diff options
author | George Hazan <george.hazan@gmail.com> | 2014-07-26 16:08:22 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-07-26 16:08:22 +0000 |
commit | df19fbdf4e4dac7dbcd6735472eb66efd02850e2 (patch) | |
tree | efac1f410db8eae5683ee988a968a7101f3dcfad /src | |
parent | 08fa43d58030952c48bcb2a7179e18579662c301 (diff) |
all clists to inherit the kernel settings loading code
git-svn-id: http://svn.miranda-ng.org/main/trunk@9948 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r-- | src/core/stdclist/src/clcfonts.cpp | 40 | ||||
-rw-r--r-- | src/core/stdclist/src/commonheaders.h | 11 | ||||
-rw-r--r-- | src/core/stdclist/src/init.cpp | 6 | ||||
-rw-r--r-- | src/modules/clist/clcutils.cpp | 36 |
4 files changed, 47 insertions, 46 deletions
diff --git a/src/core/stdclist/src/clcfonts.cpp b/src/core/stdclist/src/clcfonts.cpp index 3951ca6cc4..593f37cb3b 100644 --- a/src/core/stdclist/src/clcfonts.cpp +++ b/src/core/stdclist/src/clcfonts.cpp @@ -112,3 +112,43 @@ void RegisterCListFonts() HookEvent(ME_FONT_RELOAD, FS_FontsChanged);
}
+
+void LoadClcOptions(HWND hwnd, struct ClcData *dat, BOOL bFirst)
+{
+ HDC hdc = GetDC(hwnd);
+ for (int i = 0; i <= FONTID_MAX; i++) {
+ if (!dat->fontInfo[i].changed)
+ DeleteObject(dat->fontInfo[i].hFont);
+
+ LOGFONT lf;
+ pcli->pfnGetFontSetting(i, &lf, &dat->fontInfo[i].colour);
+ lf.lfHeight = -MulDiv(lf.lfHeight, GetDeviceCaps(hdc, LOGPIXELSY), 72);
+
+ dat->fontInfo[i].hFont = CreateFontIndirect(&lf);
+ dat->fontInfo[i].changed = 0;
+
+ HFONT holdfont = (HFONT)SelectObject(hdc, dat->fontInfo[i].hFont);
+ SIZE fontSize;
+ GetTextExtentPoint32(hdc, _T("x"), 1, &fontSize);
+ SelectObject(hdc, holdfont);
+
+ dat->fontInfo[i].fontHeight = fontSize.cy;
+ }
+ 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/core/stdclist/src/commonheaders.h b/src/core/stdclist/src/commonheaders.h index 45828cfa1b..cc2dfa7d4a 100644 --- a/src/core/stdclist/src/commonheaders.h +++ b/src/core/stdclist/src/commonheaders.h @@ -64,13 +64,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // shared vars
extern HINSTANCE g_hInst;
+extern CLIST_INTERFACE coreCli;
-/* most free()'s are invalid when the code is executed from a dll, so this changes
- all the bad free()'s to good ones, however it's still incorrect code. The reasons for not
- changing them include:
-
- * db_free has a CallService() lookup
- * free() is executed in some large loops to do with clist creation of group data
- * easy search and replace
-
-*/
+void LoadClcOptions(HWND hwnd, struct ClcData *dat, BOOL bFirst);
diff --git a/src/core/stdclist/src/init.cpp b/src/core/stdclist/src/init.cpp index 7ec9cfebc4..f84aca0ff1 100644 --- a/src/core/stdclist/src/init.cpp +++ b/src/core/stdclist/src/init.cpp @@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "commonheaders.h"
HINSTANCE g_hInst = 0;
-CLIST_INTERFACE* pcli = NULL;
+CLIST_INTERFACE* pcli = NULL, coreCli;
HIMAGELIST himlCListClc = NULL;
int hLangpack;
@@ -135,8 +135,10 @@ extern "C" __declspec(dllexport) int CListInitialise() mir_getLP( &pluginInfo );
mir_getCLI();
+ coreCli = *pcli;
pcli->hInst = g_hInst;
pcli->pfnPaintClc = PaintClc;
+ pcli->pfnLoadClcOptions = LoadClcOptions;
CreateServiceFunction(MS_CLIST_GETSTATUSMODE, GetStatusMode);
@@ -162,4 +164,4 @@ extern "C" __declspec(dllexport) int Load(void) extern "C" __declspec(dllexport) int Unload(void)
{
return 0;
-}
\ No newline at end of file +}
diff --git a/src/modules/clist/clcutils.cpp b/src/modules/clist/clcutils.cpp index f31aecedd0..0a155c8e22 100644 --- a/src/modules/clist/clcutils.cpp +++ b/src/modules/clist/clcutils.cpp @@ -719,28 +719,6 @@ void fnLoadClcOptions(HWND hwnd, struct ClcData *dat, BOOL bFirst) {
dat->rowHeight = db_get_b(NULL, "CLC", "RowHeight", CLCDEFAULT_ROWHEIGHT);
- LOGFONT lf;
- SIZE fontSize;
-
- HDC hdc = GetDC(hwnd);
- for (int i=0; i <= FONTID_MAX; i++) {
- if (!dat->fontInfo[i].changed)
- DeleteObject(dat->fontInfo[i].hFont);
-
- cli.pfnGetFontSetting(i, &lf, &dat->fontInfo[i].colour);
- lf.lfHeight = -MulDiv(lf.lfHeight, GetDeviceCaps(hdc, LOGPIXELSY), 72);
-
- dat->fontInfo[i].hFont = CreateFontIndirect(&lf);
- dat->fontInfo[i].changed = 0;
-
- HFONT holdfont = (HFONT)SelectObject(hdc, dat->fontInfo[i].hFont);
- GetTextExtentPoint32(hdc, _T("x"), 1, &fontSize);
- SelectObject(hdc, holdfont);
-
- dat->fontInfo[i].fontHeight = fontSize.cy;
- }
- ReleaseDC(hwnd, hdc);
-
dat->leftMargin = db_get_b(NULL, "CLC", "LeftMargin", CLCDEFAULT_LEFTMARGIN);
dat->exStyle = db_get_dw(NULL, "CLC", "ExStyle", cli.pfnGetDefaultExStyle());
dat->scrollTime = db_get_w(NULL, "CLC", "ScrollTime", CLCDEFAULT_SCROLLTIME);
@@ -750,19 +728,7 @@ void fnLoadClcOptions(HWND hwnd, struct ClcData *dat, BOOL bFirst) dat->noVScrollbar = db_get_b(NULL, "CLC", "NoVScrollBar", 0);
dat->filterSearch = db_get_b(NULL, "CLC", "FilterSearch", 1);
SendMessage(hwnd, INTM_SCROLLBARCHANGED, 0, 0);
- 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);
- }
+
dat->greyoutFlags = db_get_dw(NULL, "CLC", "GreyoutFlags", CLCDEFAULT_GREYOUTFLAGS);
dat->offlineModes = db_get_dw(NULL, "CLC", "OfflineModes", CLCDEFAULT_OFFLINEMODES);
dat->selBkColour = db_get_dw(NULL, "CLC", "SelBkColour", CLCDEFAULT_SELBKCOLOUR);
|