1 // ------------------------------------------------
6 // Windows front end GUI, PeerCast core is not dependant on any of this.
7 // Its very messy at the moment, but then again Windows UI always is.
8 // I really don`t like programming win32 UI.. I want my borland back..
10 // (c) 2002 peercast.org
11 // ------------------------------------------------
12 // This program is free software; you can redistribute it and/or modify
13 // it under the terms of the GNU General Public License as published by
14 // the Free Software Foundation; either version 2 of the License, or
15 // (at your option) any later version.
17 // This program is distributed in the hope that it will be useful,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 // GNU General Public License for more details.
21 // ------------------------------------------------
23 #define _WIN32_WINNT 0x0500
31 #include "win32/wsys.h"
33 #include "win32/wsocket.h"
46 #include "chkMemoryLeak.h"
47 #define DEBUG_NEW new(__FILE__, __LINE__)
52 bool shownChannels=false;
53 WINDOWPLACEMENT winPlace;
56 using namespace Gdiplus;
60 void APICALL MyPeercastApp ::printLog(LogBuffer::TYPE t, const char *str)
62 /* ADDLOG(str,logID,true,NULL,t);
65 logFile.writeLine(str);
70 void APICALL MyPeercastApp::updateSettings()
75 Gdiplus::Bitmap bmpBack(800,600,PixelFormat24bppRGB);
79 Gdiplus::Image *backImage;
80 Gdiplus::Bitmap *backBmp;
81 Gdiplus::Graphics *backGra;
83 Gdiplus::Image *img_idle;
84 Gdiplus::Image *img_connect;
85 Gdiplus::Image *img_conn_ok;
86 Gdiplus::Image *img_conn_full;
87 Gdiplus::Image *img_conn_over;
88 Gdiplus::Image *img_conn_ok_skip;
89 Gdiplus::Image *img_conn_full_skip;
90 Gdiplus::Image *img_conn_over_skip;
91 Gdiplus::Image *img_error;
92 Gdiplus::Image *img_broad_ok;
93 Gdiplus::Image *img_broad_full;
99 extern HINSTANCE hInst;
104 WLock ChannelDataLock;
106 ChannelData *channelDataTop = NULL;
108 extern bool gbGetFile;
110 extern time_t gtGetFile;
111 extern time_t gtStartTime;
113 ThreadInfo gtiGetFile;
114 static char *data1URL = "http://www.idolmaster.jp/download/images/wallpaper/imas360p_800.jpg";
115 static char *data2URL = "http://www.xbox.com/NR/rdonlyres/CAB05E2F-3051-409B-A4C8-830167C1C138/0/wpr0701idolmasterw120001.jpg";
118 bool gbDispTop = false;
119 bool gbAllOpen = false;
121 THREAD_PROC FestivalStart(ThreadInfo *thread);
123 THREAD_PROC GetHostName(ThreadInfo *thread){
124 IdData *id = (IdData*)(thread->data);
130 ip = htonl(id->getIpAddr());
132 for (int i=0; i<5 && flg; i++){
133 he = gethostbyaddr((char *)&ip,sizeof(ip),AF_INET);
135 ChannelDataLock.on();
136 ChannelData* cd = channelDataTop;
140 if (cd->setName(id->getServentId(), he->h_name)){
144 cd = cd->getNextData();
148 ChannelDataLock.off();
156 bool DownloadFile(LPCTSTR URL, LPCTSTR local){
157 char header[] = "Accept: */*\r\n\r\n";
165 f.openWriteReplace(local);
166 }catch(StreamException &e){
170 hInternet = ::InternetOpen(NULL, INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
171 if (hInternet == NULL){
175 hConnect = ::InternetOpenUrl(hInternet, URL, header, strlen(header), INTERNET_FLAG_DONT_CACHE, 0);
176 if (hConnect == NULL){
177 ::InternetCloseHandle(hInternet);
184 BOOL ret = ::InternetReadFile(hConnect, buf, 4096, &dwReadSize);
186 if (dwReadSize == 0){
190 f.write(buf, dwReadSize);
192 } catch(StreamException e){
195 ::InternetCloseHandle(hConnect);
196 ::InternetCloseHandle(hInternet);
203 ::InternetCloseHandle(hConnect);
204 ::InternetCloseHandle(hInternet);
209 THREAD_PROC GetInternetFile(ThreadInfo *thread){
211 DownloadFile(data1URL, "data1.jpg");
212 DownloadFile(data2URL, "data2.jpg");
216 extern TCHAR szWindowClass3[]; // The title bar text
219 int drawSpeed(Graphics *gra, int posX, int posY){
221 //
\91¬
\93x
\95\
\8e¦
\95\94\82Ì
\94w
\8ci
\82ð
\94\92\82
\82·
\82é
222 SolidBrush b(Color(180,255,255,255));
223 backGra->FillRectangle(&b, posX, posY, 200, 14);
224 //
\83t
\83H
\83\93\83g
\90Ý
\92è
225 Font font(L"
\82l
\82r
\82o
\83S
\83V
\83b
\83N",10);
227 SolidBrush strBrush(Color::Black);
228 //
\95¶
\8e\9a\97ñ
\8dì
\90¬
230 sprintf(tmp, "R:%.1fkbps S:%.1fkbps",
231 BYTES_TO_KBPS(stats.getPerSecond(Stats::BYTESIN)-stats.getPerSecond(Stats::LOCALBYTESIN)),
232 BYTES_TO_KBPS(stats.getPerSecond(Stats::BYTESOUT)-stats.getPerSecond(Stats::LOCALBYTESOUT)));
234 //
\95¶
\8e\9a\95\
\8e¦
\94Í
\88Í
\8ew
\92è
236 format.SetAlignment(StringAlignmentCenter);
237 RectF r((REAL)posX, (REAL)posY, (REAL)200, (REAL)14);
238 //
\95¶
\8e\9a\95`
\89æ
239 gra->DrawString(bstr, -1, &font, r, &format, &strBrush);
246 void MakeBack(HWND hwnd, UINT x, UINT y){
257 backBmp = ::new Bitmap(x,y);
258 backGra = ::new Graphics(backBmp);
260 //
\91S
\82Ä
\94\92\82Å
\93h
\82è
\82Â
\82Ô
\82µ
261 SolidBrush b(Color(255,255,255,255));
262 backGra->FillRectangle(&b, 0, 0, x, y);
264 backWidth = backImage->GetWidth();
265 backHeight = backImage->GetHeight();
267 //
\94w
\8ci
\89æ
\91\9c\82ð
\95`
\89æ
268 for (UINT xx = 0; xx < x/backWidth + 1; xx++){
269 for (UINT yy = 0; yy < y/backHeight + 1; yy++){
271 if (backWidth*(xx+1) > x){
272 width = x % backWidth;
276 if (backHeight*(yy+1) > y){
277 height = y % backHeight;
281 Rect r((INT)backWidth*xx, (INT)backHeight*yy, width, height);
282 backGra->DrawImage(backImage, r, 0, 0, (INT)width, (INT)height, UnitPixel);
290 drawSpeed(backGra, winWidth-205, 5);
292 //
\83`
\83\83\83\93\83l
\83\8b\8fî
\95ñ
\82ð
\95`
\89æ
293 ChannelDataLock.on();
294 ChannelData *cd = channelDataTop;
296 posY = cd->drawChannel(backGra, 20, posY);
297 cd = cd->getNextData();
299 ChannelDataLock.off();
303 void MakeBack(HWND hwnd){
304 MakeBack(hwnd, winWidth, winHeight);
305 ::InvalidateRect(guiWnd, NULL, FALSE);
308 void ChannelData::setData(Channel *c){
311 sjis.convertTo(String::T_SJIS);
313 strncpy(name, sjis, 256);
315 channel_id = c->channel_id;
316 bitRate = c->info.bitrate;
317 lastPlayStart = c->info.lastPlayStart;
319 totalListeners = c->totalListeners();
320 totalRelays = c->totalRelays();
321 localListeners = c->localListeners();
322 localRelays = c->localRelays();
323 stayConnected = c->stayConnected;
325 bTracker = c->sourceHost.tracker;
326 lastSkipTime = c->lastSkipTime;
327 skipCount = c->skipCount;
333 int ChannelData::drawChannel(Graphics *g, int x, int y){
338 //
\88Ê
\92u
\82ð
\95Û
\91¶
344 if (getWidth() == 0){
355 //
\83`
\83\83\83\93\83l
\83\8b\95\
\8e¦
\95\94\82Ì
\94w
\8ci
\82ð
\93h
\82é
358 SolidBrush b(Color(160,49,106,197));
359 g->FillRectangle(&b, x, y, w, 14);
362 SolidBrush b(Color(160,255,255,255));
363 g->FillRectangle(&b, x, y, w, 14);
366 //
\83X
\83e
\81[
\83^
\83X
\95\
\8e¦
367 Gdiplus::Image *img = NULL;
368 unsigned int nowTime = sys->getTime();
369 switch(this->getStatus()){
370 case Channel::S_IDLE:
373 case Channel::S_SEARCHING:
374 case Channel::S_CONNECTING:
377 case Channel::S_RECEIVING:
378 if ((skipCount > 2) && (lastSkipTime + 120 > nowTime)){
380 img = img_conn_ok_skip;
382 if (chDisp.numRelays){
383 img = img_conn_full_skip;
385 img = img_conn_over_skip;
392 if (chDisp.numRelays){
400 case Channel::S_BROADCASTING:
403 case Channel::S_ERROR:
411 PointF origin(xx, yy);
412 //
\83X
\83e
\81[
\83^
\83X
\95\
\8e¦
\88Ê
\92u
413 Rect img_rect((INT)origin.X, (INT)origin.Y + 1, img ? img->GetWidth() : 12, 12);
414 //
\83X
\83e
\81[
\83^
\83X
\95`
\89æ
416 // att.SetColorKey(Color::White, Color::White, ColorAdjustTypeBitmap);
417 g->DrawImage(img, img_rect, 0, 0, img_rect.Width, 12, UnitPixel, &att);
418 //
\8e\9f\82Ì
\8aî
\93_
419 origin.X += img_rect.Width;
421 //
\83t
\83H
\83\93\83g
\90Ý
\92è
422 Gdiplus::Font font(L"
\82l
\82r
\82o
\83S
\83V
\83b
\83N",10);
424 SolidBrush *strBrush;
425 if (servMgr->getFirewall() == ServMgr::FW_ON){
426 strBrush = ::new SolidBrush(Color::Red);
427 } else if (isTracker() && (getStatus() == Channel::S_RECEIVING)){
428 strBrush = ::new SolidBrush(Color::Green);
432 strBrush = ::new SolidBrush(Color::White);
435 strBrush = ::new SolidBrush(Color::Black);
438 //
\83`
\83\83\83\93\83l
\83\8b\96¼
\95\
\8e¦
439 g->SetTextRenderingHint(TextRenderingHintAntiAlias);
440 _bstr_t bstr1(getName());
441 //
\95¶
\8e\9a\95`
\89æ
\94Í
\88Í
\8ew
\92è
442 RectF r1(origin.X, origin.Y, 120.0f, 13.0f);
444 format.SetAlignment(StringAlignmentNear);
445 g->DrawString(bstr1, -1, &font, r1, &format, strBrush);
446 //
\8e\9f\82Ì
\8aî
\93_
447 origin.X += r1.Width;
449 ////
\8fã
\97¬IP/
\83\8a\83X
\83i
\81[
\90\94/
\83\8a\83\8c\81[
\90\94\95\
\8e¦
451 ////
\82Ò
\82 \82©
\82·
\82Ì
\93®
\8dì
\95×
\8b
\97p
\81B
\83\8a\83\8a\81[
\83X
\83r
\83\8b\83h
\82Å
\82Í
\8c³
\82Ì
\83R
\81[
\83h
\82ð
\8eg
\97p
\82Ì
\8e\96\81B
452 ////
\95¶
\8e\9a\95\
\8e¦
\94Í
\88Í
\82Í
\95\9d220
\82®
\82ç
\82¢
\82Å
\82¨
\82\8b
453 //char tmp[512]; //
\95\
\8e¦
\97p
\83o
\83b
\83t
\83@
454 //char hostip[256]; // IP
\83A
\83h
\83\8c\83X
\83o
\83b
\83t
\83@
455 //chDisp.uphost.toStr(hostip); //
\8fã
\97¬IP
456 //sprintf(tmp, "%d/%d - [%d/%d] - %s",
457 // getTotalListeners(),
459 // getLocalListeners(),
464 //
\83\8a\83X
\83i
\81[
\90\94/
\83\8a\83\8c\81[
\90\94\95\
\8e¦
466 sprintf(tmp, "%d/%d - [%d/%d]", getTotalListeners(), getTotalRelays(), getLocalListeners(), getLocalRelays());
468 //
\95¶
\8e\9a\95\
\8e¦
\94Í
\88Í
\8ew
\92è
469 RectF r2(origin.X, origin.Y, 100.0f, 13.0f);
470 format.SetAlignment(StringAlignmentCenter);
471 g->DrawString(bstr2, -1, &font, r2, &format, strBrush);
472 //
\8e\9f\82Ì
\8aî
\93_
473 origin.X += r2.Width;
477 if (isStayConnected()){
478 f = ::new Font(L"Arial", 9.0f, FontStyleItalic|FontStyleBold, UnitPoint);
480 f = ::new Font(L"Arial", 9.0f);
482 sprintf(tmp, "%dkbps", getBitRate());
484 format.SetAlignment(StringAlignmentFar);
485 //
\95¶
\8e\9a\95\
\8e¦
\94Í
\88Í
\8ew
\92è
486 RectF r3(origin.X, origin.Y, 80.0f, 13.0f);
487 g->DrawString(bstr3, -1, f, r3, &format, strBrush);
488 //
\83t
\83H
\83\93\83g
\8aJ
\95ú
491 //
\8e\9f\82Ì
\8aî
\93_
492 origin.X += r3.Width;
494 //
\83u
\83\89\83V
\8dí
\8f\9c
500 int count = getServentCount();
501 // Servent
\95\
\8e¦
\95\94\82Ì
\94w
\8ci
\82ð
\94\92\82É
\82·
\82é
502 SolidBrush b(Color(160,255,255,255));
503 g->FillRectangle(&b, (INT)origin.X, (INT)origin.Y, 14*count, 14);
508 SolidBrush *serventBrush;
509 if (sd->getInfoFlg()){
510 ChanHit *hit = sd->getChanHit();
511 if (hit->firewalled){
512 SolidBrush bb(Color(180,255,0,0));
513 g->FillRectangle(&bb, (INT)origin.X + 14*index, (INT)origin.Y, 14, 14);
516 //
\83\8a\83\8c\81[
\82n
\82j
517 serventBrush = ::new SolidBrush(Color::Green);
519 //
\83\8a\83\8c\81[
\95s
\89Â
521 //
\83\8a\83\8c\81[
\88ê
\94t
522 serventBrush = ::new SolidBrush(Color::Blue);
524 //
\83\8a\83\8c\81[
\82È
\82µ
525 serventBrush = ::new SolidBrush(Color::Purple);
530 serventBrush = ::new SolidBrush(Color::Black);
533 backGra->FillRectangle(serventBrush, (INT)origin.X + index*14 + 1, (INT)origin.Y + 1, 12, 12);
535 ::delete serventBrush;
536 sd = sd->getNextData();
541 //
\8e\9f\82Ì
\8aî
\93_
544 //
\83T
\83C
\83Y
\82ð
\95Û
\91¶
545 setWidth((int)origin.X - posX);
546 setHeight((int)origin.Y - posY);
548 // ServentData
\95\
\8e¦
551 if (openFlg || sd->getSelected()){
552 sd->drawServent(g, (INT)x+12, (INT)origin.Y);
553 //
\8e\9f\82Ì
\8aî
\93_
556 sd = sd->getNextData();
560 return (int)(origin.Y);
563 bool ChannelData::checkDown(int x,int y){
564 //
\94Í
\88Í
\93à
\83`
\83F
\83b
\83N
567 && (x < posX + getWidth())
569 && (y < posY + getHeight())
576 ServentData *ChannelData::findServentData(int servent_id){
577 ServentData *sv = serventDataTop;
579 if (sv->getServentId() == servent_id){
582 sv = sv->getNextData();
587 void ChannelData::addServentData(ServentData *sd){
588 sd->setNextData(serventDataTop);
592 void ChannelData::deleteDisableServents(){
593 ServentData *sd = serventDataTop;
594 ServentData *prev = NULL;
597 if (!(sd->getEnableFlg())){
598 ServentData *next = sd->getNextData();
600 prev->setNextData(next);
602 serventDataTop = next;
608 sd = sd->getNextData();
613 int ChannelData::getServentCount(){
616 ServentData *sd = serventDataTop;
619 sd = sd->getNextData();
624 bool ChannelData::setName(int servent_id, String name){
625 ServentData *sd = serventDataTop;
627 if (sd->getServentId() == servent_id){
631 sd = sd->getNextData();
636 void ServentData::setData(Servent *s, ChanHit *hit, unsigned int listeners, unsigned int relays, bool f){
637 servent_id = s->servent_id;
640 lastSkipTime = s->lastSkipTime;
643 chanHit.numRelays = hit->numRelays;
644 chanHit.relay = hit->relay;
645 chanHit.firewalled = hit->firewalled;
646 chanHit.version = hit->version;
647 chanHit.version_vp = hit->version_vp;
648 chanHit.version_ex_number = hit->version_ex_number;
649 chanHit.version_ex_prefix[0] = hit->version_ex_prefix[0];
650 chanHit.version_ex_prefix[1] = hit->version_ex_prefix[1];
652 totalListeners = listeners;
653 totalRelays = relays;
658 int ServentData::drawServent(Gdiplus::Graphics *g, int x, int y){
663 //
\88Ê
\92u
\82ð
\95Û
\91¶
667 if (getWidth() == 0){
679 PointF origin(xx, yy);
681 //
\83t
\83H
\83\93\83g
\90Ý
\92è
682 Font font(L"
\82l
\82r
\82o
\83S
\83V
\83b
\83N",9);
684 SolidBrush *strBrush;
685 if (chanHit.firewalled){
686 strBrush = ::new SolidBrush(Color::Red);
690 strBrush = ::new SolidBrush(Color::White);
693 strBrush = ::new SolidBrush(Color::Black);
696 // ServantData
\95\
\8e¦
697 g->SetTextRenderingHint(TextRenderingHintAntiAlias);
698 //
\95¶
\8e\9a\97ñ
\8dì
\90¬
704 if (chanHit.version_ex_number){
705 //
\8ag
\92£
\83o
\81[
\83W
\83\87\83\93
706 sprintf(tmp, "%c%c%04d - %d/%d - %s(%s)",
707 chanHit.version_ex_prefix[0],
708 chanHit.version_ex_prefix[1],
709 chanHit.version_ex_number,
715 } else if (chanHit.version_vp){
716 sprintf(tmp, "VP%04d - %d/%d - %s(%s)",
724 sprintf(tmp, "(-----) - %d/%d - %s(%s)",
732 sprintf(tmp, "(-----) - %d/%d - %s(%s)",
741 //
\83X
\83e
\81[
\83^
\83X
\95\
\8e¦
742 Gdiplus::Image *img = NULL;
743 unsigned int nowTime = sys->getTime();
745 case Servent::S_CONNECTING:
748 case Servent::S_CONNECTED:
749 if (lastSkipTime + 120 > nowTime){
751 img = img_conn_ok_skip;
753 if (chanHit.numRelays){
754 img = img_conn_full_skip;
756 img = img_conn_over_skip;
763 if (chanHit.numRelays){
775 //
\95¶
\8e\9a\95`
\89æ
\94Í
\88Í
\8ew
\92è
776 RectF r1(origin.X + img->GetWidth() + 2, origin.Y, 800.0f, 13.0f);
779 format.SetAlignment(StringAlignmentNear);
780 g->MeasureString(bstr1, -1, &font, r1, &format, &r2);
782 w = (INT)r2.Width + img->GetWidth() + 2;
783 // ServentData
\95\
\8e¦
\95\94\82Ì
\94w
\8ci
\82ð
\93h
\82é
786 SolidBrush b(Color(160,49,106,197));
787 g->FillRectangle(&b, x, y, w, 13);
790 SolidBrush b(Color(160,200,200,200));
791 g->FillRectangle(&b, x, y, w, 13);
794 //
\83X
\83e
\81[
\83^
\83X
\95\
\8e¦
\88Ê
\92u
795 Rect img_rect((INT)origin.X, (INT)origin.Y+1, img ? img->GetWidth() : 12, 12);
796 //
\83X
\83e
\81[
\83^
\83X
\95`
\89æ
798 // att.SetColorKey(Color::White, Color::White, ColorAdjustTypeBitmap);
799 g->DrawImage(img, img_rect, 0, 0, img_rect.Width, 12, UnitPixel, &att);
800 //
\8e\9f\82Ì
\8aî
\93_
803 g->DrawString(bstr1, -1, &font, r2, &format, strBrush);
804 //
\8e\9f\82Ì
\8aî
\93_
805 origin.X += r2.Width;
808 setWidth((int)origin.X-posX);
809 setHeight((int)origin.Y - posY);
815 bool ServentData::checkDown(int x, int y){
818 && (x < posX + getWidth())
820 && (y < posY + getHeight())
828 THREAD_PROC GUIDataUpdate(ThreadInfo *thread){
831 // set GUI thread status to running
832 thread->finish = false;
834 while(thread->active){
835 //
\83`
\83\83\83\93\83l
\83\8b\83f
\81[
\83^
\83\8d\83b
\83N
836 ChannelDataLock.on();
837 //
\83`
\83\83\83\93\83l
\83\8b\83f
\81[
\83^
\82Ì
\8dX
\90V
\83t
\83\89\83O
\82ð
\91S
\82ÄFALSE
\82É
\82·
\82é
838 ChannelData *cd = channelDataTop;
840 // Servent
\82Ì
\8dX
\90V
\83t
\83\89\83O
\82ðFALSE
\82É
\82·
\82é
841 ServentData *sv = cd->getServentDataTop();
843 sv->setEnableFlg(FALSE);
844 sv = sv->getNextData();
846 cd->setEnableFlg(FALSE);
847 cd = cd->getNextData();
850 Channel *c = chanMgr->channel;
851 //
\8c»
\8dÝ
\91¶
\8dÝ
\82·
\82é
\83`
\83\83\83\93\83l
\83\8b\95ª
\83\8b\81[
\83v
853 //
\8aù
\82É
\83`
\83\83\83\93\83l
\83\8b\83f
\81[
\83^
\82ð
\8e\9d\82Á
\82Ä
\82¢
\82é
\82©
855 //
\94
\8c©
\83t
\83\89\83OFALSE
856 bool bFoundFlg = FALSE;
858 if (cd->getChannelId() == c->channel_id){
859 //
\8aù
\82É
\83`
\83\83\83\93\83l
\83\8b\83f
\81[
\83^
\82ª
\82 \82é
\82Ì
\82Å
\81A
\82»
\82Ì
\82Ü
\82Ü
\8dX
\90V
861 //
\8dX
\90V
\83t
\83\89\83OTRUE
862 cd->setEnableFlg(TRUE);
863 //
\94
\8c©
\83t
\83\89\83OTRUE
865 //
\83\8b\81[
\83v
\97£
\92E
868 //
\8c©
\82Â
\82©
\82ç
\82È
\82©
\82Á
\82½
\8fê
\8d\87\81A
\8e\9f\82Ì
\83f
\81[
\83^
\82ð
\83`
\83F
\83b
\83N
869 cd = cd->getNextData();
872 //
\90V
\82µ
\82¢
\83`
\83\83\83\93\83l
\83\8b\82Ì
\8fê
\8d\87\81A
\90V
\8bK
\83f
\81[
\83^
\8dì
\90¬
874 //
\90V
\8bK
\83f
\81[
\83^
\8dì
\90¬
875 cd = ::new ChannelData();
876 //
\83f
\81[
\83^
\8dX
\90V
878 //
\8dX
\90V
\83t
\83\89\83OTRUE
879 cd->setEnableFlg(TRUE);
881 //
\90V
\8bK
\83f
\81[
\83^
\82ð
\83\8a\83X
\83g
\82Ì
\90æ
\93ª
\82É
\93ü
\82ê
\82é
882 cd->setNextData(channelDataTop);
885 //
\8e\9f\82Ì
\83`
\83\83\83\93\83l
\83\8b\82ð
\8eæ
\93¾
889 //
\83`
\83\83\83\93\83l
\83\8b\82ª
\82È
\82
\82È
\82Á
\82Ä
\82¢
\82é
\8fê
\8d\87\82Ì
\8f\88\97\9d
891 ChannelData *prev = NULL;
893 //
\83f
\81[
\83^
\82ð
\8dX
\90V
\82µ
\82È
\82©
\82Á
\82½
\82©
894 if (cd->getEnableFlg() == FALSE){
895 //
\83`
\83\83\83\93\83l
\83\8b\82ª
\82È
\82
\82È
\82Á
\82Ä
\82¢
\82é
\82Ì
\82Å
\8dí
\8f\9c
897 next = cd->getNextData();
899 //
\90æ
\93ª
\82Ì
\83f
\81[
\83^
\82ð
\8dí
\8f\9c
900 channelDataTop = next;
902 //
\93r
\92\86\82Ì
\83f
\81[
\83^
\82ð
\8dí
\8f\9c
903 prev->setNextData(next);
905 //
\8e\9f\82Ì
\83f
\81[
\83^
\82Ö
908 //
\83f
\81[
\83^
\8dX
\90V
\8dÏ
\81F
\8e\9f\82Ì
\83f
\81[
\83^
\82Ö
910 cd = cd->getNextData();
914 Servent *s = servMgr->servents;
918 bool infoFlg = false;
920 bool firewalled = false;
921 unsigned int numRelays = 0;
923 char ver_ex_prefix[2] = {' ', ' '};
924 int ver_ex_number = 0;
925 //
\92¼
\89º
\83z
\83X
\83g
\8fî
\95ñ
\83`
\83F
\83b
\83N
926 unsigned int totalRelays = 0;
927 unsigned int totalListeners = 0;
930 //
\8eó
\90M
\92\86\82©
931 if ((s->type == Servent::T_RELAY) && (s->status == Servent::S_CONNECTED)){
932 //
\83z
\83X
\83g
\8fî
\95ñ
\83\8d\83b
\83N
933 chanMgr->hitlistlock.on();
934 //
\92¼
\89º
\83z
\83X
\83g
\82ª
\8eó
\90M
\82µ
\82Ä
\82¢
\82é
\83`
\83\83\83\93\83l
\83\8b\82Ì
\83z
\83X
\83g
\8fî
\95ñ
\82ð
\8eæ
\93¾
935 chl = chanMgr->findHitListByID(s->chanID);
936 //
\83`
\83\83\83\93\83l
\83\8b\82Ì
\83z
\83X
\83g
\8fî
\95ñ
\82ª
\82 \82é
\82©
938 //
\83`
\83\83\83\93\83l
\83\8b\82Ì
\83z
\83X
\83g
\8fî
\95ñ
\82ª
\82 \82é
\8fê
\8d\87
939 ChanHit *hit = chl->hit;
940 //
\81@
\83`
\83\83\83\93\83l
\83\8b\82Ì
\83z
\83X
\83g
\8fî
\95ñ
\82ð
\91S
\91\96\8d¸
\82µ
\82Ä
942 // ID
\82ª
\93¯
\82¶
\82à
\82Ì
\82Å
\82 \82ê
\82Î
943 if (hit->servent_id == s->servent_id){
944 //
\83g
\81[
\83^
\83\8b\83\8a\83\8c\81[
\82Æ
\83g
\81[
\83^
\83\8b\83\8a\83X
\83i
\81[
\82ð
\89Á
\8eZ
945 totalRelays += hit->numRelays;
946 totalListeners += hit->numListeners;
947 //
\92¼
\89º
\82Å
\82 \82ê
\82Î
948 if (hit->numHops == 1){
949 //
\8fî
\95ñ
\82ð
\88ê
\92U
\95Û
\91¶
951 hitData.relay = hit->relay;
952 hitData.firewalled = hit->firewalled;
953 hitData.numRelays = hit->numRelays;
954 hitData.version_vp = hit->version_vp;
955 hitData.version_ex_prefix[0] = hit->version_ex_prefix[0];
956 hitData.version_ex_prefix[1] = hit->version_ex_prefix[1];
957 hitData.version_ex_number = hit->version_ex_number;
960 //
\8e\9f\82ð
\83`
\83F
\83b
\83N
965 //
\83`
\83\83\83\93\83l
\83\8b\83f
\81[
\83^
\82©
\82çServent
\82ð
\8c\9f\8dõ
966 bool bFoundFlg = FALSE;
969 ServentData *sv = cd->findServentData(s->servent_id);
970 // ServentData
\82ª
\82 \82ê
\82Î
972 //
\83f
\81[
\83^
\90Ý
\92è
973 sv->setData(s, &hitData, totalListeners, totalRelays, infoFlg);
974 sv->setEnableFlg(TRUE);
978 cd = cd->getNextData();
980 // ServentData
\82ª
\8c©
\82Â
\82©
\82ç
\82È
\82©
\82Á
\82½
\8fê
\8d\87
982 //
\83`
\83\83\83\93\83l
\83\8b\83f
\81[
\83^
\82ð
\92T
\82·
985 //
\83`
\83\83\83\93\83l
\83\8bID
\82ª
\93¯
\82¶
\82©
986 if (cd->getChannelId() == s->channel_id){
987 //
\83f
\81[
\83^
\90Ý
\92è
988 ServentData *sv = ::new ServentData();
989 sv->setData(s, &hitData, totalListeners, totalRelays, infoFlg);
990 sv->setEnableFlg(TRUE);
991 //
\83`
\83\83\83\93\83l
\83\8b\83f
\81[
\83^
\82ÉServentData
\92Ç
\89Á
992 cd->addServentData(sv);
993 //
\83z
\83X
\83g
\96¼
\82ð
\8eæ
\93¾
\82·
\82é
994 IdData *id = ::new IdData(cd->getChannelId(), sv->getServentId(), sv->getHost().ip);
996 t.func = GetHostName;
998 sys->startThread(&t);
999 //
\83\8b\81[
\83v
\8fI
\97¹
1002 //
\8e\9f\82Ì
\83f
\81[
\83^
\82Ö
1003 cd = cd->getNextData();
1006 //
\83z
\83X
\83g
\8fî
\95ñ
\83A
\83\93\83\8d\83b
\83N
1007 chanMgr->hitlistlock.off();
1012 //
\8dX
\90V
\82µ
\82Ä
\82¢
\82È
\82¢ServentData
\82ð
\8dí
\8f\9c
1013 cd = channelDataTop;
1015 cd->deleteDisableServents();
1016 cd = cd->getNextData();
1019 //
\83`
\83\83\83\93\83l
\83\8b\83f
\81[
\83^
\83A
\83\93\83\8d\83b
\83N
1020 ChannelDataLock.off();
1027 // 0.1
\95b
\81~10
\82Å1
\95b
\91Ò
\82¿
1030 if (!thread->active)
1035 if (gbGetFile && (sys->getTime() > gtGetFile)){
1037 gtiGetFile.func = GetInternetFile;
1038 gtiGetFile.data = NULL;
1039 sys->startThread(>iGetFile);
1041 else if (gbStart && (sys->getTime() > gtStartTime)){
1043 SendMessage(guiWnd, WM_START, 0, 0);
1044 gtiStart.func = FestivalStart;
1045 gtiStart.data = NULL;
1046 sys->startThread(>iStart);
1050 // set GUI thread status to terminated
1051 thread->finish = true;
1056 ChannelData *findChannelData(int channel_id){
1057 ChannelData *cd = channelDataTop;
1060 if (cd->getChannelId() == channel_id){
1063 cd = cd->getNextData();
1070 void PopupChannelMenu(int channel_id){
1072 MENUITEMINFO info, separator;
1076 hMenu = CreatePopupMenu();
1078 memset(&separator, 0, sizeof(MENUITEMINFO));
1079 separator.cbSize = sizeof(MENUITEMINFO);
1080 separator.fMask = MIIM_ID | MIIM_TYPE;
1081 separator.fType = MFT_SEPARATOR;
1082 separator.wID = 8000;
1084 memset(&info, 0, sizeof(MENUITEMINFO));
1085 info.cbSize = sizeof(MENUITEMINFO);
1086 info.fMask = MIIM_ID | MIIM_TYPE;
1087 info.fType = MFT_STRING;
1089 ChannelData *cd = findChannelData(channel_id);
1096 info.dwTypeData = "
\90Ø
\92f";
1097 InsertMenuItem(hMenu, -1, true, &info);
1099 InsertMenuItem(hMenu, -1, true, &separator);
1102 info.dwTypeData = "
\8dÄ
\90¶";
1103 InsertMenuItem(hMenu, -1, true, &info);
1105 InsertMenuItem(hMenu, -1, true, &separator);
1108 info.dwTypeData = "
\8dÄ
\90Ú
\91±";
1109 InsertMenuItem(hMenu, -1, true, &info);
1112 info.dwTypeData = "
\83L
\81[
\83v";
1113 InsertMenuItem(hMenu, -1, true, &info);
1115 InsertMenuItem(hMenu, -1, true, &separator);
1117 if (!cd->getOpenFlg()){
1119 info.dwTypeData = "
\92¼
\89º
\95\
\8e¦";
1120 InsertMenuItem(hMenu, -1, true, &info);
1123 info.dwTypeData = "
\92¼
\89º
\89B
\95Á";
1124 InsertMenuItem(hMenu, -1, true, &info);
1128 dwID = TrackPopupMenu(hMenu, TPM_LEFTALIGN|TPM_RETURNCMD, pos.x, pos.y, 0, guiWnd, NULL);
1132 cd = findChannelData(channel_id);
1138 Channel *c = chanMgr->findChannelByChannelID(channel_id);
1145 case 1000: //
\8dÄ
\90¶
1146 chanMgr->playChannel(c->info);
1149 case 1001: //
\90Ø
\92f
1150 c->thread.active = false;
1151 c->thread.finish = true;
1154 case 1002: //
\8dÄ
\90Ú
\91±
1155 //
\92¼
\89º
\82©
\82Â
\8eó
\90M
\92\86\82Å
\82 \82ê
\82Î
\8am
\94F
\83\81\83b
\83Z
\81[
\83W
\95\
\8e¦
1156 if (cd->isTracker() && cd->getStatus() == Channel::S_RECEIVING)
1159 id = MessageBox(guiWnd,
1160 "
\92¼
\89º
\82Å
\82·
\82ª
\8dÄ
\90Ú
\91±
\82µ
\82Ü
\82·
\82©
\81H",
1161 "
\92¼
\89º
\8cx
\8d\90",
1162 MB_YESNO|MB_ICONQUESTION|MB_DEFBUTTON2);
1170 case 1003: //
\83L
\81[
\83v
1171 if (!c->stayConnected){
1172 c->stayConnected = true;
1174 c->stayConnected = false;
1178 case 1004: //
\92¼
\89º
\95\
\8e¦
1179 cd->setOpenFlg(TRUE);
1183 case 1005: //
\92¼
\89º
\89B
\95Á
1184 cd->setOpenFlg(FALSE);
1190 void PopupServentMenu(int servent_id){
1192 MENUITEMINFO info, separator;
1196 hMenu = CreatePopupMenu();
1198 memset(&separator, 0, sizeof(MENUITEMINFO));
1199 separator.cbSize = sizeof(MENUITEMINFO);
1200 separator.fMask = MIIM_ID | MIIM_TYPE;
1201 separator.fType = MFT_SEPARATOR;
1202 separator.wID = 8000;
1204 memset(&info, 0, sizeof(MENUITEMINFO));
1205 info.cbSize = sizeof(MENUITEMINFO);
1206 info.fMask = MIIM_ID | MIIM_TYPE;
1207 info.fType = MFT_STRING;
1209 ServentData *sd = NULL;
1210 ChannelData *cd = channelDataTop;
1212 sd = cd->findServentData(servent_id);
1216 cd = cd->getNextData();
1219 if (cd == NULL || sd == NULL){
1224 info.dwTypeData = "
\90Ø
\92f";
1225 InsertMenuItem(hMenu, -1, true, &info);
1227 // InsertMenuItem(hMenu, -1, true, &separator);
1230 dwID = TrackPopupMenu(hMenu, TPM_LEFTALIGN|TPM_RETURNCMD, pos.x, pos.y, 0, guiWnd, NULL);
1234 cd = channelDataTop;
1236 sd = cd->findServentData(servent_id);
1240 cd = cd->getNextData();
1243 if (cd == NULL || sd == NULL){
1247 Servent *s = servMgr->findServentByServentID(servent_id);
1254 case 1001: //
\90Ø
\92f
1255 s->thread.active = false;
1261 void PopupOtherMenu(){
1263 MENUITEMINFO info, separator;
1267 hMenu = CreatePopupMenu();
1269 memset(&separator, 0, sizeof(MENUITEMINFO));
1270 separator.cbSize = sizeof(MENUITEMINFO);
1271 separator.fMask = MIIM_ID | MIIM_TYPE;
1272 separator.fType = MFT_SEPARATOR;
1273 separator.wID = 8000;
1275 memset(&info, 0, sizeof(MENUITEMINFO));
1276 info.cbSize = sizeof(MENUITEMINFO);
1277 info.fMask = MIIM_ID | MIIM_TYPE;
1278 info.fType = MFT_STRING;
1282 info.dwTypeData = "
\8dÅ
\91O
\96Ê
\95\
\8e¦";
1283 InsertMenuItem(hMenu, -1, true, &info);
1286 info.dwTypeData = "
\8dÅ
\91O
\96Ê
\89ð
\8f\9c";
1287 InsertMenuItem(hMenu, -1, true, &info);
1290 InsertMenuItem(hMenu, -1, true, &separator);
1294 info.dwTypeData = "
\91S
\92¼
\89º
\93W
\8aJ";
1295 InsertMenuItem(hMenu, -1, true, &info);
1298 info.dwTypeData = "
\91S
\92¼
\89º
\89B
\95Á";
1299 InsertMenuItem(hMenu, -1, true, &info);
1302 InsertMenuItem(hMenu, -1, true, &separator);
1304 if (!servMgr->autoServe){
1306 info.dwTypeData = "
\97L
\8cø";
1307 InsertMenuItem(hMenu, -1, true, &info);
1310 info.dwTypeData = "
\96³
\8cø";
1311 InsertMenuItem(hMenu, -1, true, &info);
1315 dwID = TrackPopupMenu(hMenu, TPM_LEFTALIGN|TPM_RETURNCMD, pos.x, pos.y, 0, guiWnd, NULL);
1319 ChannelData *cd = channelDataTop;
1322 case 1101: //
\8dÅ
\91O
\96Ê
\95\
\8e¦
1324 ::SetWindowPos(guiWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
1327 case 1102: //
\8dÅ
\91O
\96Ê
\89ð
\8f\9c
1329 ::SetWindowPos(guiWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
1332 case 1103: //
\91S
\92¼
\89º
\93W
\8aJ
1335 cd->setOpenFlg(true);
1336 cd = cd->getNextData();
1340 case 1104: //
\91S
\92¼
\89º
\89B
\95Á
1343 cd->setOpenFlg(false);
1344 cd = cd->getNextData();
1348 case 1105: //
\97L
\8cø
1349 servMgr->autoServe = true;
1352 case 1106: //
\96³
\8cø
1353 servMgr->autoServe = false;
1359 void WmCreateProc(HWND hwnd){
1360 //
\8e©
\93®
\8dÅ
\91O
\96Ê
\8b@
\94\
1361 if (servMgr->topmostGui)
1369 _bstr_t bstr("back.jpg");
1370 backImage = ::new Image(bstr);
1372 MakeBack(hwnd, 800, 600);
1374 guiThread.func = GUIDataUpdate;
1375 if (!sys->startThread(&guiThread)){
1376 MessageBox(hwnd,"Unable to start GUI","PeerCast",MB_OK|MB_ICONERROR);
1377 PostMessage(hwnd,WM_DESTROY,0,0);
1380 SetWindowPlacement(hwnd, &winPlace);
1385 ::delete img_connect;
1386 ::delete img_conn_ok;
1387 ::delete img_conn_full;
1388 ::delete img_conn_over;
1389 ::delete img_conn_ok_skip;
1390 ::delete img_conn_full_skip;
1391 ::delete img_conn_over_skip;
1393 ::delete img_broad_ok;
1394 ::delete img_broad_full;
1396 bstr = L"ST_IDLE.bmp";
1397 img_idle = ::new Image(bstr);
1398 bstr = L"ST_CONNECT.bmp";
1399 img_connect = ::new Image(bstr);
1400 bstr = L"ST_CONN_OK.bmp";
1401 img_conn_ok = ::new Image(bstr);
1402 bstr = L"ST_CONN_FULL.bmp";
1403 img_conn_full = ::new Image(bstr);
1404 bstr = L"ST_CONN_OVER.bmp";
1405 img_conn_over = ::new Image(bstr);
1406 bstr = L"ST_CONN_OK_SKIP.bmp";
1407 img_conn_ok_skip = ::new Image(bstr);
1408 bstr = L"ST_CONN_FULL_SKIP.bmp";
1409 img_conn_full_skip = ::new Image(bstr);
1410 bstr = L"ST_CONN_OVER_SKIP.bmp";
1411 img_conn_over_skip = ::new Image(bstr);
1412 bstr = L"ST_ERROR.bmp";
1413 img_error = ::new Image(bstr);
1414 bstr = L"ST_BROAD_OK.bmp";
1415 img_broad_ok = ::new Image(bstr);
1416 bstr = L"ST_BROAD_FULL.bmp";
1417 img_broad_full = ::new Image(bstr);
1420 void WmPaintProc(HWND hwnd){
1426 hdc = BeginPaint(hwnd, &paint);
1427 RECT *rcRect; //
\95`
\89æ
\94Í
\88Í
1428 rcRect = &(paint.rcPaint);
1429 LONG width = rcRect->right - rcRect->left + 1;
1430 LONG height = rcRect->bottom - rcRect->top + 1;
1433 Rect r(rcRect->left, rcRect->top, width, height);
1434 g2.DrawImage(backBmp,r, rcRect->left, rcRect->top, width, height, UnitPixel);
1435 EndPaint(hwnd, &paint);
1440 void WmSizeProc(HWND hwnd, LPARAM lParam){
1441 UINT width = LOWORD(lParam);
1442 UINT height = HIWORD(lParam);
1444 MakeBack(hwnd, width, height);
1448 void WmLButtonDownProc(HWND hwnd, LPARAM lParam){
1450 bool changeFlg = FALSE;
1452 ChannelDataLock.on();
1453 cd = channelDataTop;
1455 int x = LOWORD(lParam);
1456 int y = HIWORD(lParam);
1457 if (cd->checkDown(LOWORD(lParam), HIWORD(lParam))){
1458 if (!(cd->isSelected())){
1461 cd->setSelected(TRUE);
1463 if (cd->isSelected()){
1466 cd->setSelected(FALSE);
1468 int sx = cd->getPosX() + cd->getWidth();
1469 int sy = cd->getPosY();
1471 ServentData *sd = cd->getServentDataTop();
1473 if ( ( (!cd->getOpenFlg())
1474 && (sx + index*14 < x)
1475 && (x < sx + (index+1)*14)
1478 || sd->checkDown(LOWORD(lParam), HIWORD(lParam))
1480 if (!sd->getSelected()){
1483 sd->setSelected(TRUE);
1485 if (sd->getSelected()){
1488 sd->setSelected(FALSE);
1490 sd = sd->getNextData();
1493 cd = cd->getNextData();
1495 ChannelDataLock.off();
1501 void WmLButtonDblclkProc(HWND hwnd, LPARAM lParam){
1503 bool changeFlg = FALSE;
1505 ChannelDataLock.on();
1506 cd = channelDataTop;
1508 int x = LOWORD(lParam);
1509 int y = HIWORD(lParam);
1510 if (cd->checkDown(LOWORD(lParam), HIWORD(lParam))){
1511 if (!(cd->isSelected())){
1514 if (!(cd->getOpenFlg())){
1516 cd->setOpenFlg(TRUE);
1519 cd->setOpenFlg(FALSE);
1521 cd->setSelected(TRUE);
1523 if (cd->isSelected()){
1526 cd->setSelected(FALSE);
1528 /* int sx = cd->getPosX() + cd->getWidth();
1529 int sy = cd->getPosY();
1531 ServentData *sd = cd->getServentDataTop();
1533 if ( ( (!cd->getOpenFlg())
1534 && (sx + index*14 < x)
1535 && (x < sx + (index+1)*14)
1538 || sd->checkDown(LOWORD(lParam), HIWORD(lParam))
1540 if (!sd->getSelected()){
1543 sd->setSelected(TRUE);
1545 if (sd->getSelected()){
1548 sd->setSelected(FALSE);
1550 sd = sd->getNextData();
1553 cd = cd->getNextData();
1555 ChannelDataLock.off();
1561 void WmRButtonDownProc(HWND hwnd, LPARAM lParam){
1563 bool changeFlg = FALSE;
1564 bool channel_selected = FALSE;
1565 bool servent_selected = FALSE;
1569 cd = channelDataTop;
1571 if (cd->checkDown(LOWORD(lParam), HIWORD(lParam))){
1572 if (!(cd->isSelected())){
1575 cd->setSelected(TRUE);
1576 channel_id = cd->getChannelId();
1577 channel_selected = TRUE;
1579 if (cd->isSelected()){
1582 cd->setSelected(FALSE);
1584 ServentData *sd = cd->getServentDataTop();
1586 if (sd->checkDown(LOWORD(lParam), HIWORD(lParam))){
1587 if (!sd->getSelected()){
1590 sd->setSelected(TRUE);
1591 servent_id = sd->getServentId();
1592 servent_selected = TRUE;
1594 if (sd->getSelected()){
1597 sd->setSelected(FALSE);
1599 sd = sd->getNextData();
1601 cd = cd->getNextData();
1607 if (channel_selected){
1608 PopupChannelMenu(channel_id);
1609 } else if (servent_selected){
1610 PopupServentMenu(servent_id);
1616 LRESULT CALLBACK GUIProc (HWND hwnd, UINT message,
1617 WPARAM wParam, LPARAM lParam)
1620 case WM_CREATE: //
\83E
\83B
\83\93\83h
\83E
\8dì
\90¬
1624 case WM_PAINT: //
\95`
\89æ
1628 case WM_SIZE: //
\83T
\83C
\83Y
\95Ï
\8dX
1629 WmSizeProc(hwnd,lParam);
1632 case WM_LBUTTONDOWN: //
\8d¶
\83{
\83^
\83\93\89\9f\82·
1633 WmLButtonDownProc(hwnd,lParam);
1636 case WM_RBUTTONDOWN: //
\89E
\83{
\83^
\83\93\89\9f\82·
1637 WmRButtonDownProc(hwnd,lParam);
1640 case WM_LBUTTONDBLCLK: //
\8d¶
\83_
\83u
\83\8b\83N
\83\8a\83b
\83N
1641 WmLButtonDblclkProc(hwnd,lParam);
1644 case WM_ERASEBKGND: //
\94w
\8ci
\8fÁ
\8b\8e
1645 return TRUE; //
\94w
\8ci
\82Í
\8fÁ
\82³
\82È
\82¢
1649 // ::delete backImage;
1650 // backImage = NULL;
1652 GetWindowPlacement(hwnd, &winPlace);
1654 DestroyWindow( hwnd );
1657 GetWindowPlacement(hwnd, &winPlace);
1659 guiThread.active = false;
1661 // wait until GUI thread terminated,
1662 // and then dispose background image.
1665 if (guiThread.finish)
1677 ghStart = ::CreateWindow(szWindowClass3,
1679 WS_OVERLAPPEDWINDOW & ~(WS_MAXIMIZEBOX),
1688 ::ShowWindow(ghStart, SW_SHOWNORMAL);
1692 return (DefWindowProc(hwnd, message, wParam, lParam));
1698 Gdiplus::Image *data1 = NULL;
1699 Gdiplus::Image *data2 = NULL;
1700 Gdiplus::Bitmap *startBmp = NULL;
1701 Gdiplus::Graphics *startGra = NULL;
1702 WLock MakeStartLock;
1704 LRESULT CALLBACK StartProc (HWND hwnd, UINT message,
1705 WPARAM wParam, LPARAM lParam)
1707 SolidBrush b(Color::Black);
1712 startBmp = ::new Bitmap(400,300);
1713 startGra = ::new Graphics(startBmp);
1714 bstr = L"data1.jpg";
1715 data1 = ::new Image(bstr);
1716 bstr = L"data2.jpg";
1717 data2 = ::new Image(bstr);
1718 //
\8d\95\82Å
\93h
\82è
\82Â
\82Ô
\82µ
1719 startGra->FillRectangle(&b, 0, 0, 400, 300);
1727 hdc = BeginPaint(hwnd, &paint);
1729 rcRect = &(paint.rcPaint);
1730 LONG width = rcRect->right - rcRect->left + 1;
1731 LONG height = rcRect->bottom - rcRect->top + 1;
1734 Rect r(rcRect->left, rcRect->top, width, height);
1735 g2.DrawImage(startBmp, r, rcRect->left, rcRect->top, width, height, UnitPixel);
1736 EndPaint(hwnd, &paint);
1737 MakeStartLock.off();
1743 DestroyWindow(ghStart);
1759 return (DefWindowProc(hwnd, message, wParam, lParam));
1765 THREAD_PROC FestivalStart(ThreadInfo *thread){
1767 while(startGra==NULL){
1774 Font font(L"
\82l
\82r
\82o
\83S
\83V
\83b
\83N",40);
1775 StringFormat format;
1776 format.SetAlignment(StringAlignmentCenter);
1777 startGra->SetTextRenderingHint(TextRenderingHintAntiAlias);
1778 PointF origin(199.0f,49.0f);
1779 RectF rect(0,0,400,100);
1780 LinearGradientBrush b1(rect, Color::LightSkyBlue, Color::White, LinearGradientModeHorizontal);
1781 startGra->DrawString(L"
\91æ
\82Q
\89ñ", -1, &font, origin, &format, &b1);
1783 LinearGradientBrush b2(rect, Color::LightGreen, Color::White, LinearGradientModeHorizontal);
1784 startGra->DrawString(L"
\83A
\83C
\83h
\83\8b\83}
\83X
\83^
\81[", -1, &font, origin, &format, &b2);
1786 LinearGradientBrush b3(rect, Color::LightGoldenrodYellow, Color::White, LinearGradientModeHorizontal);
1787 startGra->DrawString(L"
\83t
\83@
\83\93\8a´
\8eÓ
\8dÕ", -1, &font, origin, &format, &b3);
1788 MakeStartLock.off();
1789 InvalidateRect(ghStart, NULL, FALSE);
1793 startGra->DrawImage(data1, Rect(0,0,80,400), 200,200,66,330, UnitPixel);
1794 MakeStartLock.off();
1795 InvalidateRect(ghStart, NULL, FALSE);
1799 startGra->DrawImage(data1, Rect(80,0,80,400), 266,200,66,330, UnitPixel);
1800 MakeStartLock.off();
1801 InvalidateRect(ghStart, NULL, FALSE);
1805 startGra->DrawImage(data1, Rect(160,0,80,400), 332,200,66,330, UnitPixel);
1806 MakeStartLock.off();
1807 InvalidateRect(ghStart, NULL, FALSE);
1811 startGra->DrawImage(data1, Rect(240,0,80,400), 398,200,66,330, UnitPixel);
1812 MakeStartLock.off();
1813 InvalidateRect(ghStart, NULL, FALSE);
1817 startGra->DrawImage(data1, Rect(320,0,80,400), 464,200,66,330, UnitPixel);
1818 MakeStartLock.off();
1819 InvalidateRect(ghStart, NULL, FALSE);
1823 startGra->DrawImage(data1, Rect(0,0,80,400), 530,200,54,270, UnitPixel);
1824 MakeStartLock.off();
1825 InvalidateRect(ghStart, NULL, FALSE);
1829 startGra->DrawImage(data1, Rect(80,0,80,400), 584,200,54,270, UnitPixel);
1830 MakeStartLock.off();
1831 InvalidateRect(ghStart, NULL, FALSE);
1835 startGra->DrawImage(data1, Rect(160,0,80,400), 638,200,54,270, UnitPixel);
1836 MakeStartLock.off();
1837 InvalidateRect(ghStart, NULL, FALSE);
1841 startGra->DrawImage(data1, Rect(240,0,80,400), 692,200,54,270, UnitPixel);
1842 MakeStartLock.off();
1843 InvalidateRect(ghStart, NULL, FALSE);
1847 startGra->DrawImage(data1, Rect(320,0,80,400), 746,200,54,270, UnitPixel);
1848 MakeStartLock.off();
1849 InvalidateRect(ghStart, NULL, FALSE);
1852 for (int i=1; i<=10; i++){
1854 1.0f, 0.0f, 0.0f, 0.0f, 0.0f,
1855 0.0f, 1.0f, 0.0f, 0.0f, 0.0f,
1856 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,
1857 0.0f, 0.0f, 0.0f, 0.1f*i, 0.0f,
1858 0.0f, 0.0f, 0.0f, 0.0f, 1.0f};
1859 ImageAttributes att;
1862 att.SetColorMatrix(&mtx, ColorMatrixFlagsDefault, ColorAdjustTypeBitmap);
1863 startGra->DrawImage(data2, Rect(0,0,400,300), 360,130,400,300, UnitPixel, &att);
1864 MakeStartLock.off();
1865 InvalidateRect(ghStart, NULL, FALSE);
1872 INT style = FontStyleBold;
1873 Font font2(L"
\82l
\82r
\82o
\83S
\83V
\83b
\83N",70,style,UnitPoint);
1874 PointF origin2(199.0f,99.0f);
1875 SolidBrush bs(Color::Black);
1876 startGra->DrawString(L"START!", -1, &font2, origin2, &format, &bs);
1877 Font font3(L"
\82l
\82r
\82o
\83S
\83V
\83b
\83N",70,style,UnitPoint);
1878 LinearGradientBrush bx(rect, Color::LightPink, Color::DeepPink, LinearGradientModeHorizontal);
1879 startGra->DrawString(L"START!", -1, &font3, origin2, &format, &bx);
1880 MakeStartLock.off();
1881 InvalidateRect(ghStart, NULL, FALSE);
1884 SendMessage(ghStart, WM_CLOSE, 0, 0);