From f14fa326359b2c32fb1f370f90956e86b43d2e51 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 26 Jul 2014 14:36:34 +0000 Subject: a parameter added to pfnLoadClcOptions to prevent double options initialization git-svn-id: http://svn.miranda-ng.org/main/trunk@9945 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/clist/clc.cpp | 4 ++-- src/modules/clist/clc.h | 2 +- src/modules/clist/clcutils.cpp | 14 ++++++-------- 3 files changed, 9 insertions(+), 11 deletions(-) (limited to 'src/modules/clist') diff --git a/src/modules/clist/clc.cpp b/src/modules/clist/clc.cpp index 9f41284f6b..b0dfa19bb9 100644 --- a/src/modules/clist/clc.cpp +++ b/src/modules/clist/clc.cpp @@ -297,7 +297,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, dat->extraColumnSpacing = 20; dat->list.cl.increment = 30; dat->needsResort = 1; - cli.pfnLoadClcOptions(hwnd, dat); + cli.pfnLoadClcOptions(hwnd, dat, TRUE); if (!IsWindowVisible(hwnd)) SetTimer(hwnd, TIMERID_REBUILDAFTER, 10, NULL); else { @@ -320,7 +320,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, break; case INTM_RELOADOPTIONS: - cli.pfnLoadClcOptions(hwnd, dat); + cli.pfnLoadClcOptions(hwnd, dat, FALSE); cli.pfnSaveStateAndRebuildList(hwnd, dat); break; diff --git a/src/modules/clist/clc.h b/src/modules/clist/clc.h index acb5279007..ba8bee42d2 100644 --- a/src/modules/clist/clc.h +++ b/src/modules/clist/clc.h @@ -92,7 +92,7 @@ DWORD fnGetDefaultExStyle(void); void fnGetSetting(int i, LOGFONT* lf, COLORREF* colour); void fnGetDefaultFontSetting(int i, LOGFONT* lf, COLORREF* colour); void fnGetFontSetting(int i, LOGFONT* lf, COLORREF* colour); -void fnLoadClcOptions(HWND hwnd, struct ClcData *dat); +void fnLoadClcOptions(HWND hwnd, struct ClcData *dat, BOOL bFirst); void fnRecalculateGroupCheckboxes(HWND hwnd, struct ClcData *dat); void fnSetGroupChildCheckboxes(ClcGroup *group, int checked); void fnSetContactCheckboxes(ClcContact *cc, int checked); diff --git a/src/modules/clist/clcutils.cpp b/src/modules/clist/clcutils.cpp index 92ed6de693..f31aecedd0 100644 --- a/src/modules/clist/clcutils.cpp +++ b/src/modules/clist/clcutils.cpp @@ -715,7 +715,7 @@ void fnGetFontSetting(int i, LOGFONT* lf, COLORREF* colour) lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; } -void fnLoadClcOptions(HWND hwnd, struct ClcData *dat) +void fnLoadClcOptions(HWND hwnd, struct ClcData *dat, BOOL bFirst) { dat->rowHeight = db_get_b(NULL, "CLC", "RowHeight", CLCDEFAULT_ROWHEIGHT); @@ -751,17 +751,15 @@ void fnLoadClcOptions(HWND hwnd, struct ClcData *dat) dat->filterSearch = db_get_b(NULL, "CLC", "FilterSearch", 1); SendMessage(hwnd, INTM_SCROLLBARCHANGED, 0, 0); if (!dat->bkChanged) { - DBVARIANT dbv; 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)) { - if (!db_get_s(NULL, "CLC", "BkBitmap", &dbv)) { - dat->hBmpBackground = (HBITMAP) CallService(MS_UTILS_LOADBITMAP, 0, (LPARAM) dbv.pszVal); - mir_free(dbv.pszVal); - } + 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); } @@ -776,8 +774,8 @@ void fnLoadClcOptions(HWND hwnd, struct ClcData *dat) NMHDR hdr; hdr.code = CLN_OPTIONSCHANGED; hdr.hwndFrom = hwnd; - hdr.idFrom = GetDlgCtrlID(hwnd); - SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM) & hdr); + hdr.idFrom = (bFirst) ? 0 : GetDlgCtrlID(hwnd); + SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM)&hdr); SendMessage(hwnd, WM_SIZE, 0, 0); } -- cgit v1.2.3