← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2679: start a styles settings page

 

------------------------------------------------------------
revno: 2679
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Tue 2011-11-15 20:05:59 +0100
message:
  start a styles settings page
renamed:
  help/settings_colors.html => help/settings_styles.html
  res/Colors.ico => res/Styles.ico
  win32/ColorsPage.cpp => win32/StylesPage.cpp
  win32/ColorsPage.h => win32/StylesPage.h
modified:
  dcpp/SettingsManager.cpp
  dcpp/SettingsManager.h
  dwt/include/dwt/Widget.h
  dwt/src/widgets/FontDialog.cpp
  dwt/src/widgets/Label.cpp
  help/DCPlusPlus.hhp
  help/index.html
  help/resource.h
  help/window_network_stats.html
  win32/DCPlusPlus.rc
  win32/HubFrame.cpp
  win32/HubFrame.h
  win32/SettingsDialog.cpp
  win32/StatsFrame.cpp
  win32/TransferView.cpp
  win32/resource.h
  help/settings_styles.html
  win32/StylesPage.cpp
  win32/StylesPage.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 'dcpp/SettingsManager.cpp'
--- dcpp/SettingsManager.cpp	2011-10-25 06:34:18 +0000
+++ dcpp/SettingsManager.cpp	2011-11-15 19:05:59 +0000
@@ -36,7 +36,7 @@
 {
 	// Strings
 	"Nick", "UploadSpeed", "Description", "DownloadDirectory", "EMail", "ExternalIp", "ExternalIp6",
-	"MainFont", "TextViewerFont",
+	"MainFont", "TextViewerFont", "UploadFont", "DownloadFont",
 	"ConnectionsOrder", "ConnectionsWidths", "HubFrameOrder", "HubFrameWidths",
 	"SearchFrameOrder", "SearchFrameWidths", "FavHubsFrameOrder", "FavHubsFrameWidths",
 	"HublistServers", "QueueFrameOrder", "QueueFrameWidths", "PublicHubsFrameOrder", "PublicHubsFrameWidths",
@@ -55,7 +55,8 @@
 	"SENTRY",
 	// Ints
 	"IncomingConnections", "InPort", "Slots", "AutoFollow", "ClearSearch",
-	"BackgroundColor", "TextColor", "ShareHidden", "FilterMessages", "MinimizeToTray", "AlwaysTray",
+	"TextColor", "BackgroundColor", "UploadTextColor", "UploadBgColor", "DownloadTextColor", "DownloadBgColor",
+	"ShareHidden", "FilterMessages", "MinimizeToTray", "AlwaysTray",
 	"AutoSearch", "TimeStamps", "PopupHubPms", "PopupBotPms", "IgnoreHubPms", "IgnoreBotPms",
 	"ListDuplicates", "BufferSize", "DownloadSlots", "MaxDownloadSpeed", "LogMainChat", "LogPrivateChat",
 	"LogDownloads", "LogFinishedDownloads", "LogUploads", "StatusInChat", "ShowJoins",
@@ -65,7 +66,7 @@
 	"SocksPort", "SocksResolve", "KeepLists", "AutoKick", "QueueFrameShowTree",
 	"CompressTransfers", "SFVCheck", "AutoAway",
 	"MaxCompression", "NoAwayMsgToBots", "SkipZeroByte", "AdlsBreakOnFirst",
-	"HubUserCommands", "AutoSearchAutoMatch", "DownloadBarColor", "UploadBarColor", "LogSystem",
+	"HubUserCommands", "AutoSearchAutoMatch", "LogSystem",
 	"LogFilelistTransfers", "SendUnknownCommands", "MaxHashSpeed", "OpenUserCmdHelp",
 	"GetUserCountry", "FavShowJoins", "LogStatusMessages", "ShowStatusbar",
 	"ShowToolbar", "ShowTransferview", "PopunderPm", "PopunderFilelist", "MagnetAsk", "MagnetAction", "MagnetRegister",
@@ -334,9 +335,8 @@
 	setDefault(MAIN_WINDOW_SIZE_Y, CW_USEDEFAULT);
 	setDefault(MAIN_WINDOW_POS_X, CW_USEDEFAULT);
 	setDefault(MAIN_WINDOW_POS_Y, CW_USEDEFAULT);
-	setDefault(UPLOAD_BAR_COLOR, RGB(205, 60, 55));
-	setDefault(DOWNLOAD_BAR_COLOR, RGB(55, 170, 85));
-
+	setDefault(UPLOAD_BG_COLOR, RGB(205, 60, 55));
+	setDefault(DOWNLOAD_BG_COLOR, RGB(55, 170, 85));
 #endif
 }
 

