From ed1449fa491e90197b78b64b52c70910f1736dd7 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 25 Jun 2012 15:05:30 +0000 Subject: dynamic fonts' options translation git-svn-id: http://svn.miranda-ng.org/main/trunk@633 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- include/m_fontservice.h | 235 ++++++----- plugins/Alarms/alarm_win.cpp | 69 ++-- plugins/Alarms/frame.cpp | 63 ++- plugins/BasicHistory/Options.cpp | 2 +- plugins/Chat/options.cpp | 12 +- plugins/Clist_classic/clcfonts.cpp | 10 +- plugins/Clist_modern/modern_clcopts.cpp | 220 +++++----- plugins/Clist_mw/CLUIFrames/cluiframes.cpp | 24 +- plugins/Clist_mw/clcfonts.cpp | 11 +- plugins/Clist_nicer/SRC/clui.cpp | 11 +- plugins/Console/Console.cpp | 87 ++-- plugins/ExternalAPI/m_toptoolbar.h | 11 +- plugins/FavContacts/src/main.cpp | 12 +- plugins/Popup/src/font.cpp | 4 +- plugins/Popup/src/notifications.cpp | 4 +- plugins/Popup/src/services.cpp | 4 +- plugins/SRMM/msgoptions.cpp | 4 +- plugins/Scriver/msgoptions.cpp | 14 +- plugins/TabSRMM/chat/options.cpp | 36 +- plugins/TipperYM/tipper.cpp | 11 +- plugins/TooltipNotify/src/TooltipNotify.cpp | 4 +- plugins/YAPP/popups2.cpp | 241 ++++------- protocols/JabberG/jabber.cpp | 6 +- protocols/Weather/weather_mwin.cpp | 15 +- src/modules/fonts/FontOptions.cpp | 620 ++++++++++++++-------------- src/modules/fonts/FontService.cpp | 26 +- src/modules/fonts/FontService.h | 83 ++-- src/modules/fonts/services.cpp | 246 +++++------ 28 files changed, 958 insertions(+), 1127 deletions(-) diff --git a/include/m_fontservice.h b/include/m_fontservice.h index b1561b2d5a..1d826437ef 100644 --- a/include/m_fontservice.h +++ b/include/m_fontservice.h @@ -5,6 +5,11 @@ #ifndef _FONT_SERVICE_API_INC #define _FONT_SERVICE_API_INC +////////////////////////////////////////////////////////////////////////// +// +// FONTS +// + // style flags #define DBFONTF_BOLD 1 #define DBFONTF_ITALIC 2 @@ -34,33 +39,28 @@ // settings to be used for the value of 'deffontsettings' in the FontID structure below - i.e. defaults typedef struct FontSettings_tag { - COLORREF colour; - char size; - BYTE style; // see the DBFONTF_* flags above - BYTE charset; - char szFace[LF_FACESIZE]; + COLORREF colour; + char size; + BYTE style; // see the DBFONTF_* flags above + BYTE charset; + char szFace[LF_FACESIZE]; } FontSettings; typedef struct FontSettingsW_tag { - COLORREF colour; - char size; - BYTE style; // see the DBFONTF_* flags above - BYTE charset; - wchar_t szFace[LF_FACESIZE]; + COLORREF colour; + char size; + BYTE style; // see the DBFONTF_* flags above + BYTE charset; + wchar_t szFace[LF_FACESIZE]; } FontSettingsW; -#define FontID_SIZEOF_V2A 372 -#define FontID_SIZEOF_V2U 660 - #if defined( _UNICODE ) - #define FontSettingsT FontSettingsW - #define FontID_SIZEOF_V2 FontID_SIZEOF_V2U + #define FontSettingsT FontSettingsW #else - #define FontSettingsT FontSettings - #define FontID_SIZEOF_V2 FontID_SIZEOF_V2A + #define FontSettingsT FontSettings #endif // a font identifier structure - used for registering a font, and getting one out again @@ -68,7 +68,8 @@ typedef struct FontSettingsW_tag // WARNING: do not use Translate(TS) for name or group as they // are translated by the core, which may lead to double translation. // Use LPGEN instead which are just dummy wrappers/markers for "lpgen.pl". -typedef struct FontID_tag { +typedef struct FontID_tag +{ int cbSize; char group[64]; // [TRANSLATED-BY-CORE] group the font belongs to - this is the 'Font Group' list in the options page char name[64]; // [TRANSLATED-BY-CORE] this is the name of the font setting - e.g. 'contacts' in the 'contact list' group @@ -83,7 +84,8 @@ typedef struct FontID_tag { } FontID; -typedef struct FontIDW_tag { +typedef struct FontIDW_tag +{ int cbSize; wchar_t group[64]; // [TRANSLATED-BY-CORE] group the font belongs to - this is the 'Font Group' list in the options page wchar_t name[64]; // [TRANSLATED-BY-CORE] this is the name of the font setting - e.g. 'contacts' in the 'contact list' group @@ -99,64 +101,30 @@ typedef struct FontIDW_tag { FontIDW; #if defined( _UNICODE ) - #define FontIDT FontIDW -#else - #define FontIDT FontID -#endif - -// WARNING: do not use Translate(TS) for name or group as they -// are translated by the core, which may lead to double translation. -// Use LPGEN instead which are just dummy wrappers/markers for "lpgen.pl". -typedef struct ColourID_tag { - int cbSize; - char group[64]; // [TRANSLATED-BY-CORE] - char name[64]; // [TRANSLATED-BY-CORE] - char dbSettingsGroup[32]; - char setting[32]; - DWORD flags; // not used - COLORREF defcolour; // default value - int order; -} - ColourID; - -// a font identifier structure - used for registering a font, and getting one out again -typedef struct ColourIDW_tag { - int cbSize; - wchar_t group[64]; // [TRANSLATED-BY-CORE] - wchar_t name[64]; // [TRANSLATED-BY-CORE] - char dbSettingsGroup[32]; - char setting[32]; - DWORD flags; // not used - COLORREF defcolour; // default value - int order; -} - ColourIDW; - -#if defined( _UNICODE ) - #define ColourIDT ColourIDW + #define FontIDT FontIDW #else - #define ColourIDT ColourID + #define FontIDT FontID #endif // register a font // wparam = (FontID *)&font_id -// lparam = 0 -#define MS_FONT_REGISTER "Font/Register" -#define MS_FONT_REGISTERW "Font/RegisterW" +// lparam = hLangpack + +extern int hLangpack; __forceinline void FontRegister( FontID* pFontID ) -{ CallService( MS_FONT_REGISTER, (WPARAM)pFontID, 0 ); +{ CallService("Font/Register", (WPARAM)pFontID, hLangpack); } __forceinline void FontRegisterW( FontIDW* pFontID ) -{ CallService( MS_FONT_REGISTERW, (WPARAM)pFontID, 0 ); +{ CallService("Font/RegisterW", (WPARAM)pFontID, hLangpack); } #if defined( _UNICODE ) #define MS_FONT_REGISTERT MS_FONT_REGISTERW #define FontRegisterT FontRegisterW #else - #define MS_FONT_REGISTERT MS_FONT_REGISTER + #define MS_FONT_REGISTERT MS_FONT_REGISTER #define FontRegisterT FontRegister #endif @@ -171,27 +139,76 @@ __forceinline void FontRegisterW( FontIDW* pFontID ) #define MS_FONT_GETW "Font/GetW" #if defined( _UNICODE ) - #define MS_FONT_GETT MS_FONT_GETW + #define MS_FONT_GETT MS_FONT_GETW #else - #define MS_FONT_GETT MS_FONT_GET + #define MS_FONT_GETT MS_FONT_GET #endif // fired when a user modifies font settings, so reload your fonts // wparam = lparam = 0 #define ME_FONT_RELOAD "Font/Reload" +////////////////////////////////////////////////////////////////////////// +// +// COLOURS +// + +// WARNING: do not use Translate(TS) for name or group as they +// are translated by the core, which may lead to double translation. +// Use LPGEN instead which are just dummy wrappers/markers for "lpgen.pl". +typedef struct ColourID_tag +{ + int cbSize; + char group[64]; // [TRANSLATED-BY-CORE] + char name[64]; // [TRANSLATED-BY-CORE] + char dbSettingsGroup[32]; + char setting[32]; + DWORD flags; // not used + COLORREF defcolour; // default value + int order; +} + ColourID; + +// a font identifier structure - used for registering a font, and getting one out again +typedef struct ColourIDW_tag +{ + int cbSize; + wchar_t group[64]; // [TRANSLATED-BY-CORE] + wchar_t name[64]; // [TRANSLATED-BY-CORE] + char dbSettingsGroup[32]; + char setting[32]; + DWORD flags; // not used + COLORREF defcolour; // default value + int order; +} + ColourIDW; + +#if defined( _UNICODE ) + #define ColourIDT ColourIDW +#else + #define ColourIDT ColourID +#endif + // 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 = 0 -#define MS_COLOUR_REGISTER "Colour/Register" -#define MS_COLOUR_REGISTERW "Colour/RegisterW" +// lparam = hLangpack + +__forceinline void ColourRegister(ColourID* pColorID) +{ CallService("Colour/Register", (WPARAM)pColorID, hLangpack); +} + +__forceinline void ColourRegisterW(ColourIDW* pColorID) +{ CallService("Colour/RegisterW", (WPARAM)pColorID, hLangpack); +} #if defined( _UNICODE ) - #define MS_COLOUR_REGISTERT MS_COLOUR_REGISTERW + #define MS_COLOUR_REGISTERT MS_COLOUR_REGISTERW + #define ColourRegisterT ColourRegisterW #else - #define MS_COLOUR_REGISTERT MS_COLOUR_REGISTER + #define MS_COLOUR_REGISTERT MS_COLOUR_REGISTER + #define ColourRegisterT ColourRegister #endif // get a colour @@ -201,74 +218,81 @@ __forceinline void FontRegisterW( FontIDW* pFontID ) #define MS_COLOUR_GETW "Colour/GetW" #if defined( _UNICODE ) - #define MS_COLOUR_GETT MS_COLOUR_GETW + #define MS_COLOUR_GETT MS_COLOUR_GETW #else - #define MS_COLOUR_GETT MS_COLOUR_GET + #define MS_COLOUR_GETT MS_COLOUR_GET #endif // fired when a user modifies font settings, so reget your fonts and colours // wparam = lparam = 0 #define ME_COLOUR_RELOAD "Colour/Reload" - ////////////////////////////////////////////////////////////////////////// // // EFFECTS // typedef struct FONTEFFECT_tag { - BYTE effectIndex; - DWORD baseColour; // ARGB - DWORD secondaryColour; // ARGB + BYTE effectIndex; + DWORD baseColour; // ARGB + DWORD secondaryColour; // ARGB } - FONTEFFECT; + FONTEFFECT; typedef struct EffectID_tag { - int cbSize; - char group[64]; - char name[64]; - char dbSettingsGroup[32]; - char setting[32]; - DWORD flags; - FONTEFFECT defeffect; - int order; - - FONTEFFECT value; + int cbSize; + char group[64]; + char name[64]; + char dbSettingsGroup[32]; + char setting[32]; + DWORD flags; + FONTEFFECT defeffect; + int order; + + FONTEFFECT value; } - EffectID; + EffectID; typedef struct EffectIDW_tag { - int cbSize; - wchar_t group[64]; - wchar_t name[64]; - char dbSettingsGroup[32]; - char setting[32]; - DWORD flags; - FONTEFFECT defeffect; - int order; - - FONTEFFECT value; + int cbSize; + wchar_t group[64]; + wchar_t name[64]; + char dbSettingsGroup[32]; + char setting[32]; + DWORD flags; + FONTEFFECT defeffect; + int order; + + FONTEFFECT value; } - EffectIDW; + EffectIDW; #if defined( _UNICODE ) - #define EffectIDT EffectIDW + #define EffectIDT EffectIDW #else - #define EffectIDT EffectID + #define EffectIDT EffectID #endif // register an effect // wparam = (EffectID *)&effect_id // lparam = 0 -#define MS_EFFECT_REGISTER "Effect/Register" -#define MS_EFFECT_REGISTERW "Effect/RegisterW" + +__forceinline void EffectRegister(EffectID* pEffectID) +{ CallService("Effect/Register", (WPARAM)pEffectID, hLangpack); +} + +__forceinline void EffectRegisterW(EffectIDW* pEffectID) +{ CallService("Effect/RegisterW", (WPARAM)pEffectID, hLangpack); +} #if defined( _UNICODE ) - #define MS_EFFECT_REGISTERT MS_EFFECT_REGISTERW + #define MS_EFFECT_REGISTERT MS_EFFECT_REGISTERW + #define EffectRegisterT EffectRegisterW #else - #define MS_EFFECT_REGISTERT MS_EFFECT_REGISTER + #define MS_EFFECT_REGISTERT MS_EFFECT_REGISTER + #define EffectRegisterT EffectRegister #endif // get a effect @@ -279,14 +303,13 @@ typedef struct EffectIDW_tag #define MS_EFFECT_GETW "Effect/GetW" #if defined( _UNICODE ) - #define MS_EFFECT_GETT MS_EFFECT_GETW + #define MS_EFFECT_GETT MS_EFFECT_GETW #else - #define MS_EFFECT_GETT MS_EFFECT_GET + #define MS_EFFECT_GETT MS_EFFECT_GET #endif // fired when a user modifies font settings, so reget your fonts and colours // wparam = lparam = 0 #define ME_EFFECT_RELOAD "Effect/Reload" - #endif // _FONT_SERVICE_API_INC diff --git a/plugins/Alarms/alarm_win.cpp b/plugins/Alarms/alarm_win.cpp index 30b4dd31e5..11a29e42b5 100644 --- a/plugins/Alarms/alarm_win.cpp +++ b/plugins/Alarms/alarm_win.cpp @@ -370,42 +370,39 @@ int ReloadFonts(WPARAM wParam, LPARAM lParam) { return 0; } -int AlarmWinModulesLoaded(WPARAM wParam, LPARAM lParam) { - if (ServiceExists(MS_FONT_REGISTER)) { - title_font_id.cbSize = sizeof(FontID); - strcpy(title_font_id.group, Translate("Alarms")); - strcpy(title_font_id.name, Translate("Title")); - strcpy(title_font_id.dbSettingsGroup, MODULE); - strcpy(title_font_id.prefix, "FontTitle"); - title_font_id.flags = 0; - title_font_id.order = 0; - - CallService(MS_FONT_REGISTER, (WPARAM)&title_font_id, 0); - - window_font_id.cbSize = sizeof(FontID); - strcpy(window_font_id.group, Translate("Alarms")); - strcpy(window_font_id.name, Translate("Window")); - strcpy(window_font_id.dbSettingsGroup, MODULE); - strcpy(window_font_id.prefix, "FontWindow"); - window_font_id.flags = 0; - window_font_id.order = 1; - - CallService(MS_FONT_REGISTER, (WPARAM)&window_font_id, 0); - - bk_colour_id.cbSize = sizeof(ColourID); - strcpy(bk_colour_id.dbSettingsGroup, MODULE); - strcpy(bk_colour_id.group, Translate("Alarms")); - strcpy(bk_colour_id.name, Translate("Background")); - strcpy(bk_colour_id.setting, "BkColour"); - bk_colour_id.defcolour = GetSysColor(COLOR_3DFACE); - bk_colour_id.flags = 0; - bk_colour_id.order = 0; - - CallService(MS_COLOUR_REGISTER, (WPARAM)&bk_colour_id, 0); - - ReloadFonts(0, 0); - HookEvent(ME_FONT_RELOAD, ReloadFonts); - } +int AlarmWinModulesLoaded(WPARAM wParam, LPARAM lParam) +{ + title_font_id.cbSize = sizeof(FontID); + strcpy(title_font_id.group, Translate("Alarms")); + strcpy(title_font_id.name, Translate("Title")); + strcpy(title_font_id.dbSettingsGroup, MODULE); + strcpy(title_font_id.prefix, "FontTitle"); + title_font_id.flags = 0; + title_font_id.order = 0; + FontRegister(&title_font_id); + + window_font_id.cbSize = sizeof(FontID); + strcpy(window_font_id.group, Translate("Alarms")); + strcpy(window_font_id.name, Translate("Window")); + strcpy(window_font_id.dbSettingsGroup, MODULE); + strcpy(window_font_id.prefix, "FontWindow"); + window_font_id.flags = 0; + window_font_id.order = 1; + FontRegister(&window_font_id); + + bk_colour_id.cbSize = sizeof(ColourID); + strcpy(bk_colour_id.dbSettingsGroup, MODULE); + strcpy(bk_colour_id.group, Translate("Alarms")); + strcpy(bk_colour_id.name, Translate("Background")); + strcpy(bk_colour_id.setting, "BkColour"); + bk_colour_id.defcolour = GetSysColor(COLOR_3DFACE); + bk_colour_id.flags = 0; + bk_colour_id.order = 0; + + ColourRegister(&bk_colour_id); + + ReloadFonts(0, 0); + HookEvent(ME_FONT_RELOAD, ReloadFonts); return 0; } diff --git a/plugins/Alarms/frame.cpp b/plugins/Alarms/frame.cpp index 1e39c38c32..6ebb459026 100644 --- a/plugins/Alarms/frame.cpp +++ b/plugins/Alarms/frame.cpp @@ -603,47 +603,30 @@ int CreateFrame() SendMessage(hwnd_plugin, WMU_INITIALIZE, 0, 0); - if (ServiceExists(MS_FONT_REGISTER)) { - font_id.cbSize = sizeof(FontID); - strncpy(font_id.group, Translate("Frames"), sizeof(font_id.group)); - strncpy(font_id.name, Translate("Alarm Reminders"), sizeof(font_id.name)); - strncpy(font_id.dbSettingsGroup, MODULE, sizeof(font_id.dbSettingsGroup)); - strncpy(font_id.prefix, "Font", sizeof(font_id.prefix)); - font_id.order = 0; - CallService(MS_FONT_REGISTER, (WPARAM)&font_id, 0); - - framebk_colour_id.cbSize = sizeof(ColourID); - strcpy(framebk_colour_id.dbSettingsGroup, MODULE); - strcpy(framebk_colour_id.group, Translate("Frames")); - strcpy(framebk_colour_id.name, Translate("Alarm Reminders")); - strcpy(framebk_colour_id.setting, "clFrameBack"); - framebk_colour_id.defcolour = GetSysColor(COLOR_3DFACE); - framebk_colour_id.flags = 0; - framebk_colour_id.order = 0; - CallService(MS_COLOUR_REGISTER, (WPARAM)&framebk_colour_id, 0); - - LOGFONT log_font; - fontColour = CallService(MS_FONT_GET, (WPARAM)&font_id, (LPARAM)&log_font); - hFont = CreateFontIndirect(&log_font); - SendMessage(hwnd_list, WM_SETFONT, (WPARAM)hFont, (LPARAM)TRUE); - - HookEvent(ME_FONT_RELOAD, ReloadFont); - - } else { - LOGFONT lf; - SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(LOGFONT), &lf, FALSE); - lf.lfHeight = 10; + font_id.cbSize = sizeof(font_id); + strncpy(font_id.group, LPGEN("Frames"), sizeof(font_id.group)); + strncpy(font_id.name, LPGEN("Alarm Reminders"), sizeof(font_id.name)); + strncpy(font_id.dbSettingsGroup, MODULE, sizeof(font_id.dbSettingsGroup)); + strncpy(font_id.prefix, "Font", sizeof(font_id.prefix)); + font_id.order = 0; + FontRegister(&font_id); + + framebk_colour_id.cbSize = sizeof(ColourID); + strcpy(framebk_colour_id.dbSettingsGroup, MODULE); + strcpy(framebk_colour_id.group, LPGEN("Frames")); + strcpy(framebk_colour_id.name, LPGEN("Alarm Reminders")); + strcpy(framebk_colour_id.setting, "clFrameBack"); + framebk_colour_id.defcolour = GetSysColor(COLOR_3DFACE); + framebk_colour_id.flags = 0; + framebk_colour_id.order = 0; + ColourRegister(&framebk_colour_id); - HDC hdc = GetDC(0); - lf.lfHeight = -MulDiv(lf.lfHeight,GetDeviceCaps(hdc, LOGPIXELSY), 72); - ReleaseDC(0, hdc); - - hFont = CreateFontIndirect(&lf); - - //fontColour = GetSysColor(COLOR_WINDOWTEXT); - // match clist 'normal contact' colour if no font service - fontColour = (COLORREF)DBGetContactSettingDword(0, "CLC", "Font0Col", GetSysColor(COLOR_WINDOWTEXT)); - } + LOGFONT log_font; + fontColour = CallService(MS_FONT_GET, (WPARAM)&font_id, (LPARAM)&log_font); + hFont = CreateFontIndirect(&log_font); + SendMessage(hwnd_list, WM_SETFONT, (WPARAM)hFont, (LPARAM)TRUE); + + HookEvent(ME_FONT_RELOAD, ReloadFont); // create the brush used for the background in the absence of clist_modern skinning features - match clist bk_brush = CreateSolidBrush(DBGetContactSettingDword(0, "Alarm", "clFrameBack", GetSysColor(COLOR_3DFACE))); diff --git a/plugins/BasicHistory/Options.cpp b/plugins/BasicHistory/Options.cpp index be024479ee..06a64d35e4 100644 --- a/plugins/BasicHistory/Options.cpp +++ b/plugins/BasicHistory/Options.cpp @@ -272,7 +272,7 @@ void Options::Load() sprintf_s(cid.setting, SIZEOF(cid.setting), "Color%d", i); cid.order = i; cid.defcolour = g_ColorOptionsList[i].def; - CallService(MS_COLOUR_REGISTERT, (WPARAM)&cid, 0); + ColourRegisterT(&cid); } hid.dwFlags = HKD_TCHAR; diff --git a/plugins/Chat/options.cpp b/plugins/Chat/options.cpp index 77989d4b39..f8def495a0 100644 --- a/plugins/Chat/options.cpp +++ b/plugins/Chat/options.cpp @@ -391,7 +391,7 @@ void RegisterFonts( void ) _tcsncpy(fontid.backgroundName, _T("Background"), SIZEOF(fontid.backgroundName)); break; } - CallService(MS_FONT_REGISTERT, (WPARAM)&fontid, 0); + FontRegisterT(&fontid); } colourid.cbSize = sizeof(ColourIDT); @@ -402,27 +402,27 @@ void RegisterFonts( void ) _tcsncpy(colourid.name, LPGENT("Background"), SIZEOF(colourid.name)); _tcsncpy(colourid.group, LPGENT("Chat Module"), SIZEOF(colourid.group)); colourid.defcolour = GetSysColor(COLOR_WINDOW); - CallService(MS_COLOUR_REGISTERT, (WPARAM)&colourid, 0); + ColourRegisterT(&colourid); strncpy(colourid.setting, "ColorMessageBG", SIZEOF(colourid.setting)); _tcsncpy(colourid.name, LPGENT("Message Background"), SIZEOF(colourid.name)); colourid.defcolour = GetSysColor(COLOR_WINDOW); - CallService(MS_COLOUR_REGISTERT, (WPARAM)&colourid, 0); + ColourRegisterT(&colourid); strncpy(colourid.setting, "ColorNicklistBG", SIZEOF(colourid.setting)); _tcsncpy(colourid.name, LPGENT("Userlist Background"), SIZEOF(colourid.name)); colourid.defcolour = GetSysColor(COLOR_WINDOW); - CallService(MS_COLOUR_REGISTERT, (WPARAM)&colourid, 0); + ColourRegisterT(&colourid); strncpy(colourid.setting, "ColorNicklistLines", SIZEOF(colourid.setting)); _tcsncpy(colourid.name, LPGENT("Userlist Lines"), SIZEOF(colourid.name)); colourid.defcolour = GetSysColor(COLOR_INACTIVEBORDER); - CallService(MS_COLOUR_REGISTERT, (WPARAM)&colourid, 0); + ColourRegisterT(&colourid); strncpy(colourid.setting, "ColorNicklistSelectedBG", SIZEOF(colourid.setting)); _tcsncpy(colourid.name, LPGENT("Userlist Background (selected)"), SIZEOF(colourid.name)); colourid.defcolour = GetSysColor(COLOR_HIGHLIGHT); - CallService(MS_COLOUR_REGISTERT, (WPARAM)&colourid, 0); + ColourRegisterT(&colourid); } // add icons to the skinning module diff --git a/plugins/Clist_classic/clcfonts.cpp b/plugins/Clist_classic/clcfonts.cpp index 9ff56524a4..6a2f3062dc 100644 --- a/plugins/Clist_classic/clcfonts.cpp +++ b/plugins/Clist_classic/clcfonts.cpp @@ -101,7 +101,7 @@ void RegisterCListFonts() strncpy(fontid.prefix, idstr, SIZEOF(fontid.prefix)); fontid.order = fontListOrder[i]; - CallService(MS_FONT_REGISTERT, (WPARAM)&fontid, 0); + FontRegisterT(&fontid); } // and colours @@ -113,25 +113,25 @@ void RegisterCListFonts() _tcsncpy(colourid.name, LPGENT("Background"), SIZEOF(colourid.name)); _tcsncpy(colourid.group, LPGENT("Contact List"), SIZEOF(colourid.group)); colourid.defcolour = CLCDEFAULT_BKCOLOUR; - CallService(MS_COLOUR_REGISTERT, (WPARAM)&colourid, 0); + ColourRegisterT(&colourid); strncpy(colourid.setting, "SelTextColour", sizeof(colourid.setting)); _tcsncpy(colourid.name, LPGENT("Selected Text"), SIZEOF(colourid.name)); colourid.order = 1; colourid.defcolour = CLCDEFAULT_SELTEXTCOLOUR; - CallService(MS_COLOUR_REGISTERT, (WPARAM)&colourid, 0); + ColourRegisterT(&colourid); strncpy(colourid.setting, "HotTextColour", sizeof(colourid.setting)); _tcsncpy(colourid.name, LPGENT("Hottrack Text"), SIZEOF(colourid.name)); colourid.order = 1; colourid.defcolour = CLCDEFAULT_HOTTEXTCOLOUR; - CallService(MS_COLOUR_REGISTERT, (WPARAM)&colourid, 0); + ColourRegisterT(&colourid); strncpy(colourid.setting, "QuickSearchColour", sizeof(colourid.setting)); _tcsncpy(colourid.name, LPGENT("Quicksearch Text"), SIZEOF(colourid.name)); colourid.order = 1; colourid.defcolour = CLCDEFAULT_QUICKSEARCHCOLOUR; - CallService(MS_COLOUR_REGISTERT, (WPARAM)&colourid, 0); + ColourRegisterT(&colourid); HookEvent(ME_FONT_RELOAD, FS_FontsChanged); } diff --git a/plugins/Clist_modern/modern_clcopts.cpp b/plugins/Clist_modern/modern_clcopts.cpp index 4585205f2f..100076f84a 100644 --- a/plugins/Clist_modern/modern_clcopts.cpp +++ b/plugins/Clist_modern/modern_clcopts.cpp @@ -2,8 +2,8 @@ Miranda IM: the free IM client for Microsoft* Windows* -Copyright 2000-2008 Miranda ICQ/IM project, -all portions of this codebase are copyrighted to the people +Copyright 2000-2008 Miranda ICQ/IM project, +all portions of this codebase are copyrighted to the people listed in contributors.txt. This program is free software; you can redistribute it and/or @@ -82,7 +82,7 @@ static struct FontOptionsList fontOptionsList[] = { { FIDF_CLASSGENERAL, FONTID_PHONE, CLCGROUP, LPGENT( "On the phone contacts"), DEFAULT_COLOUR, DEFAULT_FAMILY, DEFAULT_CHARSET, FONTF_NORMAL, DEFAULT_SIZE, DEFAULT_EFFECT }, { FIDF_CLASSGENERAL, FONTID_LUNCH, CLCGROUP, LPGENT( "Out to lunch contacts"), DEFAULT_COLOUR, DEFAULT_FAMILY, DEFAULT_CHARSET, FONTF_NORMAL, DEFAULT_SIZE, DEFAULT_EFFECT }, { FIDF_CLASSGENERAL, FONTID_OFFLINE, CLCGROUP, LPGENT( "Offline contacts"), DEFAULT_GREYCOLOUR, DEFAULT_FAMILY, DEFAULT_CHARSET, FONTF_NORMAL, DEFAULT_SIZE, DEFAULT_EFFECT }, - { FIDF_CLASSGENERAL, FONTID_INVIS, CLCGROUP, LPGENT( "Online contacts to whom you have a different visibility"), DEFAULT_COLOUR, DEFAULT_FAMILY, DEFAULT_CHARSET, FONTF_NORMAL, DEFAULT_SIZE, DEFAULT_EFFECT }, + { FIDF_CLASSGENERAL, FONTID_INVIS, CLCGROUP, LPGENT( "Online contacts to whom you have a different visibility"), DEFAULT_COLOUR, DEFAULT_FAMILY, DEFAULT_CHARSET, FONTF_NORMAL, DEFAULT_SIZE, DEFAULT_EFFECT }, { FIDF_CLASSGENERAL, FONTID_OFFINVIS, CLCGROUP, LPGENT( "Offline contacts to whom you have a different visibility"), DEFAULT_COLOUR, DEFAULT_FAMILY, DEFAULT_CHARSET, FONTF_NORMAL, DEFAULT_SIZE, DEFAULT_EFFECT }, { FIDF_CLASSGENERAL, FONTID_NOTONLIST, CLCGROUP, LPGENT( "Contacts who are 'not on list'"), DEFAULT_COLOUR, DEFAULT_FAMILY, DEFAULT_CHARSET, FONTF_NORMAL, DEFAULT_SIZE, DEFAULT_EFFECT }, { FIDF_CLASSHEADER, FONTID_OPENGROUPS, CLCGROUP, LPGENT( "Open groups"), DEFAULT_COLOUR, DEFAULT_FAMILY, DEFAULT_CHARSET, FONTF_BOLD, DEFAULT_SIZE, DEFAULT_EFFECT }, @@ -90,11 +90,11 @@ static struct FontOptionsList fontOptionsList[] = { { FIDF_CLASSHEADER, FONTID_CLOSEDGROUPS, CLCGROUP, LPGENT( "Closed groups"), DEFAULT_COLOUR, DEFAULT_FAMILY, DEFAULT_CHARSET, FONTF_BOLD, DEFAULT_SIZE, DEFAULT_EFFECT }, { FIDF_CLASSHEADER, FONTID_CLOSEDGROUPCOUNTS, CLCGROUP, LPGENT( "Closed group member counts"), DEFAULT_COLOUR, DEFAULT_FAMILY, DEFAULT_CHARSET, FONTF_NORMAL, DEFAULT_SIZE, DEFAULT_EFFECT }, { FIDF_CLASSSMALL, FONTID_DIVIDERS, CLCGROUP, LPGENT( "Dividers"), DEFAULT_COLOUR, DEFAULT_FAMILY, DEFAULT_CHARSET, FONTF_NORMAL, DEFAULT_SIZE, DEFAULT_EFFECT }, - + { FIDF_CLASSSMALL, FONTID_SECONDLINE, CLCLINESGROUP, LPGENT( "Second line"), DEFAULT_COLOUR, DEFAULT_FAMILY, DEFAULT_CHARSET, FONTF_NORMAL, DEFAULT_SMALLSIZE, DEFAULT_EFFECT }, { FIDF_CLASSSMALL, FONTID_THIRDLINE, CLCLINESGROUP, LPGENT( "Third line"), DEFAULT_COLOUR, DEFAULT_FAMILY, DEFAULT_CHARSET, FONTF_NORMAL, DEFAULT_SMALLSIZE, DEFAULT_EFFECT }, { FIDF_CLASSSMALL, FONTID_CONTACT_TIME, CLCLINESGROUP, LPGENT( "Contact time"), DEFAULT_COLOUR, DEFAULT_FAMILY, DEFAULT_CHARSET, FONTF_NORMAL, DEFAULT_SMALLSIZE, DEFAULT_EFFECT }, - + { FIDF_CLASSGENERAL, FONTID_STATUSBAR_PROTONAME, CLCFRAMESGROUP, LPGENT( "Status bar text"), DEFAULT_COLOUR, DEFAULT_FAMILY, DEFAULT_CHARSET, FONTF_NORMAL, DEFAULT_SIZE, DEFAULT_EFFECT }, { FIDF_CLASSGENERAL, FONTID_EVENTAREA, CLCFRAMESGROUP, LPGENT( "Event area text"), DEFAULT_COLOUR, DEFAULT_FAMILY, DEFAULT_CHARSET, FONTF_NORMAL, DEFAULT_SIZE, DEFAULT_EFFECT }, { FIDF_CLASSGENERAL, FONTID_VIEMODES, CLCFRAMESGROUP, LPGENT( "Current view mode text"), DEFAULT_COLOUR, DEFAULT_FAMILY, DEFAULT_CHARSET, FONTF_NORMAL, DEFAULT_SIZE, DEFAULT_EFFECT }, @@ -134,15 +134,14 @@ void RegisterCLUIFonts( void ) if ( registered ) return; FontIDT fontid = {0}; - ColourIDT colourid = {0}; EffectIDT effectid = {0}; char idstr[10]; int i, index = 0; - fontid.cbSize = FontID_SIZEOF_V2; + fontid.cbSize = sizeof(fontid); strncpy(fontid.dbSettingsGroup, "CLC", SIZEOF(fontid.dbSettingsGroup)); - effectid.cbSize = sizeof( EffectIDT ); + effectid.cbSize = sizeof(effectid); strncpy(effectid.dbSettingsGroup, "CLC", SIZEOF(effectid.dbSettingsGroup)); for ( i = 0; i < SIZEOF(fontOptionsList); i++, index++ ) @@ -162,7 +161,7 @@ void RegisterCLUIFonts( void ) fontid.deffontsettings.style = fontOptionsList[i].defStyle; _tcsncpy(fontid.deffontsettings.szFace, fontOptionsList[i].szDefFace, SIZEOF(fontid.deffontsettings.szFace)); - CallService(MS_FONT_REGISTERT, (WPARAM)&fontid, 0); + FontRegisterT(&fontid); _tcsncpy(effectid.group, fontOptionsList[i].szGroup, SIZEOF(effectid.group)); _tcsncpy(effectid.name, fontOptionsList[i].szDescr, SIZEOF(effectid.name)); @@ -174,10 +173,11 @@ void RegisterCLUIFonts( void ) effectid.defeffect.baseColour = fontOptionsList[i].defeffect.baseColour; effectid.defeffect.secondaryColour = fontOptionsList[i].defeffect.secondaryColour; - CallService(MS_EFFECT_REGISTERT, (WPARAM)&effectid, 0); - + EffectRegisterT(&effectid); } - colourid.cbSize = sizeof( ColourIDT ); + + ColourIDT colourid = {0}; + colourid.cbSize = sizeof(colourid); for ( i = 0; i < SIZEOF( colourOptionsList); i++ ) { @@ -187,7 +187,7 @@ void RegisterCLUIFonts( void ) strncpy(colourid.dbSettingsGroup, colourOptionsList[i].chGroup, SIZEOF(colourid.dbSettingsGroup)); colourid.defcolour = colourOptionsList[i].defColour; colourid.order = i + 1; - CallService(MS_COLOUR_REGISTERT, (WPARAM)&colourid, 0); + ColourRegisterT(&colourid); } registered = true; } @@ -224,7 +224,7 @@ void GetFontSetting(int i,LOGFONT *lf,COLORREF *colour,BYTE *effect, COLORREF *e return; FontIDT fontid = {0}; - fontid.cbSize = FontID_SIZEOF_V2; + fontid.cbSize = sizeof(fontid); _tcsncpy( fontid.group, fontOptionsList[index].szGroup, SIZEOF( fontid.group )); _tcsncpy( fontid.name, fontOptionsList[index].szDescr, SIZEOF( fontid.name )); @@ -261,14 +261,14 @@ struct int nExpertControls; DWORD flag; // Expertonly } -static clist_opt_items[] = -{ +static clist_opt_items[] = +{ { LPGEN("General"), IDD_OPT_CLIST, DlgProcClistOpts, NULL, 0, 0}, { LPGEN("Tray"), IDD_OPT_TRAY, DlgProcTrayOpts, NULL, 0, 0 }, { LPGEN("List"), IDD_OPT_CLC, DlgProcClistListOpts, NULL, 0, 0 }, { LPGEN("Window"), IDD_OPT_CLUI, DlgProcClistWindowOpts, NULL, 0, 0 }, { LPGEN("Behaviour"), IDD_OPT_CLUI_2, DlgProcClistBehaviourOpts, NULL, 0, 0 }, - { LPGEN("Status Bar"), IDD_OPT_SBAR, DlgProcSBarOpts, StatusBarExpertControls, SIZEOF(StatusBarExpertControls), 0}, + { LPGEN("Status Bar"), IDD_OPT_SBAR, DlgProcSBarOpts, StatusBarExpertControls, SIZEOF(StatusBarExpertControls), 0}, { LPGEN("Additional stuff"), IDD_OPT_META_CLC, DlgProcClistAdditionalOpts, NULL, 0, 0 } }; @@ -304,11 +304,11 @@ int ClcOptInit(WPARAM wParam,LPARAM lParam) odp.flags = ODPF_BOLDGROUPS; Options_AddPage(wParam, &odp); } - + return 0; } -struct CheckBoxToStyleEx_t +struct CheckBoxToStyleEx_t { int id; DWORD flag; @@ -411,7 +411,7 @@ static INT_PTR CALLBACK DlgProcClistAdditionalOpts(HWND hwndDlg, UINT msg, WPARA CheckDlgButton(hwndDlg, IDC_DISCOVER_AWAYMSG, ModernGetSettingByte(NULL,"ModernData","InternalAwayMsgDiscovery",SETTING_INTERNALAWAYMSGREQUEST_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); /// by FYR CheckDlgButton(hwndDlg, IDC_REMOVE_OFFLINE_AWAYMSG, ModernGetSettingByte(NULL,"ModernData","RemoveAwayMessageForOffline",SETTING_REMOVEAWAYMSGFOROFFLINE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); /// by FYR - SendDlgItemMessage(hwndDlg,IDC_SUBINDENTSPIN,UDM_SETBUDDY,(WPARAM)GetDlgItem(hwndDlg,IDC_SUBINDENT),0); + SendDlgItemMessage(hwndDlg,IDC_SUBINDENTSPIN,UDM_SETBUDDY,(WPARAM)GetDlgItem(hwndDlg,IDC_SUBINDENT),0); SendDlgItemMessage(hwndDlg,IDC_SUBINDENTSPIN,UDM_SETRANGE,0,MAKELONG(50,0)); SendDlgItemMessage(hwndDlg,IDC_SUBINDENTSPIN,UDM_SETPOS,0,MAKELONG(ModernGetSettingByte(NULL,"CLC","SubIndent",CLCDEFAULT_GROUPINDENT),0)); @@ -433,7 +433,7 @@ static INT_PTR CALLBACK DlgProcClistAdditionalOpts(HWND hwndDlg, UINT msg, WPARA CLUI_ShowWindowMod(GetDlgItem(hwndDlg,IDC_METAEXPAND),t); CLUI_ShowWindowMod(GetDlgItem(hwndDlg,IDC_METASUBEXTRA),t); CLUI_ShowWindowMod(GetDlgItem(hwndDlg,IDC_FRAME_META),t); - CLUI_ShowWindowMod(GetDlgItem(hwndDlg,IDC_FRAME_META_CAPT),!t); + CLUI_ShowWindowMod(GetDlgItem(hwndDlg,IDC_FRAME_META_CAPT),!t); CLUI_ShowWindowMod(GetDlgItem(hwndDlg,IDC_SUBINDENTSPIN),t); CLUI_ShowWindowMod(GetDlgItem(hwndDlg,IDC_SUBINDENT),t); CLUI_ShowWindowMod(GetDlgItem(hwndDlg,IDC_SUBIDENTCAPT),t); @@ -455,7 +455,7 @@ static INT_PTR CALLBACK DlgProcClistAdditionalOpts(HWND hwndDlg, UINT msg, WPARA return TRUE; case WM_NOTIFY: - switch(t->idFrom) + switch(t->idFrom) { case 0: switch (t->code) @@ -465,7 +465,7 @@ static INT_PTR CALLBACK DlgProcClistAdditionalOpts(HWND hwndDlg, UINT msg, WPARA ModernWriteSettingByte(NULL,"CLC","MetaDoubleClick",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_METADBLCLK)); // by FYR ModernWriteSettingByte(NULL,"CLC","MetaHideExtra",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_METASUBEXTRA)); // by FYR ModernWriteSettingByte(NULL,"CLC","MetaIgnoreEmptyExtra",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_METASUBEXTRA_IGN)); // by FYR - ModernWriteSettingByte(NULL,"CLC","MetaHideOfflineSub",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_METASUB_HIDEOFFLINE)); // by FYR + ModernWriteSettingByte(NULL,"CLC","MetaHideOfflineSub",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_METASUB_HIDEOFFLINE)); // by FYR ModernWriteSettingByte(NULL,"CLC","MetaExpanding",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_METAEXPAND)); ModernWriteSettingByte(NULL,"ModernData","InternalAwayMsgDiscovery",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_DISCOVER_AWAYMSG)); ModernWriteSettingByte(NULL,"ModernData","RemoveAwayMessageForOffline",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_REMOVE_OFFLINE_AWAYMSG)); @@ -503,7 +503,7 @@ static INT_PTR CALLBACK DlgProcClistListOpts(HWND hwndDlg, UINT msg, WPARAM wPar ImageList_AddIcon(himlCheckBoxes,LoadSmallIconShared(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_TICK))); TreeView_SetImageList(GetDlgItem(hwndDlg,IDC_GREYOUTOPTS),himlCheckBoxes,TVSIL_NORMAL); TreeView_SetImageList(GetDlgItem(hwndDlg,IDC_HIDEOFFLINEOPTS),himlCheckBoxes,TVSIL_NORMAL); - } + } { DWORD exStyle=ModernGetSettingDword(NULL,"CLC","ExStyle",GetDefaultExStyle()); for(int i=0;ipfnGetProtocolVisibility(accs[i]->szModuleName)==0 ) continue; netProtoCount++; @@ -784,7 +784,7 @@ static INT_PTR CALLBACK DlgProcClistOpts(HWND hwndDlg, UINT msg, WPARAM wParam, int i, item; int s1, s2, s3; - for (i=0; iidFrom) + switch (((LPNMHDR)lParam)->idFrom) { case 0: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: - ModernWriteSettingByte(NULL,"CList","HideOffline",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_HIDEOFFLINE)); + ModernWriteSettingByte(NULL,"CList","HideOffline",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_HIDEOFFLINE)); ModernWriteSettingByte(NULL,"CList","HideEmptyGroups",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_HIDEEMPTYGROUPS)); ModernWriteSettingByte(NULL,"CList","UseGroups",(BYTE)!IsDlgButtonChecked(hwndDlg,IDC_DISABLEGROUPS)); ModernWriteSettingByte(NULL,"CList","ConfirmDelete",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_CONFIRMDELETE)); @@ -936,7 +936,7 @@ static INT_PTR CALLBACK DlgProcTrayOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L } if (-1==(int)SendDlgItemMessage(hwndDlg,IDC_PRIMARYSTATUS,CB_GETCURSEL,0,0)) SendDlgItemMessage(hwndDlg,IDC_PRIMARYSTATUS,CB_SETCURSEL,0,0); - SendDlgItemMessage(hwndDlg,IDC_BLINKSPIN,UDM_SETBUDDY,(WPARAM)GetDlgItem(hwndDlg,IDC_BLINKTIME),0); // set buddy + SendDlgItemMessage(hwndDlg,IDC_BLINKSPIN,UDM_SETBUDDY,(WPARAM)GetDlgItem(hwndDlg,IDC_BLINKTIME),0); // set buddy SendDlgItemMessage(hwndDlg,IDC_BLINKSPIN,UDM_SETRANGE,0,MAKELONG(0x3FFF,250)); SendDlgItemMessage(hwndDlg,IDC_BLINKSPIN,UDM_SETPOS,0,MAKELONG(ModernGetSettingWord(NULL,"CList","IconFlashTime",SETTING_ICONFLASHTIME_DEFAULT),0)); { @@ -945,7 +945,7 @@ static INT_PTR CALLBACK DlgProcTrayOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L { EnableWindow(GetDlgItem(hwndDlg,IDC_PRIMARYSTATUS),TRUE); EnableWindow(GetDlgItem(hwndDlg,IDC_CYCLETIMESPIN),FALSE); - EnableWindow(GetDlgItem(hwndDlg,IDC_CYCLETIME),FALSE); + EnableWindow(GetDlgItem(hwndDlg,IDC_CYCLETIME),FALSE); EnableWindow(GetDlgItem(hwndDlg,IDC_ALWAYSPRIMARY),FALSE); EnableWindow(GetDlgItem(hwndDlg,IDC_ALWAYSPRIMARY),FALSE); EnableWindow(GetDlgItem(hwndDlg,IDC_CYCLE),FALSE); @@ -963,7 +963,7 @@ static INT_PTR CALLBACK DlgProcTrayOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWNORMAL),IsDlgButtonChecked(hwndDlg,IDC_SHOWXSTATUS)); EnableWindow(GetDlgItem(hwndDlg,IDC_TRANSPARENTOVERLAY),IsDlgButtonChecked(hwndDlg,IDC_SHOWXSTATUS)&&IsDlgButtonChecked(hwndDlg,IDC_SHOWNORMAL)); } - if(LOWORD(wParam)==IDC_DONTCYCLE || LOWORD(wParam)==IDC_CYCLE || LOWORD(wParam)==IDC_MULTITRAY) + if(LOWORD(wParam)==IDC_DONTCYCLE || LOWORD(wParam)==IDC_CYCLE || LOWORD(wParam)==IDC_MULTITRAY) { EnableWindow(GetDlgItem(hwndDlg,IDC_PRIMARYSTATUS),IsDlgButtonChecked(hwndDlg,IDC_DONTCYCLE)); EnableWindow(GetDlgItem(hwndDlg,IDC_CYCLETIME),IsDlgButtonChecked(hwndDlg,IDC_CYCLE)); @@ -978,7 +978,7 @@ static INT_PTR CALLBACK DlgProcTrayOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L break; case WM_NOTIFY: { - switch (((LPNMHDR)lParam)->idFrom) + switch (((LPNMHDR)lParam)->idFrom) { case 0: switch (((LPNMHDR)lParam)->code) @@ -1003,15 +1003,15 @@ static INT_PTR CALLBACK DlgProcTrayOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L xOptions=IsDlgButtonChecked(hwndDlg,IDC_SHOWXSTATUS)?1:0; xOptions|=(xOptions && IsDlgButtonChecked(hwndDlg,IDC_SHOWNORMAL))?2:0; xOptions|=(xOptions && IsDlgButtonChecked(hwndDlg,IDC_TRANSPARENTOVERLAY))?4:0; - ModernWriteSettingByte(NULL,"CLUI","XStatusTray",xOptions); + ModernWriteSettingByte(NULL,"CLUI","XStatusTray",xOptions); } { int cursel = SendDlgItemMessage(hwndDlg,IDC_PRIMARYSTATUS,CB_GETCURSEL,0,0); PROTOACCOUNT* pa = (PROTOACCOUNT*)SendDlgItemMessage(hwndDlg,IDC_PRIMARYSTATUS,CB_GETITEMDATA,cursel,0); - if ( !pa ) + if ( !pa ) ModernDeleteSetting(NULL, "CList","PrimaryStatus"); - else + else ModernWriteSettingString(NULL,"CList","PrimaryStatus", pa->szModuleName); } pcli->pfnTrayIconIconsChanged(); @@ -1050,9 +1050,9 @@ static INT_PTR CALLBACK DlgProcClistBehaviourOpts(HWND hwndDlg, UINT msg, WPARAM TranslateDialogDefault(hwndDlg); CheckDlgButton(hwndDlg, IDC_CLIENTDRAG, ModernGetSettingByte(NULL,"CLUI","ClientAreaDrag",SETTING_CLIENTDRAG_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_DRAGTOSCROLL, (ModernGetSettingByte(NULL,"CLUI","DragToScroll",SETTING_DRAGTOSCROLL_DEFAULT)&&!ModernGetSettingByte(NULL,"CLUI","ClientAreaDrag",SETTING_CLIENTDRAG_DEFAULT)) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_AUTOSIZE, g_CluiData.fAutoSize ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_LOCKSIZING, ModernGetSettingByte(NULL,"CLUI","LockSize",SETTING_LOCKSIZE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_BRINGTOFRONT, ModernGetSettingByte(NULL,"CList","BringToFront",SETTING_BRINGTOFRONT_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_AUTOSIZE, g_CluiData.fAutoSize ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_LOCKSIZING, ModernGetSettingByte(NULL,"CLUI","LockSize",SETTING_LOCKSIZE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_BRINGTOFRONT, ModernGetSettingByte(NULL,"CList","BringToFront",SETTING_BRINGTOFRONT_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); SendDlgItemMessage(hwndDlg,IDC_MAXSIZESPIN,UDM_SETRANGE,0,MAKELONG(100,0)); @@ -1142,7 +1142,7 @@ static INT_PTR CALLBACK DlgProcClistBehaviourOpts(HWND hwndDlg, UINT msg, WPARAM EnableWindow(GetDlgItem(hwndDlg,IDC_HIDEDELAY),mode!=0); EnableWindow(GetDlgItem(hwndDlg,IDC_HIDETIMESPIN2),mode!=0); EnableWindow(GetDlgItem(hwndDlg,IDC_HIDETIMESPIN3),mode!=0); - EnableWindow(GetDlgItem(hwndDlg,IDC_HIDETIMESPIN4),mode!=0); + EnableWindow(GetDlgItem(hwndDlg,IDC_HIDETIMESPIN4),mode!=0); EnableWindow(GetDlgItem(hwndDlg,IDC_HIDEDELAY2),mode!=0); EnableWindow(GetDlgItem(hwndDlg,IDC_STATIC5),mode!=0); EnableWindow(GetDlgItem(hwndDlg,IDC_STATIC6),mode!=0); @@ -1156,7 +1156,7 @@ static INT_PTR CALLBACK DlgProcClistBehaviourOpts(HWND hwndDlg, UINT msg, WPARAM return 0; // Enable apply button SendMessage(GetParent(hwndDlg), PSM_CHANGED, (WPARAM)hwndDlg, 0); - break; + break; case WM_NOTIFY: switch (((LPNMHDR)lParam)->code) { @@ -1166,11 +1166,11 @@ static INT_PTR CALLBACK DlgProcClistBehaviourOpts(HWND hwndDlg, UINT msg, WPARAM //DBWriteContactSettingByte(NULL,"CLUI","RightClientMargin",(BYTE)SendDlgItemMessage(hwndDlg,IDC_RIGHTMARGINSPIN,UDM_GETPOS,0,0)); //DBWriteContactSettingByte(NULL,"CLUI","TopClientMargin",(BYTE)SendDlgItemMessage(hwndDlg,IDC_TOPMARGINSPIN,UDM_GETPOS,0,0)); //DBWriteContactSettingByte(NULL,"CLUI","BottomClientMargin",(BYTE)SendDlgItemMessage(hwndDlg,IDC_BOTTOMMARGINSPIN,UDM_GETPOS,0,0)); - //if (g_proc_UpdateLayeredWindow!=NULL && IsDlgButtonChecked(hwndDlg,IDC_LAYERENGINE)) + //if (g_proc_UpdateLayeredWindow!=NULL && IsDlgButtonChecked(hwndDlg,IDC_LAYERENGINE)) // DBWriteContactSettingByte(NULL,"ModernData","EnableLayering",0); - //else - // DBDeleteContactSetting(NULL,"ModernData","EnableLayering"); - ModernWriteSettingByte(NULL,"ModernData","HideBehind",(BYTE)SendDlgItemMessage(hwndDlg,IDC_HIDEMETHOD,CB_GETCURSEL,0,0)); + //else + // DBDeleteContactSetting(NULL,"ModernData","EnableLayering"); + ModernWriteSettingByte(NULL,"ModernData","HideBehind",(BYTE)SendDlgItemMessage(hwndDlg,IDC_HIDEMETHOD,CB_GETCURSEL,0,0)); ModernWriteSettingWord(NULL,"ModernData","ShowDelay",(WORD)SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN2,UDM_GETPOS,0,0)); ModernWriteSettingWord(NULL,"ModernData","HideDelay",(WORD)SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN3,UDM_GETPOS,0,0)); ModernWriteSettingWord(NULL,"ModernData","HideBehindBorderSize",(WORD)SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN4,UDM_GETPOS,0,0)); @@ -1181,19 +1181,19 @@ static INT_PTR CALLBACK DlgProcClistBehaviourOpts(HWND hwndDlg, UINT msg, WPARAM ModernWriteSettingByte(NULL,"CLUI","ClientAreaDrag",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_CLIENTDRAG)); ModernWriteSettingByte(NULL,"CLUI","AutoSize",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_AUTOSIZE)); ModernWriteSettingByte(NULL,"CLUI","LockSize",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_LOCKSIZING)); - ModernWriteSettingByte(NULL,"CLUI","MaxSizeHeight",(BYTE)GetDlgItemInt(hwndDlg,IDC_MAXSIZEHEIGHT,NULL,FALSE)); - ModernWriteSettingByte(NULL,"CLUI","MinSizeHeight",(BYTE)GetDlgItemInt(hwndDlg,IDC_MINSIZEHEIGHT,NULL,FALSE)); + ModernWriteSettingByte(NULL,"CLUI","MaxSizeHeight",(BYTE)GetDlgItemInt(hwndDlg,IDC_MAXSIZEHEIGHT,NULL,FALSE)); + ModernWriteSettingByte(NULL,"CLUI","MinSizeHeight",(BYTE)GetDlgItemInt(hwndDlg,IDC_MINSIZEHEIGHT,NULL,FALSE)); ModernWriteSettingByte(NULL,"CLUI","AutoSizeUpward",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_AUTOSIZEUPWARD)); ModernWriteSettingByte(NULL,"CLUI","SnapToEdges",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_SNAPTOEDGES)); - - ModernWriteSettingByte(NULL,"CLUI","DockToSides",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_DOCKTOSIDES)); + + ModernWriteSettingByte(NULL,"CLUI","DockToSides",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_DOCKTOSIDES)); ModernWriteSettingByte(NULL,"CLUI","EventArea", (BYTE)(IsDlgButtonChecked(hwndDlg,IDC_EVENTAREA_ALWAYS)?2:(BYTE)IsDlgButtonChecked(hwndDlg,IDC_EVENTAREA)?1:0)); ModernWriteSettingByte(NULL,"CList","AutoHide",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_AUTOHIDE)); - ModernWriteSettingWord(NULL,"CList","HideTime",(WORD)SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN,UDM_GETPOS,0,0)); - CLUI_ChangeWindowMode(); + ModernWriteSettingWord(NULL,"CList","HideTime",(WORD)SendDlgItemMessage(hwndDlg,IDC_HIDETIMESPIN,UDM_GETPOS,0,0)); + CLUI_ChangeWindowMode(); SendMessage(pcli->hwndContactTree,WM_SIZE,0,0); //forces it to send a cln_listsizechanged CLUI_ReloadCLUIOptions(); EventArea_ConfigureEventArea(); @@ -1211,11 +1211,11 @@ static INT_PTR CALLBACK DlgProcClistWindowOpts(HWND hwndDlg, UINT msg, WPARAM wP BOOL fEnabled=FALSE; switch (msg) { - case WM_INITDIALOG: - + case WM_INITDIALOG: + TranslateDialogDefault(hwndDlg); g_hCLUIOptionsWnd=hwndDlg; - CheckDlgButton(hwndDlg, IDC_ONTOP, ModernGetSettingByte(NULL,"CList","OnTop",SETTING_ONTOP_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_ONTOP, ModernGetSettingByte(NULL,"CList","OnTop",SETTING_ONTOP_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); { // ====== Activate/Deactivate Non-Layered items ======= fEnabled=!g_CluiData.fLayered || g_CluiData.fDisableSkinEngine; EnableWindow(GetDlgItem(hwndDlg,IDC_TOOLWND),fEnabled); @@ -1240,7 +1240,7 @@ static INT_PTR CALLBACK DlgProcClistWindowOpts(HWND hwndDlg, UINT msg, WPARAM wP CheckDlgButton(hwndDlg, IDC_SHOWCAPTION, ModernGetSettingByte(NULL,"CLUI","ShowCaption",SETTING_SHOWCAPTION_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_SHOWMAINMENU, ModernGetSettingByte(NULL,"CLUI","ShowMainMenu",SETTING_SHOWMAINMENU_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); //EnableWindow(GetDlgItem(hwndDlg,IDC_CLIENTDRAG),!IsDlgButtonChecked(hwndDlg,IDC_DRAGTOSCROLL)); - if (!IsDlgButtonChecked(hwndDlg,IDC_SHOWCAPTION)) + if (!IsDlgButtonChecked(hwndDlg,IDC_SHOWCAPTION)) { EnableWindow(GetDlgItem(hwndDlg,IDC_MIN2TRAY),FALSE); EnableWindow(GetDlgItem(hwndDlg,IDC_TOOLWND),FALSE); @@ -1251,10 +1251,10 @@ static INT_PTR CALLBACK DlgProcClistWindowOpts(HWND hwndDlg, UINT msg, WPARAM wP EnableWindow(GetDlgItem(hwndDlg,IDC_MIN2TRAY),FALSE); EnableWindow(GetDlgItem(hwndDlg,IDC_TOOLWND),FALSE); EnableWindow(GetDlgItem(hwndDlg,IDC_TITLETEXT),FALSE); - EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWCAPTION),FALSE); + EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWCAPTION),FALSE); } CheckDlgButton(hwndDlg, IDC_DROPSHADOW, ModernGetSettingByte(NULL,"CList","WindowShadow",SETTING_WINDOWSHADOW_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_ROUNDCORNERS, ModernGetSettingByte(NULL,"CLC","RoundCorners",SETTING_ROUNDCORNERS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_ROUNDCORNERS, ModernGetSettingByte(NULL,"CLC","RoundCorners",SETTING_ROUNDCORNERS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); } // ====== End of Non-Layered Mode ===== CheckDlgButton(hwndDlg, IDC_FADEINOUT, ModernGetSettingByte(NULL,"CLUI","FadeInOut",SETTING_FADEIN_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); @@ -1271,12 +1271,12 @@ static INT_PTR CALLBACK DlgProcClistWindowOpts(HWND hwndDlg, UINT msg, WPARAM wP SendDlgItemMessage(hwndDlg,IDC_RIGHTMARGINSPIN,UDM_SETPOS,0,ModernGetSettingByte(NULL,"CLUI","RightClientMargin",SETTING_RIGHTCLIENTMARIGN_DEFAULT)); SendDlgItemMessage(hwndDlg,IDC_TOPMARGINSPIN,UDM_SETPOS,0,ModernGetSettingByte(NULL,"CLUI","TopClientMargin",SETTING_TOPCLIENTMARIGN_DEFAULT)); SendDlgItemMessage(hwndDlg,IDC_BOTTOMMARGINSPIN,UDM_SETPOS,0,ModernGetSettingByte(NULL,"CLUI","BottomClientMargin",SETTING_BOTTOMCLIENTMARIGN_DEFAULT)); - - CheckDlgButton(hwndDlg, IDC_DISABLEENGINE, ModernGetSettingByte(NULL,"ModernData","DisableEngine", SETTING_DISABLESKIN_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + + CheckDlgButton(hwndDlg, IDC_DISABLEENGINE, ModernGetSettingByte(NULL,"ModernData","DisableEngine", SETTING_DISABLESKIN_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_AEROGLASS, ModernGetSettingByte(NULL,"ModernData","AeroGlass",SETTING_AEROGLASS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); - + EnableWindow(GetDlgItem(hwndDlg,IDC_LAYERENGINE),(g_proc_UpdateLayeredWindow!=NULL && !ModernGetSettingByte(NULL,"ModernData","DisableEngine", SETTING_DISABLESKIN_DEFAULT))?TRUE:FALSE); - CheckDlgButton(hwndDlg, IDC_LAYERENGINE, ((ModernGetSettingByte(NULL,"ModernData","EnableLayering",SETTING_ENABLELAYERING_DEFAULT)&&g_proc_UpdateLayeredWindow!=NULL) && !ModernGetSettingByte(NULL,"ModernData","DisableEngine", SETTING_DISABLESKIN_DEFAULT)) ? BST_UNCHECKED:BST_CHECKED); + CheckDlgButton(hwndDlg, IDC_LAYERENGINE, ((ModernGetSettingByte(NULL,"ModernData","EnableLayering",SETTING_ENABLELAYERING_DEFAULT)&&g_proc_UpdateLayeredWindow!=NULL) && !ModernGetSettingByte(NULL,"ModernData","DisableEngine", SETTING_DISABLESKIN_DEFAULT)) ? BST_UNCHECKED:BST_CHECKED); { DBVARIANT dbv={0}; @@ -1348,10 +1348,10 @@ static INT_PTR CALLBACK DlgProcClistWindowOpts(HWND hwndDlg, UINT msg, WPARAM wP { // ====== Activate/Deactivate Non-Layered items ======= fEnabled=!(IsWindowEnabled(GetDlgItem(hwndDlg,IDC_LAYERENGINE)) && !IsDlgButtonChecked(hwndDlg,IDC_LAYERENGINE) && !IsDlgButtonChecked(hwndDlg,IDC_DISABLEENGINE)); - EnableWindow(GetDlgItem(hwndDlg,IDC_TOOLWND),fEnabled&&(IsDlgButtonChecked(hwndDlg,IDC_SHOWCAPTION))&&!(IsDlgButtonChecked(hwndDlg,IDC_NOBORDERWND)||IsDlgButtonChecked(hwndDlg,IDC_BORDER))); - EnableWindow(GetDlgItem(hwndDlg,IDC_MIN2TRAY),fEnabled&&(IsDlgButtonChecked(hwndDlg,IDC_TOOLWND) && IsDlgButtonChecked(hwndDlg,IDC_SHOWCAPTION)) && !(IsDlgButtonChecked(hwndDlg,IDC_NOBORDERWND)||IsDlgButtonChecked(hwndDlg,IDC_BORDER))); - EnableWindow(GetDlgItem(hwndDlg,IDC_TITLETEXT),fEnabled&&(IsDlgButtonChecked(hwndDlg,IDC_SHOWCAPTION))&&!(IsDlgButtonChecked(hwndDlg,IDC_NOBORDERWND)||IsDlgButtonChecked(hwndDlg,IDC_BORDER))); - EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWCAPTION),fEnabled&&!(IsDlgButtonChecked(hwndDlg,IDC_NOBORDERWND)||IsDlgButtonChecked(hwndDlg,IDC_BORDER))); + EnableWindow(GetDlgItem(hwndDlg,IDC_TOOLWND),fEnabled&&(IsDlgButtonChecked(hwndDlg,IDC_SHOWCAPTION))&&!(IsDlgButtonChecked(hwndDlg,IDC_NOBORDERWND)||IsDlgButtonChecked(hwndDlg,IDC_BORDER))); + EnableWindow(GetDlgItem(hwndDlg,IDC_MIN2TRAY),fEnabled&&(IsDlgButtonChecked(hwndDlg,IDC_TOOLWND) && IsDlgButtonChecked(hwndDlg,IDC_SHOWCAPTION)) && !(IsDlgButtonChecked(hwndDlg,IDC_NOBORDERWND)||IsDlgButtonChecked(hwndDlg,IDC_BORDER))); + EnableWindow(GetDlgItem(hwndDlg,IDC_TITLETEXT),fEnabled&&(IsDlgButtonChecked(hwndDlg,IDC_SHOWCAPTION))&&!(IsDlgButtonChecked(hwndDlg,IDC_NOBORDERWND)||IsDlgButtonChecked(hwndDlg,IDC_BORDER))); + EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWCAPTION),fEnabled&&!(IsDlgButtonChecked(hwndDlg,IDC_NOBORDERWND)||IsDlgButtonChecked(hwndDlg,IDC_BORDER))); EnableWindow(GetDlgItem(hwndDlg,IDC_BORDER),fEnabled); EnableWindow(GetDlgItem(hwndDlg,IDC_NOBORDERWND),fEnabled); EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWMAINMENU),fEnabled); @@ -1368,10 +1368,10 @@ static INT_PTR CALLBACK DlgProcClistWindowOpts(HWND hwndDlg, UINT msg, WPARAM wP } else if(LOWORD(wParam)==IDC_ONDESKTOP && IsDlgButtonChecked(hwndDlg,IDC_ONDESKTOP)) { - CheckDlgButton(hwndDlg, IDC_ONTOP, BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_ONTOP, BST_UNCHECKED); } else if(LOWORD(wParam)==IDC_ONTOP && IsDlgButtonChecked(hwndDlg,IDC_ONTOP)) { - CheckDlgButton(hwndDlg, IDC_ONDESKTOP, BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_ONDESKTOP, BST_UNCHECKED); } else if(LOWORD(wParam)==IDC_TOOLWND) { EnableWindow(GetDlgItem(hwndDlg,IDC_MIN2TRAY),!IsDlgButtonChecked(hwndDlg,IDC_TOOLWND)); @@ -1383,16 +1383,16 @@ static INT_PTR CALLBACK DlgProcClistWindowOpts(HWND hwndDlg, UINT msg, WPARAM wP } else if(LOWORD(wParam)==IDC_NOBORDERWND ||LOWORD(wParam)==IDC_BORDER) { - EnableWindow(GetDlgItem(hwndDlg,IDC_TOOLWND),(IsDlgButtonChecked(hwndDlg,IDC_SHOWCAPTION))&&!(IsDlgButtonChecked(hwndDlg,IDC_NOBORDERWND)||IsDlgButtonChecked(hwndDlg,IDC_BORDER))); - EnableWindow(GetDlgItem(hwndDlg,IDC_MIN2TRAY),(IsDlgButtonChecked(hwndDlg,IDC_TOOLWND) && IsDlgButtonChecked(hwndDlg,IDC_SHOWCAPTION)) && !(IsDlgButtonChecked(hwndDlg,IDC_NOBORDERWND)||IsDlgButtonChecked(hwndDlg,IDC_BORDER))); - EnableWindow(GetDlgItem(hwndDlg,IDC_TITLETEXT),(IsDlgButtonChecked(hwndDlg,IDC_SHOWCAPTION))&&!(IsDlgButtonChecked(hwndDlg,IDC_NOBORDERWND)||IsDlgButtonChecked(hwndDlg,IDC_BORDER))); - EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWCAPTION),!(IsDlgButtonChecked(hwndDlg,IDC_NOBORDERWND)||IsDlgButtonChecked(hwndDlg,IDC_BORDER))); + EnableWindow(GetDlgItem(hwndDlg,IDC_TOOLWND),(IsDlgButtonChecked(hwndDlg,IDC_SHOWCAPTION))&&!(IsDlgButtonChecked(hwndDlg,IDC_NOBORDERWND)||IsDlgButtonChecked(hwndDlg,IDC_BORDER))); + EnableWindow(GetDlgItem(hwndDlg,IDC_MIN2TRAY),(IsDlgButtonChecked(hwndDlg,IDC_TOOLWND) && IsDlgButtonChecked(hwndDlg,IDC_SHOWCAPTION)) && !(IsDlgButtonChecked(hwndDlg,IDC_NOBORDERWND)||IsDlgButtonChecked(hwndDlg,IDC_BORDER))); + EnableWindow(GetDlgItem(hwndDlg,IDC_TITLETEXT),(IsDlgButtonChecked(hwndDlg,IDC_SHOWCAPTION))&&!(IsDlgButtonChecked(hwndDlg,IDC_NOBORDERWND)||IsDlgButtonChecked(hwndDlg,IDC_BORDER))); + EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWCAPTION),!(IsDlgButtonChecked(hwndDlg,IDC_NOBORDERWND)||IsDlgButtonChecked(hwndDlg,IDC_BORDER))); if (LOWORD(wParam)==IDC_BORDER) CheckDlgButton(hwndDlg, IDC_NOBORDERWND,BST_UNCHECKED); - else CheckDlgButton(hwndDlg, IDC_BORDER,BST_UNCHECKED); + else CheckDlgButton(hwndDlg, IDC_BORDER,BST_UNCHECKED); } if ((LOWORD(wParam)==IDC_TITLETEXT || LOWORD(wParam)==IDC_MAXSIZEHEIGHT || LOWORD(wParam)==IDC_MINSIZEHEIGHT || LOWORD(wParam)==IDC_FRAMESGAP || LOWORD(wParam)==IDC_CAPTIONSGAP || - LOWORD(wParam)==IDC_LEFTMARGIN || LOWORD(wParam)==IDC_RIGHTMARGIN|| LOWORD(wParam)==IDC_TOPMARGIN || LOWORD(wParam)==IDC_BOTTOMMARGIN) + LOWORD(wParam)==IDC_LEFTMARGIN || LOWORD(wParam)==IDC_RIGHTMARGIN|| LOWORD(wParam)==IDC_TOPMARGIN || LOWORD(wParam)==IDC_BOTTOMMARGIN) &&(HIWORD(wParam)!=EN_CHANGE || (HWND)lParam!=GetFocus())) return 0; // Enable apply button @@ -1421,10 +1421,10 @@ static INT_PTR CALLBACK DlgProcClistWindowOpts(HWND hwndDlg, UINT msg, WPARAM wP ModernWriteSettingByte(NULL,"ModernData","AeroGlass",IsDlgButtonChecked(hwndDlg,IDC_AEROGLASS)); if (!IsDlgButtonChecked(hwndDlg,IDC_DISABLEENGINE)) { - if (g_proc_UpdateLayeredWindow!=NULL && IsDlgButtonChecked(hwndDlg,IDC_LAYERENGINE)) + if (g_proc_UpdateLayeredWindow!=NULL && IsDlgButtonChecked(hwndDlg,IDC_LAYERENGINE)) ModernWriteSettingByte(NULL,"ModernData","EnableLayering",0); - else - ModernDeleteSetting(NULL,"ModernData","EnableLayering"); + else + ModernDeleteSetting(NULL,"ModernData","EnableLayering"); } g_CluiData.dwKeyColor=ModernGetSettingDword(NULL,"ModernSettings","KeyColor",(DWORD)SETTING_KEYCOLOR_DEFAULT); ModernWriteSettingByte(NULL,"CList","OnDesktop",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_ONDESKTOP)); @@ -1438,7 +1438,7 @@ static INT_PTR CALLBACK DlgProcClistWindowOpts(HWND hwndDlg, UINT msg, WPARAM wP ModernWriteSettingByte(NULL,"CLUI","ShowMainMenu",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_SHOWMAINMENU)); ModernWriteSettingByte(NULL,"CList","ThinBorder",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_BORDER)); ModernWriteSettingByte(NULL,"CList","NoBorder",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_NOBORDERWND)); - { + { TCHAR title[256]; GetDlgItemText(hwndDlg,IDC_TITLETEXT,title,SIZEOF(title)); ModernWriteSettingTString(NULL,"CList","TitleText",title); @@ -1446,21 +1446,21 @@ static INT_PTR CALLBACK DlgProcClistWindowOpts(HWND hwndDlg, UINT msg, WPARAM wP } ModernWriteSettingByte(NULL,"CList","Min2Tray",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_MIN2TRAY)); ModernWriteSettingByte(NULL,"CList","WindowShadow",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_DROPSHADOW)); - ModernWriteSettingByte(NULL,"CLC","RoundCorners",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_ROUNDCORNERS)); + ModernWriteSettingByte(NULL,"CLC","RoundCorners",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_ROUNDCORNERS)); } //====== End of Non-Layered Mode ====== g_mutex_bChangingMode=TRUE; - if (IsDlgButtonChecked(hwndDlg,IDC_ONDESKTOP)) + if (IsDlgButtonChecked(hwndDlg,IDC_ONDESKTOP)) { HWND hProgMan=FindWindow(TEXT("Progman"),NULL); - if (IsWindow(hProgMan)) + if (IsWindow(hProgMan)) { SetParent(pcli->hwndContactList,hProgMan); Sync( CLUIFrames_SetParentForContainers, (HWND)hProgMan ); g_CluiData.fOnDesktop=1; } - } - else + } + else { if (GetParent(pcli->hwndContactList)) { @@ -1476,7 +1476,7 @@ static INT_PTR CALLBACK DlgProcClistWindowOpts(HWND hwndDlg, UINT msg, WPARAM wP int i1; int i2; i1=SendDlgItemMessage(hwndDlg,IDC_FRAMESSPIN,UDM_GETPOS,0,0); - i2=SendDlgItemMessage(hwndDlg,IDC_CAPTIONSSPIN,UDM_GETPOS,0,0); + i2=SendDlgItemMessage(hwndDlg,IDC_CAPTIONSSPIN,UDM_GETPOS,0,0); ModernWriteSettingDword(NULL,"CLUIFrames","GapBetweenFrames",(DWORD)i1); ModernWriteSettingDword(NULL,"CLUIFrames","GapBetweenTitleBar",(DWORD)i2); @@ -1488,11 +1488,11 @@ static INT_PTR CALLBACK DlgProcClistWindowOpts(HWND hwndDlg, UINT msg, WPARAM wP ModernWriteSettingByte(NULL,"CList","OnDesktop",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_ONDESKTOP)); ske_LoadSkinFromDB(); - CLUI_UpdateLayeredMode(); - CLUI_ChangeWindowMode(); + CLUI_UpdateLayeredMode(); + CLUI_ChangeWindowMode(); SendMessage(pcli->hwndContactTree,WM_SIZE,0,0); //forces it to send a cln_listsizechanged CLUI_ReloadCLUIOptions(); - cliShowHide(0,1); + cliShowHide(0,1); g_mutex_bChangingMode=FALSE; return TRUE; } @@ -1575,8 +1575,8 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, dat->item[indx].useBitmap = ModernGetSettingByte(NULL,module, "UseBitmap", DEFAULT_USEBITMAP); dat->item[indx].bkColor = ModernGetSettingDword(NULL,module, "BkColour", DEFAULT_BKCOLOUR); dat->item[indx].selColor = ModernGetSettingDword(NULL,module, "SelBkColour", DEFAULT_SELBKCOLOUR); - dat->item[indx].useWinColours = ModernGetSettingByte(NULL,module, "UseWinColours", CLCDEFAULT_USEWINDOWSCOLOURS); - { + dat->item[indx].useWinColours = ModernGetSettingByte(NULL,module, "UseWinColours", CLCDEFAULT_USEWINDOWSCOLOURS); + { DBVARIANT dbv; if (!ModernGetSettingString(NULL,module,"BkBitmap",&dbv)) { @@ -1607,7 +1607,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, if(dat->item) mir_free(dat->item); mir_free(dat); } - + return TRUE; case M_BKGR_GETSTATE: @@ -1620,7 +1620,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, dat->item[indx].useWinColours = IsDlgButtonChecked(hwndDlg,IDC_USEWINCOL); dat->item[indx].bkColor = SendDlgItemMessage(hwndDlg, IDC_BKGCOLOUR, CPM_GETCOLOUR,0,0); dat->item[indx].selColor = SendDlgItemMessage(hwndDlg, IDC_SELCOLOUR, CPM_GETCOLOUR,0,0); - + GetDlgItemTextA(hwndDlg, IDC_FILENAME, dat->item[indx].filename, SIZEOF(dat->item[indx].filename)); { WORD flags = 0; @@ -1632,7 +1632,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, if(IsDlgButtonChecked(hwndDlg,IDC_PROPORTIONAL)) flags |= CLBF_PROPORTIONAL; if(IsDlgButtonChecked(hwndDlg,IDC_TILEVROWH)) flags |= CLBF_TILEVTOROWHEIGHT; dat->item[indx].flags = flags; - } + } break; } case M_BKGR_SETSTATE: @@ -1654,7 +1654,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, SendDlgItemMessage(hwndDlg, IDC_BKGCOLOUR, CPM_SETCOLOUR, 0, dat->item[indx].bkColor); SendDlgItemMessage(hwndDlg, IDC_SELCOLOUR, CPM_SETDEFAULTCOLOUR, 0, DEFAULT_SELBKCOLOUR); SendDlgItemMessage(hwndDlg, IDC_SELCOLOUR, CPM_SETCOLOUR, 0, dat->item[indx].selColor); - SetDlgItemTextA(hwndDlg, IDC_FILENAME, dat->item[indx].filename); + SetDlgItemTextA(hwndDlg, IDC_FILENAME, dat->item[indx].filename); CheckDlgButton(hwndDlg,IDC_STRETCHH, flags&CLB_STRETCHH?BST_CHECKED:BST_UNCHECKED); CheckDlgButton(hwndDlg,IDC_STRETCHV,flags&CLB_STRETCHV?BST_CHECKED:BST_UNCHECKED); @@ -1681,7 +1681,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, 130, cy, 0, 0, SWP_NOACTIVATE|SWP_NOZORDER|SWP_NOSIZE); - cy += 25; + cy += 25; } if(visibility & M_BKGR_SELECTCOLOR) { @@ -1693,7 +1693,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, 130, cy, 0, 0, SWP_NOACTIVATE|SWP_NOZORDER|SWP_NOSIZE); - cy += 25; + cy += 25; } ShowWindow(GetDlgItem(hwndDlg,IDC_STRETCHH), visibility&CLB_STRETCHH?SW_SHOW:SW_HIDE); ShowWindow(GetDlgItem(hwndDlg,IDC_STRETCHV), visibility&CLB_STRETCHV?SW_SHOW:SW_HIDE); @@ -1756,10 +1756,10 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, int indx = SendDlgItemMessage(hwndDlg, IDC_BKGRLIST, CB_GETCURSEL, 0,0); if(indx != CB_ERR && indx < dat->count) { - indx = SendDlgItemMessage(hwndDlg, IDC_BKGRLIST, CB_GETITEMDATA, indx, 0); + indx = SendDlgItemMessage(hwndDlg, IDC_BKGRLIST, CB_GETITEMDATA, indx, 0); dat->item[indx].changed = TRUE; - - } + + } { BOOL EnableColours=!IsDlgButtonChecked(hwndDlg,IDC_USEWINCOL); EnableWindow(GetDlgItem(hwndDlg,IDC_BKGCOLOUR), EnableColours); @@ -1783,10 +1783,10 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, { char *module = bkgrList[indx] + strlen(bkgrList[indx]) + 1; ModernWriteSettingByte(NULL, module, "UseBitmap", (BYTE)dat->item[indx].useBitmap); - { + { COLORREF col; - if ((col = dat->item[indx].bkColor) == DEFAULT_BKCOLOUR) + if ((col = dat->item[indx].bkColor) == DEFAULT_BKCOLOUR) ModernDeleteSetting(NULL, module, "BkColour"); else ModernWriteSettingDword(NULL, module, "BkColour", col); @@ -1797,7 +1797,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, ModernWriteSettingDword(NULL, module, "SelBkColour", col); } ModernWriteSettingByte(NULL, module, "UseWinColours", (BYTE)dat->item[indx].useWinColours); - + { char str[MAX_PATH]; int retval = CallService(MS_UTILS_PATHTOABSOLUTE, @@ -1842,14 +1842,14 @@ static INT_PTR BkgrCfg_Register(WPARAM wParam,LPARAM lParam) bkgrList = (char **)mir_realloc(bkgrList, sizeof(char*)*(bkgrCount+1)); bkgrList[bkgrCount] = value; bkgrCount++; - + return 0; } HRESULT BackgroundsLoadModule() -{ - CreateServiceFunction(MS_BACKGROUNDCONFIG_REGISTER, BkgrCfg_Register); +{ + CreateServiceFunction(MS_BACKGROUNDCONFIG_REGISTER, BkgrCfg_Register); return S_OK; } @@ -2051,7 +2051,7 @@ static INT_PTR CALLBACK DlgProcModernOptions(HWND hwndDlg, UINT msg, WPARAM wPar SendMessage(hwndDlg,WM_HSCROLL,0x12345678,0); - for (i=0; ihwndContactTree,WM_SIZE,0,0); //forces it to send a cln_listsizechanged CLUI_ReloadCLUIOptions(); - cliShowHide(0,1); + cliShowHide(0,1); g_mutex_bChangingMode=FALSE; return TRUE; } diff --git a/plugins/Clist_mw/CLUIFrames/cluiframes.cpp b/plugins/Clist_mw/CLUIFrames/cluiframes.cpp index 3d5eb1d676..df70ff4d02 100644 --- a/plugins/Clist_mw/CLUIFrames/cluiframes.cpp +++ b/plugins/Clist_mw/CLUIFrames/cluiframes.cpp @@ -2853,18 +2853,18 @@ static int CLUIFrameOnFontChange(WPARAM wParam,LPARAM lParam) static void CLUIRegisterFonts() { - if (ServiceExists(MS_FONT_REGISTER)) { - FontID fid = {0}; - fid.cbSize = sizeof(fid); - strcpy(fid.group,LPGEN("Frames")); - strcpy(fid.name,LPGEN("TitleBarFont")); - strcpy(fid.dbSettingsGroup,"CLUIFrames"); - strcpy(fid.prefix,"FramesTitleBarFont"); - - CallService(MS_FONT_REGISTER,(WPARAM)&fid,0); - CLUIFrameOnFontChange(0,0); - HookEvent(ME_FONT_RELOAD,CLUIFrameOnFontChange); -} } + FontID fid = {0}; + fid.cbSize = sizeof(fid); + strcpy(fid.group, LPGEN("Frames")); + strcpy(fid.name, LPGEN("TitleBarFont")); + strcpy(fid.dbSettingsGroup, "CLUIFrames"); + strcpy(fid.prefix, "FramesTitleBarFont"); + FontRegister(&fid); + + CLUIFrameOnFontChange(0,0); + + HookEvent(ME_FONT_RELOAD,CLUIFrameOnFontChange); +} static int CLUIFrameOnModulesLoad(WPARAM wParam,LPARAM lParam) { diff --git a/plugins/Clist_mw/clcfonts.cpp b/plugins/Clist_mw/clcfonts.cpp index 346c53c9f3..1ad20dc2b0 100644 --- a/plugins/Clist_mw/clcfonts.cpp +++ b/plugins/Clist_mw/clcfonts.cpp @@ -99,8 +99,7 @@ void RegisterCListFonts() sprintf(idstr, "Font%d", fontListOrder[i]); strncpy(fontid.prefix, idstr, SIZEOF(fontid.prefix)); fontid.order = fontListOrder[i]; - - CallService(MS_FONT_REGISTERT, (WPARAM)&fontid, 0); + FontRegisterT(&fontid); } } @@ -113,25 +112,25 @@ void RegisterCListFonts() _tcsncpy(colourid.name, LPGENT("Background"), SIZEOF(colourid.name)); _tcsncpy(colourid.group, LPGENT("Contact List"), SIZEOF(colourid.group)); colourid.defcolour = CLCDEFAULT_BKCOLOUR; - CallService(MS_COLOUR_REGISTERT, (WPARAM)&colourid, 0); + ColourRegisterT(&colourid); strncpy(colourid.setting, "SelTextColour", sizeof(colourid.setting)); _tcsncpy(colourid.name, LPGENT("Selected Text"), SIZEOF(colourid.name)); colourid.order = 1; colourid.defcolour = CLCDEFAULT_SELTEXTCOLOUR; - CallService(MS_COLOUR_REGISTERT, (WPARAM)&colourid, 0); + ColourRegisterT(&colourid); strncpy(colourid.setting, "HotTextColour", sizeof(colourid.setting)); _tcsncpy(colourid.name, LPGENT("Hottrack Text"), SIZEOF(colourid.name)); colourid.order = 1; colourid.defcolour = CLCDEFAULT_HOTTEXTCOLOUR; - CallService(MS_COLOUR_REGISTERT, (WPARAM)&colourid, 0); + ColourRegisterT(&colourid); strncpy(colourid.setting, "QuickSearchColour", sizeof(colourid.setting)); _tcsncpy(colourid.name, LPGENT("Quicksearch Text"), SIZEOF(colourid.name)); colourid.order = 1; colourid.defcolour = CLCDEFAULT_QUICKSEARCHCOLOUR; - CallService(MS_COLOUR_REGISTERT, (WPARAM)&colourid, 0); + ColourRegisterT(&colourid); HookEvent(ME_FONT_RELOAD, FS_FontsChanged); } diff --git a/plugins/Clist_nicer/SRC/clui.cpp b/plugins/Clist_nicer/SRC/clui.cpp index 106ade9372..e4009d6feb 100644 --- a/plugins/Clist_nicer/SRC/clui.cpp +++ b/plugins/Clist_nicer/SRC/clui.cpp @@ -2148,7 +2148,7 @@ void FS_RegisterFonts() lstrcpynA(fid.deffontsettings.szFace, dbv.pszVal, LF_FACESIZE); mir_free(dbv.pszVal); } - CallService(MS_FONT_REGISTER, (WPARAM)&fid, 0); + FontRegister(&fid); j++; } // and colours @@ -2160,24 +2160,23 @@ void FS_RegisterFonts() strncpy(colourid.name, LPGEN("Background"), SIZEOF(colourid.name)); strncpy(colourid.group, LPGEN("Contact List"), SIZEOF(colourid.group)); colourid.defcolour = CLCDEFAULT_BKCOLOUR; - CallService(MS_COLOUR_REGISTER, (WPARAM)&colourid, 0); + ColourRegister(&colourid); strncpy(colourid.setting, "SelTextColour", sizeof(colourid.setting)); strncpy(colourid.name, LPGEN("Selected Text"), SIZEOF(colourid.name)); colourid.order = 1; colourid.defcolour = CLCDEFAULT_SELTEXTCOLOUR; - CallService(MS_COLOUR_REGISTER, (WPARAM)&colourid, 0); + ColourRegister(&colourid); strncpy(colourid.setting, "HotTextColour", sizeof(colourid.setting)); strncpy(colourid.name, LPGEN("Hottrack Text"), SIZEOF(colourid.name)); colourid.order = 1; colourid.defcolour = CLCDEFAULT_HOTTEXTCOLOUR; - CallService(MS_COLOUR_REGISTER, (WPARAM)&colourid, 0); + ColourRegister(&colourid); strncpy(colourid.setting, "QuickSearchColour", sizeof(colourid.setting)); strncpy(colourid.name, LPGEN("Quicksearch Text"), SIZEOF(colourid.name)); colourid.order = 1; colourid.defcolour = CLCDEFAULT_QUICKSEARCHCOLOUR; - CallService(MS_COLOUR_REGISTER, (WPARAM)&colourid, 0); - + ColourRegister(&colourid); } diff --git a/plugins/Console/Console.cpp b/plugins/Console/Console.cpp index 24f187cee1..3a5db7f64c 100644 --- a/plugins/Console/Console.cpp +++ b/plugins/Console/Console.cpp @@ -1259,56 +1259,43 @@ static int OnSystemModulesLoaded(WPARAM wParam,LPARAM lParam) CreateServiceFunction(MS_CONSOLE_SHOW_HIDE, ShowHideConsole); - { - FontIDT fid={0}; - fid.cbSize = sizeof(fid); - _tcscpy(fid.group,_T("Console")); - _tcscpy(fid.name,TranslateT("Text")); - strcpy(fid.dbSettingsGroup,"Console"); - strcpy(fid.prefix,"ConsoleFont"); - - _tcscpy(fid.backgroundGroup,_T("Console")); - _tcscpy(fid.backgroundName,_T("Background")); - - fid.flags = FIDF_DEFAULTVALID; - - fid.deffontsettings.charset = DEFAULT_CHARSET; - fid.deffontsettings.colour = RGB(0, 0, 0); - fid.deffontsettings.size = 10; - fid.deffontsettings.style = 0; - _tcsncpy(fid.deffontsettings.szFace, _T("Courier"), LF_FACESIZE); - - CallService(MS_FONT_REGISTERT,(WPARAM)&fid,0); - - hHooks[i++] = HookEvent(ME_FONT_RELOAD,OnFontChange); - } - - { - ColourIDT cid = {0}; - - cid.cbSize=sizeof(cid); - _tcscpy(cid.group,_T("Console")); - _tcscpy(cid.name,_T("Background")); - strcpy(cid.dbSettingsGroup,"Console"); - strcpy(cid.setting,"BgColor"); - - cid.defcolour = RGB(255,255,255); - - CallService(MS_COLOUR_REGISTERT,(WPARAM)&cid,0); - - hHooks[i++] = HookEvent(ME_COLOUR_RELOAD, OnColourChange); - } - - { - HOTKEYDESC hkd = {0}; - hkd.cbSize = sizeof(hkd); - hkd.pszName = "Console_Show_Hide"; - hkd.pszDescription = LPGEN("Show/Hide Console"); - hkd.pszSection = "Main"; - hkd.pszService = MS_CONSOLE_SHOW_HIDE; - hkd.DefHotKey = HOTKEYCODE(HOTKEYF_EXT, 'C'); - Hotkey_Register(&hkd); - } + FontIDT fid = {0}; + fid.cbSize = sizeof(fid); + _tcscpy(fid.group,_T("Console")); + _tcscpy(fid.name,TranslateT("Text")); + strcpy(fid.dbSettingsGroup,"Console"); + strcpy(fid.prefix,"ConsoleFont"); + _tcscpy(fid.backgroundGroup,_T("Console")); + _tcscpy(fid.backgroundName,_T("Background")); + fid.flags = FIDF_DEFAULTVALID; + fid.deffontsettings.charset = DEFAULT_CHARSET; + fid.deffontsettings.colour = RGB(0, 0, 0); + fid.deffontsettings.size = 10; + fid.deffontsettings.style = 0; + _tcsncpy(fid.deffontsettings.szFace, _T("Courier"), LF_FACESIZE); + FontRegisterT(&fid); + + hHooks[i++] = HookEvent(ME_FONT_RELOAD,OnFontChange); + + ColourIDT cid = {0}; + cid.cbSize=sizeof(cid); + _tcscpy(cid.group,_T("Console")); + _tcscpy(cid.name,_T("Background")); + strcpy(cid.dbSettingsGroup,"Console"); + strcpy(cid.setting,"BgColor"); + cid.defcolour = RGB(255,255,255); + ColourRegisterT(&cid); + + hHooks[i++] = HookEvent(ME_COLOUR_RELOAD, OnColourChange); + + HOTKEYDESC hkd = {0}; + hkd.cbSize = sizeof(hkd); + hkd.pszName = "Console_Show_Hide"; + hkd.pszDescription = LPGEN("Show/Hide Console"); + hkd.pszSection = "Main"; + hkd.pszService = MS_CONSOLE_SHOW_HIDE; + hkd.DefHotKey = HOTKEYCODE(HOTKEYF_EXT, 'C'); + Hotkey_Register(&hkd); if (ServiceExists(MS_TB_ADDBUTTON)) { TBButton tbb = {0}; diff --git a/plugins/ExternalAPI/m_toptoolbar.h b/plugins/ExternalAPI/m_toptoolbar.h index dba10dea61..576daf944b 100644 --- a/plugins/ExternalAPI/m_toptoolbar.h +++ b/plugins/ExternalAPI/m_toptoolbar.h @@ -91,12 +91,11 @@ toptoolbar/getoptions service lparam = 0,or lparam=lpTTBButton if flag=TTBO_ALLDATA returns: value on success, -1 on failure. */ -#define TTBO_FLAGS 0 //get/set all flags -#define TTBO_POS 1 //position -#define TTBO_WIDTH 2 //not impemented -#define TTBO_HEIGHT 3 //not impemented -#define TTBO_TIPNAME 4 //tool tip name -#define TTBO_ALLDATA 5 //change all data via lparam=lpTTBButton +#define TTBO_FLAGS 0 //get/set all flags +#define TTBO_WIDTH 2 //not impemented +#define TTBO_HEIGHT 3 //not impemented +#define TTBO_TIPNAME 4 //tool tip name +#define TTBO_ALLDATA 5 //change all data via lparam=lpTTBButton #define MS_TTB_GETBUTTONOPTIONS "TopToolBar/GetOptions" diff --git a/plugins/FavContacts/src/main.cpp b/plugins/FavContacts/src/main.cpp index d2c4db9f6f..5aba9e88fb 100644 --- a/plugins/FavContacts/src/main.cpp +++ b/plugins/FavContacts/src/main.cpp @@ -214,13 +214,13 @@ int ProcessModulesLoaded(WPARAM wParam, LPARAM lParam) lstrcpyA(fontid.prefix, "fntName"); fontid.deffontsettings.colour = GetSysColor(COLOR_MENUTEXT); fontid.deffontsettings.style = DBFONTF_BOLD; - CallService(MS_FONT_REGISTERT, (WPARAM)&fontid, 0); + FontRegisterT(&fontid); lstrcpy(fontid.name, _T("Second line")); lstrcpyA(fontid.prefix, "fntSecond"); fontid.deffontsettings.colour = sttShadeColor(GetSysColor(COLOR_MENUTEXT), GetSysColor(COLOR_MENU)); fontid.deffontsettings.style = 0; - CallService(MS_FONT_REGISTERT, (WPARAM)&fontid, 0); + FontRegisterT(&fontid); lstrcpy(fontid.backgroundName, _T("Selected background")); @@ -228,13 +228,13 @@ int ProcessModulesLoaded(WPARAM wParam, LPARAM lParam) lstrcpyA(fontid.prefix, "fntNameSel"); fontid.deffontsettings.colour = GetSysColor(COLOR_HIGHLIGHTTEXT); fontid.deffontsettings.style = DBFONTF_BOLD; - CallService(MS_FONT_REGISTERT, (WPARAM)&fontid, 0); + FontRegisterT(&fontid); lstrcpy(fontid.name, _T("Selected second line (color)")); lstrcpyA(fontid.prefix, "fntSecondSel"); fontid.deffontsettings.colour = sttShadeColor(GetSysColor(COLOR_HIGHLIGHTTEXT), GetSysColor(COLOR_HIGHLIGHT)); fontid.deffontsettings.style = 0; - CallService(MS_FONT_REGISTERT, (WPARAM)&fontid, 0); + FontRegisterT(&fontid); ///////////////////////////////////////////////////////////////////////////////////// @@ -246,12 +246,12 @@ int ProcessModulesLoaded(WPARAM wParam, LPARAM lParam) lstrcpy(colourid.name, _T("Background")); lstrcpyA(colourid.setting, "BackColour"); colourid.defcolour = GetSysColor(COLOR_MENU); - CallService(MS_COLOUR_REGISTERT, (WPARAM)&colourid, 0); + ColourRegisterT(&colourid); lstrcpy(colourid.name, _T("Selected background")); lstrcpyA(colourid.setting, "SelectedColour"); colourid.defcolour = GetSysColor(COLOR_HIGHLIGHT); - CallService(MS_COLOUR_REGISTERT, (WPARAM)&colourid, 0); + ColourRegisterT(&colourid); HookEvent(ME_FONT_RELOAD, ProcessReloadFonts); HookEvent(ME_COLOUR_RELOAD, ProcessReloadFonts); diff --git a/plugins/Popup/src/font.cpp b/plugins/Popup/src/font.cpp index d9502eadac..77aca7b94a 100644 --- a/plugins/Popup/src/font.cpp +++ b/plugins/Popup/src/font.cpp @@ -85,12 +85,12 @@ void InitFonts() { lstrcpy(cid.name, _T(PU_COL_BACK_NAME)); strcpy(cid.setting, PU_COL_BACK_SETTING); cid.defcolour = SETTING_BACKCOLOUR_DEFAULT; - CallService(MS_COLOUR_REGISTERT, (WPARAM)&cid, 0); + ColourRegisterT(&cid); lstrcpy(cid.name, _T(PU_COL_AVAT_NAME)); strcpy(cid.setting, PU_COL_AVAT_SETTING); cid.defcolour = SETTING_TEXTCOLOUR_DEFAULT; - CallService(MS_COLOUR_REGISTERT, (WPARAM)&cid, 0); + ColourRegisterT(&cid); ReloadFonts(); } diff --git a/plugins/Popup/src/notifications.cpp b/plugins/Popup/src/notifications.cpp index 3a8beb8f15..bed6cdc116 100644 --- a/plugins/Popup/src/notifications.cpp +++ b/plugins/Popup/src/notifications.cpp @@ -213,7 +213,7 @@ HANDLE RegisterNotification(POPUPNOTIFICATION *notification) mir_snprintf(fontid.name, SIZEOF(fontid.name), "%s (colors only)", notification->lpzName); mir_snprintf(fontid.prefix, SIZEOF(fontid.prefix), "{%s/%s}text", notification->lpzGroup, notification->lpzName); fontid.deffontsettings.style = 0; - CallService(MS_FONT_REGISTER, (WPARAM)&fontid, 0); + FontRegister(&fontid); ColourID colourid = {0}; colourid.cbSize = sizeof(colourid); @@ -222,7 +222,7 @@ HANDLE RegisterNotification(POPUPNOTIFICATION *notification) mir_snprintf(colourid.name, SIZEOF(colourid.name), "%s (colors only)", notification->lpzName); mir_snprintf(colourid.setting, SIZEOF(colourid.setting), "{%s/%s}backColor", notification->lpzGroup, notification->lpzName); colourid.defcolour = ptd->notification.colorBack; - CallService(MS_COLOUR_REGISTER, (WPARAM)&colourid, 0); + ColourRegister(&colourid); char section[MAXMODULELABELLENGTH], setting[MAXMODULELABELLENGTH]; mir_snprintf(section, sizeof(section), "PopUps/%s", notification->lpzGroup); diff --git a/plugins/Popup/src/services.cpp b/plugins/Popup/src/services.cpp index ca1c700781..3246a2fbcd 100644 --- a/plugins/Popup/src/services.cpp +++ b/plugins/Popup/src/services.cpp @@ -612,7 +612,7 @@ INT_PTR PopUp_RegisterPopupClass(WPARAM wParam, LPARAM lParam) { mir_snprintf(fid.prefix, sizeof(fid.prefix), "%s/Text", ptd->pupClass.pszName); // result is "%s/TextCol" fid.deffontsettings.style = 0; fid.deffontsettings.colour = fonts.clText; - CallService(MS_FONT_REGISTER, (WPARAM)&fid, 0); + FontRegister(&fid); //we ignore pc->colorBack and use fonts.clBack as default (if no setting found in DB) mir_snprintf(setting, 256, "%s/BgCol", ptd->pupClass.pszName); @@ -624,7 +624,7 @@ INT_PTR PopUp_RegisterPopupClass(WPARAM wParam, LPARAM lParam) { strcpy(cid.name, PU_COL_BACK_NAME); mir_snprintf(cid.setting, sizeof(cid.setting), "%s/BgCol", ptd->pupClass.pszName); cid.defcolour = fonts.clBack; - CallService(MS_COLOUR_REGISTER, (WPARAM)&cid, 0); + ColourRegister(&cid); gTreeData.insert(ptd); num_classes++; diff --git a/plugins/SRMM/msgoptions.cpp b/plugins/SRMM/msgoptions.cpp index 4524966d56..6eb91e910f 100644 --- a/plugins/SRMM/msgoptions.cpp +++ b/plugins/SRMM/msgoptions.cpp @@ -115,7 +115,7 @@ void RegisterSRMMFonts( void ) fontid.deffontsettings.style = fontOptionsList[i].defStyle; _tcscpy(fontid.deffontsettings.szFace, fontOptionsList[i].szDefFace); fontid.deffontsettings.charset = MsgDlgGetFontDefaultCharset(fontOptionsList[i].szDefFace); - CallService(MS_FONT_REGISTERT, (WPARAM)&fontid, 0); + FontRegisterT(&fontid); } colourid.cbSize = sizeof(ColourID); @@ -124,7 +124,7 @@ void RegisterSRMMFonts( void ) colourid.defcolour = SRMSGDEFSET_BKGCOLOUR; _tcscpy(colourid.name, LPGENT("Background")); _tcscpy(colourid.group, LPGENT("Message Log")); - CallService(MS_COLOUR_REGISTERT, (WPARAM)&colourid, 0); + ColourRegisterT(&colourid); } ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/plugins/Scriver/msgoptions.cpp b/plugins/Scriver/msgoptions.cpp index cfbde8c141..f688efc50a 100644 --- a/plugins/Scriver/msgoptions.cpp +++ b/plugins/Scriver/msgoptions.cpp @@ -160,7 +160,7 @@ void RegisterFontServiceFonts() { fid.deffontsettings.charset = MsgDlgGetFontDefaultCharset(fontOptionsList[i].szDefFace); _tcsncpy(fid.deffontsettings.szFace, fontOptionsList[i].szDefFace, SIZEOF(fid.deffontsettings.szFace)); _tcsncpy(fid.backgroundName, fontOptionsList[i].szBkgName, SIZEOF(fid.backgroundName)); - CallService(MS_FONT_REGISTERT, (WPARAM)&fid, 0); + FontRegisterT(&fid); } cid.cbSize = sizeof(ColourIDT); mir_sntprintf(cid.group, SIZEOF(cid.group), _T("%s"), LPGENT("Messaging")); @@ -175,7 +175,7 @@ void RegisterFontServiceFonts() { cid.defcolour = colourOptionsList[i].defColour; } strncpy(cid.setting, colourOptionsList[i].szSettingName, SIZEOF(cid.setting)); - CallService(MS_COLOUR_REGISTERT, (WPARAM)&cid, 0); + ColourRegisterT(&cid); } } @@ -202,7 +202,7 @@ void RegisterChatFonts( void ) fid.deffontsettings.charset = MsgDlgGetFontDefaultCharset(fontOptionsList[i].szDefFace); _tcsncpy(fid.deffontsettings.szFace, chatFontOptionsList[i].szDefFace, SIZEOF(fid.deffontsettings.szFace)); _tcsncpy(fid.backgroundName, chatFontOptionsList[i].szBkgName, SIZEOF(fid.backgroundName)); - CallService(MS_FONT_REGISTERT, (WPARAM)&fid, 0); + FontRegisterT(&fid); } colourid.cbSize = sizeof(ColourIDT); @@ -213,22 +213,22 @@ void RegisterChatFonts( void ) _tcsncpy(colourid.name, LPGENT("Background"), SIZEOF(colourid.name)); mir_sntprintf(colourid.group, SIZEOF(colourid.group), _T("%s/%s"), LPGENT("Messaging"), LPGENT("Group Chats")); colourid.defcolour = GetSysColor(COLOR_WINDOW); - CallService(MS_COLOUR_REGISTERT, (WPARAM)&colourid, 0); + ColourRegisterT(&colourid); strncpy(colourid.setting, "ColorNicklistBG", SIZEOF(colourid.setting)); _tcsncpy(colourid.name, LPGENT("User list background"), SIZEOF(colourid.name)); colourid.defcolour = GetSysColor(COLOR_WINDOW); - CallService(MS_COLOUR_REGISTERT, (WPARAM)&colourid, 0); + ColourRegisterT(&colourid); strncpy(colourid.setting, "ColorNicklistLines", SIZEOF(colourid.setting)); _tcsncpy(colourid.name, LPGENT("User list lines"), SIZEOF(colourid.name)); colourid.defcolour = GetSysColor(COLOR_INACTIVEBORDER); - CallService(MS_COLOUR_REGISTERT, (WPARAM)&colourid, 0); + ColourRegisterT(&colourid); strncpy(colourid.setting, "ColorNicklistSelectedBG", SIZEOF(colourid.setting)); _tcsncpy(colourid.name, LPGENT("User list background (selected)"), SIZEOF(colourid.name)); colourid.defcolour = GetSysColor(COLOR_HIGHLIGHT); - CallService(MS_COLOUR_REGISTERT, (WPARAM)&colourid, 0); + ColourRegisterT(&colourid); } int IconsChanged(WPARAM wParam, LPARAM lParam) diff --git a/plugins/TabSRMM/chat/options.cpp b/plugins/TabSRMM/chat/options.cpp index 6a3da75c8d..77f6cb0f82 100644 --- a/plugins/TabSRMM/chat/options.cpp +++ b/plugins/TabSRMM/chat/options.cpp @@ -759,7 +759,7 @@ void RegisterFontServiceFonts() { _tcsncpy(fid.backgroundName, _T("Incoming background"), SIZEOF(fid.backgroundName)); break; } - CallService(MS_FONT_REGISTERT, (WPARAM)&fid, 0); + FontRegisterT(&fid); } fontOptionsList = IP_fontOptionsList; @@ -785,9 +785,9 @@ void RegisterFontServiceFonts() { _tcsncpy(fid.backgroundGroup, _T(""), SIZEOF(fid.backgroundGroup)); _tcsncpy(fid.backgroundName, _T(""), SIZEOF(fid.backgroundName)); _tcsncpy(fid.group, _T("TabSRMM"), SIZEOF(fid.group)); - } - CallService(MS_FONT_REGISTERT, (WPARAM)&fid, 0); } + FontRegisterT(&fid); + } fontOptionsList = CHAT_fontOptionsList; fid.flags = FIDF_DEFAULTVALID|FIDF_ALLOWEFFECTS; @@ -810,7 +810,7 @@ void RegisterFontServiceFonts() { _tcsncpy(fid.backgroundName, _T("Group chat log background"), SIZEOF(fid.backgroundName)); if(i == 18 || i == 19) _tcsncpy(fid.backgroundName, _T("Userlist background"), SIZEOF(fid.backgroundName)); - CallService(MS_FONT_REGISTERT, (WPARAM)&fid, 0); + FontRegisterT(&fid); } _tcsncpy(cid.group, _T("TabSRMM/Group Chats"), SIZEOF(cid.group)); @@ -821,23 +821,23 @@ void RegisterFontServiceFonts() { cid.order=i+1; strncpy(cid.setting, szTemp, SIZEOF(cid.setting)); switch (i) { - case 5: - cid.defcolour = GetSysColor(COLOR_HIGHLIGHT); - break; - case 6: - cid.defcolour = GetSysColor(COLOR_HIGHLIGHTTEXT); - break; - default: - cid.defcolour =RGB(0, 0, 0); - break; - } - CallService(MS_COLOUR_REGISTERT, (WPARAM)&cid, 0); + case 5: + cid.defcolour = GetSysColor(COLOR_HIGHLIGHT); + break; + case 6: + cid.defcolour = GetSysColor(COLOR_HIGHLIGHTTEXT); + break; + default: + cid.defcolour =RGB(0, 0, 0); + break; } + ColourRegisterT(&cid); + } cid.order=8; _tcsncpy(cid.name, _T("Userlist background"), SIZEOF(cid.name)); strncpy(cid.setting, "ColorNicklistBG", SIZEOF(cid.setting)); cid.defcolour = SRMSGDEFSET_BKGCOLOUR; - CallService(MS_COLOUR_REGISTERT, (WPARAM)&cid, 0); + ColourRegisterT(&cid); /* * static colors (info panel, tool bar background etc...) @@ -854,7 +854,7 @@ void RegisterFontServiceFonts() { cid.defcolour = GetSysColor(_clrs[i].def & 0x000000ff); else cid.defcolour = _clrs[i].def; - CallService(MS_COLOUR_REGISTERT, (WPARAM)&cid, 0); + ColourRegisterT(&cid); } strncpy(cid.dbSettingsGroup, SRMSGMOD_T, SIZEOF(fid.dbSettingsGroup)); @@ -872,7 +872,7 @@ void RegisterFontServiceFonts() { else cid.defcolour = _tabclrs[i].def; - CallService(MS_COLOUR_REGISTERT, (WPARAM)&cid, 0); + ColourRegisterT(&cid); } } diff --git a/plugins/TipperYM/tipper.cpp b/plugins/TipperYM/tipper.cpp index fde1fd7a39..09903c4302 100644 --- a/plugins/TipperYM/tipper.cpp +++ b/plugins/TipperYM/tipper.cpp @@ -151,6 +151,7 @@ void InitFonts() strcpy(colourBg.setting, "ColourBg"); colourBg.defcolour = RGB(219, 219, 219); colourBg.order = 0; + ColourRegisterT(&colourBg); colourBorder.cbSize = sizeof(ColourIDT); _tcscpy(colourBorder.group, LPGENT("Tooltips")); @@ -159,6 +160,7 @@ void InitFonts() strcpy(colourBorder.setting, "BorderCol"); colourBorder.defcolour = 0; colourBorder.order = 0; + ColourRegisterT(&colourBorder); colourAvatarBorder.cbSize = sizeof(ColourIDT); _tcscpy(colourAvatarBorder.group, LPGENT("Tooltips")); @@ -167,6 +169,7 @@ void InitFonts() strcpy(colourAvatarBorder.setting, "AvBorderCol"); colourAvatarBorder.defcolour = 0; colourAvatarBorder.order = 0; + ColourRegisterT(&colourAvatarBorder); colourDivider.cbSize = sizeof(ColourIDT); _tcscpy(colourDivider.group, LPGENT("Tooltips")); @@ -175,6 +178,7 @@ void InitFonts() strcpy(colourDivider.setting, "DividerCol"); colourDivider.defcolour = 0; colourDivider.order = 0; + ColourRegisterT(&colourDivider); colourSidebar.cbSize = sizeof(ColourIDT); _tcscpy(colourSidebar.group, LPGENT("Tooltips")); @@ -183,12 +187,7 @@ void InitFonts() strcpy(colourSidebar.setting, "SidebarCol"); colourSidebar.defcolour = RGB(192, 192, 192); colourSidebar.order = 0; - - CallService(MS_COLOUR_REGISTERT, (WPARAM)&colourBg, 0); - CallService(MS_COLOUR_REGISTERT, (WPARAM)&colourBorder, 0); - CallService(MS_COLOUR_REGISTERT, (WPARAM)&colourAvatarBorder, 0); - CallService(MS_COLOUR_REGISTERT, (WPARAM)&colourDivider, 0); - CallService(MS_COLOUR_REGISTERT, (WPARAM)&colourSidebar, 0); + ColourRegisterT(&colourSidebar); fontTitle.cbSize = sizeof(FontIDT); fontTitle.flags = FIDF_ALLOWEFFECTS; diff --git a/plugins/TooltipNotify/src/TooltipNotify.cpp b/plugins/TooltipNotify/src/TooltipNotify.cpp index 1bac84a5c6..969d714b8b 100644 --- a/plugins/TooltipNotify/src/TooltipNotify.cpp +++ b/plugins/TooltipNotify/src/TooltipNotify.cpp @@ -116,11 +116,11 @@ void CTooltipNotify::RegisterFonts() _tcscpy(fontId.name, s_fontTable[i].name); strcpy(fontId.prefix, s_fontTable[i].fontPrefix); _tcscpy(fontId.backgroundName, s_fontTable[i].name); - ::CallService(MS_FONT_REGISTERT, (WPARAM)&fontId, 0); + ::FontRegisterT(&fontId); _tcscpy(colorId.name, s_fontTable[i].name); strcpy(colorId.setting, s_fontTable[i].clrPrefix); - ::CallService(MS_COLOUR_REGISTERT, (WPARAM)&colorId, 0); + ::ColourRegisterT(&colorId); } } diff --git a/plugins/YAPP/popups2.cpp b/plugins/YAPP/popups2.cpp index c90196336f..c464ea02f9 100644 --- a/plugins/YAPP/popups2.cpp +++ b/plugins/YAPP/popups2.cpp @@ -111,13 +111,12 @@ int ReloadFont(WPARAM wParam, LPARAM lParam) HANDLE hEventReloadFont = 0; -int ModulesLoaded(WPARAM wParam, LPARAM lParam) { +int ModulesLoaded(WPARAM wParam, LPARAM lParam) +{ MNotifyGetLink(); if (ServiceExists(MS_HPP_EG_WINDOW)) - { lstPopupHistory.SetRenderer(RENDER_HISTORYPP); - } if(ServiceExists(MS_UPDATE_REGISTER)) { // register with updater @@ -148,172 +147,77 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) { CallService(MS_UPDATE_REGISTER, 0, (WPARAM)&update); } - - if(ServiceExists(MS_FONT_REGISTERW)) - { - font_id_firstlinew.cbSize = sizeof(FontIDW); - font_id_firstlinew.flags = FIDF_ALLOWEFFECTS; - _tcscpy(font_id_firstlinew.group, _T("Popups")); - _tcscpy(font_id_firstlinew.name, _T("First line")); - strcpy(font_id_firstlinew.dbSettingsGroup, MODULE); - strcpy(font_id_firstlinew.prefix, "FontFirst"); - font_id_firstlinew.order = 0; - - font_id_secondlinew.cbSize = sizeof(FontIDW); - font_id_secondlinew.flags = FIDF_ALLOWEFFECTS; - _tcscpy(font_id_secondlinew.group, _T("Popups")); - _tcscpy(font_id_secondlinew.name, _T("Second line")); - strcpy(font_id_secondlinew.dbSettingsGroup, MODULE); - strcpy(font_id_secondlinew.prefix, "FontSecond"); - font_id_secondlinew.order = 1; - - font_id_timew.cbSize = sizeof(FontIDW); - font_id_timew.flags = FIDF_ALLOWEFFECTS; - _tcscpy(font_id_timew.group, _T("Popups")); - _tcscpy(font_id_timew.name, _T("Time")); - strcpy(font_id_timew.dbSettingsGroup, MODULE); - strcpy(font_id_timew.prefix, "FontTime"); - font_id_timew.order = 2; - - CallService(MS_FONT_REGISTERW, (WPARAM)&font_id_firstlinew, 0); - CallService(MS_FONT_REGISTERW, (WPARAM)&font_id_secondlinew, 0); - CallService(MS_FONT_REGISTERW, (WPARAM)&font_id_timew, 0); + font_id_firstlinew.cbSize = sizeof(FontIDW); + font_id_firstlinew.flags = FIDF_ALLOWEFFECTS; + _tcscpy(font_id_firstlinew.group, _T("Popups")); + _tcscpy(font_id_firstlinew.name, _T("First line")); + strcpy(font_id_firstlinew.dbSettingsGroup, MODULE); + strcpy(font_id_firstlinew.prefix, "FontFirst"); + font_id_firstlinew.order = 0; + FontRegisterT(&font_id_firstlinew); + + font_id_secondlinew.cbSize = sizeof(FontIDW); + font_id_secondlinew.flags = FIDF_ALLOWEFFECTS; + _tcscpy(font_id_secondlinew.group, _T("Popups")); + _tcscpy(font_id_secondlinew.name, _T("Second line")); + strcpy(font_id_secondlinew.dbSettingsGroup, MODULE); + strcpy(font_id_secondlinew.prefix, "FontSecond"); + font_id_secondlinew.order = 1; + FontRegisterT(&font_id_secondlinew); + + font_id_timew.cbSize = sizeof(FontIDW); + font_id_timew.flags = FIDF_ALLOWEFFECTS; + _tcscpy(font_id_timew.group, _T("Popups")); + _tcscpy(font_id_timew.name, _T("Time")); + strcpy(font_id_timew.dbSettingsGroup, MODULE); + strcpy(font_id_timew.prefix, "FontTime"); + font_id_timew.order = 2; + FontRegisterT(&font_id_timew); - colour_id_bgw.cbSize = sizeof(ColourIDW); - _tcscpy(colour_id_bgw.group, _T("Popups")); - _tcscpy(colour_id_bgw.name, _T("Background")); - strcpy(colour_id_bgw.dbSettingsGroup, MODULE); - strcpy(colour_id_bgw.setting, "ColourBg"); - colour_id_bgw.defcolour = GetSysColor(COLOR_3DSHADOW); - colour_id_bgw.order = 0; - - colour_id_borderw.cbSize = sizeof(ColourIDW); - _tcscpy(colour_id_borderw.group, _T("Popups")); - _tcscpy(colour_id_borderw.name, _T("Border")); - strcpy(colour_id_borderw.dbSettingsGroup, MODULE); - strcpy(colour_id_borderw.setting, "ColourBorder"); - colour_id_borderw.defcolour = RGB(0, 0, 0); - colour_id_borderw.order = 1; - - colour_id_sidebarw.cbSize = sizeof(ColourIDW); - _tcscpy(colour_id_sidebarw.group, _T("Popups")); - _tcscpy(colour_id_sidebarw.name, _T("Sidebar")); - strcpy(colour_id_sidebarw.dbSettingsGroup, MODULE); - strcpy(colour_id_sidebarw.setting, "ColourSidebar"); - colour_id_sidebarw.defcolour = RGB(128, 128, 128); - colour_id_sidebarw.order = 2; - - colour_id_titleunderlinew.cbSize = sizeof(ColourIDW); - _tcscpy(colour_id_titleunderlinew.group, _T("Popups")); - _tcscpy(colour_id_titleunderlinew.name, _T("Title underline")); - strcpy(colour_id_titleunderlinew.dbSettingsGroup, MODULE); - strcpy(colour_id_titleunderlinew.setting, "ColourTitleUnderline"); - colour_id_titleunderlinew.defcolour = GetSysColor(COLOR_3DSHADOW); - colour_id_titleunderlinew.order = 3; - - CallService(MS_COLOUR_REGISTERW, (WPARAM)&colour_id_bgw, 0); - CallService(MS_COLOUR_REGISTERW, (WPARAM)&colour_id_borderw, 0); - CallService(MS_COLOUR_REGISTERW, (WPARAM)&colour_id_sidebarw, 0); - CallService(MS_COLOUR_REGISTERW, (WPARAM)&colour_id_titleunderlinew, 0); + colour_id_bgw.cbSize = sizeof(ColourIDW); + _tcscpy(colour_id_bgw.group, _T("Popups")); + _tcscpy(colour_id_bgw.name, _T("Background")); + strcpy(colour_id_bgw.dbSettingsGroup, MODULE); + strcpy(colour_id_bgw.setting, "ColourBg"); + colour_id_bgw.defcolour = GetSysColor(COLOR_3DSHADOW); + colour_id_bgw.order = 0; + ColourRegisterT(&colour_id_bgw); + + colour_id_borderw.cbSize = sizeof(ColourIDW); + _tcscpy(colour_id_borderw.group, _T("Popups")); + _tcscpy(colour_id_borderw.name, _T("Border")); + strcpy(colour_id_borderw.dbSettingsGroup, MODULE); + strcpy(colour_id_borderw.setting, "ColourBorder"); + colour_id_borderw.defcolour = RGB(0, 0, 0); + colour_id_borderw.order = 1; + ColourRegisterT(&colour_id_borderw); + + colour_id_sidebarw.cbSize = sizeof(ColourIDW); + _tcscpy(colour_id_sidebarw.group, _T("Popups")); + _tcscpy(colour_id_sidebarw.name, _T("Sidebar")); + strcpy(colour_id_sidebarw.dbSettingsGroup, MODULE); + strcpy(colour_id_sidebarw.setting, "ColourSidebar"); + colour_id_sidebarw.defcolour = RGB(128, 128, 128); + colour_id_sidebarw.order = 2; + ColourRegisterT(&colour_id_sidebarw); + + colour_id_titleunderlinew.cbSize = sizeof(ColourIDW); + _tcscpy(colour_id_titleunderlinew.group, _T("Popups")); + _tcscpy(colour_id_titleunderlinew.name, _T("Title underline")); + strcpy(colour_id_titleunderlinew.dbSettingsGroup, MODULE); + strcpy(colour_id_titleunderlinew.setting, "ColourTitleUnderline"); + colour_id_titleunderlinew.defcolour = GetSysColor(COLOR_3DSHADOW); + colour_id_titleunderlinew.order = 3; + ColourRegisterT(&colour_id_titleunderlinew); - ReloadFont(0, 0); - - hEventReloadFont = HookEvent(ME_FONT_RELOAD, ReloadFont); - } - else + ReloadFont(0, 0); - if(ServiceExists(MS_FONT_REGISTER)) - { - font_id_firstline.cbSize = sizeof(FontID); - font_id_firstline.flags = FIDF_ALLOWEFFECTS; - strcpy(font_id_firstline.group, "Popups"); - strcpy(font_id_firstline.name, "First line"); - strcpy(font_id_firstline.dbSettingsGroup, MODULE); - strcpy(font_id_firstline.prefix, "FontFirst"); - font_id_firstline.order = 0; - - font_id_secondline.cbSize = sizeof(FontID); - font_id_secondline.flags = FIDF_ALLOWEFFECTS; - strcpy(font_id_secondline.group, "Popups"); - strcpy(font_id_secondline.name, "Second line"); - strcpy(font_id_secondline.dbSettingsGroup, MODULE); - strcpy(font_id_secondline.prefix, "FontSecond"); - font_id_secondline.order = 1; - - font_id_time.cbSize = sizeof(FontID); - font_id_time.flags = FIDF_ALLOWEFFECTS; - strcpy(font_id_time.group, "Popups"); - strcpy(font_id_time.name, "Time"); - strcpy(font_id_time.dbSettingsGroup, MODULE); - strcpy(font_id_time.prefix, "FontTime"); - font_id_time.order = 2; - - CallService(MS_FONT_REGISTER, (WPARAM)&font_id_firstline, 0); - CallService(MS_FONT_REGISTER, (WPARAM)&font_id_secondline, 0); - CallService(MS_FONT_REGISTER, (WPARAM)&font_id_time, 0); - - colour_id_bg.cbSize = sizeof(ColourID); - strcpy(colour_id_bg.group, "Popups"); - strcpy(colour_id_bg.name, "Background"); - strcpy(colour_id_bg.dbSettingsGroup, MODULE); - strcpy(colour_id_bg.setting, "ColourBg"); - colour_id_bg.defcolour = GetSysColor(COLOR_3DSHADOW); - colour_id_bg.order = 0; - - colour_id_border.cbSize = sizeof(ColourID); - strcpy(colour_id_border.group, "Popups"); - strcpy(colour_id_border.name, "Border"); - strcpy(colour_id_border.dbSettingsGroup, MODULE); - strcpy(colour_id_border.setting, "ColourBorder"); - colour_id_border.defcolour = RGB(0, 0, 0); - colour_id_border.order = 1; - - colour_id_sidebar.cbSize = sizeof(ColourID); - strcpy(colour_id_sidebar.group, "Popups"); - strcpy(colour_id_sidebar.name, "Sidebar"); - strcpy(colour_id_sidebar.dbSettingsGroup, MODULE); - strcpy(colour_id_sidebar.setting, "ColourSidebar"); - colour_id_sidebar.defcolour = RGB(128, 128, 128); - colour_id_sidebar.order = 2; - - colour_id_titleunderline.cbSize = sizeof(ColourID); - strcpy(colour_id_titleunderline.group, "Popups"); - strcpy(colour_id_titleunderline.name, "Title underline"); - strcpy(colour_id_titleunderline.dbSettingsGroup, MODULE); - strcpy(colour_id_titleunderline.setting, "ColourTitleUnderline"); - colour_id_titleunderline.defcolour = GetSysColor(COLOR_3DSHADOW); - colour_id_titleunderline.order = 3; - - CallService(MS_COLOUR_REGISTER, (WPARAM)&colour_id_bg, 0); - CallService(MS_COLOUR_REGISTER, (WPARAM)&colour_id_border, 0); - CallService(MS_COLOUR_REGISTER, (WPARAM)&colour_id_sidebar, 0); - CallService(MS_COLOUR_REGISTER, (WPARAM)&colour_id_titleunderline, 0); - - ReloadFont(0, 0); - - hEventReloadFont = HookEvent(ME_FONT_RELOAD, ReloadFont); - } else { - LOGFONT lf = {0}; - lf.lfCharSet = DEFAULT_CHARSET; - lf.lfHeight = -14; - lf.lfWeight = FW_BOLD; - hFontFirstLine = CreateFontIndirect(&lf); - - lf.lfHeight = -12; - lf.lfWeight = 0; - hFontSecondLine = CreateFontIndirect(&lf); - - lf.lfHeight = -8; - lf.lfWeight = 0; - hFontTime = CreateFontIndirect(&lf); - } + hEventReloadFont = HookEvent(ME_FONT_RELOAD, ReloadFont); LoadModuleDependentOptions(); if(GetModuleHandle(_T("neweventnotify"))) - { ignore_gpd_passed_addy = true; - } return 0; } @@ -357,16 +261,15 @@ extern "C" int POPUPS2_API Load(PLUGINLINK *link) { return 0; } -extern "C" int POPUPS2_API Unload() { - if(hEventReloadFont) UnhookEvent(hEventReloadFont); +extern "C" int POPUPS2_API Unload() +{ + if(hEventReloadFont) + UnhookEvent(hEventReloadFont); UnhookEvent(hEventPreShutdown); UnhookEvent(hEventModulesLoaded); DeinitNotify(); - if(ServiceExists(MS_FONT_REGISTERW)) { - DeleteObject(hFontFirstLine); - DeleteObject(hFontSecondLine); - DeleteObject(hFontTime); - } // otherwise, no need to delete the handle - + DeleteObject(hFontFirstLine); + DeleteObject(hFontSecondLine); + DeleteObject(hFontTime); return 0; } diff --git a/protocols/JabberG/jabber.cpp b/protocols/JabberG/jabber.cpp index b571e06bbf..d265df4fc8 100644 --- a/protocols/JabberG/jabber.cpp +++ b/protocols/JabberG/jabber.cpp @@ -188,12 +188,12 @@ static int OnModulesLoaded( WPARAM, LPARAM ) strcpy(fontid.name, "Frame title"); strcpy(fontid.prefix, "fntFrameTitle"); fontid.deffontsettings.style = DBFONTF_BOLD; - CallService(MS_FONT_REGISTER, (WPARAM)&fontid, 0); + FontRegister(&fontid); strcpy(fontid.name, "Frame text"); strcpy(fontid.prefix, "fntFrameClock"); fontid.deffontsettings.style = 0; - CallService(MS_FONT_REGISTER, (WPARAM)&fontid, 0); + FontRegister(&fontid); ColourID colourid = {0}; colourid.cbSize = sizeof(colourid); @@ -203,7 +203,7 @@ static int OnModulesLoaded( WPARAM, LPARAM ) strcpy(colourid.name, "Background"); strcpy(colourid.setting, "clFrameBack"); colourid.defcolour = GetSysColor(COLOR_WINDOW); - CallService(MS_COLOUR_REGISTER, (WPARAM)&colourid, 0); + ColourRegister(&colourid); // Init extra icons hExtraActivity = ExtraIcon_Register("activity", "Jabber Activity" /* No icons registered, "working" */); diff --git a/protocols/Weather/weather_mwin.cpp b/protocols/Weather/weather_mwin.cpp index 4c43cc2afe..4e4fd125bd 100644 --- a/protocols/Weather/weather_mwin.cpp +++ b/protocols/Weather/weather_mwin.cpp @@ -373,19 +373,16 @@ void InitMwin(void) } { - FontID fontid = {0}; ColourID colourid = {0}; - HDC hdc; - colourid.cbSize = sizeof(ColourID); strcpy(colourid.dbSettingsGroup, WEATHERPROTONAME); strcpy(colourid.setting, "ColorMwinFrame"); strcpy(colourid.name, "Frame Background"); strcpy(colourid.group, WEATHERPROTONAME); colourid.defcolour = GetSysColor(COLOR_3DFACE); + ColourRegister(&colourid); - CallService(MS_COLOUR_REGISTER, (WPARAM)&colourid, 0); - + FontID fontid = {0}; fontid.cbSize = sizeof(FontID); fontid.flags = FIDF_ALLOWREREGISTER | FIDF_DEFAULTVALID; strcpy(fontid.dbSettingsGroup, WEATHERPROTONAME); @@ -393,7 +390,7 @@ void InitMwin(void) strcpy(fontid.name, "Frame Font"); strcpy(fontid.prefix, "fnt0"); - hdc = GetDC(NULL); + HDC hdc = GetDC(NULL); fontid.deffontsettings.size = -13; ReleaseDC(0, hdc); @@ -401,14 +398,12 @@ void InitMwin(void) strcpy(fontid.deffontsettings.szFace, "Verdana"); strcpy(fontid.backgroundGroup, WEATHERPROTONAME); strcpy(fontid.backgroundName, "Frame Background"); - - CallService(MS_FONT_REGISTER, (WPARAM)&fontid, 0); + FontRegister(&fontid); fontid.deffontsettings.style = DBFONTF_BOLD; strcpy(fontid.name, "Frame Title Font"); strcpy(fontid.prefix, "fnt1"); - - CallService(MS_FONT_REGISTER, (WPARAM)&fontid, 0); + FontRegister(&fontid); } hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); diff --git a/src/modules/fonts/FontOptions.cpp b/src/modules/fonts/FontOptions.cpp index 8f343c5041..c026e26d72 100644 --- a/src/modules/fonts/FontOptions.cpp +++ b/src/modules/fonts/FontOptions.cpp @@ -27,47 +27,50 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // *_w2 is working copy of list // *_w3 is stores initial configuration -static int sttCompareFont(const TFontID* p1, const TFontID* p2) +static int sttCompareFont(const FontInternal* p1, const FontInternal* p2) { int result = _tcscmp(p1->group, p2->group); if (result != 0) return result; + result = p1->order - p2->order; if (result != 0) return result; - return _tcscmp(TranslateTS(p1->name), TranslateTS(p2->name)); + + return _tcscmp( p1->getName(), p2->getName()); } -OBJLIST font_id_list(20, sttCompareFont), font_id_list_w2(20, sttCompareFont), font_id_list_w3(20, sttCompareFont); +OBJLIST font_id_list(20, sttCompareFont), font_id_list_w2(20, sttCompareFont), font_id_list_w3(20, sttCompareFont); -static int sttCompareColour(const TColourID* p1, const TColourID* p2) +static int sttCompareColour(const ColourInternal* p1, const ColourInternal* p2) { int result = _tcscmp(p1->group, p2->group); if (result != 0) return result; + result = p1->order - p2->order; if (result != 0) return result; - return _tcscmp(TranslateTS(p1->name), TranslateTS(p2->name)); + return _tcscmp( p1->getName(), p2->getName()); } -OBJLIST colour_id_list(10, sttCompareColour), colour_id_list_w2(10, sttCompareColour), colour_id_list_w3(10, sttCompareColour); - +OBJLIST colour_id_list(10, sttCompareColour), colour_id_list_w2(10, sttCompareColour), colour_id_list_w3(10, sttCompareColour); -static int sttCompareEffect(const TEffectID* p1, const TEffectID* p2) +static int sttCompareEffect(const EffectInternal* p1, const EffectInternal* p2) { int result = _tcscmp(p1->group, p2->group); if (result != 0) return result; - result = p1->order - p2->order; + + result = p1->order - p2->order; if (result != 0) return result; - return _tcscmp(TranslateTS(p1->name), TranslateTS(p2->name)); + return _tcscmp( p1->getName(), p2->getName()); } -OBJLIST effect_id_list(10, sttCompareEffect), effect_id_list_w2(10, sttCompareEffect), effect_id_list_w3(10, sttCompareEffect); +OBJLIST effect_id_list(10, sttCompareEffect), effect_id_list_w2(10, sttCompareEffect), effect_id_list_w3(10, sttCompareEffect); typedef struct DrawTextWithEffectParam_tag { @@ -119,9 +122,9 @@ int __inline DrawTextWithEffect(HDC hdc, LPCTSTR lpchText, int cchText, RECT * l #define FSUI_FONTFRAMEVERT 4 #define FSUI_FONTLEFT (FSUI_COLORBOXLEFT+FSUI_COLORBOXWIDTH+5) -extern void UpdateFontSettings(TFontID *font_id, TFontSettings *fontsettings); -extern void UpdateColourSettings(TColourID *colour_id, COLORREF *colour); -extern void UpdateEffectSettings(TEffectID* effect_id, TEffectSettings* effectsettings); +void UpdateFontSettings(FontIDW *font_id, FontSettingsT *fontsettings); +void UpdateColourSettings(ColourIDW *colour_id, COLORREF *colour); +void UpdateEffectSettings(EffectIDW *effect_id, FONTEFFECT* effectsettings); void WriteLine(HANDLE fhand, char *line) { @@ -130,7 +133,7 @@ void WriteLine(HANDLE fhand, char *line) WriteFile(fhand, line, (DWORD)strlen(line), &wrote, 0); } -BOOL ExportSettings(HWND hwndDlg, TCHAR *filename, OBJLIST& flist, OBJLIST& clist, OBJLIST& elist) +BOOL ExportSettings(HWND hwndDlg, TCHAR *filename, OBJLIST& flist, OBJLIST& clist, OBJLIST& elist) { int i; char header[512], buff[1024], abuff[1024]; @@ -147,7 +150,7 @@ BOOL ExportSettings(HWND hwndDlg, TCHAR *filename, OBJLIST& flist, OBJL WriteLine(fhand, buff); for (i = 0; i < flist.getCount(); i++) { - TFontID& F = flist[i]; + FontInternal& F = flist[i]; mir_snprintf(buff, SIZEOF(buff), "\r\n[%s]", F.dbSettingsGroup); if (strcmp(buff, header) != 0) { @@ -208,7 +211,7 @@ BOOL ExportSettings(HWND hwndDlg, TCHAR *filename, OBJLIST& flist, OBJL header[0] = 0; for (i=0; i < clist.getCount(); i++) { - TColourID& C = clist[i]; + ColourInternal& C = clist[i]; mir_snprintf(buff, SIZEOF(buff), "\r\n[%s]", C.dbSettingsGroup); if (strcmp(buff, header) != 0) { @@ -221,7 +224,7 @@ BOOL ExportSettings(HWND hwndDlg, TCHAR *filename, OBJLIST& flist, OBJL header[0] = 0; for (i=0; i < elist.getCount(); i++) { - TEffectID& E = elist[i]; + EffectInternal& E = elist[i]; mir_snprintf(buff, SIZEOF(buff), "\r\n[%s]", E.dbSettingsGroup); if (strcmp(buff, header) != 0) { @@ -285,7 +288,7 @@ static BOOL sttFsuiBindColourIdToFonts(HWND hwndList, const TCHAR *name, const T { FSUIListItemData *itemData = (FSUIListItemData *)SendMessage(hwndList, LB_GETITEMDATA, i, 0); if (itemData && itemData->font_id >= 0) { - TFontID& F = font_id_list_w2[itemData->font_id]; + FontInternal& F = font_id_list_w2[itemData->font_id]; if (name && !_tcscmp(F.name, name)) { itemData->colour_id = colourId; @@ -308,7 +311,7 @@ static BOOL sttFsuiBindEffectIdToFonts(HWND hwndList, const TCHAR *name, int eff { FSUIListItemData *itemData = (FSUIListItemData *)SendMessage(hwndList, LB_GETITEMDATA, i, 0); if (itemData && itemData->font_id >= 0) { - TFontID& F = font_id_list_w2[itemData->font_id]; + FontInternal& F = font_id_list_w2[itemData->font_id]; if (name && !_tcscmp(F.name, name)) { itemData->effect_id = effectId; @@ -349,7 +352,7 @@ static HTREEITEM sttFindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, const TC return NULL; } -static void sttFsuiCreateSettingsTreeNode(HWND hwndTree, const TCHAR *groupName) +static void sttFsuiCreateSettingsTreeNode(HWND hwndTree, const TCHAR *groupName, int hLangpack) { TCHAR itemName[1024]; TCHAR* sectionName; @@ -364,12 +367,11 @@ static void sttFsuiCreateSettingsTreeNode(HWND hwndTree, const TCHAR *groupName) TCHAR* pItemName = sectionName; HTREEITEM hItem; - if (sectionName = _tcschr(sectionName, '/')) { - // one level deeper + // one level deeper + if (sectionName = _tcschr(sectionName, '/')) *sectionName = 0; - } - pItemName = TranslateTS(pItemName); + pItemName = LangPackTranslateStringT(hLangpack, pItemName); hItem = sttFindNamedTreeItemAt(hwndTree, hSection, pItemName); if ( !sectionName || !hItem) { @@ -466,36 +468,25 @@ static BOOL ShowEffectButton(HWND hwndDlg, BOOL bShow) return TRUE; } +TCHAR* ModernEffectNames[] = { _T(""), _T("Shadow at left"), _T("Shadow at right"), _T("Outline"), _T("Outline smooth"), _T("Smooth bump"), _T("Contour thin"), _T("Contour heavy") }; + static INT_PTR CALLBACK ChooseEffectDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { - static TEffectSettings * pEffect = NULL; + static FONTEFFECT * pEffect = NULL; switch (uMsg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); - pEffect = (TEffectSettings*) lParam; + pEffect = (FONTEFFECT*) lParam; { int i; - TCHAR * ModernEffectNames[]= - { - _T(""), - _T("Shadow at left"), - _T("Shadow at right"), - _T("Outline"), - _T("Outline smooth"), - _T("Smooth bump"), - _T("Contour thin"), - _T("Contour heavy"), - }; - - for (i=0; i < SIZEOF(ModernEffectNames); i++) - { + for (i=0; i < SIZEOF(ModernEffectNames); i++) { int itemid = SendDlgItemMessage(hwndDlg, IDC_EFFECT_COMBO, CB_ADDSTRING, 0, (LPARAM)TranslateTS(ModernEffectNames[i])); SendDlgItemMessage(hwndDlg, IDC_EFFECT_COMBO, CB_SETITEMDATA, itemid, i); SendDlgItemMessage(hwndDlg, IDC_EFFECT_COMBO, CB_SETCURSEL, 0, 0); } - int cnt=SendDlgItemMessage(hwndDlg, IDC_EFFECT_COMBO, CB_GETCOUNT, 0, 0); + int cnt = SendDlgItemMessage(hwndDlg, IDC_EFFECT_COMBO, CB_GETCOUNT, 0, 0); for (i = 0; i < cnt; i++) { if (SendDlgItemMessage(hwndDlg, IDC_EFFECT_COMBO, CB_GETITEMDATA, i, 0) == pEffect->effectIndex) { SendDlgItemMessage(hwndDlg, IDC_EFFECT_COMBO, CB_SETCURSEL, i, 0); @@ -535,12 +526,12 @@ static INT_PTR CALLBACK ChooseEffectDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wPar return FALSE; } -static BOOL ChooseEffectDialog(HWND hwndParent, TEffectSettings * es) +static BOOL ChooseEffectDialog(HWND hwndParent, FONTEFFECT * es) { return (DialogBoxParam(hMirandaInst, MAKEINTRESOURCE(IDD_CHOOSE_FONT_EFFECT), hwndParent, ChooseEffectDlgProc, (LPARAM) es) == IDOK); } -static void sttSaveFontData(HWND hwndDlg, TFontID &F) +static void sttSaveFontData(HWND hwndDlg, FontInternal &F) { LOGFONT lf; char str[128]; @@ -614,26 +605,26 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, effect_id_list_w3 = effect_id_list; for (i = 0; i < font_id_list_w2.getCount(); i++) { - TFontID& F = font_id_list_w2[i]; + FontInternal& F = font_id_list_w2[i]; // sync settings with database UpdateFontSettings(&F, &F.value); - sttFsuiCreateSettingsTreeNode(GetDlgItem(hwndDlg, IDC_FONTGROUP), F.group); + sttFsuiCreateSettingsTreeNode(GetDlgItem(hwndDlg, IDC_FONTGROUP), F.group, F.hLangpack); } for (i = 0; i < colour_id_list_w2.getCount(); i++) { - TColourID& C = colour_id_list_w2[i]; + ColourInternal& C = colour_id_list_w2[i]; // sync settings with database UpdateColourSettings(&C, &C.value); - sttFsuiCreateSettingsTreeNode(GetDlgItem(hwndDlg, IDC_FONTGROUP), C.group); + sttFsuiCreateSettingsTreeNode(GetDlgItem(hwndDlg, IDC_FONTGROUP), C.group, C.hLangpack); } for (i = 0; i < effect_id_list_w2.getCount(); i++) { - TEffectID& E = effect_id_list_w2[i]; + EffectInternal& E = effect_id_list_w2[i]; // sync settings with database UpdateEffectSettings(&E, &E.value); - sttFsuiCreateSettingsTreeNode(GetDlgItem(hwndDlg, IDC_FONTGROUP), E.group); + sttFsuiCreateSettingsTreeNode(GetDlgItem(hwndDlg, IDC_FONTGROUP), E.group, E.hLangpack); } } @@ -666,7 +657,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, SendDlgItemMessage(hwndDlg, IDC_FONTLIST, WM_SETREDRAW, FALSE, 0); for (fontId = 0; fontId < font_id_list_w2.getCount(); fontId++) { - TFontID& F = font_id_list_w2[fontId]; + FontInternal& F = font_id_list_w2[fontId]; if (_tcsncmp(F.group, group_buff, 64) == 0) { FSUIListItemData *itemData = (FSUIListItemData*)mir_alloc(sizeof(FSUIListItemData)); itemData->colour_id = -1; @@ -688,7 +679,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, } for (colourId = 0; colourId < colour_id_list_w2.getCount(); colourId++) { - TColourID& C = colour_id_list_w2[colourId]; + ColourInternal& C = colour_id_list_w2[colourId]; if (_tcsncmp(C.group, group_buff, 64) == 0) { FSUIListItemData *itemData = NULL; if (first_colour_index == -1) @@ -711,7 +702,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, hBkgColourBrush = CreateSolidBrush(GetSysColor(COLOR_WINDOW)); for (effectId = 0; effectId < effect_id_list_w2.getCount(); effectId++) { - TEffectID& E = effect_id_list_w2[effectId]; + EffectInternal& E = effect_id_list_w2[effectId]; if (_tcsncmp(E.group, group_buff, 64) == 0) { FSUIListItemData *itemData = NULL; if (first_effect_index == -1) @@ -762,13 +753,13 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, bIsFont = TRUE; CreateFromFontSettings(&font_id_list_w2[iItem].value, &lf); hFont = CreateFontIndirect(&lf); - itemName = TranslateTS(font_id_list_w2[iItem].name); + itemName = font_id_list_w2[iItem].getName(); } if (itemData->colour_id >= 0) { int iItem = itemData->colour_id; if ( !itemName) - itemName = TranslateTS(colour_id_list_w2[iItem].name); + itemName = colour_id_list_w2[iItem].getName(); } hdc = GetDC(GetDlgItem(hwndDlg, mis->CtlID)); @@ -797,8 +788,8 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, FSUIListItemData *itemData = (FSUIListItemData *)dis->itemData; - FONTEFFECT Effect; - FONTEFFECT * pEffect = NULL; + FONTEFFECT Effect; + FONTEFFECT * pEffect = NULL; if (dis->CtlID != IDC_FONTLIST) break; @@ -810,7 +801,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, bIsFont = TRUE; CreateFromFontSettings(&font_id_list_w2[iItem].value, &lf); hFont = CreateFontIndirect(&lf); - itemName = TranslateTS(font_id_list_w2[iItem].name); + itemName = font_id_list_w2[iItem].getName(); clText = font_id_list_w2[iItem].value.colour; } @@ -820,21 +811,21 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, clBack = colour_id_list_w2[iItem].value; else { clText = colour_id_list_w2[iItem].value; - itemName = TranslateTS(colour_id_list_w2[iItem].name); - - } } + itemName = colour_id_list_w2[iItem].getName(); + } + } - if (itemData->effect_id >= 0) { - int iItem = itemData->effect_id; + if (itemData->effect_id >= 0) { + int iItem = itemData->effect_id; - Effect.effectIndex = effect_id_list_w2[iItem].value.effectIndex; - Effect.baseColour = effect_id_list_w2[iItem].value.baseColour; - Effect.secondaryColour = effect_id_list_w2[iItem].value.secondaryColour; - pEffect = &Effect; + Effect.effectIndex = effect_id_list_w2[iItem].value.effectIndex; + Effect.baseColour = effect_id_list_w2[iItem].value.baseColour; + Effect.secondaryColour = effect_id_list_w2[iItem].value.secondaryColour; + pEffect = &Effect; - if ( !bIsFont) - itemName = TranslateTS(effect_id_list_w2[iItem].name); - } + if (!bIsFont) + itemName = effect_id_list_w2[iItem].getName(); + } if (hFont) hoFont = (HFONT) SelectObject(dis->hDC, hFont); @@ -887,17 +878,17 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, SetTextColor(dis->hDC, clText); - DrawTextWithEffect(dis->hDC, _T("abc"), 3, &rc, DT_CENTER|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER|DT_WORD_ELLIPSIS, pEffect); + DrawTextWithEffect(dis->hDC, _T("abc"), 3, &rc, DT_CENTER|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER|DT_WORD_ELLIPSIS, pEffect); if (dis->itemState & ODS_SELECTED) { SetTextColor(dis->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT)); - pEffect = NULL; // Do not draw effect on selected item name text - } + pEffect = NULL; // Do not draw effect on selected item name text + } rc = dis->rcItem; rc.left += FSUI_FONTLEFT; DrawTextWithEffect(dis->hDC, itemName, (int)_tcslen(itemName), &rc, DT_LEFT|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER|DT_WORD_ELLIPSIS, pEffect); - } else - { + } + else { RECT rc; HBRUSH hbrTmp; SetRect(&rc, @@ -936,7 +927,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, char bEnableFont = 1; char bEnableClText = 1; char bEnableClBack = 1; - char bEnableEffect = 1; + char bEnableEffect = 1; char bEnableReset = 1; COLORREF clBack = 0xffffffff; @@ -951,8 +942,8 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, if (bEnableClBack && (itemData->colour_id < 0)) bEnableClBack = 0; - if (bEnableEffect && (itemData->effect_id < 0)) - bEnableEffect = 0; + if (bEnableEffect && (itemData->effect_id < 0)) + bEnableEffect = 0; if (bEnableFont && (itemData->font_id < 0)) bEnableFont = 0; if ( !bEnableFont || bEnableClText && (itemData->font_id < 0)) @@ -972,11 +963,11 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, bEnableClText = 0; bEnableClBack = 0; bEnableReset = 0; - bEnableEffect = 0; + bEnableEffect = 0; } EnableWindow(GetDlgItem(hwndDlg, IDC_BKGCOLOUR), bEnableClBack); - ShowEffectButton(hwndDlg, bEnableEffect && !bEnableClBack); + ShowEffectButton(hwndDlg, bEnableEffect && !bEnableClBack); EnableWindow(GetDlgItem(hwndDlg, IDC_FONTCOLOUR), bEnableClText); EnableWindow(GetDlgItem(hwndDlg, IDC_CHOOSEFONT), bEnableFont); @@ -994,209 +985,210 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, //fall through case IDC_CHOOSEFONT: - { - int selCount; - if (selCount = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELCOUNT, 0, 0)) { - FSUIListItemData *itemData; - CHOOSEFONT cf = { 0 }; - int i; - int *selItems = (int *)mir_alloc(selCount * sizeof(int)); - SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELITEMS, (WPARAM)selCount, (LPARAM) selItems); - itemData = (FSUIListItemData *)SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[0], 0); - if (itemData->font_id < 0) { - mir_free(selItems); - if (itemData->colour_id >= 0) - SendDlgItemMessage(hwndDlg, IDC_BKGCOLOUR, WM_LBUTTONUP, 0, 0); - return TRUE; - } + { + int selCount; + if (selCount = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELCOUNT, 0, 0)) { + FSUIListItemData *itemData; + CHOOSEFONT cf = { 0 }; + int i; + int *selItems = (int *)mir_alloc(selCount * sizeof(int)); + SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELITEMS, (WPARAM)selCount, (LPARAM) selItems); + itemData = (FSUIListItemData *)SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[0], 0); + if (itemData->font_id < 0) { + mir_free(selItems); + if (itemData->colour_id >= 0) + SendDlgItemMessage(hwndDlg, IDC_BKGCOLOUR, WM_LBUTTONUP, 0, 0); + return TRUE; + } - TFontID& F = font_id_list_w2[itemData->font_id]; + FontInternal& F = font_id_list_w2[itemData->font_id]; - CreateFromFontSettings(&F.value, &lf); + CreateFromFontSettings(&F.value, &lf); - cf.lStructSize = sizeof(cf); - cf.hwndOwner = hwndDlg; - cf.lpLogFont = &lf; - cf.lCustData = 0; - - if (F.flags & FIDF_ALLOWEFFECTS) - { - cf.Flags = CF_FORCEFONTEXIST | CF_INITTOLOGFONTSTRUCT | CF_SCREENFONTS | CF_EFFECTS | CF_ENABLETEMPLATE | CF_ENABLEHOOK; - // use custom font dialog to disable colour selection - cf.hInstance = hMirandaInst; - cf.lpTemplateName = MAKEINTRESOURCE(IDD_CUSTOM_FONT); - cf.lpfnHook = CFHookProc; - } - else if (F.flags & FIDF_DISABLESTYLES) { // no style selection, mutually exclusive with FIDF_ALLOWEFFECTS - cf.Flags = CF_FORCEFONTEXIST | CF_INITTOLOGFONTSTRUCT | CF_SCREENFONTS | CF_ENABLETEMPLATE | CF_ENABLEHOOK | CF_TTONLY | CF_NOOEMFONTS; - cf.lCustData = F.flags; - cf.hInstance = hMirandaInst; - cf.lpTemplateName = MAKEINTRESOURCE(IDD_CUSTOM_FONT); - cf.lpfnHook = CFHookProc; - lf.lfWeight = FW_NORMAL; - lf.lfItalic = lf.lfUnderline = lf.lfStrikeOut = FALSE; - } - else cf.Flags = CF_FORCEFONTEXIST | CF_INITTOLOGFONTSTRUCT | CF_SCREENFONTS; + cf.lStructSize = sizeof(cf); + cf.hwndOwner = hwndDlg; + cf.lpLogFont = &lf; + cf.lCustData = 0; - if (ChooseFont(&cf)) { - for (i = 0; i < selCount; ++i) { - FSUIListItemData *itemData = (FSUIListItemData *)SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[i], 0); - if (itemData->font_id < 0) - continue; - - TFontID& F1 = font_id_list_w2[itemData->font_id]; - F1.value.size = (char)lf.lfHeight; - F1.value.style = (lf.lfWeight >= FW_BOLD ? DBFONTF_BOLD : 0) | (lf.lfItalic ? DBFONTF_ITALIC : 0) | (lf.lfUnderline ? DBFONTF_UNDERLINE : 0) | (lf.lfStrikeOut ? DBFONTF_STRIKEOUT : 0); - F1.value.charset = lf.lfCharSet; - _tcscpy(F1.value.szFace, lf.lfFaceName); - - MEASUREITEMSTRUCT mis = { 0 }; - mis.CtlID = IDC_FONTLIST; - mis.itemID = selItems[i]; - mis.itemData = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[i], 0); - SendMessage(hwndDlg, WM_MEASUREITEM, 0, (LPARAM) & mis); - SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_SETITEMHEIGHT, selItems[i], mis.itemHeight); + if (F.flags & FIDF_ALLOWEFFECTS) + { + cf.Flags = CF_FORCEFONTEXIST | CF_INITTOLOGFONTSTRUCT | CF_SCREENFONTS | CF_EFFECTS | CF_ENABLETEMPLATE | CF_ENABLEHOOK; + // use custom font dialog to disable colour selection + cf.hInstance = hMirandaInst; + cf.lpTemplateName = MAKEINTRESOURCE(IDD_CUSTOM_FONT); + cf.lpfnHook = CFHookProc; + } + else if (F.flags & FIDF_DISABLESTYLES) { // no style selection, mutually exclusive with FIDF_ALLOWEFFECTS + cf.Flags = CF_FORCEFONTEXIST | CF_INITTOLOGFONTSTRUCT | CF_SCREENFONTS | CF_ENABLETEMPLATE | CF_ENABLEHOOK | CF_TTONLY | CF_NOOEMFONTS; + cf.lCustData = F.flags; + cf.hInstance = hMirandaInst; + cf.lpTemplateName = MAKEINTRESOURCE(IDD_CUSTOM_FONT); + cf.lpfnHook = CFHookProc; + lf.lfWeight = FW_NORMAL; + lf.lfItalic = lf.lfUnderline = lf.lfStrikeOut = FALSE; + } + else cf.Flags = CF_FORCEFONTEXIST | CF_INITTOLOGFONTSTRUCT | CF_SCREENFONTS; + + if (ChooseFont(&cf)) { + for (i = 0; i < selCount; ++i) { + FSUIListItemData *itemData = (FSUIListItemData *)SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[i], 0); + if (itemData->font_id < 0) + continue; + + FontInternal& F1 = font_id_list_w2[itemData->font_id]; + F1.value.size = (char)lf.lfHeight; + F1.value.style = (lf.lfWeight >= FW_BOLD ? DBFONTF_BOLD : 0) | (lf.lfItalic ? DBFONTF_ITALIC : 0) | (lf.lfUnderline ? DBFONTF_UNDERLINE : 0) | (lf.lfStrikeOut ? DBFONTF_STRIKEOUT : 0); + F1.value.charset = lf.lfCharSet; + _tcscpy(F1.value.szFace, lf.lfFaceName); + + MEASUREITEMSTRUCT mis = { 0 }; + mis.CtlID = IDC_FONTLIST; + mis.itemID = selItems[i]; + mis.itemData = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[i], 0); + SendMessage(hwndDlg, WM_MEASUREITEM, 0, (LPARAM) & mis); + SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_SETITEMHEIGHT, selItems[i], mis.itemHeight); + } + InvalidateRect(GetDlgItem(hwndDlg, IDC_FONTLIST), NULL, TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_UNDO), TRUE); + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); } - InvalidateRect(GetDlgItem(hwndDlg, IDC_FONTLIST), NULL, TRUE); - EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_UNDO), TRUE); - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - } - mir_free(selItems); + mir_free(selItems); + } } return TRUE; - } - case IDC_EFFECT: - { - int selCount; - if (selCount = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELCOUNT, 0, 0)) { - FSUIListItemData *itemData; - TEffectSettings es = { 0 }; - int i; - int *selItems = (int *)mir_alloc(selCount * sizeof(int)); - SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELITEMS, (WPARAM)selCount, (LPARAM) selItems); - itemData = (FSUIListItemData *)SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[0], 0); - TEffectID& E = effect_id_list_w2[itemData->effect_id]; - es = E.value; - if (ChooseEffectDialog(hwndDlg, &es)) { - for (i = 0; i < selCount; ++i) { - FSUIListItemData *itemData = (FSUIListItemData *)SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[i], 0); - if (itemData->effect_id < 0) - continue; - TEffectID& E1 = effect_id_list_w2[itemData->effect_id]; - E1.value = es; + case IDC_EFFECT: + { + int selCount; + if (selCount = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELCOUNT, 0, 0)) { + FSUIListItemData *itemData; + FONTEFFECT es = { 0 }; + int i; + int *selItems = (int *)mir_alloc(selCount * sizeof(int)); + SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELITEMS, (WPARAM)selCount, (LPARAM) selItems); + itemData = (FSUIListItemData *)SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[0], 0); + EffectInternal& E = effect_id_list_w2[itemData->effect_id]; + es = E.value; + if (ChooseEffectDialog(hwndDlg, &es)) { + for (i = 0; i < selCount; ++i) { + FSUIListItemData *itemData = (FSUIListItemData *)SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[i], 0); + if (itemData->effect_id < 0) + continue; + + EffectInternal& E1 = effect_id_list_w2[itemData->effect_id]; + E1.value = es; + } + InvalidateRect(GetDlgItem(hwndDlg, IDC_FONTLIST), NULL, TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_UNDO), TRUE); + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); } - InvalidateRect(GetDlgItem(hwndDlg, IDC_FONTLIST), NULL, TRUE); - EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_UNDO), TRUE); - SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); - } - mir_free(selItems); + mir_free(selItems); + } + break; } - break; - } case IDC_FONTCOLOUR: - { - int selCount, i; - if (selCount = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELCOUNT, 0, 0)) { - int *selItems = (int *)mir_alloc(selCount * sizeof(int)); - SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELITEMS, (WPARAM)selCount, (LPARAM) selItems); - for (i = 0; i < selCount; i++) { - FSUIListItemData *itemData = (FSUIListItemData *)SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[i], 0); - if (itemData->font_id < 0) continue; - font_id_list_w2[itemData->font_id].value.colour = SendDlgItemMessage(hwndDlg, IDC_FONTCOLOUR, CPM_GETCOLOUR, 0, 0); + { + int selCount, i; + if (selCount = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELCOUNT, 0, 0)) { + int *selItems = (int *)mir_alloc(selCount * sizeof(int)); + SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELITEMS, (WPARAM)selCount, (LPARAM) selItems); + for (i = 0; i < selCount; i++) { + FSUIListItemData *itemData = (FSUIListItemData *)SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[i], 0); + if (itemData->font_id < 0) continue; + font_id_list_w2[itemData->font_id].value.colour = SendDlgItemMessage(hwndDlg, IDC_FONTCOLOUR, CPM_GETCOLOUR, 0, 0); + } + mir_free(selItems); + InvalidateRect(GetDlgItem(hwndDlg, IDC_FONTLIST), NULL, FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_UNDO), TRUE); } - mir_free(selItems); - InvalidateRect(GetDlgItem(hwndDlg, IDC_FONTLIST), NULL, FALSE); - EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_UNDO), TRUE); + break; } - break; - } case IDC_BKGCOLOUR: - { - int selCount, i; - if (selCount = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELCOUNT, 0, 0)) { - int *selItems = (int *)mir_alloc(selCount * sizeof(int)); - SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELITEMS, (WPARAM)selCount, (LPARAM) selItems); - for (i = 0; i < selCount; i++) { - FSUIListItemData *itemData = (FSUIListItemData *)SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[i], 0); - if (itemData->colour_id < 0) continue; - colour_id_list_w2[itemData->colour_id].value = SendDlgItemMessage(hwndDlg, IDC_BKGCOLOUR, CPM_GETCOLOUR, 0, 0); - - if (_tcscmp(colour_id_list_w2[itemData->colour_id].name, _T("Background")) == 0) - { - if (hBkgColourBrush) DeleteObject(hBkgColourBrush); - hBkgColourBrush = CreateSolidBrush(colour_id_list_w2[itemData->colour_id].value); + { + int selCount, i; + if (selCount = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELCOUNT, 0, 0)) { + int *selItems = (int *)mir_alloc(selCount * sizeof(int)); + SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELITEMS, (WPARAM)selCount, (LPARAM) selItems); + for (i = 0; i < selCount; i++) { + FSUIListItemData *itemData = (FSUIListItemData *)SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[i], 0); + if (itemData->colour_id < 0) continue; + colour_id_list_w2[itemData->colour_id].value = SendDlgItemMessage(hwndDlg, IDC_BKGCOLOUR, CPM_GETCOLOUR, 0, 0); + + if (_tcscmp(colour_id_list_w2[itemData->colour_id].name, _T("Background")) == 0) + { + if (hBkgColourBrush) DeleteObject(hBkgColourBrush); + hBkgColourBrush = CreateSolidBrush(colour_id_list_w2[itemData->colour_id].value); + } } + mir_free(selItems); + InvalidateRect(GetDlgItem(hwndDlg, IDC_FONTLIST), NULL, FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_UNDO), TRUE); } - mir_free(selItems); - InvalidateRect(GetDlgItem(hwndDlg, IDC_FONTLIST), NULL, FALSE); - EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_UNDO), TRUE); + break; } - break; - } case IDC_BTN_RESET: - { - int selCount; - if (font_id_list_w2.getCount() && (selCount = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELCOUNT, (WPARAM)0, (LPARAM)0))) { - int *selItems = (int *)mir_alloc(font_id_list_w2.getCount() * sizeof(int)); - SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELITEMS, (WPARAM)selCount, (LPARAM)selItems); - for (i = 0; i < selCount; ++i) { - FSUIListItemData *itemData = (FSUIListItemData *)SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[i], 0); - if (IsBadReadPtr(itemData, sizeof(FSUIListItemData))) continue; // prevent possible problems with corrupted itemData - - if ((itemData->font_id >= 0) && (font_id_list_w2[itemData->font_id].flags & FIDF_DEFAULTVALID)) { - font_id_list_w2[itemData->font_id].value = font_id_list_w2[itemData->font_id].deffontsettings; - - MEASUREITEMSTRUCT mis = { 0 }; - mis.CtlID = IDC_FONTLIST; - mis.itemID = selItems[i]; - mis.itemData = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[i], 0); - SendMessage(hwndDlg, WM_MEASUREITEM, 0, (LPARAM) & mis); - SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_SETITEMHEIGHT, selItems[i], mis.itemHeight); - } + { + int selCount; + if (font_id_list_w2.getCount() && (selCount = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELCOUNT, (WPARAM)0, (LPARAM)0))) { + int *selItems = (int *)mir_alloc(font_id_list_w2.getCount() * sizeof(int)); + SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELITEMS, (WPARAM)selCount, (LPARAM)selItems); + for (i = 0; i < selCount; ++i) { + FSUIListItemData *itemData = (FSUIListItemData *)SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[i], 0); + if (IsBadReadPtr(itemData, sizeof(FSUIListItemData))) continue; // prevent possible problems with corrupted itemData + + if ((itemData->font_id >= 0) && (font_id_list_w2[itemData->font_id].flags & FIDF_DEFAULTVALID)) { + font_id_list_w2[itemData->font_id].value = font_id_list_w2[itemData->font_id].deffontsettings; - if (itemData->colour_id >= 0) - colour_id_list_w2[itemData->colour_id].value = colour_id_list_w2[itemData->colour_id].defcolour; + MEASUREITEMSTRUCT mis = { 0 }; + mis.CtlID = IDC_FONTLIST; + mis.itemID = selItems[i]; + mis.itemData = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[i], 0); + SendMessage(hwndDlg, WM_MEASUREITEM, 0, (LPARAM) & mis); + SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_SETITEMHEIGHT, selItems[i], mis.itemHeight); + } - if (itemData->effect_id >= 0) - effect_id_list_w2[itemData->effect_id].value = effect_id_list_w2[itemData->effect_id].defeffect; + if (itemData->colour_id >= 0) + colour_id_list_w2[itemData->colour_id].value = colour_id_list_w2[itemData->colour_id].defcolour; + if (itemData->effect_id >= 0) + effect_id_list_w2[itemData->effect_id].value = effect_id_list_w2[itemData->effect_id].defeffect; + + } + mir_free(selItems); + InvalidateRect(GetDlgItem(hwndDlg, IDC_FONTLIST), NULL, TRUE); + SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_FONTLIST, LBN_SELCHANGE), 0); + EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_UNDO), TRUE); } - mir_free(selItems); - InvalidateRect(GetDlgItem(hwndDlg, IDC_FONTLIST), NULL, TRUE); - SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_FONTLIST, LBN_SELCHANGE), 0); - EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_UNDO), TRUE); + break; } - break; - } case IDC_BTN_EXPORT: - { - TCHAR fname_buff[MAX_PATH], filter[MAX_PATH]; - mir_sntprintf(filter, SIZEOF(filter), _T("%s (*.ini)%c*.ini%c%s (*.txt)%c*.TXT%c%s (*.*)%c*.*%c"), TranslateT("Configuration Files"), 0, 0, TranslateT("Text Files"), 0, 0, TranslateT("All Files"), 0, 0); - - OPENFILENAME ofn = {0}; - ofn.lStructSize = sizeof(ofn); - ofn.lpstrFile = fname_buff; - ofn.lpstrFile[0] = '\0'; - ofn.nMaxFile = MAX_PATH; - ofn.hwndOwner = hwndDlg; - ofn.Flags = OFN_NOREADONLYRETURN | OFN_CREATEPROMPT | OFN_OVERWRITEPROMPT; - ofn.lpstrFilter = filter; - ofn.nFilterIndex = 1; - - ofn.lpstrDefExt = _T("ini"); - - if (GetSaveFileName(&ofn) == TRUE) - if ( !ExportSettings(hwndDlg, ofn.lpstrFile, font_id_list, colour_id_list, effect_id_list)) - MessageBox(hwndDlg, TranslateT("Error writing file"), TranslateT("Error"), MB_ICONWARNING | MB_OK); - return TRUE; - } + { + TCHAR fname_buff[MAX_PATH], filter[MAX_PATH]; + mir_sntprintf(filter, SIZEOF(filter), _T("%s (*.ini)%c*.ini%c%s (*.txt)%c*.TXT%c%s (*.*)%c*.*%c"), TranslateT("Configuration Files"), 0, 0, TranslateT("Text Files"), 0, 0, TranslateT("All Files"), 0, 0); + + OPENFILENAME ofn = {0}; + ofn.lStructSize = sizeof(ofn); + ofn.lpstrFile = fname_buff; + ofn.lpstrFile[0] = '\0'; + ofn.nMaxFile = MAX_PATH; + ofn.hwndOwner = hwndDlg; + ofn.Flags = OFN_NOREADONLYRETURN | OFN_CREATEPROMPT | OFN_OVERWRITEPROMPT; + ofn.lpstrFilter = filter; + ofn.nFilterIndex = 1; + + ofn.lpstrDefExt = _T("ini"); + + if (GetSaveFileName(&ofn) == TRUE) + if ( !ExportSettings(hwndDlg, ofn.lpstrFile, font_id_list, colour_id_list, effect_id_list)) + MessageBox(hwndDlg, TranslateT("Error writing file"), TranslateT("Error"), MB_ICONWARNING | MB_OK); + return TRUE; + } case IDC_BTN_UNDO: font_id_list_w2 = font_id_list_w3; colour_id_list_w2 = colour_id_list_w3; - effect_id_list_w2 = effect_id_list_w3; + effect_id_list_w2 = effect_id_list_w3; EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_UNDO), FALSE); SendMessage(hwndDlg, UM_SETFONTGROUP, 0, 0); @@ -1212,28 +1204,28 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, font_id_list_w3 = font_id_list; colour_id_list_w3 = colour_id_list; - effect_id_list_w3 = effect_id_list; + effect_id_list_w3 = effect_id_list; EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_UNDO), TRUE); font_id_list = font_id_list_w2; colour_id_list = colour_id_list_w2; - effect_id_list = effect_id_list_w2; + effect_id_list = effect_id_list_w2; for (i=0; i < font_id_list_w2.getCount(); i++) { - TFontID& F = font_id_list_w2[i]; + FontInternal& F = font_id_list_w2[i]; sttSaveFontData(hwndDlg, F); } for (i=0; i < colour_id_list_w2.getCount(); i++) { - TColourID& C = colour_id_list_w2[i]; + ColourInternal& C = colour_id_list_w2[i]; mir_snprintf(str, SIZEOF(str), "%s", C.setting); DBWriteContactSettingDword(NULL, C.dbSettingsGroup, str, C.value); } for (i=0; i < effect_id_list_w2.getCount(); i++) { - TEffectID& E = effect_id_list_w2[i]; + EffectInternal& E = effect_id_list_w2[i]; mir_snprintf(str, SIZEOF(str), "%sEffect", E.setting); DBWriteContactSettingByte(NULL, E.dbSettingsGroup, str, E.value.effectIndex); @@ -1279,8 +1271,8 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, font_id_list_w3.destroy(); colour_id_list_w2.destroy(); colour_id_list_w3.destroy(); - effect_id_list_w2.destroy(); - effect_id_list_w3.destroy(); + effect_id_list_w2.destroy(); + effect_id_list_w3.destroy(); sttFreeListItems(GetDlgItem(hwndDlg, IDC_FONTLIST)); break; } @@ -1304,11 +1296,11 @@ int OptInit(WPARAM wParam, LPARAM) ///////////////////////////////////////////////////////////////////////////////////////// -static TFontID *sttFindFont(OBJLIST &fonts, char *module, char *prefix) +static FontInternal *sttFindFont(OBJLIST &fonts, char *module, char *prefix) { for (int i = 0; i < fonts.getCount(); i++) { - TFontID& F = fonts[i]; + FontInternal& F = fonts[i]; if ( !lstrcmpA(F.dbSettingsGroup, module) && !lstrcmpA(F.prefix, prefix)) return &F; } @@ -1316,31 +1308,28 @@ static TFontID *sttFindFont(OBJLIST &fonts, char *module, char *prefix) return 0; } +static FontInternal fntHeader, fntGeneral, fntSmall; + static INT_PTR CALLBACK DlgProcModernOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { int i; LOGFONT lf; - static TFontID fntHeader={0}, fntGeneral={0}, fntSmall={0}; - switch (msg) { - case WM_INITDIALOG: - { - TranslateDialogDefault(hwndDlg); - - fntHeader = *sttFindFont(font_id_list, "Fonts", "Header"); - UpdateFontSettings(&fntHeader, &fntHeader.value); - fntGeneral = *sttFindFont(font_id_list, "Fonts", "Generic"); - UpdateFontSettings(&fntGeneral, &fntGeneral.value); - fntSmall = *sttFindFont(font_id_list, "Fonts", "Small"); - UpdateFontSettings(&fntSmall, &fntSmall.value); + case WM_INITDIALOG: + TranslateDialogDefault(hwndDlg); - return TRUE; - } + fntHeader = *sttFindFont(font_id_list, "Fonts", "Header"); + UpdateFontSettings(&fntHeader, &fntHeader.value); + fntGeneral = *sttFindFont(font_id_list, "Fonts", "Generic"); + UpdateFontSettings(&fntGeneral, &fntGeneral.value); + fntSmall = *sttFindFont(font_id_list, "Fonts", "Small"); + UpdateFontSettings(&fntSmall, &fntSmall.value); + return TRUE; - case WM_DRAWITEM: + case WM_DRAWITEM: { - TFontID *pf = 0; + FontInternal *pf = 0; DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *) lParam; switch (dis->CtlID) { @@ -1355,7 +1344,8 @@ static INT_PTR CALLBACK DlgProcModernOptions(HWND hwndDlg, UINT msg, WPARAM wPar break; } - if ( !pf) break; + if ( !pf) + break; HFONT hFont = NULL, hoFont = NULL; COLORREF clText = GetSysColor(COLOR_WINDOWTEXT); @@ -1366,20 +1356,20 @@ static INT_PTR CALLBACK DlgProcModernOptions(HWND hwndDlg, UINT msg, WPARAM wPar SetTextColor(dis->hDC, GetSysColor(COLOR_BTNTEXT)); FillRect(dis->hDC, &dis->rcItem, GetSysColorBrush(COLOR_BTNFACE)); DrawText(dis->hDC, TranslateT("Sample Text"), (int)_tcslen(TranslateT("Sample Text")), &dis->rcItem, DT_LEFT|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER|DT_WORD_ELLIPSIS|DT_CENTER); - if (hoFont) SelectObject(dis->hDC, hoFont); + if (hoFont) + SelectObject(dis->hDC, hoFont); return TRUE; } - case WM_COMMAND: - switch (LOWORD(wParam)) { - case IDC_CHOOSEFONTHEADER: - case IDC_CHOOSEFONTGENERAL: - case IDC_CHOOSEFONTSMALL: + case WM_COMMAND: + switch (LOWORD(wParam)) { + case IDC_CHOOSEFONTHEADER: + case IDC_CHOOSEFONTGENERAL: + case IDC_CHOOSEFONTSMALL: { CHOOSEFONT cf = { 0 }; - TFontID *pf = NULL; - switch (LOWORD(wParam)) - { + FontInternal *pf = NULL; + switch (LOWORD(wParam)) { case IDC_CHOOSEFONTHEADER: pf = &fntHeader; break; @@ -1397,8 +1387,7 @@ static INT_PTR CALLBACK DlgProcModernOptions(HWND hwndDlg, UINT msg, WPARAM wPar cf.hwndOwner = hwndDlg; cf.lpLogFont = &lf; cf.Flags = CF_FORCEFONTEXIST | CF_INITTOLOGFONTSTRUCT | CF_SCREENFONTS; - if (pf->flags & FIDF_ALLOWEFFECTS) - { + if (pf->flags & FIDF_ALLOWEFFECTS) { cf.Flags |= CF_EFFECTS | CF_ENABLETEMPLATE | CF_ENABLEHOOK; // use custom font dialog to disable colour selection cf.hInstance = hMirandaInst; @@ -1406,8 +1395,7 @@ static INT_PTR CALLBACK DlgProcModernOptions(HWND hwndDlg, UINT msg, WPARAM wPar cf.lpfnHook = CFHookProc; } - if (ChooseFont(&cf)) - { + if (ChooseFont(&cf)) { pf->value.size = (char)lf.lfHeight; pf->value.style = (lf.lfWeight >= FW_BOLD ? DBFONTF_BOLD : 0) | (lf.lfItalic ? DBFONTF_ITALIC : 0) | (lf.lfUnderline ? DBFONTF_UNDERLINE : 0) | (lf.lfStrikeOut ? DBFONTF_STRIKEOUT : 0); pf->value.charset = lf.lfCharSet; @@ -1420,41 +1408,31 @@ static INT_PTR CALLBACK DlgProcModernOptions(HWND hwndDlg, UINT msg, WPARAM wPar } return TRUE; } - } - break; + } + break; - case WM_NOTIFY: - if (((LPNMHDR) lParam)->idFrom == 0 && ((LPNMHDR) lParam)->code == PSN_APPLY) { - for (i=0; i < font_id_list.getCount(); i++) - { - TFontID &F = font_id_list[i]; - if (F.deffontsettings.charset == SYMBOL_CHARSET) continue; - - COLORREF cl = F.value.colour; - if ((F.flags&FIDF_CLASSMASK) == FIDF_CLASSHEADER || - (F.flags&FIDF_CLASSMASK) == 0 && - (_tcsstr(F.name, _T("Incoming nick")) || - _tcsstr(F.name, _T("Outgoing nick")) || - _tcsstr(F.name, _T("Incoming timestamp")) || - _tcsstr(F.name, _T("Outgoing timestamp"))) - ) - { - F.value = fntHeader.value; - } else + case WM_NOTIFY: + if (((LPNMHDR) lParam)->idFrom == 0 && ((LPNMHDR) lParam)->code == PSN_APPLY) { + for (i=0; i < font_id_list.getCount(); i++) { + FontInternal &F = font_id_list[i]; + if (F.deffontsettings.charset == SYMBOL_CHARSET) continue; + + COLORREF cl = F.value.colour; + if ( F.isHeader()) + F.value = fntHeader.value; + else if ((F.flags&FIDF_CLASSMASK) == FIDF_CLASSSMALL) - { F.value = fntSmall.value; - } else - { + else F.value = fntGeneral.value; - } + F.value.colour = cl; sttSaveFontData(hwndDlg, F); - } - - OptionsChanged(); } - break; + + OptionsChanged(); + } + break; } return FALSE; } diff --git a/src/modules/fonts/FontService.cpp b/src/modules/fonts/FontService.cpp index cfa6477473..32285c9157 100644 --- a/src/modules/fonts/FontService.cpp +++ b/src/modules/fonts/FontService.cpp @@ -69,50 +69,42 @@ int LoadFontserviceModule(void) { code_page = LangPackGetDefaultCodePage(); - CreateServiceFunction(MS_FONT_REGISTER, RegisterFont); + CreateServiceFunction("Font/Register", RegisterFont); + CreateServiceFunction("Font/RegisterW", RegisterFontW); CreateServiceFunction(MS_FONT_GET, GetFont); - - CreateServiceFunction(MS_COLOUR_REGISTER, RegisterColour); - CreateServiceFunction(MS_COLOUR_GET, GetColour); - - CreateServiceFunction(MS_EFFECT_REGISTER, RegisterEffect); - CreateServiceFunction(MS_EFFECT_GET, GetEffect); - - CreateServiceFunction(MS_FONT_REGISTERW, RegisterFontW); CreateServiceFunction(MS_FONT_GETW, GetFontW); - CreateServiceFunction(MS_COLOUR_REGISTERW, RegisterColourW); + CreateServiceFunction("Colour/Register", RegisterColour); + CreateServiceFunction("Colour/RegisterW", RegisterColourW); + CreateServiceFunction(MS_COLOUR_GET, GetColour); CreateServiceFunction(MS_COLOUR_GETW, GetColourW); - CreateServiceFunction(MS_EFFECT_REGISTERW, RegisterEffectW); + CreateServiceFunction("Effect/Register", RegisterEffect); + CreateServiceFunction("Effect/Register", RegisterEffectW); + CreateServiceFunction(MS_EFFECT_GET, GetEffect); CreateServiceFunction(MS_EFFECT_GETW, GetEffectW); hFontReloadEvent = CreateHookableEvent(ME_FONT_RELOAD); hColourReloadEvent = CreateHookableEvent(ME_COLOUR_RELOAD); // create generic fonts - FontIDT fontid = {0}; - - fontid.cbSize = sizeof(FontID); + FontIDT fontid = { sizeof(fontid) }; strncpy(fontid.dbSettingsGroup, "Fonts", sizeof(fontid.dbSettingsGroup)); _tcsncpy(fontid.group, _T("General"), SIZEOF(fontid.group)); _tcsncpy(fontid.name, _T("Headers"), SIZEOF(fontid.name)); fontid.flags = FIDF_APPENDNAME | FIDF_NOAS | FIDF_SAVEPOINTSIZE | FIDF_ALLOWEFFECTS | FIDF_CLASSHEADER; strncpy(fontid.prefix, "Header", SIZEOF(fontid.prefix)); - fontid.order = 0; FontRegisterT(&fontid); _tcsncpy(fontid.name, _T("Generic text"), SIZEOF(fontid.name)); fontid.flags = FIDF_APPENDNAME | FIDF_NOAS | FIDF_SAVEPOINTSIZE | FIDF_ALLOWEFFECTS | FIDF_CLASSGENERAL; strncpy(fontid.prefix, "Generic", SIZEOF(fontid.prefix)); - fontid.order = 0; FontRegisterT(&fontid); _tcsncpy(fontid.name, _T("Small text"), SIZEOF(fontid.name)); fontid.flags = FIDF_APPENDNAME | FIDF_NOAS | FIDF_SAVEPOINTSIZE | FIDF_ALLOWEFFECTS | FIDF_CLASSSMALL; strncpy(fontid.prefix, "Small", SIZEOF(fontid.prefix)); - fontid.order = 0; FontRegisterT(&fontid); // do last for silly dyna plugin diff --git a/src/modules/fonts/FontService.h b/src/modules/fonts/FontService.h index 92e62ba9df..8042d668bf 100644 --- a/src/modules/fonts/FontService.h +++ b/src/modules/fonts/FontService.h @@ -23,73 +23,40 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "m_fontservice.h" +// a font identifier structure - used for registering a font, and getting one out again -// settings to be used for the value of 'deffontsettings' in the FontID structure below - i.e. defaults -typedef struct TFontSettings_tag +struct FontInternal : public FontIDT { - COLORREF colour; - char size; - BYTE style; // see the DBFONTF_* flags above - BYTE charset; - TCHAR szFace[LF_FACESIZE]; -} - TFontSettings; + FontSettingsT value; + int hLangpack; -// a font identifier structure - used for registering a font, and getting one out again + __inline TCHAR* getName() const { return LangPackTranslateStringT(hLangpack, name); } -struct TFontID -{ - int cbSize; - TCHAR group[64]; // group the font belongs to - this is the 'Font Group' list in the options page - TCHAR name[64]; // this is the name of the font setting - e.g. 'contacts' in the 'contact list' group - char dbSettingsGroup[32]; // the 'module' in the database where the font data is stored - char prefix[32]; // this is prepended to the settings used to store this font's data in the db - DWORD flags; // bitwise OR of the FIDF_* flags above - TFontSettings deffontsettings; // defaults, valid if flags & FIDF_DEFAULTVALID - int order; // controls the order in the font group in which the fonts are listed in the UI (if order fields are equal, - // they will be ordered alphabetically by name) - TCHAR backgroundGroup[64]; - TCHAR backgroundName[64]; - TFontSettings value; + __inline bool isHeader() const + { + if ((flags & FIDF_CLASSMASK) == FIDF_CLASSHEADER) + return true; + + if ((flags & FIDF_CLASSMASK) == 0) + if (_tcsstr(name, _T("Incoming nick")) || _tcsstr(name, _T("Outgoing nick")) || _tcsstr(name, _T("Incoming timestamp")) || _tcsstr(name, _T("Outgoing timestamp"))) + return true; + return false; + } }; -struct TColourID +struct ColourInternal : public ColourIDT { - int cbSize; - TCHAR group[64]; - TCHAR name[64]; - char dbSettingsGroup[32]; - char setting[32]; - DWORD flags; - COLORREF defcolour; - int order; + __inline TCHAR* getName() const { return LangPackTranslateStringT(hLangpack, name); } COLORREF value; + int hLangpack; }; -// clist_modern related tune-up, adding clist_modern effects to FontService - -typedef struct TEffectSettings_tag +struct EffectInternal : public EffectIDT { - BYTE effectIndex; - DWORD baseColour; // ARGB - DWORD secondaryColour; // ARGB -} -TEffectSettings; + __inline TCHAR* getName() const { return LangPackTranslateStringT(hLangpack, name); } - -struct TEffectID -{ - int cbSize; - TCHAR group[64]; - TCHAR name[64]; - char dbSettingsGroup[32]; - char setting[32]; - DWORD flags; - TEffectSettings defeffect; - int order; - - TEffectSettings value; + int hLangpack; }; ///////////////////////////////////////////////////////////////////////////////////////// @@ -102,11 +69,11 @@ typedef struct } TreeItem; -extern OBJLIST font_id_list; -extern OBJLIST colour_id_list; -extern OBJLIST effect_id_list; +extern OBJLIST font_id_list; +extern OBJLIST colour_id_list; +extern OBJLIST effect_id_list; extern int code_page; extern HANDLE hFontReloadEvent, hColourReloadEvent; -int CreateFromFontSettings(TFontSettings *fs, LOGFONT *lf); +int CreateFromFontSettings(FontSettingsT *fs, LOGFONT *lf); diff --git a/src/modules/fonts/services.cpp b/src/modules/fonts/services.cpp index 3e69a5fe9f..e0b145a350 100644 --- a/src/modules/fonts/services.cpp +++ b/src/modules/fonts/services.cpp @@ -2,7 +2,7 @@ Miranda IM: the free IM client for Microsoft* Windows* -Copyright 2000-2009 Miranda ICQ/IM project, +Copyright 2000-2009 Miranda ICQ/IM project, all portions of this codebase are copyrighted to the people listed in contributors.txt. @@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. -This program is distributed in the hope that it will be useful, +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -26,8 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. COLORREF GetColorFromDefault(COLORREF cl); - -void ConvertFontSettings(FontSettings* fs, TFontSettings* fsw) +void ConvertFontSettings(FontSettings* fs, FontSettingsW* fsw) { fsw->colour = fs->colour; fsw->size = fs->size; @@ -37,10 +36,13 @@ void ConvertFontSettings(FontSettings* fs, TFontSettings* fsw) MultiByteToWideChar(code_page, 0, fs->szFace, -1, fsw->szFace, LF_FACESIZE); } -void ConvertFontID(FontID *fid, TFontID* fidw) +bool ConvertFontID(FontID *fid, FontIDW* fidw) { - memset(fidw, 0, sizeof(TFontID)); - fidw->cbSize = sizeof(TFontID); + if (fid->cbSize != sizeof(FontID)) + return false; + + memset(fidw, 0, sizeof(FontIDW)); + fidw->cbSize = sizeof(FontIDW); strcpy(fidw->dbSettingsGroup, fid->dbSettingsGroup); strcpy(fidw->prefix, fid->prefix); fidw->flags = fid->flags; @@ -49,15 +51,17 @@ void ConvertFontID(FontID *fid, TFontID* fidw) MultiByteToWideChar(code_page, 0, fid->group, -1, fidw->group, 64); MultiByteToWideChar(code_page, 0, fid->name, -1, fidw->name, 64); - if (fid->cbSize >= FontID_SIZEOF_V2A) { - MultiByteToWideChar(code_page, 0, fid->backgroundGroup, -1, fidw->backgroundGroup, 64); - MultiByteToWideChar(code_page, 0, fid->backgroundName, -1, fidw->backgroundName, 64); - } + MultiByteToWideChar(code_page, 0, fid->backgroundGroup, -1, fidw->backgroundGroup, 64); + MultiByteToWideChar(code_page, 0, fid->backgroundName, -1, fidw->backgroundName, 64); + return true; } -void ConvertColourID(ColourID *cid, TColourID* cidw) +bool ConvertColourID(ColourID *cid, ColourIDW* cidw) { - cidw->cbSize = sizeof(TColourID); + if (cid->cbSize != sizeof(ColourID)) + return false; + + cidw->cbSize = sizeof(ColourIDW); strcpy(cidw->dbSettingsGroup, cid->dbSettingsGroup); strcpy(cidw->setting, cid->setting); @@ -67,25 +71,29 @@ void ConvertColourID(ColourID *cid, TColourID* cidw) MultiByteToWideChar(code_page, 0, cid->group, -1, cidw->group, 64); MultiByteToWideChar(code_page, 0, cid->name, -1, cidw->name, 64); + return true; } -void ConvertEffectID(EffectID *eid, TEffectID* eidw) +bool ConvertEffectID(EffectID *eid, EffectIDW* eidw) { - eidw->cbSize = sizeof(TEffectID); - - strcpy(eidw->dbSettingsGroup, eid->dbSettingsGroup); - strcpy(eidw->setting, eid->setting); - eidw->flags = eid->flags; - eidw->defeffect.effectIndex = eid->defeffect.effectIndex; - eidw->defeffect.baseColour = eid->defeffect.baseColour; - eidw->defeffect.secondaryColour = eid->defeffect.secondaryColour; - eidw->order = eid->order; - - MultiByteToWideChar(code_page, 0, eid->group, -1, eidw->group, 64); - MultiByteToWideChar(code_page, 0, eid->name, -1, eidw->name, 64); + if (eid->cbSize != sizeof(EffectID)) + return false; + + eidw->cbSize = sizeof(EffectIDW); + + strcpy(eidw->dbSettingsGroup, eid->dbSettingsGroup); + strcpy(eidw->setting, eid->setting); + eidw->flags = eid->flags; + eidw->defeffect.effectIndex = eid->defeffect.effectIndex; + eidw->defeffect.baseColour = eid->defeffect.baseColour; + eidw->defeffect.secondaryColour = eid->defeffect.secondaryColour; + eidw->order = eid->order; + + MultiByteToWideChar(code_page, 0, eid->group, -1, eidw->group, 64); + MultiByteToWideChar(code_page, 0, eid->name, -1, eidw->name, 64); + return true; } - void ConvertLOGFONT(LOGFONTW *lfw, LOGFONTA *lfa) { lfa->lfHeight = lfw->lfHeight; @@ -112,7 +120,7 @@ static void GetDefaultFontSetting(LOGFONT* lf, COLORREF* colour) *colour = GetSysColor(COLOR_WINDOWTEXT); lf->lfHeight = 10; - + HDC hdc = GetDC(0); lf->lfHeight = -MulDiv(lf->lfHeight, GetDeviceCaps(hdc, LOGPIXELSY), 72); ReleaseDC(0, hdc); @@ -134,7 +142,7 @@ int GetFontSettingFromDB(char *settings_group, char *prefix, LOGFONT* lf, COLORR _tcscpy(lf->lfFaceName, dbv.ptszVal); DBFreeVariant(&dbv); } - else retval = 1; + else retval = 1; if (colour) { mir_snprintf(idstr, SIZEOF(idstr), "%sCol", prefix); @@ -153,7 +161,7 @@ int GetFontSettingFromDB(char *settings_group, char *prefix, LOGFONT* lf, COLORR //} mir_snprintf(idstr, SIZEOF(idstr), "%sSty", prefix); - style = (BYTE) DBGetContactSettingByte(NULL, settings_group, idstr, + style = (BYTE) DBGetContactSettingByte(NULL, settings_group, idstr, (lf->lfWeight == FW_NORMAL ? 0 : DBFONTF_BOLD) | (lf->lfItalic ? DBFONTF_ITALIC : 0) | (lf->lfUnderline ? DBFONTF_UNDERLINE : 0) | lf->lfStrikeOut ? DBFONTF_STRIKEOUT : 0); lf->lfWidth = lf->lfEscapement = lf->lfOrientation = 0; @@ -193,7 +201,7 @@ int GetFontSettingFromDB(char *settings_group, char *prefix, LOGFONT* lf, COLORR return retval; } -int CreateFromFontSettings(TFontSettings* fs, LOGFONT* lf) +int CreateFromFontSettings(FontSettingsT* fs, LOGFONT* lf) { GetDefaultFontSetting(lf, 0); @@ -214,7 +222,7 @@ int CreateFromFontSettings(TFontSettings* fs, LOGFONT* lf) return 0; } -void UpdateFontSettings(TFontID* font_id, TFontSettings* fontsettings) +void UpdateFontSettings(FontIDW* font_id, FontSettingsT* fontsettings) { LOGFONT lf; COLORREF colour; @@ -235,8 +243,8 @@ void UpdateFontSettings(TFontID* font_id, TFontSettings* fontsettings) static COLORREF sttMixColor(COLORREF cl1, COLORREF cl2, int q) { return RGB( - (GetRValue(cl1) * q + GetRValue(cl2) * (255 - q)) / 255, - (GetGValue(cl1) * q + GetGValue(cl2) * (255 - q)) / 255, + (GetRValue(cl1) * q + GetRValue(cl2) * (255 - q)) / 255, + (GetGValue(cl1) * q + GetGValue(cl2) * (255 - q)) / 255, (GetBValue(cl1) * q + GetBValue(cl2) * (255 - q)) / 255 ); } @@ -269,10 +277,13 @@ COLORREF GetColorFromDefault(COLORREF cl) ///////////////////////////////////////////////////////////////////////////////////////// // RegisterFont service -static int sttRegisterFontWorker(TFontID* font_id) +static int sttRegisterFontWorker(FontIDW* font_id, int hLangpack) { + if (font_id->cbSize != sizeof(FontIDW)) + return -1; + for (int i = 0; i < font_id_list.getCount(); i++) { - TFontID& F = font_id_list[i]; + FontInternal& F = font_id_list[i]; if ( !lstrcmp(F.group, font_id->group) && !lstrcmp(F.name, font_id->name) && !(F.flags & FIDF_ALLOWREREGISTER)) return 1; } @@ -280,13 +291,12 @@ static int sttRegisterFontWorker(TFontID* font_id) char idstr[256]; mir_snprintf(idstr, SIZEOF(idstr), "%sFlags", font_id->prefix); DBWriteContactSettingDword(0, font_id->dbSettingsGroup, idstr, font_id->flags); - { - TFontID* newItem = new TFontID; - memset(newItem, 0, sizeof(TFontID)); + { + FontInternal* newItem = new FontInternal; + memset(newItem, 0, sizeof(FontIDW)); memcpy(newItem, font_id, font_id->cbSize); - if ( !lstrcmp(newItem->deffontsettings.szFace, _T("MS Shell Dlg"))) - { + if ( !lstrcmp(newItem->deffontsettings.szFace, _T("MS Shell Dlg"))) { LOGFONT lf; SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(LOGFONT), &lf, FALSE); lstrcpyn(newItem->deffontsettings.szFace, lf.lfFaceName, SIZEOF(newItem->deffontsettings.szFace)); @@ -300,102 +310,103 @@ static int sttRegisterFontWorker(TFontID* font_id) return 0; } -INT_PTR RegisterFontW(WPARAM wParam, LPARAM) +INT_PTR RegisterFontW(WPARAM wParam, LPARAM lParam) { - return sttRegisterFontWorker((TFontID*)wParam); + return sttRegisterFontWorker((FontIDW*)wParam, (int)lParam); } -INT_PTR RegisterFont(WPARAM wParam, LPARAM) +INT_PTR RegisterFont(WPARAM wParam, LPARAM lParam) { - TFontID temp; - ConvertFontID((FontID*)wParam, &temp); - return sttRegisterFontWorker(&temp); + FontIDW temp; + if ( !ConvertFontID((FontID*)wParam, &temp)) return -1; + return sttRegisterFontWorker(&temp, (int)lParam); } ///////////////////////////////////////////////////////////////////////////////////////// // GetFont service -static int sttGetFontWorker(TFontID* font_id, LOGFONT* lf) +static INT_PTR sttGetFontWorker(FontIDW* font_id, LOGFONT* lf) { COLORREF colour; for (int i = 0; i < font_id_list.getCount(); i++) { - TFontID& F = font_id_list[i]; + FontInternal& F = font_id_list[i]; if ( !_tcsncmp(F.name, font_id->name, SIZEOF(F.name)) && !_tcsncmp(F.group, font_id->group, SIZEOF(F.group))) { if (GetFontSettingFromDB(F.dbSettingsGroup, F.prefix, lf, &colour, F.flags) && (F.flags & FIDF_DEFAULTVALID)) { CreateFromFontSettings(&F.deffontsettings, lf); colour = GetColorFromDefault(F.deffontsettings.colour); } - return (int)colour; + return colour; } } GetDefaultFontSetting(lf, &colour); - return (int)colour; + return colour; } INT_PTR GetFontW(WPARAM wParam, LPARAM lParam) { - return sttGetFontWorker((TFontID*)wParam, (LOGFONT*)lParam); + return sttGetFontWorker((FontIDW*)wParam, (LOGFONT*)lParam); } INT_PTR GetFont(WPARAM wParam, LPARAM lParam) { - TFontID temp; - LOGFONT lftemp; - ConvertFontID((FontID *)wParam, &temp); - { int ret = sttGetFontWorker(&temp, &lftemp); - ConvertLOGFONT(&lftemp, (LOGFONTA*)lParam); - return ret; - } + FontIDW temp; + LOGFONT lftemp; + if ( !ConvertFontID((FontID*)wParam, &temp)) return -1; + + int ret = sttGetFontWorker(&temp, &lftemp); + ConvertLOGFONT(&lftemp, (LOGFONTA*)lParam); + return ret; } ///////////////////////////////////////////////////////////////////////////////////////// // RegisterColour service -void UpdateColourSettings(TColourID* colour_id, COLORREF *colour) +void UpdateColourSettings(ColourIDW* colour_id, COLORREF *colour) { *colour = (COLORREF)DBGetContactSettingDword(NULL, colour_id->dbSettingsGroup, colour_id->setting, GetColorFromDefault(colour_id->defcolour)); } -static int sttRegisterColourWorker(TColourID* colour_id) +static INT_PTR sttRegisterColourWorker(ColourIDW* colour_id, int hLangpack) { + if (colour_id->cbSize != sizeof(ColourIDW)) + return -1; + for (int i = 0; i < colour_id_list.getCount(); i++) { - TColourID& C = colour_id_list[i]; + ColourInternal& C = colour_id_list[i]; if ( !_tcscmp(C.group, colour_id->group) && !_tcscmp(C.name, colour_id->name)) return 1; } - TColourID* newItem = new TColourID; - memcpy(newItem, colour_id, sizeof(TColourID)); + ColourInternal* newItem = new ColourInternal; + memcpy(newItem, colour_id, sizeof(ColourIDW)); UpdateColourSettings(colour_id, &newItem->value); colour_id_list.insert(newItem); return 0; } -INT_PTR RegisterColourW(WPARAM wParam, LPARAM) +INT_PTR RegisterColourW(WPARAM wParam, LPARAM lParam) { - return sttRegisterColourWorker((TColourID*)wParam); + return sttRegisterColourWorker((ColourIDW*)wParam, (int)lParam); } -INT_PTR RegisterColour(WPARAM wParam, LPARAM) +INT_PTR RegisterColour(WPARAM wParam, LPARAM lParam) { - TColourID temp; - ConvertColourID((ColourID*)wParam, &temp); - return sttRegisterColourWorker(&temp); + ColourIDW temp; + if ( !ConvertColourID((ColourID*)wParam, &temp)) return -1; + return sttRegisterColourWorker(&temp, (int)lParam); } ///////////////////////////////////////////////////////////////////////////////////////// // GetColour service -static int sttGetColourWorker(TColourID* colour_id) +static INT_PTR sttGetColourWorker(ColourIDW* colour_id) { - int i; - - for (i = 0; i < colour_id_list.getCount(); i++) { - TColourID& C = colour_id_list[i]; + for (int i = 0; i < colour_id_list.getCount(); i++) { + ColourInternal& C = colour_id_list[i]; if ( !_tcscmp(C.group, colour_id->group) && !_tcscmp(C.name, colour_id->name)) - return (int)DBGetContactSettingDword(NULL, C.dbSettingsGroup, C.setting, GetColorFromDefault(C.defcolour)); + return DBGetContactSettingDword(NULL, C.dbSettingsGroup, C.setting, GetColorFromDefault(C.defcolour)); } return -1; @@ -403,95 +414,94 @@ static int sttGetColourWorker(TColourID* colour_id) INT_PTR GetColourW(WPARAM wParam, LPARAM) { - return sttGetColourWorker((TColourID*)wParam); + return sttGetColourWorker((ColourIDW*)wParam); } INT_PTR GetColour(WPARAM wParam, LPARAM) { - TColourID temp; - ConvertColourID((ColourID*)wParam, &temp); + ColourIDW temp; + if ( !ConvertColourID((ColourID*)wParam, &temp)) return -1; return sttGetColourWorker(&temp); } - ////////////////////////////////////////////////////////////////////////// // Effects -void UpdateEffectSettings(TEffectID* effect_id, TEffectSettings* effectsettings) +void UpdateEffectSettings(EffectIDW* effect_id, FONTEFFECT* effectsettings) { - char str[256]; - - mir_snprintf(str, SIZEOF(str), "%sEffect", effect_id->setting); - effectsettings->effectIndex = DBGetContactSettingByte(NULL, effect_id->dbSettingsGroup, str, effect_id->defeffect.effectIndex); + char str[256]; - mir_snprintf(str, SIZEOF(str), "%sEffectCol1", effect_id->setting); - effectsettings->baseColour = DBGetContactSettingDword(NULL, effect_id->dbSettingsGroup, str, effect_id->defeffect.baseColour); + mir_snprintf(str, SIZEOF(str), "%sEffect", effect_id->setting); + effectsettings->effectIndex = DBGetContactSettingByte(NULL, effect_id->dbSettingsGroup, str, effect_id->defeffect.effectIndex); - mir_snprintf(str, SIZEOF(str), "%sEffectCol2", effect_id->setting); - effectsettings->secondaryColour = DBGetContactSettingDword(NULL, effect_id->dbSettingsGroup, str, effect_id->defeffect.secondaryColour); + mir_snprintf(str, SIZEOF(str), "%sEffectCol1", effect_id->setting); + effectsettings->baseColour = DBGetContactSettingDword(NULL, effect_id->dbSettingsGroup, str, effect_id->defeffect.baseColour); + mir_snprintf(str, SIZEOF(str), "%sEffectCol2", effect_id->setting); + effectsettings->secondaryColour = DBGetContactSettingDword(NULL, effect_id->dbSettingsGroup, str, effect_id->defeffect.secondaryColour); } ///////////////////////////////////////////////////////////////////////////////////////// // RegisterFont service -static int sttRegisterEffectWorker(TEffectID* effect_id) +static INT_PTR sttRegisterEffectWorker(EffectIDW* effect_id, int hLangpack) { - for (int i = 0; i < effect_id_list.getCount(); i++) { - TEffectID& E = effect_id_list[i]; - if ( !_tcscmp(E.group, effect_id->group) && !_tcscmp(E.name, effect_id->name)) - return 1; - } - - TEffectID* newItem = new TEffectID; - memcpy(newItem, effect_id, sizeof(TEffectID)); - UpdateEffectSettings(effect_id, &newItem->value); - effect_id_list.insert(newItem); - return 0; + if (effect_id->cbSize != sizeof(EffectIDW)) + return -1; + + for (int i = 0; i < effect_id_list.getCount(); i++) { + EffectInternal& E = effect_id_list[i]; + if ( !_tcscmp(E.group, effect_id->group) && !_tcscmp(E.name, effect_id->name)) + return 1; + } + + EffectInternal* newItem = new EffectInternal; + memcpy(newItem, effect_id, sizeof(EffectIDW)); + UpdateEffectSettings(effect_id, &newItem->value); + effect_id_list.insert(newItem); + return 0; } INT_PTR RegisterEffectW(WPARAM wParam, LPARAM lParam) { - return sttRegisterEffectWorker((TEffectID*)wParam); + return sttRegisterEffectWorker((EffectIDW*)wParam, (int)lParam); } INT_PTR RegisterEffect(WPARAM wParam, LPARAM lParam) { - TEffectID temp; - ConvertEffectID((EffectID*)wParam, &temp); - return sttRegisterEffectWorker(&temp); + EffectIDW temp; + if ( !ConvertEffectID((EffectID*)wParam, &temp)) return -1; + return sttRegisterEffectWorker(&temp, (int)lParam); } ///////////////////////////////////////////////////////////////////////////////////////// // GetEffect service -static int sttGetEffectWorker(TEffectID* effect_id, FONTEFFECT* effect) +static INT_PTR sttGetEffectWorker(EffectIDW* effect_id, FONTEFFECT* effect) { for (int i = 0; i < effect_id_list.getCount(); i++) { - TEffectID& E = effect_id_list[i]; - if ( !_tcsncmp(E.name, effect_id->name, SIZEOF(E.name)) && !_tcsncmp(E.group, effect_id->group, SIZEOF(E.group))) - { - TEffectSettings temp; + EffectInternal& E = effect_id_list[i]; + if ( !_tcsncmp(E.name, effect_id->name, SIZEOF(E.name)) && !_tcsncmp(E.group, effect_id->group, SIZEOF(E.group))) { + FONTEFFECT temp; UpdateEffectSettings(effect_id, &temp); effect->effectIndex = temp.effectIndex; effect->baseColour = temp.baseColour; effect->secondaryColour = temp.secondaryColour; + return TRUE; + } } - return (int) TRUE; - } } - - return (int)FALSE; + return FALSE; } INT_PTR GetEffectW(WPARAM wParam, LPARAM lParam) { - return sttGetEffectWorker((TEffectID*)wParam, (FONTEFFECT*)lParam); + return sttGetEffectWorker((EffectIDW*)wParam, (FONTEFFECT*)lParam); } INT_PTR GetEffect(WPARAM wParam, LPARAM lParam) { - TEffectID temp; - ConvertEffectID((EffectID *)wParam, &temp); - return sttGetEffectWorker(&temp, (FONTEFFECT*)lParam); + EffectIDW temp; + if ( !ConvertEffectID((EffectID*)wParam, &temp)) return -1; + return sttGetEffectWorker(&temp, (FONTEFFECT*)lParam); } -- cgit v1.2.3