From 9a85fa5ff6dfb059e5f0f0e182930eb46a640deb Mon Sep 17 00:00:00 2001 From: eru Date: Sun, 27 Sep 2009 15:42:36 +0000 Subject: [PATCH] =?utf8?q?COUT=E5=88=87=E6=96=AD=E6=A9=9F=E8=83=BD?= =?utf8?q?=E3=82=92=E8=BF=BD=E5=8A=A0=20=E5=AD=A6=E7=BF=92=E5=B8=B31?= =?utf8?q?=E3=81=AE=E3=83=9E=E3=83=BC=E3=82=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- PeerCast.root/PeerCast/core/common/stream.cpp | 5 +- PeerCast.root/PeerCast/core/common/version2.h | 8 +- .../PeerCast/core/win32/lib/corelib.vcproj | 504 +++++++++++---------- PeerCast.root/PeerCast/ui/win32/simple/Simple.rc | 39 ++ .../PeerCast/ui/win32/simple/Simple.vcproj | 7 +- PeerCast.root/PeerCast/ui/win32/simple/gui.cpp | 368 ++++++++++----- PeerCast.root/PeerCast/ui/win32/simple/gui.h | 6 + .../PeerCast.root/PeerCast/core/common/stream.cpp | 5 +- .../PeerCast.root/PeerCast/core/common/version2.h | 8 +- .../PeerCast/core/win32/lib/corelib.vcproj | 504 +++++++++++---------- .../PeerCast/ui/win32/simple/Simple.rc | 39 ++ .../PeerCast/ui/win32/simple/Simple.vcproj | 7 +- .../PeerCast.root/PeerCast/ui/win32/simple/gui.cpp | 368 ++++++++++----- .../PeerCast.root/PeerCast/ui/win32/simple/gui.h | 6 + 14 files changed, 1128 insertions(+), 746 deletions(-) diff --git a/PeerCast.root/PeerCast/core/common/stream.cpp b/PeerCast.root/PeerCast/core/common/stream.cpp index b1f64b5..e303ed6 100644 --- a/PeerCast.root/PeerCast/core/common/stream.cpp +++ b/PeerCast.root/PeerCast/core/common/stream.cpp @@ -279,12 +279,13 @@ void Stream::writeLineF(const char *fmt,...) write(fmt,ap); + // special thanks: –¼–³‚µ‚Ì’N‚© + va_end(ap); + if (writeCRLF) write("\r\n",2); else write("\n",1); - - va_end(ap); } // ------------------------------------- diff --git a/PeerCast.root/PeerCast/core/common/version2.h b/PeerCast.root/PeerCast/core/common/version2.h index b316589..1497f04 100644 --- a/PeerCast.root/PeerCast/core/common/version2.h +++ b/PeerCast.root/PeerCast/core/common/version2.h @@ -44,11 +44,11 @@ extern int version_ex; // VERSION_EX #if 1 /* for VP extend version */ //#define VERSION_EX 1 static const char *PCP_CLIENT_VERSION_EX_PREFIX = "IM"; // 2bytes only -static const int PCP_CLIENT_VERSION_EX_NUMBER = 38; -static const char *PCX_AGENTEX = "PeerCast/0.1218(IM0038)"; -static const char *PCX_VERSTRING_EX = "v0.1218(IM0038)"; +static const int PCP_CLIENT_VERSION_EX_NUMBER = 39; +static const char *PCX_AGENTEX = "PeerCast/0.1218(IM0039)"; +static const char *PCX_VERSTRING_EX = "v0.1218(IM0039)"; -static const char *PCP_CLIENT_DIST_URL = "http://peercastim.s353.xrea.com/"; +static const char *PCP_CLIENT_DIST_URL = "http://pecaim.net/"; #endif // ------------------------------------------------ diff --git a/PeerCast.root/PeerCast/core/win32/lib/corelib.vcproj b/PeerCast.root/PeerCast/core/win32/lib/corelib.vcproj index bc8dfe6..d12268c 100644 --- a/PeerCast.root/PeerCast/core/win32/lib/corelib.vcproj +++ b/PeerCast.root/PeerCast/core/win32/lib/corelib.vcproj @@ -97,9 +97,9 @@ /> diff --git a/PeerCast.root/PeerCast/ui/win32/simple/Simple.rc b/PeerCast.root/PeerCast/ui/win32/simple/Simple.rc index 2ac10d2..90a2888 100644 --- a/PeerCast.root/PeerCast/ui/win32/simple/Simple.rc +++ b/PeerCast.root/PeerCast/ui/win32/simple/Simple.rc @@ -64,6 +64,45 @@ BEGIN END #endif // APSTUDIO_INVOKED + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,3,9,0 + PRODUCTVERSION 1,3,9,0 + FILEFLAGSMASK 0x17L +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "041104b0" + BEGIN + VALUE "CompanyName", "PeCa" + VALUE "FileDescription", "Peercast IM" + VALUE "FileVersion", "1, 3, 9, 0" + VALUE "InternalName", "PeCaIM" + VALUE "LegalCopyright", "Copyright (C) 2009" + VALUE "OriginalFilename", "PeerCast.exe" + VALUE "ProductName", "Peercast IM" + VALUE "ProductVersion", "1, 3, 9, 0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x411, 1200 + END +END + #endif // “ú–{Œê resources ///////////////////////////////////////////////////////////////////////////// diff --git a/PeerCast.root/PeerCast/ui/win32/simple/Simple.vcproj b/PeerCast.root/PeerCast/ui/win32/simple/Simple.vcproj index 6428a31..aabe10d 100644 --- a/PeerCast.root/PeerCast/ui/win32/simple/Simple.vcproj +++ b/PeerCast.root/PeerCast/ui/win32/simple/Simple.vcproj @@ -376,6 +376,7 @@ BrowseInformation="1" WarningLevel="3" SuppressStartupBanner="true" + Detect64BitPortabilityProblems="true" DebugInformationFormat="3" /> diff --git a/PeerCast.root/PeerCast/ui/win32/simple/gui.cpp b/PeerCast.root/PeerCast/ui/win32/simple/gui.cpp index 230354b..90504fb 100644 --- a/PeerCast.root/PeerCast/ui/win32/simple/gui.cpp +++ b/PeerCast.root/PeerCast/ui/win32/simple/gui.cpp @@ -353,8 +353,11 @@ int ChannelData::drawChannel(Graphics *g, int x, int y){ // ƒXƒe[ƒ^ƒX•\Ž¦ Gdiplus::Image *img = NULL; unsigned int nowTime = sys->getTime(); - Channel *ch = chanMgr->findChannelByChannelID(this->channel_id); - switch(this->getStatus()){ + if (this->type != Servent::T_COUT) + { + // COUTˆÈŠO + Channel *ch = chanMgr->findChannelByChannelID(this->channel_id); + switch(this->getStatus()){ case Channel::S_IDLE: img = img_idle; break; @@ -401,7 +404,13 @@ int ChannelData::drawChannel(Graphics *g, int x, int y){ default: img = img_idle; break; + } + } else + { + // COUT—p + img = img_broad_ok; } + // •`‰æŠî“_ PointF origin(xx, yy); // ƒXƒe[ƒ^ƒX•\Ž¦ˆÊ’u @@ -430,127 +439,146 @@ int ChannelData::drawChannel(Graphics *g, int x, int y){ strBrush = ::new SolidBrush(Color::Black); } } - // ƒ`ƒƒƒ“ƒlƒ‹–¼•\Ž¦ - g->SetTextRenderingHint(TextRenderingHintAntiAlias); - _bstr_t bstr1(getName()); - // •¶Žš•`‰æ”͈͎w’è - RectF r1(origin.X, origin.Y, 120.0f, 13.0f); - StringFormat format; - format.SetAlignment(StringAlignmentNear); - g->DrawString(bstr1, -1, &font, r1, &format, strBrush); - // ŽŸ‚ÌŠî“_ - origin.X += r1.Width; - - //// ã—¬IP/ƒŠƒXƒi[”/ƒŠƒŒ[”•\Ž¦ - //// NOTE: - //// ‚Ò‚ ‚©‚·‚Ì“®ì•×‹­—pBƒŠƒŠ[ƒXƒrƒ‹ƒh‚Å‚ÍŒ³‚̃R[ƒh‚ðŽg—p‚ÌŽ–B - //// •¶Žš•\Ž¦”͈͕͂220‚®‚ç‚¢‚Å‚¨‚‹ - //char tmp[512]; // •\Ž¦—pƒoƒbƒtƒ@ - //char hostip[256]; // IPƒAƒhƒŒƒXƒoƒbƒtƒ@ - //chDisp.uphost.toStr(hostip); // ã—¬IP - //sprintf(tmp, "%d/%d - [%d/%d] - %s", - // getTotalListeners(), - // getTotalRelays(), - // getLocalListeners(), - // getLocalRelays(), - // hostip - // ); - - // ƒŠƒXƒi[”/ƒŠƒŒ[”•\Ž¦ - char tmp[256]; - sprintf(tmp, "%d/%d - [%d/%d]", getTotalListeners(), getTotalRelays(), getLocalListeners(), getLocalRelays()); - _bstr_t bstr2(tmp); - // •¶Žš•\Ž¦”͈͎w’è - RectF r2(origin.X, origin.Y, 100.0f, 13.0f); - format.SetAlignment(StringAlignmentCenter); - g->DrawString(bstr2, -1, &font, r2, &format, strBrush); - // ŽŸ‚ÌŠî“_ - origin.X += r2.Width; - - // bps•\Ž¦ - Font *f; - if (isStayConnected()){ - f = ::new Font(L"Arial", 9.0f, FontStyleItalic|FontStyleBold, UnitPoint); - } else { - f = ::new Font(L"Arial", 9.0f); - } - sprintf(tmp, "%dkbps", getBitRate()); - _bstr_t bstr3(tmp); - format.SetAlignment(StringAlignmentFar); - // •¶Žš•\Ž¦”͈͎w’è - RectF r3(origin.X, origin.Y, 80.0f, 13.0f); - g->DrawString(bstr3, -1, f, r3, &format, strBrush); - // ƒtƒHƒ“ƒgŠJ•ú - ::delete f; - - // ŽŸ‚ÌŠî“_ - origin.X += r3.Width; - - // ƒuƒ‰ƒVíœ - ::delete strBrush; - - // Servent•\Ž¦ - if (!openFlg){ - int count = getServentCount(); - // Servent•\Ž¦•”‚Ì”wŒi‚ð”’‚É‚·‚é - SolidBrush b(Color(160,255,255,255)); - g->FillRectangle(&b, (INT)origin.X, (INT)origin.Y, 14*count, 14); - - sd = serventDataTop; - int index = 0; - while(sd){ - SolidBrush *serventBrush; - if (sd->getInfoFlg()){ - ChanHit *hit = sd->getChanHit(); - if (hit->firewalled){ - SolidBrush bb(Color(180,255,0,0)); - g->FillRectangle(&bb, (INT)origin.X + 14*index, (INT)origin.Y, 14, 14); - } - if (hit->relay){ - // ƒŠƒŒ[‚n‚j - serventBrush = ::new SolidBrush(Color::Green); - } else { - // ƒŠƒŒ[•s‰Â - if (hit->numRelays){ - // ƒŠƒŒ[ˆê”t - serventBrush = ::new SolidBrush(Color::Blue); + if (this->type != Servent::T_COUT) + { + // COUTˆÈŠO + + // ƒ`ƒƒƒ“ƒlƒ‹–¼•\Ž¦ + g->SetTextRenderingHint(TextRenderingHintAntiAlias); + _bstr_t bstr1(getName()); + // •¶Žš•`‰æ”͈͎w’è + RectF r1(origin.X, origin.Y, 120.0f, 13.0f); + StringFormat format; + format.SetAlignment(StringAlignmentNear); + g->DrawString(bstr1, -1, &font, r1, &format, strBrush); + // ŽŸ‚ÌŠî“_ + origin.X += r1.Width; + + //// ã—¬IP/ƒŠƒXƒi[”/ƒŠƒŒ[”•\Ž¦ + //// NOTE: + //// ‚Ò‚ ‚©‚·‚Ì“®ì•×‹­—pBƒŠƒŠ[ƒXƒrƒ‹ƒh‚Å‚ÍŒ³‚̃R[ƒh‚ðŽg—p‚ÌŽ–B + //// •¶Žš•\Ž¦”͈͕͂220‚®‚ç‚¢‚Å‚¨‚‹ + //char tmp[512]; // •\Ž¦—pƒoƒbƒtƒ@ + //char hostip[256]; // IPƒAƒhƒŒƒXƒoƒbƒtƒ@ + //chDisp.uphost.toStr(hostip); // ã—¬IP + //sprintf(tmp, "%d/%d - [%d/%d] - %s", + // getTotalListeners(), + // getTotalRelays(), + // getLocalListeners(), + // getLocalRelays(), + // hostip + // ); + + // ƒŠƒXƒi[”/ƒŠƒŒ[”•\Ž¦ + char tmp[256]; + sprintf(tmp, "%d/%d - [%d/%d]", getTotalListeners(), getTotalRelays(), getLocalListeners(), getLocalRelays()); + _bstr_t bstr2(tmp); + // •¶Žš•\Ž¦”͈͎w’è + RectF r2(origin.X, origin.Y, 100.0f, 13.0f); + format.SetAlignment(StringAlignmentCenter); + g->DrawString(bstr2, -1, &font, r2, &format, strBrush); + // ŽŸ‚ÌŠî“_ + origin.X += r2.Width; + + // bps•\Ž¦ + Font *f; + if (isStayConnected()){ + f = ::new Font(L"Arial", 9.0f, FontStyleItalic|FontStyleBold, UnitPoint); + } else { + f = ::new Font(L"Arial", 9.0f); + } + sprintf(tmp, "%dkbps", getBitRate()); + _bstr_t bstr3(tmp); + format.SetAlignment(StringAlignmentFar); + // •¶Žš•\Ž¦”͈͎w’è + RectF r3(origin.X, origin.Y, 80.0f, 13.0f); + g->DrawString(bstr3, -1, f, r3, &format, strBrush); + // ƒtƒHƒ“ƒgŠJ•ú + ::delete f; + + // ŽŸ‚ÌŠî“_ + origin.X += r3.Width; + + // ƒuƒ‰ƒVíœ + ::delete strBrush; + + + // Servent•\Ž¦ + if (!openFlg){ + int count = getServentCount(); + // Servent•\Ž¦•”‚Ì”wŒi‚ð”’‚É‚·‚é + SolidBrush b(Color(160,255,255,255)); + g->FillRectangle(&b, (INT)origin.X, (INT)origin.Y, 14*count, 14); + + sd = serventDataTop; + int index = 0; + while(sd){ + SolidBrush *serventBrush; + if (sd->getInfoFlg()){ + ChanHit *hit = sd->getChanHit(); + if (hit->firewalled){ + SolidBrush bb(Color(180,255,0,0)); + g->FillRectangle(&bb, (INT)origin.X + 14*index, (INT)origin.Y, 14, 14); + } + if (hit->relay){ + // ƒŠƒŒ[‚n‚j + serventBrush = ::new SolidBrush(Color::Green); } else { - // ƒŠƒŒ[‚È‚µ - serventBrush = ::new SolidBrush(Color::Purple); + // ƒŠƒŒ[•s‰Â + if (hit->numRelays){ + // ƒŠƒŒ[ˆê”t + serventBrush = ::new SolidBrush(Color::Blue); + } else { + // ƒŠƒŒ[‚È‚µ + serventBrush = ::new SolidBrush(Color::Purple); + } } + } else { + // î•ñ‚È‚µ + serventBrush = ::new SolidBrush(Color::Black); } - } else { - // î•ñ‚È‚µ - serventBrush = ::new SolidBrush(Color::Black); - } - // ŽlŠp•`‰æ - backGra->FillRectangle(serventBrush, (INT)origin.X + index*14 + 1, (INT)origin.Y + 1, 12, 12); + // ŽlŠp•`‰æ + backGra->FillRectangle(serventBrush, (INT)origin.X + index*14 + 1, (INT)origin.Y + 1, 12, 12); - ::delete serventBrush; - sd = sd->getNextData(); - index++; + ::delete serventBrush; + sd = sd->getNextData(); + index++; + } } - } - // ŽŸ‚ÌŠî“_ - origin.Y += 15; + // ŽŸ‚ÌŠî“_ + origin.Y += 15; - // ƒTƒCƒY‚ð•Û‘¶ - setWidth((int)origin.X - posX); - setHeight((int)origin.Y - posY); + // ƒTƒCƒY‚ð•Û‘¶ + setWidth((int)origin.X - posX); + setHeight((int)origin.Y - posY); - // ServentData•\Ž¦ - sd = serventDataTop; - while(sd){ - if (openFlg || sd->getSelected()){ - sd->drawServent(g, (INT)x+12, (INT)origin.Y); - // ŽŸ‚ÌŠî“_ - origin.Y += 15; + // ServentData•\Ž¦ + sd = serventDataTop; + while(sd){ + if (openFlg || sd->getSelected()){ + sd->drawServent(g, (INT)x+12, (INT)origin.Y); + // ŽŸ‚ÌŠî“_ + origin.Y += 15; + } + sd = sd->getNextData(); } - sd = sd->getNextData(); + } else + { + // COUT + g->SetTextRenderingHint(TextRenderingHintAntiAlias); + RectF r1(origin.X, origin.Y, 120.0f+100.0f+80.0f, 13.0f); + origin.X += r1.Width; + StringFormat format; + format.SetAlignment(StringAlignmentNear); + _bstr_t bstr1("COUT"); + g->DrawString(bstr1, -1, &font, r1, &format, strBrush); + ::delete strBrush; + origin.Y += 15; + setWidth((int)origin.X - posX); + setHeight((int)origin.Y - posY); } - return (int)(origin.Y); } @@ -881,6 +909,90 @@ THREAD_PROC GUIDataUpdate(ThreadInfo *thread){ c = c->next; } +#if 1 + // COUT‚ðŒŸõ + { + bool foundFlg = false; + bool foundFlg2 = false; + Servent *s = servMgr->servents; + while (s) + { + if (s->type == Servent::T_COUT && s->status == Servent::S_CONNECTED) + { + foundFlg = true; + + // ChannelData––”ö‚Ü‚Å’Tõ + ChannelData *prev = NULL; + cd = channelDataTop; + while (cd) + { + if (cd->type == Servent::T_COUT && cd->servent_id == s->servent_id) + { + foundFlg2 = true; + cd->setEnableFlg(true); + break; + } + prev = cd; + cd = cd->getNextData(); + } + cd = prev; + + if (foundFlg2) + break; + + // ƒm[ƒh’ljÁ + if (channelDataTop) + { + // channelData‚ª‹ó‚Å‚È‚¢Bcd‚Í‚±‚±‚ŃŠƒXƒg––”ö‚ðŽw‚µ‚Ä‚éi‚Í‚¸j + cd->setNextData(::new ChannelData()); + cd = cd->getNextData(); + memset(cd, 0, sizeof(cd)); + cd->setNextData(NULL); + } else + { + // channelData‚ª‹ó + channelDataTop = ::new ChannelData(); + channelDataTop->setNextData(NULL); + cd = channelDataTop; + } + + // ƒf[ƒ^Ý’è + cd->type = s->type; + cd->servent_id = s->servent_id; + cd->setEnableFlg(true); + } + + s = s->next; + } + + // COUT‚ªØ‚ê‚Ä‚½‚çíœ + if (!foundFlg) + { + cd = channelDataTop; + ChannelData *prev = NULL; + while (cd) + { + // COUT‚̏î•ñ‚ðíœ + if (cd->type == Servent::T_COUT) + { + // æ“ª + if (!prev) + { + channelDataTop = cd->getNextData(); + } else + { + prev->setNextData(cd->getNextData()); + } + //::delete cd; + } + + prev = cd; + cd = cd->getNextData(); + } + } + } +#endif + // ƒ`ƒƒƒ“ƒlƒ‹‚ª‚È‚­‚È‚Á‚Ä‚¢‚éê‡‚̏ˆ— cd = channelDataTop; ChannelData *prev = NULL; @@ -892,6 +1004,7 @@ THREAD_PROC GUIDataUpdate(ThreadInfo *thread){ next = cd->getNextData(); if (!prev){ // æ“ª‚̃f[ƒ^‚ðíœ + // ‚±‚±ƒƒ‚ƒŠƒŠ[ƒN‚µ‚»‚¤ by ‚¦‚é[ channelDataTop = next; } else { // “r’†‚̃f[ƒ^‚ðíœ @@ -1192,6 +1305,11 @@ void PopupServentMenu(int servent_id){ ServentData *sd = NULL; ChannelData *cd = channelDataTop; while(cd){ + // COUT + if (cd->type == Servent::T_COUT + && cd->servent_id == servent_id) + break; + sd = cd->findServentData(servent_id); if (sd){ break; @@ -1199,7 +1317,9 @@ void PopupServentMenu(int servent_id){ cd = cd->getNextData(); } - if (cd == NULL || sd == NULL){ + if (cd == NULL || sd == NULL + && cd->type != Servent::T_COUT) // COUT + { return; } @@ -1216,6 +1336,11 @@ void PopupServentMenu(int servent_id){ cd = channelDataTop; while(cd){ + // COUT + if (cd->type == Servent::T_COUT + && cd->servent_id == servent_id) + break; + sd = cd->findServentData(servent_id); if (sd){ break; @@ -1223,7 +1348,9 @@ void PopupServentMenu(int servent_id){ cd = cd->getNextData(); } - if (cd == NULL || sd == NULL){ + if (cd == NULL || sd == NULL + && cd->type != Servent::T_COUT) // COUT + { return; } @@ -1236,6 +1363,11 @@ void PopupServentMenu(int servent_id){ switch(dwID){ case 1001: // Ø’f s->thread.active = false; + + // COUTØ’f + if (s->type == Servent::T_COUT) + s->thread.finish = true; + break; } @@ -1558,6 +1690,14 @@ void WmRButtonDownProc(HWND hwnd, LPARAM lParam){ cd->setSelected(TRUE); channel_id = cd->getChannelId(); channel_selected = TRUE; + + // COUTŽ¯•Ê + if (cd->type == Servent::T_COUT) + { + channel_selected = FALSE; + servent_selected = TRUE; + servent_id = cd->servent_id; + } } else { if (cd->isSelected()){ changeFlg = TRUE; diff --git a/PeerCast.root/PeerCast/ui/win32/simple/gui.h b/PeerCast.root/PeerCast/ui/win32/simple/gui.h index ad783e8..4b86a7e 100644 --- a/PeerCast.root/PeerCast/ui/win32/simple/gui.h +++ b/PeerCast.root/PeerCast/ui/win32/simple/gui.h @@ -22,6 +22,7 @@ #include "sys.h" #include "gdiplus.h" #include "channel.h" +#include "servent.h" extern LRESULT CALLBACK GUIProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); extern void ADDLOG(const char *str,int id,bool sel,void *data, LogBuffer::TYPE type); @@ -175,6 +176,8 @@ public: selected = FALSE; serventDataTop = NULL; openFlg = FALSE; + type = Servent::T_NONE; + servent_id = -1; } int drawChannel(Gdiplus::Graphics *g, int x, int y); @@ -219,6 +222,9 @@ public: int getServentCount(); bool checkDown(int x, int y); + + Servent::TYPE type; // COUT‚̃T[ƒoƒ“ƒgî•ñ•ÛŽ—p + int servent_id; // “¯ãBchannel_id‚Å‘ã—p‚Å‚«‚½‚¯‚ÇPublic‚É‚µ‚½‚­‚È‚¢ }; diff --git a/c:/Git/PeerCast.root/PeerCast/core/common/stream.cpp b/c:/Git/PeerCast.root/PeerCast/core/common/stream.cpp index b1f64b5..e303ed6 100644 --- a/c:/Git/PeerCast.root/PeerCast/core/common/stream.cpp +++ b/c:/Git/PeerCast.root/PeerCast/core/common/stream.cpp @@ -279,12 +279,13 @@ void Stream::writeLineF(const char *fmt,...) write(fmt,ap); + // special thanks: –¼–³‚µ‚Ì’N‚© + va_end(ap); + if (writeCRLF) write("\r\n",2); else write("\n",1); - - va_end(ap); } // ------------------------------------- diff --git a/c:/Git/PeerCast.root/PeerCast/core/common/version2.h b/c:/Git/PeerCast.root/PeerCast/core/common/version2.h index b316589..1497f04 100644 --- a/c:/Git/PeerCast.root/PeerCast/core/common/version2.h +++ b/c:/Git/PeerCast.root/PeerCast/core/common/version2.h @@ -44,11 +44,11 @@ extern int version_ex; // VERSION_EX #if 1 /* for VP extend version */ //#define VERSION_EX 1 static const char *PCP_CLIENT_VERSION_EX_PREFIX = "IM"; // 2bytes only -static const int PCP_CLIENT_VERSION_EX_NUMBER = 38; -static const char *PCX_AGENTEX = "PeerCast/0.1218(IM0038)"; -static const char *PCX_VERSTRING_EX = "v0.1218(IM0038)"; +static const int PCP_CLIENT_VERSION_EX_NUMBER = 39; +static const char *PCX_AGENTEX = "PeerCast/0.1218(IM0039)"; +static const char *PCX_VERSTRING_EX = "v0.1218(IM0039)"; -static const char *PCP_CLIENT_DIST_URL = "http://peercastim.s353.xrea.com/"; +static const char *PCP_CLIENT_DIST_URL = "http://pecaim.net/"; #endif // ------------------------------------------------ diff --git a/c:/Git/PeerCast.root/PeerCast/core/win32/lib/corelib.vcproj b/c:/Git/PeerCast.root/PeerCast/core/win32/lib/corelib.vcproj index bc8dfe6..d12268c 100644 --- a/c:/Git/PeerCast.root/PeerCast/core/win32/lib/corelib.vcproj +++ b/c:/Git/PeerCast.root/PeerCast/core/win32/lib/corelib.vcproj @@ -97,9 +97,9 @@ /> diff --git a/c:/Git/PeerCast.root/PeerCast/ui/win32/simple/Simple.rc b/c:/Git/PeerCast.root/PeerCast/ui/win32/simple/Simple.rc index 2ac10d2..90a2888 100644 --- a/c:/Git/PeerCast.root/PeerCast/ui/win32/simple/Simple.rc +++ b/c:/Git/PeerCast.root/PeerCast/ui/win32/simple/Simple.rc @@ -64,6 +64,45 @@ BEGIN END #endif // APSTUDIO_INVOKED + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,3,9,0 + PRODUCTVERSION 1,3,9,0 + FILEFLAGSMASK 0x17L +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "041104b0" + BEGIN + VALUE "CompanyName", "PeCa" + VALUE "FileDescription", "Peercast IM" + VALUE "FileVersion", "1, 3, 9, 0" + VALUE "InternalName", "PeCaIM" + VALUE "LegalCopyright", "Copyright (C) 2009" + VALUE "OriginalFilename", "PeerCast.exe" + VALUE "ProductName", "Peercast IM" + VALUE "ProductVersion", "1, 3, 9, 0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x411, 1200 + END +END + #endif // “ú–{Œê resources ///////////////////////////////////////////////////////////////////////////// diff --git a/c:/Git/PeerCast.root/PeerCast/ui/win32/simple/Simple.vcproj b/c:/Git/PeerCast.root/PeerCast/ui/win32/simple/Simple.vcproj index 6428a31..aabe10d 100644 --- a/c:/Git/PeerCast.root/PeerCast/ui/win32/simple/Simple.vcproj +++ b/c:/Git/PeerCast.root/PeerCast/ui/win32/simple/Simple.vcproj @@ -376,6 +376,7 @@ BrowseInformation="1" WarningLevel="3" SuppressStartupBanner="true" + Detect64BitPortabilityProblems="true" DebugInformationFormat="3" /> diff --git a/c:/Git/PeerCast.root/PeerCast/ui/win32/simple/gui.cpp b/c:/Git/PeerCast.root/PeerCast/ui/win32/simple/gui.cpp index 230354b..90504fb 100644 --- a/c:/Git/PeerCast.root/PeerCast/ui/win32/simple/gui.cpp +++ b/c:/Git/PeerCast.root/PeerCast/ui/win32/simple/gui.cpp @@ -353,8 +353,11 @@ int ChannelData::drawChannel(Graphics *g, int x, int y){ // ƒXƒe[ƒ^ƒX•\Ž¦ Gdiplus::Image *img = NULL; unsigned int nowTime = sys->getTime(); - Channel *ch = chanMgr->findChannelByChannelID(this->channel_id); - switch(this->getStatus()){ + if (this->type != Servent::T_COUT) + { + // COUTˆÈŠO + Channel *ch = chanMgr->findChannelByChannelID(this->channel_id); + switch(this->getStatus()){ case Channel::S_IDLE: img = img_idle; break; @@ -401,7 +404,13 @@ int ChannelData::drawChannel(Graphics *g, int x, int y){ default: img = img_idle; break; + } + } else + { + // COUT—p + img = img_broad_ok; } + // •`‰æŠî“_ PointF origin(xx, yy); // ƒXƒe[ƒ^ƒX•\Ž¦ˆÊ’u @@ -430,127 +439,146 @@ int ChannelData::drawChannel(Graphics *g, int x, int y){ strBrush = ::new SolidBrush(Color::Black); } } - // ƒ`ƒƒƒ“ƒlƒ‹–¼•\Ž¦ - g->SetTextRenderingHint(TextRenderingHintAntiAlias); - _bstr_t bstr1(getName()); - // •¶Žš•`‰æ”͈͎w’è - RectF r1(origin.X, origin.Y, 120.0f, 13.0f); - StringFormat format; - format.SetAlignment(StringAlignmentNear); - g->DrawString(bstr1, -1, &font, r1, &format, strBrush); - // ŽŸ‚ÌŠî“_ - origin.X += r1.Width; - - //// ã—¬IP/ƒŠƒXƒi[”/ƒŠƒŒ[”•\Ž¦ - //// NOTE: - //// ‚Ò‚ ‚©‚·‚Ì“®ì•×‹­—pBƒŠƒŠ[ƒXƒrƒ‹ƒh‚Å‚ÍŒ³‚̃R[ƒh‚ðŽg—p‚ÌŽ–B - //// •¶Žš•\Ž¦”͈͕͂220‚®‚ç‚¢‚Å‚¨‚‹ - //char tmp[512]; // •\Ž¦—pƒoƒbƒtƒ@ - //char hostip[256]; // IPƒAƒhƒŒƒXƒoƒbƒtƒ@ - //chDisp.uphost.toStr(hostip); // ã—¬IP - //sprintf(tmp, "%d/%d - [%d/%d] - %s", - // getTotalListeners(), - // getTotalRelays(), - // getLocalListeners(), - // getLocalRelays(), - // hostip - // ); - - // ƒŠƒXƒi[”/ƒŠƒŒ[”•\Ž¦ - char tmp[256]; - sprintf(tmp, "%d/%d - [%d/%d]", getTotalListeners(), getTotalRelays(), getLocalListeners(), getLocalRelays()); - _bstr_t bstr2(tmp); - // •¶Žš•\Ž¦”͈͎w’è - RectF r2(origin.X, origin.Y, 100.0f, 13.0f); - format.SetAlignment(StringAlignmentCenter); - g->DrawString(bstr2, -1, &font, r2, &format, strBrush); - // ŽŸ‚ÌŠî“_ - origin.X += r2.Width; - - // bps•\Ž¦ - Font *f; - if (isStayConnected()){ - f = ::new Font(L"Arial", 9.0f, FontStyleItalic|FontStyleBold, UnitPoint); - } else { - f = ::new Font(L"Arial", 9.0f); - } - sprintf(tmp, "%dkbps", getBitRate()); - _bstr_t bstr3(tmp); - format.SetAlignment(StringAlignmentFar); - // •¶Žš•\Ž¦”͈͎w’è - RectF r3(origin.X, origin.Y, 80.0f, 13.0f); - g->DrawString(bstr3, -1, f, r3, &format, strBrush); - // ƒtƒHƒ“ƒgŠJ•ú - ::delete f; - - // ŽŸ‚ÌŠî“_ - origin.X += r3.Width; - - // ƒuƒ‰ƒVíœ - ::delete strBrush; - - // Servent•\Ž¦ - if (!openFlg){ - int count = getServentCount(); - // Servent•\Ž¦•”‚Ì”wŒi‚ð”’‚É‚·‚é - SolidBrush b(Color(160,255,255,255)); - g->FillRectangle(&b, (INT)origin.X, (INT)origin.Y, 14*count, 14); - - sd = serventDataTop; - int index = 0; - while(sd){ - SolidBrush *serventBrush; - if (sd->getInfoFlg()){ - ChanHit *hit = sd->getChanHit(); - if (hit->firewalled){ - SolidBrush bb(Color(180,255,0,0)); - g->FillRectangle(&bb, (INT)origin.X + 14*index, (INT)origin.Y, 14, 14); - } - if (hit->relay){ - // ƒŠƒŒ[‚n‚j - serventBrush = ::new SolidBrush(Color::Green); - } else { - // ƒŠƒŒ[•s‰Â - if (hit->numRelays){ - // ƒŠƒŒ[ˆê”t - serventBrush = ::new SolidBrush(Color::Blue); + if (this->type != Servent::T_COUT) + { + // COUTˆÈŠO + + // ƒ`ƒƒƒ“ƒlƒ‹–¼•\Ž¦ + g->SetTextRenderingHint(TextRenderingHintAntiAlias); + _bstr_t bstr1(getName()); + // •¶Žš•`‰æ”͈͎w’è + RectF r1(origin.X, origin.Y, 120.0f, 13.0f); + StringFormat format; + format.SetAlignment(StringAlignmentNear); + g->DrawString(bstr1, -1, &font, r1, &format, strBrush); + // ŽŸ‚ÌŠî“_ + origin.X += r1.Width; + + //// ã—¬IP/ƒŠƒXƒi[”/ƒŠƒŒ[”•\Ž¦ + //// NOTE: + //// ‚Ò‚ ‚©‚·‚Ì“®ì•×‹­—pBƒŠƒŠ[ƒXƒrƒ‹ƒh‚Å‚ÍŒ³‚̃R[ƒh‚ðŽg—p‚ÌŽ–B + //// •¶Žš•\Ž¦”͈͕͂220‚®‚ç‚¢‚Å‚¨‚‹ + //char tmp[512]; // •\Ž¦—pƒoƒbƒtƒ@ + //char hostip[256]; // IPƒAƒhƒŒƒXƒoƒbƒtƒ@ + //chDisp.uphost.toStr(hostip); // ã—¬IP + //sprintf(tmp, "%d/%d - [%d/%d] - %s", + // getTotalListeners(), + // getTotalRelays(), + // getLocalListeners(), + // getLocalRelays(), + // hostip + // ); + + // ƒŠƒXƒi[”/ƒŠƒŒ[”•\Ž¦ + char tmp[256]; + sprintf(tmp, "%d/%d - [%d/%d]", getTotalListeners(), getTotalRelays(), getLocalListeners(), getLocalRelays()); + _bstr_t bstr2(tmp); + // •¶Žš•\Ž¦”͈͎w’è + RectF r2(origin.X, origin.Y, 100.0f, 13.0f); + format.SetAlignment(StringAlignmentCenter); + g->DrawString(bstr2, -1, &font, r2, &format, strBrush); + // ŽŸ‚ÌŠî“_ + origin.X += r2.Width; + + // bps•\Ž¦ + Font *f; + if (isStayConnected()){ + f = ::new Font(L"Arial", 9.0f, FontStyleItalic|FontStyleBold, UnitPoint); + } else { + f = ::new Font(L"Arial", 9.0f); + } + sprintf(tmp, "%dkbps", getBitRate()); + _bstr_t bstr3(tmp); + format.SetAlignment(StringAlignmentFar); + // •¶Žš•\Ž¦”͈͎w’è + RectF r3(origin.X, origin.Y, 80.0f, 13.0f); + g->DrawString(bstr3, -1, f, r3, &format, strBrush); + // ƒtƒHƒ“ƒgŠJ•ú + ::delete f; + + // ŽŸ‚ÌŠî“_ + origin.X += r3.Width; + + // ƒuƒ‰ƒVíœ + ::delete strBrush; + + + // Servent•\Ž¦ + if (!openFlg){ + int count = getServentCount(); + // Servent•\Ž¦•”‚Ì”wŒi‚ð”’‚É‚·‚é + SolidBrush b(Color(160,255,255,255)); + g->FillRectangle(&b, (INT)origin.X, (INT)origin.Y, 14*count, 14); + + sd = serventDataTop; + int index = 0; + while(sd){ + SolidBrush *serventBrush; + if (sd->getInfoFlg()){ + ChanHit *hit = sd->getChanHit(); + if (hit->firewalled){ + SolidBrush bb(Color(180,255,0,0)); + g->FillRectangle(&bb, (INT)origin.X + 14*index, (INT)origin.Y, 14, 14); + } + if (hit->relay){ + // ƒŠƒŒ[‚n‚j + serventBrush = ::new SolidBrush(Color::Green); } else { - // ƒŠƒŒ[‚È‚µ - serventBrush = ::new SolidBrush(Color::Purple); + // ƒŠƒŒ[•s‰Â + if (hit->numRelays){ + // ƒŠƒŒ[ˆê”t + serventBrush = ::new SolidBrush(Color::Blue); + } else { + // ƒŠƒŒ[‚È‚µ + serventBrush = ::new SolidBrush(Color::Purple); + } } + } else { + // î•ñ‚È‚µ + serventBrush = ::new SolidBrush(Color::Black); } - } else { - // î•ñ‚È‚µ - serventBrush = ::new SolidBrush(Color::Black); - } - // ŽlŠp•`‰æ - backGra->FillRectangle(serventBrush, (INT)origin.X + index*14 + 1, (INT)origin.Y + 1, 12, 12); + // ŽlŠp•`‰æ + backGra->FillRectangle(serventBrush, (INT)origin.X + index*14 + 1, (INT)origin.Y + 1, 12, 12); - ::delete serventBrush; - sd = sd->getNextData(); - index++; + ::delete serventBrush; + sd = sd->getNextData(); + index++; + } } - } - // ŽŸ‚ÌŠî“_ - origin.Y += 15; + // ŽŸ‚ÌŠî“_ + origin.Y += 15; - // ƒTƒCƒY‚ð•Û‘¶ - setWidth((int)origin.X - posX); - setHeight((int)origin.Y - posY); + // ƒTƒCƒY‚ð•Û‘¶ + setWidth((int)origin.X - posX); + setHeight((int)origin.Y - posY); - // ServentData•\Ž¦ - sd = serventDataTop; - while(sd){ - if (openFlg || sd->getSelected()){ - sd->drawServent(g, (INT)x+12, (INT)origin.Y); - // ŽŸ‚ÌŠî“_ - origin.Y += 15; + // ServentData•\Ž¦ + sd = serventDataTop; + while(sd){ + if (openFlg || sd->getSelected()){ + sd->drawServent(g, (INT)x+12, (INT)origin.Y); + // ŽŸ‚ÌŠî“_ + origin.Y += 15; + } + sd = sd->getNextData(); } - sd = sd->getNextData(); + } else + { + // COUT + g->SetTextRenderingHint(TextRenderingHintAntiAlias); + RectF r1(origin.X, origin.Y, 120.0f+100.0f+80.0f, 13.0f); + origin.X += r1.Width; + StringFormat format; + format.SetAlignment(StringAlignmentNear); + _bstr_t bstr1("COUT"); + g->DrawString(bstr1, -1, &font, r1, &format, strBrush); + ::delete strBrush; + origin.Y += 15; + setWidth((int)origin.X - posX); + setHeight((int)origin.Y - posY); } - return (int)(origin.Y); } @@ -881,6 +909,90 @@ THREAD_PROC GUIDataUpdate(ThreadInfo *thread){ c = c->next; } +#if 1 + // COUT‚ðŒŸõ + { + bool foundFlg = false; + bool foundFlg2 = false; + Servent *s = servMgr->servents; + while (s) + { + if (s->type == Servent::T_COUT && s->status == Servent::S_CONNECTED) + { + foundFlg = true; + + // ChannelData––”ö‚Ü‚Å’Tõ + ChannelData *prev = NULL; + cd = channelDataTop; + while (cd) + { + if (cd->type == Servent::T_COUT && cd->servent_id == s->servent_id) + { + foundFlg2 = true; + cd->setEnableFlg(true); + break; + } + prev = cd; + cd = cd->getNextData(); + } + cd = prev; + + if (foundFlg2) + break; + + // ƒm[ƒh’ljÁ + if (channelDataTop) + { + // channelData‚ª‹ó‚Å‚È‚¢Bcd‚Í‚±‚±‚ŃŠƒXƒg––”ö‚ðŽw‚µ‚Ä‚éi‚Í‚¸j + cd->setNextData(::new ChannelData()); + cd = cd->getNextData(); + memset(cd, 0, sizeof(cd)); + cd->setNextData(NULL); + } else + { + // channelData‚ª‹ó + channelDataTop = ::new ChannelData(); + channelDataTop->setNextData(NULL); + cd = channelDataTop; + } + + // ƒf[ƒ^Ý’è + cd->type = s->type; + cd->servent_id = s->servent_id; + cd->setEnableFlg(true); + } + + s = s->next; + } + + // COUT‚ªØ‚ê‚Ä‚½‚çíœ + if (!foundFlg) + { + cd = channelDataTop; + ChannelData *prev = NULL; + while (cd) + { + // COUT‚̏î•ñ‚ðíœ + if (cd->type == Servent::T_COUT) + { + // æ“ª + if (!prev) + { + channelDataTop = cd->getNextData(); + } else + { + prev->setNextData(cd->getNextData()); + } + //::delete cd; + } + + prev = cd; + cd = cd->getNextData(); + } + } + } +#endif + // ƒ`ƒƒƒ“ƒlƒ‹‚ª‚È‚­‚È‚Á‚Ä‚¢‚éê‡‚̏ˆ— cd = channelDataTop; ChannelData *prev = NULL; @@ -892,6 +1004,7 @@ THREAD_PROC GUIDataUpdate(ThreadInfo *thread){ next = cd->getNextData(); if (!prev){ // æ“ª‚̃f[ƒ^‚ðíœ + // ‚±‚±ƒƒ‚ƒŠƒŠ[ƒN‚µ‚»‚¤ by ‚¦‚é[ channelDataTop = next; } else { // “r’†‚̃f[ƒ^‚ðíœ @@ -1192,6 +1305,11 @@ void PopupServentMenu(int servent_id){ ServentData *sd = NULL; ChannelData *cd = channelDataTop; while(cd){ + // COUT + if (cd->type == Servent::T_COUT + && cd->servent_id == servent_id) + break; + sd = cd->findServentData(servent_id); if (sd){ break; @@ -1199,7 +1317,9 @@ void PopupServentMenu(int servent_id){ cd = cd->getNextData(); } - if (cd == NULL || sd == NULL){ + if (cd == NULL || sd == NULL + && cd->type != Servent::T_COUT) // COUT + { return; } @@ -1216,6 +1336,11 @@ void PopupServentMenu(int servent_id){ cd = channelDataTop; while(cd){ + // COUT + if (cd->type == Servent::T_COUT + && cd->servent_id == servent_id) + break; + sd = cd->findServentData(servent_id); if (sd){ break; @@ -1223,7 +1348,9 @@ void PopupServentMenu(int servent_id){ cd = cd->getNextData(); } - if (cd == NULL || sd == NULL){ + if (cd == NULL || sd == NULL + && cd->type != Servent::T_COUT) // COUT + { return; } @@ -1236,6 +1363,11 @@ void PopupServentMenu(int servent_id){ switch(dwID){ case 1001: // Ø’f s->thread.active = false; + + // COUTØ’f + if (s->type == Servent::T_COUT) + s->thread.finish = true; + break; } @@ -1558,6 +1690,14 @@ void WmRButtonDownProc(HWND hwnd, LPARAM lParam){ cd->setSelected(TRUE); channel_id = cd->getChannelId(); channel_selected = TRUE; + + // COUTŽ¯•Ê + if (cd->type == Servent::T_COUT) + { + channel_selected = FALSE; + servent_selected = TRUE; + servent_id = cd->servent_id; + } } else { if (cd->isSelected()){ changeFlg = TRUE; diff --git a/c:/Git/PeerCast.root/PeerCast/ui/win32/simple/gui.h b/c:/Git/PeerCast.root/PeerCast/ui/win32/simple/gui.h index ad783e8..4b86a7e 100644 --- a/c:/Git/PeerCast.root/PeerCast/ui/win32/simple/gui.h +++ b/c:/Git/PeerCast.root/PeerCast/ui/win32/simple/gui.h @@ -22,6 +22,7 @@ #include "sys.h" #include "gdiplus.h" #include "channel.h" +#include "servent.h" extern LRESULT CALLBACK GUIProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); extern void ADDLOG(const char *str,int id,bool sel,void *data, LogBuffer::TYPE type); @@ -175,6 +176,8 @@ public: selected = FALSE; serventDataTop = NULL; openFlg = FALSE; + type = Servent::T_NONE; + servent_id = -1; } int drawChannel(Gdiplus::Graphics *g, int x, int y); @@ -219,6 +222,9 @@ public: int getServentCount(); bool checkDown(int x, int y); + + Servent::TYPE type; // COUT‚̃T[ƒoƒ“ƒgî•ñ•ÛŽ—p + int servent_id; // “¯ãBchannel_id‚Å‘ã—p‚Å‚«‚½‚¯‚ÇPublic‚É‚µ‚½‚­‚È‚¢ }; -- 2.11.0