From a411a7391bb879db8da398f067245a13c7fa7aee Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 25 Jul 2018 23:10:36 +0300 Subject: major code cleaning of all font-related structures --- plugins/Popup/src/font.cpp | 16 +++++++--------- plugins/Popup/src/notifications.cpp | 8 +++----- plugins/Popup/src/services.cpp | 10 ++++------ 3 files changed, 14 insertions(+), 20 deletions(-) (limited to 'plugins/Popup/src') diff --git a/plugins/Popup/src/font.cpp b/plugins/Popup/src/font.cpp index 6570315168..b274615963 100644 --- a/plugins/Popup/src/font.cpp +++ b/plugins/Popup/src/font.cpp @@ -28,8 +28,7 @@ PopupFonts fonts = {}; void InitFonts() { // Fonts - FontIDW fid = { 0 }; - fid.cbSize = sizeof(FontIDW); + FontIDW fid = {}; mir_wstrncpy(fid.group, _A2W(PU_FNT_AND_COLOR), _countof(fid.group)); mir_strncpy(fid.dbSettingsGroup, PU_FNT_AND_COLOR_DB, _countof(fid.dbSettingsGroup)); fid.flags = FIDF_DEFAULTVALID; @@ -40,33 +39,32 @@ void InitFonts() mir_wstrncpy(fid.deffontsettings.szFace, L"Tahoma", _countof(fid.deffontsettings.szFace)); mir_wstrncpy(fid.name, _A2W(PU_FNT_NAME_TITLE), _countof(fid.name)); - mir_snprintf(fid.prefix, PU_FNT_PREFIX, PU_FNT_NAME_TITLE); + mir_snprintf(fid.setting, PU_FNT_PREFIX, PU_FNT_NAME_TITLE); fid.deffontsettings.style = DBFONTF_BOLD; fid.deffontsettings.colour = RGB(0, 0, 0); g_plugin.addFont(&fid); mir_wstrncpy(fid.name, _A2W(PU_FNT_NAME_CLOCK), _countof(fid.name)); - mir_snprintf(fid.prefix, PU_FNT_PREFIX, PU_FNT_NAME_CLOCK); + mir_snprintf(fid.setting, PU_FNT_PREFIX, PU_FNT_NAME_CLOCK); g_plugin.addFont(&fid); mir_wstrncpy(fid.name, _A2W(PU_FNT_NAME_TEXT), _countof(fid.name)); - mir_snprintf(fid.prefix, PU_FNT_PREFIX, PU_FNT_NAME_TEXT); + mir_snprintf(fid.setting, PU_FNT_PREFIX, PU_FNT_NAME_TEXT); fid.deffontsettings.style = 0; g_plugin.addFont(&fid); mir_wstrncpy(fid.name, _A2W(PU_FNT_NAME_ACTION), _countof(fid.name)); - mir_snprintf(fid.prefix, PU_FNT_PREFIX, PU_FNT_NAME_ACTION); + mir_snprintf(fid.setting, PU_FNT_PREFIX, PU_FNT_NAME_ACTION); fid.flags = FIDF_DEFAULTVALID | FIDF_ALLOWEFFECTS; fid.deffontsettings.colour = RGB(0, 0, 255); g_plugin.addFont(&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); + mir_snprintf(fid.setting, PU_FNT_PREFIX, PU_FNT_NAME_HOVERED_ACTION); fid.deffontsettings.style = DBFONTF_UNDERLINE; g_plugin.addFont(&fid); - ColourIDW cid = { 0 }; - cid.cbSize = sizeof(ColourIDW); + ColourIDW cid = {}; mir_wstrncpy(cid.group, _A2W(PU_FNT_AND_COLOR), _countof(cid.group)); mir_strncpy(cid.dbSettingsGroup, PU_FNT_AND_COLOR_DB, _countof(cid.dbSettingsGroup)); diff --git a/plugins/Popup/src/notifications.cpp b/plugins/Popup/src/notifications.cpp index 1e2d97e7bc..fdd18a93cc 100644 --- a/plugins/Popup/src/notifications.cpp +++ b/plugins/Popup/src/notifications.cpp @@ -183,8 +183,7 @@ HANDLE RegisterNotification(POPUPNOTIFICATION *notification) // ugly hack to make reset always possible SaveNotificationSettings(ptd, "PopupNotifications"); - FontID fontid = { 0 }; - fontid.cbSize = sizeof(fontid); + FontID fontid = {}; mir_snprintf(fontid.group, PU_FNT_AND_COLOR "/%s", notification->lpzGroup); mir_strcpy(fontid.dbSettingsGroup, "PopupNotifications"); fontid.flags = FIDF_DEFAULTVALID; @@ -194,12 +193,11 @@ HANDLE RegisterNotification(POPUPNOTIFICATION *notification) mir_strncpy(fontid.deffontsettings.szFace, "MS Shell Dlg", _countof(fontid.deffontsettings.szFace)); fontid.deffontsettings.style = 0; mir_snprintf(fontid.name, "%s (colors only)", notification->lpzName); - mir_snprintf(fontid.prefix, "{%s/%s}text", notification->lpzGroup, notification->lpzName); + mir_snprintf(fontid.setting, "{%s/%s}text", notification->lpzGroup, notification->lpzName); fontid.deffontsettings.style = 0; g_plugin.addFont(&fontid); - ColourID colourid = { 0 }; - colourid.cbSize = sizeof(colourid); + ColourID colourid = {}; mir_snprintf(colourid.group, PU_FNT_AND_COLOR"/%s", notification->lpzGroup); mir_strcpy(colourid.dbSettingsGroup, "PopupNotifications"); mir_snprintf(colourid.name, "%s (colors only)", notification->lpzName); diff --git a/plugins/Popup/src/services.cpp b/plugins/Popup/src/services.cpp index 960762e556..77ab39de01 100644 --- a/plugins/Popup/src/services.cpp +++ b/plugins/Popup/src/services.cpp @@ -381,8 +381,7 @@ INT_PTR Popup_RegisterPopupClass(WPARAM, LPARAM lParam) mir_snprintf(setting, "%s/TextCol", ptd->pupClass.pszName); ptd->pupClass.colorText = (COLORREF)db_get_dw(NULL, PU_MODULCLASS, setting, fonts.clText/*pc->colorText*/); - FontIDW fid = { 0 }; - fid.cbSize = sizeof(FontIDW); + FontIDW fid = {}; mir_snwprintf(fid.group, L"%S/%s", PU_FNT_AND_COLOR, ptd->pszDescription); strncpy_s(fid.dbSettingsGroup, PU_MODULCLASS, _TRUNCATE); fid.flags = FIDF_DEFAULTVALID; @@ -390,8 +389,8 @@ INT_PTR Popup_RegisterPopupClass(WPARAM, LPARAM lParam) fid.deffontsettings.size = -11; wcsncpy_s(fid.deffontsettings.szFace, L"Verdana", _TRUNCATE); wcsncpy_s(fid.name, _A2W(PU_FNT_NAME_TEXT), _TRUNCATE); - strncpy_s(fid.prefix, setting, _TRUNCATE); - mir_snprintf(fid.prefix, "%s/Text", ptd->pupClass.pszName); // result is "%s/TextCol" + strncpy_s(fid.setting, setting, _TRUNCATE); + mir_snprintf(fid.setting, "%s/Text", ptd->pupClass.pszName); // result is "%s/TextCol" fid.deffontsettings.style = 0; fid.deffontsettings.colour = fonts.clText; g_plugin.addFont(&fid); @@ -400,8 +399,7 @@ INT_PTR Popup_RegisterPopupClass(WPARAM, LPARAM lParam) mir_snprintf(setting, "%s/BgCol", ptd->pupClass.pszName); ptd->pupClass.colorBack = (COLORREF)db_get_dw(NULL, PU_MODULCLASS, setting, (DWORD)fonts.clBack/*pc->colorBack*/); - ColourIDW cid = { 0 }; - cid.cbSize = sizeof(ColourIDW); + ColourIDW cid = {}; mir_snwprintf(cid.group, L"%S/%s", PU_FNT_AND_COLOR, ptd->pszDescription); wcsncpy_s(cid.name, PU_COL_BACK_NAME, _TRUNCATE); strncpy_s(cid.dbSettingsGroup, PU_MODULCLASS, _TRUNCATE); -- cgit v1.2.3