diff options
106 files changed, 680 insertions, 1432 deletions
diff --git a/bin10/lib/mir_app.lib b/bin10/lib/mir_app.lib Binary files differindex b0fcc7fc69..9de335094d 100644 --- a/bin10/lib/mir_app.lib +++ b/bin10/lib/mir_app.lib diff --git a/bin10/lib/mir_app64.lib b/bin10/lib/mir_app64.lib Binary files differindex 92c318596d..e1e0681969 100644 --- a/bin10/lib/mir_app64.lib +++ b/bin10/lib/mir_app64.lib diff --git a/bin12/lib/mir_app.lib b/bin12/lib/mir_app.lib Binary files differindex b0fcc7fc69..9de335094d 100644 --- a/bin12/lib/mir_app.lib +++ b/bin12/lib/mir_app.lib diff --git a/bin12/lib/mir_app64.lib b/bin12/lib/mir_app64.lib Binary files differindex 92c318596d..e1e0681969 100644 --- a/bin12/lib/mir_app64.lib +++ b/bin12/lib/mir_app64.lib diff --git a/include/delphi/m_clist.inc b/include/delphi/m_clist.inc index ccd53cca61..cf5df8da4b 100644 --- a/include/delphi/m_clist.inc +++ b/include/delphi/m_clist.inc @@ -121,36 +121,22 @@ const }
MS_CLIST_ADDCONTACTMENUITEM:PAnsiChar = 'CList/AddContactMenuItem';
MS_CLIST_ADDSTATUSMENUITEM :PAnsiChar = 'CList/AddStatusMenuItem';
-//adds a protocol menu item v0.9+
MS_CLIST_ADDPROTOMENUITEM :PAnsiChar = 'CList/AddProtoMenuItem';
- CMIM_NAME = $80000000;
- CMIM_FLAGS = $40000000;
- CMIM_ICON = $20000000;
- CMIM_HOTKEY = $10000000;
- CMIM_ALL = $F0000000;
+{
+ Affect : Modify an existing menu item, see notes
+ Returns: 0 on success, [non zero] on failure
+}
- {
- wParam : HMENUITEM
- lParam : Pointer to a initalised TCLISTMENUITEM
- Affect : Modify an existing menu item, see notes
- Returns: 0 on success, [non zero] on failure
- Notes : hMenuItem will have been returned by MS_CLIST_ADD[MAIN]MENUITEM
- TCLISTMENUITEM.flags should contain CMIM_* constants (see above)
- to mark which fields should be updated, if it's not present, they
- can't be updated -- if flags do not exist for a field it can not
- be updated.
- Version: v0.1.0.1+
- }
- MS_CLIST_MODIFYMENUITEM:PAnsiChar = 'CList/ModifyMenuItem';
+function Menu_ModifyItem(hMenu:HGENMENU; const name:PWideChar; icon:THANDLE=INVALID_HANDLE_VALUE; flags:int=-1) : int; stdcall;
+ external AppDll name 'Menu_ModifyItem';
- {
- wParam : (HGENMENU)hMenuItem
- lParam : (bool) enable = TRUE, disable = FALSE
- Notes : changes menu item's visibility
- Version: v0.94.2+
- }
- MS_CLIST_SHOWHIDEMENUITEM:PAnsiChar = 'CList/ShowHideMenuItem';
+{
+ Notes : changes menu item's visibility
+}
+
+procedure Menu_ShowItem(hMenu:HGENMENU; bShow:BYTE); stdcall;
+ external AppDll name 'Menu_ShowItem';
{
wParam : TMCONTACT
@@ -160,6 +146,7 @@ const to the contact that has them
Version: v0.1.0.1+
}
+const
ME_CLIST_PREBUILDCONTACTMENU:PAnsiChar = 'CList/PreBuildContactMenu';
type
diff --git a/include/m_clist.h b/include/m_clist.h index a6c7f06483..049d37a7f1 100644 --- a/include/m_clist.h +++ b/include/m_clist.h @@ -173,32 +173,16 @@ __forceinline HGENMENU Menu_AddProtoMenuItem(CLISTMENUITEM *mi) return (HGENMENU)CallService("CList/AddProtoMenuItem", 0, (LPARAM)mi);
}
-//modify an existing menu item v0.1.0.1+
-//wParam = (WPARAM)(HGENMENU)hMenuItem
-//lParam = (LPARAM)(CLISTMENUITEM*)&clmi
-//returns 0 on success, nonzero on failure
-//hMenuItem will have been returned by clist/add*menuItem
-//clmi.flags should contain cmim_ constants below specifying which fields to
-//update. Fields without a mask flag cannot be changed and will be ignored
-#define CMIM_NAME 0x80000000
-#define CMIM_FLAGS 0x40000000
-#define CMIM_ICON 0x20000000
-#define CMIM_HOTKEY 0x10000000
-#define CMIM_ALL 0xF0000000
-#define MS_CLIST_MODIFYMENUITEM "CList/ModifyMenuItem"
-
-__forceinline void Menu_ModifyItem(HGENMENU hMenuItem, CLISTMENUITEM *clmi)
-{ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuItem, (LPARAM)clmi);
-}
+/////////////////////////////////////////////////////////////////////////////////////////
+// modify an existing menu item
+// returns 0 on success, nonzero on failure
-//changes menu item's visibility v0.94.2+
-//wParam = (WPARAM)(HGENMENU)hMenuItem
-//lParam = (BOOL) enable = TRUE, disable = FALSE
-#define MS_CLIST_SHOWHIDEMENUITEM "CList/ShowHideMenuItem"
+EXTERN_C MIR_APP_DLL(int) Menu_ModifyItem(HGENMENU hMenuItem, const TCHAR *ptszName, HANDLE hIcon = INVALID_HANDLE_VALUE, int iFlags = -1);
-__forceinline void Menu_ShowItem(HGENMENU hMenuItem, BOOL bShow)
-{ CallService(MS_CLIST_SHOWHIDEMENUITEM, (WPARAM)hMenuItem, bShow);
-}
+/////////////////////////////////////////////////////////////////////////////////////////
+// changes menu item's visibility
+
+EXTERN_C MIR_APP_DLL(void) Menu_ShowItem(HGENMENU hMenuItem, bool bShow);
//the context menu for a contact is about to be built v0.1.0.1+
//wParam = (MCONTACT)hContact
diff --git a/include/m_genmenu.h b/include/m_genmenu.h index 55ba8115ee..2b29a4bb51 100644 --- a/include/m_genmenu.h +++ b/include/m_genmenu.h @@ -265,11 +265,6 @@ typedef struct //Useful to get and free ownerdata before delete menu item.
#define MO_MENUITEMGETOWNERDATA "MO/MenuItemGetOwnerData"
-//wparam MenuItemHandle
-//lparam PMO_MenuItem
-//returns 0 on success,-1 on failure
-#define MO_MODIFYMENUITEM "MO/ModifyMenuItem"
-
//wparam=MenuItemHandle
//lparam=PMO_MenuItem
//returns 0 and filled PMO_MenuItem structure on success and
diff --git a/plugins/Alarms/src/frame.cpp b/plugins/Alarms/src/frame.cpp index e3ff863496..c82ce4e96c 100644 --- a/plugins/Alarms/src/frame.cpp +++ b/plugins/Alarms/src/frame.cpp @@ -448,20 +448,13 @@ int ReloadFont(WPARAM, LPARAM) void FixMainMenu()
{
- CLISTMENUITEM mi = { 0 };
if (!ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) {
if (options.hide_with_clist || options.auto_showhide)
- mi.flags = CMIM_FLAGS | CMIF_GRAYED;
- else {
- mi.flags = CMIM_NAME | CMIM_FLAGS;
-
- if (ReminderFrameVisible())
- mi.pszName = Translate("Hide reminders");
- else
- mi.pszName = Translate("Show reminders");
- }
+ Menu_ModifyItem(hMenuShowReminders, NULL, INVALID_HANDLE_VALUE, CMIF_GRAYED);
+ else
+ Menu_ModifyItem(hMenuShowReminders,
+ ReminderFrameVisible() ? LPGENT("Hide reminders") : LPGENT("Show reminders"), INVALID_HANDLE_VALUE, 0);
}
- Menu_ModifyItem(hMenuShowReminders, &mi);
}
/////////////////////////
@@ -549,7 +542,6 @@ int CreateFrame() CreateServiceFunction(MODULE "/ShowHideReminders", ShowHideMenuFunc);
CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_ALL;
mi.hIcon = hIconMenuShowHide;
mi.pszName = LPGEN("Show reminders");
mi.pszService = MODULE "/ShowHideReminders";
diff --git a/plugins/Alarms/src/options.cpp b/plugins/Alarms/src/options.cpp index 58106e397e..b4fbbc4f18 100644 --- a/plugins/Alarms/src/options.cpp +++ b/plugins/Alarms/src/options.cpp @@ -693,7 +693,6 @@ void AddMenuItem() if (hMainMenuItem) return;
CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_ALL;
mi.icolibItem = IcoLib_GetIconHandle("alarms_menu_set");
mi.pszName = "Set alarm";
mi.pszService = MODULE "/NewAlarm";
diff --git a/plugins/AuthState/src/main.cpp b/plugins/AuthState/src/main.cpp index 86e775bc9c..85636cc2f4 100644 --- a/plugins/AuthState/src/main.cpp +++ b/plugins/AuthState/src/main.cpp @@ -144,13 +144,10 @@ int onPrebuildContactMenu(WPARAM hContact, LPARAM) if (!proto)
return 0;
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIF_TCHAR | CMIM_NAME;
if (db_get_b((MCONTACT)hContact, "AuthState", "ShowIcons", 1))
- mi.ptszName = LPGENT("Disable AuthState icons");
+ Menu_ModifyItem(hUserMenu, LPGENT("Disable AuthState icons"));
else
- mi.ptszName = LPGENT("Enable AuthState icons");
- Menu_ModifyItem(hUserMenu, &mi);
+ Menu_ModifyItem(hUserMenu, LPGENT("Enable AuthState icons"));
Menu_ShowItem(hUserMenu, db_get_b((MCONTACT)hContact, proto, "Auth", 0) || db_get_b((MCONTACT)hContact, proto, "Grant", 0) || !db_get_dw((MCONTACT)hContact, proto, "ServerId", 0));
return 0;
diff --git a/plugins/AutoShutdown/src/settingsdlg.cpp b/plugins/AutoShutdown/src/settingsdlg.cpp index c512924897..8d22bc2956 100644 --- a/plugins/AutoShutdown/src/settingsdlg.cpp +++ b/plugins/AutoShutdown/src/settingsdlg.cpp @@ -450,19 +450,17 @@ void SetShutdownMenuItem(bool fActive) }
mi.pszService = "AutoShutdown/MenuCommand";
mi.flags = CMIF_TCHAR;
- if (hMainMenuItem != NULL) {
- mi.flags |= CMIM_NAME | CMIM_ICON;
- Menu_ModifyItem(hMainMenuItem, &mi);
- }
- else hMainMenuItem = Menu_AddMainMenuItem(&mi);
+ if (hMainMenuItem != NULL)
+ Menu_ModifyItem(hMainMenuItem, mi.ptszName, mi.icolibItem);
+ else
+ hMainMenuItem = Menu_AddMainMenuItem(&mi);
/* tray menu */
mi.position = 899999;
- if (hTrayMenuItem != NULL) {
- mi.flags |= CMIM_NAME | CMIM_ICON;
- Menu_ModifyItem(hTrayMenuItem, &mi);
- }
- else hTrayMenuItem = Menu_AddTrayMenuItem(&mi);
+ if (hTrayMenuItem != NULL)
+ Menu_ModifyItem(hTrayMenuItem, mi.ptszName, mi.icolibItem);
+ else
+ hTrayMenuItem = Menu_AddTrayMenuItem(&mi);
}
static INT_PTR MenuItemCommand(WPARAM,LPARAM)
diff --git a/plugins/AvatarHistory/src/icolib.cpp b/plugins/AvatarHistory/src/icolib.cpp index 7975c0ff2d..39778ab801 100644 --- a/plugins/AvatarHistory/src/icolib.cpp +++ b/plugins/AvatarHistory/src/icolib.cpp @@ -24,11 +24,9 @@ static void ReleaseIconEx(HICON hIcon) static void IcoLibUpdateMenus()
{
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_FLAGS | CMIM_ICON;
- mi.hIcon = createDefaultOverlayedIcon(FALSE);
- Menu_ModifyItem(hMenu, &mi);
- DestroyIcon(mi.hIcon);
+ HICON hIcon = createDefaultOverlayedIcon(FALSE);
+ Menu_ModifyItem(hMenu, 0, hIcon, 0);
+ DestroyIcon(hIcon);
}
int IcoLibIconsChanged(WPARAM, LPARAM)
diff --git a/plugins/BasicHistory/src/BasicHistory.cpp b/plugins/BasicHistory/src/BasicHistory.cpp index 4da30e3d49..0bb43e1036 100644 --- a/plugins/BasicHistory/src/BasicHistory.cpp +++ b/plugins/BasicHistory/src/BasicHistory.cpp @@ -119,8 +119,8 @@ void InitMenuItems() void InitTaskMenuItems()
{
if (Options::instance->taskOptions.size() > 0) {
- CLISTMENUITEM mi = { 0 };
if (hTaskMainMenu == NULL) {
+ CLISTMENUITEM mi = { 0 };
mi.position = 500060005;
mi.flags = CMIF_ROOTPOPUP;
mi.icolibItem = Skin_GetIconHandle(SKINICON_OTHER_HISTORY);
@@ -130,24 +130,15 @@ void InitTaskMenuItems() std::vector<TaskOptions>::iterator taskIt = Options::instance->taskOptions.begin();
std::vector<HGENMENU>::iterator it = taskMenus.begin();
- for (; it != taskMenus.end() && taskIt != Options::instance->taskOptions.end(); ++it, ++taskIt) {
- memset(&mi, 0, sizeof(mi));
- mi.flags = CMIM_FLAGS | CMIM_NAME | CMIF_CHILDPOPUP | CMIF_ROOTHANDLE | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED;
- mi.hParentMenu = hTaskMainMenu;
- mi.ptszName = (TCHAR*)taskIt->taskName.c_str();
- Menu_ModifyItem((HGENMENU)*it, &mi);
- }
+ for (; it != taskMenus.end() && taskIt != Options::instance->taskOptions.end(); ++it, ++taskIt)
+ Menu_ModifyItem(*it, taskIt->taskName.c_str());
- for (; it != taskMenus.end(); ++it) {
- memset(&mi, 0, sizeof(mi));
- mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP | CMIF_ROOTHANDLE | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED | CMIF_HIDDEN;
- mi.hParentMenu = hTaskMainMenu;
- Menu_ModifyItem((HGENMENU)*it, &mi);
- }
+ for (; it != taskMenus.end(); ++it)
+ Menu_ShowItem(*it, false);
int pos = (int)taskMenus.size();
for (; taskIt != Options::instance->taskOptions.end(); ++taskIt) {
- memset(&mi, 0, sizeof(mi));
+ CLISTMENUITEM mi = { 0 };
mi.flags = CMIF_CHILDPOPUP | CMIF_ROOTHANDLE | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED;
mi.pszService = MS_HISTORY_EXECUTE_TASK;
mi.hParentMenu = hTaskMainMenu;
@@ -157,11 +148,8 @@ void InitTaskMenuItems() taskMenus.push_back(menu);
}
}
- else if (hTaskMainMenu != NULL) {
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_FLAGS | CMIF_ROOTPOPUP | CMIF_HIDDEN;
- Menu_ModifyItem(hTaskMainMenu, &mi);
- }
+ else if (hTaskMainMenu != NULL)
+ Menu_ShowItem(hTaskMainMenu, false);
}
IconItem iconList[] =
diff --git a/plugins/Boltun/src/boltun.cpp b/plugins/Boltun/src/boltun.cpp index 381b057440..bf3ea229f1 100644 --- a/plugins/Boltun/src/boltun.cpp +++ b/plugins/Boltun/src/boltun.cpp @@ -545,25 +545,20 @@ static INT_PTR ContactClickStartChatting(WPARAM hContact, LPARAM) static int MessagePrebuild(WPARAM hContact, LPARAM)
{
- CLISTMENUITEM clmi = { 0 };
-
if (!blInit || (db_get_b(hContact, "CList", "NotOnList", 0) == 1)) {
- clmi.flags = CMIM_FLAGS | CMIF_GRAYED;
-
- Menu_ModifyItem(hMenuItemAutoChat, &clmi);
- Menu_ModifyItem(hMenuItemNotToChat, &clmi);
+ Menu_ModifyItem(hMenuItemAutoChat, NULL, INVALID_HANDLE_VALUE, CMIF_GRAYED);
+ Menu_ModifyItem(hMenuItemNotToChat, NULL, INVALID_HANDLE_VALUE, CMIF_GRAYED);
}
else {
- BOOL boltunautochat = db_get_b(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_AUTO_CHAT, FALSE);
- BOOL boltunnottochat = db_get_b(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_NOT_TO_CHAT, FALSE);
-
- clmi.flags = CMIM_FLAGS | CMIM_ICON | (boltunautochat ? CMIF_CHECKED : 0);
- clmi.hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE((boltunautochat ? IDI_TICK : IDI_NOTICK)));
- Menu_ModifyItem(hMenuItemAutoChat, &clmi);
+ if (db_get_b(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_AUTO_CHAT, FALSE))
+ Menu_ModifyItem(hMenuItemAutoChat, NULL, Skin_LoadIcon(SKINICON_OTHER_TICK), CMIF_CHECKED);
+ else
+ Menu_ModifyItem(hMenuItemAutoChat, NULL, Skin_LoadIcon(SKINICON_OTHER_NOTICK), 0);
- clmi.flags = CMIM_FLAGS | CMIM_ICON | (boltunnottochat ? CMIF_CHECKED : 0);
- clmi.hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE((boltunnottochat ? IDI_TICK : IDI_NOTICK)));
- Menu_ModifyItem(hMenuItemNotToChat, &clmi);
+ if (db_get_b(hContact, BOLTUN_KEY, DB_CONTACT_BOLTUN_NOT_TO_CHAT, FALSE))
+ Menu_ModifyItem(hMenuItemNotToChat, NULL, Skin_LoadIcon(SKINICON_OTHER_TICK), CMIF_CHECKED);
+ else
+ Menu_ModifyItem(hMenuItemNotToChat, NULL, Skin_LoadIcon(SKINICON_OTHER_NOTICK), 0);
}
return 0;
}
diff --git a/plugins/Boltun/src/stdafx.h b/plugins/Boltun/src/stdafx.h index 2199be3cac..06ca9c2e2e 100644 --- a/plugins/Boltun/src/stdafx.h +++ b/plugins/Boltun/src/stdafx.h @@ -35,6 +35,7 @@ #include "m_database.h"
#include "m_options.h"
#include "m_langpack.h"
+#include "m_skin.h"
#include "resource.h"
#include "version.h"
diff --git a/plugins/BossKeyPlus/src/BossKey.cpp b/plugins/BossKeyPlus/src/BossKey.cpp index 096bb7060d..27081d9c64 100644 --- a/plugins/BossKeyPlus/src/BossKey.cpp +++ b/plugins/BossKeyPlus/src/BossKey.cpp @@ -521,14 +521,9 @@ static IconItem iconList[] = static int GenMenuInit(WPARAM, LPARAM) // Modify menu item text before to show the main menu
{
if (g_hMenuItem) {
- TCHAR buf[128] = { 0 };
+ TCHAR buf[128];
mir_sntprintf(buf, _T("%s [%s]"), TranslateT("Hide"), GetBossKeyText());
-
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_FLAGS | CMIF_TCHAR | CMIM_NAME;
- mi.ptszName = buf;
-
- Menu_ModifyItem(g_hMenuItem, &mi);
+ Menu_ModifyItem(g_hMenuItem, buf);
}
return 0;
}
@@ -541,7 +536,6 @@ void BossKeyMenuItemInit(void) // Add menu item mi.hIcon = IcoLib_GetIcon("hidemim");
mi.ptszName = LPGENT("Hide");
mi.pszService = MS_BOSSKEY_HIDE;
-
g_hMenuItem = Menu_AddMainMenuItem(&mi);
HookEvent(ME_CLIST_PREBUILDMAINMENU, GenMenuInit);
diff --git a/plugins/BuddyExpectator/src/BuddyExpectator.cpp b/plugins/BuddyExpectator/src/BuddyExpectator.cpp index be0812a19e..fa71165748 100644 --- a/plugins/BuddyExpectator/src/BuddyExpectator.cpp +++ b/plugins/BuddyExpectator/src/BuddyExpectator.cpp @@ -438,17 +438,11 @@ int onPrebuildContactMenu(WPARAM hContact, LPARAM) if (!proto)
return 0;
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_ICON | CMIM_NAME | CMIF_TCHAR;
- if (db_get_b(hContact, MODULE_NAME, "MissYou", 0)) {
- mi.ptszName = LPGENT("Disable Miss You");
- mi.icolibItem = iconList[1].hIcolib;
- }
- else {
- mi.ptszName = LPGENT("Enable Miss You");
- mi.icolibItem = iconList[2].hIcolib;
- }
- Menu_ModifyItem(hContactMenu, &mi);
+ if (db_get_b(hContact, MODULE_NAME, "MissYou", 0))
+ Menu_ModifyItem(hContactMenu, LPGENT("Disable Miss You"), iconList[1].hIcolib);
+ else
+ Menu_ModifyItem(hContactMenu, LPGENT("Enable Miss You"), iconList[2].hIcolib);
+
Menu_ShowItem(hContactMenu, !db_get_b(hContact, proto, "ChatRoom", 0) && (CallProtoService(proto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND));
return 0;
}
diff --git a/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp b/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp index 7bbccfe061..5db1b10683 100644 --- a/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp +++ b/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp @@ -275,18 +275,10 @@ static int PrebuildMainMenu(WPARAM wParam, LPARAM lParam) {
// we have to use ME_CLIST_PREBUILDMAINMENU instead of updating menu items only on settings change, because "popup_enabled" and "popup_disabled" icons are not always available yet in ModulesLoaded
if (bPopupExists) {
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIF_TCHAR | CMIM_NAME | CMIM_ICON;
- if (g_PopupOptPage.GetDBValueCopy(IDC_POPUPOPTDLG_POPUPNOTIFY)) {
- mi.ptszName = LPGENT("Disable c&lient change notification");
- mi.hIcon = IcoLib_GetIcon("popup_enabled");
- }
- else {
- mi.ptszName = LPGENT("Enable c&lient change notification");
- mi.hIcon = IcoLib_GetIcon("popup_disabled");
- }
- mi.ptszPopupName = LPGENT("Popups");
- Menu_ModifyItem(g_hTogglePopupsMenuItem, &mi);
+ if (g_PopupOptPage.GetDBValueCopy(IDC_POPUPOPTDLG_POPUPNOTIFY))
+ Menu_ModifyItem(g_hTogglePopupsMenuItem, LPGENT("Disable c&lient change notification"), IcoLib_GetIcon("popup_enabled"));
+ else
+ Menu_ModifyItem(g_hTogglePopupsMenuItem, LPGENT("Enable c&lient change notification"), IcoLib_GetIcon("popup_disabled"));
}
return 0;
}
diff --git a/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp index 2d1b9bf74a..df9afbc0ab 100644 --- a/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp +++ b/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp @@ -885,14 +885,6 @@ static HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popupp return 0;
}
-static int ModifyMItem(WPARAM wParam, LPARAM lParam)
-{
- if ((int)wParam == -1) return 0; // FIXME
-
- return CallService(MS_CLIST_MODIFYMENUITEM, wParam, lParam);
-};
-
-
static int CLUIFramesModifyContextMenuForFrame(WPARAM wParam, LPARAM)
{
/* HOOK */
@@ -900,45 +892,26 @@ static int CLUIFramesModifyContextMenuForFrame(WPARAM wParam, LPARAM) if (_fCluiFramesModuleNotStarted) return -1;
int pos = id2pos(wParam);
if (pos >= 0 && pos < g_nFramesCount) {
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_FLAGS | CMIM_NAME | CMIF_CHILDPOPUP | CMIF_TCHAR;
- if (g_pfwFrames[pos].visible) mi.flags |= CMIF_CHECKED;
- mi.ptszName = g_pfwFrames[pos].TitleBar.tbname ? g_pfwFrames[pos].TitleBar.tbname : g_pfwFrames[pos].name;
- ModifyMItem((WPARAM)_hmiVisible, (LPARAM)&mi);
-
- mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP;
- if (g_pfwFrames[pos].Locked) mi.flags |= CMIF_CHECKED;
- ModifyMItem((WPARAM)_hmiLock, (LPARAM)&mi);
-
- mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP;
- if (g_pfwFrames[pos].TitleBar.ShowTitleBar) mi.flags |= CMIF_CHECKED;
- ModifyMItem((WPARAM)_hmiTBVisible, (LPARAM)&mi);
-
- mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP;
- if (g_pfwFrames[pos].floating) mi.flags |= CMIF_CHECKED;
- ModifyMItem((WPARAM)_hmiFloating, (LPARAM)&mi);
-
- mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP;
- if (g_CluiData.fLayered) mi.flags |= CMIF_GRAYED;
- else if ((g_pfwFrames[pos].UseBorder)) mi.flags |= CMIF_CHECKED;
- ModifyMItem((WPARAM)_hmiBorder, (LPARAM)&mi);
-
- mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP;
- if (g_pfwFrames[pos].align&alTop) mi.flags |= CMIF_CHECKED;
- ModifyMItem((WPARAM)_hmiAlignTop, (LPARAM)&mi);
-
- mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP;
- if (g_pfwFrames[pos].align&alClient) mi.flags |= CMIF_CHECKED;
- ModifyMItem((WPARAM)_hmiAlignClient, (LPARAM)&mi);
-
- mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP;
- if (g_pfwFrames[pos].align&alBottom) mi.flags |= CMIF_CHECKED;
- ModifyMItem((WPARAM)_hmiAlignBottom, (LPARAM)&mi);
-
- mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP;
- if (g_pfwFrames[pos].collapsed) mi.flags |= CMIF_CHECKED;
- if ((!g_pfwFrames[pos].visible) || (g_pfwFrames[pos].Locked) || (pos == CLUIFramesGetalClientFrame())) mi.flags |= CMIF_GRAYED;
- ModifyMItem((WPARAM)_hmiColl, (LPARAM)&mi);
+ FRAMEWND &p = g_pfwFrames[pos];
+
+ Menu_ModifyItem(_hmiVisible, p.TitleBar.tbname ? p.TitleBar.tbname : p.name, INVALID_HANDLE_VALUE, CMIF_CHILDPOPUP + (p.visible) ? CMIF_CHECKED : 0);
+ Menu_ModifyItem(_hmiLock, NULL, INVALID_HANDLE_VALUE, CMIF_CHILDPOPUP + (p.Locked) ? CMIF_CHECKED : 0);
+ Menu_ModifyItem(_hmiTBVisible, NULL, INVALID_HANDLE_VALUE, CMIF_CHILDPOPUP + (p.TitleBar.ShowTitleBar) ? CMIF_CHECKED : 0);
+ Menu_ModifyItem(_hmiFloating, NULL, INVALID_HANDLE_VALUE, CMIF_CHILDPOPUP + (p.floating) ? CMIF_CHECKED : 0);
+
+ int flags = CMIF_CHILDPOPUP;
+ if (g_CluiData.fLayered) flags += CMIF_GRAYED;
+ else if ((p.UseBorder)) flags += CMIF_CHECKED;
+ Menu_ModifyItem(_hmiBorder, NULL, INVALID_HANDLE_VALUE, flags);
+
+ Menu_ModifyItem(_hmiAlignTop, NULL, INVALID_HANDLE_VALUE, CMIF_CHILDPOPUP + (p.align&alTop) ? CMIF_CHECKED : 0);
+ Menu_ModifyItem(_hmiAlignClient, NULL, INVALID_HANDLE_VALUE, CMIF_CHILDPOPUP + (p.align&alClient) ? CMIF_CHECKED : 0);
+ Menu_ModifyItem(_hmiAlignBottom, NULL, INVALID_HANDLE_VALUE, CMIF_CHILDPOPUP + (p.align&alBottom) ? CMIF_CHECKED : 0);
+
+ flags = CMIF_CHILDPOPUP;
+ if (p.collapsed) flags += CMIF_CHECKED;
+ if ((!p.visible) || (p.Locked) || (pos == CLUIFramesGetalClientFrame())) flags += CMIF_GRAYED;
+ Menu_ModifyItem(_hmiColl, NULL, INVALID_HANDLE_VALUE, flags);
}
return 0;
}
@@ -946,51 +919,29 @@ static int CLUIFramesModifyContextMenuForFrame(WPARAM wParam, LPARAM) static int CLUIFramesModifyMainMenuItems(WPARAM wParam, LPARAM)
{
//hiword(wParam) = frameid,loword(wParam) = flag
- if (_fCluiFramesModuleNotStarted) return -1;
+ if (_fCluiFramesModuleNotStarted)
+ return -1;
int pos = id2pos(wParam);
-
if (pos >= 0 && pos < g_nFramesCount) {
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_FLAGS | CMIM_NAME | CMIF_CHILDPOPUP | CMIF_TCHAR;
- if (g_pfwFrames[pos].visible) mi.flags |= CMIF_CHECKED;
- mi.ptszName = g_pfwFrames[pos].TitleBar.tbname ? g_pfwFrames[pos].TitleBar.tbname : g_pfwFrames[pos].name;
- Menu_ModifyItem(g_pfwFrames[pos].MenuHandles.MIVisible, &mi);
-
- mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP;
- if (g_pfwFrames[pos].Locked) mi.flags |= CMIF_CHECKED;
- Menu_ModifyItem(g_pfwFrames[pos].MenuHandles.MILock, &mi);
-
- mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP;
- if (g_pfwFrames[pos].TitleBar.ShowTitleBar) mi.flags |= CMIF_CHECKED;
- Menu_ModifyItem(g_pfwFrames[pos].MenuHandles.MITBVisible, &mi);
-
- mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP;
- if (g_pfwFrames[pos].floating) mi.flags |= CMIF_CHECKED;
- Menu_ModifyItem(g_pfwFrames[pos].MenuHandles.MIFloating, &mi);
-
- mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP;
-
- if (g_CluiData.fLayered) mi.flags |= CMIF_GRAYED;
- else if ((g_pfwFrames[pos].UseBorder)) mi.flags |= CMIF_CHECKED;
- Menu_ModifyItem(g_pfwFrames[pos].MenuHandles.MIBorder, &mi);
-
- mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP | ((g_pfwFrames[pos].align&alClient) ? CMIF_GRAYED : 0);
- if (g_pfwFrames[pos].align&alTop) mi.flags |= CMIF_CHECKED;
- Menu_ModifyItem(g_pfwFrames[pos].MenuHandles.MIAlignTop, &mi);
-
- mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP;
- if (g_pfwFrames[pos].align&alClient) mi.flags |= CMIF_CHECKED;
- Menu_ModifyItem(g_pfwFrames[pos].MenuHandles.MIAlignClient, &mi);
-
- mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP | ((g_pfwFrames[pos].align&alClient) ? CMIF_GRAYED : 0);
- if (g_pfwFrames[pos].align&alBottom) mi.flags |= CMIF_CHECKED;
- Menu_ModifyItem(g_pfwFrames[pos].MenuHandles.MIAlignBottom, &mi);
-
- mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP;
- if (g_pfwFrames[pos].collapsed) mi.flags |= CMIF_CHECKED;
- if ((!g_pfwFrames[pos].visible) || g_pfwFrames[pos].Locked || (pos == CLUIFramesGetalClientFrame())) mi.flags |= CMIF_GRAYED;
- Menu_ModifyItem(g_pfwFrames[pos].MenuHandles.MIColl, &mi);
+ FRAMEWND &p = g_pfwFrames[pos];
+
+ Menu_ModifyItem(p.MenuHandles.MIVisible, p.TitleBar.tbname ? p.TitleBar.tbname : p.name, INVALID_HANDLE_VALUE, CMIF_CHILDPOPUP + (p.visible) ? CMIF_CHECKED : 0);
+ Menu_ModifyItem(p.MenuHandles.MILock, NULL, INVALID_HANDLE_VALUE, CMIF_CHILDPOPUP + (p.Locked) ? CMIF_CHECKED : 0);
+ Menu_ModifyItem(p.MenuHandles.MITBVisible, NULL, INVALID_HANDLE_VALUE, CMIF_CHILDPOPUP + (p.TitleBar.ShowTitleBar) ? CMIF_CHECKED : 0);
+ Menu_ModifyItem(p.MenuHandles.MIFloating, NULL, INVALID_HANDLE_VALUE, CMIF_CHILDPOPUP + (p.floating) ? CMIF_CHECKED : 0);
+
+ int flags = CMIF_CHILDPOPUP;
+ if (g_CluiData.fLayered) flags += CMIF_GRAYED;
+ else if (p.UseBorder) flags += CMIF_CHECKED;
+ Menu_ModifyItem(p.MenuHandles.MIBorder, NULL, INVALID_HANDLE_VALUE, flags);
+
+ Menu_ModifyItem(p.MenuHandles.MIAlignTop, NULL, INVALID_HANDLE_VALUE, CMIF_CHILDPOPUP + ((p.align & alClient) ? CMIF_GRAYED : 0) + (p.align & alTop) ? CMIF_CHECKED : 0);
+ Menu_ModifyItem(p.MenuHandles.MIAlignClient, NULL, INVALID_HANDLE_VALUE, CMIF_CHILDPOPUP + (p.align & alClient) ? CMIF_CHECKED : 0);
+ Menu_ModifyItem(p.MenuHandles.MIAlignBottom, NULL, INVALID_HANDLE_VALUE, CMIF_CHILDPOPUP + ((p.align & alClient) ? CMIF_GRAYED : 0) + (p.align & alBottom) ? CMIF_CHECKED : 0);
+
+ flags = CMIF_CHILDPOPUP + (p.collapsed) ? CMIF_CHECKED : 0 + ((!p.visible) || p.Locked || (pos == CLUIFramesGetalClientFrame())) ? CMIF_GRAYED : 0;
+ Menu_ModifyItem(p.MenuHandles.MIColl, NULL, INVALID_HANDLE_VALUE, flags);
}
return 0;
diff --git a/plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp b/plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp index 276448b477..fd4d0f60db 100644 --- a/plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp +++ b/plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp @@ -192,18 +192,17 @@ static int OnBuildGroupMenu(WPARAM, LPARAM) {
if (MirandaExiting()) return 0;
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_FLAGS | (db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) ? CMIF_CHECKED : 0);
- Menu_ModifyItem(hHideOfflineUsersMenuItem, &mi);
+ int flags = db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) ? CMIF_CHECKED : 0;
+ Menu_ModifyItem(hHideOfflineUsersMenuItem, NULL, INVALID_HANDLE_VALUE, flags);
- mi.flags = CMIM_FLAGS | (SendMessage(pcli->hwndContactTree, CLM_GETHIDEOFFLINEROOT, 0, 0) ? CMIF_CHECKED : 0);
- Menu_ModifyItem(hHideOfflineUsersOutHereMenuItem, &mi);
+ flags = SendMessage(pcli->hwndContactTree, CLM_GETHIDEOFFLINEROOT, 0, 0) ? CMIF_CHECKED : 0;
+ Menu_ModifyItem(hHideOfflineUsersOutHereMenuItem, NULL, INVALID_HANDLE_VALUE, flags);
- mi.flags = CMIM_FLAGS | (GetWindowLongPtr(pcli->hwndContactTree, GWL_STYLE)&CLS_HIDEEMPTYGROUPS ? CMIF_CHECKED : 0);
- Menu_ModifyItem(hHideEmptyGroupsMenuItem, &mi);
+ flags = GetWindowLongPtr(pcli->hwndContactTree, GWL_STYLE) & CLS_HIDEEMPTYGROUPS ? CMIF_CHECKED : 0;
+ Menu_ModifyItem(hHideEmptyGroupsMenuItem, NULL, INVALID_HANDLE_VALUE, flags);
- mi.flags = CMIM_FLAGS | (GetWindowLongPtr(pcli->hwndContactTree, GWL_STYLE)&CLS_USEGROUPS ? 0 : CMIF_CHECKED);
- Menu_ModifyItem(hDisableGroupsMenuItem, &mi);
+ flags = GetWindowLongPtr(pcli->hwndContactTree, GWL_STYLE) & CLS_USEGROUPS ? 0 : CMIF_CHECKED;
+ Menu_ModifyItem(hDisableGroupsMenuItem, NULL, INVALID_HANDLE_VALUE, flags);
return 0;
}
@@ -348,12 +347,11 @@ static int OnBuildSubGroupMenu(WPARAM wParam, LPARAM) if (gray1 && gray2) gray1 = FALSE; //should not be cause CLCItems_IsShowOfflineGroup return false if group->hideOffline
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_FLAGS | ((group->hideOffline && !gray1) ? CMIF_CHECKED : 0) | (gray1 ? CMIF_GRAYED : 0);
- Menu_ModifyItem(hHideOfflineUsersHereMenuItem, &mi);
+ int flags = ((group->hideOffline && !gray1) ? CMIF_CHECKED : 0) | (gray1 ? CMIF_GRAYED : 0);
+ Menu_ModifyItem(hHideOfflineUsersHereMenuItem, NULL, INVALID_HANDLE_VALUE, flags);
- mi.flags = CMIM_FLAGS | ((showOfflineinGroup && !gray2) ? CMIF_CHECKED : 0) | (gray2 ? CMIF_GRAYED : 0);
- Menu_ModifyItem(hShowOfflineUsersHereMenuItem, &mi);
+ flags = ((showOfflineinGroup && !gray2) ? CMIF_CHECKED : 0) | (gray2 ? CMIF_GRAYED : 0);
+ Menu_ModifyItem(hShowOfflineUsersHereMenuItem, NULL, INVALID_HANDLE_VALUE, flags);
return 0;
}
diff --git a/plugins/Clist_modern/src/modern_clistmenus.cpp b/plugins/Clist_modern/src/modern_clistmenus.cpp index f9d532d532..809bb75508 100644 --- a/plugins/Clist_modern/src/modern_clistmenus.cpp +++ b/plugins/Clist_modern/src/modern_clistmenus.cpp @@ -117,8 +117,7 @@ static int FAV_OnContactMenuBuild(WPARAM hContact, LPARAM) if (!hFavoriteContactMenu)
hFavoriteContactMenu = Menu_AddContactMenuItem(&mi);
else {
- mi.flags |= CMIM_FLAGS | CMIM_NAME;
- Menu_ModifyItem(hFavoriteContactMenu, &mi);
+ Menu_ModifyItem(hFavoriteContactMenu, mi.ptszName);
bModifyMenu = TRUE;
}
@@ -136,29 +135,29 @@ static int FAV_OnContactMenuBuild(WPARAM hContact, LPARAM) int i;
for (i = 0; i < _countof(rates); i++) {
- mi.icolibItem = iconList[i].hIcolib;
- mi.ptszName = rates[i];
mi.flags = CMIF_CHILDPOPUP | CMIF_TCHAR | ((bContactRate == i) ? CMIF_CHECKED : 0);
- mi.pszService = CLUI_FAVSETRATE;
- mi.popupPosition = i;
- if (bModifyMenu && hFavoriteContactMenuItems[i]) {
- mi.flags |= CMIM_FLAGS | CMIM_ICON;
- Menu_ModifyItem(hFavoriteContactMenuItems[i], &mi);
+ if (bModifyMenu && hFavoriteContactMenuItems[i])
+ Menu_ModifyItem(hFavoriteContactMenuItems[i], NULL, iconList[i].hIcolib, mi.flags);
+ else {
+ mi.icolibItem = iconList[i].hIcolib;
+ mi.ptszName = rates[i];
+ mi.pszService = CLUI_FAVSETRATE;
+ mi.popupPosition = i;
+ hFavoriteContactMenuItems[i] = Menu_AddContactMenuItem(&mi);
}
- else hFavoriteContactMenuItems[i] = Menu_AddContactMenuItem(&mi);
}
mi.hIcon = NULL;
- mi.ptszName = LPGENT("Show even if offline");
mi.flags = CMIF_CHILDPOPUP | CMIF_TCHAR | (db_get_b(hContact, "CList", "noOffline", 0) ? CMIF_CHECKED : 0);
- mi.pszService = CLUI_FAVTOGGLESHOWOFFLINE;
- mi.popupPosition = i + 100000000;
- mi.position = -100000000;
- if (bModifyMenu && hShowIfOflineItem) {
- mi.flags |= CMIM_FLAGS | CMIM_ICON;
- Menu_ModifyItem(hShowIfOflineItem, &mi);
+ if (bModifyMenu && hShowIfOflineItem)
+ Menu_ModifyItem(hShowIfOflineItem, NULL, INVALID_HANDLE_VALUE, mi.flags);
+ else {
+ mi.pszService = CLUI_FAVTOGGLESHOWOFFLINE;
+ mi.popupPosition = i + 100000000;
+ mi.position = -100000000;
+ mi.ptszName = LPGENT("Show even if offline");
+ hShowIfOflineItem = Menu_AddContactMenuItem(&mi);
}
- else hShowIfOflineItem = Menu_AddContactMenuItem(&mi);
return 0;
}
diff --git a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp index 9a501b12d6..f511244c27 100644 --- a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp +++ b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp @@ -93,10 +93,10 @@ static int TitleBarH = DEFAULT_TITLEBAR_HEIGHT; static boolean resizing = FALSE; // menus -static HANDLE contMIVisible, contMITitle, contMITBVisible, contMILock, contMIColl, contMIFloating; -static HANDLE contMIAlignRoot; -static HANDLE contMIAlignTop, contMIAlignClient, contMIAlignBottom; -static HANDLE contMIBorder, contMISkinned; +static HGENMENU contMIVisible, contMITitle, contMITBVisible, contMILock, contMIColl, contMIFloating; +static HGENMENU contMIAlignRoot; +static HGENMENU contMIAlignTop, contMIAlignClient, contMIAlignBottom; +static HGENMENU contMIBorder, contMISkinned; static HGENMENU MainMIRoot = (HGENMENU)-1; // others @@ -726,11 +726,6 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid, HGENMENU root, int popuppos, HGE return 0; } -int ModifyMItem(WPARAM wParam, LPARAM lParam) -{ - return CallService(MS_CLIST_MODIFYMENUITEM, wParam, lParam); -} - static int CLUIFramesModifyContextMenuForFrame(WPARAM wParam, LPARAM) { if (FramesSysNotStarted) @@ -739,52 +734,22 @@ static int CLUIFramesModifyContextMenuForFrame(WPARAM wParam, LPARAM) mir_cslock lck(csFrameHook); int pos = id2pos((INT_PTR)wParam); if (pos >= 0 && pos < nFramescount) { - CLISTMENUITEM mi = { 0 }; - mi.flags = CMIM_NAME | CMIF_CHILDPOPUP | CMIF_TCHAR; - mi.ptszName = Frames[pos].TitleBar.tbname ? Frames[pos].TitleBar.tbname : Frames[pos].name; - ModifyMItem((WPARAM)contMITitle, (LPARAM)&mi); - - mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; - if (Frames[pos].visible) mi.flags |= CMIF_CHECKED; - ModifyMItem((WPARAM)contMIVisible, (LPARAM)&mi); - - mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; - if (Frames[pos].Locked) mi.flags |= CMIF_CHECKED; - ModifyMItem((WPARAM)contMILock, (LPARAM)&mi); - - mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; - if (Frames[pos].TitleBar.ShowTitleBar) mi.flags |= CMIF_CHECKED; - ModifyMItem((WPARAM)contMITBVisible, (LPARAM)&mi); - - mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; - if (Frames[pos].floating) mi.flags |= CMIF_CHECKED; - ModifyMItem((WPARAM)contMIFloating, (LPARAM)&mi); - - mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; - if ((Frames[pos].UseBorder)) mi.flags |= CMIF_CHECKED; - ModifyMItem((WPARAM)contMIBorder, (LPARAM)&mi); - - mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; - if ((Frames[pos].Skinned)) mi.flags |= CMIF_CHECKED; - ModifyMItem((WPARAM)contMISkinned, (LPARAM)&mi); - - mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; - if (Frames[pos].align&alTop) mi.flags |= CMIF_CHECKED; - ModifyMItem((WPARAM)contMIAlignTop, (LPARAM)&mi); - - mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; - if (Frames[pos].align&alClient) mi.flags |= CMIF_CHECKED; - ModifyMItem((WPARAM)contMIAlignClient, (LPARAM)&mi); - - mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; - if (Frames[pos].align&alBottom) mi.flags |= CMIF_CHECKED; - ModifyMItem((WPARAM)contMIAlignBottom, (LPARAM)&mi); - - - mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; - if ( !Frames[pos].collapsed) mi.flags |= CMIF_CHECKED; - if ((!Frames[pos].visible) || (Frames[pos].Locked) || (pos == CLUIFramesGetalClientFrame())) mi.flags |= CMIF_GRAYED; - ModifyMItem((WPARAM)contMIColl, (LPARAM)&mi); + FRAMEWND &p = Frames[pos]; + Menu_ModifyItem(contMITitle, p.TitleBar.tbname ? p.TitleBar.tbname : p.name, INVALID_HANDLE_VALUE, CMIF_CHILDPOPUP); + Menu_ModifyItem(contMIVisible, NULL, INVALID_HANDLE_VALUE, CMIF_CHILDPOPUP + (p.visible ? CMIF_CHECKED : 0)); + Menu_ModifyItem(contMILock, NULL, INVALID_HANDLE_VALUE, CMIF_CHILDPOPUP + (p.Locked ? CMIF_CHECKED : 0)); + Menu_ModifyItem(contMITBVisible, NULL, INVALID_HANDLE_VALUE, CMIF_CHILDPOPUP + (p.TitleBar.ShowTitleBar ? CMIF_CHECKED : 0)); + Menu_ModifyItem(contMIFloating, NULL, INVALID_HANDLE_VALUE, CMIF_CHILDPOPUP + (p.floating ? CMIF_CHECKED : 0)); + Menu_ModifyItem(contMIBorder, NULL, INVALID_HANDLE_VALUE, CMIF_CHILDPOPUP + (p.UseBorder ? CMIF_CHECKED : 0)); + Menu_ModifyItem(contMISkinned, NULL, INVALID_HANDLE_VALUE, CMIF_CHILDPOPUP + (p.Skinned ? CMIF_CHECKED : 0)); + Menu_ModifyItem(contMIAlignTop, NULL, INVALID_HANDLE_VALUE, CMIF_CHILDPOPUP + ((p.align & alTop) ? CMIF_CHECKED : 0)); + Menu_ModifyItem(contMIAlignClient, NULL, INVALID_HANDLE_VALUE, CMIF_CHILDPOPUP + ((p.align & alClient) ? CMIF_CHECKED : 0)); + Menu_ModifyItem(contMIAlignBottom, NULL, INVALID_HANDLE_VALUE, CMIF_CHILDPOPUP + ((p.align & alBottom) ? CMIF_CHECKED : 0)); + + int flags = CMIF_CHILDPOPUP + (!p.collapsed ? CMIF_CHECKED : 0); + if ((!p.visible) || (p.Locked) || (pos == CLUIFramesGetalClientFrame())) + flags |= CMIF_GRAYED; + Menu_ModifyItem(contMIColl, NULL, INVALID_HANDLE_VALUE, flags); } return 0; } @@ -798,51 +763,30 @@ INT_PTR CLUIFramesModifyMainMenuItems(WPARAM wParam, LPARAM) int pos = id2pos((INT_PTR)wParam); if (pos >= 0 && pos < nFramescount) { - CLISTMENUITEM mi = { 0 }; - mi.flags = CMIM_NAME | CMIF_CHILDPOPUP | CMIF_TCHAR; - mi.ptszName = Frames[pos].TitleBar.tbname ? Frames[pos].TitleBar.tbname : Frames[pos].name; - Menu_ModifyItem(Frames[pos].MenuHandles.MITitle, &mi); - - mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; - if (Frames[pos].visible) mi.flags |= CMIF_CHECKED; - Menu_ModifyItem(Frames[pos].MenuHandles.MIVisible, &mi); - - mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; - if (Frames[pos].Locked) mi.flags |= CMIF_CHECKED; - Menu_ModifyItem(Frames[pos].MenuHandles.MILock, &mi); - - mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; - if (Frames[pos].TitleBar.ShowTitleBar) mi.flags |= CMIF_CHECKED; - Menu_ModifyItem(Frames[pos].MenuHandles.MITBVisible, &mi); - - mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; - if (Frames[pos].floating) mi.flags |= CMIF_CHECKED; - Menu_ModifyItem(Frames[pos].MenuHandles.MIFloating, &mi); - - mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; - if ((Frames[pos].UseBorder)) mi.flags |= CMIF_CHECKED; - Menu_ModifyItem(Frames[pos].MenuHandles.MIBorder, &mi); - - mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; - if ((Frames[pos].Skinned)) mi.flags |= CMIF_CHECKED; - Menu_ModifyItem(Frames[pos].MenuHandles.MISkinned, &mi); - - mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP | ((Frames[pos].align & alClient) ? CMIF_GRAYED : 0); - if (Frames[pos].align&alTop) mi.flags |= CMIF_CHECKED; - Menu_ModifyItem(Frames[pos].MenuHandles.MIAlignTop, &mi); - - mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; - if (Frames[pos].align&alClient) mi.flags |= CMIF_CHECKED; - Menu_ModifyItem(Frames[pos].MenuHandles.MIAlignClient, &mi); - - mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP | ((Frames[pos].align & alClient) ? CMIF_GRAYED : 0); - if (Frames[pos].align&alBottom) mi.flags |= CMIF_CHECKED; - Menu_ModifyItem(Frames[pos].MenuHandles.MIAlignBottom, &mi); - - mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP; - if ( !Frames[pos].collapsed) mi.flags |= CMIF_CHECKED; - if ((!Frames[pos].visible) || Frames[pos].Locked || (pos == CLUIFramesGetalClientFrame())) mi.flags |= CMIF_GRAYED; - Menu_ModifyItem(Frames[pos].MenuHandles.MIColl, &mi); + FRAMEWND &p = Frames[pos]; + Menu_ModifyItem(p.MenuHandles.MITitle, p.TitleBar.tbname ? p.TitleBar.tbname : p.name, INVALID_HANDLE_VALUE, CMIF_CHILDPOPUP); + + Menu_ModifyItem(p.MenuHandles.MIVisible, NULL, INVALID_HANDLE_VALUE, CMIF_CHILDPOPUP + (p.visible) ? CMIF_CHECKED : 0); + Menu_ModifyItem(p.MenuHandles.MILock, NULL, INVALID_HANDLE_VALUE, CMIF_CHILDPOPUP + (p.Locked) ? CMIF_CHECKED : 0); + Menu_ModifyItem(p.MenuHandles.MITBVisible, NULL, INVALID_HANDLE_VALUE, CMIF_CHILDPOPUP + (p.TitleBar.ShowTitleBar) ? CMIF_CHECKED : 0); + Menu_ModifyItem(p.MenuHandles.MIFloating, NULL, INVALID_HANDLE_VALUE, CMIF_CHILDPOPUP + (p.floating) ? CMIF_CHECKED : 0); + Menu_ModifyItem(p.MenuHandles.MIBorder, NULL, INVALID_HANDLE_VALUE, CMIF_CHILDPOPUP + ((p.UseBorder)) ? CMIF_CHECKED : 0); + Menu_ModifyItem(p.MenuHandles.MISkinned, NULL, INVALID_HANDLE_VALUE, CMIF_CHILDPOPUP + ((p.Skinned)) ? CMIF_CHECKED : 0); + + int flags = CMIF_CHILDPOPUP | ((p.align & alClient) ? CMIF_GRAYED : 0); + if (p.align & alTop) flags |= CMIF_CHECKED; + Menu_ModifyItem(p.MenuHandles.MIAlignTop, NULL, INVALID_HANDLE_VALUE, flags); + + Menu_ModifyItem(p.MenuHandles.MIAlignClient, NULL, INVALID_HANDLE_VALUE, CMIF_CHILDPOPUP + (p.align & alClient) ? CMIF_CHECKED : 0); + + flags = CMIF_CHILDPOPUP | ((p.align & alClient) ? CMIF_GRAYED : 0); + if (p.align & alBottom) flags |= CMIF_CHECKED; + Menu_ModifyItem(p.MenuHandles.MIAlignBottom, NULL, INVALID_HANDLE_VALUE, flags); + + flags = CMIF_CHILDPOPUP; + if ( !p.collapsed) flags |= CMIF_CHECKED; + if ((!p.visible) || p.Locked || (pos == CLUIFramesGetalClientFrame())) flags |= CMIF_GRAYED; + Menu_ModifyItem(p.MenuHandles.MIColl, NULL, INVALID_HANDLE_VALUE, flags); } return 0; } diff --git a/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp b/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp index 8da3711764..279f6c1206 100644 --- a/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp +++ b/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp @@ -199,24 +199,20 @@ INT_PTR HideOfflineRootHelper(WPARAM, LPARAM) static int OnBuildGroupMenu(WPARAM, LPARAM)
{
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_FLAGS | (cfg::getByte("CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) ? CMIF_CHECKED : 0);
- Menu_ModifyItem(hHideOfflineUsersMenuItem, &mi);
-
- mi.flags = CMIM_FLAGS | (SendMessage(pcli->hwndContactTree, CLM_GETHIDEOFFLINEROOT, 0, 0) ? CMIF_CHECKED : 0);
- Menu_ModifyItem(hHideOfflineUsersOutHereMenuItem, &mi);
+ int flags = (cfg::getByte("CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT) ? CMIF_CHECKED : 0);
+ Menu_ModifyItem(hHideOfflineUsersMenuItem, NULL, INVALID_HANDLE_VALUE, flags);
- mi.flags = CMIM_FLAGS | (GetWindowLongPtr(pcli->hwndContactTree, GWL_STYLE) & CLS_HIDEEMPTYGROUPS ? CMIF_CHECKED : 0);
- Menu_ModifyItem(hHideEmptyGroupsMenuItem, &mi);
+ flags = (SendMessage(pcli->hwndContactTree, CLM_GETHIDEOFFLINEROOT, 0, 0) ? CMIF_CHECKED : 0);
+ Menu_ModifyItem(hHideOfflineUsersOutHereMenuItem, NULL, INVALID_HANDLE_VALUE, flags);
- mi.flags = CMIM_FLAGS | (GetWindowLongPtr(pcli->hwndContactTree, GWL_STYLE) & CLS_USEGROUPS ? 0 : CMIF_CHECKED);
- Menu_ModifyItem(hDisableGroupsMenuItem, &mi);
+ flags = (GetWindowLongPtr(pcli->hwndContactTree, GWL_STYLE) & CLS_HIDEEMPTYGROUPS ? CMIF_CHECKED : 0);
+ Menu_ModifyItem(hHideEmptyGroupsMenuItem, NULL, INVALID_HANDLE_VALUE, flags);
- mi.flags = CMIM_FLAGS;
- Menu_ModifyItem(hGroupMainMenuItemProxy, &mi);
+ flags = (GetWindowLongPtr(pcli->hwndContactTree, GWL_STYLE) & CLS_USEGROUPS ? 0 : CMIF_CHECKED);
+ Menu_ModifyItem(hDisableGroupsMenuItem, NULL, INVALID_HANDLE_VALUE, flags);
- mi.flags = CMIM_FLAGS;
- Menu_ModifyItem(hAppearanceMenuItemProxy, &mi);
+ Menu_ModifyItem(hGroupMainMenuItemProxy, NULL, INVALID_HANDLE_VALUE, flags);
+ Menu_ModifyItem(hAppearanceMenuItemProxy, NULL, INVALID_HANDLE_VALUE, flags);
return 0;
}
@@ -368,13 +364,8 @@ typedef struct { static int OnBuildSubGroupMenu(WPARAM wParam, LPARAM)
{
ClcGroup *group = (ClcGroup *)wParam;
- if (group == 0)
- return 0;
-
- //contact->group
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_FLAGS | (group->hideOffline ? CMIF_CHECKED : 0);
- Menu_ModifyItem(hHideOfflineUsersHereMenuItem, &mi);
+ if (group != 0) // contact->group
+ Menu_ModifyItem(hHideOfflineUsersHereMenuItem, NULL, INVALID_HANDLE_VALUE, group->hideOffline ? CMIF_CHECKED : 0);
return 0;
}
diff --git a/plugins/Console/src/Console.cpp b/plugins/Console/src/Console.cpp index b238151dee..1a6df51867 100644 --- a/plugins/Console/src/Console.cpp +++ b/plugins/Console/src/Console.cpp @@ -164,12 +164,8 @@ static void ShowConsole(int show) if (show)
RedrawWindow(pActive->hList, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW | RDW_ERASE);
- if (hMenu) {
- CLISTMENUITEM mi = { 0 };
- mi.ptszName = show ? LPGENT("Hide Console") : LPGENT("Show Console");
- mi.flags = CMIM_NAME | CMIF_TCHAR;
- Menu_ModifyItem(hMenu, &mi);
- }
+ if (hMenu)
+ Menu_ModifyItem(hMenu, show ? LPGENT("Hide Console") : LPGENT("Show Console"));
if (hTTBButt)
CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTTBButt, show ? TTBST_PUSHED : 0);
diff --git a/plugins/CyrTranslit/src/MirandaContact.cpp b/plugins/CyrTranslit/src/MirandaContact.cpp index 358b313ba6..653e134388 100644 --- a/plugins/CyrTranslit/src/MirandaContact.cpp +++ b/plugins/CyrTranslit/src/MirandaContact.cpp @@ -90,12 +90,7 @@ int MirandaContact::onPreBuildContactMenu(WPARAM wParam, LPARAM) MCONTACT hContact = MCONTACT(wParam);
if (!CallService(MS_DB_CONTACT_IS, wParam, 0)) return 0;
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_FLAGS;
- if ( bIsActive(hContact))
- mi.flags |= CMIF_CHECKED;
-
- Menu_ModifyItem(hTransliterateCmdMenuItem, &mi);
+ Menu_ModifyItem(hTransliterateCmdMenuItem, NULL, INVALID_HANDLE_VALUE, bIsActive(hContact) ? CMIF_CHECKED : 0);
return 0;
}
diff --git a/plugins/Db3x_mmap/src/dbintf.h b/plugins/Db3x_mmap/src/dbintf.h index 509f8209e4..ff155a17a9 100644 --- a/plugins/Db3x_mmap/src/dbintf.h +++ b/plugins/Db3x_mmap/src/dbintf.h @@ -198,7 +198,7 @@ struct CDb3Mmap : public MIDatabase, public MIDatabaseChecker, public MZeroedObj int PrepareCheck(int*);
- __forceinline LPSTR GetMenuTitle() const { return m_bUsesPassword ? LPGEN("Change/remove password") : LPGEN("Set password"); }
+ __forceinline LPTSTR GetMenuTitle() const { return m_bUsesPassword ? LPGENT("Change/remove password") : LPGENT("Set password"); }
void DatabaseCorruption(TCHAR *text);
void WriteSignature(DBSignature&);
diff --git a/plugins/Db3x_mmap/src/ui.cpp b/plugins/Db3x_mmap/src/ui.cpp index 8e9f9d2d40..144b1d275e 100644 --- a/plugins/Db3x_mmap/src/ui.cpp +++ b/plugins/Db3x_mmap/src/ui.cpp @@ -299,11 +299,7 @@ static int OnOptionsInit(PVOID obj, WPARAM wParam, LPARAM) void CDb3Mmap::UpdateMenuItem()
{
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_NAME;
- mi.icolibItem = iconList[1].hIcolib;
- mi.pszName = GetMenuTitle();
- Menu_ModifyItem(hSetPwdMenu, &mi);
+ Menu_ModifyItem(hSetPwdMenu, GetMenuTitle(), iconList[1].hIcolib);
}
static int OnModulesLoaded(PVOID obj, WPARAM, LPARAM)
@@ -316,14 +312,14 @@ static int OnModulesLoaded(PVOID obj, WPARAM, LPARAM) // main menu item
CLISTMENUITEM mi = { 0 };
- mi.pszName = LPGEN("Database");
+ mi.ptszName = LPGENT("Database");
mi.position = 500000000;
- mi.flags = CMIF_ROOTHANDLE;
+ mi.flags = CMIF_ROOTHANDLE | CMIF_TCHAR;
mi.icolibItem = iconList[0].hIcolib;
HGENMENU hMenuRoot = Menu_AddMainMenuItem(&mi);
mi.icolibItem = iconList[1].hIcolib;
- mi.pszName = db->GetMenuTitle();
+ mi.ptszName = db->GetMenuTitle();
mi.hParentMenu = hMenuRoot;
mi.pszService = MS_DB_CHANGEPASSWORD;
hSetPwdMenu = Menu_AddMainMenuItem(&mi);
diff --git a/plugins/FloatingContacts/src/main.cpp b/plugins/FloatingContacts/src/main.cpp index 93c7bc7ecf..d16405ffbb 100644 --- a/plugins/FloatingContacts/src/main.cpp +++ b/plugins/FloatingContacts/src/main.cpp @@ -682,13 +682,12 @@ static INT_PTR OnMainMenu_HideAll(WPARAM wParam, LPARAM lParam) {
fcOpt.bHideAll = !fcOpt.bHideAll;
db_set_b(NULL, MODULE, "HideAll", (BYTE)fcOpt.bHideAll);
+
OnStatusChanged();
- CLISTMENUITEM clmi = { 0 };
- clmi.flags = CMIM_NAME | CMIM_ICON | CMIF_TCHAR;
- clmi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(fcOpt.bHideAll ? IDI_SHOW : IDI_HIDE));
- clmi.ptszName = fcOpt.bHideAll ? LPGENT("Show all thumbs") : LPGENT("Hide all thumbs");
- Menu_ModifyItem(hMainMenuItemHideAll, &clmi);
+ Menu_ModifyItem(hMainMenuItemHideAll,
+ fcOpt.bHideAll ? LPGENT("Show all thumbs") : LPGENT("Hide all thumbs"),
+ LoadIcon(hInst, MAKEINTRESOURCE(fcOpt.bHideAll ? IDI_SHOW : IDI_HIDE)));
return 0;
}
diff --git a/plugins/HTTPServer/src/main.cpp b/plugins/HTTPServer/src/main.cpp index 7343d10006..bdca6bfcf0 100644 --- a/plugins/HTTPServer/src/main.cpp +++ b/plugins/HTTPServer/src/main.cpp @@ -622,10 +622,8 @@ static int nProtoAck(WPARAM /*wParam*/, LPARAM lParam) { // Developer : KN
/////////////////////////////////////////////////////////////////////
-INT_PTR nToggelAcceptConnections(WPARAM wparam, LPARAM /*lparam*/) {
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_NAME | CMIM_ICON;
-
+INT_PTR nToggelAcceptConnections(WPARAM wparam, LPARAM /*lparam*/)
+{
if (!hDirectBoundPort) {
NETLIBUSERSETTINGS nus = { 0 };
nus.cbSize = sizeof(nus);
@@ -644,27 +642,22 @@ INT_PTR nToggelAcceptConnections(WPARAM wparam, LPARAM /*lparam*/) { if (!hDirectBoundPort) {
TCHAR szTemp[200];
mir_snprintf(szTemp, TranslateT("Failed to bind to port %s\r\nThis is most likely because another program or service is using this port") ,
- nlb.wPort == 80 ? "80" : nus.szIncomingPorts);
+ nlb.wPort == 80 ? "80" : nus.szIncomingPorts);
MessageBox(NULL, szTemp, MSG_BOX_TITEL, MB_OK);
return 1001;
}
dwLocalPortUsed = nlb.wPort;
dwLocalIpAddress = nlb.dwInternalIP;
- mi.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_DISABLE_SERVER));
- mi.ptszName = LPGENT("Disable HTTP server");
+ Menu_ModifyItem(hAcceptConnectionsMenuItem, LPGENT("Disable HTTP server"), LoadIcon(hInstance, MAKEINTRESOURCE(IDI_DISABLE_SERVER)));
}
else if (hDirectBoundPort && wparam == 0) {
Netlib_CloseHandle(hDirectBoundPort);
hDirectBoundPort = 0;
- mi.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_SHARE_NEW_FILE));
- mi.ptszName = LPGENT("Enable HTTP server");
+ Menu_ModifyItem(hAcceptConnectionsMenuItem, LPGENT("Enable HTTP server"), LoadIcon(hInstance, MAKEINTRESOURCE(IDI_SHARE_NEW_FILE)));
}
else return 0; // no changes;
- if (hAcceptConnectionsMenuItem)
- Menu_ModifyItem(hAcceptConnectionsMenuItem, &mi);
-
if (! bShutdownInProgress)
db_set_b(NULL, MODULE, "AcceptConnections", hDirectBoundPort != 0);
diff --git a/plugins/HistoryPlusPlus/historypp.dpr b/plugins/HistoryPlusPlus/historypp.dpr index 3b350fc6de..4d3028518d 100644 --- a/plugins/HistoryPlusPlus/historypp.dpr +++ b/plugins/HistoryPlusPlus/historypp.dpr @@ -450,23 +450,16 @@ begin end;
function OnIcon2Changed(awParam: WPARAM; alParam: LPARAM): Integer; cdecl;
-var
- menuItem: TCLISTMENUITEM;
begin
Result := 0;
LoadIcons2;
NotifyAllForms(HM_NOTF_ICONS2CHANGED,0,0);
//change menu icons
- ZeroMemory(@menuitem,SizeOf(menuItem));
- menuItem.flags := CMIM_ICON;
- menuItem.hIcon := hppIcons[HPP_ICON_CONTACTHISTORY].handle;
- CallService(MS_CLIST_MODIFYMENUITEM, MenuHandles[miContact].Handle, LPARAM(@menuItem));
- CallService(MS_CLIST_MODIFYMENUITEM, MenuHandles[miSystem].Handle, LPARAM(@menuItem));
- menuItem.hIcon := hppIcons[HPP_ICON_GLOBALSEARCH].handle;
- CallService(MS_CLIST_MODIFYMENUITEM, MenuHandles[miSearch].Handle, LPARAM(@menuItem));
- menuItem.hIcon := hppIcons[HPP_ICON_TOOL_DELETEALL].handle;
- CallService(MS_CLIST_MODIFYMENUITEM, MenuHandles[miEmpty].Handle, LPARAM(@menuItem));
- CallService(MS_CLIST_MODIFYMENUITEM, MenuHandles[miSysEmpty].Handle, LPARAM(@menuItem));
+ Menu_ModifyItem(MenuHandles[miContact].Handle, nil, hppIcons[HPP_ICON_CONTACTHISTORY].handle);
+ Menu_ModifyItem(MenuHandles[miSystem].Handle, nil, hppIcons[HPP_ICON_CONTACTHISTORY].handle);
+ Menu_ModifyItem(MenuHandles[miSearch].Handle, nil, hppIcons[HPP_ICON_GLOBALSEARCH].handle);
+ Menu_ModifyItem(MenuHandles[miEmpty].Handle, nil, hppIcons[HPP_ICON_TOOL_DELETEALL].handle);
+ Menu_ModifyItem(MenuHandles[miSysEmpty].Handle, nil, hppIcons[HPP_ICON_TOOL_DELETEALL].handle);
end;
//the context menu for a contact is about to be built v0.1.0.1+
@@ -476,37 +469,26 @@ end; //contact that has them
function OnBuildContactMenu(hContact: WPARAM; alParam: LPARAM): Integer; cdecl;
var
- menuItem: TCLISTMENUITEM;
hLast: THandle;
count: Integer;
- res: Integer;
+ text: PWideChar;
begin
Result := 0;
count := db_event_count(hContact);
hLast := db_event_last(hContact);
if (PrevShowHistoryCount xor ShowHistoryCount) or (count <> MenuCount) then
begin
- ZeroMemory(@menuitem, SizeOf(menuItem));
- menuItem.flags := CMIM_FLAGS;
if hLast = 0 then
- menuItem.flags := menuItem.flags or CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, MenuHandles[miEmpty].Handle,
- lParam(@menuitem));
+ Menu_ShowItem(MenuHandles[miEmpty].Handle, 0);
if ShowHistoryCount then
- begin
- menuItem.flags := menuItem.flags or dword(CMIM_NAME) or CMIF_UNICODE;
- menuItem.szName.w :=
- pChar(Format('%s [%u]',[TranslateW(MenuHandles[miContact].Name),count]));
- end
+ text := pWideChar(Format('%s [%u]',[TranslateW(MenuHandles[miContact].Name),count]))
else if PrevShowHistoryCount then
- begin
- menuItem.flags := menuItem.flags or DWord(CMIM_NAME);
- menuItem.szName.w := TranslateW(MenuHandles[miContact].Name);
- end;
- res := CallService(MS_CLIST_MODIFYMENUITEM, MenuHandles[miContact].Handle,
- lParam(@menuitem));
- if res = 0 then
- MenuCount := count;
+ text := TranslateW(MenuHandles[miContact].Name)
+ else
+ text := nil;
+
+ Menu_ModifyItem(MenuHandles[miContact].Handle, text, INVALID_HANDLE_VALUE, 0);
+ MenuCount := count;
PrevShowHistoryCount := ShowHistoryCount;
end;
end;
diff --git a/plugins/HistoryStats/src/main.cpp b/plugins/HistoryStats/src/main.cpp index 4d9ed3a552..bad9b3ca5e 100644 --- a/plugins/HistoryStats/src/main.cpp +++ b/plugins/HistoryStats/src/main.cpp @@ -37,16 +37,15 @@ bool g_bContactMenuExists = false; bool g_bExcludeLock = false;
bool g_bConfigureLock = false;
-static HANDLE g_hMenuCreateStatistics = NULL;
-static HANDLE g_hMenuShowStatistics = NULL;
-static HANDLE g_hMenuConfigure = NULL;
-static HANDLE g_hMenuToggleExclude = NULL;
+static HGENMENU g_hMenuCreateStatistics = NULL;
+static HGENMENU g_hMenuShowStatistics = NULL;
+static HGENMENU g_hMenuConfigure = NULL;
+static HGENMENU g_hMenuToggleExclude = NULL;
#if defined(HISTORYSTATS_HISTORYCOPY)
-static HANDLE g_hMenuHistoryCopy = NULL;
-static HANDLE g_hMenuHistoryPaste = NULL;
-
-static HANDLE g_hHistoryCopyContact = NULL;
+ static HGENMENU g_hMenuHistoryCopy = NULL;
+ static HGENMENU g_hMenuHistoryPaste = NULL;
+ static HGENMENU g_hHistoryCopyContact = NULL;
#endif
/*
@@ -101,24 +100,16 @@ static INT_PTR SvcSetExclude(WPARAM hContact, LPARAM lParam) static void MenuIconsChanged(LPARAM)
{
if (g_hMenuCreateStatistics)
- {
- mu::clist::modifyMenuItem(g_hMenuCreateStatistics, CMIM_ICON, NULL, 0, IconLib::getIcon(IconLib::iiMenuCreateStatistics));
- }
+ Menu_ModifyItem(g_hMenuCreateStatistics, NULL, IconLib::getIcon(IconLib::iiMenuCreateStatistics));
if (g_hMenuShowStatistics)
- {
- mu::clist::modifyMenuItem(g_hMenuShowStatistics, CMIM_ICON, NULL, 0, IconLib::getIcon(IconLib::iiMenuShowStatistics));
- }
+ Menu_ModifyItem(g_hMenuShowStatistics, NULL, IconLib::getIcon(IconLib::iiMenuShowStatistics));
if (g_hMenuConfigure)
- {
- mu::clist::modifyMenuItem(g_hMenuConfigure, CMIM_ICON, NULL, 0, IconLib::getIcon(IconLib::iiMenuConfigure));
- }
+ Menu_ModifyItem(g_hMenuConfigure, NULL, IconLib::getIcon(IconLib::iiMenuConfigure));
if (g_hMenuToggleExclude)
- {
- mu::clist::modifyMenuItem(g_hMenuToggleExclude, CMIM_ICON, NULL, 0, IconLib::getIcon(IconLib::iiContactMenu));
- }
+ Menu_ModifyItem(g_hMenuToggleExclude, NULL, IconLib::getIcon(IconLib::iiContactMenu));
}
/*
@@ -134,15 +125,11 @@ static INT_PTR MenuCreateStatistics(WPARAM, LPARAM) static INT_PTR MenuShowStatistics(WPARAM, LPARAM)
{
if (g_pSettings->canShowStatistics())
- {
g_pSettings->showStatistics();
- }
else
- {
MessageBox(NULL,
TranslateT("The statistics can't be found. Either you never created them or the last created statistics were moved to a different location and can't be found anymore."),
TranslateT("HistoryStats - Warning"), MB_ICONWARNING | MB_OK);
- }
return 0;
}
@@ -311,7 +298,7 @@ static int EventPreBuildContactMenu(WPARAM hContact, LPARAM) if ((!g_pSettings->m_ShowContactMenuPseudo && (!szProto || !(mu::protosvc::getCaps(szProto, PFLAGNUM_2) & ~mu::protosvc::getCaps(szProto, PFLAGNUM_5)))) ||
g_pSettings->m_HideContactMenuProtos.find(szProto) != g_pSettings->m_HideContactMenuProtos.end())
{
- mu::clist::modifyMenuItem(g_hMenuToggleExclude, CMIM_FLAGS, NULL, CMIF_HIDDEN);
+ Menu_ShowItem(g_hMenuToggleExclude, false);
}
else {
MirandaSettings db;
@@ -325,13 +312,13 @@ static int EventPreBuildContactMenu(WPARAM hContact, LPARAM) menuState |= CMIF_GRAYED;
// set menu state
- mu::clist::modifyMenuItem(g_hMenuToggleExclude, CMIM_FLAGS, NULL, menuState);
+ Menu_ModifyItem(g_hMenuToggleExclude, NULL, INVALID_HANDLE_VALUE, menuState);
}
#if defined(HISTORYSTATS_HISTORYCOPY)
int menuStateCopy = (g_hHistoryCopyContact && g_hHistoryCopyContact != hContact) ? 0 : CMIF_GRAYED;
- mu::clist::modifyMenuItem(g_hMenuHistoryPaste, CMIM_FLAGS, NULL, menuStateCopy);
+ Menu_ModifyItem(g_hMenuHistoryPaste, CMIM_FLAGS, NULL, menuStateCopy);
#endif
}
diff --git a/plugins/HistoryStats/src/mu_common.cpp b/plugins/HistoryStats/src/mu_common.cpp index ec35504690..b2f7b9aa5a 100644 --- a/plugins/HistoryStats/src/mu_common.cpp +++ b/plugins/HistoryStats/src/mu_common.cpp @@ -12,7 +12,7 @@ namespace mu namespace clist
{
- HANDLE addMainMenuItem(const TCHAR* pszName, DWORD flags, int position, HICON hIcon, const char* pszService, const TCHAR* pszPopupName /* = NULL */, int popupPosition /* = 0 */, DWORD hotKey /* = 0 */)
+ HGENMENU addMainMenuItem(const TCHAR* pszName, DWORD flags, int position, HICON hIcon, const char* pszService, const TCHAR* pszPopupName /* = NULL */, int popupPosition /* = 0 */, DWORD hotKey /* = 0 */)
{
// TODO: support for unicode-core with unicode-aware CList
CLISTMENUITEM mi = { 0 };
@@ -27,7 +27,7 @@ namespace mu return Menu_AddMainMenuItem(&mi);
}
- HANDLE addContactMenuItem(const TCHAR* pszName, DWORD flags, int position, HICON hIcon, const char* pszService, DWORD hotKey /* = 0 */, const char* pszContactOwner /* = NULL */)
+ HGENMENU addContactMenuItem(const TCHAR* pszName, DWORD flags, int position, HICON hIcon, const char* pszService, DWORD hotKey /* = 0 */, const char* pszContactOwner /* = NULL */)
{
// TODO: support for unicode-core with unicode-aware CList
CLISTMENUITEM mi = { 0 };
@@ -41,17 +41,6 @@ namespace mu return Menu_AddContactMenuItem(&mi);
}
- int modifyMenuItem(HANDLE hMenuItem, DWORD toModify, const TCHAR* pszName /* = NULL */, DWORD flags /* = 0 */, HICON hIcon /* = NULL */, DWORD hotKey /* = 0 */)
- {
- // TODO: support for unicode-core with unicode-aware CList
- CLISTMENUITEM mi = { 0 };
- mi.ptszName = (TCHAR*)pszName;
- mi.flags = toModify | flags | CMIF_TCHAR;
- mi.hIcon = hIcon;
- mi.hotKey = hotKey;
- return CallService(MS_CLIST_MODIFYMENUITEM, reinterpret_cast<WPARAM>(hMenuItem), reinterpret_cast<LPARAM>(&mi));
- }
-
const TCHAR* getContactDisplayName(MCONTACT hContact)
{
return reinterpret_cast<const TCHAR*>(CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_UNICODE));
diff --git a/plugins/HistoryStats/src/mu_common.h b/plugins/HistoryStats/src/mu_common.h index 99f4c6985b..ec7e1d5447 100644 --- a/plugins/HistoryStats/src/mu_common.h +++ b/plugins/HistoryStats/src/mu_common.h @@ -13,9 +13,8 @@ namespace mu namespace clist
{
- HANDLE addMainMenuItem(const TCHAR* pszName, DWORD flags, int position, HICON hIcon, const char* pszService, const TCHAR* pszPopupName = NULL, int popupPosition = 0, DWORD hotKey = 0);
- HANDLE addContactMenuItem(const TCHAR* pszName, DWORD flags, int position, HICON hIcon, const char* pszService, DWORD hotKey = 0, const char* pszContactOwner = NULL);
- int modifyMenuItem(HANDLE hMenuItem, DWORD toModify, const TCHAR* pszName = NULL, DWORD flags = 0, HICON hIcon = NULL, DWORD hotKey = 0);
+ HGENMENU addMainMenuItem(const TCHAR* pszName, DWORD flags, int position, HICON hIcon, const char* pszService, const TCHAR* pszPopupName = NULL, int popupPosition = 0, DWORD hotKey = 0);
+ HGENMENU addContactMenuItem(const TCHAR* pszName, DWORD flags, int position, HICON hIcon, const char* pszService, DWORD hotKey = 0, const char* pszContactOwner = NULL);
const TCHAR* getContactDisplayName(MCONTACT hContact);
const TCHAR* getStatusModeDescription(int nStatusMode);
}
diff --git a/plugins/ListeningTo/src/listeningto.cpp b/plugins/ListeningTo/src/listeningto.cpp index 95ccdbc1d3..f8bcb8f8b6 100644 --- a/plugins/ListeningTo/src/listeningto.cpp +++ b/plugins/ListeningTo/src/listeningto.cpp @@ -159,11 +159,8 @@ void UpdateGlobalStatusMenus() {
BOOL enabled = ListeningToEnabled(NULL, TRUE);
- CLISTMENUITEM clmi = { 0 };
- clmi.flags = CMIM_FLAGS
- | (enabled ? CMIF_CHECKED : 0)
- | (opts.enable_sending ? 0 : CMIF_GRAYED);
- Menu_ModifyItem(proto_items[0].hMenu, &clmi);
+ int flags = (enabled ? CMIF_CHECKED : 0) + (opts.enable_sending ? 0 : CMIF_GRAYED);
+ Menu_ModifyItem(proto_items[0].hMenu, NULL, INVALID_HANDLE_VALUE, flags);
if (hTTB != NULL)
CallService(MS_TTB_SETBUTTONSTATE, (WPARAM) hTTB, (LPARAM) (enabled ? TTBST_PUSHED : 0));
@@ -244,11 +241,7 @@ int AccListChanged(WPARAM wParam, LPARAM lParam) TCHAR text[512];
mir_sntprintf(text, TranslateT("Send to %s"), info->account);
-
- CLISTMENUITEM clmi = { 0 };
- clmi.flags = CMIM_NAME | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED;
- clmi.ptszName = text;
- Menu_ModifyItem(info->hMenu, &clmi);
+ Menu_ModifyItem(info->hMenu, text);
}
else if (wParam == PRAC_REMOVED || (wParam == PRAC_CHECKED && !proto->bIsEnabled))
{
@@ -715,11 +708,8 @@ INT_PTR EnableListeningTo(char *proto,BOOL enabled) ProtocolInfo *info = GetProtoInfo(proto);
if (info != NULL)
{
- CLISTMENUITEM clmi = { 0 };
- clmi.flags = CMIM_FLAGS
- | (enabled ? CMIF_CHECKED : 0)
- | (opts.enable_sending ? 0 : CMIF_GRAYED);
- Menu_ModifyItem(info->hMenu, &clmi);
+ int flags = (enabled ? CMIF_CHECKED : 0) | (opts.enable_sending ? 0 : CMIF_GRAYED);
+ Menu_ModifyItem(info->hMenu, NULL, INVALID_HANDLE_VALUE, flags);
SetListeningInfo(proto,(opts.enable_sending && enabled) ? GetListeningInfo() : NULL);
}
diff --git a/plugins/MenuItemEx/src/main.cpp b/plugins/MenuItemEx/src/main.cpp index 532736da54..b3716522f7 100644 --- a/plugins/MenuItemEx/src/main.cpp +++ b/plugins/MenuItemEx/src/main.cpp @@ -467,25 +467,16 @@ INT_PTR onHide(WPARAM wparam, LPARAM) // following 4 functions should be self-explanatory
void ModifyVisibleSet(int mode, BOOL alpha)
{
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_ICON;
- mi.hIcon = (mode) ? hIcon[1] : (alpha ? hIcon[3] : Skin_LoadIcon(SKINICON_OTHER_SMALLDOT));
- Menu_ModifyItem(hmenuVis, &mi);
+ Menu_ModifyItem(hmenuVis, NULL, (mode) ? hIcon[1] : (alpha ? hIcon[3] : Skin_LoadIcon(SKINICON_OTHER_SMALLDOT)));
}
void ModifyInvisSet(int mode, BOOL alpha)
{
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_ICON;
- mi.hIcon = (mode) ? hIcon[2] : (alpha ? hIcon[4] : Skin_LoadIcon(SKINICON_OTHER_SMALLDOT));
- Menu_ModifyItem(hmenuOff, &mi);
+ Menu_ModifyItem(hmenuOff, NULL, (mode) ? hIcon[2] : (alpha ? hIcon[4] : Skin_LoadIcon(SKINICON_OTHER_SMALLDOT)));
}
void ModifyCopyID(MCONTACT hContact, BOOL bShowID, BOOL bTrimID)
{
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_ICON | CMIM_NAME | CMIF_UNICODE;
-
if (isMetaContact(hContact)) {
MCONTACT hC = db_mc_getMostOnline(hContact);
if (!hContact) hC = db_mc_getDefault(hContact);
@@ -499,9 +490,11 @@ void ModifyCopyID(MCONTACT hContact, BOOL bShowID, BOOL bTrimID) }
HICON hIconCID = (HICON)CallProtoService(szProto, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0);
- mi.hIcon = BindOverlayIcon(hIconCID, "miex_copyid");
- DestroyIcon(hIconCID);
- hIconCID = mi.hIcon;
+ {
+ HICON hIcon = BindOverlayIcon(hIconCID, "miex_copyid");
+ DestroyIcon(hIconCID);
+ hIconCID = hIcon;
+ }
TCHAR buffer[256];
char szID[256];
@@ -514,13 +507,12 @@ void ModifyCopyID(MCONTACT hContact, BOOL bShowID, BOOL bTrimID) }
mir_sntprintf(buffer, _countof(buffer), _T("%s [%S]"), TranslateT("Copy ID"), szID);
- mi.ptszName = buffer;
+ Menu_ModifyItem(hmenuCopyID, buffer, hIconCID);
}
- else mi.ptszName = LPGENT("Copy ID");
+ else Menu_ModifyItem(hmenuCopyID, LPGENT("Copy ID"), hIconCID);
}
- else mi.flags = CMIM_FLAGS | CMIF_HIDDEN;
+ else Menu_ShowItem(hmenuCopyID, false);
- Menu_ModifyItem(hmenuCopyID, &mi);
DestroyIcon(hIconCID);
}
@@ -532,15 +524,14 @@ void ModifyStatusMsg(MCONTACT hContact) return;
}
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_ICON;
-
HICON hIconSMsg = (HICON)CallProtoService(szProto, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0);
- mi.hIcon = BindOverlayIcon(hIconSMsg, (StatusMsgExists(hContact) & 2) ? "miex_copysm2" : "miex_copysm1");
- DestroyIcon(hIconSMsg);
- hIconSMsg = mi.hIcon;
+ {
+ HICON hIcon = BindOverlayIcon(hIconSMsg, (StatusMsgExists(hContact) & 2) ? "miex_copysm2" : "miex_copysm1");
+ DestroyIcon(hIconSMsg);
+ hIconSMsg = hIcon;
+ }
- Menu_ModifyItem(hmenuStatusMsg, &mi);
+ Menu_ModifyItem(hmenuStatusMsg, NULL, hIconSMsg);
DestroyIcon(hIconSMsg);
}
@@ -552,32 +543,30 @@ void ModifyCopyIP(MCONTACT hContact) return;
}
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_ICON;
-
HICON hIconCIP = (HICON)CallProtoService(szProto, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0);
- mi.hIcon = BindOverlayIcon(hIconCIP, "miex_copyip");
- DestroyIcon(hIconCIP);
- hIconCIP = mi.hIcon;
+ {
+ HICON hIcon = BindOverlayIcon(hIconCIP, "miex_copyip");
+ DestroyIcon(hIconCIP);
+ hIconCIP = hIcon;
+ }
- Menu_ModifyItem(hmenuCopyIP, &mi);
+ Menu_ModifyItem(hmenuCopyIP, NULL, hIconCIP);
DestroyIcon(hIconCIP);
}
void ModifyCopyMirVer(MCONTACT hContact)
{
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_ICON;
-
+ HICON hMenuIcon = NULL;
if (ServiceExists(MS_FP_GETCLIENTICONT)) {
LPTSTR msg = getMirVer(hContact);
if (msg) {
- mi.hIcon = Finger_GetClientIcon(msg, 1);
+ hMenuIcon = Finger_GetClientIcon(msg, 1);
mir_free(msg);
}
}
- if (!mi.hIcon) mi.hIcon = hIcon[0];
- Menu_ModifyItem(hmenuCopyMirVer, &mi);
+ if (!hIcon)
+ hMenuIcon = hIcon[0];
+ Menu_ModifyItem(hmenuCopyMirVer, NULL, hMenuIcon);
}
INT_PTR onCopyID(WPARAM wparam, LPARAM lparam)
@@ -758,14 +747,12 @@ static HGENMENU AddSubmenuItem(HGENMENU hRoot, TCHAR* name, HICON icon, DWORD fl static void ModifySubmenuItem(HGENMENU hItem, TCHAR *name, int checked, int hidden)
{
- CLISTMENUITEM mi = { 0 };
- mi.ptszName = name;
- mi.flags = CMIM_FLAGS | CMIF_UNICODE;
+ int flags = 0;
if (checked)
- mi.flags |= CMIF_CHECKED;
+ flags |= CMIF_CHECKED;
if (hidden)
- mi.flags |= CMIF_HIDDEN;
- Menu_ModifyItem(hItem, &mi);
+ flags |= CMIF_HIDDEN;
+ Menu_ModifyItem(hItem, NULL, INVALID_HANDLE_VALUE, flags);
}
// called when the contact-menu is built
@@ -788,11 +775,10 @@ int BuildMenu(WPARAM wparam, LPARAM) Menu_ShowItem(hmenuHide, bEnabled);
if (bEnabled) {
BYTE bHidden = db_get_b(hContact, "CList", "Hidden", 0);
- CLISTMENUITEM mi = { 0 };
- mi.flags |= CMIM_ICON | CMIM_NAME | CMIF_UNICODE;
- mi.hIcon = IcoLib_GetIcon(bHidden ? "miex_showil" : "miex_hidefl");
- mi.ptszName = bHidden ? LPGENT("Show in list") : LPGENT("Hide from list");
- Menu_ModifyItem(hmenuHide, &mi);
+ if (bHidden)
+ Menu_ModifyItem(hmenuHide, LPGENT("Show in list"), IcoLib_GetIcon("miex_showil"));
+ else
+ Menu_ModifyItem(hmenuHide, LPGENT("Hide from list"), IcoLib_GetIcon("miex_hidefl"));
}
bEnabled = bShowAll || (flags & VF_IGN);
@@ -858,11 +844,11 @@ int BuildMenu(WPARAM wparam, LPARAM) INT_PTR caps = CallProtoService(pszProto, PS_GETCAPS, PFLAGNUM_1, 0);
int apparent = db_get_w(hContact, GetContactProto(hContact), "ApparentMode", 0);
- Menu_ShowItem(hmenuVis, caps & PF1_VISLIST);
+ Menu_ShowItem(hmenuVis, (caps & PF1_VISLIST) != 0);
if (caps & PF1_VISLIST)
ModifyVisibleSet(apparent == ID_STATUS_ONLINE, flags & VF_SAI);
- Menu_ShowItem(hmenuOff, caps & PF1_INVISLIST);
+ Menu_ShowItem(hmenuOff, (caps & PF1_INVISLIST) != 0);
if (caps & PF1_INVISLIST)
ModifyInvisSet(apparent == ID_STATUS_OFFLINE, flags & VF_SAI);
}
diff --git a/plugins/MirLua/src/m_genmenu.cpp b/plugins/MirLua/src/m_genmenu.cpp index 63339b53b5..433620d7cb 100644 --- a/plugins/MirLua/src/m_genmenu.cpp +++ b/plugins/MirLua/src/m_genmenu.cpp @@ -101,9 +101,8 @@ static int lua_ModifyMenuItem(lua_State *L) mir_ptr<CLISTMENUITEM> pmi(MakeMenuItem(L));
- INT_PTR res = ::CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuItem, (LPARAM)pmi);
+ INT_PTR res = ::Menu_ModifyItem(hMenuItem, pmi->ptszName, pmi->hIcon, pmi->flags);
lua_pushinteger(L, res);
-
return 1;
}
diff --git a/plugins/MirOTR/src/mirotrmenu.cpp b/plugins/MirOTR/src/mirotrmenu.cpp index 33f69c3915..d65acdc67b 100644 --- a/plugins/MirOTR/src/mirotrmenu.cpp +++ b/plugins/MirOTR/src/mirotrmenu.cpp @@ -98,41 +98,30 @@ INT_PTR MirOTRMenuCheckService(WPARAM wParam, LPARAM) if (mi.flags & CMIF_NOTNOTPRIVATE && level == TRUST_NOT_PRIVATE) return FALSE; if (pcpp->MenuItemHandle == hStatusInfoItem) { - size_t len; TCHAR text[128]; - mi.name.t = text; - mi.flags = CMIM_NAME | CMIM_ICON | CMIF_TCHAR; + switch (level) { case TRUST_PRIVATE: - mi.hIcolibItem = IcoLib_GetIconHandle(ICON_PRIVATE); - mir_tstrncpy(text, TranslateT(LANG_STATUS_PRIVATE), _countof(text)); - len = mir_tstrlen(text); - if (len < _countof(text)) - mir_sntprintf(text + len, _countof(text) - len, _T(" [v%i]"), context->protocol_version); + mir_sntprintf(text, _T("%s [v%i]"), TranslateT(LANG_STATUS_PRIVATE), context->protocol_version); + Menu_ModifyItem(hStatusInfoItem, text, IcoLib_GetIconHandle(ICON_PRIVATE)); break; + case TRUST_UNVERIFIED: - mi.hIcolibItem = IcoLib_GetIconHandle(ICON_UNVERIFIED); - mir_tstrncpy(text, TranslateT(LANG_STATUS_UNVERIFIED), _countof(text)); - len = mir_tstrlen(text); - if (len < _countof(text)) - mir_sntprintf(text + len, _countof(text) - len, _T(" [v%i]"), context->protocol_version); + mir_sntprintf(text, _T("%s [v%i]"), TranslateT(LANG_STATUS_UNVERIFIED), context->protocol_version); + Menu_ModifyItem(hStatusInfoItem, text, IcoLib_GetIconHandle(ICON_UNVERIFIED)); break; + case TRUST_FINISHED: - mi.hIcolibItem = IcoLib_GetIconHandle(ICON_FINISHED); - mi.name.t = TranslateT(LANG_STATUS_FINISHED); + Menu_ModifyItem(hStatusInfoItem, TranslateT(LANG_STATUS_FINISHED), IcoLib_GetIconHandle(ICON_UNVERIFIED)); break; + default: - mi.hIcolibItem = IcoLib_GetIconHandle(ICON_NOT_PRIVATE); - mi.name.t = TranslateT(LANG_STATUS_DISABLED); + Menu_ModifyItem(hStatusInfoItem, TranslateT(LANG_STATUS_DISABLED), IcoLib_GetIconHandle(ICON_NOT_PRIVATE)); } - CallService(MO_MODIFYMENUITEM, (WPARAM)hStatusInfoItem, (LPARAM)&mi); } else if (pcpp->MenuItemHandle == hHTMLConvMenuItem) { - if (db_get_b(hContact, MODULENAME, "HTMLConv", 0)) - mi.flags |= CMIM_FLAGS | CMIF_CHECKED; - else - mi.flags = CMIM_FLAGS | (mi.flags &~CMIF_CHECKED); - CallService(MO_MODIFYMENUITEM, (WPARAM)hHTMLConvMenuItem, (LPARAM)&mi); + int flags = db_get_b(hContact, MODULENAME, "HTMLConv", 0) ? CMIF_CHECKED : 0; + Menu_ModifyItem(hHTMLConvMenuItem, NULL, INVALID_HANDLE_VALUE, flags); } } return TRUE; diff --git a/plugins/MirOTR/src/svcs_menu.cpp b/plugins/MirOTR/src/svcs_menu.cpp index 1eda3b7469..a7657a247c 100644 --- a/plugins/MirOTR/src/svcs_menu.cpp +++ b/plugins/MirOTR/src/svcs_menu.cpp @@ -179,9 +179,6 @@ void InitMenu() int SVC_PrebuildContactMenu(WPARAM hContact, LPARAM lParam) { - CLISTMENUITEM mi = { 0 }; - mi.flags = CMIM_FLAGS | CMIF_NOTOFFLINE | CMIF_TCHAR; - const char *proto = GetContactProto(hContact); DWORD pol = CONTACT_DEFAULT_POLICY; diff --git a/plugins/MyDetails/src/frame.cpp b/plugins/MyDetails/src/frame.cpp index 3b605578f9..c967676e73 100644 --- a/plugins/MyDetails/src/frame.cpp +++ b/plugins/MyDetails/src/frame.cpp @@ -2240,15 +2240,7 @@ INT_PTR HideFrameFunc(WPARAM, LPARAM) void FixMainMenu()
{
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_NAME | CMIF_TCHAR;
-
- if (MyDetailsFrameVisible())
- mi.ptszName = LPGENT("Hide my details");
- else
- mi.ptszName = LPGENT("Show my details");
-
- Menu_ModifyItem(hMenuShowHideFrame, &mi);
+ Menu_ModifyItem(hMenuShowHideFrame, MyDetailsFrameVisible() ? LPGENT("Hide my details") : LPGENT("Show my details"));
}
#include <math.h>
diff --git a/plugins/NewAwaySysMod/src/AwaySys.cpp b/plugins/NewAwaySysMod/src/AwaySys.cpp index 8fe18b2ebe..8749b97ee9 100644 --- a/plugins/NewAwaySysMod/src/AwaySys.cpp +++ b/plugins/NewAwaySysMod/src/AwaySys.cpp @@ -47,8 +47,8 @@ HINSTANCE g_hInstance; CLIST_INTERFACE *pcli;
int hLangpack;
-HANDLE g_hContactMenuItem, g_hReadStatMenuItem, g_hTopToolbarbutton;
-HGENMENU g_hToggleSOEMenuItem, g_hToggleSOEContactMenuItem;
+HANDLE g_hTopToolbarbutton;
+HGENMENU g_hToggleSOEMenuItem, g_hToggleSOEContactMenuItem, g_hContactMenuItem, g_hReadStatMenuItem;
HGENMENU g_hAutoreplyOnContactMenuItem, g_hAutoreplyOffContactMenuItem, g_hAutoreplyUseDefaultContactMenuItem;
bool g_fNoProcessing = false; // tells the status change proc not to do anything
int g_bIsIdle = false;
@@ -290,14 +290,13 @@ static int IdleChangeEvent(WPARAM, LPARAM lParam) int PreBuildContactMenu(WPARAM hContact, LPARAM)
{
char *szProto = GetContactProto(hContact);
- CLISTMENUITEM miSetMsg = { 0 };
- miSetMsg.flags = CMIM_FLAGS | CMIF_TCHAR | CMIF_HIDDEN;
- CLISTMENUITEM miReadMsg = { 0 };
- miReadMsg.flags = CMIM_FLAGS | CMIF_TCHAR | CMIF_HIDDEN;
int iMode = szProto ? CallProtoService(szProto, PS_GETSTATUS, 0, 0) : 0;
int Flag1 = szProto ? CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) : 0;
int iContactMode = db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE);
TCHAR szSetStr[256], szReadStr[256];
+ szSetStr[0] = szReadStr[0] = 0;
+ HICON hReadMsgIcon = NULL;
+
if (szProto) {
int i;
for (i = _countof(StatusModeList) - 1; i >= 0; i--)
@@ -305,48 +304,44 @@ int PreBuildContactMenu(WPARAM hContact, LPARAM) break;
// the protocol supports status message sending for current status, or autoreplying
- if ((Flag1 & PF1_MODEMSGSEND && CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(iMode)) || ((Flag1 & PF1_IM) == PF1_IM && (i < 0 || !g_AutoreplyOptPage.GetDBValueCopy(StatusModeList[i].DisableReplyCtlID)))) {
+ if ((Flag1 & PF1_MODEMSGSEND && CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(iMode)) ||
+ ((Flag1 & PF1_IM) == PF1_IM && (i < 0 || !g_AutoreplyOptPage.GetDBValueCopy(StatusModeList[i].DisableReplyCtlID))))
mir_sntprintf(szSetStr, _countof(szSetStr), TranslateT("Set %s message for the contact"), pcli->pfnGetStatusModeDescription(iMode, 0), pcli->pfnGetContactDisplayName(hContact, 0));
- miSetMsg.ptszName = szSetStr;
- miSetMsg.flags = CMIM_FLAGS | CMIF_TCHAR | CMIM_NAME;
- }
// the protocol supports status message reading for contact's status
if (Flag1 & PF1_MODEMSGRECV && CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(iContactMode)) {
mir_sntprintf(szReadStr, _countof(szReadStr), TranslateT("Re&ad %s message"), pcli->pfnGetStatusModeDescription(iContactMode, 0));
- miReadMsg.ptszName = szReadStr;
- miReadMsg.flags = CMIM_FLAGS | CMIF_TCHAR | CMIM_NAME | CMIM_ICON;
- miReadMsg.hIcon = Skin_LoadProtoIcon(szProto, iContactMode);
+ hReadMsgIcon = Skin_LoadProtoIcon(szProto, iContactMode);
}
}
if (g_hContactMenuItem) {
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)g_hContactMenuItem, (LPARAM)&miSetMsg);
+ if (szSetStr[0] == 0)
+ Menu_ShowItem(g_hContactMenuItem, false);
+ else
+ Menu_ModifyItem(g_hContactMenuItem, szSetStr, INVALID_HANDLE_VALUE, 0);
// if this contact supports sending/receiving messages
if ((Flag1 & PF1_IM) == PF1_IM) {
int iAutoreply = CContactSettings(g_ProtoStates[szProto].Status, hContact).Autoreply;
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_ICON | CMIM_FLAGS | CMIF_TCHAR;
+ HANDLE hIcon;
switch (iAutoreply) {
- case VAL_USEDEFAULT: mi.hIcon = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_DOT)); break;
- case 0: mi.icolibItem = iconList[0].hIcolib; break;
- default: iAutoreply = 1; mi.icolibItem = iconList[1].hIcolib; break;
+ case VAL_USEDEFAULT: hIcon = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_DOT)); break;
+ case 0: hIcon = iconList[0].hIcolib; break;
+ default: iAutoreply = 1; hIcon = iconList[1].hIcolib; break;
}
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)g_hToggleSOEContactMenuItem, (LPARAM)&mi);
- mi.flags = CMIM_FLAGS | CMIF_TCHAR | (iAutoreply == 1 ? CMIF_CHECKED : 0);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)g_hAutoreplyOnContactMenuItem, (LPARAM)&mi);
- mi.flags = CMIM_FLAGS | CMIF_TCHAR | (iAutoreply == 0 ? CMIF_CHECKED : 0);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)g_hAutoreplyOffContactMenuItem, (LPARAM)&mi);
- mi.flags = CMIM_FLAGS | CMIF_TCHAR | (iAutoreply == VAL_USEDEFAULT ? CMIF_CHECKED : 0);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)g_hAutoreplyUseDefaultContactMenuItem, (LPARAM)&mi);
- }
- else { // hide the Autoreply menu item
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_FLAGS | CMIF_TCHAR | CMIF_HIDDEN;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)g_hToggleSOEContactMenuItem, (LPARAM)&mi);
+ Menu_ModifyItem(g_hToggleSOEContactMenuItem, NULL, hIcon, 0);
+ Menu_ModifyItem(g_hAutoreplyOnContactMenuItem, NULL, INVALID_HANDLE_VALUE, (iAutoreply == 1) ? CMIF_CHECKED : 0);
+ Menu_ModifyItem(g_hAutoreplyOffContactMenuItem, NULL, INVALID_HANDLE_VALUE, (iAutoreply == 0) ? CMIF_CHECKED : 0);
+ Menu_ModifyItem(g_hAutoreplyUseDefaultContactMenuItem, NULL, INVALID_HANDLE_VALUE, (iAutoreply == VAL_USEDEFAULT) ? CMIF_CHECKED : 0);
}
+ else // hide the Autoreply menu item
+ Menu_ShowItem(g_hToggleSOEContactMenuItem, false);
}
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)g_hReadStatMenuItem, (LPARAM)&miReadMsg);
+
+ if (szReadStr[0] == 0)
+ Menu_ShowItem(g_hReadStatMenuItem, false);
+ else
+ Menu_ModifyItem(g_hReadStatMenuItem, szReadStr, hReadMsgIcon, 0);
return 0;
}
@@ -383,17 +378,10 @@ INT_PTR ToggleSendOnEvent(WPARAM hContact, LPARAM) if (hContact == NULL) {
int SendOnEvent = CContactSettings(g_ProtoStates[(LPSTR)NULL].Status).Autoreply;
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_ICON | CMIM_NAME | CMIF_TCHAR;
- if (SendOnEvent) {
- mi.ptszName = ENABLE_SOE_COMMAND;
- mi.icolibItem = iconList[1].hIcolib;
- }
- else {
- mi.ptszName = DISABLE_SOE_COMMAND;
- mi.icolibItem = iconList[0].hIcolib;
- }
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)g_hToggleSOEMenuItem, (LPARAM)&mi);
+ if (SendOnEvent)
+ Menu_ModifyItem(g_hToggleSOEMenuItem, ENABLE_SOE_COMMAND, iconList[1].hIcolib);
+ else
+ Menu_ModifyItem(g_hToggleSOEMenuItem, DISABLE_SOE_COMMAND, iconList[0].hIcolib);
if (g_hTopToolbarbutton)
CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)g_hTopToolbarbutton, SendOnEvent ? TTBST_PUSHED : 0);
diff --git a/plugins/NewEventNotify/src/menuitem.cpp b/plugins/NewEventNotify/src/menuitem.cpp index 9ab896ed7a..0aa91b51f7 100644 --- a/plugins/NewEventNotify/src/menuitem.cpp +++ b/plugins/NewEventNotify/src/menuitem.cpp @@ -39,17 +39,10 @@ static INT_PTR MenuitemNotifyCmd(WPARAM wParam,LPARAM lParam) int MenuitemUpdate(BOOL bStatus)
{
- CLISTMENUITEM mi = { 0 };
- if (bStatus) {
- mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_ENABLED));
- mi.pszName = MENUITEM_DISABLE;
- } else {
- mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_DISABLED));
- mi.pszName = MENUITEM_ENABLE;
- }
- mi.flags = CMIM_ICON | CMIM_NAME;
- Menu_ModifyItem(hMenuitemNotify, &mi);
-
+ if (bStatus)
+ Menu_ModifyItem(hMenuitemNotify, _T(MENUITEM_DISABLE), LoadIcon(hInst, MAKEINTRESOURCE(IDI_ENABLED)));
+ else
+ Menu_ModifyItem(hMenuitemNotify, _T(MENUITEM_ENABLE), LoadIcon(hInst, MAKEINTRESOURCE(IDI_DISABLED)));
return 0;
}
@@ -67,6 +60,5 @@ int MenuitemInit(BOOL bStatus) bNotify = bStatus;
MenuitemUpdate(bNotify);
-
return 0;
}
diff --git a/plugins/NewXstatusNotify/src/main.cpp b/plugins/NewXstatusNotify/src/main.cpp index 66163f6b72..fafec319e8 100644 --- a/plugins/NewXstatusNotify/src/main.cpp +++ b/plugins/NewXstatusNotify/src/main.cpp @@ -1062,18 +1062,11 @@ INT_PTR EnableDisableMenuCommand(WPARAM, LPARAM) {
db_set_b(0, MODULE, "TempDisable", opt.TempDisabled = !opt.TempDisabled);
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_ICON | CMIM_NAME | CMIF_TCHAR;
- if (opt.TempDisabled) {
- mi.ptszName = LPGENT("Enable status notification");
- mi.icolibItem = GetIconHandle(ICO_NOTIFICATION_OFF);
- }
- else {
- mi.ptszName = LPGENT("Disable status notification");
- mi.icolibItem = GetIconHandle(ICO_NOTIFICATION_ON);
- }
+ if (opt.TempDisabled)
+ Menu_ModifyItem(hEnableDisableMenu, LPGENT("Enable status notification"), GetIconHandle(ICO_NOTIFICATION_OFF));
+ else
+ Menu_ModifyItem(hEnableDisableMenu, LPGENT("Disable status notification"), GetIconHandle(ICO_NOTIFICATION_ON));
- Menu_ModifyItem(hEnableDisableMenu, &mi);
CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hToolbarButton, opt.TempDisabled ? 0 : TTBST_PUSHED);
return 0;
}
diff --git a/plugins/New_GPG/src/utilities.cpp b/plugins/New_GPG/src/utilities.cpp index 4c49c3eb4a..c28eff9c32 100755 --- a/plugins/New_GPG/src/utilities.cpp +++ b/plugins/New_GPG/src/utilities.cpp @@ -226,11 +226,8 @@ INT_PTR ToggleEncryption(WPARAM w, LPARAM l) void setClistIcon(MCONTACT hContact); setSrmmIcon(hContact); setClistIcon(hContact); - enc = enc?0:1; - CLISTMENUITEM mi = { 0 }; - mi.flags = CMIM_NAME; - enc?mi.pszName="Turn off GPG encryption":mi.pszName="Turn on GPG encryption"; - Menu_ModifyItem(hToggleEncryption, &mi); + + Menu_ModifyItem(hToggleEncryption, enc ? LPGENT("Turn off GPG encryption") : LPGENT("Turn on GPG encryption")); return 0; } @@ -259,22 +256,21 @@ int OnPreBuildContactMenu(WPARAM w, LPARAM l) TCHAR buf[128] = {0}; mir_sntprintf(buf, _T("%s: %s"), TranslateT("Send public key"), toUTF16(keyid).c_str()); mir_free(keyid); - mi2.ptszName = buf; - mi2.flags = CMIM_NAME | CMIF_TCHAR; - Menu_ModifyItem(hSendKey, &mi2); + Menu_ModifyItem(hSendKey, buf); } - CLISTMENUITEM mi = { 0 }; - mi.flags = CMIM_NAME; + + int flags; TCHAR *tmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "GPGPubKey", _T("")); if(!tmp[0]) { db_unset(hContact, szGPGModuleName, "GPGEncryption"); - mi.flags += CMIM_FLAGS | CMIF_GRAYED; + flags = CMIF_GRAYED; } - else - mi.flags = CMIM_NAME | CMIM_FLAGS; - mi.pszName = db_get_b(hContact, szGPGModuleName, "GPGEncryption", 0)?"Turn off GPG encryption":"Turn on GPG encryption"; - Menu_ModifyItem(hToggleEncryption, &mi); + else flags = 0; + + Menu_ModifyItem(hToggleEncryption, + db_get_b(hContact, szGPGModuleName, "GPGEncryption", 0) ? _T("Turn off GPG encryption") : _T("Turn on GPG encryption"), + INVALID_HANDLE_VALUE, flags); mir_free(tmp); return 0; } diff --git a/plugins/NewsAggregator/Src/Menus.cpp b/plugins/NewsAggregator/Src/Menus.cpp index bf40363323..89fd65cdd1 100644 --- a/plugins/NewsAggregator/Src/Menus.cpp +++ b/plugins/NewsAggregator/Src/Menus.cpp @@ -74,11 +74,5 @@ void InitMenu() mi.pszService = MS_NEWSAGGREGATOR_CHANGEFEED;
hService2[6] = Menu_AddContactMenuItem(&mi);
- memset(&mi, 0, sizeof(mi));
- mi.flags = CMIM_ICON;
- if (db_get_b(NULL, MODULE, "AutoUpdate", 1))
- mi.icolibItem = GetIconHandle("enabled");
- else
- mi.icolibItem = GetIconHandle("disabled");
- Menu_ModifyItem(hService2[0], &mi);
+ Menu_ModifyItem(hService2[0], NULL, GetIconHandle(db_get_b(NULL, MODULE, "AutoUpdate", 1) ? "enabled" : "disabled"));
}
\ No newline at end of file diff --git a/plugins/NewsAggregator/Src/Services.cpp b/plugins/NewsAggregator/Src/Services.cpp index 444800f8db..a37fbf5ac0 100644 --- a/plugins/NewsAggregator/Src/Services.cpp +++ b/plugins/NewsAggregator/Src/Services.cpp @@ -231,17 +231,11 @@ void UpdateMenu(bool State) {
CLISTMENUITEM mi = { 0 };
- if (!State) { // to enable auto-update
- mi.ptszName = LPGENT("Auto Update Enabled");
- mi.icolibItem = GetIconHandle("enabled");
- }
- else { // to disable auto-update
- mi.ptszName = LPGENT("Auto Update Disabled");
- mi.icolibItem = GetIconHandle("disabled");
- }
+ if (!State) // to enable auto-update
+ Menu_ModifyItem(hService2[0], LPGENT("Auto Update Enabled"), GetIconHandle("enabled"));
+ else // to disable auto-update
+ Menu_ModifyItem(hService2[0], LPGENT("Auto Update Disabled"), GetIconHandle("disabled"));
- mi.flags = CMIM_ICON | CMIM_NAME | CMIF_TCHAR;
- Menu_ModifyItem(hService2[0], &mi);
CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTBButton, State ? TTBST_PUSHED : 0);
db_set_b(NULL, MODULE, "AutoUpdate", !State);
}
diff --git a/plugins/NoHistory/src/dllmain.cpp b/plugins/NoHistory/src/dllmain.cpp index fe6d15fc5f..73a1d70c2a 100644 --- a/plugins/NoHistory/src/dllmain.cpp +++ b/plugins/NoHistory/src/dllmain.cpp @@ -146,15 +146,14 @@ int PrebuildContactMenu(WPARAM hContact, LPARAM lParam) char *proto = GetContactProto(hContact);
bool chat_room = (proto && db_get_b(hContact, proto, "ChatRoom", 0) != 0);
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_FLAGS | CMIF_TCHAR;
- if (chat_room) mi.flags |= CMIF_HIDDEN;
+ if (chat_room)
+ Menu_ShowItem(hMenuToggle, false);
else {
- mi.flags |= (CMIM_NAME | CMIM_ICON);
- mi.ptszName = (remove ? LPGENT("Enable History") : LPGENT("Disable History"));
- mi.hIcon = (remove ? hIconKeep : hIconRemove);
+ if (remove)
+ Menu_ModifyItem(hMenuToggle, LPGENT("Enable History"), hIconKeep);
+ else
+ Menu_ModifyItem(hMenuToggle, LPGENT("Disable History"), hIconRemove);
}
- Menu_ModifyItem(hMenuToggle, &mi);
Menu_ShowItem(hMenuClear, !chat_room && db_event_count(hContact) > 0);
return 0;
diff --git a/plugins/PasteIt/src/PasteIt.cpp b/plugins/PasteIt/src/PasteIt.cpp index 90ab2e97e5..3ed7dd848b 100644 --- a/plugins/PasteIt/src/PasteIt.cpp +++ b/plugins/PasteIt/src/PasteIt.cpp @@ -333,13 +333,9 @@ void InitMenuItems() void DefWebPageChanged()
{
- CLISTMENUITEM mi = { 0 };
for (int i = 0; i < PasteToWeb::pages; i++) {
- mi.flags = CMIM_FLAGS;
- if (Options::instance->defWeb == i)
- mi.flags |= CMIF_CHECKED;
-
- Menu_ModifyItem(hWebPageMenus[i], &mi);
+ int flags = (Options::instance->defWeb == i) ? CMIF_CHECKED : 0;
+ Menu_ModifyItem(hWebPageMenus[i], NULL, INVALID_HANDLE_VALUE, flags);
}
}
diff --git a/plugins/Popup/src/main.cpp b/plugins/Popup/src/main.cpp index c9f5a3c73b..8bd25c587d 100644 --- a/plugins/Popup/src/main.cpp +++ b/plugins/Popup/src/main.cpp @@ -110,22 +110,19 @@ static int IconsChanged(WPARAM, LPARAM) {
LoadActions();
- CLISTMENUITEM mi = { 0 };
+ 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.
- mi.hIcon = IcoLib_GetIcon(ICO_POPUP_ON, 0);
+ hIcon = IcoLib_GetIcon(ICO_POPUP_ON, 0);
}
else { // The module is disabled.
// The action to do is enable popups (show enabled), then write "disable popup" in the new item.
- mi.hIcon = IcoLib_GetIcon(ICO_POPUP_OFF, 0);
+ hIcon = IcoLib_GetIcon(ICO_POPUP_OFF, 0);
}
- mi.flags = CMIM_ICON;
- Menu_ModifyItem(hMenuItem, &mi);
- Menu_ModifyItem(hMenuRoot, &mi);
+ Menu_ModifyItem(hMenuItem, NULL, hIcon);
+ Menu_ModifyItem(hMenuRoot, NULL, hIcon);
- mi.hIcon = IcoLib_GetIcon(ICO_HISTORY, 0);
- mi.flags = CMIM_ICON;
- Menu_ModifyItem(hMenuItemHistory, &mi);
+ Menu_ModifyItem(hMenuItemHistory, NULL, IcoLib_GetIcon(ICO_HISTORY, 0));
return 0;
}
@@ -149,27 +146,23 @@ static int TTBLoaded(WPARAM, LPARAM) //===== EnableDisableMenuCommand ========================================================
INT_PTR svcEnableDisableMenuCommand(WPARAM, LPARAM)
{
- CLISTMENUITEM mi = { 0 };
+ HICON 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);
- mi.ptszName = LPGENT("Enable Popups");
- mi.hIcon = IcoLib_GetIcon(ICO_POPUP_OFF, 0);
+ Menu_ModifyItem(hMenuItem, LPGENT("Enable Popups"), hIcon = IcoLib_GetIcon(ICO_POPUP_OFF, 0));
}
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);
- mi.ptszName = LPGENT("Disable Popups");
- mi.hIcon = IcoLib_GetIcon(ICO_POPUP_ON, 0);
+ Menu_ModifyItem(hMenuItem, LPGENT("Disable Popups"), hIcon = IcoLib_GetIcon(ICO_POPUP_ON, 0));
}
- mi.flags = CMIM_NAME | CMIM_ICON | CMIF_TCHAR;
- Menu_ModifyItem(hMenuItem, &mi);
- mi.flags = CMIM_ICON;
- Menu_ModifyItem(hMenuRoot, &mi);
+
+ Menu_ModifyItem(hMenuRoot, NULL, hIcon);
if (hTTButton)
CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTTButton, (PopupOptions.ModuleIsEnabled) ? TTBST_PUSHED : 0);
diff --git a/plugins/Quotes/src/Forex.cpp b/plugins/Quotes/src/Forex.cpp index 908f8074c5..d565deff7a 100644 --- a/plugins/Quotes/src/Forex.cpp +++ b/plugins/Quotes/src/Forex.cpp @@ -44,64 +44,14 @@ namespace void UpdateMenu(bool bAutoUpdate)
{
- CLISTMENUITEM mi = { 0 };
-
- if (bAutoUpdate) { // to enable auto-update
- mi.pszName = LPGEN("Auto Update Enabled");
- mi.icolibItem = Quotes_GetIconHandle(IDI_ICON_MAIN);
- //opt.AutoUpdate = 1;
- }
- else { // to disable auto-update
- mi.pszName = LPGEN("Auto Update Disabled");
- mi.icolibItem = Quotes_GetIconHandle(IDI_ICON_DISABLED);
- //opt.AutoUpdate = 0;
- }
+ if (bAutoUpdate) // to enable auto-update
+ Menu_ModifyItem(g_hEnableDisableMenu, LPGENT("Auto Update Enabled"), Quotes_GetIconHandle(IDI_ICON_MAIN));
+ else // to disable auto-update
+ Menu_ModifyItem(g_hEnableDisableMenu, LPGENT("Auto Update Disabled"), Quotes_GetIconHandle(IDI_ICON_DISABLED));
- mi.flags = CMIM_ICON | CMIM_NAME;
- Menu_ModifyItem(g_hEnableDisableMenu, &mi);
CallService(MS_TTB_SETBUTTONSTATE, reinterpret_cast<WPARAM>(g_hTBButton), !bAutoUpdate ? TTBST_PUSHED : 0);
}
-
- // INT_PTR QuoteProtoFunc_SetStatus(WPARAM wp,LPARAM /*lp*/)
- // {
- // if ((ID_STATUS_ONLINE == wp) || (ID_STATUS_OFFLINE == wp))
- // {
- // bool bAutoUpdate = (ID_STATUS_ONLINE == wp);
- // bool bOldFlag = g_bAutoUpdate;
- //
- // if(bAutoUpdate != g_bAutoUpdate)
- // {
- // g_bAutoUpdate = bAutoUpdate;
- // db_set_b(NULL,QUOTES_MODULE_NAME,DB_STR_AUTO_UPDATE,g_bAutoUpdate);
- // if (bOldFlag && !g_bAutoUpdate)
- // {
- // BOOL b = ::SetEvent(g_hEventWorkThreadStop);
- // assert(b);
- // }
- // else if (g_bAutoUpdate && !bOldFlag)
- // {
- // BOOL b = ::ResetEvent(g_hEventWorkThreadStop);
- // assert(b && "Failed to reset event");
- //
- // const CModuleInfo::TQuotesProvidersPtr& pProviders = CModuleInfo::GetQuoteProvidersPtr();
- // const CQuotesProviders::TQuotesProviders& rapProviders = pProviders->GetProviders();
- // for(CQuotesProviders::TQuotesProviders::const_iterator i = rapProviders.begin();i != rapProviders.end();++i)
- // {
- // const CQuotesProviders::TQuotesProviderPtr& pProvider = *i;
- // g_ahThreads.push_back( mir_forkthread(WorkingThread, pProvider.get()));
- // }
- // }
- //
- // UpdateMenu(g_bAutoUpdate);
- // //ProtoBroadcastAck(QUOTES_PROTOCOL_NAME,NULL,ACKTYPE_STATUS,ACKRESULT_SUCCESS,reinterpret_cast<HANDLE>(nOldStatus),g_nStatus);
- // }
- //
- // }
- //
- // return 0;
- // }
-
INT_PTR QuotesMenu_RefreshAll(WPARAM, LPARAM)
{
const CQuotesProviders::TQuotesProviders& apProviders = CModuleInfo::GetQuoteProvidersPtr()->GetProviders();
diff --git a/plugins/Quotes/src/QuoteInfoDlg.cpp b/plugins/Quotes/src/QuoteInfoDlg.cpp index ddde8e2a73..32a5f5e84e 100644 --- a/plugins/Quotes/src/QuoteInfoDlg.cpp +++ b/plugins/Quotes/src/QuoteInfoDlg.cpp @@ -273,12 +273,7 @@ namespace {
void enable_menu(HGENMENU hMenu, bool bEnable)
{
- CLISTMENUITEM clmi = { 0 };
- clmi.flags = CMIM_FLAGS;
- if (false == bEnable)
- clmi.flags |= CMIF_GRAYED;
-
- Menu_ModifyItem(hMenu, &clmi);
+ Menu_ModifyItem(hMenu, NULL, INVALID_HANDLE_VALUE, (bEnable) ? 0 : CMIF_GRAYED);
}
}
diff --git a/plugins/RecentContacts/src/RecentContacts.cpp b/plugins/RecentContacts/src/RecentContacts.cpp index 1ef0dfab7a..c097b42bd5 100644 --- a/plugins/RecentContacts/src/RecentContacts.cpp +++ b/plugins/RecentContacts/src/RecentContacts.cpp @@ -501,15 +501,10 @@ int OnMsgEvent(WPARAM wParam, LPARAM lParam) static int OnPrebuildContactMenu(WPARAM hContact, LPARAM lParam)
{
- CLISTMENUITEM clmi = { 0 };
- clmi.flags = CMIM_NAME | CMIF_TCHAR;
-
if (db_get_b(hContact, dbLastUC_ModuleName, dbLastUC_IgnoreContact, 0) == 0)
- clmi.ptszName = TranslateT("Ignore Contact");
+ Menu_ModifyItem(hMenuItemRemove, LPGENT("Ignore Contact"));
else
- clmi.ptszName = TranslateT("Show Contact");
-
- Menu_ModifyItem(hMenuItemRemove, &clmi);
+ Menu_ModifyItem(hMenuItemRemove, LPGENT("Show Contact"));
return 0;
}
diff --git a/plugins/SecureIM/src/svcs_clist.cpp b/plugins/SecureIM/src/svcs_clist.cpp index 575f068818..7a7a60c2b4 100644 --- a/plugins/SecureIM/src/svcs_clist.cpp +++ b/plugins/SecureIM/src/svcs_clist.cpp @@ -69,15 +69,13 @@ int __cdecl onRebuildContactMenu(WPARAM hContact, LPARAM lParam) if (bMC)
hContact = db_mc_getMostOnline(hContact); // âîçüìåì òîò, ÷åðåç êîòîðûé ïîéäåò ñîîáùåíèå
pUinKey ptr = getUinKey(hContact);
- int i;
- CLISTMENUITEM mi = { 0 };
ShowStatusIconNotify(hContact);
// check offline/online
if (!ptr) {
// hide menu bars
- for (i = 0; i < _countof(g_hMenu); i++)
+ for (int i = 0; i < _countof(g_hMenu); i++)
Menu_ShowItem(g_hMenu[i], false);
return 0;
}
@@ -90,36 +88,24 @@ int __cdecl onRebuildContactMenu(WPARAM hContact, LPARAM lParam) bool isMiranda = isClientMiranda(hContact);
// hide all menu bars
- for (i = 0; i < _countof(g_hMenu); i++)
+ for (int i = 0; i < _countof(g_hMenu); i++)
Menu_ShowItem(g_hMenu[i], false);
if (isSecureProto && !isChat && isMiranda &&
(ptr->mode == MODE_NATIVE || ptr->mode == MODE_RSAAES)) {
// Native/RSAAES
- mi.flags = CMIM_FLAGS | CMIF_NOTOFFLINE | CMIM_ICON;
- if (!isSecured) {
- // create secureim connection
- mi.hIcon = mode2icon(ptr->mode | SECURED, 2);
- Menu_ModifyItem(g_hMenu[0], &mi);
- }
- else {
- // disable secureim connection
- mi.hIcon = mode2icon(ptr->mode, 2);
- Menu_ModifyItem(g_hMenu[1], &mi);
- }
+
+ if (!isSecured) // create secureim connection
+ Menu_ModifyItem(g_hMenu[0], NULL, mode2icon(ptr->mode | SECURED, 2));
+ else // disable secureim connection
+ Menu_ModifyItem(g_hMenu[1], NULL, mode2icon(ptr->mode, 2));
+
// set status menu
if (bSCM && !bMC && (!isSecured || ptr->mode == MODE_PGP || ptr->mode == MODE_GPG)) {
+ Menu_ModifyItem(g_hMenu[2], _A2T(sim312[ptr->status]), g_hICO[ICO_ST_DIS + ptr->status]);
- mi.flags = CMIM_FLAGS | CMIM_NAME | CMIM_ICON;
- mi.hIcon = g_hICO[ICO_ST_DIS + ptr->status];
- mi.pszName = (LPSTR)sim312[ptr->status];
- Menu_ModifyItem(g_hMenu[2], &mi);
-
- mi.flags = CMIM_FLAGS | CMIM_ICON;
- for (i = 0; i <= (ptr->mode == MODE_RSAAES ? 1 : 2); i++) {
- mi.hIcon = (i == ptr->status) ? g_hICO[ICO_ST_DIS + ptr->status] : NULL;
- Menu_ModifyItem(g_hMenu[3 + i], &mi);
- }
+ for (int i = 0; i <= (ptr->mode == MODE_RSAAES ? 1 : 2); i++)
+ Menu_ModifyItem(g_hMenu[3 + i], NULL, (i == ptr->status) ? g_hICO[ICO_ST_DIS + ptr->status] : NULL);
}
}
else if (isSecureProto && !isChat && (ptr->mode == MODE_PGP || ptr->mode == MODE_GPG)) {
@@ -135,17 +121,12 @@ int __cdecl onRebuildContactMenu(WPARAM hContact, LPARAM lParam) if (isSecureProto && !isChat && isMiranda) {
// set mode menu
if (bMCM && !bMC && (!isSecured || ptr->mode == MODE_PGP || ptr->mode == MODE_GPG)) {
- mi.flags = CMIM_FLAGS | CMIM_NAME | CMIM_ICON;
- mi.hIcon = g_hICO[ICO_OV_NAT + ptr->mode];
- mi.pszName = (LPSTR)sim311[ptr->mode];
- Menu_ModifyItem(g_hMenu[10], &mi);
+ Menu_ModifyItem(g_hMenu[10], _A2T(sim311[ptr->mode]), g_hICO[ICO_OV_NAT + ptr->mode]);
- mi.flags = CMIM_FLAGS | CMIM_ICON;
- for (i = 0; i < MODE_CNT; i++) {
+ for (int i = 0; i < MODE_CNT; i++) {
if (i == MODE_PGP && ptr->mode != MODE_PGP && !bPGP) continue;
if (i == MODE_GPG && ptr->mode != MODE_GPG && !bGPG) continue;
- mi.hIcon = (i == ptr->mode) ? g_hICO[ICO_ST_ENA] : NULL;
- Menu_ModifyItem(g_hMenu[11 + i], &mi);
+ Menu_ModifyItem(g_hMenu[11 + i], NULL, (i == ptr->mode) ? g_hICO[ICO_ST_ENA] : NULL);
}
}
}
diff --git a/plugins/SeenPlugin/src/menu.cpp b/plugins/SeenPlugin/src/menu.cpp index a2dc3b077d..58d0c1818b 100644 --- a/plugins/SeenPlugin/src/menu.cpp +++ b/plugins/SeenPlugin/src/menu.cpp @@ -40,33 +40,31 @@ int BuildContactMenu(WPARAM wparam, LPARAM) MCONTACT hContact = (MCONTACT)wparam;
char *szProto = GetContactProto(hContact);
- CLISTMENUITEM cmi = { 0 };
- if (!IsWatchedProtocol(szProto) || db_get_b(hContact, szProto, "ChatRoom", false) || !db_get_b(NULL, S_MOD, "MenuItem", 1))
- cmi.flags = CMIM_FLAGS | CMIF_HIDDEN | CMIF_TCHAR;
- else {
- cmi.flags = CMIM_NAME | CMIM_FLAGS | CMIM_ICON | CMIF_TCHAR;
- cmi.hIcon = NULL;
-
- DBVARIANT dbv;
- if (!db_get_ts(NULL, S_MOD, "MenuStamp", &dbv)) {
- cmi.ptszName = ParseString(dbv.ptszVal, (MCONTACT)wparam, 0);
- db_free(&dbv);
- }
- else cmi.ptszName = ParseString(DEFAULT_MENUSTAMP, (MCONTACT)wparam, 0);
-
- if (!mir_tstrcmp(cmi.ptszName, TranslateT("<unknown>"))) {
- if (IsWatchedProtocol(szProto))
- cmi.flags |= CMIF_GRAYED;
- else
- cmi.flags |= CMIF_HIDDEN;
- }
- else if (db_get_b(NULL, S_MOD, "ShowIcon", 1)) {
- isetting = db_get_w(hContact, S_MOD, "StatusTriger", -1);
- cmi.hIcon = Skin_LoadProtoIcon(szProto, isetting | 0x8000);
- }
+ if (!IsWatchedProtocol(szProto) || db_get_b(hContact, szProto, "ChatRoom", false) || !db_get_b(NULL, S_MOD, "MenuItem", 1)) {
+ Menu_ShowItem(hmenuitem, false);
+ return 0;
}
- Menu_ModifyItem(hmenuitem, &cmi);
+ LPCTSTR ptszName;
+ ptrT tszStamp(db_get_tsa(NULL, S_MOD, "MenuStamp"));
+ if (tszStamp != NULL)
+ ptszName = ParseString(tszStamp , (MCONTACT)wparam, 0);
+ else
+ ptszName = ParseString(DEFAULT_MENUSTAMP, (MCONTACT)wparam, 0);
+
+ int flags = 0;
+ HICON hIcon = NULL;
+ if (!mir_tstrcmp(ptszName, TranslateT("<unknown>"))) {
+ if (IsWatchedProtocol(szProto))
+ flags |= CMIF_GRAYED;
+ else
+ flags |= CMIF_HIDDEN;
+ }
+ else if (db_get_b(NULL, S_MOD, "ShowIcon", 1)) {
+ isetting = db_get_w(hContact, S_MOD, "StatusTriger", -1);
+ hIcon = Skin_LoadProtoIcon(szProto, isetting | 0x8000);
+ }
+ Menu_ModifyItem(hmenuitem, ptszName, hIcon, flags);
return 0;
}
diff --git a/plugins/Sessions/Src/Main.cpp b/plugins/Sessions/Src/Main.cpp index 10c2929aec..153ab20540 100644 --- a/plugins/Sessions/Src/Main.cpp +++ b/plugins/Sessions/Src/Main.cpp @@ -795,11 +795,10 @@ static int PluginInit(WPARAM, LPARAM) // Main menu
CLISTMENUITEM cl = { 0 };
cl.position = 1000000000;
- cl.flags = CMIM_ALL;
cl.pszName = LPGEN("Save session...");
cl.pszPopupName = LPGEN("Sessions Manager");
- cl.icolibItem = iconList[0].hIcolib;
+ cl.icolibItem = iconList[4].hIcolib;
cl.pszService = MS_SESSIONS_SAVEUSERSESSION;
hmSaveCurrentSession = Menu_AddMainMenuItem(&cl);
@@ -818,12 +817,6 @@ static int PluginInit(WPARAM, LPARAM) cl.icolibItem = iconList[5].hIcolib;
cl.position = 10100000;
Menu_AddMainMenuItem(&cl);
-
- memset(&cl, 0, sizeof(cl));
- cl.flags = CMIM_ICON;
- cl.icolibItem = iconList[4].hIcolib;
- Menu_ModifyItem(hmSaveCurrentSession, &cl);
-
return 0;
}
diff --git a/plugins/SimpleAR/src/Main.cpp b/plugins/SimpleAR/src/Main.cpp index b8c2f8bf39..27195caeaf 100644 --- a/plugins/SimpleAR/src/Main.cpp +++ b/plugins/SimpleAR/src/Main.cpp @@ -62,11 +62,10 @@ INT_PTR ToggleEnable(WPARAM wParam, LPARAM lParam) BOOL fEnabled = !db_get_b(NULL, protocolname, KEY_ENABLED, 1);
db_set_b(NULL, protocolname, KEY_ENABLED, fEnabled);
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_NAME | CMIM_ICON | CMIF_TCHAR;
- mi.ptszName = fEnabled ? LPGENT("Disable Auto&reply") : LPGENT("Enable Auto&reply");
- mi.icolibItem = fEnabled ? iconList[0].hIcolib : iconList[1].hIcolib;
- Menu_ModifyItem(hEnableMenu, &mi);
+ if (fEnabled)
+ Menu_ModifyItem(hEnableMenu, LPGENT("Disable Auto&reply"), iconList[0].hIcolib);
+ else
+ Menu_ModifyItem(hEnableMenu, LPGENT("Enable Auto&reply"), iconList[1].hIcolib);
return 0;
}
@@ -77,11 +76,10 @@ INT_PTR Toggle(WPARAM w, LPARAM l) db_set_b(hContact, protocolname, "TurnedOn", on);
on = !on;
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_NAME | CMIM_ICON | CMIF_TCHAR;
- mi.ptszName = on ? LPGENT("Turn off Autoanswer") : LPGENT("Turn on Autoanswer");
- mi.icolibItem = on ? iconList[0].hIcolib : iconList[1].hIcolib;
- Menu_ModifyItem(hToggle, &mi);
+ if (on)
+ Menu_ModifyItem(hToggle, LPGENT("Turn off Autoanswer"), iconList[0].hIcolib);
+ else
+ Menu_ModifyItem(hToggle, LPGENT("Turn on Autoanswer"), iconList[1].hIcolib);
return 0;
}
@@ -89,12 +87,11 @@ INT OnPreBuildContactMenu(WPARAM w, LPARAM l) {
MCONTACT hContact = (MCONTACT)w;
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_NAME | CMIM_ICON | CMIF_TCHAR;
- BOOL on = !db_get_b(hContact, protocolname, "TurnedOn", 0);
- mi.ptszName = on ? LPGENT("Turn off Autoanswer") : LPGENT("Turn on Autoanswer");
- mi.icolibItem = on ? iconList[0].hIcolib : iconList[1].hIcolib;
- Menu_ModifyItem(hToggle, &mi);
+ BOOL on = !db_get_b(hContact, protocolname, "TurnedOn", 0);
+ if (on)
+ Menu_ModifyItem(hToggle, LPGENT("Turn off Autoanswer"), iconList[0].hIcolib);
+ else
+ Menu_ModifyItem(hToggle, LPGENT("Turn on Autoanswer"), iconList[1].hIcolib);
return 0;
}
@@ -138,12 +135,10 @@ INT CheckDefaults(WPARAM, LPARAM) gbVarsServiceExist = TRUE;
BOOL fEnabled = db_get_b(NULL, protocolname, KEY_ENABLED, 1);
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_NAME | CMIM_ICON | CMIF_TCHAR;
- mi.ptszName = fEnabled ? LPGENT("Disable Auto&reply") : LPGENT("Enable Auto&reply");
- mi.icolibItem = fEnabled ? iconList[0].hIcolib : iconList[1].hIcolib;
- Menu_ModifyItem(hEnableMenu, &mi);
-
+ if (fEnabled)
+ Menu_ModifyItem(hEnableMenu, LPGENT("Disable Auto&reply"), iconList[0].hIcolib);
+ else
+ Menu_ModifyItem(hEnableMenu, LPGENT("Enable Auto&reply"), iconList[1].hIcolib);
return 0;
}
diff --git a/plugins/SimpleAR/src/Options.cpp b/plugins/SimpleAR/src/Options.cpp index a4b54633e4..011b19ee72 100644 --- a/plugins/SimpleAR/src/Options.cpp +++ b/plugins/SimpleAR/src/Options.cpp @@ -92,11 +92,11 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara BOOL fEnabled = IsDlgButtonChecked(hwndDlg, IDC_ENABLEREPLIER) == 1;
db_set_b(NULL, protocolname, KEY_ENABLED, (BYTE)fEnabled);
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_NAME | CMIM_ICON | CMIF_TCHAR;
- mi.ptszName = fEnabled ? LPGENT("Disable Auto&reply") : LPGENT("Enable Auto&reply");
- mi.icolibItem = fEnabled ? iconList[0].hIcolib : iconList[1].hIcolib;
- Menu_ModifyItem(hEnableMenu, &mi);
+
+ if (fEnabled)
+ Menu_ModifyItem(hEnableMenu, LPGENT("Disable Auto&reply"), iconList[0].hIcolib);
+ else
+ Menu_ModifyItem(hEnableMenu, LPGENT("Enable Auto&reply"), iconList[1].hIcolib);
GetDlgItemText(hwndDlg, IDC_HEADING, ptszText, _countof(ptszText));
db_set_ts(NULL, protocolname, KEY_HEADING, ptszText);
diff --git a/plugins/SimpleStatusMsg/src/awaymsg.cpp b/plugins/SimpleStatusMsg/src/awaymsg.cpp index b520f6924e..4b12971e99 100644 --- a/plugins/SimpleStatusMsg/src/awaymsg.cpp +++ b/plugins/SimpleStatusMsg/src/awaymsg.cpp @@ -366,41 +366,34 @@ static int AwayMsgPreBuildMenu(WPARAM hContact, LPARAM lParam) int iHidden = szProto ? db_get_b(hContact, szProto, "ChatRoom", 0) : 0;
int iStatus;
- CLISTMENUITEM clmi = { 0 };
- clmi.flags = CMIM_FLAGS | CMIF_HIDDEN | CMIF_TCHAR;
if (!iHidden) {
iHidden = 1;
iStatus = db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE);
if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGRECV) {
if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(iStatus == ID_STATUS_OFFLINE ? ID_STATUS_INVISIBLE : iStatus)) {
iHidden = 0;
- clmi.flags = CMIM_FLAGS | CMIM_NAME | CMIM_ICON | CMIF_TCHAR;
- clmi.hIcon = Skin_LoadProtoIcon(szProto, iStatus);
+ HICON hIcon = Skin_LoadProtoIcon(szProto, iStatus);
mir_sntprintf(str, _countof(str), TranslateT("Re&ad %s message"), pcli->pfnGetStatusModeDescription(iStatus, 0));
- clmi.ptszName = str;
+ Menu_ModifyItem(hAwayMsgMenuItem, str, hIcon, 0);
+ IcoLib_ReleaseIcon(hIcon);
}
}
}
- Menu_ModifyItem(hAwayMsgMenuItem, &clmi);
- IcoLib_ReleaseIcon(clmi.hIcon);
+ else Menu_ShowItem(hAwayMsgMenuItem, false);
ptrA szMsg(db_get_sa(hContact, "CList", "StatusMsg"));
- clmi.flags = CMIM_FLAGS | CMIF_HIDDEN | CMIF_TCHAR;
if (!iHidden && szMsg != NULL) {
- clmi.flags = CMIM_FLAGS | CMIM_NAME | CMIF_TCHAR;
mir_sntprintf(str, _countof(str), TranslateT("Copy %s message"), pcli->pfnGetStatusModeDescription(iStatus, 0));
- clmi.ptszName = str;
+ Menu_ModifyItem(hCopyMsgMenuItem, str);
}
- Menu_ModifyItem(hCopyMsgMenuItem, &clmi);
+ else Menu_ShowItem(hCopyMsgMenuItem, false);
- clmi.flags = CMIM_FLAGS | CMIF_HIDDEN | CMIF_TCHAR;
if (!iHidden && szMsg != NULL && StrFindURL(szMsg) != NULL) {
- clmi.flags = CMIM_FLAGS | CMIM_NAME | CMIF_TCHAR;
mir_sntprintf(str, _countof(str), TranslateT("&Go to URL in %s message"), pcli->pfnGetStatusModeDescription(iStatus, 0));
- clmi.ptszName = str;
+ Menu_ModifyItem(hGoToURLMenuItem, str);
}
- Menu_ModifyItem(hGoToURLMenuItem, &clmi);
+ else Menu_ShowItem(hGoToURLMenuItem, false);
return 0;
}
diff --git a/plugins/SmileyAdd/src/services.cpp b/plugins/SmileyAdd/src/services.cpp index 4be61bcd09..cb9b4bb884 100644 --- a/plugins/SmileyAdd/src/services.cpp +++ b/plugins/SmileyAdd/src/services.cpp @@ -294,7 +294,7 @@ int RebuildContactMenu(WPARAM wParam, LPARAM) CLISTMENUITEM mi = { 0 };
mi.hParentMenu = hContactMenuItem;
- mi.flags = CMIF_CHILDPOPUP | CMIM_FLAGS | CMIF_TCHAR;
+ mi.flags = CMIF_CHILDPOPUP | CMIF_TCHAR;
mi.pszService = MS_SMILEYADD_CUSTOMCATMENU;
bool nonecheck = true;
diff --git a/plugins/StartupSilence/src/main.cpp b/plugins/StartupSilence/src/main.cpp index 17bd44b006..3595e1884d 100644 --- a/plugins/StartupSilence/src/main.cpp +++ b/plugins/StartupSilence/src/main.cpp @@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. HINSTANCE hInst;
int hLangpack;
-HANDLE hSSMenuToggleOnOff;
+HGENMENU hSSMenuToggleOnOff;
HANDLE GetIconHandle(char *szIcon);
HANDLE hOptionsInitialize;
HANDLE hTTBarloaded = NULL;
@@ -284,16 +284,12 @@ static INT_PTR SturtupSilenceEnabled(WPARAM wParam, LPARAM lParam) static INT_PTR SilenceConnection(WPARAM wParam, LPARAM lParam)
{
timer = (BYTE)wParam;
-// if (timer == 2) //commented for now
-// db_set_b(NULL, "Skin", "UseSound", 0);
-// else db_set_b(NULL, "Skin", "UseSound", 1);
return 0;
}
static INT_PTR InitMenu()
{
CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_ALL;
mi.position = 100000000;
mi.icolibItem = GetIconHandle(MENU_NAME);
mi.pszPopupName = MENU_NAME;
@@ -305,11 +301,11 @@ static INT_PTR InitMenu() void UpdateMenu()
{
- CLISTMENUITEM mi = { 0 };
- mi.pszName = (Enabled == 1 ? DISABLE_SILENCE : ENABLE_SILENCE);
- mi.flags = CMIM_NAME | CMIM_ALL;
- mi.icolibItem = (Enabled == 1 ? GetIconHandle(DISABLE_SILENCE) : GetIconHandle(ENABLE_SILENCE));
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hSSMenuToggleOnOff, (LPARAM)&mi);
+ if (Enabled == 1)
+ Menu_ModifyItem(hSSMenuToggleOnOff, _T(DISABLE_SILENCE), GetIconHandle(DISABLE_SILENCE));
+ else
+ Menu_ModifyItem(hSSMenuToggleOnOff, _T(ENABLE_SILENCE), GetIconHandle(ENABLE_SILENCE));
+
UpdateTTB();
}
diff --git a/plugins/TabSRMM/src/typingnotify.cpp b/plugins/TabSRMM/src/typingnotify.cpp index 8959c00006..c34ed8328f 100644 --- a/plugins/TabSRMM/src/typingnotify.cpp +++ b/plugins/TabSRMM/src/typingnotify.cpp @@ -46,19 +46,10 @@ static INT_PTR EnableDisableMenuCommand(WPARAM, LPARAM) Disabled = !Disabled;
if (PluginConfig.g_bPopupAvail) {
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_ICON | CMIM_NAME;
-
- if (!Disabled) {
- mi.pszName = LPGEN("Disable &typing notification");
- mi.hIcon = LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_ENABLED));
- }
- else {
- mi.pszName = LPGEN("Enable &typing notification");
- mi.hIcon = LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_DISABLED));
- }
-
- Menu_ModifyItem(hDisableMenu, &mi);
+ if (!Disabled)
+ Menu_ModifyItem(hDisableMenu, LPGENT("Disable &typing notification"), LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_ENABLED)));
+ else
+ Menu_ModifyItem(hDisableMenu, LPGENT("Enable &typing notification"), LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_DISABLED)));
}
return 0;
diff --git a/plugins/UserInfoEx/src/svc_refreshci.cpp b/plugins/UserInfoEx/src/svc_refreshci.cpp index be63013024..f30db6a40b 100644 --- a/plugins/UserInfoEx/src/svc_refreshci.cpp +++ b/plugins/UserInfoEx/src/svc_refreshci.cpp @@ -609,13 +609,7 @@ class CContactUpdater : public CContactQueue // reset menu
if (hMenuItemRefresh)
- {
- CLISTMENUITEM clmi = { 0 };
- clmi.flags = CMIM_NAME|CMIM_ICON;
- clmi.pszName = LPGEN("Refresh contact details");
- clmi.hIcon = IcoLib_GetIcon(ICO_BTN_UPDATE);
- Menu_ModifyItem(hMenuItemRefresh, &clmi);
- }
+ Menu_ModifyItem(hMenuItemRefresh, LPGENT("Refresh contact details"), IcoLib_GetIcon(ICO_BTN_UPDATE));
}
/**
@@ -726,13 +720,7 @@ public: // if there are contacts in the queue, change the main menu item to indicate it is meant for canceling.
if (hMenuItemRefresh && Size() > 0)
- {
- CLISTMENUITEM clmi = { 0 };
- clmi.flags = CMIM_NAME|CMIM_ICON;
- clmi.pszName = LPGEN("Abort Refreshing Contact Details");
- clmi.hIcon = IcoLib_GetIcon(ICO_BTN_CANCEL);
- Menu_ModifyItem(hMenuItemRefresh, &clmi);
- }
+ Menu_ModifyItem(hMenuItemRefresh, LPGENT("Abort Refreshing Contact Details"), IcoLib_GetIcon(ICO_BTN_CANCEL));
}
/**
diff --git a/plugins/Weather/src/weather_mwin.cpp b/plugins/Weather/src/weather_mwin.cpp index 91eac1360a..0e7ed6998f 100644 --- a/plugins/Weather/src/weather_mwin.cpp +++ b/plugins/Weather/src/weather_mwin.cpp @@ -305,10 +305,8 @@ INT_PTR Mwin_MenuClicked(WPARAM wParam,LPARAM lParam) int BuildContactMenu(WPARAM wparam,LPARAM lparam)
{
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_FLAGS |
- (db_get_dw((MCONTACT)wparam, WEATHERPROTONAME, "mwin", 0) ? CMIF_CHECKED : 0);
- Menu_ModifyItem(hMwinMenu, &mi);
+ int flags = db_get_dw((MCONTACT)wparam, WEATHERPROTONAME, "mwin", 0) ? CMIF_CHECKED : 0;
+ Menu_ModifyItem(hMwinMenu, NULL, INVALID_HANDLE_VALUE, flags);
return 0;
}
diff --git a/plugins/Weather/src/weather_svcs.cpp b/plugins/Weather/src/weather_svcs.cpp index 689f88976a..278525c496 100644 --- a/plugins/Weather/src/weather_svcs.cpp +++ b/plugins/Weather/src/weather_svcs.cpp @@ -226,23 +226,16 @@ void UpdateMenu(BOOL State) opt.CAutoUpdate = State;
db_set_b(NULL, WEATHERPROTONAME, "AutoUpdate", (BYTE)State);
- CLISTMENUITEM mi = { 0 };
-
if (State) { // to enable auto-update
- mi.pszName = LPGEN("Auto Update Enabled");
- mi.icolibItem = GetIconHandle("main");
+ Menu_ModifyItem(hEnableDisableMenu, LPGENT("Auto Update Enabled"), GetIconHandle("main"));
opt.AutoUpdate = 1;
}
else { // to disable auto-update
- mi.pszName = LPGEN("Auto Update Disabled");
- mi.icolibItem = GetIconHandle("disabled");
+ Menu_ModifyItem(hEnableDisableMenu, LPGENT("Auto Update Disabled"), GetIconHandle("disabled"));
opt.AutoUpdate = 0;
}
- mi.flags = CMIM_ICON | CMIM_NAME;
- Menu_ModifyItem(hEnableDisableMenu, &mi);
CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTBButton, !State ? TTBST_PUSHED : 0);
-
}
void UpdatePopupMenu(BOOL State)
@@ -251,20 +244,10 @@ void UpdatePopupMenu(BOOL State) opt.UsePopup = State;
db_set_b(NULL, WEATHERPROTONAME, "UsePopup", (BYTE)opt.UsePopup);
- CLISTMENUITEM mi = { 0 };
- if (State)
- { // to enable popup
- mi.pszName = LPGEN("Disable &weather notification");
- mi.icolibItem = GetIconHandle("popup");
- }
- else
- { // to disable popup
- mi.pszName = LPGEN("Enable &weather notification");
- mi.icolibItem = GetIconHandle("nopopup");
- }
-
- mi.flags = CMIM_ICON | CMIM_NAME;
- Menu_ModifyItem(hEnableDisablePopupMenu, &mi);
+ if (State) // to enable popup
+ Menu_ModifyItem(hEnableDisablePopupMenu, LPGENT("Disable &weather notification"), GetIconHandle("popup"));
+ else // to disable popup
+ Menu_ModifyItem(hEnableDisablePopupMenu, LPGENT("Enable &weather notification"), GetIconHandle("nopopup"));
}
// update the weather auto-update menu item when click on it
diff --git a/plugins/WebView/src/webview.cpp b/plugins/WebView/src/webview.cpp index 95b5993569..333e501c32 100644 --- a/plugins/WebView/src/webview.cpp +++ b/plugins/WebView/src/webview.cpp @@ -41,42 +41,32 @@ HWND ContactHwnd; HINSTANCE hInst;
HMENU hMenu;
int bpStatus;
-HANDLE hMenuItem1;
-HANDLE hMenuItemCountdown;
+HGENMENU hMenuItem1;
+HGENMENU hMenuItemCountdown;
/*****************************************************************************/
void ChangeMenuItem1()
{
- /*
- * Enable or Disable auto updates
- */
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_NAME | CMIM_ICON | CMIF_TCHAR;
- mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_SITE));
-
+ // Enable or Disable auto updates
+ LPCTSTR ptszName;
if (!db_get_b(NULL, MODULENAME, DISABLE_AUTOUPDATE_KEY, 0))
- mi.ptszName = LPGENT("Auto update enabled");
+ ptszName = LPGENT("Auto update enabled");
else
- mi.ptszName = LPGENT("Auto update disabled");
+ ptszName = LPGENT("Auto update disabled");
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuItem1, (LPARAM)&mi);
+ Menu_ModifyItem(hMenuItem1, ptszName, LoadIcon(hInst, MAKEINTRESOURCE(IDI_SITE)));
}
/*****************************************************************************/
void ChangeMenuItemCountdown()
{
- /*
- * countdown
- */
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_NAME | CMIM_ICON | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED;
- mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_UPDATEALL));
+ // countdown
+ HICON hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_UPDATEALL));
TCHAR countername[100];
mir_sntprintf(countername,_countof(countername), TranslateT("%d minutes to update"), db_get_dw(NULL, MODULENAME, COUNTDOWN_KEY, 0));
- mi.ptszName = countername;
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuItemCountdown, (LPARAM)&mi);
+ Menu_ModifyItem(hMenuItemCountdown, countername, hIcon, CMIF_KEEPUNTRANSLATED);
}
/*****************************************************************************/
diff --git a/plugins/WebView/src/webview.h b/plugins/WebView/src/webview.h index b78c165caf..1767911e88 100644 --- a/plugins/WebView/src/webview.h +++ b/plugins/WebView/src/webview.h @@ -146,7 +146,7 @@ extern HMENU hMenu; extern int bpStatus;
extern HANDLE hNetlibUser;
extern MWindowList hWindowList;
-extern HANDLE hMenuItem1, hMenuItemCountdown;
+extern HGENMENU hMenuItem1, hMenuItemCountdown;
extern char optionsname[80];
//lets get rid of some warnings
diff --git a/plugins/WhoUsesMyFiles/src/wumfplug.cpp b/plugins/WhoUsesMyFiles/src/wumfplug.cpp index 412b1df9a0..676bedd73c 100644 --- a/plugins/WhoUsesMyFiles/src/wumfplug.cpp +++ b/plugins/WhoUsesMyFiles/src/wumfplug.cpp @@ -223,20 +223,16 @@ static INT_PTR WumfMenuCommand(WPARAM,LPARAM) BOOL MajorTo0121 = FALSE;
int iResult = 0;
- CLISTMENUITEM mi = { 0 };
if (WumfOptions.PopupsEnabled == TRUE) {
WumfOptions.PopupsEnabled = FALSE;
- mi.pszName = LPGEN("Enable WUMF popups");
- mi.hIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_NOPOPUP));
+ Menu_ModifyItem(hMenuItem, LPGENT("Enable WUMF popups"), LoadIcon(hInst,MAKEINTRESOURCE(IDI_NOPOPUP)));
}
else {
WumfOptions.PopupsEnabled = TRUE;
- mi.pszName = LPGEN("Disable WUMF popups");
- mi.hIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_POPUP));
+ Menu_ModifyItem(hMenuItem, LPGENT("Disable WUMF popups"), LoadIcon(hInst,MAKEINTRESOURCE(IDI_POPUP)));
}
+
db_set_b(NULL, MODULENAME, POPUPS_ENABLED, (BYTE)WumfOptions.PopupsEnabled);
- mi.flags = CMIM_NAME | CMIM_ICON;
- Menu_ModifyItem(hMenuItem, &mi);
return 0;
}
diff --git a/plugins/YAPP/src/services.cpp b/plugins/YAPP/src/services.cpp index 4132c98e32..c314328c05 100644 --- a/plugins/YAPP/src/services.cpp +++ b/plugins/YAPP/src/services.cpp @@ -195,14 +195,14 @@ void UpdateMenu() {
bool isEnabled = db_get_b(0, "Popup", "ModuleIsEnabled", 1) == 1;
- CLISTMENUITEM mi = { 0 };
- mi.ptszName = (isEnabled ? LPGENT("Disable Popups") : LPGENT("Enable Popups"));
- mi.hIcon = IcoLib_GetIcon(isEnabled ? ICO_POPUP_ON : ICO_POPUP_OFF, 0);
- mi.flags = CMIM_NAME | CMIM_ICON | CMIF_TCHAR;
- Menu_ModifyItem(hMenuItem, &mi);
-
- mi.flags = CMIM_ICON;
- Menu_ModifyItem(hMenuRoot, &mi);
+ if (isEnabled) {
+ Menu_ModifyItem(hMenuItem, LPGENT("Disable Popups"), IcoLib_GetIcon(ICO_POPUP_ON));
+ Menu_ModifyItem(hMenuRoot, NULL, IcoLib_GetIcon(ICO_POPUP_ON));
+ }
+ else {
+ Menu_ModifyItem(hMenuItem, LPGENT("Enable Popups"), IcoLib_GetIcon(ICO_POPUP_OFF));
+ Menu_ModifyItem(hMenuRoot, NULL, IcoLib_GetIcon(ICO_POPUP_OFF));
+ }
if (hTTButton)
CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTTButton, isEnabled ? TTBST_PUSHED : 0);
diff --git a/plugins/YAPP/src/yapp.cpp b/plugins/YAPP/src/yapp.cpp index f5dcbf2ed2..bb2c0065f8 100644 --- a/plugins/YAPP/src/yapp.cpp +++ b/plugins/YAPP/src/yapp.cpp @@ -71,22 +71,6 @@ int ReloadFont(WPARAM wParam, LPARAM lParam) return 0;
}
-int IconsChanged(WPARAM, LPARAM)
-{
- CLISTMENUITEM mi = { 0 };
-
- mi.hIcon = IcoLib_GetIcon(db_get_b(0, "Popup", "ModuleIsEnabled", 1) ? ICO_POPUP_ON : ICO_POPUP_OFF, 0);
- mi.flags = CMIM_ICON;
- Menu_ModifyItem(hMenuItem, &mi);
- Menu_ModifyItem(hMenuRoot, &mi);
-
- mi.hIcon = IcoLib_GetIcon(ICO_HISTORY, 0);
- mi.flags = CMIM_ICON;
- Menu_ModifyItem(hMenuItemHistory, &mi);
-
- return 0;
-}
-
int TTBLoaded(WPARAM, LPARAM)
{
TTBButton ttb = { sizeof(ttb) };
@@ -243,7 +227,6 @@ extern "C" int __declspec(dllexport) Load(void) InitIcons();
InitMenuItems();
- HookEvent(ME_SKIN2_ICONSCHANGED, IconsChanged);
HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown);
HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
return 0;
diff --git a/plugins/ZeroNotification/src/main.cpp b/plugins/ZeroNotification/src/main.cpp index 24d882f309..6e82bd43c8 100644 --- a/plugins/ZeroNotification/src/main.cpp +++ b/plugins/ZeroNotification/src/main.cpp @@ -95,13 +95,7 @@ static DWORD MakeCheckBoxTreeFlags(HWND hwndTree) //Update the name on the menu
static void UpdateMenuItem()
{
- CLISTMENUITEM mi = { 0 };
- if (db_get_b(NULL, "Skin", "UseSound", 1))
- mi.ptszName = DISABLE_SOUND;
- else
- mi.ptszName = ENABLE_SOUND;
- mi.flags |= CMIM_NAME | CMIF_TCHAR;
- Menu_ModifyItem(noSoundMenu, &mi);
+ Menu_ModifyItem(noSoundMenu, db_get_b(NULL, "Skin", "UseSound", 1) ? DISABLE_SOUND : ENABLE_SOUND);
}
//Called when the sound setting in the database is changed
diff --git a/protocols/AimOscar/src/proto.cpp b/protocols/AimOscar/src/proto.cpp index 6083632b48..6097af60cb 100644 --- a/protocols/AimOscar/src/proto.cpp +++ b/protocols/AimOscar/src/proto.cpp @@ -704,12 +704,8 @@ int __cdecl CAimProto::OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM l break;
case EV_PROTO_ONRENAME:
- if (hMenuRoot) {
- CLISTMENUITEM clmi = { 0 };
- clmi.flags = CMIM_NAME | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED;
- clmi.ptszName = m_tszUserName;
- Menu_ModifyItem(hMenuRoot, &clmi);
- }
+ if (hMenuRoot)
+ Menu_ModifyItem(hMenuRoot, m_tszUserName);
break;
case EV_PROTO_ONCONTACTDELETED:
diff --git a/protocols/AimOscar/src/theme.cpp b/protocols/AimOscar/src/theme.cpp index c8b6ab7fd0..fbfaa67627 100644 --- a/protocols/AimOscar/src/theme.cpp +++ b/protocols/AimOscar/src/theme.cpp @@ -179,37 +179,31 @@ int CAimProto::OnPreBuildContactMenu(WPARAM hContact, LPARAM) Menu_ShowItem(hHTMLAwayContextMenuItem, getWord(hContact, AIM_KEY_ST, ID_STATUS_OFFLINE) == ID_STATUS_AWAY && !bIsChatRoom);
Menu_ShowItem(hAddToServerListContextMenuItem, !getBuddyId(hContact, 1) && state != 0 && !bIsChatRoom);
- DBVARIANT dbv;
- if (!getString(hContact, AIM_KEY_SN, &dbv)) {
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_NAME | CMIM_FLAGS;
- switch(pd_mode) {
- case 1:
- mi.pszName = LPGEN("&Block");
- break;
-
- case 2:
- mi.pszName = LPGEN("&Unblock");
- break;
-
- case 3:
- mi.pszName = (char*)(allow_list.find_id(dbv.pszVal) ? LPGEN("&Block") : LPGEN("&Unblock"));
- break;
-
- case 4:
- mi.pszName = (char*)(block_list.find_id(dbv.pszVal) ? LPGEN("&Unblock") : LPGEN("&Block"));
- break;
-
- default:
- mi.pszName = LPGEN("&Block");
- mi.flags |= CMIF_HIDDEN;
- break;
- }
-
- Menu_ModifyItem(hBlockContextMenuItem, &mi);
- db_free(&dbv);
+ ptrA id(getStringA(hContact, AIM_KEY_SN));
+ if (id == NULL)
+ return 0;
+
+ switch (pd_mode) {
+ case 1:
+ Menu_ModifyItem(hBlockContextMenuItem, LPGENT("&Block"));
+ break;
+
+ case 2:
+ Menu_ModifyItem(hBlockContextMenuItem, LPGENT("&Unblock"));
+ break;
+
+ case 3:
+ Menu_ModifyItem(hBlockContextMenuItem, allow_list.find_id(id) ? LPGENT("&Block") : LPGENT("&Unblock"));
+ break;
+
+ case 4:
+ Menu_ModifyItem(hBlockContextMenuItem, block_list.find_id(id) ? LPGENT("&Unblock") : LPGENT("&Block"));
+ break;
+
+ default:
+ Menu_ShowItem(hBlockContextMenuItem, false);
+ break;
}
-
return 0;
}
diff --git a/protocols/FacebookRM/src/theme.cpp b/protocols/FacebookRM/src/theme.cpp index efd24e16dc..7d7c05cdcf 100644 --- a/protocols/FacebookRM/src/theme.cpp +++ b/protocols/FacebookRM/src/theme.cpp @@ -293,10 +293,8 @@ int FacebookProto::OnBuildStatusMenu(WPARAM, LPARAM) void FacebookProto::ToggleStatusMenuItems(BOOL bEnable)
{
- CLISTMENUITEM clmi = { 0 };
- clmi.flags = CMIM_FLAGS | ((bEnable) ? 0 : CMIF_GRAYED);
-
- Menu_ModifyItem(m_hMenuRoot, &clmi);
- Menu_ModifyItem(m_hStatusMind, &clmi);
- Menu_ModifyItem(m_hMenuServicesRoot, &clmi);
+ int flags = (bEnable) ? 0 : CMIF_GRAYED;
+ Menu_ModifyItem(m_hMenuRoot, NULL, INVALID_HANDLE_VALUE, flags);
+ Menu_ModifyItem(m_hStatusMind, NULL, INVALID_HANDLE_VALUE, flags);
+ Menu_ModifyItem(m_hMenuServicesRoot, NULL, INVALID_HANDLE_VALUE, flags);
}
diff --git a/protocols/Gadu-Gadu/src/gg.cpp b/protocols/Gadu-Gadu/src/gg.cpp index a70b5a6710..ffeb1ecc65 100644 --- a/protocols/Gadu-Gadu/src/gg.cpp +++ b/protocols/Gadu-Gadu/src/gg.cpp @@ -212,13 +212,10 @@ static int gg_prebuildcontactmenu(WPARAM hContact, LPARAM lParam) if (gg == NULL)
return 0;
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_NAME | CMIM_FLAGS | CMIF_TCHAR;
- if ( gg->getDword(hContact, GG_KEY_UIN, 0) == gg->getByte(GG_KEY_UIN, 0) ||
- gg->isChatRoom(hContact) || db_get_b(hContact, "CList", "NotOnList", 0))
- mi.flags |= CMIF_HIDDEN;
- mi.ptszName = gg->getByte(hContact, GG_KEY_BLOCK, 0) ? LPGENT("&Unblock") : LPGENT("&Block");
- Menu_ModifyItem(gg->hBlockMenuItem, &mi);
+ if (gg->getDword(hContact, GG_KEY_UIN, 0) == gg->getByte(GG_KEY_UIN, 0) || gg->isChatRoom(hContact) || db_get_b(hContact, "CList", "NotOnList", 0))
+ Menu_ShowItem(gg->hBlockMenuItem, false);
+ else
+ Menu_ModifyItem(gg->hBlockMenuItem, gg->getByte(hContact, GG_KEY_BLOCK, 0) ? LPGENT("&Unblock") : LPGENT("&Block"));
return 0;
}
diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp index ec5cf9c603..99f7c478e6 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.cpp +++ b/protocols/Gadu-Gadu/src/gg_proto.cpp @@ -764,12 +764,8 @@ int GGPROTO::OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam) break;
case EV_PROTO_ONRENAME:
- if (hMenuRoot) {
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_NAME | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED;
- mi.ptszName = m_tszUserName;
- Menu_ModifyItem(hMenuRoot, &mi);
- }
+ if (hMenuRoot)
+ Menu_ModifyItem(hMenuRoot, m_tszUserName);
break;
case EV_PROTO_ONCONTACTDELETED:
diff --git a/protocols/Gadu-Gadu/src/links.cpp b/protocols/Gadu-Gadu/src/links.cpp index eb1f590f35..a915416a63 100644 --- a/protocols/Gadu-Gadu/src/links.cpp +++ b/protocols/Gadu-Gadu/src/links.cpp @@ -63,18 +63,11 @@ static INT_PTR gg_parselink(WPARAM wParam, LPARAM lParam) for (int i=0; i < g_Instances.getCount(); i++) {
gg = g_Instances[i];
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_FLAGS;
if (gg->m_iStatus > ID_STATUS_OFFLINE) {
++items;
- mi.flags |= CMIM_ICON;
- mi.hIcon = Skin_LoadProtoIcon(gg->m_szModuleName, gg->m_iStatus);
+ Menu_ModifyItem(gg->hInstanceMenuItem, NULL, Skin_LoadProtoIcon(gg->m_szModuleName, gg->m_iStatus));
}
- else mi.flags |= CMIF_HIDDEN;
-
- Menu_ModifyItem(gg->hInstanceMenuItem, &mi);
- if (mi.hIcon)
- IcoLib_ReleaseIcon(mi.hIcon);
+ else Menu_ShowItem(gg->hInstanceMenuItem, false);
}
if (items > 1) {
diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp index f9e373e44b..4567f48602 100644 --- a/protocols/IRCG/src/commandmonitor.cpp +++ b/protocols/IRCG/src/commandmonitor.cpp @@ -2298,11 +2298,9 @@ void CIrcProto::OnIrcDisconnected() memcpy(m_nick, m_pNick, sizeof(m_nick));
setTString("Nick", m_pNick);
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_FLAGS | CMIF_GRAYED;
- Menu_ModifyItem(hMenuJoin, &mi);
- Menu_ModifyItem(hMenuList, &mi);
- Menu_ModifyItem(hMenuNick, &mi);
+ Menu_ModifyItem(hMenuJoin, NULL, INVALID_HANDLE_VALUE, CMIF_GRAYED);
+ Menu_ModifyItem(hMenuList, NULL, INVALID_HANDLE_VALUE, CMIF_GRAYED);
+ Menu_ModifyItem(hMenuNick, NULL, INVALID_HANDLE_VALUE, CMIF_GRAYED);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -2329,11 +2327,9 @@ bool CIrcProto::DoOnConnect(const CIrcMessage*) bPerformDone = true;
nickflag = true;
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_FLAGS;
- Menu_ModifyItem(hMenuJoin, &mi);
- Menu_ModifyItem(hMenuList, &mi);
- Menu_ModifyItem(hMenuNick, &mi);
+ Menu_ModifyItem(hMenuJoin, NULL, INVALID_HANDLE_VALUE, 0);
+ Menu_ModifyItem(hMenuList, NULL, INVALID_HANDLE_VALUE, 0);
+ Menu_ModifyItem(hMenuNick, NULL, INVALID_HANDLE_VALUE, 0);
int Temp = m_iStatus;
m_iStatus = ID_STATUS_ONLINE;
diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp index 378aee6063..89cb66953b 100644 --- a/protocols/IRCG/src/ircproto.cpp +++ b/protocols/IRCG/src/ircproto.cpp @@ -840,12 +840,8 @@ int __cdecl CIrcProto::OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM l break;
case EV_PROTO_ONRENAME:
- if (hMenuRoot) {
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_NAME | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED;
- mi.ptszName = m_tszUserName;
- Menu_ModifyItem(hMenuRoot, &mi);
- }
+ if (hMenuRoot)
+ Menu_ModifyItem(hMenuRoot, m_tszUserName);
break;
case EV_PROTO_ONCONTACTDELETED:
diff --git a/protocols/IRCG/src/options.cpp b/protocols/IRCG/src/options.cpp index d8296b0fec..f741aa9525 100644 --- a/protocols/IRCG/src/options.cpp +++ b/protocols/IRCG/src/options.cpp @@ -730,11 +730,7 @@ void CConnectPrefsDlg::OnApply() m_proto->m_oldStyleModes = m_oldStyle.GetState();
m_proto->m_useServer = m_useServer.GetState();
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_FLAGS;
- if (!m_proto->m_useServer)
- mi.flags |= CMIF_GRAYED;
- Menu_ModifyItem(m_proto->hMenuServer, &mi);
+ Menu_ModifyItem(m_proto->hMenuServer, NULL, INVALID_HANDLE_VALUE, (m_proto->m_useServer) ? 0 : CMIF_GRAYED);
m_proto->m_joinOnInvite = m_autoJoin.GetState();
m_proto->m_hideServerWindow = !m_showServer.GetState();
diff --git a/protocols/IcqOscarJ/src/icq_menu.cpp b/protocols/IcqOscarJ/src/icq_menu.cpp index 7ada6453fc..94a0a3ca57 100644 --- a/protocols/IcqOscarJ/src/icq_menu.cpp +++ b/protocols/IcqOscarJ/src/icq_menu.cpp @@ -204,13 +204,10 @@ int CIcqProto::OnPreBuildContactMenu(WPARAM hContact, LPARAM) Menu_ShowItem(g_hContactMenuItems[ICMI_XSTATUS_DETAILS], m_bHideXStatusUI ? 0 : bXStatus != 0);
if (bXStatus && !m_bHideXStatusUI) {
- CLISTMENUITEM clmi = { 0 };
- clmi.flags = CMIM_ICON;
if (bXStatus > 0 && bXStatus <= XSTATUS_COUNT)
- clmi.hIcon = getXStatusIcon(bXStatus, LR_SHARED);
+ Menu_ModifyItem(g_hContactMenuItems[ICMI_XSTATUS_DETAILS], NULL, getXStatusIcon(bXStatus, LR_SHARED));
else
- clmi.hIcon = Skin_LoadIcon(SKINICON_OTHER_SMALLDOT);
- Menu_ModifyItem(g_hContactMenuItems[ICMI_XSTATUS_DETAILS], &clmi);
+ Menu_ModifyItem(g_hContactMenuItems[ICMI_XSTATUS_DETAILS], NULL, Skin_LoadIcon(SKINICON_OTHER_SMALLDOT));
}
return 0;
diff --git a/protocols/IcqOscarJ/src/icq_xstatus.cpp b/protocols/IcqOscarJ/src/icq_xstatus.cpp index a82e72e5dd..75b7dbcd1b 100644 --- a/protocols/IcqOscarJ/src/icq_xstatus.cpp +++ b/protocols/IcqOscarJ/src/icq_xstatus.cpp @@ -780,14 +780,10 @@ void CIcqProto::setXStatusEx(BYTE bXStatus, BYTE bQuiet) BYTE bOldXStatus = getByte(DBSETTING_XSTATUS_ID, 0);
if (!m_bHideXStatusUI) {
- CLISTMENUITEM mi = { 0 };
- if (bOldXStatus <= XSTATUS_COUNT) {
- mi.flags = CMIM_FLAGS;
- Menu_ModifyItem(hXStatusItems[bOldXStatus], &mi);
- }
+ if (bOldXStatus <= XSTATUS_COUNT)
+ Menu_ModifyItem(hXStatusItems[bOldXStatus], NULL, INVALID_HANDLE_VALUE, 0);
- mi.flags = CMIM_FLAGS | CMIF_CHECKED;
- Menu_ModifyItem(hXStatusItems[bXStatus], &mi);
+ Menu_ModifyItem(hXStatusItems[bXStatus], NULL, INVALID_HANDLE_VALUE, CMIF_CHECKED);
}
if (bXStatus) {
diff --git a/protocols/JabberG/src/jabber_menu.cpp b/protocols/JabberG/src/jabber_menu.cpp index 7282a96457..32bccd1ad0 100644 --- a/protocols/JabberG/src/jabber_menu.cpp +++ b/protocols/JabberG/src/jabber_menu.cpp @@ -79,7 +79,7 @@ static CJabberProto* JabberGetInstanceByHContact(MCONTACT hContact) if (szProto == NULL)
return NULL;
- for (int i=0; i < g_Instances.getCount(); i++)
+ for (int i = 0; i < g_Instances.getCount(); i++)
if (!mir_strcmp(szProto, g_Instances[i]->m_szModuleName))
return g_Instances[i];
@@ -287,15 +287,15 @@ void g_MenuInit(void) g_hMenuDirectPresence[0] = Menu_AddContactMenuItem(&mi);
mi.flags |= CMIF_ROOTHANDLE | CMIF_TCHAR;
- for (int i=0; i < _countof(PresenceModeArray); i++) {
+ for (int i = 0; i < _countof(PresenceModeArray); i++) {
char buf[] = "Jabber/DirectPresenceX";
- buf[_countof(buf)-2] = '0' + i;
+ buf[_countof(buf) - 2] = '0' + i;
mi.pszService = buf;
mi.ptszName = pcli->pfnGetStatusModeDescription(PresenceModeArray[i].mode, 0);
mi.position = -1999901000;
mi.hParentMenu = g_hMenuDirectPresence[0];
mi.icolibItem = Skin_LoadIcon(PresenceModeArray[i].icon);
- g_hMenuDirectPresence[i+1] = Menu_AddContactMenuItem(&mi);
+ g_hMenuDirectPresence[i + 1] = Menu_AddContactMenuItem(&mi);
CreateServiceFunctionParam(mi.pszService, JabberMenuHandleDirectPresence, PresenceModeArray[i].mode);
}
@@ -350,17 +350,13 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM) if (hContact == NULL)
return 0;
- bool bIsChatRoom = isChatRoom(hContact);
+ bool bIsChatRoom = isChatRoom(hContact);
bool bIsTransport = getBool(hContact, "IsTransport", false);
if ((bIsChatRoom == GCW_CHATROOM) || bIsChatRoom == 0) {
- if ( ptrT( getTStringA(hContact, bIsChatRoom?(char*)"ChatRoomID":(char*)"jid")) != NULL) {
+ if (ptrT(getTStringA(hContact, bIsChatRoom ? (char*)"ChatRoomID" : (char*)"jid")) != NULL) {
Menu_ShowItem(g_hMenuConvert, TRUE);
-
- CLISTMENUITEM clmi = { 0 };
- clmi.pszName = bIsChatRoom ? (char *)LPGEN("&Convert to Contact") : (char *)LPGEN("&Convert to Chat Room");
- clmi.flags = CMIM_NAME | CMIM_FLAGS;
- Menu_ModifyItem(g_hMenuConvert, &clmi);
+ Menu_ModifyItem(g_hMenuConvert, bIsChatRoom ? LPGENT("&Convert to Contact") : LPGENT("&Convert to Chat Room"));
}
}
@@ -368,15 +364,11 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM) return 0;
Menu_ShowItem(g_hMenuDirectPresence[0], TRUE);
- for (int i=0; i < _countof(PresenceModeArray); i++) {
- CLISTMENUITEM clmi = { 0 };
- clmi.flags = CMIM_ICON | CMIM_FLAGS;
- clmi.hIcon = (HICON)Skin_LoadProtoIcon(m_szModuleName, PresenceModeArray[i].mode);
- Menu_ModifyItem(g_hMenuDirectPresence[i+1], &clmi);
- }
+ for (int i = 0; i < _countof(PresenceModeArray); i++)
+ Menu_ModifyItem(g_hMenuDirectPresence[i + 1], NULL, Skin_LoadProtoIcon(m_szModuleName, PresenceModeArray[i].mode));
if (bIsChatRoom) {
- ptrT roomid( getTStringA(hContact, "ChatRoomID"));
+ ptrT roomid(getTStringA(hContact, "ChatRoomID"));
if (roomid != NULL) {
Menu_ShowItem(g_hMenuRosterAdd, FALSE);
@@ -394,7 +386,7 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM) Menu_ShowItem(g_hMenuRefresh, TRUE);
}
- ptrT jid( getTStringA(hContact, "jid"));
+ ptrT jid(getTStringA(hContact, "jid"));
if (jid == NULL)
return 0;
@@ -403,7 +395,7 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM) if (item == NULL)
return 0;
- BOOL bCtrlPressed = (GetKeyState(VK_CONTROL)&0x8000) != 0;
+ bool bCtrlPressed = (GetKeyState(VK_CONTROL) & 0x8000) != 0;
Menu_ShowItem(g_hMenuRequestAuth, item->subscription == SUB_FROM || item->subscription == SUB_NONE || bCtrlPressed);
Menu_ShowItem(g_hMenuGrantAuth, bCtrlPressed);
Menu_ShowItem(g_hMenuRevokeAuth, item->subscription == SUB_FROM || item->subscription == SUB_BOTH || bCtrlPressed);
@@ -414,17 +406,9 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM) return 0;
Menu_ShowItem(g_hMenuResourcesRoot, TRUE);
-
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_ICON | CMIM_FLAGS;
- mi.icolibItem = m_hProtoIcon;
- Menu_ModifyItem(g_hMenuResourcesRoot, &mi);
-
- mi.flags = CMIM_ICON | CMIM_FLAGS | ((item->resourceMode == RSMODE_LASTSEEN) ? CMIF_CHECKED : 0);
- Menu_ModifyItem(g_hMenuResourcesActive, &mi);
-
- mi.flags = CMIM_FLAGS | ((item->resourceMode == RSMODE_SERVER) ? CMIF_CHECKED : 0);
- Menu_ModifyItem(g_hMenuResourcesServer, &mi);
+ Menu_ModifyItem(g_hMenuResourcesRoot, NULL, m_hProtoIcon);
+ Menu_ModifyItem(g_hMenuResourcesActive, NULL, m_hProtoIcon, (item->resourceMode == RSMODE_LASTSEEN) ? CMIF_CHECKED : 0);
+ Menu_ModifyItem(g_hMenuResourcesServer, NULL, m_hProtoIcon, (item->resourceMode == RSMODE_SERVER) ? CMIF_CHECKED : 0);
int nMenuResourceItemsNew = m_nMenuResourceItems;
if (m_nMenuResourceItems < item->arResources.getCount()) {
@@ -432,11 +416,12 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM) nMenuResourceItemsNew = item->arResources.getCount();
}
- char text[ 256 ];
+ char text[256];
mir_strcpy(text, m_szModuleName);
size_t nModuleNameLength = mir_strlen(text);
char* tDest = text + nModuleNameLength;
+ CLISTMENUITEM mi = { 0 };
mi.flags = CMIF_CHILDPOPUP;
mi.position = 0;
mi.icolibItem = NULL;
@@ -444,10 +429,10 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM) mi.pszContactOwner = m_szModuleName;
CMString szTmp;
- for (int i=0; i < nMenuResourceItemsNew; i++) {
+ for (int i = 0; i < nMenuResourceItemsNew; i++) {
mir_snprintf(tDest, _countof(text) - nModuleNameLength, "/UseResource_%d", i);
if (i >= m_nMenuResourceItems) {
- CreateProtoServiceParam(tDest, &CJabberProto::OnMenuHandleResource, MENUITEM_RESOURCES+i);
+ CreateProtoServiceParam(tDest, &CJabberProto::OnMenuHandleResource, MENUITEM_RESOURCES + i);
mi.pszName = "";
mi.position = i;
mi.hParentMenu = g_hMenuResourcesRoot;
@@ -455,19 +440,19 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM) }
if (i < item->arResources.getCount()) {
pResourceStatus r(item->arResources[i]);
- CLISTMENUITEM clmi = { 0 };
- clmi.flags = CMIM_NAME | CMIM_FLAGS | CMIF_CHILDPOPUP | CMIF_TCHAR;
+
+ int flags = 0;
+ HICON hIcon = (HICON)INVALID_HANDLE_VALUE;
if (item->resourceMode == RSMODE_MANUAL && item->m_pManualResource == r)
- clmi.flags |= CMIF_CHECKED;
+ flags |= CMIF_CHECKED;
+
if (ServiceExists(MS_FP_GETCLIENTICONT)) {
- clmi.flags |= CMIM_ICON;
FormatMirVer(r, szTmp);
- clmi.hIcon = Finger_GetClientIcon(szTmp, 0);
+ hIcon = Finger_GetClientIcon(szTmp, 0);
}
szTmp.Format(_T("%s [%s, %d]"), r->m_tszResourceName, pcli->pfnGetStatusModeDescription(r->m_iStatus, 0), r->m_iPriority);
- clmi.ptszName = szTmp.GetBuffer();
- Menu_ModifyItem(m_phMenuResourceItems[i], &clmi);
- DestroyIcon(clmi.hIcon);
+ Menu_ModifyItem(m_phMenuResourceItems[i], szTmp, hIcon, flags);
+ DestroyIcon(hIcon);
}
else Menu_ShowItem(m_phMenuResourceItems[i], FALSE);
}
@@ -602,7 +587,7 @@ INT_PTR __cdecl CJabberProto::OnMenuBookmarkAdd(WPARAM hContact, LPARAM) void CJabberProto::MenuInit()
{
char text[200];
- strncpy(text, m_szModuleName, sizeof(text)-1);
+ strncpy(text, m_szModuleName, sizeof(text) - 1);
char* tDest = text + mir_strlen(text);
CLISTMENUITEM mi = { 0 };
@@ -797,11 +782,7 @@ void CJabberProto::UpdatePriorityMenu(short priority) TCHAR szName[128];
mir_sntprintf(szName, TranslateT("Resource priority [%d]"), (int)priority);
-
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIF_TCHAR | CMIM_NAME | CMIF_KEEPUNTRANSLATED;
- mi.ptszName = szName;
- Menu_ModifyItem(m_hMenuPriorityRoot, &mi);
+ Menu_ModifyItem(m_hMenuPriorityRoot, szName);
m_priorityMenuVal = priority;
m_priorityMenuValSet = true;
@@ -903,7 +884,7 @@ int g_OnToolbarInit(WPARAM, LPARAM) void CJabberProto::GlobalMenuUninit()
{
if (m_phMenuResourceItems) {
- for (int i=0; i < m_nMenuResourceItems; i++)
+ for (int i = 0; i < m_nMenuResourceItems; i++)
CallService(MO_REMOVEMENUITEM, (WPARAM)m_phMenuResourceItems[i], 0);
mir_free(m_phMenuResourceItems);
m_phMenuResourceItems = NULL;
@@ -923,20 +904,17 @@ void CJabberProto::EnableMenuItems(BOOL bEnable) void CJabberProto::CheckMenuItems()
{
- CLISTMENUITEM clmi = { 0 };
- clmi.flags = CMIM_FLAGS;
- if (!m_menuItemsStatus)
- clmi.flags |= CMIF_GRAYED;
+ int flags = (m_menuItemsStatus) ? 0 : CMIF_GRAYED;
- Menu_ModifyItem(m_hMenuChangePassword, &clmi);
- Menu_ModifyItem(m_hMenuGroupchat, &clmi);
+ Menu_ModifyItem(m_hMenuChangePassword, NULL, INVALID_HANDLE_VALUE, flags);
+ Menu_ModifyItem(m_hMenuGroupchat, NULL, INVALID_HANDLE_VALUE, flags);
- Menu_ModifyItem(m_hMenuPrivacyLists, &clmi);
- Menu_ModifyItem(m_hMenuRosterControl, &clmi);
- Menu_ModifyItem(m_hMenuServiceDiscovery, &clmi);
- Menu_ModifyItem(m_hMenuSDMyTransports, &clmi);
- Menu_ModifyItem(m_hMenuSDTransports, &clmi);
- Menu_ModifyItem(m_hMenuSDConferences, &clmi);
+ Menu_ModifyItem(m_hMenuPrivacyLists, NULL, INVALID_HANDLE_VALUE, flags);
+ Menu_ModifyItem(m_hMenuRosterControl, NULL, INVALID_HANDLE_VALUE, flags);
+ Menu_ModifyItem(m_hMenuServiceDiscovery, NULL, INVALID_HANDLE_VALUE, flags);
+ Menu_ModifyItem(m_hMenuSDMyTransports, NULL, INVALID_HANDLE_VALUE, flags);
+ Menu_ModifyItem(m_hMenuSDTransports, NULL, INVALID_HANDLE_VALUE, flags);
+ Menu_ModifyItem(m_hMenuSDConferences, NULL, INVALID_HANDLE_VALUE, flags);
bool bEnabled = m_ThreadInfo && (m_ThreadInfo->jabberServerCaps & JABBER_CAPS_PRIVATE_STORAGE);
Menu_ShowItem(m_hMenuNotes, bEnabled);
@@ -946,7 +924,7 @@ void CJabberProto::CheckMenuItems() Menu_ShowItem(m_hMenuPriorityRoot, m_menuItemsStatus != 0);
- for (int i=0; i < m_pepServices.getCount(); i++)
+ for (int i = 0; i < m_pepServices.getCount(); i++)
Menu_ShowItem(m_pepServices[i].GetMenu(), m_bPepSupported);
JabberUpdateDialogs(m_menuItemsStatus);
@@ -1151,22 +1129,15 @@ CJabberProto* JabberChooseInstance(bool bIsLink) if (g_Instances[i]->m_options.ProcessXMPPLinks)
return g_Instances[i];
- CLISTMENUITEM clmi = { 0 };
-
int nItems = 0, lastItemId = 0;
for (int i = 0; i < g_Instances.getCount(); i++) {
- clmi.flags = CMIM_FLAGS;
-
CJabberProto *ppro = g_Instances[i];
if (ppro->m_iStatus != ID_STATUS_OFFLINE && ppro->m_iStatus != ID_STATUS_CONNECTING) {
++nItems;
lastItemId = i + 1;
- clmi.flags |= CMIM_ICON;
- clmi.hIcon = Skin_LoadProtoIcon(ppro->m_szModuleName, ppro->m_iStatus);
+ Menu_ModifyItem(ppro->m_hChooseMenuItem, NULL, Skin_LoadProtoIcon(ppro->m_szModuleName, ppro->m_iStatus));
}
- else clmi.flags |= CMIF_HIDDEN;
-
- Menu_ModifyItem(ppro->m_hChooseMenuItem, &clmi);
+ else Menu_ShowItem(ppro->m_hChooseMenuItem, false);
}
if (nItems > 1) {
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index 2d4c9fd1f8..1eb5bbfb1e 100644 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -1319,12 +1319,8 @@ int __cdecl CJabberProto::OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARA break;
case EV_PROTO_ONRENAME:
- if (m_hMenuRoot) {
- CLISTMENUITEM clmi = { 0 };
- clmi.flags = CMIM_NAME | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED;
- clmi.ptszName = m_tszUserName;
- Menu_ModifyItem(m_hMenuRoot, &clmi);
- }
+ if (m_hMenuRoot)
+ Menu_ModifyItem(m_hMenuRoot, m_tszUserName);
break;
case EV_PROTO_ONCONTACTDELETED:
diff --git a/protocols/JabberG/src/jabber_xstatus.cpp b/protocols/JabberG/src/jabber_xstatus.cpp index 3ae7a9bcea..bd78e108c4 100644 --- a/protocols/JabberG/src/jabber_xstatus.cpp +++ b/protocols/JabberG/src/jabber_xstatus.cpp @@ -489,16 +489,10 @@ bool CPepGuiService::LaunchSetGui(BYTE bQuiet) void CPepGuiService::UpdateMenuItem(HANDLE hIcolibIcon, TCHAR *text)
{
m_hIcolibItem = hIcolibIcon;
- if (m_szText) mir_free(m_szText);
- m_szText = text ? mir_tstrdup(text) : NULL;
-
- if (!m_hMenuItem) return;
+ replaceStrT(m_szText, text);
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIF_TCHAR | CMIM_ICON | CMIM_NAME;
- mi.icolibItem = m_hIcolibItem;
- mi.ptszName = m_szText ? m_szText : _T("<advanced status slot>");
- Menu_ModifyItem(m_hMenuItem, &mi);
+ if (m_hMenuItem)
+ Menu_ModifyItem(m_hMenuItem, m_szText ? m_szText : _T("<advanced status slot>"), m_hIcolibItem);
}
int CPepGuiService::OnMenuItemClick(WPARAM, LPARAM)
diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp index 981e58fa3d..2ee94802f0 100644 --- a/protocols/MRA/src/Mra_functions.cpp +++ b/protocols/MRA/src/Mra_functions.cpp @@ -1060,10 +1060,7 @@ INT_PTR CALLBACK SetXStatusDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LP dat->ppro->mraSetStringExW(NULL, szValueName, szBuff);
dat->ppro->mraSetStringExW(NULL, DBSETTING_XSTATUSNAME, szBuff);
- CLISTMENUITEM mi = { 0 };
- mi.flags = (CMIM_NAME | CMIF_UNICODE);
- mi.ptszName = szBuff;
- Menu_ModifyItem(dat->ppro->hXStatusMenuItems[dat->dwXStatus], &mi);
+ Menu_ModifyItem(dat->ppro->hXStatusMenuItems[dat->dwXStatus], szBuff);
dat->ppro->MraSetXStatusInternal(dat->dwXStatus);
diff --git a/protocols/MSN/src/msn_commands.cpp b/protocols/MSN/src/msn_commands.cpp index 9502935601..82532bd346 100644 --- a/protocols/MSN/src/msn_commands.cpp +++ b/protocols/MSN/src/msn_commands.cpp @@ -330,7 +330,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para replaceStr(msnExternalIP, tHeader["ClientIP"]);
abchMigrated = atol(tHeader["ABCHMigrated"]);
langpref = atol(tHeader["lang_preference"]);
- emailEnabled = atol(tHeader["EmailEnabled"]);
+ emailEnabled = atol(tHeader["EmailEnabled"]) != 0;
if (!MSN_RefreshContactList()) {
ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_NOSERVER);
diff --git a/protocols/MSN/src/msn_menu.cpp b/protocols/MSN/src/msn_menu.cpp index 90874396bc..b6897742fc 100644 --- a/protocols/MSN/src/msn_menu.cpp +++ b/protocols/MSN/src/msn_menu.cpp @@ -131,14 +131,10 @@ int CMsnProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM) int listId = Lists_GetMask(szEmail);
bool noChat = !(listId & LIST_FL) || isMe || isChatRoom(hContact);
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_NAME;
- mi.pszName = ((listId & LIST_BL) ? LPGEN("&Unblock") : LPGEN("&Block"));
- Menu_ModifyItem(hBlockMenuItem, &mi);
+ Menu_ModifyItem(hBlockMenuItem, (listId & LIST_BL) ? LPGENT("&Unblock") : LPGENT("&Block"));
Menu_ShowItem(hBlockMenuItem, !noChat);
- mi.pszName = isMe ? LPGEN("Open &Hotmail Inbox") : LPGEN("Send &Hotmail E-mail");
- Menu_ModifyItem(hOpenInboxMenuItem, &mi);
+ Menu_ModifyItem(hOpenInboxMenuItem, isMe ? LPGENT("Open &Hotmail Inbox") : LPGENT("Send &Hotmail E-mail"));
Menu_ShowItem(hOpenInboxMenuItem, emailEnabled);
#ifdef OBSOLETE
@@ -344,14 +340,8 @@ void CMsnProto::MsnRemoveMainMenus(void) void CMsnProto::MSN_EnableMenuItems(bool bEnable)
{
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_FLAGS;
- if (!bEnable)
- mi.flags |= CMIF_GRAYED;
-
for (int i = 0; i < _countof(menuItemsMain); i++)
- if (menuItemsMain[i] != NULL)
- Menu_ModifyItem(menuItemsMain[i], &mi);
+ Menu_ModifyItem(menuItemsMain[i], NULL, INVALID_HANDLE_VALUE, bEnable ? 0 : CMIF_GRAYED);
if (bEnable)
Menu_ShowItem(menuItemsMain[1], emailEnabled);
diff --git a/protocols/MSN/src/msn_proto.cpp b/protocols/MSN/src/msn_proto.cpp index 6dcc54d15f..8bf72194d9 100644 --- a/protocols/MSN/src/msn_proto.cpp +++ b/protocols/MSN/src/msn_proto.cpp @@ -1231,12 +1231,8 @@ int __cdecl CMsnProto::OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM l break;
case EV_PROTO_ONRENAME:
- if (mainMenuRoot) {
- CLISTMENUITEM clmi = { 0 };
- clmi.flags = CMIM_NAME | CMIF_TCHAR;
- clmi.ptszName = m_tszUserName;
- Menu_ModifyItem(mainMenuRoot, &clmi);
- }
+ if (mainMenuRoot)
+ Menu_ModifyItem(mainMenuRoot, m_tszUserName);
break;
case EV_PROTO_ONCONTACTDELETED:
diff --git a/protocols/MSN/src/msn_proto.h b/protocols/MSN/src/msn_proto.h index abef0e03c2..5020d88ad2 100644 --- a/protocols/MSN/src/msn_proto.h +++ b/protocols/MSN/src/msn_proto.h @@ -171,7 +171,7 @@ struct CMsnProto : public PROTO<CMsnProto> char* alertsoundname;
unsigned langpref;
- unsigned emailEnabled;
+ bool emailEnabled;
unsigned abchMigrated;
unsigned myFlags;
diff --git a/protocols/Sametime/src/conference.cpp b/protocols/Sametime/src/conference.cpp index 6b2e6818c5..697a829421 100644 --- a/protocols/Sametime/src/conference.cpp +++ b/protocols/Sametime/src/conference.cpp @@ -438,9 +438,8 @@ int CSametimeProto::PrebuildContactMenu(WPARAM wParam, LPARAM lParam) {
MCONTACT hContact = (MCONTACT)wParam;
debugLog(_T("CSametimeProto::PrebuildContactMenu() hContact=[%x]"), hContact);
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_FLAGS | (db_get_b(hContact, m_szModuleName, "ChatRoom", 0) == 1 ? 0 : CMIF_HIDDEN);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hLeaveChatMenuItem, (LPARAM)&mi);
+
+ Menu_ShowItem(hLeaveChatMenuItem, db_get_b(hContact, m_szModuleName, "ChatRoom", 0) == 1);
// if user is already in our meeting,
bool not_present = true;
@@ -460,9 +459,8 @@ int CSametimeProto::PrebuildContactMenu(WPARAM wParam, LPARAM lParam) db_free(&dbv);
}
- mi.flags = CMIM_FLAGS | CMIF_NOTOFFLINE | (db_get_b(hContact, m_szModuleName, "ChatRoom", 0) == 0 && not_present ? 0 : CMIF_HIDDEN);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hCreateChatMenuItem, (LPARAM)&mi);
+ Menu_ShowItem(hCreateChatMenuItem, db_get_b(hContact, m_szModuleName, "ChatRoom", 0) == 0 && not_present);
return 0;
}
@@ -530,11 +528,3 @@ void CSametimeProto::InitConferenceMenu() HookProtoEvent(ME_CLIST_PREBUILDCONTACTMENU, &CSametimeProto::PrebuildContactMenu);
}
-
-void CSametimeProto::DeinitConferenceMenu()
-{
- debugLog(_T("CSametimeProto::DeinitConferenceMenu()"));
- CallService(MO_REMOVEMENUITEM, (WPARAM)hLeaveChatMenuItem, 0);
- CallService(MO_REMOVEMENUITEM, (WPARAM)hCreateChatMenuItem, 0);
-}
-
diff --git a/protocols/Sametime/src/sametime_proto.cpp b/protocols/Sametime/src/sametime_proto.cpp index 9003bfbe21..2aaab309e0 100644 --- a/protocols/Sametime/src/sametime_proto.cpp +++ b/protocols/Sametime/src/sametime_proto.cpp @@ -66,7 +66,6 @@ CSametimeProto::~CSametimeProto() debugLog(_T("CSametimeProto::~CSametimeProto() start"));
DeinitSessionMenu();
- DeinitConferenceMenu();
DeinitAwayMsg();
UnregisterPopups();
diff --git a/protocols/Sametime/src/sametime_proto.h b/protocols/Sametime/src/sametime_proto.h index b3690b29ee..4f3a249cf3 100644 --- a/protocols/Sametime/src/sametime_proto.h +++ b/protocols/Sametime/src/sametime_proto.h @@ -99,7 +99,6 @@ struct CSametimeProto : public PROTO<CSametimeProto> void InitConference();
void InitConferenceMenu();
void DeinitConference();
- void DeinitConferenceMenu();
void ClearInviteQueue();
void TerminateConference(char* name);
int __cdecl GcEventHook(WPARAM wParam, LPARAM lParam);
@@ -183,8 +182,7 @@ struct CSametimeProto : public PROTO<CSametimeProto> mwServiceConference* service_conference;
mwLoginInfo* my_login_info;
mwConference* my_conference;
- HANDLE hLeaveChatMenuItem;
- HANDLE hCreateChatMenuItem;
+ HGENMENU hLeaveChatMenuItem, hCreateChatMenuItem;
// options.cpp
SametimeOptions options;
diff --git a/protocols/Tlen/src/tlen.cpp b/protocols/Tlen/src/tlen.cpp index c0acd7d49d..fbf6d2a30a 100644 --- a/protocols/Tlen/src/tlen.cpp +++ b/protocols/Tlen/src/tlen.cpp @@ -264,9 +264,7 @@ void TlenProtocol::initMenuItems() strncpy_s(text, sizeof(text), m_szModuleName, _TRUNCATE);
char *pSvcName = text + mir_strlen(text);
- CLISTMENUITEM mi = { 0 }, clmi = { 0 };
- clmi.flags = CMIM_FLAGS | CMIF_GRAYED;
-
+ CLISTMENUITEM mi = { 0 };
mi.pszContactOwner = m_szModuleName;
mi.popupPosition = 500090000;
@@ -292,7 +290,6 @@ void TlenProtocol::initMenuItems() mi.icolibItem = GetIconHandle(IDI_MUC);
mi.pszService = text;
hMenuMUC = Menu_AddMainMenuItem(&mi);
- Menu_ModifyItem(hMenuMUC, &clmi);
mir_strcpy(pSvcName, "/MainMenuInbox");
CreateProtoService(pSvcName, &TlenProtocol::MenuHandleInbox);
diff --git a/protocols/Tlen/src/tlen_iqid.cpp b/protocols/Tlen/src/tlen_iqid.cpp index 71233ee979..70876b4a00 100644 --- a/protocols/Tlen/src/tlen_iqid.cpp +++ b/protocols/Tlen/src/tlen_iqid.cpp @@ -220,11 +220,9 @@ void TlenIqResultRoster(TlenProtocol *proto, XmlNode *iqNode) }
}
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_FLAGS;
- Menu_ModifyItem(proto->hMenuMUC, &mi);
+ Menu_ModifyItem(proto->hMenuMUC, NULL, INVALID_HANDLE_VALUE, 0);
if (proto->hMenuChats != NULL)
- Menu_ModifyItem(proto->hMenuChats, &mi);
+ Menu_ModifyItem(proto->hMenuChats, NULL, INVALID_HANDLE_VALUE, 0);
proto->isOnline = TRUE;
proto->debugLogA("Status changed via THREADSTART");
diff --git a/protocols/Tlen/src/tlen_svc.cpp b/protocols/Tlen/src/tlen_svc.cpp index 8445565213..6406889bb9 100644 --- a/protocols/Tlen/src/tlen_svc.cpp +++ b/protocols/Tlen/src/tlen_svc.cpp @@ -1160,11 +1160,7 @@ int TlenProtocol::OnEvent(PROTOEVENTTYPE iEventType, WPARAM wParam, LPARAM lPara case EV_PROTO_ONEXIT: return PreShutdown(0, 0);
case EV_PROTO_ONRENAME:
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_NAME | CMIF_TCHAR;
- mi.ptszName = m_tszUserName;
- Menu_ModifyItem(hMenuRoot, &mi);
- /* FIXME: Rename network user as well */
+ Menu_ModifyItem(hMenuRoot, m_tszUserName);
}
return 1;
}
diff --git a/protocols/Tlen/src/tlen_thread.cpp b/protocols/Tlen/src/tlen_thread.cpp index 6cc8af6278..0e87420ca3 100644 --- a/protocols/Tlen/src/tlen_thread.cpp +++ b/protocols/Tlen/src/tlen_thread.cpp @@ -340,11 +340,9 @@ void __cdecl TlenServerThread(ThreadData *info) info->proto->isOnline = FALSE;
info->proto->isConnected = FALSE;
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_FLAGS | CMIF_GRAYED;
- Menu_ModifyItem(info->proto->hMenuMUC, &mi);
+ Menu_ModifyItem(info->proto->hMenuMUC, NULL, INVALID_HANDLE_VALUE, CMIF_GRAYED);
if (info->proto->hMenuChats != NULL)
- Menu_ModifyItem(info->proto->hMenuChats, &mi);
+ Menu_ModifyItem(info->proto->hMenuChats, NULL, INVALID_HANDLE_VALUE, CMIF_GRAYED);
// Set status to offline
char *szProto = info->proto->m_szModuleName;
diff --git a/protocols/WhatsApp/src/proto.h b/protocols/WhatsApp/src/proto.h index 2c7cf2e97e..cc6d787b7f 100644 --- a/protocols/WhatsApp/src/proto.h +++ b/protocols/WhatsApp/src/proto.h @@ -141,8 +141,7 @@ private: // Private data //////////////////////////////////////////////////////////////////////
- HGENMENU m_hMenuRoot;
- HANDLE m_hMenuCreateGroup;
+ HGENMENU m_hMenuRoot, m_hMenuCreateGroup;
HANDLE update_loop_lock_;
diff --git a/protocols/WhatsApp/src/theme.cpp b/protocols/WhatsApp/src/theme.cpp index 913d7b5aab..ac5f6ff3ff 100644 --- a/protocols/WhatsApp/src/theme.cpp +++ b/protocols/WhatsApp/src/theme.cpp @@ -84,9 +84,7 @@ int WhatsAppProto::OnBuildStatusMenu(WPARAM wParam, LPARAM lParam) void WhatsAppProto::ToggleStatusMenuItems(BOOL bEnable)
{
- CLISTMENUITEM clmi = { 0 };
- clmi.flags = CMIM_FLAGS | ((bEnable) ? 0 : CMIF_GRAYED);
-
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)m_hMenuRoot, (LPARAM)&clmi);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)m_hMenuCreateGroup, (LPARAM)&clmi);
+ int flags = (bEnable) ? 0 : CMIF_GRAYED;
+ Menu_ModifyItem(m_hMenuRoot, NULL, INVALID_HANDLE_VALUE, flags);
+ Menu_ModifyItem(m_hMenuCreateGroup, NULL, INVALID_HANDLE_VALUE, flags);
}
diff --git a/protocols/Yahoo/src/proto.cpp b/protocols/Yahoo/src/proto.cpp index 91d864b54b..2c2d9a42ea 100644 --- a/protocols/Yahoo/src/proto.cpp +++ b/protocols/Yahoo/src/proto.cpp @@ -639,12 +639,8 @@ int __cdecl CYahooProto::OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM break;
case EV_PROTO_ONRENAME:
- if (mainMenuRoot) {
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_NAME | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED;
- mi.ptszName = m_tszUserName;
- Menu_ModifyItem(mainMenuRoot, &mi);
- }
+ if (mainMenuRoot)
+ Menu_ModifyItem(mainMenuRoot, m_tszUserName, INVALID_HANDLE_VALUE, CMIF_KEEPUNTRANSLATED);
break;
case EV_PROTO_ONCONTACTDELETED:
diff --git a/src/core/stdaway/src/awaymsg.cpp b/src/core/stdaway/src/awaymsg.cpp index 2415198d4a..6be4cf1a7e 100644 --- a/src/core/stdaway/src/awaymsg.cpp +++ b/src/core/stdaway/src/awaymsg.cpp @@ -133,29 +133,23 @@ static INT_PTR GetMessageCommand(WPARAM wParam, LPARAM) static int AwayMsgPreBuildMenu(WPARAM hContact, LPARAM)
{
- TCHAR str[128];
char *szProto = GetContactProto(hContact);
-
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_FLAGS | CMIF_NOTOFFLINE | CMIF_HIDDEN | CMIF_TCHAR;
-
if (szProto != NULL) {
int chatRoom = db_get_b(hContact, szProto, "ChatRoom", 0);
if (!chatRoom) {
int status = db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE);
- mir_sntprintf(str, _countof(str), TranslateT("Re&ad %s message"), pcli->pfnGetStatusModeDescription(status, 0));
- mi.ptszName = str;
if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGRECV) {
if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(status)) {
- mi.flags = CMIM_FLAGS | CMIM_NAME | CMIF_NOTOFFLINE | CMIM_ICON | CMIF_TCHAR;
- mi.hIcon = Skin_LoadProtoIcon(szProto, status);
+ TCHAR str[128];
+ mir_sntprintf(str, _countof(str), TranslateT("Re&ad %s message"), pcli->pfnGetStatusModeDescription(status, 0));
+ Menu_ModifyItem(hAwayMsgMenuItem, str, Skin_LoadProtoIcon(szProto, status), CMIF_NOTOFFLINE);
+ return 0;
}
}
}
}
- Menu_ModifyItem(hAwayMsgMenuItem, &mi);
- IcoLib_ReleaseIcon(mi.hIcon, 0);
+ Menu_ShowItem(hAwayMsgMenuItem, false);
return 0;
}
diff --git a/src/mir_app/src/chat_clist.cpp b/src/mir_app/src/chat_clist.cpp index c8abfa46a9..e81520f679 100644 --- a/src/mir_app/src/chat_clist.cpp +++ b/src/mir_app/src/chat_clist.cpp @@ -175,19 +175,16 @@ int PrebuildContactMenu(WPARAM hContact, LPARAM) if (db_get_b(hContact, szProto, "ChatRoom", 0)) {
// still hide it for offline protos
if (CallProtoService(szProto, PS_GETSTATUS, 0, 0) != ID_STATUS_OFFLINE) {
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_NAME;
if (db_get_w(hContact, szProto, "Status", 0) == ID_STATUS_OFFLINE) {
if (ProtoServiceExists(szProto, PS_JOINCHAT)) {
bEnabledJoin = true;
- mi.pszName = LPGEN("&Join chat");
+ Menu_ModifyItem(hJoinMenuItem, LPGENT("&Join chat"));
}
}
else {
bEnabledJoin = true;
- mi.pszName = LPGEN("&Open chat window");
+ Menu_ModifyItem(hJoinMenuItem, LPGENT("&Open chat window"));
}
- Menu_ModifyItem(hJoinMenuItem, &mi);
}
bEnabledLeave = ProtoServiceExists(szProto, PS_LEAVECHAT) != 0;
}
diff --git a/src/mir_app/src/clistmenus.cpp b/src/mir_app/src/clistmenus.cpp index f61a541219..2e8c4cfda3 100644 --- a/src/mir_app/src/clistmenus.cpp +++ b/src/mir_app/src/clistmenus.cpp @@ -439,14 +439,11 @@ INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM) if (reset || check) {
TMO_IntMenuItem *timiParent = MO_GetIntMenuItem(timi->mi.root);
if (timiParent) {
- CLISTMENUITEM mi2 = { 0 };
- mi2.flags = CMIM_NAME | CMIF_TCHAR;
- mi2.ptszName = TranslateTH(timi->mi.hLangpack, timi->mi.hIcon ? timi->mi.name.t : LPGENT("Custom status"));
+ LPTSTR ptszName = TranslateTH(timi->mi.hLangpack, timi->mi.hIcon ? timi->mi.name.t : LPGENT("Custom status"));
timiParent = MO_GetIntMenuItem(timi->mi.root);
MenuItemData it = { 0 };
-
if (FindMenuHandleByGlobalID(hStatusMenu, timiParent, &it)) {
MENUITEMINFO mi = { 0 };
TCHAR d[100];
@@ -465,11 +462,12 @@ INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM) }
mi.fState |= (check && !reset ? MFS_CHECKED : MFS_UNCHECKED);
- mi.dwTypeData = mi2.ptszName;
+ mi.dwTypeData = ptszName;
SetMenuItemInfo(it.OwnerMenu, it.position, TRUE, &mi);
}
- Menu_ModifyItem(timi->mi.root, &mi2);
+ Menu_ModifyItem(timi->mi.root, ptszName);
+
timiParent->iconId = timi->iconId;
if (timiParent->hBmp) DeleteObject(timiParent->hBmp);
timiParent->hBmp = NULL;
@@ -512,8 +510,7 @@ INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM) }
if (timi->mi.hIcon) {
- timi->mi.flags |= CMIM_ICON;
- MO_ModifyMenuItem(timi, &timi->mi);
+ Menu_ModifyItem(timi, NULL, timi->mi.hIcon);
if (IconNeedDestroy) {
DestroyIcon(timi->mi.hIcon);
timi->mi.hIcon = NULL;
@@ -615,31 +612,18 @@ INT_PTR FreeOwnerDataStatusMenu(WPARAM, LPARAM lParam) /////////////////////////////////////////////////////////////////////////////////////////
// Other menu functions
-static INT_PTR ShowHideMenuItem(WPARAM wParam, LPARAM lParam)
+MIR_APP_DLL(void) Menu_ShowItem(HGENMENU hMenuItem, bool bShow)
{
- TMO_IntMenuItem *pimi = MO_GetIntMenuItem((HGENMENU)wParam);
+ TMO_IntMenuItem *pimi = MO_GetIntMenuItem(hMenuItem);
if (pimi == NULL)
- return 1;
+ return;
- TMO_MenuItem tmi = { sizeof(tmi) };
- tmi.flags = CMIM_FLAGS + pimi->mi.flags;
- if (lParam)
- tmi.flags &= ~CMIF_HIDDEN;
+ int flags = pimi->mi.flags;
+ if (bShow)
+ flags &= ~CMIF_HIDDEN;
else
- tmi.flags |= CMIF_HIDDEN;
-
- return MO_ModifyMenuItem((TMO_IntMenuItem*)wParam, &tmi);
-}
-
-//wparam MenuItemHandle
-static INT_PTR ModifyCustomMenuItem(WPARAM wParam, LPARAM lParam)
-{
- TMO_MenuItem tmi;
- CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam;
- if (!cli.pfnConvertMenu(mi, &tmi))
- return 0;
-
- return MO_ModifyMenuItem((TMO_IntMenuItem*)wParam, &tmi);
+ flags |= CMIF_HIDDEN;
+ Menu_ModifyItem(hMenuItem, NULL, INVALID_HANDLE_VALUE, flags);
}
INT_PTR MenuProcessCommand(WPARAM wParam, LPARAM lParam)
@@ -890,7 +874,7 @@ void RebuildMenuOrder(void) TMO_IntMenuItem *menuHandle = MO_AddNewMenuItem(hStatusMenuObject, &tmi);
((StatusMenuExecParam*)tmi.ownerdata)->protoindex = (int)menuHandle;
- MO_ModifyMenuItem(menuHandle, &tmi);
+ Menu_ModifyItem(menuHandle, tmi.name.t, tmi.hIcon, tmi.flags);
cli.menuProtos = (MenuProto*)mir_realloc(cli.menuProtos, sizeof(MenuProto)*(cli.menuProtoCount + 1));
memset(&(cli.menuProtos[cli.menuProtoCount]), 0, sizeof(MenuProto));
@@ -994,17 +978,14 @@ void RebuildMenuOrder(void) static int sttRebuildHotkeys(WPARAM, LPARAM)
{
- TMO_MenuItem tmi = { sizeof(tmi) };
- tmi.flags = CMIM_HOTKEY | CMIM_NAME | CMIF_TCHAR;
-
for (int j = 0; j < _countof(statusModeList); j++) {
TCHAR buf[256], hotkeyName[100];
WORD hotKey = GetHotkeyValue(statusHotkeys[j]);
HotkeyToName(hotkeyName, _countof(hotkeyName), HIBYTE(hotKey), LOBYTE(hotKey));
mir_sntprintf(buf, _T("%s\t%s"), cli.pfnGetStatusModeDescription(statusModeList[j], 0), hotkeyName);
- tmi.name.t = buf;
- tmi.hotKey = MAKELONG(HIBYTE(hotKey), LOBYTE(hotKey));
- MO_ModifyMenuItem(hStatusMainMenuHandles[j], &tmi);
+ Menu_ModifyItem(hStatusMainMenuHandles[j], buf);
+
+ hStatusMainMenuHandles[j]->mi.hotKey = MAKELONG(HIBYTE(hotKey), LOBYTE(hotKey));
}
return 0;
@@ -1031,36 +1012,28 @@ static int MenuProtoAck(WPARAM, LPARAM lParam) int overallStatus = cli.pfnGetAverageMode(NULL);
- TMO_MenuItem tmi = { sizeof(tmi) };
if (overallStatus >= ID_STATUS_OFFLINE) {
int pos = statustopos(cli.currentStatusMenuItem);
if (pos == -1)
pos = 0;
// reset all current possible checked statuses
- for (int pos2 = 0; pos2 < hStatusMainMenuHandlesCnt; pos2++) {
- if (pos2 >= 0 && pos2 < hStatusMainMenuHandlesCnt) {
- tmi.flags = CMIM_FLAGS | CMIF_ROOTHANDLE;
- MO_ModifyMenuItem(hStatusMainMenuHandles[pos2], &tmi);
- }
- }
+ for (int pos2 = 0; pos2 < hStatusMainMenuHandlesCnt; pos2++)
+ if (pos2 >= 0 && pos2 < hStatusMainMenuHandlesCnt)
+ Menu_ModifyItem(hStatusMainMenuHandles[pos2], NULL, INVALID_HANDLE_VALUE, CMIF_ROOTHANDLE);
cli.currentStatusMenuItem = overallStatus;
pos = statustopos(cli.currentStatusMenuItem);
- if (pos >= 0 && pos < hStatusMainMenuHandlesCnt) {
- tmi.flags = CMIM_FLAGS | CMIF_ROOTHANDLE | CMIF_CHECKED;
- MO_ModifyMenuItem(hStatusMainMenuHandles[pos], &tmi);
- }
+ if (pos >= 0 && pos < hStatusMainMenuHandlesCnt)
+ Menu_ModifyItem(hStatusMainMenuHandles[pos], NULL, INVALID_HANDLE_VALUE, CMIF_ROOTHANDLE | CMIF_CHECKED);
}
else {
int pos = statustopos(cli.currentStatusMenuItem);
if (pos == -1)
pos = 0;
- if (pos >= 0 && pos < hStatusMainMenuHandlesCnt) {
- tmi.flags = CMIM_FLAGS | CMIF_ROOTHANDLE;
- MO_ModifyMenuItem(hStatusMainMenuHandles[pos], &tmi);
- }
+ if (pos >= 0 && pos < hStatusMainMenuHandlesCnt)
+ Menu_ModifyItem(hStatusMainMenuHandles[pos], NULL, INVALID_HANDLE_VALUE, CMIF_ROOTHANDLE);
cli.currentStatusMenuItem = 0;
}
@@ -1071,18 +1044,14 @@ static int MenuProtoAck(WPARAM, LPARAM lParam) int pos = statustopos((int)ack->hProcess);
if (pos == -1)
pos = 0;
- for (pos = 0; pos < _countof(statusModeList); pos++) {
- tmi.flags = CMIM_FLAGS | CMIF_ROOTHANDLE;
- MO_ModifyMenuItem(hStatusMenuHandles[i].menuhandle[pos], &tmi);
- }
+ for (pos = 0; pos < _countof(statusModeList); pos++)
+ Menu_ModifyItem(hStatusMenuHandles[i].menuhandle[pos], NULL, INVALID_HANDLE_VALUE, CMIF_ROOTHANDLE);
}
if (ack->lParam >= ID_STATUS_OFFLINE && ack->lParam < ID_STATUS_OFFLINE + _countof(statusModeList)) {
int pos = statustopos((int)ack->lParam);
- if (pos >= 0 && pos < _countof(statusModeList)) {
- tmi.flags = CMIM_FLAGS | CMIF_ROOTHANDLE | CMIF_CHECKED;
- MO_ModifyMenuItem(hStatusMenuHandles[i].menuhandle[pos], &tmi);
- }
+ if (pos >= 0 && pos < _countof(statusModeList))
+ Menu_ModifyItem(hStatusMenuHandles[i].menuhandle[pos], NULL, INVALID_HANDLE_VALUE, CMIF_ROOTHANDLE | CMIF_CHECKED);
}
break;
}
@@ -1250,8 +1219,6 @@ void InitCustomMenus(void) CreateServiceFunction("CList/AddContactMenuItem", AddContactMenuItem);
CreateServiceFunction(MS_CLIST_MENUBUILDCONTACT, BuildContactMenu);
- CreateServiceFunction(MS_CLIST_SHOWHIDEMENUITEM, ShowHideMenuItem);
- CreateServiceFunction(MS_CLIST_MODIFYMENUITEM, ModifyCustomMenuItem);
CreateServiceFunction(MS_CLIST_MENUMEASUREITEM, MeasureMenuItem);
CreateServiceFunction(MS_CLIST_MENUDRAWITEM, DrawMenuItem);
diff --git a/src/mir_app/src/genmenu.cpp b/src/mir_app/src/genmenu.cpp index 2c226f4aca..8efe8d2481 100644 --- a/src/mir_app/src/genmenu.cpp +++ b/src/mir_app/src/genmenu.cpp @@ -301,35 +301,27 @@ INT_PTR MO_GetDefaultMenuItem(WPARAM wParam, LPARAM) // wparam MenuItemHandle
// lparam PMO_MenuItem
-int MO_ModifyMenuItem(TMO_IntMenuItem *menuHandle, TMO_MenuItem *pmi)
+MIR_APP_DLL(int) Menu_ModifyItem(HGENMENU hMenuItem, const TCHAR *ptszName, HANDLE hIcon, int iFlags)
{
- int oldflags;
-
- if (!bIsGenMenuInited || pmi == NULL)
+ if (!bIsGenMenuInited)
return -1;
mir_cslock lck(csMenuHook);
- TMO_IntMenuItem *pimi = MO_GetIntMenuItem((HGENMENU)menuHandle);
+ TMO_IntMenuItem *pimi = MO_GetIntMenuItem(hMenuItem);
if (pimi == NULL)
return -1;
- if (pmi->flags & CMIM_NAME) {
- FreeAndNil((void**)&pimi->mi.name.t);
+ if (ptszName != NULL)
+ replaceStrT(pimi->mi.name.t, ptszName);
- if (pmi->flags & CMIF_UNICODE)
- pimi->mi.name.t = mir_tstrdup(pmi->name.t);
- else
- pimi->mi.name.t = mir_a2t(pmi->name.a);
+ if (iFlags != -1) {
+ int oldflags = (pimi->mi.flags & CMIF_ROOTHANDLE);
+ pimi->mi.flags = iFlags | oldflags;
}
- if (pmi->flags & CMIM_FLAGS) {
- oldflags = (pimi->mi.flags & CMIF_ROOTHANDLE);
- pimi->mi.flags = (pmi->flags & ~CMIM_ALL) | oldflags;
- }
-
- if ((pmi->flags & CMIM_ICON) && !bIconsDisabled) {
- HANDLE hIcolibItem = IcoLib_IsManaged(pmi->hIcon);
+ if (hIcon != INVALID_HANDLE_VALUE && !bIconsDisabled) {
+ HANDLE hIcolibItem = IcoLib_IsManaged((HICON)hIcon);
if (hIcolibItem) {
HICON hIcon = IcoLib_GetIconByHandle(hIcolibItem, false);
if (hIcon != NULL) {
@@ -340,9 +332,9 @@ int MO_ModifyMenuItem(TMO_IntMenuItem *menuHandle, TMO_MenuItem *pmi) else pimi->iconId = -1, pimi->hIcolibItem = NULL;
}
else {
- pimi->mi.hIcon = pmi->hIcon;
- if (pmi->hIcon != NULL)
- pimi->iconId = ImageList_ReplaceIcon(pimi->parent->m_hMenuIcons, pimi->iconId, pmi->hIcon);
+ pimi->mi.hIcon = (HICON)hIcon;
+ if (hIcon != NULL)
+ pimi->iconId = ImageList_ReplaceIcon(pimi->parent->m_hMenuIcons, pimi->iconId, (HICON)hIcon);
else
pimi->iconId = -1; //fixme, should remove old icon & shuffle all iconIds
}
@@ -352,9 +344,6 @@ int MO_ModifyMenuItem(TMO_IntMenuItem *menuHandle, TMO_MenuItem *pmi) }
}
- if (pmi->flags & CMIM_HOTKEY)
- pimi->mi.hotKey = pmi->hotKey;
-
return 0;
}
@@ -1166,7 +1155,6 @@ int InitGenMenu() CreateServiceFunction(MO_REMOVEMENUITEM, MO_RemoveMenuItem);
CreateServiceFunction(MO_ADDNEWMENUITEM, (MIRANDASERVICE)MO_AddNewMenuItem);
CreateServiceFunction(MO_MENUITEMGETOWNERDATA, MO_MenuItemGetOwnerData);
- CreateServiceFunction(MO_MODIFYMENUITEM, (MIRANDASERVICE)MO_ModifyMenuItem);
CreateServiceFunction(MO_GETMENUITEM, MO_GetMenuItem);
CreateServiceFunction(MO_GETDEFAULTMENUITEM, MO_GetDefaultMenuItem);
CreateServiceFunction(MO_PROCESSCOMMANDBYMENUIDENT, MO_ProcessCommandByMenuIdent);
diff --git a/src/mir_app/src/genmenu.h b/src/mir_app/src/genmenu.h index acd498384f..12dabdacc7 100644 --- a/src/mir_app/src/genmenu.h +++ b/src/mir_app/src/genmenu.h @@ -111,7 +111,6 @@ TMO_IntMenuItem* MO_AddOldNewMenuItem(HANDLE menuobjecthandle, TMO_MenuItem *pmi int MO_DrawMenuItem(LPDRAWITEMSTRUCT dis);
int MO_MeasureMenuItem(LPMEASUREITEMSTRUCT mis);
-int MO_ModifyMenuItem(TMO_IntMenuItem *menuHandle, TMO_MenuItem *pmiparam);
int MO_ProcessCommand(TMO_IntMenuItem *pimi, LPARAM lParam);
INT_PTR MO_ProcessHotKeys(HANDLE menuHandle, INT_PTR vKey);
int MO_SetOptionsMenuItem(TMO_IntMenuItem *menuobjecthandle, int setting, INT_PTR value);
diff --git a/src/mir_app/src/meta_menu.cpp b/src/mir_app/src/meta_menu.cpp index 1b07b97247..c53083d2e6 100644 --- a/src/mir_app/src/meta_menu.cpp +++ b/src/mir_app/src/meta_menu.cpp @@ -249,7 +249,6 @@ int Meta_ModifyMenu(WPARAM hMeta, LPARAM) if (cc == NULL)
return 0;
- CLISTMENUITEM mi = { 0 };
Menu_ShowItem(hMenuRoot, false);
if (cc->IsMeta()) {
@@ -261,11 +260,9 @@ int Meta_ModifyMenu(WPARAM hMeta, LPARAM) Menu_ShowItem(hMenuAdd, false);
Menu_ShowItem(hMenuConvert, false);
Menu_ShowItem(hMenuDefault, false);
- Menu_ShowItem(hMenuDelete, false);
- mi.flags = CMIM_NAME;
- mi.pszName = LPGEN("Remove from metacontact");
- Menu_ModifyItem(hMenuDelete, &mi);
+ Menu_ShowItem(hMenuDelete, false);
+ Menu_ModifyItem(hMenuDelete, LPGENT("Remove from metacontact"));
// show subcontact menu items
CMString tszNick;
@@ -276,20 +273,18 @@ int Meta_ModifyMenu(WPARAM hMeta, LPARAM) }
MCONTACT hContact = Meta_GetContactHandle(cc, i);
+ LPCTSTR ptszName;
if (options.menu_contact_label == DNT_UID) {
Meta_GetSubNick(hMeta, i, tszNick);
- mi.ptszName = tszNick.GetBuffer();
+ ptszName = tszNick.GetBuffer();
}
- else mi.ptszName = cli.pfnGetContactDisplayName(hContact, 0);
-
- mi.flags = CMIF_TCHAR | CMIM_FLAGS | CMIM_NAME | CMIM_ICON;
+ else ptszName = cli.pfnGetContactDisplayName(hContact, 0);
int iconIndex = CallService(MS_CLIST_GETCONTACTICON, hContact, 0);
- mi.hIcon = ImageList_GetIcon((HIMAGELIST)CallService(MS_CLIST_GETICONSIMAGELIST, 0, 0), iconIndex, 0);
-
- Menu_ModifyItem(hMenuContact[i], &mi);
- DestroyIcon(mi.hIcon);
+ HICON hIcon = ImageList_GetIcon((HIMAGELIST)CallService(MS_CLIST_GETICONSIMAGELIST, 0, 0), iconIndex, 0);
+ Menu_ModifyItem(hMenuContact[i], ptszName, hIcon, 0);
+ DestroyIcon(hIcon);
Menu_ShowItem(hMenuRoot, true);
}
@@ -316,9 +311,7 @@ int Meta_ModifyMenu(WPARAM hMeta, LPARAM) if (cc->IsSub()) {
Menu_ShowItem(hMenuDefault, true);
- mi.flags = CMIM_NAME;
- mi.pszName = LPGEN("Remove from metacontact");
- Menu_ModifyItem(hMenuDelete, &mi);
+ Menu_ModifyItem(hMenuDelete, LPGENT("Remove from metacontact"));
Menu_ShowItem(hMenuDelete, true);
Menu_ShowItem(hMenuAdd, false);
@@ -346,20 +339,12 @@ int Meta_ModifyMenu(WPARAM hMeta, LPARAM) INT_PTR Meta_OnOff(WPARAM, LPARAM)
{
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_NAME | CMIM_ICON;
-
bool bToggled = !db_mc_isEnabled();
db_set_b(0, META_PROTO, "Enabled", bToggled);
- if (bToggled) {
- mi.icolibItem = GetIconHandle(I_MENUOFF);
- mi.pszName = LPGEN("Toggle metacontacts off");
- }
- else {
- mi.icolibItem = GetIconHandle(I_MENU);
- mi.pszName = LPGEN("Toggle metacontacts on");
- }
- Menu_ModifyItem(hMenuOnOff, &mi);
+ if (bToggled)
+ Menu_ModifyItem(hMenuOnOff, LPGENT("Toggle metacontacts off"), GetIconHandle(I_MENUOFF));
+ else
+ Menu_ModifyItem(hMenuOnOff, LPGENT("Toggle metacontacts on"), GetIconHandle(I_MENU));
db_mc_enable(bToggled);
Meta_HideMetaContacts(!bToggled);
@@ -434,11 +419,7 @@ void InitMenus() if (!db_mc_isEnabled()) {
// modify main menu item
- mi.flags = CMIM_NAME | CMIM_ICON;
- mi.icolibItem = GetIconHandle(I_MENU);
- mi.pszName = LPGEN("Toggle metacontacts on");
- Menu_ModifyItem(hMenuOnOff, &mi);
-
+ Menu_ModifyItem(hMenuOnOff, LPGENT("Toggle metacontacts on"), GetIconHandle(I_MENU));
Meta_HideMetaContacts(true);
}
else {
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index 0668cf9561..8764180eff 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -200,3 +200,5 @@ xmlToStringWithFormatting @197 KillModuleMenus @198
Utils_ReplaceVars @199
Utils_ReplaceVarsW @200
+Menu_ShowItem @201
+Menu_ModifyItem @202
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 69d189d5f2..87aee3de21 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -200,3 +200,5 @@ xmlToStringWithFormatting @197 KillModuleMenus @198
Utils_ReplaceVars @199
Utils_ReplaceVarsW @200
+Menu_ShowItem @201
+Menu_ModifyItem @202
|