From 1d680ee8c0f9b0c2a421a778cb50152581dc2873 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 14 Jul 2012 11:59:47 +0000 Subject: fix for Clist Nicer icons' customization git-svn-id: http://svn.miranda-ng.org/main/trunk@964 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_nicer/SRC/CLCButton.cpp | 23 +++++++++++++++++++---- plugins/Clist_nicer/SRC/clui.cpp | 8 ++++---- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/plugins/Clist_nicer/SRC/CLCButton.cpp b/plugins/Clist_nicer/SRC/CLCButton.cpp index 2af22400ce..2f01b7d3db 100644 --- a/plugins/Clist_nicer/SRC/CLCButton.cpp +++ b/plugins/Clist_nicer/SRC/CLCButton.cpp @@ -49,6 +49,20 @@ static BTNS[] = static int g_index = -1; +static int getButtonIndex(HANDLE hButton) +{ + // nasty clutch. during the initial customization + // hButton isn't assigned into BNTS yet + if (g_index != -1) + return g_index; + + for (int i=0; i < SIZEOF(BTNS); i++) + if (BTNS[i].hButton == hButton) + return i; + + return -1; +} + static int InitDefaultButtons(WPARAM, LPARAM) { for (int i=0; i < SIZEOF(BTNS); i++ ) { @@ -502,11 +516,12 @@ static void CustomizeToolbar(HANDLE hButton, HWND hWnd, LPARAM) SetButtonAsCustom(hWnd); MButtonExtension *bct = (MButtonExtension*) GetWindowLongPtr(hWnd, 0); - if (g_index != -1) { // adding built-in button - bct->iCtrlID = BTNS[g_index].ctrlid; - if (BTNS[g_index].isAction) + int idx = getButtonIndex(hButton); + if (idx != -1) { // adding built-in button + bct->iCtrlID = BTNS[idx].ctrlid; + if (BTNS[idx].isAction) bct->bSendOnDown = TRUE; - if (!BTNS[g_index].isPush) + if (!BTNS[idx].isPush) bct->bIsPushBtn = TRUE; } } diff --git a/plugins/Clist_nicer/SRC/clui.cpp b/plugins/Clist_nicer/SRC/clui.cpp index 60560051bf..b25888de02 100644 --- a/plugins/Clist_nicer/SRC/clui.cpp +++ b/plugins/Clist_nicer/SRC/clui.cpp @@ -2062,10 +2062,9 @@ static INT_PTR CLN_ShowStatusMenu(WPARAM wParam, LPARAM lParam) void LoadCLUIModule(void) { - WNDCLASS wndclass; - HookEvent(ME_SYSTEM_MODULESLOADED, CluiModulesLoaded); + WNDCLASS wndclass; wndclass.style = 0; wndclass.lpfnWndProc = EventAreaWndProc; wndclass.cbClsExtra = 0; @@ -2078,6 +2077,8 @@ void LoadCLUIModule(void) wndclass.lpszClassName = _T("EventAreaClass"); RegisterClass(&wndclass); + SFL_RegisterWindowClass(); + oldhideoffline = cfg::getByte("CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT); cluiPos.left = cfg::getDword("CList", "x", 600); cluiPos.top = cfg::getDword("CList", "y", 200); @@ -2085,9 +2086,8 @@ void LoadCLUIModule(void) cluiPos.bottom = cfg::getDword("CList", "Height", 350); LoadExtraIconModule(); - SFL_RegisterWindowClass(); - LoadCLUIFramesModule(); + CreateServiceFunction("CLN/About", CLN_ShowAbout); CreateServiceFunction(MS_CLUI_SHOWMAINMENU, CLN_ShowMainMenu); CreateServiceFunction(MS_CLUI_SHOWSTATUSMENU, CLN_ShowStatusMenu); -- cgit v1.2.3