linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #03693
[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2460: fix activation from the recent windows menu
------------------------------------------------------------
revno: 2460
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Fri 2011-03-18 16:07:59 +0100
message:
fix activation from the recent windows menu
modified:
dcpp/WindowManager.cpp
dwt/include/dwt/GCCHeaders.h
win32/DirectoryListingFrame.cpp
win32/MainWindow.cpp
--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk
Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'dcpp/WindowManager.cpp'
--- dcpp/WindowManager.cpp 2011-03-16 18:23:54 +0000
+++ dcpp/WindowManager.cpp 2011-03-18 15:07:59 +0000
@@ -152,7 +152,7 @@
ClientManager::getInstance()->saveUser(CID(i->second));
i = wi->getParams().find(WindowInfo::fileList);
- if(i != wi->getParams().end() && !i->second.content.empty())
+ if(i != wi->getParams().end() && !i->second.empty())
QueueManager::getInstance()->noDeleteFileList(i->second);
}
}
@@ -189,7 +189,7 @@
if(!info.getParams().empty()) {
xml.stepIn();
for(auto i = info.getParams().cbegin(), iend = info.getParams().cend(); i != iend; ++i) {
- xml.addTag("Param", i->second.content);
+ xml.addTag("Param", i->second);
xml.addChildAttrib("Id", i->first);
if(!i->second.identifies)
xml.addChildAttrib("Opt", true);
=== modified file 'dwt/include/dwt/GCCHeaders.h'
--- dwt/include/dwt/GCCHeaders.h 2011-03-08 22:48:55 +0000
+++ dwt/include/dwt/GCCHeaders.h 2011-03-18 15:07:59 +0000
@@ -60,10 +60,18 @@
#define BUTTON_IMAGELIST_ALIGN_CENTER 4 // Doesn't draw text
#endif
+#ifndef COLOR_MENUHILIGHT
#define COLOR_MENUHILIGHT 29
+#endif
+#ifndef COLOR_MENUBAR
#define COLOR_MENUBAR 30
+#endif
+#ifndef ODS_HOTLIGHT
#define ODS_HOTLIGHT 0x0040
+#endif
+#ifndef ODS_INACTIVE
#define ODS_INACTIVE 0x0080
+#endif
#ifndef MN_GETHMENU
#define MN_GETHMENU 0x01E1
#endif
@@ -135,7 +143,6 @@
#endif // !_WIN64
#endif // !GetWindowLongPtr
-// these should be defined in CommCtrl.h, but the one in MinGW doesn't define them... (2007-11-06)
#if (_WIN32_WINNT >= 0x0501)
#ifndef HDF_SORTUP
#define HDF_SORTUP 0x0400
@@ -257,9 +264,15 @@
#define LPNMLVCUSTOMDRAW LPNMLVCUSTOMDRAW_
// dwItemType
+#ifndef LVCDI_ITEM
#define LVCDI_ITEM 0x00000000
+#endif
+#ifndef LVCDI_GROUP
#define LVCDI_GROUP 0x00000001
+#endif
+#ifndef LVCDI_ITEMSLIST
#define LVCDI_ITEMSLIST 0x00000002
+#endif
#ifndef LVHT_EX_GROUP
#define LVHT_EX_GROUP_HEADER 0x10000000
=== modified file 'win32/DirectoryListingFrame.cpp'
--- win32/DirectoryListingFrame.cpp 2011-03-16 18:35:03 +0000
+++ win32/DirectoryListingFrame.cpp 2011-03-18 15:07:59 +0000
@@ -403,8 +403,6 @@
}
void DirectoryListingFrame::postClosing() {
- updateRecent();
-
clearList();
SettingsManager::getInstance()->set(SettingsManager::DIRECTORYLISTINGFRAME_ORDER, WinUtil::toString(files->getColumnOrder()));
@@ -890,6 +888,8 @@
for(auto i = history.cbegin(), iend = history.cend(); i != iend; ++i)
pathBox->addValue(i->empty() ? getText() : Text::toT(*i));
pathBox->setSelected(historyIndex - 1);
+
+ updateRecent();
}
void DirectoryListingFrame::changeDir(DirectoryListing::Directory* d) {
=== modified file 'win32/MainWindow.cpp'
--- win32/MainWindow.cpp 2011-03-16 18:23:54 +0000
+++ win32/MainWindow.cpp 2011-03-18 15:07:59 +0000
@@ -606,8 +606,12 @@
menu->open(pt);
}
+void addActiveParam(WindowParams& params) {
+ params["Active"] = WindowParam("1", false);
+}
+
template<typename T, typename configureF>
-static void addRecentMenu(const WindowManager::RecentList& recent, MenuPtr& menu, MainWindow* mainWindow,
+void addRecentMenu(const WindowManager::RecentList& recent, MenuPtr& menu, MainWindow* mainWindow,
const tstring& text, unsigned iconId, unsigned favIconId, configureF f)
{
MenuPtr popup = menu->appendPopup(text, WinUtil::menuIcon(iconId));
@@ -624,12 +628,14 @@
const auto& list = it->second;
for(auto i = list.cbegin(), iend = list.cend(); i != iend; ++i) {
- const auto& params = i->getParams();
+ auto params = i->getParams();
auto title = params.find("Title");
if(title == params.end() || title->second.empty())
continue;
+ addActiveParam(params);
+
popup->appendItem(escapeMenu(Text::toT(title->second)),
std::bind(&T::parseWindowParams, mainWindow->getTabView(), params),
T::isFavorite(params) ? favIcon : 0);
@@ -645,8 +651,7 @@
auto lock = wm->lock();
const auto& recent = wm->getRecent();
- typedef void (MainWindow::*configureF)(const string&, const tstring&);
- configureF f = &MainWindow::handleConfigureRecent;
+ auto f = &MainWindow::handleConfigureRecent;
addRecentMenu<HubFrame>(recent, menu, this, T_("Recent hubs"), IDI_HUB, IDI_FAVORITE_HUBS, f);
addRecentMenu<PrivateFrame>(recent, menu, this, T_("Recent PMs"), IDI_PRIVATE, IDI_FAVORITE_USERS, f);
addRecentMenu<DirectoryListingFrame>(recent, menu, this, T_("Recent file lists"), IDI_DIRECTORY, IDI_FAVORITE_USERS, f);
@@ -804,7 +809,7 @@
auto child = static_cast<MDIChildFrame<dwt::Container>*>(*i);
auto params = child->getWindowParams();
if(child == active)
- params["Active"] = WindowParam("1", false);
+ addActiveParam(params);
wm->add(child->getId(), params);
}
}