summaryrefslogtreecommitdiff
path: root/plugins/Popup
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2016-10-03 16:48:12 +0000
committerGeorge Hazan <george.hazan@gmail.com>2016-10-03 16:48:12 +0000
commit0976190894d653d5062f8ef6befabf46218f2d24 (patch)
tree4a26f4baa9a535256d7220a0c04a698390cab4e5 /plugins/Popup
parent3c4ccf82586be6b22380df2bc35ae4770f91651f (diff)
- inlined helpers for fonts, colors & effects creation replaced with functions;
- services for getting fonts, colors & effects removed; - some memory corruptions removed git-svn-id: http://svn.miranda-ng.org/main/trunk@17347 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Popup')
-rw-r--r--plugins/Popup/src/font.cpp44
-rw-r--r--plugins/Popup/src/notifications.cpp19
-rw-r--r--plugins/Popup/src/services.cpp4
3 files changed, 22 insertions, 45 deletions
diff --git a/plugins/Popup/src/font.cpp b/plugins/Popup/src/font.cpp
index 2c62c2a504..4f11e52471 100644
--- a/plugins/Popup/src/font.cpp
+++ b/plugins/Popup/src/font.cpp
@@ -43,27 +43,27 @@ void InitFonts()
mir_snprintf(fid.prefix, PU_FNT_PREFIX, PU_FNT_NAME_TITLE);
fid.deffontsettings.style = DBFONTF_BOLD;
fid.deffontsettings.colour = RGB(0, 0, 0);
- FontRegisterW(&fid);
+ Font_RegisterW(&fid);
mir_wstrncpy(fid.name, _A2W(PU_FNT_NAME_CLOCK), _countof(fid.name));
mir_snprintf(fid.prefix, PU_FNT_PREFIX, PU_FNT_NAME_CLOCK);
- FontRegisterW(&fid);
+ Font_RegisterW(&fid);
mir_wstrncpy(fid.name, _A2W(PU_FNT_NAME_TEXT), _countof(fid.name));
mir_snprintf(fid.prefix, PU_FNT_PREFIX, PU_FNT_NAME_TEXT);
fid.deffontsettings.style = 0;
- FontRegisterW(&fid);
+ Font_RegisterW(&fid);
mir_wstrncpy(fid.name, _A2W(PU_FNT_NAME_ACTION), _countof(fid.name));
mir_snprintf(fid.prefix, PU_FNT_PREFIX, PU_FNT_NAME_ACTION);
fid.flags = FIDF_DEFAULTVALID | FIDF_ALLOWEFFECTS;
fid.deffontsettings.colour = RGB(0, 0, 255);
- FontRegisterW(&fid);
+ Font_RegisterW(&fid);
mir_wstrncpy(fid.name, _A2W(PU_FNT_NAME_HOVERED_ACTION), _countof(fid.name));
mir_snprintf(fid.prefix, PU_FNT_PREFIX, PU_FNT_NAME_HOVERED_ACTION);
fid.deffontsettings.style = DBFONTF_UNDERLINE;
- FontRegisterW(&fid);
+ Font_RegisterW(&fid);
ColourIDW cid = { 0 };
cid.cbSize = sizeof(ColourIDW);
@@ -73,12 +73,12 @@ void InitFonts()
mir_wstrncpy(cid.name, PU_COL_BACK_NAME, _countof(cid.name));
mir_strncpy(cid.setting, PU_COL_BACK_SETTING, _countof(cid.setting));
cid.defcolour = SETTING_BACKCOLOUR_DEFAULT;
- ColourRegisterW(&cid);
+ Colour_RegisterW(&cid);
mir_wstrncpy(cid.name, PU_COL_AVAT_NAME, _countof(cid.name));
mir_strncpy(cid.setting, PU_COL_AVAT_SETTING, _countof(cid.setting));
cid.defcolour = SETTING_TEXTCOLOUR_DEFAULT;
- ColourRegisterW(&cid);
+ Colour_RegisterW(&cid);
ReloadFonts();
}
@@ -93,39 +93,23 @@ void ReloadFonts()
if (fonts.actionHover) DeleteObject(fonts.actionHover);
LOGFONT lf = { 0 };
- FontIDW fid = { 0 };
- fid.cbSize = sizeof(FontIDW);
- mir_wstrncpy(fid.group, _A2W(PU_FNT_AND_COLOR), _countof(fid.name));
-
- mir_wstrncpy(fid.name, _A2W(PU_FNT_NAME_TITLE), _countof(fid.name));
- fonts.clTitle = (COLORREF)CallService(MS_FONT_GETW, (WPARAM)&fid, (LPARAM)&lf);
+ fonts.clTitle = Font_GetW(_A2W(PU_FNT_AND_COLOR), _A2W(PU_FNT_NAME_TITLE), &lf);
fonts.title = CreateFontIndirect(&lf);
- mir_wstrncpy(fid.name, _A2W(PU_FNT_NAME_CLOCK), _countof(fid.name));
- fonts.clClock = (COLORREF)CallService(MS_FONT_GETW, (WPARAM)&fid, (LPARAM)&lf);
+ fonts.clClock = Font_GetW(_A2W(PU_FNT_AND_COLOR), _A2W(PU_FNT_NAME_CLOCK), &lf);
fonts.clock = CreateFontIndirect(&lf);
- mir_wstrncpy(fid.name, _A2W(PU_FNT_NAME_TEXT), _countof(fid.name));
- fonts.clText = (COLORREF)CallService(MS_FONT_GETW, (WPARAM)&fid, (LPARAM)&lf);
+ fonts.clText = Font_GetW(_A2W(PU_FNT_AND_COLOR), _A2W(PU_FNT_NAME_TEXT), &lf);
fonts.text = CreateFontIndirect(&lf);
- mir_wstrncpy(fid.name, _A2W(PU_FNT_NAME_ACTION), _countof(fid.name));
- fonts.clAction = (COLORREF)CallService(MS_FONT_GETW, (WPARAM)&fid, (LPARAM)&lf);
+ fonts.clAction = Font_GetW(_A2W(PU_FNT_AND_COLOR), _A2W(PU_FNT_NAME_ACTION), &lf);
fonts.action = CreateFontIndirect(&lf);
- mir_wstrncpy(fid.name, _A2W(PU_FNT_NAME_HOVERED_ACTION), _countof(fid.name));
- fonts.clActionHover = (COLORREF)CallService(MS_FONT_GETW, (WPARAM)&fid, (LPARAM)&lf);
+ fonts.clActionHover = Font_GetW(_A2W(PU_FNT_AND_COLOR), _A2W(PU_FNT_NAME_HOVERED_ACTION), &lf);
fonts.actionHover = CreateFontIndirect(&lf);
- ColourIDW cid = { 0 };
- cid.cbSize = sizeof(ColourIDW);
- mir_wstrncpy(cid.group, _A2W(PU_FNT_AND_COLOR), _countof(cid.group));
- mir_wstrncpy(cid.name, PU_COL_BACK_NAME, _countof(cid.name));
- fonts.clBack = (COLORREF)CallService(MS_COLOUR_GETW, (WPARAM)&cid, (LPARAM)&lf);
-
- mir_wstrncpy(cid.group, _A2W(PU_FNT_AND_COLOR), _countof(cid.group));
- mir_wstrncpy(cid.name, PU_COL_AVAT_NAME, _countof(cid.name));
- fonts.clAvatarBorder = (COLORREF)CallService(MS_COLOUR_GETW, (WPARAM)&cid, (LPARAM)&lf);
+ fonts.clBack = Colour_GetW(_A2W(PU_FNT_AND_COLOR), PU_COL_BACK_NAME);
+ fonts.clAvatarBorder = Colour_GetW(_A2W(PU_FNT_AND_COLOR), PU_COL_AVAT_NAME);
// update class popupps(only temp at this point, must rework)
char setting[256];
diff --git a/plugins/Popup/src/notifications.cpp b/plugins/Popup/src/notifications.cpp
index ad176ca7ed..1c9759e201 100644
--- a/plugins/Popup/src/notifications.cpp
+++ b/plugins/Popup/src/notifications.cpp
@@ -196,7 +196,7 @@ HANDLE RegisterNotification(POPUPNOTIFICATION *notification)
mir_snprintf(fontid.name, "%s (colors only)", notification->lpzName);
mir_snprintf(fontid.prefix, "{%s/%s}text", notification->lpzGroup, notification->lpzName);
fontid.deffontsettings.style = 0;
- FontRegister(&fontid);
+ Font_Register(&fontid);
ColourID colourid = { 0 };
colourid.cbSize = sizeof(colourid);
@@ -205,7 +205,7 @@ HANDLE RegisterNotification(POPUPNOTIFICATION *notification)
mir_snprintf(colourid.name, "%s (colors only)", notification->lpzName);
mir_snprintf(colourid.setting, "{%s/%s}backColor", notification->lpzGroup, notification->lpzName);
colourid.defcolour = ptd->notification.colorBack;
- ColourRegister(&colourid);
+ Colour_Register(&colourid);
gTreeData.insert(ptd);
return (HANDLE)ptd;
@@ -234,17 +234,10 @@ void FillNotificationData(POPUPDATA2 *ppd, DWORD *disableWhen)
*disableWhen = ptd->enabled ? ptd->disableWhen : 0xFFFFFFFF;
LOGFONTA lf; // dummy to make FS happy (use LOGFONTA coz we use MS_FONT_GET)
- FontID fontid = { 0 }; // use ansi version of fontID coz POPUPNOTIFICATION use char
- fontid.cbSize = sizeof(fontid);
- mir_snprintf(fontid.group, PU_FNT_AND_COLOR"/%s", ptd->notification.lpzGroup);
- mir_snprintf(fontid.name, "%s (colors only)", ptd->notification.lpzName);
- ppd->colorText = (COLORREF)CallService(MS_FONT_GET, (WPARAM)&fontid, (LPARAM)&lf);
-
- ColourID colourid = { 0 }; // use ansi version of ColourID coz POPUPNOTIFICATION use char
- colourid.cbSize = sizeof(colourid);
- mir_snprintf(colourid.group, PU_FNT_AND_COLOR"/%s", ptd->notification.lpzGroup);
- mir_snprintf(colourid.name, "%s (colors only)", ptd->notification.lpzName);
- ppd->colorBack = (COLORREF)CallService(MS_COLOUR_GET, (WPARAM)&colourid, 0);
+ CMStringA szGroup(FORMAT, PU_FNT_AND_COLOR"/%s", ptd->notification.lpzGroup);
+ CMStringA szName(FORMAT, "%s (colors only)", ptd->notification.lpzName);
+ ppd->colorText = Font_Get(szGroup, szName, &lf);
+ ppd->colorBack = Colour_Get(szGroup, szName);
ppd->lchIcon = IcoLib_GetIconByHandle(ptd->hIcoLib);
}
diff --git a/plugins/Popup/src/services.cpp b/plugins/Popup/src/services.cpp
index dd0c44c6aa..767fa11096 100644
--- a/plugins/Popup/src/services.cpp
+++ b/plugins/Popup/src/services.cpp
@@ -392,7 +392,7 @@ INT_PTR Popup_RegisterPopupClass(WPARAM, LPARAM lParam)
mir_snprintf(fid.prefix, "%s/Text", ptd->pupClass.pszName); // result is "%s/TextCol"
fid.deffontsettings.style = 0;
fid.deffontsettings.colour = fonts.clText;
- FontRegisterW(&fid);
+ Font_RegisterW(&fid);
// we ignore pc->colorBack and use fonts.clBack as default (if no setting found in DB)
mir_snprintf(setting, "%s/BgCol", ptd->pupClass.pszName);
@@ -404,7 +404,7 @@ INT_PTR Popup_RegisterPopupClass(WPARAM, LPARAM lParam)
mir_wstrncpy(cid.name, PU_COL_BACK_NAME, _countof(cid.name));
mir_snprintf(cid.setting, "%s/BgCol", ptd->pupClass.pszName);
cid.defcolour = fonts.clBack;
- ColourRegisterW(&cid);
+ Colour_RegisterW(&cid);
gTreeData.insert(ptd);
num_classes++;