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
25 #include "ws2tcpip.h" // getnameinfo
26 #include "wspiapi.h" // compatibility for Win2k and earlier
34 #include "win32/wsys.h"
36 #include "win32/wsocket.h"
49 #include "chkMemoryLeak.h"
50 #define DEBUG_NEW new(__FILE__, __LINE__)
55 bool shownChannels=false;
56 WINDOWPLACEMENT winPlace;
59 using namespace Gdiplus;
63 void APICALL MyPeercastApp ::printLog(LogBuffer::TYPE t, const char *str)
65 /* ADDLOG(str,logID,true,NULL,t);
68 logFile.writeLine(str);
73 void APICALL MyPeercastApp::updateSettings()
78 Gdiplus::Bitmap bmpBack(800,600,PixelFormat24bppRGB);
82 Gdiplus::Image *backImage;
83 Gdiplus::Bitmap *backBmp;
84 Gdiplus::Graphics *backGra;
86 Gdiplus::Image *img_idle;
87 Gdiplus::Image *img_connect;
88 Gdiplus::Image *img_conn_ok;
89 Gdiplus::Image *img_conn_full;
90 Gdiplus::Image *img_conn_over;
91 Gdiplus::Image *img_conn_ok_skip;
92 Gdiplus::Image *img_conn_full_skip;
93 Gdiplus::Image *img_conn_over_skip;
94 Gdiplus::Image *img_error;
95 Gdiplus::Image *img_broad_ok;
96 Gdiplus::Image *img_broad_full;
102 extern HINSTANCE hInst;
107 WLock ChannelDataLock;
109 ChannelData *channelDataTop = NULL;
111 bool gbDispTop = false;
112 bool gbAllOpen = false;
114 THREAD_PROC GetHostName(ThreadInfo *thread){
115 IdData *id = (IdData*)(thread->data);
119 struct sockaddr_in sa;
126 ip = htonl(id->getIpAddr());
128 memset(&sa, 0, sizeof(sa));
129 sa.sin_addr.S_un.S_addr = ip;
130 sa.sin_family = AF_INET;
132 for (int i=0; i<10 && flg; i++){
133 error = getnameinfo(reinterpret_cast<sockaddr*>(&sa), sizeof(sa), host, sizeof(host)/sizeof(host[0]), NULL, 0, NI_NAMEREQD);
141 case WSAHOST_NOT_FOUND:
142 LOG_ERROR("cannot resolve host for %s",
143 ((tmp = inet_ntoa(sa.sin_addr)) ? tmp : ""));
148 LOG_ERROR("an error occurred while resolving hostname of %s (%ld)",
149 ((tmp = inet_ntoa(sa.sin_addr)) ? tmp : ""), error);
156 for (flg=TRUE, findFlg=FALSE; flg; )
158 ChannelDataLock.on();
159 ChannelData* cd = channelDataTop;
162 if (cd->getChannelId() == id->getChannelId())
166 if (cd->findServentData(id->getServentId()))
168 if (cd->setName(id->getServentId(), host))
170 LOG_DEBUG("successfully resolved(%d)", id->getServentId());
175 LOG_ERROR("cannot update servent data with resolved information");
181 LOG_DEBUG("servent data has been removed");
187 cd = cd->getNextData();
191 ChannelDataLock.off();
195 LOG_DEBUG("servent data has been removed(channel)");
206 int drawSpeed(Graphics *gra, int posX, int posY){
208 //
\91¬
\93x
\95\
\8e¦
\95\94\82Ì
\94w
\8ci
\82ð
\94\92\82
\82·
\82é
209 SolidBrush b(Color(180,255,255,255));
210 backGra->FillRectangle(&b, posX, posY, 200, 14);
211 //
\83t
\83H
\83\93\83g
\90Ý
\92è
212 Font font(L"
\82l
\82r
\82o
\83S
\83V
\83b
\83N",10);
214 SolidBrush strBrush(Color::Black);
215 //
\95¶
\8e\9a\97ñ
\8dì
\90¬
217 sprintf(tmp, "R:%.1fkbps S:%.1fkbps",
218 BYTES_TO_KBPS(stats.getPerSecond(Stats::BYTESIN)-stats.getPerSecond(Stats::LOCALBYTESIN)),
219 BYTES_TO_KBPS(stats.getPerSecond(Stats::BYTESOUT)-stats.getPerSecond(Stats::LOCALBYTESOUT)));
221 //
\95¶
\8e\9a\95\
\8e¦
\94Í
\88Í
\8ew
\92è
223 format.SetAlignment(StringAlignmentCenter);
224 RectF r((REAL)posX, (REAL)posY, (REAL)200, (REAL)14);
225 //
\95¶
\8e\9a\95`
\89æ
226 gra->DrawString(bstr, -1, &font, r, &format, &strBrush);
233 void MakeBack(HWND hwnd, UINT x, UINT y){
244 backBmp = ::new Bitmap(x,y);
245 backGra = ::new Graphics(backBmp);
247 //
\91S
\82Ä
\94\92\82Å
\93h
\82è
\82Â
\82Ô
\82µ
248 SolidBrush b(Color(255,255,255,255));
249 backGra->FillRectangle(&b, 0, 0, x, y);
251 backWidth = backImage->GetWidth();
252 backHeight = backImage->GetHeight();
254 //
\94w
\8ci
\89æ
\91\9c\82ð
\95`
\89æ
255 for (UINT xx = 0; xx < x/backWidth + 1; xx++){
256 for (UINT yy = 0; yy < y/backHeight + 1; yy++){
258 if (backWidth*(xx+1) > x){
259 width = x % backWidth;
263 if (backHeight*(yy+1) > y){
264 height = y % backHeight;
268 Rect r((INT)backWidth*xx, (INT)backHeight*yy, width, height);
269 backGra->DrawImage(backImage, r, 0, 0, (INT)width, (INT)height, UnitPixel);
277 drawSpeed(backGra, winWidth-205, 5);
279 //
\83`
\83\83\83\93\83l
\83\8b\8fî
\95ñ
\82ð
\95`
\89æ
280 ChannelDataLock.on();
281 ChannelData *cd = channelDataTop;
283 posY = cd->drawChannel(backGra, 20, posY);
284 cd = cd->getNextData();
286 ChannelDataLock.off();
290 void MakeBack(HWND hwnd){
291 MakeBack(hwnd, winWidth, winHeight);
292 ::InvalidateRect(guiWnd, NULL, FALSE);
295 void ChannelData::setData(Channel *c){
298 sjis.convertTo(String::T_SJIS);
300 strncpy(name, sjis, 256);
302 channel_id = c->channel_id;
303 bitRate = c->info.bitrate;
304 lastPlayStart = c->info.lastPlayStart;
306 totalListeners = c->totalListeners();
307 totalRelays = c->totalRelays();
308 localListeners = c->localListeners();
309 localRelays = c->localRelays();
310 stayConnected = c->stayConnected;
312 bTracker = c->sourceHost.tracker;
313 lastSkipTime = c->lastSkipTime;
314 skipCount = c->skipCount;
320 int ChannelData::drawChannel(Graphics *g, int x, int y){
325 //
\88Ê
\92u
\82ð
\95Û
\91¶
331 if (getWidth() == 0){
342 //
\83`
\83\83\83\93\83l
\83\8b\95\
\8e¦
\95\94\82Ì
\94w
\8ci
\82ð
\93h
\82é
345 SolidBrush b(Color(160,49,106,197));
346 g->FillRectangle(&b, x, y, w, 14);
349 SolidBrush b(Color(160,255,255,255));
350 g->FillRectangle(&b, x, y, w, 14);
353 //
\83X
\83e
\81[
\83^
\83X
\95\
\8e¦
354 Gdiplus::Image *img = NULL;
355 unsigned int nowTime = sys->getTime();
356 if (this->type != Servent::T_COUT)
359 Channel *ch = chanMgr->findChannelByChannelID(this->channel_id);
360 switch(this->getStatus()){
361 case Channel::S_IDLE:
364 case Channel::S_SEARCHING:
365 case Channel::S_CONNECTING:
368 case Channel::S_RECEIVING:
369 if ((skipCount > 2) && (lastSkipTime + 120 > nowTime)){
371 img = img_conn_ok_skip;
373 if (chDisp.numRelays){
374 img = img_conn_full_skip;
376 img = img_conn_over_skip;
383 if (chDisp.numRelays){
391 case Channel::S_BROADCASTING:
394 case Channel::S_ERROR:
395 // bump
\8e\9e\82É
\83G
\83\89\81[
\82ª
\95\
\8e¦
\82³
\82ê
\82é
\82Ì
\82ð
\96h
\8e~
396 if (ch && ch->bumped)
415 PointF origin(xx, yy);
416 //
\83X
\83e
\81[
\83^
\83X
\95\
\8e¦
\88Ê
\92u
417 Rect img_rect((INT)origin.X, (INT)origin.Y + 1, img ? img->GetWidth() : 12, 12);
418 //
\83X
\83e
\81[
\83^
\83X
\95`
\89æ
420 // att.SetColorKey(Color::White, Color::White, ColorAdjustTypeBitmap);
421 g->DrawImage(img, img_rect, 0, 0, img_rect.Width, 12, UnitPixel, &att);
422 //
\8e\9f\82Ì
\8aî
\93_
423 origin.X += img_rect.Width;
425 //
\83t
\83H
\83\93\83g
\90Ý
\92è
426 Gdiplus::Font font(L"
\82l
\82r
\82o
\83S
\83V
\83b
\83N",10);
428 SolidBrush *strBrush;
429 if (servMgr->getFirewall() == ServMgr::FW_ON){
430 strBrush = ::new SolidBrush(Color::Red);
431 } else if (isTracker() && (getStatus() == Channel::S_RECEIVING)){
432 strBrush = ::new SolidBrush(Color::Green);
436 strBrush = ::new SolidBrush(Color::White);
439 strBrush = ::new SolidBrush(Color::Black);
443 if (this->type != Servent::T_COUT)
447 //
\83`
\83\83\83\93\83l
\83\8b\96¼
\95\
\8e¦
448 g->SetTextRenderingHint(TextRenderingHintAntiAlias);
449 _bstr_t bstr1(getName());
450 //
\95¶
\8e\9a\95`
\89æ
\94Í
\88Í
\8ew
\92è
451 RectF r1(origin.X, origin.Y, 120.0f, 13.0f);
453 format.SetAlignment(StringAlignmentNear);
454 g->DrawString(bstr1, -1, &font, r1, &format, strBrush);
455 //
\8e\9f\82Ì
\8aî
\93_
456 origin.X += r1.Width;
458 ////
\8fã
\97¬IP/
\83\8a\83X
\83i
\81[
\90\94/
\83\8a\83\8c\81[
\90\94\95\
\8e¦
460 ////
\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
461 ////
\95¶
\8e\9a\95\
\8e¦
\94Í
\88Í
\82Í
\95\9d220
\82®
\82ç
\82¢
\82Å
\82¨
\82\8b
462 //char tmp[512]; //
\95\
\8e¦
\97p
\83o
\83b
\83t
\83@
463 //char hostip[256]; // IP
\83A
\83h
\83\8c\83X
\83o
\83b
\83t
\83@
464 //chDisp.uphost.toStr(hostip); //
\8fã
\97¬IP
465 //sprintf(tmp, "%d/%d - [%d/%d] - %s",
466 // getTotalListeners(),
468 // getLocalListeners(),
473 //
\83\8a\83X
\83i
\81[
\90\94/
\83\8a\83\8c\81[
\90\94\95\
\8e¦
475 sprintf(tmp, "%d/%d - [%d/%d]", getTotalListeners(), getTotalRelays(), getLocalListeners(), getLocalRelays());
477 //
\95¶
\8e\9a\95\
\8e¦
\94Í
\88Í
\8ew
\92è
478 RectF r2(origin.X, origin.Y, 100.0f, 13.0f);
479 format.SetAlignment(StringAlignmentCenter);
480 g->DrawString(bstr2, -1, &font, r2, &format, strBrush);
481 //
\8e\9f\82Ì
\8aî
\93_
482 origin.X += r2.Width;
486 if (isStayConnected()){
487 f = ::new Font(L"Arial", 9.0f, FontStyleItalic|FontStyleBold, UnitPoint);
489 f = ::new Font(L"Arial", 9.0f);
491 sprintf(tmp, "%dkbps", getBitRate());
493 format.SetAlignment(StringAlignmentFar);
494 //
\95¶
\8e\9a\95\
\8e¦
\94Í
\88Í
\8ew
\92è
495 RectF r3(origin.X, origin.Y, 80.0f, 13.0f);
496 g->DrawString(bstr3, -1, f, r3, &format, strBrush);
497 //
\83t
\83H
\83\93\83g
\8aJ
\95ú
500 //
\8e\9f\82Ì
\8aî
\93_
501 origin.X += r3.Width;
503 //
\83u
\83\89\83V
\8dí
\8f\9c
509 int count = getServentCount();
510 // Servent
\95\
\8e¦
\95\94\82Ì
\94w
\8ci
\82ð
\94\92\82É
\82·
\82é
511 SolidBrush b(Color(160,255,255,255));
512 g->FillRectangle(&b, (INT)origin.X, (INT)origin.Y, 14*count, 14);
517 SolidBrush *serventBrush;
518 if (sd->getInfoFlg()){
519 ChanHit *hit = sd->getChanHit();
520 if (hit->firewalled){
521 SolidBrush bb(Color(180,255,0,0));
522 g->FillRectangle(&bb, (INT)origin.X + 14*index, (INT)origin.Y, 14, 14);
525 //
\83\8a\83\8c\81[
\82n
\82j
526 serventBrush = ::new SolidBrush(Color::Green);
528 //
\83\8a\83\8c\81[
\95s
\89Â
530 //
\83\8a\83\8c\81[
\88ê
\94t
531 serventBrush = ::new SolidBrush(Color::Blue);
533 //
\83\8a\83\8c\81[
\82È
\82µ
534 serventBrush = ::new SolidBrush(Color::Purple);
539 serventBrush = ::new SolidBrush(Color::Black);
542 backGra->FillRectangle(serventBrush, (INT)origin.X + index*14 + 1, (INT)origin.Y + 1, 12, 12);
544 ::delete serventBrush;
545 sd = sd->getNextData();
550 //
\8e\9f\82Ì
\8aî
\93_
553 //
\83T
\83C
\83Y
\82ð
\95Û
\91¶
554 setWidth((int)origin.X - posX);
555 setHeight((int)origin.Y - posY);
557 // ServentData
\95\
\8e¦
560 if (openFlg || sd->getSelected()){
561 sd->drawServent(g, (INT)x+12, (INT)origin.Y);
562 //
\8e\9f\82Ì
\8aî
\93_
565 sd = sd->getNextData();
570 g->SetTextRenderingHint(TextRenderingHintAntiAlias);
571 RectF r1(origin.X, origin.Y, 120.0f+100.0f+80.0f, 13.0f);
572 origin.X += r1.Width;
574 format.SetAlignment(StringAlignmentNear);
575 _bstr_t bstr1("COUT");
576 g->DrawString(bstr1, -1, &font, r1, &format, strBrush);
579 setWidth((int)origin.X - posX);
580 setHeight((int)origin.Y - posY);
583 return (int)(origin.Y);
586 bool ChannelData::checkDown(int x,int y){
587 //
\94Í
\88Í
\93à
\83`
\83F
\83b
\83N
590 && (x < posX + getWidth())
592 && (y < posY + getHeight())
599 ServentData *ChannelData::findServentData(int servent_id){
600 ServentData *sv = serventDataTop;
602 if (sv->getServentId() == servent_id){
605 sv = sv->getNextData();
610 void ChannelData::addServentData(ServentData *sd){
611 sd->setNextData(serventDataTop);
615 void ChannelData::deleteDisableServents(){
616 ServentData *sd = serventDataTop;
617 ServentData *prev = NULL;
620 if (!(sd->getEnableFlg())){
621 ServentData *next = sd->getNextData();
623 prev->setNextData(next);
625 serventDataTop = next;
631 sd = sd->getNextData();
636 int ChannelData::getServentCount(){
639 ServentData *sd = serventDataTop;
642 sd = sd->getNextData();
647 bool ChannelData::setName(int servent_id, String name){
648 ServentData *sd = serventDataTop;
650 if (sd->getServentId() == servent_id){
654 sd = sd->getNextData();
659 void ServentData::setData(Servent *s, ChanHit *hit, unsigned int listeners, unsigned int relays, bool f){
660 servent_id = s->servent_id;
663 lastSkipTime = s->lastSkipTime;
666 chanHit.numRelays = hit->numRelays;
667 chanHit.relay = hit->relay;
668 chanHit.firewalled = hit->firewalled;
669 chanHit.version = hit->version;
670 chanHit.version_vp = hit->version_vp;
671 chanHit.version_ex_number = hit->version_ex_number;
672 chanHit.version_ex_prefix[0] = hit->version_ex_prefix[0];
673 chanHit.version_ex_prefix[1] = hit->version_ex_prefix[1];
675 totalListeners = listeners;
676 totalRelays = relays;
681 int ServentData::drawServent(Gdiplus::Graphics *g, int x, int y){
686 //
\88Ê
\92u
\82ð
\95Û
\91¶
690 if (getWidth() == 0){
702 PointF origin(xx, yy);
704 //
\83t
\83H
\83\93\83g
\90Ý
\92è
705 Font font(L"
\82l
\82r
\82o
\83S
\83V
\83b
\83N",9);
707 SolidBrush *strBrush;
708 if (chanHit.firewalled){
709 strBrush = ::new SolidBrush(Color::Red);
713 strBrush = ::new SolidBrush(Color::White);
716 strBrush = ::new SolidBrush(Color::Black);
719 // ServantData
\95\
\8e¦
720 g->SetTextRenderingHint(TextRenderingHintAntiAlias);
721 //
\95¶
\8e\9a\97ñ
\8dì
\90¬
727 if (chanHit.version_ex_number){
728 //
\8ag
\92£
\83o
\81[
\83W
\83\87\83\93
729 sprintf(tmp, "%c%c%04d - %d/%d - %s(%s)",
730 chanHit.version_ex_prefix[0],
731 chanHit.version_ex_prefix[1],
732 chanHit.version_ex_number,
738 } else if (chanHit.version_vp){
739 sprintf(tmp, "VP%04d - %d/%d - %s(%s)",
747 sprintf(tmp, "(-----) - %d/%d - %s(%s)",
755 sprintf(tmp, "(-----) - %d/%d - %s(%s)",
764 //
\83X
\83e
\81[
\83^
\83X
\95\
\8e¦
765 Gdiplus::Image *img = NULL;
766 unsigned int nowTime = sys->getTime();
768 case Servent::S_CONNECTING:
771 case Servent::S_CONNECTED:
772 if (lastSkipTime + 120 > nowTime){
774 img = img_conn_ok_skip;
776 if (chanHit.numRelays){
777 img = img_conn_full_skip;
779 img = img_conn_over_skip;
786 if (chanHit.numRelays){
798 //
\95¶
\8e\9a\95`
\89æ
\94Í
\88Í
\8ew
\92è
799 RectF r1(origin.X + img->GetWidth() + 2, origin.Y, 800.0f, 13.0f);
802 format.SetAlignment(StringAlignmentNear);
803 g->MeasureString(bstr1, -1, &font, r1, &format, &r2);
805 w = (INT)r2.Width + img->GetWidth() + 2;
806 // ServentData
\95\
\8e¦
\95\94\82Ì
\94w
\8ci
\82ð
\93h
\82é
809 SolidBrush b(Color(160,49,106,197));
810 g->FillRectangle(&b, x, y, w, 13);
813 SolidBrush b(Color(160,200,200,200));
814 g->FillRectangle(&b, x, y, w, 13);
817 //
\83X
\83e
\81[
\83^
\83X
\95\
\8e¦
\88Ê
\92u
818 Rect img_rect((INT)origin.X, (INT)origin.Y+1, img ? img->GetWidth() : 12, 12);
819 //
\83X
\83e
\81[
\83^
\83X
\95`
\89æ
821 // att.SetColorKey(Color::White, Color::White, ColorAdjustTypeBitmap);
822 g->DrawImage(img, img_rect, 0, 0, img_rect.Width, 12, UnitPixel, &att);
823 //
\8e\9f\82Ì
\8aî
\93_
826 g->DrawString(bstr1, -1, &font, r2, &format, strBrush);
827 //
\8e\9f\82Ì
\8aî
\93_
828 origin.X += r2.Width;
831 setWidth((int)origin.X-posX);
832 setHeight((int)origin.Y - posY);
838 bool ServentData::checkDown(int x, int y){
841 && (x < posX + getWidth())
843 && (y < posY + getHeight())
851 THREAD_PROC GUIDataUpdate(ThreadInfo *thread){
854 // set GUI thread status to running
855 thread->finish = false;
857 while(thread->active){
858 //
\83`
\83\83\83\93\83l
\83\8b\83f
\81[
\83^
\83\8d\83b
\83N
859 ChannelDataLock.on();
860 //
\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é
861 ChannelData *cd = channelDataTop;
863 // Servent
\82Ì
\8dX
\90V
\83t
\83\89\83O
\82ðFALSE
\82É
\82·
\82é
864 ServentData *sv = cd->getServentDataTop();
866 sv->setEnableFlg(FALSE);
867 sv = sv->getNextData();
869 cd->setEnableFlg(FALSE);
870 cd = cd->getNextData();
873 Channel *c = chanMgr->channel;
874 //
\8c»
\8dÝ
\91¶
\8dÝ
\82·
\82é
\83`
\83\83\83\93\83l
\83\8b\95ª
\83\8b\81[
\83v
876 //
\8aù
\82É
\83`
\83\83\83\93\83l
\83\8b\83f
\81[
\83^
\82ð
\8e\9d\82Á
\82Ä
\82¢
\82é
\82©
878 //
\94
\8c©
\83t
\83\89\83OFALSE
879 bool bFoundFlg = FALSE;
881 if (cd->getChannelId() == c->channel_id){
882 //
\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
884 //
\8dX
\90V
\83t
\83\89\83OTRUE
885 cd->setEnableFlg(TRUE);
886 //
\94
\8c©
\83t
\83\89\83OTRUE
888 //
\83\8b\81[
\83v
\97£
\92E
891 //
\8c©
\82Â
\82©
\82ç
\82È
\82©
\82Á
\82½
\8fê
\8d\87\81A
\8e\9f\82Ì
\83f
\81[
\83^
\82ð
\83`
\83F
\83b
\83N
892 cd = cd->getNextData();
895 //
\90V
\82µ
\82¢
\83`
\83\83\83\93\83l
\83\8b\82Ì
\8fê
\8d\87\81A
\90V
\8bK
\83f
\81[
\83^
\8dì
\90¬
897 //
\90V
\8bK
\83f
\81[
\83^
\8dì
\90¬
898 cd = ::new ChannelData();
899 //
\83f
\81[
\83^
\8dX
\90V
901 //
\8dX
\90V
\83t
\83\89\83OTRUE
902 cd->setEnableFlg(TRUE);
904 //
\90V
\8bK
\83f
\81[
\83^
\82ð
\83\8a\83X
\83g
\82Ì
\90æ
\93ª
\82É
\93ü
\82ê
\82é
905 cd->setNextData(channelDataTop);
908 //
\8e\9f\82Ì
\83`
\83\83\83\93\83l
\83\8b\82ð
\8eæ
\93¾
913 // COUT
\82ð
\8c\9f\8dõ
915 bool foundFlg = false;
916 bool foundFlg2 = false;
917 Servent *s = servMgr->servents;
920 if (s->type == Servent::T_COUT && s->status == Servent::S_CONNECTED)
924 // ChannelData
\96\96\94ö
\82Ü
\82Å
\92T
\8dõ
925 ChannelData *prev = NULL;
929 if (cd->type == Servent::T_COUT && cd->servent_id == s->servent_id)
932 cd->setEnableFlg(true);
936 cd = cd->getNextData();
943 //
\83m
\81[
\83h
\92Ç
\89Á
946 // channelData
\82ª
\8bó
\82Å
\82È
\82¢
\81Bcd
\82Í
\82±
\82±
\82Å
\83\8a\83X
\83g
\96\96\94ö
\82ð
\8ew
\82µ
\82Ä
\82é
\81i
\82Í
\82¸
\81j
947 cd->setNextData(::new ChannelData());
948 cd = cd->getNextData();
949 memset(cd, 0, sizeof(cd));
950 cd->setNextData(NULL);
953 // channelData
\82ª
\8bó
954 channelDataTop = ::new ChannelData();
955 channelDataTop->setNextData(NULL);
959 //
\83f
\81[
\83^
\90Ý
\92è
961 cd->servent_id = s->servent_id;
962 cd->setEnableFlg(true);
968 // COUT
\82ª
\90Ø
\82ê
\82Ä
\82½
\82ç
\8dí
\8f\9c
972 ChannelData *prev = NULL;
975 // COUT
\82Ì
\8fî
\95ñ
\82ð
\8dí
\8f\9c
976 if (cd->type == Servent::T_COUT)
981 channelDataTop = cd->getNextData();
984 prev->setNextData(cd->getNextData());
990 cd = cd->getNextData();
996 //
\83`
\83\83\83\93\83l
\83\8b\82ª
\82È
\82
\82È
\82Á
\82Ä
\82¢
\82é
\8fê
\8d\87\82Ì
\8f\88\97\9d
998 ChannelData *prev = NULL;
1000 //
\83f
\81[
\83^
\82ð
\8dX
\90V
\82µ
\82È
\82©
\82Á
\82½
\82©
1001 if (cd->getEnableFlg() == FALSE){
1002 //
\83`
\83\83\83\93\83l
\83\8b\82ª
\82È
\82
\82È
\82Á
\82Ä
\82¢
\82é
\82Ì
\82Å
\8dí
\8f\9c
1004 next = cd->getNextData();
1006 //
\90æ
\93ª
\82Ì
\83f
\81[
\83^
\82ð
\8dí
\8f\9c
1007 //
\82±
\82±
\83\81\83\82\83\8a\83\8a\81[
\83N
\82µ
\82»
\82¤ by
\82¦
\82é
\81[
1008 channelDataTop = next;
1010 //
\93r
\92\86\82Ì
\83f
\81[
\83^
\82ð
\8dí
\8f\9c
1011 prev->setNextData(next);
1013 //
\8e\9f\82Ì
\83f
\81[
\83^
\82Ö
1016 //
\83f
\81[
\83^
\8dX
\90V
\8dÏ
\81F
\8e\9f\82Ì
\83f
\81[
\83^
\82Ö
1018 cd = cd->getNextData();
1022 Servent *s = servMgr->servents;
1026 bool infoFlg = false;
1028 bool firewalled = false;
1029 unsigned int numRelays = 0;
1031 char ver_ex_prefix[2] = {' ', ' '};
1032 int ver_ex_number = 0;
1033 //
\92¼
\89º
\83z
\83X
\83g
\8fî
\95ñ
\83`
\83F
\83b
\83N
1034 unsigned int totalRelays = 0;
1035 unsigned int totalListeners = 0;
1038 //
\8eó
\90M
\92\86\82©
1039 if ((s->type == Servent::T_RELAY) && (s->status == Servent::S_CONNECTED)){
1040 //
\83z
\83X
\83g
\8fî
\95ñ
\83\8d\83b
\83N
1041 chanMgr->hitlistlock.on();
1042 //
\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¾
1043 chl = chanMgr->findHitListByID(s->chanID);
1044 //
\83`
\83\83\83\93\83l
\83\8b\82Ì
\83z
\83X
\83g
\8fî
\95ñ
\82ª
\82 \82é
\82©
1046 //
\83`
\83\83\83\93\83l
\83\8b\82Ì
\83z
\83X
\83g
\8fî
\95ñ
\82ª
\82 \82é
\8fê
\8d\87
1047 ChanHit *hit = chl->hit;
1048 //
\81@
\83`
\83\83\83\93\83l
\83\8b\82Ì
\83z
\83X
\83g
\8fî
\95ñ
\82ð
\91S
\91\96\8d¸
\82µ
\82Ä
1050 // ID
\82ª
\93¯
\82¶
\82à
\82Ì
\82Å
\82 \82ê
\82Î
1051 if (hit->servent_id == s->servent_id){
1052 //
\83g
\81[
\83^
\83\8b\83\8a\83\8c\81[
\82Æ
\83g
\81[
\83^
\83\8b\83\8a\83X
\83i
\81[
\82ð
\89Á
\8eZ
1053 totalRelays += hit->numRelays;
1054 totalListeners += hit->numListeners;
1055 //
\92¼
\89º
\82Å
\82 \82ê
\82Î
1056 if (hit->numHops == 1){
1057 //
\8fî
\95ñ
\82ð
\88ê
\92U
\95Û
\91¶
1059 hitData.relay = hit->relay;
1060 hitData.firewalled = hit->firewalled;
1061 hitData.numRelays = hit->numRelays;
1062 hitData.version_vp = hit->version_vp;
1063 hitData.version_ex_prefix[0] = hit->version_ex_prefix[0];
1064 hitData.version_ex_prefix[1] = hit->version_ex_prefix[1];
1065 hitData.version_ex_number = hit->version_ex_number;
1068 //
\8e\9f\82ð
\83`
\83F
\83b
\83N
1073 //
\83`
\83\83\83\93\83l
\83\8b\83f
\81[
\83^
\82©
\82çServent
\82ð
\8c\9f\8dõ
1074 bool bFoundFlg = FALSE;
1075 cd = channelDataTop;
1077 ServentData *sv = cd->findServentData(s->servent_id);
1078 // ServentData
\82ª
\82 \82ê
\82Î
1079 if (sv && cd->getChannelId() == s->channel_id){
1080 //
\83f
\81[
\83^
\90Ý
\92è
1081 sv->setData(s, &hitData, totalListeners, totalRelays, infoFlg);
1082 sv->setEnableFlg(TRUE);
1086 cd = cd->getNextData();
1088 // ServentData
\82ª
\8c©
\82Â
\82©
\82ç
\82È
\82©
\82Á
\82½
\8fê
\8d\87
1090 //
\83`
\83\83\83\93\83l
\83\8b\83f
\81[
\83^
\82ð
\92T
\82·
1091 cd = channelDataTop;
1093 //
\83`
\83\83\83\93\83l
\83\8bID
\82ª
\93¯
\82¶
\82©
1094 if (cd->getChannelId() == s->channel_id){
1095 //
\83f
\81[
\83^
\90Ý
\92è
1096 ServentData *sv = ::new ServentData();
1097 sv->setData(s, &hitData, totalListeners, totalRelays, infoFlg);
1098 sv->setEnableFlg(TRUE);
1099 //
\83`
\83\83\83\93\83l
\83\8b\83f
\81[
\83^
\82ÉServentData
\92Ç
\89Á
1100 cd->addServentData(sv);
1101 //
\83z
\83X
\83g
\96¼
\82ð
\8eæ
\93¾
\82·
\82é
1102 IdData *id = ::new IdData(cd->getChannelId(), sv->getServentId(), sv->getHost().ip);
1104 t = ::new ThreadInfo();
1105 t->func = GetHostName;
1106 t->data = (void*)id;
1107 sys->startThread(t);
1108 LOG_DEBUG("resolving thread was started(%d)", id->getServentId());
1109 //
\83\8b\81[
\83v
\8fI
\97¹
1112 //
\8e\9f\82Ì
\83f
\81[
\83^
\82Ö
1113 cd = cd->getNextData();
1116 //
\83z
\83X
\83g
\8fî
\95ñ
\83A
\83\93\83\8d\83b
\83N
1117 chanMgr->hitlistlock.off();
1122 //
\8dX
\90V
\82µ
\82Ä
\82¢
\82È
\82¢ServentData
\82ð
\8dí
\8f\9c
1123 cd = channelDataTop;
1125 cd->deleteDisableServents();
1126 cd = cd->getNextData();
1129 //
\83`
\83\83\83\93\83l
\83\8b\83f
\81[
\83^
\83A
\83\93\83\8d\83b
\83N
1130 ChannelDataLock.off();
1137 // 0.1
\95b
\81~10
\82Å1
\95b
\91Ò
\82¿
1140 if (!thread->active)
1146 // set GUI thread status to terminated
1147 thread->finish = true;
1152 ChannelData *findChannelData(int channel_id){
1153 ChannelData *cd = channelDataTop;
1156 if (cd->getChannelId() == channel_id){
1159 cd = cd->getNextData();
1166 void PopupChannelMenu(int channel_id){
1168 MENUITEMINFO info, separator;
1172 hMenu = CreatePopupMenu();
1174 memset(&separator, 0, sizeof(MENUITEMINFO));
1175 separator.cbSize = sizeof(MENUITEMINFO);
1176 separator.fMask = MIIM_ID | MIIM_TYPE;
1177 separator.fType = MFT_SEPARATOR;
1178 separator.wID = 8000;
1180 memset(&info, 0, sizeof(MENUITEMINFO));
1181 info.cbSize = sizeof(MENUITEMINFO);
1182 info.fMask = MIIM_ID | MIIM_TYPE;
1183 info.fType = MFT_STRING;
1185 ChannelData *cd = findChannelData(channel_id);
1192 info.dwTypeData = "
\90Ø
\92f";
1193 InsertMenuItem(hMenu, -1, true, &info);
1195 InsertMenuItem(hMenu, -1, true, &separator);
1198 info.dwTypeData = "
\8dÄ
\90¶";
1199 InsertMenuItem(hMenu, -1, true, &info);
1201 InsertMenuItem(hMenu, -1, true, &separator);
1204 info.dwTypeData = "
\8dÄ
\90Ú
\91±";
1205 InsertMenuItem(hMenu, -1, true, &info);
1208 info.dwTypeData = "
\83L
\81[
\83v";
1209 InsertMenuItem(hMenu, -1, true, &info);
1211 InsertMenuItem(hMenu, -1, true, &separator);
1213 if (!cd->getOpenFlg()){
1215 info.dwTypeData = "
\92¼
\89º
\95\
\8e¦";
1216 InsertMenuItem(hMenu, -1, true, &info);
1219 info.dwTypeData = "
\92¼
\89º
\89B
\95Á";
1220 InsertMenuItem(hMenu, -1, true, &info);
1224 dwID = TrackPopupMenu(hMenu, TPM_LEFTALIGN|TPM_RETURNCMD, pos.x, pos.y, 0, guiWnd, NULL);
1228 cd = findChannelData(channel_id);
1234 Channel *c = chanMgr->findChannelByChannelID(channel_id);
1241 case 1000: //
\8dÄ
\90¶
1242 chanMgr->playChannel(c->info);
1245 case 1001: //
\90Ø
\92f
1246 c->thread.active = false;
1247 c->thread.finish = true;
1250 case 1002: //
\8dÄ
\90Ú
\91±
1251 //
\92¼
\89º
\82©
\82Â
\8eó
\90M
\92\86\82Å
\82 \82ê
\82Î
\8am
\94F
\83\81\83b
\83Z
\81[
\83W
\95\
\8e¦
1252 if (cd->isTracker() && cd->getStatus() == Channel::S_RECEIVING)
1255 id = MessageBox(guiWnd,
1256 "
\92¼
\89º
\82Å
\82·
\82ª
\8dÄ
\90Ú
\91±
\82µ
\82Ü
\82·
\82©
\81H",
1257 "
\92¼
\89º
\8cx
\8d\90",
1258 MB_YESNO|MB_ICONQUESTION|MB_DEFBUTTON2);
1266 case 1003: //
\83L
\81[
\83v
1267 if (!c->stayConnected){
1268 c->stayConnected = true;
1270 c->stayConnected = false;
1274 case 1004: //
\92¼
\89º
\95\
\8e¦
1275 cd->setOpenFlg(TRUE);
1279 case 1005: //
\92¼
\89º
\89B
\95Á
1280 cd->setOpenFlg(FALSE);
1286 void PopupServentMenu(int servent_id){
1288 MENUITEMINFO info, separator;
1292 hMenu = CreatePopupMenu();
1294 memset(&separator, 0, sizeof(MENUITEMINFO));
1295 separator.cbSize = sizeof(MENUITEMINFO);
1296 separator.fMask = MIIM_ID | MIIM_TYPE;
1297 separator.fType = MFT_SEPARATOR;
1298 separator.wID = 8000;
1300 memset(&info, 0, sizeof(MENUITEMINFO));
1301 info.cbSize = sizeof(MENUITEMINFO);
1302 info.fMask = MIIM_ID | MIIM_TYPE;
1303 info.fType = MFT_STRING;
1305 ServentData *sd = NULL;
1306 ChannelData *cd = channelDataTop;
1309 if (cd->type == Servent::T_COUT
1310 && cd->servent_id == servent_id)
1313 sd = cd->findServentData(servent_id);
1317 cd = cd->getNextData();
1320 if (cd == NULL || sd == NULL
1321 && cd->type != Servent::T_COUT) // COUT
1327 info.dwTypeData = "
\90Ø
\92f";
1328 InsertMenuItem(hMenu, -1, true, &info);
1330 // InsertMenuItem(hMenu, -1, true, &separator);
1333 dwID = TrackPopupMenu(hMenu, TPM_LEFTALIGN|TPM_RETURNCMD, pos.x, pos.y, 0, guiWnd, NULL);
1337 cd = channelDataTop;
1340 if (cd->type == Servent::T_COUT
1341 && cd->servent_id == servent_id)
1344 sd = cd->findServentData(servent_id);
1348 cd = cd->getNextData();
1351 if (cd == NULL || sd == NULL
1352 && cd->type != Servent::T_COUT) // COUT
1357 Servent *s = servMgr->findServentByServentID(servent_id);
1364 case 1001: //
\90Ø
\92f
1365 s->thread.active = false;
1368 if (s->type == Servent::T_COUT)
1369 s->thread.finish = true;
1376 void PopupOtherMenu(){
1378 MENUITEMINFO info, separator;
1382 hMenu = CreatePopupMenu();
1384 memset(&separator, 0, sizeof(MENUITEMINFO));
1385 separator.cbSize = sizeof(MENUITEMINFO);
1386 separator.fMask = MIIM_ID | MIIM_TYPE;
1387 separator.fType = MFT_SEPARATOR;
1388 separator.wID = 8000;
1390 memset(&info, 0, sizeof(MENUITEMINFO));
1391 info.cbSize = sizeof(MENUITEMINFO);
1392 info.fMask = MIIM_ID | MIIM_TYPE;
1393 info.fType = MFT_STRING;
1397 info.dwTypeData = "
\8dÅ
\91O
\96Ê
\95\
\8e¦";
1398 InsertMenuItem(hMenu, -1, true, &info);
1401 info.dwTypeData = "
\8dÅ
\91O
\96Ê
\89ð
\8f\9c";
1402 InsertMenuItem(hMenu, -1, true, &info);
1405 InsertMenuItem(hMenu, -1, true, &separator);
1409 info.dwTypeData = "
\91S
\92¼
\89º
\93W
\8aJ";
1410 InsertMenuItem(hMenu, -1, true, &info);
1413 info.dwTypeData = "
\91S
\92¼
\89º
\89B
\95Á";
1414 InsertMenuItem(hMenu, -1, true, &info);
1417 InsertMenuItem(hMenu, -1, true, &separator);
1419 if (!servMgr->autoServe){
1421 info.dwTypeData = "
\97L
\8cø";
1422 InsertMenuItem(hMenu, -1, true, &info);
1425 info.dwTypeData = "
\96³
\8cø";
1426 InsertMenuItem(hMenu, -1, true, &info);
1430 dwID = TrackPopupMenu(hMenu, TPM_LEFTALIGN|TPM_RETURNCMD, pos.x, pos.y, 0, guiWnd, NULL);
1434 ChannelData *cd = channelDataTop;
1437 case 1101: //
\8dÅ
\91O
\96Ê
\95\
\8e¦
1439 ::SetWindowPos(guiWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
1442 case 1102: //
\8dÅ
\91O
\96Ê
\89ð
\8f\9c
1444 ::SetWindowPos(guiWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
1447 case 1103: //
\91S
\92¼
\89º
\93W
\8aJ
1450 cd->setOpenFlg(true);
1451 cd = cd->getNextData();
1455 case 1104: //
\91S
\92¼
\89º
\89B
\95Á
1458 cd->setOpenFlg(false);
1459 cd = cd->getNextData();
1463 case 1105: //
\97L
\8cø
1464 servMgr->autoServe = true;
1467 case 1106: //
\96³
\8cø
1468 servMgr->autoServe = false;
1474 void WmCreateProc(HWND hwnd){
1475 //
\8e©
\93®
\8dÅ
\91O
\96Ê
\8b@
\94\
1476 if (servMgr->topmostGui)
1484 _bstr_t bstr("back.jpg");
1485 backImage = ::new Image(bstr);
1487 MakeBack(hwnd, 800, 600);
1489 guiThread.func = GUIDataUpdate;
1490 if (!sys->startThread(&guiThread)){
1491 MessageBox(hwnd,"Unable to start GUI","PeerCast",MB_OK|MB_ICONERROR);
1492 PostMessage(hwnd,WM_DESTROY,0,0);
1495 SetWindowPlacement(hwnd, &winPlace);
1500 ::delete img_connect;
1501 ::delete img_conn_ok;
1502 ::delete img_conn_full;
1503 ::delete img_conn_over;
1504 ::delete img_conn_ok_skip;
1505 ::delete img_conn_full_skip;
1506 ::delete img_conn_over_skip;
1508 ::delete img_broad_ok;
1509 ::delete img_broad_full;
1511 bstr = L"ST_IDLE.bmp";
1512 img_idle = ::new Image(bstr);
1513 bstr = L"ST_CONNECT.bmp";
1514 img_connect = ::new Image(bstr);
1515 bstr = L"ST_CONN_OK.bmp";
1516 img_conn_ok = ::new Image(bstr);
1517 bstr = L"ST_CONN_FULL.bmp";
1518 img_conn_full = ::new Image(bstr);
1519 bstr = L"ST_CONN_OVER.bmp";
1520 img_conn_over = ::new Image(bstr);
1521 bstr = L"ST_CONN_OK_SKIP.bmp";
1522 img_conn_ok_skip = ::new Image(bstr);
1523 bstr = L"ST_CONN_FULL_SKIP.bmp";
1524 img_conn_full_skip = ::new Image(bstr);
1525 bstr = L"ST_CONN_OVER_SKIP.bmp";
1526 img_conn_over_skip = ::new Image(bstr);
1527 bstr = L"ST_ERROR.bmp";
1528 img_error = ::new Image(bstr);
1529 bstr = L"ST_BROAD_OK.bmp";
1530 img_broad_ok = ::new Image(bstr);
1531 bstr = L"ST_BROAD_FULL.bmp";
1532 img_broad_full = ::new Image(bstr);
1535 void WmPaintProc(HWND hwnd){
1541 hdc = BeginPaint(hwnd, &paint);
1542 RECT *rcRect; //
\95`
\89æ
\94Í
\88Í
1543 rcRect = &(paint.rcPaint);
1544 LONG width = rcRect->right - rcRect->left + 1;
1545 LONG height = rcRect->bottom - rcRect->top + 1;
1548 Rect r(rcRect->left, rcRect->top, width, height);
1549 g2.DrawImage(backBmp,r, rcRect->left, rcRect->top, width, height, UnitPixel);
1550 EndPaint(hwnd, &paint);
1555 void WmSizeProc(HWND hwnd, LPARAM lParam){
1556 UINT width = LOWORD(lParam);
1557 UINT height = HIWORD(lParam);
1559 MakeBack(hwnd, width, height);
1563 void WmLButtonDownProc(HWND hwnd, LPARAM lParam){
1565 bool changeFlg = FALSE;
1567 ChannelDataLock.on();
1568 cd = channelDataTop;
1570 int x = LOWORD(lParam);
1571 int y = HIWORD(lParam);
1572 if (cd->checkDown(LOWORD(lParam), HIWORD(lParam))){
1573 if (!(cd->isSelected())){
1576 cd->setSelected(TRUE);
1578 if (cd->isSelected()){
1581 cd->setSelected(FALSE);
1583 int sx = cd->getPosX() + cd->getWidth();
1584 int sy = cd->getPosY();
1586 ServentData *sd = cd->getServentDataTop();
1588 if ( ( (!cd->getOpenFlg())
1589 && (sx + index*14 < x)
1590 && (x < sx + (index+1)*14)
1593 || sd->checkDown(LOWORD(lParam), HIWORD(lParam))
1595 if (!sd->getSelected()){
1598 sd->setSelected(TRUE);
1600 if (sd->getSelected()){
1603 sd->setSelected(FALSE);
1605 sd = sd->getNextData();
1608 cd = cd->getNextData();
1610 ChannelDataLock.off();
1616 void WmLButtonDblclkProc(HWND hwnd, LPARAM lParam){
1618 bool changeFlg = FALSE;
1620 ChannelDataLock.on();
1621 cd = channelDataTop;
1623 int x = LOWORD(lParam);
1624 int y = HIWORD(lParam);
1625 if (cd->checkDown(LOWORD(lParam), HIWORD(lParam))){
1626 if (!(cd->isSelected())){
1629 if (!(cd->getOpenFlg())){
1631 cd->setOpenFlg(TRUE);
1634 cd->setOpenFlg(FALSE);
1636 cd->setSelected(TRUE);
1638 if (cd->isSelected()){
1641 cd->setSelected(FALSE);
1643 /* int sx = cd->getPosX() + cd->getWidth();
1644 int sy = cd->getPosY();
1646 ServentData *sd = cd->getServentDataTop();
1648 if ( ( (!cd->getOpenFlg())
1649 && (sx + index*14 < x)
1650 && (x < sx + (index+1)*14)
1653 || sd->checkDown(LOWORD(lParam), HIWORD(lParam))
1655 if (!sd->getSelected()){
1658 sd->setSelected(TRUE);
1660 if (sd->getSelected()){
1663 sd->setSelected(FALSE);
1665 sd = sd->getNextData();
1668 cd = cd->getNextData();
1670 ChannelDataLock.off();
1676 void WmRButtonDownProc(HWND hwnd, LPARAM lParam){
1678 bool changeFlg = FALSE;
1679 bool channel_selected = FALSE;
1680 bool servent_selected = FALSE;
1684 cd = channelDataTop;
1686 if (cd->checkDown(LOWORD(lParam), HIWORD(lParam))){
1687 if (!(cd->isSelected())){
1690 cd->setSelected(TRUE);
1691 channel_id = cd->getChannelId();
1692 channel_selected = TRUE;
1695 if (cd->type == Servent::T_COUT)
1697 channel_selected = FALSE;
1698 servent_selected = TRUE;
1699 servent_id = cd->servent_id;
1702 if (cd->isSelected()){
1705 cd->setSelected(FALSE);
1707 ServentData *sd = cd->getServentDataTop();
1709 if (sd->checkDown(LOWORD(lParam), HIWORD(lParam))){
1710 if (!sd->getSelected()){
1713 sd->setSelected(TRUE);
1714 servent_id = sd->getServentId();
1715 servent_selected = TRUE;
1717 if (sd->getSelected()){
1720 sd->setSelected(FALSE);
1722 sd = sd->getNextData();
1724 cd = cd->getNextData();
1730 if (channel_selected){
1731 PopupChannelMenu(channel_id);
1732 } else if (servent_selected){
1733 PopupServentMenu(servent_id);
1739 LRESULT CALLBACK GUIProc (HWND hwnd, UINT message,
1740 WPARAM wParam, LPARAM lParam)
1743 case WM_CREATE: //
\83E
\83B
\83\93\83h
\83E
\8dì
\90¬
1747 case WM_PAINT: //
\95`
\89æ
1751 case WM_SIZE: //
\83T
\83C
\83Y
\95Ï
\8dX
1752 WmSizeProc(hwnd,lParam);
1755 case WM_LBUTTONDOWN: //
\8d¶
\83{
\83^
\83\93\89\9f\82·
1756 WmLButtonDownProc(hwnd,lParam);
1759 case WM_RBUTTONDOWN: //
\89E
\83{
\83^
\83\93\89\9f\82·
1760 WmRButtonDownProc(hwnd,lParam);
1763 case WM_LBUTTONDBLCLK: //
\8d¶
\83_
\83u
\83\8b\83N
\83\8a\83b
\83N
1764 WmLButtonDblclkProc(hwnd,lParam);
1767 case WM_ERASEBKGND: //
\94w
\8ci
\8fÁ
\8b\8e
1768 return TRUE; //
\94w
\8ci
\82Í
\8fÁ
\82³
\82È
\82¢
1772 // ::delete backImage;
1773 // backImage = NULL;
1775 GetWindowPlacement(hwnd, &winPlace);
1777 DestroyWindow( hwnd );
1780 GetWindowPlacement(hwnd, &winPlace);
1782 guiThread.active = false;
1784 // wait until GUI thread terminated,
1785 // and then dispose background image.
1788 if (guiThread.finish)
1801 return (DefWindowProc(hwnd, message, wParam, lParam));