From 65d21daad01ddb2323d87ef343cfeef8fde5650b Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Sat, 12 Sep 2015 22:33:15 +0000 Subject: Popup: fix #680 git-svn-id: http://svn.miranda-ng.org/main/trunk@15337 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Popup/res/Check_off.ico | Bin 1150 -> 0 bytes plugins/Popup/res/Check_on.ico | Bin 1150 -> 0 bytes plugins/Popup/res/Radio_off.ico | Bin 1150 -> 0 bytes plugins/Popup/res/Radio_on.ico | Bin 1150 -> 0 bytes plugins/Popup/res/resource.rc | 4 ---- plugins/Popup/src/icons.cpp | 11 +++-------- plugins/Popup/src/icons.h | 1 - plugins/Popup/src/main.cpp | 28 +++++++++++++--------------- plugins/Popup/src/resource.h | 4 ---- 9 files changed, 16 insertions(+), 32 deletions(-) delete mode 100644 plugins/Popup/res/Check_off.ico delete mode 100644 plugins/Popup/res/Check_on.ico delete mode 100644 plugins/Popup/res/Radio_off.ico delete mode 100644 plugins/Popup/res/Radio_on.ico diff --git a/plugins/Popup/res/Check_off.ico b/plugins/Popup/res/Check_off.ico deleted file mode 100644 index 2a78c302df..0000000000 Binary files a/plugins/Popup/res/Check_off.ico and /dev/null differ diff --git a/plugins/Popup/res/Check_on.ico b/plugins/Popup/res/Check_on.ico deleted file mode 100644 index 0ba1d546f3..0000000000 Binary files a/plugins/Popup/res/Check_on.ico and /dev/null differ diff --git a/plugins/Popup/res/Radio_off.ico b/plugins/Popup/res/Radio_off.ico deleted file mode 100644 index 79389689bf..0000000000 Binary files a/plugins/Popup/res/Radio_off.ico and /dev/null differ diff --git a/plugins/Popup/res/Radio_on.ico b/plugins/Popup/res/Radio_on.ico deleted file mode 100644 index b6a9df40e2..0000000000 Binary files a/plugins/Popup/res/Radio_on.ico and /dev/null differ diff --git a/plugins/Popup/res/resource.rc b/plugins/Popup/res/resource.rc index 6f390d8cb4..988e0ab49c 100644 --- a/plugins/Popup/res/resource.rc +++ b/plugins/Popup/res/resource.rc @@ -32,10 +32,6 @@ IDI_PU_FAVOURITE ICON "popup_fav.ico" IDI_NOPOPUP ICON "popup_no.ico" IDI_HISTORY ICON "popup_history.ico" IDI_RELOAD ICON "reload.ico" -IDI_OPT_CHECK_OFF ICON "Check_off.ico" -IDI_OPT_CHECK_ON ICON "Check_on.ico" -IDI_OPT_RADIO_OFF ICON "Radio_off.ico" -IDI_OPT_RADIO_ON ICON "Radio_on.ico" IDI_ACT_INFO ICON "info.ico" IDI_ACT_MENU ICON "menu.ico" IDI_ACT_MESSAGE ICON "message.ico" diff --git a/plugins/Popup/src/icons.cpp b/plugins/Popup/src/icons.cpp index ce4cb1b0c0..207b4991a2 100644 --- a/plugins/Popup/src/icons.cpp +++ b/plugins/Popup/src/icons.cpp @@ -25,10 +25,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static IconItem iconList[] = { - // toolbar - { LPGEN("Popups are enabled"), "TBButton_ToogleUp", IDI_POPUP }, - { LPGEN("Popups are disabled"), "TBButton_ToogleDOWN", IDI_NOPOPUP }, - // common popup { LPGEN("Popups are enabled"), "enabled", IDI_POPUP }, { LPGEN("Popups are disabled"), "disabled", IDI_NOPOPUP }, @@ -66,10 +62,9 @@ static IconItem iconList[] = void InitIcons() { - Icon_Register(hInst, SECT_TOLBAR, iconList, 2, MODULNAME); - Icon_Register(hInst, SECT_POPUP, iconList + 2, 8, MODULNAME); - Icon_Register(hInst, SECT_POPUP SECT_POPUP_OPT, iconList + 10, 9, MODULNAME); - Icon_Register(hInst, SECT_POPUP SECT_POPUP_ACT, iconList + 19, 9, MODULNAME); + Icon_Register(hInst, SECT_POPUP, iconList, 8, MODULNAME); + Icon_Register(hInst, SECT_POPUP SECT_POPUP_OPT, iconList + 8, 9, MODULNAME); + Icon_Register(hInst, SECT_POPUP SECT_POPUP_ACT, iconList + 17, 9, MODULNAME); } HICON LoadIconEx(int iconId, bool big) diff --git a/plugins/Popup/src/icons.h b/plugins/Popup/src/icons.h index edcafaa1c6..a418a3cc65 100644 --- a/plugins/Popup/src/icons.h +++ b/plugins/Popup/src/icons.h @@ -25,7 +25,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define __icons_h__ //ICONS -#define SECT_TOLBAR "Toolbar" #define SECT_POPUP MODULNAME_PLU #define SECT_POPUP_ACT "/Actions" #define SECT_POPUP_OPT "/Options" diff --git a/plugins/Popup/src/main.cpp b/plugins/Popup/src/main.cpp index 4707941cfd..ffb00e74bd 100644 --- a/plugins/Popup/src/main.cpp +++ b/plugins/Popup/src/main.cpp @@ -111,19 +111,14 @@ static int IconsChanged(WPARAM, LPARAM) { LoadActions(); - HICON hIcon; - if (PopupOptions.ModuleIsEnabled == TRUE) { // The module is enabled. - // The action to do is "disable popups" (show disabled) and we must write "enable popup" in the new item. - hIcon = LoadIconEx(IDI_POPUP, 0); - } - else { // The module is disabled. - // The action to do is enable popups (show enabled), then write "disable popup" in the new item. - hIcon = LoadIconEx(IDI_NOPOPUP, 0); - } + HANDLE hIcon = PopupOptions.ModuleIsEnabled == TRUE + ? GetIconHandle(IDI_POPUP) + : GetIconHandle(IDI_NOPOPUP); + Menu_ModifyItem(hMenuItem, NULL, hIcon); Menu_ModifyItem(hMenuRoot, NULL, hIcon); - Menu_ModifyItem(hMenuItemHistory, NULL, LoadIconEx(IDI_HISTORY, 0)); + Menu_ModifyItem(hMenuItemHistory, NULL, GetIconHandle(IDI_HISTORY)); return 0; } @@ -147,20 +142,20 @@ static int TTBLoaded(WPARAM, LPARAM) //===== EnableDisableMenuCommand ======================================================== INT_PTR svcEnableDisableMenuCommand(WPARAM, LPARAM) { - HICON hIcon; + HANDLE hIcon; if (PopupOptions.ModuleIsEnabled) { // The module is enabled. // The action to do is "disable popups" (show disabled) and we must write "enable popup" in the new item. PopupOptions.ModuleIsEnabled = FALSE; db_set_b(NULL, "Popup", "ModuleIsEnabled", FALSE); - Menu_ModifyItem(hMenuItem, LPGENT("Enable Popups"), hIcon = LoadIconEx(IDI_NOPOPUP)); + Menu_ModifyItem(hMenuItem, LPGENT("Enable Popups"), hIcon = GetIconHandle(IDI_NOPOPUP)); } else { // The module is disabled. // The action to do is enable popups (show enabled), then write "disable popup" in the new item. PopupOptions.ModuleIsEnabled = TRUE; db_set_b(NULL, "Popup", "ModuleIsEnabled", TRUE); - Menu_ModifyItem(hMenuItem, LPGENT("Disable Popups"), hIcon = LoadIconEx(IDI_POPUP)); + Menu_ModifyItem(hMenuItem, LPGENT("Disable Popups"), hIcon = GetIconHandle(IDI_POPUP)); } Menu_ModifyItem(hMenuRoot, NULL, hIcon); @@ -182,8 +177,10 @@ void InitMenuItems(void) CMenuItem mi; mi.flags = CMIF_TCHAR; + HANDLE hIcon = GetIconHandle(PopupOptions.ModuleIsEnabled ? IDI_POPUP : IDI_NOPOPUP); + // Build main menu - hMenuRoot = Menu_CreateRoot(MO_MAIN, LPGENT(MODULNAME_PLU), -1000000000, LoadIconEx(PopupOptions.ModuleIsEnabled ? IDI_POPUP : IDI_NOPOPUP)); + hMenuRoot = Menu_CreateRoot(MO_MAIN, LPGENT(MODULNAME_PLU), -1000000000, hIcon); // Add item to main menu SET_UID(mi, 0x4353d44e, 0x177, 0x4843, 0x88, 0x30, 0x25, 0x5d, 0x91, 0xad, 0xdf, 0x3f); @@ -191,6 +188,7 @@ void InitMenuItems(void) mi.pszService = MENUCOMMAND_SVC; CreateServiceFunction(mi.pszService, svcEnableDisableMenuCommand); mi.name.t = PopupOptions.ModuleIsEnabled ? LPGENT("Disable Popups") : LPGENT("Enable Popups"); + mi.hIcolibItem = hIcon; hMenuItem = Menu_AddMainMenuItem(&mi); // Popup History @@ -199,7 +197,7 @@ void InitMenuItems(void) CreateServiceFunction(mi.pszService, svcShowHistory); mi.position = 1000000000; mi.name.t = LPGENT("Popup History"); - mi.hIcolibItem = LoadIconEx(IDI_HISTORY, 0); + mi.hIcolibItem = GetIconHandle(IDI_HISTORY); hMenuItemHistory = Menu_AddMainMenuItem(&mi); } diff --git a/plugins/Popup/src/resource.h b/plugins/Popup/src/resource.h index df05d7e9ee..e13b597fed 100644 --- a/plugins/Popup/src/resource.h +++ b/plugins/Popup/src/resource.h @@ -21,10 +21,6 @@ #define IDI_MB_INFO 191 #define IDI_MB_WARN 194 #define IDI_RESIZE 196 -#define IDI_OPT_CHECK_OFF 198 -#define IDI_OPT_CHECK_ON 199 -#define IDI_OPT_RADIO_OFF 200 -#define IDI_OPT_RADIO_ON 201 #define IDI_ACT_INFO 203 #define IDI_ACT_MENU 204 #define IDI_ACT_MESSAGE 205 -- cgit v1.2.3