From e52c300401ddd8188a9fb9db307e369428cbeb19 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 26 Jul 2014 17:02:28 +0000 Subject: - unified bkChanged processing; - clist background bitmap processing also moved to the core git-svn-id: http://svn.miranda-ng.org/main/trunk@9950 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_modern/src/modern_clc.cpp | 2 +- plugins/Clist_modern/src/modern_clcpaint.cpp | 2 -- plugins/Clist_modern/src/modern_clcutils.cpp | 12 ++------ plugins/Clist_nicer/src/clcutils.cpp | 41 ++++++++++++++-------------- src/core/stdclist/src/clcfonts.cpp | 14 ---------- src/modules/clist/clc.cpp | 2 +- src/modules/clist/clcmsgs.cpp | 6 ++-- src/modules/clist/clcutils.cpp | 14 ++++++++++ 8 files changed, 42 insertions(+), 51 deletions(-) diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index f131f67697..bd733b3001 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -1410,7 +1410,7 @@ static LRESULT clcOnDestroy(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LP DeleteObject(dat->hMenuBackground); dat->hMenuBackground = NULL; } - if (!dat->bkChanged && dat->hBmpBackground) { + if (dat->hBmpBackground) { DeleteObject(dat->hBmpBackground); dat->hBmpBackground = NULL; } diff --git a/plugins/Clist_modern/src/modern_clcpaint.cpp b/plugins/Clist_modern/src/modern_clcpaint.cpp index 14c565bb3e..168ef2b9fa 100644 --- a/plugins/Clist_modern/src/modern_clcpaint.cpp +++ b/plugins/Clist_modern/src/modern_clcpaint.cpp @@ -1902,9 +1902,7 @@ void CLCPaint::_DrawLines( HWND hWnd, ClcData *dat, HDC hdc, int paintMode, RECT if ( paintMode&DM_GREYALTERNATE && line_num&1 ) { if ( paintMode&DM_CONTROL || dat->bkChanged ) - { FillRect( pc.hdcMem, &row_rc, pc.hBrushAlternateGrey ); - } else SkinDrawGlyph( pc.hdcMem, &row_rc, rcPaint, "CL,ID=GreyAlternate"); } diff --git a/plugins/Clist_modern/src/modern_clcutils.cpp b/plugins/Clist_modern/src/modern_clcutils.cpp index 4d9ce604f9..ac4894f5dc 100644 --- a/plugins/Clist_modern/src/modern_clcutils.cpp +++ b/plugins/Clist_modern/src/modern_clcutils.cpp @@ -665,16 +665,6 @@ void LoadCLCOptions(HWND hwnd, ClcData *dat, BOOL bFirst) if (dat->hMenuBackground) { DeleteObject(dat->hMenuBackground); dat->hMenuBackground = NULL; } if (g_CluiData.fDisableSkinEngine) { - if (!dat->bkChanged) { - dat->bkColour = sttGetColor("CLC", "BkColour", GetSysColor(COLOR_3DFACE)); - - if (db_get_b(NULL, "CLC", "UseBitmap", CLCDEFAULT_USEBITMAP)) { - ptrA szBitmap(db_get_sa(NULL, "CLC", "BkBitmap")); - if (szBitmap) - dat->hBmpBackground = (HBITMAP)CallService(MS_UTILS_LOADBITMAP, 0, szBitmap); - } - dat->backgroundBmpUse = db_get_w(NULL, "CLC", "BkBmpUse", CLCDEFAULT_BKBMPUSE); - } dat->MenuBkColor = sttGetColor("Menu", "BkColour", CLCDEFAULT_BKCOLOUR); dat->MenuBkHiColor = sttGetColor("Menu", "SelBkColour", CLCDEFAULT_SELBKCOLOUR); @@ -709,6 +699,8 @@ void LoadCLCOptions(HWND hwnd, ClcData *dat, BOOL bFirst) IvalidateDisplayNameCache(16); corecli.pfnLoadClcOptions(hwnd, dat, bFirst); + + dat->useWindowsColours = false; // because it's missing in the options } int ExpandMetaContact(HWND hwnd, ClcContact *contact, ClcData *dat, BOOL bExpand) diff --git a/plugins/Clist_nicer/src/clcutils.cpp b/plugins/Clist_nicer/src/clcutils.cpp index 80bb802e79..632b9e0774 100644 --- a/plugins/Clist_nicer/src/clcutils.cpp +++ b/plugins/Clist_nicer/src/clcutils.cpp @@ -572,26 +572,29 @@ void LoadClcOptions(HWND hwnd, struct ClcData *dat, BOOL bFirst) dat->bkColour = cfg::getByte("CLC", "UseWinColours", CLCDEFAULT_USEWINDOWSCOLOURS) ? GetSysColor(COLOR_3DFACE) : cfg::getDword("CLC", "BkColour", CLCDEFAULT_BKCOLOUR); - dat->bkChanged = 0; - if (cfg::dat.hBrushCLCBk) - DeleteObject(cfg::dat.hBrushCLCBk); - cfg::dat.hBrushCLCBk = CreateSolidBrush(dat->bkColour); - if (dat->hBmpBackground) { - if (cfg::dat.hdcPic) { - SelectObject(cfg::dat.hdcPic, cfg::dat.hbmPicOld); - DeleteDC(cfg::dat.hdcPic); - cfg::dat.hdcPic = 0; - cfg::dat.hbmPicOld = 0; + coreCli.pfnLoadClcOptions(hwnd, dat, bFirst); + + if (!dat->bkChanged) { + if (cfg::dat.hBrushCLCBk) + DeleteObject(cfg::dat.hBrushCLCBk); + cfg::dat.hBrushCLCBk = CreateSolidBrush(dat->bkColour); + if (dat->hBmpBackground) { + if (cfg::dat.hdcPic) { + SelectObject(cfg::dat.hdcPic, cfg::dat.hbmPicOld); + DeleteDC(cfg::dat.hdcPic); + cfg::dat.hdcPic = 0; + cfg::dat.hbmPicOld = 0; + } } - } - cfg::dat.bmpBackground = dat->hBmpBackground; - if (cfg::dat.bmpBackground) { - HDC hdcThis = GetDC(pcli->hwndContactList); - GetObject(cfg::dat.bmpBackground, sizeof(cfg::dat.bminfoBg), &(cfg::dat.bminfoBg)); - cfg::dat.hdcPic = CreateCompatibleDC(hdcThis); - cfg::dat.hbmPicOld = reinterpret_cast(SelectObject(cfg::dat.hdcPic, cfg::dat.bmpBackground)); - ReleaseDC(pcli->hwndContactList, hdcThis); + cfg::dat.bmpBackground = dat->hBmpBackground; + if (cfg::dat.bmpBackground) { + HDC hdcThis = GetDC(pcli->hwndContactList); + GetObject(cfg::dat.bmpBackground, sizeof(cfg::dat.bminfoBg), &(cfg::dat.bminfoBg)); + cfg::dat.hdcPic = CreateCompatibleDC(hdcThis); + cfg::dat.hbmPicOld = reinterpret_cast(SelectObject(cfg::dat.hdcPic, cfg::dat.bmpBackground)); + ReleaseDC(pcli->hwndContactList, hdcThis); + } } if (cfg::getByte("CLCExt", "EXBK_FillWallpaper", 0)) { @@ -616,6 +619,4 @@ void LoadClcOptions(HWND hwnd, struct ClcData *dat, BOOL bFirst) ReleaseDC(pcli->hwndContactList, hdcThis); } } - - coreCli.pfnLoadClcOptions(hwnd, dat, bFirst); } diff --git a/src/core/stdclist/src/clcfonts.cpp b/src/core/stdclist/src/clcfonts.cpp index 593f37cb3b..ceed5e591d 100644 --- a/src/core/stdclist/src/clcfonts.cpp +++ b/src/core/stdclist/src/clcfonts.cpp @@ -136,19 +136,5 @@ void LoadClcOptions(HWND hwnd, struct ClcData *dat, BOOL bFirst) } ReleaseDC(hwnd, hdc); - if (!dat->bkChanged) { - dat->bkColour = db_get_dw(NULL, "CLC", "BkColour", CLCDEFAULT_BKCOLOUR); - if (dat->hBmpBackground) { - DeleteObject(dat->hBmpBackground); - dat->hBmpBackground = NULL; - } - if (db_get_b(NULL, "CLC", "UseBitmap", CLCDEFAULT_USEBITMAP)) { - ptrA szBitmap(db_get_sa(NULL, "CLC", "BkBitmap")); - if (szBitmap) - dat->hBmpBackground = (HBITMAP)CallService(MS_UTILS_LOADBITMAP, 0, szBitmap); - } - dat->backgroundBmpUse = db_get_w(NULL, "CLC", "BkBmpUse", CLCDEFAULT_BKBMPUSE); - } - coreCli.pfnLoadClcOptions(hwnd, dat, bFirst); } diff --git a/src/modules/clist/clc.cpp b/src/modules/clist/clc.cpp index b0dfa19bb9..e6914a6089 100644 --- a/src/modules/clist/clc.cpp +++ b/src/modules/clist/clc.cpp @@ -1323,7 +1323,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, ImageList_Destroy(dat->himlHighlight); if (dat->hwndRenameEdit) DestroyWindow(dat->hwndRenameEdit); - if (!dat->bkChanged && dat->hBmpBackground) + if (dat->hBmpBackground) DeleteObject(dat->hBmpBackground); cli.pfnFreeGroup(&dat->list); mir_free(dat); diff --git a/src/modules/clist/clcmsgs.cpp b/src/modules/clist/clcmsgs.cpp index 96738ab866..a3d477c871 100644 --- a/src/modules/clist/clcmsgs.cpp +++ b/src/modules/clist/clcmsgs.cpp @@ -331,18 +331,18 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR } case CLM_SETBKBITMAP: - if (!dat->bkChanged && dat->hBmpBackground) { + if (dat->hBmpBackground) { DeleteObject(dat->hBmpBackground); dat->hBmpBackground = NULL; } - dat->hBmpBackground = (HBITMAP) lParam; + dat->hBmpBackground = (HBITMAP)lParam; dat->backgroundBmpUse = wParam; dat->bkChanged = 1; cli.pfnInvalidateRect(hwnd, NULL, FALSE); break; case CLM_SETBKCOLOR: - if (!dat->bkChanged && dat->hBmpBackground) { + if (dat->hBmpBackground) { DeleteObject(dat->hBmpBackground); dat->hBmpBackground = NULL; } diff --git a/src/modules/clist/clcutils.cpp b/src/modules/clist/clcutils.cpp index 0a155c8e22..87222c1ce1 100644 --- a/src/modules/clist/clcutils.cpp +++ b/src/modules/clist/clcutils.cpp @@ -737,6 +737,20 @@ void fnLoadClcOptions(HWND hwnd, struct ClcData *dat, BOOL bFirst) dat->quickSearchColour = db_get_dw(NULL, "CLC", "QuickSearchColour", CLCDEFAULT_QUICKSEARCHCOLOUR); dat->useWindowsColours = db_get_b(NULL, "CLC", "UseWinColours", CLCDEFAULT_USEWINDOWSCOLOURS); + if (!dat->bkChanged) { + dat->bkColour = db_get_dw(NULL, "CLC", "BkColour", CLCDEFAULT_BKCOLOUR); + if (dat->hBmpBackground) { + DeleteObject(dat->hBmpBackground); + dat->hBmpBackground = NULL; + } + if (db_get_b(NULL, "CLC", "UseBitmap", CLCDEFAULT_USEBITMAP)) { + ptrT tszBitmap(db_get_tsa(NULL, "CLC", "BkBitmap")); + if (tszBitmap) + dat->hBmpBackground = (HBITMAP)CallService(MS_UTILS_LOADBITMAPT, 0, tszBitmap); + } + dat->backgroundBmpUse = db_get_w(NULL, "CLC", "BkBmpUse", CLCDEFAULT_BKBMPUSE); + } + NMHDR hdr; hdr.code = CLN_OPTIONSCHANGED; hdr.hwndFrom = hwnd; -- cgit v1.2.3