From 680873487c4a7987012606119a744e5ca725ad30 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 13 Apr 2019 20:22:59 +0300 Subject: merge with trunk --- plugins/NoHistory/src/dllmain.cpp | 12 ++++++------ plugins/NoHistory/src/icons.cpp | 14 -------------- plugins/NoHistory/src/icons.h | 2 -- plugins/NoHistory/src/options.cpp | 9 +++++---- 4 files changed, 11 insertions(+), 26 deletions(-) (limited to 'plugins/NoHistory') diff --git a/plugins/NoHistory/src/dllmain.cpp b/plugins/NoHistory/src/dllmain.cpp index 08412fae4f..d2a8de5f9e 100644 --- a/plugins/NoHistory/src/dllmain.cpp +++ b/plugins/NoHistory/src/dllmain.cpp @@ -142,9 +142,9 @@ int PrebuildContactMenu(WPARAM hContact, LPARAM) Menu_ShowItem(hMenuToggle, false); else { if (remove) - Menu_ModifyItem(hMenuToggle, LPGENW("Enable History"), hIconKeep); + Menu_ModifyItem(hMenuToggle, LPGENW("Enable History"), g_plugin.getIconHandle(IDI_HKEEP)); else - Menu_ModifyItem(hMenuToggle, LPGENW("Disable History"), hIconRemove); + Menu_ModifyItem(hMenuToggle, LPGENW("Disable History"), g_plugin.getIconHandle(IDI_HREMOVE)); } Menu_ShowItem(hMenuClear, !chat_room && db_event_count(hContact) > 0); @@ -210,12 +210,12 @@ void SrmmMenu_Load() sid.dwId = 0; sid.szTooltip.a = LPGEN("History Enabled"); - sid.hIcon = sid.hIconDisabled = hIconKeep; + sid.hIcon = sid.hIconDisabled = g_plugin.getIcon(IDI_HKEEP); Srmm_AddIcon(&sid, &g_plugin); sid.dwId = 1; sid.szTooltip.a = LPGEN("History Disabled"); - sid.hIcon = sid.hIconDisabled = hIconRemove; + sid.hIcon = sid.hIconDisabled = g_plugin.getIcon(IDI_HREMOVE); Srmm_AddIcon(&sid, &g_plugin); // hook the window events so that we can can change the status of the icon @@ -235,14 +235,14 @@ static int ModulesLoaded(WPARAM, LPARAM) mi.position = -300010; mi.name.w = LPGENW("Disable History"); mi.pszService = MS_NOHISTORY_TOGGLE; - mi.hIcolibItem = hIconRemove; + mi.hIcolibItem = g_plugin.getIconHandle(IDI_HREMOVE); hMenuToggle = Menu_AddContactMenuItem(&mi); SET_UID(mi, 0x1c4b1c21, 0xc0d1, 0x44d1, 0xb5, 0x3c, 0xc7, 0x8d, 0xcf, 0x96, 0x51, 0xd7); mi.position = -300005; mi.name.w = LPGENW("Clear History"); mi.pszService = MS_NOHISTORY_CLEAR; - mi.hIcolibItem = hIconClear; + mi.hIcolibItem = g_plugin.getIconHandle(IDI_HCLEAR); hMenuClear = Menu_AddContactMenuItem(&mi); // add icon to srmm status icons diff --git a/plugins/NoHistory/src/icons.cpp b/plugins/NoHistory/src/icons.cpp index b24cadf3c2..3b8dfbf2b6 100644 --- a/plugins/NoHistory/src/icons.cpp +++ b/plugins/NoHistory/src/icons.cpp @@ -1,7 +1,5 @@ #include "stdafx.h" -HICON hIconRemove, hIconKeep, hIconClear; - static IconItem iconList[] = { { LPGEN("Disable"), "remove", IDI_HREMOVE }, @@ -9,19 +7,7 @@ static IconItem iconList[] = { LPGEN("Clear"), "clear", IDI_HCLEAR }, }; -int ReloadIcons(WPARAM, LPARAM) -{ - hIconRemove = IcoLib_GetIconByHandle(iconList[0].hIcolib); - hIconKeep = IcoLib_GetIconByHandle(iconList[1].hIcolib); - hIconClear = IcoLib_GetIconByHandle(iconList[2].hIcolib); - return 0; -} - void InitIcons() { g_plugin.registerIcon(LPGEN("No History"), iconList, MODULENAME); - - ReloadIcons(0, 0); - - HookEvent(ME_SKIN_ICONSCHANGED, ReloadIcons); } diff --git a/plugins/NoHistory/src/icons.h b/plugins/NoHistory/src/icons.h index cfd2288c52..911549a8cd 100644 --- a/plugins/NoHistory/src/icons.h +++ b/plugins/NoHistory/src/icons.h @@ -1,8 +1,6 @@ #ifndef _ICONS_INC #define _ICONS_INC -extern HICON hIconRemove, hIconKeep, hIconClear; - void InitIcons(); #endif diff --git a/plugins/NoHistory/src/options.cpp b/plugins/NoHistory/src/options.cpp index c7e2a35027..3107787b21 100644 --- a/plugins/NoHistory/src/options.cpp +++ b/plugins/NoHistory/src/options.cpp @@ -102,11 +102,12 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA hwndList = GetDlgItem(hwndDlg, IDC_LIST); { HIMAGELIST hIml = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, 2, 2); - ImageList_AddIcon(hIml, hIconKeep); - ImageList_AddIcon(hIml, hIconRemove); + g_plugin.addImgListIcon(hIml, IDI_HKEEP); + g_plugin.addImgListIcon(hIml, IDI_HREMOVE); SendMessage(hwndList, CLM_SETEXTRAIMAGELIST, 0, (LPARAM)hIml); - SendDlgItemMessage(hwndDlg, IDC_PIC_KEEP, STM_SETICON, (WPARAM)hIconKeep, 0); - SendDlgItemMessage(hwndDlg, IDC_PIC_REMOVE, STM_SETICON, (WPARAM)hIconRemove, 0); + + SendDlgItemMessage(hwndDlg, IDC_PIC_KEEP, STM_SETICON, (WPARAM)g_plugin.getIcon(IDI_HKEEP), 0); + SendDlgItemMessage(hwndDlg, IDC_PIC_REMOVE, STM_SETICON, (WPARAM)g_plugin.getIcon(IDI_HREMOVE), 0); } ResetListOptions(hwndList); SendMessage(hwndList, CLM_SETEXTRACOLUMNS, 1, 0); -- cgit v1.2.3