diff options
author | George Hazan <george.hazan@gmail.com> | 2012-06-14 17:17:39 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-06-14 17:17:39 +0000 |
commit | 37e1f0cb88e2344c288064b7d88963ba7ea26955 (patch) | |
tree | 5841101832e4c2a95a571c46ea6281c4018d09bf /plugins/Mwclist/groupmenu.cpp | |
parent | d5d023f683b23fe26ddea93738cb721d532804f0 (diff) |
- clists' menus compatibility issues;
- code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@412 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Mwclist/groupmenu.cpp')
-rw-r--r-- | plugins/Mwclist/groupmenu.cpp | 102 |
1 files changed, 37 insertions, 65 deletions
diff --git a/plugins/Mwclist/groupmenu.cpp b/plugins/Mwclist/groupmenu.cpp index fab616f6fb..496f98e78c 100644 --- a/plugins/Mwclist/groupmenu.cpp +++ b/plugins/Mwclist/groupmenu.cpp @@ -87,46 +87,31 @@ static INT_PTR BuildGroupMenu(WPARAM wParam,LPARAM lParam) static INT_PTR AddGroupMenuItem(WPARAM wParam,LPARAM lParam)
{
+ TMO_MenuItem tmi;
CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam;
+ if ( !pcli->pfnConvertMenu(mi, &tmi))
+ 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;
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);
- 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;
- tmi.root = mi->hParentMenu;
- tmi.ownerdata = NULL;
-
- {
- lpGroupMenuExecParam mmep;
- 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;
- }
op.Handle = (HANDLE)CallService(MO_ADDNEWMENUITEM,(WPARAM)hGroupMenuObject,(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;
@@ -494,44 +479,31 @@ static INT_PTR BuildSubGroupMenu(WPARAM wParam,LPARAM lParam) 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;
-
- tmi.ownerdata = NULL;
+ CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam;
+ if ( !pcli->pfnConvertMenu(mi, &tmi))
+ return 0;
- { lpSubGroupMenuExecParam 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;
|