From 0976190894d653d5062f8ef6befabf46218f2d24 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 3 Oct 2016 16:48:12 +0000 Subject: - inlined helpers for fonts, colors & effects creation replaced with functions; - services for getting fonts, colors & effects removed; - some memory corruptions removed git-svn-id: http://svn.miranda-ng.org/main/trunk@17347 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/AutoShutdown/src/frame.cpp | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'plugins/AutoShutdown') diff --git a/plugins/AutoShutdown/src/frame.cpp b/plugins/AutoShutdown/src/frame.cpp index f89a183373..a450355f22 100644 --- a/plugins/AutoShutdown/src/frame.cpp +++ b/plugins/AutoShutdown/src/frame.cpp @@ -223,12 +223,18 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame, UINT msg, WPARAM wParam, LP case M_REFRESH_COLORS: COLORREF clrBar; - if (FontService_GetColor(L"Automatic shutdown", L"Progress bar", &clrBar)) + clrBar = Colour_GetW(L"Automatic shutdown", L"Progress bar"); + if (clrBar == -1) clrBar = GetDefaultColor(FRAMEELEMENT_BAR); - if (FontService_GetColor(L"Automatic shutdown", L"Background", &dat->clrBackground)) + + dat->clrBackground = Colour_GetW(L"Automatic shutdown", L"Background"); + if (dat->clrBackground == -1) dat->clrBackground = GetDefaultColor(FRAMEELEMENT_BKGRND); - if (dat->hbrBackground != NULL) DeleteObject(dat->hbrBackground); + + if (dat->hbrBackground != NULL) + DeleteObject(dat->hbrBackground); dat->hbrBackground = CreateSolidBrush(dat->clrBackground); + SendMessage(dat->hwndProgress, PBM_SETBARCOLOR, 0, (LPARAM)clrBar); SendMessage(dat->hwndProgress, PBM_SETBKCOLOR, 0, (LPARAM)dat->clrBackground); InvalidateRect(hwndFrame, NULL, TRUE); @@ -240,17 +246,9 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame, UINT msg, WPARAM wParam, LP case M_REFRESH_FONTS: { LOGFONT lf; - if (!FontService_GetFont(L"Automatic shutdown", L"Countdown on frame", &dat->clrText, &lf)) { - if (dat->hFont != NULL) DeleteObject(dat->hFont); - dat->hFont = CreateFontIndirect(&lf); - } - else { - dat->clrText = GetDefaultColor(FRAMEELEMENT_TEXT); - if (GetDefaultFont(&lf) != NULL) { - if (dat->hFont != NULL) DeleteObject(dat->hFont); - dat->hFont = CreateFontIndirect(&lf); - } - } + dat->clrText = Font_GetW(L"Automatic shutdown", L"Countdown on frame", &lf); + if (dat->hFont != NULL) DeleteObject(dat->hFont); + dat->hFont = CreateFontIndirect(&lf); } if (dat->hwndDesc != NULL) SendMessage(dat->hwndDesc, WM_SETFONT, (WPARAM)dat->hFont, FALSE); -- cgit v1.2.3