← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2502: add icons in settings

 

------------------------------------------------------------
revno: 2502
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Tue 2011-04-19 22:04:13 +0200
message:
  add icons in settings
added:
  res/Advanced.ico
  res/Clock.ico
  res/Colors.ico
  res/ConnBlue.ico
  res/ConnGrey.ico
  res/ConnRed.ico
  res/Expert.ico
  res/FavoriteDirs.ico
  res/Logs.ico
  res/Notifications.ico
  res/Proxy.ico
  res/Tabs.ico
  res/Windows.ico
modified:
  changelog.txt
  dwt/include/dwt/widgets/Frame.h
  win32/DCPlusPlus.rc
  win32/SettingsDialog.cpp
  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	2011-04-18 18:41:36 +0000
+++ changelog.txt	2011-04-19 20:04:13 +0000
@@ -23,6 +23,7 @@
 * [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)
 * Increase the max bandwidth limit from 32 MiB/s to 1 GiB/s
+* More icons
 
 -- 0.782 2011-03-05 --
 * Prevent a remote crash triggered via malformed user commands (poy)

=== modified file 'dwt/include/dwt/widgets/Frame.h'
--- dwt/include/dwt/widgets/Frame.h	2011-04-15 21:51:55 +0000
+++ dwt/include/dwt/widgets/Frame.h	2011-04-19 20:04:13 +0000
@@ -88,10 +88,10 @@
 	void setMaximizeBox( bool value = true );
 
 	/// Sets the small icon for the Widget (the small icon appears typically in the top left corner of the Widget)
-	void setIconSmall( const IconPtr& icon );
+	void setSmallIcon(const IconPtr& icon);
 
 	/// Sets the large icon for the Widget (the large icon appears e.g. when you press ALT+Tab)
-	void setIconLarge( const IconPtr& icon );
+	void setLargeIcon(const IconPtr& icon);
 
 protected:
 	struct Seed : public BaseType::Seed {
@@ -105,6 +105,10 @@
 	// directly
 	virtual ~Frame()
 	{}
+
+private:
+	IconPtr smallIcon;
+	IconPtr largeIcon;
 };
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -149,19 +153,20 @@
 	Widget::addRemoveStyle( WS_MAXIMIZEBOX, value );
 }
 
-inline void Frame::setIconSmall( const IconPtr& icon )
-{
-	sendMessage(WM_SETICON, ICON_SMALL, reinterpret_cast< LPARAM >( icon->handle() ) );
-}
-
-
-inline void Frame::setIconLarge( const IconPtr& icon )
-{
-	sendMessage(WM_SETICON, ICON_BIG, reinterpret_cast< LPARAM >( icon->handle() ) );
-}
-
-inline Frame::Frame(Widget * parent, Dispatcher& dispatcher)
-	: Composite(parent, dispatcher)
+inline void Frame::setSmallIcon(const IconPtr& icon) {
+	smallIcon = icon;
+	sendMessage(WM_SETICON, ICON_SMALL, reinterpret_cast<LPARAM>(smallIcon->handle()));
+}
+
+inline void Frame::setLargeIcon(const IconPtr& icon) {
+	largeIcon = icon;
+	sendMessage(WM_SETICON, ICON_BIG, reinterpret_cast<LPARAM>(largeIcon->handle()));
+}
+
+inline Frame::Frame(Widget * parent, Dispatcher& dispatcher) :
+Composite(parent, dispatcher),
+smallIcon(0),
+largeIcon(0)
 {
 }
 

