From 30707c980d1560b358dbf2671a4d2a26a1e8173c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 28 Nov 2012 21:45:37 +0000 Subject: various menu initialization quirks git-svn-id: http://svn.miranda-ng.org/main/trunk@2552 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/NewEventNotify/src/menuitem.cpp | 30 ++++++++++++++---------------- plugins/NewEventNotify/src/options.cpp | 4 ++-- 2 files changed, 16 insertions(+), 18 deletions(-) (limited to 'plugins/NewEventNotify/src') diff --git a/plugins/NewEventNotify/src/menuitem.cpp b/plugins/NewEventNotify/src/menuitem.cpp index 6831c204a1..99e35c4740 100644 --- a/plugins/NewEventNotify/src/menuitem.cpp +++ b/plugins/NewEventNotify/src/menuitem.cpp @@ -1,6 +1,6 @@ /* Name: NewEventNotify - Plugin for Miranda IM - File: menuitem.c - Manages item(s) in the Miranda Menu + File: mi.c - Manages item(s) in the Miranda Menu Version: 0.0.4 Description: Notifies you about some events Author: icebreaker, @@ -24,7 +24,6 @@ #include "neweventnotify.h" -CLISTMENUITEM menuitem; HANDLE hMenuitemNotify; BOOL bNotify; @@ -40,14 +39,14 @@ static INT_PTR MenuitemNotifyCmd(WPARAM wParam,LPARAM lParam) int MenuitemUpdate(BOOL bStatus) { - //menuitem.flags = CMIM_FLAGS | (bStatus ? CMIF_CHECKED : 0); - menuitem.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(bStatus ? IDI_ENABLED : IDI_DISABLED)); + CLISTMENUITEM mi = { sizeof(mi) }; + mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(bStatus ? IDI_ENABLED : IDI_DISABLED)); if (bStatus) - menuitem.ptszName = TranslateT(MENUITEM_DISABLE); + mi.ptszName = TranslateT(MENUITEM_DISABLE); else - menuitem.ptszName = TranslateT(MENUITEM_ENABLE); - menuitem.flags = CMIM_ICON | CMIM_NAME | CMIF_KEEPUNTRANSLATED | CMIF_TCHAR; - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuitemNotify, (LPARAM)&menuitem); + mi.ptszName = TranslateT(MENUITEM_ENABLE); + mi.flags = CMIM_ICON | CMIM_NAME | CMIF_KEEPUNTRANSLATED | CMIF_TCHAR; + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuitemNotify, (LPARAM)&mi); return 0; } @@ -56,14 +55,13 @@ int MenuitemInit(BOOL bStatus) { CreateServiceFunction(MS_NEN_MENUNOTIFY, MenuitemNotifyCmd); - ZeroMemory(&menuitem, sizeof(menuitem)); - menuitem.cbSize = sizeof(CLISTMENUITEM); - menuitem.position = 1; - menuitem.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_ENABLED)); - menuitem.ptszPopupName = TranslateT("PopUps"); - menuitem.pszService = MS_NEN_MENUNOTIFY; - menuitem.flags = CMIF_KEEPUNTRANSLATED | CMIF_TCHAR; - hMenuitemNotify = Menu_AddMainMenuItem(&menuitem); + CLISTMENUITEM mi = { sizeof(mi) }; + mi.position = 1; + mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_ENABLED)); + mi.ptszPopupName = TranslateT("PopUps"); + mi.pszService = MS_NEN_MENUNOTIFY; + mi.flags = CMIF_KEEPUNTRANSLATED | CMIF_TCHAR; + hMenuitemNotify = Menu_AddMainMenuItem(&mi); bNotify = bStatus; MenuitemUpdate(bNotify); diff --git a/plugins/NewEventNotify/src/options.cpp b/plugins/NewEventNotify/src/options.cpp index 2e22a9f5cd..648e15c7de 100644 --- a/plugins/NewEventNotify/src/options.cpp +++ b/plugins/NewEventNotify/src/options.cpp @@ -263,7 +263,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hWnd, UINT message, WPARAM wParam, L options->colBackOthers = SendDlgItemMessage(hWnd, IDC_COLBACK_OTHERS, CPM_GETCOLOUR, 0, 0); options->colTextOthers = SendDlgItemMessage(hWnd, IDC_COLTEXT_OTHERS, CPM_GETCOLOUR, 0, 0); } - //send changes to menuitem + //send changes to mi MenuitemUpdate(!options->bDisable); //enable "Apply" button SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0); @@ -282,7 +282,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hWnd, UINT message, WPARAM wParam, L case PSN_RESET: OptionsRead(); - //maybe something changed with the menuitem + //maybe something changed with the mi MenuitemUpdate(!options->bDisable); break; } -- cgit v1.2.3