From ed1449fa491e90197b78b64b52c70910f1736dd7 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 25 Jun 2012 15:05:30 +0000 Subject: dynamic fonts' options translation git-svn-id: http://svn.miranda-ng.org/main/trunk@633 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Alarms/alarm_win.cpp | 69 +++++++++++++++++++++----------------------- plugins/Alarms/frame.cpp | 63 +++++++++++++++------------------------- 2 files changed, 56 insertions(+), 76 deletions(-) (limited to 'plugins/Alarms') diff --git a/plugins/Alarms/alarm_win.cpp b/plugins/Alarms/alarm_win.cpp index 30b4dd31e5..11a29e42b5 100644 --- a/plugins/Alarms/alarm_win.cpp +++ b/plugins/Alarms/alarm_win.cpp @@ -370,42 +370,39 @@ int ReloadFonts(WPARAM wParam, LPARAM lParam) { return 0; } -int AlarmWinModulesLoaded(WPARAM wParam, LPARAM lParam) { - if (ServiceExists(MS_FONT_REGISTER)) { - title_font_id.cbSize = sizeof(FontID); - strcpy(title_font_id.group, Translate("Alarms")); - strcpy(title_font_id.name, Translate("Title")); - strcpy(title_font_id.dbSettingsGroup, MODULE); - strcpy(title_font_id.prefix, "FontTitle"); - title_font_id.flags = 0; - title_font_id.order = 0; - - CallService(MS_FONT_REGISTER, (WPARAM)&title_font_id, 0); - - window_font_id.cbSize = sizeof(FontID); - strcpy(window_font_id.group, Translate("Alarms")); - strcpy(window_font_id.name, Translate("Window")); - strcpy(window_font_id.dbSettingsGroup, MODULE); - strcpy(window_font_id.prefix, "FontWindow"); - window_font_id.flags = 0; - window_font_id.order = 1; - - CallService(MS_FONT_REGISTER, (WPARAM)&window_font_id, 0); - - bk_colour_id.cbSize = sizeof(ColourID); - strcpy(bk_colour_id.dbSettingsGroup, MODULE); - strcpy(bk_colour_id.group, Translate("Alarms")); - strcpy(bk_colour_id.name, Translate("Background")); - strcpy(bk_colour_id.setting, "BkColour"); - bk_colour_id.defcolour = GetSysColor(COLOR_3DFACE); - bk_colour_id.flags = 0; - bk_colour_id.order = 0; - - CallService(MS_COLOUR_REGISTER, (WPARAM)&bk_colour_id, 0); - - ReloadFonts(0, 0); - HookEvent(ME_FONT_RELOAD, ReloadFonts); - } +int AlarmWinModulesLoaded(WPARAM wParam, LPARAM lParam) +{ + title_font_id.cbSize = sizeof(FontID); + strcpy(title_font_id.group, Translate("Alarms")); + strcpy(title_font_id.name, Translate("Title")); + strcpy(title_font_id.dbSettingsGroup, MODULE); + strcpy(title_font_id.prefix, "FontTitle"); + title_font_id.flags = 0; + title_font_id.order = 0; + FontRegister(&title_font_id); + + window_font_id.cbSize = sizeof(FontID); + strcpy(window_font_id.group, Translate("Alarms")); + strcpy(window_font_id.name, Translate("Window")); + strcpy(window_font_id.dbSettingsGroup, MODULE); + strcpy(window_font_id.prefix, "FontWindow"); + window_font_id.flags = 0; + window_font_id.order = 1; + FontRegister(&window_font_id); + + bk_colour_id.cbSize = sizeof(ColourID); + strcpy(bk_colour_id.dbSettingsGroup, MODULE); + strcpy(bk_colour_id.group, Translate("Alarms")); + strcpy(bk_colour_id.name, Translate("Background")); + strcpy(bk_colour_id.setting, "BkColour"); + bk_colour_id.defcolour = GetSysColor(COLOR_3DFACE); + bk_colour_id.flags = 0; + bk_colour_id.order = 0; + + ColourRegister(&bk_colour_id); + + ReloadFonts(0, 0); + HookEvent(ME_FONT_RELOAD, ReloadFonts); return 0; } diff --git a/plugins/Alarms/frame.cpp b/plugins/Alarms/frame.cpp index 1e39c38c32..6ebb459026 100644 --- a/plugins/Alarms/frame.cpp +++ b/plugins/Alarms/frame.cpp @@ -603,47 +603,30 @@ int CreateFrame() SendMessage(hwnd_plugin, WMU_INITIALIZE, 0, 0); - if (ServiceExists(MS_FONT_REGISTER)) { - font_id.cbSize = sizeof(FontID); - strncpy(font_id.group, Translate("Frames"), sizeof(font_id.group)); - strncpy(font_id.name, Translate("Alarm Reminders"), sizeof(font_id.name)); - strncpy(font_id.dbSettingsGroup, MODULE, sizeof(font_id.dbSettingsGroup)); - strncpy(font_id.prefix, "Font", sizeof(font_id.prefix)); - font_id.order = 0; - CallService(MS_FONT_REGISTER, (WPARAM)&font_id, 0); - - framebk_colour_id.cbSize = sizeof(ColourID); - strcpy(framebk_colour_id.dbSettingsGroup, MODULE); - strcpy(framebk_colour_id.group, Translate("Frames")); - strcpy(framebk_colour_id.name, Translate("Alarm Reminders")); - strcpy(framebk_colour_id.setting, "clFrameBack"); - framebk_colour_id.defcolour = GetSysColor(COLOR_3DFACE); - framebk_colour_id.flags = 0; - framebk_colour_id.order = 0; - CallService(MS_COLOUR_REGISTER, (WPARAM)&framebk_colour_id, 0); - - LOGFONT log_font; - fontColour = CallService(MS_FONT_GET, (WPARAM)&font_id, (LPARAM)&log_font); - hFont = CreateFontIndirect(&log_font); - SendMessage(hwnd_list, WM_SETFONT, (WPARAM)hFont, (LPARAM)TRUE); - - HookEvent(ME_FONT_RELOAD, ReloadFont); - - } else { - LOGFONT lf; - SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(LOGFONT), &lf, FALSE); - lf.lfHeight = 10; + font_id.cbSize = sizeof(font_id); + strncpy(font_id.group, LPGEN("Frames"), sizeof(font_id.group)); + strncpy(font_id.name, LPGEN("Alarm Reminders"), sizeof(font_id.name)); + strncpy(font_id.dbSettingsGroup, MODULE, sizeof(font_id.dbSettingsGroup)); + strncpy(font_id.prefix, "Font", sizeof(font_id.prefix)); + font_id.order = 0; + FontRegister(&font_id); + + framebk_colour_id.cbSize = sizeof(ColourID); + strcpy(framebk_colour_id.dbSettingsGroup, MODULE); + strcpy(framebk_colour_id.group, LPGEN("Frames")); + strcpy(framebk_colour_id.name, LPGEN("Alarm Reminders")); + strcpy(framebk_colour_id.setting, "clFrameBack"); + framebk_colour_id.defcolour = GetSysColor(COLOR_3DFACE); + framebk_colour_id.flags = 0; + framebk_colour_id.order = 0; + ColourRegister(&framebk_colour_id); - HDC hdc = GetDC(0); - lf.lfHeight = -MulDiv(lf.lfHeight,GetDeviceCaps(hdc, LOGPIXELSY), 72); - ReleaseDC(0, hdc); - - hFont = CreateFontIndirect(&lf); - - //fontColour = GetSysColor(COLOR_WINDOWTEXT); - // match clist 'normal contact' colour if no font service - fontColour = (COLORREF)DBGetContactSettingDword(0, "CLC", "Font0Col", GetSysColor(COLOR_WINDOWTEXT)); - } + LOGFONT log_font; + fontColour = CallService(MS_FONT_GET, (WPARAM)&font_id, (LPARAM)&log_font); + hFont = CreateFontIndirect(&log_font); + SendMessage(hwnd_list, WM_SETFONT, (WPARAM)hFont, (LPARAM)TRUE); + + HookEvent(ME_FONT_RELOAD, ReloadFont); // create the brush used for the background in the absence of clist_modern skinning features - match clist bk_brush = CreateSolidBrush(DBGetContactSettingDword(0, "Alarm", "clFrameBack", GetSysColor(COLOR_3DFACE))); -- cgit v1.2.3