summaryrefslogtreecommitdiff
path: root/plugins/Clist_modern
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 /plugins/Clist_modern
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
Diffstat (limited to 'plugins/Clist_modern')
-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
6 files changed, 28 insertions, 148 deletions
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) };