=== modified file 'dcpp/SettingsManager.h'
--- dcpp/SettingsManager.h	2011-10-25 18:07:46 +0000
+++ dcpp/SettingsManager.h	2011-11-15 19:05:59 +0000
@@ -56,7 +56,7 @@
 
 	enum StrSetting { STR_FIRST,
 		NICK = STR_FIRST, UPLOAD_SPEED, DESCRIPTION, DOWNLOAD_DIRECTORY, EMAIL, EXTERNAL_IP, EXTERNAL_IP6,
-		MAIN_FONT, TEXT_VIEWER_FONT,
+		MAIN_FONT, TEXT_VIEWER_FONT, UPLOAD_FONT, DOWNLOAD_FONT,
 		CONNECTIONS_ORDER, CONNECTIONS_WIDTHS, HUBFRAME_ORDER, HUBFRAME_WIDTHS,
 		SEARCHFRAME_ORDER, SEARCHFRAME_WIDTHS, FAVHUBSFRAME_ORDER, FAVHUBSFRAME_WIDTHS,
 		HUBLIST_SERVERS, QUEUEFRAME_ORDER, QUEUEFRAME_WIDTHS, PUBLICHUBSFRAME_ORDER, PUBLICHUBSFRAME_WIDTHS,
@@ -76,7 +76,8 @@
 
 	enum IntSetting { INT_FIRST = STR_LAST + 1,
 		INCOMING_CONNECTIONS = INT_FIRST, TCP_PORT, SLOTS, AUTO_FOLLOW, CLEAR_SEARCH,
-		BACKGROUND_COLOR, TEXT_COLOR, SHARE_HIDDEN, FILTER_MESSAGES, MINIMIZE_TRAY, ALWAYS_TRAY,
+		TEXT_COLOR, BACKGROUND_COLOR, UPLOAD_TEXT_COLOR, UPLOAD_BG_COLOR, DOWNLOAD_TEXT_COLOR, DOWNLOAD_BG_COLOR,
+		SHARE_HIDDEN, FILTER_MESSAGES, MINIMIZE_TRAY, ALWAYS_TRAY,
 		AUTO_SEARCH, TIME_STAMPS, POPUP_HUB_PMS, POPUP_BOT_PMS, IGNORE_HUB_PMS, IGNORE_BOT_PMS,
 		LIST_DUPES, BUFFER_SIZE, DOWNLOAD_SLOTS, MAX_DOWNLOAD_SPEED, LOG_MAIN_CHAT, LOG_PRIVATE_CHAT,
 		LOG_DOWNLOADS, LOG_FINISHED_DOWNLOADS, LOG_UPLOADS, STATUS_IN_CHAT, SHOW_JOINS,
@@ -86,7 +87,7 @@
 		SOCKS_PORT, SOCKS_RESOLVE, KEEP_LISTS, AUTO_KICK, QUEUEFRAME_SHOW_TREE,
 		COMPRESS_TRANSFERS, SFV_CHECK, AUTO_AWAY,
 		MAX_COMPRESSION, NO_AWAYMSG_TO_BOTS, SKIP_ZERO_BYTE, ADLS_BREAK_ON_FIRST,
-		HUB_USER_COMMANDS, AUTO_SEARCH_AUTO_MATCH, UPLOAD_BAR_COLOR, DOWNLOAD_BAR_COLOR, LOG_SYSTEM,
+		HUB_USER_COMMANDS, AUTO_SEARCH_AUTO_MATCH, LOG_SYSTEM,
 		LOG_FILELIST_TRANSFERS, SEND_UNKNOWN_COMMANDS, MAX_HASH_SPEED, OPEN_USER_CMD_HELP,
 		GET_USER_COUNTRY, FAV_SHOW_JOINS, LOG_STATUS_MESSAGES, SHOW_STATUSBAR,
 		SHOW_TOOLBAR, SHOW_TRANSFERVIEW, POPUNDER_PM, POPUNDER_FILELIST, MAGNET_ASK, MAGNET_ACTION, MAGNET_REGISTER,

=== modified file 'dwt/include/dwt/Widget.h'
--- dwt/include/dwt/Widget.h	2011-07-05 12:16:32 +0000
+++ dwt/include/dwt/Widget.h	2011-11-15 19:05:59 +0000
@@ -98,6 +98,7 @@
 	void addRemoveStyle(DWORD addStyle, bool add);
 
 	bool hasStyle(DWORD style) const;
+	bool hasExStyle(DWORD style) const;
 
 	/// Use this function to add or remove windows exStyles.
 	/** The first parameter is the type of style you wish to add/remove. <br>
@@ -258,6 +259,10 @@
 	return (::GetWindowLong(handle(), GWL_STYLE) & style) == style;
 }
 
+inline bool Widget::hasExStyle(DWORD style) const {
+	return (::GetWindowLong(handle(), GWL_EXSTYLE) & style) == style;
+}
+
 inline Widget::CallbackCollectionType& Widget::getCallbacks() {
 	return handlers;
 }

=== modified file 'dwt/src/widgets/FontDialog.cpp'
--- dwt/src/widgets/FontDialog.cpp	2011-06-28 20:07:49 +0000
+++ dwt/src/widgets/FontDialog.cpp	2011-11-15 19:05:59 +0000
@@ -148,7 +148,9 @@
 
 	if(::ChooseFont(&cf)) {
 		font = *cf.lpLogFont;
-		color = cf.rgbColors;
+		if(!options || options->color) {
+			color = cf.rgbColors;
+		}
 		return true;
 	}
 	return false;

=== modified file 'dwt/src/widgets/Label.cpp'
--- dwt/src/widgets/Label.cpp	2011-06-28 20:07:49 +0000
+++ dwt/src/widgets/Label.cpp	2011-11-15 19:05:59 +0000
@@ -71,7 +71,16 @@
 		return getWindowSize();
 	}
 
-	return getTextSize(getText());
+	auto ret = getTextSize(getText());
+
+	/// @todo there are other types of borders that should be accounted for
+
+	if(hasExStyle(WS_EX_CLIENTEDGE)) {
+		ret.x += GetSystemMetrics(SM_CXEDGE) * 2;
+		ret.y += GetSystemMetrics(SM_CYEDGE) * 2;
+	}
+
+	return ret;
 }
 
 }

=== modified file 'help/DCPlusPlus.hhp'
--- help/DCPlusPlus.hhp	2011-10-15 22:58:51 +0000
+++ help/DCPlusPlus.hhp	2011-11-15 19:05:59 +0000
@@ -64,7 +64,7 @@
 IDH_QUEUEPAGE=settings_queue.html
 IDH_UPLOADPAGE=settings_sharing.html
 IDH_APPEARANCEPAGE=settings_appearance.html
-IDH_COLORSPAGE=settings_colors.html
+IDH_STYLESPAGE=settings_styles.html
 IDH_TABSPAGE=settings_tabs.html
 IDH_WINDOWSPAGE=settings_windows.html
 IDH_NOTIFICATIONSPAGE=settings_notifications.html

=== modified file 'help/index.html'
--- help/index.html	2011-10-15 22:58:51 +0000
+++ help/index.html	2011-11-15 19:05:59 +0000
@@ -88,7 +88,7 @@
 <li>
 <div><placeholder><a href="settings_appearance.html">Appearance</a></placeholder></div>
 <ul>
-<li><placeholder><a href="settings_colors.html">Colors</a></placeholder></li>
+<li><placeholder><a href="settings_styles.html">Styles</a></placeholder></li>
 <li><placeholder><a href="settings_tabs.html">Tabs</a></placeholder></li>
 <li><placeholder><a href="settings_windows.html">Windows</a></placeholder></li>
 </ul>

=== modified file 'help/resource.h'
--- help/resource.h	2011-10-15 23:57:49 +0000
+++ help/resource.h	2011-11-15 19:05:59 +0000
@@ -53,7 +53,7 @@
 #define IDH_QUEUEPAGE 10307
 #define IDH_UPLOADPAGE 10308
 #define IDH_APPEARANCEPAGE 10309
-#define IDH_COLORSPAGE 10310
+#define IDH_STYLESPAGE 10310
 #define IDH_TABSPAGE 10311
 #define IDH_WINDOWSPAGE 10311
 #define IDH_NOTIFICATIONSPAGE 10312

=== renamed file 'help/settings_colors.html' => 'help/settings_styles.html'
--- help/settings_colors.html	2011-04-23 10:33:55 +0000
+++ help/settings_styles.html	2011-11-15 19:05:59 +0000
@@ -6,14 +6,11 @@
 <link type="text/css" rel="stylesheet" href="style.css"/>
 </head>
 <body>
-<h1>Colors</h1>
+<h1>Styles</h1>
 <p style="font-style: italic;">Note: Most of these options require
 that you restart DC++. (Fonts, colors and icons are loaded at startup
 only. Window settings are loaded when opening a new window.)</p>
-<h2>Colors</h2>
-<p cshelp="IDH_SETTINGS_COLORS_COLORS">
-You can preview the background color and text style before applying them.
-</p>
+<!--
 <dl style="margin-left: 40px;">
   <dt>Select window color</dt>
   <dd cshelp="IDH_SETTINGS_COLORS_SELWINCOLOR">This setting determines the background color of the windows in
@@ -28,5 +25,6 @@
   <dd cshelp="IDH_SETTINGS_COLORS_DOWNLOAD_BAR_COLOR">This will set the coloring for the download progress bars
 (default: RGB(55, 170, 85)).</dd>
 </dl>
+-->
 </body>
 </html>

=== modified file 'help/window_network_stats.html'
--- help/window_network_stats.html	2008-11-20 18:07:53 +0000
+++ help/window_network_stats.html	2011-11-15 19:05:59 +0000
@@ -12,7 +12,7 @@
 	</h1>
 	This window will display the avarage speed of files sent and received by DC++. The colors are
 	decided by the
-	<a href="settings_colors_and_sounds.html#transfercolors">upload and download colors in the settings window</a>.
+	<a href="settings_styles.html#transfercolors">upload and download colors in the settings window</a>.
 	Note that information to and from hubs are included here as well.
 </body>
 </html>

=== renamed file 'res/Colors.ico' => 'res/Styles.ico'
=== modified file 'win32/DCPlusPlus.rc'
--- win32/DCPlusPlus.rc	2011-11-08 19:42:19 +0000
+++ win32/DCPlusPlus.rc	2011-11-15 19:05:59 +0000
@@ -97,10 +97,10 @@
 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_STYLES              ICON                    "res/Styles.ico"
 IDI_BW_LIMITER          ICON                    "res/BandwidthLimiter.ico"
 IDI_CONN_GREY           ICON                    "res/ConnGrey.ico"
-IDI_CONN_BLUE            ICON                    "res/ConnBlue.ico"
+IDI_CONN_BLUE           ICON                    "res/ConnBlue.ico"
 IDI_EXPERT              ICON                    "res/Expert.ico"
 IDI_FAVORITE_DIRS       ICON                    "res/FavoriteDirs.ico"
 IDI_LOGS                ICON                    "res/Logs.ico"

=== modified file 'win32/HubFrame.cpp'
--- win32/HubFrame.cpp	2011-11-14 20:28:53 +0000
+++ win32/HubFrame.cpp	2011-11-15 19:05:59 +0000
@@ -771,7 +771,7 @@
 	return image;
 }
 
-int HubFrame::UserInfo::getColor(HFONT&, COLORREF& textColor, COLORREF& bgColor, int) const {
+int HubFrame::UserInfo::getStyle(HFONT&, COLORREF& textColor, COLORREF& bgColor, int) const {
 	if(identity.isOp()) {
 		textColor = 0xFFFFFF - textColor;
 		bgColor = 0xFFFFFF - bgColor;

=== modified file 'win32/HubFrame.h'
--- win32/HubFrame.h	2011-11-14 20:28:53 +0000
+++ win32/HubFrame.h	2011-11-15 19:05:59 +0000
@@ -129,7 +129,7 @@
 			return columns[col];
 		}
 		int getImage(int col) const;
-		int getColor(HFONT&, COLORREF& textColor, COLORREF& bgColor, int) const;
+		int getStyle(HFONT&, COLORREF& textColor, COLORREF& bgColor, int) const;
 
 		static int compareItems(const UserInfo* a, const UserInfo* b, int col);
 		bool update(const Identity& identity, int sortCol);

=== modified file 'win32/SettingsDialog.cpp'
--- win32/SettingsDialog.cpp	2011-10-22 16:41:13 +0000
+++ win32/SettingsDialog.cpp	2011-11-15 19:05:59 +0000
@@ -44,7 +44,7 @@
 #include "UploadPage.h"
 
 #include "AppearancePage.h"
-#include "ColorsPage.h"
+#include "StylesPage.h"
 #include "TabsPage.h"
 #include "WindowsPage.h"
 
@@ -165,7 +165,7 @@
 
 		{
 			HTREEITEM item = addPage(T_("Appearance"), new AppearancePage(container), IDI_DCPP, TVI_ROOT);
-			addPage(T_("Colors"), new ColorsPage(container), IDI_COLORS, item);
+			addPage(T_("Styles"), new StylesPage(container), IDI_STYLES, item);
 			addPage(T_("Tabs"), new TabsPage(container), IDI_TABS, item);
 			addPage(T_("Windows"), new WindowsPage(container), IDI_WINDOWS, item);
 		}

=== modified file 'win32/StatsFrame.cpp'
--- win32/StatsFrame.cpp	2011-10-10 20:18:18 +0000
+++ win32/StatsFrame.cpp	2011-11-15 19:05:59 +0000
@@ -31,8 +31,8 @@
 StatsFrame::StatsFrame(TabViewPtr parent) :
 	BaseType(parent, T_("Network Statistics"), IDH_NET_STATS, IDI_NET_STATS),
 	pen(new dwt::Pen(WinUtil::textColor)),
-	upPen(new dwt::Pen(SETTING(UPLOAD_BAR_COLOR))),
-	downPen(new dwt::Pen(SETTING(DOWNLOAD_BAR_COLOR))),
+	upPen(new dwt::Pen(SETTING(UPLOAD_BG_COLOR))),
+	downPen(new dwt::Pen(SETTING(DOWNLOAD_BG_COLOR))),
 	width(0),
 	height(0),
 	twidth(0),

=== renamed file 'win32/ColorsPage.cpp' => 'win32/StylesPage.cpp'
--- win32/ColorsPage.cpp	2011-06-28 20:07:49 +0000
+++ win32/StylesPage.cpp	2011-11-15 19:05:59 +0000
@@ -17,7 +17,7 @@
  */
 
 #include "stdafx.h"
-#include "ColorsPage.h"
+#include "StylesPage.h"
 
 #include <dcpp/SettingsManager.h>
 
@@ -29,6 +29,7 @@
 #include <dwt/widgets/Label.h>
 
 #include "resource.h"
+#include "TypedTable.h"
 #include "WinUtil.h"
 
 using dwt::Button;
@@ -38,102 +39,303 @@
 using dwt::GridInfo;
 using dwt::Label;
 
-ColorsPage::ColorsPage(dwt::Widget* parent) :
+static const ColumnInfo columns[] = {
+	{ "", 100, false }
+};
+
+StylesPage::StylesPage(dwt::Widget* parent) :
 PropPage(parent, 2, 1),
-example(0)
+table(0),
+preview(0),
+customFont(0),
+font(0),
+customTextColor(0),
+textColor(0),
+customBgColor(0),
+bgColor(0)
 {
-	setHelpId(IDH_COLORSPAGE);
+	setHelpId(IDH_STYLESPAGE);
 
 	grid->column(0).mode = GridInfo::FILL;
+	grid->row(0).mode = GridInfo::FILL;
+	grid->row(0).align = GridInfo::STRETCH;
 
 	{
-		auto cur = grid->addChild(GroupBox::Seed(T_("Colors")))->addChild(Grid::Seed(2, 3));
-		cur->column(1).mode = GridInfo::FILL;
+		auto cur = grid->addChild(GroupBox::Seed(T_("Styles")))->addChild(Grid::Seed(5, 1));
+		cur->column(0).mode = GridInfo::FILL;
+		cur->row(0).mode = GridInfo::FILL;
 		cur->row(0).align = GridInfo::STRETCH;
-		cur->setHelpId(IDH_SETTINGS_COLORS_COLORS);
-
-		ButtonPtr windowColor = cur->addChild(Button::Seed(T_("Select &window color")));
-		windowColor->onClicked([this] { handleBackgroundClicked(); });
-		windowColor->setHelpId(IDH_SETTINGS_COLORS_SELWINCOLOR);
-
-		Label::Seed seed(T_("Donate \342\202\254\342\202\254\342\202\254:s! (ok, dirty dollars are fine as well =) (see help menu)"));
-		seed.style |= SS_SUNKEN;
-		example = cur->addChild(seed);
-		cur->setWidget(example, 0, 1, 2, 1);
-		example->setHelpId(IDH_SETTINGS_COLORS_COLORS);
-
-		auto uploads = cur->addChild(Button::Seed(T_("Uploads")));
-		uploads->onClicked([this] { handleULClicked(); });
-		uploads->setHelpId(IDH_SETTINGS_COLORS_UPLOAD_BAR_COLOR);
-
-		auto textStyle	= cur->addChild(Button::Seed(T_("Select &text style")));
-		textStyle->onClicked([this] { handleTextClicked(); });
-		textStyle->setHelpId(IDH_SETTINGS_COLORS_SELTEXT);
-
-		auto downloads	= cur->addChild(Button::Seed(T_("Downloads")));
-		downloads->onClicked([this] { handleDLClicked(); });
-		downloads->setHelpId(IDH_SETTINGS_COLORS_DOWNLOAD_BAR_COLOR);
+		cur->setSpacing(grid->getSpacing());
+
+		{
+			auto seed = WinUtil::Seeds::Dialog::table;
+			seed.style &= ~LVS_SHOWSELALWAYS;
+			seed.style |= LVS_SINGLESEL | LVS_NOCOLUMNHEADER;
+			table = cur->addChild(Table::Seed(seed));
+		}
+
+		{
+			Label::Seed seed;
+			seed.exStyle |= WS_EX_CLIENTEDGE;
+			preview = cur->addChild(seed);
+			//preview->setHelpId(IDH_SETTINGS_STYLES_PREVIEW);
+		}
+
+		auto cur2 = cur->addChild(Grid::Seed(1, 2));
+		//cur2->setHelpId(IDH_SETTINGS_STYLES_FONT);
+
+		customFont = cur2->addChild(CheckBox::Seed(T_("Custom font")));
+		customFont->onClicked([this] { handleCustomFont(); });
+
+		font = cur2->addChild(Button::Seed(T_("Select font")));
+		font->onClicked([this] { handleFont(); });
+
+		cur2 = cur->addChild(Grid::Seed(1, 2));
+		//cur2->setHelpId(IDH_SETTINGS_STYLES_TEXT);
+
+		customTextColor = cur2->addChild(CheckBox::Seed(T_("Custom text color")));
+		customTextColor->onClicked([this] { handleCustomTextColor(); });
+
+		textColor = cur2->addChild(Button::Seed(T_("Select color")));
+		textColor->onClicked([this] { handleTextColor(); });
+
+		cur2 = cur->addChild(Grid::Seed(1, 2));
+		//cur2->setHelpId(IDH_SETTINGS_STYLES_BG);
+
+		customBgColor = cur2->addChild(CheckBox::Seed(T_("Custom background color")));
+		customBgColor->onClicked([this] { handleCustomBgColor(); });
+
+		bgColor = cur2->addChild(Button::Seed(T_("Select color")));
+		bgColor->onClicked([this] { handleBgColor(); });
 	}
 
 	grid->addChild(Label::Seed(T_("Note; most of these options require that you restart DC++")))->setHelpId(IDH_SETTINGS_APPEARANCE_REQUIRES_RESTART);
 
-	fg = SETTING(TEXT_COLOR);
-	bg = SETTING(BACKGROUND_COLOR);
-	upBar = SETTING(UPLOAD_BAR_COLOR);
-	downBar = SETTING(DOWNLOAD_BAR_COLOR);
-
-	WinUtil::decodeFont(Text::toT(SETTING(MAIN_FONT)), logFont);
-	font = dwt::FontPtr(new dwt::Font(logFont));
-
-	example->setColor(fg, bg);
-	example->setFont(font);
-}
-
-ColorsPage::~ColorsPage() {
-}
-
-void ColorsPage::write() {
-	SettingsManager* settings = SettingsManager::getInstance();
-
-	settings->set(SettingsManager::TEXT_COLOR, (int)fg);
-	settings->set(SettingsManager::BACKGROUND_COLOR, (int)bg);
-	settings->set(SettingsManager::UPLOAD_BAR_COLOR, (int)upBar);
-	settings->set(SettingsManager::DOWNLOAD_BAR_COLOR, (int)downBar);
-	settings->set(SettingsManager::MAIN_FONT, Text::fromT(WinUtil::encodeFont(logFont)));
-}
-
-void ColorsPage::handleBackgroundClicked() {
-	ColorDialog::ColorParams colorParams(bg);
-	if(ColorDialog(this).open(colorParams)) {
-		bg = colorParams.getColor();
-		example->setColor(fg, bg);
-		example->redraw();
-	}
-}
-
-void ColorsPage::handleTextClicked() {
+	WinUtil::makeColumns(table, columns, COLUMN_LAST);
+
+	auto add = [this](tstring&& text, unsigned helpId, int fontSetting, int textColorSetting, int bgColorSetting) -> Data* {
+		auto data = new Data(forward<tstring>(text), helpId, fontSetting, textColorSetting, bgColorSetting);
+		table->insert(data);
+		return data;
+	};
+
+	globalData = add(T_("Global application style"), 0/*IDH_SETTINGS_STYLES_GLOBAL*/, SettingsManager::MAIN_FONT,
+		SettingsManager::TEXT_COLOR, SettingsManager::BACKGROUND_COLOR);
+	add(T_("Uploads"), 0/*IDH_SETTINGS_STYLES_UPLOADS*/, SettingsManager::UPLOAD_FONT,
+		SettingsManager::UPLOAD_TEXT_COLOR, SettingsManager::UPLOAD_BG_COLOR);
+	add(T_("Downloads"), 0/*IDH_SETTINGS_STYLES_DOWNLOADS*/, SettingsManager::DOWNLOAD_FONT,
+		SettingsManager::DOWNLOAD_TEXT_COLOR, SettingsManager::DOWNLOAD_BG_COLOR);
+
+	globalData->customFont = true;
+	globalData->customTextColor = true;
+	globalData->customBgColor = true;
+	update(globalData);
+
+	handleSelectionChanged();
+
+	table->onSelectionChanged([this] { handleSelectionChanged(); });
+
+	table->onHelp([this](Widget*, unsigned id) { handleTableHelp(id); });
+	table->setHelpId([this](unsigned& id) { handleTableHelpId(id); });
+}
+
+StylesPage::~StylesPage() {
+}
+
+void StylesPage::layout() {
+	PropPage::layout();
+
+	table->setColumnWidth(COLUMN_TEXT, table->getWindowSize().x - 20);
+}
+
+void StylesPage::write() {
+	table->forEach(&StylesPage::Data::write);
+}
+
+StylesPage::Data::Data(tstring&& text, unsigned helpId, int fontSetting, int textColorSetting, int bgColorSetting) :
+text(forward<tstring>(text)),
+helpId(helpId),
+fontSetting(fontSetting),
+textColorSetting(textColorSetting),
+bgColorSetting(bgColorSetting),
+customFont(!SettingsManager::getInstance()->isDefault(static_cast<SettingsManager::StrSetting>(fontSetting))),
+customTextColor(!SettingsManager::getInstance()->isDefault(static_cast<SettingsManager::IntSetting>(textColorSetting))),
+textColor(SettingsManager::getInstance()->get(static_cast<SettingsManager::IntSetting>(textColorSetting))),
+customBgColor(!SettingsManager::getInstance()->isDefault(static_cast<SettingsManager::IntSetting>(bgColorSetting))),
+bgColor(SettingsManager::getInstance()->get(static_cast<SettingsManager::IntSetting>(bgColorSetting)))
+{
+	WinUtil::decodeFont(Text::toT(SettingsManager::getInstance()->get(static_cast<SettingsManager::StrSetting>(fontSetting))), logFont);
+	updateFont();
+}
+
+const tstring& StylesPage::Data::getText(int) const {
+	return text;
+}
+
+int StylesPage::Data::getStyle(HFONT& font, COLORREF& textColor, COLORREF& bgColor, int) const {
+	if(customFont) {
+		font = this->font->handle();
+	}
+	auto color = getTextColor();
+	if(color >= 0) {
+		textColor = color;
+	}
+	color = getBgColor();
+	if(color >= 0) {
+		bgColor = color;
+	}
+	return CDRF_NEWFONT;
+}
+
+COLORREF StylesPage::Data::getTextColor() const {
+	return customTextColor ? textColor : SettingsManager::getInstance()->getDefault(static_cast<SettingsManager::IntSetting>(textColorSetting));
+}
+
+COLORREF StylesPage::Data::getBgColor() const {
+	return customBgColor ? bgColor : SettingsManager::getInstance()->getDefault(static_cast<SettingsManager::IntSetting>(bgColorSetting));
+}
+
+void StylesPage::Data::updateFont() {
+	font.reset(customFont ? new dwt::Font(logFont) : nullptr);
+}
+
+void StylesPage::Data::write() {
+	if(customFont) {
+		SettingsManager::getInstance()->set(static_cast<SettingsManager::StrSetting>(fontSetting), Text::fromT(WinUtil::encodeFont(logFont)));
+	} else {
+		SettingsManager::getInstance()->unset(static_cast<SettingsManager::StrSetting>(fontSetting));
+	}
+
+	if(customTextColor) {
+		SettingsManager::getInstance()->set(static_cast<SettingsManager::IntSetting>(textColorSetting), static_cast<int>(textColor));
+	} else {
+		SettingsManager::getInstance()->unset(static_cast<SettingsManager::IntSetting>(textColorSetting));
+	}
+
+	if(customBgColor) {
+		SettingsManager::getInstance()->set(static_cast<SettingsManager::IntSetting>(bgColorSetting), static_cast<int>(bgColor));
+	} else {
+		SettingsManager::getInstance()->unset(static_cast<SettingsManager::IntSetting>(bgColorSetting));
+	}
+}
+
+void StylesPage::handleSelectionChanged() {
+	auto data = table->getSelectedData();
+
+	bool enable = data;
+	if(data) {
+		updatePreview(data);
+	}
+	preview->setText(data ? data->text : Util::emptyStringT);
+	preview->setEnabled(enable);
+	preview->setVisible(enable);
+	preview->getParent()->layout();
+
+	bool customizable = data && data != globalData;
+
+	enable = data && data->customFont;
+	customFont->setChecked(enable);
+	customFont->setEnabled(customizable);
+	font->setEnabled(enable);
+
+	enable = data && data->customTextColor;
+	customTextColor->setChecked(enable);
+	customTextColor->setEnabled(customizable);
+	textColor->setEnabled(enable);
+
+	enable = data && data->customBgColor;
+	customBgColor->setChecked(enable);
+	customBgColor->setEnabled(customizable);
+	bgColor->setEnabled(enable);
+}
+
+void StylesPage::handleTableHelp(unsigned id) {
+	// same as PropPage::handleListHelp
+	int item =
+		isKeyPressed(VK_F1) ? table->getSelected() :
+		table->hitTest(dwt::ScreenCoordinate(dwt::Point::fromLParam(::GetMessagePos()))).first;
+	if(item >= 0)
+		id = table->getData(item)->helpId;
+	WinUtil::help(table, id);
+}
+
+void StylesPage::handleTableHelpId(unsigned& id) {
+	// same as PropPage::handleListHelpId
+	int item = table->getSelected();
+	if(item >= 0)
+		id = table->getData(item)->helpId;
+}
+
+void StylesPage::handleCustomFont() {
+	auto data = table->getSelectedData();
+	data->customFont = customFont->getChecked();
+	data->updateFont();
+	update(data);
+	handleSelectionChanged();
+}
+
+void StylesPage::handleFont() {
+	auto data = table->getSelectedData();
 	FontDialog::Options options;
 	options.strikeout = false;
 	options.underline = false;
-	options.bgColor = bg;
-	if(FontDialog(this).open(logFont, fg, &options)) {
-		font = dwt::FontPtr(new dwt::Font(logFont));
-		example->setColor(fg, bg);
-		example->setFont(font);
-		example->redraw();
-	}
-}
-
-void ColorsPage::handleULClicked() {
-	ColorDialog::ColorParams colorParams(upBar);
-	if(ColorDialog(this).open(colorParams)) {
-		upBar = colorParams.getColor();
-	}
-}
-
-void ColorsPage::handleDLClicked() {
-	ColorDialog::ColorParams colorParams(downBar);
-	if(ColorDialog(this).open(colorParams)) {
-		downBar = colorParams.getColor();
-	}
+	options.color = false;
+	options.bgColor = data->bgColor;
+	if(FontDialog(this).open(data->logFont, data->textColor, &options)) {
+		data->updateFont();
+		update(data);
+	}
+}
+
+void StylesPage::handleCustomTextColor() {
+	auto data = table->getSelectedData();
+	data->customTextColor = customTextColor->getChecked();
+	update(data);
+	handleSelectionChanged();
+}
+
+void StylesPage::handleTextColor() {
+	auto data = table->getSelectedData();
+	colorDialog(data->textColor);
+	update(data);
+}
+
+void StylesPage::handleCustomBgColor() {
+	auto data = table->getSelectedData();
+	data->customBgColor = customBgColor->getChecked();
+	update(data);
+	handleSelectionChanged();
+}
+
+void StylesPage::handleBgColor() {
+	auto data = table->getSelectedData();
+	colorDialog(data->bgColor);
+	update(data);
+}
+
+void StylesPage::colorDialog(COLORREF& color) {
+	ColorDialog::ColorParams colorParams(color);
+	if(ColorDialog(this).open(colorParams)) {
+		color = colorParams.getColor();
+	}
+}
+
+void StylesPage::update(Data* const data) {
+	if(data == globalData) {
+		table->setFont(globalData->font, false);
+		table->setColor(globalData->textColor, globalData->bgColor);
+		table->Control::redraw(true);
+	} else {
+		table->update(data);
+	}
+	updatePreview(data);
+	preview->getParent()->layout();
+}
+
+void StylesPage::updatePreview(Data* const data) {
+	preview->setFont(data->customFont ? data->font : globalData->font, false);
+	auto textColor = data->getTextColor();
+	auto bgColor = data->getBgColor();
+	preview->setColor((textColor >= 0) ? textColor : globalData->textColor, (bgColor >= 0) ? bgColor : globalData->bgColor);
+	preview->redraw(true);
 }

=== renamed file 'win32/ColorsPage.h' => 'win32/StylesPage.h'
--- win32/ColorsPage.h	2011-04-23 10:33:55 +0000
+++ win32/StylesPage.h	2011-11-15 19:05:59 +0000
@@ -16,30 +16,90 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
-#ifndef DCPLUSPLUS_WIN32_COLORS_PAGE_H
-#define DCPLUSPLUS_WIN32_COLORS_PAGE_H
+#ifndef DCPLUSPLUS_WIN32_STYLES_PAGE_H
+#define DCPLUSPLUS_WIN32_STYLES_PAGE_H
 
 #include "PropPage.h"
 
-class ColorsPage : public PropPage
+class StylesPage : public PropPage
 {
 public:
-	ColorsPage(dwt::Widget* parent);
-	virtual ~ColorsPage();
+	StylesPage(dwt::Widget* parent);
+	virtual ~StylesPage();
 
+	virtual void layout();
 	virtual void write();
 
 private:
-	LabelPtr example;
-
-	COLORREF fg, bg, upBar, downBar;
-	dwt::FontPtr font;
-	LOGFONT logFont;
-
-	void handleBackgroundClicked();
-	void handleTextClicked();
-	void handleULClicked();
-	void handleDLClicked();
+	enum {
+		COLUMN_TEXT,
+		COLUMN_LAST
+	};
+
+	class Data {
+	public:
+		Data(tstring&& text, unsigned helpId, int fontSetting, int textColorSetting, int bgColorSetting);
+
+		const tstring& getText(int) const;
+		int getStyle(HFONT& font, COLORREF& textColor, COLORREF& bgColor, int) const;
+
+		COLORREF getTextColor() const;
+		COLORREF getBgColor() const;
+
+		void updateFont();
+
+		void write();
+
+		const tstring text;
+		unsigned helpId;
+
+		int fontSetting;
+		int textColorSetting;
+		int bgColorSetting;
+
+		bool customFont;
+		dwt::FontPtr font;
+		LOGFONT logFont;
+
+		bool customTextColor;
+		COLORREF textColor;
+
+		bool customBgColor;
+		COLORREF bgColor;
+	};
+
+	Data* globalData;
+
+	typedef TypedTable<Data> Table;
+	Table* table;
+
+	LabelPtr preview;
+
+	CheckBoxPtr customFont;
+	ButtonPtr font;
+
+	CheckBoxPtr customTextColor;
+	ButtonPtr textColor;
+
+	CheckBoxPtr customBgColor;
+	ButtonPtr bgColor;
+
+	void handleSelectionChanged();
+	void handleTableHelp(unsigned id);
+	void handleTableHelpId(unsigned& id);
+
+	void handleCustomFont();
+	void handleFont();
+
+	void handleCustomTextColor();
+	void handleTextColor();
+
+	void handleCustomBgColor();
+	void handleBgColor();
+
+	void colorDialog(COLORREF& color);
+	void update(Data* const data);
+	void updatePreview(Data* const data);
 };
 
-#endif // !defined(DCPLUSPLUS_WIN32_COLORS_PAGE_H)
+#endif

=== modified file 'win32/TransferView.cpp'
--- win32/TransferView.cpp	2011-11-13 16:46:43 +0000
+++ win32/TransferView.cpp	2011-11-15 19:05:59 +0000
@@ -402,7 +402,7 @@
 
 				double pos = static_cast<double>(ci->chunkPos) / ci->chunk;
 
-				drawProgress(hdc, dwt::Rectangle(r), item, column, text, pos, ci->download ? SETTING(DOWNLOAD_BAR_COLOR) : SETTING(UPLOAD_BAR_COLOR));
+				drawProgress(hdc, dwt::Rectangle(r), item, column, text, pos, ci->download ? SETTING(DOWNLOAD_BG_COLOR) : SETTING(UPLOAD_BG_COLOR));
 
 				return CDRF_SKIPDEFAULT;
 			}
@@ -417,7 +417,7 @@
 
 				double pos = static_cast<double>(di->done) / di->size;
 
-				drawProgress(hdc, dwt::Rectangle(r), item, column, text, pos, SETTING(DOWNLOAD_BAR_COLOR));
+				drawProgress(hdc, dwt::Rectangle(r), item, column, text, pos, SETTING(DOWNLOAD_BG_COLOR));
 
 				return CDRF_SKIPDEFAULT;
 			}

=== modified file 'win32/resource.h'
--- win32/resource.h	2011-10-15 22:58:51 +0000
+++ win32/resource.h	2011-11-15 19:05:59 +0000
@@ -66,7 +66,7 @@
 #define IDI_SLOTS_FULL 159
 #define IDI_ADVANCED 160
 #define IDI_CLOCK 161
-#define IDI_COLORS 162
+#define IDI_STYLES 162
 #define IDI_BW_LIMITER 163
 #define IDI_CONN_GREY 164
 #define IDI_CONN_BLUE 165