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/Alarms/src/alarm_win.cpp | 12 ++++---- plugins/Alarms/src/frame.cpp | 16 +++++----- plugins/AutoShutdown/src/frame.cpp | 26 ++++++++-------- plugins/BASS_interface/src/Main.cpp | 8 ++--- plugins/BasicHistory/src/Options.cpp | 16 +++------- plugins/Clist_modern/src/modern_clcopts.cpp | 13 +++----- plugins/Clist_nicer/src/clui.cpp | 12 ++++---- plugins/Console/src/Console.cpp | 22 +++----------- plugins/FavContacts/src/services.cpp | 36 ++++++++-------------- plugins/FloatingContacts/src/main.cpp | 2 +- plugins/HistoryPlusPlus/hpp_options.pas | 6 +--- plugins/MyDetails/src/frame.cpp | 12 ++++---- plugins/NotesAndReminders/src/options.cpp | 11 ++----- plugins/Ping/src/pingthread.cpp | 8 ++--- plugins/Popup/src/font.cpp | 44 +++++++++------------------ plugins/Popup/src/notifications.cpp | 19 ++++-------- plugins/Popup/src/services.cpp | 4 +-- plugins/QuickSearch/i_ok.inc | 6 +--- plugins/QuickSearch/sr_frame.pas | 7 +---- plugins/Scriver/src/msgoptions.cpp | 4 +-- plugins/SmileyAdd/src/main.cpp | 2 +- plugins/TabSRMM/src/chat/options.cpp | 14 ++++----- plugins/TipperYM/src/tipper.cpp | 39 +++++++++++++----------- plugins/TooltipNotify/src/TooltipNotify.cpp | 15 +++------ plugins/TrafficCounter/src/TrafficCounter.cpp | 12 +++----- plugins/Weather/src/weather_mwin.cpp | 18 +++-------- plugins/YAPP/src/yapp.cpp | 28 ++++++++--------- plugins/mRadio/rframeapi.pas | 6 +--- 28 files changed, 158 insertions(+), 260 deletions(-) (limited to 'plugins') diff --git a/plugins/Alarms/src/alarm_win.cpp b/plugins/Alarms/src/alarm_win.cpp index 5dfe6730cb..451075796e 100644 --- a/plugins/Alarms/src/alarm_win.cpp +++ b/plugins/Alarms/src/alarm_win.cpp @@ -331,15 +331,15 @@ INT_PTR CALLBACK DlgProcAlarm(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar int ReloadFonts(WPARAM, LPARAM) { LOGFONT log_font; - title_font_colour = CallService(MS_FONT_GETW, (WPARAM)&title_font_id, (LPARAM)&log_font); + title_font_colour = Font_GetW(title_font_id, &log_font); DeleteObject(hTitleFont); hTitleFont = CreateFontIndirect(&log_font); - window_font_colour = CallService(MS_FONT_GETW, (WPARAM)&window_font_id, (LPARAM)&log_font); + window_font_colour = Font_GetW(window_font_id, &log_font); DeleteObject(hWindowFont); hWindowFont = CreateFontIndirect(&log_font); - COLORREF bkCol = CallService(MS_COLOUR_GETW, (WPARAM)&bk_colour_id, 0); + COLORREF bkCol = Colour_GetW(bk_colour_id); DeleteObject(hBackgroundBrush); hBackgroundBrush = CreateSolidBrush(bkCol); @@ -358,7 +358,7 @@ int AlarmWinModulesLoaded(WPARAM, LPARAM) mir_wstrcpy(title_font_id.backgroundName, LPGENW("Background")); title_font_id.flags = 0; title_font_id.order = 0; - FontRegisterW(&title_font_id); + Font_RegisterW(&title_font_id); window_font_id.cbSize = sizeof(FontIDW); mir_wstrcpy(window_font_id.group, LPGENW("Alarms")); @@ -369,7 +369,7 @@ int AlarmWinModulesLoaded(WPARAM, LPARAM) mir_wstrcpy(window_font_id.backgroundName, LPGENW("Background")); window_font_id.flags = 0; window_font_id.order = 1; - FontRegisterW(&window_font_id); + Font_RegisterW(&window_font_id); bk_colour_id.cbSize = sizeof(ColourIDW); mir_strcpy(bk_colour_id.dbSettingsGroup, MODULE); @@ -380,7 +380,7 @@ int AlarmWinModulesLoaded(WPARAM, LPARAM) bk_colour_id.flags = 0; bk_colour_id.order = 0; - ColourRegisterW(&bk_colour_id); + Colour_RegisterW(&bk_colour_id); ReloadFonts(0, 0); HookEvent(ME_FONT_RELOAD, ReloadFonts); diff --git a/plugins/Alarms/src/frame.cpp b/plugins/Alarms/src/frame.cpp index da831a8fb6..41824701af 100644 --- a/plugins/Alarms/src/frame.cpp +++ b/plugins/Alarms/src/frame.cpp @@ -433,9 +433,9 @@ int ReloadFont(WPARAM, LPARAM) { DeleteObject(hFont); - LOGFONT log_font; - fontColour = CallService(MS_FONT_GET, (WPARAM)&font_id, (LPARAM)&log_font); - hFont = CreateFontIndirect(&log_font); + LOGFONTA log_font; + fontColour = Font_Get(font_id, &log_font); + hFont = CreateFontIndirectA(&log_font); SendMessage(hwnd_list, WM_SETFONT, (WPARAM)hFont, TRUE); DeleteObject(bk_brush); @@ -568,7 +568,7 @@ int CreateFrame() 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); + Font_Register(&font_id); framebk_colour_id.cbSize = sizeof(ColourID); mir_strcpy(framebk_colour_id.dbSettingsGroup, MODULE); @@ -578,11 +578,11 @@ int CreateFrame() framebk_colour_id.defcolour = GetSysColor(COLOR_3DFACE); framebk_colour_id.flags = 0; framebk_colour_id.order = 0; - ColourRegister(&framebk_colour_id); + Colour_Register(&framebk_colour_id); - LOGFONT log_font; - fontColour = CallService(MS_FONT_GET, (WPARAM)&font_id, (LPARAM)&log_font); - hFont = CreateFontIndirect(&log_font); + LOGFONTA log_font; + fontColour = Font_Get(font_id, &log_font); + hFont = CreateFontIndirectA(&log_font); SendMessage(hwnd_list, WM_SETFONT, (WPARAM)hFont, TRUE); HookEvent(ME_FONT_RELOAD, ReloadFont); 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); diff --git a/plugins/BASS_interface/src/Main.cpp b/plugins/BASS_interface/src/Main.cpp index 3a9cccf74c..681eda2a05 100644 --- a/plugins/BASS_interface/src/Main.cpp +++ b/plugins/BASS_interface/src/Main.cpp @@ -424,11 +424,7 @@ static LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR int ReloadColors(WPARAM, LPARAM) { - ColourIDW colourid = { 0 }; - colourid.cbSize = sizeof(colourid); - mir_wstrcpy(colourid.group, _A2W(ModuleName)); - mir_wstrcpy(colourid.name, LPGENW("Frame background")); - clBack = CallService(MS_COLOUR_GETW, (WPARAM)&colourid, 0); + clBack = Colour_GetW(_A2W(ModuleName), LPGENW("Frame background")); if (hBkgBrush) DeleteObject(hBkgBrush); @@ -474,7 +470,7 @@ void CreateFrame() wcscpy_s(colourid.group, _A2W(ModuleName)); colourid.defcolour = GetSysColor(COLOR_3DFACE); - ColourRegisterW(&colourid); + Colour_RegisterW(&colourid); HookEvent(ME_COLOUR_RELOAD, ReloadColors); ReloadColors(0, 0); diff --git a/plugins/BasicHistory/src/Options.cpp b/plugins/BasicHistory/src/Options.cpp index 6b1bf7ba1d..3e6fd6d8de 100644 --- a/plugins/BasicHistory/src/Options.cpp +++ b/plugins/BasicHistory/src/Options.cpp @@ -255,7 +255,7 @@ void Options::Load(void) wcsncpy_s(fid.name, g_FontOptionsList[i].szDescr, _TRUNCATE); wcsncpy_s(fid.backgroundName, g_FontOptionsList[i].szBackgroundName, _TRUNCATE); fid.flags = FIDF_DEFAULTVALID | FIDF_CLASSGENERAL | g_FontOptionsList[i].flags; - FontRegisterW(&fid); + Font_RegisterW(&fid); } strncpy_s(cid.dbSettingsGroup, "BasicHistory_Fonts", _TRUNCATE); @@ -265,7 +265,7 @@ void Options::Load(void) mir_snprintf(cid.setting, _countof(cid.setting), "Color%d", i); cid.order = i; cid.defcolour = g_ColorOptionsList[i].def; - ColourRegisterW(&cid); + Colour_RegisterW(&cid); } hid.dwFlags = HKD_UNICODE; @@ -412,20 +412,12 @@ void Options::Load(void) COLORREF Options::GetFont(Fonts fontId, PLOGFONT font) { - FontIDW fid = { 0 }; - fid.cbSize = sizeof(FontIDW); - wcsncpy_s(fid.group, LPGENW("History"), _TRUNCATE); - wcsncpy_s(fid.name, g_FontOptionsList[fontId].szDescr, _TRUNCATE); - return (COLORREF)CallService(MS_FONT_GETW, (WPARAM)&fid, (LPARAM)font); + return Font_GetW(LPGENW("History"), g_FontOptionsList[fontId].szDescr, font); } COLORREF Options::GetColor(Colors colorId) { - ColourIDW cid = { 0 }; - cid.cbSize = sizeof(ColourIDW); - wcsncpy_s(cid.group, LPGENW("History"), _TRUNCATE); - wcsncpy_s(cid.name, g_ColorOptionsList[colorId].tszName, _TRUNCATE); - return (COLORREF)CallService(MS_COLOUR_GETW, (WPARAM)&cid, NULL); + return Colour_GetW(LPGENW("History"), g_ColorOptionsList[colorId].tszName); } void Options::Save() diff --git a/plugins/Clist_modern/src/modern_clcopts.cpp b/plugins/Clist_modern/src/modern_clcopts.cpp index f3c9ae692a..a7ab4ba676 100644 --- a/plugins/Clist_modern/src/modern_clcopts.cpp +++ b/plugins/Clist_modern/src/modern_clcopts.cpp @@ -150,7 +150,7 @@ void RegisterCLUIFonts(void) fontid.deffontsettings.style = fontOptionsList[i].defStyle; mir_wstrncpy(fontid.deffontsettings.szFace, fontOptionsList[i].szDefFace, _countof(fontid.deffontsettings.szFace)); - FontRegisterW(&fontid); + Font_RegisterW(&fontid); mir_wstrncpy(effectid.group, fontOptionsList[i].szGroup, _countof(effectid.group)); mir_wstrncpy(effectid.name, fontOptionsList[i].szDescr, _countof(effectid.name)); @@ -162,7 +162,7 @@ void RegisterCLUIFonts(void) effectid.defeffect.baseColour = fontOptionsList[i].defeffect.baseColour; effectid.defeffect.secondaryColour = fontOptionsList[i].defeffect.secondaryColour; - EffectRegisterW(&effectid); + Effect_RegisterW(&effectid); } ColourIDW colourid = { 0 }; @@ -175,7 +175,7 @@ void RegisterCLUIFonts(void) mir_strncpy(colourid.dbSettingsGroup, colourOptionsList[i].chGroup, _countof(colourid.dbSettingsGroup)); colourid.defcolour = colourOptionsList[i].defColour; colourid.order = i + 1; - ColourRegisterW(&colourid); + Colour_RegisterW(&colourid); } registered = true; } @@ -203,12 +203,7 @@ void GetFontSetting(int i, LOGFONT *lf, COLORREF *colour, BYTE *effect, COLORREF if (index == _countof(fontOptionsList)) return; - FontIDW fontid = { 0 }; - fontid.cbSize = sizeof(fontid); - mir_wstrncpy(fontid.group, fontOptionsList[index].szGroup, _countof(fontid.group)); - mir_wstrncpy(fontid.name, fontOptionsList[index].szDescr, _countof(fontid.name)); - - COLORREF col = CallService(MS_FONT_GETW, (WPARAM)&fontid, (LPARAM)lf); + COLORREF col = Font_GetW(fontOptionsList[index].szGroup, fontOptionsList[index].szDescr, lf); if (colour) *colour = col; diff --git a/plugins/Clist_nicer/src/clui.cpp b/plugins/Clist_nicer/src/clui.cpp index ca49c0c4a1..16b1e83f60 100644 --- a/plugins/Clist_nicer/src/clui.cpp +++ b/plugins/Clist_nicer/src/clui.cpp @@ -1999,7 +1999,7 @@ void FS_RegisterFonts() mir_snprintf(idstr, "Font%d", i); strncpy(fid.prefix, idstr, _countof(fid.prefix)); fid.order = i; - FontRegisterW(&fid); + Font_RegisterW(&fid); } ReleaseDC(NULL, hdc); @@ -2013,30 +2013,30 @@ void FS_RegisterFonts() wcsncpy(colourid.name, LPGENW("Background"), _countof(colourid.name)); wcsncpy(colourid.group, LPGENW("Contact list"), _countof(colourid.group)); colourid.defcolour = CLCDEFAULT_BKCOLOUR; - ColourRegisterW(&colourid); + Colour_RegisterW(&colourid); strncpy(colourid.setting, "SelTextColour", sizeof(colourid.setting)); wcsncpy(colourid.name, LPGENW("Selected text"), _countof(colourid.name)); colourid.order = 1; colourid.defcolour = CLCDEFAULT_SELTEXTCOLOUR; - ColourRegisterW(&colourid); + Colour_RegisterW(&colourid); strncpy(colourid.setting, "HotTextColour", sizeof(colourid.setting)); wcsncpy(colourid.name, LPGENW("Hottrack text"), _countof(colourid.name)); colourid.order = 1; colourid.defcolour = CLCDEFAULT_HOTTEXTCOLOUR; - ColourRegisterW(&colourid); + Colour_RegisterW(&colourid); strncpy(colourid.setting, "QuickSearchColour", sizeof(colourid.setting)); wcsncpy(colourid.name, LPGENW("Quicksearch text"), _countof(colourid.name)); colourid.order = 1; colourid.defcolour = CLCDEFAULT_QUICKSEARCHCOLOUR; - ColourRegisterW(&colourid); + Colour_RegisterW(&colourid); strncpy(colourid.dbSettingsGroup, "CLUI", sizeof(colourid.dbSettingsGroup)); strncpy(colourid.setting, "clr_frameborder", sizeof(colourid.setting)); wcsncpy(colourid.name, LPGENW("Embedded frames border"), _countof(colourid.name)); colourid.order = 1; colourid.defcolour = RGB(40, 40, 40); - ColourRegisterW(&colourid); + Colour_RegisterW(&colourid); } diff --git a/plugins/Console/src/Console.cpp b/plugins/Console/src/Console.cpp index 3a2c58b4e8..4fc02875fc 100644 --- a/plugins/Console/src/Console.cpp +++ b/plugins/Console/src/Console.cpp @@ -1071,15 +1071,7 @@ static int OptInit(WPARAM wParam, LPARAM) static int OnColourChange(WPARAM, LPARAM) { if (hwndConsole) { - ColourID cid = { 0 }; - - cid.cbSize = sizeof(cid); - mir_strcpy(cid.group, "Console"); - mir_strcpy(cid.name, "Background"); - mir_strcpy(cid.dbSettingsGroup, "Console"); - mir_strcpy(cid.setting, "BgColor"); - - colBackground = (COLORREF)CallService(MS_COLOUR_GET, (WPARAM)&cid, 0); + colBackground = Colour_Get("Console", "Background"); if (colBackground != -1) SendMessage(hwndConsole, HM_SETCOLOR, (WPARAM)hfLogFont, (LPARAM)colBackground); } @@ -1092,13 +1084,7 @@ static int OnFontChange(WPARAM, LPARAM) if (hwndConsole) { HFONT hf = NULL; LOGFONT LogFont = { 0 }; - FontIDW fid = { 0 }; - fid.cbSize = sizeof(fid); - - mir_wstrncpy(fid.group, LPGENW("Console"), _countof(fid.group)); - mir_wstrncpy(fid.name, LPGENW("Text"), _countof(fid.name)); - - colLogFont = (COLORREF)CallService(MS_FONT_GETW, (WPARAM)&fid, (LPARAM)&LogFont); + colLogFont = Font_GetW(L"Console", L"Text", &LogFont); if (LogFont.lfHeight != 0) { hf = CreateFontIndirect(&LogFont); @@ -1131,7 +1117,7 @@ static int OnSystemModulesLoaded(WPARAM, LPARAM) fid.deffontsettings.size = 10; fid.deffontsettings.style = 0; mir_wstrncpy(fid.deffontsettings.szFace, L"Courier", _countof(fid.deffontsettings.szFace)); - FontRegisterW(&fid); + Font_RegisterW(&fid); HookEvent(ME_FONT_RELOAD, OnFontChange); @@ -1142,7 +1128,7 @@ static int OnSystemModulesLoaded(WPARAM, LPARAM) mir_strncpy(cid.dbSettingsGroup, "Console", _countof(cid.dbSettingsGroup)); mir_strncpy(cid.setting, "BgColor", _countof(cid.setting)); cid.defcolour = RGB(255, 255, 255); - ColourRegisterW(&cid); + Colour_RegisterW(&cid); HookEvent(ME_COLOUR_RELOAD, OnColourChange); diff --git a/plugins/FavContacts/src/services.cpp b/plugins/FavContacts/src/services.cpp index acfad2a213..c4e450a1d8 100644 --- a/plugins/FavContacts/src/services.cpp +++ b/plugins/FavContacts/src/services.cpp @@ -127,29 +127,17 @@ int ProcessReloadFonts(WPARAM, LPARAM) if (g_Options.hfntSecond) DeleteObject(g_Options.hfntSecond); LOGFONT lf = { 0 }; - FontIDW fontid = { sizeof(fontid) }; - mir_wstrcpy(fontid.group, LPGENW("Favorite Contacts")); - mir_wstrcpy(fontid.name, LPGENW("Contact name")); - g_Options.clLine1 = CallService(MS_FONT_GETW, (WPARAM)&fontid, (LPARAM)&lf); + g_Options.clLine1 = Font_GetW(LPGENW("Favorite Contacts"), LPGENW("Contact name"), &lf); g_Options.hfntName = CreateFontIndirect(&lf); - mir_wstrcpy(fontid.name, LPGENW("Second line")); - g_Options.clLine2 = CallService(MS_FONT_GETW, (WPARAM)&fontid, (LPARAM)&lf); + g_Options.clLine2 = Font_GetW(LPGENW("Favorite Contacts"), LPGENW("Second line"), &lf); g_Options.hfntSecond = CreateFontIndirect(&lf); - mir_wstrcpy(fontid.name, LPGENW("Selected contact name (color)")); - g_Options.clLine1Sel = CallService(MS_FONT_GETW, (WPARAM)&fontid, (LPARAM)&lf); - - mir_wstrcpy(fontid.name, LPGENW("Selected second line (color)")); - g_Options.clLine2Sel = CallService(MS_FONT_GETW, (WPARAM)&fontid, (LPARAM)&lf); - - ColourIDW colourid = { sizeof(colourid) }; - mir_wstrcpy(colourid.group, LPGENW("Favorite Contacts")); - mir_wstrcpy(colourid.name, LPGENW("Background")); - g_Options.clBack = CallService(MS_COLOUR_GETW, (WPARAM)&colourid, (LPARAM)&lf); + g_Options.clLine1Sel = Font_GetW(LPGENW("Favorite Contacts"), LPGENW("Selected contact name (color)"), &lf); + g_Options.clLine2Sel = Font_GetW(LPGENW("Favorite Contacts"), LPGENW("Selected second line (color)"), &lf); - mir_wstrcpy(colourid.name, LPGENW("Selected background")); - g_Options.clBackSel = CallService(MS_COLOUR_GETW, (WPARAM)&colourid, (LPARAM)&lf); + g_Options.clBack = Colour_GetW(LPGENW("Favorite Contacts"), LPGENW("Background")); + g_Options.clBackSel = Colour_GetW(LPGENW("Favorite Contacts"), LPGENW("Selected background")); return 0; } @@ -186,13 +174,13 @@ int ProcessModulesLoaded(WPARAM, LPARAM) mir_strcpy(fontid.prefix, "fntName"); fontid.deffontsettings.colour = GetSysColor(COLOR_MENUTEXT); fontid.deffontsettings.style = DBFONTF_BOLD; - FontRegisterW(&fontid); + Font_RegisterW(&fontid); mir_wstrcpy(fontid.name, LPGENW("Second line")); mir_strcpy(fontid.prefix, "fntSecond"); fontid.deffontsettings.colour = sttShadeColor(GetSysColor(COLOR_MENUTEXT), GetSysColor(COLOR_MENU)); fontid.deffontsettings.style = 0; - FontRegisterW(&fontid); + Font_RegisterW(&fontid); mir_wstrcpy(fontid.backgroundName, LPGENW("Selected background")); @@ -200,13 +188,13 @@ int ProcessModulesLoaded(WPARAM, LPARAM) mir_strcpy(fontid.prefix, "fntNameSel"); fontid.deffontsettings.colour = GetSysColor(COLOR_HIGHLIGHTTEXT); fontid.deffontsettings.style = DBFONTF_BOLD; - FontRegisterW(&fontid); + Font_RegisterW(&fontid); mir_wstrcpy(fontid.name, LPGENW("Selected second line (color)")); mir_strcpy(fontid.prefix, "fntSecondSel"); fontid.deffontsettings.colour = sttShadeColor(GetSysColor(COLOR_HIGHLIGHTTEXT), GetSysColor(COLOR_HIGHLIGHT)); fontid.deffontsettings.style = 0; - FontRegisterW(&fontid); + Font_RegisterW(&fontid); ///////////////////////////////////////////////////////////////////////////////////// @@ -217,12 +205,12 @@ int ProcessModulesLoaded(WPARAM, LPARAM) mir_wstrcpy(colourid.name, LPGENW("Background")); mir_strcpy(colourid.setting, "BackColour"); colourid.defcolour = GetSysColor(COLOR_MENU); - ColourRegisterW(&colourid); + Colour_RegisterW(&colourid); mir_wstrcpy(colourid.name, LPGENW("Selected background")); mir_strcpy(colourid.setting, "SelectedColour"); colourid.defcolour = GetSysColor(COLOR_HIGHLIGHT); - ColourRegisterW(&colourid); + Colour_RegisterW(&colourid); HookEvent(ME_FONT_RELOAD, ProcessReloadFonts); HookEvent(ME_COLOUR_RELOAD, ProcessReloadFonts); diff --git a/plugins/FloatingContacts/src/main.cpp b/plugins/FloatingContacts/src/main.cpp index 6a593f6ab6..8927b18665 100644 --- a/plugins/FloatingContacts/src/main.cpp +++ b/plugins/FloatingContacts/src/main.cpp @@ -532,7 +532,7 @@ static void CreateThumbsFont() } LOGFONT lf; - FontService_GetFont(LPGENW("Floating contacts"), s_fonts[nFontId], &tColor[nFontId], &lf); + tColor[nFontId] = Font_GetW(LPGENW("Floating contacts"), s_fonts[nFontId], &lf); hFont[nFontId] = CreateFontIndirect(&lf); } } diff --git a/plugins/HistoryPlusPlus/hpp_options.pas b/plugins/HistoryPlusPlus/hpp_options.pas index cafbbabd2f..a64505f63b 100644 --- a/plugins/HistoryPlusPlus/hpp_options.pas +++ b/plugins/HistoryPlusPlus/hpp_options.pas @@ -362,14 +362,10 @@ function LoadFont(Order: Integer; F: TFont): TFont; const size: Integer = -11; var - fid: TFontID; lf: TLogFontA; col: TColor; begin - fid.cbSize := sizeof(fid); - fid.group := hppName; - lstrcpya(fid.name, hppFontItems[Order].name { TRANSLATE-IGNORE } ); - col := CallService(MS_FONT_GETA, WPARAM(@fid), LPARAM(@lf)); + col := Font_Get(hppName, hppFontItems[Order].name, @lf); F.handle := CreateFontIndirectA(lf); F.color := col; Result := F; diff --git a/plugins/MyDetails/src/frame.cpp b/plugins/MyDetails/src/frame.cpp index 2274d8f64f..03afeafc70 100644 --- a/plugins/MyDetails/src/frame.cpp +++ b/plugins/MyDetails/src/frame.cpp @@ -198,7 +198,7 @@ int ReloadFont(WPARAM, LPARAM) DeleteObject(hFont[i]); LOGFONT log_font; - font_colour[i] = CallService(MS_FONT_GETW, (WPARAM)&font_id[i], (LPARAM)&log_font); + font_colour[i] = Font_GetW(font_id[i], &log_font); hFont[i] = CreateFontIndirect(&log_font); } @@ -208,8 +208,8 @@ int ReloadFont(WPARAM, LPARAM) int ReloadColour(WPARAM, LPARAM) { - opts.bkg_color = (COLORREF)CallService(MS_COLOUR_GET, (WPARAM)&bg_colour, 0); - opts.draw_avatar_border_color = (COLORREF)CallService(MS_COLOUR_GET, (WPARAM)&av_colour, 0); + opts.bkg_color = Colour_Get(bg_colour.group, bg_colour.name); + opts.draw_avatar_border_color = Colour_Get(av_colour.group, av_colour.name); RefreshFrame(); return 0; @@ -225,8 +225,8 @@ int CreateFrame() { HDC hdc = GetDC(NULL); - ColourRegister(&bg_colour); - ColourRegister(&av_colour); + Colour_Register(&bg_colour); + Colour_Register(&av_colour); ReloadColour(0, 0); HookEvent(ME_COLOUR_RELOAD, ReloadColour); @@ -249,7 +249,7 @@ int CreateFrame() mir_wstrncpy(font_id[i].deffontsettings.szFace, L"Tahoma", _countof(font_id[i].deffontsettings.szFace)); font_id[i].order = i; font_id[i].flags = FIDF_DEFAULTVALID; - FontRegisterW(&font_id[i]); + Font_RegisterW(&font_id[i]); } ReleaseDC(NULL, hdc); diff --git a/plugins/NotesAndReminders/src/options.cpp b/plugins/NotesAndReminders/src/options.cpp index aa9a47e53b..b1de471297 100644 --- a/plugins/NotesAndReminders/src/options.cpp +++ b/plugins/NotesAndReminders/src/options.cpp @@ -253,7 +253,7 @@ void RegisterFontServiceFonts() strncpy(fontid.deffontsettings.szFace, fontOptionsList[i].szDefFace, _countof(fontid.deffontsettings.szFace)); strncpy(fontid.backgroundName, fontOptionsList[i].szBkgName, _countof(fontid.backgroundName)); - FontRegister(&fontid); + Font_Register(&fontid); } ColourID colorid = { 0 }; @@ -269,7 +269,7 @@ void RegisterFontServiceFonts() colorid.defcolour = colourOptionsList[i].defColour; strncpy(colorid.setting, colourOptionsList[i].szSettingName, _countof(colorid.setting)); - ColourRegister(&colorid); + Colour_Register(&colorid); } hkFontChange = HookEvent(ME_FONT_RELOAD, FS_FontsChanged); @@ -278,12 +278,7 @@ void RegisterFontServiceFonts() void LoadNRFont(int i, LOGFONT *lf, COLORREF *colour) { - FontID fontid = { 0 }; - fontid.cbSize = sizeof(fontid); - strncpy(fontid.group, LPGEN(SECTIONNAME), _countof(fontid.group)); - strncpy(fontid.name, fontOptionsList[i].szDescr, _countof(fontid.name)); - - COLORREF col = CallService(MS_FONT_GET, (WPARAM)&fontid, (LPARAM)lf); + COLORREF col = Font_Get(SECTIONNAME, fontOptionsList[i].szDescr, lf); if (colour) *colour = col; } diff --git a/plugins/Ping/src/pingthread.cpp b/plugins/Ping/src/pingthread.cpp index b0df01d290..c0f48b16cc 100644 --- a/plugins/Ping/src/pingthread.cpp +++ b/plugins/Ping/src/pingthread.cpp @@ -781,11 +781,11 @@ int ReloadFont(WPARAM, LPARAM) if (hFont) DeleteObject(hFont); LOGFONT log_font; - CallService(MS_FONT_GETW, (WPARAM)&font_id, (LPARAM)&log_font); + Font_GetW(font_id, &log_font); hFont = CreateFontIndirect(&log_font); SendMessage(list_hwnd, WM_SETFONT, (WPARAM)hFont, TRUE); - bk_col = CallService(MS_COLOUR_GETW, (WPARAM)&bk_col_id, 0); + bk_col = Colour_GetW(bk_col_id); RefreshWindow(0, 0); return 0; @@ -931,7 +931,7 @@ void InitList() font_id.deffontsettings.colour = RGB(255, 255, 255); mir_wstrncpy(font_id.deffontsettings.szFace, L"Tahoma", _countof(font_id.deffontsettings.szFace)); - FontRegisterW(&font_id); + Font_RegisterW(&font_id); bk_col_id.cbSize = sizeof(ColourIDW); mir_wstrncpy(bk_col_id.group, L"Ping", _countof(bk_col_id.group)); @@ -939,7 +939,7 @@ void InitList() mir_strncpy(bk_col_id.dbSettingsGroup, "PING", _countof(bk_col_id.dbSettingsGroup)); mir_strncpy(bk_col_id.setting, "BgColor", _countof(bk_col_id.setting)); bk_col_id.defcolour = RGB(0, 0, 0); - ColourRegisterW(&bk_col_id); + Colour_RegisterW(&bk_col_id); HookEvent(ME_FONT_RELOAD, ReloadFont); diff --git a/plugins/Popup/src/font.cpp b/plugins/Popup/src/font.cpp index 2c62c2a504..4f11e52471 100644 --- a/plugins/Popup/src/font.cpp +++ b/plugins/Popup/src/font.cpp @@ -43,27 +43,27 @@ void InitFonts() mir_snprintf(fid.prefix, PU_FNT_PREFIX, PU_FNT_NAME_TITLE); fid.deffontsettings.style = DBFONTF_BOLD; fid.deffontsettings.colour = RGB(0, 0, 0); - FontRegisterW(&fid); + Font_RegisterW(&fid); mir_wstrncpy(fid.name, _A2W(PU_FNT_NAME_CLOCK), _countof(fid.name)); mir_snprintf(fid.prefix, PU_FNT_PREFIX, PU_FNT_NAME_CLOCK); - FontRegisterW(&fid); + Font_RegisterW(&fid); mir_wstrncpy(fid.name, _A2W(PU_FNT_NAME_TEXT), _countof(fid.name)); mir_snprintf(fid.prefix, PU_FNT_PREFIX, PU_FNT_NAME_TEXT); fid.deffontsettings.style = 0; - FontRegisterW(&fid); + Font_RegisterW(&fid); mir_wstrncpy(fid.name, _A2W(PU_FNT_NAME_ACTION), _countof(fid.name)); mir_snprintf(fid.prefix, PU_FNT_PREFIX, PU_FNT_NAME_ACTION); fid.flags = FIDF_DEFAULTVALID | FIDF_ALLOWEFFECTS; fid.deffontsettings.colour = RGB(0, 0, 255); - FontRegisterW(&fid); + Font_RegisterW(&fid); mir_wstrncpy(fid.name, _A2W(PU_FNT_NAME_HOVERED_ACTION), _countof(fid.name)); mir_snprintf(fid.prefix, PU_FNT_PREFIX, PU_FNT_NAME_HOVERED_ACTION); fid.deffontsettings.style = DBFONTF_UNDERLINE; - FontRegisterW(&fid); + Font_RegisterW(&fid); ColourIDW cid = { 0 }; cid.cbSize = sizeof(ColourIDW); @@ -73,12 +73,12 @@ void InitFonts() mir_wstrncpy(cid.name, PU_COL_BACK_NAME, _countof(cid.name)); mir_strncpy(cid.setting, PU_COL_BACK_SETTING, _countof(cid.setting)); cid.defcolour = SETTING_BACKCOLOUR_DEFAULT; - ColourRegisterW(&cid); + Colour_RegisterW(&cid); mir_wstrncpy(cid.name, PU_COL_AVAT_NAME, _countof(cid.name)); mir_strncpy(cid.setting, PU_COL_AVAT_SETTING, _countof(cid.setting)); cid.defcolour = SETTING_TEXTCOLOUR_DEFAULT; - ColourRegisterW(&cid); + Colour_RegisterW(&cid); ReloadFonts(); } @@ -93,39 +93,23 @@ void ReloadFonts() if (fonts.actionHover) DeleteObject(fonts.actionHover); LOGFONT lf = { 0 }; - FontIDW fid = { 0 }; - fid.cbSize = sizeof(FontIDW); - mir_wstrncpy(fid.group, _A2W(PU_FNT_AND_COLOR), _countof(fid.name)); - - mir_wstrncpy(fid.name, _A2W(PU_FNT_NAME_TITLE), _countof(fid.name)); - fonts.clTitle = (COLORREF)CallService(MS_FONT_GETW, (WPARAM)&fid, (LPARAM)&lf); + fonts.clTitle = Font_GetW(_A2W(PU_FNT_AND_COLOR), _A2W(PU_FNT_NAME_TITLE), &lf); fonts.title = CreateFontIndirect(&lf); - mir_wstrncpy(fid.name, _A2W(PU_FNT_NAME_CLOCK), _countof(fid.name)); - fonts.clClock = (COLORREF)CallService(MS_FONT_GETW, (WPARAM)&fid, (LPARAM)&lf); + fonts.clClock = Font_GetW(_A2W(PU_FNT_AND_COLOR), _A2W(PU_FNT_NAME_CLOCK), &lf); fonts.clock = CreateFontIndirect(&lf); - mir_wstrncpy(fid.name, _A2W(PU_FNT_NAME_TEXT), _countof(fid.name)); - fonts.clText = (COLORREF)CallService(MS_FONT_GETW, (WPARAM)&fid, (LPARAM)&lf); + fonts.clText = Font_GetW(_A2W(PU_FNT_AND_COLOR), _A2W(PU_FNT_NAME_TEXT), &lf); fonts.text = CreateFontIndirect(&lf); - mir_wstrncpy(fid.name, _A2W(PU_FNT_NAME_ACTION), _countof(fid.name)); - fonts.clAction = (COLORREF)CallService(MS_FONT_GETW, (WPARAM)&fid, (LPARAM)&lf); + fonts.clAction = Font_GetW(_A2W(PU_FNT_AND_COLOR), _A2W(PU_FNT_NAME_ACTION), &lf); fonts.action = CreateFontIndirect(&lf); - mir_wstrncpy(fid.name, _A2W(PU_FNT_NAME_HOVERED_ACTION), _countof(fid.name)); - fonts.clActionHover = (COLORREF)CallService(MS_FONT_GETW, (WPARAM)&fid, (LPARAM)&lf); + fonts.clActionHover = Font_GetW(_A2W(PU_FNT_AND_COLOR), _A2W(PU_FNT_NAME_HOVERED_ACTION), &lf); fonts.actionHover = CreateFontIndirect(&lf); - ColourIDW cid = { 0 }; - cid.cbSize = sizeof(ColourIDW); - mir_wstrncpy(cid.group, _A2W(PU_FNT_AND_COLOR), _countof(cid.group)); - mir_wstrncpy(cid.name, PU_COL_BACK_NAME, _countof(cid.name)); - fonts.clBack = (COLORREF)CallService(MS_COLOUR_GETW, (WPARAM)&cid, (LPARAM)&lf); - - mir_wstrncpy(cid.group, _A2W(PU_FNT_AND_COLOR), _countof(cid.group)); - mir_wstrncpy(cid.name, PU_COL_AVAT_NAME, _countof(cid.name)); - fonts.clAvatarBorder = (COLORREF)CallService(MS_COLOUR_GETW, (WPARAM)&cid, (LPARAM)&lf); + fonts.clBack = Colour_GetW(_A2W(PU_FNT_AND_COLOR), PU_COL_BACK_NAME); + fonts.clAvatarBorder = Colour_GetW(_A2W(PU_FNT_AND_COLOR), PU_COL_AVAT_NAME); // update class popupps(only temp at this point, must rework) char setting[256]; diff --git a/plugins/Popup/src/notifications.cpp b/plugins/Popup/src/notifications.cpp index ad176ca7ed..1c9759e201 100644 --- a/plugins/Popup/src/notifications.cpp +++ b/plugins/Popup/src/notifications.cpp @@ -196,7 +196,7 @@ HANDLE RegisterNotification(POPUPNOTIFICATION *notification) mir_snprintf(fontid.name, "%s (colors only)", notification->lpzName); mir_snprintf(fontid.prefix, "{%s/%s}text", notification->lpzGroup, notification->lpzName); fontid.deffontsettings.style = 0; - FontRegister(&fontid); + Font_Register(&fontid); ColourID colourid = { 0 }; colourid.cbSize = sizeof(colourid); @@ -205,7 +205,7 @@ HANDLE RegisterNotification(POPUPNOTIFICATION *notification) mir_snprintf(colourid.name, "%s (colors only)", notification->lpzName); mir_snprintf(colourid.setting, "{%s/%s}backColor", notification->lpzGroup, notification->lpzName); colourid.defcolour = ptd->notification.colorBack; - ColourRegister(&colourid); + Colour_Register(&colourid); gTreeData.insert(ptd); return (HANDLE)ptd; @@ -234,17 +234,10 @@ void FillNotificationData(POPUPDATA2 *ppd, DWORD *disableWhen) *disableWhen = ptd->enabled ? ptd->disableWhen : 0xFFFFFFFF; LOGFONTA lf; // dummy to make FS happy (use LOGFONTA coz we use MS_FONT_GET) - FontID fontid = { 0 }; // use ansi version of fontID coz POPUPNOTIFICATION use char - fontid.cbSize = sizeof(fontid); - mir_snprintf(fontid.group, PU_FNT_AND_COLOR"/%s", ptd->notification.lpzGroup); - mir_snprintf(fontid.name, "%s (colors only)", ptd->notification.lpzName); - ppd->colorText = (COLORREF)CallService(MS_FONT_GET, (WPARAM)&fontid, (LPARAM)&lf); - - ColourID colourid = { 0 }; // use ansi version of ColourID coz POPUPNOTIFICATION use char - colourid.cbSize = sizeof(colourid); - mir_snprintf(colourid.group, PU_FNT_AND_COLOR"/%s", ptd->notification.lpzGroup); - mir_snprintf(colourid.name, "%s (colors only)", ptd->notification.lpzName); - ppd->colorBack = (COLORREF)CallService(MS_COLOUR_GET, (WPARAM)&colourid, 0); + CMStringA szGroup(FORMAT, PU_FNT_AND_COLOR"/%s", ptd->notification.lpzGroup); + CMStringA szName(FORMAT, "%s (colors only)", ptd->notification.lpzName); + ppd->colorText = Font_Get(szGroup, szName, &lf); + ppd->colorBack = Colour_Get(szGroup, szName); ppd->lchIcon = IcoLib_GetIconByHandle(ptd->hIcoLib); } diff --git a/plugins/Popup/src/services.cpp b/plugins/Popup/src/services.cpp index dd0c44c6aa..767fa11096 100644 --- a/plugins/Popup/src/services.cpp +++ b/plugins/Popup/src/services.cpp @@ -392,7 +392,7 @@ INT_PTR Popup_RegisterPopupClass(WPARAM, LPARAM lParam) mir_snprintf(fid.prefix, "%s/Text", ptd->pupClass.pszName); // result is "%s/TextCol" fid.deffontsettings.style = 0; fid.deffontsettings.colour = fonts.clText; - FontRegisterW(&fid); + Font_RegisterW(&fid); // we ignore pc->colorBack and use fonts.clBack as default (if no setting found in DB) mir_snprintf(setting, "%s/BgCol", ptd->pupClass.pszName); @@ -404,7 +404,7 @@ INT_PTR Popup_RegisterPopupClass(WPARAM, LPARAM lParam) mir_wstrncpy(cid.name, PU_COL_BACK_NAME, _countof(cid.name)); mir_snprintf(cid.setting, "%s/BgCol", ptd->pupClass.pszName); cid.defcolour = fonts.clBack; - ColourRegisterW(&cid); + Colour_RegisterW(&cid); gTreeData.insert(ptd); num_classes++; diff --git a/plugins/QuickSearch/i_ok.inc b/plugins/QuickSearch/i_ok.inc index a464d30e7b..3211939c55 100644 --- a/plugins/QuickSearch/i_ok.inc +++ b/plugins/QuickSearch/i_ok.inc @@ -61,16 +61,12 @@ end; function ColorReload(wParam:WPARAM;lParam:LPARAM):int;cdecl; var - cid:TColourID; i:tqscolor; begin result:=0; - cid.cbSize:=SizeOf(cid); - StrCopy(cid.group,qs_module); for i:=Low(tqscolor) to High(tqscolor) do begin - StrCopy(cid.name ,QSColors[i].descr); - QSColors[i].color:=CallService(MS_COLOUR_GETA,tlparam(@cid),0); + QSColors[i].color:=Colour_Get(qs_module,QSColors[i].descr); end; end; diff --git a/plugins/QuickSearch/sr_frame.pas b/plugins/QuickSearch/sr_frame.pas index 44cc51bb60..e66fe68568 100644 --- a/plugins/QuickSearch/sr_frame.pas +++ b/plugins/QuickSearch/sr_frame.pas @@ -127,14 +127,9 @@ begin end; function ColorReload(wParam:WPARAM;lParam:LPARAM):int;cdecl; -var - cid:TColourID; begin result:=0; - cid.cbSize:=SizeOf(cid); - StrCopy(cid.group,'QuickSearch'); - StrCopy(cid.name ,frm_back); - frm_bkg:=CallService(MS_COLOUR_GETA,twparam(@cid),0); + frm_bkg:=Colour_Get('QuickSearch',frm_back); DeleteObject(hbr); hbr:=CreateSolidBrush(frm_bkg); diff --git a/plugins/Scriver/src/msgoptions.cpp b/plugins/Scriver/src/msgoptions.cpp index abb4b38229..4f2053fccb 100644 --- a/plugins/Scriver/src/msgoptions.cpp +++ b/plugins/Scriver/src/msgoptions.cpp @@ -123,7 +123,7 @@ void RegisterFontServiceFonts() fid.deffontsettings.charset = DEFAULT_CHARSET; wcsncpy(fid.deffontsettings.szFace, fontOptionsList[i].szDefFace, _countof(fid.deffontsettings.szFace)); wcsncpy(fid.backgroundName, fontOptionsList[i].szBkgName, _countof(fid.backgroundName)); - FontRegisterW(&fid); + Font_RegisterW(&fid); } ColourIDW cid = { sizeof(cid) }; @@ -139,7 +139,7 @@ void RegisterFontServiceFonts() cid.defcolour = colourOptionsList[i].defColour; strncpy(cid.setting, colourOptionsList[i].szSettingName, _countof(cid.setting)); - ColourRegisterW(&cid); + Colour_RegisterW(&cid); } } diff --git a/plugins/SmileyAdd/src/main.cpp b/plugins/SmileyAdd/src/main.cpp index b5afa0b036..112f3face5 100644 --- a/plugins/SmileyAdd/src/main.cpp +++ b/plugins/SmileyAdd/src/main.cpp @@ -73,7 +73,7 @@ static int ModulesLoaded(WPARAM, LPARAM) strcpy_s(cid.name, LPGEN("Background color")); strcpy_s(cid.setting, "SelWndBkgClr"); cid.defcolour = GetSysColor(COLOR_WINDOW); - ColourRegister(&cid); + Colour_Register(&cid); return 0; } diff --git a/plugins/TabSRMM/src/chat/options.cpp b/plugins/TabSRMM/src/chat/options.cpp index 64825d1b4f..f5e487e4d9 100644 --- a/plugins/TabSRMM/src/chat/options.cpp +++ b/plugins/TabSRMM/src/chat/options.cpp @@ -552,7 +552,7 @@ void RegisterFontServiceFonts() wcsncpy(fid.backgroundName, LPGENW("Incoming background"), _countof(fid.backgroundName)); break; } - FontRegisterW(&fid); + Font_RegisterW(&fid); } fontOptionsList = IP_fontOptionsList; @@ -578,7 +578,7 @@ void RegisterFontServiceFonts() wcsncpy(fid.backgroundName, L"", _countof(fid.backgroundName)); wcsncpy(fid.group, LPGENW("Message Sessions"), _countof(fid.group)); } - FontRegisterW(&fid); + Font_RegisterW(&fid); } wcsncpy(cid.group, LPGENW("Message Sessions") L"/" LPGENW("Group chats"), _countof(cid.group)); @@ -599,18 +599,18 @@ void RegisterFontServiceFonts() cid.defcolour = RGB(0, 0, 0); break; } - ColourRegisterW(&cid); + Colour_RegisterW(&cid); } cid.order++; wcsncpy_s(cid.name, LPGENW("Nick list background"), _TRUNCATE); strncpy_s(cid.setting, "ColorNicklistBG", _TRUNCATE); cid.defcolour = SRMSGDEFSET_BKGCOLOUR; - ColourRegisterW(&cid); + Colour_RegisterW(&cid); cid.order++; wcsncpy_s(cid.name, LPGENW("Group chat log background"), _TRUNCATE); strncpy_s(cid.setting, "ColorLogBG", _TRUNCATE); - ColourRegisterW(&cid); + Colour_RegisterW(&cid); // static colors (info panel, tool bar background etc...) strncpy(fid.dbSettingsGroup, FONTMODULE, _countof(fid.dbSettingsGroup)); @@ -625,7 +625,7 @@ void RegisterFontServiceFonts() cid.defcolour = GetSysColor(_clrs[i].def & 0x000000ff); else cid.defcolour = _clrs[i].def; - ColourRegisterW(&cid); + Colour_RegisterW(&cid); } strncpy(cid.dbSettingsGroup, SRMSGMOD_T, _countof(fid.dbSettingsGroup)); @@ -641,7 +641,7 @@ void RegisterFontServiceFonts() else cid.defcolour = _tabclrs[i].def; - ColourRegisterW(&cid); + Colour_RegisterW(&cid); } } diff --git a/plugins/TipperYM/src/tipper.cpp b/plugins/TipperYM/src/tipper.cpp index ac67b2a201..69bf9a954e 100644 --- a/plugins/TipperYM/src/tipper.cpp +++ b/plugins/TipperYM/src/tipper.cpp @@ -69,23 +69,26 @@ int ReloadFont(WPARAM, LPARAM) { LOGFONT logFont; if (hFontTitle) DeleteObject(hFontTitle); - opt.colTitle = CallService(MS_FONT_GETW, (WPARAM)&fontTitle, (LPARAM)&logFont); + opt.colTitle = Font_GetW(fontTitle, &logFont); hFontTitle = CreateFontIndirect(&logFont); + if (hFontLabels) DeleteObject(hFontLabels); - opt.colLabel = CallService(MS_FONT_GETW, (WPARAM)&fontLabels, (LPARAM)&logFont); + opt.colLabel = Font_GetW(fontLabels, &logFont); hFontLabels = CreateFontIndirect(&logFont); + if (hFontValues) DeleteObject(hFontValues); - opt.colValue = CallService(MS_FONT_GETW, (WPARAM)&fontValues, (LPARAM)&logFont); + opt.colValue = Font_GetW(fontValues, &logFont); hFontValues = CreateFontIndirect(&logFont); + if (hFontTrayTitle) DeleteObject(hFontTrayTitle); - opt.colTrayTitle = CallService(MS_FONT_GETW, (WPARAM)&fontTrayTitle, (LPARAM)&logFont); + opt.colTrayTitle = Font_GetW(fontTrayTitle, &logFont); hFontTrayTitle = CreateFontIndirect(&logFont); - opt.colBg = CallService(MS_COLOUR_GETW, (WPARAM)&colourBg, 0); - opt.colBorder = CallService(MS_COLOUR_GETW, (WPARAM)&colourBorder, 0); - opt.colAvatarBorder = CallService(MS_COLOUR_GETW, (WPARAM)&colourAvatarBorder, 0); - opt.colSidebar = CallService(MS_COLOUR_GETW, (WPARAM)&colourSidebar, 0); - opt.colDivider = CallService(MS_COLOUR_GETW, (WPARAM)&colourDivider, 0); + opt.colBg = Colour_GetW(colourBg); + opt.colBorder = Colour_GetW(colourBorder); + opt.colAvatarBorder = Colour_GetW(colourAvatarBorder); + opt.colSidebar = Colour_GetW(colourSidebar); + opt.colDivider = Colour_GetW(colourDivider); return 0; } @@ -130,7 +133,7 @@ void InitFonts() mir_strcpy(colourBg.setting, "ColourBg"); colourBg.defcolour = RGB(219, 219, 219); colourBg.order = 0; - ColourRegisterW(&colourBg); + Colour_RegisterW(&colourBg); colourBorder.cbSize = sizeof(ColourIDW); mir_wstrcpy(colourBorder.group, LPGENW("Tooltips")); @@ -139,7 +142,7 @@ void InitFonts() mir_strcpy(colourBorder.setting, "BorderCol"); colourBorder.defcolour = 0; colourBorder.order = 0; - ColourRegisterW(&colourBorder); + Colour_RegisterW(&colourBorder); colourAvatarBorder.cbSize = sizeof(ColourIDW); mir_wstrcpy(colourAvatarBorder.group, LPGENW("Tooltips")); @@ -148,7 +151,7 @@ void InitFonts() mir_strcpy(colourAvatarBorder.setting, "AvBorderCol"); colourAvatarBorder.defcolour = 0; colourAvatarBorder.order = 0; - ColourRegisterW(&colourAvatarBorder); + Colour_RegisterW(&colourAvatarBorder); colourDivider.cbSize = sizeof(ColourIDW); mir_wstrcpy(colourDivider.group, LPGENW("Tooltips")); @@ -157,7 +160,7 @@ void InitFonts() mir_strcpy(colourDivider.setting, "DividerCol"); colourDivider.defcolour = 0; colourDivider.order = 0; - ColourRegisterW(&colourDivider); + Colour_RegisterW(&colourDivider); colourSidebar.cbSize = sizeof(ColourIDW); mir_wstrcpy(colourSidebar.group, LPGENW("Tooltips")); @@ -166,7 +169,7 @@ void InitFonts() mir_strcpy(colourSidebar.setting, "SidebarCol"); colourSidebar.defcolour = RGB(192, 192, 192); colourSidebar.order = 0; - ColourRegisterW(&colourSidebar); + Colour_RegisterW(&colourSidebar); fontTitle.cbSize = sizeof(FontIDW); fontTitle.flags = FIDF_ALLOWEFFECTS; @@ -232,10 +235,10 @@ void InitFonts() fontTrayTitle.deffontsettings.colour = RGB(0, 0, 0); fontTrayTitle.flags |= FIDF_DEFAULTVALID; - FontRegisterW(&fontTitle); - FontRegisterW(&fontLabels); - FontRegisterW(&fontValues); - FontRegisterW(&fontTrayTitle); + Font_RegisterW(&fontTitle); + Font_RegisterW(&fontLabels); + Font_RegisterW(&fontValues); + Font_RegisterW(&fontTrayTitle); hReloadFonts = HookEvent(ME_FONT_RELOAD, ReloadFont); } diff --git a/plugins/TooltipNotify/src/TooltipNotify.cpp b/plugins/TooltipNotify/src/TooltipNotify.cpp index 3008beffb2..864fad80c1 100644 --- a/plugins/TooltipNotify/src/TooltipNotify.cpp +++ b/plugins/TooltipNotify/src/TooltipNotify.cpp @@ -95,11 +95,11 @@ void CTooltipNotify::RegisterFonts() wcsncpy(fontId.name, s_fontTable[i].name, _countof(fontId.name) - 1); strncpy(fontId.prefix, s_fontTable[i].fontPrefix, _countof(fontId.prefix) - 1); wcsncpy(fontId.backgroundName, s_fontTable[i].name, _countof(fontId.backgroundName) - 1); - ::FontRegisterW(&fontId); + ::Font_RegisterW(&fontId); wcsncpy(colorId.name, s_fontTable[i].name, _countof(colorId.name) - 1); strncpy(colorId.setting, s_fontTable[i].clrPrefix, _countof(colorId.setting) - 1); - ::ColourRegisterW(&colorId); + ::Colour_RegisterW(&colorId); } } @@ -111,17 +111,12 @@ void CTooltipNotify::GetFont(int iStatus, LOGFONT* lf, COLORREF* text, COLORREF* fontName = s_fontTable[i].name; } } - if (fontName == 0) { + if (fontName == 0) fontName = s_fontTable[_countof(s_fontTable) - 1].name; - } // name and group only - FontIDW fontId = { sizeof(fontId), FONTSERV_GROUP, 0 }; - wcsncpy(fontId.name, fontName, _countof(fontId.name) - 1); - *text = (COLORREF)::CallService(MS_FONT_GETW, (WPARAM)&fontId, (LPARAM)lf); - ColourIDW colorId = { sizeof(colorId), FONTSERV_GROUP, 0 }; - wcsncpy(colorId.name, fontName, _countof(colorId.name) - 1); - *bg = (COLORREF)::CallService(MS_COLOUR_GETW, (WPARAM)&colorId, 0); + *text = ::Font_GetW(FONTSERV_GROUP, fontName, lf); + *bg = ::Colour_GetW(FONTSERV_GROUP, fontName); } int CTooltipNotify::ModulesLoaded(WPARAM, LPARAM) diff --git a/plugins/TrafficCounter/src/TrafficCounter.cpp b/plugins/TrafficCounter/src/TrafficCounter.cpp index 3739e261c1..0694b3da0b 100644 --- a/plugins/TrafficCounter/src/TrafficCounter.cpp +++ b/plugins/TrafficCounter/src/TrafficCounter.cpp @@ -256,7 +256,7 @@ int TrafficCounterModulesLoaded(WPARAM, LPARAM) TrafficFontID.deffontsettings.style = 0; mir_wstrcpy(TrafficFontID.deffontsettings.szFace, L"Arial"); TrafficFontID.order = 0; - FontRegisterW(&TrafficFontID); + Font_RegisterW(&TrafficFontID); // Регистрируем цвет фона TrafficBackgroundColorID.cbSize = sizeof(ColourIDW); @@ -265,7 +265,7 @@ int TrafficCounterModulesLoaded(WPARAM, LPARAM) mir_strcpy(TrafficBackgroundColorID.dbSettingsGroup, TRAFFIC_SETTINGS_GROUP); mir_strcpy(TrafficBackgroundColorID.setting, "FontBkColor"); TrafficBackgroundColorID.defcolour = GetSysColor(COLOR_BTNFACE); - ColourRegisterW(&TrafficBackgroundColorID); + Colour_RegisterW(&TrafficBackgroundColorID); HookEvent(ME_FONT_RELOAD, UpdateFonts); @@ -1162,15 +1162,13 @@ int ProtocolAckHook(WPARAM, LPARAM lParam) int UpdateFonts(WPARAM, LPARAM) { LOGFONT logfont; - //if no font service - if (!ServiceExists(MS_FONT_GETW)) return 0; //update traffic font if (Traffic_h_font) DeleteObject(Traffic_h_font); - Traffic_FontColor = CallService(MS_FONT_GETW, (WPARAM)&TrafficFontID, (LPARAM)&logfont); + Traffic_FontColor = Font_GetW(TrafficFontID, &logfont); Traffic_h_font = CreateFontIndirect(&logfont); - // + TrafficFontHeight = abs(logfont.lfHeight) + 1; - Traffic_BkColor = CallService(MS_COLOUR_GETW, (WPARAM)&TrafficBackgroundColorID, 0); + Traffic_BkColor = Colour_GetW(TrafficBackgroundColorID); // Ключевой цвет UseKeyColor = db_get_b(NULL, "ModernSettings", "UseKeyColor", 1); diff --git a/plugins/Weather/src/weather_mwin.cpp b/plugins/Weather/src/weather_mwin.cpp index d51d9e6606..14266b6a4f 100644 --- a/plugins/Weather/src/weather_mwin.cpp +++ b/plugins/Weather/src/weather_mwin.cpp @@ -155,16 +155,8 @@ static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara } clr = db_get_dw(NULL, WEATHERPROTONAME, "ColorMwinFrame", GetSysColor(COLOR_3DFACE)); - - { - FontIDW fntid = { 0 }; - mir_wstrcpy(fntid.group, _A2W(WEATHERPROTONAME)); - mir_wstrcpy(fntid.name, LPGENW("Frame Font")); - fntc = CallService(MS_FONT_GETW, (WPARAM)&fntid, (LPARAM)&lfnt); - - mir_wstrcpy(fntid.name, LPGENW("Frame Title Font")); - fntc1 = CallService(MS_FONT_GETW, (WPARAM)&fntid, (LPARAM)&lfnt1); - } + fntc = Font_GetW(_A2W(WEATHERPROTONAME), LPGENW("Frame Font"), &lfnt); + fntc1 = Font_GetW(_A2W(WEATHERPROTONAME), LPGENW("Frame Title Font"), &lfnt1); ptrW tszInfo(db_get_wsa(data->hContact, WEATHERCONDITION, "WeatherInfo")); @@ -331,7 +323,7 @@ void InitMwin(void) mir_wstrcpy(colourid.name, LPGENW("Frame Background")); mir_wstrcpy(colourid.group, _A2W(WEATHERPROTONAME)); colourid.defcolour = GetSysColor(COLOR_3DFACE); - ColourRegisterW(&colourid); + Colour_RegisterW(&colourid); FontIDW fontid = { 0 }; fontid.cbSize = sizeof(FontIDW); @@ -349,12 +341,12 @@ void InitMwin(void) mir_wstrcpy(fontid.deffontsettings.szFace, L"Verdana"); mir_wstrcpy(fontid.backgroundGroup, _A2W(WEATHERPROTONAME)); mir_wstrcpy(fontid.backgroundName, LPGENW("Frame Background")); - FontRegisterW(&fontid); + Font_RegisterW(&fontid); fontid.deffontsettings.style = DBFONTF_BOLD; mir_wstrcpy(fontid.name, LPGENW("Frame Title Font")); mir_strcpy(fontid.prefix, "fnt1"); - FontRegisterW(&fontid); + Font_RegisterW(&fontid); for (MCONTACT hContact = db_find_first(WEATHERPROTONAME); hContact; hContact = db_find_next(hContact, WEATHERPROTONAME)) if (db_get_dw(hContact, WEATHERPROTONAME, "mwin", 0)) diff --git a/plugins/YAPP/src/yapp.cpp b/plugins/YAPP/src/yapp.cpp index 835748e011..b045e2d873 100644 --- a/plugins/YAPP/src/yapp.cpp +++ b/plugins/YAPP/src/yapp.cpp @@ -57,19 +57,19 @@ int ReloadFont(WPARAM, LPARAM) { LOGFONT log_font; if (hFontFirstLine) DeleteObject(hFontFirstLine); - colFirstLine = CallService(MS_FONT_GETW, (WPARAM)&font_id_firstline, (LPARAM)&log_font); + colFirstLine = Font_GetW(font_id_firstline, &log_font); hFontFirstLine = CreateFontIndirect(&log_font); if (hFontSecondLine) DeleteObject(hFontSecondLine); - colSecondLine = CallService(MS_FONT_GETW, (WPARAM)&font_id_secondline, (LPARAM)&log_font); + colSecondLine = Font_GetW(font_id_secondline, &log_font); hFontSecondLine = CreateFontIndirect(&log_font); if (hFontTime) DeleteObject(hFontTime); - colTime = CallService(MS_FONT_GETW, (WPARAM)&font_id_time, (LPARAM)&log_font); + colTime = Font_GetW(font_id_time, &log_font); hFontTime = CreateFontIndirect(&log_font); - colBg = CallService(MS_COLOUR_GETW, (WPARAM)&colour_id_bg, 0); - colBorder = CallService(MS_COLOUR_GETW, (WPARAM)&colour_id_border, 0); - colSidebar = CallService(MS_COLOUR_GETW, (WPARAM)&colour_id_sidebar, 0); - colTitleUnderline = CallService(MS_COLOUR_GETW, (WPARAM)&colour_id_titleunderline, 0); + colBg = Colour_GetW(colour_id_bg); + colBorder = Colour_GetW(colour_id_border); + colSidebar = Colour_GetW(colour_id_sidebar); + colTitleUnderline = Colour_GetW(colour_id_titleunderline); return 0; } @@ -101,7 +101,7 @@ static void InitFonts() mir_wstrcpy(font_id_firstline.backgroundGroup, L"Popups"); mir_wstrcpy(font_id_firstline.backgroundName, L"Background"); font_id_firstline.order = 0; - FontRegisterW(&font_id_firstline); + Font_RegisterW(&font_id_firstline); font_id_secondline.cbSize = sizeof(FontIDW); font_id_secondline.flags = FIDF_ALLOWEFFECTS; @@ -112,7 +112,7 @@ static void InitFonts() mir_wstrcpy(font_id_secondline.backgroundGroup, L"Popups"); mir_wstrcpy(font_id_secondline.backgroundName, L"Background"); font_id_secondline.order = 1; - FontRegisterW(&font_id_secondline); + Font_RegisterW(&font_id_secondline); font_id_time.cbSize = sizeof(FontIDW); font_id_time.flags = FIDF_ALLOWEFFECTS; @@ -123,7 +123,7 @@ static void InitFonts() mir_wstrcpy(font_id_time.backgroundGroup, L"Popups"); mir_wstrcpy(font_id_time.backgroundName, L"Background"); font_id_time.order = 2; - FontRegisterW(&font_id_time); + Font_RegisterW(&font_id_time); colour_id_bg.cbSize = sizeof(ColourIDW); mir_wstrcpy(colour_id_bg.group, LPGENW("Popups")); @@ -132,7 +132,7 @@ static void InitFonts() mir_strcpy(colour_id_bg.setting, "ColourBg"); colour_id_bg.defcolour = GetSysColor(COLOR_3DSHADOW); colour_id_bg.order = 0; - ColourRegisterW(&colour_id_bg); + Colour_RegisterW(&colour_id_bg); colour_id_border.cbSize = sizeof(ColourIDW); mir_wstrcpy(colour_id_border.group, LPGENW("Popups")); @@ -141,7 +141,7 @@ static void InitFonts() mir_strcpy(colour_id_border.setting, "ColourBorder"); colour_id_border.defcolour = RGB(0, 0, 0); colour_id_border.order = 1; - ColourRegisterW(&colour_id_border); + Colour_RegisterW(&colour_id_border); colour_id_sidebar.cbSize = sizeof(ColourIDW); mir_wstrcpy(colour_id_sidebar.group, LPGENW("Popups")); @@ -150,7 +150,7 @@ static void InitFonts() mir_strcpy(colour_id_sidebar.setting, "ColourSidebar"); colour_id_sidebar.defcolour = RGB(128, 128, 128); colour_id_sidebar.order = 2; - ColourRegisterW(&colour_id_sidebar); + Colour_RegisterW(&colour_id_sidebar); colour_id_titleunderline.cbSize = sizeof(ColourIDW); mir_wstrcpy(colour_id_titleunderline.group, LPGENW("Popups")); @@ -159,7 +159,7 @@ static void InitFonts() mir_strcpy(colour_id_titleunderline.setting, "ColourTitleUnderline"); colour_id_titleunderline.defcolour = GetSysColor(COLOR_3DSHADOW); colour_id_titleunderline.order = 3; - ColourRegisterW(&colour_id_titleunderline); + Colour_RegisterW(&colour_id_titleunderline); ReloadFont(0, 0); } diff --git a/plugins/mRadio/rframeapi.pas b/plugins/mRadio/rframeapi.pas index 2db900efe6..449f80700b 100644 --- a/plugins/mRadio/rframeapi.pas +++ b/plugins/mRadio/rframeapi.pas @@ -181,14 +181,10 @@ end; function ColorReload(wParam:WPARAM;lParam:LPARAM):int;cdecl; var - cid:TColourID; wnd:HWND; begin result:=0; - cid.cbSize:=SizeOf(cid); - StrCopy(cid.group,cPluginName); - StrCopy(cid.name ,frm_back); - frm_bkg:=CallService(MS_COLOUR_GETA,twparam(@cid),0); + frm_bkg:=Colour_Get(cPluginName,frm_back); if hbr<>0 then DeleteObject(hbr); hbr:=CreateSolidBrush(frm_bkg); -- cgit v1.2.3