From df978c9521ba66c2a2be18a93c68be92943c63ab Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 12 Apr 2019 20:29:34 +0300 Subject: wiping custom icolib functions: HistorySweeperLight --- plugins/HistorySweeperLight/src/main.cpp | 8 ++-- plugins/HistorySweeperLight/src/options.cpp | 69 +++++++++++------------------ plugins/HistorySweeperLight/src/stdafx.h | 3 -- 3 files changed, 29 insertions(+), 51 deletions(-) diff --git a/plugins/HistorySweeperLight/src/main.cpp b/plugins/HistorySweeperLight/src/main.cpp index 7d4ecd5311..416c83f319 100644 --- a/plugins/HistorySweeperLight/src/main.cpp +++ b/plugins/HistorySweeperLight/src/main.cpp @@ -70,7 +70,7 @@ static int OnModulesLoaded(WPARAM, LPARAM) StatusIconData sid = {}; sid.szModule = MODULENAME; - sid.hIcon = LoadIconEx("actG"); + sid.hIcon = g_plugin.getIcon(IDI_ACTG); if (sweep == 0) sid.szTooltip.w = LPGENW("Keep all events"); else if (sweep == 1) @@ -84,17 +84,17 @@ static int OnModulesLoaded(WPARAM, LPARAM) Srmm_AddIcon(&sid, &g_plugin); sid.dwId = 1; - sid.hIcon = LoadIconEx("act1"); + sid.hIcon = g_plugin.getIcon(IDI_ACT1); sid.szTooltip.w = time_stamp_strings[g_plugin.getByte("StartupShutdownOlder", 0)]; Srmm_AddIcon(&sid, &g_plugin); sid.dwId = 2; - sid.hIcon = LoadIconEx("act2"); + sid.hIcon = g_plugin.getIcon(IDI_ACT2); sid.szTooltip.w = keep_strings[g_plugin.getByte("StartupShutdownKeep", 0)]; Srmm_AddIcon(&sid, &g_plugin); sid.dwId = 3; - sid.hIcon = LoadIconEx("actDel"); + sid.hIcon = g_plugin.getIcon(IDI_ACTDEL); sid.szTooltip.w = LPGENW("Delete all events"); Srmm_AddIcon(&sid, &g_plugin); diff --git a/plugins/HistorySweeperLight/src/options.cpp b/plugins/HistorySweeperLight/src/options.cpp index 4dc71814f8..dc032a06b4 100644 --- a/plugins/HistorySweeperLight/src/options.cpp +++ b/plugins/HistorySweeperLight/src/options.cpp @@ -21,6 +21,25 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" +///////////////////////////////////////////////////////////////////////////////////////// + +static IconItem iconList[] = +{ + { LPGEN("Default Action"), "actG", IDI_ACTG }, + { LPGEN("Action 1"), "act1", IDI_ACT1 }, + { LPGEN("Action 2"), "act2", IDI_ACT2 }, + { LPGEN("Delete All"), "actDel", IDI_ACTDEL } +}; + +static HANDLE hIconLibItem[_countof(iconList)]; + +void InitIcons(void) +{ + g_plugin.registerIcon(MODULENAME, iconList, MODULENAME); +} + +///////////////////////////////////////////////////////////////////////////////////////// + // Time Stamps strings wchar_t* time_stamp_strings[] = { @@ -44,44 +63,6 @@ wchar_t* keep_strings[] = LPGENW("Keep 50 last events") }; -static IconItem iconList[] = -{ - { LPGEN("Default Action"), "actG", IDI_ACTG }, - { LPGEN("Action 1"), "act1", IDI_ACT1 }, - { LPGEN("Action 2"), "act2", IDI_ACT2 }, - { LPGEN("Delete All"), "actDel", IDI_ACTDEL } -}; - -static HANDLE hIconLibItem[_countof(iconList)]; - -void InitIcons(void) -{ - g_plugin.registerIcon(MODULENAME, iconList, MODULENAME); -} - -HICON LoadIconEx(const char* name) -{ - char szSettingName[100]; - mir_snprintf(szSettingName, "%s_%s", MODULENAME, name); - return IcoLib_GetIcon(szSettingName); -} - -HANDLE GetIconHandle(const char* name) -{ - for (auto &it : iconList) - if (mir_strcmp(it.szName, name) == 0) - return ⁢ - - return nullptr; -} - -void ReleaseIconEx(const char* name) -{ - char szSettingName[100]; - mir_snprintf(szSettingName, "%s_%s", MODULENAME, name); - IcoLib_Release(szSettingName); -} - HANDLE hAllContacts, hSystemHistory; static void ShowAllContactIcons(HWND hwndList) @@ -187,15 +168,15 @@ INT_PTR CALLBACK DlgProcHSOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM lParam) ImageList_AddIcon(hIml, hIcon); IcoLib_ReleaseIcon(hIcon); - hIcon = LoadIconEx("act1"); + hIcon = g_plugin.getIcon(IDI_ACT1); ImageList_AddIcon(hIml, hIcon); SendDlgItemMessage(hwndDlg, IDC_ACT1, STM_SETICON, (WPARAM)hIcon, 0); - hIcon = LoadIconEx("act2"); + hIcon = g_plugin.getIcon(IDI_ACT2); ImageList_AddIcon(hIml, hIcon); SendDlgItemMessage(hwndDlg, IDC_ACT2, STM_SETICON, (WPARAM)hIcon, 0); - hIcon = LoadIconEx("actDel"); + hIcon = g_plugin.getIcon(IDI_ACTDEL); ImageList_AddIcon(hIml, hIcon); SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_SETEXTRAIMAGELIST, 0, (LPARAM)hIml); @@ -206,9 +187,9 @@ INT_PTR CALLBACK DlgProcHSOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM lParam) case WM_DESTROY: ImageList_Destroy((HIMAGELIST)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETEXTRAIMAGELIST, 0, 0)); - ReleaseIconEx("act1"); - ReleaseIconEx("act2"); - ReleaseIconEx("actDel"); + g_plugin.releaseIcon(IDI_ACT1); + g_plugin.releaseIcon(IDI_ACT2); + g_plugin.releaseIcon(IDI_ACTDEL); break; case WM_COMMAND: diff --git a/plugins/HistorySweeperLight/src/stdafx.h b/plugins/HistorySweeperLight/src/stdafx.h index 5d68a9c2bb..73df99ec90 100644 --- a/plugins/HistorySweeperLight/src/stdafx.h +++ b/plugins/HistorySweeperLight/src/stdafx.h @@ -60,9 +60,6 @@ extern wchar_t* time_stamp_strings[]; extern wchar_t* keep_strings[]; int HSOptInitialise(WPARAM wParam, LPARAM lParam); void InitIcons(void); -void ReleaseIconEx(const char* name); -HICON LoadIconEx(const char* name); -HANDLE GetIconHandle(const char* name); // historysweeper.c void ShutdownAction(void); -- cgit v1.2.3