summaryrefslogtreecommitdiff
path: root/src
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 /src
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 'src')
-rw-r--r--src/core/stdaway/src/awaymsg.cpp16
-rw-r--r--src/mir_app/src/chat_clist.cpp7
-rw-r--r--src/mir_app/src/clistmenus.cpp89
-rw-r--r--src/mir_app/src/genmenu.cpp38
-rw-r--r--src/mir_app/src/genmenu.h1
-rw-r--r--src/mir_app/src/meta_menu.cpp47
-rw-r--r--src/mir_app/src/mir_app.def2
-rw-r--r--src/mir_app/src/mir_app64.def2
8 files changed, 66 insertions, 136 deletions
diff --git a/src/core/stdaway/src/awaymsg.cpp b/src/core/stdaway/src/awaymsg.cpp
index 2415198d4a..6be4cf1a7e 100644
--- a/src/core/stdaway/src/awaymsg.cpp
+++ b/src/core/stdaway/src/awaymsg.cpp
@@ -133,29 +133,23 @@ static INT_PTR GetMessageCommand(WPARAM wParam, LPARAM)
static int AwayMsgPreBuildMenu(WPARAM hContact, LPARAM)
{
- TCHAR str[128];
char *szProto = GetContactProto(hContact);
-
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_FLAGS | CMIF_NOTOFFLINE | CMIF_HIDDEN | CMIF_TCHAR;
-
if (szProto != NULL) {
int chatRoom = db_get_b(hContact, szProto, "ChatRoom", 0);
if (!chatRoom) {
int status = db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE);
- mir_sntprintf(str, _countof(str), TranslateT("Re&ad %s message"), pcli->pfnGetStatusModeDescription(status, 0));
- mi.ptszName = str;
if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGRECV) {
if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(status)) {
- mi.flags = CMIM_FLAGS | CMIM_NAME | CMIF_NOTOFFLINE | CMIM_ICON | CMIF_TCHAR;
- mi.hIcon = Skin_LoadProtoIcon(szProto, status);
+ TCHAR str[128];
+ mir_sntprintf(str, _countof(str), TranslateT("Re&ad %s message"), pcli->pfnGetStatusModeDescription(status, 0));
+ Menu_ModifyItem(hAwayMsgMenuItem, str, Skin_LoadProtoIcon(szProto, status), CMIF_NOTOFFLINE);
+ return 0;
}
}
}
}
- Menu_ModifyItem(hAwayMsgMenuItem, &mi);
- IcoLib_ReleaseIcon(mi.hIcon, 0);
+ Menu_ShowItem(hAwayMsgMenuItem, false);
return 0;
}
diff --git a/src/mir_app/src/chat_clist.cpp b/src/mir_app/src/chat_clist.cpp
index c8abfa46a9..e81520f679 100644
--- a/src/mir_app/src/chat_clist.cpp
+++ b/src/mir_app/src/chat_clist.cpp
@@ -175,19 +175,16 @@ int PrebuildContactMenu(WPARAM hContact, LPARAM)
if (db_get_b(hContact, szProto, "ChatRoom", 0)) {
// still hide it for offline protos
if (CallProtoService(szProto, PS_GETSTATUS, 0, 0) != ID_STATUS_OFFLINE) {
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_NAME;
if (db_get_w(hContact, szProto, "Status", 0) == ID_STATUS_OFFLINE) {
if (ProtoServiceExists(szProto, PS_JOINCHAT)) {
bEnabledJoin = true;
- mi.pszName = LPGEN("&Join chat");
+ Menu_ModifyItem(hJoinMenuItem, LPGENT("&Join chat"));
}
}
else {
bEnabledJoin = true;
- mi.pszName = LPGEN("&Open chat window");
+ Menu_ModifyItem(hJoinMenuItem, LPGENT("&Open chat window"));
}
- Menu_ModifyItem(hJoinMenuItem, &mi);
}
bEnabledLeave = ProtoServiceExists(szProto, PS_LEAVECHAT) != 0;
}
diff --git a/src/mir_app/src/clistmenus.cpp b/src/mir_app/src/clistmenus.cpp
index f61a541219..2e8c4cfda3 100644
--- a/src/mir_app/src/clistmenus.cpp
+++ b/src/mir_app/src/clistmenus.cpp
@@ -439,14 +439,11 @@ INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM)
if (reset || check) {
TMO_IntMenuItem *timiParent = MO_GetIntMenuItem(timi->mi.root);
if (timiParent) {
- CLISTMENUITEM mi2 = { 0 };
- mi2.flags = CMIM_NAME | CMIF_TCHAR;
- mi2.ptszName = TranslateTH(timi->mi.hLangpack, timi->mi.hIcon ? timi->mi.name.t : LPGENT("Custom status"));
+ LPTSTR ptszName = TranslateTH(timi->mi.hLangpack, timi->mi.hIcon ? timi->mi.name.t : LPGENT("Custom status"));
timiParent = MO_GetIntMenuItem(timi->mi.root);
MenuItemData it = { 0 };
-
if (FindMenuHandleByGlobalID(hStatusMenu, timiParent, &it)) {
MENUITEMINFO mi = { 0 };
TCHAR d[100];
@@ -465,11 +462,12 @@ INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM)
}
mi.fState |= (check && !reset ? MFS_CHECKED : MFS_UNCHECKED);
- mi.dwTypeData = mi2.ptszName;
+ mi.dwTypeData = ptszName;
SetMenuItemInfo(it.OwnerMenu, it.position, TRUE, &mi);
}
- Menu_ModifyItem(timi->mi.root, &mi2);
+ Menu_ModifyItem(timi->mi.root, ptszName);
+
timiParent->iconId = timi->iconId;
if (timiParent->hBmp) DeleteObject(timiParent->hBmp);
timiParent->hBmp = NULL;
@@ -512,8 +510,7 @@ INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM)
}
if (timi->mi.hIcon) {
- timi->mi.flags |= CMIM_ICON;
- MO_ModifyMenuItem(timi, &timi->mi);
+ Menu_ModifyItem(timi, NULL, timi->mi.hIcon);
if (IconNeedDestroy) {
DestroyIcon(timi->mi.hIcon);
timi->mi.hIcon = NULL;
@@ -615,31 +612,18 @@ INT_PTR FreeOwnerDataStatusMenu(WPARAM, LPARAM lParam)
/////////////////////////////////////////////////////////////////////////////////////////
// Other menu functions
-static INT_PTR ShowHideMenuItem(WPARAM wParam, LPARAM lParam)
+MIR_APP_DLL(void) Menu_ShowItem(HGENMENU hMenuItem, bool bShow)
{
- TMO_IntMenuItem *pimi = MO_GetIntMenuItem((HGENMENU)wParam);
+ TMO_IntMenuItem *pimi = MO_GetIntMenuItem(hMenuItem);
if (pimi == NULL)
- return 1;
+ return;
- TMO_MenuItem tmi = { sizeof(tmi) };
- tmi.flags = CMIM_FLAGS + pimi->mi.flags;
- if (lParam)
- tmi.flags &= ~CMIF_HIDDEN;
+ int flags = pimi->mi.flags;
+ if (bShow)
+ flags &= ~CMIF_HIDDEN;
else
- tmi.flags |= CMIF_HIDDEN;
-
- return MO_ModifyMenuItem((TMO_IntMenuItem*)wParam, &tmi);
-}
-
-//wparam MenuItemHandle
-static INT_PTR ModifyCustomMenuItem(WPARAM wParam, LPARAM lParam)
-{
- TMO_MenuItem tmi;
- CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam;
- if (!cli.pfnConvertMenu(mi, &tmi))
- return 0;
-
- return MO_ModifyMenuItem((TMO_IntMenuItem*)wParam, &tmi);
+ flags |= CMIF_HIDDEN;
+ Menu_ModifyItem(hMenuItem, NULL, INVALID_HANDLE_VALUE, flags);
}
INT_PTR MenuProcessCommand(WPARAM wParam, LPARAM lParam)
@@ -890,7 +874,7 @@ void RebuildMenuOrder(void)
TMO_IntMenuItem *menuHandle = MO_AddNewMenuItem(hStatusMenuObject, &tmi);
((StatusMenuExecParam*)tmi.ownerdata)->protoindex = (int)menuHandle;
- MO_ModifyMenuItem(menuHandle, &tmi);
+ Menu_ModifyItem(menuHandle, tmi.name.t, tmi.hIcon, tmi.flags);
cli.menuProtos = (MenuProto*)mir_realloc(cli.menuProtos, sizeof(MenuProto)*(cli.menuProtoCount + 1));
memset(&(cli.menuProtos[cli.menuProtoCount]), 0, sizeof(MenuProto));
@@ -994,17 +978,14 @@ void RebuildMenuOrder(void)
static int sttRebuildHotkeys(WPARAM, LPARAM)
{
- TMO_MenuItem tmi = { sizeof(tmi) };
- tmi.flags = CMIM_HOTKEY | CMIM_NAME | CMIF_TCHAR;
-
for (int j = 0; j < _countof(statusModeList); j++) {
TCHAR buf[256], hotkeyName[100];
WORD hotKey = GetHotkeyValue(statusHotkeys[j]);
HotkeyToName(hotkeyName, _countof(hotkeyName), HIBYTE(hotKey), LOBYTE(hotKey));
mir_sntprintf(buf, _T("%s\t%s"), cli.pfnGetStatusModeDescription(statusModeList[j], 0), hotkeyName);
- tmi.name.t = buf;
- tmi.hotKey = MAKELONG(HIBYTE(hotKey), LOBYTE(hotKey));
- MO_ModifyMenuItem(hStatusMainMenuHandles[j], &tmi);
+ Menu_ModifyItem(hStatusMainMenuHandles[j], buf);
+
+ hStatusMainMenuHandles[j]->mi.hotKey = MAKELONG(HIBYTE(hotKey), LOBYTE(hotKey));
}
return 0;
@@ -1031,36 +1012,28 @@ static int MenuProtoAck(WPARAM, LPARAM lParam)
int overallStatus = cli.pfnGetAverageMode(NULL);
- TMO_MenuItem tmi = { sizeof(tmi) };
if (overallStatus >= ID_STATUS_OFFLINE) {
int pos = statustopos(cli.currentStatusMenuItem);
if (pos == -1)
pos = 0;
// reset all current possible checked statuses
- for (int pos2 = 0; pos2 < hStatusMainMenuHandlesCnt; pos2++) {
- if (pos2 >= 0 && pos2 < hStatusMainMenuHandlesCnt) {
- tmi.flags = CMIM_FLAGS | CMIF_ROOTHANDLE;
- MO_ModifyMenuItem(hStatusMainMenuHandles[pos2], &tmi);
- }
- }
+ for (int pos2 = 0; pos2 < hStatusMainMenuHandlesCnt; pos2++)
+ if (pos2 >= 0 && pos2 < hStatusMainMenuHandlesCnt)
+ Menu_ModifyItem(hStatusMainMenuHandles[pos2], NULL, INVALID_HANDLE_VALUE, CMIF_ROOTHANDLE);
cli.currentStatusMenuItem = overallStatus;
pos = statustopos(cli.currentStatusMenuItem);
- if (pos >= 0 && pos < hStatusMainMenuHandlesCnt) {
- tmi.flags = CMIM_FLAGS | CMIF_ROOTHANDLE | CMIF_CHECKED;
- MO_ModifyMenuItem(hStatusMainMenuHandles[pos], &tmi);
- }
+ if (pos >= 0 && pos < hStatusMainMenuHandlesCnt)
+ Menu_ModifyItem(hStatusMainMenuHandles[pos], NULL, INVALID_HANDLE_VALUE, CMIF_ROOTHANDLE | CMIF_CHECKED);
}
else {
int pos = statustopos(cli.currentStatusMenuItem);
if (pos == -1)
pos = 0;
- if (pos >= 0 && pos < hStatusMainMenuHandlesCnt) {
- tmi.flags = CMIM_FLAGS | CMIF_ROOTHANDLE;
- MO_ModifyMenuItem(hStatusMainMenuHandles[pos], &tmi);
- }
+ if (pos >= 0 && pos < hStatusMainMenuHandlesCnt)
+ Menu_ModifyItem(hStatusMainMenuHandles[pos], NULL, INVALID_HANDLE_VALUE, CMIF_ROOTHANDLE);
cli.currentStatusMenuItem = 0;
}
@@ -1071,18 +1044,14 @@ static int MenuProtoAck(WPARAM, LPARAM lParam)
int pos = statustopos((int)ack->hProcess);
if (pos == -1)
pos = 0;
- for (pos = 0; pos < _countof(statusModeList); pos++) {
- tmi.flags = CMIM_FLAGS | CMIF_ROOTHANDLE;
- MO_ModifyMenuItem(hStatusMenuHandles[i].menuhandle[pos], &tmi);
- }
+ for (pos = 0; pos < _countof(statusModeList); pos++)
+ Menu_ModifyItem(hStatusMenuHandles[i].menuhandle[pos], NULL, INVALID_HANDLE_VALUE, CMIF_ROOTHANDLE);
}
if (ack->lParam >= ID_STATUS_OFFLINE && ack->lParam < ID_STATUS_OFFLINE + _countof(statusModeList)) {
int pos = statustopos((int)ack->lParam);
- if (pos >= 0 && pos < _countof(statusModeList)) {
- tmi.flags = CMIM_FLAGS | CMIF_ROOTHANDLE | CMIF_CHECKED;
- MO_ModifyMenuItem(hStatusMenuHandles[i].menuhandle[pos], &tmi);
- }
+ if (pos >= 0 && pos < _countof(statusModeList))
+ Menu_ModifyItem(hStatusMenuHandles[i].menuhandle[pos], NULL, INVALID_HANDLE_VALUE, CMIF_ROOTHANDLE | CMIF_CHECKED);
}
break;
}
@@ -1250,8 +1219,6 @@ void InitCustomMenus(void)
CreateServiceFunction("CList/AddContactMenuItem", AddContactMenuItem);
CreateServiceFunction(MS_CLIST_MENUBUILDCONTACT, BuildContactMenu);
- CreateServiceFunction(MS_CLIST_SHOWHIDEMENUITEM, ShowHideMenuItem);
- CreateServiceFunction(MS_CLIST_MODIFYMENUITEM, ModifyCustomMenuItem);
CreateServiceFunction(MS_CLIST_MENUMEASUREITEM, MeasureMenuItem);
CreateServiceFunction(MS_CLIST_MENUDRAWITEM, DrawMenuItem);
diff --git a/src/mir_app/src/genmenu.cpp b/src/mir_app/src/genmenu.cpp
index 2c226f4aca..8efe8d2481 100644
--- a/src/mir_app/src/genmenu.cpp
+++ b/src/mir_app/src/genmenu.cpp
@@ -301,35 +301,27 @@ INT_PTR MO_GetDefaultMenuItem(WPARAM wParam, LPARAM)
// wparam MenuItemHandle
// lparam PMO_MenuItem
-int MO_ModifyMenuItem(TMO_IntMenuItem *menuHandle, TMO_MenuItem *pmi)
+MIR_APP_DLL(int) Menu_ModifyItem(HGENMENU hMenuItem, const TCHAR *ptszName, HANDLE hIcon, int iFlags)
{
- int oldflags;
-
- if (!bIsGenMenuInited || pmi == NULL)
+ if (!bIsGenMenuInited)
return -1;
mir_cslock lck(csMenuHook);
- TMO_IntMenuItem *pimi = MO_GetIntMenuItem((HGENMENU)menuHandle);
+ TMO_IntMenuItem *pimi = MO_GetIntMenuItem(hMenuItem);
if (pimi == NULL)
return -1;
- if (pmi->flags & CMIM_NAME) {
- FreeAndNil((void**)&pimi->mi.name.t);
+ if (ptszName != NULL)
+ replaceStrT(pimi->mi.name.t, ptszName);
- if (pmi->flags & CMIF_UNICODE)
- pimi->mi.name.t = mir_tstrdup(pmi->name.t);
- else
- pimi->mi.name.t = mir_a2t(pmi->name.a);
+ if (iFlags != -1) {
+ int oldflags = (pimi->mi.flags & CMIF_ROOTHANDLE);
+ pimi->mi.flags = iFlags | oldflags;
}
- if (pmi->flags & CMIM_FLAGS) {
- oldflags = (pimi->mi.flags & CMIF_ROOTHANDLE);
- pimi->mi.flags = (pmi->flags & ~CMIM_ALL) | oldflags;
- }
-
- if ((pmi->flags & CMIM_ICON) && !bIconsDisabled) {
- HANDLE hIcolibItem = IcoLib_IsManaged(pmi->hIcon);
+ if (hIcon != INVALID_HANDLE_VALUE && !bIconsDisabled) {
+ HANDLE hIcolibItem = IcoLib_IsManaged((HICON)hIcon);
if (hIcolibItem) {
HICON hIcon = IcoLib_GetIconByHandle(hIcolibItem, false);
if (hIcon != NULL) {
@@ -340,9 +332,9 @@ int MO_ModifyMenuItem(TMO_IntMenuItem *menuHandle, TMO_MenuItem *pmi)
else pimi->iconId = -1, pimi->hIcolibItem = NULL;
}
else {
- pimi->mi.hIcon = pmi->hIcon;
- if (pmi->hIcon != NULL)
- pimi->iconId = ImageList_ReplaceIcon(pimi->parent->m_hMenuIcons, pimi->iconId, pmi->hIcon);
+ pimi->mi.hIcon = (HICON)hIcon;
+ if (hIcon != NULL)
+ pimi->iconId = ImageList_ReplaceIcon(pimi->parent->m_hMenuIcons, pimi->iconId, (HICON)hIcon);
else
pimi->iconId = -1; //fixme, should remove old icon & shuffle all iconIds
}
@@ -352,9 +344,6 @@ int MO_ModifyMenuItem(TMO_IntMenuItem *menuHandle, TMO_MenuItem *pmi)
}
}
- if (pmi->flags & CMIM_HOTKEY)
- pimi->mi.hotKey = pmi->hotKey;
-
return 0;
}
@@ -1166,7 +1155,6 @@ int InitGenMenu()
CreateServiceFunction(MO_REMOVEMENUITEM, MO_RemoveMenuItem);
CreateServiceFunction(MO_ADDNEWMENUITEM, (MIRANDASERVICE)MO_AddNewMenuItem);
CreateServiceFunction(MO_MENUITEMGETOWNERDATA, MO_MenuItemGetOwnerData);
- CreateServiceFunction(MO_MODIFYMENUITEM, (MIRANDASERVICE)MO_ModifyMenuItem);
CreateServiceFunction(MO_GETMENUITEM, MO_GetMenuItem);
CreateServiceFunction(MO_GETDEFAULTMENUITEM, MO_GetDefaultMenuItem);
CreateServiceFunction(MO_PROCESSCOMMANDBYMENUIDENT, MO_ProcessCommandByMenuIdent);
diff --git a/src/mir_app/src/genmenu.h b/src/mir_app/src/genmenu.h
index acd498384f..12dabdacc7 100644
--- a/src/mir_app/src/genmenu.h
+++ b/src/mir_app/src/genmenu.h
@@ -111,7 +111,6 @@ TMO_IntMenuItem* MO_AddOldNewMenuItem(HANDLE menuobjecthandle, TMO_MenuItem *pmi
int MO_DrawMenuItem(LPDRAWITEMSTRUCT dis);
int MO_MeasureMenuItem(LPMEASUREITEMSTRUCT mis);
-int MO_ModifyMenuItem(TMO_IntMenuItem *menuHandle, TMO_MenuItem *pmiparam);
int MO_ProcessCommand(TMO_IntMenuItem *pimi, LPARAM lParam);
INT_PTR MO_ProcessHotKeys(HANDLE menuHandle, INT_PTR vKey);
int MO_SetOptionsMenuItem(TMO_IntMenuItem *menuobjecthandle, int setting, INT_PTR value);
diff --git a/src/mir_app/src/meta_menu.cpp b/src/mir_app/src/meta_menu.cpp
index 1b07b97247..c53083d2e6 100644
--- a/src/mir_app/src/meta_menu.cpp
+++ b/src/mir_app/src/meta_menu.cpp
@@ -249,7 +249,6 @@ int Meta_ModifyMenu(WPARAM hMeta, LPARAM)
if (cc == NULL)
return 0;
- CLISTMENUITEM mi = { 0 };
Menu_ShowItem(hMenuRoot, false);
if (cc->IsMeta()) {
@@ -261,11 +260,9 @@ int Meta_ModifyMenu(WPARAM hMeta, LPARAM)
Menu_ShowItem(hMenuAdd, false);
Menu_ShowItem(hMenuConvert, false);
Menu_ShowItem(hMenuDefault, false);
- Menu_ShowItem(hMenuDelete, false);
- mi.flags = CMIM_NAME;
- mi.pszName = LPGEN("Remove from metacontact");
- Menu_ModifyItem(hMenuDelete, &mi);
+ Menu_ShowItem(hMenuDelete, false);
+ Menu_ModifyItem(hMenuDelete, LPGENT("Remove from metacontact"));
// show subcontact menu items
CMString tszNick;
@@ -276,20 +273,18 @@ int Meta_ModifyMenu(WPARAM hMeta, LPARAM)
}
MCONTACT hContact = Meta_GetContactHandle(cc, i);
+ LPCTSTR ptszName;
if (options.menu_contact_label == DNT_UID) {
Meta_GetSubNick(hMeta, i, tszNick);
- mi.ptszName = tszNick.GetBuffer();
+ ptszName = tszNick.GetBuffer();
}
- else mi.ptszName = cli.pfnGetContactDisplayName(hContact, 0);
-
- mi.flags = CMIF_TCHAR | CMIM_FLAGS | CMIM_NAME | CMIM_ICON;
+ else ptszName = cli.pfnGetContactDisplayName(hContact, 0);
int iconIndex = CallService(MS_CLIST_GETCONTACTICON, hContact, 0);
- mi.hIcon = ImageList_GetIcon((HIMAGELIST)CallService(MS_CLIST_GETICONSIMAGELIST, 0, 0), iconIndex, 0);
-
- Menu_ModifyItem(hMenuContact[i], &mi);
- DestroyIcon(mi.hIcon);
+ HICON hIcon = ImageList_GetIcon((HIMAGELIST)CallService(MS_CLIST_GETICONSIMAGELIST, 0, 0), iconIndex, 0);
+ Menu_ModifyItem(hMenuContact[i], ptszName, hIcon, 0);
+ DestroyIcon(hIcon);
Menu_ShowItem(hMenuRoot, true);
}
@@ -316,9 +311,7 @@ int Meta_ModifyMenu(WPARAM hMeta, LPARAM)
if (cc->IsSub()) {
Menu_ShowItem(hMenuDefault, true);
- mi.flags = CMIM_NAME;
- mi.pszName = LPGEN("Remove from metacontact");
- Menu_ModifyItem(hMenuDelete, &mi);
+ Menu_ModifyItem(hMenuDelete, LPGENT("Remove from metacontact"));
Menu_ShowItem(hMenuDelete, true);
Menu_ShowItem(hMenuAdd, false);
@@ -346,20 +339,12 @@ int Meta_ModifyMenu(WPARAM hMeta, LPARAM)
INT_PTR Meta_OnOff(WPARAM, LPARAM)
{
- CLISTMENUITEM mi = { 0 };
- mi.flags = CMIM_NAME | CMIM_ICON;
-
bool bToggled = !db_mc_isEnabled();
db_set_b(0, META_PROTO, "Enabled", bToggled);
- if (bToggled) {
- mi.icolibItem = GetIconHandle(I_MENUOFF);
- mi.pszName = LPGEN("Toggle metacontacts off");
- }
- else {
- mi.icolibItem = GetIconHandle(I_MENU);
- mi.pszName = LPGEN("Toggle metacontacts on");
- }
- Menu_ModifyItem(hMenuOnOff, &mi);
+ if (bToggled)
+ Menu_ModifyItem(hMenuOnOff, LPGENT("Toggle metacontacts off"), GetIconHandle(I_MENUOFF));
+ else
+ Menu_ModifyItem(hMenuOnOff, LPGENT("Toggle metacontacts on"), GetIconHandle(I_MENU));
db_mc_enable(bToggled);
Meta_HideMetaContacts(!bToggled);
@@ -434,11 +419,7 @@ void InitMenus()
if (!db_mc_isEnabled()) {
// modify main menu item
- mi.flags = CMIM_NAME | CMIM_ICON;
- mi.icolibItem = GetIconHandle(I_MENU);
- mi.pszName = LPGEN("Toggle metacontacts on");
- Menu_ModifyItem(hMenuOnOff, &mi);
-
+ Menu_ModifyItem(hMenuOnOff, LPGENT("Toggle metacontacts on"), GetIconHandle(I_MENU));
Meta_HideMetaContacts(true);
}
else {
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def
index 0668cf9561..8764180eff 100644
--- a/src/mir_app/src/mir_app.def
+++ b/src/mir_app/src/mir_app.def
@@ -200,3 +200,5 @@ xmlToStringWithFormatting @197
KillModuleMenus @198
Utils_ReplaceVars @199
Utils_ReplaceVarsW @200
+Menu_ShowItem @201
+Menu_ModifyItem @202
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def
index 69d189d5f2..87aee3de21 100644
--- a/src/mir_app/src/mir_app64.def
+++ b/src/mir_app/src/mir_app64.def
@@ -200,3 +200,5 @@ xmlToStringWithFormatting @197
KillModuleMenus @198
Utils_ReplaceVars @199
Utils_ReplaceVarsW @200
+Menu_ShowItem @201
+Menu_ModifyItem @202