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 | |
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
42 files changed, 368 insertions, 567 deletions
diff --git a/include/m_clist.h b/include/m_clist.h index 2417932122..40288608e5 100644 --- a/include/m_clist.h +++ b/include/m_clist.h @@ -117,6 +117,8 @@ typedef struct { }
CLISTMENUITEM;
+#define CLISTMENUITEM_OLDSIZE_V1 (offsetof(CLISTMENUITEM,hLangpack))
+
#define HGENMENU_ROOT (( HGENMENU )-1)
#define CMIF_GRAYED 1
diff --git a/include/m_clistint.h b/include/m_clistint.h index 8f58397b8e..625289d709 100644 --- a/include/m_clistint.h +++ b/include/m_clistint.h @@ -220,7 +220,7 @@ typedef struct int ( *pfnGetRowsPriorTo )( struct ClcGroup *group, struct ClcGroup *subgroup, int contactIndex );
int ( *pfnFindItem )( HWND hwnd, struct ClcData *dat, HANDLE hItem, struct ClcContact **contact, struct ClcGroup **subgroup, int *isVisible );
int ( *pfnGetRowByIndex )( struct ClcData *dat, int testindex, struct ClcContact **contact, struct ClcGroup **subgroup );
- HANDLE ( *pfnContactToHItem )( struct ClcContact* contact );
+ HANDLE ( *pfnContactToHItem )( struct ClcContact* contact );
HANDLE ( *pfnContactToItemHandle )( struct ClcContact * contact, DWORD * nmFlags );
/* clcitems.c */
@@ -262,7 +262,7 @@ typedef struct void ( *pfnCalcEipPosition )( struct ClcData *dat, struct ClcContact *contact, struct ClcGroup *group, POINT *result);
int ( *pfnGetDropTargetInformation )( HWND hwnd, struct ClcData *dat, POINT pt );
int ( *pfnClcStatusToPf2 )( int status );
- int ( *pfnIsHiddenMode )( struct ClcData *dat, int status );
+ int ( *pfnIsHiddenMode )( struct ClcData *dat, int status );
void ( *pfnHideInfoTip )( HWND hwnd, struct ClcData *dat );
void ( *pfnNotifyNewContact )( HWND hwnd, HANDLE hContact );
DWORD ( *pfnGetDefaultExStyle )( void );
@@ -327,7 +327,7 @@ typedef struct /* group.c */
TCHAR* ( *pfnGetGroupName )( int idx, DWORD* pdwFlags );
- int ( *pfnRenameGroup )( int groupID, TCHAR* newName );
+ int ( *pfnRenameGroup )( int groupID, TCHAR* newName );
/* keyboard.c */
int ( *pfnHotKeysRegister )( HWND hwnd );
@@ -382,7 +382,7 @@ typedef struct int trayIconCount;
int shellVersion;
UINT_PTR cycleTimerId;
- int cycleStep;
+ int cycleStep;
TCHAR* szTip;
BOOL bTrayMenuOnScreen;
@@ -408,6 +408,7 @@ typedef struct * version 6 additions (0.8.0.x) - accounts
*************************************************************************************/
int ( *pfnGetAccountIndexByPos )( int pos );
+ int ( *pfnConvertMenu )( CLISTMENUITEM*, TMO_MenuItem* );
}
CLIST_INTERFACE;
diff --git a/include/m_genmenu.h b/include/m_genmenu.h index c0d20fc9f1..8c181912a8 100644 --- a/include/m_genmenu.h +++ b/include/m_genmenu.h @@ -233,6 +233,7 @@ typedef struct };
DWORD hotKey;
void *ownerdata;
+ int hLangpack;
}
TMO_MenuItem,*PMO_MenuItem;
diff --git a/plugins/Chat/clist.c b/plugins/Chat/clist.c index 7c09dfe3e9..87d544097e 100644 --- a/plugins/Chat/clist.c +++ b/plugins/Chat/clist.c @@ -208,7 +208,7 @@ int CList_PrebuildContactMenu(WPARAM wParam, LPARAM lParam) char* szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
CLISTMENUITEM clmi = {0};
- clmi.cbSize = sizeof( CLISTMENUITEM );
+ clmi.cbSize = sizeof(CLISTMENUITEM);
clmi.flags = CMIM_FLAGS | CMIF_DEFAULT | CMIF_HIDDEN;
if ( szProto ) {
diff --git a/plugins/Clist_nicer/CLUIFrames/framesmenu.cpp b/plugins/Clist_nicer/CLUIFrames/framesmenu.cpp index 1d5b0dd850..07b6ebc4e6 100644 --- a/plugins/Clist_nicer/CLUIFrames/framesmenu.cpp +++ b/plugins/Clist_nicer/CLUIFrames/framesmenu.cpp @@ -44,34 +44,23 @@ INT_PTR FreeOwnerDataFrameMenu (WPARAM wParam,LPARAM lParam) static INT_PTR AddContextFrameMenuItem(WPARAM wParam,LPARAM lParam)
{
- CLISTMENUITEM *mi=(CLISTMENUITEM*)lParam;
TMO_MenuItem tmi;
+ CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam;
+ if ( !pcli->pfnConvertMenu(mi, &tmi))
+ return NULL;
- if(mi->cbSize!=sizeof(CLISTMENUITEM)) return 0;
-
- memset(&tmi,0,sizeof(tmi));
+ tmi.root = (mi->flags & CMIF_ROOTHANDLE) ? mi->hParentMenu : NULL;
- tmi.cbSize=sizeof(tmi);
- tmi.flags=mi->flags;
- tmi.hIcon=mi->hIcon;
- tmi.hotKey=mi->hotKey;
- tmi.position=mi->position;
- tmi.pszName=mi->pszName;
+ lpFrameMenuExecParam fmep = (lpFrameMenuExecParam)mir_alloc(sizeof(FrameMenuExecParam));
+ if (fmep == NULL)
+ return 0;
- if ( mi->flags & CMIF_ROOTHANDLE )
- tmi.root = mi->hParentMenu;
- {
- lpFrameMenuExecParam fmep;
- fmep=(lpFrameMenuExecParam)mir_alloc(sizeof(FrameMenuExecParam));
- if (fmep==NULL){return(0);};
- fmep->szServiceName=mir_strdup(mi->pszService);
- fmep->Frameid=mi->popupPosition;
- fmep->param1=(INT_PTR)mi->pszContactOwner;
-
- tmi.ownerdata=fmep;
- }
+ 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)
diff --git a/plugins/Clist_nicer/CLUIFrames/groupmenu.cpp b/plugins/Clist_nicer/CLUIFrames/groupmenu.cpp index 52bdb33c01..0fba19dd92 100644 --- a/plugins/Clist_nicer/CLUIFrames/groupmenu.cpp +++ b/plugins/Clist_nicer/CLUIFrames/groupmenu.cpp @@ -87,63 +87,40 @@ static 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;
-
- 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;
+ lpGroupMenuExecParam mmep = (lpGroupMenuExecParam)mir_alloc(sizeof(GroupMenuExecParam));
+ if (mmep == NULL)
+ return 0;
- {
- lpGroupMenuExecParam mmep;
- mmep=(lpGroupMenuExecParam)mir_alloc(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;
-
- }
+ //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);
- tmi.ownerdata=mmep;
- }
+ OptParam op;
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;
-
- // mainItemCount++;
- // return MENU_CUSTOMITEMMAIN|(mainMenuItem[mainItemCount-1].id);
}
-INT_PTR GroupMenuCheckService(WPARAM wParam,LPARAM lParam) {
- //not used
- return(0);
-};
+INT_PTR GroupMenuCheckService(WPARAM wParam,LPARAM lParam)
+{
+ return 0;
+}
INT_PTR GroupMenuonAddService(WPARAM wParam,LPARAM lParam) {
@@ -502,88 +479,64 @@ static INT_PTR RemoveSubGroupMenuItem(WPARAM wParam,LPARAM lParam) static int OnBuildSubGroupMenu(WPARAM wParam,LPARAM lParam)
{
- CLISTMENUITEM mi;
- struct ClcGroup *group=(struct ClcGroup *)wParam;
- if (wParam==0) return 0;
-
+ ClcGroup *group=(struct ClcGroup *)wParam;
+ if (group == 0)
+ return 0;
//contact->group
- ZeroMemory(&mi,sizeof(mi));
+ CLISTMENUITEM mi = { 0 };
mi.cbSize = sizeof(mi);
mi.flags = CMIM_FLAGS | (group->hideOffline?CMIF_CHECKED:0);
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hHideOfflineUsersHereMenuItem, (LPARAM)&mi);
return 0;
-};
+}
+
static INT_PTR BuildSubGroupMenu(WPARAM wParam,LPARAM lParam)
{
- int tick;
- HMENU hMenu;
ListParam param = { 0 };
- param.MenuObjectHandle=hSubGroupMenuObject;
- param.wParam=wParam;
+ param.MenuObjectHandle = hSubGroupMenuObject;
+ param.wParam = wParam;
- //hMenu=hMainMenu;
- hMenu=CreatePopupMenu();
- //hMenu=wParam;
- tick=GetTickCount();
+ HMENU hMenu = CreatePopupMenu();
+ int tick = GetTickCount();
NotifyEventHooks(hPreBuildSubGroupMenuEvent,wParam,0);
CallService(MO_BUILDMENU,(WPARAM)hMenu,(LPARAM)¶m);
- //DrawMenuBar((HWND)CallService("CLUI/GetHwnd",0,0));
- tick=GetTickCount()-tick;
+ tick = GetTickCount()-tick;
return(INT_PTR)hMenu;
}
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;
+ CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam;
+ if ( !pcli->pfnConvertMenu(mi, &tmi))
+ return NULL;
- //pszPopupName for new system mean root level
- //pszPopupName for old system mean that exists popup
- tmi.root = mi->hParentMenu;
+ lpSubGroupMenuExecParam mmep = (lpSubGroupMenuExecParam)mir_alloc(sizeof(SubGroupMenuExecParam));
+ if (mmep == NULL)
+ return 0;
- tmi.ownerdata=NULL;
-
- {
- lpSubGroupMenuExecParam mmep;
- mmep=(lpSubGroupMenuExecParam)mir_alloc(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;
- }
-
- tmi.ownerdata=mmep;
+ //we need just one parametr.
+ lpGroupMenuParam gmp=(lpGroupMenuParam)wParam;
+ mmep->szServiceName = mir_strdup(mi->pszService);
+ mmep->Param1 = mi->popupPosition;
+ 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) {
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) {
diff --git a/plugins/Mwclist/CLUIFrames/framesmenu.cpp b/plugins/Mwclist/CLUIFrames/framesmenu.cpp index 7a34206512..7ce6bdd2a1 100644 --- a/plugins/Mwclist/CLUIFrames/framesmenu.cpp +++ b/plugins/Mwclist/CLUIFrames/framesmenu.cpp @@ -37,34 +37,24 @@ INT_PTR FreeOwnerDataFrameMenu (WPARAM wParam,LPARAM lParam) static INT_PTR AddContextFrameMenuItem(WPARAM wParam,LPARAM lParam)
{
- CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam;
TMO_MenuItem tmi;
+ CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam;
+ if ( !pcli->pfnConvertMenu(mi, &tmi))
+ return 0;
- if (mi->cbSize != sizeof(CLISTMENUITEM)) return 0;
-
- memset(&tmi,0,sizeof(tmi));
+ if ((mi->flags & CMIF_ROOTPOPUP) || (mi->flags & CMIF_CHILDPOPUP))
+ tmi.root = mi->hParentMenu;
- tmi.cbSize = sizeof(tmi);
- tmi.flags = mi->flags;
- tmi.hIcon = mi->hIcon;
- tmi.hotKey = mi->hotKey;
- tmi.position = mi->position;
- tmi.pszName = mi->pszName;
+ lpFrameMenuExecParam fmep = (lpFrameMenuExecParam)mir_alloc(sizeof(FrameMenuExecParam));
+ if (fmep == NULL)
+ return 0;
- if (mi->flags&CMIF_ROOTPOPUP||mi->flags&CMIF_CHILDPOPUP)
- tmi.root = mi->hParentMenu;
- {
- lpFrameMenuExecParam fmep;
- fmep = (lpFrameMenuExecParam)mir_alloc(sizeof(FrameMenuExecParam));
- if (fmep == NULL){return 0;}
- fmep->szServiceName = mir_strdup(mi->pszService);
- fmep->Frameid = mi->popupPosition;
- fmep->param1 = (INT_PTR)mi->pszContactOwner;
-
- tmi.ownerdata = fmep;
- }
+ 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)
diff --git a/plugins/Mwclist/clisttray.cpp b/plugins/Mwclist/clisttray.cpp index 82ce1a2f16..d0e6e3ae93 100644 --- a/plugins/Mwclist/clisttray.cpp +++ b/plugins/Mwclist/clisttray.cpp @@ -106,38 +106,20 @@ 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 = (HGENMENU)mi->pszPopupName;
-
- tmi.ownerdata = NULL;
+ CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam;
+ if ( !pcli->pfnConvertMenu(mi, &tmi))
+ return NULL;
- {
- lpTrayMenuExecParam mmep;
- mmep = (lpTrayMenuExecParam)mir_alloc(sizeof(TrayMenuExecParam));
- if (mmep == NULL)
- return 0;
+ lpTrayMenuExecParam 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;
+ 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/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;
diff --git a/plugins/SRMM/msgs.c b/plugins/SRMM/msgs.c index ac7a615703..8ebb549339 100644 --- a/plugins/SRMM/msgs.c +++ b/plugins/SRMM/msgs.c @@ -379,7 +379,7 @@ static int PrebuildContactMenu(WPARAM wParam, LPARAM lParam) char* szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
CLISTMENUITEM clmi = {0};
- clmi.cbSize = sizeof( CLISTMENUITEM );
+ clmi.cbSize = sizeof(CLISTMENUITEM);
clmi.flags = CMIM_FLAGS | CMIF_DEFAULT | CMIF_HIDDEN;
if ( szProto ) {
diff --git a/plugins/Scriver/chat/clist.c b/plugins/Scriver/chat/clist.c index 03a88ede7f..971ddfbe03 100644 --- a/plugins/Scriver/chat/clist.c +++ b/plugins/Scriver/chat/clist.c @@ -214,7 +214,7 @@ int CList_PrebuildContactMenu(WPARAM wParam, LPARAM lParam) char* szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
CLISTMENUITEM clmi = {0};
- clmi.cbSize = sizeof( CLISTMENUITEM );
+ clmi.cbSize = sizeof(CLISTMENUITEM);
clmi.flags = CMIM_FLAGS | CMIF_DEFAULT | CMIF_HIDDEN;
if ( szProto ) {
diff --git a/plugins/Scriver/msgs.c b/plugins/Scriver/msgs.c index 0ce59281ea..486887e84e 100644 --- a/plugins/Scriver/msgs.c +++ b/plugins/Scriver/msgs.c @@ -419,7 +419,7 @@ static int PrebuildContactMenu(WPARAM wParam, LPARAM lParam) { char* szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
CLISTMENUITEM clmi = {0};
- clmi.cbSize = sizeof( CLISTMENUITEM );
+ clmi.cbSize = sizeof(CLISTMENUITEM);
clmi.flags = CMIM_FLAGS | CMIF_DEFAULT | CMIF_HIDDEN;
if ( szProto ) {
diff --git a/plugins/TabSRMM/chat/clist.cpp b/plugins/TabSRMM/chat/clist.cpp index 18f1eba4e4..540997aa87 100644 --- a/plugins/TabSRMM/chat/clist.cpp +++ b/plugins/TabSRMM/chat/clist.cpp @@ -222,7 +222,7 @@ int CList_PrebuildContactMenu(WPARAM wParam, LPARAM lParam) char* szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
CLISTMENUITEM clmi = {0};
- clmi.cbSize = sizeof( CLISTMENUITEM );
+ clmi.cbSize = sizeof(CLISTMENUITEM);
clmi.flags = CMIM_FLAGS | CMIF_DEFAULT | CMIF_HIDDEN;
if ( szProto ) {
diff --git a/plugins/TabSRMM/src/mim.cpp b/plugins/TabSRMM/src/mim.cpp index 853279a086..1e412817be 100644 --- a/plugins/TabSRMM/src/mim.cpp +++ b/plugins/TabSRMM/src/mim.cpp @@ -706,7 +706,7 @@ int CMimAPI::PrebuildContactMenu(WPARAM wParam, LPARAM lParam) char* szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
CLISTMENUITEM clmi = {0};
- clmi.cbSize = sizeof( CLISTMENUITEM );
+ clmi.cbSize = sizeof(CLISTMENUITEM);
clmi.flags = CMIM_FLAGS | CMIF_DEFAULT | CMIF_HIDDEN;
if ( szProto ) {
diff --git a/protocols/IRCG/ircproto.cpp b/protocols/IRCG/ircproto.cpp index f167eddad6..3fd32d1f68 100644 --- a/protocols/IRCG/ircproto.cpp +++ b/protocols/IRCG/ircproto.cpp @@ -1061,7 +1061,7 @@ int __cdecl CIrcProto::OnEvent( PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM case EV_PROTO_ONRENAME:
if ( hMenuRoot ) {
CLISTMENUITEM clmi = { 0 };
- clmi.cbSize = sizeof( CLISTMENUITEM );
+ clmi.cbSize = sizeof(CLISTMENUITEM);
clmi.flags = CMIM_NAME | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED;
clmi.ptszName = m_tszUserName;
CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hMenuRoot, ( LPARAM )&clmi );
diff --git a/protocols/IRCG/services.cpp b/protocols/IRCG/services.cpp index 745ebe80d6..63fd495b7a 100644 --- a/protocols/IRCG/services.cpp +++ b/protocols/IRCG/services.cpp @@ -131,7 +131,7 @@ static INT_PTR IrcMenuIgnore(WPARAM wParam, LPARAM lParam) int IrcPrebuildContactMenu( WPARAM wParam, LPARAM lParam )
{
CLISTMENUITEM clmi = {0};
- clmi.cbSize = sizeof( CLISTMENUITEM );
+ clmi.cbSize = sizeof(CLISTMENUITEM);
clmi.flags = CMIM_FLAGS | CMIF_HIDDEN;
CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )hUMenuChanSettings, ( LPARAM )&clmi );
diff --git a/protocols/IcqOscarJ/icq_menu.cpp b/protocols/IcqOscarJ/icq_menu.cpp index f6aeb99161..054cfd0b09 100644 --- a/protocols/IcqOscarJ/icq_menu.cpp +++ b/protocols/IcqOscarJ/icq_menu.cpp @@ -100,7 +100,7 @@ static INT_PTR IcqMenuHandleOpenProfile(WPARAM wParam, LPARAM lParam) static void sttEnableMenuItem( HANDLE hMenuItem, bool bEnable )
{
CLISTMENUITEM clmi = {0};
- clmi.cbSize = sizeof( CLISTMENUITEM );
+ clmi.cbSize = sizeof(CLISTMENUITEM);
clmi.flags = CMIM_FLAGS;
if ( !bEnable )
clmi.flags |= CMIF_HIDDEN;
@@ -134,7 +134,7 @@ void g_MenuInit(void) strcpy( str, "ICQ" );
CLISTMENUITEM mi = { 0 };
- mi.cbSize = sizeof( CLISTMENUITEM );
+ mi.cbSize = sizeof(CLISTMENUITEM);
mi.pszService = str;
mi.flags = CMIF_ICONFROMICOLIB;
diff --git a/protocols/JabberG/jabber_menu.cpp b/protocols/JabberG/jabber_menu.cpp index 4ddfaa7ea6..827a32011c 100644 --- a/protocols/JabberG/jabber_menu.cpp +++ b/protocols/JabberG/jabber_menu.cpp @@ -171,7 +171,7 @@ static INT_PTR JabberMenuHandleDirectPresence( WPARAM wParam, LPARAM lParam, LPA static void sttEnableMenuItem( HANDLE hMenuItem, BOOL bEnable )
{
CLISTMENUITEM clmi = {0};
- clmi.cbSize = sizeof( CLISTMENUITEM );
+ clmi.cbSize = sizeof(CLISTMENUITEM);
clmi.flags = CMIM_FLAGS;
if ( !bEnable )
clmi.flags |= CMIF_HIDDEN;
@@ -224,7 +224,7 @@ void g_MenuInit( void ) // Contact menu initialization
CLISTMENUITEM mi = { 0 };
- mi.cbSize = sizeof( CLISTMENUITEM );
+ mi.cbSize = sizeof(CLISTMENUITEM);
// "Request authorization"
mi.pszName = LPGEN("Request authorization");
@@ -408,7 +408,7 @@ int CJabberProto::OnPrebuildContactMenu( WPARAM wParam, LPARAM ) for (int i = 0; i < SIZEOF(PresenceModeArray); ++i)
{
CLISTMENUITEM clmi = {0};
- clmi.cbSize = sizeof( CLISTMENUITEM );
+ clmi.cbSize = sizeof(CLISTMENUITEM);
clmi.flags = CMIM_ICON|CMIM_FLAGS;
clmi.hIcon = (HICON)LoadSkinnedProtoIcon(m_szModuleName, PresenceModeArray[i].mode);
CallService(MS_CLIST_MODIFYMENUITEM, ( WPARAM )g_hMenuDirectPresence[i+1], ( LPARAM )&clmi );
@@ -451,7 +451,7 @@ int CJabberProto::OnPrebuildContactMenu( WPARAM wParam, LPARAM ) sttEnableMenuItem( g_hMenuResourcesRoot, TRUE );
CLISTMENUITEM mi = {0};
- mi.cbSize = sizeof( CLISTMENUITEM );
+ mi.cbSize = sizeof(CLISTMENUITEM);
mi.flags = CMIM_ICON|CMIM_FLAGS;
mi.icolibItem = GetIconHandle( IDI_JABBER );
CallService(MS_CLIST_MODIFYMENUITEM, ( WPARAM )g_hMenuResourcesRoot, ( LPARAM )&mi );
@@ -468,7 +468,7 @@ int CJabberProto::OnPrebuildContactMenu( WPARAM wParam, LPARAM ) size_t nModuleNameLength = strlen( text );
char* tDest = text + nModuleNameLength;
- mi.cbSize = sizeof( CLISTMENUITEM );
+ mi.cbSize = sizeof(CLISTMENUITEM);
mi.flags = CMIF_CHILDPOPUP;
mi.position = 0;
mi.icolibItem = GetIconHandle( IDI_REQUEST );
@@ -487,7 +487,7 @@ int CJabberProto::OnPrebuildContactMenu( WPARAM wParam, LPARAM ) }
if ( i < item->resourceCount ) {
CLISTMENUITEM clmi = {0};
- clmi.cbSize = sizeof( CLISTMENUITEM );
+ clmi.cbSize = sizeof(CLISTMENUITEM);
clmi.flags = CMIM_NAME|CMIM_FLAGS | CMIF_CHILDPOPUP|CMIF_TCHAR;
if ((item->resourceMode == RSMODE_MANUAL) && (item->manualResource == i))
clmi.flags |= CMIF_CHECKED;
@@ -510,7 +510,7 @@ int CJabberProto::OnPrebuildContactMenu( WPARAM wParam, LPARAM ) }
ZeroMemory(&mi, sizeof(mi));
- mi.cbSize = sizeof( CLISTMENUITEM );
+ mi.cbSize = sizeof(CLISTMENUITEM);
mi.flags = CMIM_FLAGS | CMIF_CHILDPOPUP|CMIF_ICONFROMICOLIB |
((item->resourceMode == RSMODE_LASTSEEN) ? CMIF_CHECKED : 0);
@@ -706,7 +706,7 @@ INT_PTR __cdecl CJabberProto::OnMenuBookmarkAdd( WPARAM wParam, LPARAM ) void CJabberProto::MenuInit()
{
CLISTMENUITEM mi = { 0 };
- mi.cbSize = sizeof( CLISTMENUITEM );
+ mi.cbSize = sizeof(CLISTMENUITEM);
char text[ 200 ];
strcpy( text, m_szModuleName );
@@ -1034,7 +1034,7 @@ void CJabberProto::EnableMenuItems( BOOL bEnable ) void CJabberProto::CheckMenuItems()
{
CLISTMENUITEM clmi = { 0 };
- clmi.cbSize = sizeof( CLISTMENUITEM );
+ clmi.cbSize = sizeof(CLISTMENUITEM);
clmi.flags = CMIM_FLAGS;
if ( !m_menuItemsStatus )
clmi.flags |= CMIF_GRAYED;
@@ -1290,7 +1290,7 @@ CJabberProto *JabberChooseInstance(bool bIsLink) }
CLISTMENUITEM clmi = {0};
- clmi.cbSize = sizeof( CLISTMENUITEM );
+ clmi.cbSize = sizeof(CLISTMENUITEM);
int nItems = 0, lastItemId = 0;
for (int i = 0; i < g_Instances.getCount(); ++i) {
diff --git a/protocols/JabberG/jabber_proto.cpp b/protocols/JabberG/jabber_proto.cpp index 2457eab7a2..7d9ef3f14a 100644 --- a/protocols/JabberG/jabber_proto.cpp +++ b/protocols/JabberG/jabber_proto.cpp @@ -1656,7 +1656,7 @@ int __cdecl CJabberProto::OnEvent( PROTOEVENTTYPE eventType, WPARAM wParam, LPAR if ( m_hMenuRoot )
{
CLISTMENUITEM clmi = { 0 };
- clmi.cbSize = sizeof( CLISTMENUITEM );
+ clmi.cbSize = sizeof(CLISTMENUITEM);
clmi.flags = CMIM_NAME | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED;
clmi.ptszName = m_tszUserName;
JCallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )m_hMenuRoot, ( LPARAM )&clmi );
diff --git a/protocols/Yahoo/proto.cpp b/protocols/Yahoo/proto.cpp index 37a3af24d1..4dd453a489 100644 --- a/protocols/Yahoo/proto.cpp +++ b/protocols/Yahoo/proto.cpp @@ -807,7 +807,7 @@ int __cdecl CYahooProto::OnEvent( PROTOEVENTTYPE eventType, WPARAM wParam, LPARA case EV_PROTO_ONRENAME:
if ( mainMenuRoot ) {
CLISTMENUITEM clmi = { 0 };
- clmi.cbSize = sizeof( CLISTMENUITEM );
+ clmi.cbSize = sizeof(CLISTMENUITEM);
clmi.flags = CMIM_NAME | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED;
clmi.ptszName = m_tszUserName;
YAHOO_CallService( MS_CLIST_MODIFYMENUITEM, ( WPARAM )mainMenuRoot, ( LPARAM )&clmi );
diff --git a/src/modules/autoaway/autoaway.cpp b/src/modules/autoaway/autoaway.cpp index af774200d9..055313736b 100644 --- a/src/modules/autoaway/autoaway.cpp +++ b/src/modules/autoaway/autoaway.cpp @@ -53,7 +53,7 @@ static int AutoAwayEvent(WPARAM, LPARAM lParam) continue;
}
if ( currentstatus >= ID_STATUS_ONLINE && currentstatus != ID_STATUS_INVISIBLE ) {
- if ( (lParam&IDF_ISIDLE) && ( currentstatus == ID_STATUS_ONLINE || currentstatus == ID_STATUS_FREECHAT )) {
+ if ((lParam&IDF_ISIDLE) && ( currentstatus == ID_STATUS_ONLINE || currentstatus == ID_STATUS_FREECHAT )) {
DBWriteContactSettingByte( NULL, AA_MODULE, pa->szModuleName, 1 );
Proto_SetStatus( pa->szModuleName, status );
}
diff --git a/src/modules/clist/clc.cpp b/src/modules/clist/clc.cpp index 982ede3406..e438e4d7b3 100644 --- a/src/modules/clist/clc.cpp +++ b/src/modules/clist/clc.cpp @@ -71,7 +71,7 @@ static int ClcSettingChanged(WPARAM wParam, LPARAM lParam) {
char *szProto;
DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *) lParam;
- if ( (HANDLE)wParam != NULL && !strcmp(cws->szModule, "CList")) {
+ if ((HANDLE)wParam != NULL && !strcmp(cws->szModule, "CList")) {
if (!strcmp(cws->szSetting, "MyHandle")) {
cli.pfnInvalidateDisplayNameCacheEntry((HANDLE) wParam);
cli.pfnClcBroadcast( INTM_NAMECHANGED, wParam, lParam);
diff --git a/src/modules/clist/clc.h b/src/modules/clist/clc.h index f9ac61e634..ba12d8b70a 100644 --- a/src/modules/clist/clc.h +++ b/src/modules/clist/clc.h @@ -156,6 +156,7 @@ void GetFontSetting(int i, LOGFONTA *lf, COLORREF *colour); /* clistmenus.c */
HGENMENU fnGetProtocolMenu( const char* );
int fnGetProtocolVisibility( const char* accName );
+int fnConvertMenu( CLISTMENUITEM*, TMO_MenuItem* );
int fnGetAccountIndexByPos(int Pos);
int fnGetProtoIndexByPos(PROTOCOLDESCRIPTOR ** proto, int protoCnt, int Pos);
diff --git a/src/modules/clist/clistcore.cpp b/src/modules/clist/clistcore.cpp index ad3f6832de..ae662be16f 100644 --- a/src/modules/clist/clistcore.cpp +++ b/src/modules/clist/clistcore.cpp @@ -205,6 +205,7 @@ static INT_PTR srvRetrieveInterface( WPARAM, LPARAM lParam ) cli.pfnReloadProtoMenus = fnReloadProtoMenus;
cli.pfnGetAccountIndexByPos = fnGetAccountIndexByPos;
cli.pfnGetProtocolMenu = fnGetProtocolMenu;
+ cli.pfnConvertMenu = fnConvertMenu;
cli.hInst = ( HMODULE )lParam;
diff --git a/src/modules/clist/clistmenus.cpp b/src/modules/clist/clistmenus.cpp index 2a77fbb731..b14675091a 100644 --- a/src/modules/clist/clistmenus.cpp +++ b/src/modules/clist/clistmenus.cpp @@ -210,33 +210,21 @@ static INT_PTR BuildMainMenu(WPARAM, LPARAM) static INT_PTR AddMainMenuItem(WPARAM, LPARAM lParam)
{
- CLISTMENUITEM* mi = ( CLISTMENUITEM* )lParam;
- if ( mi->cbSize != sizeof( CLISTMENUITEM ))
- return NULL;
+ TMO_MenuItem tmi;
+ CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam;
+ if ( !cli.pfnConvertMenu(mi, &tmi))
+ return 0;
- TMO_MenuItem tmi = { 0 };
- tmi.cbSize = sizeof(tmi);
- tmi.flags = mi->flags;
- tmi.hIcon = mi->hIcon;
- tmi.hotKey = mi->hotKey;
- tmi.ptszName = mi->ptszName;
- tmi.position = mi->position;
-
- //pszPopupName for new system mean root level
- //pszPopupName for old system mean that exists popup
- tmi.root = ( HGENMENU )mi->pszPopupName;
- {
- lpMainMenuExecParam mmep;
- mmep = ( lpMainMenuExecParam )mir_alloc( sizeof( MainMenuExecParam ));
- if ( mmep == NULL )
- return 0;
-
- //we need just one parametr.
- mmep->szServiceName = mir_strdup(mi->pszService);
- mmep->Param1 = mi->popupPosition;
- mmep->szMenuName = tmi.ptszName;
- tmi.ownerdata=mmep;
- }
+ lpMainMenuExecParam mmep;
+ mmep = ( lpMainMenuExecParam )mir_alloc( sizeof( MainMenuExecParam ));
+ if ( mmep == NULL )
+ return 0;
+
+ //we need just one parametr.
+ mmep->szServiceName = mir_strdup(mi->pszService);
+ mmep->Param1 = mi->popupPosition;
+ mmep->szMenuName = tmi.ptszName;
+ tmi.ownerdata = mmep;
PMO_IntMenuItem pimi = MO_AddNewMenuItem( hMainMenuObject, &tmi );
@@ -249,8 +237,7 @@ static INT_PTR AddMainMenuItem(WPARAM, LPARAM lParam) name = mir_t2a( mi->ptszName );
needFree = true;
}
- else
- name = mi->pszName;
+ else name = mi->pszName;
MO_SetOptionsMenuItem( pimi, OPT_MENUITEMSETUNIQNAME, ( INT_PTR )name );
if (needFree) mir_free(name);
@@ -300,19 +287,11 @@ static INT_PTR RemoveContactMenuItem(WPARAM wParam, LPARAM) static INT_PTR AddContactMenuItem(WPARAM, LPARAM lParam)
{
- CLISTMENUITEM *mi=(CLISTMENUITEM*)lParam;
- if ( mi->cbSize != sizeof( CLISTMENUITEM ))
+ TMO_MenuItem tmi;
+ CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam;
+ if ( !cli.pfnConvertMenu(mi, &tmi))
return 0;
- TMO_MenuItem tmi = { 0 };
- tmi.cbSize = sizeof(tmi);
- tmi.flags = mi->flags;
- tmi.hIcon = mi->hIcon;
- tmi.hotKey = mi->hotKey;
- tmi.position = mi->position;
- tmi.ptszName = mi->ptszName;
- tmi.root = ( HGENMENU )mi->pszPopupName;
-
if ( !( mi->flags & CMIF_ROOTHANDLE )) {
//old system
tmi.flags |= CMIF_ROOTHANDLE;
@@ -387,18 +366,14 @@ INT_PTR ContactMenuExecService(WPARAM wParam, LPARAM lParam) INT_PTR ContactMenuCheckService(WPARAM wParam, LPARAM)
{
PCheckProcParam pcpp = ( PCheckProcParam )wParam;
- BuildContactParam *bcp=NULL;
- lpContactMenuExecParam cmep=NULL;
- TMO_MenuItem mi;
-
if ( pcpp == NULL )
return FALSE;
- bcp = ( BuildContactParam* )pcpp->wParam;
+ BuildContactParam *bcp = ( BuildContactParam* )pcpp->wParam;
if ( bcp == NULL )
return FALSE;
- cmep = ( lpContactMenuExecParam )pcpp->MenuItemOwnerData;
+ lpContactMenuExecParam cmep = ( lpContactMenuExecParam )pcpp->MenuItemOwnerData;
if ( cmep == NULL ) //this is root...build it
return TRUE;
@@ -406,6 +381,8 @@ INT_PTR ContactMenuCheckService(WPARAM wParam, LPARAM) if ( bcp->szProto == NULL ) return FALSE;
if ( strcmp( cmep->pszContactOwner, bcp->szProto )) return FALSE;
}
+
+ TMO_MenuItem mi;
if ( MO_GetMenuItem(( WPARAM )pcpp->MenuItemHandle, ( LPARAM )&mi ) == 0 ) {
if ( mi.flags & CMIF_HIDDEN ) return FALSE;
if ( mi.flags & CMIF_NOTONLIST && bcp->isOnList ) return FALSE;
@@ -432,25 +409,24 @@ INT_PTR FreeOwnerDataContactMenu (WPARAM, LPARAM lParam) BOOL FindMenuHandleByGlobalID(HMENU hMenu, PMO_IntMenuItem id, MenuItemData* itdat)
{
- int i;
- PMO_IntMenuItem pimi;
- MENUITEMINFO mii={0};
- BOOL inSub=FALSE;
if (!itdat)
return FALSE;
+ MENUITEMINFO mii = {0};
mii.cbSize = MENUITEMINFO_V4_SIZE;
mii.fMask = MIIM_SUBMENU | MIIM_DATA;
- for ( i = GetMenuItemCount( hMenu )-1; i >= 0; i-- ) {
+ for ( int i = GetMenuItemCount( hMenu )-1; i >= 0; i-- ) {
GetMenuItemInfo(hMenu, i, TRUE, &mii);
if ( mii.fType == MFT_SEPARATOR )
continue;
+
+ BOOL inSub = FALSE;
if ( mii.hSubMenu )
inSub = FindMenuHandleByGlobalID(mii.hSubMenu, id, itdat);
if ( inSub )
return inSub;
- pimi = MO_GetIntMenuItem(( HGENMENU )mii.dwItemData );
+ PMO_IntMenuItem pimi = MO_GetIntMenuItem(( HGENMENU )mii.dwItemData );
if ( pimi != NULL ) {
if ( pimi == id ) {
itdat->OwnerMenu = hMenu;
@@ -472,10 +448,8 @@ INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM) return TRUE;
StatusMenuExecParam *smep = ( StatusMenuExecParam* )pcpp->MenuItemOwnerData;
- if (smep && !smep->status && smep->custom )
- {
- if (wildcmp(smep->svc, "*XStatus*"))
- {
+ if (smep && !smep->status && smep->custom ) {
+ if ( wildcmp(smep->svc, "*XStatus*")) {
int XStatus = CallProtoService(smep->proto, "/GetXStatus", 0, 0);
char buf[255];
mir_snprintf( buf, sizeof(buf), "*XStatus%d", XStatus );
@@ -488,11 +462,9 @@ INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM) else
timi->mi.flags &= ~CMIF_CHECKED;
- if ( reset || check )
- {
+ if ( reset || check ) {
PMO_IntMenuItem timiParent = MO_GetIntMenuItem( timi->mi.root );
- if (timiParent)
- {
+ if (timiParent) {
CLISTMENUITEM mi2 = {0};
mi2.cbSize = sizeof(mi2);
mi2.flags = CMIM_NAME | CMIF_TCHAR;
@@ -502,24 +474,20 @@ INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM) MenuItemData it = {0};
- if (FindMenuHandleByGlobalID(hStatusMenu, timiParent, &it))
- {
+ if (FindMenuHandleByGlobalID(hStatusMenu, timiParent, &it)) {
MENUITEMINFO mi ={0};
TCHAR d[100];
GetMenuString(it.OwnerMenu, it.position, d, SIZEOF(d), MF_BYPOSITION);
- if (!IsWinVer98Plus())
- {
+ if (!IsWinVer98Plus()) {
mi.cbSize = MENUITEMINFO_V4_SIZE;
mi.fMask = MIIM_TYPE | MIIM_STATE;
mi.fType = MFT_STRING;
}
- else
- {
+ else {
mi.cbSize = sizeof( mi );
mi.fMask = MIIM_STRING | MIIM_STATE;
- if ( timi->iconId != -1 )
- {
+ if ( timi->iconId != -1 ) {
mi.fMask |= MIIM_BITMAP;
if (IsWinVerVistaPlus() && isThemeActive()) {
if (timi->hBmp == NULL)
@@ -685,19 +653,11 @@ INT_PTR FreeOwnerDataStatusMenu(WPARAM, LPARAM lParam) //wparam MenuItemHandle
static INT_PTR ModifyCustomMenuItem(WPARAM wParam, LPARAM lParam)
{
- CLISTMENUITEM *mi=(CLISTMENUITEM*)lParam;
TMO_MenuItem tmi;
+ CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam;
+ if ( !cli.pfnConvertMenu(mi, &tmi))
+ return 0;
- if ( lParam == 0 )
- return -1;
- if ( mi->cbSize != sizeof( CLISTMENUITEM ))
- return 1;
-
- tmi.cbSize = sizeof(tmi);
- tmi.flags = mi->flags;
- tmi.hIcon = mi->hIcon;
- tmi.hotKey = mi->hotKey;
- tmi.ptszName = mi->ptszName;
return MO_ModifyMenuItem(( PMO_IntMenuItem )wParam, &tmi );
}
@@ -718,7 +678,7 @@ INT_PTR MenuProcessCommand(WPARAM wParam, LPARAM lParam) //process old menu sys
if ( HIWORD(wParam) & MPCF_CONTACTMENU )
- return MO_ProcessCommandBySubMenuIdent( (int)hContactMenuObject, LOWORD(wParam), lParam );
+ return MO_ProcessCommandBySubMenuIdent((int)hContactMenuObject, LOWORD(wParam), lParam );
//unknown old menu
return MO_ProcessCommandByMenuIdent( LOWORD(wParam), lParam );
@@ -1034,15 +994,14 @@ void RebuildMenuOrder( void ) tmi.hIcon = LoadSkinIcon( skinIconStatusList[j] );
tmi.position = pos++;
tmi.hotKey = MAKELPARAM(MOD_CONTROL, '0'+j);
- {
- //owner data
- lpStatusMenuExecParam smep = ( lpStatusMenuExecParam )mir_alloc( sizeof( StatusMenuExecParam ));
- smep->custom = FALSE;
- smep->status = statusModeList[j];
- smep->proto = NULL;
- smep->svc = NULL;
- tmi.ownerdata = smep;
- }
+
+ //owner data
+ lpStatusMenuExecParam smep = ( lpStatusMenuExecParam )mir_alloc( sizeof( StatusMenuExecParam ));
+ smep->custom = FALSE;
+ smep->status = statusModeList[j];
+ smep->proto = NULL;
+ smep->svc = NULL;
+ tmi.ownerdata = smep;
{
TCHAR buf[ 256 ], hotkeyName[ 100 ];
WORD hotKey = GetHotkeyValue( statusHotkeys[j] );
@@ -1144,28 +1103,28 @@ static int MenuProtoAck(WPARAM, LPARAM lParam) tmi.flags = CMIM_FLAGS | CMIF_ROOTHANDLE;
MO_ModifyMenuItem( hStatusMainMenuHandles[pos], &tmi );
}
- //SetMenuDefaultItem(hStatusMenu, -1, FALSE);
+
cli.currentStatusMenuItem=0;
}
for ( i=0; i < accounts.getCount(); i++ ) {
if ( !lstrcmpA( accounts[i]->szModuleName, ack->szModule )) {
- //hProcess is previous mode, lParam is new mode
- if ((( int )ack->hProcess >= ID_STATUS_OFFLINE || ( int )ack->hProcess == 0 ) && ( int )ack->hProcess < ID_STATUS_OFFLINE + SIZEOF(statusModeList)) {
- int pos = statustopos(( int )ack->hProcess);
- if ( pos == -1 )
- pos = 0;
- for ( pos = 0; pos < SIZEOF(statusModeList); pos++ ) {
- tmi.flags = CMIM_FLAGS | CMIF_ROOTHANDLE;
- MO_ModifyMenuItem( hStatusMenuHandles[i].menuhandle[pos], &tmi );
- } }
-
- if ( ack->lParam >= ID_STATUS_OFFLINE && ack->lParam < ID_STATUS_OFFLINE + SIZEOF(statusModeList)) {
- int pos = statustopos(( int )ack->lParam );
- if ( pos >= 0 && pos < SIZEOF(statusModeList)) {
- tmi.flags = CMIM_FLAGS | CMIF_ROOTHANDLE | CMIF_CHECKED;
- MO_ModifyMenuItem( hStatusMenuHandles[i].menuhandle[pos], &tmi );
- } }
+ if ((( int )ack->hProcess >= ID_STATUS_OFFLINE || ( int )ack->hProcess == 0 ) && ( int )ack->hProcess < ID_STATUS_OFFLINE + SIZEOF(statusModeList)) {
+ int pos = statustopos(( int )ack->hProcess);
+ if ( pos == -1 )
+ pos = 0;
+ for ( pos = 0; pos < SIZEOF(statusModeList); pos++ ) {
+ tmi.flags = CMIM_FLAGS | CMIF_ROOTHANDLE;
+ MO_ModifyMenuItem( hStatusMenuHandles[i].menuhandle[pos], &tmi );
+ } }
+
+ if ( ack->lParam >= ID_STATUS_OFFLINE && ack->lParam < ID_STATUS_OFFLINE + SIZEOF(statusModeList)) {
+ int pos = statustopos(( int )ack->lParam );
+ if ( pos >= 0 && pos < SIZEOF(statusModeList)) {
+ tmi.flags = CMIM_FLAGS | CMIF_ROOTHANDLE | CMIF_CHECKED;
+ MO_ModifyMenuItem( hStatusMenuHandles[i].menuhandle[pos], &tmi );
+ }
+ }
break;
} }
@@ -1173,6 +1132,32 @@ static int MenuProtoAck(WPARAM, LPARAM lParam) return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
+int fnConvertMenu( CLISTMENUITEM* mi, TMO_MenuItem* pmi )
+{
+ if (mi == NULL || pmi == NULL)
+ return FALSE;
+
+ if (mi->cbSize != sizeof(CLISTMENUITEM) && mi->cbSize != CLISTMENUITEM_OLDSIZE_V1)
+ return FALSE;
+
+ memset(pmi, 0, sizeof(TMO_MenuItem));
+ pmi->cbSize = sizeof(tmi);
+ pmi->root = mi->hParentMenu;
+ pmi->flags = mi->flags;
+ pmi->hIcon = mi->hIcon;
+ pmi->hotKey = mi->hotKey;
+ pmi->pszName = mi->pszName;
+ pmi->position = mi->position;
+ if (mi->cbSize == sizeof(CLISTMENUITEM))
+ pmi->hLangpack = mi->hLangpack;
+
+ return TRUE;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
static MenuProto* FindProtocolMenu( const char* proto )
{
for (int i=0; i < cli.menuProtoCount; i++)
@@ -1195,25 +1180,17 @@ HGENMENU fnGetProtocolMenu( const char* proto ) return NULL;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
static INT_PTR AddStatusMenuItem(WPARAM wParam, LPARAM lParam)
{
- CLISTMENUITEM *mi = ( CLISTMENUITEM* )lParam;
- if ( mi->cbSize != sizeof( CLISTMENUITEM ))
+ TMO_MenuItem tmi;
+ CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam;
+ if ( !cli.pfnConvertMenu(mi, &tmi))
return 0;
- PMO_IntMenuItem pRoot = NULL;
- lpStatusMenuExecParam smep = NULL;
-
- TMO_MenuItem tmi = { 0 };
- tmi.cbSize = sizeof(tmi);
- tmi.hIcon = mi->hIcon;
- tmi.hotKey = mi->hotKey;
- tmi.position = mi->position;
- tmi.pszName = mi->pszName;
- tmi.flags = mi->flags;
- tmi.root = mi->hParentMenu;
-
// for new style menus the pszPopupName contains the root menu handle
+ PMO_IntMenuItem pRoot = NULL;
if ( mi->flags & CMIF_ROOTHANDLE )
pRoot = MO_GetIntMenuItem( mi->hParentMenu );
@@ -1251,6 +1228,7 @@ static INT_PTR AddStatusMenuItem(WPARAM wParam, LPARAM lParam) }
//owner data
+ lpStatusMenuExecParam smep = NULL;
if ( mi->pszService ) {
smep = ( lpStatusMenuExecParam )mir_calloc(sizeof(StatusMenuExecParam));
smep->custom = TRUE;
@@ -1284,6 +1262,8 @@ static INT_PTR AddStatusMenuItem(WPARAM wParam, LPARAM lParam) return ( INT_PTR )menuHandle;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
static INT_PTR HotkeySetStatus(WPARAM wParam, LPARAM lParam)
{
return SetStatusMode( lParam, 0 );
diff --git a/src/modules/clist/genmenu.cpp b/src/modules/clist/genmenu.cpp index 13e9d61e46..e0fc7b34e3 100644 --- a/src/modules/clist/genmenu.cpp +++ b/src/modules/clist/genmenu.cpp @@ -208,7 +208,7 @@ INT_PTR MO_ProcessHotKeys( HANDLE menuHandle, INT_PTR vKey ) EnterCriticalSection( &csMenuHook );
- int objidx = GetMenuObjbyId( (int)menuHandle );
+ int objidx = GetMenuObjbyId((int)menuHandle );
if ( objidx == -1 ) {
LeaveCriticalSection( &csMenuHook );
return FALSE;
@@ -318,22 +318,17 @@ int MO_ModifyMenuItem( PMO_IntMenuItem menuHandle, PMO_MenuItem pmi ) FreeAndNil(( void** )&pimi->mi.pszName );
if ( pmi->flags & CMIF_UNICODE )
- pimi->mi.ptszName = mir_tstrdup(( pmi->flags & CMIF_KEEPUNTRANSLATED ) ? pmi->ptszName : TranslateTS( pmi->ptszName ));
- else {
- if ( pmi->flags & CMIF_KEEPUNTRANSLATED ) {
- int len = lstrlenA( pmi->pszName );
- pimi->mi.ptszName = ( TCHAR* )mir_alloc( sizeof( TCHAR )*( len+1 ));
- MultiByteToWideChar( CP_ACP, 0, pmi->pszName, -1, pimi->mi.ptszName, len+1 );
- pimi->mi.ptszName[ len ] = 0;
- }
- else pimi->mi.ptszName = LangPackPcharToTchar( pmi->pszName );
- }
+ pimi->mi.ptszName = mir_tstrdup(pmi->ptszName);
+ else
+ pimi->mi.ptszName = mir_a2t(pmi->pszName);
}
+
if ( pmi->flags & CMIM_FLAGS ) {
oldflags = pimi->mi.flags & ( CMIF_ROOTHANDLE | CMIF_ICONFROMICOLIB );
pimi->mi.flags = (pmi->flags & ~CMIM_ALL) | oldflags;
}
- if ( (pmi->flags & CMIM_ICON) && !bIconsDisabled ) {
+
+ if ((pmi->flags & CMIM_ICON) && !bIconsDisabled ) {
if ( pimi->mi.flags & CMIF_ICONFROMICOLIB ) {
HICON hIcon = IcoLib_GetIconByHandle( pmi->hIcolibItem, false );
if ( hIcon != NULL ) {
@@ -350,7 +345,10 @@ int MO_ModifyMenuItem( PMO_IntMenuItem menuHandle, PMO_MenuItem pmi ) else
pimi->iconId = -1; //fixme, should remove old icon & shuffle all iconIds
}
- if (pimi->hBmp) DeleteObject(pimi->hBmp); pimi->hBmp = NULL;
+ if (pimi->hBmp) {
+ DeleteObject(pimi->hBmp);
+ pimi->hBmp = NULL;
+ }
}
if ( pmi->flags & CMIM_HOTKEY )
@@ -504,7 +502,7 @@ int MO_SetOptionsMenuObject( HANDLE handle, int setting, INT_PTR value ) EnterCriticalSection( &csMenuHook );
__try
{
- pimoidx = GetMenuObjbyId( (int)handle );
+ pimoidx = GetMenuObjbyId((int)handle );
res = pimoidx != -1;
if ( res ) {
TIntMenuObject* pmo = g_menus[pimoidx];
@@ -637,7 +635,7 @@ PMO_IntMenuItem MO_AddNewMenuItem( HANDLE menuobjecthandle, PMO_MenuItem pmi ) return MO_AddOldNewMenuItem( menuobjecthandle, pmi );
EnterCriticalSection( &csMenuHook );
- int objidx = GetMenuObjbyId( (int)menuobjecthandle );
+ int objidx = GetMenuObjbyId((int)menuobjecthandle );
if ( objidx == -1 ) {
LeaveCriticalSection( &csMenuHook );
return NULL;
@@ -655,13 +653,9 @@ PMO_IntMenuItem MO_AddNewMenuItem( HANDLE menuobjecthandle, PMO_MenuItem pmi ) p->originalPosition = pmi->position;
if ( pmi->flags & CMIF_UNICODE )
- p->mi.ptszName = mir_tstrdup(( pmi->flags & CMIF_KEEPUNTRANSLATED ) ? pmi->ptszName : TranslateTS( pmi->ptszName ));
- else {
- if ( pmi->flags & CMIF_KEEPUNTRANSLATED )
- p->mi.ptszName = mir_a2u(pmi->pszName);
- else
- p->mi.ptszName = LangPackPcharToTchar( pmi->pszName );
- }
+ p->mi.ptszName = mir_tstrdup(pmi->ptszName);
+ else
+ p->mi.ptszName = mir_a2u(pmi->pszName);
if ( pmi->hIcon != NULL && !bIconsDisabled ) {
if ( pmi->flags & CMIF_ICONFROMICOLIB ) {
@@ -715,7 +709,7 @@ PMO_IntMenuItem MO_AddOldNewMenuItem( HANDLE menuobjecthandle, PMO_MenuItem pmi if ( !bIsGenMenuInited || pmi == NULL )
return NULL;
- int objidx = GetMenuObjbyId( (int)menuobjecthandle );
+ int objidx = GetMenuObjbyId((int)menuobjecthandle );
if ( objidx == -1 )
return NULL;
@@ -873,7 +867,7 @@ INT_PTR MO_BuildMenu(WPARAM wParam, LPARAM lParam) EnterCriticalSection( &csMenuHook );
ListParam *lp = ( ListParam* )lParam;
- int pimoidx = GetMenuObjbyId( (int)lp->MenuObjectHandle );
+ int pimoidx = GetMenuObjbyId((int)lp->MenuObjectHandle );
if ( pimoidx == -1 ) {
LeaveCriticalSection( &csMenuHook );
return 0;
@@ -1073,7 +1067,7 @@ int OnIconLibChanges(WPARAM, LPARAM) {
EnterCriticalSection( &csMenuHook );
for ( int mo=0; mo < g_menus.getCount(); mo++ )
- if ( (int)hStatusMenuObject != g_menus[mo]->id ) //skip status menu
+ if ((int)hStatusMenuObject != g_menus[mo]->id ) //skip status menu
MO_RecursiveWalkMenu( g_menus[mo]->m_items.first, MO_ReloadIcon, 0 );
LeaveCriticalSection( &csMenuHook );
@@ -1151,7 +1145,7 @@ int RegisterAllIconsInIconLib() {
//register all icons
for ( int mo=0; mo < g_menus.getCount(); mo++ ) {
- if ( (int)hStatusMenuObject == g_menus[mo]->id ) //skip status menu
+ if ((int)hStatusMenuObject == g_menus[mo]->id ) //skip status menu
continue;
MO_RecursiveWalkMenu( g_menus[mo]->m_items.first, MO_RegisterIcon, 0 );
@@ -1162,7 +1156,7 @@ int RegisterAllIconsInIconLib() int TryProcessDoubleClick( HANDLE hContact )
{
- int iMenuID = GetMenuObjbyId( (int)hContactMenuObject );
+ int iMenuID = GetMenuObjbyId((int)hContactMenuObject );
if ( iMenuID != -1 ) {
NotifyEventHooks(hPreBuildContactMenuEvent, (WPARAM)hContact, 0);
diff --git a/src/modules/clist/genmenu.h b/src/modules/clist/genmenu.h index 14d820575e..1ae6c00b52 100644 --- a/src/modules/clist/genmenu.h +++ b/src/modules/clist/genmenu.h @@ -48,6 +48,7 @@ typedef struct _tagIntMenuItem HANDLE hIcolibItem; // handle of iconlib item
HBITMAP hBmp;
int originalPosition;
+ int hLangpack;
struct _tagIntMenuItem *next; // next item in list
struct TIntMenuObject *parent;
diff --git a/src/modules/database/dbutils.cpp b/src/modules/database/dbutils.cpp index 6cbf8ca781..cd4168884d 100644 --- a/src/modules/database/dbutils.cpp +++ b/src/modules/database/dbutils.cpp @@ -93,7 +93,7 @@ static INT_PTR DbEventGetText(WPARAM wParam, LPARAM lParam) BOOL bIsDenyUnicode = (egt->datatype & DBVTF_DENYUNICODE);
DBEVENTINFO* dbei = egt->dbei;
- DBEVENTTYPEDESCR* et = ( DBEVENTTYPEDESCR* )DbEventTypeGet( ( WPARAM )dbei->szModule, ( LPARAM )dbei->eventType );
+ DBEVENTTYPEDESCR* et = ( DBEVENTTYPEDESCR* )DbEventTypeGet(( WPARAM )dbei->szModule, ( LPARAM )dbei->eventType );
if ( et && ServiceExists( et->textService ))
return CallService( et->textService, wParam, lParam );
@@ -163,7 +163,7 @@ static INT_PTR DbEventGetIcon( WPARAM wParam, LPARAM lParam ) {
DBEVENTINFO* dbei = ( DBEVENTINFO* )lParam;
HICON icon = NULL;
- DBEVENTTYPEDESCR* et = ( DBEVENTTYPEDESCR* )DbEventTypeGet( ( WPARAM )dbei->szModule, ( LPARAM )dbei->eventType );
+ DBEVENTTYPEDESCR* et = ( DBEVENTTYPEDESCR* )DbEventTypeGet(( WPARAM )dbei->szModule, ( LPARAM )dbei->eventType );
if ( et && ServiceExists( et->iconService )) {
icon = ( HICON )CallService( et->iconService, wParam, lParam );
diff --git a/src/modules/database/profilemanager.cpp b/src/modules/database/profilemanager.cpp index cf1521872d..3ee38c754c 100644 --- a/src/modules/database/profilemanager.cpp +++ b/src/modules/database/profilemanager.cpp @@ -89,7 +89,7 @@ static int findProfiles(TCHAR * szProfileDir, ENUMPROFILECALLBACK callback, LPAR do {
// find all subfolders except "." and ".."
- if ( (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && _tcscmp(ffd.cFileName, _T(".")) && _tcscmp(ffd.cFileName, _T("..")) ) {
+ if ((ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && _tcscmp(ffd.cFileName, _T(".")) && _tcscmp(ffd.cFileName, _T("..")) ) {
TCHAR buf[MAX_PATH], profile[MAX_PATH];
mir_sntprintf(buf, SIZEOF(buf), _T("%s\\%s\\%s.dat"), szProfileDir, ffd.cFileName, ffd.cFileName);
if (_taccess(buf, 0) == 0) {
diff --git a/src/modules/fonts/services.cpp b/src/modules/fonts/services.cpp index 0a00198d66..1ffed036c2 100644 --- a/src/modules/fonts/services.cpp +++ b/src/modules/fonts/services.cpp @@ -312,7 +312,7 @@ INT_PTR RegisterFont(WPARAM wParam, LPARAM) {
#if defined( _UNICODE )
TFontID temp;
- ConvertFontID( ( FontID* )wParam, &temp );
+ ConvertFontID(( FontID* )wParam, &temp );
return sttRegisterFontWorker( &temp );
#else
return sttRegisterFontWorker(( TFontID* )wParam );
@@ -486,7 +486,7 @@ INT_PTR RegisterEffect(WPARAM wParam, LPARAM lParam) {
#if defined( _UNICODE )
TEffectID temp;
- ConvertEffectID( ( EffectID* )wParam, &temp );
+ ConvertEffectID(( EffectID* )wParam, &temp );
return sttRegisterEffectWorker( &temp );
#else
return sttRegisterEffectWorker(( TEffectID* )wParam );
diff --git a/src/modules/icolib/skin2icons.cpp b/src/modules/icolib/skin2icons.cpp index 10e1ef58dc..0993e7ef10 100644 --- a/src/modules/icolib/skin2icons.cpp +++ b/src/modules/icolib/skin2icons.cpp @@ -42,7 +42,7 @@ struct IcoLibOptsData { CRITICAL_SECTION csIconList;
-#define SECTIONPARAM_MAKE(index, level, flags) MAKELONG( (index)&0xFFFF, MAKEWORD( level, flags ) )
+#define SECTIONPARAM_MAKE(index, level, flags) MAKELONG((index)&0xFFFF, MAKEWORD( level, flags ) )
#define SECTIONPARAM_INDEX(lparam) LOWORD( lparam )
#define SECTIONPARAM_LEVEL(lparam) LOBYTE( HIWORD(lparam) )
#define SECTIONPARAM_FLAGS(lparam) HIBYTE( HIWORD(lparam) )
diff --git a/src/modules/idle/idle.cpp b/src/modules/idle/idle.cpp index 96c71161da..dbd684b675 100644 --- a/src/modules/idle/idle.cpp +++ b/src/modules/idle/idle.cpp @@ -420,7 +420,7 @@ static INT_PTR CALLBACK IdleOptsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L case IDC_IDLE1STTIME:
{
int min;
- if ( (HWND)lParam != GetFocus() || HIWORD(wParam) != EN_CHANGE ) return FALSE;
+ if ((HWND)lParam != GetFocus() || HIWORD(wParam) != EN_CHANGE ) return FALSE;
min=GetDlgItemInt(hwndDlg, IDC_IDLE1STTIME, NULL, FALSE);
if ( min == 0 && GetWindowTextLength(GetDlgItem(hwndDlg, IDC_IDLE1STTIME)) )
SendDlgItemMessage(hwndDlg, IDC_IDLESPIN, UDM_SETPOS, 0, MAKELONG((short) 1, 0));
diff --git a/src/modules/netlib/netlib.cpp b/src/modules/netlib/netlib.cpp index cb46c6d14d..d1c0579c37 100644 --- a/src/modules/netlib/netlib.cpp +++ b/src/modules/netlib/netlib.cpp @@ -420,7 +420,7 @@ INT_PTR NetlibHttpUrlEncode(WPARAM, LPARAM lParam) return (INT_PTR)(char*)NULL;
}
for (outputLen=0, pszIn=szInput;*pszIn;pszIn++) {
- if ( (48 <= *pszIn && *pszIn <= 57) ||//0-9
+ if ((48 <= *pszIn && *pszIn <= 57) ||//0-9
(65 <= *pszIn && *pszIn <= 90) ||//ABC...XYZ
(97 <= *pszIn && *pszIn <= 122) ||//abc...xyz
*pszIn == '-' || *pszIn == '_' || *pszIn == '.' || *pszIn == ' ') outputLen++;
@@ -432,7 +432,7 @@ INT_PTR NetlibHttpUrlEncode(WPARAM, LPARAM lParam) return (INT_PTR)(unsigned char*)NULL;
}
for (pszOut=szOutput, pszIn=szInput;*pszIn;pszIn++) {
- if ( (48 <= *pszIn && *pszIn <= 57) ||
+ if ((48 <= *pszIn && *pszIn <= 57) ||
(65 <= *pszIn && *pszIn <= 90) ||
(97 <= *pszIn && *pszIn <= 122) ||
*pszIn == '-' || *pszIn == '_' || *pszIn == '.') *pszOut++=*pszIn;
diff --git a/src/modules/netlib/netliblog.cpp b/src/modules/netlib/netliblog.cpp index 586d160baf..8991f6ff24 100644 --- a/src/modules/netlib/netliblog.cpp +++ b/src/modules/netlib/netliblog.cpp @@ -111,12 +111,12 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wPa {
tvis.item.pszText=netlibUser[i]->user.ptszDescriptiveName;
tvis.item.lParam=i;
- tvis.item.state=INDEXTOSTATEIMAGEMASK( (netlibUser[i]->toLog) ? 2 : 1 );
+ tvis.item.state=INDEXTOSTATEIMAGEMASK((netlibUser[i]->toLog) ? 2 : 1 );
TreeView_InsertItem(hwndFilter, &tvis);
}
tvis.item.lParam=-1;
tvis.item.pszText=TranslateT("(Miranda Core Logging)");
- tvis.item.state=INDEXTOSTATEIMAGEMASK( (logOptions.toLog) ? 2 : 1 );
+ tvis.item.state=INDEXTOSTATEIMAGEMASK((logOptions.toLog) ? 2 : 1 );
TreeView_InsertItem(hwndFilter, &tvis);
}
return TRUE;
diff --git a/src/modules/options/options.cpp b/src/modules/options/options.cpp index c417b4b6e4..d168a6f2c7 100644 --- a/src/modules/options/options.cpp +++ b/src/modules/options/options.cpp @@ -437,7 +437,7 @@ static void CALLBACK FilterSearchTimerFunc( HWND hwnd, UINT, UINT_PTR, DWORD ) FindFilterStrings( TRUE, dat->currentPage == FilterPage, hFilterSearchWnd, &( dat->opd[FilterPage]) );
FilterPage++;
- FilterLoadProgress = FilterPage*100/( (dat->pageCount) ? dat->pageCount : FilterPage );
+ FilterLoadProgress = FilterPage*100/((dat->pageCount) ? dat->pageCount : FilterPage );
if ( FilterPage >= dat->pageCount )
{
KillTimer( hwnd, FilterTimerId );
@@ -1086,7 +1086,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, L switch(LOWORD(wParam)) {
case IDC_KEYWORD_FILTER:
//add a timer - when the timer elapses filter the option pages
- if ( (HIWORD(wParam) == CBN_SELCHANGE) || (HIWORD(wParam) == CBN_EDITCHANGE))
+ if ((HIWORD(wParam) == CBN_SELCHANGE) || (HIWORD(wParam) == CBN_EDITCHANGE))
if (!SetTimer(hdlg, FILTER_TIMEOUT_TIMER, 400, NULL))
MessageBeep(MB_ICONSTOP);
diff --git a/src/modules/plugins/newplugins.cpp b/src/modules/plugins/newplugins.cpp index 5dc90a2750..022120379a 100644 --- a/src/modules/plugins/newplugins.cpp +++ b/src/modules/plugins/newplugins.cpp @@ -649,7 +649,7 @@ char **GetServiceModePluginsList(void) p = p->nextclass;
}
if ( i ) {
- list = (char**)mir_calloc( (i + 1) * sizeof(char*) );
+ list = (char**)mir_calloc((i + 1) * sizeof(char*) );
p = pluginListSM;
i = 0;
while ( p != NULL ) {
diff --git a/src/modules/protocols/protocols.cpp b/src/modules/protocols/protocols.cpp index 1da7f0b4dd..80eefddc7c 100644 --- a/src/modules/protocols/protocols.cpp +++ b/src/modules/protocols/protocols.cpp @@ -248,7 +248,7 @@ static INT_PTR Proto_RecvMessage(WPARAM, LPARAM lParam) if ( pre->flags & PREF_UTF )
dbei.flags |= DBEF_UTF;
if ( pre->flags & PREF_UNICODE )
- dbei.cbBlob += sizeof( wchar_t )*( (DWORD)wcslen(( wchar_t* )&pre->szMessage[dbei.cbBlob+1] )+1 );
+ dbei.cbBlob += sizeof( wchar_t )*((DWORD)wcslen(( wchar_t* )&pre->szMessage[dbei.cbBlob+1] )+1 );
dbei.pBlob = ( PBYTE ) pre->szMessage;
return CallService( MS_DB_EVENT_ADD, ( WPARAM ) ccs->hContact, ( LPARAM )&dbei );
@@ -436,7 +436,7 @@ INT_PTR CallProtoServiceInt( HANDLE hContact, const char *szModule, const char * return ( INT_PTR )ppi->AddToList( wParam, (PROTOSEARCHRESULT*)lParam );
#endif
case 2: return ( INT_PTR )ppi->AddToListByEvent( LOWORD(wParam), HIWORD(wParam), (HANDLE)lParam );
- case 3: return ( INT_PTR )ppi->Authorize( ( HANDLE )wParam );
+ case 3: return ( INT_PTR )ppi->Authorize(( HANDLE )wParam );
case 4:
if ( ppi->m_iVersion > 1 )
return ( INT_PTR )ppi->AuthDeny(( HANDLE )wParam, StrConvT(( char* )lParam ));
@@ -496,8 +496,8 @@ INT_PTR CallProtoServiceInt( HANDLE hContact, const char *szModule, const char * else
return ( INT_PTR )ppi->SearchByName( psbn->pszNick, psbn->pszFirstName, psbn->pszLastName );
}
- case 18: return ( INT_PTR )ppi->SearchAdvanced( ( HWND )lParam );
- case 19: return ( INT_PTR )ppi->CreateExtendedSearchUI ( ( HWND )lParam );
+ case 18: return ( INT_PTR )ppi->SearchAdvanced(( HWND )lParam );
+ case 19: return ( INT_PTR )ppi->CreateExtendedSearchUI (( HWND )lParam );
case 20: return ( INT_PTR )ppi->RecvContacts( hContact, ( PROTORECVEVENT* )lParam );
case 21: return ( INT_PTR )ppi->RecvFile( hContact, ( PROTOFILEEVENT* )lParam );
case 22: return ( INT_PTR )ppi->RecvMsg( hContact, ( PROTORECVEVENT* )lParam );
@@ -527,7 +527,7 @@ INT_PTR CallProtoServiceInt( HANDLE hContact, const char *szModule, const char * return ( INT_PTR )ppi->SetAwayMsg( wParam, StrConvT(( char* )lParam ));
else
return ( INT_PTR )ppi->SetAwayMsg( wParam, ( TCHAR* )lParam );
- case 34: return ( INT_PTR )ppi->UserIsTyping( ( HANDLE )wParam, lParam );
+ case 34: return ( INT_PTR )ppi->UserIsTyping(( HANDLE )wParam, lParam );
case 35: lstrcpynA(( char* )lParam, ppi->m_szModuleName, wParam ); return 0;
case 36: return ppi->m_iStatus;
diff --git a/src/modules/skin/skinicons.cpp b/src/modules/skin/skinicons.cpp index 8dd3d47a68..11b8ff3a4b 100644 --- a/src/modules/skin/skinicons.cpp +++ b/src/modules/skin/skinicons.cpp @@ -396,12 +396,12 @@ static INT_PTR sttLoadSkinIcon( WPARAM wParam, LPARAM lParam ) static INT_PTR sttLoadSkinProtoIcon( WPARAM wParam, LPARAM lParam )
{
- return (INT_PTR)LoadSkinProtoIcon( (char*)wParam, (int)lParam, false );
+ return (INT_PTR)LoadSkinProtoIcon((char*)wParam, (int)lParam, false );
}
static INT_PTR sttLoadSkinProtoIconBig( WPARAM wParam, LPARAM lParam )
{
- return (INT_PTR)LoadSkinProtoIcon( (char*)wParam, (int)lParam, true );
+ return (INT_PTR)LoadSkinProtoIcon((char*)wParam, (int)lParam, true );
}
int LoadSkinIcons(void)
diff --git a/src/modules/xml/xmlApi.cpp b/src/modules/xml/xmlApi.cpp index 16cb936090..c574da4f6d 100644 --- a/src/modules/xml/xmlApi.cpp +++ b/src/modules/xml/xmlApi.cpp @@ -240,7 +240,7 @@ static int xmlapiGetElement( HXML _n, XML_ELEMENT_POS pos, XML_ELEMENT_TYPE *typ if ( !type || pos >= XMLNode(_n).nElement())
return false;
- XMLNodeContents c( XMLNode(_n).enumContents( ( XMLElementPosition )pos ));
+ XMLNodeContents c( XMLNode(_n).enumContents(( XMLElementPosition )pos ));
switch ( c.etype ) {
case eNodeChild:
{
|