summaryrefslogtreecommitdiff
path: root/plugins/TabSRMM/src/chat/window.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-07-06 12:10:42 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-07-06 12:10:42 +0000
commit3480ee282427850ceaee9ab38887b66c396cbf67 (patch)
tree9ae6d69ff176f0168a392546118ddf7769478561 /plugins/TabSRMM/src/chat/window.cpp
parentecbda9bae58700987dcb77730f54dfc37b3ff9c5 (diff)
tabSRMM: code cleaning for chat fonts/colors
git-svn-id: http://svn.miranda-ng.org/main/trunk@5243 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TabSRMM/src/chat/window.cpp')
-rw-r--r--plugins/TabSRMM/src/chat/window.cpp63
1 files changed, 30 insertions, 33 deletions
diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp
index f936e639d3..39ff4da0ea 100644
--- a/plugins/TabSRMM/src/chat/window.cpp
+++ b/plugins/TabSRMM/src/chat/window.cpp
@@ -1863,19 +1863,17 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
* precise than using GetTextExtentPoint...()
*/
-int GetTextPixelSize(TCHAR* pszText, HFONT hFont, BOOL bWidth)
+int GetTextPixelSize(TCHAR* pszText, HFONT hFont, bool bWidth)
{
- HDC hdc;
- HFONT hOldFont;
- RECT rc = {0};
- int i;
-
if (!pszText || !hFont)
return 0;
- hdc = GetDC(NULL);
- hOldFont = (HFONT)SelectObject(hdc, hFont);
- i = DrawText(hdc, pszText , -1, &rc, DT_CALCRECT);
+ HDC hdc = GetDC(NULL);
+ HFONT hOldFont = (HFONT)SelectObject(hdc, hFont);
+
+ RECT rc = {0};
+ int i = DrawText(hdc, pszText , -1, &rc, DT_CALCRECT);
+
SelectObject(hdc, hOldFont);
ReleaseDC(NULL, hdc);
return bWidth ? rc.right - rc.left : rc.bottom - rc.top;
@@ -2335,8 +2333,6 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
}
else {
if (dis->CtlID == IDC_LIST) {
- HFONT hFont, hOldFont;
- HICON hIcon;
int offset, x_offset = 0;
int height;
int index = dis->itemID;
@@ -2352,38 +2348,39 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
offset = 0;
else
offset = height / 2;
- hIcon = SM_GetStatusIcon(si, ui, &szIndicator);
- hFont = (ui->iStatusEx == 0) ? g_Settings.UserListFont : g_Settings.UserListHeadingsFont;
- hOldFont = (HFONT) SelectObject(dis->hDC, hFont);
+ HICON hIcon = SM_GetStatusIcon(si, ui, &szIndicator);
+ HFONT hFont = g_Settings.UserListFonts[ui->iStatusEx];
+ HFONT hOldFont = (HFONT) SelectObject(dis->hDC, hFont);
SetBkMode(dis->hDC, TRANSPARENT);
if (dis->itemState & ODS_SELECTED) {
FillRect(dis->hDC, &dis->rcItem, g_Settings.SelectionBGBrush);
SetTextColor(dis->hDC, g_Settings.nickColors[6]);
- } else {
+ }
+ else {
FillRect(dis->hDC, &dis->rcItem, hListBkgBrush);
if (g_Settings.ColorizeNicks && szIndicator != 0) {
COLORREF clr;
-
switch (szIndicator) {
- case '@':
- clr = g_Settings.nickColors[0];
- break;
- case '%':
- clr = g_Settings.nickColors[1];
- break;
- case '+':
- clr = g_Settings.nickColors[2];
- break;
- case '!':
- clr = g_Settings.nickColors[3];
- break;
- case '*':
- clr = g_Settings.nickColors[4];
- break;
+ case '@':
+ clr = g_Settings.nickColors[0];
+ break;
+ case '%':
+ clr = g_Settings.nickColors[1];
+ break;
+ case '+':
+ clr = g_Settings.nickColors[2];
+ break;
+ case '!':
+ clr = g_Settings.nickColors[3];
+ break;
+ case '*':
+ clr = g_Settings.nickColors[4];
+ break;
}
SetTextColor(dis->hDC, clr);
- } else SetTextColor(dis->hDC, ui->iStatusEx == 0 ? g_Settings.crUserListColor : g_Settings.crUserListHeadingsColor);
+ }
+ else SetTextColor(dis->hDC, g_Settings.UserListColors[ui->iStatusEx]);
}
x_offset = 2;
@@ -2617,7 +2614,7 @@ LABEL_SHOWWINDOW:
case GC_SHOWCOLORCHOOSER: {
HWND ColorWindow;
RECT rc;
- BOOL bFG = lParam == IDC_COLOR ? TRUE : FALSE;
+ bool bFG = (lParam == IDC_COLOR);
COLORCHOOSER *pCC = (COLORCHOOSER *)mir_alloc(sizeof(COLORCHOOSER));
GetWindowRect(GetDlgItem(hwndDlg, bFG ? IDC_COLOR : IDC_BKGCOLOR), &rc);