← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2503: less packed settings tree

 

------------------------------------------------------------
revno: 2503
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Wed 2011-04-20 18:35:03 +0200
message:
  less packed settings tree
modified:
  changelog.txt
  dwt/include/dwt/widgets/Tree.h
  dwt/src/widgets/Tree.cpp
  win32/SettingsDialog.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 'changelog.txt'
--- changelog.txt	2011-04-19 20:04:13 +0000
+++ changelog.txt	2011-04-20 16:35:03 +0000
@@ -21,7 +21,7 @@
 * Fix focus problems in dialogs (poy)
 * Fix Ctrl+W / Ctrl+F4 sometimes closing the wrong tab (poy)
 * [L#604983] Fix transfers dying on setting upload/download throttle to 0 (cologic)
-* [L#702498] Menus to adjust the bw limit from the tray menu & status bar (poy, iceman50)
+* [L#591626] Menus to adjust the bw limit from the tray menu & status bar (poy, iceman50)
 * Increase the max bandwidth limit from 32 MiB/s to 1 GiB/s
 * More icons
 

=== modified file 'dwt/include/dwt/widgets/Tree.h'
--- dwt/include/dwt/widgets/Tree.h	2011-04-16 15:22:56 +0000
+++ dwt/include/dwt/widgets/Tree.h	2011-04-20 16:35:03 +0000
@@ -161,6 +161,9 @@
 	HTREEITEM getFirst();
 	HTREEITEM getLast();
 
+	int getItemHeight();
+	void setItemHeight(int h);
+
 	ScreenCoordinate getContextMenuPos();
 
 	bool isExpanded(HTREEITEM node);

=== modified file 'dwt/src/widgets/Tree.cpp'
--- dwt/src/widgets/Tree.cpp	2011-04-16 14:19:18 +0000
+++ dwt/src/widgets/Tree.cpp	2011-04-20 16:35:03 +0000
@@ -36,7 +36,7 @@
 const TCHAR Tree::windowClass[] = WC_TREEVIEW;
 
 Tree::Seed::Seed() :
-	BaseType::Seed(WS_CHILD | WS_TABSTOP | TVS_DISABLEDRAGDROP | TVS_HASLINES | TVS_SHOWSELALWAYS),
+	BaseType::Seed(WS_CHILD | WS_TABSTOP | TVS_DISABLEDRAGDROP | TVS_HASLINES | TVS_NONEVENHEIGHT | TVS_SHOWSELALWAYS),
 	font(new Font(DefaultGuiFont))
 {
 }
@@ -139,6 +139,14 @@
 	TreeView_SetItem(handle(), &tvitem);
 }
 
+int Tree::getItemHeight() {
+	return TreeView_GetItemHeight(handle());
+}
+
+void Tree::setItemHeight(int h) {
+	TreeView_SetItemHeight(handle(), h);
+}
+
 ScreenCoordinate Tree::getContextMenuPos() {
 	HTREEITEM item = getSelected();
 	POINT pt = { 0 };

=== modified file 'win32/SettingsDialog.cpp'
--- win32/SettingsDialog.cpp	2011-04-19 20:04:13 +0000
+++ win32/SettingsDialog.cpp	2011-04-20 16:35:03 +0000
@@ -117,6 +117,7 @@
 			seed.style |= WS_BORDER;
 			tree = cur->addChild(seed);
 			tree->setHelpId(IDH_SETTINGS_TREE);
+			tree->setItemHeight(tree->getItemHeight() * 5 / 4);
 			tree->onSelectionChanged([this] { handleSelectionChanged(); });
 		}
 
@@ -131,12 +132,17 @@
 			auto index = pages.size();
 			images->add(dwt::Icon(icon, size));
 			page->onVisibilityChanged([=](bool b) { if(b) {
-				setSmallIcon(WinUtil::createIcon(icon, 16));
-				setLargeIcon(WinUtil::createIcon(icon, 32));
+#ifdef __GNUC__ // MSVC doesn't like the explicit "this"...
+#define GCC_WTF2(x) this->x
+#else
+#define GCC_WTF2(x) x
+#endif
+				GCC_WTF2(setSmallIcon(WinUtil::createIcon(icon, 16)));
+				GCC_WTF2(setLargeIcon(WinUtil::createIcon(icon, 32)));
 			} });
 			auto ret = tree->insert(title, parent, reinterpret_cast<LPARAM>(page), true, index);
 			if(index == setting)
-				GCC_WTF->callAsync([=] { tree->setSelected(ret); });
+				GCC_WTF->callAsync([=] { tree->setSelected(ret); tree->ensureVisible(ret); });
 			pages.push_back(page);
 			return ret;
 		};