=== added file 'res/Advanced.ico'
Binary files res/Advanced.ico	1970-01-01 00:00:00 +0000 and res/Advanced.ico	2011-04-19 20:04:13 +0000 differ
=== added file 'res/Clock.ico'
Binary files res/Clock.ico	1970-01-01 00:00:00 +0000 and res/Clock.ico	2011-04-19 20:04:13 +0000 differ
=== added file 'res/Colors.ico'
Binary files res/Colors.ico	1970-01-01 00:00:00 +0000 and res/Colors.ico	2011-04-19 20:04:13 +0000 differ
=== added file 'res/ConnBlue.ico'
Binary files res/ConnBlue.ico	1970-01-01 00:00:00 +0000 and res/ConnBlue.ico	2011-04-19 20:04:13 +0000 differ
=== added file 'res/ConnGrey.ico'
Binary files res/ConnGrey.ico	1970-01-01 00:00:00 +0000 and res/ConnGrey.ico	2011-04-19 20:04:13 +0000 differ
=== added file 'res/ConnRed.ico'
Binary files res/ConnRed.ico	1970-01-01 00:00:00 +0000 and res/ConnRed.ico	2011-04-19 20:04:13 +0000 differ
=== added file 'res/Expert.ico'
Binary files res/Expert.ico	1970-01-01 00:00:00 +0000 and res/Expert.ico	2011-04-19 20:04:13 +0000 differ
=== added file 'res/FavoriteDirs.ico'
Binary files res/FavoriteDirs.ico	1970-01-01 00:00:00 +0000 and res/FavoriteDirs.ico	2011-04-19 20:04:13 +0000 differ
=== added file 'res/Logs.ico'
Binary files res/Logs.ico	1970-01-01 00:00:00 +0000 and res/Logs.ico	2011-04-19 20:04:13 +0000 differ
=== added file 'res/Notifications.ico'
Binary files res/Notifications.ico	1970-01-01 00:00:00 +0000 and res/Notifications.ico	2011-04-19 20:04:13 +0000 differ
=== added file 'res/Proxy.ico'
Binary files res/Proxy.ico	1970-01-01 00:00:00 +0000 and res/Proxy.ico	2011-04-19 20:04:13 +0000 differ
=== added file 'res/Tabs.ico'
Binary files res/Tabs.ico	1970-01-01 00:00:00 +0000 and res/Tabs.ico	2011-04-19 20:04:13 +0000 differ
=== added file 'res/Windows.ico'
Binary files res/Windows.ico	1970-01-01 00:00:00 +0000 and res/Windows.ico	2011-04-19 20:04:13 +0000 differ
=== modified file 'win32/DCPlusPlus.rc'
--- win32/DCPlusPlus.rc	2011-03-23 22:05:13 +0000
+++ win32/DCPlusPlus.rc	2011-04-19 20:04:13 +0000
@@ -98,6 +98,19 @@
 IDI_GRANT_SLOT_ON       ICON                    "res/GrantSlotOn.ico"
 IDI_GRANT_SLOT_OFF      ICON                    "res/GrantSlotOff.ico"
 IDI_SLOTS_FULL          ICON                    "res/SlotsFull.ico"
+IDI_ADVANCED            ICON                    "res/Advanced.ico"
+IDI_CLOCK               ICON                    "res/Clock.ico"
+IDI_COLORS              ICON                    "res/Colors.ico"
+IDI_CONN_BLUE           ICON                    "res/ConnBlue.ico"
+IDI_CONN_GREY           ICON                    "res/ConnGrey.ico"
+IDI_CONN_RED            ICON                    "res/ConnRed.ico"
+IDI_EXPERT              ICON                    "res/Expert.ico"
+IDI_FAVORITE_DIRS       ICON                    "res/FavoriteDirs.ico"
+IDI_LOGS                ICON                    "res/Logs.ico"
+IDI_NOTIFICATIONS       ICON                    "res/Notifications.ico"
+IDI_PROXY               ICON                    "res/Proxy.ico"
+IDI_TABS                ICON                    "res/Tabs.ico"
+IDI_WINDOWS             ICON                    "res/Windows.ico"
 
 /////////////////////////////////////////////////////////////////////////////
 //

=== modified file 'win32/SettingsDialog.cpp'
--- win32/SettingsDialog.cpp	2011-04-19 16:19:49 +0000
+++ win32/SettingsDialog.cpp	2011-04-19 20:04:13 +0000
@@ -120,52 +120,62 @@
 			tree->onSelectionChanged([this] { handleSelectionChanged(); });
 		}
 
+		const dwt::Point size(16, 16);
+		dwt::ImageListPtr images(new dwt::ImageList(size));
+		tree->setNormalImageList(images);
+
 		auto container = cur->addChild(dwt::ScrolledContainer::Seed(WS_BORDER));
 
 		const size_t setting = SETTING(SETTINGS_PAGE);
-		auto addPage = [this, container, setting](const tstring& title, PropPage* page, HTREEITEM parent) -> HTREEITEM {
-			auto ret = tree->insert(title, parent, reinterpret_cast<LPARAM>(page), true);
-			if(pages.size() == setting)
+		auto addPage = [&](const tstring& title, PropPage* page, unsigned icon, HTREEITEM parent) -> HTREEITEM {
+			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));
+			} });
+			auto ret = tree->insert(title, parent, reinterpret_cast<LPARAM>(page), true, index);
+			if(index == setting)
 				GCC_WTF->callAsync([=] { tree->setSelected(ret); });
 			pages.push_back(page);
 			return ret;
 		};
 
