summaryrefslogtreecommitdiff
path: root/plugins/Modernb
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Modernb')
-rw-r--r--plugins/Modernb/modern_clisttray.cpp38
-rw-r--r--plugins/Modernb/modern_framesmenu.cpp44
-rw-r--r--plugins/Modernb/modern_groupmenu.cpp120
3 files changed, 68 insertions, 134 deletions
diff --git a/plugins/Modernb/modern_clisttray.cpp b/plugins/Modernb/modern_clisttray.cpp
index 521785066d..15c26506c8 100644
--- a/plugins/Modernb/modern_clisttray.cpp
+++ b/plugins/Modernb/modern_clisttray.cpp
@@ -520,37 +520,21 @@ static INT_PTR BuildTrayMenu(WPARAM wParam,LPARAM lParam)
static INT_PTR AddTrayMenuItem(WPARAM wParam,LPARAM lParam)
{
- CLISTMENUITEM *mi=(CLISTMENUITEM*)lParam;
TMO_MenuItem tmi;
- OptParam op;
-
- if(mi->cbSize!=sizeof(CLISTMENUITEM)) return 0;
-
- memset(&tmi,0,sizeof(tmi));
- tmi.cbSize=sizeof(tmi);
- tmi.flags=mi->flags;
- tmi.hIcon=mi->hIcon;
- tmi.hotKey=mi->hotKey;
- tmi.pszName=mi->pszName;
- tmi.position=mi->position;
-
- //pszPopupName for new system mean root level
- //pszPopupName for old system mean that exists popup
- tmi.root = mi->hParentMenu;
+ CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam;
+ if ( !pcli->pfnConvertMenu(mi, &tmi))
+ return NULL;
- tmi.ownerdata=NULL;
+ lpTrayMenuExecParam mmep = (lpTrayMenuExecParam)mir_alloc(sizeof(TrayMenuExecParam));
+ if ( mmep == NULL)
+ return 0;
- {
- lpTrayMenuExecParam mmep;
- mmep=(lpTrayMenuExecParam)mir_alloc(sizeof(TrayMenuExecParam));
- if(mmep==NULL){return(0);};
-
- //we need just one parametr.
- mmep->szServiceName=mir_strdup(mi->pszService);
- mmep->Param1=mi->popupPosition;
+ //we need just one parametr.
+ mmep->szServiceName=mir_strdup(mi->pszService);
+ mmep->Param1=mi->popupPosition;
+ tmi.ownerdata = mmep;
- tmi.ownerdata=mmep;
- }
+ OptParam op;
op.Handle=(HANDLE)CallService(MO_ADDNEWMENUITEM,(WPARAM)hTrayMenuObject,(LPARAM)&tmi);
op.Setting=OPT_MENUITEMSETUNIQNAME;
op.Value=(INT_PTR)mi->pszService;
diff --git a/plugins/Modernb/modern_framesmenu.cpp b/plugins/Modernb/modern_framesmenu.cpp
index 5a8552f0cb..766adf4974 100644
--- a/plugins/Modernb/modern_framesmenu.cpp
+++ b/plugins/Modernb/modern_framesmenu.cpp
@@ -10,7 +10,8 @@ typedef struct{
char *szServiceName;
int Frameid;
INT_PTR param1;
-}FrameMenuExecParam,*lpFrameMenuExecParam;
+}
+ FrameMenuExecParam,*lpFrameMenuExecParam;
void FreeAndNil( void **p )
{
@@ -20,41 +21,30 @@ void FreeAndNil( void **p )
if ( *p != NULL ) {
mir_free( *p );
*p = NULL;
- } }
+} }
static INT_PTR AddContextFrameMenuItem(WPARAM wParam,LPARAM lParam)
{
- CLISTMENUITEM *mi=(CLISTMENUITEM*)lParam;
- TMO_MenuItem tmi={0};
+ TMO_MenuItem tmi;
+ CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam;
+ if ( !pcli->pfnConvertMenu(mi, &tmi))
+ return NULL;
- if(mi->cbSize!=sizeof(CLISTMENUITEM)) return 0;
+ tmi.root = (mi->flags & CMIF_ROOTHANDLE) ? mi->hParentMenu : NULL;
- memset(&tmi,0,sizeof(tmi));
+ lpFrameMenuExecParam fmep = (lpFrameMenuExecParam)mir_alloc(sizeof(FrameMenuExecParam));
+ if (fmep == NULL)
+ return 0;
- tmi.cbSize=sizeof(tmi);
- tmi.flags=mi->flags;
- tmi.hIcon=mi->hIcon;
- tmi.hotKey=mi->hotKey;
- tmi.position=mi->position;
- tmi.pszName=mi->pszName;
+ memset(fmep, 0, sizeof(FrameMenuExecParam));
+ fmep->szServiceName = mir_strdup(mi->pszService);
+ fmep->Frameid = mi->popupPosition;
+ fmep->param1 = (INT_PTR)mi->pszContactOwner;
+ tmi.ownerdata = fmep;
- if ( mi->flags & CMIF_ROOTHANDLE ) tmi.root = mi->hParentMenu;
- {
- lpFrameMenuExecParam fmep;
- fmep=(lpFrameMenuExecParam)mir_alloc(sizeof(FrameMenuExecParam));
- if (fmep==NULL){return(0);};
- memset(fmep,0,sizeof(FrameMenuExecParam));
- fmep->szServiceName=mir_strdup(mi->pszService);
- 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)
{
lpFrameMenuExecParam fmep;
diff --git a/plugins/Modernb/modern_groupmenu.cpp b/plugins/Modernb/modern_groupmenu.cpp
index dcfa6db2a8..9d2b3780e6 100644
--- a/plugins/Modernb/modern_groupmenu.cpp
+++ b/plugins/Modernb/modern_groupmenu.cpp
@@ -80,54 +80,34 @@ INT_PTR BuildGroupMenu(WPARAM wParam,LPARAM lParam)
static INT_PTR AddGroupMenuItem(WPARAM wParam,LPARAM lParam)
{
- CLISTMENUITEM *mi=(CLISTMENUITEM*)lParam;
- lpGroupMenuParam gmp=(lpGroupMenuParam)wParam;
- char buf[1024];
-
TMO_MenuItem tmi;
- OptParam op;
+ CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam;
+ if ( !pcli->pfnConvertMenu(mi, &tmi))
+ return NULL;
- if(mi->cbSize!=sizeof(CLISTMENUITEM)) return 0;
-
- memset(&tmi,0,sizeof(tmi));
- tmi.cbSize=sizeof(tmi);
- tmi.flags=mi->flags;
- tmi.hIcon=mi->hIcon;
- tmi.hotKey=mi->hotKey;
- tmi.pszName=mi->pszName;
- tmi.position=mi->position;
-
- //pszPopupName for new system mean root level
- //pszPopupName for old system mean that exists popup
- tmi.root = mi->hParentMenu;
-
- tmi.ownerdata=NULL;
-
- {
- lpGroupMenuExecParam mmep;
- mmep=(lpGroupMenuExecParam)mir_calloc(sizeof(GroupMenuExecParam));
- if(mmep==NULL){return(0);};
+ lpGroupMenuExecParam mmep = (lpGroupMenuExecParam)mir_calloc(sizeof(GroupMenuExecParam));
+ if (mmep == NULL)
+ return 0;
- //we need just one parametr.
- mmep->szServiceName=mir_strdup(mi->pszService);
- mmep->Param1=mi->popupPosition;
- if (gmp!=NULL)
- {
- mmep->Param1=gmp->wParam;
- mmep->Param2=gmp->lParam;
- }
-
- tmi.ownerdata=mmep;
+ //we need just one parametr.
+ mmep->szServiceName = mir_strdup(mi->pszService);
+ mmep->Param1 = mi->popupPosition;
+ lpGroupMenuParam gmp = (lpGroupMenuParam)wParam;
+ if (gmp != NULL) {
+ mmep->Param1 = gmp->wParam;
+ mmep->Param2 = gmp->lParam;
}
- op.Handle=(HANDLE)CallService(MO_ADDNEWMENUITEM,(WPARAM)hGroupMenuObject,(LPARAM)&tmi);
- op.Setting=OPT_MENUITEMSETUNIQNAME;
+ tmi.ownerdata=mmep;
+
+ char buf[1024];
sprintf(buf,"%s/%s",mi->pszService,mi->pszName);
- op.Value=(INT_PTR)buf;
+
+ OptParam op;
+ op.Handle = (HANDLE)CallService(MO_ADDNEWMENUITEM,(WPARAM)hGroupMenuObject,(LPARAM)&tmi);
+ op.Setting = OPT_MENUITEMSETUNIQNAME;
+ op.Value = (INT_PTR)buf;
CallService(MO_SETOPTIONSMENUITEM,(WPARAM)0,(LPARAM)&op);
return (INT_PTR)op.Handle;
-
-// mainItemCount++;
-// return MENU_CUSTOMITEMMAIN|(mainMenuItem[mainItemCount-1].id);
}
int GroupMenuCheckService(WPARAM wParam,LPARAM lParam) {
@@ -545,54 +525,34 @@ HMENU cliBuildGroupPopupMenu(struct ClcGroup *group)
}
static INT_PTR AddSubGroupMenuItem(WPARAM wParam,LPARAM lParam)
{
- CLISTMENUITEM *mi=(CLISTMENUITEM*)lParam;
- lpGroupMenuParam gmp=(lpGroupMenuParam)wParam;
- char buf[1024];
TMO_MenuItem tmi;
- OptParam op;
-
- if(mi->cbSize!=sizeof(CLISTMENUITEM)) return 0;
- memset(&tmi,0,sizeof(tmi));
- tmi.cbSize=sizeof(tmi);
- tmi.flags=mi->flags;
- tmi.hIcon=mi->hIcon;
- tmi.hotKey=mi->hotKey;
- tmi.pszName=mi->pszName;
- tmi.position=mi->position;
-
- //pszPopupName for new system mean root level
- //pszPopupName for old system mean that exists popup
- tmi.root = mi->hParentMenu;
+ CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam;
+ if ( !pcli->pfnConvertMenu(mi, &tmi))
+ return NULL;
- tmi.ownerdata=NULL;
-
- {
- lpSubGroupMenuExecParam mmep;
- mmep=(lpSubGroupMenuExecParam)mir_calloc(sizeof(SubGroupMenuExecParam));
- if(mmep==NULL){return(0);};
-
- //we need just one parametr.
- mmep->szServiceName=mir_strdup(mi->pszService);
- mmep->Param1=mi->popupPosition;
- if (gmp!=NULL)
- {
- mmep->Param1=gmp->wParam;
- mmep->Param2=gmp->lParam;
-
- }
+ lpSubGroupMenuExecParam mmep = (lpSubGroupMenuExecParam)mir_calloc(sizeof(SubGroupMenuExecParam));
+ if ( mmep == NULL)
+ return 0;
-
- tmi.ownerdata=mmep;
+ //we need just one parametr.
+ mmep->szServiceName = mir_strdup(mi->pszService);
+ mmep->Param1 = mi->popupPosition;
+ lpGroupMenuParam gmp=(lpGroupMenuParam)wParam;
+ if (gmp != NULL) {
+ mmep->Param1 = gmp->wParam;
+ mmep->Param2 = gmp->lParam;
}
+ tmi.ownerdata=mmep;
+
+ char buf[1024];
+ sprintf(buf,"%s/%s",mi->pszService,mi->pszName);
+
+ OptParam op;
op.Handle=(HANDLE)CallService(MO_ADDNEWMENUITEM,(WPARAM)hSubGroupMenuObject,(LPARAM)&tmi);
op.Setting=OPT_MENUITEMSETUNIQNAME;
- sprintf(buf,"%s/%s",mi->pszService,mi->pszName);
op.Value=(INT_PTR)buf;
CallService(MO_SETOPTIONSMENUITEM,(WPARAM)0,(LPARAM)&op);
return (INT_PTR)op.Handle;
-
-// mainItemCount++;
-// return MENU_CUSTOMITEMMAIN|(mainMenuItem[mainItemCount-1].id);
}
INT_PTR SubGroupMenuCheckService(WPARAM wParam,LPARAM lParam) {