summaryrefslogtreecommitdiff
path: root/plugins/Clist_nicer/src/CLUIFrames
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_nicer/src/CLUIFrames
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_nicer/src/CLUIFrames')
-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
4 files changed, 26 insertions, 154 deletions
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