-		addPage(T_("Personal information"), new GeneralPage(container), TVI_ROOT);
-
-		{
-			HTREEITEM item = addPage(T_("Connectivity"), new ConnectivityPage(container), TVI_ROOT);
-			addPage(T_("Manual configuration"), new ConnectivityManualPage(container), item);
-			addPage(T_("Bandwidth limiting"), new BandwidthLimitPage(container), item);
-			addPage(T_("Proxy"), new ProxyPage(container), item);
-		}
-
-		{
-			HTREEITEM item = addPage(T_("Downloads"), new DownloadPage(container), TVI_ROOT);
-			addPage(T_("Favorites"), new FavoriteDirsPage(container), item);
-			addPage(T_("Queue"), new QueuePage(container), item);
-		}
-
-		addPage(T_("Sharing"), new UploadPage(container), TVI_ROOT);
-
-		{
-			HTREEITEM item = addPage(T_("Appearance"), new AppearancePage(container), TVI_ROOT);
-			addPage(T_("Colors and sounds"), new Appearance2Page(container), item);
-			addPage(T_("Tabs"), new TabsPage(container), item);
-			addPage(T_("Windows"), new WindowsPage(container), item);
-		}
-
-		{
-			HTREEITEM item = addPage(T_("History"), new HistoryPage(container), TVI_ROOT);
-			addPage(T_("Logs"), new LogPage(container), item);
-		}
-
-		{
-			HTREEITEM item = addPage(T_("Advanced"), new AdvancedPage(container), TVI_ROOT);
-			addPage(T_("Experts only"), new ExpertsPage(container), item);
-			addPage(T_("User commands"), new UCPage(container), item);
-			addPage(T_("Security certificates"), new CertificatesPage(container), item);
-			addPage(T_("Search types"), new SearchTypesPage(container), item);
+		addPage(T_("Personal information"), new GeneralPage(container), IDI_USER, TVI_ROOT);
+
+		{
+			HTREEITEM item = addPage(T_("Connectivity"), new ConnectivityPage(container), IDI_CONN_RED, TVI_ROOT);
+			addPage(T_("Manual configuration"), new ConnectivityManualPage(container), IDI_CONN_GREY, item);
+			addPage(T_("Bandwidth limiting"), new BandwidthLimitPage(container), IDI_CONN_BLUE, item);
+			addPage(T_("Proxy"), new ProxyPage(container), IDI_PROXY, item);
+		}
+
+		{
+			HTREEITEM item = addPage(T_("Downloads"), new DownloadPage(container), IDI_DOWNLOAD, TVI_ROOT);
+			addPage(T_("Favorites"), new FavoriteDirsPage(container), IDI_FAVORITE_DIRS, item);
+			addPage(T_("Queue"), new QueuePage(container), IDI_QUEUE, item);
+		}
+
+		addPage(T_("Sharing"), new UploadPage(container), IDI_UPLOAD, TVI_ROOT);
+
+		{
+			HTREEITEM item = addPage(T_("Appearance"), new AppearancePage(container), IDI_DCPP, TVI_ROOT);
+			addPage(T_("Colors and sounds"), new Appearance2Page(container), IDI_COLORS, item);
+			addPage(T_("Tabs"), new TabsPage(container), IDI_TABS, item);
+			addPage(T_("Windows"), new WindowsPage(container), IDI_WINDOWS, item);
+		}
+
+		{
+			HTREEITEM item = addPage(T_("History"), new HistoryPage(container), IDI_CLOCK, TVI_ROOT);
+			addPage(T_("Logs"), new LogPage(container), IDI_LOGS, item);
+		}
+
+		{
+			HTREEITEM item = addPage(T_("Advanced"), new AdvancedPage(container), IDI_ADVANCED, TVI_ROOT);
+			addPage(T_("Experts only"), new ExpertsPage(container), IDI_EXPERT, item);
+			addPage(T_("User commands"), new UCPage(container), IDI_USER_OP, item);
+			addPage(T_("Security certificates"), new CertificatesPage(container), IDI_SECURE, item);
+			addPage(T_("Search types"), new SearchTypesPage(container), IDI_SEARCH, item);
 		}
 	}
 
@@ -259,12 +269,13 @@
 void SettingsDialog::handleSelectionChanged() {
 	PropPage* page = reinterpret_cast<PropPage*>(tree->getData(tree->getSelected()));
 	if(page) {
+		// move to the top of the Z order so the ScrolledContainer thinks this is the only child.
+		::SetWindowPos(page->handle(), HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOOWNERZORDER);
+		page->setVisible(true);
+
 		if(currentPage) {
 			currentPage->setVisible(false);
-			currentPage = 0;
 		}
-
-		::SetWindowPos(page->handle(), HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOOWNERZORDER | SWP_SHOWWINDOW);
 		currentPage = page;
 
 		updateTitle();

=== modified file 'win32/resource.h'
--- win32/resource.h	2011-03-23 20:26:21 +0000
+++ win32/resource.h	2011-04-19 20:04:13 +0000
@@ -64,6 +64,19 @@
 #define IDI_GRANT_SLOT_ON 157
 #define IDI_GRANT_SLOT_OFF 158
 #define IDI_SLOTS_FULL 159
+#define IDI_ADVANCED 160
+#define IDI_CLOCK 161
+#define IDI_COLORS 162
+#define IDI_CONN_BLUE 163
+#define IDI_CONN_GREY 164
+#define IDI_CONN_RED 165
+#define IDI_EXPERT 166
+#define IDI_FAVORITE_DIRS 167
+#define IDI_LOGS 168
+#define IDI_NOTIFICATIONS 169
+#define IDI_PROXY 170
+#define IDI_TABS 171
+#define IDI_WINDOWS 172
 
 // Stuff that uses multiple id's