|
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)"
-...
[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->getPar...
[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;
+}
+
...
[truncated message content] |
|
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
+...
[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 create...
[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);
retu...
[truncated message content] |
|
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.
|