From 70cf96fdda918321f2f90ffb9271d690cd55d011 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 12 Oct 2024 21:32:25 +0300 Subject: fixes #4726 (IEView: remove duplicate "Code" button) --- plugins/IEView/res/ieview.rc | 2 -- plugins/IEView/src/Options.cpp | 8 ++++---- plugins/IEView/src/ieview_main.cpp | 39 ++++++-------------------------------- plugins/IEView/src/resource.h | 1 - plugins/IEView/src/stdafx.h | 1 - 5 files changed, 10 insertions(+), 41 deletions(-) diff --git a/plugins/IEView/res/ieview.rc b/plugins/IEView/res/ieview.rc index 55499349bf..42e3b7492a 100644 --- a/plugins/IEView/res/ieview.rc +++ b/plugins/IEView/res/ieview.rc @@ -49,8 +49,6 @@ END // Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems. -IDI_CODE ICON "code.ico" - IDI_RTL_ON ICON "rtl_on.ico" IDI_RTL_OFF ICON "rtl_off.ico" diff --git a/plugins/IEView/src/Options.cpp b/plugins/IEView/src/Options.cpp index be47efc419..c0ffd80344 100644 --- a/plugins/IEView/src/Options.cpp +++ b/plugins/IEView/src/Options.cpp @@ -306,10 +306,10 @@ static void RefreshProtoIcons() static void RefreshIcons() { hImageList = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_MASK | ILC_COLOR32, 0, 0); - ImageList_AddIcon(hImageList, IcoLib_GetIconByHandle(iconList[3].hIcolib)); - ImageList_AddIcon(hImageList, IcoLib_GetIconByHandle(iconList[2].hIcolib)); - ImageList_AddIcon(hImageList, IcoLib_GetIconByHandle(iconList[1].hIcolib)); - ImageList_AddIcon(hImageList, IcoLib_GetIconByHandle(iconList[0].hIcolib)); + ImageList_AddIcon(hImageList, g_plugin.getIcon(IDI_GROUP_OFF)); + ImageList_AddIcon(hImageList, g_plugin.getIcon(IDI_GROUP_ON)); + ImageList_AddIcon(hImageList, g_plugin.getIcon(IDI_RTL_OFF)); + ImageList_AddIcon(hImageList, g_plugin.getIcon(IDI_RTL_ON)); } static void RefreshProtoList(HWND hwndDlg, int mode, bool protoTemplates) diff --git a/plugins/IEView/src/ieview_main.cpp b/plugins/IEView/src/ieview_main.cpp index 9056ca1950..a407c37c8d 100644 --- a/plugins/IEView/src/ieview_main.cpp +++ b/plugins/IEView/src/ieview_main.cpp @@ -23,15 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. char *workingDirUtf8; CMPlugin g_plugin; -IconItem iconList[] = -{ - { LPGEN("Code"), "CODE", IDI_CODE }, - { LPGEN("RTL On"), "RTL_ON", IDI_RTL_ON }, - { LPGEN("RTL Off"), "RTL_OFF", IDI_RTL_OFF }, - { LPGEN("Group On"), "GROUP_ON", IDI_GROUP_ON }, - { LPGEN("Group Off"), "GROUP_OFF", IDI_GROUP_OFF } -}; - ///////////////////////////////////////////////////////////////////////////////////////// PLUGININFOEX pluginInfoEx = { @@ -53,34 +44,16 @@ CMPlugin::CMPlugin() : ///////////////////////////////////////////////////////////////////////////////////////// -static int CustomButtonPressed(WPARAM, LPARAM lParam) +static IconItem iconList[] = { - CustomButtonClickData *cbcd = (CustomButtonClickData *)lParam; - if (mir_strcmp(cbcd->pszModule, MODULENAME)) - return 0; - - if (cbcd->dwButtonId != 1) - return 1; - - HWND hEdit = GetDlgItem(cbcd->hwndFrom, IDC_SRMM_MESSAGE); - SendMessage(hEdit, EM_REPLACESEL, TRUE, (LPARAM)L"[code][/code]"); - return 0; -} + { LPGEN("RTL On"), "RTL_ON", IDI_RTL_ON }, + { LPGEN("RTL Off"), "RTL_OFF", IDI_RTL_OFF }, + { LPGEN("Group On"), "GROUP_ON", IDI_GROUP_ON }, + { LPGEN("Group Off"), "GROUP_OFF", IDI_GROUP_OFF } +}; static int ModulesLoaded(WPARAM, LPARAM) { - BBButton bbd = {}; - bbd.pszModuleName = MODULENAME; - bbd.dwButtonID = 1; - bbd.bbbFlags = BBBF_ISCHATBUTTON | BBBF_ISIMBUTTON | BBBF_NOREADONLY | BBBF_NOREADONLY; - bbd.dwDefPos = 40; - bbd.hIcon = g_plugin.getIconHandle(IDI_CODE); - bbd.pwszText = L"[Code]"; - bbd.pwszTooltip = LPGENW("Format text as code"); - g_plugin.addButton(&bbd); - - HookEvent(ME_MSG_BUTTONPRESSED, CustomButtonPressed); - Options::init(); return 0; } diff --git a/plugins/IEView/src/resource.h b/plugins/IEView/src/resource.h index 10a782b67e..f3c6a430b6 100644 --- a/plugins/IEView/src/resource.h +++ b/plugins/IEView/src/resource.h @@ -9,7 +9,6 @@ #define IDI_RTL_OFF 101 #define IDI_GROUP_ON 102 #define IDI_GROUP_OFF 103 -#define IDI_CODE 104 #define IDD_SRMM_OPTIONS 153 #define IDD_GENERAL_OPTIONS 155 #define IDR_CONTEXTMENU 200 diff --git a/plugins/IEView/src/stdafx.h b/plugins/IEView/src/stdafx.h index fa5ba81185..3732b09705 100644 --- a/plugins/IEView/src/stdafx.h +++ b/plugins/IEView/src/stdafx.h @@ -87,7 +87,6 @@ CSrmmLogWindow *logBuilder(CMsgDialog &pDlg); extern IEView *debugView; extern char *workingDirUtf8; extern HANDLE hHookOptionsChanged; -extern IconItem iconList[]; class BSTR_PTR { -- cgit v1.2.3