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 --- bin10/lib/mir_app.lib | Bin 82262 -> 84756 bytes bin10/lib/mir_app64.lib | Bin 78830 -> 81076 bytes bin12/lib/mir_app.lib | Bin 82262 -> 84756 bytes bin12/lib/mir_app64.lib | Bin 78830 -> 81076 bytes bin14/lib/mir_app.lib | Bin 82262 -> 84756 bytes bin14/lib/mir_app64.lib | Bin 78830 -> 81076 bytes include/delphi/m_fontservice.inc | 51 ++---------- include/delphi/m_helpers.inc | 31 +------- include/m_fontservice.h | 67 ++++++---------- 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 +- protocols/JabberG/src/jabber.cpp | 6 +- protocols/JabberG/src/jabber_frame.cpp | 16 +--- src/core/stdchat/src/main.cpp | 10 +-- src/core/stdclist/src/clcfonts.cpp | 10 +-- src/core/stdmsg/src/msgoptions.cpp | 4 +- src/mir_app/src/FontService.cpp | 108 ++++++++++---------------- src/mir_app/src/mir_app.def | 12 +++ src/mir_app/src/mir_app64.def | 12 +++ utils/mir_fonts.cpp | 23 +----- utils/mir_fonts.h | 3 - 47 files changed, 276 insertions(+), 495 deletions(-) diff --git a/bin10/lib/mir_app.lib b/bin10/lib/mir_app.lib index 9dc2bae69c..d4b7d469b8 100644 Binary files a/bin10/lib/mir_app.lib and b/bin10/lib/mir_app.lib differ diff --git a/bin10/lib/mir_app64.lib b/bin10/lib/mir_app64.lib index 34e53fe748..bc5739d331 100644 Binary files a/bin10/lib/mir_app64.lib and b/bin10/lib/mir_app64.lib differ diff --git a/bin12/lib/mir_app.lib b/bin12/lib/mir_app.lib index 9dc2bae69c..d4b7d469b8 100644 Binary files a/bin12/lib/mir_app.lib and b/bin12/lib/mir_app.lib differ diff --git a/bin12/lib/mir_app64.lib b/bin12/lib/mir_app64.lib index 34e53fe748..bc5739d331 100644 Binary files a/bin12/lib/mir_app64.lib and b/bin12/lib/mir_app64.lib differ diff --git a/bin14/lib/mir_app.lib b/bin14/lib/mir_app.lib index 9dc2bae69c..d4b7d469b8 100644 Binary files a/bin14/lib/mir_app.lib and b/bin14/lib/mir_app.lib differ diff --git a/bin14/lib/mir_app64.lib b/bin14/lib/mir_app64.lib index 34e53fe748..bc5739d331 100644 Binary files a/bin14/lib/mir_app64.lib and b/bin14/lib/mir_app64.lib differ diff --git a/include/delphi/m_fontservice.inc b/include/delphi/m_fontservice.inc index b93f7cf653..c6dacc42e1 100644 --- a/include/delphi/m_fontservice.inc +++ b/include/delphi/m_fontservice.inc @@ -112,22 +112,12 @@ type PFontIDW = ^TFontIDW; const - { register a font } - { wparam = pointer to FontID structure} - { lparam = hLangpack } - MS_FONT_REGISTERA:PAnsiChar = 'Font/Register'; - MS_FONT_REGISTERW:PAnsiChar = 'Font/RegisterW'; - - { get a font } - { wparam = pointer to FontID structure (only name and group matter) } - { lParam = pointer to LOGFONT structure } - { returns the font's colour } - MS_FONT_GETA:PAnsiChar = 'Font/Get'; - MS_FONT_GETW:PAnsiChar = 'Font/GetW'; - { fired when a user modifies font settings, so reget your fonts } ME_FONT_RELOAD:PAnsiChar = 'Font/Reload'; +function Font_Register(pFont:pFontID; hLang:int) : int; stdcall; external AppDll; +function Font_Get(pGroup,pName:pAnsiChar; pFont:pLogFontA) : longint; stdcall; external AppDll; + type PColourID_tag = ^TColourID_tag; TColourID_tag = record @@ -158,29 +148,11 @@ type PColourIDW = ^TColourIDW; const - { register a colour (this should be used for everything except actual text colour for registered fonts) } - { [note - a colour with name 'Background' has special meaning and will be used as the background colour of } - { the font list box in the options, for the given group] } - { wparam = pointer to ColourID structure } - { lparam = hLangpack } - MS_COLOUR_REGISTERA:PAnsiChar = 'Colour/Register'; - MS_COLOUR_REGISTERW:PAnsiChar = 'Colour/RegisterW'; - - { get a colour } - { wparam = pointer to ColourID structure (only name and group matter) } - { returns the colour (as COLORREF), or -1 if not found } - MS_COLOUR_GETA:PAnsiChar = 'Colour/Get'; - MS_COLOUR_GETW:PAnsiChar = 'Colour/GetW'; - { fired when a user modifies font settings, so reget your fonts and colours } ME_COLOUR_RELOAD:PAnsiChar = 'Colour/Reload'; -var - MS_FONT_REGISTER :PAnsiChar absolute MS_FONT_REGISTERW; - MS_FONT_GET :PAnsiChar absolute MS_FONT_GETW; - MS_COLOUR_REGISTER:PAnsiChar absolute MS_COLOUR_REGISTERW; - MS_COLOUR_GET :PAnsiChar absolute MS_COLOUR_GETW; - +function Colour_Register(pColour:pColourID; hLang:int) : int; stdcall; external AppDll; +function Colour_Get(pGroup,pName:pAnsiChar) : longint; stdcall; external AppDll; ////////////////////////////////////////////////////////////////////////// // @@ -225,19 +197,6 @@ type TEffectIDW = EffectIDW_tag; const -// register an effect -// wparam = (EffectID *)&effect_id -// lparam = hLangpack - MS_EFFECT_REGISTERA:PAnsiChar = 'Effect/Register'; - MS_EFFECT_REGISTERW:PAnsiChar = 'Effect/RegisterW'; - -// get a effect -// wparam = (EffectID *)&effect_id (only name and group matter) -// lparam = (FONTEFFECT *)&effect -// rerturns 0, or -1 if not found - MS_EFFECT_GET :PAnsiChar = 'Effect/Get'; - MS_EFFECT_GETW:PAnsiChar = 'Effect/GetW'; - // fired when a user modifies font settings, so reget your fonts and colours // wparam = lparam = 0 ME_EFFECT_RELOAD:PAnsiChar = 'Effect/Reload'; diff --git a/include/delphi/m_helpers.inc b/include/delphi/m_helpers.inc index 62bdd92c10..f923dcc8d9 100644 --- a/include/delphi/m_helpers.inc +++ b/include/delphi/m_helpers.inc @@ -60,14 +60,8 @@ function Skin_AddIcon(si:PSKINICONDESC):THANDLE; procedure Icon_Register (hInst:HINST; const szSection:PAnsiChar; pIcons:pIconItem ; iCount:size_t; prefix:PAnsiChar); procedure Icon_RegisterW(hInst:HINST; const szSection:PWideChar; pIcons:pIconItemW; iCount:size_t; prefix:PAnsiChar); -procedure FontRegister (pFontID:pFontID); -procedure FontRegisterW(pFontID:pFontIDW); - -procedure ColourRegister (pColorID:pColourID); -procedure ColourRegisterW(pColorID:pColourIDW); - -procedure EffectRegister (pEffectID:pEffectID); -procedure EffectRegisterW(pEffectID:pEffectIDW); +procedure FontRegister(pFontID:pFontID); +procedure ColourRegister(pColorID:pColourID); function TopToolbar_AddButton(pButton:PTTBButton):THANDLE; @@ -421,29 +415,12 @@ end; procedure FontRegister(pFontID:pFontID); begin - CallService(MS_FONT_REGISTERA, WPARAM(pFontID), hLangpack); -end; -procedure FontRegisterW(pFontID:pFontIDW); -begin - CallService(MS_FONT_REGISTERW, WPARAM(pFontID), hLangpack); + Font_Register(pFontID, hLangpack); end; procedure ColourRegister(pColorID:pColourID); begin - CallService(MS_COLOUR_REGISTERA, WPARAM(pColorID), hLangpack); -end; -procedure ColourRegisterW(pColorID:pColourIDW); -begin - CallService(MS_COLOUR_REGISTERW, WPARAM(pColorID), hLangpack); -end; - -procedure EffectRegister(pEffectID:pEffectID); -begin - CallService(MS_EFFECT_REGISTERA, WPARAM(pEffectID), hLangpack); -end; -procedure EffectRegisterW(pEffectID:pEffectIDW); -begin - CallService(MS_EFFECT_REGISTERW, WPARAM(pEffectID), hLangpack); + Colour_Register(pColorID, hLangpack); end; function TopToolbar_AddButton(pButton:PTTBButton):THANDLE; diff --git a/include/m_fontservice.h b/include/m_fontservice.h index ad89aeab34..022e03e140 100644 --- a/include/m_fontservice.h +++ b/include/m_fontservice.h @@ -93,30 +93,26 @@ struct FontIDW }; // register a font -// wparam = (FontID *)&font_id -// lparam = hLangpack - extern int hLangpack; -__forceinline void FontRegister(FontID* pFontID) -{ - CallService("Font/Register", (WPARAM)pFontID, hLangpack); -} - -__forceinline void FontRegisterW(FontIDW* pFontID) -{ - CallService("Font/RegisterW", (WPARAM)pFontID, hLangpack); -} +EXTERN_C MIR_APP_DLL(int) Font_Register(FontID *pFont, int = hLangpack); +EXTERN_C MIR_APP_DLL(int) Font_RegisterW(FontIDW *pFont, int = hLangpack); // get a font // will fill the logfont structure passed in with the user's choices, or the default if it was set and the user has not chosen a font yet, // or the global default font settings otherwise (i.e. no user choice and default set, or font not registered) // global default font is gotten using SPI_GETICONTITLELOGFONT, color COLOR_WINDOWTEXT, size 8. -// wparam = (FontID *)&font_id (only name and group matter) -// lParam = (LOGFONT *)&logfont // returns the font's colour -#define MS_FONT_GET "Font/Get" -#define MS_FONT_GETW "Font/GetW" + +EXTERN_C MIR_APP_DLL(COLORREF) Font_Get(const char *szGroup, const char *szName, LOGFONTA *pFont); +EXTERN_C MIR_APP_DLL(COLORREF) Font_GetW(const wchar_t *wszGroup, const wchar_t *wszName, LOGFONTW *pFont); + +__forceinline COLORREF Font_Get(FontID &p, LOGFONTA *pFont) +{ return Font_Get(p.group, p.name, pFont); +} +__forceinline COLORREF Font_GetW(FontIDW &p, LOGFONTW *pFont) +{ return Font_GetW(p.group, p.name, pFont); +} // fired when a user modifies font settings, so reload your fonts // wparam = lparam = 0 @@ -162,24 +158,17 @@ struct ColourIDW // register a colour (this should be used for everything except actual text colour for registered fonts) // [note - a colour with name 'Background' [translated!] has special meaning and will be used as the background colour of // the font list box in the options, for the given group] -// wparam = (ColourID *)&colour_id -// lparam = hLangpack -__forceinline void ColourRegister(ColourID* pColorID) -{ - CallService("Colour/Register", (WPARAM)pColorID, hLangpack); -} - -__forceinline void ColourRegisterW(ColourIDW* pColorID) -{ - CallService("Colour/RegisterW", (WPARAM)pColorID, hLangpack); -} +EXTERN_C MIR_APP_DLL(int) Colour_Register(ColourID *pFont, int = hLangpack); +EXTERN_C MIR_APP_DLL(int) Colour_RegisterW(ColourIDW *pFont, int = hLangpack); // get a colour -// wparam = (ColourID *)&colour_id (only name and group matter) -// rerturns the colour (as COLORREF), or -1 if not found -#define MS_COLOUR_GET "Colour/Get" -#define MS_COLOUR_GETW "Colour/GetW" +EXTERN_C MIR_APP_DLL(COLORREF) Colour_Get(const char *szGroup, const char *szName); +EXTERN_C MIR_APP_DLL(COLORREF) Colour_GetW(const wchar_t *wszGroup, const wchar_t *wszName); + +__forceinline COLORREF Colour_GetW(ColourIDW &p) +{ return Colour_GetW(p.group, p.name); +} // fired when a user modifies font settings, so reget your fonts and colours // wparam = lparam = 0 @@ -230,22 +219,16 @@ struct EffectIDW // wparam = (EffectID *)&effect_id // lparam = 0 -__forceinline void EffectRegister(EffectID* pEffectID) -{ - CallService("Effect/Register", (WPARAM)pEffectID, hLangpack); -} - -__forceinline void EffectRegisterW(EffectIDW* pEffectID) -{ - CallService("Effect/RegisterW", (WPARAM)pEffectID, hLangpack); -} +EXTERN_C MIR_APP_DLL(int) Effect_Register(EffectID *pEffect, int = hLangpack); +EXTERN_C MIR_APP_DLL(int) Effect_RegisterW(EffectIDW *pEffect, int = hLangpack); // get a effect // wparam = (EffectID *)&effect_id (only name and group matter) // lparam = (FONTEFFECT *)&effect // rerturns 0, or -1 if not found -#define MS_EFFECT_GET "Effect/Get" -#define MS_EFFECT_GETW "Effect/GetW" + +EXTERN_C MIR_APP_DLL(int) Effect_Get(const char *szGroup, const char *wszName, FONTEFFECT *pEffect); +EXTERN_C MIR_APP_DLL(int) Effect_GetW(const wchar_t *wszGroup, const wchar_t *szName, FONTEFFECT *pEffect); // fired when a user modifies font settings, so reget your fonts and colours // wparam = lparam = 0 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); diff --git a/protocols/JabberG/src/jabber.cpp b/protocols/JabberG/src/jabber.cpp index ff4ec8afe3..5b1ad552b1 100644 --- a/protocols/JabberG/src/jabber.cpp +++ b/protocols/JabberG/src/jabber.cpp @@ -142,12 +142,12 @@ static int OnModulesLoaded(WPARAM, LPARAM) wcsncpy_s(fontid.name, LPGENW("Frame title"), _TRUNCATE); strncpy_s(fontid.prefix, "fntFrameTitle", _TRUNCATE); fontid.deffontsettings.style = DBFONTF_BOLD; - FontRegisterW(&fontid); + Font_RegisterW(&fontid); wcsncpy_s(fontid.name, LPGENW("Frame text"), _TRUNCATE); strncpy_s(fontid.prefix, "fntFrameClock", _TRUNCATE); fontid.deffontsettings.style = 0; - FontRegisterW(&fontid); + Font_RegisterW(&fontid); ColourIDW colourid = {0}; colourid.cbSize = sizeof(colourid); @@ -157,7 +157,7 @@ static int OnModulesLoaded(WPARAM, LPARAM) wcsncpy_s(colourid.name, L"Background", _TRUNCATE); strncpy_s(colourid.setting, "clFrameBack", _TRUNCATE); colourid.defcolour = GetSysColor(COLOR_WINDOW); - ColourRegisterW(&colourid); + Colour_RegisterW(&colourid); return 0; } diff --git a/protocols/JabberG/src/jabber_frame.cpp b/protocols/JabberG/src/jabber_frame.cpp index be116dc5ae..acf6098cde 100644 --- a/protocols/JabberG/src/jabber_frame.cpp +++ b/protocols/JabberG/src/jabber_frame.cpp @@ -239,25 +239,15 @@ void CJabberInfoFrame::Update() void CJabberInfoFrame::ReloadFonts() { LOGFONT lfFont; - - FontIDW fontid = {0}; - fontid.cbSize = sizeof(fontid); - wcsncpy_s(fontid.group, L"Jabber", _TRUNCATE); - wcsncpy_s(fontid.name, L"Frame title", _TRUNCATE); - m_clTitle = CallService(MS_FONT_GETW, (WPARAM)&fontid, (LPARAM)&lfFont); + m_clTitle = Font_GetW(L"Jabber", L"Frame title", &lfFont); DeleteObject(m_hfntTitle); m_hfntTitle = CreateFontIndirect(&lfFont); - wcsncpy_s(fontid.name, L"Frame text", _TRUNCATE); - m_clText = CallService(MS_FONT_GETW, (WPARAM)&fontid, (LPARAM)&lfFont); + m_clText = Font_GetW(L"Jabber", L"Frame text",&lfFont); DeleteObject(m_hfntText); m_hfntText = CreateFontIndirect(&lfFont); - ColourIDW colourid = {0}; - colourid.cbSize = sizeof(colourid); - wcsncpy_s(colourid.group, L"Jabber", _TRUNCATE); - wcsncpy_s(colourid.name, L"Background", _TRUNCATE); - m_clBack = CallService(MS_COLOUR_GETW, (WPARAM)&colourid, 0); + m_clBack = Colour_GetW(L"Jabber", L"Background"); UpdateSize(); } diff --git a/src/core/stdchat/src/main.cpp b/src/core/stdchat/src/main.cpp index d12604f44e..581022c42c 100644 --- a/src/core/stdchat/src/main.cpp +++ b/src/core/stdchat/src/main.cpp @@ -292,27 +292,27 @@ static void RegisterFonts() strncpy(colourid.setting, "ColorLogBG", _countof(colourid.setting)); wcsncpy(colourid.name, LPGENW("Group chat log background"), _countof(colourid.name)); colourid.defcolour = GetSysColor(COLOR_WINDOW); - ColourRegisterW(&colourid); + Colour_RegisterW(&colourid); strncpy(colourid.setting, "ColorMessageBG", _countof(colourid.setting)); wcsncpy(colourid.name, LPGENW("Message background"), _countof(colourid.name)); colourid.defcolour = GetSysColor(COLOR_WINDOW); - ColourRegisterW(&colourid); + Colour_RegisterW(&colourid); strncpy(colourid.setting, "ColorNicklistBG", _countof(colourid.setting)); wcsncpy(colourid.name, LPGENW("Nick list background"), _countof(colourid.name)); colourid.defcolour = GetSysColor(COLOR_WINDOW); - ColourRegisterW(&colourid); + Colour_RegisterW(&colourid); strncpy(colourid.setting, "ColorNicklistLines", _countof(colourid.setting)); wcsncpy(colourid.name, LPGENW("Nick list lines"), _countof(colourid.name)); colourid.defcolour = GetSysColor(COLOR_INACTIVEBORDER); - ColourRegisterW(&colourid); + Colour_RegisterW(&colourid); strncpy(colourid.setting, "ColorNicklistSelectedBG", _countof(colourid.setting)); wcsncpy(colourid.name, LPGENW("Nick list background (selected)"), _countof(colourid.name)); colourid.defcolour = GetSysColor(COLOR_HIGHLIGHT); - ColourRegisterW(&colourid); + Colour_RegisterW(&colourid); } static int OnCheckPlugins(WPARAM, LPARAM) diff --git a/src/core/stdclist/src/clcfonts.cpp b/src/core/stdclist/src/clcfonts.cpp index dc53eed62d..7fb8c60095 100644 --- a/src/core/stdclist/src/clcfonts.cpp +++ b/src/core/stdclist/src/clcfonts.cpp @@ -76,7 +76,7 @@ void RegisterCListFonts() mir_snprintf(idstr, "Font%d", i); strncpy(fontid.prefix, idstr, _countof(fontid.prefix)); fontid.order = i; - FontRegisterW(&fontid); + Font_RegisterW(&fontid); } ReleaseDC(NULL, hdc); @@ -90,25 +90,25 @@ void RegisterCListFonts() 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); HookEvent(ME_FONT_RELOAD, FS_FontsChanged); } diff --git a/src/core/stdmsg/src/msgoptions.cpp b/src/core/stdmsg/src/msgoptions.cpp index 9935c9d747..0c59ddabaa 100644 --- a/src/core/stdmsg/src/msgoptions.cpp +++ b/src/core/stdmsg/src/msgoptions.cpp @@ -117,7 +117,7 @@ void RegisterSRMMFonts(void) fontid.deffontsettings.charset = MsgDlgGetFontDefaultCharset(fontOptionsList[i].szDefFace); wcsncpy_s(fontid.backgroundGroup, LPGENW("Message log"), _TRUNCATE); wcsncpy_s(fontid.backgroundName, LPGENW("Background"), _TRUNCATE); - FontRegisterW(&fontid); + Font_RegisterW(&fontid); } ColourIDW colourid = { sizeof(colourid) }; @@ -126,7 +126,7 @@ void RegisterSRMMFonts(void) colourid.defcolour = SRMSGDEFSET_BKGCOLOUR; wcsncpy_s(colourid.name, LPGENW("Background"), _TRUNCATE); wcsncpy_s(colourid.group, LPGENW("Message log"), _TRUNCATE); - ColourRegisterW(&colourid); + Colour_RegisterW(&colourid); } ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/mir_app/src/FontService.cpp b/src/mir_app/src/FontService.cpp index 5c3d72d6d4..0eb5a3999a 100644 --- a/src/mir_app/src/FontService.cpp +++ b/src/mir_app/src/FontService.cpp @@ -271,28 +271,28 @@ static int sttRegisterFontWorker(FontIDW *font_id, int _hLang) return 0; } -static INT_PTR RegisterFontW(WPARAM wParam, LPARAM lParam) +MIR_APP_DLL(int) Font_RegisterW(FontIDW *pFont, int _hLang) { - return sttRegisterFontWorker((FontIDW*)wParam, (int)lParam); + return sttRegisterFontWorker(pFont, _hLang); } -static INT_PTR RegisterFont(WPARAM wParam, LPARAM lParam) +MIR_APP_DLL(int) Font_Register(FontID *pFont, int _hLang) { FontIDW temp; - if (!ConvertFontID((FontID*)wParam, &temp)) return -1; - return sttRegisterFontWorker(&temp, (int)lParam); + if (!ConvertFontID(pFont, &temp)) return -1; + return sttRegisterFontWorker(&temp, _hLang); } ///////////////////////////////////////////////////////////////////////////////////////// // GetFont service -static INT_PTR sttGetFontWorker(FontIDW *font_id, LOGFONT *lf) +static COLORREF sttGetFontWorker(const wchar_t *wszGroup, const wchar_t *wszName, LOGFONTW *lf) { COLORREF colour; for (int i = 0; i < font_id_list.getCount(); i++) { FontInternal& F = font_id_list[i]; - if (!wcsncmp(F.name, font_id->name, _countof(F.name)) && !wcsncmp(F.group, font_id->group, _countof(F.group))) { + if (!wcsncmp(F.name, wszName, _countof(F.name)) && !wcsncmp(F.group, wszGroup, _countof(F.group))) { if (GetFontSettingFromDB(F.dbSettingsGroup, F.prefix, lf, &colour, F.flags) && (F.flags & FIDF_DEFAULTVALID)) { CreateFromFontSettings(&F.deffontsettings, lf); colour = F.deffontsettings.colour; @@ -306,20 +306,16 @@ static INT_PTR sttGetFontWorker(FontIDW *font_id, LOGFONT *lf) return colour; } -static INT_PTR GetFontW(WPARAM wParam, LPARAM lParam) +MIR_APP_DLL(COLORREF) Font_GetW(const wchar_t *wszGroup, const wchar_t *wszName, LOGFONTW *pFont) { - return sttGetFontWorker((FontIDW*)wParam, (LOGFONT*)lParam); + return sttGetFontWorker(wszGroup, wszName, pFont); } -static INT_PTR GetFont(WPARAM wParam, LPARAM lParam) +MIR_APP_DLL(COLORREF) Font_Get(const char *szGroup, const char *szName, LOGFONTA *pFont) { - FontIDW temp; - if (!ConvertFontID((FontID*)wParam, &temp)) - return -1; - - LOGFONT lftemp; - int ret = sttGetFontWorker(&temp, &lftemp); - ConvertLOGFONT(&lftemp, (LOGFONTA*)lParam); + LOGFONTW lftemp; + COLORREF ret = sttGetFontWorker(_A2T(szGroup), _A2T(szName), &lftemp); + ConvertLOGFONT(&lftemp, pFont); return ret; } @@ -366,42 +362,40 @@ static INT_PTR sttRegisterColourWorker(ColourIDW *colour_id, int _hLang) return 0; } -static INT_PTR RegisterColourW(WPARAM wParam, LPARAM lParam) +MIR_APP_DLL(int) Colour_RegisterW(ColourIDW *pFont, int _hLang) { - return sttRegisterColourWorker((ColourIDW*)wParam, (int)lParam); + return sttRegisterColourWorker(pFont, _hLang); } -static INT_PTR RegisterColour(WPARAM wParam, LPARAM lParam) +MIR_APP_DLL(int) Colour_Register(ColourID *pFont, int _hLang) { ColourIDW temp; - if (!ConvertColourID((ColourID*)wParam, &temp)) return -1; - return sttRegisterColourWorker(&temp, (int)lParam); + if (!ConvertColourID(pFont, &temp)) return -1; + return sttRegisterColourWorker(&temp, _hLang); } ///////////////////////////////////////////////////////////////////////////////////////// // GetColour service -static INT_PTR sttGetColourWorker(ColourIDW *colour_id) +static INT_PTR sttGetColourWorker(const wchar_t *wszGroup, const wchar_t *wszName) { for (int i = 0; i < colour_id_list.getCount(); i++) { ColourInternal& C = colour_id_list[i]; - if (!mir_wstrcmp(C.group, colour_id->group) && !mir_wstrcmp(C.name, colour_id->name)) + if (!mir_wstrcmp(C.group, wszGroup) && !mir_wstrcmp(C.name, wszName)) return db_get_dw(NULL, C.dbSettingsGroup, C.setting, C.defcolour); } return -1; } -static INT_PTR GetColourW(WPARAM wParam, LPARAM) +MIR_APP_DLL(COLORREF) Colour_GetW(const wchar_t *wszGroup, const wchar_t *wszName) { - return sttGetColourWorker((ColourIDW*)wParam); + return sttGetColourWorker(wszGroup, wszName); } -static INT_PTR GetColour(WPARAM wParam, LPARAM) +MIR_APP_DLL(COLORREF) Colour_Get(const char *szGroup, const char *szName) { - ColourIDW temp; - if (!ConvertColourID((ColourID*)wParam, &temp)) return -1; - return sttGetColourWorker(&temp); + return sttGetColourWorker(_A2T(szGroup), _A2T(szName)); } static INT_PTR ReloadColours(WPARAM, LPARAM) @@ -438,7 +432,7 @@ void UpdateEffectSettings(EffectIDW *effect_id, FONTEFFECT *effectsettings) ///////////////////////////////////////////////////////////////////////////////////////// // RegisterEffect service -static INT_PTR sttRegisterEffectWorker(EffectIDW *effect_id, int _hLang) +static int sttRegisterEffectWorker(EffectIDW *effect_id, int _hLang) { if (effect_id->cbSize != sizeof(EffectIDW)) return -1; @@ -458,32 +452,27 @@ static INT_PTR sttRegisterEffectWorker(EffectIDW *effect_id, int _hLang) return 0; } -static INT_PTR RegisterEffectW(WPARAM wParam, LPARAM lParam) +MIR_APP_DLL(int) Effect_RegisterW(EffectIDW *pFont, int _hLang) { - return sttRegisterEffectWorker((EffectIDW*)wParam, (int)lParam); + return sttRegisterEffectWorker(pFont, _hLang); } -static INT_PTR RegisterEffect(WPARAM wParam, LPARAM lParam) +MIR_APP_DLL(int) Effect_Register(EffectID *pFont, int _hLang) { EffectIDW temp; - if (!ConvertEffectID((EffectID*)wParam, &temp)) return -1; - return sttRegisterEffectWorker(&temp, (int)lParam); + if (!ConvertEffectID(pFont, &temp)) return -1; + return sttRegisterEffectWorker(&temp, _hLang); } ///////////////////////////////////////////////////////////////////////////////////////// // GetEffect service -static INT_PTR sttGetEffectWorker(EffectIDW *effect_id, FONTEFFECT *effect) +static INT_PTR sttGetEffectWorker(const wchar_t *wszGroup, const wchar_t *wszName, FONTEFFECT *effect) { for (int i = 0; i < effect_id_list.getCount(); i++) { EffectInternal& E = effect_id_list[i]; - if (!wcsncmp(E.name, effect_id->name, _countof(E.name)) && !wcsncmp(E.group, effect_id->group, _countof(E.group))) { - FONTEFFECT temp; - UpdateEffectSettings(effect_id, &temp); - - effect->effectIndex = temp.effectIndex; - effect->baseColour = temp.baseColour; - effect->secondaryColour = temp.secondaryColour; + if (!wcsncmp(E.name, wszName, _countof(E.name)) && !wcsncmp(E.group, wszGroup, _countof(E.group))) { + UpdateEffectSettings(&E, effect); return TRUE; } } @@ -491,16 +480,14 @@ static INT_PTR sttGetEffectWorker(EffectIDW *effect_id, FONTEFFECT *effect) return FALSE; } -static INT_PTR GetEffectW(WPARAM wParam, LPARAM lParam) +EXTERN_C MIR_APP_DLL(int) Effect_GetW(const wchar_t *wszGroup, const wchar_t *wszName, FONTEFFECT *pEffect) { - return sttGetEffectWorker((EffectIDW*)wParam, (FONTEFFECT*)lParam); + return sttGetEffectWorker(wszGroup, wszName, pEffect); } -static INT_PTR GetEffect(WPARAM wParam, LPARAM lParam) +MIR_APP_DLL(int) Effect_Get(const char *szGroup, const char *szName, FONTEFFECT *pEffect) { - EffectIDW temp; - if (!ConvertEffectID((EffectID*)wParam, &temp)) return -1; - return sttGetEffectWorker(&temp, (FONTEFFECT*)lParam); + return sttGetEffectWorker(_A2T(szGroup), _A2T(szName), pEffect); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -538,21 +525,6 @@ int LoadFontserviceModule(void) { code_page = Langpack_GetDefaultCodePage(); - CreateServiceFunction("Font/Register", RegisterFont); - CreateServiceFunction("Font/RegisterW", RegisterFontW); - CreateServiceFunction(MS_FONT_GET, GetFont); - CreateServiceFunction(MS_FONT_GETW, GetFontW); - - CreateServiceFunction("Colour/Register", RegisterColour); - CreateServiceFunction("Colour/RegisterW", RegisterColourW); - CreateServiceFunction(MS_COLOUR_GET, GetColour); - CreateServiceFunction(MS_COLOUR_GETW, GetColourW); - - CreateServiceFunction("Effect/Register", RegisterEffect); - CreateServiceFunction("Effect/RegisterW", RegisterEffectW); - CreateServiceFunction(MS_EFFECT_GET, GetEffect); - CreateServiceFunction(MS_EFFECT_GETW, GetEffectW); - CreateServiceFunction(MS_FONT_RELOAD, ReloadFonts); CreateServiceFunction(MS_COLOUR_RELOAD, ReloadColours); @@ -567,17 +539,17 @@ int LoadFontserviceModule(void) wcsncpy_s(fontid.name, LPGENW("Headers"), _TRUNCATE); fontid.flags = FIDF_APPENDNAME | FIDF_NOAS | FIDF_SAVEPOINTSIZE | FIDF_ALLOWEFFECTS | FIDF_CLASSHEADER; strncpy(fontid.prefix, "Header", _countof(fontid.prefix)); - FontRegisterW(&fontid); + Font_RegisterW(&fontid); wcsncpy_s(fontid.name, LPGENW("Generic text"), _TRUNCATE); fontid.flags = FIDF_APPENDNAME | FIDF_NOAS | FIDF_SAVEPOINTSIZE | FIDF_ALLOWEFFECTS | FIDF_CLASSGENERAL; strncpy(fontid.prefix, "Generic", _countof(fontid.prefix)); - FontRegisterW(&fontid); + Font_RegisterW(&fontid); wcsncpy_s(fontid.name, LPGENW("Small text"), _TRUNCATE); fontid.flags = FIDF_APPENDNAME | FIDF_NOAS | FIDF_SAVEPOINTSIZE | FIDF_ALLOWEFFECTS | FIDF_CLASSSMALL; strncpy(fontid.prefix, "Small", _countof(fontid.prefix)); - FontRegisterW(&fontid); + Font_RegisterW(&fontid); // do last for silly dyna plugin HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index c6ec271572..fb947113ec 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -311,3 +311,15 @@ Chat_Terminate @311 Chat_AddGroup @312 Chat_Control @313 Clist_FindItem @314 +Colour_Get @315 +Colour_GetW @316 +Colour_Register @317 +Colour_RegisterW @318 +Effect_Get @319 +Effect_GetW @320 +Effect_Register @321 +Effect_RegisterW @322 +Font_Get @323 +Font_GetW @324 +Font_Register @325 +Font_RegisterW @326 diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 05b5e0945b..e8f7a4bc37 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -311,3 +311,15 @@ Chat_Terminate @311 Chat_AddGroup @312 Chat_Control @313 Clist_FindItem @314 +Colour_Get @315 +Colour_GetW @316 +Colour_Register @317 +Colour_RegisterW @318 +Effect_Get @319 +Effect_GetW @320 +Effect_Register @321 +Effect_RegisterW @322 +Font_Get @323 +Font_GetW @324 +Font_Register @325 +Font_RegisterW @326 diff --git a/utils/mir_fonts.cpp b/utils/mir_fonts.cpp index 9b8c32cb23..d8b7056adf 100644 --- a/utils/mir_fonts.cpp +++ b/utils/mir_fonts.cpp @@ -30,19 +30,10 @@ int FontService_RegisterFont(const char *pszDbModule, const char *pszDbName, con fid.deffontsettings.charset = plfDefault->lfCharSet; mir_wstrncpy(fid.deffontsettings.szFace, plfDefault->lfFaceName, _countof(fid.deffontsettings.szFace)); /* buffer safe */ } - FontRegisterW(&fid); + Font_RegisterW(&fid); return 0; } -int FontService_GetFont(const wchar_t *pszSection, const wchar_t *pszDescription, COLORREF *pclr, LOGFONT *plf) -{ - FontIDW fid = { 0 }; - mir_wstrncpy(fid.group, pszSection, _countof(fid.group)); /* buffer sfae */ - mir_wstrncpy(fid.name, pszDescription, _countof(fid.name)); /* buffer safe */ - *pclr = (COLORREF)CallService(MS_FONT_GETW, (WPARAM)&fid, (LPARAM)plf); /* uses fallback font on error */ - return (int)*pclr == -1; -} - int FontService_RegisterColor(const char *pszDbModule, const char *pszDbName, const wchar_t *pszSection, const wchar_t *pszDescription, COLORREF clrDefault) { ColourIDW cid = { 0 }; @@ -52,16 +43,6 @@ int FontService_RegisterColor(const char *pszDbModule, const char *pszDbName, co mir_strncpy(cid.setting, pszDbName, sizeof(cid.setting)); /* buffer safe */ mir_wstrncpy(cid.group, pszSection, _countof(cid.group)); /* buffer safe */ mir_wstrncpy(cid.name, pszDescription, _countof(cid.name)); /* buffer safe */ - ColourRegisterW(&cid); + Colour_RegisterW(&cid); return 0; } - -int FontService_GetColor(const wchar_t *pszSection, const wchar_t *pszDescription, COLORREF *pclr) -{ - ColourIDW cid = { 0 }; - cid.cbSize = sizeof(cid); - wcsncpy_s(cid.group, pszSection, _TRUNCATE); - wcsncpy_s(cid.name, pszDescription, _TRUNCATE); - *pclr = (COLORREF)CallService(MS_COLOUR_GETW, (WPARAM)&cid, 0); - return (int)*pclr == -1; -} diff --git a/utils/mir_fonts.h b/utils/mir_fonts.h index b85b82ce74..2f7226777e 100644 --- a/utils/mir_fonts.h +++ b/utils/mir_fonts.h @@ -1,6 +1,3 @@ int FontService_RegisterFont(const char *pszDbModule, const char *pszDbName, const TCHAR *pszSection, const TCHAR *pszDescription, const TCHAR* pszBackgroundGroup, const TCHAR* pszBackgroundName, int position, BOOL bAllowEffects, LOGFONT *plfDefault, COLORREF clrDefault); -int FontService_GetFont(const TCHAR *pszSection, const TCHAR *pszDescription, COLORREF *pclr, LOGFONT *plf); - int FontService_RegisterColor(const char *pszDbModule,const char *pszDbName,const TCHAR *pszSection,const TCHAR *pszDescription,COLORREF clrDefault); -int FontService_GetColor(const TCHAR *pszSection,const TCHAR *pszDescription,COLORREF *pclr); -- cgit v1.2.3