diff options
author | George Hazan <ghazan@miranda.im> | 2019-04-12 20:28:42 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2019-04-12 20:28:42 +0300 |
commit | 26e51a3da66e2fda76fdf70fad849a9d4c58fd85 (patch) | |
tree | 1ad3bb0d15d3e5b1ed5a6fef3f0656ec34d995d8 /protocols | |
parent | b439b465f5ab39ac06cf9b32ab927cca787e4cfe (diff) |
wiping custom icolib functions: NewsAggregator
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/NewsAggregator/Res/Resource.rc | 1 | ||||
-rw-r--r-- | protocols/NewsAggregator/Src/Icons.cpp | 18 | ||||
-rw-r--r-- | protocols/NewsAggregator/Src/Menus.cpp | 12 | ||||
-rw-r--r-- | protocols/NewsAggregator/Src/Services.cpp | 10 | ||||
-rw-r--r-- | protocols/NewsAggregator/Src/resource.h | 1 | ||||
-rw-r--r-- | protocols/NewsAggregator/Src/stdafx.h | 2 |
6 files changed, 14 insertions, 30 deletions
diff --git a/protocols/NewsAggregator/Res/Resource.rc b/protocols/NewsAggregator/Res/Resource.rc index eb7688640f..9b8b50cfaa 100644 --- a/protocols/NewsAggregator/Res/Resource.rc +++ b/protocols/NewsAggregator/Res/Resource.rc @@ -28,6 +28,7 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT // remains consistent on all systems. IDI_ICON ICON "Main.ico" IDI_CHECKALL ICON "CheckAll.ico" +IDI_CHECKFEED ICON "CheckAll.ico" IDI_ADDFEED ICON "AddFeed.ico" IDI_IMPORTFEEDS ICON "Import.ico" IDI_EXPORTFEEDS ICON "Export.ico" diff --git a/protocols/NewsAggregator/Src/Icons.cpp b/protocols/NewsAggregator/Src/Icons.cpp index b9cdeb6166..f1525282b0 100644 --- a/protocols/NewsAggregator/Src/Icons.cpp +++ b/protocols/NewsAggregator/Src/Icons.cpp @@ -26,7 +26,7 @@ static IconItem iconList[] = { LPGEN("Add Feed"), "addfeed", IDI_ADDFEED}, { LPGEN("Import Feeds"), "importfeeds", IDI_IMPORTFEEDS}, { LPGEN("Export Feeds"), "exportfeeds", IDI_EXPORTFEEDS}, - { LPGEN("Check Feed"), "checkfeed", IDI_CHECKALL}, + { LPGEN("Check Feed"), "checkfeed", IDI_CHECKFEED}, { LPGEN("Auto Update Enabled"), "enabled", IDI_ENABLED}, { LPGEN("Auto Update Disabled"), "disabled", IDI_DISABLED} }; @@ -35,19 +35,3 @@ void InitIcons() { g_plugin.registerIcon(LPGEN("News Aggregator"), iconList, MODULENAME); } - -HICON LoadIconEx(const char *name, bool big) -{ - char szSettingName[100]; - mir_snprintf(szSettingName, "%s_%s", MODULENAME, name); - return IcoLib_GetIcon(szSettingName, big); -} - -HANDLE GetIconHandle(const char *name) -{ - for (int i=0; i < _countof(iconList); i++) - if ( !mir_strcmp(iconList[i].szName, name)) - return iconList[i].hIcolib; - - return nullptr; -} diff --git a/protocols/NewsAggregator/Src/Menus.cpp b/protocols/NewsAggregator/Src/Menus.cpp index 7770e843eb..16bd7163ef 100644 --- a/protocols/NewsAggregator/Src/Menus.cpp +++ b/protocols/NewsAggregator/Src/Menus.cpp @@ -34,7 +34,7 @@ void InitMenu() mi.name.w = LPGENW("Auto Update Enabled"); else mi.name.w = LPGENW("Auto Update Disabled"); - mi.hIcolibItem = GetIconHandle("main"); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_ICON); mi.pszService = MS_NEWSAGGREGATOR_ENABLED; hService2[0] = Menu_AddMainMenuItem(&mi); @@ -46,21 +46,21 @@ void InitMenu() SET_UID(mi, 0xb876484d, 0x28aa, 0x4e03, 0x9e, 0x98, 0xed, 0xbc, 0xd1, 0xcf, 0x31, 0x80); mi.position = 20100002; - mi.hIcolibItem = GetIconHandle("addfeed"); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_ADDFEED); mi.name.w = LPGENW("Add Feed"); mi.pszService = MS_NEWSAGGREGATOR_ADDFEED; hService2[2] = Menu_AddMainMenuItem(&mi); SET_UID(mi, 0x600bf2c2, 0xa974, 0x44d3, 0x98, 0xf9, 0xe6, 0x65, 0x7c, 0x1f, 0x63, 0x37); mi.position = 20100003; - mi.hIcolibItem = GetIconHandle("importfeeds"); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_IMPORTFEEDS); mi.name.w = LPGENW("Import Feeds"); mi.pszService = MS_NEWSAGGREGATOR_IMPORTFEEDS; hService2[3] = Menu_AddMainMenuItem(&mi); SET_UID(mi, 0xc09c8119, 0x64c2, 0x49bd, 0x81, 0xf, 0x54, 0x20, 0x69, 0xd7, 0x30, 0xcf); mi.position = 20100004; - mi.hIcolibItem = GetIconHandle("exportfeeds"); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_EXPORTFEEDS); mi.name.w = LPGENW("Export Feeds"); mi.pszService = MS_NEWSAGGREGATOR_EXPORTFEEDS; hService2[4] = Menu_AddMainMenuItem(&mi); @@ -69,7 +69,7 @@ void InitMenu() SET_UID(mi, 0x92be499c, 0x928c, 0x4789, 0x8f, 0x36, 0x28, 0xa2, 0x9f, 0xb7, 0x1a, 0x97); mi.root = nullptr; mi.position = -0x7FFFFFFA; - mi.hIcolibItem = GetIconHandle("checkfeed"); + mi.hIcolibItem = g_plugin.getIconHandle(IDI_CHECKFEED); mi.name.w = LPGENW("Check feed"); mi.pszService = MS_NEWSAGGREGATOR_CHECKFEED; hService2[5] = Menu_AddContactMenuItem(&mi, MODULENAME); @@ -79,5 +79,5 @@ void InitMenu() mi.pszService = MS_NEWSAGGREGATOR_CHANGEFEED; hService2[6] = Menu_AddContactMenuItem(&mi, MODULENAME); - Menu_ModifyItem(hService2[0], nullptr, GetIconHandle(g_plugin.getByte("AutoUpdate", 1) ? "enabled" : "disabled")); + Menu_ModifyItem(hService2[0], nullptr, g_plugin.getIconHandle(g_plugin.getByte("AutoUpdate", 1) ? IDI_ENABLED : IDI_DISABLED)); } diff --git a/protocols/NewsAggregator/Src/Services.cpp b/protocols/NewsAggregator/Src/Services.cpp index b5b8c9f028..9183607841 100644 --- a/protocols/NewsAggregator/Src/Services.cpp +++ b/protocols/NewsAggregator/Src/Services.cpp @@ -113,7 +113,7 @@ INT_PTR NewsAggrGetStatus(WPARAM, LPARAM) INT_PTR NewsAggrLoadIcon(WPARAM wParam, LPARAM) { - return (LOWORD(wParam) == PLI_PROTOCOL) ? (INT_PTR)CopyIcon(LoadIconEx("main", FALSE)) : 0; + return (LOWORD(wParam) == PLI_PROTOCOL) ? (INT_PTR)CopyIcon(g_plugin.getIcon(IDI_ICON)) : 0; } static void __cdecl AckThreadProc(void *param) @@ -230,9 +230,9 @@ INT_PTR NewsAggrRecvMessage(WPARAM, LPARAM lParam) void UpdateMenu(bool State) { if (!State) // to enable auto-update - Menu_ModifyItem(hService2[0], LPGENW("Auto Update Enabled"), GetIconHandle("enabled")); + Menu_ModifyItem(hService2[0], LPGENW("Auto Update Enabled"), g_plugin.getIconHandle(IDI_ENABLED)); else // to disable auto-update - Menu_ModifyItem(hService2[0], LPGENW("Auto Update Disabled"), GetIconHandle("disabled")); + Menu_ModifyItem(hService2[0], LPGENW("Auto Update Disabled"), g_plugin.getIconHandle(IDI_DISABLED)); CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTBButton, State ? TTBST_PUSHED : 0); g_plugin.setByte("AutoUpdate", !State); @@ -253,8 +253,8 @@ int OnToolbarLoaded(WPARAM, LPARAM) ttb.pszService = MS_NEWSAGGREGATOR_ENABLED; ttb.pszTooltipUp = LPGEN("Auto Update Enabled"); ttb.pszTooltipDn = LPGEN("Auto Update Disabled"); - ttb.hIconHandleUp = GetIconHandle("enabled"); - ttb.hIconHandleDn = GetIconHandle("disabled"); + ttb.hIconHandleUp = g_plugin.getIconHandle(IDI_ENABLED); + ttb.hIconHandleDn = g_plugin.getIconHandle(IDI_DISABLED); ttb.dwFlags = (g_plugin.getByte("AutoUpdate", 1) ? 0 : TTBBF_PUSHED) | TTBBF_ASPUSHBUTTON | TTBBF_VISIBLE; hTBButton = g_plugin.addTTB(&ttb); return 0; diff --git a/protocols/NewsAggregator/Src/resource.h b/protocols/NewsAggregator/Src/resource.h index 131a0844ba..6067cef8bf 100644 --- a/protocols/NewsAggregator/Src/resource.h +++ b/protocols/NewsAggregator/Src/resource.h @@ -4,6 +4,7 @@ // #define IDD_OPTIONS 101 #define IDD_AUTHENTICATION 102 +#define IDI_CHECKFEED 108 #define IDI_ICON 109 #define IDD_ADDFEED 110 #define IDI_CHECKALL 111 diff --git a/protocols/NewsAggregator/Src/stdafx.h b/protocols/NewsAggregator/Src/stdafx.h index 819e96d69f..e2af12c08c 100644 --- a/protocols/NewsAggregator/Src/stdafx.h +++ b/protocols/NewsAggregator/Src/stdafx.h @@ -101,8 +101,6 @@ void NetlibInit(); void NetlibUnInit(); void InitMenu(); void InitIcons(); -HICON LoadIconEx(const char* name, bool big); -HANDLE GetIconHandle(const char* name); INT_PTR NewsAggrGetName(WPARAM wParam, LPARAM lParam); INT_PTR NewsAggrGetCaps(WPARAM wp, LPARAM lp); |