From da2edf0603f1552ef53325fa558c28a3c6fdec94 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 16 Jan 2014 11:33:08 +0000 Subject: - two chat HBRUSHes moved into CHAT_MANAGER; - fix for changing fonts; - crash fix for StdChat unloading; git-svn-id: http://svn.miranda-ng.org/main/trunk@7677 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/core/stdchat/src/chat.h | 4 +--- src/core/stdchat/src/main.cpp | 14 ++------------ src/core/stdchat/src/options.cpp | 15 +-------------- src/core/stdchat/src/window.cpp | 8 ++++---- 4 files changed, 8 insertions(+), 33 deletions(-) (limited to 'src/core') diff --git a/src/core/stdchat/src/chat.h b/src/core/stdchat/src/chat.h index 81cda11d63..9f7e9cba7a 100644 --- a/src/core/stdchat/src/chat.h +++ b/src/core/stdchat/src/chat.h @@ -95,7 +95,6 @@ extern GlobalLogSettings g_Settings; extern SESSION_INFO g_TabSession; extern TABLIST *g_TabList; extern HMENU g_hMenu; -extern HBRUSH hListBkgBrush, hListSelectedBkgBrush; extern HINSTANCE g_hInst; extern BOOL SmileyAddInstalled, PopupInstalled; @@ -154,8 +153,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) int GetTextPixelSize( TCHAR* pszText, HFONT hFont, BOOL bWidth); // options.c -int OptionsInit(void); -int OptionsUnInit(void); +int OptionsInitialize(WPARAM wParam, LPARAM lParam); void AddIcons(void); HICON LoadIconEx(char* pszIcoLibName, BOOL big); diff --git a/src/core/stdchat/src/main.cpp b/src/core/stdchat/src/main.cpp index ffacc93dc9..eb345b53ab 100644 --- a/src/core/stdchat/src/main.cpp +++ b/src/core/stdchat/src/main.cpp @@ -31,7 +31,6 @@ HINSTANCE g_hInst; int hLangpack; BOOL SmileyAddInstalled = FALSE, PopupInstalled = FALSE; -HBRUSH hListBkgBrush = NULL, hListSelectedBkgBrush = NULL; GlobalLogSettings g_Settings; @@ -230,14 +229,6 @@ static void OnLoadSettings() g_Settings.TabsAtBottom = db_get_b(NULL, "Chat", "TabBottom", 0); g_Settings.TabCloseOnDblClick = db_get_b(NULL, "Chat", "TabCloseOnDblClick", 0); - if (hListBkgBrush != NULL) - DeleteObject(hListBkgBrush); - hListBkgBrush = CreateSolidBrush(db_get_dw(NULL, "Chat", "ColorNicklistBG", GetSysColor(COLOR_WINDOW))); - - if (hListSelectedBkgBrush != NULL) - DeleteObject(hListSelectedBkgBrush); - hListSelectedBkgBrush = CreateSolidBrush(db_get_dw(NULL, "Chat", "ColorNicklistSelectedBG", GetSysColor(COLOR_HIGHLIGHT))); - ZeroMemory(&g_TabSession, sizeof(SESSION_INFO)); g_TabSession.iType = GCW_TABROOM; g_TabSession.iSplitterX = g_Settings.iSplitterX; @@ -287,8 +278,8 @@ extern "C" __declspec(dllexport) int Load(void) LoadIcons(); OnLoadSettings(); - OptionsInit(); - + + HookEvent(ME_OPT_INITIALISE, OptionsInitialize); HookEvent(ME_SYSTEM_SHUTDOWN, OnShutdown); return 0; } @@ -303,7 +294,6 @@ extern "C" __declspec(dllexport) int Unload(void) db_set_dw(NULL, "Chat", "roomheight", g_Settings.iHeight); DestroyMenu(g_hMenu); - OptionsUnInit(); return 0; } diff --git a/src/core/stdchat/src/options.cpp b/src/core/stdchat/src/options.cpp index 2b5b9dacd9..147978e048 100644 --- a/src/core/stdchat/src/options.cpp +++ b/src/core/stdchat/src/options.cpp @@ -725,7 +725,7 @@ static INT_PTR CALLBACK DlgProcOptionsPopup(HWND hwndDlg, UINT uMsg, WPARAM wPar return FALSE; } -static int OptionsInitialize(WPARAM wParam, LPARAM lParam) +int OptionsInitialize(WPARAM wParam, LPARAM lParam) { OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = 910000000; @@ -755,16 +755,3 @@ static int OptionsInitialize(WPARAM wParam, LPARAM lParam) } return 0; } - -int OptionsInit(void) -{ - HookEvent(ME_OPT_INITIALISE, OptionsInitialize); - return 0; -} - -int OptionsUnInit(void) -{ - DeleteObject(hListBkgBrush); - DeleteObject(hListSelectedBkgBrush); - return 0; -} diff --git a/src/core/stdchat/src/window.cpp b/src/core/stdchat/src/window.cpp index b19a5040f6..b0bdffc27a 100644 --- a/src/core/stdchat/src/window.cpp +++ b/src/core/stdchat/src/window.cpp @@ -977,7 +977,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, if (rc.bottom-rc.top > items * height) { rc.top = items*height; - FillRect(dc, &rc, hListBkgBrush); + FillRect(dc, &rc, pci->hListBkgBrush); } } } } return 1; @@ -1735,7 +1735,7 @@ END_REMOVETAB: case WM_CTLCOLORLISTBOX: SetBkColor((HDC) wParam, g_Settings.crUserListBGColor); - return (INT_PTR) hListBkgBrush; + return (INT_PTR)pci->hListBkgBrush; case WM_MEASUREITEM: { @@ -1779,9 +1779,9 @@ END_REMOVETAB: SetBkMode(dis->hDC, TRANSPARENT); if (dis->itemAction == ODA_FOCUS && dis->itemState & ODS_SELECTED) - FillRect(dis->hDC, &dis->rcItem, hListSelectedBkgBrush); + FillRect(dis->hDC, &dis->rcItem, pci->hListSelectedBkgBrush); else //if (dis->itemState & ODS_INACTIVE) - FillRect(dis->hDC, &dis->rcItem, hListBkgBrush); + FillRect(dis->hDC, &dis->rcItem, pci->hListBkgBrush); if (g_Settings.ShowContactStatus && g_Settings.ContactStatusFirst && ui->ContactStatus) { HICON hIcon = LoadSkinnedProtoIcon(si->pszModule, ui->ContactStatus); -- cgit v1.2.3