← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2376: More consistent behavior in file lists for back / forward / up, and some buttons

 

------------------------------------------------------------
revno: 2376
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Mon 2011-01-03 21:11:13 +0100
message:
  More consistent behavior in file lists for back / forward / up, and some buttons
added:
  res/Up.ico
modified:
  changelog.txt
  dwt/src/widgets/Rebar.cpp
  dwt/src/widgets/ToolBar.cpp
  help/window_file_list.html
  miniupnpc/VERSION
  res/Left.ico
  res/Right.ico
  win32/DCPlusPlus.rc
  win32/DirectoryListingFrame.cpp
  win32/DirectoryListingFrame.h
  win32/MainWindow.cpp
  win32/MainWindow.h
  win32/WinUtil.cpp
  win32/WinUtil.h
  win32/resource.h


--
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 'changelog.txt'
--- changelog.txt	2010-12-27 16:15:36 +0000
+++ changelog.txt	2011-01-03 20:11:13 +0000
@@ -60,9 +60,10 @@
 * Display full country names rather than abbreviations (poy)
 * Select a better default font (poy)
 * [L#681754] Fonts and dialogs respect DPI settings - mark DC++ as DPI aware (poy)
-* Update MiniUPnPc (poy)
+* Update MiniUPnPc to version 1.5 (poy)
 * Ameliorate the MiniUPnPc device selection
 * Prevent an endless loop on connection failure (thanks bigmuscle)
+* More consistent behavior in file lists for back / forward / up, and some buttons (poy)
 
 -- 0.770 2010-07-05 --
 * [L#550300] Catch more potential file corruptions (thanks bigmuscle)

=== modified file 'dwt/src/widgets/Rebar.cpp'
--- dwt/src/widgets/Rebar.cpp	2011-01-02 17:12:02 +0000
+++ dwt/src/widgets/Rebar.cpp	2011-01-03 20:11:13 +0000
@@ -58,6 +58,8 @@
 	if(size() == 0)
 		setVisible(true);
 
+	w->addRemoveStyle(CCS_NORESIZE, true);
+
 	REBARBANDINFO info = { sizeof(REBARBANDINFO), RBBIM_CHILD | RBBIM_CHILDSIZE };
 
 	if(!text.empty()) {

=== modified file 'dwt/src/widgets/ToolBar.cpp'
--- dwt/src/widgets/ToolBar.cpp	2011-01-02 17:12:02 +0000
+++ dwt/src/widgets/ToolBar.cpp	2011-01-03 20:11:13 +0000
@@ -31,14 +31,12 @@
 
 #include <dwt/widgets/ToolBar.h>
 
-#include <dwt/util/win32/ApiHelpers.h>
-
 namespace dwt {
 
 const TCHAR ToolBar::windowClass[] = TOOLBARCLASSNAME;
 
 ToolBar::Seed::Seed() :
-BaseType::Seed(WS_CHILD | CCS_ADJUSTABLE | CCS_NODIVIDER | CCS_NORESIZE | TBSTYLE_FLAT | TBSTYLE_LIST | TBSTYLE_TOOLTIPS)
+BaseType::Seed(WS_CHILD | CCS_ADJUSTABLE | CCS_NODIVIDER | TBSTYLE_FLAT | TBSTYLE_LIST | TBSTYLE_TOOLTIPS)
 {
 }
 

=== modified file 'help/window_file_list.html'
--- help/window_file_list.html	2010-12-22 16:40:11 +0000
+++ help/window_file_list.html	2011-01-03 20:11:13 +0000
@@ -14,6 +14,15 @@
 <p cshelp="IDH_FILE_LIST_DIRS">
 Folders available in the current file list. Left-click on a folder to show the contents of that folder in the window on the right; right-click to open a menu that allows you to download the whole folder.
 </p>
+<h3>Toolbar</h3>
+<dl style="margin-left: 40px;">
+	<dt><img src="Left.ico" width="16" height="16" alt="Back"/> Back</dt>
+	<dd cshelp="IDH_FILE_LIST_BACK">Switch to the previously visited directory. This command can also be accessed via the Backspace key and the Ctrl+Left keyboard shortcut.</dd>
+	<dt><img src="Right.ico" width="16" height="16" alt="Forward"/> Forward</dt>
+	<dd cshelp="IDH_FILE_LIST_FORWARD">Switch to the next visited directory. This command can also be accessed via the Ctrl+Right keyboard shortcut.</dd>
+	<dt><img src="Up.ico" width="16" height="16" alt="Up one level"/> Up one level</dt>
+	<dd cshelp="IDH_FILE_LIST_UP">Switch to the parent directory. This command can also be accessed via the Ctrl+Up keyboard shortcut.</dd>
+</dl>
 <h2>Contents (right)</h2>
 <p cshelp="IDH_FILE_LIST_FILES">
 Shows the contents of the folder selected in the folder list (window on the left). Right-click to get menu options.

=== modified file 'miniupnpc/VERSION'
--- miniupnpc/VERSION	2010-12-12 21:16:33 +0000
+++ miniupnpc/VERSION	2011-01-03 20:11:13 +0000
@@ -1,1 +1,1 @@
-1.4
+1.5

=== modified file 'res/Left.ico'
Binary files res/Left.ico	2010-12-20 17:19:41 +0000 and res/Left.ico	2011-01-03 20:11:13 +0000 differ
=== modified file 'res/Right.ico'
Binary files res/Right.ico	2010-12-20 17:19:41 +0000 and res/Right.ico	2011-01-03 20:11:13 +0000 differ
=== added file 'res/Up.ico'
Binary files res/Up.ico	1970-01-01 00:00:00 +0000 and res/Up.ico	2011-01-03 20:11:13 +0000 differ
=== modified file 'win32/DCPlusPlus.rc'
--- win32/DCPlusPlus.rc	2011-01-02 17:12:02 +0000
+++ win32/DCPlusPlus.rc	2011-01-03 20:11:13 +0000
@@ -98,6 +98,7 @@
 IDI_USER_NOCON          ICON                    "res/UserNoCon.ico"
 IDI_USER_NOSLOT         ICON                    "res/UserNoSlot.ico"
 IDI_USER_OP             ICON                    "res/UserOp.ico"
+IDI_UP                  ICON                    "res/Up.ico"
 
 /////////////////////////////////////////////////////////////////////////////
 //

=== modified file 'win32/DirectoryListingFrame.cpp'
--- win32/DirectoryListingFrame.cpp	2011-01-02 19:52:46 +0000
+++ win32/DirectoryListingFrame.cpp	2011-01-03 20:11:13 +0000
@@ -35,6 +35,8 @@
 #include <dcpp/ShareManager.h>
 #include <dcpp/WindowInfo.h>
 
+#include <dwt/widgets/ToolBar.h>
+
 const string DirectoryListingFrame::id = "DirectoryListing";
 const string& DirectoryListingFrame::getId() const { return id; }
 
@@ -191,16 +193,47 @@
 	grid->row(0).align = GridInfo::STRETCH;
 	grid->row(1).size = 0;
 	grid->row(1).mode = GridInfo::STATIC;
+	grid->setSpacing(0);
 
 	VSplitterPtr paned = grid->addChild(VSplitter::Seed(0.3));
 
 	{
-		dirs = grid->addChild(WidgetDirs::Seed());
+		// create a container that will hold both the toolbar and the dir tree.
+		ContainerPtr container = grid->addChild(Container::Seed(0, WS_EX_CONTROLPARENT));
+
+		auto seed = ToolBar::Seed();
+		seed.style &= ~CCS_ADJUSTABLE;
+		ToolBarPtr toolbar = container->addChild(seed);
+
+		StringList ids;
+		auto addButton = [toolbar, &ids](unsigned icon, const tstring& text, unsigned helpId, const dwt::Dispatchers::VoidVoid<>::F& f) {
+			ids.push_back(string(1, '0' + ids.size()));
+			toolbar->addButton(ids.back(), WinUtil::toolbarIcon(icon), 0, text, helpId, f);
+		};
+		addButton(IDI_LEFT, T_("Back"), IDH_FILE_LIST_BACK, [this] { back(); });
+		addButton(IDI_RIGHT, T_("Forward"), IDH_FILE_LIST_FORWARD, [this] { this->forward(); }); // explicit ns (vs std::forward)
+		ids.push_back(string());
+		addButton(IDI_UP, T_("Up one level"), IDH_FILE_LIST_UP, [this] { up(); });
+		toolbar->setLayout(ids);
+
+		dirs = container->addChild(WidgetDirs::Seed());
 		dirs->setHelpId(IDH_FILE_LIST_DIRS);
 		addWidget(dirs);
-		paned->setFirst(dirs);
+
+		container->onSized([this, toolbar](const dwt::SizedEvent& e) {
+			dwt::Rectangle r(e.size);
+			toolbar->refresh();
+			dwt::Point pt = toolbar->getWindowSize();
+			r.pos.y += pt.y;
+			r.size.y -= pt.y;
+			dirs->layout(r);
+		});
+		paned->setFirst(container);
+
 		dirs->setNormalImageList(WinUtil::fileImages);
 		dirs->onSelectionChanged(std::bind(&DirectoryListingFrame::handleSelectionChanged, this));
+		dirs->onKeyDown(std::bind(&DirectoryListingFrame::handleKeyDownDirs, this, _1));
+		dirs->onSysKeyDown(std::bind(&DirectoryListingFrame::handleKeyDownDirs, this, _1));
 		dirs->onContextMenu(std::bind(&DirectoryListingFrame::handleDirsContextMenu, this, _1));
 		dirs->onXMouseUp(std::bind(&DirectoryListingFrame::handleXMouseUp, this, _1));
 	}
@@ -1068,19 +1101,32 @@
 	return true;
 }
 
+bool DirectoryListingFrame::handleKeyDownDirs(int c) {
+	switch(c) {
+	case VK_BACK: { back(); return true; }
+	case VK_LEFT:
+		{
+			if(isControlPressed()) { back(); return true; }
+			break;
+		}
+	case VK_RIGHT:
+		{
+			if(isControlPressed()) { forward(); return true; }
+			break;
+		}
+	case VK_UP:
+		{
+			if(isControlPressed()) { up(); return true; }
+			break;
+		}
+	}
+	return false;
+}
+
 bool DirectoryListingFrame::handleKeyDownFiles(int c) {
-	if(c == VK_BACK) {
-		up();
-		return true;
-	}
-	if(c == VK_LEFT && isControlPressed()) {
-		back();
-		return true;
-	}
-	if(c == VK_RIGHT && isControlPressed()) {
-		forward();
-		return true;
-	}
+	if(handleKeyDownDirs(c))
+		return true;
+
 	if(c == VK_RETURN) {
 		if(files->countSelected() == 1) {
 			ItemInfo* ii = files->getSelectedData();
@@ -1101,6 +1147,7 @@
 		}
 		return true;
 	}
+
 	return false;
 }
 

=== modified file 'win32/DirectoryListingFrame.h'
--- win32/DirectoryListingFrame.h	2011-01-02 17:12:02 +0000
+++ win32/DirectoryListingFrame.h	2011-01-03 20:11:13 +0000
@@ -227,6 +227,7 @@
 	void handleDownloadTarget(unsigned index);
 	void handleDownloadFavorite(unsigned index);
 	void handleDownloadBrowse();
+	bool handleKeyDownDirs(int c);
 	bool handleKeyDownFiles(int c);
 
 	void handleDoubleClickFiles();

=== modified file 'win32/MainWindow.cpp'
--- win32/MainWindow.cpp	2011-01-02 17:12:02 +0000
+++ win32/MainWindow.cpp	2011-01-03 20:11:13 +0000
@@ -349,43 +349,43 @@
 	dcdebug("initToolbar\n");
 	toolbar = addChild(ToolBar::Seed());
 
-	toolbar->addButton(PublicHubsFrame::id, toolbarIcon(IDI_PUBLICHUBS), 0, T_("Public Hubs"), IDH_TOOLBAR_PUBLIC_HUBS,
+	toolbar->addButton(PublicHubsFrame::id, WinUtil::toolbarIcon(IDI_PUBLICHUBS), 0, T_("Public Hubs"), IDH_TOOLBAR_PUBLIC_HUBS,
 		[this] { PublicHubsFrame::openWindow(getTabView()); });
-	toolbar->addButton("Reconnect", toolbarIcon(IDI_RECONNECT), 0, T_("Reconnect"), IDH_TOOLBAR_RECONNECT,
+	toolbar->addButton("Reconnect", WinUtil::toolbarIcon(IDI_RECONNECT), 0, T_("Reconnect"), IDH_TOOLBAR_RECONNECT,
 		std::bind(&MainWindow::handleReconnect, this));
-	toolbar->addButton("Redirect", toolbarIcon(IDI_FOLLOW), 0, T_("Follow last redirect"), IDH_TOOLBAR_FOLLOW,
+	toolbar->addButton("Redirect", WinUtil::toolbarIcon(IDI_FOLLOW), 0, T_("Follow last redirect"), IDH_TOOLBAR_FOLLOW,
 		std::bind(&MainWindow::handleRedirect, this));
-	toolbar->addButton(FavHubsFrame::id, toolbarIcon(IDI_FAVORITE_HUBS), 0, T_("Favorite Hubs"), IDH_TOOLBAR_FAVORITE_HUBS,
+	toolbar->addButton(FavHubsFrame::id, WinUtil::toolbarIcon(IDI_FAVORITE_HUBS), 0, T_("Favorite Hubs"), IDH_TOOLBAR_FAVORITE_HUBS,
 		[this] { FavHubsFrame::openWindow(getTabView()); }, std::bind(&MainWindow::handleFavHubsDropDown, this, _1));
-	toolbar->addButton(UsersFrame::id, toolbarIcon(IDI_FAVORITE_USERS), 0, T_("Favorite Users"), IDH_TOOLBAR_FAVORITE_USERS,
+	toolbar->addButton(UsersFrame::id, WinUtil::toolbarIcon(IDI_FAVORITE_USERS), 0, T_("Favorite Users"), IDH_TOOLBAR_FAVORITE_USERS,
 		[this] { UsersFrame::openWindow(getTabView()); });
-	toolbar->addButton(QueueFrame::id, toolbarIcon(IDI_QUEUE), 0, T_("Download Queue"), IDH_TOOLBAR_QUEUE,
+	toolbar->addButton(QueueFrame::id, WinUtil::toolbarIcon(IDI_QUEUE), 0, T_("Download Queue"), IDH_TOOLBAR_QUEUE,
 		[this] { QueueFrame::openWindow(getTabView()); });
-	toolbar->addButton(FinishedDLFrame::id, toolbarIcon(IDI_FINISHED_DL), 0, T_("Finished Downloads"), IDH_TOOLBAR_FINISHED_DL,
+	toolbar->addButton(FinishedDLFrame::id, WinUtil::toolbarIcon(IDI_FINISHED_DL), 0, T_("Finished Downloads"), IDH_TOOLBAR_FINISHED_DL,
 		[this] { FinishedDLFrame::openWindow(getTabView()); });
-	toolbar->addButton(WaitingUsersFrame::id, toolbarIcon(IDI_WAITING_USERS), 0, T_("Waiting Users"), IDH_TOOLBAR_WAITING_USERS,
+	toolbar->addButton(WaitingUsersFrame::id, WinUtil::toolbarIcon(IDI_WAITING_USERS), 0, T_("Waiting Users"), IDH_TOOLBAR_WAITING_USERS,
 		[this] { WaitingUsersFrame::openWindow(getTabView()); });
-	toolbar->addButton(FinishedULFrame::id, toolbarIcon(IDI_FINISHED_UL), 0, T_("Finished Uploads"), IDH_TOOLBAR_FINISHED_UL,
+	toolbar->addButton(FinishedULFrame::id, WinUtil::toolbarIcon(IDI_FINISHED_UL), 0, T_("Finished Uploads"), IDH_TOOLBAR_FINISHED_UL,
 		[this] { FinishedULFrame::openWindow(getTabView()); });
-	toolbar->addButton(SearchFrame::id, toolbarIcon(IDI_SEARCH), 0, T_("Search"), IDH_TOOLBAR_SEARCH,
+	toolbar->addButton(SearchFrame::id, WinUtil::toolbarIcon(IDI_SEARCH), 0, T_("Search"), IDH_TOOLBAR_SEARCH,
 		[this] { SearchFrame::openWindow(getTabView()); });
-	toolbar->addButton(ADLSearchFrame::id, toolbarIcon(IDI_ADLSEARCH), 0, T_("ADL Search"), IDH_TOOLBAR_ADL_SEARCH,
+	toolbar->addButton(ADLSearchFrame::id, WinUtil::toolbarIcon(IDI_ADLSEARCH), 0, T_("ADL Search"), IDH_TOOLBAR_ADL_SEARCH,
 		[this] { ADLSearchFrame::openWindow(getTabView()); });
-	toolbar->addButton(SpyFrame::id, toolbarIcon(IDI_SPY), 0, T_("Search Spy"), IDH_TOOLBAR_SEARCH_SPY,
+	toolbar->addButton(SpyFrame::id, WinUtil::toolbarIcon(IDI_SPY), 0, T_("Search Spy"), IDH_TOOLBAR_SEARCH_SPY,
 		[this] { SpyFrame::openWindow(getTabView()); });
-	toolbar->addButton(StatsFrame::id, toolbarIcon(IDI_NET_STATS), 0, T_("Network Statistics"), IDH_TOOLBAR_NET_STATS,
+	toolbar->addButton(StatsFrame::id, WinUtil::toolbarIcon(IDI_NET_STATS), 0, T_("Network Statistics"), IDH_TOOLBAR_NET_STATS,
 		[this] { StatsFrame::openWindow(getTabView()); });
-	toolbar->addButton("OpenFL", toolbarIcon(IDI_OPEN_FILE_LIST), 0, T_("Open file list..."), IDH_TOOLBAR_FILE_LIST,
+	toolbar->addButton("OpenFL", WinUtil::toolbarIcon(IDI_OPEN_FILE_LIST), 0, T_("Open file list..."), IDH_TOOLBAR_FILE_LIST,
 		std::bind(&MainWindow::handleOpenFileList, this));
-	toolbar->addButton("Recents", toolbarIcon(IDI_RECENTS), 0, T_("Recent windows"), IDH_TOOLBAR_RECENT,
+	toolbar->addButton("Recents", WinUtil::toolbarIcon(IDI_RECENTS), 0, T_("Recent windows"), IDH_TOOLBAR_RECENT,
 		0, std::bind(&MainWindow::handleRecent, this, _1));
-	toolbar->addButton("Settings", toolbarIcon(IDI_SETTINGS), 0, T_("Settings"), IDH_TOOLBAR_SETTINGS,
+	toolbar->addButton("Settings", WinUtil::toolbarIcon(IDI_SETTINGS), 0, T_("Settings"), IDH_TOOLBAR_SETTINGS,
 		std::bind(&MainWindow::handleSettings, this));
-	toolbar->addButton(NotepadFrame::id, toolbarIcon(IDI_NOTEPAD), 0, T_("Notepad"), IDH_TOOLBAR_NOTEPAD,
+	toolbar->addButton(NotepadFrame::id, WinUtil::toolbarIcon(IDI_NOTEPAD), 0, T_("Notepad"), IDH_TOOLBAR_NOTEPAD,
 		[this] { NotepadFrame::openWindow(getTabView()); });
-	toolbar->addButton("Refresh", toolbarIcon(IDI_REFRESH), 0, T_("Refresh file list"), IDH_TOOLBAR_REFRESH,
+	toolbar->addButton("Refresh", WinUtil::toolbarIcon(IDI_REFRESH), 0, T_("Refresh file list"), IDH_TOOLBAR_REFRESH,
 		std::bind(&MainWindow::handleRefreshFileList, this));
-	toolbar->addButton("CSHelp", toolbarIcon(IDI_WHATS_THIS), 0, T_("What's This?"), IDH_TOOLBAR_WHATS_THIS,
+	toolbar->addButton("CSHelp", WinUtil::toolbarIcon(IDI_WHATS_THIS), 0, T_("What's This?"), IDH_TOOLBAR_WHATS_THIS,
 		std::bind(&MainWindow::handleWhatsThis, this));
 
 	if(SettingsManager::getInstance()->isDefault(SettingsManager::TOOLBAR)) {
@@ -783,10 +783,6 @@
 	return false;
 }
 
-dwt::IconPtr MainWindow::toolbarIcon(unsigned id) const {
-	return WinUtil::createIcon(id, SETTING(TOOLBAR_SIZE));
-}
-
 void MainWindow::setSaveTimer() {
 	setTimer([this]() -> bool { saveSettings(); return true; }, SETTING(SETTINGS_SAVE_INTERVAL) * 60 * 1000, TIMER_SAVE);
 }

=== modified file 'win32/MainWindow.h'
--- win32/MainWindow.h	2011-01-02 17:12:02 +0000
+++ win32/MainWindow.h	2011-01-03 20:11:13 +0000
@@ -197,7 +197,6 @@
 	void parseCommandLine(const tstring& line);
 	bool chooseFavHubGroup(const tstring& title, tstring& group);
 	void statusMessage(time_t t, const string& m);
-	dwt::IconPtr toolbarIcon(unsigned id) const;
 
 	bool filter(MSG& msg);
 

=== modified file 'win32/WinUtil.cpp'
--- win32/WinUtil.cpp	2011-01-02 17:12:02 +0000
+++ win32/WinUtil.cpp	2011-01-03 20:11:13 +0000
@@ -1383,6 +1383,10 @@
 	return new dwt::Icon(id, dwt::Point(size, size));
 }
 
+dwt::IconPtr WinUtil::toolbarIcon(unsigned id) {
+	return createIcon(id, SETTING(TOOLBAR_SIZE));
+}
+
 #ifdef PORT_ME
 
 double WinUtil::toBytes(TCHAR* aSize) {

=== modified file 'win32/WinUtil.h'
--- win32/WinUtil.h	2011-01-02 17:12:02 +0000
+++ win32/WinUtil.h	2011-01-03 20:11:13 +0000
@@ -239,6 +239,7 @@
 	static inline dwt::IconPtr menuIcon(unsigned id) { return createIcon(id, 16); }
 	static inline dwt::IconPtr statusIcon(unsigned id) { return createIcon(id, 16); }
 	static inline dwt::IconPtr tabIcon(unsigned id) { return createIcon(id, 16); }
+	static dwt::IconPtr toolbarIcon(unsigned id);
 
 #ifdef PORT_ME
 	static double toBytes(TCHAR* aSize);

=== modified file 'win32/resource.h'
--- win32/resource.h	2011-01-02 17:03:43 +0000
+++ win32/resource.h	2011-01-03 20:11:13 +0000
@@ -57,6 +57,7 @@
 #define IDI_USER_NOCON 149
 #define IDI_USER_NOSLOT 150
 #define IDI_USER_OP 151
+#define IDI_UP 152
 
 #define IDB_FOLDERS 200