From dbbf4f80b0774a3880989458cd1519e29e959f54 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 26 Jan 2014 16:32:28 +0000 Subject: fix for toolbar's background drawing git-svn-id: http://svn.miranda-ng.org/main/trunk@7909 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_modern/src/modern_toolbar.cpp | 29 +++++++++++++++++++++++++++-- plugins/Clist_modern/src/version.h | 4 ++-- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/plugins/Clist_modern/src/modern_toolbar.cpp b/plugins/Clist_modern/src/modern_toolbar.cpp index e5d79e65f6..80c7d474b0 100644 --- a/plugins/Clist_modern/src/modern_toolbar.cpp +++ b/plugins/Clist_modern/src/modern_toolbar.cpp @@ -134,6 +134,28 @@ static int ehhToolBarSettingsChanged(WPARAM wParam, LPARAM lParam) return 0; } +static int ehhToolBarBackgroundSettingsChanged(WPARAM wParam, LPARAM lParam) +{ + if (tbdat.mtb_hBmpBackground) { + DeleteObject(tbdat.mtb_hBmpBackground); + tbdat.mtb_hBmpBackground = NULL; + } + if (g_CluiData.fDisableSkinEngine) { + DBVARIANT dbv; + tbdat.mtb_bkColour = sttGetColor("ToolBar", "BkColour", CLCDEFAULT_BKCOLOUR); + if (db_get_b(NULL, "ToolBar", "UseBitmap", CLCDEFAULT_USEBITMAP)) { + if (!db_get_s(NULL, "ToolBar", "BkBitmap", &dbv, DBVT_TCHAR)) { + tbdat.mtb_hBmpBackground = (HBITMAP)CallService(MS_UTILS_LOADBITMAP, 0, (LPARAM)dbv.ptszVal); + db_free(&dbv); + } + } + tbdat.mtb_useWinColors = db_get_b(NULL, "ToolBar", "UseWinColours", CLCDEFAULT_USEWINDOWSCOLOURS); + tbdat.mtb_backgroundBmpUse = db_get_b(NULL, "ToolBar", "BkBmpUse", CLCDEFAULT_BKBMPUSE); + } + PostMessage(pcli->hwndContactList, WM_SIZE, 0, 0); + return 0; +} + static BOOL sttDrawToolBarBackground(HWND hwnd, HDC hdc, RECT *rect, ModernToolbarCtrl* pMTBInfo) { BOOL bFloat = (GetParent(hwnd)!=pcli->hwndContactList); @@ -147,9 +169,11 @@ static BOOL sttDrawToolBarBackground(HWND hwnd, HDC hdc, RECT *rect, ModernToolb GetClientRect(hwnd,&rc); if (!(tbdat.mtb_backgroundBmpUse && tbdat.mtb_hBmpBackground) && tbdat.mtb_useWinColors) { + HRESULT hr = S_FALSE; if (xpt_IsThemed(pMTBInfo->mtbXPTheme)) - xpt_DrawTheme(pMTBInfo->mtbXPTheme, pMTBInfo->hWnd, hdc, 0, 0, &rc, &rc); - else { + hr = xpt_DrawTheme(pMTBInfo->mtbXPTheme, pMTBInfo->hWnd, hdc, 0, 0, &rc, &rc); + + if (hr == S_FALSE) { hbr = GetSysColorBrush(COLOR_3DFACE); FillRect(hdc, &rc, hbr); } @@ -337,6 +361,7 @@ static int Toolbar_ModulesLoaded(WPARAM, LPARAM) HRESULT ToolbarLoadModule() { + HookEvent(ME_BACKGROUNDCONFIG_CHANGED, ehhToolBarBackgroundSettingsChanged); HookEvent(ME_SYSTEM_MODULELOAD, Toolbar_ModuleReloaded); HookEvent(ME_SYSTEM_MODULESLOADED, Toolbar_ModulesLoaded); return S_OK; diff --git a/plugins/Clist_modern/src/version.h b/plugins/Clist_modern/src/version.h index 00a7fa0a79..d1f5bccbdf 100644 --- a/plugins/Clist_modern/src/version.h +++ b/plugins/Clist_modern/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 9 -#define __RELEASE_NUM 0 -#define __BUILD_NUM 11 +#define __RELEASE_NUM 0 +#define __BUILD_NUM 12 #include -- cgit v1.2.3