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 // ------------------------------------------------
29 #include "win32/wsys.h"
31 #include "win32/wsocket.h"
38 #include "chkMemoryLeak.h"
39 #define DEBUG_NEW new(__FILE__, __LINE__)
44 bool shownChannels=false;
52 const char *statusStr;
79 unsigned int numRelays;
80 unsigned int totalRelays;
81 unsigned int totalListeners;
83 char ver_ex_prefix[2];
89 unsigned int lastSkipTime;
90 unsigned int lastSkipCount;
93 ListData *list_top = NULL;
94 ServentData *servent_top = NULL;
96 // --------------------------------------------------
97 // for PCRaw (connection list) start
98 WNDPROC wndOldListBox = NULL, wndOldConnListBox = NULL;
99 bool sleep_skip = false;
101 LRESULT CALLBACK ListBoxProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
107 int index = SendMessage(hwnd, LB_ITEMFROMPOINT, 0, lParam);
110 SendMessage(hwnd, LB_SETCURSEL, (DWORD)-1, 0L);
116 case WM_LBUTTONDBLCLK:
118 int index = SendMessage(hwnd, LB_ITEMFROMPOINT, 0, lParam);
121 SendMessage(guiWnd, WM_COMMAND, IDC_BUTTON8, NULL);
129 MENUITEMINFO info, separator;
133 int index = SendMessage(hwnd, LB_ITEMFROMPOINT, 0, lParam);
136 SendMessage(hwnd, LB_SETCURSEL, (DWORD)index, 1L);
140 SendMessage(hwnd, LB_SETCURSEL, (DWORD)-1, 0L);
145 hMenu = CreatePopupMenu();
147 memset(&separator, 0, sizeof(MENUITEMINFO));
148 separator.cbSize = sizeof(MENUITEMINFO);
149 separator.fMask = MIIM_ID | MIIM_TYPE;
150 separator.fType = MFT_SEPARATOR;
151 separator.wID = 8000;
153 memset(&info, 0, sizeof(MENUITEMINFO));
154 info.cbSize = sizeof(MENUITEMINFO);
155 info.fMask = MIIM_ID | MIIM_TYPE;
156 info.fType = MFT_STRING;
159 info.dwTypeData = "
\90Ø
\92f(&X)";
160 InsertMenuItem(hMenu, -1, true, &info);
162 InsertMenuItem(hMenu, -1, true, &separator);
165 info.dwTypeData = "
\8dÄ
\90¶(&P)";
166 InsertMenuItem(hMenu, -1, true, &info);
168 InsertMenuItem(hMenu, -1, true, &separator);
171 info.dwTypeData = "
\8dÄ
\90Ú
\91±(&R)";
172 InsertMenuItem(hMenu, -1, true, &info);
175 info.dwTypeData = "
\83L
\81[
\83v(&K)";
176 InsertMenuItem(hMenu, -1, true, &info);
178 InsertMenuItem(hMenu, -1, true, &separator);
181 info.dwTypeData = "
\91I
\91ð
\89ð
\8f\9c(&D)";
182 InsertMenuItem(hMenu, -1, true, &info);
185 dwID = TrackPopupMenu(hMenu, TPM_LEFTALIGN | TPM_RETURNCMD, pos.x, pos.y, 0, hwnd, NULL);
192 SendMessage(guiWnd, WM_COMMAND, IDC_BUTTON8, NULL);
196 SendMessage(guiWnd, WM_COMMAND, IDC_BUTTON5, NULL);
200 SendMessage(guiWnd, WM_COMMAND, IDC_BUTTON3, NULL);
204 SendMessage(guiWnd, WM_COMMAND, IDC_BUTTON9, NULL);
208 SendMessage(hwnd, LB_SETCURSEL, (DWORD)-1, 0L);
221 return CallWindowProc(wndOldListBox, hwnd, message, wParam, lParam);
224 LRESULT CALLBACK ConnListBoxProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
230 int index = SendMessage(hwnd, LB_ITEMFROMPOINT, 0, lParam);
233 SendMessage(hwnd, LB_SETCURSEL, (DWORD)-1, 0L);
245 int index = SendMessage(hwnd, LB_ITEMFROMPOINT, 0, lParam);
248 SendMessage(hwnd, LB_SETCURSEL, (DWORD)index, 1L);
252 SendMessage(hwnd, LB_SETCURSEL, (DWORD)-1, 0L);
256 hMenu = CreatePopupMenu();
258 memset(&info, 0, sizeof(MENUITEMINFO));
259 info.cbSize = sizeof(MENUITEMINFO);
260 info.fMask = MIIM_ID | MIIM_TYPE;
261 info.fType = MFT_STRING;
264 info.dwTypeData = "
\90Ø
\92f(&X)";
265 InsertMenuItem(hMenu, -1, true, &info);
268 dwID = TrackPopupMenu(hMenu, TPM_LEFTALIGN | TPM_RETURNCMD, pos.x, pos.y, 0, hwnd, NULL);
275 SendMessage(guiWnd, WM_COMMAND, IDC_BUTTON6, NULL);
283 return CallWindowProc(wndOldConnListBox, hwnd, message, wParam, lParam);
285 // for PCRaw (connection list) end
286 // --------------------------------------------------
287 int logID,statusID,hitID,chanID;
289 // --------------------------------------------------
290 bool getButtonState(int id)
292 return SendDlgItemMessage(guiWnd, id,BM_GETCHECK, 0, 0) == BST_CHECKED;
295 // --------------------------------------------------
296 void enableControl(int id, bool on)
298 EnableWindow(GetDlgItem(guiWnd,id),on);
301 // --------------------------------------------------
302 void enableEdit(int id, bool on)
304 SendDlgItemMessage(guiWnd, id,WM_ENABLE, on, 0);
305 SendDlgItemMessage(guiWnd, id,EM_SETREADONLY, !on, 0);
307 // --------------------------------------------------
308 int getEditInt(int id)
311 SendDlgItemMessage(guiWnd, id,WM_GETTEXT, 128, (LONG)str);
314 // --------------------------------------------------
315 char * getEditStr(int id)
317 static char str[128];
318 SendDlgItemMessage(guiWnd, id,WM_GETTEXT, 128, (LONG)str);
321 // --------------------------------------------------
322 void setEditStr(int id, char *str)
324 SendDlgItemMessage(guiWnd, id,WM_SETTEXT, 0, (LONG)str);
326 // --------------------------------------------------
327 void setEditInt(int id, int v)
331 SendDlgItemMessage(guiWnd, id,WM_SETTEXT, 0, (LONG)str);
334 // --------------------------------------------------
335 void *getListBoxSelData(int id)
337 int sel = SendDlgItemMessage(guiWnd, id,LB_GETCURSEL, 0, 0);
339 return (void *)SendDlgItemMessage(guiWnd, id,LB_GETITEMDATA, sel, 0);
343 Channel *getListBoxChannel(){
344 int sel = SendDlgItemMessage(guiWnd, chanID ,LB_GETCURSEL, 0, 0);
346 ListData *ld = list_top;
351 return chanMgr->findChannelByChannelID(ld->channel_id);
360 Servent *getListBoxServent(){
361 int sel = SendDlgItemMessage(guiWnd, statusID ,LB_GETCURSEL, 0, 0);
363 ServentData *sd = servent_top;
368 return servMgr->findServentByServentID(sd->servent_id);
377 // --------------------------------------------------
378 void setButtonState(int id, bool on)
380 SendDlgItemMessage(guiWnd, id,BM_SETCHECK, on, 0);
381 SendMessage(guiWnd,WM_COMMAND,id,0);
383 // --------------------------------------------------
384 void ADDLOG(const char *str,int id,bool sel,void *data, LogBuffer::TYPE type)
390 int num = SendDlgItemMessage(guiWnd, id,LB_GETCOUNT, 0, 0);
393 SendDlgItemMessage(guiWnd, id, LB_DELETESTRING, 0, 0);
396 sjis = str; //JP-Patch
397 sjis.convertTo(String::T_SJIS); //JP-Patch
398 //int idx = SendDlgItemMessage(guiWnd, id, LB_ADDSTRING, 0, (LONG)(LPSTR)str);
399 int idx = SendDlgItemMessage(guiWnd, id, LB_ADDSTRING, 0, (LONG)(LPSTR)sjis.cstr());
400 SendDlgItemMessage(guiWnd, id, LB_SETITEMDATA, idx, (LONG)data);
403 SendDlgItemMessage(guiWnd, id, LB_SETCURSEL, num, 0);
407 if (type != LogBuffer::T_NONE)
410 OutputDebugString(str);
411 OutputDebugString("\n");
418 // --------------------------------------------------
419 void ADDLOG2(const char *fmt,va_list ap,int id,bool sel,void *data, LogBuffer::TYPE type)
422 vsprintf(str,fmt,ap);
424 ADDLOG(str,id,sel,data,type);
427 // --------------------------------------------------
428 void ADDCHAN(void *d, const char *fmt,...)
432 ADDLOG2(fmt,ap,chanID,false,d,LogBuffer::T_NONE);
435 // --------------------------------------------------
436 void ADDHIT(void *d, const char *fmt,...)
440 ADDLOG2(fmt,ap,hitID,false,d,LogBuffer::T_NONE);
443 // --------------------------------------------------
444 void ADDCONN(void *d, const char *fmt,...)
448 ADDLOG2(fmt,ap,statusID,false,d,LogBuffer::T_NONE);
455 // --------------------------------------------------
456 THREAD_PROC showConnections(ThreadInfo *thread)
459 while (thread->active)
462 /* sel = SendDlgItemMessage(guiWnd, statusID,LB_GETCURSEL, 0, 0);
463 top = SendDlgItemMessage(guiWnd, statusID,LB_GETTOPINDEX, 0, 0);
465 SendDlgItemMessage(guiWnd, statusID, LB_RESETCONTENT, 0, 0);
466 Servent *s = servMgr->servents;
469 if (s->type != Servent::T_NONE)
471 Host h = s->getHost();
473 unsigned int ip = h.ip;
474 unsigned short port = h.port;
480 unsigned int tnum = 0;
483 tnum = sys->getTime()-s->lastConnect;
485 if ((s->type == Servent::T_RELAY) || (s->type == Servent::T_DIRECT))
487 ADDCONN(s,"%s-%s-%d%c - %s - %d - %s ",
488 s->getTypeStr(),s->getStatusStr(),tnum,tdef,
490 s->syncPos,s->agent.cstr()
493 if (s->status == Servent::S_CONNECTED)
495 ADDCONN(s,"%s-%s-%d%c - %s - %d/%d",
496 s->getTypeStr(),s->getStatusStr(),tnum,tdef,
498 s->gnuStream.packetsIn,s->gnuStream.packetsOut);
500 ADDCONN(s,"%s-%s-%d%c - %s",
501 s->getTypeStr(),s->getStatusStr(),tnum,tdef,
513 SendDlgItemMessage(guiWnd, statusID,LB_SETCURSEL, sel, 0);
515 SendDlgItemMessage(guiWnd, statusID,LB_SETTOPINDEX, top, 0);*/
520 sel = SendDlgItemMessage(guiWnd, statusID,LB_GETCURSEL, 0, 0);
521 top = SendDlgItemMessage(guiWnd, statusID,LB_GETTOPINDEX, 0, 0);
523 ServentData *sd = servent_top;
531 Servent *s = servMgr->servents;
533 Channel *sel_ch = getListBoxChannel(); // for PCRaw (connection list)
537 bool foundFlg = false;
539 bool infoFlg = false;
541 bool firewalled = false;
542 unsigned int numRelays = 0;
543 unsigned int totalRelays = 0;
544 unsigned int totalListeners = 0;
546 char ver_ex_prefix[2] = {' ', ' '};
547 int ver_ex_number = 0;
551 // for PCRaw (connection list) start
552 if(sel_ch && !sel_ch->info.id.isSame(s->chanID))
557 // for PCRaw (connection list) end
559 if (s->type != Servent::T_NONE){
561 chanMgr->hitlistlock.on();
563 chl = chanMgr->findHitListByID(s->chanID);
565 ChanHit *hit = chl->hit;
567 if (hit->servent_id == s->servent_id){
568 if ((hit->numHops == 1)/* && (hit->host.ip == s->getHost().ip)*/){
571 firewalled = hit->firewalled;
572 numRelays = hit->numRelays;
573 vp_ver = hit->version_vp;
574 ver_ex_prefix[0] = hit->version_ex_prefix[0];
575 ver_ex_prefix[1] = hit->version_ex_prefix[1];
576 ver_ex_number = hit->version_ex_number;
578 totalRelays += hit->numRelays;
579 totalListeners += hit->numListeners;
584 chanMgr->hitlistlock.off();
589 if (sd->servent_id == s->servent_id){
591 if (s->thread.finish) break;
594 sd->status = s->status;
595 sd->agent = s->agent;
596 sd->h = s->getHost();
597 sd->syncpos = s->syncPos;
598 sd->tnum = (s->lastConnect) ? sys->getTime()-s->lastConnect : 0;
599 sd->typeStr = s->getTypeStr();
600 sd->statusStr = s->getStatusStr();
601 sd->infoFlg = infoFlg;
603 sd->firewalled = firewalled;
604 sd->numRelays = numRelays;
605 sd->totalRelays = totalRelays;
606 sd->totalListeners = totalListeners;
608 sd->lastSkipTime = s->lastSkipTime;
609 sd->lastSkipCount = s->lastSkipCount;
610 sd->ver_ex_prefix[0] = ver_ex_prefix[0];
611 sd->ver_ex_prefix[1] = ver_ex_prefix[1];
612 sd->ver_ex_number = ver_ex_number;
617 if (!foundFlg && (s->type != Servent::T_NONE) && !s->thread.finish){
618 ServentData *newData = new ServentData();
619 newData->next = servent_top;
620 servent_top = newData;
622 newData->servent_id = s->servent_id;
623 newData->type = s->type;
624 newData->status = s->status;
625 newData->agent = s->agent;
626 newData->h = s->getHost();
627 newData->syncpos = s->syncPos;
628 newData->tnum = (s->lastConnect) ? sys->getTime()-s->lastConnect : 0;
629 newData->typeStr = s->getTypeStr();
630 newData->statusStr = s->getStatusStr();
631 newData->infoFlg = infoFlg;
632 newData->relay = relay;
633 newData->firewalled = firewalled;
634 newData->numRelays = numRelays;
635 newData->totalRelays = totalRelays;
636 newData->totalListeners = totalListeners;
637 newData->vp_ver = vp_ver;
638 newData->lastSkipTime = s->lastSkipTime;
639 newData->lastSkipCount = s->lastSkipCount;
640 newData->ver_ex_prefix[0] = ver_ex_prefix[0];
641 newData->ver_ex_prefix[1] = ver_ex_prefix[1];
642 newData->ver_ex_number = ver_ex_number;
644 int idx = SendDlgItemMessage(guiWnd, statusID, LB_ADDSTRING, 0, (LONG)"");
645 SendDlgItemMessage(guiWnd, statusID, LB_SETITEMDATA, idx, (LONG)(newData->servent_id));
655 ServentData *prev = NULL;
658 // idxs = new int[sd_count];
661 if (!sd->flg || (sd->type == Servent::T_NONE)){
662 ServentData *next = sd->next;
670 PostMessage(GetDlgItem(guiWnd, statusID), LB_DELETESTRING, idx, 0);
671 // SendDlgItemMessage(guiWnd, statusID, LB_DELETESTRING, idx, 0);
682 if ((sel >= 0) && (diff != 0)){
683 PostMessage(GetDlgItem(guiWnd, statusID), LB_SETCURSEL, sel+diff, 0);
686 PostMessage(GetDlgItem(guiWnd, statusID), LB_SETTOPINDEX, top, 0);
688 InvalidateRect(GetDlgItem(guiWnd, statusID), NULL, FALSE);
693 // sel = SendDlgItemMessage(guiWnd, chanID,LB_GETCURSEL, 0, 0);
694 // top = SendDlgItemMessage(guiWnd, chanID,LB_GETTOPINDEX, 0, 0);
695 // SendDlgItemMessage(guiWnd, chanID, LB_RESETCONTENT, 0, 0);
697 ListData *ld = list_top;
703 Channel *c = chanMgr->channel;
708 bool foundFlg = false;
711 sjis.convertTo(String::T_SJIS);
717 if (ld->channel_id == c->channel_id){
719 if (c->thread.finish) break;
721 strncpy(ld->name, sjis, 20);
723 ld->bitRate = c->info.bitrate;
724 ld->status = c->status;
725 ld->statusStr = c->getStatusStr();
726 ld->totalListeners = c->totalListeners();
727 ld->totalRelays = c->totalRelays();
728 ld->localListeners = c->localListeners();
729 ld->localRelays = c->localRelays();
730 ld->stayConnected = c->stayConnected;
731 ld->chDisp = c->chDisp;
732 ld->bTracker = c->sourceHost.tracker;
737 if (!foundFlg && !c->thread.finish){
738 ListData *newData = new ListData();
739 newData->next = list_top;
742 newData->channel_id = c->channel_id;
743 strncpy(newData->name, sjis, 20);
744 newData->name[20] = '\0';
745 newData->bitRate = c->info.bitrate;
746 newData->status = c->status;
747 newData->statusStr = c->getStatusStr();
748 newData->totalListeners = c->totalListeners();
749 newData->totalRelays = c->totalRelays();
750 newData->localListeners = c->localListeners();
751 newData->localRelays = c->localRelays();
752 newData->stayConnected = c->stayConnected;
753 newData->chDisp = c->chDisp;
754 newData->bTracker = c->sourceHost.tracker;
756 int idx = SendDlgItemMessage(guiWnd, chanID, LB_ADDSTRING, 0, (LONG)"");
757 SendDlgItemMessage(guiWnd, chanID, LB_SETITEMDATA, idx, (LONG)(newData->channel_id));
764 ListData *prev = NULL;
767 ListData *next = ld->next;
775 SendDlgItemMessage(guiWnd, chanID, LB_DELETESTRING, idx, 0);
784 InvalidateRect(GetDlgItem(guiWnd, chanID), NULL, FALSE);
786 /* String sjis; //JP-Patch
787 sjis = c->getName(); //JP-Patch
788 sjis.convertTo(String::T_SJIS); //JP-Patch
789 strncpy(cname,sjis.cstr(),16); //JP-Patch
790 //strncpy(cname,c->getName(),16);
792 //int sec = ((c->currSPacket*c->bitrate*SPacket::DATA_LEN)/8)/(c->bitrate*1024);
793 //int k = ((c->currSPacket*SPacket::DATA_LEN))/(1024);
794 //ADDCHAN(c,"%d. %s - %d KB/s - %du - %dk",num,cname,c->bitrate,c->listeners,k);
795 //ADDCHAN(c,"%d. %s - %d kb/s - %s",c->index,cname,c->getBitrate(),c->getStatusStr());
796 ADDCHAN(c,"%s - %d kb/s - %s - %d/%d-[%d/%d] - %s",cname,c->getBitrate(),c->getStatusStr(),
797 c->totalListeners(),c->totalRelays(),c->localListeners(),c->localRelays(),c->stayConnected?"Yes":"No"); //JP-Patch
802 // SendDlgItemMessage(guiWnd, chanID,LB_SETCURSEL, sel, 0);
804 // SendDlgItemMessage(guiWnd, chanID,LB_SETTOPINDEX, top, 0);
809 bool update = ((sys->getTime() - chanMgr->lastHit) < 3)||(!shownChannels);
813 shownChannels = true;
815 sel = SendDlgItemMessage(guiWnd, hitID,LB_GETCURSEL, 0, 0);
816 top = SendDlgItemMessage(guiWnd, hitID,LB_GETTOPINDEX, 0, 0);
817 SendDlgItemMessage(guiWnd, hitID, LB_RESETCONTENT, 0, 0);
819 chanMgr->hitlistlock.on();
821 ChanHitList *chl = chanMgr->hitlist;
827 if (chl->info.match(chanMgr->searchInfo))
829 strncpy(cname,chl->info.name.cstr(),16);
831 ADDHIT(chl,"%s - %d kb/s - %d/%d",cname,chl->info.bitrate,chl->numListeners(),chl->numHits());
836 chanMgr->hitlistlock.off();
840 SendDlgItemMessage(guiWnd, hitID,LB_SETCURSEL, sel, 0);
842 SendDlgItemMessage(guiWnd, hitID,LB_SETTOPINDEX, top, 0);
849 switch (servMgr->getFirewall())
852 SendDlgItemMessage(guiWnd, IDC_EDIT4,WM_SETTEXT, 0, (LONG)"Firewalled");
854 case ServMgr::FW_UNKNOWN:
855 SendDlgItemMessage(guiWnd, IDC_EDIT4,WM_SETTEXT, 0, (LONG)"Unknown");
857 case ServMgr::FW_OFF:
858 SendDlgItemMessage(guiWnd, IDC_EDIT4,WM_SETTEXT, 0, (LONG)"Normal");
863 // sleep for 1 second .. check every 1/10th for shutdown
866 if(sleep_skip) // for PCRaw (connection list)
878 ListData *ld = list_top;
889 ServentData *sd = servent_top;
905 // --------------------------------------------------
913 char *sendStr = "GET / HTTP/1.1\n\n";
916 sock.open("taiyo",80);
917 sock.write(sendStr,strlen(sendStr));
919 LOG("Connected: %s",tmp);
920 }catch(IOException &e)
928 // ---------------------------------
929 void APICALL MyPeercastApp ::printLog(LogBuffer::TYPE t, const char *str)
931 ADDLOG(str,logID,true,NULL,t);
932 if (logFile.isOpen())
934 logFile.writeLine(str);
940 // --------------------------------------------------
941 static void setControls(bool fromGUI)
945 setEditInt(IDC_EDIT1,servMgr->serverHost.port);
946 setEditStr(IDC_EDIT3,servMgr->password);
947 setEditStr(IDC_EDIT9,chanMgr->broadcastMsg.cstr());
948 setEditInt(IDC_MAXRELAYS,servMgr->maxRelays);
950 setButtonState(IDC_CHECK11,chanMgr->broadcastMsg[0]!=0);
952 setButtonState(IDC_LOGDEBUG,(servMgr->showLog&(1<<LogBuffer::T_DEBUG))!=0);
953 setButtonState(IDC_LOGERRORS,(servMgr->showLog&(1<<LogBuffer::T_ERROR))!=0);
954 setButtonState(IDC_LOGNETWORK,(servMgr->showLog&(1<<LogBuffer::T_NETWORK))!=0);
955 setButtonState(IDC_LOGCHANNELS,(servMgr->showLog&(1<<LogBuffer::T_CHANNEL))!=0);
957 setButtonState(IDC_CHECK9,servMgr->pauseLog);
961 setButtonState(IDC_CHECK1,servMgr->autoServe);
965 // --------------------------------------------------
966 void APICALL MyPeercastApp::updateSettings()
971 void MoveControl(HWND hWnd, int cx, int cy, int y, HDWP& hDwp){
975 GetWindowRect(hWnd, &rc2);
978 ScreenToClient(guiWnd, &pos);
979 hDwp = DeferWindowPos(hDwp, hWnd, HWND_TOP,
980 pos.x,cy-y-(rc2.bottom-rc2.top),rc2.right-rc2.left,rc2.bottom-rc2.top,SWP_SHOWWINDOW);
983 void MoveControl2(HWND hWnd, int cx, int cy, int y, HDWP& hDwp){
987 GetWindowRect(hWnd, &rc);
990 ScreenToClient(guiWnd, &pos);
991 hDwp = DeferWindowPos(hDwp, hWnd, HWND_TOP,
992 pos.x,pos.y,rc.right-rc.left,cy-y,SWP_SHOWWINDOW);
995 // --------------------------------------------------
996 void MoveControls(LPARAM lParam){
998 //IDC_LIST1 3,291,291,43
999 /* CONTROL "
\97L
\8cø",IDC_CHECK1,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
1000 WS_TABSTOP,9,29,60,20,WS_EX_TRANSPARENT
1001 EDITTEXT IDC_EDIT1,127,18,47,12,ES_AUTOHSCROLL
1002 RTEXT "
\83|
\81[
\83g :",IDC_STATIC,107,20,18,8
1003 GROUPBOX "",IDC_STATIC,3,4,291,49
1004 PUSHBUTTON "
\90Ø
\92f",IDC_BUTTON5,67,65,43,13
1005 EDITTEXT IDC_EDIT3,127,34,47,12,ES_PASSWORD | ES_AUTOHSCROLL
1006 RTEXT "
\83p
\83X
\83\8f\81[
\83h :",IDC_STATIC,89,36,36,8
1007 PUSHBUTTON "
\8dÄ
\90¶",IDC_BUTTON8,10,65,22,13
1008 PUSHBUTTON "
\8dÄ
\90Ú
\91±",IDC_BUTTON3,41,65,24,13
1009 RTEXT "
\8dÅ
\91å
\83\8a\83\8c\81[
\90\94 :",IDC_STATIC,203,20,40,8
1010 EDITTEXT IDC_MAXRELAYS,248,18,40,14,ES_AUTOHSCROLL | ES_NUMBER
1011 PUSHBUTTON "
\83L
\81[
\83v",IDC_BUTTON9,112,65,24,13
1012 LTEXT "Peercast-VP",IDC_STATIC,21,14,39,8*/
1015 GROUPBOX "
\83\8a\83\8c\81[",IDC_GROUPBOX_RELAY,3,54,291,132
1016 LISTBOX IDC_LIST3,3,81,291,102,LBS_OWNERDRAWFIXED |
1017 LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
1018 CONTROL "DJ",IDC_CHECK11,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
1019 WS_TABSTOP,5,190,23,12
1020 EDITTEXT IDC_EDIT9,33,189,261,14,ES_AUTOHSCROLL
1021 LTEXT "
\83R
\83l
\83N
\83V
\83\87\83\93",IDC_STATIC_CONNECTION,3,214,40,8
1022 PUSHBUTTON "
\90Ø
\92f",IDC_BUTTON6,47,209,43,13
1023 LISTBOX IDC_LIST2,3,224,291,53,LBS_NOINTEGRALHEIGHT | WS_VSCROLL |
1025 LTEXT "
\83\8d\83O",IDC_STATIC_LOG,3,282,13,8
1026 PUSHBUTTON "
\83N
\83\8a\83A",IDC_BUTTON1,35,279,25,11
1027 CONTROL "
\92â
\8e~",IDC_CHECK9,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
1028 WS_TABSTOP,60,279,30,11
1029 CONTROL "
\83f
\83o
\83b
\83O",IDC_LOGDEBUG,"Button",BS_AUTOCHECKBOX |
1030 BS_PUSHLIKE | WS_TABSTOP,127,279,32,11
1031 CONTROL "
\83G
\83\89\81[",IDC_LOGERRORS,"Button",BS_AUTOCHECKBOX |
1032 BS_PUSHLIKE | WS_TABSTOP,159,279,25,11
1033 CONTROL "
\83l
\83b
\83g
\83\8f\81[
\83N",IDC_LOGNETWORK,"Button",BS_AUTOCHECKBOX |
1034 BS_PUSHLIKE | WS_TABSTOP,185,279,35,11
1035 CONTROL "
\83`
\83\83\83\93\83l
\83\8b",IDC_LOGCHANNELS,"Button",BS_AUTOCHECKBOX |
1036 BS_PUSHLIKE | WS_TABSTOP,221,279,35,11
1037 LISTBOX IDC_LIST1,3,291,291,43,LBS_NOINTEGRALHEIGHT | WS_VSCROLL |
1040 hDwp = BeginDeferWindowPos(15);
1041 int cx = LOWORD(lParam);
1042 int cy = HIWORD(lParam);
1044 MoveControl2(GetDlgItem(guiWnd, IDC_GROUPBOX_RELAY), cx, cy, 343, hDwp);
1045 MoveControl2(GetDlgItem(guiWnd, IDC_LIST3), cx, cy, 385, hDwp);
1047 MoveControl(GetDlgItem(guiWnd, IDC_EDIT9), cx, cy, 233, hDwp);
1048 MoveControl(GetDlgItem(guiWnd, IDC_CHECK11), cx, cy, 232, hDwp);
1049 MoveControl(GetDlgItem(guiWnd, IDC_STATIC_CONNECTION), cx, cy, 209, hDwp);
1050 MoveControl(GetDlgItem(guiWnd, IDC_BUTTON6), cx, cy, 208, hDwp);
1051 MoveControl(GetDlgItem(guiWnd, IDC_LIST2), cx, cy, 94, hDwp);
1052 MoveControl(GetDlgItem(guiWnd, IDC_STATIC_LOG), cx, cy, 72, hDwp);
1053 MoveControl(GetDlgItem(guiWnd, IDC_CHECK9), cx, cy, 71, hDwp);
1054 MoveControl(GetDlgItem(guiWnd, IDC_BUTTON1), cx, cy, 71, hDwp);
1055 MoveControl(GetDlgItem(guiWnd, IDC_LOGDEBUG), cx, cy, 71, hDwp);
1056 MoveControl(GetDlgItem(guiWnd, IDC_LOGNETWORK), cx, cy, 71, hDwp);
1057 MoveControl(GetDlgItem(guiWnd, IDC_LOGERRORS), cx, cy, 71, hDwp);
1058 MoveControl(GetDlgItem(guiWnd, IDC_LOGCHANNELS), cx, cy, 71, hDwp);
1059 MoveControl(GetDlgItem(guiWnd, IDC_LIST1), cx, cy, 3, hDwp);
1061 EndDeferWindowPos(hDwp);
1064 WINDOWPLACEMENT winPlace;
1065 bool guiFlg = false;
1067 // --------------------------------------------------
1068 LRESULT CALLBACK GUIProc (HWND hwnd, UINT message,
1069 WPARAM wParam, LPARAM lParam)
1074 LRESULT from; //
\95Ï
\8a·
\8c³
1075 LRESULT to; //
\95Ï
\8a·
\90æ
1079 { HTLEFT, HTBORDER }, //
\8d¶
\92[
\82Ì
\8d¶
\89E
\96î
\88ó
\81¨
\96î
\88ó
\82È
\82µ
1080 { HTRIGHT, HTBORDER }, //
\89E
\92[
\82Ì
\8d¶
\89E
\96î
\88ó
\81¨
\96î
\88ó
\82È
\82µ
1081 { HTTOPLEFT, HTTOP }, //
\8d¶
\8fã
\8b÷
\82Ì
\8eÎ
\82ß
\96î
\88ó
\81¨
\8fc
\96î
\88ó
1082 { HTTOPRIGHT, HTTOP }, //
\89E
\8fã
\8b÷
\82Ì
\8eÎ
\82ß
\96î
\88ó
\81¨
\8fc
\96î
\88ó
1083 { HTBOTTOMLEFT, HTBOTTOM }, //
\8d¶
\89º
\8b÷
\82Ì
\8eÎ
\82ß
\96î
\88ó
\81¨
\8fc
\96î
\88ó
1084 { HTBOTTOMRIGHT, HTBOTTOM }, //
\89E
\89º
\8b÷
\82Ì
\8eÎ
\82ß
\96î
\88ó
\81¨
\8fc
\96î
\88ó
1086 { HTBOTTOM, HTBOTTOM }
1090 bool rectflg = false;
1097 shownChannels = false;
1098 logID = IDC_LIST1; // log
1099 statusID = IDC_LIST2; // status
1100 hitID = IDC_LIST4; // hit
1101 chanID = IDC_LIST3; // channels
1103 enableControl(IDC_BUTTON8,false);
1104 enableControl(IDC_BUTTON11,false);
1105 enableControl(IDC_BUTTON10,false);
1107 peercastApp->updateSettings();
1109 if (servMgr->autoServe)
1110 setButtonState(IDC_CHECK1,true);
1111 if (servMgr->autoConnect)
1112 setButtonState(IDC_CHECK2,true);
1115 guiThread.func = showConnections;
1116 if (!sys->startThread(&guiThread))
1118 MessageBox(hwnd,"Unable to start GUI","PeerCast",MB_OK|MB_ICONERROR);
1119 PostMessage(hwnd,WM_DESTROY,0,0);
1123 SetWindowPlacement(hwnd, &winPlace);
1126 { // for PCRaw (connection list)
1129 hwndList = GetDlgItem(guiWnd, chanID);
1131 wndOldListBox = (WNDPROC)GetWindowLong(hwndList, GWL_WNDPROC);
1132 SetWindowLong(hwndList, GWL_WNDPROC, (DWORD)ListBoxProc);
1134 hwndList = GetDlgItem(guiWnd, statusID);
1135 wndOldConnListBox = (WNDPROC)GetWindowLong(hwndList, GWL_WNDPROC);
1136 SetWindowLong(hwndList, GWL_WNDPROC, (DWORD)ConnListBoxProc);
1138 wndOldListBox = (WNDPROC)GetWindowLongPtr(hwndList, GWLP_WNDPROC);
1139 SetWindowLongPtr(hwndList, GWLP_WNDPROC, (DWORD)ListBoxProc);
1141 hwndList = GetDlgItem(guiWnd, statusID);
1142 wndOldConnListBox = (WNDPROC)GetWindowLongPtr(hwndList, GWLP_WNDPROC);
1143 SetWindowLongPtr(hwndList, GWLP_WNDPROC, (DWORD)ConnListBoxProc);
1152 case IDC_CHECK1: // start server
1153 if (getButtonState(IDC_CHECK1))
1155 //SendDlgItemMessage(hwnd, IDC_CHECK1,WM_SETTEXT, 0, (LPARAM)"Deactivate");
1157 SendDlgItemMessage(hwnd, IDC_EDIT3,WM_GETTEXT, 64, (LONG)servMgr->password);
1159 servMgr->serverHost.port = (unsigned short)getEditInt(IDC_EDIT1);
1160 servMgr->setMaxRelays(getEditInt(IDC_MAXRELAYS));
1163 enableControl(IDC_EDIT1,false);
1164 enableControl(IDC_EDIT3,false);
1165 enableControl(IDC_MAXRELAYS,false);
1166 enableControl(IDC_BUTTON8,true);
1167 enableControl(IDC_BUTTON11,true);
1168 enableControl(IDC_BUTTON10,true);
1171 servMgr->autoServe = true;
1173 setEditStr(IDC_CHECK1,"Enabled");
1177 //SendDlgItemMessage(hwnd, IDC_CHECK1,WM_SETTEXT, 0, (LPARAM)"Activate");
1179 servMgr->autoServe = false;
1181 enableControl(IDC_EDIT1,true);
1182 enableControl(IDC_EDIT3,true);
1183 enableControl(IDC_MAXRELAYS,true);
1184 enableControl(IDC_BUTTON8,false);
1185 enableControl(IDC_BUTTON11,false);
1186 enableControl(IDC_BUTTON10,false);
1188 setEditStr(IDC_CHECK1,"Disabled");
1194 case IDC_CHECK11: // DJ message
1195 if (getButtonState(IDC_CHECK11))
1197 enableControl(IDC_EDIT9,false);
1198 SendDlgItemMessage(hwnd, IDC_EDIT9,WM_GETTEXT, 128, (LONG)chanMgr->broadcastMsg.cstr());
1200 enableControl(IDC_EDIT9,true);
1201 chanMgr->broadcastMsg.clear();
1204 case IDC_LOGDEBUG: // log debug
1205 servMgr->showLog = getButtonState(wParam) ? servMgr->showLog|(1<<LogBuffer::T_DEBUG) : servMgr->showLog&~(1<<LogBuffer::T_DEBUG);
1207 case IDC_LOGERRORS: // log errors
1208 servMgr->showLog = getButtonState(wParam) ? servMgr->showLog|(1<<LogBuffer::T_ERROR) : servMgr->showLog&~(1<<LogBuffer::T_ERROR);
1210 case IDC_LOGNETWORK: // log network
1211 servMgr->showLog = getButtonState(wParam) ? servMgr->showLog|(1<<LogBuffer::T_NETWORK) : servMgr->showLog&~(1<<LogBuffer::T_NETWORK);
1213 case IDC_LOGCHANNELS: // log channels
1214 servMgr->showLog = getButtonState(wParam) ? servMgr->showLog|(1<<LogBuffer::T_CHANNEL) : servMgr->showLog&~(1<<LogBuffer::T_CHANNEL);
1216 case IDC_CHECK9: // pause log
1217 servMgr->pauseLog = getButtonState(wParam);
1219 case IDC_CHECK2: // start outgoing
1221 if (getButtonState(IDC_CHECK2))
1224 SendDlgItemMessage(hwnd, IDC_COMBO1,WM_GETTEXT, 128, (LONG)servMgr->connectHost);
1225 servMgr->autoConnect = true;
1226 //SendDlgItemMessage(hwnd, IDC_CHECK2,WM_SETTEXT, 0, (LPARAM)"Disconnect");
1227 enableControl(IDC_COMBO1,false);
1229 servMgr->autoConnect = false;
1230 //SendDlgItemMessage(hwnd, IDC_CHECK2,WM_SETTEXT, 0, (LPARAM)"Connect");
1231 enableControl(IDC_COMBO1,true);
1234 case IDC_BUTTON11: // broadcast
1236 Host sh = servMgr->serverHost;
1240 sprintf(cmd,"http://localhost:%d/admin?page=broadcast",sh.port);
1241 ShellExecute(hwnd, NULL, cmd, NULL, NULL, SW_SHOWNORMAL);
1244 MessageBox(hwnd,"Server is not currently connected.\nPlease wait until you have a connection.","PeerCast",MB_OK);
1248 case IDC_BUTTON8: // play selected
1250 Channel *c = getListBoxChannel();
1252 chanMgr->playChannel(c->info);
1256 case IDC_BUTTON7: // advanced
1257 sys->callLocalURL("admin?page=settings",servMgr->serverHost.port);
1259 case IDC_BUTTON6: // servent disconnect
1261 /* Servent *s = (Servent *)getListBoxSelData(statusID);
1263 s->thread.active = false;*/
1264 Servent *s = getListBoxServent();
1266 s->thread.active = false;
1267 s->thread.finish = true;
1272 case IDC_BUTTON5: // chan disconnect
1274 /* Channel *c = (Channel *)getListBoxSelData(chanID);
1276 c->thread.active = false;*/
1278 // Channel *c = chanMgr->findChannelByChannelID((int)getListBoxSelData(chanID));
1279 Channel *c = getListBoxChannel();
1281 c->thread.active = false;
1282 c->thread.finish = true;
1287 case IDC_BUTTON3: // chan bump
1289 /* Channel *c = (Channel *)getListBoxSelData(chanID);
1293 // Channel *c = chanMgr->findChannelByChannelID((int)getListBoxSelData(chanID));
1294 Channel *c = getListBoxChannel();
1301 case IDC_BUTTON4: // get channel
1303 ChanHitList *chl = (ChanHitList *)getListBoxSelData(hitID);
1306 if (!chanMgr->findChannelByID(chl->info.id))
1308 Channel *c = chanMgr->createChannel(chl->info,NULL);
1313 MessageBox(hwnd,"Please select a channel","PeerCast",MB_OK);
1318 case IDC_BUTTON9: //JP-EX chan keep
1320 /* Channel *c = (Channel *)getListBoxSelData(chanID);
1323 if (!c->stayConnected)
1325 //if (servMgr->getFirewall() == ServMgr::FW_OFF)
1326 c->stayConnected = true;
1329 c->stayConnected = false;
1332 // Channel *c = chanMgr->findChannelByChannelID((int)getListBoxSelData(chanID));
1333 Channel *c = getListBoxChannel();
1335 if (!c->stayConnected){
1336 c->stayConnected = true;
1338 c->stayConnected = false;
1344 case IDC_BUTTON1: // clear log
1345 SendDlgItemMessage(guiWnd, logID, LB_RESETCONTENT, 0, 0);
1346 sys->logBuf->clear(); // for PCRaw (clear log)
1349 case IDC_BUTTON2: // find
1352 SendDlgItemMessage(hwnd, IDC_EDIT2,WM_GETTEXT, 64, (LONG)str);
1353 SendDlgItemMessage(hwnd, hitID, LB_RESETCONTENT, 0, 0);
1357 chanMgr->startSearch(info);
1364 case WM_MEASUREITEM:
1365 if ((UINT) wParam==IDC_LIST3){
1366 LPMEASUREITEMSTRUCT lpMI = (LPMEASUREITEMSTRUCT)lParam;
1367 lpMI->itemHeight = 12;
1368 } else if ((UINT) wParam==IDC_LIST2){
1369 LPMEASUREITEMSTRUCT lpMI = (LPMEASUREITEMSTRUCT)lParam;
1370 lpMI->itemHeight = 12;
1374 if ((UINT) wParam==IDC_LIST3)
1376 LPDRAWITEMSTRUCT _DrawItem=(LPDRAWITEMSTRUCT)lParam;
1379 unsigned int idx = 0;
1384 if (_DrawItem->itemID == idx){
1391 if ((_DrawItem->itemState) & (ODS_SELECTED))
1393 hBrush=CreateSolidBrush(RGB(49,106,197));
1397 hBrush=CreateSolidBrush(RGB(255,255,255));
1399 FillRect(_DrawItem->hDC,&_DrawItem->rcItem,hBrush);
1400 DeleteObject(hBrush);
1403 if (ld->status == Channel::S_RECEIVING){
1404 if (ld->chDisp.status == Channel::S_RECEIVING){
1405 if (ld->chDisp.relay){
1407 SetTextColor(_DrawItem->hDC,RGB(0,255,0));
1408 SetBkColor(_DrawItem->hDC,RGB(255,255,255)) ;
1411 if (ld->chDisp.numRelays){
1413 SetTextColor(_DrawItem->hDC,RGB(0,0,255));
1414 SetBkColor(_DrawItem->hDC,RGB(255,255,255)) ;
1417 SetTextColor(_DrawItem->hDC,RGB(255,0,255));
1418 SetBkColor(_DrawItem->hDC,RGB(255,255,255)) ;
1422 /* status unmatch */
1423 SetTextColor(_DrawItem->hDC,RGB(0,0,0));
1424 SetBkColor(_DrawItem->hDC,RGB(255,255,255)) ;
1426 TextOut(_DrawItem->hDC,
1427 _DrawItem->rcItem.left,
1428 _DrawItem->rcItem.top,
1432 SetTextColor(_DrawItem->hDC,RGB(0,0,0));
1433 SetBkColor(_DrawItem->hDC,RGB(255,255,255)) ;
1434 TextOut(_DrawItem->hDC,
1435 _DrawItem->rcItem.left,
1436 _DrawItem->rcItem.top,
1440 if ((_DrawItem->itemState) & (ODS_SELECTED))
1442 SetTextColor(_DrawItem->hDC,RGB(255,255,255));
1443 SetBkColor(_DrawItem->hDC,RGB(49,106,197)) ;
1445 SetTextColor(_DrawItem->hDC,RGB(0,0,0));
1446 SetBkColor(_DrawItem->hDC,RGB(255,255,255)) ;
1448 if (servMgr->getFirewall() == ServMgr::FW_ON){
1449 SetTextColor(_DrawItem->hDC,RGB(255,0,0));
1450 } else if (ld->bTracker && (ld->status == Channel::S_RECEIVING)){
1451 if ((_DrawItem->itemState) & (ODS_SELECTED))
1453 SetTextColor(_DrawItem->hDC,RGB(0,255,0));
1454 SetBkColor(_DrawItem->hDC,RGB(49,106,197)) ;
1456 SetTextColor(_DrawItem->hDC,RGB(0,128,0));
1460 TextOut(_DrawItem->hDC,
1461 _DrawItem->rcItem.left + 12,
1462 _DrawItem->rcItem.top,
1465 /* sprintf(buf, "- %4dkbps -", ld->bitRate);
1466 TextOut(_DrawItem->hDC,
1467 _DrawItem->rcItem.left + 12 + 118,
1468 _DrawItem->rcItem.top,
1471 TextOut(_DrawItem->hDC,
1472 _DrawItem->rcItem.left + 12 + 118 + 80,
1473 _DrawItem->rcItem.top,
1475 strlen(ld->statusStr));
1476 sprintf(buf, "- %3d/%3d - [%3d/%3d] -", ld->totalListeners, ld->totalRelays, ld->localListeners, ld->localRelays);
1477 TextOut(_DrawItem->hDC,
1478 _DrawItem->rcItem.left + 12 + 118 + 80 + 80,
1479 _DrawItem->rcItem.top,
1482 strcpy(buf, ld->stayConnected?"YES":"NO");
1483 TextOut(_DrawItem->hDC,
1484 _DrawItem->rcItem.left + 12 + 118 + 80 + 80 + 130,
1485 _DrawItem->rcItem.top,
1488 sprintf(buf, "- %4dkbps - %s - %3d/%3d - [%3d/%3d] - %s",
1495 ld->stayConnected?"YES":"NO");
1496 TextOut(_DrawItem->hDC,
1497 _DrawItem->rcItem.left + 12 + 118,
1498 _DrawItem->rcItem.top,
1502 } else if ((UINT) wParam==IDC_LIST2) {
1503 LPDRAWITEMSTRUCT _DrawItem=(LPDRAWITEMSTRUCT)lParam;
1506 unsigned int idx = 0;
1513 if (_DrawItem->itemID == idx){
1523 sd->h.toStr(hostName);
1525 if ((_DrawItem->itemState) & (ODS_SELECTED))
1527 hBrush=CreateSolidBrush(RGB(49,106,197));
1531 hBrush=CreateSolidBrush(RGB(255,255,255));
1533 FillRect(_DrawItem->hDC,&_DrawItem->rcItem,hBrush);
1534 DeleteObject(hBrush);
1539 SetTextColor(_DrawItem->hDC,RGB(0,255,0));
1540 // SetBkColor(_DrawItem->hDC,RGB(255,255,255));
1545 SetTextColor(_DrawItem->hDC,RGB(0,0,255));
1546 // SetBkColor(_DrawItem->hDC,RGB(255,255,255));
1549 SetTextColor(_DrawItem->hDC,RGB(255,0,255));
1550 // SetBkColor(_DrawItem->hDC,RGB(255,255,255));
1555 SetTextColor(_DrawItem->hDC,RGB(0,0,0));
1556 // SetBkColor(_DrawItem->hDC,RGB(255,255,255));
1559 if (sd->lastSkipTime + 120 > sys->getTime()){
1560 SetBkColor(_DrawItem->hDC,RGB(128,128,128));
1561 if (sd->type == Servent::T_RELAY){
1562 sprintf(buf, "
\81¥(%d)",sd->lastSkipCount);
1563 TextOut(_DrawItem->hDC,
1564 _DrawItem->rcItem.left,
1565 _DrawItem->rcItem.top,
1569 SetTextColor(_DrawItem->hDC,RGB(0,0,0));
1570 sprintf(buf, "
\81¤(%d)",sd->lastSkipCount);
1571 TextOut(_DrawItem->hDC,
1572 _DrawItem->rcItem.left,
1573 _DrawItem->rcItem.top,
1578 SetBkColor(_DrawItem->hDC,RGB(255,255,255));
1579 if (sd->type == Servent::T_RELAY){
1580 TextOut(_DrawItem->hDC,
1581 _DrawItem->rcItem.left,
1582 _DrawItem->rcItem.top,
1586 SetTextColor(_DrawItem->hDC,RGB(0,0,0));
1587 SetBkColor(_DrawItem->hDC,RGB(255,255,255)) ;
1588 TextOut(_DrawItem->hDC,
1589 _DrawItem->rcItem.left,
1590 _DrawItem->rcItem.top,
1596 if ((_DrawItem->itemState) & (ODS_SELECTED))
1598 SetTextColor(_DrawItem->hDC,RGB(255,255,255));
1599 SetBkColor(_DrawItem->hDC,RGB(49,106,197)) ;
1601 SetTextColor(_DrawItem->hDC,RGB(0,0,0));
1602 SetBkColor(_DrawItem->hDC,RGB(255,255,255)) ;
1604 if (sd->firewalled){
1605 if (!sd->numRelays){
1606 SetTextColor(_DrawItem->hDC,RGB(255,0,0));
1608 SetTextColor(_DrawItem->hDC,RGB(255,168,0));
1613 if (sd->ver_ex_number){
1614 sprintf(buf2, "(%c%c%04d)", sd->ver_ex_prefix[0], sd->ver_ex_prefix[1], sd->ver_ex_number);
1615 } else if (sd->vp_ver){
1616 sprintf(buf2, "(VP%04d)", sd->vp_ver);
1620 if (sd->type == Servent::T_RELAY){
1621 if (sd->status == Servent::S_CONNECTED){
1622 sprintf(buf, "(%d)RELAYING-%ds - %d/%d - %s - %d - %s%s",
1625 sd->totalListeners, sd->totalRelays,
1627 sd->syncpos, sd->agent.cstr(), buf2
1630 sprintf(buf, "%s-%s-%ds - %d/%d - %s - %d - %s%s",
1631 sd->typeStr, sd->statusStr, sd->tnum,
1632 sd->totalListeners, sd->totalRelays,
1634 sd->syncpos, sd->agent.cstr(), buf2
1637 } else if (sd->type == Servent::T_DIRECT){
1638 sprintf(buf, "%s-%s-%ds - %s - %d - %s ",
1639 sd->typeStr, sd->statusStr, sd->tnum,
1641 sd->syncpos, sd->agent.cstr()
1644 if (sd->status == Servent::S_CONNECTED){
1645 sprintf(buf, "%s-%s-%ds - %s - %d/%d",
1646 sd->typeStr, sd->statusStr, sd->tnum,
1648 sd->syncpos, sd->agent.cstr()
1651 sprintf(buf, "%s-%s-%ds - %s",
1652 sd->typeStr, sd->statusStr, sd->tnum,
1657 TextOut(_DrawItem->hDC,
1658 _DrawItem->rcItem.left + 12,
1659 _DrawItem->rcItem.top,
1668 MoveControls(lParam);
1671 case WM_GETMINMAXINFO:
1673 MINMAXINFO *pmmi = (MINMAXINFO *)lParam;
1676 pmmi->ptMinTrackSize.x = 530; //
\8dÅ
\8f¬
\95\9d
1677 pmmi->ptMinTrackSize.y = 435; //
\8dÅ
\8f¬
\8d\82
1678 pmmi->ptMaxTrackSize.x = 530; //
\8dÅ
\91å
\95\9d
1679 pmmi->ptMaxTrackSize.y = 1200; //
\8dÅ
\91å
\8d\82
1684 /* case WM_NCHITTEST:
1686 LRESULT lResult; //
\83J
\81[
\83\
\83\8b\88Ê
\92u
\94»
\92è
\8c\8b\89Ê
1688 //
\95Ï
\8a·
\88ê
\97\97\82É
\82 \82ê
\82Î
\95Ï
\8a·
\82µ
\82½
\92l
\82ð
\95Ô
\82·
\81B
1689 lResult = DefWindowProc( guiWnd, message, wParam, lParam );
1690 for( int i = 0; i < 8; i++ )
1692 if ( lResult == trans[ i ].from )
1694 return trans[ i ].to;
1698 // return HTCAPTION;
1703 GetWindowPlacement(hwnd, &winPlace);
1705 DestroyWindow( hwnd );
1709 GetWindowPlacement(hwnd, &winPlace);
1711 guiThread.active = false;
1712 // guiThread.lock();
1714 // guiThread.unlock();
1715 EndDialog(hwnd, LOWORD(wParam));
1720 //return DefDlgProc(hwnd, message, wParam, lParam); // this recurses for ever
1721 //return DefWindowProc(hwnd, message, wParam, lParam); // this stops window messages