From: <arn...@us...> - 2008-02-03 19:16:43
|
Revision: 987 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=987&view=rev Author: arnetheduck Date: 2008-02-03 11:16:41 -0800 (Sun, 03 Feb 2008) Log Message: ----------- Fixed various races, recover partially downloaded segments Modified Paths: -------------- dcplusplus/trunk/SConstruct dcplusplus/trunk/changelog.txt dcplusplus/trunk/dcpp/DownloadManager.cpp dcplusplus/trunk/dcpp/QueueManager.cpp dcplusplus/trunk/dcpp/TimerManager.cpp dcplusplus/trunk/dcpp/TimerManager.h dcplusplus/trunk/dcpp/User.cpp dcplusplus/trunk/dcpp/User.h Modified: dcplusplus/trunk/SConstruct =================================================================== --- dcplusplus/trunk/SConstruct 2008-02-03 16:11:52 UTC (rev 986) +++ dcplusplus/trunk/SConstruct 2008-02-03 19:16:41 UTC (rev 987) @@ -149,7 +149,7 @@ # internationalization (ardour.org provided the initial idea) # -po_args = ['msgmerge', '-q', '--update', '$TARGET', '$SOURCE'] +po_args = ['msgmerge', '-q', '--update', '--backup=none', '$TARGET', '$SOURCE'] po_bld = Builder (action = Action([po_args], 'Updating translation $TARGET from $SOURCES')) env.Append(BUILDERS = {'PoBuild' : po_bld}) Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2008-02-03 16:11:52 UTC (rev 986) +++ dcplusplus/trunk/changelog.txt 2008-02-03 19:16:41 UTC (rev 987) @@ -21,7 +21,10 @@ * In waiting users, show requested chunk (since we can't know % done) * Fixed crash when download connection was disconnected before any data was received * Fixed crash due to race condition on idle check (thans bigmuscle) - +* Fixed crash when copying identity +* Fixed potential timer race condition (thanks bigmuscle) +* The good parts of partially downloaded segments are now added to queue (thanks bigmuscle) + -- 0.704 2007-12-14 -- * Hub lists added to utilize Coral's distributed network (ullner) * Use system header arrows on common controls 6+ (thanks poy) Modified: dcplusplus/trunk/dcpp/DownloadManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/DownloadManager.cpp 2008-02-03 16:11:52 UTC (rev 986) +++ dcplusplus/trunk/dcpp/DownloadManager.cpp 2008-02-03 19:16:41 UTC (rev 987) @@ -112,42 +112,6 @@ } } -void QueueManager::FileMover::moveFile(const string& source, const string& target) { - Lock l(cs); - files.push_back(make_pair(source, target)); - if(!active) { - active = true; - start(); - } -} - -int QueueManager::FileMover::run() { - for(;;) { - FilePair next; - { - Lock l(cs); - if(files.empty()) { - active = false; - return 0; - } - next = files.back(); - files.pop_back(); - } - try { - File::renameFile(next.first, next.second); - } catch(const FileException&) { - try { - // Try to just rename it to the correct name at least - string newTarget = Util::getFilePath(next.first) + Util::getFileName(next.second); - File::renameFile(next.first, newTarget); - LogManager::getInstance()->message(str(F_("%1% renamed to %2%") % next.first % newTarget)); - } catch(const FileException& e) { - LogManager::getInstance()->message(str(F_("Unable to rename %1%: %2%") % next.first % e.getError())); - } - } - } -} - void DownloadManager::removeConnection(UserConnectionPtr aConn) { dcassert(aConn->getDownload() == NULL); aConn->removeListener(this); Modified: dcplusplus/trunk/dcpp/QueueManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/QueueManager.cpp 2008-02-03 16:11:52 UTC (rev 986) +++ dcplusplus/trunk/dcpp/QueueManager.cpp 2008-02-03 19:16:41 UTC (rev 987) @@ -301,6 +301,42 @@ } } +void QueueManager::FileMover::moveFile(const string& source, const string& target) { + Lock l(cs); + files.push_back(make_pair(source, target)); + if(!active) { + active = true; + start(); + } +} + +int QueueManager::FileMover::run() { + for(;;) { + FilePair next; + { + Lock l(cs); + if(files.empty()) { + active = false; + return 0; + } + next = files.back(); + files.pop_back(); + } + try { + File::renameFile(next.first, next.second); + } catch(const FileException&) { + try { + // Try to just rename it to the correct name at least + string newTarget = Util::getFilePath(next.first) + Util::getFileName(next.second); + File::renameFile(next.first, newTarget); + LogManager::getInstance()->message(str(F_("%1% renamed to %2%") % next.first % newTarget)); + } catch(const FileException& e) { + LogManager::getInstance()->message(str(F_("Unable to rename %1%: %2%") % next.first % e.getError())); + } + } + } +} + QueueManager::QueueManager() : lastSave(0), queueFile(Util::getConfigPath() + "Queue.xml"), dirty(true), nextSearch(0) { TimerManager::getInstance()->addListener(this); SearchManager::getInstance()->addListener(this); @@ -921,6 +957,15 @@ // Blah...no use keeping an unfinished file list... File::deleteFile(q->getListName()); } + if(aDownload->getType() == Transfer::TYPE_FILE) { + // mark partially downloaded chunk, but align it to block size + int64_t downloaded = aDownload->getPos(); + downloaded -= downloaded % aDownload->getTigerTree().getBlockSize(); + + if(downloaded > 0) { + q->addSegment(Segment(aDownload->getStartPos(), downloaded)); + } + } } if(q->getPriority() != QueueItem::PAUSED) { Modified: dcplusplus/trunk/dcpp/TimerManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/TimerManager.cpp 2008-02-03 16:11:52 UTC (rev 986) +++ dcplusplus/trunk/dcpp/TimerManager.cpp 2008-02-03 19:16:41 UTC (rev 987) @@ -26,6 +26,7 @@ #ifdef _WIN32 DWORD TimerManager::lastTick = 0; uint32_t TimerManager::cycles = 0; +FastCriticalSection TimerManager::cs; #else timeval TimerManager::tv; #endif @@ -52,6 +53,8 @@ uint64_t TimerManager::getTick() { #ifdef _WIN32 + FastLock l(cs); + DWORD tick = ::GetTickCount(); if(tick < lastTick) { cycles++; Modified: dcplusplus/trunk/dcpp/TimerManager.h =================================================================== --- dcplusplus/trunk/dcpp/TimerManager.h 2008-02-03 16:11:52 UTC (rev 986) +++ dcplusplus/trunk/dcpp/TimerManager.h 2008-02-03 19:16:41 UTC (rev 987) @@ -74,6 +74,7 @@ #ifdef _WIN32 static DWORD lastTick; static uint32_t cycles; + static FastCriticalSection cs; #else static timeval tv; #endif Modified: dcplusplus/trunk/dcpp/User.cpp =================================================================== --- dcplusplus/trunk/dcpp/User.cpp 2008-02-03 16:11:52 UTC (rev 986) +++ dcplusplus/trunk/dcpp/User.cpp 2008-02-03 19:16:41 UTC (rev 987) @@ -26,13 +26,15 @@ namespace dcpp { +FastCriticalSection Identity::cs; + OnlineUser::OnlineUser(const UserPtr& ptr, Client& client_, uint32_t sid_) : identity(ptr, sid_), client(client_) { } void Identity::getParams(StringMap& sm, const string& prefix, bool compatibility) const { { - Lock l(cs); + FastLock l(cs); for(InfMap::const_iterator i = info.begin(); i != info.end(); ++i) { sm[prefix + string((char*)(&i->first), 2)] = i->second; } @@ -76,13 +78,20 @@ } string Identity::get(const char* name) const { - Lock l(cs); + FastLock l(cs); InfMap::const_iterator i = info.find(*(short*)name); return i == info.end() ? Util::emptyString : i->second; } +bool Identity::isSet(const char* name) const { + FastLock l(cs); + InfMap::const_iterator i = info.find(*(short*)name); + return i != info.end(); +} + + void Identity::set(const char* name, const string& val) { - Lock l(cs); + FastLock l(cs); if(val.empty()) info.erase(*(short*)name); else @@ -90,7 +99,7 @@ } bool Identity::supports(const string& name) const { - const string& su = get("SU"); + string su = get("SU"); StringTokenizer<string> st(su, ','); for(StringIter i = st.getTokens().begin(); i != st.getTokens().end(); ++i) { if(*i == name) Modified: dcplusplus/trunk/dcpp/User.h =================================================================== --- dcplusplus/trunk/dcpp/User.h 2008-02-03 16:11:52 UTC (rev 986) +++ dcplusplus/trunk/dcpp/User.h 2008-02-03 19:16:41 UTC (rev 987) @@ -103,8 +103,8 @@ Identity() : sid(0) { } Identity(const UserPtr& ptr, uint32_t aSID) : user(ptr), sid(aSID) { } - Identity(const Identity& rhs) : Flags(rhs), user(rhs.user), sid(rhs.sid), info(rhs.info) { } - Identity& operator=(const Identity& rhs) { Lock l(cs); *static_cast<Flags*>(this) = rhs; user = rhs.user; sid = rhs.sid; info = rhs.info; return *this; } + Identity(const Identity& rhs) : Flags(), sid(0) { *this = rhs; } // Use operator= since we have to lock before reading... + Identity& operator=(const Identity& rhs) { FastLock l(cs); *static_cast<Flags*>(this) = rhs; user = rhs.user; sid = rhs.sid; info = rhs.info; return *this; } #define GS(n, x) string get##n() const { return get(x); } void set##n(const string& v) { set(x, v); } GS(Nick, "NI") @@ -123,16 +123,17 @@ void setHidden(bool hidden) { set("HI", hidden ? "1" : Util::emptyString); } string getTag() const; bool supports(const string& name) const; - bool isHub() const { return isClientType(CT_HUB) || !get("HU").empty(); } - bool isOp() const { return isClientType(CT_OP) || isClientType(CT_SU) || isClientType(CT_OWNER) || !get("OP").empty(); } - bool isRegistered() const { return isClientType(CT_REGGED) || !get("RG").empty(); } - bool isHidden() const { return !get("HI").empty(); } - bool isBot() const { return isClientType(CT_BOT) || !get("BO").empty(); } - bool isAway() const { return !get("AW").empty(); } + bool isHub() const { return isClientType(CT_HUB) || isSet("HU"); } + bool isOp() const { return isClientType(CT_OP) || isClientType(CT_SU) || isClientType(CT_OWNER) || isSet("OP"); } + bool isRegistered() const { return isClientType(CT_REGGED) || isSet("RG"); } + bool isHidden() const { return isSet("HI"); } + bool isBot() const { return isClientType(CT_BOT) || isSet("BO"); } + bool isAway() const { return isSet("AW"); } bool isTcpActive() const { return !getIp().empty() || (user->isSet(User::NMDC) && !user->isSet(User::PASSIVE)); } bool isUdpActive() const { return !getIp().empty() && !getUdpPort().empty(); } string get(const char* name) const; void set(const char* name, const string& val); + bool isSet(const char* name) const; string getSIDString() const { return string((const char*)&sid, 4); } bool isClientType(ClientType ct) const; @@ -145,8 +146,8 @@ typedef std::tr1::unordered_map<short, string> InfMap; typedef InfMap::iterator InfIter; InfMap info; - /** @todo there are probably more threading issues here ...*/ - mutable CriticalSection cs; + + static FastCriticalSection cs; }; class Client; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2008-02-05 09:31:56
|
Revision: 988 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=988&view=rev Author: arnetheduck Date: 2008-02-05 01:31:54 -0800 (Tue, 05 Feb 2008) Log Message: ----------- Fix tab parent, danish translation has encoding errors Modified Paths: -------------- dcplusplus/trunk/win32/TransferView.cpp Removed Paths: ------------- dcplusplus/trunk/dcpp/po/da.po dcplusplus/trunk/win32/po/da.po Property Changed: ---------------- dcplusplus/trunk/dcpp/po/ Property changes on: dcplusplus/trunk/dcpp/po ___________________________________________________________________ Name: svn:ignore + dcpp.pot Deleted: dcplusplus/trunk/dcpp/po/da.po =================================================================== --- dcplusplus/trunk/dcpp/po/da.po 2008-02-03 19:16:41 UTC (rev 987) +++ dcplusplus/trunk/dcpp/po/da.po 2008-02-05 09:31:54 UTC (rev 988) @@ -1,388 +0,0 @@ -# Danish translations for the DC++ package. -# Copyright (C) 2008 The translators -# This file is distributed under the same license as the DC++ package. -# <g2...@us...>, 2008. -# -msgid "" -msgstr "" -"Project-Id-Version: dcpp\n" -"Report-Msgid-Bugs-To: dcp...@li...\n" -"POT-Creation-Date: 2008-01-31 20:32+0100\n" -"Last-Translator: <g2...@us...>\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: dcpp/Util.cpp:381 -#, c-format, boost-format -msgid "%'lld B" -msgstr "" - -#: dcpp/Util.cpp:343 -#, c-format, boost-format -msgid "%.02f GiB" -msgstr "" - -#: dcpp/Util.cpp:339 -#, c-format, boost-format -msgid "%.02f KiB" -msgstr "" - -#: dcpp/Util.cpp:341 -#, c-format, boost-format -msgid "%.02f MiB" -msgstr "" - -#: dcpp/Util.cpp:347 -#, c-format, boost-format -msgid "%.02f PiB" -msgstr "" - -#: dcpp/Util.cpp:345 -#, c-format, boost-format -msgid "%.02f TiB" -msgstr "" - -#: dcpp/NmdcHub.cpp:273 -#, boost-format -msgid "%1% (Nick unknown)" -msgstr "" - -#: dcpp/HashManager.cpp:767 -#, boost-format -msgid "" -"%1% not shared; calculated CRC32 does not match the one found in SFV file." -msgstr "" - -#: dcpp/DownloadManager.cpp:143 -#, boost-format -msgid "%1% renamed to %2%" -msgstr "" - -#: dcpp/DownloadManager.cpp:547 -#, fuzzy, boost-format -msgid "%1%: File not available" -msgstr "Fil er ikke tilg�elig..!" - -#: dcpp/Util.cpp:337 -#, c-format, boost-format -msgid "%d B" -msgstr "" - -#: dcpp/Util.cpp:377 -#, c-format, boost-format -msgid "%s B" -msgstr "" - -#: dcpp/QueueManager.cpp:503 -msgid "A file of equal or larger size already exists at the target location" -msgstr "En fil af samme st�se eller st�findes allerede p�en angivne placering" - -#: dcpp/QueueManager.cpp:446 -msgid "A file with a different size already exists in the queue" -msgstr "Filer med forskellige st�ser" - -#: dcpp/QueueManager.cpp:449 -msgid "A file with different tth root already exists in the queue" -msgstr "Filer med forskellige st�ser (TTH)" - -#: dcpp/QueueManager.cpp:413 -msgid "A file with the same hash already exists in your share" -msgstr "En fil med den samme hash eksisterer i din deling!" - -#: dcpp/ConnectionManager.cpp:181 -msgid "All download slots taken" -msgstr "Alle downloadslots er i brug" - -#: dcpp/DownloadManager.cpp:421 -msgid "CRC32 inconsistency (SFV-Check)" -msgstr "CRC32-Inkonsistens (SFV-kontrol)" - -#: dcpp/DownloadManager.cpp:419 -#, fuzzy, boost-format -msgid "CRC32 inconsistency (SFV-Check) (File: %1%)" -msgstr "CRC32-Inkonsistens (SFV-kontrol)" - -#: dcpp/ConnectionManager.cpp:385 -msgid "Certificate not trusted, unable to connect" -msgstr "Certifikatet er ikke gyldigt, kunne ikke Oprette forbindelse" - -#: dcpp/Socket.cpp:154 dcpp/ConnectionManager.cpp:187 -#: dcpp/BufferedSocket.cpp:154 -msgid "Connection timeout" -msgstr "Forbindelsen fik 'Timeout' (den anden computer svarer ikke)" - -#: dcpp/DownloadManager.cpp:284 -#, boost-format -msgid "Could not open target file: %1%" -msgstr "" - -#: dcpp/ShareManager.cpp:418 -msgid "Directory already shared" -msgstr "Mappen er allerede delt!" - -#: dcpp/BufferedSocket.cpp:409 dcpp/BufferedSocket.cpp:427 -msgid "Disconnected" -msgstr "Forbindelsen er afbrudt!!!" - -#: dcpp/UploadManager.cpp:450 -#, boost-format -msgid "Disconnected user leaving the hub: %1%" -msgstr "" - -#: dcpp/DCPlusPlus.cpp:103 -msgid "Download Queue" -msgstr "" - -#: dcpp/ShareManager.cpp:745 -#, boost-format -msgid "" -"Duplicate file will not be shared: %1%%2% (Size: %3% B) Dupe matched " -"against: %4%%5%" -msgstr "" - -#: dcpp/QueueManager.cpp:516 dcpp/QueueManager.cpp:520 -#, boost-format -msgid "Duplicate source: %1%" -msgstr "" - -#: dcpp/HashManager.cpp:456 -#, fuzzy, boost-format -msgid "Error creating hash data file: %1%" -msgstr "Kan ikke l� denne TTH-fil" - -#: dcpp/ZUtils.cpp:33 dcpp/ZUtils.cpp:54 dcpp/ZUtils.cpp:76 dcpp/ZUtils.cpp:86 -#: dcpp/BZUtils.cpp:31 dcpp/BZUtils.cpp:52 dcpp/BZUtils.cpp:60 -msgid "Error during compression" -msgstr "Fejl under komprimering" - -#: dcpp/ZUtils.cpp:100 dcpp/ZUtils.cpp:123 dcpp/BZUtils.cpp:72 -#: dcpp/BZUtils.cpp:94 dcpp/BZUtils.cpp:97 dcpp/CryptoManager.cpp:344 -#: dcpp/CryptoManager.cpp:363 dcpp/CryptoManager.cpp:377 -msgid "Error during decompression" -msgstr "Fejl under dekomprimeringen" - -#: dcpp/HashManager.cpp:772 -#, boost-format -msgid "Error hashing %1%: %2%" -msgstr "" - -#: dcpp/HashManager.cpp:118 dcpp/HashManager.cpp:333 -#, boost-format -msgid "Error saving hash data: %1%" -msgstr "" - -#: dcpp/CryptoManager.cpp:228 dcpp/CryptoManager.cpp:232 -#: dcpp/CryptoManager.cpp:237 dcpp/CryptoManager.cpp:241 -msgid "Failed to load certificate file" -msgstr "Fejlede ved indl�ing af Certifikat!" - -#: dcpp/CryptoManager.cpp:246 dcpp/CryptoManager.cpp:250 -#: dcpp/CryptoManager.cpp:255 dcpp/CryptoManager.cpp:259 -msgid "Failed to load private key" -msgstr "Fejlede ved indl�ing af privat n�" - -#: dcpp/Socket.cpp:408 -msgid "" -"Failed to set up the socks server for UDP relay (check socks address and " -"port)" -msgstr "" - -#: dcpp/ShareManager.cpp:780 -#, fuzzy, boost-format -msgid "File list refresh failed: %1%" -msgstr "Fillisten er opdater�.." - -#: dcpp/ShareManager.cpp:824 -msgid "File list refresh finished" -msgstr "Fillisten er opdater�.." - -#: dcpp/ShareManager.cpp:760 -msgid "" -"File list refresh in progress, please wait for it to finish before trying to " -"refresh again" -msgstr "" - -#: dcpp/ShareManager.cpp:802 -msgid "File list refresh initiated" -msgstr "Fillisten opdatering er sat i gang..." - -#: dcpp/DirectoryListing.cpp:102 -msgid "File not available" -msgstr "Fil er ikke tilg�elig..!" - -#: dcpp/HashManager.cpp:89 -#, boost-format -msgid "Finished hashing: %1%" -msgstr "" - -#: dcpp/HashManager.cpp:87 -#, boost-format -msgid "Finished hashing: %1% (%2%/s)" -msgstr "" - -#: dcpp/DownloadManager.cpp:353 -msgid "Full tree does not match TTH root" -msgstr "Downloaded TTH tr�atcher ikke TTH roden" - -#: dcpp/CryptoManager.cpp:221 -msgid "Generated new TLS certificate" -msgstr "Skab TLS certifikat" - -#: dcpp/DCPlusPlus.cpp:97 -msgid "Hash database" -msgstr "Hash databasen" - -#: dcpp/HashManager.cpp:677 -msgid "Hash database rebuilt" -msgstr "Hash databasen er genopbygget" - -#: dcpp/HashManager.cpp:73 dcpp/HashManager.cpp:277 -#, boost-format -msgid "Hashing failed: %1%" -msgstr "" - -#: dcpp/DownloadManager.cpp:264 dcpp/DownloadManager.cpp:269 -msgid "Invalid size" -msgstr "Ugyldig st�se..." - -#: dcpp/QueueManager.cpp:486 dcpp/QueueManager.cpp:494 -msgid "" -"Invalid target file (missing directory, check default download directory " -"setting)" -msgstr "" - -#: dcpp/FavoriteManager.cpp:438 -msgid "Kick user(s)" -msgstr "Spark bruger(e)" - -#: dcpp/ConnectionManager.cpp:239 -#, boost-format -msgid "Listening socket failed (you need to restart DC++): %1%" -msgstr "" - -#: dcpp/BufferedSocket.cpp:263 -msgid "Maximum command length exceeded" -msgstr "Maxsimal l�de for kommando overskredet" - -#: dcpp/DownloadManager.cpp:323 -msgid "More data was sent than was expected" -msgstr "For meget data..." - -#: dcpp/ShareManager.cpp:403 -msgid "No directory specified" -msgstr "Ingen mappe defineret..!" - -#: dcpp/DownloadManager.cpp:462 -msgid "No slots available" -msgstr "Ingen ledige slots" - -#: dcpp/AdcHub.cpp:554 -msgid "Not listening for connections - please restart DC++" -msgstr "Starter ikke - Genstart venligst DC++" - -#: dcpp/Transfer.cpp:63 dcpp/Transfer.cpp:67 dcpp/ClientManager.cpp:115 -#: dcpp/SearchManager.cpp:267 dcpp/SearchManager.cpp:329 -#: dcpp/SearchManager.cpp:331 -msgid "Offline" -msgstr "Offline" - -#: dcpp/FavoriteManager.cpp:442 -msgid "Redirect user(s)" -msgstr "Viderestil bruger(e)" - -#: dcpp/ShareManager.cpp:421 -msgid "Remove all subdirectories before adding this one" -msgstr "" - -#: dcpp/DCPlusPlus.cpp:100 -msgid "Shared Files" -msgstr "Delte filer" - -#: dcpp/Socket.cpp:269 dcpp/Socket.cpp:273 -msgid "Socks server authentication failed (bad login / password?)" -msgstr "Socks-server brugerverificering sl� fejl (forkert brugernavn/kodeord)" - -#: dcpp/CryptoManager.cpp:223 -#, fuzzy, boost-format -msgid "TLS disabled, failed to generate certificate: %1%" -msgstr "TLS deaktivert, ingen certifikatfil angivet" - -#: dcpp/CryptoManager.cpp:213 -msgid "TLS disabled, no certificate file set" -msgstr "TLS deaktivert, ingen certifikatfil angivet" - -#: dcpp/QueueManager.cpp:481 dcpp/QueueManager.cpp:490 -msgid "Target filename too long" -msgstr "Filnavnet er for langt...!" - -#: dcpp/QueueManager.cpp:769 -msgid "Target removed" -msgstr "" - -#: dcpp/Socket.cpp:255 -msgid "The socks server doesn't support login / password authentication" -msgstr "Socks-serveren underst� ikke bruger/kodeord-verificering" - -#: dcpp/Socket.cpp:162 dcpp/Socket.cpp:173 dcpp/Socket.cpp:206 -#: dcpp/Socket.cpp:210 dcpp/Socket.cpp:237 dcpp/Socket.cpp:252 -msgid "The socks server failed establish a connection" -msgstr "Socks-serveren kunne ikke oprette en forbindelse" - -#: dcpp/Socket.cpp:241 -msgid "The socks server requires authentication" -msgstr "Socks-serveren kr�r brugernavn/kodeord" - -#: dcpp/ShareManager.cpp:407 -msgid "The temporary download directory cannot be shared" -msgstr "Den midlertidlige download mappe kan ikke blive delt..!" - -#: dcpp/QueueManager.cpp:436 -msgid "This file is already queued" -msgstr "Filen finnes allerede i downloadk�!" - -#: dcpp/Thread.cpp:34 dcpp/Thread.cpp:42 -#, fuzzy -msgid "Unable to create thread" -msgstr "Kan ikke l� denne TTH-fil" - -#: dcpp/QueueManager.cpp:957 -#, boost-format -msgid "Unable to open filelist: %1%" -msgstr "" - -#: dcpp/HashManager.cpp:131 -msgid "Unable to read hash data file" -msgstr "Kan ikke l� denne TTH-fil" - -#: dcpp/DownloadManager.cpp:145 -#, boost-format -msgid "Unable to rename %1%: %2%" -msgstr "" - -#: dcpp/UploadManager.cpp:149 -#, boost-format -msgid "Unable to send file %1%: %2%" -msgstr "" - -#: dcpp/Socket.cpp:54 -#, c-format, boost-format -msgid "Unknown error: 0x%1$x" -msgstr "" - -#: dcpp/ShareManager.cpp:426 dcpp/ShareManager.cpp:468 -msgid "Virtual directory name already exists" -msgstr "Virtuel mappe navn eksister allerede..." - -#: dcpp/QueueManager.cpp:383 dcpp/QueueManager.cpp:407 -msgid "You're trying to download from yourself!" -msgstr "Du pr�at downloade fra dig selv!!!" - -#: dcpp/SettingsManager.cpp:156 -msgid "downloaded from" -msgstr "" - -#: dcpp/SettingsManager.cpp:157 -msgid "uploaded to" -msgstr "" Modified: dcplusplus/trunk/win32/TransferView.cpp =================================================================== --- dcplusplus/trunk/win32/TransferView.cpp 2008-02-03 19:16:41 UTC (rev 987) +++ dcplusplus/trunk/win32/TransferView.cpp 2008-02-05 09:31:54 UTC (rev 988) @@ -85,13 +85,13 @@ cs.background = (HBRUSH)(COLOR_3DFACE + 1); cs.location = tabs->getUsableArea(true); - connectionsWindow = createWidgetChildWindow(cs); + connectionsWindow = SmartWin::WidgetCreator<WidgetChildWindow>::createWindow(tabs, cs); tabs->addPage(T_("Connections"), 0); cs.style &= ~WS_VISIBLE; cs.caption = T_("Downloads"); - downloadsWindow = createWidgetChildWindow(cs); + downloadsWindow = SmartWin::WidgetCreator<WidgetChildWindow>::createWindow(tabs, cs); tabs->addPage(T_("Downloads"), 1); } Deleted: dcplusplus/trunk/win32/po/da.po =================================================================== --- dcplusplus/trunk/win32/po/da.po 2008-02-03 19:16:41 UTC (rev 987) +++ dcplusplus/trunk/win32/po/da.po 2008-02-05 09:31:54 UTC (rev 988) @@ -1,2269 +0,0 @@ -# Danish translations for the DC++ package. -# Copyright (C) 2008 The translators -# This file is distributed under the same license as the DC++ package. -# <g2...@us...>, 2008. -# -msgid "" -msgstr "" -"Project-Id-Version: win32\n" -"Report-Msgid-Bugs-To: dcp...@li...\n" -"POT-Creation-Date: 2008-02-02 21:32+0100\n" -"Last-Translator: <g2...@us...>\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: win32/MainWindow.cpp:848 -#, fuzzy, boost-format -msgid "" -"%1%\n" -"Open download page?" -msgstr "�n Download Stien" - -#: win32/TransferView.cpp:569 -#, boost-format -msgid "%1% (%2$0.2f)" -msgstr "" - -#: win32/HashProgressDlg.cpp:91 -#, boost-format -msgid "%1% files/h, %2% files left" -msgstr "" - -#: win32/SearchFrame.cpp:576 -#, boost-format -msgid "%1% filtered" -msgstr "" - -#: win32/SearchFrame.cpp:571 -#, boost-format -msgid "%1% item" -msgid_plural "%1% items" -msgstr[0] "" -msgstr[1] "" - -#: win32/HashProgressDlg.cpp:100 -#, boost-format -msgid "%1% left" -msgstr "" - -#: win32/HubFrame.cpp:936 -#, fuzzy, boost-format -msgid "%1% user" -msgid_plural "%1% users" -msgstr[0] "Ingen bruger(e)" -msgstr[1] "Ingen bruger(e)" - -#: win32/TransferView.cpp:583 win32/TransferView.cpp:631 -#, boost-format -msgid "%1%/s" -msgstr "" - -#: win32/HashProgressDlg.cpp:92 -#, boost-format -msgid "%1%/s, %2% left" -msgstr "" - -#: win32/HubListsDlg.cpp:63 win32/UCPage.cpp:33 -msgid "&Add" -msgstr "" - -#: win32/UploadPage.cpp:37 win32/FavoriteDirsPage.cpp:34 -msgid "&Add folder" -msgstr "" - -#: win32/DirectoryListingFrame.cpp:369 win32/SearchFrame.cpp:774 -#: win32/SearchFrame.cpp:804 win32/DownloadPage.cpp:32 win32/LogPage.cpp:33 -#: win32/Appearance2Page.cpp:30 -#, fuzzy -msgid "&Browse..." -msgstr "Gennemse..." - -#: win32/UCPage.cpp:34 -#, fuzzy -msgid "&Change" -msgstr "Nye Features i DC++..." - -#: win32/PrivateFrame.cpp:373 win32/HubFrame.cpp:1184 -#, fuzzy -msgid "&Close" -msgstr "Farver" - -#: win32/PublicHubsFrame.cpp:150 -msgid "&Configure" -msgstr "" - -#: win32/FavHubsFrame.cpp:71 win32/FavHubsFrame.cpp:113 -#: win32/PublicHubsFrame.cpp:447 -#, fuzzy -msgid "&Connect" -msgstr "Forbindelsen oprettet" - -#: win32/TransferView.cpp:200 -#, fuzzy -msgid "&Disconnect" -msgstr "Hurtigt Forbind" - -#: win32/DirectoryListingFrame.cpp:311 win32/DirectoryListingFrame.cpp:336 -#: win32/DirectoryListingFrame.cpp:348 win32/SearchFrame.cpp:742 -#, fuzzy -msgid "&Download" -msgstr "Downloads" - -#: win32/MainWindow.cpp:205 -msgid "&Download Queue\tCtrl+D" -msgstr "" - -#: win32/HubListsDlg.cpp:75 -msgid "&Edit" -msgstr "" - -#: win32/MainWindow.cpp:202 -#, fuzzy -msgid "&Favorite Hubs\tCtrl+F" -msgstr "Favorit Hubs" - -#: win32/MainWindow.cpp:181 -#, fuzzy -msgid "&File" -msgstr "Fil" - -#: win32/TransferView.cpp:197 -msgid "&Force attempt" -msgstr "" - -#: win32/QueueFrame.cpp:1006 win32/WaitingUsersFrame.cpp:83 -#: win32/PrivateFrame.cpp:365 -msgid "&Get file list" -msgstr "" - -#: win32/DirectoryListingFrame.cpp:325 -#, fuzzy -msgid "&Go to directory" -msgstr "Download hele mappen" - -#: win32/MainWindow.cpp:228 win32/ADLSearchFrame.cpp:93 -msgid "&Help" -msgstr "" - -#: win32/PrivateFrame.cpp:366 -msgid "&Match queue" -msgstr "" - -#: win32/QueueFrame.cpp:960 win32/QueueFrame.cpp:978 win32/QueueFrame.cpp:988 -#, fuzzy -msgid "&Move/Rename" -msgstr "Omd�ppe" - -#: win32/FavHubsFrame.cpp:76 win32/FavHubsFrame.cpp:115 -#: win32/ADLSearchFrame.cpp:68 win32/ADLSearchFrame.cpp:293 -msgid "&New..." -msgstr "" - -#: win32/MainWindow.cpp:214 -#, fuzzy -msgid "&Notepad\tCtrl+N" -msgstr "Notesblok" - -#: win32/FavHubsFrame.cpp:81 win32/FavHubsFrame.cpp:116 -#: win32/ADLSearchFrame.cpp:73 win32/ADLSearchFrame.cpp:294 -#: win32/UsersFrame.cpp:186 -#, fuzzy -msgid "&Properties" -msgstr "ASM Egenskaber" - -#: win32/MainWindow.cpp:201 -#, fuzzy -msgid "&Public Hubs\tCtrl+P" -msgstr "Offentlige Hubs" - -#: win32/MainWindow.cpp:183 -#, fuzzy -msgid "&Quick Connect ...\tCtrl+Q" -msgstr "Hurtigt Forbind" - -#: win32/MainWindow.cpp:185 win32/HubFrame.cpp:1179 -msgid "&Reconnect\tCtrl+R" -msgstr "" - -#: win32/PublicHubsFrame.cpp:156 -msgid "&Refresh" -msgstr "" - -#: win32/UploadPage.cpp:36 win32/QueueFrame.cpp:968 win32/QueueFrame.cpp:980 -#: win32/QueueFrame.cpp:990 win32/HubListsDlg.cpp:79 -#: win32/WaitingUsersFrame.cpp:85 win32/FavoriteDirsPage.cpp:33 -#: win32/SearchFrame.cpp:755 win32/FavHubsFrame.cpp:96 -#: win32/FavHubsFrame.cpp:120 win32/ADLSearchFrame.cpp:88 -#: win32/ADLSearchFrame.cpp:295 win32/UCPage.cpp:35 win32/UsersFrame.cpp:187 -#, fuzzy -msgid "&Remove" -msgstr "Omd�ppe" - -#: win32/SpyFrame.cpp:191 -#, fuzzy -msgid "&Search" -msgstr "S�ter" - -#: win32/MainWindow.cpp:210 -msgid "&Search\tCtrl+S" -msgstr "" - -#: win32/QueueFrame.cpp:1014 win32/WaitingUsersFrame.cpp:88 -#, fuzzy -msgid "&Send private message" -msgstr "Ignor�(PM)beskeder fra bots" - -#: win32/MainWindow.cpp:199 -#, fuzzy -msgid "&View" -msgstr "Video (avi, mov, mpg m.fl.)" - -#: win32/DirectoryListingFrame.cpp:315 win32/SearchFrame.cpp:746 -msgid "&View as text" -msgstr "" - -#: win32/MainWindow.cpp:220 -msgid "&Window" -msgstr "" - -#: win32/HubFrame.cpp:490 -#, boost-format -msgid "*** Joins: %1%" -msgstr "" - -#: win32/HubFrame.cpp:497 -#, boost-format -msgid "*** Parts: %1%" -msgstr "" - -#: win32/HashProgressDlg.cpp:84 -#, boost-format -msgid "-.-- B/s, %1% left" -msgstr "" - -#: win32/HashProgressDlg.cpp:83 -#, boost-format -msgid "-.-- files/h, %1% files left" -msgstr "" - -#: win32/WinUtil.cpp:1025 -msgid "" -"A MAGNET link was given to DC++, but it didn't contain a valid file hash for " -"use on the Direct Connect network. No action will be taken." -msgstr "" -"En MAGNET link var givet til DC++, men den havde ikke en rigtig fil hash som " -"man bruger p�irect Connect netv�et. Derfor vil der ikke blive udf�ogen " -"handlinger." - -#: win32/MainWindow.cpp:211 win32/MainWindow.cpp:282 -msgid "ADL Search" -msgstr "AML S�g" - -#: win32/ADLSProperties.cpp:49 -msgid "ADLSearch Properties" -msgstr "ASM Egenskaber" - -#: win32/MainWindow.cpp:293 win32/MainWindow.cpp:549 -msgid "AWAY" -msgstr "Ikke Til Stede" - -#: win32/MainWindow.cpp:233 -msgid "About DC++..." -msgstr "Om DC++..." - -#: win32/AdvancedPage.cpp:43 -msgid "Accept custom user commands from hub" -msgstr "Accepter �rede bruger kommandoer fra huben" - -#: win32/WaitingUsersFrame.cpp:87 win32/PrivateFrame.cpp:369 -#: win32/HubFrame.cpp:1176 win32/PublicHubsFrame.cpp:448 -#, fuzzy -msgid "Add To &Favorites" -msgstr "Favorit Hubs" - -#: win32/AdvancedPage.cpp:45 -msgid "Add finished files to share instantly (if shared)" -msgstr "Tilf�rdige filer til deling �ikligt (hvis delt)" - -#: win32/QueueFrame.cpp:45 -#, fuzzy -msgid "Added" -msgstr "Hub adresse" - -#: win32/MainWindow.cpp:344 win32/PublicHubsFrame.cpp:52 -msgid "Address" -msgstr "Hub adresse" - -#: win32/SettingsDialog.cpp:67 -msgid "Advanced" -msgstr "Avanceret" - -#: win32/SettingsDialog.cpp:69 -msgid "Advanced\\Experts only" -msgstr "" - -#: win32/SettingsDialog.cpp:68 -#, fuzzy -msgid "Advanced\\Logs" -msgstr "Avanceret" - -#: win32/SettingsDialog.cpp:71 -msgid "Advanced\\Security Certificates" -msgstr "" - -#: win32/SettingsDialog.cpp:70 -msgid "Advanced\\User Commands" -msgstr "" - -#: win32/QueueFrame.cpp:1024 win32/QueueFrame.cpp:1034 -msgid "All" -msgstr "Alle" - -#: win32/QueueFrame.cpp:431 -#, fuzzy, boost-format -msgid "All %1% users offline" -msgstr "Bruger offline..." - -#: win32/CertificatesPage.cpp:43 -msgid "Allow TLS connections to clients without trusted certificate" -msgstr "Tillad TLS-opkobling til klienter uden certifikat" - -#: win32/CertificatesPage.cpp:42 -msgid "Allow TLS connections to hubs without trusted certificate" -msgstr "Tillad TLS-opkobling til hubs uden certifikat" - -#: win32/CommandDlg.cpp:117 -msgid "Always open help file with this dialog" -msgstr "�en hj�efilen med denne dialogboks" - -#: win32/SearchFrame.cpp:182 win32/HubFrame.cpp:129 -#: win32/PublicHubsFrame.cpp:138 -msgid "Any" -msgstr "Alle Typer" - -#: win32/SettingsDialog.cpp:63 -msgid "Appearance" -msgstr "Udseende" - -#: win32/SettingsDialog.cpp:64 -msgid "Appearance\\Colors and sounds" -msgstr "" - -#: win32/SettingsDialog.cpp:65 -#, fuzzy -msgid "Appearance\\Tabs" -msgstr "Udseende" - -#: win32/SettingsDialog.cpp:66 -#, fuzzy -msgid "Appearance\\Windows" -msgstr "Udseende" - -#: win32/SearchFrame.cpp:156 -msgid "At least" -msgstr "Mindst" - -#: win32/SearchFrame.cpp:157 -msgid "At most" -msgstr "H�" - -#: win32/SearchFrame.cpp:183 -msgid "Audio" -msgstr "Lyd Filer (mp3, wma, wav m.fl.)" - -#: win32/FavHubsFrame.cpp:32 -msgid "Auto connect / Name" -msgstr "Auto. Forbind / Navn" - -#: win32/UsersFrame.cpp:30 -msgid "Auto grant slot / Nick" -msgstr "Auto. Slot / Navn" - -#: win32/QueuePage.cpp:28 -#, fuzzy -msgid "Auto priority settings" -msgstr "Auto fjern Indstillinger" - -#: win32/Advanced3Page.cpp:40 -msgid "Auto refresh time" -msgstr "Auto update tid" - -#: win32/AdvancedPage.cpp:30 -msgid "Auto-away on minimize (and back on restore)" -msgstr "Auto-'Ikke til stede' til ved minimer og fra ved gendan" - -#: win32/WindowsPage.cpp:30 -msgid "Auto-open at startup" -msgstr "�en ved opstart" - -#: win32/Advanced3Page.cpp:41 -msgid "Auto-search limit" -msgstr "Auto-s�r�e" - -#: win32/QueuePage.cpp:37 -msgid "Autodrop settings" -msgstr "Auto fjern Indstillinger" - -#: win32/QueuePage.cpp:69 -msgid "Autodrop slow sources for all queue items (except filelists)" -msgstr "Fjern automatisk kilder for alle objekter i k�Untagen fillister)" - -#: win32/ADLSearchFrame.cpp:40 -msgid "Automatic Directory Listing Search" -msgstr "Automatisk S�g i Mappeliste" - -#: win32/AdvancedPage.cpp:37 -msgid "Automatically disconnect users who leave the hub" -msgstr "Afbryd brugere som forlader hubben (ikke ved crash, du forlader den)" - -#: win32/AdvancedPage.cpp:31 -msgid "Automatically follow redirects" -msgstr "F�utomatisk viderestillinger..." - -#: win32/QueuePage.cpp:73 -msgid "Automatically match queue for auto search hits" -msgstr "Automatisk match af k� AML s�gs fund" - -#: win32/UploadPage.cpp:39 -msgid "Automatically open an extra slot if speed is below (0 = disable)" -msgstr "Automatisk �n et ekstra slot hvis hastigheden er under (0 = fra)" - -#: win32/QueuePage.cpp:72 -msgid "Automatically search for alternative download locations" -msgstr "S�tomatisk efter alternative download-kilder" - -#: win32/SpyFrame.cpp:115 -#, boost-format -msgid "Average/s: %1%" -msgstr "" - -#: win32/WinUtil.cpp:264 win32/WinUtil.cpp:274 -msgid "Away mode off" -msgstr "'Ikke Til Stede' sl� fra" - -#: win32/WinUtil.cpp:269 -#, fuzzy, boost-format -msgid "Away mode on: %1%" -msgstr "'Ikke Til Stede' sl� fra" - -#: win32/Advanced3Page.cpp:28 win32/SearchFrame.cpp:171 -#: win32/ADLSProperties.cpp:74 -msgid "B" -msgstr "B" - -#: win32/QueuePage.cpp:39 -#, fuzzy -msgid "B/s" -msgstr "MB/s" - -#: win32/Advanced3Page.cpp:37 -msgid "Bind address" -msgstr "Bind adresse" - -#: win32/AdvancedPage.cpp:41 -msgid "Break on first ADLSearch match" -msgstr "Afbryd ved f� forekomst af 'Automatisk S�g i Mappeliste'" - -#: win32/DownloadPage.cpp:34 -msgid "Browse..." -msgstr "Gennemse..." - -#: win32/SearchFrame.cpp:43 win32/HubFrame.cpp:44 win32/UsersFrame.cpp:34 -msgid "CID" -msgstr "CID" - -#: win32/QueueFrame.cpp:477 -msgid "CRC32 inconsistency (SFV-Check)" -msgstr "CRC32-Inkonsistens (SFV-kontrol)" - -#: win32/MainWindow.cpp:232 -msgid "Change Log" -msgstr "Nye Features i DC++..." - -#: win32/CommandDlg.cpp:82 -msgid "Chat" -msgstr "Chat" - -#: win32/QueuePage.cpp:40 -msgid "Check every" -msgstr "Kontrollere hver" - -#: win32/TransferView.cpp:45 -msgid "Chunk size" -msgstr "" - -#: win32/TransferView.cpp:48 -msgid "Cipher" -msgstr "Tal" - -#: win32/AdvancedPage.cpp:32 -msgid "Clear search box after each search" -msgstr "Ryd s�ltet efter hver s�g" - -#: win32/MainWindow.cpp:223 -msgid "Close all PM windows" -msgstr "Luk alle PM-vinduer" - -#: win32/MainWindow.cpp:225 -msgid "Close all file list windows" -msgstr "Luk alle filiste-vinduer" - -#: win32/MainWindow.cpp:224 -msgid "Close all offline PM windows" -msgstr "Luk alle Offline PM-Vinduer" - -#: win32/MainWindow.cpp:226 -msgid "Close all search windows" -msgstr "Luk alle s�nduer" - -#: win32/MainWindow.cpp:222 -msgid "Close disconnected" -msgstr "Luk Alle Ikke-tilsluttede Vinduer" - -#: win32/Appearance2Page.cpp:31 -msgid "Colors" -msgstr "Farver" - -#: win32/UCPage.cpp:54 -msgid "Command" -msgstr "Kommando" - -#: win32/SearchFrame.cpp:184 -msgid "Compressed" -msgstr "Komprimerte Filer/mapper" - -#: win32/DownloadPage.cpp:41 -msgid "Configure Public Hub Lists" -msgstr "Konfigurere Hub Listerne" - -#: win32/HubListsDlg.cpp:43 win32/PublicHubsFrame.cpp:164 -msgid "Configured Public Hub Lists" -msgstr "Konfigurede Hub Lister" - -#: win32/WindowsPage.cpp:66 -msgid "Confirm application exit" -msgstr "Bekr� afslutning af DC++" - -#: win32/WindowsPage.cpp:32 -#, fuzzy -msgid "Confirm dialog options" -msgstr "Vindues indstillinger" - -#: win32/WindowsPage.cpp:67 -msgid "Confirm favorite hub removal" -msgstr "Bekr� fjernelse af en hub" - -#: win32/WindowsPage.cpp:68 -msgid "Confirm item removal in download queue" -msgstr "" - -#: win32/HubFrame.cpp:500 -msgid "Connected" -msgstr "Forbindelsen oprettet" - -#: win32/TransferView.cpp:640 win32/TransferView.cpp:647 -#, fuzzy -msgid "Connecting" -msgstr "Forbindelse" - -#: win32/TransferView.cpp:284 -#, fuzzy -msgid "Connecting (forced)" -msgstr "Forbindelsen oprettet" - -#: win32/HubFrame.cpp:826 -#, fuzzy, boost-format -msgid "Connecting to %1%..." -msgstr "Forbindelse" - -#: win32/SearchFrame.cpp:38 win32/HubFrame.cpp:41 -msgid "Connection" -msgstr "Forbindelse" - -#: win32/SettingsDialog.cpp:58 -msgid "Connection settings" -msgstr "Forbindelses Indstillinger" - -#: win32/TransferView.cpp:84 win32/TransferView.cpp:90 -#, fuzzy -msgid "Connections" -msgstr "Forbindelse" - -#: win32/HubFrame.cpp:1180 win32/PublicHubsFrame.cpp:449 -#, fuzzy -msgid "Copy &address to clipboard" -msgstr "Kopi�MAGNET link til Udklipsholderen" - -#: win32/TransferView.cpp:198 win32/HubFrame.cpp:1160 -#, fuzzy -msgid "Copy &nick to clipboard" -msgstr "Kopi�MAGNET link til Udklipsholderen" - -#: win32/WaitingUsersFrame.cpp:84 -#, fuzzy -msgid "Copy Filename" -msgstr "Filnavn" - -#: win32/WinUtil.cpp:363 -msgid "Copy magnet link to clipboard" -msgstr "Kopi�MAGNET link til Udklipsholderen" - -#: win32/SpyFrame.cpp:35 -#, fuzzy -msgid "Count" -msgstr "Land" - -#: win32/PublicHubsFrame.cpp:53 -msgid "Country" -msgstr "Land" - -#: win32/CommandDlg.cpp:63 -msgid "Create / Modify Command" -msgstr "Skab / Modificere Kommando" - -#: win32/HashProgressDlg.cpp:40 -msgid "Creating file index..." -msgstr "Laver indeks filen..." - -#: win32/MainWindow.cpp:552 -#, boost-format -msgid "D: %1%" -msgstr "" - -#: win32/MainWindow.cpp:554 -#, boost-format -msgid "D: %1%/s (%2%)" -msgstr "" - -#: win32/WinUtil.cpp:819 -msgid "DC++" -msgstr "DC++" - -#: win32/MainWindow.cpp:235 -msgid "DC++ Homepage" -msgstr "DC++�s Hjemmeside" - -#: win32/MainWindow.cpp:241 -msgid "DC++ discussion forum" -msgstr "DC++ Diskussionsforum" - -#: win32/AppearancePage.cpp:86 win32/AppearancePage.cpp:109 -msgid "Default" -msgstr "" - -#: win32/AppearancePage.cpp:32 -msgid "Default away message" -msgstr "Standart 'Ikke Til Stede' Besked" - -#: win32/DownloadPage.cpp:31 -msgid "Default download directory" -msgstr "Standart Downloads Mappen" - -#: win32/GeneralPage.cpp:31 win32/FavHubsFrame.cpp:33 win32/HubFrame.cpp:39 -#: win32/PublicHubsFrame.cpp:50 win32/UsersFrame.cpp:33 -#: win32/UsersFrame.cpp:143 -msgid "Description" -msgstr "Beskrivelse!" - -#: win32/ADLSearchFrame.cpp:34 -msgid "Destination Directory" -msgstr "Destination Mappe" - -#: win32/NetworkPage.cpp:30 win32/NetworkPage.cpp:31 -msgid "Direct connection" -msgstr "Direkte forbindelse" - -#: win32/DownloadPage.cpp:30 -msgid "Directories" -msgstr "Mappe" - -#: win32/UploadPage.cpp:64 win32/FavoriteDirsPage.cpp:49 -#: win32/SearchFrame.cpp:189 win32/SearchFrame.cpp:530 win32/LogPage.cpp:32 -#: win32/ADLSProperties.cpp:63 -msgid "Directory" -msgstr "Mappe" - -#: win32/FavoriteDirsPage.cpp:126 win32/FavoriteDirsPage.cpp:159 -msgid "Directory or directory name already exists" -msgstr "Mappen eller mappe navn eksistere allerede" - -#: win32/MagnetDlg.cpp:62 -msgid "Do nothing" -msgstr "G�genting" - -#: win32/SearchFrame.cpp:185 -msgid "Document" -msgstr "Dokument Filer (doc, pdf, txt m.fl.)" - -#: win32/NetworkPage.cpp:35 -msgid "Don't allow hub/UPnP to override" -msgstr "Ikke tillat at tilsides�e hub/UPnP" - -#: win32/AdvancedPage.cpp:47 -msgid "Don't automatically disconnect favorite users who leave the hub" -msgstr "Afbryd ikke automatisk fra favorittbrugere som forlader hubben" - -#: win32/AdvancedPage.cpp:36 -msgid "Don't delete file lists when exiting" -msgstr "Gem hentede fillister n�DC++ afsluttes" - -#: win32/QueuePage.cpp:75 -msgid "Don't download files already in share" -msgstr "Lad v� med at downloade filer som bliver delt allerede" - -#: win32/QueuePage.cpp:76 -#, fuzzy -msgid "Don't download files already in the queue" -msgstr "Lad v� med at downloade filer som bliver delt allerede" - -#: win32/HubFrame.cpp:385 -msgid "Don't remove /password before your password" -msgstr "Lad v� med at slette /password f�t kodeord" - -#: win32/QueuePage.cpp:71 -msgid "Don't remove the source when autodropping, only disconnect" -msgstr "Fjern ikke kilder n�\"auto-fjern\", kun lukker ned" - -#: win32/AdvancedPage.cpp:40 -msgid "Don't send the away message to bots" -msgstr "Send ikke \"Ikke Til Stede\" beskeder til botter" - -#: win32/MainWindow.cpp:244 -msgid "Donate (paypal)" -msgstr "Don����/$$$ (PayPal)" - -#: win32/Appearance2Page.cpp:34 -msgid "Donate €€€:s! (ok, dirty dollars are fine as well =) (see help menu)" -msgstr "" - -#: win32/TransferView.cpp:58 -msgid "Done" -msgstr "" - -#: win32/DirectoryListingFrame.cpp:358 -#, fuzzy -msgid "Download &to..." -msgstr "Download til..." - -#: win32/ADLSProperties.cpp:88 -msgid "Download Matches" -msgstr "Download Matches" - -#: win32/QueueFrame.cpp:57 win32/TabsPage.cpp:41 win32/WindowsPage.cpp:39 -#: win32/MainWindow.cpp:276 -#, fuzzy -msgid "Download Queue" -msgstr "Downloaded" - -#: win32/PublicHubsFrame.cpp:322 -#, fuzzy, boost-format -msgid "Download failed: %1%" -msgstr "Downloaded" - -#: win32/WinUtil.cpp:820 -msgid "Download files from the Direct Connect network" -msgstr "Download filer fra Direct Connect netv�et" - -#: win32/SearchFrame.cpp:764 -msgid "Download to..." -msgstr "Download til..." - -#: win32/SearchFrame.cpp:744 -msgid "Download whole directory" -msgstr "Download hele mappen" - -#: win32/SearchFrame.cpp:794 -msgid "Download whole directory to..." -msgstr "Download hele mappen til..." - -#: win32/QueueFrame.cpp:39 -msgid "Downloaded" -msgstr "Downloaded" - -#: win32/TransferView.cpp:718 -#, fuzzy, boost-format -msgid "Downloading %1%" -msgstr "Downloader..." - -#: win32/TransferView.cpp:629 -#, boost-format -msgid "Downloading from %1% user" -msgid_plural "Downloading from %1% users" -msgstr[0] "" -msgstr[1] "" - -#: win32/DirectoryListingFrame.cpp:693 -msgid "Downloading list..." -msgstr "Downloader list..." - -#: win32/PublicHubsFrame.cpp:188 -msgid "Downloading public hub list..." -msgstr "Downloader Offentlig Hubliste..." - -#: win32/PublicHubsFrame.cpp:319 -#, fuzzy, boost-format -msgid "Downloading public hub list... (%1%)" -msgstr "Downloader Offentlig Hubliste..." - -#: win32/AboutDlg.cpp:63 -msgid "Downloading..." -msgstr "Downloader..." - -#: win32/SettingsDialog.cpp:59 win32/MainWindow.cpp:217 -#: win32/MainWindow.cpp:236 win32/TransferView.cpp:93 -#: win32/TransferView.cpp:95 win32/Appearance2Page.cpp:40 -msgid "Downloads" -msgstr "Downloads" - -#: win32/SettingsDialog.cpp:60 -#, fuzzy -msgid "Downloads\\Favorites" -msgstr "Download Matches" - -#: win32/SettingsDialog.cpp:61 -#, fuzzy -msgid "Downloads\\Queue" -msgstr "Downloads" - -#: win32/QueuePage.cpp:38 -msgid "Drop sources below" -msgstr "Fjerner kilder under" - -#: win32/MainWindow.cpp:197 -msgid "E&xit" -msgstr "" - -#: win32/GeneralPage.cpp:30 win32/HubFrame.cpp:43 -msgid "E-Mail" -msgstr "E-Mail" - -#: win32/HubListsDlg.cpp:149 -msgid "Edit the hublist" -msgstr "Redigere hublisten" - -#: win32/AdvancedPage.cpp:39 -msgid "Enable automatic SFV checking" -msgstr "Sl�FV-kontrol til (ekstra sikkerhed for at filen overf�korrekt)" - -#: win32/AdvancedPage.cpp:42 -msgid "Enable safe and compressed transfers" -msgstr "Benyt sikkert og komprimerede overf�er" - -#: win32/ADLSProperties.cpp:84 -msgid "Enabled" -msgstr "Sl�il" - -#: win32/ADLSearchFrame.cpp:32 -msgid "Enabled / Search String" -msgstr "Aktiv S�unktion" - -#: win32/DirectoryListingFrame.cpp:795 -msgid "Enter search string" -msgstr "Indtast en s�reng..." - -#: win32/WinUtil.cpp:727 -msgid "Error creating adc registry key" -msgstr "" - -#: win32/WinUtil.cpp:688 -msgid "Error creating dchub registry key" -msgstr "" - -#: win32/WinUtil.cpp:787 win32/WinUtil.cpp:800 -msgid "Error creating magnet registry key" -msgstr "" - -#: win32/QueueFrame.cpp:44 -msgid "Errors" -msgstr "Fejl" - -#: win32/QueueFrame.cpp:43 win32/DirectoryListingFrame.cpp:42 -#: win32/SearchFrame.cpp:40 -msgid "Exact size" -msgstr "Pr�s St�se" - -#: win32/SearchFrame.cpp:186 -msgid "Executable" -msgstr "Eksekverbar Filer (exe, com m.fl.)" - -#: win32/MainWindow.cpp:998 -msgid "Exit" -msgstr "" - -#: win32/NetworkPage.cpp:38 -msgid "External / WAN IP" -msgstr "Ekstern/IP" - -#: win32/PublicHubsFrame.cpp:168 -#, fuzzy -msgid "F&ilter" -msgstr "Fil" - -#: win32/MainWindow.cpp:631 win32/MainWindow.cpp:632 -msgid "Failed to create port mappings. Please set up your NAT yourself." -msgstr "Det mislykkedes at skabe port kortl�er" - -#: win32/MainWindow.cpp:650 win32/MainWindow.cpp:651 -msgid "Failed to get external IP via UPnP. Please set it yourself." -msgstr "" -"Det mislykkedes f�en ekterne IP via UPnP. V�venligs og s�det ordenligt op." - -#: win32/MainWindow.cpp:664 win32/MainWindow.cpp:672 -msgid "Failed to remove port mappings" -msgstr "Det mislykkedes at fjerne port kortl�er" - -#: win32/MainWindow.cpp:203 -#, fuzzy -msgid "Favorite &Users\tCtrl+U" -msgstr "Favorit Brugere" - -#: win32/FavHubProperties.cpp:47 -msgid "Favorite Hub Properties" -msgstr "Favorit Hub Egenskaber" - -#: win32/WindowsPage.cpp:47 win32/MainWindow.cpp:273 win32/FavHubsFrame.cpp:41 -msgid "Favorite Hubs" -msgstr "Favorit Hubs" - -#: win32/WindowsPage.cpp:38 win32/MainWindow.cpp:274 win32/UsersFrame.cpp:38 -msgid "Favorite Users" -msgstr "Favorit Brugere" - -#: win32/FavoriteDirsPage.cpp:32 -msgid "Favorite download directories" -msgstr "Favorit 'Download til' mapper" - -#: win32/HubFrame.cpp:964 -msgid "Favorite hub added" -msgstr "Hub tilf�til 'Favorit Hubs'" - -#: win32/HubFrame.cpp:974 -#, fuzzy -msgid "Favorite hub removed" -msgstr "Hub tilf�til 'Favorit Hubs'" - -#: win32/FavoriteDirsPage.cpp:48 win32/FavoriteDirsPage.cpp:120 -#: win32/FavoriteDirsPage.cpp:150 -msgid "Favorite name" -msgstr "Favorit navn" - -#: win32/PrivateFrame.cpp:290 -msgid "Favorite user added" -msgstr "Bruger tilf�til 'Favorit Brugere'" - -#: win32/DirectoryListingFrame.cpp:40 win32/SearchFrame.cpp:32 -msgid "File" -msgstr "Fil" - -#: win32/QueueFrame.cpp:473 -msgid "File not available" -msgstr "Fil er ikke tilg�elig..!" - -#: win32/SearchFrame.cpp:122 -msgid "File type" -msgstr "Filtype" - -#: win32/CommandDlg.cpp:99 -msgid "Filelist Menu" -msgstr "Filliste Menu" - -#: win32/QueueFrame.cpp:36 win32/TransferView.cpp:53 win32/LogPage.cpp:35 -#: win32/ADLSProperties.cpp:62 -msgid "Filename" -msgstr "Filnavn" - -#: win32/QueueFrame.cpp:287 win32/DirectoryListingFrame.cpp:634 -#: win32/DirectoryListingFrame.cpp:650 -#, boost-format -msgid "Files: %1%" -msgstr "" - -#: win32/AppearancePage.cpp:47 -msgid "Filter kick and NMDC debug messages" -msgstr "Filtr�'Kick' og 'NMDC debug'-meddelelser fra" - -#: win32/DirectoryListingFrame.cpp:160 win32/DirectoryListingFrame.cpp:182 -msgid "Find" -msgstr "" - -#: win32/TabsPage.cpp:42 win32/WindowsPage.cpp:40 win32/MainWindow.cpp:206 -#: win32/MainWindow.cpp:277 win32/FinishedDLFrame.cpp:25 -msgid "Finished Downloads" -msgstr "F�ige Downloads" - -#: win32/TabsPage.cpp:44 win32/WindowsPage.cpp:42 win32/MainWindow.cpp:208 -#: win32/MainWindow.cpp:279 win32/FinishedULFrame.cpp:25 -msgid "Finished Uploads" -msgstr "F�ige oploads" - -#: win32/NetworkPage.cpp:34 -msgid "Firewall (passive, last resort)" -msgstr "Firewall passiv (D�igt valg)" - -#: win32/NetworkPage.cpp:32 -msgid "Firewall with UPnP" -msgstr "Firewall med UPnP" - -#: win32/NetworkPage.cpp:33 -msgid "Firewall with manual port forwarding" -msgstr "Firewall med manuel port forwarding'" - -#: win32/MainWindow.cpp:184 -msgid "Follow last redirec&t\tCtrl+T" -msgstr "" - -#: win32/MainWindow.cpp:271 -msgid "Follow last redirect" -msgstr "" - -#: win32/LogPage.cpp:34 -msgid "Format" -msgstr "Format" - -#: win32/MainWindow.cpp:239 -msgid "Frequently asked questions" -msgstr "Ofte Stillede Sp��(FAQ)" - -#: win32/ADLSProperties.cpp:64 -msgid "Full Path" -msgstr "Hele Stien" - -#: win32/QueueFrame.cpp:479 -msgid "Full tree does not match TTH root" -msgstr "Downloaded TTH tr�atcher ikke TTH roden" - -#: win32/MainWindow.cpp:237 -msgid "GeoIP database update" -msgstr "Opdatering af GeoIP-database" - -#: win32/SearchFrame.cpp:174 win32/ADLSProperties.cpp:77 -msgid "GiB" -msgstr "GB" - -#: win32/WaitingUsersFrame.cpp:86 win32/PrivateFrame.cpp:367 -msgid "Grant &extra slot" -msgstr "" - -#: win32/AppearancePage.cpp:56 -msgid "Guess user country from IP" -msgstr "Find brugerens land" - -#: win32/DownloadPage.cpp:42 -msgid "HTTP Proxy (for hublist only)" -msgstr "HTTP Proxy (Kun For Hubliste)" - -#: win32/MainWindow.cpp:230 -msgid "Help &Contents\tF1" -msgstr "" - -#: win32/MainWindow.cpp:240 -msgid "Help forum" -msgstr "Hj�eforum" - -#: win32/QueueFrame.cpp:454 win32/QueueFrame.cpp:1000 -#, fuzzy -msgid "High" -msgstr "H�" - -#: win32/QueuePage.cpp:31 -msgid "High prio max size" -msgstr "H�iotet" - -#: win32/QueueFrame.cpp:455 win32/QueueFrame.cpp:1001 -msgid "Highest" -msgstr "H�" - -#: win32/QueuePage.cpp:29 -msgid "Highest prio max size" -msgstr "H� priotet" - -#: win32/SpyFrame.cpp:162 -#, boost-format -msgid "Hit Ratio: %1%" -msgstr "" - -#: win32/SpyFrame.cpp:160 -#, boost-format -msgid "Hits: %1%" -msgstr "" - -#: win32/TabsPage.cpp:37 win32/SearchFrame.cpp:39 win32/UCPage.cpp:55 -msgid "Hub" -msgstr "Hub" - -#: win32/UsersFrame.cpp:31 -msgid "Hub (last seen in, if offline)" -msgstr "" - -#: win32/CommandDlg.cpp:90 -msgid "Hub Menu" -msgstr "Hub Menu" - -#: win32/FavHubProperties.cpp:119 -msgid "Hub address cannot be empty" -msgstr "" - -#: win32/FavHubsFrame.cpp:179 win32/HubFrame.cpp:966 -msgid "Hub already exists as a favorite" -msgstr "" - -#: win32/PublicHubsFrame.cpp:316 -#, fuzzy, boost-format -msgid "Hub list downloaded... (%1%)" -msgstr "Hubliste hentet fra bufferen" - -#: win32/PublicHubsFrame.cpp:316 -msgid "Hub list loaded from cache..." -msgstr "Hubliste hentet fra bufferen" - -#: win32/HubListsDlg.cpp:149 -msgid "Hublist" -msgstr "Hublist" - -#: win32/SearchFrame.cpp:128 -msgid "Hubs" -msgstr "Hubber" - -#: win32/PublicHubsFrame.cpp:271 -#, fuzzy, boost-format -msgid "Hubs: %1%" -msgstr "Hubber" - -#: win32/SearchFrame.cpp:41 win32/TransferView.cpp:49 win32/HubFrame.cpp:42 -msgid "IP" -msgstr "IP" - -#: win32/HubFrame.cpp:330 -#, boost-format -msgid "IP: %1%, Port: %2%/%3%/%4%" -msgstr "" - -#: win32/TransferView.cpp:535 win32/TransferView.cpp:831 -msgid "Idle" -msgstr "" - -#: win32/SpyFrame.cpp:66 -msgid "Ignore TTH searches" -msgstr "Ignore TTH searches" - -#: win32/WindowsPage.cpp:59 -msgid "Ignore private messages from bots" -msgstr "Ignor�(PM)beskeder fra bots" - -#: win32/WindowsPage.cpp:58 -msgid "Ignore private messages from the hub" -msgstr "Ignor�(PM)beskeder fra hubber" - -#: win32/HubFrame.cpp:542 win32/HubFrame.cpp:550 -#, boost-format -msgid "Ignored message: %1%" -msgstr "" - -#: win32/NetworkPage.cpp:47 -msgid "Incoming connection settings (see Help/FAQ if unsure)" -msgstr "Indkommende besked om indstillinger" - -#: win32/MainWindow.cpp:218 -msgid "Indexing progress" -msgstr "Indekserings Fremskridt.." - -#: win32/MainWindow.cpp:690 -msgid "Invalid file list name" -msgstr "Ugyldigt fillist navn" - -#: win32/WinUtil.cpp:250 -msgid "Invalid number of slots" -msgstr "Ugyldigt antal slots..." - -#: win32/QueueFrame.cpp:283 -#, boost-format -msgid "Items: %1%" -msgstr "" - -#: win32/HubFrame.cpp:323 -msgid "Join/part of favorite users showing off" -msgstr "Ankomst/Afgang af favorit brugere visning sl� fra" - -#: win32/HubFrame.cpp:321 -msgid "Join/part of favorite users showing on" -msgstr "Ankomst/Afgang af favorit brugere visning sl� til" - -#: win32/HubFrame.cpp:316 -msgid "Join/part showing off" -msgstr "Ankomst/Afgang vises ikke" - -#: win32/HubFrame.cpp:314 -msgid "Join/part showing on" -msgstr "Ankomst/Afgang vises" - -#: win32/AdvancedPage.cpp:33 -msgid "Keep duplicate files in your file list" -msgstr "" -"Inklud�duplikerede filer i min filliste (duplikerede filer t�er aldrig med i " -"din deling)" - -#: win32/QueuePage.cpp:30 win32/QueuePage.cpp:32 win32/QueuePage.cpp:34 -#: win32/QueuePage.cpp:36 win32/QueuePage.cpp:48 win32/Advanced3Page.cpp:30 -#: win32/Advanced3Page.cpp:36 win32/SearchFrame.cpp:172 -#: win32/ADLSProperties.cpp:75 -msgid "KiB" -msgstr "Kb" - -#: win32/UploadPage.cpp:40 -msgid "KiB/s" -msgstr "Kb/s" - -#: win32/AppearancePage.cpp:34 -msgid "Language file" -msgstr "Sprog Fil" - -#: win32/DownloadPage.cpp:35 -msgid "Limits" -msgstr "Download gr�er" - -#: win32/GeneralPage.cpp:32 -msgid "Line speed (upload)" -msgstr "Oploade hastighed" - -#: win32/SplashWindow.cpp:77 -#, boost-format -msgid "Loading DC++, please wait... (%1%)" -msgstr "" - -#: win32/LogPage.cpp:47 -msgid "Log downloads" -msgstr "Log downloads" - -#: win32/LogPage.cpp:51 -msgid "Log filelist transfers" -msgstr "Log filliste overf�er" - -#: win32/LogPage.cpp:45 -msgid "Log main chat" -msgstr "Log main chat" - -#: win32/LogPage.cpp:46 -msgid "Log private chat" -msgstr "Log privat chat" - -#: win32/LogPage.cpp:50 -msgid "Log status messages" -msgstr "Log status beskeder" - -#: win32/LogPage.cpp:49 -msgid "Log system messages" -msgstr "Log system beskeder" - -#: win32/LogPage.cpp:48 -msgid "Log uploads" -msgstr "Log uploads" - -#: win32/LogPage.cpp:31 -msgid "Logging" -msgstr "Logging" - -#: win32/NetworkPage.cpp:44 -msgid "Login" -msgstr "Socks5 brugernavn" - -#: win32/WinUtil.cpp:362 -msgid "Lookup TTH at Bitzi.com" -msgstr "Kig efter TTH roden p�itzi.com" - -#: win32/QueueFrame.cpp:452 win32/QueueFrame.cpp:998 -msgid "Low" -msgstr "Lav" - -#: win32/QueuePage.cpp:35 -msgid "Low prio max size" -msgstr "Lav priotet" - -#: win32/QueueFrame.cpp:451 win32/QueueFrame.cpp:997 -msgid "Lowest" -msgstr "Laveste" - -#: win32/MagnetDlg.cpp:44 win32/WinUtil.cpp:1025 -msgid "MAGNET Link detected" -msgstr "MAGNET link opdaget" - -#: win32/WinUtil.cpp:972 -#, fuzzy, boost-format -msgid "MAGNET Link detected: %1%" -msgstr "MAGNET link opdaget" - -#: win32/Appearance2Page.cpp:38 -msgid "Make an annoying sound every time a private message is received" -msgstr "Lav et irriterene lyd hver gang en privat besked er modtaget" - -#: win32/Appearance2Page.cpp:39 -msgid "Make an annoying sound when a private message window is opened" -msgstr "Lav et irriterene lyd n�en privat besked vindue er �et" - -#: win32/MainWindow.cpp:190 -msgid "Match downloaded lists" -msgstr "Matcher downloadede filst�ser" - -#: win32/DirectoryListingFrame.cpp:168 win32/DirectoryListingFrame.cpp:181 -msgid "Match queue" -msgstr "" - -#: win32/DirectoryListingFrame.cpp:260 -#, boost-format -msgid "Matched %1% file" -msgid_plural "Matched %1% files" -msgstr[0] "" -msgstr[1] "" - -#: win32/PublicHubsFrame.cpp:57 -msgid "Max Hubs" -msgstr "Max. Hubs" - -#: win32/ADLSearchFrame.cpp:36 -#, fuzzy -msgid "Max Size" -msgstr "St�se" - -#: win32/PublicHubsFrame.cpp:58 -msgid "Max Users" -msgstr "Max. Brugere" - -#: win32/Advanced3Page.cpp:38 -msgid "Max filelist size" -msgstr "Max. Fillistest�se" - -#: win32/Advanced3Page.cpp:31 -msgid "Max hash speed" -msgstr "Max. Hash Hastighed" - -#: win32/QueuePage.cpp:44 -msgid "Max inactivity" -msgstr "Max inaktivitet" - -#: win32/DownloadPage.cpp:36 -msgid "Maximum simultaneous downloads (0 = infinite)" -msgstr "Maximum samtidlige downloads (0 = fra)" - -#: win32/Advanced3Page.cpp:39 win32/SearchFrame.cpp:173 -#: win32/ADLSProperties.cpp:76 -msgid "MiB" -msgstr "MB" - -#: win32/Advanced3Page.cpp:32 -msgid "MiB/s" -msgstr "MB/s" - -#: win32/GeneralPage.cpp:33 -msgid "MiBits/s" -msgstr "MB/s" - -#: win32/PublicHubsFrame.cpp:55 -msgid "Min Share" -msgstr "Min. Delling" - -#: win32/ADLSearchFrame.cpp:35 -#, fuzzy -msgid "Min Size" -msgstr "Min. Delling" - -#: win32/PublicHubsFrame.cpp:56 -msgid "Min Slots" -msgstr "Min Slots" - -#: win32/QueuePage.cpp:42 -msgid "Min elapsed" -msgstr "Brugt tid" - -#: win32/QueuePage.cpp:47 -msgid "Min filesize" -msgstr "Min filst�se" - -#: win32/Advanced3Page.cpp:42 -#, fuzzy -msgid "Min segment size" -msgstr "St�se p�ini-slots" - -#: win32/QueuePage.cpp:46 -msgid "Min sources online" -msgstr "Min kilder online" - -#: win32/Advanced3Page.cpp:35 -msgid "Mini slot size" -msgstr "St�se p�ini-slots" - -#: win32/AppearancePage.cpp:48 -msgid "Minimize to tray" -msgstr "Minim�til systembakken (ved siden af uret)" - -#: win32/HubListsDlg.cpp:71 win32/FavHubsFrame.cpp:91 -#: win32/FavHubsFrame.cpp:118 win32/ADLSearchFrame.cpp:83 win32/UCPage.cpp:32 -msgid "Move &Down" -msgstr "" - -#: win32/HubListsDlg.cpp:67 win32/FavHubsFrame.cpp:86 -#: win32/FavHubsFrame.cpp:117 win32/ADLSearchFrame.cpp:78 win32/UCPage.cpp:31 -msgid "Move &Up" -msgstr "" - -#: win32/UCPage.cpp:53 win32/PublicHubsFrame.cpp:49 -msgid "Name" -msgstr "Navn" - -#: win32/UploadPage.cpp:188 win32/UploadPage.cpp:232 -msgid "Name under which the others see the directory" -msgstr "Under navnet af mappen som de andre ser" - -#: win32/WindowsPage.cpp:44 win32/MainWindow.cpp:216 win32/StatsFrame.cpp:27 -msgid "Network Statistics" -msgstr "Netv� Statestiker" - -#: win32/UploadPage.cpp:197 -msgid "New virtual name matches old name, skipping..." -msgstr "Den nye virtuele navn matcher det gamle navn, springer over..." - -#: win32/DirectoryListingFrame.cpp:164 win32/DirectoryListingFrame.cpp:183 -msgid "Next" -msgstr "N�e" - -#: win32/GeneralPage.cpp:29 win32/FavHubsFrame.cpp:34 win32/HubFrame.cpp:37 -msgid "Nick" -msgstr "Brugernavn" - -#: win32/QueueFrame.cpp:488 -msgid "No errors" -msgstr "Ingen fejl" - -#: win32/DirectoryListingFrame.cpp:858 -msgid "No matches" -msgstr "Ingen resultater fundet!" - -#: win32/DownloadPage.cpp:37 -msgid "No new downloads if speed exceeds (KiB/s, 0 = disable)" -msgstr "Ikke nogen nye downloads hvis hastigheden er under (0 KB/s= fra)" - -#: win32/QueueFrame.cpp:415 -msgid "No users" -msgstr "Ingen bruger(e)" - -#: win32/QueueFrame.cpp:427 -msgid "No users to download from" -msgstr "Ingen brugere at downloade fra" - -#: win32/QueueFrame.cpp:453 win32/QueueFrame.cpp:999 win32/SearchFrame.cpp:155 -msgid "Normal" -msgstr "Normal" - -#: win32/QueuePage.cpp:33 -msgid "Normal prio max size" -msgstr "Normal priotet" - -#: win32/UploadPage.cpp:42 -msgid "Note; Files appear in the share only after they've been hashed!" -msgstr "Notat; Nye filer er tilf�til deling kun n�de er blevet hashet!" - -#: win32/DownloadPage.cpp:38 -#, fuzzy, c-format -msgid "Note; because of changing download speeds, this is not 100% accurate..." -msgstr "" -"Notat; Fordi af skiftende download hastigheder, er det her ikke 100% pr�st..." - -#: win32/Appearance2Page.cpp:35 win32/AppearancePage.cpp:35 -msgid "Note; most of these options require that you restart DC++" -msgstr "Notat; De fleste af disse indstillinger kr�r at du genstarter DC++." - -#: win32/WindowsPage.cpp:45 win32/NotepadFrame.cpp:27 win32/MainWindow.cpp:287 -msgid "Notepad" -msgstr "Notesblok" - -#: win32/Appearance2Page.cpp:29 -msgid "Notification sound" -msgstr "Notifikations lyd" - -#: win32/WinUtil.cpp:323 -msgid "Offline" -msgstr "Offline" - -#: win32/UsersFrame.cpp:108 win32/UsersFrame.cpp:123 -msgid "Online" -msgstr "Online" - -#: win32/AppearancePage.cpp:52 -msgid "Only show joins / parts for favorite users" -msgstr "Vis kun ankomst/afgang for favorit brugere" - -#: win32/SearchFrame.cpp:194 -msgid "Only users with free slots" -msgstr "Kun brugere med ledige slots" - -#: win32/SearchFrame.cpp:216 -msgid "Only where I'm op" -msgstr "Kun hvor jeg er OP!" - -#: win32/MainWindow.cpp:192 win32/MainWindow.cpp:999 -msgid "Open downloads directory" -msgstr "�n Download Stien" - -#: win32/MainWindow.cpp:285 -#, fuzzy -msgid "Open file list..." -msgstr "�n Egen Liste" - -#: win32/MainWindow.cpp:188 -msgid "Open file list...\tCtrl+L" -msgstr "" - -#: win32/WindowsPage.cpp:55 -msgid "Open new file list windows in the background" -msgstr "�n nye fillister vinduer i baggrunden" - -#: win32/WindowsPage.cpp:56 -msgid "Open new private message windows in the background" -msgstr "�n nye privat beskeder vinduer i baggrunden" - -#: win32/WindowsPage.cpp:57 -msgid "Open new window when using /join" -msgstr "�en ny vinduer n�\"/join\" bruges" - -#: win32/MainWindow.cpp:189 -msgid "Open own list" -msgstr "�n Egen Liste" - -#: win32/WindowsPage.cpp:53 -msgid "Open private messages from bots in their own window" -msgstr "�n nye privat beskeder vinduer i baggrunden" - -#: win32/WindowsPage.cpp:54 -msgid "Open private messages from the hub in their own window" -msgstr "�n nye privat beskeder vinduer i baggrunden" - -#: win32/WindowsPage.cpp:52 -msgid "Open private messages in their own window" -msgstr "Private beskeder popper op i deres eget vindue" - -#: win32/AppearancePage.cpp:31 -msgid "Options" -msgstr "Valg" - -#: win32/QueuePage.cpp:49 -#, fuzzy -msgid "Other queue options" -msgstr "S�uligheder" - -#: win32/NetworkPage.cpp:48 -msgid "Outgoing connection settings" -msgstr "Udg�de forbindelses indstillinger" - -#: win32/CommandDlg.cpp:86 -msgid "PM" -msgstr "PM" - -#: win32/Advanced3Page.cpp:33 -msgid "PM history" -msgstr "Log over private beskeder" - -#: win32/QueueFrame.cpp:475 -msgid "Passive user" -msgstr "Passiv bruger" - -#: win32/NetworkPage.cpp:45 win32/FavHubsFrame.cpp:35 -msgid "Password" -msgstr "Kodeord" - -#: win32/QueueFrame.cpp:42 win32/SearchFrame.cpp:36 win32/TransferView.cpp:54 -msgid "Path" -msgstr "Sti" - -#: win32/QueueFrame.cpp:450 win32/QueueFrame.cpp:996 -msgid "Paused" -msgstr "Pauset" - -#: win32/GeneralPage.cpp:28 -msgid "Personal Information" -msgstr "Personligt Information" - -#: win32/SettingsDialog.cpp:57 -msgid "Personal information" -msgstr "Generelt" - -#: win32/SearchFrame.cpp:187 -msgid "Picture" -msgstr "Billede Filer (jpg, bmp, gif m.fl.)" - -#: win32/FavHubsFrame.cpp:320 win32/PublicHubsFrame.cpp:496 -msgid "Please enter a nickname in the settings dialog!" -msgstr "Indtast venligst et brugernavn under 'Indstillinger'!" - -#: win32/HubFrame.cpp:528 -msgid "Please enter a password" -msgstr "Indtast venligst et kodeord!" - -#: win32/WindowsPage.cpp:61 -msgid "Popup box to input password for hubs" -msgstr "�en en dialog for at andgive password til hub(ben)" - -#: win32/NetworkPage.cpp:43 -msgid "Port" -msgstr "Socks5 port" - -#: win32/NetworkPage.cpp:37 -msgid "Ports" -msgstr "Port instillinger" - -#: win32/HubFrame.cpp:855 -#, boost-format -msgid "Press the follow redirect button to connect to %1%" -msgstr "" - -#: win32/QueueFrame.cpp:40 -msgid "Priority" -msgstr "Prioritet" - -#: win32/TabsPage.cpp:38 -msgid "Private message" -msgstr "" - -#: win32/HubFrame.cpp:546 win32/HubFrame.cpp:554 win32/HubFrame.cpp:560 -#, fuzzy, boost-format -msgid "Private message from %1%: %2%" -msgstr "Ignor�(PM)beskeder fra hubber" - -#: win32/WindowsPage.cpp:46 win32/MainWindow.cpp:269 -#: win32/PublicHubsFrame.cpp:93 -msgid "Public Hubs" -msgstr "Offentlige Hubs" - -#: win32/DownloadPage.cpp:39 -msgid "Public Hubs list" -msgstr "Offenlig Hubliste" - -#: win32/DownloadPage.cpp:40 -msgid "Public Hubs list URL" -msgstr "Offenlig Hubliste URL" - -#: win32/SearchFrame.cpp:240 -msgid "Purge" -msgstr "Rens" - -#: win32/TransferView.cpp:47 -msgid "Queued" -msgstr "" - -#: win32/MainWindow.cpp:344 -msgid "Quick Connect" -msgstr "Hurtigt Forbind" - -#: win32/PublicHubsFrame.cpp:60 -msgid "Rating" -msgstr "Vudering" - -#: win32/AboutDlg.cpp:61 -#, c-format, boost-format -msgid "Ratio (up/down): %1$0.2f" -msgstr "" - -#: win32/CommandDlg.cpp:78 -msgid "Raw" -msgstr "Raw" - -#: win32/QueueFrame.cpp:1022 -msgid "Re-add source" -msgstr "Tilf�lde igen" - -#: win32/SearchFrame.cpp:1024 -msgid "Ready to search..." -msgstr "Klar til at s�." - -#: win32/MainWindow.cpp:459 -msgid "Really exit?" -msgstr "Vil du virkelig afslutte DC++?" - -#: win32/QueueFrame.cpp:692 win32/QueueFrame.cpp:697 -#: win32/FavHubsFrame.cpp:243 -msgid "Really remove?" -msgstr "Vil du virkeligt fjerne den?" - -#: win32/MainWindow.cpp:270 -#, fuzzy -msgid "Reconnect" -msgstr "Forbindelsen oprettet" - -#: win32/HubFrame.cpp:848 win32/HubFrame.cpp:1371 -msgid "Redirect request received to a hub that's already connected" -msgstr "" -"Viderestillingsforesp�l modtaget til en hub, du allerede er forbundet til!" - -#: win32/MainWindow.cpp:191 -msgid "Refresh file list\tCtrl+E" -msgstr "" - -#: win32/AdvancedPage.cpp:34 -msgid "Register with Windows to handle dchub:// and adc:// URL links" -msgstr "Registrer i Windows URL-styring til at h�tere dchub:// og adc:// links" - -#: win32/AdvancedPage.cpp:35 -msgid "Register with Windows to handle magnet: URI links" -msgstr "Registrer i Windows til at h�tere MAGNET: URI links" - -#: win32/PublicHubsFrame.cpp:59 -msgid "Reliability" -msgstr "P�delighed" - -#: win32/QueueFrame.cpp:483 win32/TransferView.cpp:659 -msgid "Remote client does not fully support TTH - cannot download" -msgstr "Fjernklienten har ikke TTH - st�kan ikke downloade!" - -#: win32/QueuePage.cpp:70 -msgid "Remove slow filelists" -msgstr "Fjern fillister" - -#: win32/QueueFrame.cpp:1033 -msgid "Remove source" -msgstr "Fjern kilde" - -#: win32/QueueFrame.cpp:1043 -#, fuzzy -msgid "Remove user from queue" -msgstr "Fjern kilde" - -#: win32/UploadPage.cpp:38 win32/FavoriteDirsPage.cpp:35 -msgid "Rename" -msgstr "Omd�ppe" - -#: win32/MainWindow.cpp:243 -msgid "Report a bug" -msgstr "Rapport�en Fejl (Bug)" - -#: win32/MainWindow.cpp:242 -msgid "Request a feature" -msgstr "Foresl�ye Ting Til DC++" - -#: win32/HashProgressDlg.cpp:48 -msgid "Run in background" -msgstr "K�baggrunden.." - -#: win32/QueueFrame.cpp:435 -msgid "Running..." -msgstr "K�.." - -#: win32/NetworkPage.cpp:36 -msgid "SOCKS5" -msgstr "Socks5" - -#: win32/TabsPage.cpp:39 win32/MainWindow.cpp:281 win32/SearchFrame.cpp:85 -#: win32/SearchFrame.cpp:145 -#, fuzzy -msgid "Search" -msgstr "S�ter" - -#: win32/SearchFrame.cpp:990 win32/SearchFrame.cpp:1005 -#: win32/SearchFrame.cpp:1020 -#, fuzzy, boost-format -msgid "Search - %1%" -msgstr "S�ter" - -#: win32/SearchFrame.cpp:1025 -#, fuzzy -msgid "Search - Ready to search..." -msgstr "Klar til at s�." - -#: win32/CommandDlg.cpp:96 -msgid "Search Menu" -msgstr "S�enu" - -#: win32/WindowsPage.cpp:43 win32/MainWindow.cpp:212 win32/MainWindow.cpp:283 -#: win32/SpyFrame.cpp:40 -msgid "Search Spy" -msgstr "S�ion" - -#: win32/SpyFrame.cpp:34 -msgid "Search String" -msgstr "S�treng" - -#: win32/SearchFrame.cpp:116 -msgid "Search for" -msgstr "S�ter" - -#: win32/WinUtil.cpp:361 -msgid "Search for alternates" -msgstr "S�ter alternative kilder" - -#: win32/DirectoryListingFrame.cpp:795 win32/DirectoryListingFrame.cpp:858 -msgid "Search for file" -msgstr "S�ter filen" - -#: win32/Advanced3Page.cpp:34 -msgid "Search history" -msgstr "S�ersigt" - -#: win32/SearchFrame.cpp:125 -msgid "Search options" -msgstr "S�uligheder" - -#: win32/HubFrame.cpp:910 -#, boost-format -msgid "Search spam detected from %1%" -msgstr "" - -#: win32/SearchFrame.cpp:984 -#, fuzzy, boost-format -msgid "Searching for %1%..." -msgstr "S�ter" - -#: win32/SearchFrame.cpp:999 win32/SearchFrame.cpp:1018 -#, boost-format -msgid "Searching too soon, next search in %1% second" -msgid_plural "Searching too soon, next search in %1% seconds" -msgstr[0] "" -msgstr[1] "" - -#: win32/Appearance2Page.cpp:33 -msgid "Select &text style" -msgstr "" - -#: win32/Appearance2Page.cpp:32 -msgid "Select &window color" -msgstr "" - -#: win32/CommandDlg.cpp:112 -msgid "Send once per nick" -msgstr "Send en gang per brugernavn" - -#: win32/AdvancedPage.cpp:44 -msgid "Send unknown /commands to the hub" -msgstr "Send ukendte /kommandoer til huben" - -#: win32/UCPage.cpp:123 win32/UCPage.cpp:181 win32/CommandDlg.cpp:74 -msgid "Separator" -msgstr "Separator" - -#: win32/FavHubsFrame.cpp:36 -msgid "Server" -msgstr "Server" - -#: win32/QueuePage.cpp:68 -msgid "Set lowest prio for newly added files larger than Low prio size" -msgstr "Lavest priotet" - -#: win32/QueueFrame.cpp:995 -msgid "Set priority" -msgstr "S�prioritet" - -#: win32/AppearancePage.cpp:33 -msgid "Set timestamps" -msgstr "Tidsformat (%H:%M:%S)" - -#: win32/SettingsDialog.cpp:55 win32/MainWindow.cpp:286 -msgid "Settings" -msgstr "Indstillinger" - -#: win32/MainWindow.cpp:195 win32/MainWindow.cpp:1000 -msgid "Settings..." -msgstr "Indstillinger..." - -#: win32/UploadPage.cpp:35 -msgid "Share hidden files" -msgstr "Del skjulte filer" - -#: win32/HubFrame.cpp:38 win32/PublicHubsFrame.cpp:54 -msgid "Shared" -msgstr "Delt" - -#: win32/UploadPage.cpp:33 -msgid "Shared directories" -msgstr "Delte Mapper" - -#: win32/SettingsDialog.cpp:62 -msgid "Sharing" -msgstr "Opload" - -#: win32/MainWindow.cpp:997 -msgid "Show" -msgstr "Vis" - -#: win32/AppearancePage.cpp:51 -msgid "Show joins / parts in chat by default" -msgstr "Vis altid ankomster/afgange i main chaten" - -#: win32/AdvancedPage.cpp:38 -msgid "Show progress bars for transfers" -msgstr "Vis grafisk fremskridt for overf�r (bruger noget CPU-tid)" - -#: win32/AdvancedPage.cpp:48 -msgid "Show shell menu where possible" -msgstr "Vis shell menu" - -#: win32/AppearancePage.cpp:49 -msgid "Show timestamps in chat by default" -msgstr "S�Tidsstemple" - -#: win32/UploadPage.cpp:65 win32/QueueFrame.cpp:38 -#: win32/DirectoryListingFrame.cpp:43 win32/SearchFrame.cpp:35 -#: win32/SearchFrame.cpp:119 win32/TransferView.cpp:59 -msgid "Size" -msgstr "St�se" - -#: win32/QueueFrame.cpp:284 win32/QueueFrame.cpp:288 -#: win32/DirectoryListingFrame.cpp:635 win32/DirectoryListingFrame.cpp:652 -#, fuzzy, boost-format -msgid "Size: %1%" -msgstr "St�se" - -#: win32/QueuePage.cpp:74 -msgid "Skip zero-byte files" -msgstr "Spring over 0 byte filer" - -#: win32/PrivateFrame.cpp:285 -msgid "Slot granted" -msgstr "Ekstra slot tildelt" - -#: win32/SearchFrame.cpp:37 -msgid "Slots" -msgstr "Slots" - -#: win32/WinUtil.cpp:247 -msgid "Slots set" -msgstr "Slots indstillet" - -#: win32/MainWindow.cpp:551 -#, boost-format -msgid "Slots: %1%/%2%" -msgstr "" - -#: win32/NetworkPage.cpp:42 -msgid "Socks IP" -msgstr "Socks IP" - -#: win32/AppearancePage.cpp:46 -#, fuzzy -msgid "Sort all downloads first" -msgstr "Ingen brugere at downloade fra" - -#: win32/AppearancePage.cpp:53 -#, fuzzy -msgid "Sort favorite users first" -msgstr "Ankomst/Afgang af favorit brugere visning sl� til" - -#: win32/Appearance2Page.cpp:37 -msgid "Sounds" -msgstr "Lyde" - -#: win32/ADLSearchFrame.cpp:33 -msgid "Source Type" -msgstr "Kilde Type" - -#: win32/QueueFrame.cpp:481 -msgid "Source too slow" -msgstr "" - -#: win32/WinUtil.cpp:289 -msgid "Specify a URL" -msgstr "" - -#: win32/WinUtil.cpp:256 win32/WinUtil.cpp:277 win32/WinUtil.cpp:283 -msgid "Specify a search string" -msgstr "Specifiser s�reng" - -#: win32/HubFrame.cpp:296 -msgid "Specify a server to connect to" -msgstr "Angiv en server der skal oprettes forbindeelse til..." - -#: win32/TransferView.cpp:44 win32/TransferView.cpp:57 -msgid "Speed" -msgstr "Hastighed" - -#: win32/DirectoryListingFrame.cpp:636 -#, boost-format -msgid "Speed: %1%/s" -msgstr "" - -#: win32/MagnetDlg.cpp:57 -msgid "Start a search for this file" -msgstr "Start en s�g efter denne fil" - -#: win32... [truncated message content] |
From: <arn...@us...> - 2008-02-06 09:37:10
|
Revision: 991 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=991&view=rev Author: arnetheduck Date: 2008-02-06 01:37:07 -0800 (Wed, 06 Feb 2008) Log Message: ----------- Fix transferview stuff Modified Paths: -------------- dcplusplus/trunk/dcpp/po/hu.po dcplusplus/trunk/win32/TransferView.cpp dcplusplus/trunk/win32/TransferView.h Modified: dcplusplus/trunk/dcpp/po/hu.po =================================================================== --- dcplusplus/trunk/dcpp/po/hu.po 2008-02-05 22:10:22 UTC (rev 990) +++ dcplusplus/trunk/dcpp/po/hu.po 2008-02-06 09:37:07 UTC (rev 991) @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: dcplusplus\n" -"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" -"POT-Creation-Date: 2008-01-23 22:20+0100\n" +"Report-Msgid-Bugs-To: dcp...@li...\n" +"POT-Creation-Date: 2008-02-05 20:19+0100\n" "PO-Revision-Date: 2008-01-28 10:02+0000\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: Hungarian <hu...@li...>\n" @@ -19,32 +19,32 @@ "X-Generator: Launchpad (build Unknown)\n" #: dcpp/Util.cpp:381 -#, boost-format, c-format +#, c-format, boost-format msgid "%'lld B" msgstr "%'lld B" #: dcpp/Util.cpp:343 -#, boost-format, c-format +#, c-format, boost-format msgid "%.02f GiB" msgstr "%.02f GiB" #: dcpp/Util.cpp:339 -#, boost-format, c-format +#, c-format, boost-format msgid "%.02f KiB" msgstr "%.02f KiB" #: dcpp/Util.cpp:341 -#, boost-format, c-format +#, c-format, boost-format msgid "%.02f MiB" msgstr "%.02f MiB" #: dcpp/Util.cpp:347 -#, boost-format, c-format +#, c-format, boost-format msgid "%.02f PiB" msgstr "%.02f PiB" #: dcpp/Util.cpp:345 -#, boost-format, c-format +#, c-format, boost-format msgid "%.02f TiB" msgstr "%.02f TiB" @@ -60,39 +60,39 @@ msgstr "" "%1% nincs megosztva. A kiszámított CRC32 nem egyezik az SFV fájlban lévővel." -#: dcpp/DownloadManager.cpp:143 +#: dcpp/QueueManager.cpp:332 #, boost-format msgid "%1% renamed to %2%" msgstr "%1% átnevezve a következőre: %2%" -#: dcpp/DownloadManager.cpp:547 +#: dcpp/DownloadManager.cpp:520 #, boost-format msgid "%1%: File not available" msgstr "%1%: A fájl nem elérhető" #: dcpp/Util.cpp:337 -#, boost-format, c-format +#, c-format, boost-format msgid "%d B" msgstr "%d B" #: dcpp/Util.cpp:377 -#, boost-format, c-format +#, c-format, boost-format msgid "%s B" msgstr "%s B" -#: dcpp/QueueManager.cpp:503 +#: dcpp/QueueManager.cpp:539 msgid "A file of equal or larger size already exists at the target location" msgstr "Egy egyező méretű vagy nagyobb fájl már létezik a cél helyén." -#: dcpp/QueueManager.cpp:446 +#: dcpp/QueueManager.cpp:482 msgid "A file with a different size already exists in the queue" msgstr "Egy különböző mérettel rendelkező fájl már van a sorban" -#: dcpp/QueueManager.cpp:449 +#: dcpp/QueueManager.cpp:485 msgid "A file with different tth root already exists in the queue" msgstr "Egy különböző TTH gyökerű fájl már van a sorban" -#: dcpp/QueueManager.cpp:413 +#: dcpp/QueueManager.cpp:449 msgid "A file with the same hash already exists in your share" msgstr "" @@ -100,11 +100,11 @@ msgid "All download slots taken" msgstr "Összes letöltési szál foglalt" -#: dcpp/DownloadManager.cpp:421 +#: dcpp/DownloadManager.cpp:385 msgid "CRC32 inconsistency (SFV-Check)" msgstr "CRC32 inkonzisztencia (SFV-Ellenőrzés)" -#: dcpp/DownloadManager.cpp:419 +#: dcpp/DownloadManager.cpp:383 #, boost-format msgid "CRC32 inconsistency (SFV-Check) (File: %1%)" msgstr "CRC32 inkonzisztencia (SFV-Ellenőrzés) (Fájl: %1%)" @@ -113,12 +113,12 @@ msgid "Certificate not trusted, unable to connect" msgstr "A tanúsítvány nem megbízható, a kapcsolódás nem lehetséges" -#: dcpp/Socket.cpp:155 dcpp/ConnectionManager.cpp:187 +#: dcpp/Socket.cpp:154 dcpp/ConnectionManager.cpp:187 #: dcpp/BufferedSocket.cpp:154 msgid "Connection timeout" msgstr "Időtúllépés" -#: dcpp/DownloadManager.cpp:284 +#: dcpp/DownloadManager.cpp:248 #, boost-format msgid "Could not open target file: %1%" msgstr "Nem sikerült megnyitni a célfájlt a következő miatt: %1%" @@ -147,7 +147,7 @@ "against: %4%%5%" msgstr "" -#: dcpp/QueueManager.cpp:516 dcpp/QueueManager.cpp:520 +#: dcpp/QueueManager.cpp:552 dcpp/QueueManager.cpp:556 #, boost-format msgid "Duplicate source: %1%" msgstr "" @@ -188,7 +188,7 @@ msgid "Failed to load private key" msgstr "Nem sikerült betölteni a pirvát kulcsot" -#: dcpp/Socket.cpp:409 +#: dcpp/Socket.cpp:408 msgid "" "Failed to set up the socks server for UDP relay (check socks address and " "port)" @@ -229,7 +229,7 @@ msgid "Finished hashing: %1% (%2%/s)" msgstr "Indexelés befejezve: %1% (%2%/s)" -#: dcpp/DownloadManager.cpp:353 +#: dcpp/DownloadManager.cpp:317 msgid "Full tree does not match TTH root" msgstr "A teljes fa nem megfelelő a TTH gyökérhez" @@ -250,11 +250,11 @@ msgid "Hashing failed: %1%" msgstr "Sikertelen indexelés: %1%" -#: dcpp/DownloadManager.cpp:264 dcpp/DownloadManager.cpp:269 +#: dcpp/DownloadManager.cpp:228 dcpp/DownloadManager.cpp:233 msgid "Invalid size" msgstr "Érvénytelen méret" -#: dcpp/QueueManager.cpp:486 dcpp/QueueManager.cpp:494 +#: dcpp/QueueManager.cpp:522 dcpp/QueueManager.cpp:530 msgid "" "Invalid target file (missing directory, check default download directory " "setting)" @@ -275,7 +275,7 @@ msgid "Maximum command length exceeded" msgstr "A maximális parancs hossz túllépve" -#: dcpp/DownloadManager.cpp:323 +#: dcpp/DownloadManager.cpp:287 msgid "More data was sent than was expected" msgstr "A vártnál több adat lett küldve" @@ -283,7 +283,7 @@ msgid "No directory specified" msgstr "Nincs könyvtár megadva" -#: dcpp/DownloadManager.cpp:462 +#: dcpp/DownloadManager.cpp:426 msgid "No slots available" msgstr "Nincs szabad slot" @@ -309,11 +309,11 @@ msgid "Shared Files" msgstr "Megosztott fájlok" -#: dcpp/Socket.cpp:270 dcpp/Socket.cpp:274 +#: dcpp/Socket.cpp:269 dcpp/Socket.cpp:273 msgid "Socks server authentication failed (bad login / password?)" msgstr "" -"A hitelesítés a socks kiszolgálónál nem sikerült (rossz felhasználói " -"név/jelszó?)" +"A hitelesítés a socks kiszolgálónál nem sikerült (rossz felhasználói név/" +"jelszó?)" #: dcpp/CryptoManager.cpp:223 #, boost-format @@ -324,25 +324,25 @@ msgid "TLS disabled, no certificate file set" msgstr "TLS letiltva, nincs tanúsítvány fájl beállítva" -#: dcpp/QueueManager.cpp:481 dcpp/QueueManager.cpp:490 +#: dcpp/QueueManager.cpp:517 dcpp/QueueManager.cpp:526 msgid "Target filename too long" msgstr "A cél fájlneve túl hosszú" -#: dcpp/QueueManager.cpp:769 +#: dcpp/QueueManager.cpp:805 msgid "Target removed" msgstr "Cél eltávolítva" -#: dcpp/Socket.cpp:256 +#: dcpp/Socket.cpp:255 msgid "The socks server doesn't support login / password authentication" msgstr "" "A socks kiszolgáló nem támogatja a bejelentkezési név / jelszó hitelesítést" -#: dcpp/Socket.cpp:163 dcpp/Socket.cpp:174 dcpp/Socket.cpp:207 -#: dcpp/Socket.cpp:211 dcpp/Socket.cpp:238 dcpp/Socket.cpp:253 +#: dcpp/Socket.cpp:162 dcpp/Socket.cpp:173 dcpp/Socket.cpp:206 +#: dcpp/Socket.cpp:210 dcpp/Socket.cpp:237 dcpp/Socket.cpp:252 msgid "The socks server failed establish a connection" msgstr "Nem sikerült a socks kiszolgálóhoz kapcsolódni" -#: dcpp/Socket.cpp:242 +#: dcpp/Socket.cpp:241 msgid "The socks server requires authentication" msgstr "A socks kiszolgáló hitelesítést igényel" @@ -350,7 +350,7 @@ msgid "The temporary download directory cannot be shared" msgstr "Az ideiglenes letöltési könyvtár nem megosztható" -#: dcpp/QueueManager.cpp:436 +#: dcpp/QueueManager.cpp:472 msgid "This file is already queued" msgstr "A fájl már a sorban van" @@ -358,7 +358,7 @@ msgid "Unable to create thread" msgstr "A szál léterhozása sikertelen" -#: dcpp/QueueManager.cpp:957 +#: dcpp/QueueManager.cpp:1002 #, boost-format msgid "Unable to open filelist: %1%" msgstr "Nem sikerült megnyitni a fájl-listát: %1%" @@ -367,7 +367,7 @@ msgid "Unable to read hash data file" msgstr "A hash adatfájl beolvasása nem lehetséges" -#: dcpp/DownloadManager.cpp:145 +#: dcpp/QueueManager.cpp:334 #, boost-format msgid "Unable to rename %1%: %2%" msgstr "A fájl átnevezése sikertelen: %1%: %2%" @@ -377,16 +377,16 @@ msgid "Unable to send file %1%: %2%" msgstr "A fájl küldése sikertelen: %1%: %2%" -#: dcpp/Socket.cpp:55 -#, boost-format -msgid "Unknown error: 0x%1%" +#: dcpp/Socket.cpp:54 +#, fuzzy, c-format, boost-format +msgid "Unknown error: 0x%1$x" msgstr "Ismeretlen hiba: 0x%1%" #: dcpp/ShareManager.cpp:426 dcpp/ShareManager.cpp:468 msgid "Virtual directory name already exists" msgstr "A virtuális könyvtárnév már létezik" -#: dcpp/QueueManager.cpp:383 dcpp/QueueManager.cpp:407 +#: dcpp/QueueManager.cpp:419 dcpp/QueueManager.cpp:443 msgid "You're trying to download from yourself!" msgstr "Saját magadtól próbálsz meg letölteni!" Modified: dcplusplus/trunk/win32/TransferView.cpp =================================================================== --- dcplusplus/trunk/win32/TransferView.cpp 2008-02-05 22:10:22 UTC (rev 990) +++ dcplusplus/trunk/win32/TransferView.cpp 2008-02-06 09:37:07 UTC (rev 991) @@ -36,7 +36,7 @@ int TransferView::connectionSizes[] = { 125, 375, 100, 100, 125, 75, 100, 100 }; int TransferView::downloadIndexes[] = { DOWNLOAD_COLUMN_FILE, DOWNLOAD_COLUMN_PATH, DOWNLOAD_COLUMN_STATUS, DOWNLOAD_COLUMN_TIMELEFT, DOWNLOAD_COLUMN_SPEED, DOWNLOAD_COLUMN_DONE, DOWNLOAD_COLUMN_SIZE }; -int TransferView::downloadSizes[] = { 200, 300, 150, 200, 125, 100}; +int TransferView::downloadSizes[] = { 200, 300, 150, 200, 125, 100, 100 }; static const char* connectionNames[] = { N_("User"), @@ -59,7 +59,6 @@ N_("Size") }; - TransferView::TransferView(SmartWin::Widget* parent, SmartWin::WidgetTabView* mdi_) : WidgetFactory<SmartWin::WidgetChildWindow>(parent), connections(0), @@ -472,30 +471,35 @@ break; } } - } else if(i->first == DOWNLOADS_TICK) { + } else if(i->first == DOWNLOADS_ADD_USER) { boost::scoped_ptr<TickInfo> ti(static_cast<TickInfo*>(i->second)); int i = find(ti->path); if(i == -1) { int64_t size = QueueManager::getInstance()->getSize(ti->path); if(size == -1) { - return 0; + break; } TTHValue tth; if(QueueManager::getInstance()->getTTH(ti->path, tth)) { i = downloads->insert(new DownloadInfo(ti->path, size, tth)); } else { - return 0; + break; } } - DownloadInfo* di = downloads->getData(i); - di->update(*ti); - downloads->update(i); - } else if(i->first == DOWNLOADS_DISCONNECTED) { + } else if(i->first == DOWNLOADS_TICK) { boost::scoped_ptr<TickInfo> ti(static_cast<TickInfo*>(i->second)); - int i = find(ti->path); if(i != -1) { DownloadInfo* di = downloads->getData(i); + di->update(*ti); + downloads->update(i); + } + } else if(i->first == DOWNLOADS_REMOVE_USER) { + boost::scoped_ptr<TickInfo> ti(static_cast<TickInfo*>(i->second)); + int i = find(ti->path); + + if(i != -1) { + DownloadInfo* di = downloads->getData(i); if(--di->users == 0) { di->bps = 0; } @@ -599,7 +603,7 @@ path(target), done(QueueManager::getInstance()->getPos(target)), size(size_), - users(0), + users(1), tth(tth_) { columns[DOWNLOAD_COLUMN_FILE] = Text::toT(Util::getFileName(target)); @@ -614,7 +618,6 @@ } void TransferView::DownloadInfo::update(const TransferView::TickInfo& ti) { - users = ti.users; done = ti.done + QueueManager::getInstance()->getInstance()->getPos(ti.path); bps = ti.bps; update(); @@ -719,6 +722,8 @@ ui->setStatusString(statusString); speak(CONNECTIONS_UPDATE, ui); + + speak(DOWNLOADS_ADD_USER, new TickInfo(d->getPath())); } void TransferView::on(DownloadManagerListener::Tick, const DownloadList& dl) throw() { @@ -751,7 +756,6 @@ ti = new TickInfo(d->getPath()); dis.push_back(ti); } - ti->users++; ti->bps += d->getAverageSpeed(); ti->done += d->getPos(); } @@ -769,8 +773,7 @@ speak(CONNECTIONS_UPDATE, ui); - speak(DOWNLOADS_DISCONNECTED, new TickInfo(d->getPath())); - + speak(DOWNLOADS_REMOVE_USER, new TickInfo(d->getPath())); } void TransferView::on(UploadManagerListener::Starting, Upload* u) throw() { @@ -817,7 +820,7 @@ void TransferView::on(DownloadManagerListener::Complete, Download* d) throw() { onTransferComplete(d, false); - speak(DOWNLOADS_DISCONNECTED, new TickInfo(d->getPath())); + speak(DOWNLOADS_REMOVE_USER, new TickInfo(d->getPath())); } void TransferView::on(UploadManagerListener::Complete, Upload* aUpload) throw() { Modified: dcplusplus/trunk/win32/TransferView.h =================================================================== --- dcplusplus/trunk/win32/TransferView.h 2008-02-05 22:10:22 UTC (rev 990) +++ dcplusplus/trunk/win32/TransferView.h 2008-02-06 09:37:07 UTC (rev 991) @@ -67,12 +67,13 @@ }; enum { - DOWNLOADS_DISCONNECTED, + DOWNLOADS_ADD_USER, + DOWNLOADS_TICK, + DOWNLOADS_REMOVE_USER, DOWNLOADS_REMOVED, - DOWNLOADS_TICK, CONNECTIONS_ADD, CONNECTIONS_REMOVE, - CONNECTIONS_UPDATE, + CONNECTIONS_UPDATE }; enum { @@ -176,12 +177,11 @@ }; struct TickInfo : public Task { - TickInfo(const string& path_) : path(path_), done(0), bps(0), users(0) { } + TickInfo(const string& path_) : path(path_), done(0), bps(0) { } string path; int64_t done; double bps; - int users; }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2008-02-07 22:59:09
|
Revision: 992 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=992&view=rev Author: arnetheduck Date: 2008-02-07 14:59:03 -0800 (Thu, 07 Feb 2008) Log Message: ----------- Fancy menus, language setting fix Modified Paths: -------------- dcplusplus/trunk/smartwin/include/smartwin/WidgetFactoryPlatformSmartWinDesktop.h dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetMenuExtended.h dcplusplus/trunk/win32/AppearancePage.cpp dcplusplus/trunk/win32/DCPlusPlus.rc dcplusplus/trunk/win32/MainWindow.cpp dcplusplus/trunk/win32/MainWindow.h dcplusplus/trunk/win32/PropPage.cpp dcplusplus/trunk/win32/PropPage.h dcplusplus/trunk/win32/resource.h Modified: dcplusplus/trunk/smartwin/include/smartwin/WidgetFactoryPlatformSmartWinDesktop.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/WidgetFactoryPlatformSmartWinDesktop.h 2008-02-06 09:37:07 UTC (rev 991) +++ dcplusplus/trunk/smartwin/include/smartwin/WidgetFactoryPlatformSmartWinDesktop.h 2008-02-07 22:59:03 UTC (rev 992) @@ -56,14 +56,12 @@ /// RichEditBox object type. typedef typename WidgetRichTextBox::ObjectType WidgetRichTextBoxPtr; -#ifdef PORT_ME /// ExtendedMenu class type. - typedef SmartWin::WidgetMenuExtended< EventHandlerClass > WidgetMenuExtended; + typedef SmartWin::WidgetMenuExtended WidgetMenuExtended; /// ExtendedMenu object type. typedef typename WidgetMenuExtended::ObjectType WidgetMenuExtendedPtr; -#endif - + /// ChooseFont class and object type. typedef SmartWin::WidgetChooseFont< SmartWin::Widget > WidgetChooseFont; @@ -115,17 +113,15 @@ return WidgetCreator< WidgetRichTextBox >::attach( this, id ); } -#ifdef PORT_ME /// Creates an Extended Menu /** The returned object is of type std::tr1::shared_ptr< WidgetMenuExtended >, but * you should use the typedef WidgetMenuExtendedPtr and not <br> * the shared_ptr itself since this may change in future releases. */ - WidgetMenuExtendedPtr createExtendedMenu() + WidgetMenuExtendedPtr createExtendedMenu(const typename WidgetMenuExtended::Seed& cs = WidgetMenuExtended::Seed()) { - return WidgetCreator< WidgetMenuExtended >::create( this ); + return WidgetCreator< WidgetMenuExtended >::create( this, cs ); } -#endif /// Creates a Tool Bar and returns a pointer to it. /** DON'T delete the returned pointer!!! Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetMenuExtended.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetMenuExtended.h 2008-02-06 09:37:07 UTC (rev 991) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetMenuExtended.h 2008-02-07 22:59:03 UTC (rev 992) @@ -5,14 +5,14 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met : - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the SmartWin++ nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the SmartWin++ nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED @@ -29,10 +29,10 @@ #ifndef WidgetMenuExtended_h #define WidgetMenuExtended_h +#include "../Application.h" #include "../BasicTypes.h" #include "../CanvasClasses.h" -#include <boost/cast.hpp> -#ifdef PORT_ME + namespace SmartWin { // begin namespace SmartWin @@ -67,9 +67,9 @@ /// \ingroup GlobalStuff // MenuItemDataPtr type, contains rendering data for e.g. WidgetMenuExtended /** Helps easily create color values and so on for a WidgetMenuExtended item! <br> - * Each Menu Item can have different colors and so on, use this smart pointer to set - * those values! - */ +* Each Menu Item can have different colors and so on, use this smart pointer to set +* those values! +*/ typedef std::tr1::shared_ptr< MenuItemData > MenuItemDataPtr; namespace private_ @@ -101,10 +101,10 @@ // Wrapper Constructor ItemDataWrapper( HMENU owner, int itemIndex, MenuItemDataPtr itemData, bool isTitleItem = false ) - : menu( owner ) - , index( itemIndex ) - , isMenuTitleItem( isTitleItem ) - , data( itemData ) + : menu( owner ) + , index( itemIndex ) + , isMenuTitleItem( isTitleItem ) + , data( itemData ) {} ~ItemDataWrapper() @@ -114,8 +114,8 @@ /// Struct for coloring different areas of WidgetMenuExtended /** Contains the different color settings of the WidgetMenuExtended <br> - * Default values to constructor makes menu look roughly like MSVC++7.1 menus - */ +* Default values to constructor makes menu look roughly like MSVC++7.1 menus +*/ struct MenuColorInfo { /// Menu color @@ -141,9 +141,9 @@ /// Constructs MenuColorInfo objects /** If all the default arguments are used it will construct an object making - * menus look roughly like they do in MSVC++ 7.1 <br> - * Pass your own arguments to construct other color effects - */ + * menus look roughly like they do in MSVC++ 7.1 <br> + * Pass your own arguments to construct other color effects + */ MenuColorInfo( COLORREF menuColor = ColorUtilities::darkenColor( ::GetSysColor( COLOR_WINDOW ), 0.02 ), COLORREF stripColor = ColorUtilities::darkenColor( ::GetSysColor( COLOR_3DFACE ), 0.02 ), COLORREF titleColor = ColorUtilities::darkenColor( ::GetSysColor( COLOR_MENUBAR ), 0.1 ), @@ -161,905 +161,228 @@ {} }; -// /////////////////////////////////////////////////////////////////////////////// -// Default Menu Renderer, create your own by copying this and modyfying -// if you want your menus to be different! -// Basic process is to add Event Handlers for onDrawItem and onMeasureItem -// /////////////////////////////////////////////////////////////////////////////// -template< class MenuType > -class DefaultMenuRenderer -{ -public: - /// Rendering settting settings - static const int borderGap = 3; /// Gap between the border and item - static const int pointerGap = 5; /// Gap between item text and sub - menu pointer - static const int textIconGap = 8; /// Gap between text and icon - static const int textBorderGap = 4; /// Gap between text and rectangel border - static const int separatorHeight = 8; /// Defines default height for rectangle containing separator - static const int minSysMenuItemWidth = 130; /// Minimum width for system menu items - - static Point defaultImageSize; /// Default image size, used when no image is available - - // Default callback for WM_MEASUREITEM message processing - static bool measureItem( EventHandlerClass * parent, typename MenuType::ObjectType menu, MEASUREITEMSTRUCT * measureInfo ) - { - if ( measureInfo->CtlType != ODT_MENU ) // if not intended for us - return false; - - // get data wrapper - private_::ItemDataWrapper * wrapper = reinterpret_cast< private_::ItemDataWrapper * >( measureInfo->itemData ); - - xAssert( wrapper != 0, _T( "Unsupported menu item type in measureItem()" ) ); - - // this will contain item size - UINT & itemWidth = measureInfo->itemWidth; - UINT & itemHeight = measureInfo->itemHeight; - - // init struct for item info - MENUITEMINFO info; - memset( & info, 0, sizeof( MENUITEMINFO ) ); - info.cbSize = sizeof( MENUITEMINFO ); - - // set up flags - info.fMask = MIIM_FTYPE | MIIM_DATA | MIIM_CHECKMARKS | MIIM_STRING; - - // get menu handle - HMENU handle = reinterpret_cast< HMENU >( menu->handle() ); - - // try to get item info - if ( ::GetMenuItemInfo( handle, wrapper->index, TRUE, & info ) == FALSE ) - throw xCeption ( _T( "Couldn't get item info in measureItem()" ) ); - - // check if item is owner drawn - xAssert( ( info.fType & MFT_OWNERDRAW ) != 0, _T( "Not owner - drawn item encountered in measureItem()" ) ); - - // check if separator - if ( info.fType & MFT_SEPARATOR ) - { - itemWidth = 60; - itemHeight = separatorHeight; - return true; - } - - // are we processing menu bar ? - bool isMenuBar = ::GetMenu( parent->handle() ) == handle; - - // compute text width and height by simulating write to dc - // get its DC - HDC hdc = ::GetDC( menu->getParent()->handle() ); - - // get the item data - MenuItemDataPtr data = wrapper->data; - xAssert( data != 0, _T( "Couldn't find item data in measureItem()" ) ); - - // get item text - const int length = info.cch + 1; - std::vector< TCHAR > buffer ( length ); - int count = ::GetMenuString( handle, wrapper->index, & buffer[0], length, MF_BYPOSITION ); - SmartUtil::tstring itemText ( buffer.begin(), buffer.begin() + count ); - - // now get text extents - SIZE textSize; - memset( & textSize, 0, sizeof( SIZE ) ); - - HGDIOBJ oldFont = ::SelectObject( hdc, data->Font->getHandle() ); - ::GetTextExtentPoint32( hdc, itemText.c_str(), ( int ) itemText.size(), & textSize ); - ::SelectObject( hdc, oldFont ); - - // release DC - ::ReleaseDC( menu->handle(), hdc ); - - // adjust item size - itemWidth = textSize.cx + borderGap; - itemHeight = textSize.cy + borderGap; - - // check to see if item has an image - Point imageSize = data->Image->getBitmapSize(); - - // this will contain checked/unchecked image size - Point checkImageSize; - - // if item has check/unchecked state images, then get their sizes - if ( ( info.hbmpChecked != NULL ) && ( info.hbmpUnchecked != NULL ) ) - checkImageSize = ( info.fState & MFS_CHECKED ) == 0 - ? Bitmap::getBitmapSize( info.hbmpUnchecked ) - : Bitmap::getBitmapSize( info.hbmpChecked ); - - // take the maximum of all available images or set default image size - imageSize.x = (std::max)( imageSize.x, checkImageSize.x ); - imageSize.y = (std::max)( imageSize.y, checkImageSize.y ); - - bool hasImage = ( imageSize.x != 0 ) && ( imageSize.y != 0 ); - - // set default image size if no image is available - if ( !hasImage ) - { - imageSize.x = (std::max)( defaultImageSize.x, (std::max)( imageSize.x, checkImageSize.x ) ); - imageSize.y = (std::max)( defaultImageSize.y, (std::max)( imageSize.y, checkImageSize.y ) ); - } - - // adjust default image size - defaultImageSize.x = (std::max)( defaultImageSize.x, imageSize.x ); - defaultImageSize.y = (std::max)( defaultImageSize.y, imageSize.y ); - - // adjust width - if ( !isMenuBar || // if not menu bar item - ( isMenuBar && hasImage ) ) // or menu bar item with image - { - // adjust item width - itemWidth += imageSize.x + textIconGap + pointerGap; - - // adjust item height - itemHeight = (std::max)( itemHeight, ( UINT ) imageSize.y + borderGap ); - } - - // adjust width for system menu items - if ( menu->isSysMenu ) - itemWidth = (std::max)( ( UINT ) minSysMenuItemWidth, itemWidth ); - - // adjust width for sidebar - if ( menu->drawSidebar ) - { - // get title text extents - SIZE textSize; - memset( & textSize, 0, sizeof( SIZE ) ); - - ::GetTextExtentPoint32( hdc, menu->itsTitle.c_str(), ( int ) menu->itsTitle.size(), & textSize ); - - itemWidth += textSize.cy; - } - - // adjust item height - itemHeight = (std::max)( itemHeight, ( UINT )::GetSystemMetrics( SM_CYMENU ) ); - return true; - } - - // Default callback for WM_DRAWITEM message processing - static bool drawItem( EventHandlerClass * parent, typename MenuType::ObjectType menu, int controlID, const DRAWITEMSTRUCT & drawInfo ) - { - if ( ( controlID != 0 ) || ( drawInfo.CtlType != ODT_MENU ) ) // if not intended for us - return false; - - // setup colors - MenuColorInfo colorInfo = menu->itsColorInfo; - COLORREF colorMenuBar = colorInfo.colorMenuBar; - COLORREF colorTitle = colorInfo.colorTitle; - COLORREF colorMenuDraw = colorInfo.colorMenu; // color for drawing menu - COLORREF colorFillHighlighted = ColorUtilities::lightenColor( colorInfo.colorHighlight, 0.7 ); - - // get menu handle - HMENU handle = reinterpret_cast< HMENU >( menu->handle() ); - - // if processing menu bar - const bool isMenuBar = ::GetMenu( parent->handle() ) == handle; - - // change menu draw color for menubars - if ( isMenuBar ) - colorMenuDraw = colorMenuBar; - - // get item data wrapper - private_::ItemDataWrapper * wrapper = reinterpret_cast< private_::ItemDataWrapper * >( drawInfo.itemData ); - xAssert( wrapper != 0, _T( "Unsupported menu item in drawItem()" ) ) - - // init struct for menu item info - MENUITEMINFO info; - memset( & info, 0, sizeof( MENUITEMINFO ) ); - info.cbSize = sizeof( MENUITEMINFO ); - - // set flags - info.fMask = MIIM_CHECKMARKS | MIIM_FTYPE | MIIM_DATA | MIIM_STATE | MIIM_STRING; - - if ( ::GetMenuItemInfo( handle, wrapper->index, TRUE, & info ) == FALSE ) - throw xCeption ( _T( "Couldn't get menu item info in drawItem()" ) ); - - // check if item is owner drawn - xAssert( ( info.fType & MFT_OWNERDRAW ) != 0, _T( "Not a owner - drawn item in drawItem()" ) ) - - // get item data - MenuItemDataPtr data ( wrapper->data ); - xAssert( data != 0, _T( "Couldn't find item data in drawItem()" ) ) - - // get state info - bool isGrayed = ( drawInfo.itemState & ODS_GRAYED ) == ODS_GRAYED; - bool isChecked = ( drawInfo.itemState & ODS_CHECKED ) == ODS_CHECKED; - bool isDisabled = ( drawInfo.itemState & ODS_DISABLED ) == ODS_DISABLED; - bool isSelected = ( drawInfo.itemState & ODS_SELECTED ) == ODS_SELECTED; - bool isHighlighted = ( drawInfo.itemState & ODS_HOTLIGHT ) == ODS_HOTLIGHT; - - // this will contain item image - HBITMAP image = NULL; - - // if checked/unchecked image is avaiable - if ( ( info.hbmpChecked != NULL ) && ( info.hbmpUnchecked != NULL ) ) - image = isChecked ? info.hbmpChecked : info.hbmpUnchecked; - else // get normal image - image = data->Image->getBitmap(); - - // this will contain image size - Point imageSize = data->Image->getBitmapSize(); - - if ( ( imageSize.x == 0 ) && ( imageSize.y == 0 ) ) // no image - imageSize = defaultImageSize; // set default image size - - // compute strip width - int stripWidth = imageSize.x + textIconGap; - - // prepare item rectangle - Rectangle itemRectangle( drawInfo.rcItem.left, drawInfo.rcItem.top, // position - drawInfo.rcItem.right - drawInfo.rcItem.left, // width - drawInfo.rcItem.bottom - drawInfo.rcItem.top ); // height - - // setup buffered canvas - BufferedCanvas< FreeCanvas > canvas( menu->handle(), drawInfo.hDC ); - - // this will conain adjusted sidebar width - int sidebarWidth = 0; - - // this will contain logical information - // about title font - LOGFONT lf; - memset( & lf, 0, sizeof( LOGFONT ) ); - - // this will contain adjusted(rotated) title font for sidebar - HFONT titleFont = NULL; - - // get title font info and adjust item rectangle - if ( menu->drawSidebar ) - { - // get title font - std::tr1::shared_ptr< Font > font = menu->itsTitleFont; - - // get logical info for title font - ::GetObject( font->getHandle(), sizeof( LOGFONT ), & lf ); - - // 90 degree rotation and bold - lf.lfOrientation = lf.lfEscapement = 900; - - // create title font from logical info - titleFont = ::CreateFontIndirect( & lf ); - - // get title text size - SIZE textSize; - memset( & textSize, 0, sizeof( SIZE ) ); - - HGDIOBJ oldFont = ::SelectObject( canvas.getDc(), titleFont ); - ::GetTextExtentPoint32( canvas.getDc(), menu->itsTitle.c_str(), ( int ) menu->itsTitle.size(), & textSize ); - ::SelectObject( canvas.getDc(), oldFont ); - - // set sidebar width to text height - sidebarWidth = textSize.cy; - - // adjust item rectangle and item background - itemRectangle.pos.x += sidebarWidth; - itemRectangle.size.x -= sidebarWidth; - } - - // draw sidebar with menu title - if ( ( drawInfo.itemAction & ODA_DRAWENTIRE ) && ( menu->drawSidebar ) && !menu->itsTitle.empty() ) - { - // select title font and color - HGDIOBJ oldFont = ::SelectObject ( canvas.getDc(), titleFont ); - COLORREF oldColor = canvas.setTextColor( colorInfo.colorTitleText ); - - // set background mode to transparent - bool oldMode = canvas.setBkMode( true ); - - // get rect for sidebar - RECT rect; - ::GetClipBox( drawInfo.hDC, & rect ); - //rect.left -= borderGap; - - // set title rectangle - Rectangle textRectangle( 0, 0, sidebarWidth, rect.bottom - rect.top ); - - // draw background - Brush brush( canvas, colorInfo.colorTitle ); - canvas.fillRectangle( textRectangle, brush ); - - // draw title - textRectangle.pos.y += 10; - canvas.drawText( menu->itsTitle, textRectangle, DT_BOTTOM | DT_SINGLELINE ); - - // clear - canvas.setTextColor( oldColor ); - canvas.setBkMode( oldMode ); - - // set back old font - ::SelectObject( canvas.getDc(), oldFont ); - } - - // destroy title font - ::DeleteObject( titleFont ); - - // set item background - if ( wrapper->isMenuTitleItem ) // for title - { - Brush brush( canvas, colorTitle ); - canvas.fillRectangle( itemRectangle, brush ); - - // draw raised border - RECT rc( itemRectangle ); - ::DrawEdge( canvas.getDc(), & rc, EDGE_RAISED, BF_RECT ); - } - else // for normal items - { - Brush brush( canvas, colorMenuDraw ); - canvas.fillRectangle( itemRectangle, brush ); - } - - if ( isMenuBar && isSelected ) // draw selected menu bar item - { - // TODO: Simulate shadow - - // select pen for drawing broder - // and brush for filling item - COLORREF colorBorder = 0; - Pen pen ( canvas, colorBorder ); - Brush brush ( canvas, ColorUtilities::lightenColor( colorMenuBar, 0.5 ) ); - - canvas.rectangle( itemRectangle ); - } // end if - else if ( ( isSelected || isHighlighted ) && !isDisabled ) // draw selected or highlighted menu item (if not inactive) - { - // select pen for drawing broder - // and brush for filling item - Pen pen ( canvas, colorInfo.colorHighlight ); - Brush brush ( canvas, colorFillHighlighted ); - - canvas.rectangle( itemRectangle ); - } // end if - else if ( !isMenuBar && !wrapper->isMenuTitleItem ) // draw strip bar for menu items (except menu title item) - { - // create rectangle for strip bar - Rectangle stripRectangle ( itemRectangle ); - stripRectangle.size.x = stripWidth; - - // draw strip bar - Brush brush( canvas, colorInfo.colorStrip ); - canvas.fillRectangle( stripRectangle, brush ); - } // end if - - if ( !isMenuBar && info.fType & MFT_SEPARATOR ) // draw separator - { - // set up separator rectangle - Rectangle rectangle ( itemRectangle ); - - // center in the item rectangle - rectangle.pos.x += stripWidth + textIconGap; - rectangle.pos.y += rectangle.size.y / 2 - 1; - - // select color - Pen pen( canvas, ::GetSysColor( COLOR_GRAYTEXT ) ); - - // draw separator - canvas.moveTo( rectangle.pos.x, rectangle.pos.y ); - canvas.lineTo( rectangle.size.x, rectangle.pos.y ); - } // end if - else // not a seperator, then draw item text and icon - { - // get item text - const int length = info.cch + 1; - std::vector< TCHAR > buffer( length ); - int count = ::GetMenuString( handle, wrapper->index, & buffer[0], length, MF_BYPOSITION ); - SmartUtil::tstring itemText( buffer.begin(), buffer.begin() + count ); - - // index will contain accelerator position - size_t index = itemText.find_last_of( _T( '\t' ) ); - - // split item text to draw accelerator correctly - SmartUtil::tstring text = itemText.substr( 0, index ); - - // get accelerator - SmartUtil::tstring accelerator; - - if ( index != itemText.npos ) - accelerator = itemText.substr( index + 1 ); - - // set mode to transparent - bool oldMode = canvas.setBkMode( true ); - - // select item text color - canvas.setTextColor( isGrayed ? ::GetSysColor( COLOR_GRAYTEXT ) : wrapper->isMenuTitleItem ? colorInfo.colorTitleText : data->TextColor ); - - // Select item font if available - FontPtr font( data->Font ); - - HGDIOBJ oldFont = ::SelectObject( canvas.getDc(), font->getHandle() ); - - if ( !isMenuBar && !wrapper->isMenuTitleItem && !itemText.empty() ) // if menu item - { - // compute text rectangle - Rectangle textRectangle( itemRectangle ); - - // adjust rectangle - textRectangle.pos.x += stripWidth + textIconGap; - textRectangle.size.x -= stripWidth + textIconGap + borderGap; - - canvas.drawText( text, textRectangle, DT_LEFT | DT_VCENTER | DT_SINGLELINE ); - - // draw accelerator - if ( !accelerator.empty() ) - canvas.drawText( accelerator, textRectangle, DT_RIGHT | DT_VCENTER | DT_SINGLELINE ); - } // end if - else if ( !itemText.empty() ) // draw menu bar item text - { - Rectangle textRectangle( itemRectangle ); - - if ( image != NULL ) // has icon - textRectangle.pos.x += textIconGap; - - canvas.drawText( text, textRectangle, DT_CENTER | DT_VCENTER | DT_SINGLELINE ); - } // end if - - // set back old font - ::SelectObject( canvas.getDc(), oldFont ); - - // reset old mode - canvas.setBkMode( oldMode ); - - // set up image rectangle - Rectangle imageRectangle( itemRectangle.pos, imageSize ); - - // adjust icon rectangle - imageRectangle.pos.x += ( stripWidth - imageSize.x ) / 2; - imageRectangle.pos.y += ( itemRectangle.size.y - imageSize.y ) / 2; - - if ( image == NULL ) // drawing item without icon - { - if ( isChecked ) // needs checkmark - { - // draw the check mark or radio bullet - // prepare background - Brush brush( canvas, colorInfo.colorStrip ); - canvas.fillRectangle( imageRectangle, brush ); - - // create memory DC and set bitmap on it - HDC memoryDC = ::CreateCompatibleDC( canvas.getDc() ); - HGDIOBJ old = ::SelectObject( memoryDC, ::CreateCompatibleBitmap( canvas.getDc(), imageSize.x, imageSize.y ) ); - - // draw into memory - RECT rc( Rectangle( 0, 0, imageSize.x, imageSize.y ) ); - ::DrawFrameControl( memoryDC, & rc, DFC_MENU, ( info.fType & MFT_RADIOCHECK ) == 0 ? DFCS_MENUCHECK : DFCS_MENUBULLET ); - - const int adjustment = 2; // adjustment for mark to be in the center - - // bit - blast into out canvas - ::BitBlt( canvas.getDc(), imageRectangle.pos.x + adjustment, imageRectangle.pos.y, imageSize.x, imageSize.y, memoryDC, 0, 0, SRCAND ); - - // delete memory dc - ::DeleteObject( ::SelectObject( memoryDC, old ) ); - ::DeleteDC( memoryDC ); - } - } - else // drawing item with icon - { - if ( isSelected && !isDisabled ) // if selected and active, then imitate icon shadow - { - // adjust icon position for later drawing - imageRectangle.pos.x -= 1; - imageRectangle.pos.y -= 1; - - // setup brush for shadow emulation - Brush brush( canvas, ColorUtilities::darkenColor( colorInfo.colorStrip, 0.7 ) ); - - // draw the icon shadow - Rectangle shadowRectangle( imageRectangle ); - shadowRectangle.pos.x += 2; - shadowRectangle.pos.y += 2; - canvas.drawBitmap( image, shadowRectangle, colorInfo.colorImageBackground, true ); - } - - // draw normal icon - canvas.drawBitmap( image, imageRectangle, colorInfo.colorImageBackground, isGrayed ); - } - - if ( isChecked ) // draw surrounding rectangle for checked items - { - /*if ( image != NULL ) // adjust for icon - iconRectangle = iconRectangle.shrink( 1.20 );*/ - - // draw the surrounding rectangle - Pen pen( canvas, colorInfo.colorHighlight ); - canvas.line( imageRectangle ); - } - } - - // blast buffer into screen - if ( ( drawInfo.itemAction & ODA_DRAWENTIRE ) && menu->drawSidebar ) // adjustment for sidebar - { - itemRectangle.pos.x -= sidebarWidth; - itemRectangle.size.x += sidebarWidth; - } - - canvas.blast( itemRectangle ); - return true; - } -}; - -// Since this is a Dispatcher ONLY for Menus it CAN'T be a "non control", therefore -// we DON'T need the partial specialization for it... -template< class EventHandlerClass, class WidgetType, class MessageMapType > -class WidgetMenuExtendedDispatcher -{ - static EventHandlerClass * getParent( Widget * parentGiven ) - { - Widget * tmpParent = parentGiven; - EventHandlerClass * ptrMainParent; - while ( true ) - { - ptrMainParent = dynamic_cast< EventHandlerClass * >( tmpParent ); - if ( ptrMainParent != 0 ) - break; - tmpParent = tmpParent->getParent(); - if ( 0 == tmpParent ) - throw xCeption( _T( "Serious error while trying to get MainWindow parent to menu, menu probably not attached to Main WidgetFactory..." ) ); - } - return ptrMainParent; - } - -public: -#ifdef PORT_ME - static HRESULT dispatch( private_::SignalContent & params ) - { - EventHandlerClass * ptrMainParent = getParent( params.This->getParent() ); - typename WidgetType::menuExtendedVoidFunctionTakingUInt func = - reinterpret_cast< typename WidgetType::menuExtendedVoidFunctionTakingUInt >( params.Function ); - - StayAliveDeleter< WidgetType > deleter; - std::tr1::shared_ptr< WidgetType > ptrThis( boost::polymorphic_cast< WidgetType * >( params.This ), deleter ); - - func - ( dynamic_cast< EventHandlerClass * >( 0 ) - , ptrThis - , LOWORD( params.Msg.WParam ) - ); - return 1; - } - - static HRESULT dispatchThis( private_::SignalContent & params ) - { - EventHandlerClass * ptrMainParent = getParent( params.This->getParent() ); - typename WidgetType::itsVoidMenuExtendedFunctionTakingUInt func = - reinterpret_cast< typename WidgetType::itsVoidMenuExtendedFunctionTakingUInt >( params.FunctionThis ); - - StayAliveDeleter< WidgetType > deleter; - std::tr1::shared_ptr< WidgetType > ptrThis( boost::polymorphic_cast< WidgetType * >( params.This ), deleter ); - - ( ( * boost::polymorphic_cast< EventHandlerClass * >( ptrMainParent ) ).*func ) - ( ptrThis - , LOWORD( params.Msg.WParam ) - ); - return 1; - } - - static HRESULT dispatchDrawItem( private_::SignalContent & params ) - { - // get callback - typename WidgetType::boolDrawItemFunction func = - reinterpret_cast< typename WidgetType::boolDrawItemFunction >( params.Function ); - - StayAliveDeleter< WidgetType > deleter; - std::tr1::shared_ptr< WidgetType > ptrThis( boost::polymorphic_cast< WidgetType * >( params.This ), deleter ); - - // call the callback - bool handled = func - ( dynamic_cast< EventHandlerClass * >( params.This->getParent() ) - , ptrThis - , params.Msg.WParam // control id - , * reinterpret_cast< DRAWITEMSTRUCT * >( params.Msg.LParam ) - ); - return handled; - } - - static HRESULT dispatchDrawItemThis( private_::SignalContent & params ) - { - // get method pointer - typename WidgetType::itsBoolDrawItemFunction func = - reinterpret_cast< typename WidgetType::itsBoolDrawItemFunction >( params.FunctionThis ); - - StayAliveDeleter< WidgetType > deleter; - std::tr1::shared_ptr< WidgetType > ptrThis( boost::polymorphic_cast< WidgetType * >( params.This ), deleter ); - - // call method - bool handled = ( ( * boost::polymorphic_cast< EventHandlerClass * >( params.This->getParent() ) ).*func ) - ( ptrThis - , params.Msg.WParam // control id - , * reinterpret_cast< DRAWITEMSTRUCT * >( params.Msg.LParam ) - ); - return handled; - } - - static HRESULT dispatchMeasureItem( private_::SignalContent & params ) - { - // get callback - typename WidgetType::boolMeasureItemFunction func = - reinterpret_cast< typename WidgetType::boolMeasureItemFunction >( params.Function ); - - StayAliveDeleter< WidgetType > deleter; - std::tr1::shared_ptr< WidgetType > ptrThis( boost::polymorphic_cast< WidgetType * >( params.This ), deleter ); - - // call the callback - bool handled = func - ( dynamic_cast< EventHandlerClass * >( params.This->getParent() ) - , ptrThis - , reinterpret_cast< MEASUREITEMSTRUCT * >( params.Msg.LParam ) - ); - return handled; - } - - static HRESULT dispatchMeasureItemThis( private_::SignalContent & params ) - { - // get method pointer - typename WidgetType::itsBoolMeasureItemFunction func = - reinterpret_cast< typename WidgetType::itsBoolMeasureItemFunction >( params.FunctionThis ); - - StayAliveDeleter< WidgetType > deleter; - std::tr1::shared_ptr< WidgetType > ptrThis( boost::polymorphic_cast< WidgetType * >( params.This ), deleter ); - - // call method - bool handled = ( ( * boost::polymorphic_cast< EventHandlerClass * >( params.This->getParent() ) ).*func ) - ( ptrThis - , reinterpret_cast< MEASUREITEMSTRUCT * >( params.Msg.LParam ) - ); - return handled; - } - - static HRESULT dispatchPopup( private_::SignalContent & params ) - { - // get callback - typename WidgetType::voidPopupFunction func = - reinterpret_cast< typename WidgetType::voidPopupFunction >( params.Function ); - - StayAliveDeleter< WidgetType > deleter; - std::tr1::shared_ptr< WidgetType > ptrThis( boost::polymorphic_cast< WidgetType * >( params.This ), deleter ); - - // call the callback - func - ( dynamic_cast< EventHandlerClass * >( params.This->getParent() ) - , ptrThis - ); - return 0; - } - - static HRESULT dispatchPopupThis( private_::SignalContent & params ) - { - // get method pointer - typename WidgetType::itsVoidPopupFunction func = - reinterpret_cast< typename WidgetType::itsVoidPopupFunction >( params.FunctionThis ); - - StayAliveDeleter< WidgetType > deleter; - std::tr1::shared_ptr< WidgetType > ptrThis( boost::polymorphic_cast< WidgetType * >( params.This ), deleter ); - - // call method - ( ( * boost::polymorphic_cast< EventHandlerClass * >( params.This->getParent() ) ).*func ) - ( ptrThis - ); - return 0; - } -#endif -}; - -// Menu Renderer static data members initialization -template< class MenuType > -Point DefaultMenuRenderer< MenuType >::defaultImageSize = Point( 16, 16 ); - // Platform specific implementation template< class MenuType, Platform > class WidgetMenuExtendedPlatformImplementation; /// Specialized functions in menu for desktop Windows API version /** This class contains all the functions in the WidgetMenuExtended which only works - * in the Desktop Version of the OS. <br> - * Though WidgetMenuExtended class does not actually WORK on WinCE we plan to MAKE - * it work in future versions, therefore we have created the CurrentPlatform - * specialization classes for it here...!! - */ -template< class MenuType > -class WidgetMenuExtendedPlatformImplementation< MenuType, SmartWinDesktop > +* in the Desktop Version of the OS. <br> +* Though WidgetMenuExtended class does not actually WORK on WinCE we plan to MAKE +* it work in future versions, therefore we have created the CurrentPlatform +* specialization classes for it here...!! +*/ +template< typename MenuType > +class WidgetMenuExtendedPlatformImplementation< MenuType, SmartWinDesktop > { - // friends - friend class DefaultMenuRenderer< MenuType >; public: - typedef std::tr1::shared_ptr< MenuType > WidgetMenuExtendedPtr; - typedef WidgetMenuExtendedDispatcher< MenuType > Dispatcher; - /// Attaches the menu to a parent window - void attach( EventHandlerClass * mainWindow ); + struct Seed { + Seed(bool popup_) : popup(popup_) { } + Seed() : popup(false) { } + bool popup; + }; + HMENU handle() const { + return itsHandle; + } + + HWND getParent() const { + return itsParent ? itsParent->handle() : 0; + } + /// Actually creates the menu /** Creates the menu, the menu will be created initially empty! - */ - void create( bool isPopup = false ); + */ + void create(const Seed& cs); - /// Actually creates the menu - /** Copies the menu if copy is true, otherwise just hooks it - */ - void create( HMENU source, bool copy ); + /// Attaches the menu to the parent window + void attach(); /// Appends a popup to the menu /** Everything you "append" to a menu is added sequentially to the menu <br> - * This specific "append" function appends a "popup" menu which is a menu - * containing other menus. <br> - * With other words a menu which is not an "option" but rather a new "subgroup". - * <br> - * The "File" menu of most application is for instance a "popup" menu while the - * File/Print is often NOT a popup. <br> - * To append items to the popup created call one of the appendItem overloaded - * functions on the returned value of this function. <br> - * Also, although references to all menu objects must be kept ( since they're - * not collected automatically like other Widgets ) <br> - * you don't have to keep a reference to the return value of this function since - * it's being added as a reference to the children list of the "this" object. - * <br> - * A popup is basically another branch in the menu hierarchy <br> - * See the WidgetMenu project for a demonstration. - */ - WidgetMenuExtendedPtr appendPopup( const SmartUtil::tstring & text, MenuItemDataPtr itemData = MenuItemDataPtr( new MenuItemData() ) ); + * This specific "append" function appends a "popup" menu which is a menu + * containing other menus. <br> + * With other words a menu which is not an "option" but rather a new "subgroup". + * <br> + * The "File" menu of most application is for instance a "popup" menu while the + * File/Print is often NOT a popup. <br> + * To append items to the popup created call one of the appendItem overloaded + * functions on the returned value of this function. <br> + * Also, although references to all menu objects must be kept ( since they're + * not collected automatically like other Widgets ) <br> + * you don't have to keep a reference to the return value of this function since + * it's being added as a reference to the children list of the "this" object. + * <br> + * A popup is basically another branch in the menu hierarchy <br> + * See the WidgetMenu project for a demonstration. + */ + WidgetMenuExtendedPtr appendPopup( const SmartUtil::tstring & text, MenuItemDataPtr itemData = MenuItemDataPtr(new MenuItemData()) ); /// Returns the "System Menu" /** The system menu is a special menu that ( normally ) is accessed by pressing - * the "window icon" at the top left of the window. <br> - * In SmartWin++ this menu can ALSO be easily manipulated and added items to - * etc... <br> - * Also, although references to all menu objects must be kept ( since they're - * not collected automatically like other Widgets ) <br> - * you don't have to keep a reference to the return value of this function since - * it's being added as a reference to the children list <br> - * of the "this" object. <br> - * See the WidgetMenu sample project for a demonstration. - */ + * the "window icon" at the top left of the window. <br> + * In SmartWin++ this menu can ALSO be easily manipulated and added items to + * etc... <br> + * Also, although references to all menu objects must be kept ( since they're + * not collected automatically like other Widgets ) <br> + * you don't have to keep a reference to the return value of this function since + * it's being added as a reference to the children list <br> + * of the "this" object. <br> + * See the WidgetMenu sample project for a demonstration. + */ WidgetMenuExtendedPtr getSystemMenu(); -protected: - // Initializes menu with given handle - void init( HMENU handle ); + /// Rendering settting settings + static const int borderGap; /// Gap between the border and item + static const int pointerGap; /// Gap between item text and sub - menu pointer + static const int textIconGap; /// Gap between text and icon + static const int textBorderGap; /// Gap between text and rectangel border + static const int separatorHeight; /// Defines default height for rectangle containing separator + static const int minSysMenuItemWidth; /// Minimum width for system menu items + static Point defaultImageSize; /// Default image size, used when no image is available +protected: // its sub menus std::vector< WidgetMenuExtendedPtr > itsChildren; // its item data std::vector < private_::ItemDataWrapper * > itsItemData; + + HMENU itsHandle; + + Widget* itsParent; + + typedef std::map<unsigned, Widget::CallbackType> CallbackMap; + CallbackMap callbacks; + + void addCommands(Widget* widget); }; /// Extended Menu class /** \ingroup WidgetControls - * \WidgetUsageInfo - * \image html menuextended.png - * Class for creating an Extended Menu Control which then can be attached to e.g. a - * WidgetWindow. <br> - * Note for Desktop version only! <br> - * After you have created a menu you must call WidgetMenu::attach() to make it - * "attach" to the WidgetWindow you want it to belong to. <br> - * Do not be fooled, a WidgetMenuExtended is a much more advanced menu type then the - * "normal" WidgetMenu and contains support for visualizations far beyond the - * capabilities of the WidgetMenu. <br> - * If you need those truly awesome visual menu effects use this menu control instead - * of the WidgetMenu. - */ +* \WidgetUsageInfo +* \image html menuextended.png +* Class for creating an Extended Menu Control which then can be attached to e.g. a +* WidgetWindow. <br> +* Note for Desktop version only! <br> +* After you have created a menu you must call WidgetMenu::attach() to make it +* "attach" to the WidgetWindow you want it to belong to. <br> +* Do not be fooled, a WidgetMenuExtended is a much more advanced menu type then the +* "normal" WidgetMenu and contains support for visualizations far beyond the +* capabilities of the WidgetMenu. <br> +* If you need those truly awesome visual menu effects use this menu control instead +* of the WidgetMenu. +*/ class WidgetMenuExtended : - public WidgetMenuExtendedPlatformImplementation< CurrentPlatform > + public WidgetMenuExtendedPlatformImplementation< WidgetMenuExtended, CurrentPlatform >, + public boost::enable_shared_from_this< WidgetMenuExtended > { // friends - friend class DefaultMenuRenderer< WidgetMenuExtended >; - friend class WidgetMenuExtendedPlatformImplementation< CurrentPlatform >; + friend class WidgetMenuExtendedPlatformImplementation< WidgetMenuExtended, CurrentPlatform >; friend class WidgetCreator< WidgetMenuExtended >; - typedef WidgetMenuExtendedPlatformImplementation< CurrentPlatform > Implementation; - typedef SmartWin::DefaultMenuRenderer< WidgetMenuExtended > DefaultMenuRenderer; - typedef typename WidgetMenuExtendedPlatformImplementation< CurrentPlatform >::Dispatcher Dispatcher; + typedef WidgetMenuExtendedPlatformImplementation< WidgetMenuExtended, CurrentPlatform > Implementation; public: /// Type of object typedef WidgetMenuExtended ThisType; /// Object type - typedef typename WidgetMenuExtendedPlatformImplementation< CurrentPlatform >::WidgetMenuExtendedPtr ObjectType; + typedef WidgetMenuExtendedPlatformImplementation< WidgetMenuExtended, CurrentPlatform >::WidgetMenuExtendedPtr ObjectType; - /// Creational info - //TODO: empty because it is not used anywhere ... - class Seed - {}; + struct IdDispatcher + { + typedef std::tr1::function<void (unsigned)> F; - // Event Handlers signature typedefs + IdDispatcher(const F& f_) : f(f_) { } - /// \ingroup eventsSignatures - /// \typedef Typedef of a member function to the original class taking pointer to the this Widget and an unsigned int returning void - typedef void ( EventHandlerClass::* itsVoidMenuExtendedFunctionTakingUInt )( ObjectType, unsigned ); + bool operator()(const MSG& msg, LRESULT& ret) { + f(LOWORD(msg.wParam)); + return true; + } - /// \ingroup eventsSignatures - /// Typedef of a static/global function taking a pointer to the original class, a pointer to the this Widget class and an unsigned int returning void - typedef void ( * menuExtendedVoidFunctionTakingUInt )( EventHandlerClass *, ObjectType, unsigned ); + F f; + }; - /// \ingroup eventsSignatures - /// \typedef Typedef of a member function to the original class taking pointer to the this Widget and an unsigned int returning void - typedef bool ( EventHandlerClass::* itsBoolDrawItemFunction )( ObjectType, int, const DRAWITEMSTRUCT & ); + struct DrawItemDispatcher { + typedef std::tr1::function<bool (int, LPDRAWITEMSTRUCT)> F; - /// \ingroup eventsSignatures - /// Typedef of a static/global function taking a pointer to the original class, a pointer to the this Widget class and an unsigned int returning void - typedef bool ( * boolDrawItemFunction )( EventHandlerClass *, ObjectType, int, const DRAWITEMSTRUCT & ); + DrawItemDispatcher(const F& f_) : f(f_) { } - /// \ingroup eventsSignatures - /// \typedef Typedef of a member function to the original class taking pointer to the this Widget and an unsigned int returning void - typedef bool ( EventHandlerClass::* itsBoolMeasureItemFunction )( ObjectType, MEASUREITEMSTRUCT * ); + bool operator()(const MSG& msg, LRESULT& ret) { + return f(msg.wParam, reinterpret_cast<LPDRAWITEMSTRUCT>(msg.lParam)); + } - /// \ingroup eventsSignatures - /// Typedef of a static/global function taking a pointer to the original class, a pointer to the this Widget class and an unsigned int returning void - typedef bool ( * boolMeasureItemFunction )( EventHandlerClass *, ObjectType, MEASUREITEMSTRUCT * ); + F f; + }; - /// \ingroup eventsSignatures - /// \typedef Typedef of a member function to the original class taking pointer to the this Widget returning void - typedef void ( EventHandlerClass::* itsVoidPopupFunction )( ObjectType ); + struct MeasureItemDispatcher { + typedef std::tr1::function<bool (LPMEASUREITEMSTRUCT)> F; - /// \ingroup eventsSignatures - /// Typedef of a static/global function taking a pointer to the original class, a pointer to the this Widget class returning void - typedef void ( * voidPopupFunction )( EventHandlerClass *, ObjectType ); + MeasureItemDispatcher(const F& f_) : f(f_) { } - // Overriden to set default drawing - void create( bool isPopup = false ); + bool operator()(const MSG& msg, LRESULT& ret) { + return f(reinterpret_cast<LPMEASUREITEMSTRUCT>(msg.lParam)); + } - // Overriden to set default drawing - void create( HMENU source, bool copy ); + F f; + }; /// Setting event handler for Draw Item Event /** The Draw Item Event will be raised when the menu needs to draw itself, if you - * wish to truly be creative and be 100% in control you must handle this Event - * and do the actualy drawing of the Menu yourself, but for most people it will - * be enough to just manipulate the background colors etc of the MenuItemData - * given to the menu in the appendItem or to call the setColorInfo function <br> - * Note! <br> - * If this event is handled you also MUST handle the Measure Item Event!! - */ - void onDrawItem( boolDrawItemFunction eventHandler ); - void onDrawItem( itsBoolDrawItemFunction eventHandler ); + * wish to truly be creative and be 100% in control you must handle this Event + * and do the actualy drawing of the Menu yourself, but for most people it will + * be enough to just manipulate the background colors etc of the MenuItemData + * given to the menu in the appendItem or to call the setColorInfo function <br> + * Note! <br> + * If this event is handled you also MUST handle the Measure Item Event!! + */ + bool handleDrawItem(int id, LPDRAWITEMSTRUCT drawInfo); - /// Setting event handler for Draw Item Event + /// Setting event handler for Measure Item Event /** The Measure Item Event is nessecary to handle if you want to draw the menu - * yourself since it is inside this Event Handler you're telling the system how - * much space you need to actually do the drawing <br> - * Note! <br> - * If this event is handled you also MUST handle the Draw Item Event!! - */ - void onMeasureItem( boolMeasureItemFunction eventHandler ); - void onMeasureItem( itsBoolMeasureItemFunction eventHandler ); + * yourself since it is inside this Event Handler you're telling the system how + * much space you need to actually do the drawing <br> + * Note! <br> + * If this event is handled you also MUST handle the Draw Item Event!! + */ + bool handleMeasureItem(LPMEASUREITEMSTRUCT measureInfo); - /// Sets the event handler for the Popup event - void onPopup( voidPopupFunction eventHandler ); - - /// Sets the event handler for the Popup event - void onPopup( itsVoidPopupFunction eventHandler ); - /// Appends a separator item to the menu /** A menu separator is basically just "air" between menu items.< br > - * A separator cannot be "clicked" or "chosen". - */ + * A separator cannot be "clicked" or "chosen". + */ void appendSeparatorItem(); /// Appends a Menu Item /** eventHandler is the function that will receive the "click" event from the - * menu item. <br> - * Event handler's signature must be "void foo( WidgetMenuExtendedPtr, unsigned - * int )" and it must be contained as a member <br> - * of the class that is defined as the EventHandlerClass, normally either the - * WidgetWindow derived class or the class derived from WidgetMenu. <br> - * See e.g. WidgetMenu for an example. <br> - * The reason to why we have this "id" is because the same event handler can be - * defined for several menu items even in fact across menu objects, therefore - * this number should be unique across the application. - */ - void appendItem( unsigned itemID, const SmartUtil::tstring & text, MenuItemDataPtr itemData, itsVoidMenuExtendedFunctionTakingUInt eventHandler ); - void appendItem( unsigned itemID, const SmartUtil::tstring & text, MenuItemDataPtr itemData, menuExtendedVoidFunctionTakingUInt eventHandler ); + * menu item. <br> + * Event handler's signature must be "void foo( WidgetMenuExtendedPtr, unsigned + * int )" and it must be contained as a member <br> + * of the class that is defined as the Widget, normally either the + * WidgetWindow derived class or the class derived from WidgetMenu. <br> + * See e.g. WidgetMenu for an example. <br> + * The reason to why we have this "id" is because the same event handler can be + * defined for several menu items even in fact across menu objects, therefore + * this number should be unique across the application. + */ + void appendItem(unsigned int id, const SmartUtil::tstring & text, MenuItemDataPtr itemData = MenuItemDataPtr(new MenuItemData())); + void appendItem(unsigned int id, const SmartUtil::tstring & text, const IdDispatcher::F& f, MenuItemDataPtr itemData = MenuItemDataPtr(new MenuItemData())); + void appendItem(unsigned int id, const SmartUtil::tstring & text, BitmapPtr image); + void appendItem(unsigned int id, const SmartUtil::tstring & text, const IdDispatcher::F& f, BitmapPtr image); /// Removes specified item from this menu /** Call this function to actually DELETE a menu item from the menu hierarchy. - * Note that you have to specify the item position; and whenever you remove an item, - * all subsequent items change positions. To remove a range of items, remove from - * end to start. - */ + * Note that you have to specify the item position; and whenever you remove an item, + * all subsequent items change positions. To remove a range of items, remove from + * end to start. + */ void removeItem( unsigned itemIndex ); /// Remove all items from the menu /** Will also delete any submenus. - */ + */ void removeAllItems(); /// Return the number of items in the menu @@ -1067,69 +390,69 @@ /// Displays and handles a menu which can appear anywhere in the window. /** Typically called by a Right Mouse click. If both the x and the y coordinate - * is - 1 ( default ) it'll show the context menu on the position the mouse was - * at when the system last recieved a message, basically the "right" place... - * <br> - * Depending on the flags it might return the id of the menu item selected, or 0 - * if none was chosen. Flags with TPM_RETURNCMD will return the menu - item, but - * not do the menu command. - * < ul > - * < li >TPM_CENTERALIGN : Centers the shortcut menu horizontally relative to the coordinate specified by the x parameter< /li > - * < li >TPM_LEFTALIGN : Function positions the shortcut menu so that its left side is aligned with the coordinate specified by the x parameter< /li > - * < li >TPM_RIGHTALIGN : Opposite of LEFTALIGN< /li > - * < li >TPM_BOTTOMALIGN : Aligns menu bottoms to the coordinate specified by the y parameter< /li > - * < li >TPM_TOPALIGN : Opposite of BOTTOMALIGN< /li > - * < li >TPM_VCENTERALIGN : Centers vertically relative to the y parameter< /li > - * < li >TPM_NONOTIFY : Restricts the menu from sending notifications when user clicks item< /li > - * < li >TPM_RETURNCMD : returns the menu item identifier of the user's selection in the return value but DOES NOT carry out the event handler< /li > - * < li >TPM_LEFTBUTTON : Restricts users to selecting menu items with only left mouse button< /li > - * < li >TPM_RIGHTBUTTON : User can choose menu item with both mouse buttons< /li > - * < /ul > - * None of the following are used by default but can be manually chosen if you - * manually call SystemParametersInfo - * < ul > - * < li >TPM_HORNEGANIMATION : Animates the menu from right to left< /li > - * < li >TPM_HORPOSANIMATION : Animates the menu from left to right< /li > - * < li >TPM_NOANIMATION : Displays menu without animation< /li > - * < li >TPM_VERNEGANIMATION : Animates the menu from bottom to top< /li > - * < li >TPM_VERPOSANIMATION : Animates the menu from top to bottom< /li > - * < /ul > - */ - unsigned trackPopupMenu( EventHandlerClass * mainWindow, int x = - 1, int y = - 1, unsigned flags = 0 ); + * is - 1 ( default ) it'll show the context menu on the position the mouse was + * at when the system last recieved a message, basically the "right" place... + * <br> + * Depending on the flags it might return the id of the menu item selected, or 0 + * if none was chosen. Flags with TPM_RETURNCMD will return the menu - item, but + * not do the menu command. + * < ul > + * < li >TPM_CENTERALIGN : Centers the shortcut menu horizontally relative to the coordinate specified by the x parameter< /li > + * < li >TPM_LEFTALIGN : Function positions the shortcut menu so that its left side is aligned with the coordinate specified by the x parameter< /li > + * < li >TPM_RIGHTALIGN : Opposite of LEFTALIGN< /li > + * < li >TPM_BOTTOMALIGN : Aligns menu bottoms to the coordinate specified by the y parameter< /li > + * < li >TPM_TOPALIGN : Opposite of BOTTOMALIGN< /li > + * < li >TPM_VCENTERALIGN : Centers vertically relative to the y parameter< /li > + * < li >TPM_NONOTIFY : Restricts the menu from sending notifications when user clicks item< /li > + * < li >TPM_RETURNCMD : returns the menu item identifier of the user's selection in the return value but DOES NOT carry out the event handler< /li > + * < li >TPM_LEFTBUTTON : Restricts users to selecting menu items with only left mouse button< /li > + * < li >TPM_RIGHTBUTTON : User can choose menu item with both mouse buttons< /li > + * < /ul > + * None of the following are used by default but can be manually chosen if you + * manually call SystemParametersInfo + * < ul > + * < li >TPM_HORNEGANIMATION : Animates the menu from right to left< /li > + * < li >TPM_HORPOSANIMATION : Animates the menu from left to right< /li > + * < li >TPM_NOANIMATION : Displays menu without animation< /li > + * < li >TPM_VERNEGANIMATION : Animates the menu from bottom to top< /li > + * < li >TPM_VERPOSANIMATION : Animates the menu from top to bottom< /li > + * < /ul > + */ + unsigned trackPopupMenu( Widget * mainWindow, const ScreenCoordinate& sc, unsigned flags = 0 ); /// Sets menu title /** A WidgetMenuExtended can have a title, this function sets that title - */ + */ void setTitle( const SmartUtil::tstring & title, bool drawSidebar = false ); /// Sets title font /** Create a font through e.g. createFont in WidgetFactory or similar and set the - * title font to the menu title through using this function - */ + * title font to the menu title through using this function + */ void setTitleFont( FontPtr font ); /// Removes menu title /** If clearSidebar is true, sidebar is removed - */ + */ void clearTitle( bool clearSidebar = false ); /// Enables or disables menu item /** If the second argument is true the menu item will be enabled, otherwise it'll - * be disabled - */ - void enableItem( unsigned itemID, bool setEnabled ); + * be disabled + */ + void enableItem( unsigned int id, bool setEnabled ); /// Set item state to checked/unchecked /** If second parameter is true the menu item will be checked, otherwise it'll be - * unchecked - */ - void checkItem( unsigned itemID, bool setChecked, bool radioMark ); + * unchecked + */ + void checkItem( unsigned int id, bool setChecked, bool radioMark ); /// Returns true if item is checked - bool isItemEnabled( unsigned itemID ); + bool isItemEnabled( unsigned int id ); /// Returns true if item is checked - bool isItemChecked( unsigned itemID ); + bool isItemChecked( unsigned int id ); /// Returns true if menu is "system menu" (icon in top left of window) bool isSystemMenu() @@ -1138,16 +461,16 @@ } /// Returns item text - SmartUtil::tstring getItemText( unsigned itemID ); + SmartUtil::tstring getItemText( unsigned int id ); /// Sets item text - void setItemText( unsigned itemID, SmartUtil::tstring text ); + void setItemText( unsigned int id, SmartUtil::tstring text ); /// Sets color information for the menu /** The MenuColorInfo declares which colors will be used for drawing the menu ( - * items ) <br> - * Have no effect if you override the onDrawItem/onMeasureItem - */ + * items ) <br> + * Have no effect if you override the onDrawItem/onMeasureItem + */ void setColorInfo( const MenuColorInfo & info ); /// Returns menu color information @@ -1181,136 +504,67 @@ MenuColorInfo itsColorInfo; // work around for gcc - std::vector< typename WidgetMenuExtendedPlatformImplementation< EventHandlerClass, CurrentPlatform > - ::WidgetMenuExtendedPtr > & itsChildrenRef; + std::vector< WidgetMenuExtendedPlatformImplementation< WidgetMenuExtended, CurrentPlatform > ::WidgetMenuExtendedPtr > & itsChildrenRef; + // work around for gcc std::vector < private_::ItemDataWrapper * > & itsItemDataRef; private: // Returns item index in the menu item list // If no item with specified id is found, - 1 is returned - int getItemIndex( unsigned itemID ); + int getItemIndex( unsigned int id ); - // Sets event handler for specified item (to process WM_COMMAND) - void setItemCommandHandler( unsigned itemID, menuExtendedVoidFunctionTakingUInt eventHandler ); - void setItemCommandHandler( unsigned itemID, itsVoidMenuExtendedFunctionTakingUInt eventHandler ); - - // TODO: Basically we have a copy constructor which is create( HMENU, bool ) WidgetMenuExtended( const WidgetMenuExtended & ); // Never implemented intentionally }; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Implementation of class /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -template< class EventHandlerClass > -void WidgetMenuExtendedPlatformImplementation< EventHandlerClass, SmartWinDesktop >::attach( EventHandlerClass * mainWindow ) -{ - // get my handle - HMENU handle = reinterpret_cast< HMENU >( this->Widget::itsHandle ); +template< typename MenuType > +const int WidgetMenuExtendedPlatformImplementation< MenuType, SmartWinDesktop >::borderGap = 3; +template< typename MenuType > +const int WidgetMenuExtendedPlatformImplementation< MenuType, SmartWinDesktop >::pointerGap = 5; +template< typename MenuType > +const int WidgetMenuExtendedPlatformImplementation< MenuType, SmartWinDesktop >::textIconGap = 8; +template< typename MenuType > +const int WidgetMenuExtendedPlatformImplementation< MenuType, SmartWinDesktop >::textBorderGap = 4; +template< typename MenuType > +const int WidgetMenuExtendedPlatformImplementation< MenuType, SmartWinDesktop >::separatorHeight = 8; +template< typename MenuType > +const int WidgetMenuExtendedPlatformImplementation< MenuType, SmartWinDesktop >::minSysMenuItemWidth = 130; +template< typename MenuType > +Point WidgetMenuExtendedPlatformImplementation< MenuType, SmartWinDesktop >::defaultImageSize = Point( 16, 16 ); - // set menu - if ( ::SetMenu( mainWindow->handle(), handle ) == FALSE ) - throw xCeption( _T( "Couldn't attach menu to given parent" ) ); +template< typename MenuType > +void WidgetMenuExtendedPlatformImplementation< MenuType, SmartWinDesktop >::attach() +{ + addCommands(itsParent); + if ( ::SetMenu( getParent(), this->itsHandle ) == FALSE ) + throw xCeption( _T( "Couldn't attach menu to the parent window" ) ); } -template< class EventHandlerClass > -void WidgetMenuExtendedPlatformImplementation< EventHandlerClass, SmartWinDesktop >::create( bool isPopup ) +template< typename MenuType > +void WidgetMenuExtendedPlatformImplementation< MenuType, SmartWinDesktop >::create(const Seed& cs) { - HMENU handle = NULL; - // Create menu - if ( isPopup ) - handle = ::CreatePopupMenu(); + if(cs.popup) + itsHandle = ::CreatePopupMenu(); else - handle = ::CreateMenu(); - - // init newly created menu - init( handle ); -} - -template< class EventHandlerClass > -void WidgetMenuExtendedPlatformImplementation< EventHandlerClass, SmartWinDesktop >::create( HMENU source, bool copy ) -{ - if ( !::IsMenu( source ) ) // if source is not a valid menu, cancel - return; - - if ( copy ) - void create(); // create empty menu - else - init( source ); // init with the source - - // get handle to this menu - HMENU handle = reinterpret_cast< HMENU >( this->Widget::itsHandle ); - - // get source item count - int itemCount = ::GetMenuItemCount( source ); - - // variables used in the loop - int index = 0; - int length = 0; - MENUITEMINFO info; - for ( index = 0; index < itemCount; ++index ) + itsHandle = ::CreateMenu(); + if ( !itsHandle ) { - // init struct for menu item info - memset( & info, 0, sizeof( MENUITEMINFO ) ); - info.cbSize = sizeof( MENUITEMINFO ); - - // set mask - info.fMask = MIIM_CHECKMARKS | MIIM_DATA | MIIM_STRING | MIIM_FTYPE | - MIIM_ID | MIIM_STATE | MIIM_SUBMENU; - - if ( ::GetMenuItemInfo( source, index, TRUE, & info ) == FALSE ) - throw xCeption( _T( "Couldn't get menu item info in create()" ) ); - - // set item to owner - drawn - info.fType |= MFT_OWNERDRAW; - - // create item extended info - MenuItemDataPtr data( new MenuItemData() ); - std::auto_ptr< private_::ItemDataWrapper > wrapper( new private_::ItemDataWrapper( handle, index, data ) ); - - // modify item info data - info.dwItemData = reinterpret_cast< ULONG_PTR >( wrapper.get() ); - - // set item text - length = info.cch + 1; - boost::scoped_ptr< TCHAR > tmp( new TCHAR[ length ] ); - info.dwTypeData = tmp.get(); - memset( info.dwTypeData, 0, length ); - ::GetMenuString( source, index, info.dwTypeData, length, MF_BYPOSITION ); - - // process submenus - if ( info.hSubMenu != NULL ) - { - // create popup menu - WidgetMenuExtendedPtr popup ( new WidgetMenuExtended< EventHandlerClass >( this->getParent() ) ); - popup->create( info.hSubMenu, true /* copy */ ); - - // get new handle - info.hSubMenu = reinterpret_cast< HMENU >( popup->handle() ); - - // store as child - itsChildren.push_back( popup ); - } - - // set back item info - if ( ( copy && ::InsertMenuItem( handle, index, TRUE, & info ) ) || // insert new item or - ( !copy && ::SetMenuItemInfo( handle, index, TRUE, & info ) ) ) // change existing item info - { - itsItemData.push_back( wrapper.release() ); - } - else - throw xCeption( _T( "Couldn't insert/modify item in create()" ) ); + xCeption x( _T( "CreateMenu in WidgetMenuExtended::create fizzle... [truncated message content] |
From: <zou...@us...> - 2008-02-08 01:46:21
|
Revision: 993 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=993&view=rev Author: zouzou123gen Date: 2008-02-07 17:46:15 -0800 (Thu, 07 Feb 2008) Log Message: ----------- forgotten files about the main menu patch Added Paths: ----------- dcplusplus/trunk/res/menu/ dcplusplus/trunk/res/menu/ADLSearch.bmp dcplusplus/trunk/res/menu/DLQueue.bmp dcplusplus/trunk/res/menu/FavoriteHubs.bmp dcplusplus/trunk/res/menu/FavoriteUsers.bmp dcplusplus/trunk/res/menu/FinishedDL.bmp dcplusplus/trunk/res/menu/FinishedUL.bmp dcplusplus/trunk/res/menu/Follow.bmp dcplusplus/trunk/res/menu/NetworkStats.bmp dcplusplus/trunk/res/menu/Notepad.bmp dcplusplus/trunk/res/menu/OpenFileList.bmp dcplusplus/trunk/res/menu/PublicHubs.bmp dcplusplus/trunk/res/menu/Reconnect.bmp dcplusplus/trunk/res/menu/Search.bmp dcplusplus/trunk/res/menu/SearchSpy.bmp dcplusplus/trunk/res/menu/Settings.bmp dcplusplus/trunk/res/menu/WaitingUsers.bmp dcplusplus/trunk/smartwin/source/widgets/WidgetMenuExtended.cpp Removed Paths: ------------- dcplusplus/trunk/res/toolbar.bmp Added: dcplusplus/trunk/res/menu/ADLSearch.bmp =================================================================== (Binary files differ) Property changes on: dcplusplus/trunk/res/menu/ADLSearch.bmp ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: dcplusplus/trunk/res/menu/DLQueue.bmp =================================================================== (Binary files differ) Property changes on: dcplusplus/trunk/res/menu/DLQueue.bmp ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: dcplusplus/trunk/res/menu/FavoriteHubs.bmp =================================================================== (Binary files differ) Property changes on: dcplusplus/trunk/res/menu/FavoriteHubs.bmp ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: dcplusplus/trunk/res/menu/FavoriteUsers.bmp =================================================================== (Binary files differ) Property changes on: dcplusplus/trunk/res/menu/FavoriteUsers.bmp ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: dcplusplus/trunk/res/menu/FinishedDL.bmp =================================================================== (Binary files differ) Property changes on: dcplusplus/trunk/res/menu/FinishedDL.bmp ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: dcplusplus/trunk/res/menu/FinishedUL.bmp =================================================================== (Binary files differ) Property changes on: dcplusplus/trunk/res/menu/FinishedUL.bmp ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: dcplusplus/trunk/res/menu/Follow.bmp =================================================================== (Binary files differ) Property changes on: dcplusplus/trunk/res/menu/Follow.bmp ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: dcplusplus/trunk/res/menu/NetworkStats.bmp =================================================================== (Binary files differ) Property changes on: dcplusplus/trunk/res/menu/NetworkStats.bmp ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: dcplusplus/trunk/res/menu/Notepad.bmp =================================================================== (Binary files differ) Property changes on: dcplusplus/trunk/res/menu/Notepad.bmp ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: dcplusplus/trunk/res/menu/OpenFileList.bmp =================================================================== (Binary files differ) Property changes on: dcplusplus/trunk/res/menu/OpenFileList.bmp ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: dcplusplus/trunk/res/menu/PublicHubs.bmp =================================================================== (Binary files differ) Property changes on: dcplusplus/trunk/res/menu/PublicHubs.bmp ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: dcplusplus/trunk/res/menu/Reconnect.bmp =================================================================== (Binary files differ) Property changes on: dcplusplus/trunk/res/menu/Reconnect.bmp ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: dcplusplus/trunk/res/menu/Search.bmp =================================================================== (Binary files differ) Property changes on: dcplusplus/trunk/res/menu/Search.bmp ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: dcplusplus/trunk/res/menu/SearchSpy.bmp =================================================================== (Binary files differ) Property changes on: dcplusplus/trunk/res/menu/SearchSpy.bmp ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: dcplusplus/trunk/res/menu/Settings.bmp =================================================================== (Binary files differ) Property changes on: dcplusplus/trunk/res/menu/Settings.bmp ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: dcplusplus/trunk/res/menu/WaitingUsers.bmp =================================================================== (Binary files differ) Property changes on: dcplusplus/trunk/res/menu/WaitingUsers.bmp ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Deleted: dcplusplus/trunk/res/toolbar.bmp =================================================================== (Binary files differ) Added: dcplusplus/trunk/smartwin/source/widgets/WidgetMenuExtended.cpp =================================================================== --- dcplusplus/trunk/smartwin/source/widgets/WidgetMenuExtended.cpp (rev 0) +++ dcplusplus/trunk/smartwin/source/widgets/WidgetMenuExtended.cpp 2008-02-08 01:46:15 UTC (rev 993) @@ -0,0 +1,888 @@ +/* +Copyright ( c ) 2005, Thomas Hansen +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met : + +* Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. +* Neither the name of the SmartWin++ nor the names of its contributors +may be used to endorse or promote products derived from this software +without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +( INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT ( INCLUDING NEGLIGENCE OR OTHERWISE ) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +#ifndef WINCE + +#include "../../include/smartwin/widgets/WidgetMenuExtended.h" + +#include "../../include/smartwin/resources/Brush.h" +#include "../../include/smartwin/resources/Pen.h" + +namespace SmartWin { + +void WidgetMenuExtended::setColorInfo( const MenuColorInfo & info ) +{ + itsColorInfo = info; +} + +MenuColorInfo WidgetMenuExtended::getColorInfo() +{ + return itsColorInfo; +} + +int WidgetMenuExtended::getItemIndex( unsigned int id ) +{ + int index = 0; + const int itemCount = ::GetMenuItemCount( this->itsHandle ); + + for ( index = 0; index < itemCount; ++index ) + if ( ::GetMenuItemID( this->itsHandle, index ) == id ) // exit the loop if found + return index; + + return - 1; +} + +MenuItemDataPtr WidgetMenuExtended::getData( int itemIndex ) +{ + size_t i = 0; + + for ( i = 0; i < itsItemDataRef.size(); ++i ) + if ( itsItemDataRef[i]->index == itemIndex ) + return itsItemDataRef[i]->data; + + return MenuItemDataPtr(); +} + +WidgetMenuExtended::~WidgetMenuExtended() +{ + // Destroy this menu + ::DestroyMenu( this->handle() ); + std::for_each( itsItemDataRef.begin(), itsItemDataRef.end(), destroyItemDataWrapper ); +} + +void WidgetMenuExtended::destroyItemDataWrapper( private_::ItemDataWrapper * wrapper ) +{ + if ( 0 != wrapper ) + delete wrapper; + + wrapper = 0; +} + +void WidgetMenuExtended::setTitleFont( FontPtr font ) +{ + itsTitleFont = font; + setTitle( itsTitle, this->drawSidebar ); // Easy for now, should be refactored... +} + +void WidgetMenuExtended::clearTitle( bool clearSidebar /* = false */) +{ + if ( !clearSidebar && !itsTitle.empty() ) + removeItem( 0 ); + + // clear title text + itsTitle.clear(); +} + +void WidgetMenuExtended::enableItem( unsigned int id, bool setEnabled ) +{ + if ( ::EnableMenuItem( this->itsHandle, id, MF_BYCOMMAND | setEnabled ? MF_ENABLED : MF_GRAYED ) == -1 ) + throw xCeption( _T( "Couldn't enable/disable item in enableItem()" ) ); +} + +void WidgetMenuExtended::checkItem( unsigned int id, bool setChecked, bool radioMark ) +{ + ::CheckMenuItem( this->itsHandle, id, MF_BYCOMMAND | setChecked ? MF_CHECKED : MF_UNCHECKED ); + + if ( radioMark ) + ::CheckMenuRadioItem( this->itsHandle, id, id, id, id ); +} + +bool WidgetMenuExtended::isItemEnabled( unsigned int id ) +{ + // init struct for item info + MENUITEMINFO info; + memset( & info, 0, sizeof( MENUITEMINFO ) ); + info.cbSize = sizeof( MENUITEMINFO ); + + // set flag + info.fMask = MIIM_STATE; + + // get item info + if ( ::GetMenuItemInfo( this->itsHandle, id, FALSE, & info ) == FALSE ) + throw xCeption( _T( "Couldn't get item info in isItemEnabled()" ) ); + + return ( info.fState & MFS_ENABLED ) == MFS_ENABLED; +} + +bool WidgetMenuExtended::isItemChecked( unsigned int id ) +{ + // init struct for item info + MENUITEMINFO info; + memset( & info, 0, sizeof( MENUITEMINFO ) ); + info.cbSize = sizeof( MENUITEMINFO ); + + // set flag + info.fMask = MIIM_STATE; + + // get item info + if ( ::GetMenuItemInfo( this->itsHandle, id, FALSE, & info ) == FALSE ) + throw xCeption( _T( "Couldn't get item info in isItemChecked()" ) ); + + return ( info.fState & MF_CHECKED ) == MF_CHECKED; +} + +SmartUtil::tstring WidgetMenuExtended::getItemText( unsigned int id ) +{ + MENUITEMINFO info; + memset( & info, 0, sizeof( MENUITEMINFO ) ); + info.cbSize = sizeof( MENUITEMINFO ); + + // set flag + info.fMask = MIIM_STRING; + + if ( ::GetMenuItemInfo( this->itsHandle, id, FALSE, & info ) == FALSE ) + throw xCeption( _T( "Couldn't get item info in getItemText()" ) ); + + boost::scoped_array< TCHAR > buffer( new TCHAR[++info.cch] ); + info.dwTypeData = buffer.get(); + + if ( ::GetMenuItemInfo( this->itsHandle, id, FALSE, & info ) == FALSE ) + throw xCeption( _T( "Couldn't get item info in getItemText()" ) ); + + SmartUtil::tstring retVal = info.dwTypeData; + return retVal; +} + +void WidgetMenuExtended::setItemText( unsigned int id, SmartUtil::tstring text ) +{ + MENUITEMINFO info; + memset( & info, 0, sizeof( MENUITEMINFO ) ); + info.cbSize = sizeof( MENUITEMINFO ); + + // set flag + info.fMask = MIIM_STRING; + info.dwTypeData = (TCHAR*) text.c_str(); + + if ( ::SetMenuItemInfo( this->itsHandle, id, FALSE, & info ) == FALSE ) + throw xCeption( _T( "Couldn't set item info in setItemText()" ) ); +} + +void WidgetMenuExtended::setTitle( const SmartUtil::tstring & title, bool drawSidebar /* = false */) +{ + this->drawSidebar = drawSidebar; + const bool hasTitle = !itsTitle.empty(); + + // set its title + itsTitle = title; + + if ( !drawSidebar ) + { + // init struct for title info + MENUITEMINFO info; + memset( & info, 0, sizeof( MENUITEMINFO ) ); + info.cbSize = sizeof( MENUITEMINFO ); + + // set flags + info.fMask = MIIM_STATE | MIIM_STRING | MIIM_FTYPE | MIIM_DATA; + info.fType = MFT_OWNERDRAW; + info.fState = MF_DISABLED; + + // set title text + info.dwTypeData = const_cast< LPTSTR >( title.c_str() ); + + // created extended info for title item + MenuItemDataPtr data( new MenuItemData( itsTitleFont ) ); + private_::ItemDataWrapper * wrapper = new private_::ItemDataWrapper( this->itsHandle, 0, data, true ); + + // set item data + info.dwItemData = ( ULONG_PTR ) wrapper; + + if ( ( !hasTitle && ::InsertMenuItem( this->itsHandle, 0, TRUE, & info ) ) || + ( hasTitle && ::SetMenuItemInfo( this->itsHandle, 0, TRUE, & info ) ) ) + { + size_t i = 0; + + // adjust item data wrappers for all existing items + for ( i = 0; i < itsItemDataRef.size(); ++i ) + if ( itsItemDataRef[i] ) + ++itsItemDataRef[i]->index; + + // push back title + itsItemDataRef.push_back( wrapper ); + } + } +} + +bool WidgetMenuExtended::handleDrawItem(int id, LPDRAWITEMSTRUCT drawInfo) { + if ( ( id != 0 ) || ( drawInfo->CtlType != ODT_MENU ) ) // if not intended for us + return false; + + // setup colors + MenuColorInfo colorInfo = this->itsColorInfo; + COLORREF colorMenuBar = colorInfo.colorMenuBar; + COLORREF colorTitle = colorInfo.colorTitle; + COLORREF colorMenuDraw = colorInfo.colorMenu; // color for drawing menu + COLORREF colorFillHighlighted = ColorUtilities::lightenColor( colorInfo.colorHighlight, 0.7 ); + + // get item data wrapper + private_::ItemDataWrapper * wrapper = reinterpret_cast< private_::ItemDataWrapper * >( drawInfo->itemData ); + xAssert( wrapper != 0, _T( "Unsupported menu item in drawItem()" ) ); + + // if processing menu bar + const bool isMenuBar = ::GetMenu( getParent() ) == wrapper->menu; + + // change menu draw color for menubars + if ( isMenuBar ) + colorMenuDraw = colorMenuBar; + + // init struct for menu item info + MENUITEMINFO info; + memset( & info, 0, sizeof( MENUITEMINFO ) ); + info.cbSize = sizeof( MENUITEMINFO ); + + // set flags + info.fMask = MIIM_CHECKMARKS | MIIM_FTYPE | MIIM_DATA | MIIM_STATE | MIIM_STRING; + + if ( ::GetMenuItemInfo( wrapper->menu, wrapper->index, TRUE, & info ) == FALSE ) + throw xCeption ( _T( "Couldn't get menu item info in drawItem()" ) ); + + // check if item is owner drawn + xAssert( ( info.fType & MFT_OWNERDRAW ) != 0, _T( "Not a owner - drawn item in drawItem()" ) ); + + // get item data + MenuItemDataPtr data ( wrapper->data ); + xAssert( data != 0, _T( "Couldn't find item data in drawItem()" ) ); + + // get state info + bool isGrayed = ( drawInfo->itemState & ODS_GRAYED ) == ODS_GRAYED; + bool isChecked = ( drawInfo->itemState & ODS_CHECKED ) == ODS_CHECKED; + bool isDisabled = ( drawInfo->itemState & ODS_DISABLED ) == ODS_DISABLED; + bool isSelected = ( drawInfo->itemState & ODS_SELECTED ) == ODS_SELECTED; + bool isHighlighted = ( drawInfo->itemState & ODS_HOTLIGHT ) == ODS_HOTLIGHT; + + // this will contain item image + HBITMAP image = NULL; + + // if checked/unchecked image is avaiable + if ( ( info.hbmpChecked != NULL ) && ( info.hbmpUnchecked != NULL ) ) + image = isChecked ? info.hbmpChecked : info.hbmpUnchecked; + else // get normal image + image = data->Image->getBitmap(); + + // this will contain image size + Point imageSize = data->Image->getBitmapSize(); + + if ( ( imageSize.x == 0 ) && ( imageSize.y == 0 ) ) // no image + imageSize = defaultImageSize; // set default image size + + // compute strip width + int stripWidth = imageSize.x + textIconGap; + + // prepare item rectangle + Rectangle itemRectangle( drawInfo->rcItem.left, drawInfo->rcItem.top, // position + drawInfo->rcItem.right - drawInfo->rcItem.left, // width + drawInfo->rcItem.bottom - drawInfo->rcItem.top ); // height + + // setup buffered canvas + BufferedCanvas< FreeCanvas > canvas( reinterpret_cast<HWND>(wrapper->menu), drawInfo->hDC ); + + // this will conain adjusted sidebar width + int sidebarWidth = 0; + + // this will contain logical information + // about title font + LOGFONT lf; + memset( & lf, 0, sizeof( LOGFONT ) ); + + // this will contain adjusted(rotated) title font for sidebar + HFONT titleFont = NULL; + + // get title font info and adjust item rectangle + if ( this->drawSidebar ) + { + // get title font + FontPtr font = this->itsTitleFont; + + // get logical info for title font + ::GetObject( font->handle(), sizeof( LOGFONT ), & lf ); + + // 90 degree rotation and bold + lf.lfOrientation = lf.lfEscapement = 900; + + // create title font from logical info + titleFont = ::CreateFontIndirect( & lf ); + + // get title text size + SIZE textSize; + memset( & textSize, 0, sizeof( SIZE ) ); + + HGDIOBJ oldFont = ::SelectObject( canvas.handle(), titleFont ); + ::GetTextExtentPoint32( canvas.handle(), this->itsTitle.c_str(), ( int ) this->itsTitle.size(), & textSize ); + ::SelectObject( canvas.handle(), oldFont ); + + // set sidebar width to text height + sidebarWidth = textSize.cy; + + // adjust item rectangle and item background + itemRectangle.pos.x += sidebarWidth; + itemRectangle.size.x -= sidebarWidth; + } + + // draw sidebar with menu title + if ( ( drawInfo->itemAction & ODA_DRAWENTIRE ) && ( this->drawSidebar ) && !this->itsTitle.empty() ) + { + // select title font and color + HGDIOBJ oldFont = ::SelectObject ( canvas.handle(), titleFont ); + COLORREF oldColor = canvas.setTextColor( colorInfo.colorTitleText ); + + // set background mode to transparent + bool oldMode = canvas.setBkMode( true ); + + // get rect for sidebar + RECT rect; + ::GetClipBox( drawInfo->hDC, & rect ); + //rect.left -= borderGap; + + // set title rectangle + Rectangle textRectangle( 0, 0, sidebarWidth, rect.bottom - rect.top ); + + // draw background + Brush brush ( colorInfo.colorTitle ); + canvas.fillRectangle( textRectangle, brush ); + + // draw title + textRectangle.pos.y += 10; + canvas.drawText( this->itsTitle, textRectangle, DT_BOTTOM | DT_SINGLELINE ); + + // clear + canvas.setTextColor( oldColor ); + canvas.setBkMode( oldMode ); + + // set back old font + ::SelectObject( canvas.handle(), oldFont ); + } + + // destroy title font + ::DeleteObject( titleFont ); + + // set item background + if ( wrapper->isMenuTitleItem ) // for title + { + Brush brush ( colorTitle ); + canvas.fillRectangle( itemRectangle, brush ); + + // draw raised border + RECT rc( itemRectangle ); + ::DrawEdge( canvas.handle(), & rc, EDGE_RAISED, BF_RECT ); + } + else // for normal items + { + Brush brush ( colorMenuDraw ); + canvas.fillRectangle( itemRectangle, brush ); + } + + if ( isMenuBar && isSelected ) // draw selected menu bar item + { + // TODO: Simulate shadow + + // select pen for drawing broder + // and brush for filling item + COLORREF colorBorder = 0; + Canvas::Selector select_pen(canvas, *PenPtr(new Pen(colorBorder))); + Canvas::Selector select_brush(canvas, *BrushPtr(new Brush(ColorUtilities::lightenColor( colorMenuBar, 0.5 )))); + + canvas.rectangle( itemRectangle ); + } // end if + else if ( ( isSelected || isHighlighted ) && !isDisabled ) // draw selected or highlighted menu item (if not inactive) + { + // select pen for drawing broder + // and brush for filling item + Canvas::Selector select_pen(canvas, *PenPtr(new Pen(colorInfo.colorHighlight))); + Canvas::Selector select_brush(canvas, *BrushPtr(new Brush(colorFillHighlighted))); + + canvas.rectangle( itemRectangle ); + } // end if + else if ( !isMenuBar && !wrapper->isMenuTitleItem ) // draw strip bar for menu items (except menu title item) + { + // create rectangle for strip bar + Rectangle stripRectangle ( itemRectangle ); + stripRectangle.size.x = stripWidth; + + // draw strip bar + Brush brush ( colorInfo.colorStrip ); + canvas.fillRectangle( stripRectangle, brush ); + } // end if + + if ( !isMenuBar && info.fType & MFT_SEPARATOR ) // draw separator + { + // set up separator rectangle + Rectangle rectangle ( itemRectangle ); + + // center in the item rectangle + rectangle.pos.x += stripWidth + textIconGap; + rectangle.pos.y += rectangle.size.y / 2 - 1; + + // select color + Canvas::Selector select(canvas, *PenPtr(new Pen(::GetSysColor( COLOR_GRAYTEXT )))); + + // draw separator + canvas.moveTo( rectangle.pos.x, rectangle.pos.y ); + canvas.lineTo( rectangle.size.x, rectangle.pos.y ); + } // end if + else // not a seperator, then draw item text and icon + { + // get item text + const int length = info.cch + 1; + std::vector< TCHAR > buffer( length ); + int count = ::GetMenuString( wrapper->menu, wrapper->index, & buffer[0], length, MF_BYPOSITION ); + SmartUtil::tstring itemText( buffer.begin(), buffer.begin() + count ); + + // index will contain accelerator position + size_t index = itemText.find_last_of( _T( '\t' ) ); + + // split item text to draw accelerator correctly + SmartUtil::tstring text = itemText.substr( 0, index ); + + // get accelerator + SmartUtil::tstring accelerator; + + if ( index != itemText.npos ) + accelerator = itemText.substr( index + 1 ); + + // set mode to transparent + bool oldMode = canvas.setBkMode( true ); + + // select item text color + canvas.setTextColor( isGrayed ? ::GetSysColor( COLOR_GRAYTEXT ) : wrapper->isMenuTitleItem ? colorInfo.colorTitleText : data->TextColor ); + + // Select item font if available + FontPtr font( data->Font ); + + HGDIOBJ oldFont = ::SelectObject( canvas.handle(), font->handle() ); + + if ( !isMenuBar && !wrapper->isMenuTitleItem && !itemText.empty() ) // if menu item + { + // compute text rectangle + Rectangle textRectangle( itemRectangle ); + + // adjust rectangle + textRectangle.pos.x += stripWidth + textIconGap; + textRectangle.size.x -= stripWidth + textIconGap + borderGap; + + canvas.drawText( text, textRectangle, DT_LEFT | DT_VCENTER | DT_SINGLELINE ); + + // draw accelerator + if ( !accelerator.empty() ) + canvas.drawText( accelerator, textRectangle, DT_RIGHT | DT_VCENTER | DT_SINGLELINE ); + } // end if + else if ( !itemText.empty() ) // draw menu bar item text + { + Rectangle textRectangle( itemRectangle ); + + if ( image != NULL ) // has icon + textRectangle.pos.x += textIconGap; + + canvas.drawText( text, textRectangle, DT_CENTER | DT_VCENTER | DT_SINGLELINE ); + } // end if + + // set back old font + ::SelectObject( canvas.handle(), oldFont ); + + // reset old mode + canvas.setBkMode( oldMode ); + + // set up image rectangle + Rectangle imageRectangle( itemRectangle.pos, imageSize ); + + // adjust icon rectangle + imageRectangle.pos.x += ( stripWidth - imageSize.x ) / 2; + imageRectangle.pos.y += ( itemRectangle.size.y - imageSize.y ) / 2; + + if ( image == NULL ) // drawing item without icon + { + if ( isChecked ) // needs checkmark + { + // draw the check mark or radio bullet + // prepare background + Brush brush( colorInfo.colorStrip ); + canvas.fillRectangle( imageRectangle, brush ); + + // create memory DC and set bitmap on it + HDC memoryDC = ::CreateCompatibleDC( canvas.handle() ); + HGDIOBJ old = ::SelectObject( memoryDC, ::CreateCompatibleBitmap( canvas.handle(), imageSize.x, imageSize.y ) ); + + // draw into memory + RECT rc( Rectangle( 0, 0, imageSize.x, imageSize.y ) ); + ::DrawFrameControl( memoryDC, & rc, DFC_MENU, ( info.fType & MFT_RADIOCHECK ) == 0 ? DFCS_MENUCHECK : DFCS_MENUBULLET ); + + const int adjustment = 2; // adjustment for mark to be in the center + + // bit - blast into out canvas + ::BitBlt( canvas.handle(), imageRectangle.pos.x + adjustment, imageRectangle.pos.y, imageSize.x, imageSize.y, memoryDC, 0, 0, SRCAND ); + + // delete memory dc + ::DeleteObject( ::SelectObject( memoryDC, old ) ); + ::DeleteDC( memoryDC ); + } + } + else // drawing item with icon + { + if ( isSelected && !isDisabled ) // if selected and active, then imitate icon shadow + { + // adjust icon position for later drawing + imageRectangle.pos.x -= 1; + imageRectangle.pos.y -= 1; + + // setup brush for shadow emulation + Brush brush( ColorUtilities::darkenColor( colorInfo.colorStrip, 0.7 ) ); + + // draw the icon shadow + Rectangle shadowRectangle( imageRectangle ); + shadowRectangle.pos.x += 2; + shadowRectangle.pos.y += 2; + canvas.drawBitmap( image, shadowRectangle, colorInfo.colorImageBackground, true ); + } + + // draw normal icon + canvas.drawBitmap( image, imageRectangle, colorInfo.colorImageBackground, isGrayed ); + } + + if ( isChecked ) // draw surrounding rectangle for checked items + { + /*if ( image != NULL ) // adjust for icon + iconRectangle = iconRectangle.shrink( 1.20 );*/ + + // draw the surrounding rectangle + Canvas::Selector select(canvas, *PenPtr(new Pen(colorInfo.colorHighlight))); + canvas.line( imageRectangle ); + } + } + + // blast buffer into screen + if ( ( drawInfo->itemAction & ODA_DRAWENTIRE ) && this->drawSidebar ) // adjustment for sidebar + { + itemRectangle.pos.x -= sidebarWidth; + itemRectangle.size.x += sidebarWidth; + } + + canvas.blast( itemRectangle ); + return true; +} + +bool WidgetMenuExtended::handleMeasureItem(LPMEASUREITEMSTRUCT measureInfo) { + if ( measureInfo->CtlType != ODT_MENU ) // if not intended for us + return false; + + // get data wrapper + private_::ItemDataWrapper * wrapper = reinterpret_cast< private_::ItemDataWrapper * >( measureInfo->itemData ); + xAssert( wrapper != 0, _T( "Unsupported menu item type in measureItem()" ) ); + + // this will contain item size + UINT & itemWidth = measureInfo->itemWidth; + UINT & itemHeight = measureInfo->itemHeight; + + // init struct for item info + MENUITEMINFO info; + memset( & info, 0, sizeof( MENUITEMINFO ) ); + info.cbSize = sizeof( MENUITEMINFO ); + + // set up flags + info.fMask = MIIM_FTYPE | MIIM_DATA | MIIM_CHECKMARKS | MIIM_STRING; + + // try to get item info + if ( ::GetMenuItemInfo( wrapper->menu, wrapper->index, TRUE, & info ) == FALSE ) + throw xCeption ( _T( "Couldn't get item info in measureItem()" ) ); + + // check if item is owner drawn + xAssert( ( info.fType & MFT_OWNERDRAW ) != 0, _T( "Not owner - drawn item encountered in measureItem()" ) ); + + // check if separator + if ( info.fType & MFT_SEPARATOR ) + { + itemWidth = 60; + itemHeight = separatorHeight; + return true; + } + + // are we processing menu bar ? + const bool isMenuBar = ::GetMenu( getParent() ) == wrapper->menu; + + // compute text width and height by simulating write to dc + // get its DC + HDC hdc = ::GetDC( getParent() ); + + // get the item data + MenuItemDataPtr data = wrapper->data; + xAssert( data != 0, _T( "Couldn't find item data in measureItem()" ) ); + + // get item text + const int length = info.cch + 1; + std::vector< TCHAR > buffer ( length ); + int count = ::GetMenuString( wrapper->menu, wrapper->index, & buffer[0], length, MF_BYPOSITION ); + SmartUtil::tstring itemText ( buffer.begin(), buffer.begin() + count ); + + // now get text extents + SIZE textSize; + memset( & textSize, 0, sizeof( SIZE ) ); + + HGDIOBJ oldFont = ::SelectObject( hdc, data->Font->handle() ); + ::GetTextExtentPoint32( hdc, itemText.c_str(), ( int ) itemText.size(), & textSize ); + ::SelectObject( hdc, oldFont ); + + // release DC + ::ReleaseDC( reinterpret_cast<HWND>(wrapper->menu), hdc ); + + // adjust item size + itemWidth = textSize.cx + borderGap; + itemHeight = textSize.cy + borderGap; + + // check to see if item has an image + Point imageSize = data->Image->getBitmapSize(); + + // this will contain checked/unchecked image size + Point checkImageSize; + + // if item has check/unchecked state images, then get their sizes + if ( ( info.hbmpChecked != NULL ) && ( info.hbmpUnchecked != NULL ) ) + checkImageSize = ( info.fState & MFS_CHECKED ) == 0 + ? Bitmap::getBitmapSize( info.hbmpUnchecked ) + : Bitmap::getBitmapSize( info.hbmpChecked ); + + // take the maximum of all available images or set default image size + imageSize.x = (std::max)( imageSize.x, checkImageSize.x ); + imageSize.y = (std::max)( imageSize.y, checkImageSize.y ); + + bool hasImage = ( imageSize.x != 0 ) && ( imageSize.y != 0 ); + + // set default image size if no image is available + if ( !hasImage ) + { + imageSize.x = (std::max)( defaultImageSize.x, (std::max)( imageSize.x, checkImageSize.x ) ); + imageSize.y = (std::max)( defaultImageSize.y, (std::max)( imageSize.y, checkImageSize.y ) ); + } + + // adjust default image size + defaultImageSize.x = (std::max)( defaultImageSize.x, imageSize.x ); + defaultImageSize.y = (std::max)( defaultImageSize.y, imageSize.y ); + + // adjust width + if ( !isMenuBar || // if not menu bar item + ( isMenuBar && hasImage ) ) // or menu bar item with image + { + // adjust item width + itemWidth += imageSize.x + textIconGap + pointerGap; + + // adjust item height + itemHeight = (std::max)( itemHeight, ( UINT ) imageSize.y + borderGap ); + } + + // adjust width for system menu items + if ( this->isSysMenu ) + itemWidth = (std::max)( ( UINT ) minSysMenuItemWidth, itemWidth ); + + // adjust width for sidebar + if ( this->drawSidebar ) + { + // get title text extents + SIZE textSize; + memset( & textSize, 0, sizeof( SIZE ) ); + + ::GetTextExtentPoint32( hdc, this->itsTitle.c_str(), ( int ) this->itsTitle.size(), & textSize ); + + itemWidth += textSize.cy; + } + + // adjust item height + itemHeight = (std::max)( itemHeight, ( UINT )::GetSystemMetrics( SM_CYMENU ) ); + return true; +} + +void WidgetMenuExtended::appendSeparatorItem() +{ + // init structure for new item + MENUITEMINFO itemInfo; + memset( & itemInfo, 0, sizeof( itemInfo ) ); + itemInfo.cbSize = sizeof( MENUITEMINFO ); + + // set flags + itemInfo.fMask = MIIM_DATA | MIIM_FTYPE; + itemInfo.fType = MFT_OWNERDRAW | MFT_SEPARATOR; + + // create item data wrapper + int position = ::GetMenuItemCount( this->itsHandle ); + private_::ItemDataWrapper * wrapper = new private_::ItemDataWrapper( this->itsHandle, position, MenuItemDataPtr( new MenuItemData() ) ); + + // set fields + itemInfo.dwItemData = reinterpret_cast< ULONG_PTR >( wrapper ); + + if ( ::InsertMenuItem( this->itsHandle, position, TRUE, & itemInfo ) ) + itsItemDataRef.push_back( wrapper ); +} + +void WidgetMenuExtended::removeItem( unsigned itemIndex ) +{ + // has sub menus ? + HMENU popup = ::GetSubMenu( this->itsHandle, itemIndex ); + + // try to remove item + if ( ::RemoveMenu( this->itsHandle, itemIndex, MF_BYPOSITION ) == TRUE ) + { + size_t i = 0; + private_::ItemDataWrapper * wrapper = 0; + int itemRemoved = -1; + + for ( i = 0; i < itsItemDataRef.size(); ++i ) + { + // get current data wrapper + wrapper = itsItemDataRef[i]; + + if ( wrapper->index == int(itemIndex) ) // if found + { + itemRemoved = int(i); + delete wrapper; + itsItemDataRef[i] = 0; + } + else if ( wrapper->index > int(itemIndex) ) + --wrapper->index; // adjust succeeding item indices + } + + if( itemRemoved != -1 ) + itsItemDataRef.erase( itsItemDataRef.begin() + itemRemoved ); + + if ( popup != NULL ) // remove sub menus if any + { + for ( i = 0; i < itsChildrenRef.size(); ++i ) + { + if ( itsChildrenRef[i]->itsHandle == popup ) + itsChildrenRef[i].reset(); + } + } + } + else + throw xCeption( _T( "Couldn't remove item in removeItem()" ) ); +} + +void WidgetMenuExtended::removeAllItems() +{ + //must be backwards, since bigger indexes change on remove + for( int i = this->getCount() - 1; i >= 0; i-- ) + { + this->removeItem( i ); + } +} + +int WidgetMenuExtended::getCount() +{ + int count = ::GetMenuItemCount( this->itsHandle ); + if( count == -1 ) + throw xCeption( _T( "Couldn't get item count in getCount()" ) ); + return count; +} + +void WidgetMenuExtended::appendItem(unsigned int id, const SmartUtil::tstring & text, MenuItemDataPtr itemData) +{ + // init structure for new item + MENUITEMINFO info; + memset( & info, 0, sizeof( info ) ); + info.cbSize = sizeof( MENUITEMINFO ); + + // set flags + info.fMask = MIIM_DATA | MIIM_FTYPE | MIIM_CHECKMARKS | MIIM_ID | MIIM_STRING; + info.fType = MFT_OWNERDRAW; + + // set fields + xAssert( !isSysMenu || id < SC_SIZE, _T( "Can't add sysmenu item with that high value, value can not be higher then SC_SIZE - 1" ) ); + info.wID = id; + + // set text + info.dwTypeData = const_cast< LPTSTR >( text.c_str() ); + + // find item index + int index = getItemIndex( id ); + + // set position to insert + bool itemExists = index != - 1; + index = itemExists ? index : ::GetMenuItemCount( this->itsHandle ); + + // set item data + private_::ItemDataWrapper * wrapper = new private_::ItemDataWrapper( this->itsHandle, index, itemData ); + info.dwItemData = reinterpret_cast< ULONG_PTR >( wrapper ); + + if ( ( !itemExists && ::InsertMenuItem( this->itsHandle, id, FALSE, & info ) == TRUE ) || + ( itemExists && ::SetMenuItemInfo( this->itsHandle, id, FALSE, & info ) == TRUE ) ) + { + itsItemDataRef.push_back( wrapper ); + } + else + throw xCeption( _T( "Couldn't insert/update item in the appendItem()" ) ); +} + +void WidgetMenuExtended::appendItem(unsigned int id, const SmartUtil::tstring & text, const IdDispatcher::F& f, MenuItemDataPtr itemData) +{ + appendItem(id, text, itemData); + callbacks.insert(std::make_pair(id, IdDispatcher(f))); +} + +void WidgetMenuExtended::appendItem(unsigned int id, const SmartUtil::tstring & text, BitmapPtr image) +{ + MenuItemDataPtr itemData(new MenuItemData()); + itemData->Image = image; + appendItem(id, text, itemData); +} + +void WidgetMenuExtended::appendItem(unsigned int id, const SmartUtil::tstring & text, const IdDispatcher::F& f, BitmapPtr image) +{ + MenuItemDataPtr itemData(new MenuItemData()); + itemData->Image = image; + appendItem(id, text, f, itemData); +} + +unsigned WidgetMenuExtended::trackPopupMenu( Widget * mainWindow, const ScreenCoordinate& sc, unsigned flags ) +{ + xAssert( mainWindow != 0, _T( "Widget can't be null while trying to display Popup Menu" ) ); + addCommands(mainWindow); + + long x = sc.getPoint().x, y = sc.getPoint().y; + + if ( x == - 1 && y == - 1 ) + { + DWORD pos = ::GetMessagePos(); + x = LOWORD( pos ); + y = HIWORD( pos ); + } + + int retVal = ::TrackPopupMenu(this->itsHandle, flags, x, y, 0, mainWindow->handle(), 0 ); + return retVal; +} + +WidgetMenuExtended::WidgetMenuExtended( SmartWin::Widget* parent ) : +isSysMenu( false ), +drawSidebar( false ), +itsTitleFont( new Font( _T( "Tahoma" ), 20, 10 ) ), +itsChildrenRef( WidgetMenuExtendedPlatformImplementation< WidgetMenuExtended, CurrentPlatform >::itsChildren ), +itsItemDataRef( WidgetMenuExtendedPlatformImplementation< WidgetMenuExtended, CurrentPlatform >::itsItemData ) +{ + this->itsParent = parent; + + // set default drawing + parent->setCallback(Message(WM_DRAWITEM), DrawItemDispatcher(std::tr1::bind(&WidgetMenuExtended::handleDrawItem, this, _1, _2))); + parent->setCallback(Message(WM_MEASUREITEM), MeasureItemDispatcher(std::tr1::bind(&WidgetMenuExtended::handleMeasureItem, this, _1))); +} + +} + +#endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <zou...@us...> - 2008-02-08 03:13:20
|
Revision: 994 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=994&view=rev Author: zouzou123gen Date: 2008-02-07 19:13:16 -0800 (Thu, 07 Feb 2008) Log Message: ----------- fancy menus fixes Modified Paths: -------------- dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetMenuExtended.h dcplusplus/trunk/smartwin/source/widgets/WidgetMenuExtended.cpp dcplusplus/trunk/win32/MainWindow.cpp Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetMenuExtended.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetMenuExtended.h 2008-02-08 01:46:15 UTC (rev 993) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetMenuExtended.h 2008-02-08 03:13:16 UTC (rev 994) @@ -179,9 +179,10 @@ typedef std::tr1::shared_ptr< MenuType > WidgetMenuExtendedPtr; struct Seed { - Seed(bool popup_) : popup(popup_) { } + Seed(bool popup_, const MenuColorInfo& colorInfo_) : popup(popup_), colorInfo(colorInfo_) { } Seed() : popup(false) { } bool popup; + MenuColorInfo colorInfo; }; HMENU handle() const { @@ -254,6 +255,9 @@ Widget* itsParent; + // Contains information about menu colors + MenuColorInfo itsColorInfo; + typedef std::map<unsigned, Widget::CallbackType> CallbackMap; CallbackMap callbacks; @@ -334,7 +338,7 @@ * wish to truly be creative and be 100% in control you must handle this Event * and do the actualy drawing of the Menu yourself, but for most people it will * be enough to just manipulate the background colors etc of the MenuItemData - * given to the menu in the appendItem or to call the setColorInfo function <br> + * given to the menu in the appendItem function <br> * Note! <br> * If this event is handled you also MUST handle the Measure Item Event!! */ @@ -466,16 +470,6 @@ /// Sets item text void setItemText( unsigned int id, SmartUtil::tstring text ); - /// Sets color information for the menu - /** The MenuColorInfo declares which colors will be used for drawing the menu ( - * items ) <br> - * Have no effect if you override the onDrawItem/onMeasureItem - */ - void setColorInfo( const MenuColorInfo & info ); - - /// Returns menu color information - MenuColorInfo getColorInfo(); - /// Returns item data MenuItemDataPtr getData( int itemIndex ); @@ -500,9 +494,6 @@ // if true title is drawn as sidebar bool drawSidebar; - // Contains information about menu colors - MenuColorInfo itsColorInfo; - // work around for gcc std::vector< WidgetMenuExtendedPlatformImplementation< WidgetMenuExtended, CurrentPlatform > ::WidgetMenuExtendedPtr > & itsChildrenRef; @@ -546,6 +537,8 @@ template< typename MenuType > void WidgetMenuExtendedPlatformImplementation< MenuType, SmartWinDesktop >::create(const Seed& cs) { + itsColorInfo = cs.colorInfo; + // Create menu if(cs.popup) itsHandle = ::CreatePopupMenu(); @@ -564,7 +557,7 @@ { // create popup menu pointer WidgetMenuExtendedPtr retVal ( new MenuType(this->itsParent) ); - retVal->create( Seed(true) ); + retVal->create( Seed(true, itsColorInfo) ); // init structure for new item MENUITEMINFO info; Modified: dcplusplus/trunk/smartwin/source/widgets/WidgetMenuExtended.cpp =================================================================== --- dcplusplus/trunk/smartwin/source/widgets/WidgetMenuExtended.cpp 2008-02-08 01:46:15 UTC (rev 993) +++ dcplusplus/trunk/smartwin/source/widgets/WidgetMenuExtended.cpp 2008-02-08 03:13:16 UTC (rev 994) @@ -34,16 +34,6 @@ namespace SmartWin { -void WidgetMenuExtended::setColorInfo( const MenuColorInfo & info ) -{ - itsColorInfo = info; -} - -MenuColorInfo WidgetMenuExtended::getColorInfo() -{ - return itsColorInfo; -} - int WidgetMenuExtended::getItemIndex( unsigned int id ) { int index = 0; @@ -871,8 +861,8 @@ WidgetMenuExtended::WidgetMenuExtended( SmartWin::Widget* parent ) : isSysMenu( false ), -drawSidebar( false ), itsTitleFont( new Font( _T( "Tahoma" ), 20, 10 ) ), +drawSidebar( false ), itsChildrenRef( WidgetMenuExtendedPlatformImplementation< WidgetMenuExtended, CurrentPlatform >::itsChildren ), itsItemDataRef( WidgetMenuExtendedPlatformImplementation< WidgetMenuExtended, CurrentPlatform >::itsItemData ) { Modified: dcplusplus/trunk/win32/MainWindow.cpp =================================================================== --- dcplusplus/trunk/win32/MainWindow.cpp 2008-02-08 01:46:15 UTC (rev 993) +++ dcplusplus/trunk/win32/MainWindow.cpp 2008-02-08 03:13:16 UTC (rev 994) @@ -176,81 +176,85 @@ void MainWindow::initMenu() { dcdebug("initMenu\n"); - mainMenu = createExtendedMenu(); - // DC++ bitmaps use RGB(255, 0, 255) as their background (transparent) color - SmartWin::MenuColorInfo menuColorInfo = mainMenu->getColorInfo(); - menuColorInfo.colorImageBackground = RGB(255, 0, 255); - mainMenu->setColorInfo(menuColorInfo); + { + WidgetMenuExtended::Seed cs; + cs.colorInfo.colorImageBackground = RGB(255, 0, 255); // DC++ bitmaps use RGB(255, 0, 255) as their background (transparent) color + mainMenu = createExtendedMenu(cs); + } - WidgetMenuExtendedPtr file = mainMenu->appendPopup(T_("&File")); - file->setColorInfo(menuColorInfo); + { + WidgetMenuExtendedPtr file = mainMenu->appendPopup(T_("&File")); - file->appendItem(IDC_QUICK_CONNECT, T_("&Quick Connect ...\tCtrl+Q"), std::tr1::bind(&MainWindow::handleQuickConnect, this)); - file->appendItem(IDC_FOLLOW, T_("Follow last redirec&t\tCtrl+T"), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_FOLLOW))); - file->appendItem(IDC_RECONNECT, T_("&Reconnect\tCtrl+R"), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_RECONNECT))); - file->appendSeparatorItem(); + file->appendItem(IDC_QUICK_CONNECT, T_("&Quick Connect ...\tCtrl+Q"), std::tr1::bind(&MainWindow::handleQuickConnect, this)); + file->appendItem(IDC_FOLLOW, T_("Follow last redirec&t\tCtrl+T"), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_FOLLOW))); + file->appendItem(IDC_RECONNECT, T_("&Reconnect\tCtrl+R"), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_RECONNECT))); + file->appendSeparatorItem(); - file->appendItem(IDC_OPEN_FILE_LIST, T_("Open file list...\tCtrl+L"), std::tr1::bind(&MainWindow::handleOpenFileList, this), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_OPEN_FILE_LIST))); - file->appendItem(IDC_OPEN_OWN_LIST, T_("Open own list"), std::tr1::bind(&MainWindow::handleOpenOwnList, this)); - file->appendItem(IDC_MATCH_ALL, T_("Match downloaded lists"), std::tr1::bind(&MainWindow::handleMatchAll, this)); - file->appendItem(IDC_REFRESH_FILE_LIST, T_("Refresh file list\tCtrl+E"), std::tr1::bind(&MainWindow::handleRefreshFileList, this)); - file->appendItem(IDC_OPEN_DOWNLOADS, T_("Open downloads directory"), std::tr1::bind(&MainWindow::handleOpenDownloadsDir, this)); - file->appendSeparatorItem(); + file->appendItem(IDC_OPEN_FILE_LIST, T_("Open file list...\tCtrl+L"), std::tr1::bind(&MainWindow::handleOpenFileList, this), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_OPEN_FILE_LIST))); + file->appendItem(IDC_OPEN_OWN_LIST, T_("Open own list"), std::tr1::bind(&MainWindow::handleOpenOwnList, this)); + file->appendItem(IDC_MATCH_ALL, T_("Match downloaded lists"), std::tr1::bind(&MainWindow::handleMatchAll, this)); + file->appendItem(IDC_REFRESH_FILE_LIST, T_("Refresh file list\tCtrl+E"), std::tr1::bind(&MainWindow::handleRefreshFileList, this)); + file->appendItem(IDC_OPEN_DOWNLOADS, T_("Open downloads directory"), std::tr1::bind(&MainWindow::handleOpenDownloadsDir, this)); + file->appendSeparatorItem(); - file->appendItem(IDC_SETTINGS, T_("Settings..."), std::tr1::bind(&MainWindow::handleSettings, this), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_SETTINGS))); - file->appendSeparatorItem(); - file->appendItem(IDC_EXIT, T_("E&xit"), std::tr1::bind(&MainWindow::handleExit, this)); + file->appendItem(IDC_SETTINGS, T_("Settings..."), std::tr1::bind(&MainWindow::handleSettings, this), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_SETTINGS))); + file->appendSeparatorItem(); + file->appendItem(IDC_EXIT, T_("E&xit"), std::tr1::bind(&MainWindow::handleExit, this)); + } - WidgetMenuExtendedPtr view = mainMenu->appendPopup(T_("&View")); - view->setColorInfo(menuColorInfo); + { + WidgetMenuExtendedPtr view = mainMenu->appendPopup(T_("&View")); - view->appendItem(IDC_PUBLIC_HUBS, T_("&Public Hubs\tCtrl+P"), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_PUBLIC_HUBS))); - view->appendItem(IDC_FAVORITE_HUBS, T_("&Favorite Hubs\tCtrl+F"), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_FAVORITE_HUBS))); - view->appendItem(IDC_FAVUSERS, T_("Favorite &Users\tCtrl+U"), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_FAVORITE_USERS))); - view->appendSeparatorItem(); - view->appendItem(IDC_QUEUE, T_("&Download Queue\tCtrl+D"), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_DL_QUEUE))); - view->appendItem(IDC_FINISHED_DL, T_("Finished Downloads"), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_FINISHED_DL))); - view->appendItem(IDC_WAITING_USERS, T_("Waiting Users"), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_WAITING_USERS))); - view->appendItem(IDC_FINISHED_UL, T_("Finished Uploads"), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_FINISHED_UL))); - view->appendSeparatorItem(); - view->appendItem(IDC_SEARCH, T_("&Search\tCtrl+S"), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_SEARCH))); - view->appendItem(IDC_ADL_SEARCH, T_("ADL Search"), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_ADL_SEARCH))); - view->appendItem(IDC_SEARCH_SPY, T_("Search Spy"), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_SEARCH_SPY))); - view->appendSeparatorItem(); - view->appendItem(IDC_NOTEPAD, T_("&Notepad\tCtrl+N"), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_NOTEPAD))); - view->appendItem(IDC_SYSTEM_LOG, T_("System Log"), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1)); - view->appendItem(IDC_NET_STATS, T_("Network Statistics"), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_NETWORK_STATS))); - view->appendItem(IDC_HASH_PROGRESS, T_("Indexing progress"), std::tr1::bind(&MainWindow::handleHashProgress, this)); - - WidgetMenuExtendedPtr window = mainMenu->appendPopup(T_("&Window")); - window->setColorInfo(menuColorInfo); + view->appendItem(IDC_PUBLIC_HUBS, T_("&Public Hubs\tCtrl+P"), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_PUBLIC_HUBS))); + view->appendItem(IDC_FAVORITE_HUBS, T_("&Favorite Hubs\tCtrl+F"), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_FAVORITE_HUBS))); + view->appendItem(IDC_FAVUSERS, T_("Favorite &Users\tCtrl+U"), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_FAVORITE_USERS))); + view->appendSeparatorItem(); + view->appendItem(IDC_QUEUE, T_("&Download Queue\tCtrl+D"), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_DL_QUEUE))); + view->appendItem(IDC_FINISHED_DL, T_("Finished Downloads"), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_FINISHED_DL))); + view->appendItem(IDC_WAITING_USERS, T_("Waiting Users"), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_WAITING_USERS))); + view->appendItem(IDC_FINISHED_UL, T_("Finished Uploads"), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_FINISHED_UL))); + view->appendSeparatorItem(); + view->appendItem(IDC_SEARCH, T_("&Search\tCtrl+S"), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_SEARCH))); + view->appendItem(IDC_ADL_SEARCH, T_("ADL Search"), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_ADL_SEARCH))); + view->appendItem(IDC_SEARCH_SPY, T_("Search Spy"), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_SEARCH_SPY))); + view->appendSeparatorItem(); + view->appendItem(IDC_NOTEPAD, T_("&Notepad\tCtrl+N"), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_NOTEPAD))); + view->appendItem(IDC_SYSTEM_LOG, T_("System Log"), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1)); + view->appendItem(IDC_NET_STATS, T_("Network Statistics"), std::tr1::bind(&MainWindow::handleOpenWindow, this, _1), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_NETWORK_STATS))); + view->appendItem(IDC_HASH_PROGRESS, T_("Indexing progress"), std::tr1::bind(&MainWindow::handleHashProgress, this)); + } - window->appendItem(IDC_CLOSE_ALL_DISCONNECTED, T_("Close disconnected"), std::tr1::bind(&MainWindow::handleCloseWindows, this, _1)); - window->appendItem(IDC_CLOSE_ALL_PM, T_("Close all PM windows"), std::tr1::bind(&MainWindow::handleCloseWindows, this, _1)); - window->appendItem(IDC_CLOSE_ALL_OFFLINE_PM, T_("Close all offline PM windows"), std::tr1::bind(&MainWindow::handleCloseWindows, this, _1)); - window->appendItem(IDC_CLOSE_ALL_DIR_LIST, T_("Close all file list windows"), std::tr1::bind(&MainWindow::handleCloseWindows, this, _1)); - window->appendItem(IDC_CLOSE_ALL_SEARCH_FRAME, T_("Close all search windows"), std::tr1::bind(&MainWindow::handleCloseWindows, this, _1)); + { + WidgetMenuExtendedPtr window = mainMenu->appendPopup(T_("&Window")); - WidgetMenuExtendedPtr help = mainMenu->appendPopup(T_("&Help")); - help->setColorInfo(menuColorInfo); + window->appendItem(IDC_CLOSE_ALL_DISCONNECTED, T_("Close disconnected"), std::tr1::bind(&MainWindow::handleCloseWindows, this, _1)); + window->appendItem(IDC_CLOSE_ALL_PM, T_("Close all PM windows"), std::tr1::bind(&MainWindow::handleCloseWindows, this, _1)); + window->appendItem(IDC_CLOSE_ALL_OFFLINE_PM, T_("Close all offline PM windows"), std::tr1::bind(&MainWindow::handleCloseWindows, this, _1)); + window->appendItem(IDC_CLOSE_ALL_DIR_LIST, T_("Close all file list windows"), std::tr1::bind(&MainWindow::handleCloseWindows, this, _1)); + window->appendItem(IDC_CLOSE_ALL_SEARCH_FRAME, T_("Close all search windows"), std::tr1::bind(&MainWindow::handleCloseWindows, this, _1)); + } - help->appendItem(IDC_HELP_CONTENTS, T_("Help &Contents\tF1"), std::tr1::bind(&MainWindow::handleMenuHelp, this, _1)); - help->appendSeparatorItem(); - help->appendItem(IDC_HELP_CHANGELOG, T_("Change Log"), std::tr1::bind(&MainWindow::handleMenuHelp, this, _1)); - help->appendItem(IDC_ABOUT, T_("About DC++..."), std::tr1::bind(&MainWindow::handleAbout, this)); - help->appendSeparatorItem(); - help->appendItem(IDC_HELP_HOMEPAGE, T_("DC++ Homepage"), std::tr1::bind(&MainWindow::handleLink, this, _1)); - help->appendItem(IDC_HELP_DOWNLOADS, T_("Downloads"), std::tr1::bind(&MainWindow::handleLink, this, _1)); - help->appendItem(IDC_HELP_GEOIPFILE, T_("GeoIP database update"), std::tr1::bind(&MainWindow::handleLink, this, _1)); - help->appendItem(IDC_HELP_TRANSLATIONS, T_("Translations"), std::tr1::bind(&MainWindow::handleLink, this, _1)); - help->appendItem(IDC_HELP_FAQ, T_("Frequently asked questions"), std::tr1::bind(&MainWindow::handleLink, this, _1)); - help->appendItem(IDC_HELP_FORUM, T_("Help forum"), std::tr1::bind(&MainWindow::handleLink, this, _1)); - help->appendItem(IDC_HELP_DISCUSS, T_("DC++ discussion forum"), std::tr1::bind(&MainWindow::handleLink, this, _1)); - help->appendItem(IDC_HELP_REQUEST_FEATURE, T_("Request a feature"), std::tr1::bind(&MainWindow::handleLink, this, _1)); - help->appendItem(IDC_HELP_REPORT_BUG, T_("Report a bug"), std::tr1::bind(&MainWindow::handleLink, this, _1)); - help->appendItem(IDC_HELP_DONATE, T_("Donate (paypal)"), std::tr1::bind(&MainWindow::handleLink, this, _1)); + { + WidgetMenuExtendedPtr help = mainMenu->appendPopup(T_("&Help")); + help->appendItem(IDC_HELP_CONTENTS, T_("Help &Contents\tF1"), std::tr1::bind(&MainWindow::handleMenuHelp, this, _1)); + help->appendSeparatorItem(); + help->appendItem(IDC_HELP_CHANGELOG, T_("Change Log"), std::tr1::bind(&MainWindow::handleMenuHelp, this, _1)); + help->appendItem(IDC_ABOUT, T_("About DC++..."), std::tr1::bind(&MainWindow::handleAbout, this)); + help->appendSeparatorItem(); + help->appendItem(IDC_HELP_HOMEPAGE, T_("DC++ Homepage"), std::tr1::bind(&MainWindow::handleLink, this, _1)); + help->appendItem(IDC_HELP_DOWNLOADS, T_("Downloads"), std::tr1::bind(&MainWindow::handleLink, this, _1)); + help->appendItem(IDC_HELP_GEOIPFILE, T_("GeoIP database update"), std::tr1::bind(&MainWindow::handleLink, this, _1)); + help->appendItem(IDC_HELP_TRANSLATIONS, T_("Translations"), std::tr1::bind(&MainWindow::handleLink, this, _1)); + help->appendItem(IDC_HELP_FAQ, T_("Frequently asked questions"), std::tr1::bind(&MainWindow::handleLink, this, _1)); + help->appendItem(IDC_HELP_FORUM, T_("Help forum"), std::tr1::bind(&MainWindow::handleLink, this, _1)); + help->appendItem(IDC_HELP_DISCUSS, T_("DC++ discussion forum"), std::tr1::bind(&MainWindow::handleLink, this, _1)); + help->appendItem(IDC_HELP_REQUEST_FEATURE, T_("Request a feature"), std::tr1::bind(&MainWindow::handleLink, this, _1)); + help->appendItem(IDC_HELP_REPORT_BUG, T_("Report a bug"), std::tr1::bind(&MainWindow::handleLink, this, _1)); + help->appendItem(IDC_HELP_DONATE, T_("Donate (paypal)"), std::tr1::bind(&MainWindow::handleLink, this, _1)); + } + mainMenu->attach(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <zou...@us...> - 2008-02-08 17:19:26
|
Revision: 996 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=996&view=rev Author: zouzou123gen Date: 2008-02-08 09:19:21 -0800 (Fri, 08 Feb 2008) Log Message: ----------- tab menus have icons and a title bar + more menu icons added Modified Paths: -------------- dcplusplus/trunk/smartwin/SmartUtil/StringUtils.cpp dcplusplus/trunk/smartwin/SmartUtil/StringUtils.h dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetMenuExtended.h dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetTabView.h dcplusplus/trunk/smartwin/source/widgets/WidgetMenu.cpp dcplusplus/trunk/smartwin/source/widgets/WidgetMenuExtended.cpp dcplusplus/trunk/smartwin/source/widgets/WidgetTabView.cpp dcplusplus/trunk/win32/DCPlusPlus.rc dcplusplus/trunk/win32/HubFrame.cpp dcplusplus/trunk/win32/MDIChildFrame.h dcplusplus/trunk/win32/MainWindow.cpp dcplusplus/trunk/win32/PrivateFrame.cpp dcplusplus/trunk/win32/resource.h Added Paths: ----------- dcplusplus/trunk/res/menu/DCPlusPlus.bmp dcplusplus/trunk/res/menu/Exit.bmp dcplusplus/trunk/res/menu/Hub.bmp Added: dcplusplus/trunk/res/menu/DCPlusPlus.bmp =================================================================== (Binary files differ) Property changes on: dcplusplus/trunk/res/menu/DCPlusPlus.bmp ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: dcplusplus/trunk/res/menu/Exit.bmp =================================================================== (Binary files differ) Property changes on: dcplusplus/trunk/res/menu/Exit.bmp ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: dcplusplus/trunk/res/menu/Hub.bmp =================================================================== (Binary files differ) Property changes on: dcplusplus/trunk/res/menu/Hub.bmp ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: dcplusplus/trunk/smartwin/SmartUtil/StringUtils.cpp =================================================================== --- dcplusplus/trunk/smartwin/SmartUtil/StringUtils.cpp 2008-02-08 08:43:39 UTC (rev 995) +++ dcplusplus/trunk/smartwin/SmartUtil/StringUtils.cpp 2008-02-08 17:19:21 UTC (rev 996) @@ -3,6 +3,12 @@ #include "UtilSystemHeaders.h" namespace SmartUtil { + tstring cutText(tstring str, unsigned int maxLength) { + if(str.length() > maxLength) + str = str.substr(0, maxLength - 3) + _T("..."); + return str; + } + tstring escapeMenu(tstring str) { tstring::size_type i = 0; while( (i = str.find(_T('&'), i)) != tstring::npos) { Modified: dcplusplus/trunk/smartwin/SmartUtil/StringUtils.h =================================================================== --- dcplusplus/trunk/smartwin/SmartUtil/StringUtils.h 2008-02-08 08:43:39 UTC (rev 995) +++ dcplusplus/trunk/smartwin/SmartUtil/StringUtils.h 2008-02-08 17:19:21 UTC (rev 996) @@ -4,6 +4,7 @@ #include "tstring.h" namespace SmartUtil { +tstring cutText(tstring str, unsigned int maxLength); tstring escapeMenu(tstring str); } Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetMenuExtended.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetMenuExtended.h 2008-02-08 08:43:39 UTC (rev 995) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetMenuExtended.h 2008-02-08 17:19:21 UTC (rev 996) @@ -124,9 +124,6 @@ /// Strip bar color COLORREF colorStrip; - /// Title background color - COLORREF colorTitle; - /// Menu bar color COLORREF colorMenuBar; @@ -146,14 +143,12 @@ */ MenuColorInfo( COLORREF menuColor = ColorUtilities::darkenColor( ::GetSysColor( COLOR_WINDOW ), 0.02 ), COLORREF stripColor = ColorUtilities::darkenColor( ::GetSysColor( COLOR_3DFACE ), 0.02 ), - COLORREF titleColor = ColorUtilities::darkenColor( ::GetSysColor( COLOR_MENUBAR ), 0.1 ), COLORREF menuBarColor = ::GetSysColor( COLOR_MENUBAR ), COLORREF highlightColor = ::GetSysColor( COLOR_HIGHLIGHT ), COLORREF titleTextColor = ::GetSysColor( COLOR_MENUTEXT ), COLORREF imageBackground = RGB( 0, 0, 0 ) ) // black : colorMenu( menuColor ), colorStrip( stripColor ), - colorTitle( titleColor ), colorMenuBar( menuBarColor ), colorHighlight( highlightColor ), colorTitleText( titleTextColor ), @@ -452,11 +447,16 @@ */ void checkItem( unsigned int id, bool setChecked, bool radioMark ); - /// Returns true if item is checked - bool isItemEnabled( unsigned int id ); + UINT getMenuState(UINT id, bool byPosition = false); - /// Returns true if item is checked - bool isItemChecked( unsigned int id ); + /// Return true if the item is a separator (by position) + bool isSeparator(UINT id, bool byPosition = false); + /// Return true if the menu item is checked + bool isChecked(UINT id, bool byPosition = false); + /// Return true if the menu item is a popup menu + bool isPopup(UINT id, bool byPosition = false); + /// Return true if the menu item is enabled (not grey and not disabled) + bool isEnabled(UINT id, bool byPosition = false); /// Returns true if menu is "system menu" (icon in top left of window) bool isSystemMenu() @@ -464,15 +464,23 @@ return isSysMenu; } - /// Returns item text - SmartUtil::tstring getItemText( unsigned int id ); + /// Returns the text of a specific menu item + /** Which menu item you wish to retrieve the text for is defined by the "id" + * parameter of the function. + */ + SmartUtil::tstring getText( unsigned idOrPos, bool byPos ); - /// Sets item text - void setItemText( unsigned int id, SmartUtil::tstring text ); + /// Sets the text of a specific menu item + /** Which menu item you wish to set the text is defined by the "id" + * parameter of the function. + */ + void setText( unsigned id, const SmartUtil::tstring& text ); /// Returns item data MenuItemDataPtr getData( int itemIndex ); + ObjectType getChild(UINT position); + virtual ~WidgetMenuExtended(); protected: Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetTabView.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetTabView.h 2008-02-08 08:43:39 UTC (rev 995) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetTabView.h 2008-02-08 17:19:21 UTC (rev 996) @@ -60,6 +60,8 @@ void create( const Seed & cs = Seed() ); + enum { MAX_TITLE_LENGTH = 20 }; + protected: friend class WidgetCreator<WidgetTabView>; @@ -68,7 +70,6 @@ virtual ~WidgetTabView() { } private: - enum { MAX_TITLE_LENGTH = 20 }; struct TabInfo { TabInfo(WidgetChildWindow* w_) : w(w_) { } WidgetChildWindow* w; Modified: dcplusplus/trunk/smartwin/source/widgets/WidgetMenu.cpp =================================================================== --- dcplusplus/trunk/smartwin/source/widgets/WidgetMenu.cpp 2008-02-08 08:43:39 UTC (rev 995) +++ dcplusplus/trunk/smartwin/source/widgets/WidgetMenu.cpp 2008-02-08 17:19:21 UTC (rev 996) @@ -36,7 +36,7 @@ { MENUITEMINFO mi = { sizeof(MENUITEMINFO) }; - mi.fMask = MIIM_TYPE; + mi.fMask = MIIM_STRING; if ( ::GetMenuItemInfo( this->handle(), id, byPosition, & mi ) == 0 ) { xAssert( false, _T( "Error while trying to get MenuItemInfo in WidgetMenu::getText..." ) ); @@ -59,7 +59,7 @@ info.dwTypeData = (TCHAR*) text.c_str(); if ( ::SetMenuItemInfo( this->handle(), id, FALSE, & info ) == FALSE ) - throw xCeption( _T( "Couldn't set item info in setItemText()" ) ); + throw xCeption( _T( "Couldn't set item info in WidgetMenu::setText" ) ); } void WidgetMenuBase::addCommands(Widget* widget) { Modified: dcplusplus/trunk/smartwin/source/widgets/WidgetMenuExtended.cpp =================================================================== --- dcplusplus/trunk/smartwin/source/widgets/WidgetMenuExtended.cpp 2008-02-08 08:43:39 UTC (rev 995) +++ dcplusplus/trunk/smartwin/source/widgets/WidgetMenuExtended.cpp 2008-02-08 17:19:21 UTC (rev 996) @@ -101,74 +101,58 @@ ::CheckMenuRadioItem( this->itsHandle, id, id, id, id ); } -bool WidgetMenuExtended::isItemEnabled( unsigned int id ) +UINT WidgetMenuExtended::getMenuState( UINT id, bool byPosition ) { - // init struct for item info - MENUITEMINFO info; - memset( & info, 0, sizeof( MENUITEMINFO ) ); - info.cbSize = sizeof( MENUITEMINFO ); + return ::GetMenuState(this->handle(), id, byPosition ? MF_BYPOSITION : MF_BYCOMMAND); +} - // set flag - info.fMask = MIIM_STATE; +bool WidgetMenuExtended::isChecked( UINT id, bool byPosition ) +{ + return (getMenuState(id, byPosition) & MF_CHECKED) == MF_CHECKED; +} - // get item info - if ( ::GetMenuItemInfo( this->itsHandle, id, FALSE, & info ) == FALSE ) - throw xCeption( _T( "Couldn't get item info in isItemEnabled()" ) ); - - return ( info.fState & MFS_ENABLED ) == MFS_ENABLED; +bool WidgetMenuExtended::isEnabled( UINT id, bool byPosition ) +{ + return !(getMenuState(id, byPosition) & (MF_DISABLED | MF_GRAYED)); } -bool WidgetMenuExtended::isItemChecked( unsigned int id ) +bool WidgetMenuExtended::isPopup( UINT id, bool byPosition ) { - // init struct for item info - MENUITEMINFO info; - memset( & info, 0, sizeof( MENUITEMINFO ) ); - info.cbSize = sizeof( MENUITEMINFO ); + return (getMenuState(id, byPosition) & MF_POPUP) == MF_POPUP; +} - // set flag - info.fMask = MIIM_STATE; - - // get item info - if ( ::GetMenuItemInfo( this->itsHandle, id, FALSE, & info ) == FALSE ) - throw xCeption( _T( "Couldn't get item info in isItemChecked()" ) ); - - return ( info.fState & MF_CHECKED ) == MF_CHECKED; +bool WidgetMenuExtended::isSeparator( UINT id, bool byPosition ) +{ + return (getMenuState(id, byPosition) & MF_SEPARATOR) == MF_SEPARATOR; } -SmartUtil::tstring WidgetMenuExtended::getItemText( unsigned int id ) +SmartUtil::tstring WidgetMenuExtended::getText( unsigned id, bool byPosition ) { - MENUITEMINFO info; - memset( & info, 0, sizeof( MENUITEMINFO ) ); - info.cbSize = sizeof( MENUITEMINFO ); + MENUITEMINFO mi = { sizeof(MENUITEMINFO) }; // set flag - info.fMask = MIIM_STRING; + mi.fMask = MIIM_STRING; - if ( ::GetMenuItemInfo( this->itsHandle, id, FALSE, & info ) == FALSE ) - throw xCeption( _T( "Couldn't get item info in getItemText()" ) ); + if ( ::GetMenuItemInfo( this->itsHandle, id, byPosition, & mi ) == FALSE ) + throw xCeption( _T( "Couldn't get item info in WidgetMenuExtended::getText" ) ); - boost::scoped_array< TCHAR > buffer( new TCHAR[++info.cch] ); - info.dwTypeData = buffer.get(); - - if ( ::GetMenuItemInfo( this->itsHandle, id, FALSE, & info ) == FALSE ) - throw xCeption( _T( "Couldn't get item info in getItemText()" ) ); - - SmartUtil::tstring retVal = info.dwTypeData; - return retVal; + boost::scoped_array< TCHAR > buffer( new TCHAR[++mi.cch] ); + mi.dwTypeData = buffer.get(); + if ( ::GetMenuItemInfo( this->itsHandle, id, byPosition, & mi ) == FALSE ) + throw xCeption( _T( "Couldn't get item info in WidgetMenuExtended::getText" ) ); + return mi.dwTypeData; } -void WidgetMenuExtended::setItemText( unsigned int id, SmartUtil::tstring text ) +void WidgetMenuExtended::setText( unsigned id, const SmartUtil::tstring& text ) { - MENUITEMINFO info; - memset( & info, 0, sizeof( MENUITEMINFO ) ); - info.cbSize = sizeof( MENUITEMINFO ); + MENUITEMINFO mi = { sizeof(MENUITEMINFO) }; // set flag - info.fMask = MIIM_STRING; - info.dwTypeData = (TCHAR*) text.c_str(); + mi.fMask = MIIM_STRING; + mi.dwTypeData = (TCHAR*) text.c_str(); - if ( ::SetMenuItemInfo( this->itsHandle, id, FALSE, & info ) == FALSE ) - throw xCeption( _T( "Couldn't set item info in setItemText()" ) ); + if ( ::SetMenuItemInfo( this->itsHandle, id, FALSE, & mi ) == FALSE ) + throw xCeption( _T( "Couldn't set item info in WidgetMenuExtended::setText" ) ); } void WidgetMenuExtended::setTitle( const SmartUtil::tstring & title, bool drawSidebar /* = false */) @@ -224,7 +208,6 @@ // setup colors MenuColorInfo colorInfo = this->itsColorInfo; COLORREF colorMenuBar = colorInfo.colorMenuBar; - COLORREF colorTitle = colorInfo.colorTitle; COLORREF colorMenuDraw = colorInfo.colorMenu; // color for drawing menu COLORREF colorFillHighlighted = ColorUtilities::lightenColor( colorInfo.colorHighlight, 0.7 ); @@ -351,7 +334,7 @@ Rectangle textRectangle( 0, 0, sidebarWidth, rect.bottom - rect.top ); // draw background - Brush brush ( colorInfo.colorTitle ); + Brush brush ( colorInfo.colorMenuBar ); canvas.fillRectangle( textRectangle, brush ); // draw title @@ -372,7 +355,7 @@ // set item background if ( wrapper->isMenuTitleItem ) // for title { - Brush brush ( colorTitle ); + Brush brush ( colorMenuBar ); canvas.fillRectangle( itemRectangle, brush ); // draw raised border @@ -859,9 +842,20 @@ return retVal; } +WidgetMenuExtended::ObjectType WidgetMenuExtended::getChild( unsigned position ) { + HMENU h = ::GetSubMenu(handle(), position); + for(size_t i = 0; i < this->itsChildren.size(); ++i) { + ObjectType& menu = this->itsChildren[i]; + if(menu->handle() == h) { + return menu; + } + } + return ObjectType(); +} + WidgetMenuExtended::WidgetMenuExtended( SmartWin::Widget* parent ) : isSysMenu( false ), -itsTitleFont( new Font( _T( "Tahoma" ), 20, 10 ) ), +itsTitleFont( new Font( DefaultGuiFont ) ), drawSidebar( false ), itsChildrenRef( WidgetMenuExtendedPlatformImplementation< WidgetMenuExtended, CurrentPlatform >::itsChildren ), itsItemDataRef( WidgetMenuExtendedPlatformImplementation< WidgetMenuExtended, CurrentPlatform >::itsItemData ) Modified: dcplusplus/trunk/smartwin/source/widgets/WidgetTabView.cpp =================================================================== --- dcplusplus/trunk/smartwin/source/widgets/WidgetTabView.cpp 2008-02-08 08:43:39 UTC (rev 995) +++ dcplusplus/trunk/smartwin/source/widgets/WidgetTabView.cpp 2008-02-08 17:19:21 UTC (rev 996) @@ -184,10 +184,7 @@ } SmartUtil::tstring WidgetTabView::formatTitle(SmartUtil::tstring title) { - if(title.length() > MAX_TITLE_LENGTH) { - title = title.substr(0, MAX_TITLE_LENGTH - 3) + _T("..."); - } - return SmartUtil::escapeMenu(title); + return SmartUtil::escapeMenu(SmartUtil::cutText(title, MAX_TITLE_LENGTH)); } bool WidgetTabView::handleSized(const WidgetSizedEventResult& sz) { Modified: dcplusplus/trunk/win32/DCPlusPlus.rc =================================================================== --- dcplusplus/trunk/win32/DCPlusPlus.rc 2008-02-08 08:43:39 UTC (rev 995) +++ dcplusplus/trunk/win32/DCPlusPlus.rc 2008-02-08 17:19:21 UTC (rev 996) @@ -31,13 +31,16 @@ IDB_ADL_SEARCH BITMAP "res/menu/ADLSearch.bmp" IDB_ARROWS BITMAP "res/arrows.bmp" +IDB_DCPP BITMAP "res/menu/DCPlusPlus.bmp" IDB_DL_QUEUE BITMAP "res/menu/DLQueue.bmp" +IDB_EXIT BITMAP "res/menu/Exit.bmp" IDB_FAVORITE_HUBS BITMAP "res/menu/FavoriteHubs.bmp" IDB_FAVORITE_USERS BITMAP "res/menu/FavoriteUsers.bmp" IDB_FINISHED_DL BITMAP "res/menu/FinishedDL.bmp" IDB_FINISHED_UL BITMAP "res/menu/FinishedUL.bmp" IDB_FOLDERS BITMAP "res/folders.bmp" IDB_FOLLOW BITMAP "res/menu/Follow.bmp" +IDB_HUB BITMAP "res/menu/Hub.bmp" IDB_NETWORK_STATS BITMAP "res/menu/NetworkStats.bmp" IDB_NOTEPAD BITMAP "res/menu/Notepad.bmp" IDB_OPEN_FILE_LIST BITMAP "res/menu/OpenFileList.bmp" Modified: dcplusplus/trunk/win32/HubFrame.cpp =================================================================== --- dcplusplus/trunk/win32/HubFrame.cpp 2008-02-08 08:43:39 UTC (rev 995) +++ dcplusplus/trunk/win32/HubFrame.cpp 2008-02-08 17:19:21 UTC (rev 996) @@ -1170,18 +1170,23 @@ } bool HubFrame::handleTabContextMenu(const SmartWin::ScreenCoordinate& pt) { - WidgetMenuPtr menu = createMenu(true); + WidgetMenuExtended::Seed cs; + cs.popup = true; + cs.colorInfo.colorImageBackground = RGB(255, 0, 255); // DC++ bitmaps use RGB(255, 0, 255) as their background (transparent) color + WidgetMenuExtendedPtr menu = createExtendedMenu(cs); + menu->setTitle(SmartUtil::cutText(getText(), SmartWin::WidgetTabView::MAX_TITLE_LENGTH)); + if(!FavoriteManager::getInstance()->isFavoriteHub(url)) { - menu->appendItem(IDC_ADD_TO_FAVORITES, T_("Add To &Favorites"), std::tr1::bind(&HubFrame::addAsFavorite, this)); + menu->appendItem(IDC_ADD_TO_FAVORITES, T_("Add To &Favorites"), std::tr1::bind(&HubFrame::addAsFavorite, this), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_FAVORITE_HUBS))); } - menu->appendItem(IDC_RECONNECT, T_("&Reconnect\tCtrl+R"), std::tr1::bind(&HubFrame::handleReconnect, this)); + menu->appendItem(IDC_RECONNECT, T_("&Reconnect\tCtrl+R"), std::tr1::bind(&HubFrame::handleReconnect, this), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_RECONNECT))); menu->appendItem(IDC_COPY_HUB, T_("Copy &address to clipboard"), std::tr1::bind(&HubFrame::handleCopyHub, this)); prepareMenu(menu, UserCommand::CONTEXT_HUB, url); menu->appendSeparatorItem(); - menu->appendItem(IDC_CLOSE_WINDOW, T_("&Close"), std::tr1::bind(&HubFrame::close, this, true)); + menu->appendItem(IDC_CLOSE_WINDOW, T_("&Close"), std::tr1::bind(&HubFrame::close, this, true), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_EXIT))); inTabMenu = true; Modified: dcplusplus/trunk/win32/MDIChildFrame.h =================================================================== --- dcplusplus/trunk/win32/MDIChildFrame.h 2008-02-08 08:43:39 UTC (rev 995) +++ dcplusplus/trunk/win32/MDIChildFrame.h 2008-02-08 17:19:21 UTC (rev 996) @@ -186,11 +186,13 @@ } bool handleContextMenu(const SmartWin::ScreenCoordinate& pt) { - SmartWin::WidgetMenu::ObjectType menu = SmartWin::WidgetCreator<SmartWin::WidgetMenu>::create(SmartWin::WidgetMenu::Seed(true)); - menu->appendItem(IDC_CLOSE_WINDOW, T_("&Close"), std::tr1::bind(&ThisType::close, this, true)); - + WidgetMenuExtended::Seed cs; + cs.popup = true; + cs.colorInfo.colorImageBackground = RGB(255, 0, 255); // DC++ bitmaps use RGB(255, 0, 255) as their background (transparent) color + SmartWin::WidgetMenuExtended::ObjectType menu = createExtendedMenu(cs); + menu->setTitle(SmartUtil::cutText(getText(), SmartWin::WidgetTabView::MAX_TITLE_LENGTH)); + menu->appendItem(IDC_CLOSE_WINDOW, T_("&Close"), std::tr1::bind(&ThisType::close, this, true), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_EXIT))); menu->trackPopupMenu(this, pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON); - return true; } Modified: dcplusplus/trunk/win32/MainWindow.cpp =================================================================== --- dcplusplus/trunk/win32/MainWindow.cpp 2008-02-08 08:43:39 UTC (rev 995) +++ dcplusplus/trunk/win32/MainWindow.cpp 2008-02-08 17:19:21 UTC (rev 996) @@ -186,7 +186,7 @@ { WidgetMenuExtendedPtr file = mainMenu->appendPopup(T_("&File")); - file->appendItem(IDC_QUICK_CONNECT, T_("&Quick Connect ...\tCtrl+Q"), std::tr1::bind(&MainWindow::handleQuickConnect, this)); + file->appendItem(IDC_QUICK_CONNECT, T_("&Quick Connect ...\tCtrl+Q"), std::tr1::bind(&MainWindow::handleQuickConnect, this), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_HUB))); file->appendItem(IDC_FOLLOW, T_("Follow last redirec&t\tCtrl+T"), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_FOLLOW))); file->appendItem(IDC_RECONNECT, T_("&Reconnect\tCtrl+R"), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_RECONNECT))); file->appendSeparatorItem(); @@ -200,7 +200,7 @@ file->appendItem(IDC_SETTINGS, T_("Settings..."), std::tr1::bind(&MainWindow::handleSettings, this), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_SETTINGS))); file->appendSeparatorItem(); - file->appendItem(IDC_EXIT, T_("E&xit"), std::tr1::bind(&MainWindow::handleExit, this)); + file->appendItem(IDC_EXIT, T_("E&xit"), std::tr1::bind(&MainWindow::handleExit, this), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_EXIT))); } { @@ -241,7 +241,7 @@ help->appendItem(IDC_HELP_CONTENTS, T_("Help &Contents\tF1"), std::tr1::bind(&MainWindow::handleMenuHelp, this, _1)); help->appendSeparatorItem(); help->appendItem(IDC_HELP_CHANGELOG, T_("Change Log"), std::tr1::bind(&MainWindow::handleMenuHelp, this, _1)); - help->appendItem(IDC_ABOUT, T_("About DC++..."), std::tr1::bind(&MainWindow::handleAbout, this)); + help->appendItem(IDC_ABOUT, T_("About DC++..."), std::tr1::bind(&MainWindow::handleAbout, this), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_DCPP))); help->appendSeparatorItem(); help->appendItem(IDC_HELP_HOMEPAGE, T_("DC++ Homepage"), std::tr1::bind(&MainWindow::handleLink, this, _1)); help->appendItem(IDC_HELP_DOWNLOADS, T_("Downloads"), std::tr1::bind(&MainWindow::handleLink, this, _1)); Modified: dcplusplus/trunk/win32/PrivateFrame.cpp =================================================================== --- dcplusplus/trunk/win32/PrivateFrame.cpp 2008-02-08 08:43:39 UTC (rev 995) +++ dcplusplus/trunk/win32/PrivateFrame.cpp 2008-02-08 17:19:21 UTC (rev 996) @@ -360,20 +360,25 @@ } bool PrivateFrame::handleTabContextMenu(const SmartWin::ScreenCoordinate& pt) { - WidgetMenuPtr menu = createMenu(true); + WidgetMenuExtended::Seed cs; + cs.popup = true; + cs.colorInfo.colorImageBackground = RGB(255, 0, 255); // DC++ bitmaps use RGB(255, 0, 255) as their background (transparent) color + WidgetMenuExtendedPtr menu = createExtendedMenu(cs); + + menu->setTitle(SmartUtil::cutText(getText(), SmartWin::WidgetTabView::MAX_TITLE_LENGTH)); menu->appendItem(IDC_GETLIST, T_("&Get file list"), std::tr1::bind(&PrivateFrame::handleGetList, this)); menu->appendItem(IDC_MATCH_QUEUE, T_("&Match queue"), std::tr1::bind(&PrivateFrame::handleMatchQueue, this)); menu->appendItem(IDC_GRANTSLOT, T_("Grant &extra slot"), std::tr1::bind(&UploadManager::reserveSlot, UploadManager::getInstance(), replyTo)); if(!FavoriteManager::getInstance()->isFavoriteUser(replyTo)) - menu->appendItem(IDC_ADD_TO_FAVORITES, T_("Add To &Favorites"), std::tr1::bind(&FavoriteManager::addFavoriteUser, FavoriteManager::getInstance(), replyTo)); + menu->appendItem(IDC_ADD_TO_FAVORITES, T_("Add To &Favorites"), std::tr1::bind(&FavoriteManager::addFavoriteUser, FavoriteManager::getInstance(), replyTo), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_FAVORITE_USERS))); prepareMenu(menu, UserCommand::CONTEXT_CHAT, ClientManager::getInstance()->getHubs(replyTo->getCID())); menu->appendSeparatorItem(); - menu->appendItem(IDC_CLOSE_WINDOW, T_("&Close"), std::tr1::bind(&PrivateFrame::close, this, true)); + menu->appendItem(IDC_CLOSE_WINDOW, T_("&Close"), std::tr1::bind(&PrivateFrame::close, this, true), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_EXIT))); menu->trackPopupMenu(this, pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON); - return TRUE; + return true; } void PrivateFrame::runUserCommand(const UserCommand& uc) { Modified: dcplusplus/trunk/win32/resource.h =================================================================== --- dcplusplus/trunk/win32/resource.h 2008-02-08 08:43:39 UTC (rev 995) +++ dcplusplus/trunk/win32/resource.h 2008-02-08 17:19:21 UTC (rev 996) @@ -42,6 +42,9 @@ #define IDB_TOOLBAR20_HOT 168 #define IDB_USERS 169 #define IDB_WAITING_USERS 170 +#define IDB_EXIT 171 +#define IDB_HUB 172 +#define IDB_DCPP 173 #define IDD_ABOUTBOX 200 #define IDD_ADLS_PROPERTIES 201 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2008-02-09 20:51:56
|
Revision: 998 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=998&view=rev Author: arnetheduck Date: 2008-02-09 12:51:52 -0800 (Sat, 09 Feb 2008) Log Message: ----------- Patches Modified Paths: -------------- dcplusplus/trunk/changelog.txt dcplusplus/trunk/dcpp/AdcHub.cpp dcplusplus/trunk/dcpp/AdcHub.h dcplusplus/trunk/dcpp/Client.h dcplusplus/trunk/dcpp/ClientManager.cpp dcplusplus/trunk/dcpp/ClientManager.h dcplusplus/trunk/dcpp/NmdcHub.cpp dcplusplus/trunk/dcpp/NmdcHub.h dcplusplus/trunk/dcpp/Text.cpp dcplusplus/trunk/dcpp/Text.h dcplusplus/trunk/win32/AppearancePage.cpp dcplusplus/trunk/win32/HubFrame.cpp dcplusplus/trunk/win32/MainWindow.cpp dcplusplus/trunk/win32/MainWindow.h dcplusplus/trunk/win32/PrivateFrame.cpp dcplusplus/trunk/win32/PrivateFrame.h dcplusplus/trunk/win32/QueueFrame.cpp dcplusplus/trunk/win32/QueueFrame.h dcplusplus/trunk/win32/SystemFrame.cpp dcplusplus/trunk/win32/WinUtil.cpp dcplusplus/trunk/win32/WinUtil.h dcplusplus/trunk/win32/resource.h Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2008-02-09 12:12:59 UTC (rev 997) +++ dcplusplus/trunk/changelog.txt 2008-02-09 20:51:52 UTC (rev 998) @@ -24,7 +24,12 @@ * Fixed crash when copying identity * Fixed potential timer race condition (thanks bigmuscle) * The good parts of partially downloaded segments are now added to queue (thanks bigmuscle) - +* Fancy menus (thanks poy) +* [ADC] Added /me handling (thanks poy) +* Fixed issues with scrolling (thanks poy) +* Fixed re-add sources showing wrong sources (thanks poy) +* Partially fixed + -- 0.704 2007-12-14 -- * Hub lists added to utilize Coral's distributed network (ullner) * Use system header arrows on common controls 6+ (thanks poy) Modified: dcplusplus/trunk/dcpp/AdcHub.cpp =================================================================== --- dcplusplus/trunk/dcpp/AdcHub.cpp 2008-02-09 12:12:59 UTC (rev 997) +++ dcplusplus/trunk/dcpp/AdcHub.cpp 2008-02-09 20:51:52 UTC (rev 998) @@ -560,16 +560,25 @@ } } -void AdcHub::hubMessage(const string& aMessage) { +void AdcHub::hubMessage(const string& aMessage, bool thirdPerson) { if(state != STATE_NORMAL) return; - send(AdcCommand(AdcCommand::CMD_MSG, AdcCommand::TYPE_BROADCAST).addParam(aMessage)); + AdcCommand c(AdcCommand::CMD_MSG, AdcCommand::TYPE_BROADCAST); + c.addParam(aMessage); + if(thirdPerson) + c.addParam("ME", "1"); + send(c); } -void AdcHub::privateMessage(const OnlineUser& user, const string& aMessage) { +void AdcHub::privateMessage(const OnlineUser& user, const string& aMessage, bool thirdPerson) { if(state != STATE_NORMAL) return; - send(AdcCommand(AdcCommand::CMD_MSG, user.getIdentity().getSID(), AdcCommand::TYPE_ECHO).addParam(aMessage).addParam("PM", getMySID())); + AdcCommand c(AdcCommand::CMD_MSG, user.getIdentity().getSID(), AdcCommand::TYPE_ECHO); + c.addParam(aMessage); + if(thirdPerson) + c.addParam("ME", "1"); + c.addParam("PM", getMySID()); + send(c); } void AdcHub::search(int aSizeMode, int64_t aSize, int aFileType, const string& aString, const string& aToken) { Modified: dcplusplus/trunk/dcpp/AdcHub.h =================================================================== --- dcplusplus/trunk/dcpp/AdcHub.h 2008-02-09 12:12:59 UTC (rev 997) +++ dcplusplus/trunk/dcpp/AdcHub.h 2008-02-09 20:51:52 UTC (rev 998) @@ -36,8 +36,8 @@ virtual void connect(const OnlineUser& user, const string& token); void connect(const OnlineUser& user, string const& token, bool secure); - virtual void hubMessage(const string& aMessage); - virtual void privateMessage(const OnlineUser& user, const string& aMessage); + virtual void hubMessage(const string& aMessage, bool thirdPerson = false); + virtual void privateMessage(const OnlineUser& user, const string& aMessage, bool thirdPerson = false); virtual void sendUserCmd(const string& aUserCmd) { send(aUserCmd); } virtual void search(int aSizeMode, int64_t aSize, int aFileType, const string& aString, const string& aToken); virtual void password(const string& pwd); Modified: dcplusplus/trunk/dcpp/Client.h =================================================================== --- dcplusplus/trunk/dcpp/Client.h 2008-02-09 12:12:59 UTC (rev 997) +++ dcplusplus/trunk/dcpp/Client.h 2008-02-09 20:51:52 UTC (rev 998) @@ -38,8 +38,8 @@ virtual void disconnect(bool graceless); virtual void connect(const OnlineUser& user, const string& token) = 0; - virtual void hubMessage(const string& aMessage) = 0; - virtual void privateMessage(const OnlineUser& user, const string& aMessage) = 0; + virtual void hubMessage(const string& aMessage, bool thirdPerson = false) = 0; + virtual void privateMessage(const OnlineUser& user, const string& aMessage, bool thirdPerson = false) = 0; virtual void sendUserCmd(const string& aUserCmd) = 0; virtual void search(int aSizeMode, int64_t aSize, int aFileType, const string& aString, const string& aToken) = 0; virtual void password(const string& pwd) = 0; Modified: dcplusplus/trunk/dcpp/ClientManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/ClientManager.cpp 2008-02-09 12:12:59 UTC (rev 997) +++ dcplusplus/trunk/dcpp/ClientManager.cpp 2008-02-09 20:51:52 UTC (rev 998) @@ -290,12 +290,12 @@ } } -void ClientManager::privateMessage(const UserPtr& p, const string& msg) { +void ClientManager::privateMessage(const UserPtr& p, const string& msg, bool thirdPerson) { Lock l(cs); OnlineIter i = onlineUsers.find(p->getCID()); if(i != onlineUsers.end()) { OnlineUser* u = i->second; - u->getClient().privateMessage(*u, msg); + u->getClient().privateMessage(*u, msg, thirdPerson); } } Modified: dcplusplus/trunk/dcpp/ClientManager.h =================================================================== --- dcplusplus/trunk/dcpp/ClientManager.h 2008-02-09 12:12:59 UTC (rev 997) +++ dcplusplus/trunk/dcpp/ClientManager.h 2008-02-09 20:51:52 UTC (rev 998) @@ -80,7 +80,7 @@ void connect(const UserPtr& p, const string& token); void send(AdcCommand& c, const CID& to); - void privateMessage(const UserPtr& p, const string& msg); + void privateMessage(const UserPtr& p, const string& msg, bool thirdPerson); void userCommand(const UserPtr& p, const UserCommand& uc, StringMap& params, bool compatibility); Modified: dcplusplus/trunk/dcpp/NmdcHub.cpp =================================================================== --- dcplusplus/trunk/dcpp/NmdcHub.cpp 2008-02-09 12:12:59 UTC (rev 997) +++ dcplusplus/trunk/dcpp/NmdcHub.cpp 2008-02-09 20:51:52 UTC (rev 998) @@ -748,9 +748,9 @@ send("$RevConnectToMe " + fromUtf8(getMyNick()) + " " + fromUtf8(aUser.getIdentity().getNick()) + "|"); } -void NmdcHub::hubMessage(const string& aMessage) { +void NmdcHub::hubMessage(const string& aMessage, bool thirdPerson) { checkstate(); - send(fromUtf8( "<" + getMyNick() + "> " + escape(aMessage) + "|" ) ); + send(fromUtf8( "<" + getMyNick() + "> " + escape(thirdPerson ? "/me " + aMessage : aMessage) + "|" ) ); } void NmdcHub::myInfo(bool alwaysSend) { @@ -870,7 +870,7 @@ return tmp; } -void NmdcHub::privateMessage(const OnlineUser& aUser, const string& aMessage) { +void NmdcHub::privateMessage(const OnlineUser& aUser, const string& aMessage, bool /*thirdPerson*/) { checkstate(); send("$To: " + fromUtf8(aUser.getIdentity().getNick()) + " From: " + fromUtf8(getMyNick()) + " $" + fromUtf8(escape("<" + getMyNick() + "> " + aMessage)) + "|"); Modified: dcplusplus/trunk/dcpp/NmdcHub.h =================================================================== --- dcplusplus/trunk/dcpp/NmdcHub.h 2008-02-09 12:12:59 UTC (rev 997) +++ dcplusplus/trunk/dcpp/NmdcHub.h 2008-02-09 20:51:52 UTC (rev 998) @@ -39,8 +39,8 @@ virtual void connect(const OnlineUser& aUser, const string&); - virtual void hubMessage(const string& aMessage); - virtual void privateMessage(const OnlineUser& aUser, const string& aMessage); + virtual void hubMessage(const string& aMessage, bool /*thirdPerson*/ = false); + virtual void privateMessage(const OnlineUser& aUser, const string& aMessage, bool /*thirdPerson*/ = false); virtual void sendUserCmd(const string& aUserCmd) throw() { send(fromUtf8(aUserCmd)); } virtual void search(int aSizeType, int64_t aSize, int aFileType, const string& aString, const string& aToken); virtual void password(const string& aPass) { send("$MyPass " + fromUtf8(aPass) + "|"); } Modified: dcplusplus/trunk/dcpp/Text.cpp =================================================================== --- dcplusplus/trunk/dcpp/Text.cpp 2008-02-09 12:12:59 UTC (rev 997) +++ dcplusplus/trunk/dcpp/Text.cpp 2008-02-09 20:51:52 UTC (rev 998) @@ -417,4 +417,25 @@ return tmp; } +wstring Text::toDOS(wstring tmp) { + if(tmp.empty()) + return Util::emptyStringW; + + if(tmp[0] == L'\r' && (tmp.size() == 1 || tmp[1] != L'\n')) { + tmp.insert(1, L"\n"); + } + for(string::size_type i = 1; i < tmp.size() - 1; ++i) { + if(tmp[i] == L'\r' && tmp[i+1] != L'\n') { + // Mac ending + tmp.insert(i+1, L"\n"); + i++; + } else if(tmp[i] == L'\n' && tmp[i-1] != L'\r') { + // Unix encoding + tmp.insert(i, L"\r"); + i++; + } + } + return tmp; +} + } // namespace dcpp Modified: dcplusplus/trunk/dcpp/Text.h =================================================================== --- dcplusplus/trunk/dcpp/Text.h 2008-02-09 12:12:59 UTC (rev 997) +++ dcplusplus/trunk/dcpp/Text.h 2008-02-09 20:51:52 UTC (rev 998) @@ -132,6 +132,7 @@ } string toDOS(string tmp); + wstring toDOS(wstring tmp); } Modified: dcplusplus/trunk/win32/AppearancePage.cpp =================================================================== --- dcplusplus/trunk/win32/AppearancePage.cpp 2008-02-09 12:12:59 UTC (rev 997) +++ dcplusplus/trunk/win32/AppearancePage.cpp 2008-02-09 20:51:52 UTC (rev 998) @@ -44,7 +44,7 @@ PropPage::ListItem AppearancePage::listItems[] = { { SettingsManager::ALT_SORT_ORDER, N_("Sort all downloads first") }, - { SettingsManager::FILTER_MESSAGES, N_("Filter kick and NMDC debug messages") }, + { SettingsManager::FILTER_MESSAGES, N_("Filter kick messages") }, { SettingsManager::MINIMIZE_TRAY, N_("Minimize to tray") }, { SettingsManager::TIME_STAMPS, N_("Show timestamps in chat by default") }, { SettingsManager::STATUS_IN_CHAT, N_("View status messages in main chat") }, Modified: dcplusplus/trunk/win32/HubFrame.cpp =================================================================== --- dcplusplus/trunk/win32/HubFrame.cpp 2008-02-09 12:12:59 UTC (rev 997) +++ dcplusplus/trunk/win32/HubFrame.cpp 2008-02-09 20:51:52 UTC (rev 998) @@ -277,9 +277,10 @@ tstring param; tstring msg; tstring status; - if(WinUtil::checkCommand(cmd, param, msg, status)) { + bool thirdPerson = false; + if(WinUtil::checkCommand(cmd, param, msg, status, thirdPerson)) { if(!msg.empty()) { - client->hubMessage(Text::fromT(msg)); + client->hubMessage(Text::fromT(msg), thirdPerson); } if(!status.empty()) { addStatus(status); @@ -412,26 +413,21 @@ } else { line = _T("\r\n"); } - line += aLine; + line += Text::toDOS(aLine); - int limit = chat->getTextLimit(); - if(chat->length() + static_cast<int>(line.size()) > limit) { - HoldRedraw hold(chat); + SCROLLINFO scrollInfo = { sizeof(SCROLLINFO), SIF_RANGE | SIF_PAGE | SIF_POS }; + bool scroll = ( + (::GetScrollInfo(chat->handle(), SB_VERT, &scrollInfo) == 0) || // on error, let's keep scrolling... + (scrollInfo.nPos == (scrollInfo.nMax - max(scrollInfo.nPage - 1, 0u))) // scroll only if the current scroll position is at the end + ); + HoldRedraw hold(chat, !scroll); + + size_t limit = chat->getTextLimit(); + if(chat->length() + line.size() > limit) { + HoldRedraw hold2(chat, scroll); chat->setSelection(0, chat->lineIndex(chat->lineFromChar(limit / 10))); chat->replaceSelection(_T("")); } -#ifdef PORT_ME - BOOL noscroll = TRUE; - POINT p = ctrlClient.PosFromChar(ctrlClient.GetWindowTextLength() - 1); - CRect r; - ctrlClient.GetClientRect(r); - - if( r.PtInRect(p) || MDIGetActive() != m_hWnd) - noscroll = FALSE; - else { - ctrlClient.SetRedraw(FALSE); // Strange!! This disables the scrolling...???? - } -#endif if(BOOLSETTING(LOG_MAIN_CHAT)) { StringMap params; params["message"] = Text::fromT(aLine); @@ -441,11 +437,10 @@ LOG(LogManager::CHAT, params); } chat->addText(line); -#ifdef PORT_ME - if(noscroll) { - ctrlClient.SetRedraw(TRUE); - } -#endif + + if(scroll) + chat->sendMessage(WM_VSCROLL, SB_BOTTOM); + setDirty(SettingsManager::BOLD_HUB); } @@ -881,23 +876,23 @@ } void HubFrame::on(Message, Client*, const OnlineUser& from, const string& msg, bool thirdPerson) throw() { - speak(ADD_CHAT_LINE, Util::formatMessage(from.getIdentity().getNick(), msg, thirdPerson)); -} - -void HubFrame::on(StatusMessage, Client*, const string& line) throw() { if(SETTING(FILTER_MESSAGES)) { - if((line.find("Hub-Security") != string::npos) && (line.find("was kicked by") != string::npos)) { + if((msg.find("Hub-Security") != string::npos) && (msg.find("was kicked by") != string::npos)) { // Do nothing... - } else if((line.find("is kicking") != string::npos) && (line.find("because:") != string::npos)) { - speak(ADD_SILENT_STATUS_LINE, Text::toDOS(line)); + } else if((msg.find("is kicking") != string::npos) && (msg.find("because:") != string::npos)) { + speak(ADD_SILENT_STATUS_LINE, msg); } else { - speak(ADD_CHAT_LINE, Text::toDOS(line)); + speak(ADD_CHAT_LINE, Util::formatMessage(from.getIdentity().getNick(), msg, thirdPerson)); } } else { - speak(ADD_CHAT_LINE, Text::toDOS(line)); + speak(ADD_CHAT_LINE, Util::formatMessage(from.getIdentity().getNick(), msg, thirdPerson)); } } +void HubFrame::on(StatusMessage, Client*, const string& line) throw() { + speak(ADD_CHAT_LINE, line); +} + void HubFrame::on(PrivateMessage, Client*, const OnlineUser& from, const OnlineUser& to, const OnlineUser& replyTo, const string& line, bool thirdPerson) throw() { speak(from, to, replyTo, Util::formatMessage(from.getIdentity().getNick(), line, thirdPerson)); } Modified: dcplusplus/trunk/win32/MainWindow.cpp =================================================================== --- dcplusplus/trunk/win32/MainWindow.cpp 2008-02-09 12:12:59 UTC (rev 997) +++ dcplusplus/trunk/win32/MainWindow.cpp 2008-02-09 20:51:52 UTC (rev 998) @@ -69,13 +69,13 @@ links.homepage = _T("http://dcpp.net/"); links.downloads = links.homepage + _T("download/"); links.geoipfile = _T("http://www.maxmind.com/download/geoip/database/GeoIPCountryCSV.zip"); - links.translations = _T("http://sourceforge.net/tracker/?atid=460289&group_id=40287"); links.faq = links.homepage + _T("faq/"); links.help = links.homepage + _T("forum/"); links.discuss = links.homepage + _T("forum/"); links.features = links.homepage + _T("bugzilla/"); links.bugs = links.homepage + _T("bugzilla/"); - + links.donate = _T("https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=arnetheduck%40gmail%2ecom&item_name=DCPlusPlus&no_shipping=1&return=http%3a%2f%2fdcplusplus%2esf%2enet%2f&cancel_return=http%3a%2f%2fdcplusplus%2esf%2enet%2f&cn=Greeting&tax=0¤cy_code=EUR&bn=PP%2dDonationsBF&charset=UTF%2d8"); + initWindow(); initMenu(); initToolbar(); @@ -246,7 +246,6 @@ help->appendItem(IDC_HELP_HOMEPAGE, T_("DC++ Homepage"), std::tr1::bind(&MainWindow::handleLink, this, _1)); help->appendItem(IDC_HELP_DOWNLOADS, T_("Downloads"), std::tr1::bind(&MainWindow::handleLink, this, _1)); help->appendItem(IDC_HELP_GEOIPFILE, T_("GeoIP database update"), std::tr1::bind(&MainWindow::handleLink, this, _1)); - help->appendItem(IDC_HELP_TRANSLATIONS, T_("Translations"), std::tr1::bind(&MainWindow::handleLink, this, _1)); help->appendItem(IDC_HELP_FAQ, T_("Frequently asked questions"), std::tr1::bind(&MainWindow::handleLink, this, _1)); help->appendItem(IDC_HELP_FORUM, T_("Help forum"), std::tr1::bind(&MainWindow::handleLink, this, _1)); help->appendItem(IDC_HELP_DISCUSS, T_("DC++ discussion forum"), std::tr1::bind(&MainWindow::handleLink, this, _1)); @@ -880,10 +879,6 @@ links.geoipfile = Text::toT(xml.getChildData()); } xml.resetCurrentChild(); - if(xml.findChild("Translations")) { - links.translations = Text::toT(xml.getChildData()); - } - xml.resetCurrentChild(); if(xml.findChild("Faq")) { links.faq = Text::toT(xml.getChildData()); } @@ -949,9 +944,6 @@ case IDC_HELP_GEOIPFILE: site = links.geoipfile; break; - case IDC_HELP_TRANSLATIONS: - site = links.translations; - break; case IDC_HELP_FAQ: site = links.faq; break; @@ -968,8 +960,7 @@ site = links.bugs; break; case IDC_HELP_DONATE: - site - = Text::toT("https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=arnetheduck%40gmail%2ecom&item_name=DCPlusPlus&no_shipping=1&return=http%3a%2f%2fdcplusplus%2esf%2enet%2f&cancel_return=http%3a%2f%2fdcplusplus%2esf%2enet%2f&cn=Greeting&tax=0¤cy_code=EUR&bn=PP%2dDonationsBF&charset=UTF%2d8"); + site = links.donate; break; default: dcassert(0); Modified: dcplusplus/trunk/win32/MainWindow.h =================================================================== --- dcplusplus/trunk/win32/MainWindow.h 2008-02-09 12:12:59 UTC (rev 997) +++ dcplusplus/trunk/win32/MainWindow.h 2008-02-09 20:51:52 UTC (rev 998) @@ -94,12 +94,12 @@ tstring homepage; tstring downloads; tstring geoipfile; - tstring translations; tstring faq; tstring help; tstring discuss; tstring features; tstring bugs; + tstring donate; } links; WidgetHPanedPtr paned; Modified: dcplusplus/trunk/win32/PrivateFrame.cpp =================================================================== --- dcplusplus/trunk/win32/PrivateFrame.cpp 2008-02-09 12:12:59 UTC (rev 997) +++ dcplusplus/trunk/win32/PrivateFrame.cpp 2008-02-09 20:51:52 UTC (rev 998) @@ -144,9 +144,16 @@ } line += aLine; + SCROLLINFO scrollInfo = { sizeof(SCROLLINFO), SIF_RANGE | SIF_PAGE | SIF_POS }; + bool scroll = ( + (::GetScrollInfo(chat->handle(), SB_VERT, &scrollInfo) == 0) || // on error, let's keep scrolling... + (scrollInfo.nPos == (scrollInfo.nMax - max(scrollInfo.nPage - 1, 0u))) // scroll only if the current scroll position is at the end + ); + HoldRedraw hold(chat, !scroll); + size_t limit = chat->getTextLimit(); if(chat->length() + line.size() > limit) { - HoldRedraw hold(chat); + HoldRedraw hold2(chat, scroll); chat->setSelection(0, chat->lineIndex(chat->lineFromChar(limit / 10))); chat->replaceSelection(_T("")); } @@ -160,8 +167,11 @@ params["myCID"] = ClientManager::getInstance()->getMe()->getCID().toBase32(); LOG(LogManager::PM, params); } + chat->addText(line); - chat->addText(line); + if(scroll) + chat->sendMessage(WM_VSCROLL, SB_BOTTOM); + setDirty(SettingsManager::BOLD_PM); } @@ -268,29 +278,31 @@ bool send = false; // Process special commands if(s[0] == '/') { + tstring cmd = s; tstring param; tstring message; tstring status; - if(WinUtil::checkCommand(s, param, message, status)) { + bool thirdPerson = false; + if(WinUtil::checkCommand(cmd, param, message, status, thirdPerson)) { if(!message.empty()) { - sendMessage(message); + sendMessage(message, thirdPerson); } if(!status.empty()) { addStatus(status); } - } else if(Util::stricmp(s.c_str(), _T("clear")) == 0) { + } else if(Util::stricmp(cmd.c_str(), _T("clear")) == 0) { chat->setText(Util::emptyStringT); - } else if(Util::stricmp(s.c_str(), _T("grant")) == 0) { + } else if(Util::stricmp(cmd.c_str(), _T("grant")) == 0) { UploadManager::getInstance()->reserveSlot(replyTo); addStatus(T_("Slot granted")); - } else if(Util::stricmp(s.c_str(), _T("close")) == 0) { + } else if(Util::stricmp(cmd.c_str(), _T("close")) == 0) { postMessage(WM_CLOSE); - } else if((Util::stricmp(s.c_str(), _T("favorite")) == 0) || (Util::stricmp(s.c_str(), _T("fav")) == 0)) { + } else if((Util::stricmp(cmd.c_str(), _T("favorite")) == 0) || (Util::stricmp(cmd.c_str(), _T("fav")) == 0)) { FavoriteManager::getInstance()->addFavoriteUser(replyTo); addStatus(T_("Favorite user added")); - } else if(Util::stricmp(s.c_str(), _T("getlist")) == 0) { + } else if(Util::stricmp(cmd.c_str(), _T("getlist")) == 0) { // TODO handleGetList(); - } else if(Util::stricmp(s.c_str(), _T("log")) == 0) { + } else if(Util::stricmp(cmd.c_str(), _T("log")) == 0) { StringMap params; params["hubNI"] = Util::toString(ClientManager::getInstance()->getHubNames(replyTo->getCID())); @@ -299,7 +311,7 @@ params["userNI"] = ClientManager::getInstance()->getNicks(replyTo->getCID())[0]; params["myCID"] = ClientManager::getInstance()->getMe()->getCID().toBase32(); WinUtil::openFile(Text::toT(Util::validateFileName(SETTING(LOG_DIRECTORY) + Util::formatParams(SETTING(LOG_FILE_PRIVATE_CHAT), params, true)))); - } else if(Util::stricmp(s.c_str(), _T("help")) == 0) { + } else if(Util::stricmp(cmd.c_str(), _T("help")) == 0) { addStatus(_T("*** ") + WinUtil::commands + _T(", /getlist, /clear, /grant, /close, /favorite, /log <system, downloads, uploads>")); } else { send = true; @@ -323,8 +335,8 @@ } -void PrivateFrame::sendMessage(const tstring& msg) { - ClientManager::getInstance()->privateMessage(replyTo, Text::fromT(msg)); +void PrivateFrame::sendMessage(const tstring& msg, bool thirdPerson) { + ClientManager::getInstance()->privateMessage(replyTo, Text::fromT(msg), thirdPerson); } HRESULT PrivateFrame::handleSpeaker(WPARAM, LPARAM) { Modified: dcplusplus/trunk/win32/PrivateFrame.h =================================================================== --- dcplusplus/trunk/win32/PrivateFrame.h 2008-02-09 12:12:59 UTC (rev 997) +++ dcplusplus/trunk/win32/PrivateFrame.h 2008-02-09 20:51:52 UTC (rev 998) @@ -42,7 +42,7 @@ static void closeAll(); static void closeAllOffline(); - void sendMessage(const tstring& msg); + void sendMessage(const tstring& msg, bool thirdPerson = false); private: typedef MDIChildFrame<PrivateFrame> BaseType; Modified: dcplusplus/trunk/win32/QueueFrame.cpp =================================================================== --- dcplusplus/trunk/win32/QueueFrame.cpp 2008-02-09 12:12:59 UTC (rev 997) +++ dcplusplus/trunk/win32/QueueFrame.cpp 2008-02-09 20:51:52 UTC (rev 998) @@ -1004,7 +1004,7 @@ void QueueFrame::addBrowseMenu(const WidgetMenuPtr& parent, QueueItemInfo* qii) { unsigned int pos = parent->getCount(); WidgetMenuPtr menu = parent->appendPopup(T_("&Get file list")); - if(addUsers(menu, IDC_BROWSELIST, &QueueFrame::handleBrowseList, qii, false) == 0) { + if(addUsers(menu, IDC_BROWSELIST, &QueueFrame::handleBrowseList, qii->getSources(), false) == 0) { ::EnableMenuItem(menu->handle(), pos, MF_BYPOSITION | MF_GRAYED); } } @@ -1012,7 +1012,7 @@ void QueueFrame::addPMMenu(const WidgetMenuPtr& parent, QueueItemInfo* qii) { unsigned int pos = parent->getCount(); WidgetMenuPtr menu = parent->appendPopup(T_("&Send private message")); - if(addUsers(menu, IDC_PM, &QueueFrame::handlePM, qii, false) == 0) { + if(addUsers(menu, IDC_PM, &QueueFrame::handlePM, qii->getSources(), false) == 0) { ::EnableMenuItem(menu->handle(), pos, MF_BYPOSITION | MF_GRAYED); } } @@ -1023,7 +1023,7 @@ menu->appendItem(IDC_READD, T_("All"), std::tr1::bind(&QueueFrame::handleReadd, this, UserPtr())); menu->appendSeparatorItem(); - if(addUsers(menu, IDC_READD + 1, &QueueFrame::handleReadd, qii, true) == 0) { + if(addUsers(menu, IDC_READD + 1, &QueueFrame::handleReadd, qii->getBadSources(), true) == 0) { ::EnableMenuItem(menu->handle(), pos, MF_BYPOSITION | MF_GRAYED); } } @@ -1033,7 +1033,7 @@ WidgetMenuPtr menu = parent->appendPopup(T_("Remove source")); menu->appendItem(IDC_REMOVE_SOURCE, T_("All"), std::tr1::bind(&QueueFrame::handleRemoveSource, this, UserPtr())); menu->appendSeparatorItem(); - if(addUsers(menu, IDC_REMOVE_SOURCE + 1, &QueueFrame::handleRemoveSource, qii, true) == 0) { + if(addUsers(menu, IDC_REMOVE_SOURCE + 1, &QueueFrame::handleRemoveSource, qii->getSources(), true) == 0) { ::EnableMenuItem(menu->handle(), pos, MF_BYPOSITION | MF_GRAYED); } } @@ -1041,15 +1041,15 @@ void QueueFrame::addRemoveAllMenu(const WidgetMenuPtr& parent, QueueItemInfo* qii) { unsigned int pos = parent->getCount(); WidgetMenuPtr menu = parent->appendPopup(T_("Remove user from queue")); - if(addUsers(menu, IDC_REMOVE_SOURCES, &QueueFrame::handleRemoveSources, qii, true) == 0) { + if(addUsers(menu, IDC_REMOVE_SOURCES, &QueueFrame::handleRemoveSources, qii->getSources(), true) == 0) { ::EnableMenuItem(menu->handle(), pos, MF_BYPOSITION | MF_GRAYED); } } -unsigned int QueueFrame::addUsers(const WidgetMenuPtr& menu, unsigned int startId, void (QueueFrame::*handler)(const UserPtr&), QueueItemInfo* qii, bool offline) { +unsigned int QueueFrame::addUsers(const WidgetMenuPtr& menu, unsigned int startId, void (QueueFrame::*handler)(const UserPtr&), const QueueItem::SourceList& sources, bool offline) { unsigned int id = startId; - for(QueueItem::SourceIter i = qii->getSources().begin(); i != qii->getSources().end(); ++i) { - QueueItem::Source& source = *i; + for(QueueItem::SourceConstIter i = sources.begin(); i != sources.end(); ++i) { + const QueueItem::Source& source = *i; if(offline || source.getUser()->isOnline()) { tstring nick = SmartUtil::escapeMenu(WinUtil::getNicks(source.getUser())); menu->appendItem(id++, nick, reinterpret_cast<ULONG_PTR>(&source), (const WidgetMenu::SimpleDispatcher::F&)std::tr1::bind(handler, this, source.getUser())); Modified: dcplusplus/trunk/win32/QueueFrame.h =================================================================== --- dcplusplus/trunk/win32/QueueFrame.h 2008-02-09 12:12:59 UTC (rev 997) +++ dcplusplus/trunk/win32/QueueFrame.h 2008-02-09 20:51:52 UTC (rev 998) @@ -274,7 +274,7 @@ void addPMMenu(const WidgetMenuPtr& parent, QueueItemInfo* qii); void addPriorityMenu(const WidgetMenuPtr& parent); void addReaddMenu(const WidgetMenuPtr& parent, QueueItemInfo* qii); - unsigned int addUsers(const WidgetMenuPtr& menu, unsigned int startId, void (QueueFrame::*handler)(const UserPtr&), QueueItemInfo* qii, bool offline); + unsigned int addUsers(const WidgetMenuPtr& menu, unsigned int startId, void (QueueFrame::*handler)(const UserPtr&), const QueueItem::SourceList& sources, bool offline); void layout(); HRESULT handleSpeaker(WPARAM wParam, LPARAM lParam); Modified: dcplusplus/trunk/win32/SystemFrame.cpp =================================================================== --- dcplusplus/trunk/win32/SystemFrame.cpp 2008-02-09 12:12:59 UTC (rev 997) +++ dcplusplus/trunk/win32/SystemFrame.cpp 2008-02-09 20:51:52 UTC (rev 998) @@ -59,6 +59,7 @@ log->replaceSelection(_T("")); } log->addTextLines(Text::toT("\r\n[" + Util::getShortTimeString(t) + "] ") + msg); + log->sendMessage(WM_VSCROLL, SB_BOTTOM); setDirty(SettingsManager::BOLD_SYSTEM_LOG); } Modified: dcplusplus/trunk/win32/WinUtil.cpp =================================================================== --- dcplusplus/trunk/win32/WinUtil.cpp 2008-02-09 12:12:59 UTC (rev 997) +++ dcplusplus/trunk/win32/WinUtil.cpp 2008-02-09 20:51:52 UTC (rev 998) @@ -217,9 +217,9 @@ #define MSGS 16 -tstring WinUtil::commands = _T("/refresh, /slots #, /search <string>, /dc++, /away <msg>, /back, /g <searchstring>, /imdb <imdbquery>, /u <url>, /rebuild"); +tstring WinUtil::commands = _T("/refresh, /me <msg>, /slots #, /search <string>, /dc++, /away <msg>, /back, /g <searchstring>, /imdb <imdbquery>, /u <url>, /rebuild"); -bool WinUtil::checkCommand(tstring& cmd, tstring& param, tstring& message, tstring& status) { +bool WinUtil::checkCommand(tstring& cmd, tstring& param, tstring& message, tstring& status, bool& thirdPerson) { string::size_type i = cmd.find(' '); if(i != string::npos) { param = cmd.substr(i+1); @@ -238,6 +238,9 @@ } else { return false; } + } else if(Util::stricmp(cmd.c_str(), _T("me")) == 0) { + message = param; + thirdPerson = true; } else if(Util::stricmp(cmd.c_str(), _T("refresh"))==0) { try { ShareManager::getInstance()->setDirty(); Modified: dcplusplus/trunk/win32/WinUtil.h =================================================================== --- dcplusplus/trunk/win32/WinUtil.h 2008-02-09 12:12:59 UTC (rev 997) +++ dcplusplus/trunk/win32/WinUtil.h 2008-02-09 20:51:52 UTC (rev 998) @@ -90,7 +90,7 @@ * @param status Message that should be shown in the status line. * @return True if the command was processed, false otherwise. */ - static bool checkCommand(tstring& cmd, tstring& param, tstring& message, tstring& status); + static bool checkCommand(tstring& cmd, tstring& param, tstring& message, tstring& status, bool& thirdPerson); static void openFile(const tstring& file); static void openFolder(const tstring& file); Modified: dcplusplus/trunk/win32/resource.h =================================================================== --- dcplusplus/trunk/win32/resource.h 2008-02-09 12:12:59 UTC (rev 997) +++ dcplusplus/trunk/win32/resource.h 2008-02-09 20:51:52 UTC (rev 998) @@ -129,7 +129,6 @@ #define IDC_HELP_HOMEPAGE 1061 #define IDC_HELP_DOWNLOADS 1062 #define IDC_HELP_GEOIPFILE 1063 -#define IDC_HELP_TRANSLATIONS 1064 #define IDC_HELP_FORUM 1065 #define IDC_HELP_DISCUSS 1066 #define IDC_HELP_REQUEST_FEATURE 1067 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2008-02-09 22:14:52
|
Revision: 999 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=999&view=rev Author: arnetheduck Date: 2008-02-09 14:14:47 -0800 (Sat, 09 Feb 2008) Log Message: ----------- add requesting message when downloading, fix downloads view Modified Paths: -------------- dcplusplus/trunk/changelog.txt dcplusplus/trunk/dcpp/DownloadManager.cpp dcplusplus/trunk/dcpp/DownloadManagerListener.h dcplusplus/trunk/dcpp/HashBloom.cpp dcplusplus/trunk/win32/TransferView.cpp dcplusplus/trunk/win32/TransferView.h Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2008-02-09 20:51:52 UTC (rev 998) +++ dcplusplus/trunk/changelog.txt 2008-02-09 22:14:47 UTC (rev 999) @@ -28,7 +28,7 @@ * [ADC] Added /me handling (thanks poy) * Fixed issues with scrolling (thanks poy) * Fixed re-add sources showing wrong sources (thanks poy) -* Partially fixed +* Partially fixed kick message filtering (thanks mikejj) -- 0.704 2007-12-14 -- * Hub lists added to utilize Coral's distributed network (ullner) Modified: dcplusplus/trunk/dcpp/DownloadManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/DownloadManager.cpp 2008-02-09 20:51:52 UTC (rev 998) +++ dcplusplus/trunk/dcpp/DownloadManager.cpp 2008-02-09 22:14:47 UTC (rev 999) @@ -192,7 +192,10 @@ if(aConn->isSet(UserConnection::FLAG_SUPPORTS_XML_BZLIST) && d->getType() == Transfer::TYPE_FULL_LIST) { d->setFlag(Download::FLAG_XML_BZ_LIST); } + + fire(DownloadManagerListener::Requesting(), d); aConn->send(d->getCommand(aConn->isSet(UserConnection::FLAG_SUPPORTS_ZLIB_GET))); + } void DownloadManager::on(AdcCommand::SND, UserConnection* aSource, const AdcCommand& cmd) throw() { Modified: dcplusplus/trunk/dcpp/DownloadManagerListener.h =================================================================== --- dcplusplus/trunk/dcpp/DownloadManagerListener.h 2008-02-09 20:51:52 UTC (rev 998) +++ dcplusplus/trunk/dcpp/DownloadManagerListener.h 2008-02-09 22:14:47 UTC (rev 999) @@ -45,11 +45,17 @@ typedef X<1> Failed; typedef X<2> Starting; typedef X<3> Tick; + typedef X<3> Requesting; /** * This is the first message sent before a download starts. - * No other messages will be sent before. + * No other messages will be sent before this. */ + virtual void on(Requesting, Download*) throw() { } + + /** + * This is the first message sent before a download starts. + */ virtual void on(Starting, Download*) throw() { } /** Modified: dcplusplus/trunk/dcpp/HashBloom.cpp =================================================================== --- dcplusplus/trunk/dcpp/HashBloom.cpp 2008-02-09 20:51:52 UTC (rev 998) +++ dcplusplus/trunk/dcpp/HashBloom.cpp 2008-02-09 22:14:47 UTC (rev 999) @@ -50,13 +50,13 @@ } size_t HashBloom::pos(const TTHValue& tth, size_t n) const { - uint64_t x = 0; - - size_t start = n * h; if((n+1)*h > TTHValue::BITS) { return 0; } + uint64_t x = 0; + + size_t start = n * h; for(size_t i = 0; i < h; ++i) { size_t bit = start + i; size_t byte = bit / 8; Modified: dcplusplus/trunk/win32/TransferView.cpp =================================================================== --- dcplusplus/trunk/win32/TransferView.cpp 2008-02-09 20:51:52 UTC (rev 998) +++ dcplusplus/trunk/win32/TransferView.cpp 2008-02-09 22:14:47 UTC (rev 999) @@ -33,7 +33,7 @@ #include <dcpp/Upload.h> int TransferView::connectionIndexes[] = { CONNECTION_COLUMN_USER, CONNECTION_COLUMN_STATUS, CONNECTION_COLUMN_SPEED, CONNECTION_COLUMN_CHUNK, CONNECTION_COLUMN_TRANSFERED, CONNECTION_COLUMN_QUEUED, CONNECTION_COLUMN_CIPHER, CONNECTION_COLUMN_IP }; -int TransferView::connectionSizes[] = { 125, 375, 100, 100, 125, 75, 100, 100 }; +int TransferView::connectionSizes[] = { 125, 375, 100, 125, 125, 75, 100, 100 }; int TransferView::downloadIndexes[] = { DOWNLOAD_COLUMN_FILE, DOWNLOAD_COLUMN_PATH, DOWNLOAD_COLUMN_STATUS, DOWNLOAD_COLUMN_TIMELEFT, DOWNLOAD_COLUMN_SPEED, DOWNLOAD_COLUMN_DONE, DOWNLOAD_COLUMN_SIZE }; int TransferView::downloadSizes[] = { 200, 300, 150, 200, 125, 100, 100 }; @@ -42,7 +42,7 @@ N_("User"), N_("Status"), N_("Speed"), - N_("Chunk size"), + N_("Chunk"), N_("Transfered (Ratio)"), N_("Queued"), N_("Cipher"), @@ -575,8 +575,9 @@ } if(ui.updateMask & UpdateInfo::MASK_CHUNK) { + chunkPos = ui.chunkPos; chunk = ui.chunk; - columns[CONNECTION_COLUMN_CHUNK] = Text::toT(Util::formatBytes(ui.chunk)); + columns[CONNECTION_COLUMN_CHUNK] = Text::toT(Util::formatBytes(chunkPos) + "/" + Util::formatBytes(chunk)); } if(ui.updateMask & UpdateInfo::MASK_SPEED) { @@ -682,7 +683,7 @@ void TransferView::starting(UpdateInfo* ui, Transfer* t) { ui->setStatus(ConnectionInfo::STATUS_RUNNING); ui->setTransfered(t->getPos(), t->getActual()); - ui->setChunk(t->getSize()); + ui->setChunk(t->getPos(), t->getSize()); const UserConnection& uc = t->getUserConnection(); ui->setCipher(Text::toT(uc.getCipherName())); tstring country = Text::toT(Util::getIpCountry(uc.getRemoteIp())); @@ -694,10 +695,21 @@ } } +void TransferView::on(DownloadManagerListener::Requesting, Download* d) throw() { + UpdateInfo* ui = new UpdateInfo(d->getUser(), true); + + starting(ui, d); + + ui->setStatusString(str(TF_("Requesting %1%") % getFile(d))); + + speak(CONNECTIONS_UPDATE, ui); + + speak(DOWNLOADS_ADD_USER, new TickInfo(d->getPath())); +} + void TransferView::on(DownloadManagerListener::Starting, Download* d) throw() { UpdateInfo* ui = new UpdateInfo(d->getUser(), true); - starting(ui, d); tstring statusString; if(d->getUserConnection().isSecure()) { @@ -720,8 +732,6 @@ ui->setStatusString(statusString); speak(CONNECTIONS_UPDATE, ui); - - speak(DOWNLOADS_ADD_USER, new TickInfo(d->getPath())); } void TransferView::on(DownloadManagerListener::Tick, const DownloadList& dl) throw() { @@ -731,7 +741,7 @@ UpdateInfo* ui = new UpdateInfo(d->getUser(), true); ui->setTransfered(d->getPos(), d->getActual()); ui->setSpeed(d->getAverageSpeed()); - + ui->setChunk(d->getPos(), d->getSize()); tasks.add(CONNECTIONS_UPDATE, ui); } Modified: dcplusplus/trunk/win32/TransferView.h =================================================================== --- dcplusplus/trunk/win32/TransferView.h 2008-02-09 20:51:52 UTC (rev 998) +++ dcplusplus/trunk/win32/TransferView.h 2008-02-09 22:14:47 UTC (rev 999) @@ -117,6 +117,7 @@ int64_t queued; int64_t speed; int64_t chunk; + int64_t chunkPos; tstring columns[CONNECTION_COLUMN_LAST]; void update(const UpdateInfo& ui); @@ -167,7 +168,8 @@ int64_t speed; void setStatusString(const tstring& aStatusString) { statusString = aStatusString; updateMask |= MASK_STATUS_STRING; } tstring statusString; - void setChunk(int64_t aChunk) { chunk = aChunk; updateMask |= MASK_CHUNK; } + void setChunk(int64_t aChunkPos, int64_t aChunk) { chunkPos = aChunkPos; chunk = aChunk; updateMask |= MASK_CHUNK; } + int64_t chunkPos; int64_t chunk; void setIP(const tstring& aIp) { ip = aIp; updateMask |= MASK_IP; } @@ -277,6 +279,7 @@ virtual void on(ConnectionManagerListener::Removed, ConnectionQueueItem* aCqi) throw(); virtual void on(ConnectionManagerListener::StatusChanged, ConnectionQueueItem* aCqi) throw(); + virtual void on(DownloadManagerListener::Requesting, Download* aDownload) throw(); virtual void on(DownloadManagerListener::Complete, Download* aDownload) throw(); virtual void on(DownloadManagerListener::Failed, Download* aDownload, const string& aReason) throw(); virtual void on(DownloadManagerListener::Starting, Download* aDownload) throw(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ul...@us...> - 2008-02-10 21:35:57
|
Revision: 1002 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=1002&view=rev Author: ullner Date: 2008-02-10 13:35:52 -0800 (Sun, 10 Feb 2008) Log Message: ----------- version.xml use Coral; fixed todo for quick connect/nick missing; removed non-coral'd hub lists Modified Paths: -------------- dcplusplus/trunk/changelog.txt dcplusplus/trunk/dcpp/SettingsManager.cpp dcplusplus/trunk/win32/AboutDlg.cpp dcplusplus/trunk/win32/MainWindow.cpp Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2008-02-10 19:19:16 UTC (rev 1001) +++ dcplusplus/trunk/changelog.txt 2008-02-10 21:35:52 UTC (rev 1002) @@ -13,7 +13,7 @@ * Added tab drag/drop (thanks poy) * Changed Pothead to mikejj * Fixed search spy crash -* Upgraded to bzip 1.0.4 (thanks pothead) +* Upgraded to bzip 1.0.4 (thanks mikejj) * Tab tooltips (thanks poy) * Allow spaces in the description field (poy) * [ADC] Handle third person formatting (thanks poy) @@ -29,6 +29,7 @@ * Fixed issues with scrolling (thanks poy) * Fixed re-add sources showing wrong sources (thanks poy) * Partially fixed kick message filtering (thanks mikejj) +* version.xml now use Coral (ullner) -- 0.704 2007-12-14 -- * Hub lists added to utilize Coral's distributed network (ullner) Modified: dcplusplus/trunk/dcpp/SettingsManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/SettingsManager.cpp 2008-02-10 19:19:16 UTC (rev 1001) +++ dcplusplus/trunk/dcpp/SettingsManager.cpp 2008-02-10 21:35:52 UTC (rev 1002) @@ -136,7 +136,7 @@ setDefault(IGNORE_BOT_PMS, false); setDefault(LIST_DUPES, true); setDefault(BUFFER_SIZE, 64); - setDefault(HUBLIST_SERVERS, "http://hublist.hubtracker.com/hublist.xml.bz2;http://dchublist.com/hublist.xml.bz2;http://adchublist.com/hublist.xml.bz2;http://www.hublist.org/PublicHubList.xml.bz2;http://dclist.eu/hublist.xml.bz2;http://download.hublist.cz/hublist.xml.bz2;http://hublist.awenet.info/PublicHubList.xml.bz2;http://hublist.hubtracker.com.nyud.net/hublist.xml.bz2;http://dchublist.com.nyud.net/hublist.xml.bz2;http://adchublist.com.nyud.net/hublist.xml.bz2;http://www.hublist.org.nyud.net/PublicHubList.xml.bz2;http://dclist.eu.nyud.net/hublist.xml.bz2;http://download.hublist.cz.nyud.net/hublist.xml.bz2;http://hublist.awenet.info.nyud.net/PublicHubList.xml.bz2"); + setDefault(HUBLIST_SERVERS, "http://hublist.hubtracker.com.nyud.net/hublist.xml.bz2;http://dchublist.com.nyud.net/hublist.xml.bz2;http://adchublist.com.nyud.net/hublist.xml.bz2;http://www.hublist.org.nyud.net/PublicHubList.xml.bz2;http://dclist.eu.nyud.net/hublist.xml.bz2;http://download.hublist.cz.nyud.net/hublist.xml.bz2;http://hublist.awenet.info.nyud.net/PublicHubList.xml.bz2"); setDefault(DOWNLOAD_SLOTS, 3); setDefault(MAX_DOWNLOAD_SPEED, 0); setDefault(LOG_DIRECTORY, Util::getConfigPath() + "Logs" PATH_SEPARATOR_STR); Modified: dcplusplus/trunk/win32/AboutDlg.cpp =================================================================== --- dcplusplus/trunk/win32/AboutDlg.cpp 2008-02-10 19:19:16 UTC (rev 1001) +++ dcplusplus/trunk/win32/AboutDlg.cpp 2008-02-10 21:35:52 UTC (rev 1002) @@ -67,7 +67,7 @@ centerWindow(); c.addListener(this); - c.downloadFile("http://dcplusplus.sourceforge.net/version.xml"); + c.downloadFile("http://dcplusplus.sourceforge.net.nyud.net/version.xml"); return false; } Modified: dcplusplus/trunk/win32/MainWindow.cpp =================================================================== --- dcplusplus/trunk/win32/MainWindow.cpp 2008-02-10 19:19:16 UTC (rev 1001) +++ dcplusplus/trunk/win32/MainWindow.cpp 2008-02-10 21:35:52 UTC (rev 1002) @@ -106,7 +106,7 @@ c = new HttpConnection; c->addListener(this); - c->downloadFile("http://dcplusplus.sourceforge.net/version.xml"); + c->downloadFile("http://dcplusplus.sourceforge.net.nyud.net/version.xml"); File::ensureDirectory(SETTING(LOG_DIRECTORY)); startSocket(); @@ -348,9 +348,10 @@ } void MainWindow::handleQuickConnect() { - ///@todo send user to settings - if (SETTING(NICK).empty()) + if (SETTING(NICK).empty()) { + postMessage(WM_COMMAND, IDC_SETTINGS); return; + } LineDlg dlg(this, T_("Quick Connect"), T_("Address")); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <zou...@us...> - 2008-02-11 11:00:40
|
Revision: 1001 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=1001&view=rev Author: zouzou123gen Date: 2008-02-10 11:19:16 -0800 (Sun, 10 Feb 2008) Log Message: ----------- fix ampersands in tab menu titles, revert some changes of r996 Modified Paths: -------------- dcplusplus/trunk/smartwin/SmartUtil/StringUtils.cpp dcplusplus/trunk/smartwin/SmartUtil/StringUtils.h dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetTabSheet.h dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetTabView.h dcplusplus/trunk/smartwin/source/widgets/WidgetTabSheet.cpp dcplusplus/trunk/smartwin/source/widgets/WidgetTabView.cpp dcplusplus/trunk/win32/HubFrame.cpp dcplusplus/trunk/win32/MDIChildFrame.h dcplusplus/trunk/win32/PrivateFrame.cpp Modified: dcplusplus/trunk/smartwin/SmartUtil/StringUtils.cpp =================================================================== --- dcplusplus/trunk/smartwin/SmartUtil/StringUtils.cpp 2008-02-10 00:32:56 UTC (rev 1000) +++ dcplusplus/trunk/smartwin/SmartUtil/StringUtils.cpp 2008-02-10 19:19:16 UTC (rev 1001) @@ -3,12 +3,6 @@ #include "UtilSystemHeaders.h" namespace SmartUtil { - tstring cutText(tstring str, unsigned int maxLength) { - if(str.length() > maxLength) - str = str.substr(0, maxLength - 3) + _T("..."); - return str; - } - tstring escapeMenu(tstring str) { tstring::size_type i = 0; while( (i = str.find(_T('&'), i)) != tstring::npos) { Modified: dcplusplus/trunk/smartwin/SmartUtil/StringUtils.h =================================================================== --- dcplusplus/trunk/smartwin/SmartUtil/StringUtils.h 2008-02-10 00:32:56 UTC (rev 1000) +++ dcplusplus/trunk/smartwin/SmartUtil/StringUtils.h 2008-02-10 19:19:16 UTC (rev 1001) @@ -4,7 +4,6 @@ #include "tstring.h" namespace SmartUtil { -tstring cutText(tstring str, unsigned int maxLength); tstring escapeMenu(tstring str); } Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetTabSheet.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetTabSheet.h 2008-02-10 00:32:56 UTC (rev 1000) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetTabSheet.h 2008-02-10 19:19:16 UTC (rev 1001) @@ -130,12 +130,9 @@ // Commented in AspectSelection int getSelectedIndex() const; - /// Returns the text of the currently selected tab - /** Use this function to retrieve the header text of the currently selected tab. - */ - SmartUtil::tstring getSelectedHeader() const; + SmartUtil::tstring getText(unsigned idx) const; - void setHeader(unsigned idx, const SmartUtil::tstring& text); + void setText(unsigned idx, const SmartUtil::tstring& text); /// Setting the event handler for the "selection changing" event /** The event handler must have the signature "bool foo( WidgetTabSheet * Widget, @@ -322,10 +319,10 @@ TabCtrl_SetCurSel( this->handle(), idx ); } -inline void WidgetTabSheet::setHeader( unsigned index, const SmartUtil::tstring& header ) +inline void WidgetTabSheet::setText( unsigned index, const SmartUtil::tstring& text ) { TCITEM item = { TCIF_TEXT }; - item.pszText = const_cast < TCHAR * >( header.c_str() ); + item.pszText = const_cast < TCHAR * >( text.c_str() ); TabCtrl_SetItem(this->handle(), index, &item); } Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetTabView.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetTabView.h 2008-02-10 00:32:56 UTC (rev 1000) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetTabView.h 2008-02-10 19:19:16 UTC (rev 1001) @@ -44,6 +44,8 @@ WidgetChildWindow* getActive(); void setActive(WidgetChildWindow* w) { setActive(findTab(w)); } + SmartUtil::tstring getTabText(WidgetChildWindow* w); + void onTitleChanged(const std::tr1::function<void (const SmartUtil::tstring&)>& f) { titleChangedFunction = f; } @@ -60,8 +62,6 @@ void create( const Seed & cs = Seed() ); - enum { MAX_TITLE_LENGTH = 20 }; - protected: friend class WidgetCreator<WidgetTabView>; @@ -70,6 +70,8 @@ virtual ~WidgetTabView() { } private: + enum { MAX_TITLE_LENGTH = 20 }; + struct TabInfo { TabInfo(WidgetChildWindow* w_) : w(w_) { } WidgetChildWindow* w; Modified: dcplusplus/trunk/smartwin/source/widgets/WidgetTabSheet.cpp =================================================================== --- dcplusplus/trunk/smartwin/source/widgets/WidgetTabSheet.cpp 2008-02-10 00:32:56 UTC (rev 1000) +++ dcplusplus/trunk/smartwin/source/widgets/WidgetTabSheet.cpp 2008-02-10 19:19:16 UTC (rev 1001) @@ -59,19 +59,17 @@ TabCtrl_SetImageList(handle(), imageList->handle()); } -inline SmartUtil::tstring WidgetTabSheet::getSelectedHeader() const +SmartUtil::tstring WidgetTabSheet::getText(unsigned idx) const { - TCITEM item; - item.mask = TCIF_TEXT; + TCITEM item = { TCIF_TEXT }; TCHAR buffer[200]; item.cchTextMax = 198; item.pszText = buffer; - if ( !TabCtrl_GetItem( this->handle(), getSelectedIndex(), & item ) ) + if ( !TabCtrl_GetItem( this->handle(), idx, & item ) ) { - throw xCeption( _T( "Couldn't retrieve text of currently selected TabSheet item." ) ); + throw xCeption( _T( "Couldn't retrieve text in WidgetTabSheet::getText." ) ); } return buffer; } - } Modified: dcplusplus/trunk/smartwin/source/widgets/WidgetTabView.cpp =================================================================== --- dcplusplus/trunk/smartwin/source/widgets/WidgetTabView.cpp 2008-02-10 00:32:56 UTC (rev 1000) +++ dcplusplus/trunk/smartwin/source/widgets/WidgetTabView.cpp 2008-02-10 19:19:16 UTC (rev 1001) @@ -92,6 +92,13 @@ titleChangedFunction(SmartUtil::tstring()); } +SmartUtil::tstring WidgetTabView::getTabText(WidgetChildWindow* w) { + int i = findTab(w); + if(i != -1) + return tab->getText(i); + return SmartUtil::tstring(); +} + void WidgetTabView::onTabContextMenu(WidgetChildWindow* w, const std::tr1::function<bool (const ScreenCoordinate& pt)>& f) { TabInfo* ti = getTabInfo(w); if(ti) { @@ -174,7 +181,7 @@ bool WidgetTabView::handleTextChanging(WidgetChildWindow* w, const SmartUtil::tstring& newText) { int i = findTab(w); if(i != -1) { - tab->setHeader(i, formatTitle(newText)); + tab->setText(i, formatTitle(newText)); layout(); if((i == active) && titleChangedFunction) @@ -184,7 +191,9 @@ } SmartUtil::tstring WidgetTabView::formatTitle(SmartUtil::tstring title) { - return SmartUtil::escapeMenu(SmartUtil::cutText(title, MAX_TITLE_LENGTH)); + if(title.length() > MAX_TITLE_LENGTH) + title = title.substr(0, MAX_TITLE_LENGTH - 3) + _T("..."); + return SmartUtil::escapeMenu(title); } bool WidgetTabView::handleSized(const WidgetSizedEventResult& sz) { Modified: dcplusplus/trunk/win32/HubFrame.cpp =================================================================== --- dcplusplus/trunk/win32/HubFrame.cpp 2008-02-10 00:32:56 UTC (rev 1000) +++ dcplusplus/trunk/win32/HubFrame.cpp 2008-02-10 19:19:16 UTC (rev 1001) @@ -1168,7 +1168,7 @@ bool HubFrame::handleTabContextMenu(const SmartWin::ScreenCoordinate& pt) { WidgetMenuExtendedPtr menu = createExtendedMenu(WinUtil::Seeds::menuExtended); - menu->setTitle(SmartUtil::cutText(getText(), SmartWin::WidgetTabView::MAX_TITLE_LENGTH)); + menu->setTitle(getParent()->getTabText(this)); if(!FavoriteManager::getInstance()->isFavoriteHub(url)) { menu->appendItem(IDC_ADD_TO_FAVORITES, T_("Add To &Favorites"), std::tr1::bind(&HubFrame::addAsFavorite, this), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_FAVORITE_HUBS))); Modified: dcplusplus/trunk/win32/MDIChildFrame.h =================================================================== --- dcplusplus/trunk/win32/MDIChildFrame.h 2008-02-10 00:32:56 UTC (rev 1000) +++ dcplusplus/trunk/win32/MDIChildFrame.h 2008-02-10 19:19:16 UTC (rev 1001) @@ -187,7 +187,7 @@ bool handleContextMenu(const SmartWin::ScreenCoordinate& pt) { SmartWin::WidgetMenuExtended::ObjectType menu = createExtendedMenu(WinUtil::Seeds::menuExtended); - menu->setTitle(SmartUtil::cutText(getText(), SmartWin::WidgetTabView::MAX_TITLE_LENGTH)); + menu->setTitle(getParent()->getTabText(this)); menu->appendItem(IDC_CLOSE_WINDOW, T_("&Close"), std::tr1::bind(&ThisType::close, this, true), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_EXIT))); menu->trackPopupMenu(this, pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON); return true; Modified: dcplusplus/trunk/win32/PrivateFrame.cpp =================================================================== --- dcplusplus/trunk/win32/PrivateFrame.cpp 2008-02-10 00:32:56 UTC (rev 1000) +++ dcplusplus/trunk/win32/PrivateFrame.cpp 2008-02-10 19:19:16 UTC (rev 1001) @@ -375,7 +375,7 @@ bool PrivateFrame::handleTabContextMenu(const SmartWin::ScreenCoordinate& pt) { WidgetMenuExtendedPtr menu = createExtendedMenu(WinUtil::Seeds::menuExtended); - menu->setTitle(SmartUtil::cutText(getText(), SmartWin::WidgetTabView::MAX_TITLE_LENGTH)); + menu->setTitle(getParent()->getTabText(this)); menu->appendItem(IDC_GETLIST, T_("&Get file list"), std::tr1::bind(&PrivateFrame::handleGetList, this)); menu->appendItem(IDC_MATCH_QUEUE, T_("&Match queue"), std::tr1::bind(&PrivateFrame::handleMatchQueue, this)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <zou...@us...> - 2008-02-11 13:03:09
|
Revision: 1000 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=1000&view=rev Author: zouzou123gen Date: 2008-02-09 16:32:56 -0800 (Sat, 09 Feb 2008) Log Message: ----------- scroll fixes Modified Paths: -------------- dcplusplus/trunk/smartwin/include/smartwin/aspects/AspectScrollable.h dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetTextBox.h dcplusplus/trunk/win32/HubFrame.cpp dcplusplus/trunk/win32/PrivateFrame.cpp dcplusplus/trunk/win32/SystemFrame.cpp Modified: dcplusplus/trunk/smartwin/include/smartwin/aspects/AspectScrollable.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/aspects/AspectScrollable.h 2008-02-09 22:14:47 UTC (rev 999) +++ dcplusplus/trunk/smartwin/include/smartwin/aspects/AspectScrollable.h 2008-02-10 00:32:56 UTC (rev 1000) @@ -44,6 +44,8 @@ { typedef Dispatchers::VoidVoid<> Dispatcher; public: + bool scrollIsAtEnd(); + /// \ingroup EventHandlersAspectScrollable /// Setting the event handler for the "scrolling horizontally" event /** A scrolling event occurs when for instance a WidgetSliders value is being @@ -75,6 +77,18 @@ {} }; +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Implementation of class +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +template< class WidgetType > +bool AspectScrollable< WidgetType >::scrollIsAtEnd() +{ + SCROLLINFO scrollInfo = { sizeof(SCROLLINFO), SIF_RANGE | SIF_PAGE | SIF_POS }; + BOOL ret = ::GetScrollInfo(static_cast<WidgetType*>(this)->handle(), SB_VERT, &scrollInfo); + xAssert(ret != FALSE, _T("Can't get scroll info in scrollIsAtEnd")); + return (scrollInfo.nPos == static_cast<int>(scrollInfo.nMax - std::max(scrollInfo.nPage - 1, 0u))); +} + // end namespace SmartWin } Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetTextBox.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetTextBox.h 2008-02-09 22:14:47 UTC (rev 999) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetTextBox.h 2008-02-10 00:32:56 UTC (rev 1000) @@ -34,6 +34,7 @@ #include "../aspects/AspectControl.h" #include "../aspects/AspectFocus.h" #include "../aspects/AspectFont.h" +#include "../aspects/AspectScrollable.h" #include "../aspects/AspectText.h" #include "../aspects/AspectUpdate.h" @@ -70,6 +71,7 @@ public AspectControl< WidgetTextBoxBase >, public AspectFocus< WidgetTextBoxBase >, public AspectFont< WidgetTextBoxBase >, + public AspectScrollable< WidgetTextBoxBase >, public AspectText< WidgetTextBoxBase >, public AspectUpdate< WidgetTextBoxBase > { Modified: dcplusplus/trunk/win32/HubFrame.cpp =================================================================== --- dcplusplus/trunk/win32/HubFrame.cpp 2008-02-09 22:14:47 UTC (rev 999) +++ dcplusplus/trunk/win32/HubFrame.cpp 2008-02-10 00:32:56 UTC (rev 1000) @@ -203,6 +203,8 @@ } void HubFrame::layout() { + bool scroll = chat->scrollIsAtEnd(); + const int border = 2; SmartWin::Rectangle r(getClientAreaSize()); @@ -233,6 +235,9 @@ paned->setSecond(0); } paned->setRect(r); + + if(scroll) + chat->sendMessage(WM_VSCROLL, SB_BOTTOM); } void HubFrame::updateStatus() { @@ -415,11 +420,7 @@ } line += Text::toDOS(aLine); - SCROLLINFO scrollInfo = { sizeof(SCROLLINFO), SIF_RANGE | SIF_PAGE | SIF_POS }; - bool scroll = ( - (::GetScrollInfo(chat->handle(), SB_VERT, &scrollInfo) == 0) || // on error, let's keep scrolling... - (scrollInfo.nPos == (scrollInfo.nMax - max(scrollInfo.nPage - 1, 0u))) // scroll only if the current scroll position is at the end - ); + bool scroll = chat->scrollIsAtEnd(); HoldRedraw hold(chat, !scroll); size_t limit = chat->getTextLimit(); Modified: dcplusplus/trunk/win32/PrivateFrame.cpp =================================================================== --- dcplusplus/trunk/win32/PrivateFrame.cpp 2008-02-09 22:14:47 UTC (rev 999) +++ dcplusplus/trunk/win32/PrivateFrame.cpp 2008-02-10 00:32:56 UTC (rev 1000) @@ -144,11 +144,7 @@ } line += aLine; - SCROLLINFO scrollInfo = { sizeof(SCROLLINFO), SIF_RANGE | SIF_PAGE | SIF_POS }; - bool scroll = ( - (::GetScrollInfo(chat->handle(), SB_VERT, &scrollInfo) == 0) || // on error, let's keep scrolling... - (scrollInfo.nPos == (scrollInfo.nMax - max(scrollInfo.nPage - 1, 0u))) // scroll only if the current scroll position is at the end - ); + bool scroll = chat->scrollIsAtEnd(); HoldRedraw hold(chat, !scroll); size_t limit = chat->getTextLimit(); @@ -228,6 +224,8 @@ } void PrivateFrame::layout() { + bool scroll = chat->scrollIsAtEnd(); + const int border = 2; SmartWin::Rectangle r(getClientAreaSize()); @@ -240,6 +238,9 @@ r.size.y -= rm.size.y + border; chat->setBounds(r); + + if(scroll) + chat->sendMessage(WM_VSCROLL, SB_BOTTOM); } void PrivateFrame::updateTitle() { Modified: dcplusplus/trunk/win32/SystemFrame.cpp =================================================================== --- dcplusplus/trunk/win32/SystemFrame.cpp 2008-02-09 22:14:47 UTC (rev 999) +++ dcplusplus/trunk/win32/SystemFrame.cpp 2008-02-10 00:32:56 UTC (rev 1000) @@ -52,26 +52,34 @@ } void SystemFrame::addLine(time_t t, const tstring& msg) { - int limit = log->getTextLimit(); - if(log->length() + static_cast<int>(msg.size()) > limit) { - HoldRedraw hold(log); + bool scroll = log->scrollIsAtEnd(); + HoldRedraw hold(log, !scroll); + + size_t limit = log->getTextLimit(); + if(log->length() + msg.size() > limit) { + HoldRedraw hold2(log, scroll); log->setSelection(0, log->lineIndex(log->lineFromChar(limit / 10))); log->replaceSelection(_T("")); } log->addTextLines(Text::toT("\r\n[" + Util::getShortTimeString(t) + "] ") + msg); - log->sendMessage(WM_VSCROLL, SB_BOTTOM); + if(scroll) + log->sendMessage(WM_VSCROLL, SB_BOTTOM); + setDirty(SettingsManager::BOLD_SYSTEM_LOG); } void SystemFrame::layout() { - const int border = 2; + bool scroll = log->scrollIsAtEnd(); SmartWin::Rectangle r(this->getClientAreaSize()); layoutStatus(r); log->setBounds(r); + + if(scroll) + log->sendMessage(WM_VSCROLL, SB_BOTTOM); } HRESULT SystemFrame::handleSpeaker(WPARAM wp, LPARAM lp) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <zou...@us...> - 2008-02-11 13:03:22
|
Revision: 997 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=997&view=rev Author: zouzou123gen Date: 2008-02-09 04:12:59 -0800 (Sat, 09 Feb 2008) Log Message: ----------- WinUtil::Seeds::menuExtended to remember the bitmap background Modified Paths: -------------- dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetMenuExtended.h dcplusplus/trunk/win32/HubFrame.cpp dcplusplus/trunk/win32/MDIChildFrame.h dcplusplus/trunk/win32/MainWindow.cpp dcplusplus/trunk/win32/PrivateFrame.cpp dcplusplus/trunk/win32/WinUtil.cpp dcplusplus/trunk/win32/WinUtil.h Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetMenuExtended.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetMenuExtended.h 2008-02-08 17:19:21 UTC (rev 996) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetMenuExtended.h 2008-02-09 12:12:59 UTC (rev 997) @@ -174,8 +174,7 @@ typedef std::tr1::shared_ptr< MenuType > WidgetMenuExtendedPtr; struct Seed { - Seed(bool popup_, const MenuColorInfo& colorInfo_) : popup(popup_), colorInfo(colorInfo_) { } - Seed() : popup(false) { } + Seed(const MenuColorInfo& colorInfo_ = MenuColorInfo()) : popup(true), colorInfo(colorInfo_) { } bool popup; MenuColorInfo colorInfo; }; @@ -565,7 +564,7 @@ { // create popup menu pointer WidgetMenuExtendedPtr retVal ( new MenuType(this->itsParent) ); - retVal->create( Seed(true, itsColorInfo) ); + retVal->create( Seed(itsColorInfo) ); // init structure for new item MENUITEMINFO info; Modified: dcplusplus/trunk/win32/HubFrame.cpp =================================================================== --- dcplusplus/trunk/win32/HubFrame.cpp 2008-02-08 17:19:21 UTC (rev 996) +++ dcplusplus/trunk/win32/HubFrame.cpp 2008-02-09 12:12:59 UTC (rev 997) @@ -1170,10 +1170,7 @@ } bool HubFrame::handleTabContextMenu(const SmartWin::ScreenCoordinate& pt) { - WidgetMenuExtended::Seed cs; - cs.popup = true; - cs.colorInfo.colorImageBackground = RGB(255, 0, 255); // DC++ bitmaps use RGB(255, 0, 255) as their background (transparent) color - WidgetMenuExtendedPtr menu = createExtendedMenu(cs); + WidgetMenuExtendedPtr menu = createExtendedMenu(WinUtil::Seeds::menuExtended); menu->setTitle(SmartUtil::cutText(getText(), SmartWin::WidgetTabView::MAX_TITLE_LENGTH)); Modified: dcplusplus/trunk/win32/MDIChildFrame.h =================================================================== --- dcplusplus/trunk/win32/MDIChildFrame.h 2008-02-08 17:19:21 UTC (rev 996) +++ dcplusplus/trunk/win32/MDIChildFrame.h 2008-02-09 12:12:59 UTC (rev 997) @@ -186,10 +186,7 @@ } bool handleContextMenu(const SmartWin::ScreenCoordinate& pt) { - WidgetMenuExtended::Seed cs; - cs.popup = true; - cs.colorInfo.colorImageBackground = RGB(255, 0, 255); // DC++ bitmaps use RGB(255, 0, 255) as their background (transparent) color - SmartWin::WidgetMenuExtended::ObjectType menu = createExtendedMenu(cs); + SmartWin::WidgetMenuExtended::ObjectType menu = createExtendedMenu(WinUtil::Seeds::menuExtended); menu->setTitle(SmartUtil::cutText(getText(), SmartWin::WidgetTabView::MAX_TITLE_LENGTH)); menu->appendItem(IDC_CLOSE_WINDOW, T_("&Close"), std::tr1::bind(&ThisType::close, this, true), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_EXIT))); menu->trackPopupMenu(this, pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON); Modified: dcplusplus/trunk/win32/MainWindow.cpp =================================================================== --- dcplusplus/trunk/win32/MainWindow.cpp 2008-02-08 17:19:21 UTC (rev 996) +++ dcplusplus/trunk/win32/MainWindow.cpp 2008-02-09 12:12:59 UTC (rev 997) @@ -178,8 +178,8 @@ dcdebug("initMenu\n"); { - WidgetMenuExtended::Seed cs; - cs.colorInfo.colorImageBackground = RGB(255, 0, 255); // DC++ bitmaps use RGB(255, 0, 255) as their background (transparent) color + WidgetMenuExtended::Seed cs = WinUtil::Seeds::menuExtended; + cs.popup = false; mainMenu = createExtendedMenu(cs); } Modified: dcplusplus/trunk/win32/PrivateFrame.cpp =================================================================== --- dcplusplus/trunk/win32/PrivateFrame.cpp 2008-02-08 17:19:21 UTC (rev 996) +++ dcplusplus/trunk/win32/PrivateFrame.cpp 2008-02-09 12:12:59 UTC (rev 997) @@ -360,10 +360,7 @@ } bool PrivateFrame::handleTabContextMenu(const SmartWin::ScreenCoordinate& pt) { - WidgetMenuExtended::Seed cs; - cs.popup = true; - cs.colorInfo.colorImageBackground = RGB(255, 0, 255); // DC++ bitmaps use RGB(255, 0, 255) as their background (transparent) color - WidgetMenuExtendedPtr menu = createExtendedMenu(cs); + WidgetMenuExtendedPtr menu = createExtendedMenu(WinUtil::Seeds::menuExtended); menu->setTitle(SmartUtil::cutText(getText(), SmartWin::WidgetTabView::MAX_TITLE_LENGTH)); Modified: dcplusplus/trunk/win32/WinUtil.cpp =================================================================== --- dcplusplus/trunk/win32/WinUtil.cpp 2008-02-08 17:19:21 UTC (rev 996) +++ dcplusplus/trunk/win32/WinUtil.cpp 2008-02-09 12:12:59 UTC (rev 997) @@ -62,6 +62,7 @@ const SmartWin::WidgetComboBox::Seed WinUtil::Seeds::comboBoxStatic; const SmartWin::WidgetComboBox::Seed WinUtil::Seeds::comboBoxEdit; const SmartWin::WidgetListView::Seed WinUtil::Seeds::listView; +const SmartWin::WidgetMenuExtended::Seed WinUtil::Seeds::menuExtended; const SmartWin::WidgetTextBox::Seed WinUtil::Seeds::textBox; const SmartWin::WidgetTreeView::Seed WinUtil::Seeds::treeView; @@ -123,6 +124,7 @@ SmartWin::WidgetComboBox::Seed& xcomboBoxEdit = const_cast<SmartWin::WidgetComboBox::Seed&>(Seeds::comboBoxEdit); SmartWin::WidgetComboBox::Seed& xcomboBoxStatic = const_cast<SmartWin::WidgetComboBox::Seed&>(Seeds::comboBoxStatic); SmartWin::WidgetListView::Seed& xlistView = const_cast<SmartWin::WidgetListView::Seed&>(Seeds::listView); + SmartWin::WidgetMenuExtended::Seed& xmenuExtended = const_cast<SmartWin::WidgetMenuExtended::Seed&>(Seeds::menuExtended); SmartWin::WidgetTextBox::Seed& xtextBox = const_cast<SmartWin::WidgetTextBox::Seed&>(Seeds::textBox); SmartWin::WidgetTreeView::Seed& xtreeView = const_cast<SmartWin::WidgetTreeView::Seed&>(Seeds::treeView); @@ -133,7 +135,10 @@ xlistView.exStyle = WS_EX_CLIENTEDGE; xlistView.lvStyle = LVS_EX_HEADERDRAGDROP | LVS_EX_FULLROWSELECT | LVS_EX_LABELTIP | LVS_EX_DOUBLEBUFFER; xlistView.font = font; - + + // DC++ bitmaps use RGB(255, 0, 255) as their background (transparent) color + xmenuExtended.colorInfo.colorImageBackground = RGB(255, 0, 255); + xtextBox.exStyle = WS_EX_CLIENTEDGE; xtextBox.font = font; Modified: dcplusplus/trunk/win32/WinUtil.h =================================================================== --- dcplusplus/trunk/win32/WinUtil.h 2008-02-08 17:19:21 UTC (rev 996) +++ dcplusplus/trunk/win32/WinUtil.h 2008-02-09 12:12:59 UTC (rev 997) @@ -71,6 +71,7 @@ static const SmartWin::WidgetComboBox::Seed comboBoxStatic; static const SmartWin::WidgetComboBox::Seed comboBoxEdit; static const SmartWin::WidgetListView::Seed listView; + static const SmartWin::WidgetMenuExtended::Seed menuExtended; static const SmartWin::WidgetTextBox::Seed textBox; static const SmartWin::WidgetTreeView::Seed treeView; }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <zou...@us...> - 2008-02-11 14:47:47
|
Revision: 1003 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=1003&view=rev Author: zouzou123gen Date: 2008-02-11 06:47:45 -0800 (Mon, 11 Feb 2008) Log Message: ----------- extended menus everywhere, option to use basic menus Modified Paths: -------------- dcplusplus/trunk/dcpp/SettingsManager.cpp dcplusplus/trunk/dcpp/SettingsManager.h dcplusplus/trunk/smartwin/include/smartwin/GCCHeaders.h dcplusplus/trunk/smartwin/include/smartwin/WidgetFactory.h dcplusplus/trunk/smartwin/include/smartwin/WidgetFactoryPlatformSmartWinDesktop.h dcplusplus/trunk/smartwin/source/widgets/WidgetTabView.cpp dcplusplus/trunk/win32/ADLSearchFrame.cpp dcplusplus/trunk/win32/AdvancedPage.cpp dcplusplus/trunk/win32/DirectoryListingFrame.cpp dcplusplus/trunk/win32/FavHubsFrame.cpp dcplusplus/trunk/win32/FavHubsFrame.h dcplusplus/trunk/win32/FinishedFrameBase.h dcplusplus/trunk/win32/HubFrame.cpp dcplusplus/trunk/win32/MDIChildFrame.h dcplusplus/trunk/win32/MainWindow.cpp dcplusplus/trunk/win32/MainWindow.h dcplusplus/trunk/win32/PrivateFrame.cpp dcplusplus/trunk/win32/PublicHubsFrame.cpp dcplusplus/trunk/win32/QueueFrame.cpp dcplusplus/trunk/win32/QueueFrame.h dcplusplus/trunk/win32/SearchFrame.cpp dcplusplus/trunk/win32/ShellContextMenu.cpp dcplusplus/trunk/win32/SpyFrame.cpp dcplusplus/trunk/win32/SpyFrame.h dcplusplus/trunk/win32/TransferView.cpp dcplusplus/trunk/win32/UserInfoBase.h dcplusplus/trunk/win32/UsersFrame.cpp dcplusplus/trunk/win32/WaitingUsersFrame.cpp dcplusplus/trunk/win32/WinUtil.cpp dcplusplus/trunk/win32/WinUtil.h Added Paths: ----------- dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetMenu.h dcplusplus/trunk/smartwin/source/widgets/WidgetMenu.cpp Removed Paths: ------------- dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetMenu.h dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetMenuExtended.h dcplusplus/trunk/smartwin/source/widgets/WidgetMenu.cpp dcplusplus/trunk/smartwin/source/widgets/WidgetMenuExtended.cpp Modified: dcplusplus/trunk/dcpp/SettingsManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/SettingsManager.cpp 2008-02-10 21:35:52 UTC (rev 1002) +++ dcplusplus/trunk/dcpp/SettingsManager.cpp 2008-02-11 14:47:45 UTC (rev 1003) @@ -77,7 +77,7 @@ "UseTLS", "AutoSearchLimit", "AltSortOrder", "AutoKickNoFavs", "PromptPassword", "SpyFrameIgnoreTthSearches", "DontDlAlreadyQueued", "MaxCommandLength", "AllowUntrustedHubs", "AllowUntrustedClients", "TLSPort", "FastHash", "SortFavUsersFirst", "ShowShellMenu", "MinSegmentSize", "FollowLinks", - "SendBloom", + "SendBloom", "OwnerDrawnMenus", "SENTRY", // Int64 "TotalUpload", "TotalDownload", @@ -273,6 +273,7 @@ setDefault(MIN_SEGMENT_SIZE, 1024); setDefault(FOLLOW_LINKS, false); setDefault(SEND_BLOOM, true); + setDefault(OWNER_DRAWN_MENUS, true); #ifdef _WIN32 setDefault(MAIN_WINDOW_STATE, SW_SHOWNORMAL); Modified: dcplusplus/trunk/dcpp/SettingsManager.h =================================================================== --- dcplusplus/trunk/dcpp/SettingsManager.h 2008-02-10 21:35:52 UTC (rev 1002) +++ dcplusplus/trunk/dcpp/SettingsManager.h 2008-02-11 14:47:45 UTC (rev 1003) @@ -90,7 +90,7 @@ USE_TLS, AUTO_SEARCH_LIMIT, ALT_SORT_ORDER, AUTO_KICK_NO_FAVS, PROMPT_PASSWORD, SPY_FRAME_IGNORE_TTH_SEARCHES, DONT_DL_ALREADY_QUEUED, MAX_COMMAND_LENGTH, ALLOW_UNTRUSTED_HUBS, ALLOW_UNTRUSTED_CLIENTS, TLS_PORT, FAST_HASH, SORT_FAVUSERS_FIRST, SHOW_SHELL_MENU, MIN_SEGMENT_SIZE, FOLLOW_LINKS, - SEND_BLOOM, + SEND_BLOOM, OWNER_DRAWN_MENUS, INT_LAST }; enum Int64Setting { INT64_FIRST = INT_LAST + 1, Modified: dcplusplus/trunk/smartwin/include/smartwin/GCCHeaders.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/GCCHeaders.h 2008-02-10 21:35:52 UTC (rev 1002) +++ dcplusplus/trunk/smartwin/include/smartwin/GCCHeaders.h 2008-02-11 14:47:45 UTC (rev 1003) @@ -81,6 +81,14 @@ #define COLOR_MENUBAR 30 #define ODS_HOTLIGHT 0x0040 #define ODS_INACTIVE 0x0080 + #if(_WIN32_WINNT >= 0x0500) + #ifndef ODS_NOACCEL + #define ODS_NOACCEL 0x0100 + #endif + #ifndef DT_HIDEPREFIX + #define DT_HIDEPREFIX 0x00100000 + #endif + #endif // Additional (gcc, normally) stuff Modified: dcplusplus/trunk/smartwin/include/smartwin/WidgetFactory.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/WidgetFactory.h 2008-02-10 21:35:52 UTC (rev 1002) +++ dcplusplus/trunk/smartwin/include/smartwin/WidgetFactory.h 2008-02-11 14:47:45 UTC (rev 1003) @@ -42,7 +42,6 @@ #include "widgets/WidgetMDIChild.h" #include "widgets/WidgetMDIFrame.h" #include "widgets/WidgetMDIParent.h" -#include "widgets/WidgetMenu.h" #include "widgets/WidgetMessageBox.h" #include "widgets/WidgetProgressBar.h" #include "widgets/WidgetRadioButton.h" @@ -202,12 +201,6 @@ /// Static object type. typedef typename WidgetStatic::ObjectType WidgetStaticPtr; - /// Menu class type. - typedef SmartWin::WidgetMenu WidgetMenu; - - /// Menu object type. - typedef typename WidgetMenu::ObjectType WidgetMenuPtr; - /// CheckBox class type. typedef SmartWin::WidgetCheckBox WidgetCheckBox; @@ -325,12 +318,6 @@ */ WidgetTreeViewPtr attachTreeView( unsigned id ); - /// Creates a Menu and returns a pointer to it. - /** The returned object is of type std::tr1::shared_ptr< WidgetMenu >, but you should use the typedef WidgetMenuPtr and not < br > - * the shared_ptr itself since this may change in future releases. - */ - WidgetMenuPtr createMenu(const typename WidgetMenu::Seed& cs = WidgetMenu::Seed()); - /// Creates a Edit Control and returns a pointer to it. /** DON'T delete the returned pointer!!! */ @@ -577,13 +564,6 @@ } template<typename ContainerWidgetType> -typename WidgetFactory< ContainerWidgetType >::WidgetMenuPtr -WidgetFactory< ContainerWidgetType >::createMenu(const typename WidgetMenu::Seed & cs) -{ - return WidgetCreator< WidgetMenu >::create( cs ); -} - -template<typename ContainerWidgetType> typename WidgetFactory< ContainerWidgetType >::WidgetTextBoxPtr WidgetFactory< ContainerWidgetType >::createTextBox( const typename WidgetTextBox::Seed & cs ) { Modified: dcplusplus/trunk/smartwin/include/smartwin/WidgetFactoryPlatformSmartWinDesktop.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/WidgetFactoryPlatformSmartWinDesktop.h 2008-02-10 21:35:52 UTC (rev 1002) +++ dcplusplus/trunk/smartwin/include/smartwin/WidgetFactoryPlatformSmartWinDesktop.h 2008-02-11 14:47:45 UTC (rev 1003) @@ -32,7 +32,7 @@ #include "WidgetFactoryPlatformCommon.h" #include "widgets/WidgetRichTextBox.h" #include "widgets/WidgetChooseFont.h" -#include "widgets/WidgetMenuExtended.h" +#include "widgets/WidgetMenu.h" #include "widgets/WidgetToolbar.h" #include "widgets/WidgetCoolbar.h" #include "WidgetCreator.h" @@ -56,11 +56,11 @@ /// RichEditBox object type. typedef typename WidgetRichTextBox::ObjectType WidgetRichTextBoxPtr; - /// ExtendedMenu class type. - typedef SmartWin::WidgetMenuExtended WidgetMenuExtended; + /// Menu class type. + typedef SmartWin::WidgetMenu WidgetMenu; - /// ExtendedMenu object type. - typedef typename WidgetMenuExtended::ObjectType WidgetMenuExtendedPtr; + /// Menu object type. + typedef typename WidgetMenu::ObjectType WidgetMenuPtr; /// ChooseFont class and object type. typedef SmartWin::WidgetChooseFont< SmartWin::Widget > WidgetChooseFont; @@ -113,14 +113,14 @@ return WidgetCreator< WidgetRichTextBox >::attach( this, id ); } - /// Creates an Extended Menu - /** The returned object is of type std::tr1::shared_ptr< WidgetMenuExtended >, but - * you should use the typedef WidgetMenuExtendedPtr and not <br> + /// Creates a Menu + /** The returned object is of type std::tr1::shared_ptr< WidgetMenu >, but + * you should use the typedef WidgetMenuPtr and not <br> * the shared_ptr itself since this may change in future releases. */ - WidgetMenuExtendedPtr createExtendedMenu(const typename WidgetMenuExtended::Seed& cs = WidgetMenuExtended::Seed()) + WidgetMenuPtr createMenu(const typename WidgetMenu::Seed& cs = WidgetMenu::Seed()) { - return WidgetCreator< WidgetMenuExtended >::create( this, cs ); + return WidgetCreator< WidgetMenu >::create( this, cs ); } /// Creates a Tool Bar and returns a pointer to it. Deleted: dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetMenu.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetMenu.h 2008-02-10 21:35:52 UTC (rev 1002) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetMenu.h 2008-02-11 14:47:45 UTC (rev 1003) @@ -1,536 +0,0 @@ -/* - Copyright ( c ) 2005, Thomas Hansen - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met : - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the SmartWin++ nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - ( INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT ( INCLUDING NEGLIGENCE OR OTHERWISE ) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#ifndef WidgetMenu_h -#define WidgetMenu_h - -#include "../Application.h" -#include "../BasicTypes.h" -#include "../Dispatchers.h" -#include "../Widget.h" -#include "../xCeption.h" - -namespace SmartWin -{ -// begin namespace SmartWin - -// Forward declaring friends -template< class WidgetType > -class WidgetCreator; - -class WidgetMenu; - -class WidgetMenuBase : boost::noncopyable { -public: - - HMENU handle() { - return itsHandle; - } -protected: - WidgetMenuBase() : itsHandle(NULL) { } - virtual ~WidgetMenuBase() { - if(itsHandle) { - ::DestroyMenu(itsHandle); - } - } - - // Children, only "popup" menus are supposed to have children - std::vector< std::tr1::shared_ptr<WidgetMenu> > itsChildren; - - HMENU itsHandle; - - typedef std::map<unsigned, Widget::CallbackType> CallbackMap; - CallbackMap callbacks; - - void addCommands(Widget* widget); - -}; - -template< typename WidgetMenuType, enum Platform > -class WidgetMenuPlatformImplementation; - -/// Specialized functions in menu for Windows CE Windows API version -template<typename WidgetMenuType> -class WidgetMenuPlatformImplementation< WidgetMenuType, SmartWinCE > : - public WidgetMenuBase -{ - -public: - struct Seed { - Seed() { } - }; - - typedef std::tr1::shared_ptr< WidgetMenuType > WidgetMenuPtr; - - /// Actually creates the Menu - /** You should call WidgetFactory::createMenu if you instantiate class directly. - * <br> - * Only if you DERIVE from class you should call this function directly. - */ - void create(const typename WidgetMenuType::Seed cs) - { - itsCmdBar = CommandBar_Create( Application::instance().getAppHandle(), this->getParent()->handle(), 1 ); - if ( !itsCmdBar ) - { - xCeption x( _T( "CommandBar_Create in WidgetMenu::create fizzled..." ) ); - throw x; - } - itsHandle = ::CreateMenu(); - if ( !itsHandle ) - { - xCeption x( _T( "CreateMenu in WidgetMenu::create fizzled..." ) ); - throw x; - } - // Why on EARTH this works I have no idea whatsoever, but apparently it does... (casting to string!) - LPTSTR menuName = reinterpret_cast< LPTSTR >( itsHandle ); - CommandBar_InsertMenubarEx( itsCmdBar, reinterpret_cast< HINSTANCE >( 0 ), menuName, 0 ); - - // Since we're defaulting the window creation to no capture and no title we must add the X in the command bar... - CommandBar_AddAdornments( itsCmdBar, 0, 0 ); - } - - /// Appends a popup to the menu - /** Everything you "append" to a menu is added sequentially to the menu! <br> - * This specific "append" function appends a "popup" menu which is a menu - * containg other menus. <br> - * With other words a menu which is not an "option" but rather a new "subgroup". - * <br> - * The "File" menu of most application is for instance a "popup" menu while the - * File/Print is NOT a popup. <br> - * To append items to the popup created call one of the appendItem overloaded - * functions on the returned value of this function. <br> - * Also, although references to all menu objects must be kept ( since they're - * not collected automatically like other Widgets ) <br> - * you don't have to keep a reference to the return value of this function since - * it's being added as a reference to the children list <br> - * of the "this" object. <br> - * See the WidgetMenu sample project for a demonstration. - */ - WidgetMenuPtr appendPopup( const SmartUtil::tstring & name ) - { - WidgetMenuPtr retVal = WidgetMenuPtr( new WidgetMenuType( ) ); - HMENU popup = CreatePopupMenu(); - retVal->itsHandle = reinterpret_cast< HWND >( popup ); - ::AppendMenu( handle(), MF_POPUP, reinterpret_cast< unsigned int >( retVal->handle() ), name.c_str() ); - itsChildren.push_back( retVal ); - retVal->Widget::registerWidget(); - return retVal; - } - - WidgetMenuPlatformImplementation() - : Widget(0), itsCmdBar( 0 ) - {} - - virtual ~WidgetMenuPlatformImplementation() - { - if ( itsCmdBar ) - { - CommandBar_Destroy( itsCmdBar ); - } - } -private: - HWND itsCmdBar; -}; - -/// Specialized functions in menu for desktop Windows API version -template< typename WidgetMenuType > -class WidgetMenuPlatformImplementation< WidgetMenuType, SmartWinDesktop > : - public WidgetMenuBase -{ -protected: - WidgetMenuPlatformImplementation() { } -public: - struct Seed { - Seed(bool popup_) : popup(popup_) { } - Seed() : popup(false) { } - bool popup; - }; - - typedef std::tr1::shared_ptr< WidgetMenuType > WidgetMenuPtr; - - /// Attaches the menu to a parent window - /** Note! Menus can be switched between at runtime, you can have several menus - * that the EventHandlerClass switches between. <br> - * This can be done by attaching another menu object. <br> - * For an example of this see the WidgetMenu project. - */ - void attach( Widget * mainWindow ) - { - addCommands(mainWindow); - ::SetMenu( mainWindow->handle(), handle() ); - } - - /// Actually creates the Menu - /** You should call WidgetFactory::createMenu if you instantiate class directly. - * <br> - * Only if you DERIVE from class you should call this function directly. - */ - void create(const Seed& cs) - { - if(cs.popup) { - itsHandle = ::CreatePopupMenu(); - } else { - itsHandle = ::CreateMenu(); - } - if ( !itsHandle ) - { - xCeption x( _T( "CreateMenu in WidgetManu::create fizzled..." ) ); - throw x; - } - } - - /// Appends a popup to the menu - /** Everything you "append" to a menu is added sequentially to the menu <br> - * This specific "append" function appends a "popup" menu which is a menu - * containg other menus. <br> - * With other words a menu which is not an "option" but rather a new "subgroup". - * <br> - * The "File" menu of most application is for instance a "popup" menu while the - * File/Print is often NOT a popup. <br> - * To append items to the popup created call one of the appendItem overloaded - * functions on the returned value of this function. <br> - * Also, although references to all menu objects must be kept ( since they're - * not collected automatically like other Widgets ) <br> - * you don't have to keep a reference to the return value of this function since - * it's being added as a reference to the children list <br> - * of the "this" object. <br> - * See the WidgetMenu project for a demonstration. - */ - WidgetMenuPtr appendPopup( const SmartUtil::tstring & name ) - { - - WidgetMenuPtr retVal = WidgetMenuPtr( new WidgetMenuType( ) ); - - retVal->create(Seed(true)); - ::AppendMenu( handle(), MF_POPUP, reinterpret_cast< unsigned int >( retVal->handle() ), name.c_str() ); - itsChildren.push_back( retVal ); - return retVal; - } - - /// Returns the "System Menu" - /** The system menu is a special menu that ( normally ) is accessed by pressing - * the "window icon" at the top left of the window. <br> - * In SmartWin++ this menu can ALSO be easily manipulated and added items to - * etc... <br> - * Also, although references to all menu objects must be kept ( since they're - * not collected automatically like other Widgets ) <br> - * you don't have to keep a reference to the return value of this function since - * it's being added as a reference to the children list <br> - * of the "this" object. <br> - * See the WidgetMenu sample project for a demonstration. - */ -#ifdef PORT_ME - WidgetMenuPtr getSystemMenu() - { - HMENU h = ::GetSystemMenu( internal_::getTypedParentOrThrow < EventHandlerClass * >( this )->handle(), FALSE ); - WidgetMenuPtr sysMenu( new WidgetMenu( this->getParent() ) ); - sysMenu->Widget::itsHandle = reinterpret_cast< HWND >( h ); - sysMenu->Widget::registerWidget(); - sysMenu->isSysMenu = true; - - // We're assuming that the system menu has the same lifespan as the "this" - // menu, we must keep a reference to te system menu otherwise it will be - // "lost", therefore we add it up as a child to the "this" menu... - itsChildren.push_back( sysMenu ); - return sysMenu; - } -#endif -}; - -/// Menu class -/** \ingroup WidgetControls - * \WidgetUsageInfo - * \image html menu.PNG - * Class for creating a Menu Control which then can be attached to a WidgetWindow. - * <br> - * Note for Desktop applications only! <br> - * After you have created a menu you must call WidgetMenu::attach() to make it - * "attach" to the WidgetWindow you want it to belong to. <br> - * Related class : <br> - * WidgetMenuExtended - */ -class WidgetMenu : - public WidgetMenuPlatformImplementation< WidgetMenu, CurrentPlatform >, - public boost::enable_shared_from_this<WidgetMenu > -{ -protected: - typedef WidgetMenuPlatformImplementation< WidgetMenu, CurrentPlatform > PlatformImplementation; - - // friends - friend class WidgetMenuPlatformImplementation< WidgetMenu, CurrentPlatform >; - friend class WidgetCreator< WidgetMenu >; -public: - - WidgetMenu(); - - struct IdDispatcher - { - typedef std::tr1::function<void (unsigned)> F; - - IdDispatcher(const F& f_) : f(f_) { } - - bool operator()(const MSG& msg, LRESULT& ret) { - f(LOWORD(msg.wParam)); - return true; - } - - F f; - }; - - typedef Dispatchers::VoidVoid<> SimpleDispatcher; - - /// Class type - typedef WidgetMenu ThisType; - - /// Object type - typedef PlatformImplementation::WidgetMenuPtr ObjectType; - - /// Creational info - typedef PlatformImplementation::Seed Seed; - /// \ingroup eventsSignatures - - /// \ingroup EventHandlersWidgetMenu - /// Appends a "normal" menu item - /** eventHandler is the function that will receive the "click" event from the - * menu item. <br> - * Event handler's signature must be "void foo(unsigned int )" - * and it must be contained as a member <br> - * of the class that is defined as the EventHandlerClass, normally either the - * WidgetWindow derived class or the class derived from WidgetMenu. <br> - * See e.g. WidgetFun for an example. <br> - * The reason to why we have this "id" is because the same event handler can be - * defined for several menu items <br> - * even in fact across menu objects, therefore this number should be unique - * across the application. - */ - void appendItem( unsigned int id, const SmartUtil::tstring & name, const IdDispatcher::F& f ) { - appendItem(id, name, (ULONG_PTR)0, f); - } - void appendItem( unsigned int id, const SmartUtil::tstring & name, ULONG_PTR data, const IdDispatcher::F& f ); - void appendItem( unsigned int id, const SmartUtil::tstring & name, ULONG_PTR data, const SimpleDispatcher::F& f ); - void appendItem( unsigned int id, const SmartUtil::tstring& name, ULONG_PTR data = NULL); - - ULONG_PTR getData(unsigned int id, bool byPosition = false); - - /// Appends a separator item to the menu - /** A menu separator is basically just "air" between menu items. <br> - * A separator cannot be "clicked" or "chosen". - */ - void appendSeparatorItem(); - - /// Returns the text of a specific menu item - /** Which menu item you wish to retrieve the text for is defined by the "id" - * parameter of the function. - */ - SmartUtil::tstring getText( unsigned idOrPos, bool byPos ); - - /// Sets the text of a specific menu item - /** Which menu item you wish to set the text is defined by the "id" - * parameter of the function. - */ - void setText( unsigned id, const SmartUtil::tstring& text ); - - /// Checks (or uncheck) a specific menu item - /** Which menu item you wish to check ( or uncheck ) is passed in as the "id" - * parameter. <br> - * If the "value" parameter is true the item will be checked, otherwise it will - * be unchecked - */ - void checkItem( unsigned id, bool value = true ); - - /// Returns a boolean indicating if a specific menu item is checked or not - /** Which menu item you wish to check must be passed as the "id" parameter of the - * function - */ - bool getCheckedState( unsigned id ); - - /// Enables (or disables) a specific menu item - /** Which menu item you wish to enable ( or disable ) is passed in as the "id" - * parameter. <br> - * If the "value" parameter is true the item becomes enabled, otherwise disabled - */ - void setItemEnabled( unsigned id, bool value = true ); - - /// Returns a boolean indicating if a specific menu item is enabled or not - /** Which menu item you wish to check must be passed as the "id" parameter to the - * function. - */ - bool getItemEnabled( unsigned id ); - - /// Return the id associated with a certain position - UINT getId(unsigned postition); - - /// Return the number of items in the menu - int getCount(); - - UINT getMenuState(UINT id, bool byPosition = false); - - /// Return true if the item is a separator (by position) - bool isSeparator(UINT id, bool byPosition = false); - /// Return true if the menu item is checked - bool isChecked(UINT id, bool byPosition = false); - /// Return true if the menu item is a popup menu - bool isPopup(UINT id, bool byPosition = false); - /// Return true if the menu item is enabled (not grey and not disabled) - bool isEnabled(UINT id, bool byPosition = false); - - void setDefaultItem(UINT id, bool byPosition = false); - - ObjectType getChild(UINT position); - - /// Displays and handles a menu which can appear anywhere in the window. - /** Typically called by a Right Mouse click. If both the x and the y coordinates - * are - 1 ( default ), it'll show the context menu at the mouse position when - * the system last received a message, basically the "right" place. Depending on - * the flags it might return the id of the menu item selected, or 0 if none was - * chosen. Flags with TPM_RETURNCMD will return the menu - item, but not call - * the Event Handler. - * < ul > - * < li >TPM_CENTERALIGN : Centers the shortcut menu horizontally relative to the coordinate specified by the x parameter< /li > - * < li >TPM_LEFTALIGN : Function positions the shortcut menu so that its left side is aligned with the coordinate specified by the x parameter< /li > - * < li >TPM_RIGHTALIGN : Opposite of LEFTALIGN< /li > - * < li >TPM_BOTTOMALIGN : Aligns menu bottoms to the coordinate specified by the y parameter< /li > - * < li >TPM_TOPALIGN : Opposite of BOTTOMALIGN< /li > - * < li >TPM_VCENTERALIGN : Centers vertically relative to the y parameter< /li > - * < li >TPM_NONOTIFY : Restricts the menu from sending notifications when user clicks item< /li > - * < li >TPM_RETURNCMD : returns the menu item identifier of the user's selection in the return value but DOES NOT carry out the event handler< /li > - * < li >TPM_LEFTBUTTON : Restricts users to selecting menu items with only left mouse button< /li > - * < li >TPM_RIGHTBUTTON : User can choose menu item with both mouse buttons< /li > - * < /ul > - * None of the following are used by default but can be manually chosen if you - * manually call SystemParametersInfo - * < ul > - * < li >TPM_HORNEGANIMATION : Animates the menu from right to left< /li > - * < li >TPM_HORPOSANIMATION : Animates the menu from left to right< /li > - * < li >TPM_NOANIMATION : Displays menu without animation< /li > - * < li >TPM_VERNEGANIMATION : Animates the menu from bottom to top< /li > - * < li >TPM_VERPOSANIMATION : Animates the menu from top to bottom< /li > - * < /ul > - */ - unsigned trackPopupMenu( Widget * mainWindow, const ScreenCoordinate& sc, unsigned flags = 0 ); - - bool isSystemMenu() - { - return isSysMenu; - } - -private: - // True is menu is "system menu" (icon in top left of window) - bool isSysMenu; -}; - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Implementation of class -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -inline ULONG_PTR WidgetMenu::getData(unsigned int id, bool byPosition) { - MENUITEMINFO mii = { sizeof(MENUITEMINFO) }; - mii.fMask = MIIM_DATA; - ::GetMenuItemInfo(this->handle(), id, byPosition, &mii); - return mii.dwItemData; -} - -inline void WidgetMenu::appendSeparatorItem() -{ - ::AppendMenu( this->handle(), MF_SEPARATOR, 0, 0 ); -} - -inline UINT WidgetMenu::getId(UINT position) -{ - return ::GetMenuItemID( this->handle(), position ); -} - -inline void WidgetMenu::checkItem( unsigned id, bool value ) -{ - ::CheckMenuItem( this->handle(), id, value ? MF_CHECKED : MF_UNCHECKED ); -} - -inline bool WidgetMenu::getCheckedState( unsigned id ) -{ - return isChecked(id); -} - -inline void WidgetMenu::setItemEnabled( unsigned id, bool value ) -{ - if ( ::EnableMenuItem( this->handle(), id, value ? MF_ENABLED : MF_GRAYED ) == - 1 ) - { - xCeption x( _T( "Couldn't enable/disable the menu item, item doesn't exist" ) ); - throw x; - } -} - -inline bool WidgetMenu::getItemEnabled( unsigned id ) -{ - return isEnabled(id); -} - -inline int WidgetMenu::getCount() -{ - int count = ::GetMenuItemCount( this->handle() ); - if( count == -1 ) - throw xCeption( _T( "Couldn't get item count in getCount()" ) ); - return count; -} - -inline UINT WidgetMenu::getMenuState( UINT id, bool byPosition ) -{ - return ::GetMenuState(this->handle(), id, byPosition ? MF_BYPOSITION : MF_BYCOMMAND); -} - -inline void WidgetMenu::setDefaultItem( UINT id, bool byPosition ) -{ - ::SetMenuDefaultItem(this->handle(), id, byPosition); -} - -inline bool WidgetMenu::isChecked( UINT id, bool byPosition ) -{ - return (getMenuState(id, byPosition) & MF_CHECKED) == MF_CHECKED; -} - -inline bool WidgetMenu::isEnabled( UINT id, bool byPosition ) -{ - return !(getMenuState(id, byPosition) & (MF_DISABLED | MF_GRAYED)); -} - -inline bool WidgetMenu::isPopup( UINT id, bool byPosition ) -{ - return (getMenuState(id, byPosition) & MF_POPUP) == MF_POPUP; -} - -inline bool WidgetMenu::isSeparator( UINT id, bool byPosition ) -{ - return (getMenuState(id, byPosition) & MF_SEPARATOR) == MF_SEPARATOR; -} - -inline WidgetMenu::WidgetMenu( ) - : isSysMenu( false ) -{ -} -// end namespace SmartWin -} - -#endif Copied: dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetMenu.h (from rev 1000, dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetMenuExtended.h) =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetMenu.h (rev 0) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetMenu.h 2008-02-11 14:47:45 UTC (rev 1003) @@ -0,0 +1,530 @@ +/* + Copyright ( c ) 2005, Thomas Hansen + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met : + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the SmartWin++ nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + ( INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT ( INCLUDING NEGLIGENCE OR OTHERWISE ) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +#ifndef WINCE +#ifndef WidgetMenu_h +#define WidgetMenu_h + +#include "../Application.h" +#include "../BasicTypes.h" +#include "../CanvasClasses.h" +#include "../Dispatchers.h" + +namespace SmartWin +{ +// begin namespace SmartWin + +// Forward declaring friends +template< class WidgetType > +class WidgetCreator; + +/// Contains information about menu item +struct MenuItemData +{ + /// Menu item text color + COLORREF TextColor; + + /// Menu item font + FontPtr Font; + + /// Menu item image + BitmapPtr Image; + + /// Creates new menu item with specified data + MenuItemData( + FontPtr font = FontPtr( new SmartWin::Font( ( HFONT )::GetStockObject( DEFAULT_GUI_FONT ), false ) ), + BitmapPtr image = BitmapPtr( new Bitmap( ( HBITMAP ) NULL ) ), // defaults to empty bitmap + COLORREF textColor = ::GetSysColor( COLOR_MENUTEXT ) ) + : TextColor( textColor ), + Font( font ), + Image( image ) + {} +}; + +/// \ingroup GlobalStuff +// MenuItemDataPtr type, contains rendering data for e.g. WidgetMenu +/** Helps easily create color values and so on for a WidgetMenu item! <br> +* Each Menu Item can have different colors and so on, use this smart pointer to set +* those values! +*/ +typedef std::tr1::shared_ptr< MenuItemData > MenuItemDataPtr; + +namespace private_ +{ + // //////////////////////////////////////////////////////////////////////// + // Menu item data wrapper, used internally + // MENUITEMINFO's dwItemData *should* point to it + // //////////////////////////////////////////////////////////////////////// + struct ItemDataWrapper + { + // The menu item belongs to + // For some messages (e.g. WM_MEASUREITEM), + // Windows doesn't specify it, so + // we need to keep this + HMENU menu; + + // Item index in the menu + // This is needed, because ID's for items + // are not unique (although Windows claims) + // e.g. we can have an item with ID 0, + // that is either separator or popup menu + int index; + + // Specifies if item is menu title + bool isMenuTitleItem; + + // Contains item data + MenuItemDataPtr data; + + // Wrapper Constructor + ItemDataWrapper( HMENU owner, int itemIndex, MenuItemDataPtr itemData, bool isTitleItem = false ) + : menu( owner ) + , index( itemIndex ) + , isMenuTitleItem( isTitleItem ) + , data( itemData ) + {} + + ~ItemDataWrapper() + {} + }; +} + +/// Struct for coloring different areas of WidgetMenu +/** Contains the different color settings of the WidgetMenu <br> +* Default values to constructor makes menu look roughly like MSVC++7.1 menus +*/ +struct MenuColorInfo +{ + /// Menu color + COLORREF colorMenu; + + /// Strip bar color + COLORREF colorStrip; + + /// Menu bar color + COLORREF colorMenuBar; + + /// Highlighted menu item color + COLORREF colorHighlight; + + /// Title text color + COLORREF colorTitleText; + + /// Item image background color, used for transparency effects + COLORREF colorImageBackground; + + /// Constructs MenuColorInfo objects + /** If all the default arguments are used it will construct an object making + * menus look roughly like they do in MSVC++ 7.1 <br> + * Pass your own arguments to construct other color effects + */ + MenuColorInfo( COLORREF menuColor = ColorUtilities::darkenColor( ::GetSysColor( COLOR_WINDOW ), 0.02 ), + COLORREF stripColor = ColorUtilities::darkenColor( ::GetSysColor( COLOR_3DFACE ), 0.02 ), + COLORREF menuBarColor = ::GetSysColor( COLOR_MENUBAR ), + COLORREF highlightColor = ::GetSysColor( COLOR_HIGHLIGHT ), + COLORREF titleTextColor = ::GetSysColor( COLOR_MENUTEXT ), + COLORREF imageBackground = RGB( 0, 0, 0 ) ) // black + : colorMenu( menuColor ), + colorStrip( stripColor ), + colorMenuBar( menuBarColor ), + colorHighlight( highlightColor ), + colorTitleText( titleTextColor ), + colorImageBackground( imageBackground ) + {} +}; + +/// Menu class +/** \ingroup WidgetControls +* \WidgetUsageInfo +* \image html menu.png +* Class for creating a Menu Control which then can be attached to e.g. a +* WidgetWindow. <br> +* Note for Desktop version only! <br> +* After you have created a menu you must call WidgetMenu::attach() to make it +* "attach" to the WidgetWindow you want it to belong to. <br> +* Do not be fooled, a WidgetMenu is a much more advanced menu type then the +* "normal" WidgetMenu and contains support for visualizations far beyond the +* capabilities of the WidgetMenu. <br> +* If you need those truly awesome visual menu effects use this menu control instead +* of the WidgetMenu. +*/ +class WidgetMenu : public boost::enable_shared_from_this< WidgetMenu > +{ + // friends + friend class WidgetCreator< WidgetMenu >; + +public: + /// Type of object + typedef WidgetMenu ThisType; + + /// Object type + typedef std::tr1::shared_ptr<WidgetMenu> ObjectType; + + struct Seed { + Seed(bool ownerDrawn_ = true, const MenuColorInfo& colorInfo_ = MenuColorInfo()) : popup(true), ownerDrawn(ownerDrawn_), colorInfo(colorInfo_) { } + bool popup; + bool ownerDrawn; + MenuColorInfo colorInfo; + }; + + struct IdDispatcher + { + typedef std::tr1::function<void (unsigned)> F; + + IdDispatcher(const F& f_) : f(f_) { } + + bool operator()(const MSG& msg, LRESULT& ret) { + f(LOWORD(msg.wParam)); + return true; + } + + F f; + }; + + typedef Dispatchers::VoidVoid<> SimpleDispatcher; + + struct DrawItemDispatcher { + typedef std::tr1::function<bool (int, LPDRAWITEMSTRUCT)> F; + + DrawItemDispatcher(const F& f_) : f(f_) { } + + bool operator()(const MSG& msg, LRESULT& ret) { + return f(msg.wParam, reinterpret_cast<LPDRAWITEMSTRUCT>(msg.lParam)); + } + + F f; + }; + + struct MeasureItemDispatcher { + typedef std::tr1::function<bool (LPMEASUREITEMSTRUCT)> F; + + MeasureItemDispatcher(const F& f_) : f(f_) { } + + bool operator()(const MSG& msg, LRESULT& ret) { + return f(reinterpret_cast<LPMEASUREITEMSTRUCT>(msg.lParam)); + } + + F f; + }; + + /// Rendering settting settings + static const int borderGap; /// Gap between the border and item + static const int pointerGap; /// Gap between item text and sub - menu pointer + static const int textIconGap; /// Gap between text and icon + static const int textBorderGap; /// Gap between text and rectangel border + static const int separatorHeight; /// Defines default height for rectangle containing separator + static const int minSysMenuItemWidth; /// Minimum width for system menu items + static Point defaultImageSize; /// Default image size, used when no image is available + + HMENU handle() const { + return itsHandle; + } + + HWND getParent() const { + return itsParent ? itsParent->handle() : 0; + } + + /// Actually creates the menu + /** Creates the menu, the menu will be created initially empty! + */ + void create(const Seed& cs); + + /// Attaches the menu to the parent window + void attach(); + + /// Appends a popup to the menu + /** Everything you "append" to a menu is added sequentially to the menu <br> + * This specific "append" function appends a "popup" menu which is a menu + * containing other menus. <br> + * With other words a menu which is not an "option" but rather a new "subgroup". + * <br> + * The "File" menu of most application is for instance a "popup" menu while the + * File/Print is often NOT a popup. <br> + * To append items to the popup created call one of the appendItem overloaded + * functions on the returned value of this function. <br> + * Also, although references to all menu objects must be kept ( since they're + * not collected automatically like other Widgets ) <br> + * you don't have to keep a reference to the return value of this function since + * it's being added as a reference to the children list of the "this" object. + * <br> + * A popup is basically another branch in the menu hierarchy <br> + * See the WidgetMenu project for a demonstration. + */ + ObjectType appendPopup( const SmartUtil::tstring & text, MenuItemDataPtr itemData = MenuItemDataPtr(new MenuItemData()) ); + + /// Returns the "System Menu" + /** The system menu is a special menu that ( normally ) is accessed by pressing + * the "window icon" at the top left of the window. <br> + * In SmartWin++ this menu can ALSO be easily manipulated and added items to + * etc... <br> + * Also, although references to all menu objects must be kept ( since they're + * not collected automatically like other Widgets ) <br> + * you don't have to keep a reference to the return value of this function since + * it's being added as a reference to the children list <br> + * of the "this" object. <br> + * See the WidgetMenu sample project for a demonstration. + */ + ObjectType getSystemMenu(); + + /// Setting event handler for Draw Item Event + /** The Draw Item Event will be raised when the menu needs to draw itself, if you + * wish to truly be creative and be 100% in control you must handle this Event + * and do the actualy drawing of the Menu yourself, but for most people it will + * be enough to just manipulate the background colors etc of the MenuItemData + * given to the menu in the appendItem function <br> + * Note! <br> + * If this event is handled you also MUST handle the Measure Item Event!! + */ + bool handleDrawItem(int id, LPDRAWITEMSTRUCT drawInfo); + + /// Setting event handler for Measure Item Event + /** The Measure Item Event is nessecary to handle if you want to draw the menu + * yourself since it is inside this Event Handler you're telling the system how + * much space you need to actually do the drawing <br> + * Note! <br> + * If this event is handled you also MUST handle the Draw Item Event!! + */ + bool handleMeasureItem(LPMEASUREITEMSTRUCT measureInfo); + + /// Appends a separator item to the menu + /** A menu separator is basically just "air" between menu items.< br > + * A separator cannot be "clicked" or "chosen". + */ + void appendSeparatorItem(); + + /// Appends a Menu Item + /** eventHandler is the function that will receive the "click" event from the + * menu item. <br> + * Event handler's signature must be "void foo( ObjectType, unsigned + * int )" and it must be contained as a member <br> + * of the class that is defined as the Widget, normally either the + * WidgetWindow derived class or the class derived from WidgetMenu. <br> + * See e.g. WidgetMenu for an example. <br> + * The reason to why we have this "id" is because the same event handler can be + * defined for several menu items even in fact across menu objects, therefore + * this number should be unique across the application. + */ + void appendItem(unsigned int id, const SmartUtil::tstring & text, MenuItemDataPtr itemData = MenuItemDataPtr(new MenuItemData())); + + template<typename DispatcherType> + void appendItem(unsigned int id, const SmartUtil::tstring & text, const typename DispatcherType::F& f, MenuItemDataPtr itemData = MenuItemDataPtr(new MenuItemData())) { + appendItem(id, text, itemData); + callbacks.insert(std::make_pair(id, DispatcherType(f))); + } + + void appendItem(unsigned int id, const SmartUtil::tstring & text, const IdDispatcher::F& f, MenuItemDataPtr itemData = MenuItemDataPtr(new MenuItemData())) { + appendItem<IdDispatcher>(id, text, f, itemData); + } + + void appendItem(unsigned int id, const SmartUtil::tstring & text, BitmapPtr image); + + template<typename DispatcherType> + void appendItem(unsigned int id, const SmartUtil::tstring & text, const typename DispatcherType::F& f, BitmapPtr image) { + MenuItemDataPtr itemData(new MenuItemData()); + if(ownerDrawn) + itemData->Image = image; + appendItem<DispatcherType>(id, text, f, itemData); + } + + void appendItem(unsigned int id, const SmartUtil::tstring & text, const IdDispatcher::F& f, BitmapPtr image) { + appendItem<IdDispatcher>(id, text, f, image); + } + + /// Removes specified item from this menu + /** Call this function to actually DELETE a menu item from the menu hierarchy. + * Note that you have to specify the item position; and whenever you remove an item, + * all subsequent items change positions. To remove a range of items, remove from + * end to start. + */ + void removeItem( unsigned itemIndex ); + + /// Remove all items from the menu + /** Will also delete any submenus. + */ + void removeAllItems(); + + /// Return the number of items in the menu + int getCount(); + + /// Displays and handles a menu which can appear anywhere in the window. + /** Typically called by a Right Mouse click. If both the x and the y coordinate + * is - 1 ( default ) it'll show the context menu on the position the mouse was + * at when the system last recieved a message, basically the "right" place... + * <br> + * Depending on the flags it might return the id of the menu item selected, or 0 + * if none was chosen. Flags with TPM_RETURNCMD will return the menu - item, but + * not do the menu command. + * < ul > + * < li >TPM_CENTERALIGN : Centers the shortcut menu horizontally relative to the coordinate specified by the x parameter< /li > + * < li >TPM_LEFTALIGN : Function positions the shortcut menu so that its left side is aligned with the coordinate specified by the x parameter< /li > + * < li >TPM_RIGHTALIGN : Opposite of LEFTALIGN< /li > + * < li >TPM_BOTTOMALIGN : Aligns menu bottoms to the coordinate specified by the y parameter< /li > + * < li >TPM_TOPALIGN : Opposite of BOTTOMALIGN< /li > + * < li >TPM_VCENTERALIGN : Centers vertically relative to the y parameter< /li > + * < li >TPM_NONOTIFY : Restricts the menu from sending notifications when user clicks item< /li > + * < li >TPM_RETURNCMD : returns the menu item identifier of the user's selection in the return value but DOES NOT carry out the event handler< /li > + * < li >TPM_LEFTBUTTON : Restricts users to selecting menu items with only left mouse button< /li > + * < li >TPM_RIGHTBUTTON : User can choose menu item with both mouse buttons< /li > + * < /ul > + * None of the following are used by default but can be manually chosen if you + * manually call SystemParametersInfo + * < ul > + * < li >TPM_HORNEGANIMATION : Animates the menu from right to left< /li > + * < li >TPM_HORPOSANIMATION : Animates the menu from left to right< /li > + * < li >TPM_NOANIMATION : Displays menu without animation< /li > + * < li >TPM_VERNEGANIMATION : Animates the menu from bottom to top< /li > + * < li >TPM_VERPOSANIMATION : Animates the menu from top to bottom< /li > + * < /ul > + */ + unsigned trackPopupMenu( Widget * mainWindow, const ScreenCoordinate& sc, unsigned flags = 0 ); + + /// Sets menu title + /** A WidgetMenu can have a title, this function sets that title + */ + void setTitle( const SmartUtil::tstring & title, bool drawSidebar = false ); + + /// Sets title font + /** Create a font through e.g. createFont in WidgetFactory or similar and set the + * title font to the menu title through using this function + */ + void setTitleFont( FontPtr font ); + + /// Removes menu title + /** If clearSidebar is true, sidebar is removed + */ + void clearTitle( bool clearSidebar = false ); + + /// Checks (or uncheck) a specific menu item + /** Which menu item you wish to check ( or uncheck ) is passed in as the "id" + * parameter. <br> + * If the "value" parameter is true the item will be checked, otherwise it will + * be unchecked + */ + void checkItem( unsigned id, bool value = true ); + + /// Enables (or disables) a specific menu item + /** Which menu item you wish to enable ( or disable ) is passed in as the "id" + * parameter. <br> + * If the "value" parameter is true the item becomes enabled, otherwise disabled + */ + void setItemEnabled( unsigned id, bool byPosition = false, bool value = true ); + + UINT getMenuState(UINT id, bool byPosition = false); + + /// Return true if the item is a separator (by position) + bool isSeparator(UINT id, bool byPosition = false); + /// Return true if the menu item is checked + bool isChecked(UINT id, bool byPosition = false); + /// Return true if the menu item is a popup menu + bool isPopup(UINT id, bool byPosition = false); + /// Return true if the menu item is enabled (not grey and not disabled) + bool isEnabled(UINT id, bool byPosition = false); + + void setDefaultItem(UINT id, bool byPosition = false); + + /// Returns true if menu is "system menu" (icon in top left of window) + bool isSystemMenu() + { + return isSysMenu; + } + + /// Returns the text of a specific menu item + /** Which menu item you wish to retrieve the text for is defined by the "id" + * parameter of the function. + */ + SmartUtil::tstring getText( unsigned idOrPos, bool byPos ); + + /// Sets the text of a specific menu item + /** Which menu item you wish to set the text is defined by the "id" + * parameter of the function. + */ + void setText( unsigned id, const SmartUtil::tstring& text ); + + /// Returns item data + MenuItemDataPtr getData( int itemIndex ); + + ObjectType getChild(UINT position); + + virtual ~WidgetMenu(); + +private: + /// Constructor Taking pointer to parent + explicit WidgetMenu( SmartWin::Widget * parent ); + + // This is used during menu destruction + static void destroyItemDataWrapper( private_::ItemDataWrapper * wrapper ); + + // True is menu is "system menu" (icon in top left of window) + bool isSysMenu; + + // work around for gcc + std::vector< ObjectType > & itsChildrenRef; + + // work around for gcc + std::vector < private_::ItemDataWrapper * > & itsItemDataRef; + + // its sub menus + std::vector< ObjectType > itsChildren; + + // its item data + std::vector < private_::ItemDataWrapper * > itsItemData; + + HMENU itsHandle; + + Widget* itsParent; + + bool ownerDrawn; + + // Contains information about menu colors + MenuColorInfo itsColorInfo; + + // Menu title + SmartUtil::tstring itsTitle; + + // Menu title font + FontPtr itsTitleFont; + + // if true title is drawn as sidebar + bool drawSidebar; + + typedef std::map<unsigned, Widget::CallbackType> CallbackMap; + CallbackMap callbacks; + + void addCommands(Widget* widget); + + // Returns item index in the menu item list + // If no item with specified id is found, - 1 is returned + int getItemIndex( unsigned int id ); + + WidgetMenu( const WidgetMenu & ); // Never implemented intentionally +}; + +// end namespace SmartWin +} + +#endif +#endif Deleted: dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetMenuExtended.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetMenuExtended.h 2008-02-10 21:35:52 UTC (rev 1002) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetMenuExtended.h 2008-02-11 14:47:45 UTC (rev 1003) @@ -1,638 +0,0 @@ -/* - Copyright ( c ) 2005, Thomas Hansen - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met : - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of the SmartWin++ nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - ( INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT ( INCLUDING NEGLIGENCE OR OTHERWISE ) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#ifndef WINCE -#ifndef WidgetMenuExtended_h -#define WidgetMenuExtended_h - -#include "../Application.h" -#include "../BasicTypes.h" -#include "../CanvasClasses.h" - -namespace SmartWin -{ -// begin namespace SmartWin - -// Forward declaring friends -template< class WidgetType > -class WidgetCreator; - -/// Contains extended information about extended menu item -struct MenuItemData -{ - /// Menu item text color - COLORREF TextColor; - - /// Menu item font - FontPtr Font; - - /// Menu item image - BitmapPtr Image; - - /// Creates new menu item with specified data - MenuItemData( - FontPtr font = FontPtr( new SmartWin::Font( ( HFONT )::GetStockObject( DEFAULT_GUI_FONT ), false ) ), // defaults to SYSTEM_FONT - BitmapPtr image = BitmapPtr( new Bitmap( ( HBITMAP ) NULL ) ), // defaults to empty bitmap - COLORREF textColor = ::GetSysColor( COLOR_MENUTEXT ) ) - : TextColor( textColor ), - Font( font ), - Image( image ) - {} -}; - -/// \ingroup GlobalStuff -// MenuItemDataPtr type, contains rendering data for e.g. WidgetMenuExtended -/** Helps easily create color values and so on for a WidgetMenuExtended item! <br> -* Each Menu Item can have different colors and so on, use this smart pointer to set -* those values! -*/ -typedef std::tr1::shared_ptr< MenuItemData > MenuItemDataPtr; - -namespace private_ -{ - // //////////////////////////////////////////////////////////////////////// - // Menu item data wrapper, used internally - // MENUITEMINFO's dwItemData *should* point to it - // //////////////////////////////////////////////////////////////////////// - struct ItemDataWrapper - { - // The menu item belongs to - // For some messages (e.g. WM_MEASUREITEM), - // Windows doesn't specify it, so - // we need to keep this - HMENU menu; - - // Item index in the menu - // This is needed, because ID's for items - // are not unique (although Windows claims) - // e.g. we can have an item with ID 0, - // that is either separator or popup menu - int index; - - // Specifies if item is menu title - bool isMenuTitleItem; - - // Contains item data - MenuItemDataPtr data; - - // Wrapper Constructor - ItemDataWrapper( HMENU owner, int itemIndex, MenuItemDataPtr itemData, bool isTitleItem = false ) - : menu( owner ) - , index( itemIndex ) - , isMenuTitleItem( isTitleItem ) - , data( itemData ) - {} - - ~ItemDataWrapper() - {} - }; -} - -/// Struct for coloring different areas of WidgetMenuExtended -/** Contains the different color settings of the WidgetMenuExtended <br> -* Default values to constructor makes menu look roughly like MSVC++7.1 menus -*/ -struct MenuColorInfo -{ - /// Menu color - COLORREF colorMenu; - - /// Strip bar color - COLORREF colorStrip; - - /// Menu bar color - COLORREF colorMenuBar; - - /// Highlighted menu item color - COLORREF colorHighlight; - - /// Title text color - COLORREF colorTitleText; - - /// Item image background color, used for transparency effects - COLORREF colorImageBackground; - - /// Constructs MenuColorInfo objects - /** If all the default arguments are used it will construct an object making - * menus look roughly like they do in MSVC++ 7.1 <br> - * Pass your own arguments to construct other color effects - */ - MenuColorInfo( COLORREF menuColor = ColorUtilities::darkenColor( ::GetSysColor( COLOR_WINDOW ), 0.02 ), - COLORREF stripColor = ColorUtilities::darkenColor( ::GetSysColor( COLOR_3DFACE ), 0.02 ), - COLORREF menuBarColor = ::GetSysColor( COLOR_MENUBAR ), - COLORREF highlightColor = ::GetSysColor( COLOR_HIGHLIGHT ), - COLORREF titleTextColor = ::GetSysColor( COLOR_MENUTEXT ), - COLORREF imageBackground = RGB( 0, 0, 0 ) ) // black - : colorMenu( menuColor ), - colorStrip( stripColor ), - colorMenuBar( menuBarColor ), - colorHighlight( highlightColor ), - colorTitleText( titleTextColor ), - colorImageBackground( imageBackground ) - {} -}; - -// Platform specific implementation -template< class MenuType, Platform > -class WidgetMenuExtendedPlatformImplementation; - -/// Specialized functions in menu for desktop Windows API version -/** This class contains all the functions in the WidgetMenuExtended which only works -* in the Desktop Version of the OS. <br> -* Though WidgetMenuExtended class does not actually WORK on WinCE we plan to MAKE -* it work in future versions, therefore we have created the CurrentPlatform -* specialization classes for it here...!! -*/ -template< typename MenuType > -class WidgetMenuExtendedPlatformImplementation< MenuType, SmartWinDesktop > -{ -public: - typedef std::tr1::shared_ptr< MenuType > WidgetMenuExtendedPtr; - - struct Seed { - Seed(const MenuColorInfo& colorInfo_ = MenuColorInfo()) : popup(true), colorInfo(colorInfo_) { } - bool popup; - MenuColorInfo colorInfo; - }; - - HMENU handle() const { - return itsHandle; - } - - HWND getParent() const { - return itsParent ? itsParent->handle() : 0; - } - - /// Actually creates the menu - /** Creates the menu, the menu will be created initially empty! - */ - void create(const Seed& cs); - - /// Attaches the menu to the parent window - void attach(); - - /// Appends a popup to the menu - /** Everything you "append" to a menu is added sequentially to the menu <br> - * This specific "append" function appends a "popup" menu which is a menu - * containing other menus. <br> - * With other words a menu which is not an "option" but rather a new "subgroup". - * <br> - * The "File" menu of most application is for instance a "popup" menu while the - * File/Print is often NOT a popup. <br> - * To append items to the popup created call one of the appendItem overloaded - * functions on the returned value of this function. <br> - * Also, although references to all menu objects must be kept ( since they're - * not collected automatically like other Widgets ) <br> - * you don't have to keep a reference to the return value of this function since - * it's being added as a reference to the children list of the "this" object. - * <br> - * A popup is basically another branch in the menu hierarchy <br> - * See the WidgetMenu project for a demonstration. - */ - WidgetMenuExtendedPtr appendPopup( const SmartUtil::tstring & text, MenuItemDataPtr itemData = MenuItemDataPtr(new MenuItemData()) ); - - /// Returns the "System Menu" - /** The system menu is a special menu that ( normally ) is accessed by pressing - * the "window icon" at the top left of the window. <br> - * In SmartWin++ this menu can ALSO be easily manipulated and added items to - * etc... <br> - * Also, although references to all menu objects must be kept ( since they're - * not collected automatically like other Widgets ) <br> - * you don't have to keep a reference to the return value of this function since - * it's being added as a reference to the children list <br> - * of the "this" object. <br> - * See the WidgetMenu sample project for a demonstration. - */ - WidgetMenuExtendedPtr getSystemMenu(); - - /// Rendering settting settings - static const int borderGap; /// Gap between the border and item - static const int pointerGap; /// Gap between item text and sub - menu pointer - static const int textIconGap; /// Gap between text and icon - static const int textBorderGap; /// Gap between text and rectangel border - static const int separatorHeight; /// Defines default height for rectangle containing separator - static const int minSysMenuItemWidth; /// Minimum width for system menu items - static Point defaultImageSize; /// Default image size, used when no image is available - -protected: - // its sub menus - std::vector< WidgetMenuExtendedPtr > itsChildren; - - // its item data - std::vector < private_::ItemDataWrapper * > itsItemData; - - HMENU itsHandle; - - Widget* itsParent; - - // Contains information about menu colors - MenuColorInfo itsColorInfo; - - typedef std::map<unsigned, Widget::CallbackType> CallbackMap; - CallbackMap callbacks; - - void addCommands(Widget* widget); -}; - -/// Extended Menu class -/** \ingroup WidgetControls -* \WidgetUsageInfo -* \image html menuextended.png -* Class for creating an Extended Menu Control which then can be attached to e.g. a -* WidgetWindow. <br> -* Note for Desktop version only! <br> -* After you have created a menu you must call WidgetMenu::attach() to make it -* "attach" to the WidgetWindow you want it to belong to. <br> -* Do not be fooled, a WidgetMenuExtended is a much more advanced menu type then the -* "normal" WidgetMenu and contains support for visualizations far beyond the -* capabilities of the WidgetMenu. <br> -* If you need those truly awesome visual menu effects use this menu control instead -* of the WidgetMenu. -*/ -class WidgetMenuExtended : - public WidgetMenuExtendedPlatformImplementation< WidgetMenuExtended, CurrentPlatform >, - public boost::enable_shared_from_this< WidgetMenuExtended > -{ - // friends - friend class WidgetMenuExtendedPlatformImplementation< WidgetMenuExtended, CurrentPlatform >; - friend class WidgetCreator< WidgetMenuExtended >; - - typedef WidgetMenuExtendedPlatformImplementation< WidgetMenuExtended, CurrentPlatform > Implementation; -public: - /// Type of object - typedef WidgetMenuExtended ThisType; - - /// Object type - typedef WidgetMenuExtendedPlatformImplementation< WidgetMenuExtended, CurrentPlatform >::WidgetMenuExtendedPtr ObjectType; - - struct IdDispatcher - { - typedef std::tr1::function<void (unsigned)> F; - - IdDispatcher(const F& f_) : f(f_) { } - - bool operator()(const MSG& msg, LRESULT& ret) { - f(LOWORD(msg.wParam)); - return true; - } - - F f; - }; - - struct DrawItemDispatcher { - typedef std::tr1::function<bool (int, LPDRAWITEMSTRUCT)> F; - - DrawItemDispatcher(const F& f_) : f(f_) { } - - bool operator()(const MSG& msg, LRESULT& ret) { - return f(msg.wParam, reinterpret_cast<LPDRAW... [truncated message content] |
From: <arn...@us...> - 2008-02-13 22:06:36
|
Revision: 1007 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=1007&view=rev Author: arnetheduck Date: 2008-02-13 14:06:33 -0800 (Wed, 13 Feb 2008) Log Message: ----------- Bugfixes Modified Paths: -------------- dcplusplus/trunk/changelog.txt dcplusplus/trunk/dcpp/AdcHub.cpp dcplusplus/trunk/dcpp/ClientListener.h dcplusplus/trunk/dcpp/NmdcHub.cpp dcplusplus/trunk/dcpp/ShareManager.cpp dcplusplus/trunk/win32/HubFrame.cpp dcplusplus/trunk/win32/HubFrame.h dcplusplus/trunk/win32/QueueFrame.cpp Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2008-02-12 22:09:17 UTC (rev 1006) +++ dcplusplus/trunk/changelog.txt 2008-02-13 22:06:33 UTC (rev 1007) @@ -28,8 +28,9 @@ * [ADC] Added /me handling (thanks poy) * Fixed issues with scrolling (thanks poy) * Fixed re-add sources showing wrong sources (thanks poy) -* Partially fixed kick message filtering (thanks mikejj) +* Fixed kick message filtering (thanks mikejj) * version.xml now use Coral (ullner) +* [ADC] Number of files counts unique files when sending stats to hub -- 0.704 2007-12-14 -- * Hub lists added to utilize Coral's distributed network (ullner) Modified: dcplusplus/trunk/dcpp/AdcHub.cpp =================================================================== --- dcplusplus/trunk/dcpp/AdcHub.cpp 2008-02-12 22:09:17 UTC (rev 1006) +++ dcplusplus/trunk/dcpp/AdcHub.cpp 2008-02-13 22:06:33 UTC (rev 1007) @@ -136,8 +136,8 @@ if(!c.getParam("NI", 0, nick)) { nick = "[nick unknown]"; } - fire(ClientListener::StatusMessage(), this, u->getIdentity().getNick() + " (" + u->getIdentity().getSIDString() + - ") has same CID {" + cid + "} as " + nick + " (" + AdcCommand::fromSID(c.getFrom()) + "), ignoring."); + fire(ClientListener::StatusMessage(), this, str(F_("%1% (%2%) has same CID {%3%} as %4% (%5%), ignoring") + % u->getIdentity().getNick() % u->getIdentity().getSIDString() % cid % nick % AdcCommand::fromSID(c.getFrom()))); return; } } else { @@ -203,13 +203,13 @@ } if(!baseOk) { - fire(ClientListener::StatusMessage(), this, "Failed to negotiate base protocol"); // @todo internationalize + fire(ClientListener::StatusMessage(), this, _("Failed to negotiate base protocol")); socket->disconnect(false); return; } else if(!tigrOk) { oldPassword = true; // Some hubs fake BASE support without TIGR support =/ - fire(ClientListener::StatusMessage(), this, "Hub probably uses an old version of ADC, please encourage the owner to upgrade"); + fire(ClientListener::StatusMessage(), this, _("Hub probably uses an old version of ADC, please encourage the owner to upgrade")); } } @@ -263,13 +263,35 @@ void AdcHub::handle(AdcCommand::QUI, AdcCommand& c) throw() { uint32_t s = AdcCommand::toSID(c.getParam(0)); - putUser(s); // @todo: use the DI flag - + + OnlineUser* victim = findUser(s); + if(!victim) { + return; + } + string tmp; if(c.getParam("MS", 1, tmp)) { - fire(ClientListener::StatusMessage(), this, tmp); + OnlineUser* source = 0; + string tmp2; + if(c.getParam("ID", 1, tmp2)) { + source = findUser(AdcCommand::toSID(tmp2)); + } + + if(source) { + tmp = str(F_("%1% was kicked by %2%: %3%") % victim->getIdentity().getNick() % + source->getIdentity().getNick() % tmp); + } else { + tmp = str(F_("%1% was kicked: %2%") % victim->getIdentity().getNick() % tmp); + } + fire(ClientListener::StatusMessage(), this, tmp, ClientListener::FLAG_IS_SPAM); } + + if(c.hasFlag("DI", 1)) { + ConnectionManager::getInstance()->disconnect(victim->getUser(), false); + } + putUser(s); + if(s == sid) { if(c.getParam("TL", 1, tmp)) { if(tmp == "-1") { Modified: dcplusplus/trunk/dcpp/ClientListener.h =================================================================== --- dcplusplus/trunk/dcpp/ClientListener.h 2008-02-12 22:09:17 UTC (rev 1006) +++ dcplusplus/trunk/dcpp/ClientListener.h 2008-02-13 22:06:33 UTC (rev 1007) @@ -29,6 +29,11 @@ typedef X<17> SearchFlood; typedef X<18> NmdcSearch; typedef X<19> AdcSearch; + + enum StatusFlags { + FLAG_NORMAL = 0x00, + FLAG_IS_SPAM = 0x01 + }; virtual void on(Connecting, Client*) throw() { } virtual void on(Connected, Client*) throw() { } @@ -40,7 +45,7 @@ virtual void on(GetPassword, Client*) throw() { } virtual void on(HubUpdated, Client*) throw() { } virtual void on(Message, Client*, const OnlineUser&, const string&, bool = false) throw() { } - virtual void on(StatusMessage, Client*, const string&) throw() { } + virtual void on(StatusMessage, Client*, const string&, int = FLAG_NORMAL) throw() { } virtual void on(PrivateMessage, Client*, const OnlineUser&, const OnlineUser&, const OnlineUser&, const string&, bool = false) throw() { } virtual void on(HubUserCommand, Client*, int, int, const string&, const string&) throw() { } virtual void on(HubFull, Client*) throw() { } Modified: dcplusplus/trunk/dcpp/NmdcHub.cpp =================================================================== --- dcplusplus/trunk/dcpp/NmdcHub.cpp 2008-02-12 22:09:17 UTC (rev 1006) +++ dcplusplus/trunk/dcpp/NmdcHub.cpp 2008-02-13 22:06:33 UTC (rev 1007) @@ -198,6 +198,14 @@ return; } + if((line.find("Hub-Security") != string::npos) && (line.find("was kicked by") != string::npos)) { + fire(ClientListener::StatusMessage(), this, unescape(line), ClientListener::FLAG_IS_SPAM); + return; + } else if((line.find("is kicking") != string::npos) && (line.find("because:") != string::npos)) { + fire(ClientListener::StatusMessage(), this, unescape(line), ClientListener::FLAG_IS_SPAM); + return; + } + OnlineUser* ou = findUser(nick); if(ou) { fire(ClientListener::Message(), this, *ou, unescape(message)); Modified: dcplusplus/trunk/dcpp/ShareManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/ShareManager.cpp 2008-02-12 22:09:17 UTC (rev 1006) +++ dcplusplus/trunk/dcpp/ShareManager.cpp 2008-02-13 22:06:33 UTC (rev 1007) @@ -507,11 +507,7 @@ size_t ShareManager::getSharedFiles() const throw() { Lock l(cs); - size_t tmp = 0; - for(Directory::Map::const_iterator i = directories.begin(); i != directories.end(); ++i) { - tmp += i->second->countFiles(); - } - return tmp; + return tthIndex.size(); } class FileFindIter { Modified: dcplusplus/trunk/win32/HubFrame.cpp =================================================================== --- dcplusplus/trunk/win32/HubFrame.cpp 2008-02-12 22:09:17 UTC (rev 1006) +++ dcplusplus/trunk/win32/HubFrame.cpp 2008-02-13 22:06:33 UTC (rev 1007) @@ -877,23 +877,17 @@ } void HubFrame::on(Message, Client*, const OnlineUser& from, const string& msg, bool thirdPerson) throw() { - if(SETTING(FILTER_MESSAGES)) { - if((msg.find("Hub-Security") != string::npos) && (msg.find("was kicked by") != string::npos)) { - // Do nothing... - } else if((msg.find("is kicking") != string::npos) && (msg.find("because:") != string::npos)) { - speak(ADD_SILENT_STATUS_LINE, msg); - } else { - speak(ADD_CHAT_LINE, Util::formatMessage(from.getIdentity().getNick(), msg, thirdPerson)); - } + speak(ADD_CHAT_LINE, Util::formatMessage(from.getIdentity().getNick(), msg, thirdPerson)); +} + +void HubFrame::on(StatusMessage, Client*, const string& line, int statusFlags) throw() { + if(SETTING(FILTER_MESSAGES) && (statusFlags & ClientListener::FLAG_IS_SPAM)) { + speak(ADD_SILENT_STATUS_LINE, line); } else { - speak(ADD_CHAT_LINE, Util::formatMessage(from.getIdentity().getNick(), msg, thirdPerson)); + speak(ADD_STATUS_LINE, line); } } -void HubFrame::on(StatusMessage, Client*, const string& line) throw() { - speak(ADD_CHAT_LINE, line); -} - void HubFrame::on(PrivateMessage, Client*, const OnlineUser& from, const OnlineUser& to, const OnlineUser& replyTo, const string& line, bool thirdPerson) throw() { speak(from, to, replyTo, Util::formatMessage(from.getIdentity().getNick(), line, thirdPerson)); } Modified: dcplusplus/trunk/win32/HubFrame.h =================================================================== --- dcplusplus/trunk/win32/HubFrame.h 2008-02-12 22:09:17 UTC (rev 1006) +++ dcplusplus/trunk/win32/HubFrame.h 2008-02-13 22:06:33 UTC (rev 1007) @@ -275,7 +275,7 @@ virtual void on(GetPassword, Client*) throw(); virtual void on(HubUpdated, Client*) throw(); virtual void on(Message, Client*, const OnlineUser&, const string&, bool = false) throw(); - virtual void on(StatusMessage, Client*, const string&) throw(); + virtual void on(StatusMessage, Client*, const string&, int = ClientListener::FLAG_NORMAL) throw(); virtual void on(PrivateMessage, Client*, const OnlineUser&, const OnlineUser&, const OnlineUser&, const string&, bool = false) throw(); virtual void on(NickTaken, Client*) throw(); virtual void on(SearchFlood, Client*, const string&) throw(); Modified: dcplusplus/trunk/win32/QueueFrame.cpp =================================================================== --- dcplusplus/trunk/win32/QueueFrame.cpp 2008-02-12 22:09:17 UTC (rev 1006) +++ dcplusplus/trunk/win32/QueueFrame.cpp 2008-02-13 22:06:33 UTC (rev 1007) @@ -811,7 +811,7 @@ QueueItemInfo* ii = files->getSelectedData(); if(!user) { - for(QueueItem::SourceIter si = ii->getSources().begin(); si != ii->getSources().end(); ) { + for(QueueItem::SourceIter si = ii->getSources().begin(); si != ii->getSources().end(); ++si) { QueueManager::getInstance()->removeSource(ii->getTarget(), si->getUser(), QueueItem::Source::FLAG_REMOVED); } } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2008-02-13 22:36:25
|
Revision: 1008 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=1008&view=rev Author: arnetheduck Date: 2008-02-13 14:36:24 -0800 (Wed, 13 Feb 2008) Log Message: ----------- Warning fixes Modified Paths: -------------- dcplusplus/trunk/changelog.txt dcplusplus/trunk/win32/ADLSearchFrame.cpp dcplusplus/trunk/win32/HubFrame.cpp dcplusplus/trunk/win32/NotepadFrame.cpp dcplusplus/trunk/win32/PublicHubsFrame.cpp dcplusplus/trunk/win32/WaitingUsersFrame.cpp Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2008-02-13 22:06:33 UTC (rev 1007) +++ dcplusplus/trunk/changelog.txt 2008-02-13 22:36:24 UTC (rev 1008) @@ -31,6 +31,8 @@ * Fixed kick message filtering (thanks mikejj) * version.xml now use Coral (ullner) * [ADC] Number of files counts unique files when sending stats to hub +* [ADC] Fixed kick handling +* Fixed 100% on remove all sources in queue -- 0.704 2007-12-14 -- * Hub lists added to utilize Coral's distributed network (ullner) Modified: dcplusplus/trunk/win32/ADLSearchFrame.cpp =================================================================== --- dcplusplus/trunk/win32/ADLSearchFrame.cpp 2008-02-13 22:06:33 UTC (rev 1007) +++ dcplusplus/trunk/win32/ADLSearchFrame.cpp 2008-02-13 22:36:24 UTC (rev 1008) @@ -110,8 +110,6 @@ } void ADLSearchFrame::layout() { - const int border = 2; - SmartWin::Rectangle r(SmartWin::Point(0, 0), getClientAreaSize()); layoutStatus(r); Modified: dcplusplus/trunk/win32/HubFrame.cpp =================================================================== --- dcplusplus/trunk/win32/HubFrame.cpp 2008-02-13 22:06:33 UTC (rev 1007) +++ dcplusplus/trunk/win32/HubFrame.cpp 2008-02-13 22:36:24 UTC (rev 1008) @@ -1097,6 +1097,7 @@ case GREATER: insert = (size < ui.getIdentity().getBytesShared()); break; case LESS: insert = (size > ui.getIdentity().getBytesShared()); break; case NOT_EQUAL: insert = (size != ui.getIdentity().getBytesShared()); break; + case NONE: ; break; } } else { if(sel >= COLUMN_LAST) { Modified: dcplusplus/trunk/win32/NotepadFrame.cpp =================================================================== --- dcplusplus/trunk/win32/NotepadFrame.cpp 2008-02-13 22:06:33 UTC (rev 1007) +++ dcplusplus/trunk/win32/NotepadFrame.cpp 2008-02-13 22:36:24 UTC (rev 1008) @@ -66,8 +66,6 @@ } void NotepadFrame::layout() { - const int border = 2; - SmartWin::Rectangle r(SmartWin::Point(0, 0), getClientAreaSize()); layoutStatus(r); Modified: dcplusplus/trunk/win32/PublicHubsFrame.cpp =================================================================== --- dcplusplus/trunk/win32/PublicHubsFrame.cpp 2008-02-13 22:06:33 UTC (rev 1007) +++ dcplusplus/trunk/win32/PublicHubsFrame.cpp 2008-02-13 22:36:24 UTC (rev 1008) @@ -419,6 +419,7 @@ case GREATER: insert = (size < entrySize); break; case LESS: insert = (size > entrySize); break; case NOT_EQUAL: insert = (size != entrySize); break; + case NONE: ; break; } } else { if(sel >= COLUMN_LAST) { Modified: dcplusplus/trunk/win32/WaitingUsersFrame.cpp =================================================================== --- dcplusplus/trunk/win32/WaitingUsersFrame.cpp 2008-02-13 22:06:33 UTC (rev 1007) +++ dcplusplus/trunk/win32/WaitingUsersFrame.cpp 2008-02-13 22:36:24 UTC (rev 1008) @@ -53,10 +53,7 @@ } // Recalculate frame control layout -void WaitingUsersFrame::layout() -{ - const int border = 2; - +void WaitingUsersFrame::layout() { SmartWin::Rectangle r(this->getClientAreaSize()); layoutStatus(r); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <zou...@us...> - 2008-02-15 16:46:48
|
Revision: 1010 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=1010&view=rev Author: zouzou123gen Date: 2008-02-15 08:46:35 -0800 (Fri, 15 Feb 2008) Log Message: ----------- Don't always show the tray icon after killing and re-opening explorer.exe Modified Paths: -------------- dcplusplus/trunk/changelog.txt dcplusplus/trunk/win32/MainWindow.cpp dcplusplus/trunk/win32/MainWindow.h Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2008-02-13 22:50:42 UTC (rev 1009) +++ dcplusplus/trunk/changelog.txt 2008-02-15 16:46:35 UTC (rev 1010) @@ -33,6 +33,7 @@ * [ADC] Number of files counts unique files when sending stats to hub * [ADC] Fixed kick handling * Fixed 100% on remove all sources in queue +* Don't always show the tray icon after killing and re-opening explorer.exe (poy) -- 0.704 2007-12-14 -- * Hub lists added to utilize Coral's distributed network (ullner) Modified: dcplusplus/trunk/win32/MainWindow.cpp =================================================================== --- dcplusplus/trunk/win32/MainWindow.cpp 2008-02-13 22:50:42 UTC (rev 1009) +++ dcplusplus/trunk/win32/MainWindow.cpp 2008-02-15 16:46:35 UTC (rev 1010) @@ -98,7 +98,7 @@ onClosing(std::tr1::bind(&MainWindow::closing, this)); - onRaw(std::tr1::bind(&MainWindow::trayMessage, this, _1, _2), SmartWin::Message(RegisterWindowMessage(_T("TaskbarCreated")))); + onRaw(std::tr1::bind(&MainWindow::handleTrayMessage, this), SmartWin::Message(RegisterWindowMessage(_T("TaskbarCreated")))); onRaw(std::tr1::bind(&MainWindow::handleEndSession, this, _1, _2), SmartWin::Message(WM_ENDSESSION)); onRaw(std::tr1::bind(&MainWindow::handleWhereAreYou, this, _1, _2), SmartWin::Message(SingleInstance::WMU_WHERE_ARE_YOU)); @@ -507,8 +507,9 @@ return true; } -LRESULT MainWindow::trayMessage(WPARAM wParam, LPARAM lParam) { - updateTray(true); +LRESULT MainWindow::handleTrayMessage() { + if(BOOLSETTING(MINIMIZE_TRAY) && isIconic()) + updateTray(true); return 0; } Modified: dcplusplus/trunk/win32/MainWindow.h =================================================================== --- dcplusplus/trunk/win32/MainWindow.h 2008-02-13 22:50:42 UTC (rev 1009) +++ dcplusplus/trunk/win32/MainWindow.h 2008-02-15 16:46:35 UTC (rev 1010) @@ -167,7 +167,7 @@ bool handleSized(const SmartWin::WidgetSizedEventResult& sz); LRESULT handleSpeaker(WPARAM wParam, LPARAM lParam); - LRESULT trayMessage(WPARAM wParam, LPARAM lParam); + LRESULT handleTrayMessage(); LRESULT handleCopyData(WPARAM wParam, LPARAM lParam); LRESULT handleWhereAreYou(WPARAM wParam, LPARAM lParam); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2008-02-17 11:51:41
|
Revision: 1011 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=1011&view=rev Author: arnetheduck Date: 2008-02-17 03:51:38 -0800 (Sun, 17 Feb 2008) Log Message: ----------- Patches, download manager cleanup, copyright year Modified Paths: -------------- dcplusplus/trunk/changelog.txt dcplusplus/trunk/dcpp/ADLSearch.cpp dcplusplus/trunk/dcpp/ADLSearch.h dcplusplus/trunk/dcpp/AdcCommand.cpp dcplusplus/trunk/dcpp/AdcCommand.h dcplusplus/trunk/dcpp/AdcHub.cpp dcplusplus/trunk/dcpp/AdcHub.h dcplusplus/trunk/dcpp/BZUtils.cpp dcplusplus/trunk/dcpp/BZUtils.h dcplusplus/trunk/dcpp/BitInputStream.h dcplusplus/trunk/dcpp/BitOutputStream.h dcplusplus/trunk/dcpp/BloomFilter.h dcplusplus/trunk/dcpp/BufferedSocket.cpp dcplusplus/trunk/dcpp/BufferedSocket.h dcplusplus/trunk/dcpp/BufferedSocketListener.h dcplusplus/trunk/dcpp/CID.h dcplusplus/trunk/dcpp/Client.cpp dcplusplus/trunk/dcpp/Client.h dcplusplus/trunk/dcpp/ClientManager.cpp dcplusplus/trunk/dcpp/ClientManager.h dcplusplus/trunk/dcpp/ClientManagerListener.h dcplusplus/trunk/dcpp/ConnectionManager.cpp dcplusplus/trunk/dcpp/ConnectionManager.h dcplusplus/trunk/dcpp/ConnectionManagerListener.h dcplusplus/trunk/dcpp/CriticalSection.h dcplusplus/trunk/dcpp/CryptoManager.cpp dcplusplus/trunk/dcpp/CryptoManager.h dcplusplus/trunk/dcpp/DCPlusPlus.cpp dcplusplus/trunk/dcpp/DCPlusPlus.h dcplusplus/trunk/dcpp/DirectoryListing.cpp dcplusplus/trunk/dcpp/DirectoryListing.h dcplusplus/trunk/dcpp/Download.cpp dcplusplus/trunk/dcpp/DownloadManager.cpp dcplusplus/trunk/dcpp/DownloadManager.h dcplusplus/trunk/dcpp/DownloadManagerListener.h dcplusplus/trunk/dcpp/Encoder.cpp dcplusplus/trunk/dcpp/Encoder.h dcplusplus/trunk/dcpp/Exception.h dcplusplus/trunk/dcpp/FastAlloc.h dcplusplus/trunk/dcpp/FavoriteManager.cpp dcplusplus/trunk/dcpp/FavoriteManager.h dcplusplus/trunk/dcpp/FavoriteManagerListener.h dcplusplus/trunk/dcpp/FavoriteUser.h dcplusplus/trunk/dcpp/File.cpp dcplusplus/trunk/dcpp/File.h dcplusplus/trunk/dcpp/FilteredFile.h dcplusplus/trunk/dcpp/FinishedManager.cpp dcplusplus/trunk/dcpp/FinishedManager.h dcplusplus/trunk/dcpp/FinishedManagerListener.h dcplusplus/trunk/dcpp/HashManager.cpp dcplusplus/trunk/dcpp/HashManager.h dcplusplus/trunk/dcpp/HashValue.h dcplusplus/trunk/dcpp/HttpConnection.cpp dcplusplus/trunk/dcpp/HttpConnection.h dcplusplus/trunk/dcpp/HubEntry.h dcplusplus/trunk/dcpp/LogManager.cpp dcplusplus/trunk/dcpp/LogManager.h dcplusplus/trunk/dcpp/MerkleCheckOutputStream.h dcplusplus/trunk/dcpp/MerkleTree.h dcplusplus/trunk/dcpp/NmdcHub.cpp dcplusplus/trunk/dcpp/NmdcHub.h dcplusplus/trunk/dcpp/Pointer.h dcplusplus/trunk/dcpp/QueueItem.cpp dcplusplus/trunk/dcpp/QueueItem.h dcplusplus/trunk/dcpp/QueueManager.cpp dcplusplus/trunk/dcpp/QueueManager.h dcplusplus/trunk/dcpp/QueueManagerListener.h dcplusplus/trunk/dcpp/ResourceManager.cpp dcplusplus/trunk/dcpp/ResourceManager.h dcplusplus/trunk/dcpp/SFVReader.cpp dcplusplus/trunk/dcpp/SFVReader.h dcplusplus/trunk/dcpp/SSLSocket.cpp dcplusplus/trunk/dcpp/SSLSocket.h dcplusplus/trunk/dcpp/SearchManager.cpp dcplusplus/trunk/dcpp/SearchManager.h dcplusplus/trunk/dcpp/SearchManagerListener.h dcplusplus/trunk/dcpp/Segment.h dcplusplus/trunk/dcpp/Semaphore.h dcplusplus/trunk/dcpp/ServerSocket.cpp dcplusplus/trunk/dcpp/ServerSocket.h dcplusplus/trunk/dcpp/SettingsManager.cpp dcplusplus/trunk/dcpp/SettingsManager.h dcplusplus/trunk/dcpp/ShareManager.cpp dcplusplus/trunk/dcpp/ShareManager.h dcplusplus/trunk/dcpp/SimpleXML.cpp dcplusplus/trunk/dcpp/SimpleXML.h dcplusplus/trunk/dcpp/Singleton.h dcplusplus/trunk/dcpp/Socket.cpp dcplusplus/trunk/dcpp/Socket.h dcplusplus/trunk/dcpp/Speaker.h dcplusplus/trunk/dcpp/Streams.h dcplusplus/trunk/dcpp/StringSearch.h dcplusplus/trunk/dcpp/StringTokenizer.cpp dcplusplus/trunk/dcpp/StringTokenizer.h dcplusplus/trunk/dcpp/TaskQueue.h dcplusplus/trunk/dcpp/Text.cpp dcplusplus/trunk/dcpp/Text.h dcplusplus/trunk/dcpp/Thread.cpp dcplusplus/trunk/dcpp/Thread.h dcplusplus/trunk/dcpp/TigerHash.cpp dcplusplus/trunk/dcpp/TigerHash.h dcplusplus/trunk/dcpp/TimerManager.cpp dcplusplus/trunk/dcpp/TimerManager.h dcplusplus/trunk/dcpp/Transfer.cpp dcplusplus/trunk/dcpp/Transfer.h dcplusplus/trunk/dcpp/Upload.cpp dcplusplus/trunk/dcpp/UploadManager.cpp dcplusplus/trunk/dcpp/UploadManager.h dcplusplus/trunk/dcpp/User.cpp dcplusplus/trunk/dcpp/User.h dcplusplus/trunk/dcpp/UserCommand.h dcplusplus/trunk/dcpp/UserConnection.cpp dcplusplus/trunk/dcpp/UserConnection.h dcplusplus/trunk/dcpp/UserConnectionListener.h dcplusplus/trunk/dcpp/Util.cpp dcplusplus/trunk/dcpp/Util.h dcplusplus/trunk/dcpp/ZUtils.cpp dcplusplus/trunk/dcpp/ZUtils.h dcplusplus/trunk/dcpp/forward.h dcplusplus/trunk/dcpp/stdinc.cpp dcplusplus/trunk/dcpp/stdinc.h dcplusplus/trunk/dcpp/version.h dcplusplus/trunk/help/gen_changelog.py dcplusplus/trunk/win32/ADLSProperties.cpp dcplusplus/trunk/win32/ADLSProperties.h dcplusplus/trunk/win32/ADLSearchFrame.cpp dcplusplus/trunk/win32/ADLSearchFrame.h dcplusplus/trunk/win32/AboutDlg.cpp dcplusplus/trunk/win32/AboutDlg.h dcplusplus/trunk/win32/Advanced3Page.cpp dcplusplus/trunk/win32/Advanced3Page.h dcplusplus/trunk/win32/AdvancedPage.cpp dcplusplus/trunk/win32/AdvancedPage.h dcplusplus/trunk/win32/Appearance2Page.cpp dcplusplus/trunk/win32/Appearance2Page.h dcplusplus/trunk/win32/AppearancePage.cpp dcplusplus/trunk/win32/AppearancePage.h dcplusplus/trunk/win32/AspectSpeaker.h dcplusplus/trunk/win32/AspectStatus.h dcplusplus/trunk/win32/AspectUserCommand.h dcplusplus/trunk/win32/CertificatesPage.cpp dcplusplus/trunk/win32/CertificatesPage.h dcplusplus/trunk/win32/CommandDlg.cpp dcplusplus/trunk/win32/CommandDlg.h dcplusplus/trunk/win32/DirectoryListingFrame.cpp dcplusplus/trunk/win32/DirectoryListingFrame.h dcplusplus/trunk/win32/DownloadPage.cpp dcplusplus/trunk/win32/DownloadPage.h dcplusplus/trunk/win32/FavHubProperties.cpp dcplusplus/trunk/win32/FavHubProperties.h dcplusplus/trunk/win32/FavHubsFrame.cpp dcplusplus/trunk/win32/FavHubsFrame.h dcplusplus/trunk/win32/FavoriteDirsPage.cpp dcplusplus/trunk/win32/FavoriteDirsPage.h dcplusplus/trunk/win32/FinishedDLFrame.cpp dcplusplus/trunk/win32/FinishedDLFrame.h dcplusplus/trunk/win32/FinishedFrameBase.h dcplusplus/trunk/win32/FinishedULFrame.cpp dcplusplus/trunk/win32/FinishedULFrame.h dcplusplus/trunk/win32/GeneralPage.cpp dcplusplus/trunk/win32/GeneralPage.h dcplusplus/trunk/win32/HashProgressDlg.cpp dcplusplus/trunk/win32/HashProgressDlg.h dcplusplus/trunk/win32/HoldRedraw.h dcplusplus/trunk/win32/HubFrame.cpp dcplusplus/trunk/win32/HubFrame.h dcplusplus/trunk/win32/HubListsDlg.cpp dcplusplus/trunk/win32/HubListsDlg.h dcplusplus/trunk/win32/LineDlg.cpp dcplusplus/trunk/win32/LineDlg.h dcplusplus/trunk/win32/LogPage.cpp dcplusplus/trunk/win32/LogPage.h dcplusplus/trunk/win32/MDIChildFrame.h dcplusplus/trunk/win32/MagnetDlg.cpp dcplusplus/trunk/win32/MagnetDlg.h dcplusplus/trunk/win32/MainWindow.cpp dcplusplus/trunk/win32/MainWindow.h dcplusplus/trunk/win32/MainWindowFactory.cpp dcplusplus/trunk/win32/NetworkPage.cpp dcplusplus/trunk/win32/NetworkPage.h dcplusplus/trunk/win32/NotepadFrame.cpp dcplusplus/trunk/win32/NotepadFrame.h dcplusplus/trunk/win32/PrivateFrame.cpp dcplusplus/trunk/win32/PrivateFrame.h dcplusplus/trunk/win32/PropPage.cpp dcplusplus/trunk/win32/PropPage.h dcplusplus/trunk/win32/PublicHubsFrame.cpp dcplusplus/trunk/win32/PublicHubsFrame.h dcplusplus/trunk/win32/QueueFrame.cpp dcplusplus/trunk/win32/QueueFrame.h dcplusplus/trunk/win32/QueuePage.cpp dcplusplus/trunk/win32/QueuePage.h dcplusplus/trunk/win32/SearchFrame.cpp dcplusplus/trunk/win32/SearchFrame.h dcplusplus/trunk/win32/SettingsDialog.cpp dcplusplus/trunk/win32/SettingsDialog.h dcplusplus/trunk/win32/ShellContextMenu.cpp dcplusplus/trunk/win32/ShellContextMenu.h dcplusplus/trunk/win32/SplashWindow.cpp dcplusplus/trunk/win32/SpyFrame.cpp dcplusplus/trunk/win32/SpyFrame.h dcplusplus/trunk/win32/StaticFrame.h dcplusplus/trunk/win32/StatsFrame.cpp dcplusplus/trunk/win32/StatsFrame.h dcplusplus/trunk/win32/SystemFrame.cpp dcplusplus/trunk/win32/SystemFrame.h dcplusplus/trunk/win32/TabsPage.cpp dcplusplus/trunk/win32/TabsPage.h dcplusplus/trunk/win32/TextFrame.cpp dcplusplus/trunk/win32/TextFrame.h dcplusplus/trunk/win32/TransferView.cpp dcplusplus/trunk/win32/UCPage.cpp dcplusplus/trunk/win32/UCPage.h dcplusplus/trunk/win32/UPnP.cpp dcplusplus/trunk/win32/UPnP.h dcplusplus/trunk/win32/UploadPage.cpp dcplusplus/trunk/win32/UploadPage.h dcplusplus/trunk/win32/UserInfoBase.cpp dcplusplus/trunk/win32/UserInfoBase.h dcplusplus/trunk/win32/UsersFrame.cpp dcplusplus/trunk/win32/UsersFrame.h dcplusplus/trunk/win32/WaitingUsersFrame.h dcplusplus/trunk/win32/WidgetFactory.h dcplusplus/trunk/win32/WidgetPaned.h dcplusplus/trunk/win32/WidgetTextBox.h dcplusplus/trunk/win32/WinUtil.cpp dcplusplus/trunk/win32/WinUtil.h dcplusplus/trunk/win32/WindowsPage.cpp dcplusplus/trunk/win32/WindowsPage.h dcplusplus/trunk/win32/stdafx.h Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2008-02-15 16:46:35 UTC (rev 1010) +++ dcplusplus/trunk/changelog.txt 2008-02-17 11:51:38 UTC (rev 1011) @@ -15,24 +15,25 @@ * Fixed search spy crash * Upgraded to bzip 1.0.4 (thanks mikejj) * Tab tooltips (thanks poy) -* Allow spaces in the description field (poy) -* [ADC] Handle third person formatting (thanks poy) -* Fix right-click issue when chat history is long (thanks poy) -* In waiting users, show requested chunk (since we can't know % done) -* Fixed crash when download connection was disconnected before any data was received +* [L#185724] Allow spaces in the description field (poy) +* [L#180321] [ADC] Handle third person formatting (thanks poy) +* [L#186429] Fix right-click issue when chat history is long (thanks poy) +* [L#188107] In waiting users, show requested chunk (since we can't know % done) +* [L#188585] Fixed crash when download connection was disconnected before any data was received * Fixed crash due to race condition on idle check (thans bigmuscle) * Fixed crash when copying identity * Fixed potential timer race condition (thanks bigmuscle) * The good parts of partially downloaded segments are now added to queue (thanks bigmuscle) * Fancy menus (thanks poy) -* [ADC] Added /me handling (thanks poy) -* Fixed issues with scrolling (thanks poy) -* Fixed re-add sources showing wrong sources (thanks poy) -* Fixed kick message filtering (thanks mikejj) +* [L#180321] [ADC] Added /me handling (thanks poy) +* [L#187288] Fixed issues with scrolling (thanks poy) +* [L#190463] Fixed re-add sources showing wrong sources (thanks poy) +* [L#190469] Fixed kick message filtering (thanks mikejj) * version.xml now use Coral (ullner) * [ADC] Number of files counts unique files when sending stats to hub * [ADC] Fixed kick handling -* Fixed 100% on remove all sources in queue +* [L#190955] Fixed 100% on remove all sources in queue +* Fixed a few hardcoded dc++'s (thanks steven sheehy) * Don't always show the tray icon after killing and re-opening explorer.exe (poy) -- 0.704 2007-12-14 -- @@ -115,26 +116,26 @@ * Fixed one of several possible crashes at exit -- 0.700 2007-10-11 -- -* [bug 1102] Fixed move/rename queue folder (thanks mikael eman) -* [bug 1124] Fixed thread shutdown on *nix (thanks mikael eman) +* [B#1102] Fixed move/rename queue folder (thanks mikael eman) +* [B#1124] Fixed thread shutdown on *nix (thanks mikael eman) * Fixed invalid share size -* [bug 1127] Fixed crash on invalid file list (thanks steven sheehy) -* [bug 1019] Reworked initial filelist dir (thanks mikael eman) +* [B#1127] Fixed crash on invalid file list (thanks steven sheehy) +* [B#1019] Reworked initial filelist dir (thanks mikael eman) * Moved to smartwin to enable mingw compiling (thanks cologic, ullner, poy) * Removed notepad loading compatibility code for notepad texts from versions < 0.20 * Fixed time issues with DC++ running for more than 49 days -* [bug 980] Fixed PM's when popup is disabled (thanks ullner) -* [bug 1066] Search for alternates not available on uploads (thanks ullner) -* [bug 1104] Better error message on dupe source (thanks ullner) -* [bug 1132] Download queue updated when users go offline (thanks stephan hohe) -* [bug 1133] Fixed max tab rows being reset (thanks mikejj) -* [bug 1134] Use SO_REUSEADDR for connection manager socket (thanks mikael eman) -* [bug 1136] Fixed dupe changelog rebuild (thanks mikejj) -* [bug 1139] Fixed download delay in some cases (thanks mikael eman) -* [bug 1144] Added possibility to add many hub lists in one go (use ; as separator) (thanks poy) -* [bug 1152] Only refresh if there are directories shared (thanks ullner) -* [bug 1153] More shell menus (thanks poy) -* [bug 1159] Removed unnecessary resume position reset (thanks cologic) +* [B#980] Fixed PM's when popup is disabled (thanks ullner) +* [B#1066] Search for alternates not available on uploads (thanks ullner) +* [B#1104] Better error message on dupe source (thanks ullner) +* [B#1132] Download queue updated when users go offline (thanks stephan hohe) +* [B#1133] Fixed max tab rows being reset (thanks mikejj) +* [B#1134] Use SO_REUSEADDR for connection manager socket (thanks mikael eman) +* [B#1136] Fixed dupe changelog rebuild (thanks mikejj) +* [B#1139] Fixed download delay in some cases (thanks mikael eman) +* [B#1144] Added possibility to add many hub lists in one go (use ; as separator) (thanks poy) +* [B#1152] Only refresh if there are directories shared (thanks ullner) +* [B#1153] More shell menus (thanks poy) +* [B#1159] Removed unnecessary resume position reset (thanks cologic) * Removed rollback support - advanced TTH resume is now always used (thanks cologic) * Switched to mingw/stlport5.1 * Uninstaller removes adc registry key (thanks ullner) @@ -159,31 +160,31 @@ * SFV checking is now default * Fixed TLS port not being greyed out * Automatic hub reconnection is only done if at least one successful connection has been made -* [bug 1080] Better nick tab completion (thanks cologic) -* [bug 1081] Added user IP in hub frame (thanks cologic) +* [B#1080] Better nick tab completion (thanks cologic) +* [B#1081] Added user IP in hub frame (thanks cologic) * No more STLport for the time being * Linux checks for invalid file types (thanks steven sheehy) * Fixed potential crash when search began with space -* [bug 1085] Better sound playing settings (thanks cologic / ullner) -* [bug 1111] OpenSSL compatibility and some unix fixes (thanks steven sheehy) -* [bug 1056] Added option to sort fav users above other users in hub frame (thanks poy) -* [bug 1063] Added option to show shell context menu in finished frame (thanks poy) -* [bug 1092] Fixed TTH tree being redownloaded (thanks stephan hohe) -* [bug 1097] Fixed waiting users being removed (thanks stephan hohe) -* [bug 1110] Added new adc hub list (thanks mafa_45) -* [bug 1091] Added new nmdc hub lists (thanks poy) -* [bug 1112] Port sign cleanup (thanks steven sheehy) +* [B#1085] Better sound playing settings (thanks cologic / ullner) +* [B#1111] OpenSSL compatibility and some unix fixes (thanks steven sheehy) +* [B#1056] Added option to sort fav users above other users in hub frame (thanks poy) +* [B#1063] Added option to show shell context menu in finished frame (thanks poy) +* [B#1092] Fixed TTH tree being redownloaded (thanks stephan hohe) +* [B#1097] Fixed waiting users being removed (thanks stephan hohe) +* [B#1110] Added new adc hub list (thanks mafa_45) +* [B#1091] Added new nmdc hub lists (thanks poy) +* [B#1112] Port sign cleanup (thanks steven sheehy) * [ADC] Fixed client-to-client connection sequence -* [bug 1064] Updated to YaSSL 1.5.0, should fix crash -* [bug 446] Public hub lists are cached and downloaded only when user requests it (thanks poy) -* [bug 1117] Fixed subfolders being created on filelist downloads (thanks mikael eman) -* [bug 1096] Updated credits in about box -* [bug 1123] Removed some typecasts (thanks stephan hohe) -* [bug 1099] Fixed "Readd all" spin -* [bug 1095] Fixed about dialog +* [B#1064] Updated to YaSSL 1.5.0, should fix crash +* [B#446] Public hub lists are cached and downloaded only when user requests it (thanks poy) +* [B#1117] Fixed subfolders being created on filelist downloads (thanks mikael eman) +* [B#1096] Updated credits in about box +* [B#1123] Removed some typecasts (thanks stephan hohe) +* [B#1099] Fixed "Readd all" spin +* [B#1095] Fixed about dialog -- 0.698 2006-10-10 -- -* [bug 1065] Code cleanup (thanks steven sheehy) +* [B#1065] Code cleanup (thanks steven sheehy) * Fixed readme.txt (thanks ullner) * More code cleanup * Fixed trusted/untrusted upload view @@ -198,20 +199,20 @@ * Fixed a few random crashes * [ADC] Removed obsolete DSC command * Fixed user list not being updated in some cases -* [bug 1071] Added fasthash for unix (thanks steven sheehy) +* [B#1071] Added fasthash for unix (thanks steven sheehy) -- 0.697 2006-09-29 -- * [ADC] Fixed a few protocol issues * Some code cleanup * Queue frame fixes and memory saves * TLS port change without restart fixed -* [bug 1007] Fixed nick character check +* [B#1007] Fixed nick character check * Fixed some transfer view sorting issues -* [bug 59] Added option to match all local lists +* [B#59] Added option to match all local lists -- 0.696 2006-09-22 -- * Fixed a possible deadlock -* [bug 1058] Removed some whitespace (big thanks to mikejj) +* [B#1058] Removed some whitespace (big thanks to mikejj) * Removed the possibility to download files without TTH * Removed the possibility to read *.DcLst files (no TTH, no i18n support) * Files with no TTH no longer show up in search and directory listings @@ -223,44 +224,44 @@ * Upgraded yaSSL to 1.4.0 * Fixed some SSL connection issues * Fixed on-the-fly compression of file lists -* [bug 1055] Stopped files.xml.bz2 from being deleted on linux (thanks dorian) -* [bug 1061] Log page fix (thanks fleetcommand) -* [bug 1033] Altered NMDC hubname/description detection slightly (thanks fleetcommand) -* [bug 1059] Fixed the possibility for users to become hidden in some cases (thanks fleetcommand) +* [B#1055] Stopped files.xml.bz2 from being deleted on linux (thanks dorian) +* [B#1061] Log page fix (thanks fleetcommand) +* [B#1033] Altered NMDC hubname/description detection slightly (thanks fleetcommand) +* [B#1059] Fixed the possibility for users to become hidden in some cases (thanks fleetcommand) -- 0.695 2006-09-10 -- * PM popup/ignore options updated, in nmdc a hub is any nick which hasn't sent a hello or myinfo, and a bot is a nick with myinfo without connection type -* [bug 125] Fixed out-of-order PM/quit -* [bug 224] Slots are no longer granted to disconnected users, instead disconnection is delayed a minute +* [B#125] Fixed out-of-order PM/quit +* [B#224] Slots are no longer granted to disconnected users, instead disconnection is delayed a minute * [NMDC] Fixed extra space in chat -* [bug 395] Fixed password being blanked -* [bug 419] Allowed changing case only when moving file in queue -* [bug 736] Fixed escaping of menu items -* [bug 1013] Fixed gcc warnings (thanks steven sheehy) -* [bug 1023] Fixed some large stack allocations (thanks steven sheehy) -* [bug 1026] Fixed some potential buffer overflows (thanks steven sheehy) -* [bug 1027] Improved unix socket support (thanks steven sheehy) -* [bug 1028] Improved big endian support (thanks steven sheehy) -* [bug 1029] Fixed BSD compile issue (thanks steven sheehy) -* [bug 1031] Fixed a crash after closing hub window (thanks bigmuscle/mikejj) -* [bug 1032] Fixed certificates help (thanks mikejj) +* [B#395] Fixed password being blanked +* [B#419] Allowed changing case only when moving file in queue +* [B#736] Fixed escaping of menu items +* [B#1013] Fixed gcc warnings (thanks steven sheehy) +* [B#1023] Fixed some large stack allocations (thanks steven sheehy) +* [B#1026] Fixed some potential buffer overflows (thanks steven sheehy) +* [B#1027] Improved unix socket support (thanks steven sheehy) +* [B#1028] Improved big endian support (thanks steven sheehy) +* [B#1029] Fixed BSD compile issue (thanks steven sheehy) +* [B#1031] Fixed a crash after closing hub window (thanks bigmuscle/mikejj) +* [B#1032] Fixed certificates help (thanks mikejj) * Added possibility to store configuration files in separate directory * Switched back to unicows for w9x users, opencow was missing too many functions -* [bug 876] Fixed lost tooltips (thanks poy and bigmuscle) -* [bug 1041] Fixed about tab order (thanks mikejj) -* [bug 1042] Fixed experts tab order (thanks mikejj) -* [bug 1047] Fixed possible nmdc crash (thanks guitarm) -* [bug 1049] Added tooltip to tab bar (thanks poy) -* [bug 1053] Fixed vista detection (thanks ullner) -* [bug 988] Fixed duplicate nicks -* [bug 1015] Fixed chevron text +* [B#876] Fixed lost tooltips (thanks poy and bigmuscle) +* [B#1041] Fixed about tab order (thanks mikejj) +* [B#1042] Fixed experts tab order (thanks mikejj) +* [B#1047] Fixed possible nmdc crash (thanks guitarm) +* [B#1049] Added tooltip to tab bar (thanks poy) +* [B#1053] Fixed vista detection (thanks ullner) +* [B#988] Fixed duplicate nicks +* [B#1015] Fixed chevron text * Default hub lists updated -- 0.694 2006-07-10 -- * Fixed crash in certificates page -* [bug 1005] Fixed linux compile issue (thanks tpo) -* [bug 1004] Fixed browse file list on self +* [B#1005] Fixed linux compile issue (thanks tpo) +* [B#1004] Fixed browse file list on self * Both .crt and .pem files are read as trusted certificates -- 0.693 2006-07-09 -- @@ -268,58 +269,58 @@ * Added language code to example language xml -- 0.692 2006-07-09 -- -* [bug 927] Fixed OP detection bug really (thanks mikejj) -* [bug 938] Added a few more ADC info fields (thanks ullner) -* [bug 939] Fixed hub info update (thanks ullner) -* [bug 940] Fixed a 64-bit compile error (thanks steven sheehy) -* [bug 942] Fixed atomic operations on unices (thanks tobias nygren) -* [bug 943] Fixed unix utsname compile issue (thanks tobias nygren) -* [bug 944] Fixed unix string conversion bug (thanks tobias nygren) -* [bug 945] Fixed unix mutex initialiser (thanks tobias nygren) -* [bug 946] Tiger hash supports big endian and 64-bit architectures (thanks tobias nygren) -* [bug 941] Updated usercount display (thanks mikejj) -* [bug 951] Fixed issue with high port numbers (thanks tpo) -* [bug 958] Search spy tth option automagically saved (thanks ullner) -* [bug 959] Code cleanup (thanks mikejj) -* [bug 966] Max hash speed fixed when fast hashing method is not used (thanks steven sheehy) -* [bug 967] Fixed path case-sensitivity issue (thanks steven sheehy) +* [B#927] Fixed OP detection bug really (thanks mikejj) +* [B#938] Added a few more ADC info fields (thanks ullner) +* [B#939] Fixed hub info update (thanks ullner) +* [B#940] Fixed a 64-bit compile error (thanks steven sheehy) +* [B#942] Fixed atomic operations on unices (thanks tobias nygren) +* [B#943] Fixed unix utsname compile issue (thanks tobias nygren) +* [B#944] Fixed unix string conversion bug (thanks tobias nygren) +* [B#945] Fixed unix mutex initialiser (thanks tobias nygren) +* [B#946] Tiger hash supports big endian and 64-bit architectures (thanks tobias nygren) +* [B#941] Updated usercount display (thanks mikejj) +* [B#951] Fixed issue with high port numbers (thanks tpo) +* [B#958] Search spy tth option automagically saved (thanks ullner) +* [B#959] Code cleanup (thanks mikejj) +* [B#966] Max hash speed fixed when fast hashing method is not used (thanks steven sheehy) +* [B#967] Fixed path case-sensitivity issue (thanks steven sheehy) * Fixed auto-reconnect -* [bug 936] Fixed duplicate entries in search hubs +* [B#936] Fixed duplicate entries in search hubs * Fixed some hub title display issues * Some spring cleanup -* [bug 970] Unix file permissions correctly set (thanks steven sheehy) +* [B#970] Unix file permissions correctly set (thanks steven sheehy) * [ADC] Allowed $ and | in nick/description * Fixed targetdrive bug for temp target location * Fixed a crash bug when hash data cannot be saved * Possibly fixed issues with queue items not being updated * Added warning when someone tries to spam hublist.org or dcpp.net with your client -* [bug 968] Fixed unix compile issue (thanks mikejj) -* [bug 975] Fixed silly warning (thanks mikejj) -* [bug 978] Fixed 64-bit compiler issue (thanks steven sheehy) -* [bug 988] Only unique nicks diplayed in title bar +* [B#968] Fixed unix compile issue (thanks mikejj) +* [B#975] Fixed silly warning (thanks mikejj) +* [B#978] Fixed 64-bit compiler issue (thanks steven sheehy) +* [B#988] Only unique nicks diplayed in title bar * Added protection from hubs/clients sending junk data resulting in high memory usage / crash * Updated to yaSSL 1.3.7 * Added a few TLS options; [U] in transfer status means untrusted TLS (encrypted but certificate not validated) * Added certificate generation, OpenSSL must be installed and in PATH for this to work -* [bug 996] Fixed an issue where directories that are hard to delete were created -* [bug 1000] Fixed linux compile issue (thanks steven sheehy) -* [bug 949] Fixed a crash when reading invalid XML files +* [B#996] Fixed an issue where directories that are hard to delete were created +* [B#1000] Fixed linux compile issue (thanks steven sheehy) +* [B#949] Fixed a crash when reading invalid XML files * TLS port may now be specified in settings and is only opened if TLS is enabled * Added TLS port to /connection -* [bug 977] Added copy hub address to hub right-click menu (thanks mikejj) -* [bug 1001] Fixed assertion on unix (thanks steven sheehy) +* [B#977] Added copy hub address to hub right-click menu (thanks mikejj) +* [B#1001] Fixed assertion on unix (thanks steven sheehy) -- 0.691 2006-06-03 -- * Links to bugzilla in html changelog -* [bug 122] Added userlist filter (thanks trem) -* [bug 578] Added search for alternates to transfers menu (thanks trem) -* [bug 861] Fixed auto-prio not being set correctly (thanks trem) -* [bug 878] Added close all ... to window menu (thanks trem) -* [bug 903] Holding shift while minimizing will use opposite tray setting (thanks joakim tosteberg) -* [bug 923] PM history always read (thanks trem) -* [bug 927] Fixed OP detection bug (thanks mikejj) -* [bug 929] Fixed list view flicker issues (thanks trem) -* [bug 931] Improved keyboard navigation (thanks trem) +* [B#122] Added userlist filter (thanks trem) +* [B#578] Added search for alternates to transfers menu (thanks trem) +* [B#861] Fixed auto-prio not being set correctly (thanks trem) +* [B#878] Added close all ... to window menu (thanks trem) +* [B#903] Holding shift while minimizing will use opposite tray setting (thanks joakim tosteberg) +* [B#923] PM history always read (thanks trem) +* [B#927] Fixed OP detection bug (thanks mikejj) +* [B#929] Fixed list view flicker issues (thanks trem) +* [B#931] Improved keyboard navigation (thanks trem) * Added "all" to hub list field search (thanks trem) * Fixed bug when sending active ADC search results * Updated to ADC 0.11 @@ -342,29 +343,29 @@ * Another fix for opencow * Fixed user command parameters not being remembered * Fixed ADC op commands -* [bug 464] Added option for masked password prompt (thanks ullner) -* [bug 922] Updated help links (thanks xan) +* [B#464] Added option for masked password prompt (thanks ullner) +* [B#922] Updated help links (thanks xan) * Fixed op count -* [bug 230] Added settings to tray menu -* [bug 403] Unfinished file lists deleted since they're never resumed anyway -* [bug 639] Separated remove user from queue menu option -* [bug 766] Fixed broken app titlebar +* [B#230] Added settings to tray menu +* [B#403] Unfinished file lists deleted since they're never resumed anyway +* [B#639] Separated remove user from queue menu option +* [B#766] Fixed broken app titlebar * Removed support for generating NMDC-style file lists (old clients won't be able to download from you) -- 0.689 2006-04-01 -- * Fixed displaying of available bytes when user list is off * Fixed a potential crash when not showing user list * Fixed 100% CPU bug on upload -* [bug 853] Fixed missing function in opencow +* [B#853] Fixed missing function in opencow -- 0.688 2006-03-18 -- * Fixed public hubs sorting (thanks mikejj) * Fixed a ZPipe issue (thanks jove) -* [bug 858] Fixed a 100% cpu / crash bug -* [bug 872] Fixed a pm issue hopefully -* [bug 812] Fixed pm's being sent to bots +* [B#858] Fixed a 100% cpu / crash bug +* [B#872] Fixed a pm issue hopefully +* [B#812] Fixed pm's being sent to bots * Files with invalid crc-32, as per their sfv file, are no longer shared -* [bug 873] Added connect to hub option (thanks joakim tosteberg) +* [B#873] Added connect to hub option (thanks joakim tosteberg) * Fixed an issue with linux file reading (thanks bart vullings and steven) * Added back/forward mouse/keyboard navigation to directory listing frame @@ -393,15 +394,15 @@ * Fixed "browse list" being available for NMDC users * [ADC] Removed obsolete CI field * Fixed missing upload progress -* [bug 89] Readded dynamic compression disabling +* [B#89] Readded dynamic compression disabling * Added filelist download speed to filelist browser status bar * Added advanced hublist filter (thanks trem) -* [bug 579] Fixed 0-byte files not being created if directory doesn't exist -* [bug 804] Cleaned up project files (thanks mikejj) +* [B#579] Fixed 0-byte files not being created if directory doesn't exist +* [B#804] Cleaned up project files (thanks mikejj) * Socket buffer size = 0 now means use system default -* [bug 789] Fixed wrong nick being copied (thanks ullner) -* [bug 794] [ADC] Fixed automatic reconnect (thanks ullner) -* [bug 806] Fixed description for favorite hubs (thanks ullner) +* [B#789] Fixed wrong nick being copied (thanks ullner) +* [B#794] [ADC] Fixed automatic reconnect (thanks ullner) +* [B#806] Fixed description for favorite hubs (thanks ullner) * Updated to latest ADC specs, this will break 0.68/0.681/0.6811 queue sources and fav users (for NMDC as well) * Fixed a bufferedsocket crash * [ADC] Fixed quitting user processing (thanks ullner) @@ -414,8 +415,8 @@ * Changed to open source version unicows for win9x users, perhaps this one will work better for you (see it as a last attempt; if it doesn't work, w9x support will be phased out completely unless someone else solves the win9x issues) -* [bug 774] Fixed invalid description being sent if hub modifies it -* [bug 818] Fixed default exit mnemonic +* [B#774] Fixed invalid description being sent if hub modifies it +* [B#818] Fixed default exit mnemonic * Fixed some more crashes (thanks bigmuscle) * Fixed some shutdown issues * Updated country database @@ -429,12 +430,12 @@ * Minor user command fix (thanks garg) * Removed some duplicate code (thanks trem) * Ctrl-a to select all items in a list (thanks garg) -* [bug 484] Added a check for multiple refreshes running at the same time (thanks trem) +* [B#484] Added a check for multiple refreshes running at the same time (thanks trem) * Fixed a few crashes here and there * Fixed no-slots message not being sent out always * Fixed yassl build locations (thanks mikejj) * Added ip resolve cache when searching (thanks trem) -* [bug 413] Failed file moves are now reported to the system log +* [B#413] Failed file moves are now reported to the system log -- 0.68 2006-01-08 -- * Changed the user identification process completely to work better with ADC. This leads to a more strict interpretation of @@ -443,7 +444,7 @@ this will rarely be used (since file lists are free and downloaded almost instantly) * Fixed international timestamps (thanks ullner) * Fixed targetdrive docs (thanks ullner) -* [bug 485] Fixed transfer list view flicker on WinXP +* [B#485] Fixed transfer list view flicker on WinXP * New connection settings, please check settings page * Connection type strings changed * No longer falls back to passive mode on failed UPnP @@ -451,35 +452,35 @@ * Removed some old favorite file format compatibility code * Added country to search frame (thanks paka) * Strftime fix (thanks garg) -* [bug 521] Help instead of readme shown on first startup (thanks paka) -* [bug 553] Minimize to tray and confirm appexit default to true (thanks paka) -* [bug 452] Fixed example.xml language file generation (thanks tpo) -* [bug 556] Fixed last searches purge (thanks sulan) -* [bug 73] Added option to disconnect slow sources (thanks paka) +* [B#521] Help instead of readme shown on first startup (thanks paka) +* [B#553] Minimize to tray and confirm appexit default to true (thanks paka) +* [B#452] Fixed example.xml language file generation (thanks tpo) +* [B#556] Fixed last searches purge (thanks sulan) +* [B#73] Added option to disconnect slow sources (thanks paka) * ADC hub counts updated correctly (thanks ullner) -* [bug 325] Added error message when adding dupe fav hub (thanks ullner) +* [B#325] Added error message when adding dupe fav hub (thanks ullner) * Updated bzip2 to 1.0.3 (thanks garg) * Some small *nix fixes (thanks poison) * Source path no longer saved for TTH enabled clients (saves memory and queue file space) -* [bug 335] Search window settings saved automatically (thanks mikejj) +* [B#335] Search window settings saved automatically (thanks mikejj) * Open folder selects file in explorer (thanks mikejj) * Local echo in pm window formatted as the other side should see it (thanks paka) * Fixed debug assertion (thanks tpo) * Dirty tabs settings improved (thanks ullner) * ZLib upgraded to 1.2.3, possibly fixing security issues (thanks garg) * Slot grants now last one connection instead of 10 minutes -* [bug 632] Subtotals shown when selecting users in hub frame (thanks cologic) -* [bug 625] /u chat command opens url (thanks pur) +* [B#632] Subtotals shown when selecting users in hub frame (thanks cologic) +* [B#625] /u chat command opens url (thanks pur) * [NMDC] The first word of hub name is taken as short name for displaying purposes when space is limited -* [bug 629] Waiting users frame added (thanks cologic) +* [B#629] Waiting users frame added (thanks cologic) * Removed old versions check (thanks cologic) -* [bug 635] Added option to limit maximum file list size to open (thanks paka) +* [B#635] Added option to limit maximum file list size to open (thanks paka) * Filelist transfer logging default to off (thanks paka) * Added some checks when creating fav hubs (thanks tpo) * More settings screen updates (thanks ullner) * Fixed linux file moving (thanks naga) -* [bug 260] Added option to only download files with TTH (thanks ullner) -* [bug 708] Fixed registry creation functions used (thanks ullner) +* [B#260] Added option to only download files with TTH (thanks ullner) +* [B#708] Fixed registry creation functions used (thanks ullner) * Updated WTL * Rewrote socket code to remove some old hacks and add some new (major change) * Now using standard windows error messages for socket errors @@ -497,12 +498,12 @@ * Improved hashing error reporting * Fixed hash database rebuild * Added /removefav command to remove a favorite hub (thanks ullner) -* [bug 717] Fixed search combo box (thanks mikejj) +* [B#717] Fixed search combo box (thanks mikejj) * Added option to change auto-refresh interval (thanks ullner) -* [bug 740] Removed tab completion option (thanks ullner) -* [bug 743] Added registry key creation failure notification (thanks ullner) -* [bug 717] Fixed dropdown sizes (thanks mikejj) -* [bug 760] Fixed list subtraction issue (thanks cologic) +* [B#740] Removed tab completion option (thanks ullner) +* [B#743] Added registry key creation failure notification (thanks ullner) +* [B#717] Fixed dropdown sizes (thanks mikejj) +* [B#760] Fixed list subtraction issue (thanks cologic) * Added some right-to-left support, but it probably needs more work * [NMDC] Minislots are no longer given to old DC++ clients (<0.304) * [ADC] Directory size returned with search results @@ -517,7 +518,7 @@ * Fixed context menu open for multi-screen setups (thanks trem) * Changed country database to the original format so that users can update by themselves (thanks paka) * Fixed some registry issues (thanks trem) -* [bug 443] Fixed localised number encodings (thanks trem) +* [B#443] Fixed localised number encodings (thanks trem) * Updated sorting to use a more windows-like order (thanks trem) * Fixed an issue with restore all (thanks krzysztof tyszecki) * Added list view tooltips @@ -538,10 +539,10 @@ -- 0.671 2005-03-19 -- * Added possibility to set minislot size (thanks ullner) -* [bug 22] Added possibility for multiline away messages and user commands (thanks ullner) +* [B#22] Added possibility for multiline away messages and user commands (thanks ullner) * Added file type to queue frame (thanks ullner) * Changed stats frame to use standard colors (thanks yoji) -* [bug 439] Fixed purge button (thanks ullner) +* [B#439] Fixed purge button (thanks ullner) * Fixed search frame only tth issue (thanks naga) * Updated to ADC 0.9 * Fixed a crash bug (thanks trem) @@ -557,40 +558,40 @@ * Basic ADC transfers now work * Added option to specify bind address for sockets (thanks sed) * Made the connection flood trigger slighly less sensitive -* [bug 58] Fixed strange user list behaviour -* [bug 83] Consolidated auto-open window options +* [B#58] Fixed strange user list behaviour +* [B#83] Consolidated auto-open window options * Fixed some context menu stuff -- 0.670 2005-02-04 -- * Fixed an issue with international formats of float numbers (also fixes UDP port setting) * Fixed a minor crash log output address issue * Split off color and sound to a new page (thanks ullner) -* [bug 359] Fixed an issue with negative search terms (thanks naga) +* [B#359] Fixed an issue with negative search terms (thanks naga) * Added option to filter TTH results in search spy (thanks joakim tosteberg) -* [bug 184] Updated log functionality to allow users to customize log filenames (thanks naga) +* [B#184] Updated log functionality to allow users to customize log filenames (thanks naga) * Fixes to log edit function (thanks naga) * Added possibility to filter all searches without tth (thanks naga) * More preferences splitting (thanks ullner) * Small socket fix (thanks tremor) * Search tab goes bold if set to (thanks naga) * Hopefully fixed an UPnP crash -* [bug 302] User commands in file lists (thanks joakim tosteberg) +* [B#302] User commands in file lists (thanks joakim tosteberg) * ADC url's clickable (thanks naga) -* [Bug 117] Improved search timer to avoid spamming hub (thanks naga) +* [B#117] Improved search timer to avoid spamming hub (thanks naga) * Redid some of the hash storage code, should be slighly more efficient -* [bug 94] Share is cached for faster startup +* [B#94] Share is cached for faster startup * Temporary targetnames are now filled in when download starts, not when item is added to queue, which makes temp target dir changes happen for current queue items as well, plus we get a huge memory save on huge queues. -* [bug 363] Added "Remove All Sources" to queue (thanks izzzo & garg) +* [B#363] Added "Remove All Sources" to queue (thanks izzzo & garg) * Queue menu items greyed out when there are no items (thanks izzzo) * Fixed a crash with certain empty lists (thanks garg) * Added "restore all" to undo "minimize all" (thanks guitarm) * Added optional pm history (thanks trem and ullner) * Better log file managment (thanks trem) -* [bug 412] Fixed a queue count issue on removal (thanks ullner) -* [bug 9] Fixed a queue move issue (thanks paka) -* [bug 20] Fixed upload auto-slot granting (thanks naga) +* [B#412] Fixed a queue count issue on removal (thanks ullner) +* [B#9] Fixed a queue move issue (thanks paka) +* [B#20] Fixed upload auto-slot granting (thanks naga) * Redid adl search to accomodate for partial list browsing (thanks garg) * Added initial ADC file transfers support * ADC hub connectivity improved @@ -619,10 +620,10 @@ * Added exact file size to directory listings (thanks paka) * Remove confirm fix (thanks trem) * Added option for the new tab select behaviour (thanks trem) -* [bug 116] Added possibility to download to temp folder on the same drive as target (thanks sed) +* [B#116] Added possibility to download to temp folder on the same drive as target (thanks sed) * Fixed user command string for file list context (thanks sed) -* [bug 290] Added more correct escaping of search strings (thanks sed) -* [bug 432] Fixed download directory for adlsearch matches (thanks ullner) +* [B#290] Added more correct escaping of search strings (thanks sed) +* [B#432] Fixed download directory for adlsearch matches (thanks ullner) * Some UPnP fixes (thanks nils maier) * ADL Search byte prefix fixes, might screw up your adl search settings on first load (thanks ullner) * Linux download path fix (thanks jens oknelid) @@ -631,7 +632,7 @@ * Fixed alt source download starts (thanks paka) -- 0.668 2004-11-30 -- -* [bug 311] Fixed crash on open own filelist (thanks sulan) +* [B#311] Fixed crash on open own filelist (thanks sulan) * Added option to make /join open a new window (thanks ullner) * Added mailto: to link-clicking (thanks ullner) * Fixed stack overflow with excessive xml nesting (thanks farcry) @@ -642,18 +643,18 @@ * PgUp/PgDn now scroll the chat window (thanks jonathan stone) * Small fix with line history (thanks jonathan stone) * Added option to use separate TCP and UDP ports -* [bug 303] Fixed a raw command guessing bug (thanks garg) -* [bug 345] Fixed an xml listing parsing bug -* [bug 309] Hopefully fixed nt4 startup +* [B#303] Fixed a raw command guessing bug (thanks garg) +* [B#345] Fixed an xml listing parsing bug +* [B#309] Hopefully fixed nt4 startup * Hopefully fixed an issue with downloading international search results from old clients -- 0.667 2004-11-15 -- * Improved multiple hublist support (thanks garg) * Fixed some favdirs issues (thanks naga) * Fixed a status logging issue (thanks naga) -* [bug 289] Fixed annoying login issue +* [B#289] Fixed annoying login issue * Added possibility to rename shares (thanks naga and tremor) -* [bug 106] Fixed show joins for fav users (thanks ullner) +* [B#106] Fixed show joins for fav users (thanks ullner) * Fixed some unnecessary connects when download slots are full * Fixed magnet registration issue (thanks garg) * Some code documentation work (thanks jonathan jansson) @@ -671,64 +672,64 @@ * Fixed so that a connection attempt is made when changing a transfer to highest priority -- 0.666 2004-11-03 -- -* [bug 173] Fixed copy nick to clipboard (thanks trem) +* [B#173] Fixed copy nick to clipboard (thanks trem) * Removed some old code (thanks garg) * Added tth to log codes (thanks garg) * Added # of locally filtered results to search frame (thanks garg) * Fixed a crash in the upnp code * Fixed wide formatting of time (thanks garg) -* [bug 166] Added local filtering of searches with "-" in front of the search term (thanks cologic) +* [B#166] Added local filtering of searches with "-" in front of the search term (thanks cologic) * Fixed a missing hubframe stats bug (thanks trem) -* [bug 87] TTH's are now correctly searched for in search spy (thanks trem) -* [bug 256] Fixed an issue with utf8 user commands (thanks trem) +* [B#87] TTH's are now correctly searched for in search spy (thanks trem) +* [B#256] Fixed an issue with utf8 user commands (thanks trem) * Moved to a less intrusive build procedure where stlport and wtl are local to the DC++ build (see compile.txt) * Added /log to show log for current hub / user (thanks garg) * More internationalization (thanks garg) * Updated some template code (thanks farcry) * Extended log command (thanks ullner) -* [bug 212] Fixed issue with utf-8 nicks during login to some hubs (thanks garg) +* [B#212] Fixed issue with utf-8 nicks during login to some hubs (thanks garg) * Fixed issue with utf-8 time formatting for certain languages in certain locales * Removed search optimisation obsoleted by tth's and bloom filters (those of you with a large number of files in your share, post on the forum if you notice any big increase in CPU usage) -* [bug 69] Added option not to download files already in share (by TTH) (thanks TPO) +* [B#69] Added option not to download files already in share (by TTH) (thanks TPO) * Help file work (garg, ullner) * Added petabytes (PiB) (thanks garg) * Clicking on active tab will deactivate it (thanks garg) -* [bug 227] Fixed an issue with loading invalid virtual names when upgrading (thanks garg) -* [bug 256] Fixed another issue with user commands (thanks garg) +* [B#227] Fixed an issue with loading invalid virtual names when upgrading (thanks garg) +* [B#256] Fixed another issue with user commands (thanks garg) * Updated to WTL 7.5.4291 -* [bug 183] Hopefully fixed a few issues with w9x and Unicode +* [B#183] Hopefully fixed a few issues with w9x and Unicode * Fixed common control initialization * Unix makefile now generates a shared lib (thanks jeremy huddleston) * Slight memory save for hash database -* [bug 130] Added favorite hub removal confirmation option (thanks ullner) -* [bug 5] Fixed broken redirect (thanks garg) +* [B#130] Added favorite hub removal confirmation option (thanks ullner) +* [B#5] Fixed broken redirect (thanks garg) * Added spy frame column saving (thanks garg) * ADL Search autoqueue saved now (thanks garg) * Window minimization issue fix (thanks garg) -* [bug 129] Fixed some issues with downloading >4GiB files -* [bug 15] ADL Search goto directory fixed (thanks garg) +* [B#129] Fixed some issues with downloading >4GiB files +* [B#15] ADL Search goto directory fixed (thanks garg) * Some fixes for compiling on osx (thanks jonathan jansson) * Removed Makedefs in favour of a python script * FastAlloc disabled in debug builds -* [bug 266] Fixed a crash with offline users and user commands (thanks naga) -* [bug 165] Fixed a case insensitivity issue (thanks farcry) -* [bug 18] Added favorite download directories (thanks naga) +* [B#266] Fixed a crash with offline users and user commands (thanks naga) +* [B#165] Fixed a case insensitivity issue (thanks farcry) +* [B#18] Added favorite download directories (thanks naga) * Fixed MyINFO spam when hashing -- 0.4034 2004-10-03 -- * Help file additions (thanks naga & ullner) -* [bug 170] Fixed a few issues with files not being hashed correctly (thanks garg) +* [B#170] Fixed a few issues with files not being hashed correctly (thanks garg) * More ADC fixes (thanks sed) * Fixed some ADLSearch stuff (thanks garg) * Added item count to finished frames (thanks garg) * Fixed user commands encoding (thanks garg) * Added last search time to search spy (thanks ullner) -* [bug 3] Fixed queue size growing on queue item move +* [B#3] Fixed queue size growing on queue item move * Fixed missing file list on 0 byte share -* [bug 185] Fixed missing search results (thanks garg) +* [B#185] Fixed missing search results (thanks garg) -- 0.4033 2004-09-27 -- *** WARNING *** @@ -745,7 +746,7 @@ * Files that can't be moved to the target drive from the temp folder are now renamed to their real name * Text with unix and mac line end encodings should now be correctly displayed -* [bug 35] TTH Values are used for right click download menus when available +* [B#35] TTH Values are used for right click download menus when available * Upgraded to WTL 7.5.4196 * Updated license to allow others to release legal binaries compiled against WTL * Moved the core structures to UTF-8 to allow correct internationalisation (major change) @@ -758,7 +759,7 @@ * Removed autosearch string, it's not used any more * Fixed a tth hash speed bug (hashing should be much faster now) * File listings are now generated on the fly when someone needs them -* [bug 127] Added UPnP support (thanks mark gillespie) +* [B#127] Added UPnP support (thanks mark gillespie) * Ctrl-L now opens file lists (thanks garg) * Various ADC patches (thanks sedulus) * Slightly changed temporary download name @@ -774,7 +775,7 @@ * Files scheduled for viewing are always set to highest prio * Added rudimentary automake and autoconf support for the client part, perhaps this will encourage someone to finish a nice linux port -* [bug 162] Fixed dupe usercommands on reconnect (thanks sed) +* [B#162] Fixed dupe usercommands on reconnect (thanks sed) * Links now clickable in PM's and notepad as well (thanks naga) * Files are no longer hashed if the shared directory is removed while hashing * Added hash progress dialog, hashing is run at a higher priority when dialog is shown @@ -782,7 +783,7 @@ * Better strategy for removing old filelists on exit (thanks garg) * Added Geo-IP license and fixes (thanks garg) * Added Help file - make sure you read it (thanks garg) -* [bug 169] Fixed a memory leak with rollback buffers under certain conditions +* [B#169] Fixed a memory leak with rollback buffers under certain conditions * ADC INF updates only send the necessary info (thanks sed) -- 0.4032 2004-08-08 -- Modified: dcplusplus/trunk/dcpp/ADLSearch.cpp =================================================================== --- dcplusplus/trunk/dcpp/ADLSearch.cpp 2008-02-15 16:46:35 UTC (rev 1010) +++ dcplusplus/trunk/dcpp/ADLSearch.cpp 2008-02-17 11:51:38 UTC (rev 1011) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001-2007 Jacek Sieka, arnetheduck on gmail point com + * Copyright (C) 2001-2008 Jacek Sieka, arnetheduck on gmail point com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Modified: dcplusplus/trunk/dcpp/ADLSearch.h =================================================================== --- dcplusplus/trunk/dcpp/ADLSearch.h 2008-02-15 16:46:35 UTC (rev 1010) +++ dcplusplus/trunk/dcpp/ADLSearch.h 2008-02-17 11:51:38 UTC (rev 1011) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001-2007 Jacek Sieka, arnetheduck on gmail point com + * Copyright (C) 2001-2008 Jacek Sieka, arnetheduck on gmail point com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Modified: dcplusplus/trunk/dcpp/AdcCommand.cpp =================================================================== --- dcplusplus/trunk/dcpp/AdcCommand.cpp 2008-02-15 16:46:35 UTC (rev 1010) +++ dcplusplus/trunk/dcpp/AdcCommand.cpp 2008-02-17 11:51:38 UTC (rev 1011) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001-2007 Jacek Sieka, arnetheduck on gmail point com + * Copyright (C) 2001-2008 Jacek Sieka, arnetheduck on gmail point com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Modified: dcplusplus/trunk/dcpp/AdcCommand.h =================================================================== --- dcplusplus/trunk/dcpp/AdcCommand.h 2008-02-15 16:46:35 UTC (rev 1010) +++ dcplusplus/trunk/dcpp/AdcCommand.h 2008-02-17 11:51:38 UTC (rev 1011) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001-2007 Jacek Sieka, arnetheduck on gmail point com + * Copyright (C) 2001-2008 Jacek Sieka, arnetheduck on gmail point com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Modified: dcplusplus/trunk/dcpp/AdcHub.cpp =================================================================== --- dcplusplus/trunk/dcpp/AdcHub.cpp 2008-02-15 16:46:35 UTC (rev 1010) +++ dcplusplus/trunk/dcpp/AdcHub.cpp 2008-02-17 11:51:38 UTC (rev 1011) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001-2007 Jacek Sieka, arnetheduck on gmail point com + * Copyright (C) 2001-2008 Jacek Sieka, arnetheduck on gmail point com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -573,7 +573,7 @@ uint16_t port = secure ? ConnectionManager::getInstance()->getSecurePort() : ConnectionManager::getInstance()->getPort(); if(port == 0) { // Oops? - LogManager::getInstance()->message(_("Not listening for connections - please restart DC++")); + LogManager::getInstance()->message(str(F_("Not listening for connections - please restart %1%") % APPNAME)); return; } send(AdcCommand(AdcCommand::CMD_CTM, user.getIdentity().getSID(), AdcCommand::TYPE_DIRECT).addParam(*proto).addParam(Util::toString(port)).addParam(token)); Modified: dcplusplus/trunk/dcpp/AdcHub.h =================================================================== --- dcplusplus/trunk/dcpp/AdcHub.h 2008-02-15 16:46:35 UTC (rev 1010) +++ dcplusplus/trunk/dcpp/AdcHub.h 2008-02-17 11:51:38 UTC (rev 1011) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001-2007 Jacek Sieka, arnetheduck on gmail point com + * Copyright (C) 2001-2008 Jacek Sieka, arnetheduck on gmail point com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Modified: dcplusplus/trunk/dcpp/BZUtils.cpp =================================================================== --- dcplusplus/trunk/dcpp/BZUtils.cpp 2008-02-15 16:46:35 UTC (rev 1010) +++ dcplusplus/trunk/dcpp/BZUtils.cpp 2008-02-17 11:51:38 UTC (rev 1011) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001-2007 Jacek Sieka, arnetheduck on gmail point com + * Copyright (C) 2001-2008 Jacek Sieka, arnetheduck on gmail point com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Modified: dcplusplus/trunk/dcpp/BZUtils.h =================================================================== --- dcplusplus/trunk/dcpp/BZUtils.h 2008-02-15 16:46:35 UTC (rev 1010) +++ dcplusplus/trunk/dcpp/BZUtils.h 2008-02-17 11:51:38 UTC (rev 1011) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001-2007 Jacek Sieka, arnetheduck on gmail point com + * Copyright (C) 2001-2008 Jacek Sieka, arnetheduck on gmail point com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Modified: dcplusplus/trunk/dcpp/BitInputStream.h =================================================================== --- dcplusplus/trunk/dcpp/BitInputStream.h 2008-02-15 16:46:35 UTC (rev 1010) +++ dcplusplus/trunk/dcpp/BitInputStream.h 2008-02-17 11:51:38 UTC (rev 1011) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001-2007 Jacek Sieka, arnetheduck on gmail point com + * Copyright (C) 2001-2008 Jacek Sieka, arnetheduck on gmail point com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Modified: dcplusplus/trunk/dcpp/BitOutputStream.h =================================================================== --- dcplusplus/trunk/dcpp/BitOutputStream.h 2008-02-15 16:46:35 UTC (rev 1010) +++ dcplusplus/trunk/dcpp/BitOutputStream.h 2008-02-17 11:51:38 UTC (rev 1011) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001-2007 Jacek Sieka, arnetheduck on gmail point com + * Copyright (C) 2001-2008 Jacek Sieka, arnetheduck on gmail point com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Modified: dcplusplus/trunk/dcpp/BloomFilter.h =================================================================== --- dcplusplus/trunk/dcpp/BloomFilter.h 2008-02-15 16:46:35 UTC (rev 1010) +++ dcplusplus/trunk/dcpp/BloomFilter.h 2008-02-17 11:51:38 UTC (rev 1011) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001-2007 Jacek Sieka, arnetheduck on gmail point com + * Copyright (C) 2001-2008 Jacek Sieka, arnetheduck on gmail point com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Modified: dcplusplus/trunk/dcpp/BufferedSocket.cpp =================================================================== --- dcplusplus/trunk/dcpp/BufferedSocket.cpp 2008-02-15 16:46:35 UTC (rev 1010) +++ dcplusplus/trunk/dcpp/BufferedSocket.cpp 2008-02-17 11:51:38 UTC (rev 1011) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001-2007 Jacek Sieka, arnetheduck on gmail point com + * Copyright (C) 2001-2008 Jacek Sieka, arnetheduck on gmail point com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -430,6 +430,9 @@ return false; case ACCEPTED: break; + case UPDATED: + fire(BufferedSocketListener::Updated()); + break; } delete p.second; Modified: dcplusplus/trunk/dcpp/BufferedSocket.h =================================================================== --- dcplusplus/trunk/dcpp/BufferedSocket.h 2008-02-15 16:46:35 UTC (rev 1010) +++ dcplusplus/trunk/dcpp/BufferedSocket.h 2008-02-17 11:51:38 UTC (rev 1011) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001-2007 Jacek Sieka, arnetheduck on gmail point com + * Copyright (C) 2001-2008 Jacek Sieka, arnetheduck on gmail point com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -77,10 +77,13 @@ bool isTrusted() const { return sock && sock->isTrusted(); } std::string getCipherName() const { return sock ? sock->getCipherName() : Util::emptyString; } - void write(const string& aData) throw() { write(aData.data(), aData.length()); } + void write(const string& aData) { write(aData.data(), aData.length()); } void write(const char* aBuf, size_t aLen) throw(); /** Send the file f over this socket. */ - void transmitFile(InputStream* f) throw() { Lock l(cs); addTask(SEND_FILE, new SendFileInfo(f)); } + void transmitFile(InputStream* f) { Lock l(cs); addTask(SEND_FILE, new SendFileInfo(f)); } + + /** Send an updated signal to all listeners */ + void updated() { Lock l(cs); addTask(UPDATED, 0); } void disconnect(bool graceless = false) throw() { Lock l(cs); if(graceless) disconnecting = true; addTask(DISCONNECT, 0); } @@ -94,7 +97,8 @@ SEND_DATA, SEND_FILE, SHUTDOWN, - ACCEPTED + ACCEPTED, + UPDATED }; struct TaskData { Modified: dcplusplus/trunk/dcpp/BufferedSocketListener.h =================================================================== --- dcplusplus/trunk/dcpp/BufferedSocketListener.h 2008-02-15 16:46:35 UTC (rev 1010) +++ dcplusplus/trunk/dcpp/BufferedSocketListener.h 2008-02-17 11:51:38 UTC (rev 1011) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001-2007 Jacek Sieka, arnetheduck on gmail point com + * Copyright (C) 2001-2008 Jacek Sieka, arnetheduck on gmail point com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -34,6 +34,7 @@ typedef X<5> ModeChange; typedef X<6> TransmitDone; typedef X<7> Failed; + typedef X<8> Updated; virtual void on(Connecting) throw() { } virtual void on(Connected) throw() { } @@ -43,6 +44,7 @@ virtual void on(ModeChange) throw() { } virtual void on(TransmitDone) throw() { } virtual void on(Failed, const string&) throw() { } + virtual void on(Updated) throw() { } }; } // namespace dcpp Modified: dcplusplus/trunk/dcpp/CID.h =================================================================== --- dcplusplus/trunk/dcpp/CID.h 2008-02-15 16:46:35 UTC (rev 1010) +++... [truncated message content] |
From: <arn...@us...> - 2008-02-17 21:23:25
|
Revision: 1012 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=1012&view=rev Author: arnetheduck Date: 2008-02-17 13:23:07 -0800 (Sun, 17 Feb 2008) Log Message: ----------- Cleanup Modified Paths: -------------- dcplusplus/trunk/changelog.txt dcplusplus/trunk/dcpp/DownloadManager.cpp dcplusplus/trunk/dcpp/Exception.h dcplusplus/trunk/dcpp/QueueManager.cpp dcplusplus/trunk/dcpp/QueueManager.h dcplusplus/trunk/dcpp/UploadManager.cpp dcplusplus/trunk/dcpp/UploadManager.h dcplusplus/trunk/dcpp/UploadManagerListener.h dcplusplus/trunk/win32/AboutDlg.cpp dcplusplus/trunk/win32/MainWindow.cpp dcplusplus/trunk/win32/PrivateFrame.h dcplusplus/trunk/win32/TransferView.cpp dcplusplus/trunk/win32/TransferView.h dcplusplus/trunk/win32/WaitingUsersFrame.cpp dcplusplus/trunk/win32/WaitingUsersFrame.h Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2008-02-17 11:51:38 UTC (rev 1011) +++ dcplusplus/trunk/changelog.txt 2008-02-17 21:23:07 UTC (rev 1012) @@ -35,6 +35,7 @@ * [L#190955] Fixed 100% on remove all sources in queue * Fixed a few hardcoded dc++'s (thanks steven sheehy) * Don't always show the tray icon after killing and re-opening explorer.exe (poy) +* Updated links (thanks pietry) -- 0.704 2007-12-14 -- * Hub lists added to utilize Coral's distributed network (ullner) Modified: dcplusplus/trunk/dcpp/DownloadManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/DownloadManager.cpp 2008-02-17 11:51:38 UTC (rev 1011) +++ dcplusplus/trunk/dcpp/DownloadManager.cpp 2008-02-17 21:23:07 UTC (rev 1012) @@ -447,7 +447,6 @@ aConn->disconnect(); } - void DownloadManager::removeDownload(Download* d) { if(d->getFile()) { if(d->getActual() > 0) { Modified: dcplusplus/trunk/dcpp/Exception.h =================================================================== --- dcplusplus/trunk/dcpp/Exception.h 2008-02-17 11:51:38 UTC (rev 1011) +++ dcplusplus/trunk/dcpp/Exception.h 2008-02-17 21:23:07 UTC (rev 1012) @@ -21,11 +21,14 @@ namespace dcpp { -class Exception +class Exception : std::exception { public: Exception() { } Exception(const string& aError) throw() : error(aError) { dcdrun(if(error.size()>0)) dcdebug("Thrown: %s\n", error.c_str()); } + + virtual const char* what() const throw() { return getError().c_str(); } + virtual ~Exception() throw() { } virtual const string& getError() const throw() { return error; } protected: Modified: dcplusplus/trunk/dcpp/QueueManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/QueueManager.cpp 2008-02-17 11:51:38 UTC (rev 1011) +++ dcplusplus/trunk/dcpp/QueueManager.cpp 2008-02-17 21:23:07 UTC (rev 1012) @@ -42,12 +42,6 @@ #undef ff #endif -#ifndef _WIN32 -#include <sys/types.h> -#include <dirent.h> -#include <fnmatch.h> -#endif - namespace dcpp { QueueItem* QueueManager::FileQueue::add(const string& aTarget, int64_t aSize, @@ -235,7 +229,6 @@ } void QueueManager::UserQueue::removeDownload(QueueItem* qi, const UserPtr& user) { - // Remove the download from running running.erase(user); for(DownloadList::iterator i = qi->getDownloads().begin(); i != qi->getDownloads().end(); ++i) { @@ -355,10 +348,9 @@ if(!BOOLSETTING(KEEP_LISTS)) { string path = Util::getListPath(); StringList filelists = File::findFiles(path, "*.xml.bz2"); - StringList filelists2 = File::findFiles(path, "*.DcLst"); - filelists.insert(filelists.end(), filelists2.begin(), filelists2.end()); - std::for_each(filelists.begin(), filelists.end(), &File::deleteFile); + filelists = File::findFiles(path, "*.DcLst"); + std::for_each(filelists.begin(), filelists.end(), &File::deleteFile); } } @@ -408,6 +400,7 @@ string target = Util::getListPath() + nick + aUser->getCID().toBase32(); if (!aInitialDir.empty()) { + Lock l(cs); dirMap[aUser->getCID().toBase32()] = aInitialDir; } @@ -433,7 +426,7 @@ ConnectionManager::getInstance()->getDownloadConnection(aUser); } -void QueueManager::add(const string& aTarget, int64_t aSize, const TTHValue& root, UserPtr aUser, +void QueueManager::add(const string& aTarget, int64_t aSize, const TTHValue& root, const UserPtr& aUser, int aFlags /* = QueueItem::FLAG_RESUME */, bool addBad /* = true */) throw(QueueException, FileException) { bool wantConnection = true; @@ -545,7 +538,7 @@ } /** Add a source to an existing queue item */ -bool QueueManager::addSource(QueueItem* qi, UserPtr aUser, Flags::MaskType addBad) throw(QueueException, FileException) { +bool QueueManager::addSource(QueueItem* qi, const UserPtr& aUser, Flags::MaskType addBad) throw(QueueException, FileException) { bool wantConnection = (qi->getPriority() != QueueItem::PAUSED) && !userQueue.getRunning(aUser); if(qi->isSource(aUser)) { Modified: dcplusplus/trunk/dcpp/QueueManager.h =================================================================== --- dcplusplus/trunk/dcpp/QueueManager.h 2008-02-17 11:51:38 UTC (rev 1011) +++ dcplusplus/trunk/dcpp/QueueManager.h 2008-02-17 21:23:07 UTC (rev 1012) @@ -73,7 +73,7 @@ { public: /** Add a file to the queue. */ - void add(const string& aTarget, int64_t aSize, const TTHValue& root, UserPtr aUser, + void add(const string& aTarget, int64_t aSize, const TTHValue& root, const UserPtr& aUser, int aFlags = QueueItem::FLAG_RESUME, bool addBad = true) throw(QueueException, FileException); /** Add a user's filelist to the queue. */ void addList(const UserPtr& aUser, int aFlags, const string& aInitialDir = Util::emptyString) throw(QueueException, FileException); @@ -224,7 +224,7 @@ /** Sanity check for the target filename */ static string checkTarget(const string& aTarget, int64_t aSize, int& flags) throw(QueueException, FileException); /** Add a source to an existing queue item */ - bool addSource(QueueItem* qi, UserPtr aUser, Flags::MaskType addBad) throw(QueueException, FileException); + bool addSource(QueueItem* qi, const UserPtr& aUser, Flags::MaskType addBad) throw(QueueException, FileException); void processList(const string& name, UserPtr& user, int flags); Modified: dcplusplus/trunk/dcpp/UploadManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/UploadManager.cpp 2008-02-17 11:51:38 UTC (rev 1011) +++ dcplusplus/trunk/dcpp/UploadManager.cpp 2008-02-17 21:23:07 UTC (rev 1012) @@ -387,7 +387,7 @@ return u; } -const UploadManager::FileSet& UploadManager::getWaitingUserFiles(const UserPtr &u) { +const UploadManager::FileSet& UploadManager::getWaitingUserFiles(const UserPtr& u) { Lock l(cs); return waitingFiles.find(u)->second; } Modified: dcplusplus/trunk/dcpp/UploadManager.h =================================================================== --- dcplusplus/trunk/dcpp/UploadManager.h 2008-02-17 11:51:38 UTC (rev 1011) +++ dcplusplus/trunk/dcpp/UploadManager.h 2008-02-17 21:23:07 UTC (rev 1012) @@ -59,7 +59,7 @@ typedef unordered_map<UserPtr, FileSet, User::Hash> FilesMap; void clearUserFiles(const UserPtr&); UserList getWaitingUsers(); - const FileSet& getWaitingUserFiles(const UserPtr &); + const FileSet& getWaitingUserFiles(const UserPtr&); /** @internal */ void addConnection(UserConnectionPtr conn); Modified: dcplusplus/trunk/dcpp/UploadManagerListener.h =================================================================== --- dcplusplus/trunk/dcpp/UploadManagerListener.h 2008-02-17 11:51:38 UTC (rev 1011) +++ dcplusplus/trunk/dcpp/UploadManagerListener.h 2008-02-17 21:23:07 UTC (rev 1012) @@ -21,8 +21,8 @@ virtual void on(Tick, const UploadList&) throw() { } virtual void on(Complete, Upload*) throw() { } virtual void on(Failed, Upload*, const string&) throw() { } - virtual void on(WaitingAddFile, const UserPtr, const string&) throw() { } - virtual void on(WaitingRemoveUser, const UserPtr) throw() { } + virtual void on(WaitingAddFile, const UserPtr&, const string&) throw() { } + virtual void on(WaitingRemoveUser, const UserPtr&) throw() { } }; Modified: dcplusplus/trunk/win32/AboutDlg.cpp =================================================================== --- dcplusplus/trunk/win32/AboutDlg.cpp 2008-02-17 11:51:38 UTC (rev 1011) +++ dcplusplus/trunk/win32/AboutDlg.cpp 2008-02-17 21:23:07 UTC (rev 1012) @@ -53,7 +53,7 @@ } bool AboutDlg::handleInitDialog() { - setItemText(IDC_VERSION, Text::toT("DC++ " VERSIONSTRING "\n(c) Copyright 2001-2007 Jacek Sieka\nEx-codeveloper: Per Lind\303\251n\nGraphics: Martin Skogevall et al.\nDC++ is licenced under GPL\nhttp://dcplusplus.sourceforge.net/")); + setItemText(IDC_VERSION, Text::toT("DC++ " VERSIONSTRING "\n(c) Copyright 2001-2008 Jacek Sieka\nEx-codeveloper: Per Lind\303\251n\nGraphics: Martin Skogevall et al.\nDC++ is licenced under GPL\nhttp://dcplusplus.sourceforge.net/")); setItemText(IDC_TTH, WinUtil::tth); setItemText(IDC_THANKS, Text::toT(thanks)); setItemText(IDC_TOTALS, str(TF_("Upload: %1%, Download: %2%") % Text::toT(Util::formatBytes(SETTING(TOTAL_UPLOAD))) % Text::toT(Util::formatBytes(SETTING(TOTAL_DOWNLOAD))))); Modified: dcplusplus/trunk/win32/MainWindow.cpp =================================================================== --- dcplusplus/trunk/win32/MainWindow.cpp 2008-02-17 11:51:38 UTC (rev 1011) +++ dcplusplus/trunk/win32/MainWindow.cpp 2008-02-17 21:23:07 UTC (rev 1012) @@ -66,14 +66,14 @@ UPnP_TCPConnection(0), UPnP_UDPConnection(0) { - links.homepage = _T("http://dcpp.net/"); + links.homepage = _T("http://dcplusplus.sourceforge.net/"); links.downloads = links.homepage + _T("download/"); links.geoipfile = _T("http://www.maxmind.com/download/geoip/database/GeoIPCountryCSV.zip"); links.faq = links.homepage + _T("faq/"); - links.help = links.homepage + _T("forum/"); - links.discuss = links.homepage + _T("forum/"); - links.features = links.homepage + _T("bugzilla/"); - links.bugs = links.homepage + _T("bugzilla/"); + links.help = links.homepage + _T("help/"); + links.discuss = links.homepage + _T("discussion/"); + links.features = links.homepage + _T("featurereq/"); + links.bugs = links.homepage + _T("bugs/"); links.donate = _T("https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=arnetheduck%40gmail%2ecom&item_name=DCPlusPlus&no_shipping=1&return=http%3a%2f%2fdcplusplus%2esf%2enet%2f&cancel_return=http%3a%2f%2fdcplusplus%2esf%2enet%2f&cn=Greeting&tax=0¤cy_code=EUR&bn=PP%2dDonationsBF&charset=UTF%2d8"); initWindow(); @@ -849,7 +849,6 @@ if(xml.findChild("Version")) { if(Util::toDouble(xml.getChildData()) > VERSIONFLOAT) { xml.resetCurrentChild(); - xml.resetCurrentChild(); if(xml.findChild("Title")) { const string& title = xml.getChildData(); xml.resetCurrentChild(); @@ -865,43 +864,42 @@ } } } - + } + xml.resetCurrentChild(); + if(xml.findChild("Links")) { + xml.stepIn(); + if(xml.findChild("Homepage")) { + links.homepage = Text::toT(xml.getChildData()); + } xml.resetCurrentChild(); - if(xml.findChild("Links")) { - xml.stepIn(); - if(xml.findChild("Homepage")) { - links.homepage = Text::toT(xml.getChildData()); - } - xml.resetCurrentChild(); - if(xml.findChild("Downloads")) { - links.downloads = Text::toT(xml.getChildData()); - } - xml.resetCurrentChild(); - if(xml.findChild("GeoIP database update")) { - links.geoipfile = Text::toT(xml.getChildData()); - } - xml.resetCurrentChild(); - if(xml.findChild("Faq")) { - links.faq = Text::toT(xml.getChildData()); - } - xml.resetCurrentChild(); - if(xml.findChild("Bugs")) { - links.bugs = Text::toT(xml.getChildData()); - } - xml.resetCurrentChild(); - if(xml.findChild("Features")) { - links.features = Text::toT(xml.getChildData()); - } - xml.resetCurrentChild(); - if(xml.findChild("Help")) { - links.help = Text::toT(xml.getChildData()); - } - xml.resetCurrentChild(); - if(xml.findChild("Forum")) { - links.discuss = Text::toT(xml.getChildData()); - } - xml.stepOut(); + if(xml.findChild("Downloads")) { + links.downloads = Text::toT(xml.getChildData()); } + xml.resetCurrentChild(); + if(xml.findChild("GeoIP database update")) { + links.geoipfile = Text::toT(xml.getChildData()); + } + xml.resetCurrentChild(); + if(xml.findChild("Faq")) { + links.faq = Text::toT(xml.getChildData()); + } + xml.resetCurrentChild(); + if(xml.findChild("Bugs")) { + links.bugs = Text::toT(xml.getChildData()); + } + xml.resetCurrentChild(); + if(xml.findChild("Features")) { + links.features = Text::toT(xml.getChildData()); + } + xml.resetCurrentChild(); + if(xml.findChild("Help")) { + links.help = Text::toT(xml.getChildData()); + } + xml.resetCurrentChild(); + if(xml.findChild("Forum")) { + links.discuss = Text::toT(xml.getChildData()); + } + xml.stepOut(); } xml.stepOut(); } catch (const Exception&) { Modified: dcplusplus/trunk/win32/PrivateFrame.h =================================================================== --- dcplusplus/trunk/win32/PrivateFrame.h 2008-02-17 11:51:38 UTC (rev 1011) +++ dcplusplus/trunk/win32/PrivateFrame.h 2008-02-17 21:23:07 UTC (rev 1012) @@ -38,7 +38,7 @@ static void gotMessage(SmartWin::WidgetTabView* mdiParent, const UserPtr& from, const UserPtr& to, const UserPtr& replyTo, const tstring& aMessage); static void openWindow(SmartWin::WidgetTabView* mdiParent, const UserPtr& replyTo, const tstring& aMessage = Util::emptyStringT); - static bool isOpen(const UserPtr u) { return frames.find(u) != frames.end(); } + static bool isOpen(const UserPtr& u) { return frames.find(u) != frames.end(); } static void closeAll(); static void closeAllOffline(); Modified: dcplusplus/trunk/win32/TransferView.cpp =================================================================== --- dcplusplus/trunk/win32/TransferView.cpp 2008-02-17 11:51:38 UTC (rev 1011) +++ dcplusplus/trunk/win32/TransferView.cpp 2008-02-17 21:23:07 UTC (rev 1012) @@ -734,15 +734,17 @@ speak(CONNECTIONS_UPDATE, ui); } -void TransferView::on(DownloadManagerListener::Tick, const DownloadList& dl) throw() { - for(DownloadList::const_iterator j = dl.begin(); j != dl.end(); ++j) { - Download* d = *j; +void TransferView::onTransferTick(Transfer* t) { + UpdateInfo* ui = new UpdateInfo(d->getUser(), true); + ui->setTransfered(t->getPos(), t->getActual()); + ui->setSpeed(t->getAverageSpeed()); + ui->setChunk(t->getPos(), t->getSize()); + tasks.add(CONNECTIONS_UPDATE, ui); +} - UpdateInfo* ui = new UpdateInfo(d->getUser(), true); - ui->setTransfered(d->getPos(), d->getActual()); - ui->setSpeed(d->getAverageSpeed()); - ui->setChunk(d->getPos(), d->getSize()); - tasks.add(CONNECTIONS_UPDATE, ui); +void TransferView::on(DownloadManagerListener::Tick, const DownloadList& dl) throw() { + for(DownloadList::const_iterator i = dl.begin(); i != dl.end(); ++i) { + onTransferTick(*i); } std::vector<TickInfo*> dis; @@ -812,15 +814,8 @@ } void TransferView::on(UploadManagerListener::Tick, const UploadList& ul) throw() { - for(UploadList::const_iterator j = ul.begin(); j != ul.end(); ++j) { - Upload* u = *j; - - UpdateInfo* ui = new UpdateInfo(u->getUser(), false); - ui->setTransfered(u->getPos(), u->getActual()); - ui->setSpeed(u->getAverageSpeed()); - ui->setChunk(u->getPos(), u->getSize()); - - tasks.add(CONNECTIONS_UPDATE, ui); + for(UploadList::const_iterator i = ul.begin(); i != ul.end(); ++i) { + onTransferTick(*i); } speak(); @@ -841,6 +836,7 @@ ui->setStatus(ConnectionInfo::STATUS_WAITING); ui->setStatusString(T_("Idle")); + ui->setChunk(aTransfer->getPos(), aTransfer->getSize()); speak(CONNECTIONS_UPDATE, ui); } Modified: dcplusplus/trunk/win32/TransferView.h =================================================================== --- dcplusplus/trunk/win32/TransferView.h 2008-02-17 11:51:38 UTC (rev 1011) +++ dcplusplus/trunk/win32/TransferView.h 2008-02-17 21:23:07 UTC (rev 1012) @@ -291,6 +291,7 @@ virtual void on(QueueManagerListener::Removed, QueueItem*) throw(); + void onTransferTick(Transfer* aTransfer); void onTransferComplete(Transfer* aTransfer, bool isUpload); void starting(UpdateInfo* ui, Transfer* t); Modified: dcplusplus/trunk/win32/WaitingUsersFrame.cpp =================================================================== --- dcplusplus/trunk/win32/WaitingUsersFrame.cpp 2008-02-17 11:51:38 UTC (rev 1011) +++ dcplusplus/trunk/win32/WaitingUsersFrame.cpp 2008-02-17 21:23:07 UTC (rev 1012) @@ -180,11 +180,11 @@ } // UploadManagerListener -void WaitingUsersFrame::on(UploadManagerListener::WaitingRemoveUser, const UserPtr aUser) throw() { +void WaitingUsersFrame::on(UploadManagerListener::WaitingRemoveUser, const UserPtr& aUser) throw() { speak(SPEAK_REMOVE_USER, (LPARAM)new UserItem(aUser)); } -void WaitingUsersFrame::on(UploadManagerListener::WaitingAddFile, const UserPtr aUser, const string& aFilename) throw() { +void WaitingUsersFrame::on(UploadManagerListener::WaitingAddFile, const UserPtr& aUser, const string& aFilename) throw() { speak(SPEAK_ADD_FILE, (LPARAM)new pair<UserPtr, string>(aUser, aFilename)); } Modified: dcplusplus/trunk/win32/WaitingUsersFrame.h =================================================================== --- dcplusplus/trunk/win32/WaitingUsersFrame.h 2008-02-17 11:51:38 UTC (rev 1011) +++ dcplusplus/trunk/win32/WaitingUsersFrame.h 2008-02-17 21:23:07 UTC (rev 1012) @@ -89,8 +89,8 @@ void updateSearch(int index, BOOL doDelete = TRUE); // UploadManagerListener - virtual void on(UploadManagerListener::WaitingRemoveUser, const UserPtr) throw(); - virtual void on(UploadManagerListener::WaitingAddFile, const UserPtr, const string&) throw(); + virtual void on(UploadManagerListener::WaitingRemoveUser, const UserPtr&) throw(); + virtual void on(UploadManagerListener::WaitingAddFile, const UserPtr&, const string&) throw(); }; #endif /* WAITING_QUEUE_FRAME_H */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <zou...@us...> - 2008-02-17 22:27:18
|
Revision: 1014 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=1014&view=rev Author: zouzou123gen Date: 2008-02-17 14:27:10 -0800 (Sun, 17 Feb 2008) Log Message: ----------- menu changes: simplify parent args, use the wrapper in draw functions; fix a GDB-specific crash Modified Paths: -------------- dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetMenu.h dcplusplus/trunk/smartwin/source/widgets/WidgetMenu.cpp dcplusplus/trunk/win32/ADLSearchFrame.cpp dcplusplus/trunk/win32/DirectoryListingFrame.cpp dcplusplus/trunk/win32/FavHubsFrame.cpp dcplusplus/trunk/win32/FinishedFrameBase.h dcplusplus/trunk/win32/HubFrame.cpp dcplusplus/trunk/win32/MDIChildFrame.h dcplusplus/trunk/win32/MainWindow.cpp dcplusplus/trunk/win32/PrivateFrame.cpp dcplusplus/trunk/win32/PublicHubsFrame.cpp dcplusplus/trunk/win32/QueueFrame.cpp dcplusplus/trunk/win32/SearchFrame.cpp dcplusplus/trunk/win32/ShellContextMenu.cpp dcplusplus/trunk/win32/ShellContextMenu.h dcplusplus/trunk/win32/SpyFrame.cpp dcplusplus/trunk/win32/TransferView.cpp dcplusplus/trunk/win32/UsersFrame.cpp dcplusplus/trunk/win32/WaitingUsersFrame.cpp Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetMenu.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetMenu.h 2008-02-17 22:03:38 UTC (rev 1013) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetMenu.h 2008-02-17 22:27:10 UTC (rev 1014) @@ -73,46 +73,6 @@ */ typedef std::tr1::shared_ptr< MenuItemData > MenuItemDataPtr; -namespace private_ -{ - // //////////////////////////////////////////////////////////////////////// - // Menu item data wrapper, used internally - // MENUITEMINFO's dwItemData *should* point to it - // //////////////////////////////////////////////////////////////////////// - struct ItemDataWrapper - { - // The menu item belongs to - // For some messages (e.g. WM_MEASUREITEM), - // Windows doesn't specify it, so - // we need to keep this - HMENU menu; - - // Item index in the menu - // This is needed, because ID's for items - // are not unique (although Windows claims) - // e.g. we can have an item with ID 0, - // that is either separator or popup menu - int index; - - // Specifies if item is menu title - bool isMenuTitleItem; - - // Contains item data - MenuItemDataPtr data; - - // Wrapper Constructor - ItemDataWrapper( HMENU owner, int itemIndex, MenuItemDataPtr itemData, bool isTitleItem = false ) - : menu( owner ) - , index( itemIndex ) - , isMenuTitleItem( isTitleItem ) - , data( itemData ) - {} - - ~ItemDataWrapper() - {} - }; -} - /// Struct for coloring different areas of WidgetMenu /** Contains the different color settings of the WidgetMenu <br> * Default values to constructor makes menu look roughly like MSVC++7.1 menus @@ -164,15 +124,8 @@ * Class for creating a Menu Control which then can be attached to e.g. a * WidgetWindow. <br> * Note for Desktop version only! <br> -* After you have created a menu you must call WidgetMenu::attach() to make it -* "attach" to the WidgetWindow you want it to belong to. <br> -* Do not be fooled, a WidgetMenu is a much more advanced menu type then the -* "normal" WidgetMenu and contains support for visualizations far beyond the -* capabilities of the WidgetMenu. <br> -* If you need those truly awesome visual menu effects use this menu control instead -* of the WidgetMenu. */ -class WidgetMenu : public boost::enable_shared_from_this< WidgetMenu > +class WidgetMenu : public boost::enable_shared_from_this< WidgetMenu >, boost::noncopyable { // friends friend class WidgetCreator< WidgetMenu >; @@ -244,8 +197,8 @@ return itsHandle; } - HWND getParent() const { - return itsParent ? itsParent->handle() : 0; + Widget* getParent() const { + return itsParent; } /// Actually creates the menu @@ -400,7 +353,7 @@ * < li >TPM_VERPOSANIMATION : Animates the menu from top to bottom< /li > * < /ul > */ - unsigned trackPopupMenu( Widget * mainWindow, const ScreenCoordinate& sc, unsigned flags = 0 ); + unsigned trackPopupMenu( const ScreenCoordinate& sc, unsigned flags = 0 ); /// Sets menu title /** A WidgetMenu can have a title, this function sets that title @@ -475,24 +428,59 @@ /// Constructor Taking pointer to parent explicit WidgetMenu( SmartWin::Widget * parent ); + // //////////////////////////////////////////////////////////////////////// + // Menu item data wrapper, used internally + // MENUITEMINFO's dwItemData *should* point to it + // //////////////////////////////////////////////////////////////////////// + struct ItemDataWrapper + { + // The menu item belongs to + // For some messages (e.g. WM_MEASUREITEM), + // Windows doesn't specify it, so + // we need to keep this + const WidgetMenu* menu; + + // Item index in the menu + // This is needed, because ID's for items + // are not unique (although Windows claims) + // e.g. we can have an item with ID 0, + // that is either separator or popup menu + int index; + + // Specifies if item is menu title + bool isMenuTitleItem; + + // Contains item data + MenuItemDataPtr data; + + // Wrapper Constructor + ItemDataWrapper( const WidgetMenu* menu_, int itemIndex, MenuItemDataPtr itemData, bool isTitleItem = false ) + : menu( menu_ ) + , index( itemIndex ) + , isMenuTitleItem( isTitleItem ) + , data( itemData ) + {} + + ~ItemDataWrapper() + {} + }; + // This is used during menu destruction - static void destroyItemDataWrapper( private_::ItemDataWrapper * wrapper ); + static void destroyItemDataWrapper( ItemDataWrapper * wrapper ); // True is menu is "system menu" (icon in top left of window) bool isSysMenu; + // its sub menus + std::vector< ObjectType > itsChildren; // work around for gcc std::vector< ObjectType > & itsChildrenRef; + // its item data + std::vector < ItemDataWrapper * > itsItemData; // work around for gcc - std::vector < private_::ItemDataWrapper * > & itsItemDataRef; + std::vector < ItemDataWrapper * > & itsItemDataRef; - // its sub menus - std::vector< ObjectType > itsChildren; - - // its item data - std::vector < private_::ItemDataWrapper * > itsItemData; - HMENU itsHandle; Widget* itsParent; @@ -514,13 +502,11 @@ typedef std::map<unsigned, Widget::CallbackType> CallbackMap; CallbackMap callbacks; - void addCommands(Widget* widget); + void addCommands(); // Returns item index in the menu item list // If no item with specified id is found, - 1 is returned int getItemIndex( unsigned int id ); - - WidgetMenu( const WidgetMenu & ); // Never implemented intentionally }; // end namespace SmartWin Modified: dcplusplus/trunk/smartwin/source/widgets/WidgetMenu.cpp =================================================================== --- dcplusplus/trunk/smartwin/source/widgets/WidgetMenu.cpp 2008-02-17 22:03:38 UTC (rev 1013) +++ dcplusplus/trunk/smartwin/source/widgets/WidgetMenu.cpp 2008-02-17 22:27:10 UTC (rev 1014) @@ -49,6 +49,7 @@ itsParent(parent), drawSidebar(false) { + xAssert(itsParent != NULL, _T("A WidgetMenu must have a parent")); } void WidgetMenu::create(const Seed& cs) @@ -84,15 +85,15 @@ void WidgetMenu::attach() { - addCommands(itsParent); - if ( ::SetMenu( getParent(), this->itsHandle ) == FALSE ) + addCommands(); + if ( ::SetMenu( itsParent->handle(), itsHandle ) == FALSE ) throw xCeption( _T( "Couldn't attach menu to the parent window" ) ); } WidgetMenu::ObjectType WidgetMenu::appendPopup( const SmartUtil::tstring & text, MenuItemDataPtr itemData ) { // create popup menu pointer - ObjectType retVal ( new WidgetMenu(this->itsParent) ); + ObjectType retVal ( new WidgetMenu(itsParent) ); retVal->create( Seed(ownerDrawn, itsColorInfo) ); // init structure for new item @@ -110,21 +111,21 @@ info.hSubMenu = retVal->handle(); // get position to insert - int position = ::GetMenuItemCount( this->itsHandle ); + int position = ::GetMenuItemCount( itsHandle ); - private_::ItemDataWrapper * wrapper; + ItemDataWrapper * wrapper = NULL; if(ownerDrawn) { info.fMask |= MIIM_DATA | MIIM_FTYPE; info.fType = MFT_OWNERDRAW; // create item data - wrapper = new private_::ItemDataWrapper( this->itsHandle, position, itemData ); - info.dwItemData = reinterpret_cast< UINT_PTR >( wrapper ); + wrapper = new ItemDataWrapper( this, position, itemData ); + info.dwItemData = reinterpret_cast< ULONG_PTR >( wrapper ); } // append to this menu at the end - if ( ::InsertMenuItem( this->itsHandle, position, TRUE, & info ) ) + if ( ::InsertMenuItem( itsHandle, position, TRUE, & info ) ) { if(ownerDrawn) itsItemData.push_back( wrapper ); @@ -137,10 +138,10 @@ WidgetMenu::ObjectType WidgetMenu::getSystemMenu() { // get system menu for the utmost parent - HMENU handle = ::GetSystemMenu( this->getParent(), FALSE ); + HMENU handle = ::GetSystemMenu( itsParent->handle(), FALSE ); // create pointer to system menu - ObjectType sysMenu( new WidgetMenu( this->getParent() ) ); + ObjectType sysMenu( new WidgetMenu( itsParent->handle() ) ); // create(take) system menu sysMenu->isSysMenu = true; @@ -154,22 +155,22 @@ } #endif -void WidgetMenu::addCommands(Widget* widget) { +void WidgetMenu::addCommands() { for(CallbackMap::iterator i = callbacks.begin(); i != callbacks.end(); ++i) { - widget->setCallback(Message(WM_COMMAND, i->first), i->second); + itsParent->setCallback(Message(WM_COMMAND, i->first), i->second); } for(std::vector< ObjectType >::iterator i = itsChildren.begin(); i != itsChildren.end(); ++i) { - (*i)->addCommands(widget); + (*i)->addCommands(); } } int WidgetMenu::getItemIndex( unsigned int id ) { int index = 0; - const int itemCount = ::GetMenuItemCount( this->itsHandle ); + const int itemCount = ::GetMenuItemCount( itsHandle ); for ( index = 0; index < itemCount; ++index ) - if ( ::GetMenuItemID( this->itsHandle, index ) == id ) // exit the loop if found + if ( ::GetMenuItemID( itsHandle, index ) == id ) // exit the loop if found return index; return - 1; @@ -193,7 +194,7 @@ std::for_each( itsItemDataRef.begin(), itsItemDataRef.end(), destroyItemDataWrapper ); } -void WidgetMenu::destroyItemDataWrapper( private_::ItemDataWrapper * wrapper ) +void WidgetMenu::destroyItemDataWrapper( ItemDataWrapper * wrapper ) { if ( 0 != wrapper ) delete wrapper; @@ -270,12 +271,12 @@ // set flag mi.fMask = MIIM_STRING; - if ( ::GetMenuItemInfo( this->itsHandle, id, byPosition, & mi ) == FALSE ) + if ( ::GetMenuItemInfo( itsHandle, id, byPosition, & mi ) == FALSE ) throw xCeption( _T( "Couldn't get item info in WidgetMenu::getText" ) ); boost::scoped_array< TCHAR > buffer( new TCHAR[++mi.cch] ); mi.dwTypeData = buffer.get(); - if ( ::GetMenuItemInfo( this->itsHandle, id, byPosition, & mi ) == FALSE ) + if ( ::GetMenuItemInfo( itsHandle, id, byPosition, & mi ) == FALSE ) throw xCeption( _T( "Couldn't get item info in WidgetMenu::getText" ) ); return mi.dwTypeData; } @@ -288,7 +289,7 @@ mi.fMask = MIIM_STRING; mi.dwTypeData = (TCHAR*) text.c_str(); - if ( ::SetMenuItemInfo( this->itsHandle, id, FALSE, & mi ) == FALSE ) + if ( ::SetMenuItemInfo( itsHandle, id, FALSE, & mi ) == FALSE ) throw xCeption( _T( "Couldn't set item info in WidgetMenu::setText" ) ); } @@ -320,13 +321,13 @@ // created info for title item MenuItemDataPtr data( new MenuItemData( itsTitleFont ) ); - private_::ItemDataWrapper * wrapper = new private_::ItemDataWrapper( this->itsHandle, 0, data, true ); + ItemDataWrapper * wrapper = new ItemDataWrapper( this, 0, data, true ); // set item data - info.dwItemData = ( ULONG_PTR ) wrapper; + info.dwItemData = reinterpret_cast< ULONG_PTR >( wrapper ); - if ( ( !hasTitle && ::InsertMenuItem( this->itsHandle, 0, TRUE, & info ) ) || - ( hasTitle && ::SetMenuItemInfo( this->itsHandle, 0, TRUE, & info ) ) ) + if ( ( !hasTitle && ::InsertMenuItem( itsHandle, 0, TRUE, & info ) ) || + ( hasTitle && ::SetMenuItemInfo( itsHandle, 0, TRUE, & info ) ) ) { size_t i = 0; @@ -345,18 +346,18 @@ if ( ( id != 0 ) || ( drawInfo->CtlType != ODT_MENU ) ) // if not intended for us return false; + // get item data wrapper + ItemDataWrapper * wrapper = reinterpret_cast< ItemDataWrapper * >( drawInfo->itemData ); + xAssert( wrapper != 0, _T( "Unsupported menu item in drawItem()" ) ); + // setup colors - MenuColorInfo colorInfo = this->itsColorInfo; + MenuColorInfo colorInfo = wrapper->menu->itsColorInfo; COLORREF colorMenuBar = colorInfo.colorMenuBar; COLORREF colorMenuDraw = colorInfo.colorMenu; // color for drawing menu COLORREF colorFillHighlighted = ColorUtilities::lightenColor( colorInfo.colorHighlight, 0.7 ); - // get item data wrapper - private_::ItemDataWrapper * wrapper = reinterpret_cast< private_::ItemDataWrapper * >( drawInfo->itemData ); - xAssert( wrapper != 0, _T( "Unsupported menu item in drawItem()" ) ); - // if processing menu bar - const bool isMenuBar = ::GetMenu( getParent() ) == wrapper->menu; + const bool isMenuBar = ::GetMenu( wrapper->menu->getParent()->handle() ) == wrapper->menu->handle(); // change menu draw color for menubars if ( isMenuBar ) @@ -370,7 +371,7 @@ // set flags info.fMask = MIIM_CHECKMARKS | MIIM_FTYPE | MIIM_DATA | MIIM_STATE | MIIM_STRING; - if ( ::GetMenuItemInfo( wrapper->menu, wrapper->index, TRUE, & info ) == FALSE ) + if ( ::GetMenuItemInfo( wrapper->menu->handle(), wrapper->index, TRUE, & info ) == FALSE ) throw xCeption ( _T( "Couldn't get menu item info in drawItem()" ) ); // check if item is owner drawn @@ -411,7 +412,7 @@ drawInfo->rcItem.bottom - drawInfo->rcItem.top ); // height // setup buffered canvas - BufferedCanvas< FreeCanvas > canvas( reinterpret_cast<HWND>(wrapper->menu), drawInfo->hDC ); + BufferedCanvas< FreeCanvas > canvas( reinterpret_cast<HWND>(wrapper->menu->handle()), drawInfo->hDC ); // this will conain adjusted sidebar width int sidebarWidth = 0; @@ -425,10 +426,10 @@ HFONT titleFont = NULL; // get title font info and adjust item rectangle - if ( this->drawSidebar ) + if ( wrapper->menu->drawSidebar ) { // get title font - FontPtr font = this->itsTitleFont; + FontPtr font = wrapper->menu->itsTitleFont; // get logical info for title font ::GetObject( font->handle(), sizeof( LOGFONT ), & lf ); @@ -444,7 +445,7 @@ memset( & textSize, 0, sizeof( SIZE ) ); HGDIOBJ oldFont = ::SelectObject( canvas.handle(), titleFont ); - ::GetTextExtentPoint32( canvas.handle(), this->itsTitle.c_str(), ( int ) this->itsTitle.size(), & textSize ); + ::GetTextExtentPoint32( canvas.handle(), wrapper->menu->itsTitle.c_str(), ( int ) wrapper->menu->itsTitle.size(), & textSize ); ::SelectObject( canvas.handle(), oldFont ); // set sidebar width to text height @@ -456,7 +457,7 @@ } // draw sidebar with menu title - if ( ( drawInfo->itemAction & ODA_DRAWENTIRE ) && ( this->drawSidebar ) && !this->itsTitle.empty() ) + if ( ( drawInfo->itemAction & ODA_DRAWENTIRE ) && ( wrapper->menu->drawSidebar ) && !wrapper->menu->itsTitle.empty() ) { // select title font and color HGDIOBJ oldFont = ::SelectObject ( canvas.handle(), titleFont ); @@ -479,7 +480,7 @@ // draw title textRectangle.pos.y += 10; - canvas.drawText( this->itsTitle, textRectangle, DT_BOTTOM | DT_SINGLELINE ); + canvas.drawText( wrapper->menu->itsTitle, textRectangle, DT_BOTTOM | DT_SINGLELINE ); // clear canvas.setTextColor( oldColor ); @@ -561,7 +562,7 @@ // get item text const int length = info.cch + 1; std::vector< TCHAR > buffer( length ); - int count = ::GetMenuString( wrapper->menu, wrapper->index, & buffer[0], length, MF_BYPOSITION ); + int count = ::GetMenuString( wrapper->menu->handle(), wrapper->index, & buffer[0], length, MF_BYPOSITION ); SmartUtil::tstring itemText( buffer.begin(), buffer.begin() + count ); // index will contain accelerator position @@ -583,7 +584,7 @@ canvas.setTextColor( isGrayed ? ::GetSysColor( COLOR_GRAYTEXT ) : wrapper->isMenuTitleItem ? colorInfo.colorTitleText : data->TextColor ); // Select item font - FontPtr font((static_cast<int>(::GetMenuDefaultItem(wrapper->menu, TRUE, GMDI_USEDISABLED)) == wrapper->index) ? itsTitleFont : data->Font); + FontPtr font((static_cast<int>(::GetMenuDefaultItem(wrapper->menu->handle(), TRUE, GMDI_USEDISABLED)) == wrapper->index) ? itsTitleFont : data->Font); HGDIOBJ oldFont = ::SelectObject( canvas.handle(), font->handle() ); @@ -690,7 +691,7 @@ } // blast buffer into screen - if ( ( drawInfo->itemAction & ODA_DRAWENTIRE ) && this->drawSidebar ) // adjustment for sidebar + if ( ( drawInfo->itemAction & ODA_DRAWENTIRE ) && wrapper->menu->drawSidebar ) // adjustment for sidebar { itemRectangle.pos.x -= sidebarWidth; itemRectangle.size.x += sidebarWidth; @@ -704,8 +705,8 @@ if ( measureInfo->CtlType != ODT_MENU ) // if not intended for us return false; - // get data wrapper - private_::ItemDataWrapper * wrapper = reinterpret_cast< private_::ItemDataWrapper * >( measureInfo->itemData ); + // get item data wrapper + ItemDataWrapper * wrapper = reinterpret_cast< ItemDataWrapper * >( measureInfo->itemData ); xAssert( wrapper != 0, _T( "Unsupported menu item type in measureItem()" ) ); // this will contain item size @@ -721,7 +722,7 @@ info.fMask = MIIM_FTYPE | MIIM_DATA | MIIM_CHECKMARKS | MIIM_STRING; // try to get item info - if ( ::GetMenuItemInfo( wrapper->menu, wrapper->index, TRUE, & info ) == FALSE ) + if ( ::GetMenuItemInfo( wrapper->menu->handle(), wrapper->index, TRUE, & info ) == FALSE ) throw xCeption ( _T( "Couldn't get item info in measureItem()" ) ); // check if item is owner drawn @@ -736,11 +737,11 @@ } // are we processing menu bar ? - const bool isMenuBar = ::GetMenu( getParent() ) == wrapper->menu; + const bool isMenuBar = ::GetMenu( wrapper->menu->getParent()->handle() ) == wrapper->menu->handle(); // compute text width and height by simulating write to dc // get its DC - HDC hdc = ::GetDC( getParent() ); + HDC hdc = ::GetDC( wrapper->menu->getParent()->handle() ); // get the item data MenuItemDataPtr data = wrapper->data; @@ -749,7 +750,7 @@ // get item text const int length = info.cch + 1; std::vector< TCHAR > buffer ( length ); - int count = ::GetMenuString( wrapper->menu, wrapper->index, & buffer[0], length, MF_BYPOSITION ); + int count = ::GetMenuString( wrapper->menu->handle(), wrapper->index, & buffer[0], length, MF_BYPOSITION ); SmartUtil::tstring itemText ( buffer.begin(), buffer.begin() + count ); // now get text extents @@ -761,7 +762,7 @@ ::SelectObject( hdc, oldFont ); // release DC - ::ReleaseDC( reinterpret_cast<HWND>(wrapper->menu), hdc ); + ::ReleaseDC( reinterpret_cast<HWND>(wrapper->menu->handle()), hdc ); // adjust item size itemWidth = textSize.cx + borderGap; @@ -808,17 +809,17 @@ } // adjust width for system menu items - if ( this->isSysMenu ) + if ( wrapper->menu->isSysMenu ) itemWidth = (std::max)( ( UINT ) minSysMenuItemWidth, itemWidth ); // adjust width for sidebar - if ( this->drawSidebar ) + if ( wrapper->menu->drawSidebar ) { // get title text extents SIZE textSize; memset( & textSize, 0, sizeof( SIZE ) ); - ::GetTextExtentPoint32( hdc, this->itsTitle.c_str(), ( int ) this->itsTitle.size(), & textSize ); + ::GetTextExtentPoint32( hdc, wrapper->menu->itsTitle.c_str(), ( int ) wrapper->menu->itsTitle.size(), & textSize ); itemWidth += textSize.cy; } @@ -840,34 +841,34 @@ itemInfo.fType = MFT_SEPARATOR; // get position to insert - int position = ::GetMenuItemCount( this->itsHandle ); + int position = ::GetMenuItemCount( itsHandle ); - private_::ItemDataWrapper * wrapper; + ItemDataWrapper * wrapper = NULL; if(ownerDrawn) { itemInfo.fMask |= MIIM_DATA; itemInfo.fType |= MFT_OWNERDRAW; // create item data wrapper - wrapper = new private_::ItemDataWrapper( this->itsHandle, position, MenuItemDataPtr( new MenuItemData() ) ); + wrapper = new ItemDataWrapper( this, position, MenuItemDataPtr( new MenuItemData() ) ); itemInfo.dwItemData = reinterpret_cast< ULONG_PTR >( wrapper ); } - if ( ::InsertMenuItem( this->itsHandle, position, TRUE, & itemInfo ) && ownerDrawn ) + if ( ::InsertMenuItem( itsHandle, position, TRUE, & itemInfo ) && ownerDrawn ) itsItemDataRef.push_back( wrapper ); } void WidgetMenu::removeItem( unsigned itemIndex ) { // has sub menus ? - HMENU popup = ::GetSubMenu( this->itsHandle, itemIndex ); + HMENU popup = ::GetSubMenu( itsHandle, itemIndex ); // try to remove item - if ( ::RemoveMenu( this->itsHandle, itemIndex, MF_BYPOSITION ) == TRUE ) + if ( ::RemoveMenu( itsHandle, itemIndex, MF_BYPOSITION ) == TRUE ) { size_t i = 0; if(ownerDrawn) { - private_::ItemDataWrapper * wrapper = 0; + ItemDataWrapper * wrapper = 0; int itemRemoved = -1; for ( i = 0; i < itsItemDataRef.size(); ++i ) @@ -913,7 +914,7 @@ int WidgetMenu::getCount() { - int count = ::GetMenuItemCount( this->itsHandle ); + int count = ::GetMenuItemCount( itsHandle ); if( count == -1 ) throw xCeption( _T( "Couldn't get item count in getCount()" ) ); return count; @@ -941,26 +942,26 @@ // set position to insert bool itemExists = index != - 1; - index = itemExists ? index : ::GetMenuItemCount( this->itsHandle ); + index = itemExists ? index : ::GetMenuItemCount( itsHandle ); - private_::ItemDataWrapper * wrapper; + ItemDataWrapper * wrapper = NULL; if(ownerDrawn) { info.fMask |= MIIM_DATA | MIIM_FTYPE; info.fType = MFT_OWNERDRAW; // set item data - wrapper = new private_::ItemDataWrapper( this->itsHandle, index, itemData ); + wrapper = new ItemDataWrapper( this, index, itemData ); info.dwItemData = reinterpret_cast< ULONG_PTR >( wrapper ); } - if ( ( !itemExists && ::InsertMenuItem( this->itsHandle, id, FALSE, & info ) == TRUE ) || - ( itemExists && ::SetMenuItemInfo( this->itsHandle, id, FALSE, & info ) == TRUE ) ) + if ( ( !itemExists && ::InsertMenuItem( itsHandle, id, FALSE, & info ) == TRUE ) || + ( itemExists && ::SetMenuItemInfo( itsHandle, id, FALSE, & info ) == TRUE ) ) { if(ownerDrawn) itsItemDataRef.push_back( wrapper ); } else - throw xCeption( _T( "Couldn't insert/update item in the WidgetMenu::appendItem" ) ); + throw xCeption( _T( "Couldn't insert/update item in WidgetMenu::appendItem" ) ); } void WidgetMenu::appendItem(unsigned int id, const SmartUtil::tstring & text, BitmapPtr image) @@ -971,10 +972,9 @@ appendItem(id, text, itemData); } -unsigned WidgetMenu::trackPopupMenu( Widget * mainWindow, const ScreenCoordinate& sc, unsigned flags ) +unsigned WidgetMenu::trackPopupMenu( const ScreenCoordinate& sc, unsigned flags ) { - xAssert( mainWindow != 0, _T( "Widget can't be null while trying to display Popup Menu" ) ); - addCommands(mainWindow); + addCommands(); long x = sc.getPoint().x, y = sc.getPoint().y; @@ -985,7 +985,7 @@ y = HIWORD( pos ); } - int retVal = ::TrackPopupMenu(this->itsHandle, flags, x, y, 0, mainWindow->handle(), 0 ); + int retVal = ::TrackPopupMenu(itsHandle, flags, x, y, 0, itsParent->handle(), 0 ); return retVal; } Modified: dcplusplus/trunk/win32/ADLSearchFrame.cpp =================================================================== --- dcplusplus/trunk/win32/ADLSearchFrame.cpp 2008-02-17 22:03:38 UTC (rev 1013) +++ dcplusplus/trunk/win32/ADLSearchFrame.cpp 2008-02-17 22:27:10 UTC (rev 1014) @@ -296,7 +296,7 @@ contextMenu->setItemEnabled(IDC_EDIT, false, status); contextMenu->setItemEnabled(IDC_REMOVE, false, status); - contextMenu->trackPopupMenu(this, pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON); + contextMenu->trackPopupMenu(pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON); return true; } Modified: dcplusplus/trunk/win32/DirectoryListingFrame.cpp =================================================================== --- dcplusplus/trunk/win32/DirectoryListingFrame.cpp 2008-02-17 22:03:38 UTC (rev 1013) +++ dcplusplus/trunk/win32/DirectoryListingFrame.cpp 2008-02-17 22:27:10 UTC (rev 1014) @@ -411,7 +411,7 @@ WidgetMenuPtr menu = createMenu(cs); CShellContextMenu shellMenu; shellMenu.SetPath(Text::utf8ToWide(path)); - shellMenu.ShowContextMenu(menu, this, pt); + shellMenu.ShowContextMenu(menu, pt); return true; } } @@ -421,7 +421,7 @@ contextMenu = makeMultiMenu(); } usingDirMenu = false; - contextMenu->trackPopupMenu(this, pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON); + contextMenu->trackPopupMenu(pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON); return true; } return false; @@ -437,7 +437,7 @@ if(dirs->getSelection()) { WidgetMenuPtr contextMenu = makeDirMenu(); usingDirMenu = true; - contextMenu->trackPopupMenu(this, pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON); + contextMenu->trackPopupMenu(pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON); return true; } Modified: dcplusplus/trunk/win32/FavHubsFrame.cpp =================================================================== --- dcplusplus/trunk/win32/FavHubsFrame.cpp 2008-02-17 22:03:38 UTC (rev 1013) +++ dcplusplus/trunk/win32/FavHubsFrame.cpp 2008-02-17 22:27:10 UTC (rev 1014) @@ -292,7 +292,7 @@ menu->setItemEnabled(IDC_MOVE_DOWN, false, status); menu->setItemEnabled(IDC_REMOVE, false, status); - menu->trackPopupMenu(this, pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON); + menu->trackPopupMenu(pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON); return true; } Modified: dcplusplus/trunk/win32/FinishedFrameBase.h =================================================================== --- dcplusplus/trunk/win32/FinishedFrameBase.h 2008-02-17 22:03:38 UTC (rev 1013) +++ dcplusplus/trunk/win32/FinishedFrameBase.h 2008-02-17 22:27:10 UTC (rev 1014) @@ -230,7 +230,7 @@ pShellMenu->appendItem(IDC_REMOVE_ALL, T_("Remove &all"), std::tr1::bind(&ThisType::handleRemoveAll, this)); pShellMenu->appendSeparatorItem(); - UINT idCommand = shellMenu.ShowContextMenu(pShellMenu, static_cast<T*>(this), pt); + UINT idCommand = shellMenu.ShowContextMenu(pShellMenu, pt); if(idCommand != 0) this->postMessage(WM_COMMAND, idCommand); return true; @@ -245,7 +245,7 @@ contextMenu->appendItem(IDC_REMOVE, T_("&Remove"), std::tr1::bind(&ThisType::handleRemove, this)); contextMenu->appendItem(IDC_REMOVE_ALL, T_("Remove &all"), std::tr1::bind(&ThisType::handleRemoveAll, this)); contextMenu->setDefaultItem(IDC_OPEN_FILE); - contextMenu->trackPopupMenu(static_cast<T*>(this), pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON); + contextMenu->trackPopupMenu(pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON); return true; } return false; Modified: dcplusplus/trunk/win32/HubFrame.cpp =================================================================== --- dcplusplus/trunk/win32/HubFrame.cpp 2008-02-17 22:03:38 UTC (rev 1013) +++ dcplusplus/trunk/win32/HubFrame.cpp 2008-02-17 22:27:10 UTC (rev 1014) @@ -1154,7 +1154,7 @@ inTabMenu = false; - menu->trackPopupMenu(this, pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON); + menu->trackPopupMenu(pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON); return true; } return false; @@ -1178,7 +1178,7 @@ inTabMenu = true; - menu->trackPopupMenu(this, pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON); + menu->trackPopupMenu(pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON); return true; } Modified: dcplusplus/trunk/win32/MDIChildFrame.h =================================================================== --- dcplusplus/trunk/win32/MDIChildFrame.h 2008-02-17 22:03:38 UTC (rev 1013) +++ dcplusplus/trunk/win32/MDIChildFrame.h 2008-02-17 22:27:10 UTC (rev 1014) @@ -189,7 +189,7 @@ SmartWin::WidgetMenu::ObjectType menu = createMenu(WinUtil::Seeds::menu); menu->setTitle(getParent()->getTabText(this)); menu->appendItem(IDC_CLOSE_WINDOW, T_("&Close"), std::tr1::bind(&ThisType::close, this, true), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_EXIT))); - menu->trackPopupMenu(this, pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON); + menu->trackPopupMenu(pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON); return true; } Modified: dcplusplus/trunk/win32/MainWindow.cpp =================================================================== --- dcplusplus/trunk/win32/MainWindow.cpp 2008-02-17 22:03:38 UTC (rev 1013) +++ dcplusplus/trunk/win32/MainWindow.cpp 2008-02-17 22:27:10 UTC (rev 1014) @@ -1004,7 +1004,7 @@ trayMenu->setDefaultItem(0,TRUE); ::GetCursorPos(&pt.getPoint()); ::SetForegroundWindow(handle()); - trayMenu->trackPopupMenu(this, pt, TPM_BOTTOMALIGN|TPM_LEFTBUTTON|TPM_RIGHTBUTTON); + trayMenu->trackPopupMenu(pt, TPM_BOTTOMALIGN|TPM_LEFTBUTTON|TPM_RIGHTBUTTON); postMessage(WM_NULL); } else if(lParam == WM_MOUSEMOVE && ((lastMove + 1000) < GET_TICK()) ) { NOTIFYICONDATA nid; Modified: dcplusplus/trunk/win32/PrivateFrame.cpp =================================================================== --- dcplusplus/trunk/win32/PrivateFrame.cpp 2008-02-17 22:03:38 UTC (rev 1013) +++ dcplusplus/trunk/win32/PrivateFrame.cpp 2008-02-17 22:27:10 UTC (rev 1014) @@ -387,7 +387,7 @@ menu->appendSeparatorItem(); menu->appendItem(IDC_CLOSE_WINDOW, T_("&Close"), std::tr1::bind(&PrivateFrame::close, this, true), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_EXIT))); - menu->trackPopupMenu(this, pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON); + menu->trackPopupMenu(pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON); return true; } Modified: dcplusplus/trunk/win32/PublicHubsFrame.cpp =================================================================== --- dcplusplus/trunk/win32/PublicHubsFrame.cpp 2008-02-17 22:03:38 UTC (rev 1013) +++ dcplusplus/trunk/win32/PublicHubsFrame.cpp 2008-02-17 22:27:10 UTC (rev 1014) @@ -449,7 +449,7 @@ menu->appendItem(IDC_ADD, T_("Add To &Favorites"), std::tr1::bind(&PublicHubsFrame::handleAdd, this), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_FAVORITE_HUBS))); menu->appendItem(IDC_COPY_HUB, T_("Copy &address to clipboard"), std::tr1::bind(&PublicHubsFrame::handleCopyHub, this)); menu->setDefaultItem(IDC_CONNECT); - menu->trackPopupMenu(this, pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON); + menu->trackPopupMenu(pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON); return true; } return false; Modified: dcplusplus/trunk/win32/QueueFrame.cpp =================================================================== --- dcplusplus/trunk/win32/QueueFrame.cpp 2008-02-17 22:03:38 UTC (rev 1013) +++ dcplusplus/trunk/win32/QueueFrame.cpp 2008-02-17 22:27:10 UTC (rev 1014) @@ -1068,7 +1068,7 @@ } else { contextMenu = makeMultiMenu(); } - contextMenu->trackPopupMenu(this, pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON); + contextMenu->trackPopupMenu(pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON); return true; } @@ -1085,7 +1085,7 @@ if(dirs->getSelection()) { usingDirMenu = true; WidgetMenuPtr contextMenu = makeDirMenu(); - contextMenu->trackPopupMenu(this, pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON); + contextMenu->trackPopupMenu(pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON); return true; } Modified: dcplusplus/trunk/win32/SearchFrame.cpp =================================================================== --- dcplusplus/trunk/win32/SearchFrame.cpp 2008-02-17 22:03:38 UTC (rev 1013) +++ dcplusplus/trunk/win32/SearchFrame.cpp 2008-02-17 22:27:10 UTC (rev 1014) @@ -635,7 +635,7 @@ } WidgetMenuPtr contextMenu = makeMenu(); - contextMenu->trackPopupMenu(this, pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON); + contextMenu->trackPopupMenu(pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON); return true; } return false; Modified: dcplusplus/trunk/win32/ShellContextMenu.cpp =================================================================== --- dcplusplus/trunk/win32/ShellContextMenu.cpp 2008-02-17 22:03:38 UTC (rev 1013) +++ dcplusplus/trunk/win32/ShellContextMenu.cpp 2008-02-17 22:27:10 UTC (rev 1014) @@ -101,7 +101,7 @@ bDelete = true; // indicates that m_psfFolder should be deleted by CShellContextMenu } -UINT CShellContextMenu::ShowContextMenu(SmartWin::WidgetMenu::ObjectType& menu, SmartWin::Widget * parent, const SmartWin::ScreenCoordinate& pt) +UINT CShellContextMenu::ShowContextMenu(SmartWin::WidgetMenu::ObjectType& menu, const SmartWin::ScreenCoordinate& pt) { int iMenuType = 0; // to know which version of IContextMenu is supported LPCONTEXTMENU pContextMenu; // common pointer to IContextMenu and higher version interface @@ -116,7 +116,7 @@ WNDPROC OldWndProc; if(iMenuType > 1) // only attach if its version 2 or 3 { - OldWndProc = (WNDPROC) SetWindowLong(parent->handle(), GWL_WNDPROC, (DWORD) HookWndProc); + OldWndProc = (WNDPROC) SetWindowLong(menu->getParent()->handle(), GWL_WNDPROC, (DWORD) HookWndProc); if(iMenuType == 2) g_IContext2 = (LPCONTEXTMENU2) pContextMenu; else // version 3 @@ -125,10 +125,10 @@ else OldWndProc = NULL; - UINT idCommand = menu->trackPopupMenu(parent, pt, TPM_RETURNCMD | TPM_LEFTALIGN); + UINT idCommand = menu->trackPopupMenu(pt, TPM_RETURNCMD | TPM_LEFTALIGN); if(OldWndProc) // unattach - SetWindowLong(parent->handle(), GWL_WNDPROC, (DWORD) OldWndProc); + SetWindowLong(menu->getParent()->handle(), GWL_WNDPROC, (DWORD) OldWndProc); if(idCommand >= ID_SHELLCONTEXTMENU_MIN && idCommand <= ID_SHELLCONTEXTMENU_MAX) { Modified: dcplusplus/trunk/win32/ShellContextMenu.h =================================================================== --- dcplusplus/trunk/win32/ShellContextMenu.h 2008-02-17 22:03:38 UTC (rev 1013) +++ dcplusplus/trunk/win32/ShellContextMenu.h 2008-02-17 22:27:10 UTC (rev 1014) @@ -35,7 +35,7 @@ void SetPath(const wstring& strPath); - UINT ShowContextMenu(SmartWin::WidgetMenu::ObjectType& menu, SmartWin::Widget * parent, const SmartWin::ScreenCoordinate& pt); + UINT ShowContextMenu(SmartWin::WidgetMenu::ObjectType& menu, const SmartWin::ScreenCoordinate& pt); private: bool bDelete; Modified: dcplusplus/trunk/win32/SpyFrame.cpp =================================================================== --- dcplusplus/trunk/win32/SpyFrame.cpp 2008-02-17 22:03:38 UTC (rev 1013) +++ dcplusplus/trunk/win32/SpyFrame.cpp 2008-02-17 22:27:10 UTC (rev 1014) @@ -188,7 +188,7 @@ WidgetMenuPtr contextMenu = createMenu(WinUtil::Seeds::menu); contextMenu->appendItem<WidgetMenu::SimpleDispatcher>(IDC_SEARCH, T_("&Search"), std::tr1::bind(&SpyFrame::handleSearch, this, searches->getText(searches->getSelectedIndex(), COLUMN_STRING)), SmartWin::BitmapPtr(new SmartWin::Bitmap(IDB_SEARCH))); - contextMenu->trackPopupMenu(this, pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON); + contextMenu->trackPopupMenu(pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON); return true; } return false; Modified: dcplusplus/trunk/win32/TransferView.cpp =================================================================== --- dcplusplus/trunk/win32/TransferView.cpp 2008-02-17 22:03:38 UTC (rev 1013) +++ dcplusplus/trunk/win32/TransferView.cpp 2008-02-17 22:27:10 UTC (rev 1014) @@ -210,7 +210,7 @@ /// @todo Fix multiple selection menu... ConnectionInfo* ii = connections->getSelectedData(); WidgetMenuPtr contextMenu = makeContextMenu(ii); - contextMenu->trackPopupMenu(this, pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON); + contextMenu->trackPopupMenu(pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON); return true; } @@ -226,7 +226,7 @@ WidgetMenuPtr menu = createMenu(WinUtil::Seeds::menu); DownloadInfo* di = downloads->getSelectedData(); WinUtil::addHashItems(menu, di->tth, di->columns[DOWNLOAD_COLUMN_FILE]); - menu->trackPopupMenu(this, pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON); + menu->trackPopupMenu(pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON); return true; } Modified: dcplusplus/trunk/win32/UsersFrame.cpp =================================================================== --- dcplusplus/trunk/win32/UsersFrame.cpp 2008-02-17 22:03:38 UTC (rev 1013) +++ dcplusplus/trunk/win32/UsersFrame.cpp 2008-02-17 22:27:10 UTC (rev 1014) @@ -186,7 +186,7 @@ menu->appendItem(IDC_EDIT, T_("&Properties"), std::tr1::bind(&UsersFrame::handleProperties, this)); menu->appendItem(IDC_REMOVE, T_("&Remove"), std::tr1::bind(&UsersFrame::handleRemove, this)); - menu->trackPopupMenu(this, pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON); + menu->trackPopupMenu(pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON); return true; } Modified: dcplusplus/trunk/win32/WaitingUsersFrame.cpp =================================================================== --- dcplusplus/trunk/win32/WaitingUsersFrame.cpp 2008-02-17 22:03:38 UTC (rev 1013) +++ dcplusplus/trunk/win32/WaitingUsersFrame.cpp 2008-02-17 22:27:10 UTC (rev 1014) @@ -83,7 +83,7 @@ menu->appendItem(IDC_GRANTSLOT, T_("Grant &extra slot"), std::tr1::bind(&WaitingUsersFrame::onGrantSlot, this)); menu->appendItem(IDC_ADD_TO_FAVORITES, T_("Add To &Favorites"), std::tr1::bind(&WaitingUsersFrame::onAddToFavorites, this)); menu->appendItem(IDC_PRIVATEMESSAGE, T_("&Send private message"), std::tr1::bind(&WaitingUsersFrame::onPrivateMessage, this)); - menu->trackPopupMenu(this, pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON); + menu->trackPopupMenu(pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON); return true; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <zou...@us...> - 2008-02-18 20:19:31
|
Revision: 1016 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=1016&view=rev Author: zouzou123gen Date: 2008-02-18 12:19:27 -0800 (Mon, 18 Feb 2008) Log Message: ----------- Fixed clicking on active tab Modified Paths: -------------- dcplusplus/trunk/changelog.txt dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetTabView.h dcplusplus/trunk/smartwin/source/widgets/WidgetTabView.cpp dcplusplus/trunk/win32/MainWindow.cpp Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2008-02-17 23:43:00 UTC (rev 1015) +++ dcplusplus/trunk/changelog.txt 2008-02-18 20:19:27 UTC (rev 1016) @@ -36,6 +36,7 @@ * Fixed a few hardcoded dc++'s (thanks steven sheehy) * Don't always show the tray icon after killing and re-opening explorer.exe (poy) * Updated links (thanks pietry) +* Fixed clicking on active tab (poy) -- 0.704 2007-12-14 -- * Hub lists added to utilize Coral's distributed network (ullner) Modified: dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetTabView.h =================================================================== --- dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetTabView.h 2008-02-17 23:43:00 UTC (rev 1015) +++ dcplusplus/trunk/smartwin/include/smartwin/widgets/WidgetTabView.h 2008-02-18 20:19:27 UTC (rev 1016) @@ -31,6 +31,8 @@ public: /// Fills with default parameters Seed(); + + bool toggleActive; }; void add(WidgetChildWindow* w, const IconPtr& icon); @@ -85,6 +87,8 @@ std::tr1::function<void (const SmartUtil::tstring&)> titleChangedFunction; + bool toggleActive; + bool inTab; typedef std::list<WidgetChildWindow*> WindowList; Modified: dcplusplus/trunk/smartwin/source/widgets/WidgetTabView.cpp =================================================================== --- dcplusplus/trunk/smartwin/source/widgets/WidgetTabView.cpp 2008-02-17 23:43:00 UTC (rev 1015) +++ dcplusplus/trunk/smartwin/source/widgets/WidgetTabView.cpp 2008-02-18 20:19:27 UTC (rev 1016) @@ -7,7 +7,8 @@ WindowClass WidgetTabView::windowClass(_T("WidgetTabView"), &WidgetTabView::wndProc, NULL, ( HBRUSH )( COLOR_WINDOW + 1 )); WidgetTabView::Seed::Seed() : - Widget::Seed(windowClass.getClassName(), WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE) + Widget::Seed(windowClass.getClassName(), WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE), + toggleActive(false) { } @@ -15,6 +16,7 @@ PolicyType(w), tab(0), tip(0), + toggleActive(false), inTab(false), active(-1), dragging(-1) @@ -22,6 +24,7 @@ void WidgetTabView::create(const Seed & cs) { PolicyType::create(cs); + toggleActive = cs.toggleActive; WidgetTabSheet::Seed tcs; tcs.style = WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VISIBLE | @@ -311,8 +314,12 @@ } if(dropPos == dragging) { - // the tab hasn't moved; select it - setActive(dropPos); + // the tab hasn't moved; handle the click + if(dropPos == active) { + if(toggleActive) + next(); + } else + setActive(dropPos); dragging = -1; return; } Modified: dcplusplus/trunk/win32/MainWindow.cpp =================================================================== --- dcplusplus/trunk/win32/MainWindow.cpp 2008-02-17 23:43:00 UTC (rev 1015) +++ dcplusplus/trunk/win32/MainWindow.cpp 2008-02-18 20:19:27 UTC (rev 1016) @@ -309,6 +309,7 @@ void MainWindow::initTabs() { WidgetTabView::Seed cs; cs.style = WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_VISIBLE; + cs.toggleActive = BOOLSETTING(TOGGLE_ACTIVE_WINDOW); tabs = createTabView(cs); tabs->onTitleChanged(std::tr1::bind(&MainWindow::handleTabsTitleChanged, this, _1)); paned->setFirst(tabs); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <zou...@us...> - 2008-02-29 18:58:48
|
Revision: 1018 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=1018&view=rev Author: zouzou123gen Date: 2008-02-29 10:12:34 -0800 (Fri, 29 Feb 2008) Log Message: ----------- Fixed tabbing in hub windows Modified Paths: -------------- dcplusplus/trunk/changelog.txt dcplusplus/trunk/win32/HubFrame.cpp Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2008-02-21 20:56:33 UTC (rev 1017) +++ dcplusplus/trunk/changelog.txt 2008-02-29 18:12:34 UTC (rev 1018) @@ -37,6 +37,7 @@ * Don't always show the tray icon after killing and re-opening explorer.exe (poy) * Updated links (thanks pietry) * Fixed clicking on active tab (poy) +* Fixed tabbing in hub windows (poy) -- 0.704 2007-12-14 -- * Hub lists added to utilize Coral's distributed network (ullner) Modified: dcplusplus/trunk/win32/HubFrame.cpp =================================================================== --- dcplusplus/trunk/win32/HubFrame.cpp 2008-02-21 20:56:33 UTC (rev 1017) +++ dcplusplus/trunk/win32/HubFrame.cpp 2008-02-29 18:12:34 UTC (rev 1018) @@ -100,19 +100,9 @@ message->onKeyDown(std::tr1::bind(&HubFrame::handleMessageKeyDown, this, _1)); message->onChar(std::tr1::bind(&HubFrame::handleMessageChar, this, _1)); } - + { WidgetTextBox::Seed cs = WinUtil::Seeds::textBox; - cs.style = WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL | ES_MULTILINE | ES_NOHIDESEL | ES_READONLY; - chat = createTextBox(cs); - chat->setTextLimit(0); - addWidget(chat); - paned->setFirst(chat); - chat->onContextMenu(std::tr1::bind(&HubFrame::handleChatContextMenu, this, _1)); - } - - { - WidgetTextBox::Seed cs = WinUtil::Seeds::textBox; cs.style = WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL; filter = createTextBox(cs); addWidget(filter); @@ -130,8 +120,18 @@ filterType->setSelectedIndex(COLUMN_LAST); filterType->onSelectionChanged(std::tr1::bind(&HubFrame::updateUserList, this, (UserInfo*)0)); } - + { + WidgetTextBox::Seed cs = WinUtil::Seeds::textBox; + cs.style = WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL | ES_MULTILINE | ES_NOHIDESEL | ES_READONLY; + chat = createTextBox(cs); + chat->setTextLimit(0); + addWidget(chat); + paned->setFirst(chat); + chat->onContextMenu(std::tr1::bind(&HubFrame::handleChatContextMenu, this, _1)); + } + + { users = SmartWin::WidgetCreator<WidgetUsers>::create(this, WinUtil::Seeds::listView); addWidget(users); paned->setSecond(users); @@ -151,6 +151,7 @@ { WidgetCheckBox::Seed cs(_T("+/-")); + cs.style &= ~WS_TABSTOP; showUsers = createCheckBox(cs); showUsers->setChecked(BOOLSETTING(GET_USER_INFO)); } @@ -681,7 +682,7 @@ bool HubFrame::handleMessageChar(int c) { switch(c) { - case VK_TAB: + case VK_TAB: return true; break; case VK_RETURN: { if(!(isShiftPressed() || isControlPressed() || isAltPressed())) { return true; @@ -1292,7 +1293,8 @@ bool HubFrame::tab() { if(message->length() == 0) { - return false; + ::SetFocus(::GetNextDlgTabItem(handle(), message->handle(), isShiftPressed())); + return true; } HWND focus = GetFocus(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <zou...@us...> - 2008-02-29 22:58:02
|
Revision: 1019 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=1019&view=rev Author: zouzou123gen Date: 2008-02-29 14:58:00 -0800 (Fri, 29 Feb 2008) Log Message: ----------- Fixed Ctrl+F that opens favorite hubs Modified Paths: -------------- dcplusplus/trunk/changelog.txt dcplusplus/trunk/win32/DCPlusPlus.rc dcplusplus/trunk/win32/resource.h Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2008-02-29 18:12:34 UTC (rev 1018) +++ dcplusplus/trunk/changelog.txt 2008-02-29 22:58:00 UTC (rev 1019) @@ -37,7 +37,8 @@ * Don't always show the tray icon after killing and re-opening explorer.exe (poy) * Updated links (thanks pietry) * Fixed clicking on active tab (poy) -* Fixed tabbing in hub windows (poy) +* [L#195209] Fixed tabbing in hub windows (poy) +* [L#195209] Fixed Ctrl+F that opens favorite hubs (poy) -- 0.704 2007-12-14 -- * Hub lists added to utilize Coral's distributed network (ullner) Modified: dcplusplus/trunk/win32/DCPlusPlus.rc =================================================================== --- dcplusplus/trunk/win32/DCPlusPlus.rc 2008-02-29 18:12:34 UTC (rev 1018) +++ dcplusplus/trunk/win32/DCPlusPlus.rc 2008-02-29 22:58:00 UTC (rev 1019) @@ -880,7 +880,7 @@ "3", IDC_VIEW_TRANSFER_VIEW, VIRTKEY, CONTROL, NOINVERT "D", IDC_QUEUE, VIRTKEY, CONTROL, NOINVERT "E", IDC_REFRESH_FILE_LIST, VIRTKEY, CONTROL, NOINVERT - "F", IDC_FAVORITES, VIRTKEY, CONTROL, NOINVERT + "F", IDC_FAVORITE_HUBS, VIRTKEY, CONTROL, NOINVERT "L", IDC_OPEN_FILE_LIST, VIRTKEY, CONTROL, NOINVERT "N", IDC_NOTEPAD, VIRTKEY, CONTROL, NOINVERT "P", IDC_CONNECT, VIRTKEY, CONTROL, NOINVERT Modified: dcplusplus/trunk/win32/resource.h =================================================================== --- dcplusplus/trunk/win32/resource.h 2008-02-29 18:12:34 UTC (rev 1018) +++ dcplusplus/trunk/win32/resource.h 2008-02-29 22:58:00 UTC (rev 1019) @@ -81,7 +81,6 @@ #define IDC_VIEW_TOOLBAR 1007 #define IDC_VIEW_TRANSFER_VIEW 1008 #define IDC_PUBLIC_HUBS 1009 -#define IDC_FAVORITE_HUBS 1010 #define IDC_GETLIST 1011 #define IDC_COPY_FILENAME 1012 #define IDC_GRANTSLOT 1013 @@ -206,7 +205,7 @@ #define IDC_EMAIL 2047 #define IDC_EXTERNAL_IP 2048 #define IDC_FAVORITE_DIRECTORIES 2049 -#define IDC_FAVORITES 2050 +#define IDC_FAVORITE_HUBS 2050 #define IDC_FAVUSERS 2051 #define IDC_FH_ADDRESS 2052 #define IDC_FH_HUB 2053 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2008-03-01 22:00:50
|
Revision: 1020 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=1020&view=rev Author: arnetheduck Date: 2008-03-01 14:00:01 -0800 (Sat, 01 Mar 2008) Log Message: ----------- auto-coral all urls, mem leak fix Modified Paths: -------------- dcplusplus/trunk/changelog.txt dcplusplus/trunk/dcpp/BufferedSocket.cpp dcplusplus/trunk/dcpp/CryptoManager.cpp dcplusplus/trunk/dcpp/FavoriteManager.h dcplusplus/trunk/dcpp/HttpConnection.cpp dcplusplus/trunk/dcpp/SettingsManager.cpp dcplusplus/trunk/dcpp/SettingsManager.h dcplusplus/trunk/win32/AboutDlg.cpp dcplusplus/trunk/win32/AdvancedPage.cpp dcplusplus/trunk/win32/MainWindow.cpp Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2008-02-29 22:58:00 UTC (rev 1019) +++ dcplusplus/trunk/changelog.txt 2008-03-01 22:00:01 UTC (rev 1020) @@ -39,7 +39,9 @@ * Fixed clicking on active tab (poy) * [L#195209] Fixed tabbing in hub windows (poy) * [L#195209] Fixed Ctrl+F that opens favorite hubs (poy) +* [L#194696] Fixed small memory leak + -- 0.704 2007-12-14 -- * Hub lists added to utilize Coral's distributed network (ullner) * Use system header arrows on common controls 6+ (thanks poy) Modified: dcplusplus/trunk/dcpp/BufferedSocket.cpp =================================================================== --- dcplusplus/trunk/dcpp/BufferedSocket.cpp 2008-02-29 22:58:00 UTC (rev 1019) +++ dcplusplus/trunk/dcpp/BufferedSocket.cpp 2008-03-01 22:00:01 UTC (rev 1020) @@ -411,30 +411,34 @@ continue; } - switch(p.first) { - case SEND_DATA: - threadSendData(); break; - case SEND_FILE: - threadSendFile(((SendFileInfo*)p.second)->stream); break; - case CONNECT: - { - ConnectInfo* ci = (ConnectInfo*)p.second; - threadConnect(ci->addr, ci->port, ci->proxy); + try { + switch(p.first) { + case SEND_DATA: + threadSendData(); break; + case SEND_FILE: + threadSendFile(((SendFileInfo*)p.second)->stream); break; + case CONNECT: + { + ConnectInfo* ci = (ConnectInfo*)p.second; + threadConnect(ci->addr, ci->port, ci->proxy); + break; + } + case DISCONNECT: + if(isConnected()) + fail(_("Disconnected")); break; - } - case DISCONNECT: - if(isConnected()) - fail(_("Disconnected")); - break; - case SHUTDOWN: - return false; - case ACCEPTED: - break; - case UPDATED: - fire(BufferedSocketListener::Updated()); - break; + case SHUTDOWN: + return false; + case ACCEPTED: + break; + case UPDATED: + fire(BufferedSocketListener::Updated()); + break; + } + } catch(...) { + delete p.second; + throw; } - delete p.second; } return true; Modified: dcplusplus/trunk/dcpp/CryptoManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/CryptoManager.cpp 2008-02-29 22:58:00 UTC (rev 1019) +++ dcplusplus/trunk/dcpp/CryptoManager.cpp 2008-03-01 22:00:01 UTC (rev 1020) @@ -149,7 +149,7 @@ ssl::X509 x509ss(X509_new()); if(!bn || !rsa || !pkey || !nm || !x509ss) { - throw new CryptoException("Error creating objects for cert generation"); + throw CryptoException("Error creating objects for cert generation"); } int days = 10; Modified: dcplusplus/trunk/dcpp/FavoriteManager.h =================================================================== --- dcplusplus/trunk/dcpp/FavoriteManager.h 2008-02-29 22:58:00 UTC (rev 1019) +++ dcplusplus/trunk/dcpp/FavoriteManager.h 2008-03-01 22:00:01 UTC (rev 1020) @@ -122,6 +122,7 @@ int lastServer; HubTypes listType; string downloadBuf; + bool coral; ///< Currently downloading from a coraled list /** Used during loading to prevent saving. */ bool dontSave; Modified: dcplusplus/trunk/dcpp/HttpConnection.cpp =================================================================== --- dcplusplus/trunk/dcpp/HttpConnection.cpp 2008-02-29 22:58:00 UTC (rev 1019) +++ dcplusplus/trunk/dcpp/HttpConnection.cpp 2008-03-01 22:00:01 UTC (rev 1020) @@ -26,6 +26,8 @@ namespace dcpp { +static const std::string CORAL_SUFFIX = ".nyud.net"; + /** * Downloads a file and returns it as a string * @todo Report exceptions @@ -61,6 +63,12 @@ Util::decodeUrl(SETTING(HTTP_PROXY), server, port, file); file = currentUrl; } + + if(SETTING(CORAL)) { + if(server.length() > CORAL_SUFFIX.length() && server.compare(server.length() - CORAL_SUFFIX.length(), CORAL_SUFFIX.length(), CORAL_SUFFIX) != 0) { + server += CORAL_SUFFIX; + } + } if(port == 0) port = 80; Modified: dcplusplus/trunk/dcpp/SettingsManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/SettingsManager.cpp 2008-02-29 22:58:00 UTC (rev 1019) +++ dcplusplus/trunk/dcpp/SettingsManager.cpp 2008-03-01 22:00:01 UTC (rev 1020) @@ -77,7 +77,7 @@ "UseTLS", "AutoSearchLimit", "AltSortOrder", "AutoKickNoFavs", "PromptPassword", "SpyFrameIgnoreTthSearches", "DontDlAlreadyQueued", "MaxCommandLength", "AllowUntrustedHubs", "AllowUntrustedClients", "TLSPort", "FastHash", "SortFavUsersFirst", "ShowShellMenu", "MinSegmentSize", "FollowLinks", - "SendBloom", "OwnerDrawnMenus", + "SendBloom", "OwnerDrawnMenus", "Coral", "SENTRY", // Int64 "TotalUpload", "TotalDownload", @@ -136,7 +136,7 @@ setDefault(IGNORE_BOT_PMS, false); setDefault(LIST_DUPES, true); setDefault(BUFFER_SIZE, 64); - setDefault(HUBLIST_SERVERS, "http://hublist.hubtracker.com.nyud.net/hublist.xml.bz2;http://dchublist.com.nyud.net/hublist.xml.bz2;http://adchublist.com.nyud.net/hublist.xml.bz2;http://www.hublist.org.nyud.net/PublicHubList.xml.bz2;http://dclist.eu.nyud.net/hublist.xml.bz2;http://download.hublist.cz.nyud.net/hublist.xml.bz2;http://hublist.awenet.info.nyud.net/PublicHubList.xml.bz2"); + setDefault(HUBLIST_SERVERS, "http://hublist.hubtracker.com/hublist.xml.bz2;http://dchublist.com/hublist.xml.bz2;http://adchublist.com/hublist.xml.bz2;http://www.hublist.org/PublicHubList.xml.bz2;http://dclist.eu/hublist.xml.bz2;http://download.hublist.cz/hublist.xml.bz2;http://hublist.awenet.info/PublicHubList.xml.bz2"); setDefault(DOWNLOAD_SLOTS, 3); setDefault(MAX_DOWNLOAD_SPEED, 0); setDefault(LOG_DIRECTORY, Util::getConfigPath() + "Logs" PATH_SEPARATOR_STR); @@ -274,7 +274,8 @@ setDefault(FOLLOW_LINKS, false); setDefault(SEND_BLOOM, true); setDefault(OWNER_DRAWN_MENUS, true); - + setDefault(CORAL, true); + #ifdef _WIN32 setDefault(MAIN_WINDOW_STATE, SW_SHOWNORMAL); setDefault(MAIN_WINDOW_SIZE_X, CW_USEDEFAULT); Modified: dcplusplus/trunk/dcpp/SettingsManager.h =================================================================== --- dcplusplus/trunk/dcpp/SettingsManager.h 2008-02-29 22:58:00 UTC (rev 1019) +++ dcplusplus/trunk/dcpp/SettingsManager.h 2008-03-01 22:00:01 UTC (rev 1020) @@ -90,7 +90,7 @@ USE_TLS, AUTO_SEARCH_LIMIT, ALT_SORT_ORDER, AUTO_KICK_NO_FAVS, PROMPT_PASSWORD, SPY_FRAME_IGNORE_TTH_SEARCHES, DONT_DL_ALREADY_QUEUED, MAX_COMMAND_LENGTH, ALLOW_UNTRUSTED_HUBS, ALLOW_UNTRUSTED_CLIENTS, TLS_PORT, FAST_HASH, SORT_FAVUSERS_FIRST, SHOW_SHELL_MENU, MIN_SEGMENT_SIZE, FOLLOW_LINKS, - SEND_BLOOM, OWNER_DRAWN_MENUS, + SEND_BLOOM, OWNER_DRAWN_MENUS, CORAL, INT_LAST }; enum Int64Setting { INT64_FIRST = INT_LAST + 1, Modified: dcplusplus/trunk/win32/AboutDlg.cpp =================================================================== --- dcplusplus/trunk/win32/AboutDlg.cpp 2008-02-29 22:58:00 UTC (rev 1019) +++ dcplusplus/trunk/win32/AboutDlg.cpp 2008-03-01 22:00:01 UTC (rev 1020) @@ -67,7 +67,7 @@ centerWindow(); c.addListener(this); - c.downloadFile("http://dcplusplus.sourceforge.net.nyud.net/version.xml"); + c.downloadFile("http://dcplusplus.sourceforge.net/version.xml"); return false; } Modified: dcplusplus/trunk/win32/AdvancedPage.cpp =================================================================== --- dcplusplus/trunk/win32/AdvancedPage.cpp 2008-02-29 22:58:00 UTC (rev 1019) +++ dcplusplus/trunk/win32/AdvancedPage.cpp 2008-03-01 22:00:01 UTC (rev 1020) @@ -47,6 +47,7 @@ { SettingsManager::AUTO_KICK_NO_FAVS, N_("Don't automatically disconnect favorite users who leave the hub") }, { SettingsManager::SHOW_SHELL_MENU, N_("Show shell menu where possible") }, { SettingsManager::OWNER_DRAWN_MENUS, N_("Use extended menus with icons and titles") }, + { SettingsManager::CORAL, N_("Use Coral network when downloading hub lists (improves reliability)") }, { 0, 0 } }; Modified: dcplusplus/trunk/win32/MainWindow.cpp =================================================================== --- dcplusplus/trunk/win32/MainWindow.cpp 2008-02-29 22:58:00 UTC (rev 1019) +++ dcplusplus/trunk/win32/MainWindow.cpp 2008-03-01 22:00:01 UTC (rev 1020) @@ -106,7 +106,7 @@ c = new HttpConnection; c->addListener(this); - c->downloadFile("http://dcplusplus.sourceforge.net.nyud.net/version.xml"); + c->downloadFile("http://dcplusplus.sourceforge.net/version.xml"); File::ensureDirectory(SETTING(LOG_DIRECTORY)); startSocket(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2008-03-01 23:17:01
|
Revision: 1022 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=1022&view=rev Author: arnetheduck Date: 2008-03-01 15:16:58 -0800 (Sat, 01 Mar 2008) Log Message: ----------- boostify some mem handling Modified Paths: -------------- dcplusplus/trunk/dcpp/AdcHub.cpp dcplusplus/trunk/dcpp/BufferedSocket.cpp dcplusplus/trunk/dcpp/CryptoManager.cpp dcplusplus/trunk/dcpp/DirectoryListing.cpp dcplusplus/trunk/dcpp/DownloadManager.cpp dcplusplus/trunk/dcpp/File.cpp dcplusplus/trunk/dcpp/FilteredFile.h dcplusplus/trunk/dcpp/HashManager.cpp dcplusplus/trunk/dcpp/NmdcHub.cpp dcplusplus/trunk/dcpp/SearchManager.cpp dcplusplus/trunk/dcpp/ShareManager.cpp dcplusplus/trunk/dcpp/Streams.h dcplusplus/trunk/dcpp/Util.cpp dcplusplus/trunk/dcpp/Util.h dcplusplus/trunk/dcpp/stdinc.h dcplusplus/trunk/win32/PropPage.cpp dcplusplus/trunk/win32/WinUtil.cpp Modified: dcplusplus/trunk/dcpp/AdcHub.cpp =================================================================== --- dcplusplus/trunk/dcpp/AdcHub.cpp 2008-03-01 22:39:24 UTC (rev 1021) +++ dcplusplus/trunk/dcpp/AdcHub.cpp 2008-03-01 23:16:58 UTC (rev 1022) @@ -643,15 +643,15 @@ return; if(!salt.empty()) { size_t saltBytes = salt.size() * 5 / 8; - AutoArray<uint8_t> buf(saltBytes); - Encoder::fromBase32(salt.c_str(), buf, saltBytes); + boost::scoped_array<uint8_t> buf(new uint8_t[saltBytes]); + Encoder::fromBase32(salt.c_str(), &buf[0], saltBytes); TigerHash th; if(oldPassword) { CID cid = getMyIdentity().getUser()->getCID(); th.update(cid.data(), CID::SIZE); } th.update(pwd.data(), pwd.length()); - th.update(buf, saltBytes); + th.update(&buf[0], saltBytes); send(AdcCommand(AdcCommand::CMD_PAS, AdcCommand::TYPE_HUB).addParam(Encoder::toBase32(th.finalize(), TigerHash::BYTES))); salt.clear(); } Modified: dcplusplus/trunk/dcpp/BufferedSocket.cpp =================================================================== --- dcplusplus/trunk/dcpp/BufferedSocket.cpp 2008-03-01 22:39:24 UTC (rev 1021) +++ dcplusplus/trunk/dcpp/BufferedSocket.cpp 2008-03-01 23:16:58 UTC (rev 1022) @@ -183,7 +183,7 @@ const int BufSize = 1024; // Special to autodetect nmdc connections... string::size_type pos = 0; - AutoArray<uint8_t> buffer (BufSize); + boost::scoped_array<uint8_t> buffer (new uint8_t[BufSize]); size_t in; l = line; // decompress all input data and store in l. Modified: dcplusplus/trunk/dcpp/CryptoManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/CryptoManager.cpp 2008-03-01 22:39:24 UTC (rev 1021) +++ dcplusplus/trunk/dcpp/CryptoManager.cpp 2008-03-01 23:16:58 UTC (rev 1022) @@ -346,12 +346,12 @@ // We assume that the files aren't compressed more than 2:1...if they are it'll work anyway, // but we'll have to do multiple passes... size_t bufsize = 2*sz; - AutoArray<char> buf(bufsize); + boost::scoped_array<char> buf(new char[bufsize]); bs.avail_in = sz; bs.avail_out = bufsize; bs.next_in = (char*)(const_cast<uint8_t*>(is)); - bs.next_out = buf; + bs.next_out = &buf[0]; int err; @@ -362,13 +362,13 @@ BZ2_bzDecompressEnd(&bs); throw CryptoException(_("Error during decompression")); } - os.append(buf, bufsize-bs.avail_out); + os.append(&buf[0], bufsize-bs.avail_out); bs.avail_out = bufsize; - bs.next_out = buf; + bs.next_out = &buf[0]; } if(err == BZ_STREAM_END) - os.append(buf, bufsize-bs.avail_out); + os.append(&buf[0], bufsize-bs.avail_out); BZ2_bzDecompressEnd(&bs); @@ -379,7 +379,7 @@ } string CryptoManager::keySubst(const uint8_t* aKey, size_t len, size_t n) { - AutoArray<uint8_t> temp(len + n * 10); + boost::scoped_array<uint8_t> temp(new uint8_t[len + n * 10]); size_t j=0; @@ -400,14 +400,14 @@ temp[j++] = aKey[i]; } } - return string((char*)(uint8_t*)temp, j); + return string((const char*)&temp[0], j); } string CryptoManager::makeKey(const string& aLock) { if(aLock.size() < 3) return Util::emptyString; - AutoArray<uint8_t> temp(aLock.length()); + boost::scoped_array<uint8_t> temp(new uint8_t[aLock.length()]); uint8_t v1; size_t extra=0; @@ -431,7 +431,7 @@ extra++; } - return keySubst(temp, aLock.length(), extra); + return keySubst(&temp[0], aLock.length(), extra); } } // namespace dcpp Modified: dcplusplus/trunk/dcpp/DirectoryListing.cpp =================================================================== --- dcplusplus/trunk/dcpp/DirectoryListing.cpp 2008-03-01 22:39:24 UTC (rev 1021) +++ dcplusplus/trunk/dcpp/DirectoryListing.cpp 2008-03-01 23:16:58 UTC (rev 1022) @@ -83,13 +83,13 @@ dcpp::File ff(name, dcpp::File::READ, dcpp::File::OPEN); FilteredInputStream<UnBZFilter, false> f(&ff); const size_t BUF_SIZE = 64*1024; - AutoArray<char> buf(BUF_SIZE); + boost::scoped_array<char> buf(new char[BUF_SIZE]); size_t len; size_t bytesRead = 0; for(;;) { size_t n = BUF_SIZE; - len = f.read(buf, n); - txt.append(buf, len); + len = f.read(&buf[0], n); + txt.append(&buf[0], len); bytesRead += len; if(SETTING(MAX_FILELIST_SIZE) && bytesRead > (size_t)SETTING(MAX_FILELIST_SIZE)*1024*1024) break; Modified: dcplusplus/trunk/dcpp/DownloadManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/DownloadManager.cpp 2008-03-01 22:39:24 UTC (rev 1021) +++ dcplusplus/trunk/dcpp/DownloadManager.cpp 2008-03-01 23:16:58 UTC (rev 1022) @@ -350,9 +350,9 @@ CalcInputStream<CRC32Filter, false> f(&ff); const size_t BUF_SIZE = 1024*1024; - AutoArray<uint8_t> b(BUF_SIZE); + boost::scoped_array<uint8_t> b(new uint8_t[BUF_SIZE]); size_t n = BUF_SIZE; - while(f.read((uint8_t*)b, n) > 0) + while(f.read(&b[0], n) > 0) ; // Keep on looping... return f.getFilter().getValue(); Modified: dcplusplus/trunk/dcpp/File.cpp =================================================================== --- dcplusplus/trunk/dcpp/File.cpp 2008-03-01 22:39:24 UTC (rev 1021) +++ dcplusplus/trunk/dcpp/File.cpp 2008-03-01 23:16:58 UTC (rev 1022) @@ -350,13 +350,13 @@ // This doesn't assume all bytes are written in one write call, it is a bit safer void File::copyFile(const string& source, const string& target) throw(FileException) { const size_t BUF_SIZE = 64 * 1024; - AutoArray<char> buffer(BUF_SIZE); + boost::scoped_array<char> buffer(BUF_SIZE); size_t count = BUF_SIZE; File src(source, File::READ, 0); File dst(target, File::WRITE, File::CREATE | File::TRUNCATE); - while(src.read((char*)buffer, count) > 0) { - char* p = (char*)buffer; + while(src.read(&buffer[0], count) > 0) { + char* p = &buffer[0]; while(count > 0) { size_t ret = dst.write(p, count); p += ret; Modified: dcplusplus/trunk/dcpp/FilteredFile.h =================================================================== --- dcplusplus/trunk/dcpp/FilteredFile.h 2008-03-01 22:39:24 UTC (rev 1021) +++ dcplusplus/trunk/dcpp/FilteredFile.h 2008-03-01 23:16:58 UTC (rev 1022) @@ -95,7 +95,7 @@ public: using OutputStream::write; - FilteredOutputStream(OutputStream* aFile) : f(aFile), buf(BUF_SIZE), flushed(false) { } + FilteredOutputStream(OutputStream* aFile) : f(aFile), buf(new uint8_t[BUF_SIZE]), flushed(false) { } ~FilteredOutputStream() throw() { if(manage) delete f; } size_t flush() throw(Exception) { @@ -108,9 +108,9 @@ for(;;) { size_t n = BUF_SIZE; size_t zero = 0; - bool more = filter(NULL, zero, buf, n); + bool more = filter(NULL, zero, &buf[0], n); - written += f->write(buf, n); + written += f->write(&buf[0], n); if(!more) break; @@ -128,11 +128,11 @@ size_t n = BUF_SIZE; size_t m = len; - bool more = filter(wb, m, buf, n); + bool more = filter(wb, m, &buf[0], n); wb += m; len -= m; - written += f->write(buf, n); + written += f->write(&buf[0], n); if(!more) { if(len > 0) { @@ -151,14 +151,14 @@ OutputStream* f; Filter filter; - AutoArray<uint8_t> buf; + boost::scoped_array<uint8_t> buf; bool flushed; }; template<class Filter, bool managed> class FilteredInputStream : public InputStream { public: - FilteredInputStream(InputStream* aFile) : f(aFile), buf(BUF_SIZE), pos(0), valid(0), more(true) { } + FilteredInputStream(InputStream* aFile) : f(aFile), buf(new uint8_t[BUF_SIZE]), pos(0), valid(0), more(true) { } virtual ~FilteredInputStream() throw() { if(managed) delete f; } /** @@ -177,13 +177,13 @@ size_t curRead = BUF_SIZE; if(valid == 0) { dcassert(pos == 0); - valid = f->read(buf, curRead); + valid = f->read(&buf[0], curRead); totalRead += curRead; } size_t n = len - totalProduced; size_t m = valid - pos; - more = filter(buf + pos, m, rb, n); + more = filter(&buf[pos], m, rb, n); pos += m; if(pos == valid) { valid = pos = 0; @@ -200,7 +200,7 @@ InputStream* f; Filter filter; - AutoArray<uint8_t> buf; + boost::scoped_array<uint8_t> buf; size_t pos; size_t valid; bool more; Modified: dcplusplus/trunk/dcpp/HashManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/HashManager.cpp 2008-03-01 22:39:24 UTC (rev 1021) +++ dcplusplus/trunk/dcpp/HashManager.cpp 2008-03-01 23:16:58 UTC (rev 1022) @@ -153,9 +153,9 @@ try { f.setPos(ti.getIndex()); size_t datalen = TigerTree::calcBlocks(ti.getSize(), ti.getBlockSize()) * TTHValue::BYTES; - AutoArray<uint8_t> buf(datalen); - f.read((uint8_t*)buf, datalen); - tt = TigerTree(ti.getSize(), ti.getBlockSize(), buf); + boost::scoped_array<uint8_t> buf(new uint8_t[datalen]); + f.read(&buf[0], datalen); + tt = TigerTree(ti.getSize(), ti.getBlockSize(), &buf[0]); if(!(tt.getRoot() == root)) return false; } catch(const Exception&) { Modified: dcplusplus/trunk/dcpp/NmdcHub.cpp =================================================================== --- dcplusplus/trunk/dcpp/NmdcHub.cpp 2008-03-01 22:39:24 UTC (rev 1021) +++ dcplusplus/trunk/dcpp/NmdcHub.cpp 2008-03-01 23:16:58 UTC (rev 1022) @@ -807,7 +807,6 @@ void NmdcHub::search(int aSizeType, int64_t aSize, int aFileType, const string& aString, const string&) { checkstate(); - AutoArray<char> buf((char*)NULL); char c1 = (aSizeType == SearchManager::SIZE_DONTCARE) ? 'F' : 'T'; char c2 = (aSizeType == SearchManager::SIZE_ATLEAST) ? 'F' : 'T'; string tmp = ((aFileType == SearchManager::TYPE_TTH) ? "TTH:" + aString : fromUtf8(escape(aString))); @@ -815,19 +814,19 @@ while((i = tmp.find(' ')) != string::npos) { tmp[i] = '$'; } - int chars = 0; size_t BUF_SIZE; + string tmp2; if(ClientManager::getInstance()->isActive()) { string x = getLocalIp(); BUF_SIZE = x.length() + aString.length() + 64; - buf = new char[BUF_SIZE]; - chars = snprintf(buf, BUF_SIZE, "$Search %s:%d %c?%c?%s?%d?%s|", x.c_str(), (int)SearchManager::getInstance()->getPort(), c1, c2, Util::toString(aSize).c_str(), aFileType+1, tmp.c_str()); + tmp2.resize(BUF_SIZE); + tmp2.resize(snprintf(&tmp2[0], tmp2.size(), "$Search %s:%d %c?%c?%s?%d?%s|", x.c_str(), (int)SearchManager::getInstance()->getPort(), c1, c2, Util::toString(aSize).c_str(), aFileType+1, tmp.c_str())); } else { BUF_SIZE = getMyNick().length() + aString.length() + 64; - buf = new char[BUF_SIZE]; - chars = snprintf(buf, BUF_SIZE, "$Search Hub:%s %c?%c?%s?%d?%s|", fromUtf8(getMyNick()).c_str(), c1, c2, Util::toString(aSize).c_str(), aFileType+1, tmp.c_str()); + tmp2.resize(BUF_SIZE); + tmp2.resize(snprintf(&tmp2[0], tmp2.size(), "$Search Hub:%s %c?%c?%s?%d?%s|", fromUtf8(getMyNick()).c_str(), c1, c2, Util::toString(aSize).c_str(), aFileType+1, tmp.c_str())); } - send(buf, chars); + send(tmp2); } string NmdcHub::validateMessage(string tmp, bool reverse) { Modified: dcplusplus/trunk/dcpp/SearchManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/SearchManager.cpp 2008-03-01 22:39:24 UTC (rev 1021) +++ dcplusplus/trunk/dcpp/SearchManager.cpp 2008-03-01 23:16:58 UTC (rev 1022) @@ -145,15 +145,15 @@ #define BUFSIZE 8192 int SearchManager::run() { - AutoArray<uint8_t> buf(BUFSIZE); + boost::scoped_array<uint8_t> buf(new uint8_t[BUFSIZE]); int len; while(true) { string remoteAddr; try { - while( (len = socket->read((uint8_t*)buf, BUFSIZE, remoteAddr)) != 0) { - onData(buf, len, remoteAddr); + while( (len = socket->read(&buf[0], BUFSIZE, remoteAddr)) != 0) { + onData(&buf[0], len, remoteAddr); } } catch(const SocketException& e) { dcdebug("SearchManager::run Error: %s\n", e.getError().c_str()); Modified: dcplusplus/trunk/dcpp/ShareManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/ShareManager.cpp 2008-03-01 22:39:24 UTC (rev 1021) +++ dcplusplus/trunk/dcpp/ShareManager.cpp 2008-03-01 23:16:58 UTC (rev 1022) @@ -363,12 +363,12 @@ dcpp::File ff(Util::getConfigPath() + "files.xml.bz2", dcpp::File::READ, dcpp::File::OPEN); FilteredInputStream<UnBZFilter, false> f(&ff); const size_t BUF_SIZE = 64*1024; - AutoArray<char> buf(BUF_SIZE); + boost::scoped_array<char> buf(new char[BUF_SIZE]); size_t len; for(;;) { size_t n = BUF_SIZE; - len = f.read(buf, n); - txt.append(buf, len); + len = f.read(&buf[0], n); + txt.append(&buf[0], len); if(len < BUF_SIZE) break; } Modified: dcplusplus/trunk/dcpp/Streams.h =================================================================== --- dcplusplus/trunk/dcpp/Streams.h 2008-03-01 22:39:24 UTC (rev 1021) +++ dcplusplus/trunk/dcpp/Streams.h 2008-03-01 23:16:58 UTC (rev 1022) @@ -127,7 +127,7 @@ public: using OutputStream::write; - BufferedOutputStream(OutputStream* aStream, size_t aBufSize = SETTING(BUFFER_SIZE) * 1024) : s(aStream), pos(0), bufSize(aBufSize), buf(aBufSize) { } + BufferedOutputStream(OutputStream* aStream, size_t aBufSize = SETTING(BUFFER_SIZE) * 1024) : s(aStream), pos(0), buf(aBufSize) { } virtual ~BufferedOutputStream() throw() { try { // We must do this in order not to lose bytes when a download @@ -140,7 +140,7 @@ virtual size_t flush() throw(Exception) { if(pos > 0) - s->write(buf, pos); + s->write(&buf[0], pos); pos = 0; s->flush(); return 0; @@ -149,18 +149,19 @@ virtual size_t write(const void* wbuf, size_t len) throw(Exception) { uint8_t* b = (uint8_t*)wbuf; size_t l2 = len; + size_t bufSize = buf.size(); while(len > 0) { if(pos == 0 && len >= bufSize) { s->write(b, len); break; } else { size_t n = min(bufSize - pos, len); - memcpy(buf + pos, b, n); + memcpy(&buf[pos], b, n); b += n; pos += n; len -= n; if(pos == bufSize) { - s->write(buf, bufSize); + s->write(&buf[0], bufSize); pos = 0; } } @@ -170,8 +171,7 @@ private: OutputStream* s; size_t pos; - size_t bufSize; - AutoArray<uint8_t> buf; + ByteVector buf; }; class StringOutputStream : public OutputStream { Modified: dcplusplus/trunk/dcpp/Util.cpp =================================================================== --- dcplusplus/trunk/dcpp/Util.cpp 2008-03-01 22:39:24 UTC (rev 1021) +++ dcplusplus/trunk/dcpp/Util.cpp 2008-03-01 23:16:58 UTC (rev 1022) @@ -669,17 +669,18 @@ tmp[1] = tmp[2] = tmp[3] = 0; StringMap sm; - AutoArray<char> buf(1024); + static const size_t BUF_SIZE = 1024; + boost::scoped_array<char> buf(new char[BUF_SIZE]); for(size_t i = 0; i < strlen(codes); ++i) { tmp[1] = codes[i]; tmp[2] = 0; - strftime(buf, 1024-1, tmp, t); - sm[tmp] = buf; + strftime(&buf[0], BUF_SIZE-1, tmp, t); + sm[tmp] = &buf[0]; tmp[1] = '#'; tmp[2] = codes[i]; - strftime(buf, 1024-1, tmp, t); - sm[tmp] = buf; + strftime(&buf[0], BUF_SIZE-1, tmp, t); + sm[tmp] = &buf[0]; } for(StringMapIter i = sm.begin(); i != sm.end(); ++i) { @@ -701,13 +702,15 @@ return Util::emptyString; } #if _WIN32 - AutoArray<TCHAR> buf(bufsize); + tstring buf(bufsize, 0); - if(!_tcsftime(buf, bufsize-1, Text::toT(msg).c_str(), loc)) { + buf.resize(_tcsftime(&buf[0], buf.size()-1, Text::toT(msg).c_str(), loc)); + + if(buf.empty()) { return fixedftime(msg, loc); } - return Text::fromT(tstring(buf)); + return Text::fromT(buf); #else // will this give wide representations for %a and %A? // surely win32 can't have a leg up on linux/unixen in this area. - Todd Modified: dcplusplus/trunk/dcpp/Util.h =================================================================== --- dcplusplus/trunk/dcpp/Util.h 2008-03-01 22:39:24 UTC (rev 1021) +++ dcplusplus/trunk/dcpp/Util.h 2008-03-01 23:16:58 UTC (rev 1022) @@ -87,22 +87,6 @@ template<typename T1> inline int compare(const T1& v1, const T1& v2) { return (v1 < v2) ? -1 : ((v1 == v2) ? 0 : 1); } -template<typename T> -class AutoArray { - typedef T* TPtr; -public: - explicit AutoArray(TPtr t) : p(t) { } - explicit AutoArray(size_t size) : p(new T[size]) { } - ~AutoArray() { delete[] p; } - operator TPtr() { return p; } - AutoArray& operator=(TPtr t) { delete[] p; p = t; return *this; } -private: - AutoArray(const AutoArray&); - AutoArray& operator=(const AutoArray&); - - TPtr p; -}; - class Util { public: Modified: dcplusplus/trunk/dcpp/stdinc.h =================================================================== --- dcplusplus/trunk/dcpp/stdinc.h 2008-03-01 22:39:24 UTC (rev 1021) +++ dcplusplus/trunk/dcpp/stdinc.h 2008-03-01 23:16:58 UTC (rev 1022) @@ -120,6 +120,7 @@ #include <libintl.h> #include <boost/format.hpp> +#include <boost/scoped_array.hpp> #ifdef _STLPORT_VERSION Modified: dcplusplus/trunk/win32/PropPage.cpp =================================================================== --- dcplusplus/trunk/win32/PropPage.cpp 2008-03-01 22:39:24 UTC (rev 1021) +++ dcplusplus/trunk/win32/PropPage.cpp 2008-03-01 23:16:58 UTC (rev 1022) @@ -92,22 +92,24 @@ SettingsManager* settings = SettingsManager::getInstance(); - AutoArray<TCHAR> buf(SETTINGS_BUF_LEN); + tstring buf; for(Item const* i = items; i->type != T_END; i++) { switch(i->type) { case T_STR: { - ::GetDlgItemText(page, i->itemID, buf, SETTINGS_BUF_LEN); - settings->set((SettingsManager::StrSetting)i->setting, Text::fromT(tstring(buf))); + buf.resize(SETTINGS_BUF_LEN); + buf.resize(::GetDlgItemText(page, i->itemID, &buf[0], buf.size())); + settings->set((SettingsManager::StrSetting)i->setting, Text::fromT(buf)); break; } case T_INT: { - ::GetDlgItemText(page, i->itemID, buf, SETTINGS_BUF_LEN); - settings->set((SettingsManager::IntSetting)i->setting, Text::fromT(tstring(buf))); + buf.resize(SETTINGS_BUF_LEN); + buf.resize(::GetDlgItemText(page, i->itemID, &buf[0], buf.size())); + settings->set((SettingsManager::IntSetting)i->setting, Text::fromT(buf)); break; } case T_BOOL: @@ -120,7 +122,7 @@ } } - if(listItems != NULL) { + if(listItems) { int i; for(i = 0; listItems[i].setting != 0; i++) { settings->set(SettingsManager::IntSetting(listItems[i].setting), ListView_GetCheckState(list, i) > 0); Modified: dcplusplus/trunk/win32/WinUtil.cpp =================================================================== --- dcplusplus/trunk/win32/WinUtil.cpp 2008-03-01 22:39:24 UTC (rev 1021) +++ dcplusplus/trunk/win32/WinUtil.cpp 2008-03-01 23:16:58 UTC (rev 1022) @@ -904,9 +904,9 @@ STARTUPINFO si = { sizeof(si), 0 }; PROCESS_INFORMATION pi = { 0 }; - AutoArray<TCHAR> buf(cmdLine.length() + 1); - _tcscpy(buf, cmdLine.c_str()); - if(::CreateProcess(cmd.c_str(), buf, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) { + boost::scoped_ptr<TCHAR> buf(new TCHAR[cmdLine.length() + 1]); + _tcscpy(&buf[0], cmdLine.c_str()); + if(::CreateProcess(cmd.c_str(), &buf[0], NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) { ::CloseHandle(pi.hThread); ::CloseHandle(pi.hProcess); return; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |