summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-12-16 16:07:54 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-12-16 16:07:54 +0000
commit3abd733254c02e2ca2c9bcc7fbbd1417c4a8ff74 (patch)
treef797b88d7a3c6993d447ac35b240a20fee4186b7
parentcaf5e0116248d00c0b6beaed6e4e7817a0158fbb (diff)
- new menu object helpers (MO_CreateMenuObject, MO_SetMenuObjectParam);
- menu item display names are now translatable; - old nasty pieces of junk removed in CLUIFrames/cluiframes.cpp git-svn-id: http://svn.miranda-ng.org/main/trunk@7247 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--include/m_genmenu.h91
-rw-r--r--plugins/Clist_modern/src/hdr/modern_cluiframes.h6
-rw-r--r--plugins/Clist_modern/src/hdr/modern_commonprototypes.h2
-rw-r--r--plugins/Clist_modern/src/modern_clisttray.cpp27
-rw-r--r--plugins/Clist_modern/src/modern_cluiframes.cpp8
-rw-r--r--plugins/Clist_modern/src/modern_framesmenu.cpp70
-rw-r--r--plugins/Clist_modern/src/modern_groupmenu.cpp63
-rw-r--r--plugins/Clist_mw/src/CLUIFrames/cluiframes.cpp11
-rw-r--r--plugins/Clist_mw/src/CLUIFrames/cluiframes.h9
-rw-r--r--plugins/Clist_mw/src/CLUIFrames/framesmenu.cpp98
-rw-r--r--plugins/Clist_mw/src/clisttray.cpp28
-rw-r--r--plugins/Clist_mw/src/groupmenu.cpp63
-rw-r--r--plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp17
-rw-r--r--plugins/Clist_nicer/src/CLUIFrames/cluiframes.h6
-rw-r--r--plugins/Clist_nicer/src/CLUIFrames/framesmenu.cpp93
-rw-r--r--plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp64
-rw-r--r--plugins/MirOTR/MirOTR/src/mirotrmenu.cpp28
-rw-r--r--protocols/Gadu-Gadu/src/gg.cpp10
-rw-r--r--protocols/Gadu-Gadu/src/gg.h1
-rw-r--r--protocols/Gadu-Gadu/src/links.cpp36
-rw-r--r--protocols/JabberG/src/jabber_menu.cpp3
-rw-r--r--protocols/Skype/src/skype_menus.cpp4
-rw-r--r--src/modules/clist/clistmenus.cpp31
-rw-r--r--src/modules/clist/genmenu.cpp28
-rw-r--r--src/modules/clist/genmenu.h13
-rw-r--r--src/modules/clist/genmenuopt.cpp6
26 files changed, 177 insertions, 639 deletions
diff --git a/include/m_genmenu.h b/include/m_genmenu.h
index ef05806534..d26e539c2a 100644
--- a/include/m_genmenu.h
+++ b/include/m_genmenu.h
@@ -249,31 +249,6 @@ typedef struct
}
TCheckProcParam,*PCheckProcParam;
-typedef struct
-{
- int cbSize;
- char *name;
-
- /*
- This service called when module build menu(MO_BUILDMENU).
- Service called with params
-
- wparam=PCheckProcParam
- lparam=0
- if return==FALSE item is skiped.
- */
- char *CheckService;
-
- /*
- This service called when user select menu item.
- Service called with params
- wparam=ownerdata
- lparam=lParam from MO_PROCESSCOMMAND
- */
- char *ExecService;//called when processmenuitem called
-}
- TMenuParam,*PMenuParam;
-
//used in MO_BUILDMENU
typedef struct tagListParam
{
@@ -309,20 +284,6 @@ typedef struct
//and call MO_PROCESSCOMMAND
#define MO_PROCESSCOMMANDBYMENUIDENT "MO/ProcessCommandByMenuIdent"
-
-//wparam=0;
-//lparam=PMenuParam;
-//returns=MenuObjectHandle on success,-1 on failure
-#define MO_CREATENEWMENUOBJECT "MO/CreateNewMenuObject"
-
-//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"
-
-
//wparam=MenuItemHandle
//lparam=0
//returns 0 on success,-1 on failure.
@@ -382,6 +343,39 @@ typedef struct
//enable ability user to edit menuitems via options page.
#define OPT_USERDEFINEDITEMS 1
+// szName = unique menu object identifier
+// szDisplayName = menu display name (auto-translated by core)
+// szCheckService = this service called when module build menu(MO_BUILDMENU).
+// Service is called with params wparam = PCheckProcParam, lparam = 0
+// if service returns FALSE, item is skipped.
+// 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
+
+struct TMenuParam
+{
+ int cbSize;
+ LPCSTR name, CheckService, ExecService;
+};
+
+__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);
+}
+
+//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"
+
+// wparam=0
+// lparam=*lpOptParam
+// returns TRUE if it processed the command, FALSE otherwise
+#define MO_SRV_SETOPTIONSMENUOBJECT "MO/SetOptionsMenuObject"
typedef struct tagOptParam
{
@@ -391,21 +385,26 @@ typedef struct tagOptParam
}
OptParam,*lpOptParam;
-//wparam=0
-//lparam=*lpOptParam
-//returns TRUE if it processed the command, FALSE otherwise
-#define MO_SETOPTIONSMENUOBJECT "MO/SetOptionsMenuObject"
-
+__forceinline void MO_SetMenuObjectParam(HANDLE hMenu, int iSetting, INT_PTR iValue)
+{
+ OptParam param = { hMenu, iSetting, iValue };
+ CallService(MO_SRV_SETOPTIONSMENUOBJECT, 0, (LPARAM)&param);
+}
+__forceinline void MO_SetMenuObjectParam(HANDLE hMenu, int iSetting, LPCSTR pszValue)
+{
+ OptParam param = { hMenu, iSetting, (INT_PTR)pszValue };
+ CallService(MO_SRV_SETOPTIONSMENUOBJECT, 0, (LPARAM)&param);
+}
//wparam=0
//lparam=*lpOptParam
//returns TRUE if it processed the command, FALSE otherwise
-#define MO_SETOPTIONSMENUITEM "MO/SetOptionsMenuItem"
+#define MO_SETOPTIONSMENUITEM "MO/SetOptionsMenuItem"
//wparam=char* szProtoName
//lparam=0
//returns HGENMENU of the root item or NULL
-#define MO_GETPROTOROOTMENU "MO/GetProtoRootMenu"
+#define MO_GETPROTOROOTMENU "MO/GetProtoRootMenu"
__forceinline HGENMENU MO_GetProtoRootMenu( const char* szProtoName )
{
diff --git a/plugins/Clist_modern/src/hdr/modern_cluiframes.h b/plugins/Clist_modern/src/hdr/modern_cluiframes.h
index f4cc677610..75bf89a8bd 100644
--- a/plugins/Clist_modern/src/hdr/modern_cluiframes.h
+++ b/plugins/Clist_modern/src/hdr/modern_cluiframes.h
@@ -136,12 +136,6 @@ struct FRAMEWND
#define CLUIFrameTitleBarClassName _T("CLUIFrameTitleBar")
#define CLUIFrameModule "CLUIFrames"
-//integrated menu module
-#define MS_INT_MENUMEASUREITEM "CLUIFrames/IntMenuMeasureItem"
-#define MS_INT_MENUDRAWITEM "CLUIFrames/IntMenuDrawItem"
-#define MS_INT_MENUPROCESSCOMMAND "CLUIFrames/IntMenuProcessCommand"
-#define MS_INT_MODIFYMENUITEM "CLUIFrames/IntModifyMenuItem"
-
#endif
diff --git a/plugins/Clist_modern/src/hdr/modern_commonprototypes.h b/plugins/Clist_modern/src/hdr/modern_commonprototypes.h
index 785c9a7160..328552b6ce 100644
--- a/plugins/Clist_modern/src/hdr/modern_commonprototypes.h
+++ b/plugins/Clist_modern/src/hdr/modern_commonprototypes.h
@@ -227,9 +227,7 @@ int LoadStatusBarData(); //mo
int MenuModulesLoaded(WPARAM wParam,LPARAM lParam); //clistmenu.c
int MenuModulesShutdown(WPARAM wParam,LPARAM lParam); //clistmenu.c
int MenuProcessCommand(WPARAM wParam,LPARAM lParam); //clistmenu.c
-int ModifyMenuItemProxy(WPARAM wParam,LPARAM lParam); //framesmenu.c
int OnFrameTitleBarBackgroundChange(WPARAM wParam,LPARAM lParam); //cluiframes.c
-int ProcessCommandProxy(WPARAM wParam,LPARAM lParam); //framesmenu.c
int QueueAllFramesUpdating (BYTE); //cluiframes.c
int RecursiveDeleteMenu(HMENU hMenu); //clistmenus.c
int ModernSkinButtonRedrawAll(HDC hdc); //modern_button.c
diff --git a/plugins/Clist_modern/src/modern_clisttray.cpp b/plugins/Clist_modern/src/modern_clisttray.cpp
index b221df94ca..a5ff7ee804 100644
--- a/plugins/Clist_modern/src/modern_clisttray.cpp
+++ b/plugins/Clist_modern/src/modern_clisttray.cpp
@@ -506,28 +506,11 @@ void InitTrayMenus(void)
CreateServiceFunction(MS_CLIST_REMOVETRAYMENUITEM,RemoveTrayMenuItem);
CreateServiceFunction(MS_CLIST_MENUBUILDTRAY,BuildTrayMenu);
- //Tray menu
- TMenuParam tmp = { sizeof(tmp) };
- tmp.CheckService = NULL;
- tmp.ExecService = "CLISTMENUSTRAY/ExecService";
- tmp.name = "TrayMenu";
- hTrayMenuObject = (HANDLE)CallService(MO_CREATENEWMENUOBJECT, 0, (LPARAM)&tmp);
-
- OptParam op;
- op.Handle = hTrayMenuObject;
- op.Setting = OPT_USERDEFINEDITEMS;
- op.Value = TRUE;
- CallService(MO_SETOPTIONSMENUOBJECT, 0, (LPARAM)&op);
-
- op.Handle = hTrayMenuObject;
- op.Setting = OPT_MENUOBJECT_SET_FREE_SERVICE;
- op.Value = (INT_PTR)"CLISTMENUSTRAY/FreeOwnerDataTrayMenu";
- CallService(MO_SETOPTIONSMENUOBJECT, 0, (LPARAM)&op);
-
- op.Handle = hTrayMenuObject;
- op.Setting = OPT_MENUOBJECT_SET_ONADD_SERVICE;
- op.Value = (INT_PTR)"CLISTMENUSTRAY/TrayMenuonAddService";
- CallService(MO_SETOPTIONSMENUOBJECT, 0, (LPARAM)&op);
+ // Tray menu
+ hTrayMenuObject = MO_CreateMenuObject("TrayMenu", LPGEN("Tray menu"), 0, "CLISTMENUSTRAY/ExecService");
+ MO_SetMenuObjectParam(hTrayMenuObject, OPT_USERDEFINEDITEMS, TRUE);
+ MO_SetMenuObjectParam(hTrayMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, "CLISTMENUSTRAY/FreeOwnerDataTrayMenu");
+ MO_SetMenuObjectParam(hTrayMenuObject, OPT_MENUOBJECT_SET_ONADD_SERVICE, "CLISTMENUSTRAY/TrayMenuonAddService");
//add exit command to menu
CLISTMENUITEM mi = { sizeof(mi) };
diff --git a/plugins/Clist_modern/src/modern_cluiframes.cpp b/plugins/Clist_modern/src/modern_cluiframes.cpp
index b265a0afee..d034d3aa89 100644
--- a/plugins/Clist_modern/src/modern_cluiframes.cpp
+++ b/plugins/Clist_modern/src/modern_cluiframes.cpp
@@ -982,7 +982,7 @@ static int ModifyMItem(WPARAM wParam,LPARAM lParam)
{
if ((int)wParam == -1 ) return 0; // FIXME
- return ModifyMenuItemProxy(wParam,lParam);
+ return CallService(MS_CLIST_MODIFYMENUITEM, wParam, lParam);
};
@@ -2959,11 +2959,7 @@ static LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam
return 1;
case WM_COMMAND:
- if ( ServiceExists(MO_CREATENEWMENUOBJECT)) {
- if ( ProcessCommandProxy(MAKEWPARAM(LOWORD(wParam),0), (LPARAM)Frameid))
- break;
- }
- else if ( CallService(MS_CLIST_MENUPROCESSCOMMAND,MAKEWPARAM(LOWORD(wParam),MPCF_CONTEXTFRAMEMENU),(LPARAM)Frameid))
+ if ( CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam),0), Frameid))
break;
if (HIWORD(wParam) == 0) {//mouse events for self created menu
diff --git a/plugins/Clist_modern/src/modern_framesmenu.cpp b/plugins/Clist_modern/src/modern_framesmenu.cpp
index bb46b58083..cdd132569d 100644
--- a/plugins/Clist_modern/src/modern_framesmenu.cpp
+++ b/plugins/Clist_modern/src/modern_framesmenu.cpp
@@ -102,71 +102,19 @@ static INT_PTR BuildContextFrameMenu(WPARAM wParam,LPARAM lParam)
}
//========================== Frames end
-bool InternalGenMenuModule = FALSE;
-
-int MeasureItemProxy(WPARAM wParam, LPARAM lParam)
-{
- if (InternalGenMenuModule) {
- int val = CallService(MS_INT_MENUMEASUREITEM, wParam, lParam);
- if (val)
- return val;
- }
- return CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam);
-}
-
-int DrawItemProxy(WPARAM wParam, LPARAM lParam)
-{
- if (InternalGenMenuModule) {
- int val = CallService(MS_INT_MENUDRAWITEM, wParam, lParam);
- if (val)
- return val;
- }
- return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);
-}
-
-int ProcessCommandProxy(WPARAM wParam, LPARAM lParam)
-{
- if (InternalGenMenuModule) {
- int val = CallService(MS_INT_MENUPROCESSCOMMAND, wParam, lParam);
- if (val)
- return val;
- }
- return CallService(MS_CLIST_MENUPROCESSCOMMAND,wParam,lParam);
-}
-
-int ModifyMenuItemProxy(WPARAM wParam, LPARAM lParam)
-{
- if (InternalGenMenuModule) {
- int val = CallService(MS_INT_MODIFYMENUITEM, wParam, lParam);
- if (val)
- return val;
- }
- return CallService(MS_CLIST_MODIFYMENUITEM,wParam,lParam);
-}
int InitFramesMenus(void)
{
- if ( !ServiceExists(MO_REMOVEMENUOBJECT)) {
- InitCustomMenus();
- InternalGenMenuModule = TRUE;
- }
+ CreateServiceFunction("FrameMenuExecService",FrameMenuExecService);
+ CreateServiceFunction("FrameMenuCheckService",FrameMenuCheckService);
- if ( ServiceExists(MO_REMOVEMENUOBJECT)) {
- CreateServiceFunction("FrameMenuExecService",FrameMenuExecService);
- CreateServiceFunction("FrameMenuCheckService",FrameMenuCheckService);
-
- CreateServiceFunction(MS_CLIST_REMOVECONTEXTFRAMEMENUITEM,RemoveContextFrameMenuItem);
- CreateServiceFunction("CList/AddContextFrameMenuItem",AddContextFrameMenuItem);
- CreateServiceFunction(MS_CLIST_MENUBUILDFRAMECONTEXT,BuildContextFrameMenu);
- CreateServiceFunction(MS_CLIST_FRAMEMENUNOTIFY,ContextFrameMenuNotify);
-
- //frame menu object
- TMenuParam tmp = { sizeof(tmp) };
- tmp.CheckService = "FrameMenuCheckService";
- tmp.ExecService = "FrameMenuExecService";
- tmp.name = "FrameMenu";
- hFrameMenuObject = (HANDLE)CallService(MO_CREATENEWMENUOBJECT, 0, (LPARAM)&tmp);
- }
+ CreateServiceFunction(MS_CLIST_REMOVECONTEXTFRAMEMENUITEM,RemoveContextFrameMenuItem);
+ CreateServiceFunction("CList/AddContextFrameMenuItem",AddContextFrameMenuItem);
+ CreateServiceFunction(MS_CLIST_MENUBUILDFRAMECONTEXT,BuildContextFrameMenu);
+ CreateServiceFunction(MS_CLIST_FRAMEMENUNOTIFY,ContextFrameMenuNotify);
+
+ // frame menu object
+ hFrameMenuObject = MO_CreateMenuObject("FrameMenu", LPGEN("Frame menu"), "FrameMenuCheckService", "FrameMenuExecService");
return 0;
}
diff --git a/plugins/Clist_modern/src/modern_groupmenu.cpp b/plugins/Clist_modern/src/modern_groupmenu.cpp
index 27c797bcc8..4f0741b5c9 100644
--- a/plugins/Clist_modern/src/modern_groupmenu.cpp
+++ b/plugins/Clist_modern/src/modern_groupmenu.cpp
@@ -265,28 +265,11 @@ void GroupMenus_Init(void)
InitSubGroupMenus();
- //Group menu
- TMenuParam tmp = { sizeof(tmp) };
- tmp.CheckService = NULL;
- tmp.ExecService = "CLISTMENUSGroup/ExecService";
- tmp.name = LPGEN("GroupMenu");
- hGroupMenuObject = (HANDLE)CallService(MO_CREATENEWMENUOBJECT, 0, (LPARAM)&tmp);
-
- OptParam op;
- op.Handle = hGroupMenuObject;
- op.Setting = OPT_USERDEFINEDITEMS;
- op.Value = TRUE;
- CallService(MO_SETOPTIONSMENUOBJECT, 0, (LPARAM)&op);
-
- op.Handle = hGroupMenuObject;
- op.Setting = OPT_MENUOBJECT_SET_FREE_SERVICE;
- op.Value = (INT_PTR)"CLISTMENUSGroup/FreeOwnerDataGroupMenu";
- CallService(MO_SETOPTIONSMENUOBJECT, 0, (LPARAM)&op);
-
- op.Handle = hGroupMenuObject;
- op.Setting = OPT_MENUOBJECT_SET_ONADD_SERVICE;
- op.Value = (INT_PTR)"CLISTMENUSGroup/GroupMenuonAddService";
- CallService(MO_SETOPTIONSMENUOBJECT, 0, (LPARAM)&op);
+ // Group menu
+ hGroupMenuObject = MO_CreateMenuObject("GroupMenu", LPGEN("Group menu"), 0, "CLISTMENUSGroup/ExecService");
+ MO_SetMenuObjectParam(hGroupMenuObject, OPT_USERDEFINEDITEMS, TRUE);
+ MO_SetMenuObjectParam(hGroupMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, "CLISTMENUSGroup/FreeOwnerDataGroupMenu");
+ MO_SetMenuObjectParam(hGroupMenuObject, OPT_MENUOBJECT_SET_ONADD_SERVICE, "CLISTMENUSGroup/GroupMenuonAddService");
//add exit command to menu
GroupMenuParam gmp;
@@ -536,8 +519,6 @@ INT_PTR GroupMenuExecProxy(WPARAM wParam,LPARAM lParam)
void InitSubGroupMenus(void)
{
- OptParam op;
-
CreateServiceFunction("CLISTMENUSSubGroup/ExecService",SubGroupMenuExecService);
CreateServiceFunction("CLISTMENUSSubGroup/FreeOwnerDataSubGroupMenu",FreeOwnerDataSubGroupMenu);
CreateServiceFunction("CLISTMENUSSubGroup/SubGroupMenuonAddService",SubGroupMenuonAddService);
@@ -550,34 +531,14 @@ void InitSubGroupMenus(void)
HookEvent(ME_CLIST_PREBUILDSUBGROUPMENU,OnBuildSubGroupMenu);
- //SubGroup menu
- TMenuParam tmp = { sizeof(tmp) };
- tmp.CheckService = NULL;
- tmp.ExecService = "CLISTMENUSSubGroup/ExecService";
- tmp.name = LPGEN("SubGroupMenu");
- hSubGroupMenuObject = (HANDLE)CallService(MO_CREATENEWMENUOBJECT, 0, (LPARAM)&tmp);
-
- op.Handle = hSubGroupMenuObject;
- op.Setting = OPT_USERDEFINEDITEMS;
- op.Value = TRUE;
- CallService(MO_SETOPTIONSMENUOBJECT, 0, (LPARAM)&op);
-
- op.Handle = hSubGroupMenuObject;
- op.Setting = OPT_MENUOBJECT_SET_FREE_SERVICE;
- op.Value = (INT_PTR)"CLISTMENUSSubGroup/FreeOwnerDataSubGroupMenu";
- CallService(MO_SETOPTIONSMENUOBJECT, 0, (LPARAM)&op);
-
- op.Handle = hSubGroupMenuObject;
- op.Setting = OPT_MENUOBJECT_SET_ONADD_SERVICE;
- op.Value = (INT_PTR)"CLISTMENUSSubGroup/SubGroupMenuonAddService";
- CallService(MO_SETOPTIONSMENUOBJECT, 0, (LPARAM)&op);
-
- op.Handle = hSubGroupMenuObject;
- op.Setting = OPT_MENUOBJECT_SET_CHECK_SERVICE;
- op.Value = (INT_PTR)"CLISTMENUSSubGroup/SubGroupMenuCheckService";
- CallService(MO_SETOPTIONSMENUOBJECT, 0, (LPARAM)&op);
+ // SubGroup menu
+ hSubGroupMenuObject = MO_CreateMenuObject("SubGroupMenu", LPGEN("Subgroup menu"), 0, "CLISTMENUSSubGroup/ExecService");
+ MO_SetMenuObjectParam(hSubGroupMenuObject, OPT_USERDEFINEDITEMS, TRUE);
+ MO_SetMenuObjectParam(hSubGroupMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, "CLISTMENUSSubGroup/FreeOwnerDataSubGroupMenu");
+ MO_SetMenuObjectParam(hSubGroupMenuObject, OPT_MENUOBJECT_SET_ONADD_SERVICE, "CLISTMENUSSubGroup/SubGroupMenuonAddService");
+ MO_SetMenuObjectParam(hSubGroupMenuObject, OPT_MENUOBJECT_SET_CHECK_SERVICE, "CLISTMENUSSubGroup/SubGroupMenuCheckService");
- //add exit command to menu
+ // add exit command to menu
GroupMenuParam gmp;
CLISTMENUITEM mi = { sizeof(mi) };
diff --git a/plugins/Clist_mw/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_mw/src/CLUIFrames/cluiframes.cpp
index 5374b67ae1..a624ec563f 100644
--- a/plugins/Clist_mw/src/CLUIFrames/cluiframes.cpp
+++ b/plugins/Clist_mw/src/CLUIFrames/cluiframes.cpp
@@ -36,11 +36,9 @@ extern HINSTANCE g_hInst;
#define frame_menu_visible 2
#define frame_menu_showtitlebar 3
#define frame_menu_floating 4
-extern int ModifyMenuItemProxy(WPARAM wParam,LPARAM lParam);
static int UpdateTBToolTip(int framepos);
INT_PTR CLUIFrameSetFloat(WPARAM wParam,LPARAM lParam);
int CLUIFrameResizeFloatingFrame(int framepos);
-extern int ProcessCommandProxy(WPARAM wParam,LPARAM lParam);
extern int InitFramesMenus(void);
int GapBetweenTitlebar;
@@ -796,7 +794,7 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid,int root,int popuppos,HGENMENU (*
INT_PTR ModifyMItem(WPARAM wParam,LPARAM lParam)
{
- return ModifyMenuItemProxy(wParam,lParam);
+ return CallService(MS_CLIST_MODIFYMENUITEM, wParam, lParam);
}
static int CLUIFramesModifyContextMenuForFrame(WPARAM wParam,LPARAM lParam)
@@ -2168,13 +2166,10 @@ LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA
return 0;
case WM_COMMAND:
- if ( ServiceExists(MO_CREATENEWMENUOBJECT)) {
- if (ProcessCommandProxy(MAKEWPARAM(LOWORD(wParam),0),(LPARAM)Frameid)) break;
- }
- else if ( CallService(MS_CLIST_MENUPROCESSCOMMAND,MAKEWPARAM(LOWORD(wParam),MPCF_CONTEXTFRAMEMENU),(LPARAM)Frameid))
+ if ( CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam),0), Frameid))
break;
- if (HIWORD(wParam) == 0) {//mouse events for self created menu
+ if (HIWORD(wParam) == 0) { //mouse events for self created menu
int framepos = id2pos(Frameid);
if (framepos == -1)
break;
diff --git a/plugins/Clist_mw/src/CLUIFrames/cluiframes.h b/plugins/Clist_mw/src/CLUIFrames/cluiframes.h
index 6430c6655d..d36dff07da 100644
--- a/plugins/Clist_mw/src/CLUIFrames/cluiframes.h
+++ b/plugins/Clist_mw/src/CLUIFrames/cluiframes.h
@@ -33,12 +33,3 @@ typedef struct tagProtocolData {
#define CLUIFrameTitleBarClassName _T("CLUIFrameTitleBar")
#define CLUIFrameModule "CLUIFrames"
-
-//integrated menu module
-#define MS_INT_MENUMEASUREITEM "CLUIFrames/IntMenuMeasureItem"
-#define MS_INT_MENUDRAWITEM "CLUIFrames/IntMenuDrawItem"
-#define MS_INT_MENUPROCESSCOMMAND "CLUIFrames/IntMenuProcessCommand"
-#define MS_INT_MODIFYMENUITEM "CLUIFrames/IntModifyMenuItem"
-
-
-
diff --git a/plugins/Clist_mw/src/CLUIFrames/framesmenu.cpp b/plugins/Clist_mw/src/CLUIFrames/framesmenu.cpp
index f850143c20..4e94c8b75f 100644
--- a/plugins/Clist_mw/src/CLUIFrames/framesmenu.cpp
+++ b/plugins/Clist_mw/src/CLUIFrames/framesmenu.cpp
@@ -127,93 +127,21 @@ static INT_PTR BuildContextFrameMenu(WPARAM wParam,LPARAM lParam)
}
// == == == == == == == == == == == == == Frames end
-boolean InternalGenMenuModule = FALSE;
-
-int MeasureItemProxy(WPARAM wParam,LPARAM lParam)
-{
- int val;
- if (InternalGenMenuModule)
- {
- val = CallService(MS_INT_MENUMEASUREITEM,wParam,lParam);
- if (val) return(val);
- }
- return CallService(MS_CLIST_MENUMEASUREITEM,wParam,lParam);
-}
-
-int DrawItemProxy(WPARAM wParam,LPARAM lParam)
-{
- if (InternalGenMenuModule)
- {
- int val;
- val = CallService(MS_INT_MENUDRAWITEM,wParam,lParam);
- if (val) return(val);
- }
- return CallService(MS_CLIST_MENUDRAWITEM,wParam,lParam);
-}
-
-int ProcessCommandProxy(WPARAM wParam,LPARAM lParam)
-{
- if (InternalGenMenuModule)
- {
- int val;
- val = CallService(MS_INT_MENUPROCESSCOMMAND,wParam,lParam);
- if (val) return(val);
- }
-
- return CallService(MS_CLIST_MENUPROCESSCOMMAND,wParam,lParam);
-
-}
-
-int ModifyMenuItemProxy(WPARAM wParam,LPARAM lParam)
-{
- if (InternalGenMenuModule)
- {
- int val;
- val = CallService(MS_INT_MODIFYMENUITEM,wParam,lParam);
- if (val) return(val);
- }
-
- return CallService(MS_CLIST_MODIFYMENUITEM,wParam,lParam);
-}
int InitFramesMenus(void)
{
- TMenuParam tmp;
-
- if ( !ServiceExists(MO_REMOVEMENUOBJECT))
- {
-
- InitCustomMenus();
- InternalGenMenuModule = TRUE;
- }
-
- if (ServiceExists(MO_REMOVEMENUOBJECT))
- {
- CreateServiceFunction("FrameMenuExecService",FrameMenuExecService);
- CreateServiceFunction("FrameMenuCheckService",FrameMenuCheckService);
- CreateServiceFunction("FrameMenuFreeService",FreeOwnerDataFrameMenu);
-
-
- CreateServiceFunction(MS_CLIST_REMOVECONTEXTFRAMEMENUITEM,RemoveContextFrameMenuItem);
- CreateServiceFunction("CList/AddContextFrameMenuItem",AddContextFrameMenuItem);
- CreateServiceFunction(MS_CLIST_MENUBUILDFRAMECONTEXT,BuildContextFrameMenu);
- CreateServiceFunction(MS_CLIST_FRAMEMENUNOTIFY,ContextFrameMenuNotify);
- hPreBuildFrameMenuEvent = CreateHookableEvent(ME_CLIST_PREBUILDFRAMEMENU);
-
- //frame menu object
- memset(&tmp,0,sizeof(tmp));
- tmp.cbSize = sizeof(tmp);
- tmp.CheckService = "FrameMenuCheckService";
- tmp.ExecService = "FrameMenuExecService";
- tmp.name = "FrameMenu";
- hFrameMenuObject = (HANDLE)CallService(MO_CREATENEWMENUOBJECT,0,(LPARAM)&tmp);
- {
- OptParam op;
- op.Handle = hFrameMenuObject;
- op.Setting = OPT_MENUOBJECT_SET_FREE_SERVICE;
- op.Value = (INT_PTR)"FrameMenuFreeService";
- CallService(MO_SETOPTIONSMENUOBJECT,0,(LPARAM)&op);
- }
- }
+ CreateServiceFunction("FrameMenuExecService", FrameMenuExecService);
+ CreateServiceFunction("FrameMenuCheckService", FrameMenuCheckService);
+ CreateServiceFunction("FrameMenuFreeService", FreeOwnerDataFrameMenu);
+
+ CreateServiceFunction(MS_CLIST_REMOVECONTEXTFRAMEMENUITEM, RemoveContextFrameMenuItem);
+ CreateServiceFunction("CList/AddContextFrameMenuItem", AddContextFrameMenuItem);
+ CreateServiceFunction(MS_CLIST_MENUBUILDFRAMECONTEXT, BuildContextFrameMenu);
+ CreateServiceFunction(MS_CLIST_FRAMEMENUNOTIFY, ContextFrameMenuNotify);
+ hPreBuildFrameMenuEvent = CreateHookableEvent(ME_CLIST_PREBUILDFRAMEMENU);
+
+ // frame menu object
+ hFrameMenuObject = MO_CreateMenuObject("FrameMenu", LPGEN("Frame menu"), "FrameMenuCheckService", "FrameMenuExecService");
+ MO_SetMenuObjectParam(hFrameMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, "FrameMenuFreeService");
return 0;
}
diff --git a/plugins/Clist_mw/src/clisttray.cpp b/plugins/Clist_mw/src/clisttray.cpp
index de61524292..ddfcb22811 100644
--- a/plugins/Clist_mw/src/clisttray.cpp
+++ b/plugins/Clist_mw/src/clisttray.cpp
@@ -192,16 +192,11 @@ INT_PTR FreeOwnerDataTrayMenu (WPARAM wParam,LPARAM lParam)
void InitTrayMenus(void)
{
- TMenuParam tmp;
- OptParam op;
-
//Tray menu
- memset(&tmp,0,sizeof(tmp));
- tmp.cbSize = sizeof(tmp);
- tmp.CheckService = NULL;
- tmp.ExecService = "CLISTMENUSTRAY/ExecService";
- tmp.name = "TrayMenu";
- hTrayMenuObject = (HANDLE)CallService(MO_CREATENEWMENUOBJECT,0,(LPARAM)&tmp);
+ hTrayMenuObject = MO_CreateMenuObject("TrayMenu", LPGEN("Tray menu"), 0, "CLISTMENUSTRAY/ExecService");
+ MO_SetMenuObjectParam(hTrayMenuObject, OPT_USERDEFINEDITEMS, TRUE);
+ MO_SetMenuObjectParam(hTrayMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, "CLISTMENUSTRAY/FreeOwnerDataTrayMenu");
+ MO_SetMenuObjectParam(hTrayMenuObject, OPT_MENUOBJECT_SET_ONADD_SERVICE, "CLISTMENUSTRAY/TrayMenuonAddService");
CreateServiceFunction("CLISTMENUSTRAY/ExecService",TrayMenuExecService);
CreateServiceFunction("CLISTMENUSTRAY/FreeOwnerDataTrayMenu",FreeOwnerDataTrayMenu);
@@ -212,21 +207,6 @@ void InitTrayMenus(void)
CreateServiceFunction(MS_CLIST_MENUBUILDTRAY,BuildTrayMenu);
hPreBuildTrayMenuEvent = CreateHookableEvent(ME_CLIST_PREBUILDTRAYMENU);
- op.Handle = hTrayMenuObject;
- op.Setting = OPT_USERDEFINEDITEMS;
- op.Value = TRUE;
- CallService(MO_SETOPTIONSMENUOBJECT,0,(LPARAM)&op);
-
- op.Handle = hTrayMenuObject;
- op.Setting = OPT_MENUOBJECT_SET_FREE_SERVICE;
- op.Value = (INT_PTR)"CLISTMENUSTRAY/FreeOwnerDataTrayMenu";
- CallService(MO_SETOPTIONSMENUOBJECT,0,(LPARAM)&op);
-
- op.Handle = hTrayMenuObject;
- op.Setting = OPT_MENUOBJECT_SET_ONADD_SERVICE;
- op.Value = (INT_PTR)"CLISTMENUSTRAY/TrayMenuonAddService";
- CallService(MO_SETOPTIONSMENUOBJECT,0,(LPARAM)&op);
-
//add exit command to menu
CLISTMENUITEM mi = { sizeof(mi) };
mi.position = 900000;
diff --git a/plugins/Clist_mw/src/groupmenu.cpp b/plugins/Clist_mw/src/groupmenu.cpp
index 7d57aae318..ba13c66479 100644
--- a/plugins/Clist_mw/src/groupmenu.cpp
+++ b/plugins/Clist_mw/src/groupmenu.cpp
@@ -235,10 +235,7 @@ int static OnIconLibIconChanged(WPARAM wParam,LPARAM lParam)
void InitGroupMenus(void)
{
- TMenuParam tmp;
- OptParam op;
- HICON hicon;
- hicon = LoadIconFromExternalFile("clisticons.dll",2,TRUE,TRUE,"NewGroup","Contact List","New Group",-IDI_NEWGROUP2,0);
+ HICON hicon = LoadIconFromExternalFile("clisticons.dll",2,TRUE,TRUE,"NewGroup","Contact List","New Group",-IDI_NEWGROUP2,0);
NewGroupIconidx = ImageList_AddIcon(hCListImages,hicon );
CreateServiceFunction("CLISTMENUSGroup/ExecService",GroupMenuExecService);
@@ -256,30 +253,11 @@ void InitGroupMenus(void)
InitSubGroupMenus();
- //Group menu
- memset(&tmp,0,sizeof(tmp));
- tmp.cbSize = sizeof(tmp);
- tmp.CheckService = NULL;
- tmp.ExecService = "CLISTMENUSGroup/ExecService";
- tmp.name = "Group Menu";
- hGroupMenuObject = (HANDLE)CallService(MO_CREATENEWMENUOBJECT,0,(LPARAM)&tmp);
-
-
- op.Handle = hGroupMenuObject;
- op.Setting = OPT_USERDEFINEDITEMS;
- op.Value = TRUE;
- CallService(MO_SETOPTIONSMENUOBJECT,0,(LPARAM)&op);
-
- op.Handle = hGroupMenuObject;
- op.Setting = OPT_MENUOBJECT_SET_FREE_SERVICE;
- op.Value = (INT_PTR)"CLISTMENUSGroup/FreeOwnerDataGroupMenu";
- CallService(MO_SETOPTIONSMENUOBJECT,0,(LPARAM)&op);
-
- op.Handle = hGroupMenuObject;
- op.Setting = OPT_MENUOBJECT_SET_ONADD_SERVICE;
- op.Value = (INT_PTR)"CLISTMENUSGroup/GroupMenuonAddService";
- CallService(MO_SETOPTIONSMENUOBJECT,0,(LPARAM)&op);
-
+ // Group menu
+ hGroupMenuObject = MO_CreateMenuObject("GroupMenu", LPGEN("Group menu"), 0, "CLISTMENUSGroup/ExecService");
+ MO_SetMenuObjectParam(hGroupMenuObject, OPT_USERDEFINEDITEMS, TRUE);
+ MO_SetMenuObjectParam(hGroupMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, "CLISTMENUSGroup/FreeOwnerDataGroupMenu");
+ MO_SetMenuObjectParam(hGroupMenuObject, OPT_MENUOBJECT_SET_ONADD_SERVICE, "CLISTMENUSGroup/GroupMenuonAddService");
{
//add exit command to menu
GroupMenuParam gmp;
@@ -530,9 +508,6 @@ INT_PTR GroupMenuExecProxy(WPARAM wParam,LPARAM lParam)
void InitSubGroupMenus(void)
{
- TMenuParam tmp;
- OptParam op;
-
CreateServiceFunction("CLISTMENUSSubGroup/ExecService",SubGroupMenuExecService);
CreateServiceFunction("CLISTMENUSSubGroup/FreeOwnerDataSubGroupMenu",FreeOwnerDataSubGroupMenu);
CreateServiceFunction("CLISTMENUSSubGroup/SubGroupMenuonAddService",SubGroupMenuonAddService);
@@ -545,28 +520,10 @@ void InitSubGroupMenus(void)
HookEvent(ME_CLIST_PREBUILDSUBGROUPMENU,OnBuildSubGroupMenu);
//SubGroup menu
- memset(&tmp,0,sizeof(tmp));
- tmp.cbSize = sizeof(tmp);
- tmp.CheckService = NULL;
- tmp.ExecService = "CLISTMENUSSubGroup/ExecService";
- tmp.name = "SubGroupMenu";
- hSubGroupMenuObject = (HANDLE)CallService(MO_CREATENEWMENUOBJECT,0,(LPARAM)&tmp);
-
-
- op.Handle = hSubGroupMenuObject;
- op.Setting = OPT_USERDEFINEDITEMS;
- op.Value = TRUE;
- CallService(MO_SETOPTIONSMENUOBJECT,0,(LPARAM)&op);
-
- op.Handle = hSubGroupMenuObject;
- op.Setting = OPT_MENUOBJECT_SET_FREE_SERVICE;
- op.Value = (INT_PTR)"CLISTMENUSSubGroup/FreeOwnerDataSubGroupMenu";
- CallService(MO_SETOPTIONSMENUOBJECT,0,(LPARAM)&op);
-
- op.Handle = hSubGroupMenuObject;
- op.Setting = OPT_MENUOBJECT_SET_ONADD_SERVICE;
- op.Value = (INT_PTR)"CLISTMENUSSubGroup/SubGroupMenuonAddService";
- CallService(MO_SETOPTIONSMENUOBJECT,0,(LPARAM)&op);
+ hSubGroupMenuObject = MO_CreateMenuObject("SubGroupMenu", LPGEN("Subgroup menu"), 0, "CLISTMENUSSubGroup/ExecService");
+ MO_SetMenuObjectParam(hSubGroupMenuObject, OPT_USERDEFINEDITEMS, TRUE);
+ MO_SetMenuObjectParam(hSubGroupMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, "CLISTMENUSSubGroup/FreeOwnerDataSubGroupMenu");
+ MO_SetMenuObjectParam(hSubGroupMenuObject, OPT_MENUOBJECT_SET_ONADD_SERVICE, "CLISTMENUSSubGroup/SubGroupMenuonAddService");
//add exit command to menu
GroupMenuParam gmp;
diff --git a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp
index b0acb8a6e8..d4fe172364 100644
--- a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp
+++ b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp
@@ -54,11 +54,9 @@ extern HINSTANCE g_hInst;
#define frame_menu_floating 4
#define frame_menu_skinned 5
-extern INT_PTR ModifyMenuItemProxy(WPARAM wParam, LPARAM lParam);
static int UpdateTBToolTip(int framepos);
INT_PTR CLUIFrameSetFloat(WPARAM wParam, LPARAM lParam);
int CLUIFrameResizeFloatingFrame(int framepos);
-extern int ProcessCommandProxy(WPARAM wParam, LPARAM lParam);
extern int InitFramesMenus(void);
extern int UnitFramesMenu();
static int CLUIFramesReSort();
@@ -793,9 +791,8 @@ HMENU CLUIFramesCreateMenuForFrame(int frameid, int root, int popuppos, HGENMENU
int ModifyMItem(WPARAM wParam, LPARAM lParam)
{
- return ModifyMenuItemProxy(wParam, lParam);
-};
-
+ return CallService(MS_CLIST_MODIFYMENUITEM, wParam, lParam);
+}
static int CLUIFramesModifyContextMenuForFrame(WPARAM wParam, LPARAM lParam)
{
@@ -2568,14 +2565,8 @@ LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA
return 0;
case WM_COMMAND:
- if (ServiceExists(MO_CREATENEWMENUOBJECT)) {
- if (ProcessCommandProxy(MAKEWPARAM(LOWORD(wParam), 0), (LPARAM)Frameid))
- break;
- }
- else {
- if (CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTEXTFRAMEMENU), (LPARAM)Frameid))
- break;
- }
+ if ( CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), 0), Frameid))
+ break;
if (HIWORD(wParam) == 0) {//mouse events for self created menu
framepos = id2pos(Frameid);
diff --git a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.h b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.h
index 60caca8ab8..2c2375a351 100644
--- a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.h
+++ b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.h
@@ -36,12 +36,6 @@ typedef struct tagProtocolData {
#define CLUIFrameTitleBarClassName _T("CLUIFrameTitleBar")
#define CLUIFrameModule "CLUIFrames"
-//integrated menu module
-#define MS_INT_MENUMEASUREITEM "CLUIFrames/IntMenuMeasureItem"
-#define MS_INT_MENUDRAWITEM "CLUIFrames/IntMenuDrawItem"
-#define MS_INT_MENUPROCESSCOMMAND "CLUIFrames/IntMenuProcessCommand"
-#define MS_INT_MODIFYMENUITEM "CLUIFrames/IntModifyMenuItem"
-
typedef struct _DockOpt {
HWND hwndLeft;
HWND hwndRight;
diff --git a/plugins/Clist_nicer/src/CLUIFrames/framesmenu.cpp b/plugins/Clist_nicer/src/CLUIFrames/framesmenu.cpp
index 0d8161739c..79c00914fe 100644
--- a/plugins/Clist_nicer/src/CLUIFrames/framesmenu.cpp
+++ b/plugins/Clist_nicer/src/CLUIFrames/framesmenu.cpp
@@ -136,89 +136,22 @@ static INT_PTR BuildContextFrameMenu(WPARAM wParam,LPARAM lParam)
}
//==========================Frames end
-boolean InternalGenMenuModule=FALSE;
-
-INT_PTR MeasureItemProxy(WPARAM wParam,LPARAM lParam)
-{
- int val;
- if (InternalGenMenuModule)
- {
- val=CallService(MS_INT_MENUMEASUREITEM,wParam,lParam);
- if (val) return(val);
- }
-
- return CallService(MS_CLIST_MENUMEASUREITEM,wParam,lParam);
-}
-
-INT_PTR DrawItemProxy(WPARAM wParam,LPARAM lParam)
-{
- if (InternalGenMenuModule)
- {
- int val;
- val=CallService(MS_INT_MENUDRAWITEM,wParam,lParam);
- if (val) return(val);
- }
- return CallService(MS_CLIST_MENUDRAWITEM,wParam,lParam);
-}
-
-int ProcessCommandProxy(WPARAM wParam,LPARAM lParam)
-{
- if (InternalGenMenuModule) {
- int val;
- val=CallService(MS_INT_MENUPROCESSCOMMAND,wParam,lParam);
- if (val)
- return(val);
- }
- return CallService(MS_CLIST_MENUPROCESSCOMMAND,wParam,lParam);
-}
-
-INT_PTR ModifyMenuItemProxy(WPARAM wParam,LPARAM lParam)
-{
- if (InternalGenMenuModule)
- {
- int val;
- val=CallService(MS_INT_MODIFYMENUITEM,wParam,lParam);
- if (val) return(val);
- }
-
- return CallService(MS_CLIST_MODIFYMENUITEM,wParam,lParam);
-}
int InitFramesMenus(void)
{
- TMenuParam tmp;
-
- if ( !ServiceExists(MO_REMOVEMENUOBJECT))
- InternalGenMenuModule=TRUE;
-
- if (ServiceExists(MO_REMOVEMENUOBJECT))
- {
- CreateServiceFunction("FrameMenuExecService",FrameMenuExecService);
- CreateServiceFunction("FrameMenuCheckService",FrameMenuCheckService);
- CreateServiceFunction("FrameMenuFreeService",FreeOwnerDataFrameMenu);
-
-
- CreateServiceFunction(MS_CLIST_REMOVECONTEXTFRAMEMENUITEM,RemoveContextFrameMenuItem);
- CreateServiceFunction("CList/AddContextFrameMenuItem",AddContextFrameMenuItem);
- CreateServiceFunction(MS_CLIST_MENUBUILDFRAMECONTEXT,BuildContextFrameMenu);
- CreateServiceFunction(MS_CLIST_FRAMEMENUNOTIFY,ContextFrameMenuNotify);
- hPreBuildFrameMenuEvent=CreateHookableEvent(ME_CLIST_PREBUILDFRAMEMENU);
-
- //frame menu object
- memset(&tmp,0,sizeof(tmp));
- tmp.cbSize=sizeof(tmp);
- tmp.CheckService="FrameMenuCheckService";
- tmp.ExecService="FrameMenuExecService";
- tmp.name="Frames_Menu";
- hFrameMenuObject=(HANDLE)CallService(MO_CREATENEWMENUOBJECT,0,(LPARAM)&tmp);
- {
- OptParam op;
- op.Handle=hFrameMenuObject;
- op.Setting=OPT_MENUOBJECT_SET_FREE_SERVICE;
- op.Value=(INT_PTR)"FrameMenuFreeService";
- CallService(MO_SETOPTIONSMENUOBJECT,0,(LPARAM)&op);
- }
- }
+ CreateServiceFunction("FrameMenuExecService",FrameMenuExecService);
+ CreateServiceFunction("FrameMenuCheckService",FrameMenuCheckService);
+ CreateServiceFunction("FrameMenuFreeService",FreeOwnerDataFrameMenu);
+
+ CreateServiceFunction(MS_CLIST_REMOVECONTEXTFRAMEMENUITEM,RemoveContextFrameMenuItem);
+ CreateServiceFunction("CList/AddContextFrameMenuItem",AddContextFrameMenuItem);
+ CreateServiceFunction(MS_CLIST_MENUBUILDFRAMECONTEXT,BuildContextFrameMenu);
+ CreateServiceFunction(MS_CLIST_FRAMEMENUNOTIFY,ContextFrameMenuNotify);
+ hPreBuildFrameMenuEvent = CreateHookableEvent(ME_CLIST_PREBUILDFRAMEMENU);
+
+ //frame menu object
+ hFrameMenuObject = MO_CreateMenuObject("Frames_Menu", LPGEN("Frames menu"), "FrameMenuCheckService", "FrameMenuExecService");
+ MO_SetMenuObjectParam(hFrameMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, "FrameMenuFreeService");
return 0;
}
diff --git a/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp b/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp
index 080c7b8077..7059a5563d 100644
--- a/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp
+++ b/plugins/Clist_nicer/src/CLUIFrames/groupmenu.cpp
@@ -251,11 +251,6 @@ int static OnIconLibIconChanged(WPARAM wParam,LPARAM lParam)
void InitGroupMenus(void)
{
- TMenuParam tmp;
- OptParam op;
- //hicon=LoadIconFromExternalFile("clisticons.dll",2,TRUE,TRUE,"NewGroup","Contact List","New Group",-IDI_NEWGROUP2);
- //NewGroupIconidx=ImageList_AddIcon(hCListImages,hicon );
-
CreateServiceFunction("CLISTMENUSGroup/ExecService",GroupMenuExecService);
CreateServiceFunction("CLISTMENUSGroup/FreeOwnerDataGroupMenu",FreeOwnerDataGroupMenu);
CreateServiceFunction("CLISTMENUSGroup/GroupMenuonAddService",GroupMenuonAddService);
@@ -272,29 +267,10 @@ void InitGroupMenus(void)
InitSubGroupMenus();
//Group menu
- memset(&tmp,0,sizeof(tmp));
- tmp.cbSize=sizeof(tmp);
- tmp.CheckService=NULL;
- tmp.ExecService="CLISTMENUSGroup/ExecService";
- tmp.name="GroupMenu";
- hGroupMenuObject=(HANDLE)CallService(MO_CREATENEWMENUOBJECT,0,(LPARAM)&tmp);
-
-
- op.Handle=hGroupMenuObject;
- op.Setting=OPT_USERDEFINEDITEMS;
- op.Value=TRUE;
- CallService(MO_SETOPTIONSMENUOBJECT,0,(LPARAM)&op);
-
- op.Handle=hGroupMenuObject;
- op.Setting=OPT_MENUOBJECT_SET_FREE_SERVICE;
- op.Value=(INT_PTR)"CLISTMENUSGroup/FreeOwnerDataGroupMenu";
- CallService(MO_SETOPTIONSMENUOBJECT,0,(LPARAM)&op);
-
- op.Handle=hGroupMenuObject;
- op.Setting=OPT_MENUOBJECT_SET_ONADD_SERVICE;
- op.Value=(INT_PTR)"CLISTMENUSGroup/GroupMenuonAddService";
- CallService(MO_SETOPTIONSMENUOBJECT,0,(LPARAM)&op);
-
+ hGroupMenuObject = MO_CreateMenuObject("GroupMenu", LPGEN("Groups menu"), 0, "CLISTMENUSGroup/ExecService");
+ MO_SetMenuObjectParam(hGroupMenuObject, OPT_USERDEFINEDITEMS, TRUE);
+ MO_SetMenuObjectParam(hGroupMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, "CLISTMENUSGroup/FreeOwnerDataGroupMenu");
+ MO_SetMenuObjectParam(hGroupMenuObject, OPT_MENUOBJECT_SET_ONADD_SERVICE, "CLISTMENUSGroup/GroupMenuonAddService");
{
//add exit command to menu
GroupMenuParam gmp;
@@ -562,9 +538,6 @@ INT_PTR GroupMenuExecProxy(WPARAM wParam,LPARAM lParam)
void InitSubGroupMenus(void)
{
- TMenuParam tmp;
- OptParam op;
-
CreateServiceFunction("CLISTMENUSSubGroup/ExecService",SubGroupMenuExecService);
CreateServiceFunction("CLISTMENUSSubGroup/FreeOwnerDataSubGroupMenu",FreeOwnerDataSubGroupMenu);
CreateServiceFunction("CLISTMENUSSubGroup/SubGroupMenuonAddService",SubGroupMenuonAddService);
@@ -580,30 +553,11 @@ void InitSubGroupMenus(void)
hPreBuildSubGroupMenuEvent=CreateHookableEvent(ME_CLIST_PREBUILDSUBGROUPMENU);
HookEvent(ME_CLIST_PREBUILDSUBGROUPMENU,OnBuildSubGroupMenu);
-
- //SubGroup menu
- memset(&tmp,0,sizeof(tmp));
- tmp.cbSize=sizeof(tmp);
- tmp.CheckService=NULL;
- tmp.ExecService="CLISTMENUSSubGroup/ExecService";
- tmp.name="SubGroupMenu";
- hSubGroupMenuObject=(HANDLE)CallService(MO_CREATENEWMENUOBJECT,0,(LPARAM)&tmp);
-
-
- op.Handle=hSubGroupMenuObject;
- op.Setting=OPT_USERDEFINEDITEMS;
- op.Value=TRUE;
- CallService(MO_SETOPTIONSMENUOBJECT,0,(LPARAM)&op);
-
- op.Handle=hSubGroupMenuObject;
- op.Setting=OPT_MENUOBJECT_SET_FREE_SERVICE;
- op.Value=(INT_PTR)"CLISTMENUSSubGroup/FreeOwnerDataSubGroupMenu";
- CallService(MO_SETOPTIONSMENUOBJECT,0,(LPARAM)&op);
-
- op.Handle=hSubGroupMenuObject;
- op.Setting=OPT_MENUOBJECT_SET_ONADD_SERVICE;
- op.Value=(INT_PTR)"CLISTMENUSSubGroup/SubGroupMenuonAddService";
- CallService(MO_SETOPTIONSMENUOBJECT,0,(LPARAM)&op);
+ // SubGroup menu
+ hSubGroupMenuObject = MO_CreateMenuObject("SubGroupMenu", LPGEN("Subgroup menu"), 0, "CLISTMENUSSubGroup/ExecService");
+ MO_SetMenuObjectParam(hSubGroupMenuObject, OPT_USERDEFINEDITEMS, TRUE);
+ MO_SetMenuObjectParam(hSubGroupMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, "CLISTMENUSSubGroup/FreeOwnerDataSubGroupMenu");
+ MO_SetMenuObjectParam(hSubGroupMenuObject, OPT_MENUOBJECT_SET_ONADD_SERVICE, "CLISTMENUSSubGroup/SubGroupMenuonAddService");
{
//add exit command to menu
diff --git a/plugins/MirOTR/MirOTR/src/mirotrmenu.cpp b/plugins/MirOTR/MirOTR/src/mirotrmenu.cpp
index dfd28d741f..f886cd14e6 100644
--- a/plugins/MirOTR/MirOTR/src/mirotrmenu.cpp
+++ b/plugins/MirOTR/MirOTR/src/mirotrmenu.cpp
@@ -200,36 +200,20 @@ void InitMirOTRMenu(void)
CreateServiceFunction("MirOTRMenuExecService",MirOTRMenuExecService);
CreateServiceFunction("MirOTRMenuCheckService",MirOTRMenuCheckService);
- //free services
+ // menu object
CreateServiceFunction("MIROTRMENUS/FreeOwnerDataMirOTRMenu",FreeOwnerDataMirOTRMenu);
CreateServiceFunction("MIROTRMENUS/OnAddMenuItemMirOTRMenu",OnAddMenuItemMirOTRMenu);
CreateServiceFunction(MS_MIROTR_ADDMIROTRMENUITEM,AddMirOTRMenuItem);
CreateServiceFunction(MS_MIROTR_MENUBUILDMIROTR,BuildMirOTRMenu);
CreateServiceFunction(MS_MIROTR_REMOVEMIROTRMENUITEM,RemoveMirOTRMenuItem);
- {
- TMenuParam tmp = { 0 };
- tmp.cbSize=sizeof(tmp);
- tmp.CheckService="MirOTRMenuCheckService";
- tmp.ExecService="MirOTRMenuExecService";
- tmp.name="MirOTRMenu";
- hMirOTRMenuObject=(HANDLE)CallService(MO_CREATENEWMENUOBJECT,0,(LPARAM)&tmp);
- }
-
- OptParam params;
- params.Handle = hMirOTRMenuObject;
- params.Setting = OPT_USERDEFINEDITEMS;
- params.Value = FALSE;
- CallService(MO_SETOPTIONSMENUOBJECT, 0, (LPARAM)&params);
-
- params.Setting = OPT_MENUOBJECT_SET_FREE_SERVICE;
- params.Value = (INT_PTR)"MIROTRMENUS/FreeOwnerDataMirOTRMenu";
- CallService(MO_SETOPTIONSMENUOBJECT, 0, (LPARAM)&params);
- params.Setting = OPT_MENUOBJECT_SET_ONADD_SERVICE;
- params.Value = (INT_PTR)"MIROTRMENUS/OnAddMenuItemMirOTRMenu";
- CallService(MO_SETOPTIONSMENUOBJECT, 0, (LPARAM)&params);
+ hMirOTRMenuObject = MO_CreateMenuObject("MirOTRMenu", LPGEN("MirOTR menu"), "MirOTRMenuCheckService", "MirOTRMenuExecService");
+ MO_SetMenuObjectParam(hMirOTRMenuObject, OPT_USERDEFINEDITEMS, FALSE);
+ MO_SetMenuObjectParam(hMirOTRMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, "MIROTRMENUS/FreeOwnerDataMirOTRMenu");
+ MO_SetMenuObjectParam(hMirOTRMenuObject, OPT_MENUOBJECT_SET_ONADD_SERVICE, "MIROTRMENUS/OnAddMenuItemMirOTRMenu");
+ // menu items
MIROTRMENUITEM mi = {0};
mi.cbSize = sizeof(mi);
diff --git a/protocols/Gadu-Gadu/src/gg.cpp b/protocols/Gadu-Gadu/src/gg.cpp
index 0930378b6d..1b70719699 100644
--- a/protocols/Gadu-Gadu/src/gg.cpp
+++ b/protocols/Gadu-Gadu/src/gg.cpp
@@ -195,15 +195,6 @@ static int gg_modulesloaded(WPARAM wParam, LPARAM lParam)
}
//////////////////////////////////////////////////////////
-// When Miranda starting shutdown sequence
-static int gg_preshutdown(WPARAM wParam, LPARAM lParam)
-{
- gg_links_destroy();
-
- return 0;
-}
-
-//////////////////////////////////////////////////////////
// Gets protocol instance associated with a contact
static GGPROTO* gg_getprotoinstance(HANDLE hContact)
{
@@ -349,7 +340,6 @@ extern "C" int __declspec(dllexport) Load(void)
// Hook system events
hHookModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, gg_modulesloaded);
- hHookPreShutdown = HookEvent(ME_SYSTEM_PRESHUTDOWN, gg_preshutdown);
// Prepare protocol name
PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
diff --git a/protocols/Gadu-Gadu/src/gg.h b/protocols/Gadu-Gadu/src/gg.h
index d89d6d43e8..2acf921ec1 100644
--- a/protocols/Gadu-Gadu/src/gg.h
+++ b/protocols/Gadu-Gadu/src/gg.h
@@ -337,7 +337,6 @@ void WindowFreeIcon(HWND hWnd);
/* URI parser functions */
void gg_links_instancemenu_init();
void gg_links_init();
-void gg_links_destroy();
#define UIN2IDA(uin,id) _itoa(uin,id,10)
#define UIN2IDT(uin,id) _itot(uin,id,10)
diff --git a/protocols/Gadu-Gadu/src/links.cpp b/protocols/Gadu-Gadu/src/links.cpp
index fafaf05c48..2e6238a963 100644
--- a/protocols/Gadu-Gadu/src/links.cpp
+++ b/protocols/Gadu-Gadu/src/links.cpp
@@ -24,12 +24,10 @@
//////////////////////////////////////////////////////////
// File Association Manager support
-#define GGS_PARSELINK "%s/ParseLink"
-#define GGS_MENUCHOOSE "%s/MenuChoose"
+#define GGS_PARSELINK "GG/ParseLink"
+#define GGS_MENUCHOOSE "GG/MenuChoose"
static HANDLE hInstanceMenu;
-static HANDLE hServiceMenuChoose;
-static HANDLE hServiceParseLink;
static INT_PTR gg_menuchoose(WPARAM wParam, LPARAM lParam)
{
@@ -111,17 +109,10 @@ static INT_PTR gg_parselink(WPARAM wParam, LPARAM lParam)
void gg_links_instancemenu_init()
{
- char service[MAXMODULELABELLENGTH];
- TMenuParam mnu = {0};
- TMO_MenuItem tmi = {0};
-
- mir_snprintf(service, sizeof(service), GGS_MENUCHOOSE, GGDEF_PROTO);
- hServiceMenuChoose = CreateServiceFunction(service, gg_menuchoose);
- mnu.cbSize = sizeof(mnu);
- mnu.name = "GGAccountChooser";
- mnu.ExecService = service;
- hInstanceMenu = (HANDLE)CallService(MO_CREATENEWMENUOBJECT, 0, (LPARAM)&mnu);
+ CreateServiceFunction(GGS_MENUCHOOSE, gg_menuchoose);
+ hInstanceMenu = MO_CreateMenuObject("GGAccountChooser", LPGEN("Gadu-Gadu account chooser"), 0, GGS_MENUCHOOSE);
+ TMO_MenuItem tmi = {0};
tmi.cbSize = sizeof(tmi);
tmi.pszName = "Cancel";
tmi.position = 9999999;
@@ -131,23 +122,12 @@ void gg_links_instancemenu_init()
void gg_links_init()
{
- if (ServiceExists(MS_ASSOCMGR_ADDNEWURLTYPE))
- {
- char service[MAXMODULELABELLENGTH];
-
- mir_snprintf(service, sizeof(service), GGS_PARSELINK, GGDEF_PROTO);
- hServiceParseLink = CreateServiceFunction(service, gg_parselink);
- AssocMgr_AddNewUrlType("gg:", Translate("Gadu-Gadu Link Protocol"), hInstance, IDI_GG, service, 0);
+ if (ServiceExists(MS_ASSOCMGR_ADDNEWURLTYPE)) {
+ CreateServiceFunction(GGS_PARSELINK, gg_parselink);
+ AssocMgr_AddNewUrlType("gg:", Translate("Gadu-Gadu Link Protocol"), hInstance, IDI_GG, GGS_PARSELINK, 0);
}
}
-void gg_links_destroy()
-{
- DestroyServiceFunction(hServiceMenuChoose);
- if (ServiceExists(MS_ASSOCMGR_ADDNEWURLTYPE))
- DestroyServiceFunction(hServiceParseLink);
-}
-
void GGPROTO::links_instance_init()
{
if (ServiceExists(MS_ASSOCMGR_ADDNEWURLTYPE)) {
diff --git a/protocols/JabberG/src/jabber_menu.cpp b/protocols/JabberG/src/jabber_menu.cpp
index e409f419b2..43025b38f8 100644
--- a/protocols/JabberG/src/jabber_menu.cpp
+++ b/protocols/JabberG/src/jabber_menu.cpp
@@ -183,8 +183,7 @@ void g_MenuInit(void)
CreateServiceFunction("Jabber/MenuChoose", JabberMenuChooseService);
- TMenuParam mnu = { sizeof(mnu), "JabberAccountChooser", 0, "Jabber/MenuChoose" };
- hChooserMenu = (HANDLE)CallService(MO_CREATENEWMENUOBJECT, 0, (LPARAM)&mnu);
+ hChooserMenu = MO_CreateMenuObject("JabberAccountChooser", LPGEN("Jabber account chooser"), 0, "Jabber/MenuChoose");
TMO_MenuItem tmi = { sizeof(tmi) };
tmi.pszName = "Cancel";
diff --git a/protocols/Skype/src/skype_menus.cpp b/protocols/Skype/src/skype_menus.cpp
index 69e4acce52..3553b0b5ce 100644
--- a/protocols/Skype/src/skype_menus.cpp
+++ b/protocols/Skype/src/skype_menus.cpp
@@ -1,6 +1,6 @@
#include "skype.h"
-HGENMENU CSkypeProto::hChooserMenu;
+HANDLE CSkypeProto::hChooserMenu;
HGENMENU CSkypeProto::contactMenuItems[CMI_MAX];
INT_PTR CSkypeProto::MenuChooseService(WPARAM wParam, LPARAM lParam)
@@ -122,7 +122,7 @@ void CSkypeProto::InitMenus()
mnu.cbSize = sizeof(mnu);
mnu.name = "SkypeAccountChooser";
mnu.ExecService = "Skype/MenuChoose";
- hChooserMenu = (HGENMENU)::CallService(MO_CREATENEWMENUOBJECT, 0, (LPARAM)&mnu);
+ hChooserMenu = MO_CreateMenuObject(LPGEN("Skype menu chooser"), &mnu);
//////////////////////////////////////////////////////////////////////////////////////
// Contact menu initialization
diff --git a/src/modules/clist/clistmenus.cpp b/src/modules/clist/clistmenus.cpp
index cbb8f97b92..ef7fcde149 100644
--- a/src/modules/clist/clistmenus.cpp
+++ b/src/modules/clist/clistmenus.cpp
@@ -850,13 +850,7 @@ void RebuildMenuOrder(void)
mir_free(hStatusMenuHandles);
}
- TMenuParam tmp = { 0 };
- tmp.cbSize = sizeof(tmp);
- tmp.ExecService = "StatusMenuExecService";
- tmp.CheckService = "StatusMenuCheckService";
- tmp.name = "StatusMenu";
-
- hStatusMenuObject = (HANDLE)CallService(MO_CREATENEWMENUOBJECT, 0, (LPARAM)&tmp);
+ hStatusMenuObject = MO_CreateMenuObject("StatusMenu", LPGEN("Status menu"), "StatusMenuCheckService", "StatusMenuExecService");
MO_SetOptionsMenuObject(hStatusMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, (INT_PTR)"CLISTMENUS/FreeOwnerDataStatusMenu");
hStatusMainMenuHandles = (PMO_IntMenuItem*)mir_calloc(SIZEOF(statusModeList) * sizeof(PMO_IntMenuItem*));
@@ -1324,29 +1318,16 @@ void InitCustomMenus(void)
hStatusMenuHandles = NULL;
hStatusMenuHandlesCnt = 0;
- //new menu sys
+ // new menu sys
InitGenMenu();
- //main menu
- {
- TMenuParam tmp = { sizeof(tmp) };
- tmp.ExecService = "MainMenuExecService";
- tmp.name = "MainMenu";
- hMainMenuObject = (HANDLE)CallService(MO_CREATENEWMENUOBJECT, 0, (LPARAM)&tmp);
- }
-
+ // main menu
+ hMainMenuObject = MO_CreateMenuObject("MainMenu", LPGEN("Main menu"), 0, "MainMenuExecService");
MO_SetOptionsMenuObject(hMainMenuObject, OPT_USERDEFINEDITEMS, TRUE);
MO_SetOptionsMenuObject(hMainMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, (INT_PTR)"CLISTMENUS/FreeOwnerDataMainMenu");
- //contact menu
- {
- TMenuParam tmp = { sizeof(tmp) };
- tmp.CheckService = "ContactMenuCheckService";
- tmp.ExecService = "ContactMenuExecService";
- tmp.name = "ContactMenu";
- hContactMenuObject = (HANDLE)CallService(MO_CREATENEWMENUOBJECT, 0, (LPARAM)&tmp);
- }
-
+ // contact menu
+ hContactMenuObject = MO_CreateMenuObject("ContactMenu", LPGEN("Contact menu"), "ContactMenuCheckService", "ContactMenuExecService");
MO_SetOptionsMenuObject(hContactMenuObject, OPT_USERDEFINEDITEMS, TRUE);
MO_SetOptionsMenuObject(hContactMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, (INT_PTR)"CLISTMENUS/FreeOwnerDataContactMenu");
diff --git a/src/modules/clist/genmenu.cpp b/src/modules/clist/genmenu.cpp
index 6fe6446ab6..15882d6475 100644
--- a/src/modules/clist/genmenu.cpp
+++ b/src/modules/clist/genmenu.cpp
@@ -50,7 +50,7 @@ static void DumpMenuItem(TMO_IntMenuItem* pParent, int level = 0)
static int CompareMenus(const TIntMenuObject* p1, const TIntMenuObject* p2)
{
- return lstrcmpA(p1->Name, p2->Name);
+ return lstrcmpA(p1->pszName, p2->pszName);
}
LIST<TIntMenuObject> g_menus(10, CompareMenus);
@@ -434,7 +434,7 @@ int MO_ProcessCommand(PMO_IntMenuItem aHandle, LPARAM lParam)
return -1;
}
- char *srvname = pimi->parent->ExecService;
+ LPCSTR srvname = pimi->parent->ExecService;
void *ownerdata = pimi->mi.ownerdata;
CallService(srvname, (WPARAM)ownerdata, lParam);
return 1;
@@ -495,20 +495,21 @@ int MO_SetOptionsMenuObject(HANDLE handle, int setting, INT_PTR value)
return res;
}
-//wparam = 0;
+//wparam = LPCSTR szDisplayName;
//lparam = PMenuParam;
//result = MenuObjectHandle
-INT_PTR MO_CreateNewMenuObject(WPARAM, LPARAM lParam)
+INT_PTR MO_CreateNewMenuObject(WPARAM wParam, LPARAM lParam)
{
- PMenuParam pmp = (PMenuParam)lParam;
- if ( !bIsGenMenuInited || pmp == NULL)
+ TMenuParam *pmp = (TMenuParam *)lParam;
+ if (!bIsGenMenuInited || pmp == NULL)
return -1;
mir_cslock lck(csMenuHook);
TIntMenuObject* p = new TIntMenuObject();
p->id = NextObjectId++;
- p->Name = mir_strdup(pmp->name);
+ p->pszName = mir_strdup(pmp->name);
+ p->ptszDisplayName = Langpack_PcharToTchar(LPCSTR(wParam));
p->CheckService = mir_strdup(pmp->CheckService);
p->ExecService = mir_strdup(pmp->ExecService);
p->m_hMenuIcons = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, 15, 100);
@@ -901,7 +902,7 @@ HMENU BuildRecursiveMenu(HMENU hMenu, PMO_IntMenuItem pRootMenu, ListParam *para
DBVARIANT dbv = { 0 };
int pos;
char MenuNameItems[256];
- mir_snprintf(MenuNameItems, SIZEOF(MenuNameItems), "%s_Items", pmo->Name);
+ mir_snprintf(MenuNameItems, SIZEOF(MenuNameItems), "%s_Items", pmo->pszName);
char menuItemName[256];
GetMenuItemName(pmi, menuItemName, sizeof(menuItemName));
@@ -1045,10 +1046,10 @@ static int MO_RegisterIcon(PMO_IntMenuItem pmi, void*)
HICON hIcon = ImageList_GetIcon(pmi->parent->m_hMenuIcons, pmi->iconId, 0);
TCHAR sectionName[256];
- mir_sntprintf(sectionName, SIZEOF(sectionName), LPGENT("Menu icons") _T("/%s"), (TCHAR*)_A2T(pmi->parent->Name));
+ mir_sntprintf(sectionName, SIZEOF(sectionName), LPGENT("Menu icons") _T("/%s"), TranslateTS(pmi->parent->ptszDisplayName));
char iconame[256];
- mir_snprintf(iconame, sizeof(iconame), "genmenu_%s_%s", pmi->parent->Name, uname && *uname ? uname : descr);
+ mir_snprintf(iconame, sizeof(iconame), "genmenu_%s_%s", pmi->parent->pszName, uname && *uname ? uname : descr);
// remove '&'
if (descr) {
@@ -1154,7 +1155,7 @@ int InitGenMenu()
CreateServiceFunction(MO_BUILDMENU, MO_BuildMenu);
CreateServiceFunction(MO_PROCESSCOMMAND, (MIRANDASERVICE)MO_ProcessCommand);
- CreateServiceFunction(MO_CREATENEWMENUOBJECT, MO_CreateNewMenuObject);
+ CreateServiceFunction("MO/CreateNewMenuObject", MO_CreateNewMenuObject);
CreateServiceFunction(MO_REMOVEMENUITEM, MO_RemoveMenuItem);
CreateServiceFunction(MO_ADDNEWMENUITEM, (MIRANDASERVICE)MO_AddNewMenuItem);
CreateServiceFunction(MO_MENUITEMGETOWNERDATA, MO_MenuItemGetOwnerData);
@@ -1166,7 +1167,7 @@ int InitGenMenu()
CreateServiceFunction(MO_REMOVEMENUOBJECT, MO_RemoveMenuObject);
CreateServiceFunction(MO_GETPROTOROOTMENU, MO_GetProtoRootMenu);
- CreateServiceFunction(MO_SETOPTIONSMENUOBJECT, SRVMO_SetOptionsMenuObject);
+ CreateServiceFunction(MO_SRV_SETOPTIONSMENUOBJECT, SRVMO_SetOptionsMenuObject);
CreateServiceFunction(MO_SETOPTIONSMENUITEM, SRVMO_SetOptionsMenuItem);
bIconsDisabled = db_get_b(NULL, "CList", "DisableMenuIcons", 0) != 0;
@@ -1206,7 +1207,8 @@ TIntMenuObject::~TIntMenuObject()
FreeAndNil((void**)&onAddService);
FreeAndNil((void**)&CheckService);
FreeAndNil((void**)&ExecService);
- FreeAndNil((void**)&Name);
+ FreeAndNil((void**)&ptszDisplayName);
+ FreeAndNil((void**)&pszName);
ImageList_Destroy(m_hMenuIcons);
}
diff --git a/src/modules/clist/genmenu.h b/src/modules/clist/genmenu.h
index c3d14b0bbd..e33fc6159a 100644
--- a/src/modules/clist/genmenu.h
+++ b/src/modules/clist/genmenu.h
@@ -63,27 +63,28 @@ struct TIntMenuObject : public MZeroedObject
TIntMenuObject();
~TIntMenuObject();
- char* Name;
- int id;
+ char *pszName;
+ TCHAR *ptszDisplayName;
+ int id;
//ExecService
//LPARAM lParam;//owner data
//WPARAM wParam;//allways lparam from winproc
- char *ExecService;
+ LPCSTR ExecService;
//CheckService called when building menu
//return false to skip item.
//LPARAM lParam;//0
//WPARAM wParam;//CheckParam
- char *CheckService;//analog to check_proc
+ LPCSTR CheckService;//analog to check_proc
//LPARAM lParam;//ownerdata
//WPARAM wParam;//menuitemhandle
- char *FreeService;//callback service used to free ownerdata for menuitems
+ LPCSTR FreeService;//callback service used to free ownerdata for menuitems
//LPARAM lParam;//MENUITEMINFO filled with all needed data
//WPARAM wParam;//menuitemhandle
- char *onAddService;//called just before add MENUITEMINFO to hMenu
+ LPCSTR onAddService;//called just before add MENUITEMINFO to hMenu
TMO_LinkedList m_items;
HIMAGELIST m_hMenuIcons;
diff --git a/src/modules/clist/genmenuopt.cpp b/src/modules/clist/genmenuopt.cpp
index 379c503697..38294756ae 100644
--- a/src/modules/clist/genmenuopt.cpp
+++ b/src/modules/clist/genmenuopt.cpp
@@ -89,7 +89,7 @@ static int SaveTree(HWND hwndDlg)
TIntMenuObject *pimo = g_menus[menupos];
char MenuNameItems[256];
- mir_snprintf(MenuNameItems, sizeof(MenuNameItems), "%s_Items", pimo->Name);
+ mir_snprintf(MenuNameItems, sizeof(MenuNameItems), "%s_Items", pimo->pszName);
int runtimepos = 100;
while (tvi.hItem != NULL) {
@@ -141,7 +141,7 @@ static int BuildMenuObjectsTree(HWND hwndDlg)
continue;
tvis.item.lParam = (LPARAM)g_menus[i]->id;
- tvis.item.pszText = Langpack_PcharToTchar(g_menus[i]->Name);
+ tvis.item.pszText = TranslateTS(g_menus[i]->ptszDisplayName);
tvis.item.iImage = tvis.item.iSelectedImage = TRUE;
TreeView_InsertItem(hTree, &tvis);
mir_free(tvis.item.pszText);
@@ -231,7 +231,7 @@ static int BuildTree(HWND hwndDlg, int MenuObjectId, BOOL bReread)
if (pimo->m_items.first == NULL)
return FALSE;
- mir_snprintf(MenuNameItems, sizeof(MenuNameItems), "%s_Items", pimo->Name);
+ mir_snprintf(MenuNameItems, sizeof(MenuNameItems), "%s_Items", pimo->pszName);
int count = 0;
{