summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-06-22 20:38:56 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-06-22 20:38:56 +0000
commit88790eed4ffd9ca555c8f9b73cb014a93b57a34f (patch)
treeb3e5bfe096005a9cac4bc14fdfbe5f6f5acad98a /plugins
parent9ecc2aa50e2183e2c4a11861ca6dede7d2151139 (diff)
Menu_ModifyItem unbound from CLISTMENUITEM structure
git-svn-id: http://svn.miranda-ng.org/main/trunk@14334 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Alarms/src/frame.cpp16
-rw-r--r--plugins/Alarms/src/options.cpp1
-rw-r--r--plugins/AuthState/src/main.cpp7
-rw-r--r--plugins/AutoShutdown/src/settingsdlg.cpp18
-rw-r--r--plugins/AvatarHistory/src/icolib.cpp8
-rw-r--r--plugins/BasicHistory/src/BasicHistory.cpp28
-rw-r--r--plugins/Boltun/src/boltun.cpp25
-rw-r--r--plugins/Boltun/src/stdafx.h1
-rw-r--r--plugins/BossKeyPlus/src/BossKey.cpp10
-rw-r--r--plugins/BuddyExpectator/src/BuddyExpectator.cpp16
-rw-r--r--plugins/ClientChangeNotify/src/ClientChangeNotify.cpp16
-rw-r--r--plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp129
-rw-r--r--plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp26
-rw-r--r--plugins/Clist_modern/src/modern_clistmenus.cpp35
-rw-r--r--plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp144
-rw-r--r--plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp33
-rw-r--r--plugins/Console/src/Console.cpp8
-rw-r--r--plugins/CyrTranslit/src/MirandaContact.cpp7
-rw-r--r--plugins/Db3x_mmap/src/dbintf.h2
-rw-r--r--plugins/Db3x_mmap/src/ui.cpp12
-rw-r--r--plugins/FloatingContacts/src/main.cpp9
-rw-r--r--plugins/HTTPServer/src/main.cpp17
-rw-r--r--plugins/HistoryPlusPlus/historypp.dpr46
-rw-r--r--plugins/HistoryStats/src/main.cpp41
-rw-r--r--plugins/HistoryStats/src/mu_common.cpp15
-rw-r--r--plugins/HistoryStats/src/mu_common.h5
-rw-r--r--plugins/ListeningTo/src/listeningto.cpp20
-rw-r--r--plugins/MenuItemEx/src/main.cpp88
-rw-r--r--plugins/MirLua/src/m_genmenu.cpp3
-rw-r--r--plugins/MirOTR/src/mirotrmenu.cpp35
-rw-r--r--plugins/MirOTR/src/svcs_menu.cpp3
-rw-r--r--plugins/MyDetails/src/frame.cpp10
-rw-r--r--plugins/NewAwaySysMod/src/AwaySys.cpp74
-rw-r--r--plugins/NewEventNotify/src/menuitem.cpp16
-rw-r--r--plugins/NewXstatusNotify/src/main.cpp15
-rwxr-xr-xplugins/New_GPG/src/utilities.cpp26
-rw-r--r--plugins/NewsAggregator/Src/Menus.cpp8
-rw-r--r--plugins/NewsAggregator/Src/Services.cpp14
-rw-r--r--plugins/NoHistory/src/dllmain.cpp13
-rw-r--r--plugins/PasteIt/src/PasteIt.cpp8
-rw-r--r--plugins/Popup/src/main.cpp29
-rw-r--r--plugins/Quotes/src/Forex.cpp58
-rw-r--r--plugins/Quotes/src/QuoteInfoDlg.cpp7
-rw-r--r--plugins/RecentContacts/src/RecentContacts.cpp9
-rw-r--r--plugins/SecureIM/src/svcs_clist.cpp47
-rw-r--r--plugins/SeenPlugin/src/menu.cpp48
-rw-r--r--plugins/Sessions/Src/Main.cpp9
-rw-r--r--plugins/SimpleAR/src/Main.cpp39
-rw-r--r--plugins/SimpleAR/src/Options.cpp10
-rw-r--r--plugins/SimpleStatusMsg/src/awaymsg.cpp23
-rw-r--r--plugins/SmileyAdd/src/services.cpp2
-rw-r--r--plugins/StartupSilence/src/main.cpp16
-rw-r--r--plugins/TabSRMM/src/typingnotify.cpp17
-rw-r--r--plugins/UserInfoEx/src/svc_refreshci.cpp16
-rw-r--r--plugins/Weather/src/weather_mwin.cpp6
-rw-r--r--plugins/Weather/src/weather_svcs.cpp29
-rw-r--r--plugins/WebView/src/webview.cpp30
-rw-r--r--plugins/WebView/src/webview.h2
-rw-r--r--plugins/WhoUsesMyFiles/src/wumfplug.cpp10
-rw-r--r--plugins/YAPP/src/services.cpp16
-rw-r--r--plugins/YAPP/src/yapp.cpp17
-rw-r--r--plugins/ZeroNotification/src/main.cpp8
62 files changed, 470 insertions, 986 deletions
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