From fe2d42bba1d2d2cf2e149f6f58fd0c0dfada30ab Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 27 Jun 2024 16:10:08 +0300 Subject: tabSRMM: 27 unused cached icons removed --- plugins/TabSRMM/src/globals.h | 17 ++++++++++++- plugins/TabSRMM/src/msgs.cpp | 55 ++++++++++++++++++++++------------------- plugins/TabSRMM/src/msgs.h | 13 ---------- plugins/TabSRMM/src/sidebar.cpp | 4 ++- 4 files changed, 48 insertions(+), 41 deletions(-) (limited to 'plugins/TabSRMM/src') diff --git a/plugins/TabSRMM/src/globals.h b/plugins/TabSRMM/src/globals.h index 59cfaba124..a50ba6b4c0 100644 --- a/plugins/TabSRMM/src/globals.h +++ b/plugins/TabSRMM/src/globals.h @@ -30,6 +30,21 @@ #ifndef __GLOBALS_H #define __GLOBALS_H +// icon defintions (index into g_buttonBarIcons) +#define ICON_BUTTON_ADD 0 +#define ICON_BUTTON_CANCEL 1 +#define ICON_BUTTON_SAVE 2 +#define ICON_BUTTON_SEND 3 + +#define ICON_DEFAULT_SOUNDS 4 +#define ICON_DEFAULT_PULLDOWN 5 +#define ICON_DEFAULT_LEFT 6 +#define ICON_DEFAULT_RIGHT 7 +#define ICON_DEFAULT_UP 8 +#define ICON_DEFAULT_TYPING 9 + +#define ICON_DEFAULT_MAX 10 + struct TSplitterBroadCast { TContainerData *pSrcContainer; CMsgDialog *pSrcDat; @@ -73,7 +88,7 @@ public: HICON g_IconMsgEvent, g_IconTypingEvent, g_IconFileEvent, g_IconSend; HICON g_IconMsgEventBig, g_IconTypingEventBig; HMENU g_hMenuContext, g_hMenuContainer; - HICON g_buttonBarIcons[37]; + HICON g_buttonBarIcons[ICON_DEFAULT_MAX]; // dynamic options, need reload when options change int m_iTabNameLimit; diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp index 1ffab3882e..a5b9216a9e 100644 --- a/plugins/TabSRMM/src/msgs.cpp +++ b/plugins/TabSRMM/src/msgs.cpp @@ -433,32 +433,32 @@ void TSAPI CreateImageList(bool bInitial) static TIconDesc _toolbaricons[] = { - { "tabSRMM_mlog", LPGEN("Message Log options"), &PluginConfig.g_buttonBarIcons[2], -IDI_MSGLOGOPT, 1 }, // 2 - { "tabSRMM_multi", LPGEN("Image tag"), &PluginConfig.g_buttonBarIcons[3], -IDI_IMAGETAG, 1 }, - { "tabSRMM_quote", LPGEN("Quote text"), &PluginConfig.g_buttonBarIcons[8], -IDI_QUOTE, 1 }, - { "tabSRMM_save", LPGEN("Save and close"), &PluginConfig.g_buttonBarIcons[7], -IDI_SAVE, 1 }, + { "tabSRMM_mlog", LPGEN("Message Log options"), 0, -IDI_MSGLOGOPT, 1 }, // 2 + { "tabSRMM_multi", LPGEN("Image tag"), 0, -IDI_IMAGETAG, 1 }, + { "tabSRMM_quote", LPGEN("Quote text"), 0, -IDI_QUOTE, 1 }, + { "tabSRMM_avatar", LPGEN("Edit user notes"), 0, -IDI_CONTACTPIC, 1 }, + { "tabSRMM_save", LPGEN("Save and close"), &PluginConfig.g_buttonBarIcons[ICON_BUTTON_SAVE], -IDI_SAVE, 1 }, { "tabSRMM_send", LPGEN("Send message"), &PluginConfig.g_buttonBarIcons[ICON_BUTTON_SEND], -IDI_SEND, 1 }, - { "tabSRMM_avatar", LPGEN("Edit user notes"), &PluginConfig.g_buttonBarIcons[10], -IDI_CONTACTPIC, 1 }, { "tabSRMM_close", LPGEN("Close"), &PluginConfig.g_buttonBarIcons[ICON_BUTTON_CANCEL], -IDI_CLOSEMSGDLG, 1 } }; static TIconDesc _exttoolbaricons[] = { - { "tabSRMM_emoticon", LPGEN("Smiley button"), &PluginConfig.g_buttonBarIcons[11], -IDI_SMILEYICON, 1 }, // 9 - { "tabSRMM_bold", LPGEN("Format bold"), &PluginConfig.g_buttonBarIcons[17], -IDI_FONTBOLD, 1 }, - { "tabSRMM_italic", LPGEN("Format italic"), &PluginConfig.g_buttonBarIcons[18], -IDI_FONTITALIC, 1 }, - { "tabSRMM_underline", LPGEN("Format underline"), &PluginConfig.g_buttonBarIcons[19], -IDI_FONTUNDERLINE, 1 }, - { "tabSRMM_face", LPGEN("Font face"), &PluginConfig.g_buttonBarIcons[20], -IDI_FONTFACE, 1 }, - { "tabSRMM_color", LPGEN("Font color"), &PluginConfig.g_buttonBarIcons[21], -IDI_FONTCOLOR, 1 }, - { "tabSRMM_strikeout", LPGEN("Format strike-through"), &PluginConfig.g_buttonBarIcons[30], -IDI_STRIKEOUT, 1 } + { "tabSRMM_emoticon", LPGEN("Smiley button"), 0, -IDI_SMILEYICON, 1 }, // 9 + { "tabSRMM_bold", LPGEN("Format bold"), 0, -IDI_FONTBOLD, 1 }, + { "tabSRMM_italic", LPGEN("Format italic"), 0, -IDI_FONTITALIC, 1 }, + { "tabSRMM_underline", LPGEN("Format underline"), 0, -IDI_FONTUNDERLINE, 1 }, + { "tabSRMM_face", LPGEN("Font face"), 0, -IDI_FONTFACE, 1 }, + { "tabSRMM_color", LPGEN("Font color"), 0, -IDI_FONTCOLOR, 1 }, + { "tabSRMM_strikeout", LPGEN("Format strike-through"), 0, -IDI_STRIKEOUT, 1 } }; static TIconDesc _chattoolbaricons[] = { - { "chat_bkgcol", LPGEN("Background color"), &PluginConfig.g_buttonBarIcons[31], -IDI_BKGCOLOR, 1 }, - { "chat_settings", LPGEN("Room settings"), &PluginConfig.g_buttonBarIcons[32], -IDI_TOPICBUT, 1 }, - { "chat_filter", LPGEN("Event filter"), &PluginConfig.g_buttonBarIcons[33], -IDI_FILTER2, 1 }, - { "chat_shownicklist", LPGEN("Nick list"), &PluginConfig.g_buttonBarIcons[35], -IDI_SHOWNICKLIST, 1 } + { "chat_bkgcol", LPGEN("Background color"), 0, -IDI_BKGCOLOR, 1 }, + { "chat_settings", LPGEN("Room settings"), 0, -IDI_TOPICBUT, 1 }, + { "chat_filter", LPGEN("Event filter"), 0, -IDI_FILTER2, 1 }, + { "chat_shownicklist", LPGEN("Nick list"), 0, -IDI_SHOWNICKLIST, 1 } }; static TIconDesc _logicons[] = @@ -553,13 +553,14 @@ static int TSAPI SetupIconLibConfig() static int TSAPI LoadFromIconLib() { for (auto &it : ICONBLOCKS) - for (int i = 0; i < it.nItems; i++) - *(it.idesc[i].phIcon) = IcoLib_GetIcon(it.idesc[i].szName); - - PluginConfig.g_buttonBarIcons[0] = Skin_LoadIcon(SKINICON_OTHER_ADDCONTACT); - PluginConfig.g_buttonBarIcons[1] = Skin_LoadIcon(SKINICON_OTHER_HISTORY); + for (int i = 0; i < it.nItems; i++) { + auto &p = it.idesc[i]; + if (p.phIcon) + *p.phIcon = IcoLib_GetIcon(p.szName); + } - PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING] = PluginConfig.g_buttonBarIcons[12] = Skin_LoadIcon(SKINICON_OTHER_TYPING); + PluginConfig.g_buttonBarIcons[ICON_BUTTON_ADD] = Skin_LoadIcon(SKINICON_OTHER_ADDCONTACT); + PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING] = Skin_LoadIcon(SKINICON_OTHER_TYPING); PluginConfig.g_iconOverlayDisabled = IcoLib_GetIcon("tabSRMM_overlay_disabled"); @@ -586,11 +587,13 @@ void TSAPI LoadIconTheme() static void UnloadIcons() { for (auto &it : ICONBLOCKS) - for (int i = 0; i < it.nItems; i++) - if (*(it.idesc[i].phIcon) != nullptr) { - DestroyIcon(*(it.idesc[i].phIcon)); - *(it.idesc[i].phIcon) = nullptr; + for (int i = 0; i < it.nItems; i++) { + auto &p = it.idesc[i]; + if (p.phIcon && *p.phIcon != nullptr) { + DestroyIcon(*p.phIcon); + *p.phIcon = nullptr; } + } if (PluginConfig.g_hbmUnknown) DeleteObject(PluginConfig.g_hbmUnknown); diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index 5b9de4088a..d7e7d01bae 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -1029,19 +1029,6 @@ struct SKINDESC #define SKIN_NR_ELEMENTS 6 #define SKIN_VERSION 2 -// icon defintions (index into g_buttonBarIcons) -#define ICON_DEFAULT_SOUNDS 22 -#define ICON_DEFAULT_PULLDOWN 16 -#define ICON_DEFAULT_LEFT 25 -#define ICON_DEFAULT_RIGHT 28 -#define ICON_DEFAULT_UP 26 -#define ICON_DEFAULT_TYPING 5 - -#define ICON_BUTTON_ADD 0 -#define ICON_BUTTON_CANCEL 6 -#define ICON_BUTTON_SAVE 7 -#define ICON_BUTTON_SEND 9 - struct CMPlugin : public PLUGIN { HANDLE hLogger; diff --git a/plugins/TabSRMM/src/sidebar.cpp b/plugins/TabSRMM/src/sidebar.cpp index a7798bd225..c37e4f66ab 100644 --- a/plugins/TabSRMM/src/sidebar.cpp +++ b/plugins/TabSRMM/src/sidebar.cpp @@ -1007,8 +1007,10 @@ void __fastcall CSideBar::m_DefaultContentRenderer(const HDC hdc, const RECT *rc int stateID = item->m_buttonControl->stateId; if (id == IDC_SIDEBARUP || id == IDC_SIDEBARDOWN) { - ::DrawIconEx(hdc, (rcBox->left + rcBox->right) / 2 - 8, (rcBox->top + rcBox->bottom) / 2 - 8, id == IDC_SIDEBARUP ? PluginConfig.g_buttonBarIcons[26] : PluginConfig.g_buttonBarIcons[16], + ::DrawIconEx(hdc, (rcBox->left + rcBox->right) / 2 - 8, (rcBox->top + rcBox->bottom) / 2 - 8, + PluginConfig.g_buttonBarIcons[id == IDC_SIDEBARUP ? ICON_DEFAULT_UP : ICON_DEFAULT_PULLDOWN], 16, 16, 0, nullptr, DI_NORMAL); + if (!M.isAero() && stateID == PBS_HOT) ::DrawEdge(hdc, const_cast(rcBox), BDR_INNER, BF_RECT | BF_SOFT | BF_FLAT); } -- cgit v1.2.3