summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bin10/lib/mir_app.libbin57544 -> 59118 bytes
-rw-r--r--bin10/lib/mir_app64.libbin56178 -> 57606 bytes
-rw-r--r--bin12/lib/mir_app.libbin57544 -> 59118 bytes
-rw-r--r--bin12/lib/mir_app64.libbin56178 -> 57606 bytes
-rw-r--r--include/delphi/m_genmenu.inc64
-rw-r--r--include/m_genmenu.h105
-rw-r--r--plugins/Actman/ua/i_uaplaces.inc4
-rw-r--r--plugins/AddContactPlus/src/main.cpp6
-rw-r--r--plugins/AutoShutdown/src/watcher.cpp2
-rw-r--r--plugins/BossKeyPlus/src/BossKey.cpp2
-rw-r--r--plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp50
-rw-r--r--plugins/Clist_modern/src/CLUIFrames/framesmenu.cpp14
-rw-r--r--plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp20
-rw-r--r--plugins/Clist_modern/src/modern_clc.cpp2
-rw-r--r--plugins/Clist_modern/src/modern_clistmenus.cpp5
-rw-r--r--plugins/Clist_modern/src/modern_clisttray.cpp15
-rw-r--r--plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp24
-rw-r--r--plugins/Clist_nicer/src/CLUIFrames/framesmenu.cpp15
-rw-r--r--plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp34
-rw-r--r--plugins/ListeningTo/src/listeningto.cpp4
-rw-r--r--plugins/MenuItemEx/src/main.cpp10
-rw-r--r--plugins/MirLua/src/m_genmenu.cpp2
-rw-r--r--plugins/MirOTR/src/mirotrmenu.cpp28
-rw-r--r--plugins/QuickSearch/sr_global.pas12
-rw-r--r--plugins/QuickSearch/sr_window.pas2
-rw-r--r--plugins/Quotes/src/Forex.cpp6
-rw-r--r--plugins/SmileyAdd/src/services.cpp4
-rw-r--r--plugins/TrafficCounter/src/TrafficCounter.cpp2
-rw-r--r--plugins/TrafficCounter/src/options.cpp2
-rw-r--r--plugins/UserInfoEx/src/mir_menuitems.cpp2
-rw-r--r--plugins/UserInfoEx/src/svc_email.cpp2
-rw-r--r--plugins/Watrack/lastfm/lastfm.pas2
-rw-r--r--plugins/Watrack/popup/popups.pas2
-rw-r--r--plugins/Watrack/stat/statlog.pas2
-rw-r--r--plugins/mRadio/i_tray.inc4
-rw-r--r--protocols/AimOscar/src/theme.cpp2
-rw-r--r--protocols/FacebookRM/src/theme.cpp7
-rw-r--r--protocols/Gadu-Gadu/src/gg.cpp4
-rw-r--r--protocols/Gadu-Gadu/src/gg_proto.cpp2
-rw-r--r--protocols/Gadu-Gadu/src/image.cpp3
-rw-r--r--protocols/Gadu-Gadu/src/links.cpp30
-rw-r--r--protocols/IRCG/src/ircproto.cpp2
-rw-r--r--protocols/IRCG/src/services.cpp15
-rw-r--r--protocols/IcqOscarJ/src/icq_menu.cpp12
-rw-r--r--protocols/JabberG/src/jabber_menu.cpp37
-rw-r--r--protocols/JabberG/src/jabber_privacy.cpp2
-rw-r--r--protocols/MSN/src/msn_menu.cpp12
-rw-r--r--protocols/Sametime/src/sametime_proto.cpp2
-rw-r--r--protocols/Sametime/src/sametime_proto.h2
-rw-r--r--protocols/Sametime/src/sametime_session.cpp8
-rw-r--r--protocols/SkypeWeb/src/skype_menus.cpp4
-rw-r--r--protocols/Steam/src/steam_menus.cpp17
-rw-r--r--protocols/Tox/src/tox_menus.cpp4
-rw-r--r--protocols/Twitter/src/theme.cpp2
-rw-r--r--protocols/VKontakte/src/vk_proto.cpp6
-rw-r--r--protocols/WhatsApp/src/theme.cpp7
-rw-r--r--protocols/Xfire/src/Xfire_game.cpp2
-rw-r--r--protocols/Xfire/src/Xfire_gamelist.cpp2
-rw-r--r--protocols/Xfire/src/Xfire_gamelist.h2
-rw-r--r--protocols/Yahoo/src/services.cpp6
-rw-r--r--src/mir_app/src/clistmenus.cpp55
-rw-r--r--src/mir_app/src/genmenu.cpp220
-rw-r--r--src/mir_app/src/genmenu.h6
-rw-r--r--src/mir_app/src/mir_app.def7
-rw-r--r--src/mir_app/src/mir_app64.def7
-rw-r--r--src/mir_app/src/movetogroup.cpp2
66 files changed, 407 insertions, 530 deletions
diff --git a/bin10/lib/mir_app.lib b/bin10/lib/mir_app.lib
index e51c9ce2b0..a8f702a7ef 100644
--- a/bin10/lib/mir_app.lib
+++ b/bin10/lib/mir_app.lib
Binary files differ
diff --git a/bin10/lib/mir_app64.lib b/bin10/lib/mir_app64.lib
index 7a07daad19..b9770ef7b3 100644
--- a/bin10/lib/mir_app64.lib
+++ b/bin10/lib/mir_app64.lib
Binary files differ
diff --git a/bin12/lib/mir_app.lib b/bin12/lib/mir_app.lib
index e51c9ce2b0..a8f702a7ef 100644
--- a/bin12/lib/mir_app.lib
+++ b/bin12/lib/mir_app.lib
Binary files differ
diff --git a/bin12/lib/mir_app64.lib b/bin12/lib/mir_app64.lib
index 7a07daad19..b9770ef7b3 100644
--- a/bin12/lib/mir_app64.lib
+++ b/bin12/lib/mir_app64.lib
Binary files differ
diff --git a/include/delphi/m_genmenu.inc b/include/delphi/m_genmenu.inc
index ff44d69a86..42e0d2c4bd 100644
--- a/include/delphi/m_genmenu.inc
+++ b/include/delphi/m_genmenu.inc
@@ -239,17 +239,6 @@ type
ExecService:PAnsiChar;//called when processmenuitem called
end;
-//used in MO_BUILDMENU
-type
- PListParam = ^TListParam;
- TListParam = record
- rootlevel :int;
- MenuObjectHandle:THANDLE;
- wParam :WPARAM;
- lParam :LPARAM;
-end;
- tagListParam = TListParam;
-
type
PProcessCommandParam = ^TProcessCommandParam;
TProcessCommandParam = record
@@ -258,69 +247,70 @@ type
lParam:LPARAM;
end;
-const
{
- wparam started hMenu
- lparam ListParam*
+ Builds a menu from the menu object specified
result hMenu
}
- MO_BUILDMENU:PAnsiChar = 'MO/BuildMenu';
+
+function Menu_Build(parent:HMENU; menuObject:THANDLE; wParam:WPARAM; lParam:LPARAM) : HMENU; stdcall;
+ external AppDLL name 'Menu_Build';
{
- wparam=MenuItemHandle
- lparam userdefined
- returns TRUE if it processed the command, FALSE otherwise
+ Passes custom lParam to the ExecMenuService for the specified menu item
+ returns true if command is processed, false otherwise
}
- MO_PROCESSCOMMAND:PAnsiChar = 'MO/ProcessCommand';
+
+function Menu_ProcessCommand(hMenuItem:HGENMENU; lParam:LPARAM) : integer; stdcall;
+ external AppDLL name 'Menu_ProcessCommand';
{
if menu not known call this
LOWORD(wparam) menuident (from WM_COMMAND message)
- returns TRUE if it processed the command, FALSE otherwise
- Service automatically find right menuobject and menuitem
- and call MO_PROCESSCOMMAND
+ It automatically finds right menuobject and menuitem and calls Menu_ProcessCommand
+ returns true if command is processed, false otherwise
}
- MO_PROCESSCOMMANDBYMENUIDENT:PAnsiChar = 'MO/ProcessCommandByMenuIdent';
+
+function Menu_ProcessCommandById(iCommand:integer; lParam:LPARAM) : integer; stdcall;
+ external AppDLL name 'Menu_ProcessCommandById';
{
- wparam=0;
- lparam=PMenuParam;
returns=MenuObjectHandle on success,-1 on failure
}
- MO_CREATENEWMENUOBJECT:PAnsiChar = 'MO/CreateNewMenuObject';
+
+function Menu_AddObject(const name, displayName, checkService, execService:PAnsiChar) : THANDLE; stdcall;
+ external AppDLL name 'Menu_AddObject';
{
- wparam=MenuObjectHandle
- lparam=0
returns 0 on success,-1 on failure
Note: you must free all ownerdata structures, before you
call this service.MO_REMOVEMENUOBJECT NOT free it.
}
- MO_REMOVEMENUOBJECT:PAnsiChar = 'MO/RemoveMenuObject';
+
+function Menu_RemoveObject(hMenuObject:THANDLE) : integer; stdcall;
+ external AppDLL name 'Menu_RemoveObject';
{
- wparam=MenuItemHandle
- lparam=0
returns 0 on success,-1 on failure.
You must free ownerdata before this call.
If MenuItemHandle is root all child will be removed too.
}
- MO_REMOVEMENUITEM:PAnsiChar = 'MO/RemoveMenuItem';
+
+function Menu_RemoveItem(hMenuItem:HGENMENU) : integer; stdcall;
+ external AppDLL name 'Menu_RemoveItem';
{
- wparam=MenuObjectHandle
- lparam=PMO_MenuItem
return MenuItemHandle on success,-1 on failure
- Service supports old menu items (without CMIF_ROOTPOPUP or
- CMIF_CHILDPOPUP flag).For old menu items needed root will be created automatically.
}
- MO_ADDNEWMENUITEM:PAnsiChar = 'MO/AddNewMenuItem';
+
+function Menu_AddItem(hMenuObject:THANDLE; var tmi:TMO_MenuItem) : integer; stdcall;
+ external AppDLL name 'Menu_AddItem';
{
wparam MenuItemHandle
returns ownerdata on success,NULL on failure
Useful to get and free ownerdata before delete menu item.
}
+const
MO_MENUITEMGETOWNERDATA:PAnsiChar = 'MO/MenuItemGetOwnerData';
{
diff --git a/include/m_genmenu.h b/include/m_genmenu.h
index a4c30fe509..dd7840e0b5 100644
--- a/include/m_genmenu.h
+++ b/include/m_genmenu.h
@@ -200,68 +200,60 @@ struct TMO_MenuItem
/*
This structure passed to CheckService.
*/
-typedef struct
+
+struct TCheckProcParam
{
void *MenuItemOwnerData;
HGENMENU MenuItemHandle;
- WPARAM wParam;//from ListParam.wParam when building menu
- LPARAM lParam;//from ListParam.lParam when building menu
-}
- TCheckProcParam,*PCheckProcParam;
-
-//used in MO_BUILDMENU
-typedef struct tagListParam
-{
- int rootlevel;
- HANDLE MenuObjectHandle;
WPARAM wParam;
LPARAM lParam;
-}
- ListParam,*lpListParam;
+};
-typedef struct
+struct ProcessCommandParam
{
HMENU menu;
int ident;
LPARAM lParam;
-}
- ProcessCommandParam,*lpProcessCommandParam;
+};
-//wparam started hMenu
-//lparam ListParam*
-//result hMenu
-#define MO_BUILDMENU "MO/BuildMenu"
+/////////////////////////////////////////////////////////////////////////////////////////
+// Builds a menu from menu object's description
+// Returns hMenu on success or NULL on failure
-//wparam=MenuItemHandle
-//lparam userdefined
-//returns TRUE if it processed the command, FALSE otherwise
-#define MO_PROCESSCOMMAND "MO/ProcessCommand"
+EXTERN_C MIR_APP_DLL(HMENU) Menu_Build(HMENU parent, HANDLE hMenuObject, WPARAM wParam = 0, LPARAM lParam = 0);
-//if menu not known call this
-//LOWORD(wparam) menuident (from WM_COMMAND message)
-//returns TRUE if it processed the command, FALSE otherwise
-//Service automatically find right menuobject and menuitem
-//and call MO_PROCESSCOMMAND
-#define MO_PROCESSCOMMANDBYMENUIDENT "MO/ProcessCommandByMenuIdent"
+/////////////////////////////////////////////////////////////////////////////////////////
+// Passes custom lParam to the ExecMenuService for the specified menu item
+// Returns TRUE if command was processed, FALSE otherwise
-//wparam=MenuItemHandle
-//lparam=0
-//returns 0 on success,-1 on failure.
-//You must free ownerdata before this call.
-//If MenuItemHandle is root all child will be removed too.
-#define MO_REMOVEMENUITEM "MO/RemoveMenuItem"
+EXTERN_C MIR_APP_DLL(BOOL) Menu_ProcessCommand(HGENMENU hMenuItem, LPARAM lParam);
-//wparam=MenuObjectHandle
-//lparam=PMO_MenuItem
-//return MenuItemHandle on success,-1 on failure
-//Service supports old menu items (without CMIF_ROOTPOPUP or
-//CMIF_CHILDPOPUP flag).For old menu items needed root will be created
-//automatically.
-#define MO_ADDNEWMENUITEM "MO/AddNewMenuItem"
+/////////////////////////////////////////////////////////////////////////////////////////
+// if menu not known call this
+// LOWORD(wparam) menuident (from WM_COMMAND message)
+// It automatically finds right menuobject and menuitem and calls Menu_ProcessCommand
+// returns TRUE if command was processed, FALSE otherwise
+
+EXTERN_C MIR_APP_DLL(BOOL) Menu_ProcessCommandById(int command, LPARAM lParam);
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// Removes a menu item from genmenu
+// Returns 0 on success,-1 on failure.
+// You must free ownerdata before this call.
+// If MenuItemHandle is root, all children will be removed too.
+
+EXTERN_C MIR_APP_DLL(int) Menu_RemoveItem(HGENMENU hMenuItem);
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// Adds a menu item to genmenu
+// Returns MenuItemHandle on success, or NULL on failure
+
+EXTERN_C MIR_APP_DLL(HGENMENU) Menu_AddItem(HANDLE hMenuObject, TMO_MenuItem *pItem);
//wparam MenuItemHandle
//returns ownerdata on success,NULL on failure
//Useful to get and free ownerdata before delete menu item.
+
#define MO_MENUITEMGETOWNERDATA "MO/MenuItemGetOwnerData"
//wparam=MenuItemHandle
@@ -281,6 +273,8 @@ typedef struct
//this should be called in WM_KEYDOWN
#define MO_PROCESSHOTKEYS "MO/ProcessHotKeys"
+/////////////////////////////////////////////////////////////////////////////////////////
+// Creates a new menu object
// szName = unique menu object identifier
// szDisplayName = menu display name (auto-translated by core)
// szCheckService = this service called when module build menu(MO_BUILDMENU).
@@ -289,26 +283,17 @@ typedef struct
// szExecService = this service called when user select menu item.
// Service called with params wparam = ownerdata; lparam = lParam from MO_PROCESSCOMMAND
//
-// returns = MenuObjectHandle on success,-1 on failure
+// returns = MenuObjectHandle on success, NULL on failure
-struct TMenuParam
-{
- int cbSize;
- LPCSTR name, CheckService, ExecService;
-};
+EXTERN_C MIR_APP_DLL(HANDLE) Menu_AddObject(LPCSTR szName, LPCSTR szDisplayName, LPCSTR szCheckService, LPCSTR szExecService);
-__forceinline HANDLE MO_CreateMenuObject(LPCSTR szName, LPCSTR szDisplayName, LPCSTR szCheckService, LPCSTR szExecService)
-{
- TMenuParam param = { sizeof(param), szName, szCheckService, szExecService };
- return (HANDLE)CallService("MO/CreateNewMenuObject", (WPARAM)szDisplayName, (LPARAM)&param);
-}
+/////////////////////////////////////////////////////////////////////////////////////////
+// Removes the whole menu object with all submenus
+// returns 0 on success, nonzero on failure
+// Note: you must free all ownerdata structures, before you
+// call this function. Menu_RemoveObject DOES NOT free it.
-//wparam=MenuObjectHandle
-//lparam=0
-//returns 0 on success,-1 on failure
-//Note: you must free all ownerdata structures, before you
-//call this service.MO_REMOVEMENUOBJECT NOT free it.
-#define MO_REMOVEMENUOBJECT "MO/RemoveMenuObject"
+EXTERN_C MIR_APP_DLL(int) Menu_RemoveObject(HANDLE hMenuObject);
/////////////////////////////////////////////////////////////////////////////////////////
// tunes the whold menu object
diff --git a/plugins/Actman/ua/i_uaplaces.inc b/plugins/Actman/ua/i_uaplaces.inc
index 0b7856f909..9b7dac8cf1 100644
--- a/plugins/Actman/ua/i_uaplaces.inc
+++ b/plugins/Actman/ua/i_uaplaces.inc
@@ -278,7 +278,7 @@ begin
with ActionItem.UAMenuItem[mtype] do
begin
if hMenuItem=0 then exit;
- CallService(MO_REMOVEMENUITEM,hMenuItem,0);
+ Menu_RemoveItem(hMenuItem);
hMenuItem:=0;
end;
@@ -302,7 +302,7 @@ begin
break;
end;
end;
- CallService(MO_REMOVEMENUITEM,hMenuRoot,0);
+ Menu_RemoveItem(hMenuRoot);
ActionItem.UAMenuItem[mtype].hMenuRoot:=0;
end;
end;
diff --git a/plugins/AddContactPlus/src/main.cpp b/plugins/AddContactPlus/src/main.cpp
index 4b63376b7e..96fcff53bf 100644
--- a/plugins/AddContactPlus/src/main.cpp
+++ b/plugins/AddContactPlus/src/main.cpp
@@ -18,12 +18,14 @@ You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+
#include "stdafx.h"
CLIST_INTERFACE *pcli;
HINSTANCE hInst;
int hLangpack;
-static HANDLE hMainMenuItem = 0, hToolBarItem = 0;
+static HANDLE hToolBarItem = 0;
+static HGENMENU hMainMenuItem = 0;
HWND hAddDlg;
static IconItem icon = { LPGEN("Add contact"), ICON_ADD, IDI_ADDCONTACT };
@@ -102,7 +104,7 @@ static int OnAccListChanged(WPARAM, LPARAM)
if (!hMainMenuItem)
return 0;
- CallService(MO_REMOVEMENUITEM, (WPARAM)hMainMenuItem, 0);
+ Menu_RemoveItem(hMainMenuItem);
CallService(MS_TTB_REMOVEBUTTON, (WPARAM)hToolBarItem, 0);
hMainMenuItem = 0;
}
diff --git a/plugins/AutoShutdown/src/watcher.cpp b/plugins/AutoShutdown/src/watcher.cpp
index 029d0af01d..f8194f3394 100644
--- a/plugins/AutoShutdown/src/watcher.cpp
+++ b/plugins/AutoShutdown/src/watcher.cpp
@@ -66,7 +66,7 @@ static void __inline ShutdownAndStopWatcher(void)
static TCHAR* GetMessageText(BYTE **ppBlob,DWORD *pcbBlob)
{
(*ppBlob)[*pcbBlob]=0;
- DWORD cb = mir_strlen((char*)*ppBlob);
+ size_t cb = mir_strlen((char*)*ppBlob);
/* use Unicode data if present */
if (*pcbBlob>(cb+3)) {
(*ppBlob)[*pcbBlob-1]=0;
diff --git a/plugins/BossKeyPlus/src/BossKey.cpp b/plugins/BossKeyPlus/src/BossKey.cpp
index 27081d9c64..2770a91569 100644
--- a/plugins/BossKeyPlus/src/BossKey.cpp
+++ b/plugins/BossKeyPlus/src/BossKey.cpp
@@ -543,7 +543,7 @@ void BossKeyMenuItemInit(void) // Add menu item
void BossKeyMenuItemUnInit(void) // Remove menu item
{
- CallService(MO_REMOVEMENUITEM, (WPARAM)g_hMenuItem, 0);
+ Menu_RemoveItem(g_hMenuItem);
g_hMenuItem = 0;
}
diff --git a/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp
index f087d307b9..7f8f7269e1 100644
--- a/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp
+++ b/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp
@@ -1544,7 +1544,7 @@ static int CLUIFramesLoadMainMenu()
return -1;
if (_hmiRoot != HGENMENU_ROOT) {
- CallService(MO_REMOVEMENUITEM, (WPARAM)_hmiRoot, 0);
+ Menu_RemoveItem(_hmiRoot);
_hmiRoot = HGENMENU_ROOT;
}
@@ -3493,29 +3493,29 @@ int CLUIFrameOnModulesUnload(WPARAM, LPARAM)
if (!_hmiVisible)
return 0;
- CallService(MO_REMOVEMENUITEM, (LPARAM)_hmiVisible, 0);
- CallService(MO_REMOVEMENUITEM, (LPARAM)_hmiTBVisible, 0);
- CallService(MO_REMOVEMENUITEM, (LPARAM)_hmiLock, 0);
- CallService(MO_REMOVEMENUITEM, (LPARAM)_hmiColl, 0);
- CallService(MO_REMOVEMENUITEM, (LPARAM)_hmiFloating, 0);
- CallService(MO_REMOVEMENUITEM, (LPARAM)_hmiAlignTop, 0);
- CallService(MO_REMOVEMENUITEM, (LPARAM)_hmiAlignClient, 0);
- CallService(MO_REMOVEMENUITEM, (LPARAM)_hmiAlignBottom, 0);
- CallService(MO_REMOVEMENUITEM, (LPARAM)_hmiBorder, 0);
- CallService(MO_REMOVEMENUITEM, (LPARAM)_hmiAlignRoot, 0);
-
- CallService(MO_REMOVEMENUITEM, (LPARAM)_hmiPosUp, 0);
- CallService(MO_REMOVEMENUITEM, (LPARAM)_hmiPosDown, 0);
- CallService(MO_REMOVEMENUITEM, (LPARAM)_hmiPosRoot, 0);
-
- CallService(MO_REMOVEMENUITEM, (LPARAM)_hmiVisible, 0);
- CallService(MO_REMOVEMENUITEM, (LPARAM)_hmiTBVisible, 0);
- CallService(MO_REMOVEMENUITEM, (LPARAM)_hmiLock, 0);
- CallService(MO_REMOVEMENUITEM, (LPARAM)_hmiColl, 0);
- CallService(MO_REMOVEMENUITEM, (LPARAM)_hmiFloating, 0);
- CallService(MO_REMOVEMENUITEM, (LPARAM)_hmiBorder, 0);
- CallService(MO_REMOVEMENUITEM, (LPARAM)_hmiAlignRoot, 0);
- CallService(MO_REMOVEMENUITEM, (LPARAM)_hmiPosRoot, 0);
+ Menu_RemoveItem(_hmiVisible);
+ Menu_RemoveItem(_hmiTBVisible);
+ Menu_RemoveItem(_hmiLock);
+ Menu_RemoveItem(_hmiColl);
+ Menu_RemoveItem(_hmiFloating);
+ Menu_RemoveItem(_hmiAlignTop);
+ Menu_RemoveItem(_hmiAlignClient);
+ Menu_RemoveItem(_hmiAlignBottom);
+ Menu_RemoveItem(_hmiBorder);
+ Menu_RemoveItem(_hmiAlignRoot);
+
+ Menu_RemoveItem(_hmiPosUp);
+ Menu_RemoveItem(_hmiPosDown);
+ Menu_RemoveItem(_hmiPosRoot);
+
+ Menu_RemoveItem(_hmiVisible);
+ Menu_RemoveItem(_hmiTBVisible);
+ Menu_RemoveItem(_hmiLock);
+ Menu_RemoveItem(_hmiColl);
+ Menu_RemoveItem(_hmiFloating);
+ Menu_RemoveItem(_hmiBorder);
+ Menu_RemoveItem(_hmiAlignRoot);
+ Menu_RemoveItem(_hmiPosRoot);
_hmiVisible = 0;
_AniAva_OnModulesUnload();
@@ -3576,7 +3576,7 @@ static INT_PTR UnloadMainMenu()
{
CLUIFrameOnModulesUnload(0, 0);
if (_hmiRoot != HGENMENU_ROOT) {
- CallService(MO_REMOVEMENUITEM, (WPARAM)_hmiRoot, 0);
+ Menu_RemoveItem(_hmiRoot);
_hmiRoot = HGENMENU_ROOT;
}
diff --git a/plugins/Clist_modern/src/CLUIFrames/framesmenu.cpp b/plugins/Clist_modern/src/CLUIFrames/framesmenu.cpp
index a8d4a70d58..35e6b95a7f 100644
--- a/plugins/Clist_modern/src/CLUIFrames/framesmenu.cpp
+++ b/plugins/Clist_modern/src/CLUIFrames/framesmenu.cpp
@@ -41,8 +41,7 @@ static INT_PTR AddContextFrameMenuItem(WPARAM, LPARAM lParam)
fmep->Frameid = mi->popupPosition;
fmep->param1 = (INT_PTR)mi->pszContactOwner;
tmi.ownerdata = fmep;
-
- return CallService(MO_ADDNEWMENUITEM, (WPARAM)hFrameMenuObject, (LPARAM)&tmi);
+ return (INT_PTR)Menu_AddItem(hFrameMenuObject, &tmi);
}
//called with:
@@ -61,7 +60,7 @@ INT_PTR FrameMenuExecService(WPARAM wParam, LPARAM lParam)
//true - ok,false ignore
INT_PTR FrameMenuCheckService(WPARAM wParam, LPARAM)
{
- PCheckProcParam pcpp = (PCheckProcParam)wParam;
+ TCheckProcParam *pcpp = (TCheckProcParam*)wParam;
if (pcpp == NULL)
return FALSE;
@@ -85,14 +84,9 @@ static INT_PTR ContextFrameMenuNotify(WPARAM wParam, LPARAM lParam)
static INT_PTR BuildContextFrameMenu(WPARAM wParam, LPARAM lParam)
{
- ListParam param = { 0 };
- param.MenuObjectHandle = hFrameMenuObject;
- param.wParam = wParam;
- param.lParam = lParam;
-
HMENU hMenu = CreatePopupMenu();
ContextFrameMenuNotify(wParam, -1);
- CallService(MO_BUILDMENU, (WPARAM)hMenu, (LPARAM)&param);
+ Menu_Build(hMenu, hFrameMenuObject, wParam, lParam);
return (INT_PTR)hMenu;
}
@@ -110,7 +104,7 @@ int InitFramesMenus(void)
hPreBuildFrameMenuEvent = CreateHookableEvent(ME_CLIST_PREBUILDFRAMEMENU);
// frame menu object
- hFrameMenuObject = MO_CreateMenuObject("FrameMenu", LPGEN("Frame menu"), "FrameMenuCheckService", "FrameMenuExecService");
+ hFrameMenuObject = Menu_AddObject("FrameMenu", LPGEN("Frame menu"), "FrameMenuCheckService", "FrameMenuExecService");
Menu_ConfigureObject(hFrameMenuObject, MCO_OPT_FREE_SERVICE, "FrameMenuFreeService");
return 0;
}
diff --git a/plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp b/plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp
index 188639ecf0..eedeba5e7d 100644
--- a/plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp
+++ b/plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp
@@ -56,10 +56,7 @@ INT_PTR BuildGroupMenu(WPARAM, LPARAM)
NotifyEventHooks(g_CluiData.hEventPreBuildGroupMenu, 0, 0);
HMENU hMenu = CreatePopupMenu();
-
- ListParam param = { 0 };
- param.MenuObjectHandle = hGroupMenuObject;
- CallService(MO_BUILDMENU, (WPARAM)hMenu, (LPARAM)&param);
+ Menu_Build(hMenu, hGroupMenuObject);
return (INT_PTR)hMenu;
}
@@ -84,7 +81,7 @@ static INT_PTR AddGroupMenuItem(WPARAM wParam, LPARAM lParam)
}
tmi.ownerdata = mmep;
- HGENMENU hNewItem = (HGENMENU)CallService(MO_ADDNEWMENUITEM, (WPARAM)hGroupMenuObject, (LPARAM)&tmi);
+ HGENMENU hNewItem = Menu_AddItem(hGroupMenuObject, &tmi);
char buf[1024];
mir_snprintf(buf, "%s/%s", mi->pszService, mi->pszName);
@@ -224,7 +221,7 @@ void GroupMenus_Init(void)
InitSubGroupMenus();
// Group menu
- hGroupMenuObject = MO_CreateMenuObject("GroupMenu", LPGEN("Group menu"), 0, "CLISTMENUSGroup/ExecService");
+ hGroupMenuObject = Menu_AddObject("GroupMenu", LPGEN("Group menu"), 0, "CLISTMENUSGroup/ExecService");
Menu_ConfigureObject(hGroupMenuObject, MCO_OPT_USERDEFINEDITEMS, TRUE);
Menu_ConfigureObject(hGroupMenuObject, MCO_OPT_FREE_SERVICE, "CLISTMENUSGroup/FreeOwnerDataGroupMenu");
Menu_ConfigureObject(hGroupMenuObject, MCO_OPT_ONADD_SERVICE, "CLISTMENUSGroup/GroupMenuonAddService");
@@ -355,13 +352,8 @@ INT_PTR BuildSubGroupMenu(WPARAM wParam, LPARAM lParam)
{
NotifyEventHooks(g_CluiData.hEventPreBuildSubGroupMenu, wParam, 0);
- ListParam param = { 0 };
- param.MenuObjectHandle = hSubGroupMenuObject;
- param.wParam = wParam;
- param.lParam = lParam;
-
HMENU hMenu = CreatePopupMenu();
- CallService(MO_BUILDMENU, (WPARAM)hMenu, (LPARAM)&param);
+ Menu_Build(hMenu, hSubGroupMenuObject, wParam, lParam);
return (INT_PTR)hMenu;
}
@@ -391,7 +383,7 @@ static INT_PTR AddSubGroupMenuItem(WPARAM wParam, LPARAM lParam)
}
tmi.ownerdata = mmep;
- HGENMENU hNewItem = (HGENMENU)CallService(MO_ADDNEWMENUITEM, (WPARAM)hSubGroupMenuObject, (LPARAM)&tmi);
+ HGENMENU hNewItem = Menu_AddItem(hSubGroupMenuObject, &tmi);
char buf[1024];
mir_snprintf(buf, "%s/%s", mi->pszService, mi->pszName);
@@ -469,7 +461,7 @@ void InitSubGroupMenus(void)
HookEvent(ME_CLIST_PREBUILDSUBGROUPMENU, OnBuildSubGroupMenu);
// SubGroup menu
- hSubGroupMenuObject = MO_CreateMenuObject("SubGroupMenu", LPGEN("Subgroup menu"), 0, "CLISTMENUSSubGroup/ExecService");
+ hSubGroupMenuObject = Menu_AddObject("SubGroupMenu", LPGEN("Subgroup menu"), 0, "CLISTMENUSSubGroup/ExecService");
Menu_ConfigureObject(hSubGroupMenuObject, MCO_OPT_USERDEFINEDITEMS, TRUE);
Menu_ConfigureObject(hSubGroupMenuObject, MCO_OPT_FREE_SERVICE, "CLISTMENUSSubGroup/FreeOwnerDataSubGroupMenu");
Menu_ConfigureObject(hSubGroupMenuObject, MCO_OPT_ONADD_SERVICE, "CLISTMENUSSubGroup/SubGroupMenuonAddService");
diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp
index 3618cf2d9b..5ee7d52875 100644
--- a/plugins/Clist_modern/src/modern_clc.cpp
+++ b/plugins/Clist_modern/src/modern_clc.cpp
@@ -374,7 +374,7 @@ static LRESULT clcOnCommand(ClcData *dat, HWND hwnd, UINT, WPARAM wParam, LPARAM
}
if (contact->type == CLCIT_GROUP)
- if (CallService(MO_PROCESSCOMMANDBYMENUIDENT, LOWORD(wParam), (LPARAM)hwnd))
+ if (Menu_ProcessCommandById(wParam, (LPARAM)hwnd))
return 0;
return 0;
diff --git a/plugins/Clist_modern/src/modern_clistmenus.cpp b/plugins/Clist_modern/src/modern_clistmenus.cpp
index 22bc5e14ab..77de5d473f 100644
--- a/plugins/Clist_modern/src/modern_clistmenus.cpp
+++ b/plugins/Clist_modern/src/modern_clistmenus.cpp
@@ -189,9 +189,6 @@ int UnloadFavoriteContactMenu()
free(hFavoriteContactMenuItems);
hFavoriteContactMenuItems = NULL;
- if (hFavoriteContactMenu)
- CallService(MO_REMOVEMENUITEM, (WPARAM)hFavoriteContactMenu, 0);
- hFavoriteContactMenu = NULL;
-
+ Menu_RemoveItem(hFavoriteContactMenu); hFavoriteContactMenu = NULL;
return 0;
}
diff --git a/plugins/Clist_modern/src/modern_clisttray.cpp b/plugins/Clist_modern/src/modern_clisttray.cpp
index 7854a6abfa..93ad8f1b2a 100644
--- a/plugins/Clist_modern/src/modern_clisttray.cpp
+++ b/plugins/Clist_modern/src/modern_clisttray.cpp
@@ -163,11 +163,8 @@ static INT_PTR BuildTrayMenu(WPARAM, LPARAM)
{
NotifyEventHooks(g_CluiData.hEventPreBuildTrayMenu, 0, 0);
- ListParam param = { 0 };
- param.MenuObjectHandle = hTrayMenuObject;
-
HMENU hMenu = CreatePopupMenu();
- CallService(MO_BUILDMENU, (WPARAM)hMenu, (LPARAM)&param);
+ Menu_Build(hMenu, hTrayMenuObject);
return (INT_PTR)hMenu;
}
@@ -181,7 +178,7 @@ static INT_PTR AddTrayMenuItem(WPARAM, LPARAM lParam)
tmi.ownerdata = mir_strdup(mi->pszService);
- HGENMENU hNewItem = (HGENMENU)CallService(MO_ADDNEWMENUITEM, (WPARAM)hTrayMenuObject, (LPARAM)&tmi);
+ HGENMENU hNewItem = Menu_AddItem(hTrayMenuObject, &tmi);
Menu_ConfigureItem(hNewItem, MCI_OPT_UNIQUENAME, mi->pszService);
return (INT_PTR)hNewItem;
}
@@ -311,7 +308,7 @@ void InitTrayMenus(void)
CreateServiceFunction(MS_CLIST_MENUBUILDTRAY, BuildTrayMenu);
// Tray menu
- hTrayMenuObject = MO_CreateMenuObject("TrayMenu", LPGEN("Tray menu"), 0, "CLISTMENUSTRAY/ExecService");
+ hTrayMenuObject = Menu_AddObject("TrayMenu", LPGEN("Tray menu"), 0, "CLISTMENUSTRAY/ExecService");
Menu_ConfigureObject(hTrayMenuObject, MCO_OPT_USERDEFINEDITEMS, TRUE);
Menu_ConfigureObject(hTrayMenuObject, MCO_OPT_FREE_SERVICE, "CLISTMENUSTRAY/FreeOwnerDataTrayMenu");
Menu_ConfigureObject(hTrayMenuObject, MCO_OPT_ONADD_SERVICE, "CLISTMENUSTRAY/TrayMenuonAddService");
@@ -366,10 +363,8 @@ void InitTrayMenus(void)
void UninitTrayMenu()
{
- if (hTrayMenuObject) {
- CallService(MO_REMOVEMENUOBJECT, (WPARAM)hTrayMenuObject, 0);
- hTrayMenuObject = NULL;
- }
+ Menu_RemoveObject(hTrayMenuObject);
+ hTrayMenuObject = NULL;
}
VOID CALLBACK cliTrayCycleTimerProc(HWND, UINT, UINT_PTR, DWORD)
diff --git a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp
index 7f30fff6d2..4dcb13a226 100644
--- a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp
+++ b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp
@@ -1381,7 +1381,7 @@ static int CLUIFramesLoadMainMenu()
return -1;
if (MainMIRoot != (HANDLE)-1) {
- CallService(MO_REMOVEMENUITEM, (WPARAM)MainMIRoot, 0);
+ Menu_RemoveItem(MainMIRoot);
MainMIRoot = (HGENMENU)-1;
}
@@ -3012,17 +3012,17 @@ static int CLUIFrameOnModulesUnload(WPARAM, LPARAM)
WaitForSingleObject(hThreadMFUpdate, 2000);
CloseHandle(g_hEventThread);
- CallService(MO_REMOVEMENUITEM, (LPARAM)contMIVisible, 0);
- CallService(MO_REMOVEMENUITEM, (LPARAM)contMITitle, 0);
- CallService(MO_REMOVEMENUITEM, (LPARAM)contMITBVisible, 0);
- CallService(MO_REMOVEMENUITEM, (LPARAM)contMILock, 0);
- CallService(MO_REMOVEMENUITEM, (LPARAM)contMIColl, 0);
- CallService(MO_REMOVEMENUITEM, (LPARAM)contMIFloating, 0);
- CallService(MO_REMOVEMENUITEM, (LPARAM)contMIAlignRoot, 0);
- CallService(MO_REMOVEMENUITEM, (LPARAM)contMIAlignTop, 0);
- CallService(MO_REMOVEMENUITEM, (LPARAM)contMIAlignClient, 0);
- CallService(MO_REMOVEMENUITEM, (LPARAM)contMIAlignBottom, 0);
- CallService(MO_REMOVEMENUITEM, (LPARAM)contMIBorder, 0);
+ Menu_RemoveItem(contMIVisible);
+ Menu_RemoveItem(contMITitle);
+ Menu_RemoveItem(contMITBVisible);
+ Menu_RemoveItem(contMILock);
+ Menu_RemoveItem(contMIColl);
+ Menu_RemoveItem(contMIFloating);
+ Menu_RemoveItem(contMIAlignRoot);
+ Menu_RemoveItem(contMIAlignTop);
+ Menu_RemoveItem(contMIAlignClient);
+ Menu_RemoveItem(contMIAlignBottom);
+ Menu_RemoveItem(contMIBorder);
return 0;
}
diff --git a/plugins/Clist_nicer/src/CLUIFrames/framesmenu.cpp b/plugins/Clist_nicer/src/CLUIFrames/framesmenu.cpp
index 858c65dcf7..d013caefd9 100644
--- a/plugins/Clist_nicer/src/CLUIFrames/framesmenu.cpp
+++ b/plugins/Clist_nicer/src/CLUIFrames/framesmenu.cpp
@@ -41,8 +41,7 @@ static INT_PTR AddContextFrameMenuItem(WPARAM, LPARAM lParam)
fmep->Frameid = mi->popupPosition;
fmep->param1 = (INT_PTR)mi->pszContactOwner;
tmi.ownerdata = fmep;
-
- return CallService(MO_ADDNEWMENUITEM, (WPARAM)hFrameMenuObject, (LPARAM)&tmi);
+ return (INT_PTR)Menu_AddItem(hFrameMenuObject, &tmi);
}
//called with:
@@ -62,7 +61,7 @@ INT_PTR FrameMenuExecService(WPARAM wParam, LPARAM lParam)
//true - ok,false ignore
INT_PTR FrameMenuCheckService(WPARAM wParam, LPARAM)
{
- PCheckProcParam pcpp = (PCheckProcParam)wParam;
+ TCheckProcParam *pcpp = (TCheckProcParam*)wParam;
if (pcpp == NULL)
return FALSE;
@@ -86,14 +85,10 @@ static INT_PTR ContextFrameMenuNotify(WPARAM wParam, LPARAM lParam)
static INT_PTR BuildContextFrameMenu(WPARAM wParam, LPARAM lParam)
{
- ListParam param = {0};
- param.MenuObjectHandle = hFrameMenuObject;
- param.wParam = wParam;
- param.lParam = lParam;
+ ContextFrameMenuNotify(wParam, -1);
HMENU hMenu = CreatePopupMenu();
- ContextFrameMenuNotify(wParam, -1);
- CallService(MO_BUILDMENU, (WPARAM)hMenu, (LPARAM)&param);
+ Menu_Build(hMenu, hFrameMenuObject, wParam, lParam);
return (INT_PTR)hMenu;
}
@@ -111,7 +106,7 @@ int InitFramesMenus(void)
hPreBuildFrameMenuEvent = CreateHookableEvent(ME_CLIST_PREBUILDFRAMEMENU);
// frame menu object
- hFrameMenuObject = MO_CreateMenuObject("FrameMenu", LPGEN("Frame menu"), "FrameMenuCheckService", "FrameMenuExecService");
+ hFrameMenuObject = Menu_AddObject("FrameMenu", LPGEN("Frame menu"), "FrameMenuCheckService", "FrameMenuExecService");
Menu_ConfigureObject(hFrameMenuObject, MCO_OPT_FREE_SERVICE, "FrameMenuFreeService");
return 0;
}
diff --git a/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp b/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp
index d203d954c9..dd77bc9232 100644
--- a/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp
+++ b/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp
@@ -53,21 +53,10 @@ typedef struct {
static INT_PTR BuildGroupMenu(WPARAM, LPARAM)
{
- int tick;
- HMENU hMenu;
- ListParam param = {0};
- param.MenuObjectHandle = hGroupMenuObject;
-
- //hMenu = hMainMenu;
- hMenu = CreatePopupMenu();
- //hMenu = wParam;
- tick = GetTickCount();
-
NotifyEventHooks(hPreBuildGroupMenuEvent, 0, 0);
- CallService(MO_BUILDMENU, (WPARAM)hMenu, (LPARAM)&param);
- //DrawMenuBar((HWND)CallService("CLUI/GetHwnd",0,0));
- tick = GetTickCount() - tick;
+ HMENU hMenu = CreatePopupMenu();
+ Menu_Build(hMenu, hGroupMenuObject);
return (INT_PTR)hMenu;
}
@@ -92,7 +81,7 @@ static INT_PTR AddGroupMenuItem(WPARAM wParam, LPARAM lParam)
}
tmi.ownerdata = mmep;
- HGENMENU hNewItem = (HGENMENU)CallService(MO_ADDNEWMENUITEM, (WPARAM)hGroupMenuObject, (LPARAM)&tmi);
+ HGENMENU hNewItem = Menu_AddItem(hGroupMenuObject, &tmi);
char buf[1024];
mir_snprintf(buf, "%s/%s", mi->pszService, mi->pszName);
@@ -241,7 +230,7 @@ void InitGroupMenus(void)
InitSubGroupMenus();
//Group menu
- hGroupMenuObject = MO_CreateMenuObject("GroupMenu", LPGEN("Group menu"), 0, "CLISTMENUSGroup/ExecService");
+ hGroupMenuObject = Menu_AddObject("GroupMenu", LPGEN("Group menu"), 0, "CLISTMENUSGroup/ExecService");
Menu_ConfigureObject(hGroupMenuObject, MCO_OPT_USERDEFINEDITEMS, TRUE);
Menu_ConfigureObject(hGroupMenuObject, MCO_OPT_FREE_SERVICE, "CLISTMENUSGroup/FreeOwnerDataGroupMenu");
Menu_ConfigureObject(hGroupMenuObject, MCO_OPT_ONADD_SERVICE, "CLISTMENUSGroup/GroupMenuonAddService");
@@ -369,16 +358,10 @@ static int OnBuildSubGroupMenu(WPARAM wParam, LPARAM)
static INT_PTR BuildSubGroupMenu(WPARAM wParam, LPARAM)
{
- ListParam param = {0};
- param.MenuObjectHandle = hSubGroupMenuObject;
- param.wParam = wParam;
-
- HMENU hMenu = CreatePopupMenu();
- int tick = GetTickCount();
NotifyEventHooks(hPreBuildSubGroupMenuEvent, wParam, 0);
- CallService(MO_BUILDMENU, (WPARAM)hMenu, (LPARAM)&param);
- tick = GetTickCount() - tick;
+ HMENU hMenu = CreatePopupMenu();
+ Menu_Build(hMenu, hSubGroupMenuObject, wParam);
return (INT_PTR)hMenu;
}
@@ -402,8 +385,7 @@ static INT_PTR AddSubGroupMenuItem(WPARAM wParam, LPARAM lParam)
mmep->Param2 = gmp->lParam;
}
tmi.ownerdata = mmep;
-
- HGENMENU hNewItem = (HGENMENU)CallService(MO_ADDNEWMENUITEM, (WPARAM)hSubGroupMenuObject, (LPARAM)&tmi);
+ HGENMENU hNewItem = Menu_AddItem(hSubGroupMenuObject, &tmi);
char buf[1024];
mir_snprintf(buf, "%s/%s", mi->pszService, mi->pszName);
@@ -489,7 +471,7 @@ void InitSubGroupMenus(void)
HookEvent(ME_CLIST_PREBUILDSUBGROUPMENU, OnBuildSubGroupMenu);
// SubGroup menu
- hSubGroupMenuObject = MO_CreateMenuObject("SubGroupMenu", LPGEN("Subgroup menu"), 0, "CLISTMENUSSubGroup/ExecService");
+ hSubGroupMenuObject = Menu_AddObject("SubGroupMenu", LPGEN("Subgroup menu"), 0, "CLISTMENUSSubGroup/ExecService");
Menu_ConfigureObject(hSubGroupMenuObject, MCO_OPT_USERDEFINEDITEMS, TRUE);
Menu_ConfigureObject(hSubGroupMenuObject, MCO_OPT_FREE_SERVICE, "CLISTMENUSSubGroup/FreeOwnerDataSubGroupMenu");
Menu_ConfigureObject(hSubGroupMenuObject, MCO_OPT_ONADD_SERVICE, "CLISTMENUSSubGroup/SubGroupMenuonAddService");
diff --git a/plugins/ListeningTo/src/listeningto.cpp b/plugins/ListeningTo/src/listeningto.cpp
index c45188b971..9b62cb0633 100644
--- a/plugins/ListeningTo/src/listeningto.cpp
+++ b/plugins/ListeningTo/src/listeningto.cpp
@@ -185,7 +185,7 @@ void RebuildMenu()
ProtocolInfo *info = &proto_items[i];
if (info->hMenu != NULL)
- CallService(MO_REMOVEMENUITEM, (WPARAM) info->hMenu, 0);
+ Menu_RemoveItem(info->hMenu);
TCHAR text[512];
mir_sntprintf(text, TranslateT("Send to %s"), info->account);
@@ -245,7 +245,7 @@ int AccListChanged(WPARAM wParam, LPARAM lParam)
}
else if (wParam == PRAC_REMOVED || (wParam == PRAC_CHECKED && !proto->bIsEnabled))
{
- CallService(MO_REMOVEMENUITEM, (WPARAM) info->hMenu, 0);
+ Menu_RemoveItem(info->hMenu);
for(std::vector<ProtocolInfo>::iterator it = proto_items.begin(); it != proto_items.end(); ++it)
{
diff --git a/plugins/MenuItemEx/src/main.cpp b/plugins/MenuItemEx/src/main.cpp
index 08f86255bf..2631515ecb 100644
--- a/plugins/MenuItemEx/src/main.cpp
+++ b/plugins/MenuItemEx/src/main.cpp
@@ -745,7 +745,7 @@ static HGENMENU AddSubmenuItem(HGENMENU hRoot, TCHAR* name, HICON icon, DWORD fl
return Menu_AddContactMenuItem(&mi);
}
-static void ModifySubmenuItem(HGENMENU hItem, TCHAR *name, int checked, int hidden)
+static void ModifySubmenuItem(HGENMENU hItem, int checked, int hidden)
{
int flags = 0;
if (checked)
@@ -789,13 +789,13 @@ int BuildMenu(WPARAM wparam, LPARAM)
if (check)
all++;
- ModifySubmenuItem(hIgnoreItem[i], ii[i].name, check, 0);
+ ModifySubmenuItem(hIgnoreItem[i], check, 0);
if (all == _countof(ii) - 1) // ignor all
check = 1;
else
check = 0;
- ModifySubmenuItem(hIgnoreItem[0], ii[i].name, check, 0);
+ ModifySubmenuItem(hIgnoreItem[0], check, 0);
}
}
@@ -809,7 +809,7 @@ int BuildMenu(WPARAM wparam, LPARAM)
}
int check = Proto_IsProtoOnContact(wparam, accs[i]->szModuleName);
- ModifySubmenuItem(hProtoItem[i], accs[i]->tszAccountName, check, hide);
+ ModifySubmenuItem(hProtoItem[i], check, hide);
}
Menu_ShowItem(hmenuProto, j > 1);
}
@@ -864,7 +864,7 @@ int EnumProtoSubmenu(WPARAM, LPARAM)
{
if (hProtoItem[i])
{
- CallService(MO_REMOVEMENUITEM, (WPARAM)hProtoItem[i], 0);
+ Menu_RemoveItem(hProtoItem[i]);
hProtoItem[i] = 0;
}
}
diff --git a/plugins/MirLua/src/m_genmenu.cpp b/plugins/MirLua/src/m_genmenu.cpp
index 433620d7cb..3d5a041c4b 100644
--- a/plugins/MirLua/src/m_genmenu.cpp
+++ b/plugins/MirLua/src/m_genmenu.cpp
@@ -110,7 +110,7 @@ static int lua_RemoveMenuItem(lua_State *L)
{
HGENMENU hMenuItem = (HGENMENU)lua_touserdata(L, 1);
- INT_PTR res = ::CallService(MO_REMOVEMENUITEM, (WPARAM)hMenuItem, 0);
+ INT_PTR res = ::Menu_RemoveItem(hMenuItem);
lua_pushinteger(L, res);
return 1;
diff --git a/plugins/MirOTR/src/mirotrmenu.cpp b/plugins/MirOTR/src/mirotrmenu.cpp
index 55dad23416..f00c228042 100644
--- a/plugins/MirOTR/src/mirotrmenu.cpp
+++ b/plugins/MirOTR/src/mirotrmenu.cpp
@@ -15,9 +15,10 @@ MirOTRMenuExecParam,*lpMirOTRMenuExecParam;
////////////////////////////////////////////
// MirOTR MENU
///////////////////////////////////////////
+
static INT_PTR RemoveMirOTRMenuItem(WPARAM wParam, LPARAM)
{
- CallService(MO_REMOVEMENUITEM,wParam,0);
+ Menu_RemoveItem((HGENMENU)wParam);
return 0;
}
@@ -39,20 +40,13 @@ static INT_PTR AddMirOTRMenuItem(WPARAM, LPARAM lParam)
lpMirOTRMenuExecParam cmep = ( lpMirOTRMenuExecParam )mir_calloc(sizeof(MirOTRMenuExecParam));
cmep->szServiceName = mir_strdup( mi->pszService );
tmi.ownerdata = cmep;
-
- INT_PTR menuHandle = CallService(MO_ADDNEWMENUITEM, (WPARAM) hMirOTRMenuObject, (LPARAM)&tmi );
-
- return menuHandle;
+ return (INT_PTR)Menu_AddItem(hMirOTRMenuObject, &tmi);
}
static INT_PTR BuildMirOTRMenu(WPARAM hContact, LPARAM)
{
- ListParam param = { 0 };
- param.MenuObjectHandle = hMirOTRMenuObject;
- param.wParam = hContact;
HMENU hMenu = CreatePopupMenu();
- CallService(MO_BUILDMENU,(WPARAM)hMenu,(LPARAM)&param);
-
+ Menu_Build(hMenu, hMirOTRMenuObject, hContact);
return (INT_PTR)hMenu;
}
@@ -72,9 +66,7 @@ INT_PTR MirOTRMenuExecService(WPARAM wParam,LPARAM lParam)
// true - ok,false ignore
INT_PTR MirOTRMenuCheckService(WPARAM wParam, LPARAM)
{
- PCheckProcParam pcpp = (PCheckProcParam)wParam;
- TMO_MenuItem mi;
-
+ TCheckProcParam *pcpp = (TCheckProcParam*)wParam;
if (pcpp == NULL)
return FALSE;
@@ -89,6 +81,7 @@ INT_PTR MirOTRMenuCheckService(WPARAM wParam, LPARAM)
ConnContext *context = otrl_context_find_miranda(otr_user_state, hContact);
TrustLevel level = (TrustLevel)otr_context_get_trust(context);
+ TMO_MenuItem mi;
if (CallService(MO_GETMENUITEM, (WPARAM)pcpp->MenuItemHandle, (LPARAM)&mi) == 0) {
if (mi.flags & CMIF_HIDDEN) return FALSE;
if (mi.flags & CMIF_NOTPRIVATE && level == TRUST_PRIVATE) return FALSE;
@@ -162,7 +155,8 @@ LRESULT CALLBACK PopupMenuWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM
if (CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam)) return TRUE;
break;
case WM_COMMAND:
- if (CallService(MO_PROCESSCOMMANDBYMENUIDENT, wParam, GetWindowLongPtr(hwnd, GWLP_USERDATA))) return TRUE;
+ if (Menu_ProcessCommandById(wParam, GetWindowLongPtr(hwnd, GWLP_USERDATA)))
+ return TRUE;
break;
}
return DefWindowProc(hwnd, message, wParam, lParam);
@@ -196,7 +190,7 @@ void InitMirOTRMenu(void)
CreateServiceFunction(MS_MIROTR_MENUBUILDMIROTR, BuildMirOTRMenu);
CreateServiceFunction(MS_MIROTR_REMOVEMIROTRMENUITEM, RemoveMirOTRMenuItem);
- hMirOTRMenuObject = MO_CreateMenuObject("MirOTRMenu", LPGEN("MirOTR menu"), "MirOTRMenuCheckService", "MirOTRMenuExecService");
+ hMirOTRMenuObject = Menu_AddObject("MirOTRMenu", LPGEN("MirOTR menu"), "MirOTRMenuCheckService", "MirOTRMenuExecService");
Menu_ConfigureObject(hMirOTRMenuObject, MCO_OPT_FREE_SERVICE, "MIROTRMENUS/FreeOwnerDataMirOTRMenu");
Menu_ConfigureObject(hMirOTRMenuObject, MCO_OPT_ONADD_SERVICE, "MIROTRMENUS/OnAddMenuItemMirOTRMenu");
@@ -248,7 +242,9 @@ void UninitMirOTRMenu(void)
{
DestroyWindow(hDummyPaintWin);
hDummyPaintWin = 0;
+
UnregisterClass(_T("MirOTRPopupMenuProcessor"), hInst);
- if (hMirOTRMenuObject) CallService(MO_REMOVEMENUOBJECT, (WPARAM)hMirOTRMenuObject, 0);
+
+ Menu_RemoveObject(hMirOTRMenuObject);
hMirOTRMenuObject = 0;
}
diff --git a/plugins/QuickSearch/sr_global.pas b/plugins/QuickSearch/sr_global.pas
index d667d282c7..c7a160d990 100644
--- a/plugins/QuickSearch/sr_global.pas
+++ b/plugins/QuickSearch/sr_global.pas
@@ -244,21 +244,9 @@ begin
ZeroMemory(@cmi,sizeof(cmi));
cmi.szName.a :=qs_name;
cmi.position :=500050000;
-// cmi.pszPopupName:=nil;
-// cmi.flags :=0;
cmi.pszService :=QS_SHOWSERVICE;
cmi.hIcon :=IcoLib_GetIcon(QS_QS,0);
MainMenuItem :=Menu_AddMainMenuItem(@cmi);
-
- begin
-{
- if (MainMenuItem<>0) then
- begin
- CallService(MO_REMOVEMENUITEM,MainMenuItem,0);
- MainMenuItem:=0;
- end;
-}
- end;
end;
// -------- column functions ---------
diff --git a/plugins/QuickSearch/sr_window.pas b/plugins/QuickSearch/sr_window.pas
index ef57002e26..265bfbbfa1 100644
--- a/plugins/QuickSearch/sr_window.pas
+++ b/plugins/QuickSearch/sr_window.pas
@@ -1893,7 +1893,7 @@ begin
case hMessage of
WM_DESTROY: begin
if srvhandle<>0 then DestroyServiceFunction(srvhandle);
- if mnuhandle<>0 then CallService(MO_REMOVEMENUITEM,mnuhandle,0);
+ if mnuhandle<>0 then Menu_RemoveItem(mnuhandle);
UnhookEvent(hAdd);
UnhookEvent(hDelete);
diff --git a/plugins/Quotes/src/Forex.cpp b/plugins/Quotes/src/Forex.cpp
index c51d077bb7..23c9b5b191 100644
--- a/plugins/Quotes/src/Forex.cpp
+++ b/plugins/Quotes/src/Forex.cpp
@@ -357,12 +357,6 @@ namespace
{
return UnhookEvent(h);
}
-
- inline int Quotes_RemoveMenuItem(HGENMENU h)
- {
- return CallService(MO_REMOVEMENUITEM, reinterpret_cast<WPARAM>(h), 0);
- }
-
}
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
diff --git a/plugins/SmileyAdd/src/services.cpp b/plugins/SmileyAdd/src/services.cpp
index 16e483c17b..5dd9c3bf07 100644
--- a/plugins/SmileyAdd/src/services.cpp
+++ b/plugins/SmileyAdd/src/services.cpp
@@ -262,7 +262,7 @@ INT_PTR CustomCatMenu(WPARAM hContact, LPARAM lParam)
}
for (int i=0; i < menuHandleArray.getCount(); i++)
- CallService(MO_REMOVEMENUITEM, (WPARAM)menuHandleArray[i], 0);
+ Menu_RemoveItem((HGENMENU)menuHandleArray[i]);
menuHandleArray.destroy();
return TRUE;
@@ -285,7 +285,7 @@ int RebuildContactMenu(WPARAM wParam, LPARAM)
Menu_ShowItem(hContactMenuItem, haveMenu);
for (int i=0; i < menuHandleArray.getCount(); i++)
- CallService(MO_REMOVEMENUITEM, (WPARAM)menuHandleArray[i], 0);
+ Menu_RemoveItem((HGENMENU)menuHandleArray[i]);
menuHandleArray.destroy();
if (haveMenu) {
diff --git a/plugins/TrafficCounter/src/TrafficCounter.cpp b/plugins/TrafficCounter/src/TrafficCounter.cpp
index 5f3a0b551f..e464d888c2 100644
--- a/plugins/TrafficCounter/src/TrafficCounter.cpp
+++ b/plugins/TrafficCounter/src/TrafficCounter.cpp
@@ -158,7 +158,7 @@ int TrafficCounterShutdown(WPARAM wParam, LPARAM lParam)
// Óäàëÿåì ïóíêò ãëàâíîãî ìåíþ.
if (hTrafficMainMenuItem)
{
- CallService(MO_REMOVEMENUITEM, (WPARAM)hTrafficMainMenuItem, 0);
+ Menu_RemoveItem(hTrafficMainMenuItem);
hTrafficMainMenuItem = NULL;
}
// Óäàëÿåì êîíòåêñòíîå ìåíþ.
diff --git a/plugins/TrafficCounter/src/options.cpp b/plugins/TrafficCounter/src/options.cpp
index f3a74a2dcd..8765a4adca 100644
--- a/plugins/TrafficCounter/src/options.cpp
+++ b/plugins/TrafficCounter/src/options.cpp
@@ -324,7 +324,7 @@ static INT_PTR CALLBACK DlgProcTCOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
// Åñëè îòêëþ÷àåòñÿ ïîêàç ïóíêòà ãëàâíîãî ìåíþ, òî óäàëÿåì åãî.
if (!unOptions.ShowMainMenuItem && hTrafficMainMenuItem)
{
- CallService(MO_REMOVEMENUITEM, (WPARAM)hTrafficMainMenuItem, 0);
+ Menu_RemoveItem(hTrafficMainMenuItem);
hTrafficMainMenuItem = NULL;
}
// Åñëè âêëþ÷àåòñÿ, òî ñîçäà¸ì.
diff --git a/plugins/UserInfoEx/src/mir_menuitems.cpp b/plugins/UserInfoEx/src/mir_menuitems.cpp
index 50a5e46a8a..9d44263735 100644
--- a/plugins/UserInfoEx/src/mir_menuitems.cpp
+++ b/plugins/UserInfoEx/src/mir_menuitems.cpp
@@ -47,7 +47,7 @@ INT_PTR RemoveMenuItems(HGENMENU *pItems, int Count)
}
while (Count--) {
if (pItems[Count]) {
- CallService(MO_REMOVEMENUITEM, (WPARAM)pItems[Count], 0);
+ Menu_RemoveItem(pItems[Count]);
pItems[Count] = NULL;
}
}
diff --git a/plugins/UserInfoEx/src/svc_email.cpp b/plugins/UserInfoEx/src/svc_email.cpp
index 1b8ee4a1bc..5ad7c0935f 100644
--- a/plugins/UserInfoEx/src/svc_email.cpp
+++ b/plugins/UserInfoEx/src/svc_email.cpp
@@ -196,7 +196,7 @@ void SvcEMailRebuildMenu()
UnhookEvent(ME_CLIST_PREBUILDCONTACTMENU), hPrebuildMenuHook = NULL;
if (ghMenuItem) {
- CallService(MO_REMOVEMENUITEM, (WPARAM)ghMenuItem, NULL);
+ Menu_RemoveItem(ghMenuItem);
ghMenuItem = NULL;
}
}
diff --git a/plugins/Watrack/lastfm/lastfm.pas b/plugins/Watrack/lastfm/lastfm.pas
index b814359974..12a144a8a7 100644
--- a/plugins/Watrack/lastfm/lastfm.pas
+++ b/plugins/Watrack/lastfm/lastfm.pas
@@ -234,7 +234,7 @@ begin
else
DestroyServiceFunction(slastinf);
- CallService(MO_REMOVEMENUITEM,hMenuLast,0);
+ Menu_RemoveItem(hMenuLast);
hMenuLast:=0;
DestroyServiceFunction(slast);
diff --git a/plugins/Watrack/popup/popups.pas b/plugins/Watrack/popup/popups.pas
index cf149f0adf..d714facb52 100644
--- a/plugins/Watrack/popup/popups.pas
+++ b/plugins/Watrack/popup/popups.pas
@@ -524,7 +524,7 @@ begin
if aSetDisable then
SetModStatus(0);
- CallService(MO_REMOVEMENUITEM,hMenuInfo,0);
+ Menu_RemoveItem(hMenuInfo);
UnhookEvent(plStatusHook);
DestroyServiceFunction(ssmi);
diff --git a/plugins/Watrack/stat/statlog.pas b/plugins/Watrack/stat/statlog.pas
index 38a8f01af8..c1a9fe0a76 100644
--- a/plugins/Watrack/stat/statlog.pas
+++ b/plugins/Watrack/stat/statlog.pas
@@ -596,7 +596,7 @@ begin
if aSetDisable then
SetModStatus(0);
- CallService(MO_REMOVEMENUITEM,hMenuReport,0);
+ Menu_RemoveItem(hMenuReport);
DestroyServiceFunction(hPackLog);
DestroyServiceFunction(hMakeReport);
DestroyServiceFunction(hAddToLog);
diff --git a/plugins/mRadio/i_tray.inc b/plugins/mRadio/i_tray.inc
index 7ed794c1a7..4a32675903 100644
--- a/plugins/mRadio/i_tray.inc
+++ b/plugins/mRadio/i_tray.inc
@@ -82,7 +82,7 @@ begin
begin
mFreeMem(tmp.name);
DestroyServiceFunction(tmp.service);
- CallService(MO_REMOVEMENUITEM,tmp.menuitem,0);
+ Menu_RemoveItem(tmp.menuitem);
mFreeMem(tmp);
List_Remove(@trayStations,i);
end;
@@ -281,5 +281,5 @@ begin
DestroyServiceFunction(srvtrayplaypause);
DestroyServiceFunction(srvtraystop);
- CallService(MO_REMOVEMENUITEM,trayradioparent,0);
+ Menu_RemoveItem(trayradioparent);
end;
diff --git a/protocols/AimOscar/src/theme.cpp b/protocols/AimOscar/src/theme.cpp
index d4ba6ebfea..a0c1398634 100644
--- a/protocols/AimOscar/src/theme.cpp
+++ b/protocols/AimOscar/src/theme.cpp
@@ -226,7 +226,7 @@ void CAimProto::InitMainMenus(void)
}
else {
if (hMenuRoot) {
- CallService(MO_REMOVEMENUITEM, (WPARAM)hMenuRoot, 0);
+ Menu_RemoveItem(hMenuRoot);
hMenuRoot = NULL;
}
}
diff --git a/protocols/FacebookRM/src/theme.cpp b/protocols/FacebookRM/src/theme.cpp
index 1d371c61c7..922c065db7 100644
--- a/protocols/FacebookRM/src/theme.cpp
+++ b/protocols/FacebookRM/src/theme.cpp
@@ -226,9 +226,10 @@ int FacebookProto::OnBuildStatusMenu(WPARAM, LPARAM)
hRoot = m_hMenuRoot = Menu_AddProtoMenuItem(&miRoot);
}
else {
- if (m_hMenuRoot)
- CallService(MO_REMOVEMENUITEM, (WPARAM)m_hMenuRoot, 0);
- m_hMenuRoot = NULL;
+ if (m_hMenuRoot) {
+ Menu_RemoveItem(m_hMenuRoot);
+ m_hMenuRoot = NULL;
+ }
}
mi.flags = CMIF_ROOTHANDLE | (this->isOnline() ? 0 : CMIF_GRAYED);
diff --git a/protocols/Gadu-Gadu/src/gg.cpp b/protocols/Gadu-Gadu/src/gg.cpp
index 0712ed4784..b6b75db861 100644
--- a/protocols/Gadu-Gadu/src/gg.cpp
+++ b/protocols/Gadu-Gadu/src/gg.cpp
@@ -256,7 +256,7 @@ void GGPROTO::block_init()
void GGPROTO::block_uninit()
{
- CallService(MO_REMOVEMENUITEM, (WPARAM)hBlockMenuItem, 0);
+ Menu_RemoveItem(hBlockMenuItem);
}
//////////////////////////////////////////////////////////
@@ -289,7 +289,7 @@ void GGPROTO::menus_init()
hCLRoot = Menu_AddProtoMenuItem(&mi);
if (hMenuRoot)
- CallService(MO_REMOVEMENUITEM, (WPARAM)hMenuRoot, 0);
+ Menu_RemoveItem(hMenuRoot);
hMenuRoot = NULL;
}
diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp
index 99f7c478e6..a3c8ba8141 100644
--- a/protocols/Gadu-Gadu/src/gg_proto.cpp
+++ b/protocols/Gadu-Gadu/src/gg_proto.cpp
@@ -95,7 +95,7 @@ GGPROTO::~GGPROTO()
Popup_UnregisterClass(hPopupNotify);
if (hMenuRoot)
- CallService(MO_REMOVEMENUITEM, (WPARAM)hMenuRoot, 0);
+ Menu_RemoveItem(hMenuRoot);
// Close handles
Netlib_CloseHandle(m_hNetlibUser);
diff --git a/protocols/Gadu-Gadu/src/image.cpp b/protocols/Gadu-Gadu/src/image.cpp
index 3fbda53b9d..9ec67477e1 100644
--- a/protocols/Gadu-Gadu/src/image.cpp
+++ b/protocols/Gadu-Gadu/src/image.cpp
@@ -127,8 +127,7 @@ int GGPROTO::img_destroy()
// Destroy list
list_destroy(imagedlgs, 1);
- CallService(MO_REMOVEMENUITEM, (WPARAM)hImageMenuItem, 0);
-
+ Menu_RemoveItem(hImageMenuItem);
return FALSE;
}
diff --git a/protocols/Gadu-Gadu/src/links.cpp b/protocols/Gadu-Gadu/src/links.cpp
index a915416a63..15a1da12a8 100644
--- a/protocols/Gadu-Gadu/src/links.cpp
+++ b/protocols/Gadu-Gadu/src/links.cpp
@@ -71,45 +71,37 @@ static INT_PTR gg_parselink(WPARAM wParam, LPARAM lParam)
}
if (items > 1) {
- ListParam param = {0};
- HMENU hMenu = CreatePopupMenu();
POINT pt;
- int cmd = 0;
-
- param.MenuObjectHandle = hInstanceMenu;
- CallService(MO_BUILDMENU, (WPARAM)hMenu, (LPARAM)&param);
-
GetCursorPos(&pt);
- cmd = TrackPopupMenu(hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, pcli->hwndContactList, NULL);
+
+ HMENU hMenu = CreatePopupMenu();
+ Menu_Build(hMenu, hInstanceMenu);
+ int cmd = TrackPopupMenu(hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, pcli->hwndContactList, NULL);
DestroyMenu(hMenu);
if (cmd)
- CallService(MO_PROCESSCOMMANDBYMENUIDENT, cmd, (LPARAM)&gg);
+ Menu_ProcessCommandById(cmd, (LPARAM)&gg);
}
if (gg == NULL)
return 0;
- if (ServiceExists(MS_MSG_SENDMESSAGE))
- {
- MCONTACT hContact = gg->getcontact(uin, 1, 0, NULL);
- if (hContact != NULL)
- CallService(MS_MSG_SENDMESSAGE, hContact, 0);
- }
-
+ MCONTACT hContact = gg->getcontact(uin, 1, 0, NULL);
+ if (hContact != NULL)
+ CallService(MS_MSG_SENDMESSAGE, hContact, 0);
return 0;
}
void gg_links_instancemenu_init()
{
CreateServiceFunction(GGS_MENUCHOOSE, gg_menuchoose);
- hInstanceMenu = MO_CreateMenuObject("GGAccountChooser", LPGEN("Gadu-Gadu account chooser"), 0, GGS_MENUCHOOSE);
+ hInstanceMenu = Menu_AddObject("GGAccountChooser", LPGEN("Gadu-Gadu account chooser"), 0, GGS_MENUCHOOSE);
TMO_MenuItem mi = {0};
mi.name.a = "Cancel";
mi.position = 9999999;
mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_DELETE);
- CallService(MO_ADDNEWMENUITEM, (WPARAM)hInstanceMenu, (LPARAM)&mi);
+ Menu_AddItem(hInstanceMenu, &mi);
}
void gg_links_init()
@@ -128,6 +120,6 @@ void GGPROTO::links_instance_init()
mi.ownerdata = this;
mi.position = g_Instances.getCount();
mi.name.t = m_tszUserName;
- hInstanceMenuItem = (HGENMENU)CallService(MO_ADDNEWMENUITEM, (WPARAM)hInstanceMenu, (LPARAM)&mi);
+ hInstanceMenuItem = Menu_AddItem(hInstanceMenu, &mi);
}
}
diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp
index 89cb66953b..4b60263266 100644
--- a/protocols/IRCG/src/ircproto.cpp
+++ b/protocols/IRCG/src/ircproto.cpp
@@ -147,7 +147,7 @@ CIrcProto::~CIrcProto()
Netlib_CloseHandle(hNetlibDCC); hNetlibDCC = NULL;
if (hMenuRoot)
- CallService(MO_REMOVEMENUITEM, (WPARAM)hMenuRoot, 0);
+ Menu_RemoveItem(hMenuRoot);
mir_free(m_alias);
diff --git a/protocols/IRCG/src/services.cpp b/protocols/IRCG/src/services.cpp
index c8a167d0d6..9f00d7f631 100644
--- a/protocols/IRCG/src/services.cpp
+++ b/protocols/IRCG/src/services.cpp
@@ -40,9 +40,10 @@ void CIrcProto::InitMainMenus(void)
hRoot = hMenuRoot = Menu_AddProtoMenuItem(&mi);
}
else {
- if (hMenuRoot)
- CallService(MO_REMOVEMENUITEM, (WPARAM)hMenuRoot, 0);
- hMenuRoot = NULL;
+ if (hMenuRoot) {
+ Menu_RemoveItem(hMenuRoot);
+ hMenuRoot = NULL;
+ }
}
mi.flags = CMIF_ROOTHANDLE;
@@ -175,10 +176,10 @@ void InitContactMenus(void)
void UninitContactMenus(void)
{
- CallService(MO_REMOVEMENUITEM, (WPARAM)hUMenuChanSettings, 0);
- CallService(MO_REMOVEMENUITEM, (WPARAM)hUMenuWhois, 0);
- CallService(MO_REMOVEMENUITEM, (WPARAM)hUMenuDisconnect, 0);
- CallService(MO_REMOVEMENUITEM, (WPARAM)hUMenuIgnore, 0);
+ Menu_RemoveItem(hUMenuChanSettings);
+ Menu_RemoveItem(hUMenuWhois);
+ Menu_RemoveItem(hUMenuDisconnect);
+ Menu_RemoveItem(hUMenuIgnore);
DestroyServiceFunction(hMenuChanSettings);
DestroyServiceFunction(hMenuWhois);
diff --git a/protocols/IcqOscarJ/src/icq_menu.cpp b/protocols/IcqOscarJ/src/icq_menu.cpp
index 94a0a3ca57..a075dc3cea 100644
--- a/protocols/IcqOscarJ/src/icq_menu.cpp
+++ b/protocols/IcqOscarJ/src/icq_menu.cpp
@@ -164,12 +164,12 @@ void g_MenuInit(void)
void g_MenuUninit(void)
{
- CallService(MO_REMOVEMENUITEM, (WPARAM)g_hContactMenuItems[ICMI_AUTH_REQUEST], 0);
- CallService(MO_REMOVEMENUITEM, (WPARAM)g_hContactMenuItems[ICMI_AUTH_GRANT], 0);
- CallService(MO_REMOVEMENUITEM, (WPARAM)g_hContactMenuItems[ICMI_AUTH_REVOKE], 0);
- CallService(MO_REMOVEMENUITEM, (WPARAM)g_hContactMenuItems[ICMI_ADD_TO_SERVLIST], 0);
- CallService(MO_REMOVEMENUITEM, (WPARAM)g_hContactMenuItems[ICMI_XSTATUS_DETAILS], 0);
- CallService(MO_REMOVEMENUITEM, (WPARAM)g_hContactMenuItems[ICMI_OPEN_PROFILE], 0);
+ Menu_RemoveItem(g_hContactMenuItems[ICMI_AUTH_REQUEST]);
+ Menu_RemoveItem(g_hContactMenuItems[ICMI_AUTH_GRANT]);
+ Menu_RemoveItem(g_hContactMenuItems[ICMI_AUTH_REVOKE]);
+ Menu_RemoveItem(g_hContactMenuItems[ICMI_ADD_TO_SERVLIST]);
+ Menu_RemoveItem(g_hContactMenuItems[ICMI_XSTATUS_DETAILS]);
+ Menu_RemoveItem(g_hContactMenuItems[ICMI_OPEN_PROFILE]);
}
INT_PTR CIcqProto::OpenWebProfile(WPARAM hContact, LPARAM)
diff --git a/protocols/JabberG/src/jabber_menu.cpp b/protocols/JabberG/src/jabber_menu.cpp
index 42d1c744d5..999ace6c06 100644
--- a/protocols/JabberG/src/jabber_menu.cpp
+++ b/protocols/JabberG/src/jabber_menu.cpp
@@ -185,13 +185,13 @@ void g_MenuInit(void)
CreateServiceFunction("Jabber/MenuChoose", JabberMenuChooseService);
- hChooserMenu = MO_CreateMenuObject("JabberAccountChooser", LPGEN("Jabber account chooser"), 0, "Jabber/MenuChoose");
+ hChooserMenu = Menu_AddObject("JabberAccountChooser", LPGEN("Jabber account chooser"), 0, "Jabber/MenuChoose");
TMO_MenuItem tmi = { sizeof(tmi) };
tmi.name.a = "Cancel";
tmi.position = 9999999;
tmi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_DELETE);
- CallService(MO_ADDNEWMENUITEM, (WPARAM)hChooserMenu, (LPARAM)&tmi);
+ Menu_AddItem(hChooserMenu, &tmi);
//////////////////////////////////////////////////////////////////////////////////////
// Contact menu initialization
@@ -330,14 +330,14 @@ void g_MenuUninit(void)
{
DestroyHookableEvent(hStatusMenuInit);
- CallService(MO_REMOVEMENUITEM, (WPARAM)g_hMenuRequestAuth, 0);
- CallService(MO_REMOVEMENUITEM, (WPARAM)g_hMenuGrantAuth, 0);
- CallService(MO_REMOVEMENUITEM, (WPARAM)g_hMenuRevokeAuth, 0);
- CallService(MO_REMOVEMENUITEM, (WPARAM)g_hMenuConvert, 0);
- CallService(MO_REMOVEMENUITEM, (WPARAM)g_hMenuRosterAdd, 0);
- CallService(MO_REMOVEMENUITEM, (WPARAM)g_hMenuLogin, 0);
- CallService(MO_REMOVEMENUITEM, (WPARAM)g_hMenuRefresh, 0);
- CallService(MO_REMOVEMENUITEM, (WPARAM)g_hMenuAddBookmark, 0);
+ Menu_RemoveItem(g_hMenuRequestAuth);
+ Menu_RemoveItem(g_hMenuGrantAuth);
+ Menu_RemoveItem(g_hMenuRevokeAuth);
+ Menu_RemoveItem(g_hMenuConvert);
+ Menu_RemoveItem(g_hMenuRosterAdd);
+ Menu_RemoveItem(g_hMenuLogin);
+ Menu_RemoveItem(g_hMenuRefresh);
+ Menu_RemoveItem(g_hMenuAddBookmark);
WindowList_Destroy(hDialogsList);
}
@@ -604,7 +604,7 @@ void CJabberProto::MenuInit()
}
else {
if (m_hMenuRoot)
- CallService(MO_REMOVEMENUITEM, (WPARAM)m_hMenuRoot, 0);
+ Menu_RemoveItem(m_hMenuRoot);
m_hMenuRoot = NULL;
}
@@ -800,7 +800,7 @@ void CJabberProto::GlobalMenuInit()
tmi.ownerdata = this;
tmi.position = iChooserMenuPos++;
tmi.name.t = m_tszUserName;
- m_hChooseMenuItem = (HGENMENU)CallService(MO_ADDNEWMENUITEM, (WPARAM)hChooserMenu, (LPARAM)&tmi);
+ m_hChooseMenuItem = Menu_AddItem(hChooserMenu, &tmi);
//////////////////////////////////////////////////////////////////////////////////////
// Hotkeys
@@ -885,14 +885,14 @@ void CJabberProto::GlobalMenuUninit()
{
if (m_phMenuResourceItems) {
for (int i = 0; i < m_nMenuResourceItems; i++)
- CallService(MO_REMOVEMENUITEM, (WPARAM)m_phMenuResourceItems[i], 0);
+ Menu_RemoveItem(m_phMenuResourceItems[i]);
mir_free(m_phMenuResourceItems);
m_phMenuResourceItems = NULL;
}
m_nMenuResourceItems = 0;
if (m_hMenuRoot)
- CallService(MO_REMOVEMENUITEM, (WPARAM)m_hMenuRoot, 0);
+ Menu_RemoveItem(m_hMenuRoot);
m_hMenuRoot = NULL;
}
@@ -1141,20 +1141,17 @@ CJabberProto* JabberChooseInstance(bool bIsLink)
}
if (nItems > 1) {
- ListParam param = { 0 };
- param.MenuObjectHandle = hChooserMenu;
- HMENU hMenu = CreatePopupMenu();
- CallService(MO_BUILDMENU, (WPARAM)hMenu, (LPARAM)&param);
-
POINT pt;
GetCursorPos(&pt);
+ HMENU hMenu = CreatePopupMenu();
+ Menu_Build(hMenu, hChooserMenu);
int res = TrackPopupMenu(hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, pcli->hwndContactList, NULL);
DestroyMenu(hMenu);
if (res) {
CJabberProto* pro = NULL;
- CallService(MO_PROCESSCOMMANDBYMENUIDENT, res, (LPARAM)&pro);
+ Menu_ProcessCommandById(res, (LPARAM)&pro);
return pro;
}
diff --git a/protocols/JabberG/src/jabber_privacy.cpp b/protocols/JabberG/src/jabber_privacy.cpp
index eb606a70e4..9bfeb7e63e 100644
--- a/protocols/JabberG/src/jabber_privacy.cpp
+++ b/protocols/JabberG/src/jabber_privacy.cpp
@@ -2115,7 +2115,7 @@ void CJabberProto::BuildPrivacyListsMenu(bool bDeleteOld)
{
if (bDeleteOld)
for (int i = 0; i < m_hPrivacyMenuItems.getCount(); i++)
- CallService(MO_REMOVEMENUITEM, (WPARAM)m_hPrivacyMenuItems[i], 0);
+ Menu_RemoveItem((HGENMENU)m_hPrivacyMenuItems[i]);
m_hPrivacyMenuItems.destroy();
diff --git a/protocols/MSN/src/msn_menu.cpp b/protocols/MSN/src/msn_menu.cpp
index 52c56bebb0..33dd616058 100644
--- a/protocols/MSN/src/msn_menu.cpp
+++ b/protocols/MSN/src/msn_menu.cpp
@@ -335,7 +335,7 @@ void CMsnProto::MsnInitMainMenu(void)
void CMsnProto::MsnRemoveMainMenus(void)
{
if (mainMenuRoot)
- CallService(MO_REMOVEMENUITEM, (WPARAM)mainMenuRoot, 0);
+ Menu_RemoveItem(mainMenuRoot);
}
void CMsnProto::MSN_EnableMenuItems(bool bEnable)
@@ -444,14 +444,14 @@ void MSN_InitContactMenu(void)
void MSN_RemoveContactMenus(void)
{
- CallService(MO_REMOVEMENUITEM, (WPARAM)hBlockMenuItem, 0);
- CallService(MO_REMOVEMENUITEM, (WPARAM)hLiveSpaceMenuItem, 0);
+ Menu_RemoveItem(hBlockMenuItem);
+ Menu_RemoveItem(hLiveSpaceMenuItem);
#ifdef OBSOLETE
- CallService(MO_REMOVEMENUITEM, (WPARAM)hNetmeetingMenuItem, 0);
+ Menu_RemoveItem(hNetmeetingMenuItem);
DestroyServiceFunction(hNetMeeting);
#endif
- CallService(MO_REMOVEMENUITEM, (WPARAM)hChatInviteMenuItem, 0);
- CallService(MO_REMOVEMENUITEM, (WPARAM)hOpenInboxMenuItem, 0);
+ Menu_RemoveItem(hChatInviteMenuItem);
+ Menu_RemoveItem(hOpenInboxMenuItem);
DestroyServiceFunction(hBlockCom);
DestroyServiceFunction(hSendHotMail);
diff --git a/protocols/Sametime/src/sametime_proto.cpp b/protocols/Sametime/src/sametime_proto.cpp
index 2aaab309e0..27fbb51cf4 100644
--- a/protocols/Sametime/src/sametime_proto.cpp
+++ b/protocols/Sametime/src/sametime_proto.cpp
@@ -65,8 +65,6 @@ CSametimeProto::~CSametimeProto()
{
debugLog(_T("CSametimeProto::~CSametimeProto() start"));
- DeinitSessionMenu();
-
DeinitAwayMsg();
UnregisterPopups();
diff --git a/protocols/Sametime/src/sametime_proto.h b/protocols/Sametime/src/sametime_proto.h
index 4f3a249cf3..35082ecd23 100644
--- a/protocols/Sametime/src/sametime_proto.h
+++ b/protocols/Sametime/src/sametime_proto.h
@@ -111,7 +111,6 @@ struct CSametimeProto : public PROTO<CSametimeProto>
void SessionStarted();
void SessionStopping();
void InitSessionMenu();
- void DeinitSessionMenu();
int LogIn(int status, HANDLE hNetlibUser);
int LogOut();
int SetSessionStatus(int status);
@@ -171,7 +170,6 @@ struct CSametimeProto : public PROTO<CSametimeProto>
// sametime_session.cpp
bool first_online; // set our status after the first online status comes from the server
- HANDLE hSessionAnnounceMenuItem;
int login_status;
bool idle_status;
int idle_timerid;
diff --git a/protocols/Sametime/src/sametime_session.cpp b/protocols/Sametime/src/sametime_session.cpp
index 551ab48a57..cea3d51431 100644
--- a/protocols/Sametime/src/sametime_session.cpp
+++ b/protocols/Sametime/src/sametime_session.cpp
@@ -571,11 +571,5 @@ void CSametimeProto::InitSessionMenu()
mi.pszService = service;
mi.icolibItem = GetIconHandle(IDI_ICON_ANNOUNCE);
mi.pszContactOwner = m_szModuleName;
- hSessionAnnounceMenuItem = Menu_AddContactMenuItem(&mi);
-}
-
-void CSametimeProto::DeinitSessionMenu()
-{
- debugLog(_T("CSametimeProto::DeinitSessionMenu()"));
- CallService(MO_REMOVEMENUITEM, (WPARAM)hSessionAnnounceMenuItem, 0);
+ Menu_AddContactMenuItem(&mi);
}
diff --git a/protocols/SkypeWeb/src/skype_menus.cpp b/protocols/SkypeWeb/src/skype_menus.cpp
index 2f620ff0ff..8d24cb25f7 100644
--- a/protocols/SkypeWeb/src/skype_menus.cpp
+++ b/protocols/SkypeWeb/src/skype_menus.cpp
@@ -58,7 +58,7 @@ void CSkypeProto::InitMenus()
{
HookEvent(ME_CLIST_PREBUILDCONTACTMENU, &CSkypeProto::PrebuildContactMenu);
- //hChooserMenu = MO_CreateMenuObject("SkypeAccountChooser", LPGEN("Skype menu chooser"), 0, "Skype/MenuChoose");
+ //hChooserMenu = Menu_AddObject("SkypeAccountChooser", LPGEN("Skype menu chooser"), 0, "Skype/MenuChoose");
CLISTMENUITEM mi = { 0 };
mi.flags = CMIF_TCHAR;
@@ -129,7 +129,7 @@ int CSkypeProto::OnInitStatusMenu()
/*else
{
if (m_hMenuRoot)
- CallService(MO_REMOVEMENUITEM, (WPARAM)m_hMenuRoot, 0);
+ Menu_RemoveItem(m_hMenuRoot, 0);
m_hMenuRoot = NULL;
}*/
mi.hParentMenu = hStatusMunuRoot;
diff --git a/protocols/Steam/src/steam_menus.cpp b/protocols/Steam/src/steam_menus.cpp
index d997b29fc2..6b76a93220 100644
--- a/protocols/Steam/src/steam_menus.cpp
+++ b/protocols/Steam/src/steam_menus.cpp
@@ -104,8 +104,7 @@ void CSteamProto::OnInitStatusMenu()
mi.pszService = text;
HGENMENU hSteamRoot = Menu_GetProtocolRoot(m_szModuleName);
- if (!hSteamRoot)
- {
+ if (!hSteamRoot) {
mi.ptszName = m_tszUserName;
mi.position = -1999901006;
mi.hParentMenu = HGENMENU_ROOT;
@@ -113,10 +112,8 @@ void CSteamProto::OnInitStatusMenu()
//mi.icolibItem = NULL;
hSteamRoot = m_hMenuRoot = Menu_AddProtoMenuItem(&mi);
}
- else
- {
- if (m_hMenuRoot)
- CallService(MO_REMOVEMENUITEM, (WPARAM)m_hMenuRoot, 0);
+ else {
+ Menu_RemoveItem(m_hMenuRoot);
m_hMenuRoot = NULL;
}
@@ -134,7 +131,7 @@ void CSteamProto::OnInitStatusMenu()
void CSteamProto::InitMenus()
{
- hChooserMenu = MO_CreateMenuObject("SteamAccountChooser", LPGEN("Steam menu chooser"), 0, "Steam/MenuChoose");
+ hChooserMenu = Menu_AddObject("SteamAccountChooser", LPGEN("Steam menu chooser"), 0, "Steam/MenuChoose");
//////////////////////////////////////////////////////////////////////////////////////
// Contact menu initialization
@@ -170,8 +167,8 @@ void CSteamProto::InitMenus()
void CSteamProto::UninitMenus()
{
- CallService(MO_REMOVEMENUITEM, (WPARAM)contactMenuItems[CMI_AUTH_REQUEST], 0);
- CallService(MO_REMOVEMENUITEM, (WPARAM)contactMenuItems[CMI_BLOCK], 0);
- CallService(MO_REMOVEMENUITEM, (WPARAM)contactMenuItems[CMI_JOIN_GAME], 0);
+ Menu_RemoveItem(contactMenuItems[CMI_AUTH_REQUEST]);
+ Menu_RemoveItem(contactMenuItems[CMI_BLOCK]);
+ Menu_RemoveItem(contactMenuItems[CMI_JOIN_GAME]);
}
diff --git a/protocols/Tox/src/tox_menus.cpp b/protocols/Tox/src/tox_menus.cpp
index 7657f80bea..34f00da9ec 100644
--- a/protocols/Tox/src/tox_menus.cpp
+++ b/protocols/Tox/src/tox_menus.cpp
@@ -39,7 +39,7 @@ void CToxProto::InitMenus()
{
HookEvent(ME_CLIST_PREBUILDCONTACTMENU, &CToxProto::PrebuildContactMenu);
- //hChooserMenu = MO_CreateMenuObject("SkypeAccountChooser", LPGEN("Skype menu chooser"), 0, "Skype/MenuChoose");
+ //hChooserMenu = Menu_AddObject("SkypeAccountChooser", LPGEN("Skype menu chooser"), 0, "Skype/MenuChoose");
CLISTMENUITEM mi = { 0 };
mi.flags = CMIF_TCHAR;
@@ -96,7 +96,7 @@ int CToxProto::OnInitStatusMenu()
/*else
{
if (m_hMenuRoot)
- CallService(MO_REMOVEMENUITEM, (WPARAM)m_hMenuRoot, 0);
+ Menu_RemoveItem(m_hMenuRoot, 0);
m_hMenuRoot = NULL;
}*/
diff --git a/protocols/Twitter/src/theme.cpp b/protocols/Twitter/src/theme.cpp
index 2ffdc00f8b..5c97648203 100644
--- a/protocols/Twitter/src/theme.cpp
+++ b/protocols/Twitter/src/theme.cpp
@@ -107,7 +107,7 @@ void InitContactMenus()
void UninitContactMenus()
{
for (size_t i = 0; i < _countof(g_hMenuItems); i++)
- CallService(MO_REMOVEMENUITEM, (WPARAM)g_hMenuItems[i], 0);
+ Menu_RemoveItem(g_hMenuItems[i]);
UnhookEvent(g_hMenuEvts[0]);
for (size_t i = 1; i < _countof(g_hMenuEvts); i++)
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp
index 23ab2d7fd4..873badb076 100644
--- a/protocols/VKontakte/src/vk_proto.cpp
+++ b/protocols/VKontakte/src/vk_proto.cpp
@@ -375,13 +375,13 @@ void CVkProto::UnInitMenus()
{
debugLogA("CVkProto::UnInitMenus");
for (int i = 0; i < PMI_COUNT; i++)
- CallService(MO_REMOVEMENUITEM, (WPARAM)g_hProtoMenuItems[i], 0);
+ Menu_RemoveItem(g_hProtoMenuItems[i]);
for (int i = 0; i < CHMI_COUNT; i++)
- CallService(MO_REMOVEMENUITEM, (WPARAM)g_hContactHistoryMenuItems[i], 0);
+ Menu_RemoveItem(g_hContactHistoryMenuItems[i]);
for (int i = 0; i < CMI_COUNT; i++)
- CallService(MO_REMOVEMENUITEM, (WPARAM)g_hContactMenuItems[i], 0);
+ Menu_RemoveItem(g_hContactMenuItems[i]);
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/WhatsApp/src/theme.cpp b/protocols/WhatsApp/src/theme.cpp
index 5210749b76..9ced4f036d 100644
--- a/protocols/WhatsApp/src/theme.cpp
+++ b/protocols/WhatsApp/src/theme.cpp
@@ -64,9 +64,10 @@ int WhatsAppProto::OnBuildStatusMenu(WPARAM wParam, LPARAM lParam)
hRoot = m_hMenuRoot = Menu_AddProtoMenuItem(&mi);
}
else {
- if (m_hMenuRoot)
- CallService(MO_REMOVEMENUITEM, (WPARAM)m_hMenuRoot, 0);
- m_hMenuRoot = NULL;
+ if (m_hMenuRoot) {
+ Menu_RemoveItem(m_hMenuRoot);
+ m_hMenuRoot = NULL;
+ }
}
mi.flags = CMIF_ROOTHANDLE | (isOnline() ? 0 : CMIF_GRAYED);
diff --git a/protocols/Xfire/src/Xfire_game.cpp b/protocols/Xfire/src/Xfire_game.cpp
index 02029be589..7d10b769c3 100644
--- a/protocols/Xfire/src/Xfire_game.cpp
+++ b/protocols/Xfire/src/Xfire_game.cpp
@@ -461,7 +461,7 @@ void Xfire_game::remoteMenuitem()
{
if (menuhandle != NULL)
{
- CallService(MO_REMOVEMENUITEM, (WPARAM)menuhandle, 0);
+ Menu_RemoveItem(menuhandle);
menuhandle = NULL;
}
}
diff --git a/protocols/Xfire/src/Xfire_gamelist.cpp b/protocols/Xfire/src/Xfire_gamelist.cpp
index 2bf698f078..a60e870548 100644
--- a/protocols/Xfire/src/Xfire_gamelist.cpp
+++ b/protocols/Xfire/src/Xfire_gamelist.cpp
@@ -254,7 +254,7 @@ void Xfire_gamelist::createDummyMenuItem()
//entfernt dummymenueintrag
void Xfire_gamelist::removeDummyMenuItem()
{
- CallService(MO_REMOVEMENUITEM, (WPARAM)dummymenuitem, 0);
+ Menu_RemoveItem(dummymenuitem);
}
//säubert die datenbank spiel einträge udn trägt custom spiele vorher nach
diff --git a/protocols/Xfire/src/Xfire_gamelist.h b/protocols/Xfire/src/Xfire_gamelist.h
index e6e86d93ee..83f087cd96 100644
--- a/protocols/Xfire/src/Xfire_gamelist.h
+++ b/protocols/Xfire/src/Xfire_gamelist.h
@@ -41,7 +41,7 @@ using namespace std;
class Xfire_gamelist : public Xfire_base {
private:
vector<Xfire_game*> gamelist;
- HANDLE dummymenuitem;
+ HGENMENU dummymenuitem;
unsigned int nextgameid;
BOOL ingame;
mir_cs gamlistMutex;
diff --git a/protocols/Yahoo/src/services.cpp b/protocols/Yahoo/src/services.cpp
index 658824f400..2ffd9f32d8 100644
--- a/protocols/Yahoo/src/services.cpp
+++ b/protocols/Yahoo/src/services.cpp
@@ -383,7 +383,7 @@ void CYahooProto::MenuMainInit(void)
}
else {
if (mainMenuRoot)
- CallService(MO_REMOVEMENUITEM, (WPARAM)mainMenuRoot, 0);
+ Menu_RemoveItem(mainMenuRoot);
mainMenuRoot = NULL;
}
@@ -477,9 +477,9 @@ void CYahooProto::MenuContactInit(void)
void CYahooProto::MenuUninit(void)
{
if (mainMenuRoot)
- CallService(MO_REMOVEMENUITEM, (WPARAM)mainMenuRoot, 0);
+ Menu_RemoveItem(mainMenuRoot);
- CallService(MO_REMOVEMENUITEM, (WPARAM)hShowProfileMenuItem, 0);
+ Menu_RemoveItem(hShowProfileMenuItem);
}
int __cdecl CYahooProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM)
diff --git a/src/mir_app/src/clistmenus.cpp b/src/mir_app/src/clistmenus.cpp
index 8d7725c402..32193ed18d 100644
--- a/src/mir_app/src/clistmenus.cpp
+++ b/src/mir_app/src/clistmenus.cpp
@@ -178,12 +178,9 @@ int fnGetAverageMode(int *pNetProtoCount)
static INT_PTR BuildMainMenu(WPARAM, LPARAM)
{
- ListParam param = { 0 };
- param.MenuObjectHandle = hMainMenuObject;
-
NotifyEventHooks(hPreBuildMainMenuEvent, 0, 0);
- CallService(MO_BUILDMENU, (WPARAM)hMainMenu, (LPARAM)&param);
+ Menu_Build(hMainMenu, hMainMenuObject);
DrawMenuBar((HWND)CallService("CLUI/GetHwnd", 0, 0));
return (INT_PTR)hMainMenu;
}
@@ -205,7 +202,7 @@ static INT_PTR AddMainMenuItem(WPARAM, LPARAM lParam)
mmep->szMenuName = tmi.name.t;
tmi.ownerdata = mmep;
- TMO_IntMenuItem *pimi = MO_AddNewMenuItem(hMainMenuObject, &tmi);
+ TMO_IntMenuItem *pimi = Menu_AddItem(hMainMenuObject, &tmi);
char* name;
bool needFree = false;
@@ -280,7 +277,7 @@ static INT_PTR AddContactMenuItem(WPARAM, LPARAM lParam)
tmi.ownerdata = cmep;
//may be need to change how UniqueName is formed?
- TMO_IntMenuItem *menuHandle = MO_AddNewMenuItem(hContactMenuObject, &tmi);
+ TMO_IntMenuItem *menuHandle = Menu_AddItem(hContactMenuObject, &tmi);
char buf[256];
if (mi->pszService)
mir_snprintf(buf, "%s/%s", (mi->pszContactOwner) ? mi->pszContactOwner : "", (mi->pszService) ? mi->pszService : "");
@@ -306,13 +303,8 @@ static INT_PTR BuildContactMenu(WPARAM hContact, LPARAM)
bcp.isOnList = (db_get_b(hContact, "CList", "NotOnList", 0) == 0);
bcp.isOnline = (szProto != NULL && ID_STATUS_OFFLINE != db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE));
- ListParam param = { 0 };
- param.MenuObjectHandle = hContactMenuObject;
- param.wParam = (WPARAM)&bcp;
-
HMENU hMenu = CreatePopupMenu();
- CallService(MO_BUILDMENU, (WPARAM)hMenu, (LPARAM)&param);
-
+ Menu_Build(hMenu, hContactMenuObject, (WPARAM)&bcp);
return (INT_PTR)hMenu;
}
@@ -332,7 +324,7 @@ INT_PTR ContactMenuExecService(WPARAM wParam, LPARAM lParam)
//true - ok, false ignore
INT_PTR ContactMenuCheckService(WPARAM wParam, LPARAM)
{
- PCheckProcParam pcpp = (PCheckProcParam)wParam;
+ TCheckProcParam *pcpp = (TCheckProcParam*)wParam;
if (pcpp == NULL)
return FALSE;
@@ -408,7 +400,7 @@ BOOL FindMenuHandleByGlobalID(HMENU hMenu, TMO_IntMenuItem *id, MenuItemData* it
INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM)
{
- PCheckProcParam pcpp = (PCheckProcParam)wParam;
+ TCheckProcParam *pcpp = (TCheckProcParam*)wParam;
if (!pcpp)
return TRUE;
@@ -636,7 +628,7 @@ INT_PTR MenuProcessCommand(WPARAM wParam, LPARAM lParam)
if (hst >= ID_STATUS_OFFLINE && hst <= ID_STATUS_OUTTOLUNCH) {
int pos = statustopos(hst);
if (pos != -1 && hStatusMainMenuHandles != NULL)
- return MO_ProcessCommand(hStatusMainMenuHandles[pos], lParam);
+ return Menu_ProcessCommand(hStatusMainMenuHandles[pos], lParam);
}
}
@@ -648,7 +640,7 @@ INT_PTR MenuProcessCommand(WPARAM wParam, LPARAM lParam)
return MO_ProcessCommandBySubMenuIdent((int)hContactMenuObject, LOWORD(wParam), lParam);
//unknown old menu
- return MO_ProcessCommandByMenuIdent(LOWORD(wParam), lParam);
+ return Menu_ProcessCommandById(LOWORD(wParam), lParam);
}
BOOL FindMenuHanleByGlobalID(HMENU hMenu, TMO_IntMenuItem *id, MenuItemData* itdat)
@@ -729,17 +721,16 @@ int RecursiveDeleteMenu(HMENU hMenu)
static INT_PTR MenuGetMain(WPARAM, LPARAM)
{
RecursiveDeleteMenu(hMainMenu);
+
BuildMainMenu(0, 0);
return (INT_PTR)hMainMenu;
}
static INT_PTR BuildStatusMenu(WPARAM, LPARAM)
{
- ListParam param = { 0 };
- param.MenuObjectHandle = hStatusMenuObject;
-
RecursiveDeleteMenu(hStatusMenu);
- CallService(MO_BUILDMENU, (WPARAM)hStatusMenu, (LPARAM)&param);
+
+ Menu_Build(hStatusMenu, hStatusMenuObject);
return (INT_PTR)hStatusMenu;
}
@@ -805,12 +796,12 @@ void RebuildMenuOrder(void)
//status menu
if (hStatusMenuObject != 0) {
- CallService(MO_REMOVEMENUOBJECT, (WPARAM)hStatusMenuObject, 0);
+ Menu_RemoveObject(hStatusMenuObject);
mir_free(hStatusMainMenuHandles);
mir_free(hStatusMenuHandles);
}
- hStatusMenuObject = MO_CreateMenuObject("StatusMenu", LPGEN("Status menu"), "StatusMenuCheckService", "StatusMenuExecService");
+ hStatusMenuObject = Menu_AddObject("StatusMenu", LPGEN("Status menu"), "StatusMenuCheckService", "StatusMenuExecService");
Menu_ConfigureObject(hStatusMenuObject, MCO_OPT_FREE_SERVICE, (INT_PTR)"CLISTMENUS/FreeOwnerDataStatusMenu");
hStatusMainMenuHandles = (TMO_IntMenuItem**)mir_calloc(_countof(statusModeList) * sizeof(TMO_IntMenuItem*));
@@ -852,7 +843,7 @@ void RebuildMenuOrder(void)
smep->proto = mir_strdup(pa->szModuleName);
tmi.ownerdata = smep;
- TMO_IntMenuItem *rootmenu = MO_AddNewMenuItem(hStatusMenuObject, &tmi);
+ TMO_IntMenuItem *rootmenu = Menu_AddItem(hStatusMenuObject, &tmi);
memset(&tmi, 0, sizeof(tmi));
tmi.flags = CMIF_TCHAR | CMIF_ROOTHANDLE | CMIF_KEEPUNTRANSLATED;
@@ -874,7 +865,7 @@ void RebuildMenuOrder(void)
}
else tmi.name.t = pa->tszAccountName;
- TMO_IntMenuItem *menuHandle = MO_AddNewMenuItem(hStatusMenuObject, &tmi);
+ TMO_IntMenuItem *menuHandle = Menu_AddItem(hStatusMenuObject, &tmi);
((StatusMenuExecParam*)tmi.ownerdata)->protoindex = (int)menuHandle;
Menu_ModifyItem(menuHandle, tmi.name.t, tmi.hIcon, tmi.flags);
@@ -916,7 +907,7 @@ void RebuildMenuOrder(void)
hStatusMenuHandles[i].protoindex = i;
hStatusMenuHandles[i].protostatus[j] = statusModeList[j];
- hStatusMenuHandles[i].menuhandle[j] = MO_AddNewMenuItem(hStatusMenuObject, &tmi);
+ hStatusMenuHandles[i].menuhandle[j] = Menu_AddItem(hStatusMenuObject, &tmi);
char buf[256];
mir_snprintf(buf, "ProtocolIcon_%s_%s", pa->szModuleName, tmi.name.a);
@@ -958,7 +949,7 @@ void RebuildMenuOrder(void)
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;
- hStatusMainMenuHandles[j] = MO_AddNewMenuItem(hStatusMenuObject, &tmi);
+ hStatusMainMenuHandles[j] = Menu_AddItem(hStatusMenuObject, &tmi);
hStatusMainMenuHandles[j]->hotKey = hotKey;
}
@@ -1131,7 +1122,7 @@ static INT_PTR AddStatusMenuItem(WPARAM wParam, LPARAM lParam)
tmi.root = mp->pMenu;
tmi.hIcon = NULL;
tmi.name.a = mi->pszPopupName;
- pRoot = MO_AddNewMenuItem(hStatusMenuObject, &tmi);
+ pRoot = Menu_AddItem(hStatusMenuObject, &tmi);
}
tmi.flags |= CMIF_ROOTHANDLE;
@@ -1161,7 +1152,7 @@ static INT_PTR AddStatusMenuItem(WPARAM wParam, LPARAM lParam)
tmi.ownerdata = smep;
}
- TMO_IntMenuItem *menuHandle = MO_AddNewMenuItem(hStatusMenuObject, &tmi);
+ TMO_IntMenuItem *menuHandle = Menu_AddItem(hStatusMenuObject, &tmi);
if (smep)
smep->hMenuItem = menuHandle;
@@ -1248,12 +1239,12 @@ void InitCustomMenus(void)
InitGenMenu();
// main menu
- hMainMenuObject = MO_CreateMenuObject("MainMenu", LPGEN("Main menu"), 0, "MainMenuExecService");
+ hMainMenuObject = Menu_AddObject("MainMenu", LPGEN("Main menu"), 0, "MainMenuExecService");
Menu_ConfigureObject(hMainMenuObject, MCO_OPT_USERDEFINEDITEMS, TRUE);
Menu_ConfigureObject(hMainMenuObject, MCO_OPT_FREE_SERVICE, (INT_PTR)"CLISTMENUS/FreeOwnerDataMainMenu");
// contact menu
- hContactMenuObject = MO_CreateMenuObject("ContactMenu", LPGEN("Contact menu"), "ContactMenuCheckService", "ContactMenuExecService");
+ hContactMenuObject = Menu_AddObject("ContactMenu", LPGEN("Contact menu"), "ContactMenuCheckService", "ContactMenuExecService");
Menu_ConfigureObject(hContactMenuObject, MCO_OPT_USERDEFINEDITEMS, TRUE);
Menu_ConfigureObject(hContactMenuObject, MCO_OPT_FREE_SERVICE, (INT_PTR)"CLISTMENUS/FreeOwnerDataContactMenu");
@@ -1299,8 +1290,8 @@ void UninitCustomMenus(void)
mir_free(hStatusMenuHandles);
hStatusMenuHandles = NULL;
- if (hMainMenuObject) CallService(MO_REMOVEMENUOBJECT, (WPARAM)hMainMenuObject, 0);
- if (hStatusMenuObject) CallService(MO_REMOVEMENUOBJECT, (WPARAM)hMainMenuObject, 0);
+ Menu_RemoveObject(hMainMenuObject);
+ Menu_RemoveObject(hMainMenuObject);
UnloadMoveToGroup();
FreeMenuProtos();
diff --git a/src/mir_app/src/genmenu.cpp b/src/mir_app/src/genmenu.cpp
index 4a7036d37a..9396daad50 100644
--- a/src/mir_app/src/genmenu.cpp
+++ b/src/mir_app/src/genmenu.cpp
@@ -194,24 +194,6 @@ int MO_RemoveAllObjects()
/////////////////////////////////////////////////////////////////////////////////////////
// wparam = MenuObjectHandle
-
-INT_PTR MO_RemoveMenuObject(WPARAM wParam, LPARAM)
-{
- if (!bIsGenMenuInited)
- return -1;
-
- mir_cslock lck(csMenuHook);
- int objidx = GetMenuObjbyId((int)wParam);
- if (objidx == -1)
- return -1;
-
- delete g_menus[objidx];
- g_menus.remove(objidx);
- return 0;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-// wparam = MenuObjectHandle
// lparam = vKey
INT_PTR MO_ProcessHotKeys(HANDLE menuHandle, INT_PTR vKey)
@@ -231,7 +213,7 @@ INT_PTR MO_ProcessHotKeys(HANDLE menuHandle, INT_PTR vKey)
if (!(LOWORD(pimi->hotKey) & MOD_CONTROL) != !(GetKeyState(VK_CONTROL) & 0x8000)) continue;
if (!(LOWORD(pimi->hotKey) & MOD_SHIFT) != !(GetKeyState(VK_SHIFT) & 0x8000)) continue;
- MO_ProcessCommand(pimi, 0);
+ Menu_ProcessCommand(pimi, 0);
return TRUE;
}
@@ -380,7 +362,6 @@ TMO_IntMenuItem *MO_GetIntMenuItem(HGENMENU wParam)
}
/////////////////////////////////////////////////////////////////////////////////////////
-// LOWORD(wparam) menuident
static int FindMenuByCommand(TMO_IntMenuItem *pimi, void* pCommand)
{
@@ -402,43 +383,46 @@ int MO_ProcessCommandBySubMenuIdent(int menuID, int command, LPARAM lParam)
pimi = MO_RecursiveWalkMenu(g_menus[objidx]->m_items.first, FindMenuByCommand, (void*)command);
}
- return (pimi) ? MO_ProcessCommand(pimi, lParam) : -1;
+ return (pimi) ? Menu_ProcessCommand(pimi, lParam) : -1;
}
-INT_PTR MO_ProcessCommandByMenuIdent(WPARAM wParam, LPARAM lParam)
+/////////////////////////////////////////////////////////////////////////////////////////
+
+MIR_APP_DLL(BOOL) Menu_ProcessCommandById(int command, LPARAM lParam)
{
if (!bIsGenMenuInited)
return -1;
- TMO_IntMenuItem *pimi = NULL;
- {
- mir_cslock lck(csMenuHook);
- for (int i = 0; i < g_menus.getCount(); i++)
- if ((pimi = MO_RecursiveWalkMenu(g_menus[i]->m_items.first, FindMenuByCommand, (void*)wParam)) != NULL)
- break;
- }
+ mir_cslock lck(csMenuHook);
+ for (int i = 0; i < g_menus.getCount(); i++)
+ if (TMO_IntMenuItem *pimi = MO_RecursiveWalkMenu(g_menus[i]->m_items.first, FindMenuByCommand, (void*)command))
+ return Menu_ProcessCommand(pimi, lParam);
- return (pimi) ? MO_ProcessCommand(pimi, lParam) : FALSE;
+ return false;
}
-int MO_ProcessCommand(TMO_IntMenuItem *aHandle, LPARAM lParam)
+/////////////////////////////////////////////////////////////////////////////////////////
+
+MIR_APP_DLL(BOOL) Menu_ProcessCommand(HGENMENU hMenuItem, LPARAM lParam)
{
if (!bIsGenMenuInited)
- return -1;
+ return false;
TMO_IntMenuItem *pimi;
{
mir_cslock lck(csMenuHook);
- if ((pimi = MO_GetIntMenuItem(aHandle)) == NULL)
- return -1;
+ if ((pimi = MO_GetIntMenuItem(hMenuItem)) == NULL)
+ return false;
}
LPCSTR srvname = pimi->parent->ExecService;
void *ownerdata = pimi->mi.ownerdata;
CallService(srvname, (WPARAM)ownerdata, lParam);
- return 1;
+ return true;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
MIR_APP_DLL(int) Menu_ConfigureItem(HGENMENU hItem, int iOption, INT_PTR value)
{
if (!bIsGenMenuInited)
@@ -462,6 +446,8 @@ MIR_APP_DLL(int) Menu_ConfigureItem(HGENMENU hItem, int iOption, INT_PTR value)
return 1;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
MIR_APP_DLL(int) Menu_ConfigureObject(HANDLE handle, int setting, INT_PTR value)
{
if (!bIsGenMenuInited)
@@ -500,27 +486,40 @@ MIR_APP_DLL(int) Menu_ConfigureObject(HANDLE handle, int setting, INT_PTR value)
}
/////////////////////////////////////////////////////////////////////////////////////////
-// wparam = LPCSTR szDisplayName;
-// lparam = PMenuParam;
-// result = MenuObjectHandle
-INT_PTR MO_CreateNewMenuObject(WPARAM wParam, LPARAM lParam)
+MIR_APP_DLL(HANDLE) Menu_AddObject(LPCSTR szName, LPCSTR szDisplayName, LPCSTR szCheckService, LPCSTR szExecService)
{
- TMenuParam *pmp = (TMenuParam *)lParam;
- if (!bIsGenMenuInited || pmp == NULL)
- return -1;
+ if (!bIsGenMenuInited || szName == NULL)
+ return NULL;
mir_cslock lck(csMenuHook);
- TIntMenuObject* p = new TIntMenuObject();
+ TIntMenuObject *p = new TIntMenuObject();
p->id = NextObjectId++;
- p->pszName = mir_strdup(pmp->name);
- p->ptszDisplayName = mir_a2t(LPCSTR(wParam));
- p->CheckService = mir_strdup(pmp->CheckService);
- p->ExecService = mir_strdup(pmp->ExecService);
+ p->pszName = mir_strdup(szName);
+ p->ptszDisplayName = mir_a2t(szDisplayName);
+ p->CheckService = mir_strdup(szCheckService);
+ p->ExecService = mir_strdup(szExecService);
p->m_hMenuIcons = ImageList_Create(g_iIconSX, g_iIconSY, ILC_COLOR32 | ILC_MASK, 15, 100);
g_menus.insert(p);
- return p->id;
+ return (HANDLE)p->id;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+MIR_APP_DLL(int) Menu_RemoveObject(HANDLE hMenuObject)
+{
+ if (!bIsGenMenuInited || hMenuObject == NULL)
+ return -1;
+
+ mir_cslock lck(csMenuHook);
+ int objidx = GetMenuObjbyId((int)hMenuObject);
+ if (objidx == -1)
+ return -1;
+
+ delete g_menus[objidx];
+ g_menus.remove(objidx);
+ return 0;
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -538,10 +537,10 @@ static int FindParent(TMO_IntMenuItem* pimi, void* p)
return pimi->next == p;
}
-INT_PTR MO_RemoveMenuItem(WPARAM wParam, LPARAM)
+MIR_APP_DLL(int) Menu_RemoveItem(HGENMENU hMenuItem)
{
mir_cslock lck(csMenuHook);
- TMO_IntMenuItem *pimi = MO_GetIntMenuItem((HGENMENU)wParam);
+ TMO_IntMenuItem *pimi = MO_GetIntMenuItem(hMenuItem);
if (pimi == NULL)
return -1;
@@ -595,7 +594,7 @@ MIR_APP_DLL(void) KillModuleMenus(int hLangpack)
MO_RecursiveWalkMenu(g_menus[i]->m_items.first, (pfnWalkFunc)KillMenuItems, &param);
for (int k = 0; k < param.arItems.getCount(); k++)
- MO_RemoveMenuItem((WPARAM)param.arItems[k], 0);
+ Menu_RemoveItem(param.arItems[k]);
}
///////////////////////////////////////////////////////////////////////////////
@@ -624,17 +623,17 @@ static int GetNextObjectMenuItemId()
// lparam = PMO_MenuItem
// return MenuItemHandle
-TMO_IntMenuItem *MO_AddNewMenuItem(HANDLE menuobjecthandle, TMO_MenuItem *pmi)
+MIR_APP_DLL(HGENMENU) Menu_AddItem(HANDLE hMenuObject, TMO_MenuItem *pmi)
{
if (!bIsGenMenuInited || pmi == NULL)
return NULL;
// old mode
if (!(pmi->flags & CMIF_ROOTHANDLE))
- return MO_AddOldNewMenuItem(menuobjecthandle, pmi);
+ return MO_AddOldNewMenuItem(hMenuObject, pmi);
mir_cslock lck(csMenuHook);
- int objidx = GetMenuObjbyId((int)menuobjecthandle);
+ int objidx = GetMenuObjbyId((int)hMenuObject);
if (objidx == -1)
return NULL;
@@ -696,7 +695,7 @@ int FindRoot(TMO_IntMenuItem *pimi, void* param)
return FALSE;
}
-TMO_IntMenuItem *MO_AddOldNewMenuItem(HANDLE menuobjecthandle, TMO_MenuItem *pmi)
+TMO_IntMenuItem* MO_AddOldNewMenuItem(HANDLE menuobjecthandle, TMO_MenuItem *pmi)
{
if (!bIsGenMenuInited || pmi == NULL)
return NULL;
@@ -731,7 +730,7 @@ TMO_IntMenuItem *MO_AddOldNewMenuItem(HANDLE menuobjecthandle, TMO_MenuItem *pmi
tmi.root = NULL;
// copy pszPopupName
tmi.name.t = (TCHAR*)pmi->root;
- if ((oldroot = MO_AddNewMenuItem(menuobjecthandle, &tmi)) != NULL)
+ if ((oldroot = Menu_AddItem(menuobjecthandle, &tmi)) != NULL)
Menu_ConfigureItem(oldroot, MCI_OPT_UNIQUENAME, (const char*)pmi->root);
}
pmi->root = oldroot;
@@ -740,7 +739,7 @@ TMO_IntMenuItem *MO_AddOldNewMenuItem(HANDLE menuobjecthandle, TMO_MenuItem *pmi
}
pmi->flags |= CMIF_ROOTHANDLE;
// add popup(root allready exists)
- return MO_AddNewMenuItem(menuobjecthandle, pmi);
+ return Menu_AddItem(menuobjecthandle, pmi);
}
static int WhereToPlace(HMENU hMenu, TMO_MenuItem *mi)
@@ -836,28 +835,6 @@ static void InsertMenuItemWithSeparators(HMENU hMenu, int uItem, MENUITEMINFO *l
}
/////////////////////////////////////////////////////////////////////////////////////////
-// wparam started hMenu
-// lparam ListParam*
-// result hMenu
-
-INT_PTR MO_BuildMenu(WPARAM wParam, LPARAM lParam)
-{
- if (!bIsGenMenuInited)
- return -1;
-
- mir_cslock lck(csMenuHook);
-
- ListParam *lp = (ListParam*)lParam;
- int pimoidx = GetMenuObjbyId((int)lp->MenuObjectHandle);
- if (pimoidx == -1)
- return 0;
-
- #if defined(_DEBUG)
- // DumpMenuItem(g_menus[pimoidx]->m_items.first);
- #endif
-
- return (INT_PTR)BuildRecursiveMenu((HMENU)wParam, g_menus[pimoidx]->m_items.first, (ListParam*)lParam);
-}
#ifdef _DEBUG
#define PUTPOSITIONSONMENU
@@ -873,19 +850,16 @@ void GetMenuItemName(TMO_IntMenuItem *pMenuItem, char* pszDest, size_t cbDestSiz
mir_snprintf(pszDest, cbDestSize, "{%s}", pMenuItem->mi.name.t);
}
-HMENU BuildRecursiveMenu(HMENU hMenu, TMO_IntMenuItem *pRootMenu, ListParam *param)
+static HMENU BuildRecursiveMenu(HMENU hMenu, TMO_IntMenuItem *pRootMenu, INT_PTR iRootLevel, WPARAM wParam, LPARAM lParam)
{
- if (param == NULL || pRootMenu == NULL)
+ if (pRootMenu == NULL)
return NULL;
TIntMenuObject* pmo = pRootMenu->parent;
- int rootlevel = (param->rootlevel == -1) ? 0 : param->rootlevel;
-
- ListParam localparam = *param;
-
- while (rootlevel == 0 && GetMenuItemCount(hMenu) > 0)
- DeleteMenu(hMenu, 0, MF_BYPOSITION);
+ if (iRootLevel == 0)
+ while (GetMenuItemCount(hMenu) > 0)
+ DeleteMenu(hMenu, 0, MF_BYPOSITION);
for (TMO_IntMenuItem *pmi = pRootMenu; pmi != NULL; pmi = pmi->next) {
TMO_MenuItem *mi = &pmi->mi;
@@ -894,8 +868,8 @@ HMENU BuildRecursiveMenu(HMENU hMenu, TMO_IntMenuItem *pRootMenu, ListParam *par
if (pmo->CheckService != NULL) {
TCheckProcParam CheckParam;
- CheckParam.lParam = param->lParam;
- CheckParam.wParam = param->wParam;
+ CheckParam.wParam = wParam;
+ CheckParam.lParam = lParam;
CheckParam.MenuItemOwnerData = mi->ownerdata;
CheckParam.MenuItemHandle = pmi;
if (CallService(pmo->CheckService, (WPARAM)&CheckParam, 0) == FALSE)
@@ -903,7 +877,7 @@ HMENU BuildRecursiveMenu(HMENU hMenu, TMO_IntMenuItem *pRootMenu, ListParam *par
}
/**************************************/
- if (rootlevel == 0 && mi->root == NULL && pmo->m_bUseUserDefinedItems) {
+ if (iRootLevel == 0 && mi->root == NULL && pmo->m_bUseUserDefinedItems) {
char DBString[256];
DBVARIANT dbv = { 0 };
int pos;
@@ -943,7 +917,7 @@ HMENU BuildRecursiveMenu(HMENU hMenu, TMO_IntMenuItem *pRootMenu, ListParam *par
/**************************************/
- if (rootlevel != (int)pmi->mi.root)
+ if (iRootLevel != (INT_PTR)pmi->mi.root)
continue;
int i = WhereToPlace(hMenu, mi);
@@ -975,28 +949,27 @@ HMENU BuildRecursiveMenu(HMENU hMenu, TMO_IntMenuItem *pRootMenu, ListParam *par
mii.fMask |= MIIM_SUBMENU;
mii.hSubMenu = CreatePopupMenu();
- #ifdef PUTPOSITIONSONMENU
- if (GetKeyState(VK_CONTROL) & 0x8000) {
- TCHAR str[256];
- mir_sntprintf(str, _countof(str), _T("%s (%d, id %x)"), mi->name.a, mi->position, mii.dwItemData);
- mii.dwTypeData = str;
- }
- #endif
+#ifdef PUTPOSITIONSONMENU
+ if (GetKeyState(VK_CONTROL) & 0x8000) {
+ TCHAR str[256];
+ mir_sntprintf(str, _countof(str), _T("%s (%d, id %x)"), mi->name.a, mi->position, mii.dwItemData);
+ mii.dwTypeData = str;
+ }
+#endif
InsertMenuItemWithSeparators(hMenu, i, &mii);
- localparam.rootlevel = LPARAM(pmi);
- BuildRecursiveMenu(mii.hSubMenu, pmi->submenu.first, &localparam);
+ BuildRecursiveMenu(mii.hSubMenu, pmi->submenu.first, LPARAM(pmi), wParam, lParam);
}
else {
mii.wID = pmi->iCommand;
- #ifdef PUTPOSITIONSONMENU
- if (GetKeyState(VK_CONTROL) & 0x8000) {
- TCHAR str[256];
- mir_sntprintf(str, _countof(str), _T("%s (%d, id %x)"), mi->name.a, mi->position, mii.dwItemData);
- mii.dwTypeData = str;
- }
- #endif
+#ifdef PUTPOSITIONSONMENU
+ if (GetKeyState(VK_CONTROL) & 0x8000) {
+ TCHAR str[256];
+ mir_sntprintf(str, _countof(str), _T("%s (%d, id %x)"), mi->name.a, mi->position, mii.dwItemData);
+ mii.dwTypeData = str;
+ }
+#endif
if (pmo->onAddService != NULL)
if (CallService(pmo->onAddService, (WPARAM)&mii, (LPARAM)pmi) == FALSE)
@@ -1010,6 +983,29 @@ HMENU BuildRecursiveMenu(HMENU hMenu, TMO_IntMenuItem *pRootMenu, ListParam *par
}
/////////////////////////////////////////////////////////////////////////////////////////
+// wparam started hMenu
+// lparam ListParam*
+// result hMenu
+
+EXTERN_C MIR_APP_DLL(HMENU) Menu_Build(HMENU parent, HANDLE hMenuObject, WPARAM wParam, LPARAM lParam)
+{
+ if (!bIsGenMenuInited)
+ return NULL;
+
+ mir_cslock lck(csMenuHook);
+
+ int pimoidx = GetMenuObjbyId(int(hMenuObject));
+ if (pimoidx == -1)
+ return 0;
+
+ #if defined(_DEBUG)
+ // DumpMenuItem(g_menus[pimoidx]->m_items.first);
+ #endif
+
+ return BuildRecursiveMenu(parent, g_menus[pimoidx]->m_items.first, 0, wParam, lParam);
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
// iconlib in menu
static int MO_ReloadIcon(TMO_IntMenuItem *pmi, void*)
@@ -1111,7 +1107,7 @@ int TryProcessDoubleClick(MCONTACT hContact)
TMO_IntMenuItem *pimi = (TMO_IntMenuItem*)MO_GetDefaultMenuItem((WPARAM)g_menus[iMenuID]->m_items.first, 0);
if (pimi != NULL) {
- MO_ProcessCommand(pimi, hContact);
+ Menu_ProcessCommand(pimi, hContact);
return 0;
}
}
@@ -1139,18 +1135,10 @@ static int OnModulesLoaded(WPARAM, LPARAM)
int InitGenMenu()
{
- CreateServiceFunction(MO_BUILDMENU, MO_BuildMenu);
-
- CreateServiceFunction(MO_PROCESSCOMMAND, (MIRANDASERVICE)MO_ProcessCommand);
- CreateServiceFunction("MO/CreateNewMenuObject", MO_CreateNewMenuObject);
- CreateServiceFunction(MO_REMOVEMENUITEM, MO_RemoveMenuItem);
- CreateServiceFunction(MO_ADDNEWMENUITEM, (MIRANDASERVICE)MO_AddNewMenuItem);
CreateServiceFunction(MO_MENUITEMGETOWNERDATA, MO_MenuItemGetOwnerData);
CreateServiceFunction(MO_GETMENUITEM, MO_GetMenuItem);
CreateServiceFunction(MO_GETDEFAULTMENUITEM, MO_GetDefaultMenuItem);
- CreateServiceFunction(MO_PROCESSCOMMANDBYMENUIDENT, MO_ProcessCommandByMenuIdent);
CreateServiceFunction(MO_PROCESSHOTKEYS, (MIRANDASERVICE)MO_ProcessHotKeys);
- CreateServiceFunction(MO_REMOVEMENUOBJECT, MO_RemoveMenuObject);
bIconsDisabled = db_get_b(NULL, "CList", "DisableMenuIcons", 0) != 0;
diff --git a/src/mir_app/src/genmenu.h b/src/mir_app/src/genmenu.h
index 0c5f3cd0d2..7ae31f8b25 100644
--- a/src/mir_app/src/genmenu.h
+++ b/src/mir_app/src/genmenu.h
@@ -101,21 +101,17 @@ extern LIST<TIntMenuObject> g_menus;
#define SEPARATORPOSITIONINTERVAL 100000
-//internal usage
-HMENU BuildRecursiveMenu(HMENU hMenu, TMO_IntMenuItem*, ListParam *param);
+// internal usage
void GetMenuItemName(TMO_IntMenuItem *pMenuItem, char* pszDest, size_t cbDestSize);
TMO_IntMenuItem* MO_GetIntMenuItem(HGENMENU);
-TMO_IntMenuItem* MO_AddNewMenuItem(HANDLE menuobjecthandle, TMO_MenuItem *pmi);
TMO_IntMenuItem* MO_AddOldNewMenuItem(HANDLE menuobjecthandle, TMO_MenuItem *pmi);
int MO_DrawMenuItem(LPDRAWITEMSTRUCT dis);
int MO_MeasureMenuItem(LPMEASUREITEMSTRUCT mis);
-int MO_ProcessCommand(TMO_IntMenuItem *pimi, LPARAM lParam);
INT_PTR MO_ProcessHotKeys(HANDLE menuHandle, INT_PTR vKey);
-INT_PTR MO_ProcessCommandByMenuIdent(WPARAM wParam, LPARAM lParam);
int MO_ProcessCommandBySubMenuIdent(int menuID, int command, LPARAM lParam);
// function returns TRUE if the walk should be immediately stopped
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def
index e8e029f9e7..f54b171e6c 100644
--- a/src/mir_app/src/mir_app.def
+++ b/src/mir_app/src/mir_app.def
@@ -205,3 +205,10 @@ Menu_ModifyItem @202
Menu_ConfigureItem @203
Menu_GetProtocolRoot @204
Menu_ConfigureObject @205
+Menu_Build @206
+Menu_ProcessCommand @207
+Menu_ProcessCommandById @208
+Menu_AddItem @209
+Menu_RemoveItem @210
+Menu_AddObject @211
+Menu_RemoveObject @212
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def
index e1114580b8..c97bd514b1 100644
--- a/src/mir_app/src/mir_app64.def
+++ b/src/mir_app/src/mir_app64.def
@@ -205,3 +205,10 @@ Menu_ModifyItem @202
Menu_ConfigureItem @203
Menu_GetProtocolRoot @204
Menu_ConfigureObject @205
+Menu_Build @206
+Menu_ProcessCommand @207
+Menu_ProcessCommandById @208
+Menu_AddItem @209
+Menu_RemoveItem @210
+Menu_AddObject @211
+Menu_RemoveObject @212
diff --git a/src/mir_app/src/movetogroup.cpp b/src/mir_app/src/movetogroup.cpp
index 75b9a66dff..ba995132c8 100644
--- a/src/mir_app/src/movetogroup.cpp
+++ b/src/mir_app/src/movetogroup.cpp
@@ -98,7 +98,7 @@ static int OnContactMenuBuild(WPARAM wParam, LPARAM)
}
for (i=0; i < lphGroupsItems.getCount(); i++)
- CallService(MO_REMOVEMENUITEM, (WPARAM)lphGroupsItems[i], 0);
+ Menu_RemoveItem((HGENMENU)lphGroupsItems[i]);
lphGroupsItems.destroy();
ptrT szContactGroup(db_get_tsa(wParam, "CList", "Group"));