summaryrefslogtreecommitdiff
path: root/plugins/Clist_modern/src/modern_framesmenu.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-01-26 21:04:38 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-01-26 21:04:38 +0000
commitf8a2931aff174ded0a69b7b5933dd27337cbb134 (patch)
tree8e8960cfd9d816d822837bc882e3c6e539832f8b /plugins/Clist_modern/src/modern_framesmenu.cpp
parenteecb95c8e17f3397f64820f36f2a1d2351fe92e0 (diff)
SKINICON_OTHER_FRAME for all plugins
git-svn-id: http://svn.miranda-ng.org/main/trunk@3297 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Clist_modern/src/modern_framesmenu.cpp')
-rw-r--r--plugins/Clist_modern/src/modern_framesmenu.cpp188
1 files changed, 75 insertions, 113 deletions
diff --git a/plugins/Clist_modern/src/modern_framesmenu.cpp b/plugins/Clist_modern/src/modern_framesmenu.cpp
index dba4a3eb30..bb46b58083 100644
--- a/plugins/Clist_modern/src/modern_framesmenu.cpp
+++ b/plugins/Clist_modern/src/modern_framesmenu.cpp
@@ -1,7 +1,7 @@
#include "hdr/modern_commonheaders.h"
#include "hdr/modern_commonprototypes.h"
-// == == == == == == == == == == == == == Frames
+//========================== Frames
HANDLE hFrameMenuObject;
//contactmenu exec param(ownerdata)
@@ -13,20 +13,11 @@ typedef struct{
}
FrameMenuExecParam,*lpFrameMenuExecParam;
-void FreeAndNil( void **p )
+static INT_PTR AddContextFrameMenuItem(WPARAM wParam, LPARAM lParam)
{
- if ( p == NULL )
- return;
-
- if ( *p != NULL ) {
- mir_free( *p );
- *p = NULL;
-} }
+ CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam;
-static INT_PTR AddContextFrameMenuItem(WPARAM wParam,LPARAM lParam)
-{
TMO_MenuItem tmi;
- CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam;
if ( !pcli->pfnConvertMenu(mi, &tmi))
return NULL;
@@ -41,21 +32,20 @@ static INT_PTR AddContextFrameMenuItem(WPARAM 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 CallService(MO_ADDNEWMENUITEM, (WPARAM)hFrameMenuObject, (LPARAM)&tmi);
}
-static INT_PTR RemoveContextFrameMenuItem(WPARAM wParam,LPARAM lParam)
+static INT_PTR RemoveContextFrameMenuItem(WPARAM wParam, LPARAM lParam)
{
- lpFrameMenuExecParam fmep = (lpFrameMenuExecParam)CallService(MO_MENUITEMGETOWNERDATA,wParam,lParam);
- if (fmep != NULL){
+ lpFrameMenuExecParam fmep = (lpFrameMenuExecParam)CallService(MO_MENUITEMGETOWNERDATA, wParam, lParam);
+ if (fmep != NULL) {
if (fmep->szServiceName != NULL)
mir_free(fmep->szServiceName);
mir_free(fmep);
}
if (lParam != 1)
- CallService(MO_REMOVEMENUITEM,wParam,0);
+ CallService(MO_REMOVEMENUITEM, wParam, 0);
return 0;
}
@@ -63,40 +53,40 @@ static INT_PTR RemoveContextFrameMenuItem(WPARAM wParam,LPARAM lParam)
//called with:
//wparam - ownerdata
//lparam - lparam from winproc
-INT_PTR FrameMenuExecService(WPARAM wParam,LPARAM lParam) {
+INT_PTR FrameMenuExecService(WPARAM wParam, LPARAM lParam)
+{
lpFrameMenuExecParam fmep = (lpFrameMenuExecParam)wParam;
- if (fmep == NULL){return(-1);};
- CallService(fmep->szServiceName,lParam,fmep->param1);
+ if (fmep ==NULL)
+ return -1;
+ CallService(fmep->szServiceName, lParam, fmep->param1);
return 0;
-};
+}
//true - ok,false ignore
-INT_PTR FrameMenuCheckService(WPARAM wParam,LPARAM lParam) {
-
+INT_PTR FrameMenuCheckService(WPARAM wParam, LPARAM lParam)
+{
PCheckProcParam pcpp = (PCheckProcParam)wParam;
- lpFrameMenuExecParam fmep;
- TMO_MenuItem mi;
+ if (pcpp == NULL)
+ return FALSE;
- if (pcpp == NULL){return(FALSE);};
- if (CallService(MO_GETMENUITEM,(WPARAM)pcpp->MenuItemHandle,(LPARAM)&mi) == 0)
- {
- fmep = (lpFrameMenuExecParam)mi.ownerdata;
- if (fmep != NULL)
- {
+ TMO_MenuItem mi;
+ if ( CallService(MO_GETMENUITEM, (WPARAM)pcpp->MenuItemHandle, (LPARAM)&mi) == 0) {
+ lpFrameMenuExecParam fmep = (lpFrameMenuExecParam)mi.ownerdata;
+ if (fmep != NULL) {
//pcpp->wParam - frameid
- if (((WPARAM)fmep->Frameid == pcpp->wParam) || fmep->Frameid == -1) return(TRUE);
- };
-
- };
- return(FALSE);
-};
+ if (((WPARAM)fmep->Frameid == pcpp->wParam) || fmep->Frameid == -1)
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
-static INT_PTR ContextFrameMenuNotify(WPARAM wParam,LPARAM lParam)
+static INT_PTR ContextFrameMenuNotify(WPARAM wParam, LPARAM lParam)
{
- NotifyEventHooks(g_CluiData.hEventPreBuildFrameMenu,wParam,lParam);
+ NotifyEventHooks(g_CluiData.hEventPreBuildFrameMenu, wParam, lParam);
return 0;
-};
+}
static INT_PTR BuildContextFrameMenu(WPARAM wParam,LPARAM lParam)
{
@@ -106,81 +96,62 @@ static INT_PTR BuildContextFrameMenu(WPARAM wParam,LPARAM lParam)
param.lParam = lParam;
HMENU hMenu = CreatePopupMenu();
- //NotifyEventHooks(hPreBuildFrameMenuEvent,wParam,-1);
- ContextFrameMenuNotify(wParam,-1);
- CallService(MO_BUILDMENU,(WPARAM)hMenu,(LPARAM)&param);
+ ContextFrameMenuNotify(wParam, -1);
+ CallService(MO_BUILDMENU, (WPARAM)hMenu, (LPARAM)&param);
return (INT_PTR)hMenu;
}
-// == == == == == == == == == == == == == Frames end
+//========================== Frames end
bool 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);
+int MeasureItemProxy(WPARAM wParam, LPARAM lParam)
+{
+ if (InternalGenMenuModule) {
+ int val = CallService(MS_INT_MENUMEASUREITEM, wParam, lParam);
+ if (val)
+ return val;
}
- return CallService(MS_CLIST_MENUDRAWITEM,wParam,lParam);
-
-};
-
-
+ return CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam);
+}
-int ProcessCommandProxy(WPARAM wParam,LPARAM lParam) {
- if (InternalGenMenuModule)
- {
- int val;
- val = CallService(MS_INT_MENUPROCESSCOMMAND,wParam,lParam);
- if (val) return(val);
- };
+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;
- val = CallService(MS_INT_MODIFYMENUITEM,wParam,lParam);
- if (val) return(val);
- };
-
+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)
{
- TMenuParam tmp;
-
- if ( !ServiceExists(MO_REMOVEMENUOBJECT))
- {
-
- InitCustomMenus();
+ if ( !ServiceExists(MO_REMOVEMENUOBJECT)) {
+ InitCustomMenus();
InternalGenMenuModule = TRUE;
- };
+ }
- if ( ServiceExists(MO_REMOVEMENUOBJECT))
- {
+ if ( ServiceExists(MO_REMOVEMENUOBJECT)) {
CreateServiceFunction("FrameMenuExecService",FrameMenuExecService);
CreateServiceFunction("FrameMenuCheckService",FrameMenuCheckService);
@@ -188,27 +159,18 @@ int InitFramesMenus(void)
CreateServiceFunction("CList/AddContextFrameMenuItem",AddContextFrameMenuItem);
CreateServiceFunction(MS_CLIST_MENUBUILDFRAMECONTEXT,BuildContextFrameMenu);
CreateServiceFunction(MS_CLIST_FRAMEMENUNOTIFY,ContextFrameMenuNotify);
-
//frame menu object
- memset(&tmp,0,sizeof(tmp));
- tmp.cbSize = sizeof(tmp);
+ TMenuParam tmp = { sizeof(tmp) };
tmp.CheckService = "FrameMenuCheckService";
tmp.ExecService = "FrameMenuExecService";
tmp.name = "FrameMenu";
- hFrameMenuObject = (HANDLE)CallService(MO_CREATENEWMENUOBJECT,0,(LPARAM)&tmp);
+ hFrameMenuObject = (HANDLE)CallService(MO_CREATENEWMENUOBJECT, 0, (LPARAM)&tmp);
}
return 0;
}
+
int UnitFramesMenu()
{
-
- /*
- if ( ServiceExists(MO_REMOVEMENUOBJECT))
- {
- CallService(MO_REMOVEMENUOBJECT,hFrameMenuObject,0);
- if (InternalGenMenuModule){UnitGenMenu();};
- };
- */
return 0;
-};
+}