summaryrefslogtreecommitdiff
path: root/protocols/MRA
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-06-14 15:51:34 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-06-14 15:51:34 +0000
commite58823d961a630eb62e60d2ccb443761ba5f1704 (patch)
tree62d071be480d57af2a53f154a1468abe0b9449ff /protocols/MRA
parent721aea0764451e985d575236205808bbef298244 (diff)
- all MS_CLIST_ADD*ITEM services replaced with Menu_Add*Item stubs.
- massive cleanup of the menu-related code git-svn-id: http://svn.miranda-ng.org/main/trunk@410 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/MRA')
-rw-r--r--protocols/MRA/Mra.h2
-rw-r--r--protocols/MRA/Mra_functions.cpp4
-rw-r--r--protocols/MRA/Mra_svcs.cpp56
3 files changed, 28 insertions, 34 deletions
diff --git a/protocols/MRA/Mra.h b/protocols/MRA/Mra.h
index c888e8f78c..3f5a1f1394 100644
--- a/protocols/MRA/Mra.h
+++ b/protocols/MRA/Mra.h
@@ -399,7 +399,7 @@ DWORD ProtoBroadcastAckAsynchEx (const char *szModule,HANDLE hC
void MraUserAPCThreadProc (LPVOID lpParameter);
DWORD CreateBlobFromContact (HANDLE hContact,LPWSTR lpwszRequestReason,SIZE_T dwRequestReasonSize,LPBYTE lpbBuff,SIZE_T dwBuffSize,SIZE_T *pdwBuffSizeRet);
-void CListCreateMenu (LONG lPosition,LONG lPopupPosition,HANDLE hMainIcon,LPSTR pszContactOwner,LPSTR lpszCListMenuType,const GUI_DISPLAY_ITEM *pgdiItems,HANDLE *hIcoLibIcons,SIZE_T dwCount,HANDLE *hResult);
+void CListCreateMenu (LONG lPosition,LONG lPopupPosition,HANDLE hMainIcon,LPSTR pszContactOwner,BOOL bIsStatus,const GUI_DISPLAY_ITEM *pgdiItems,HANDLE *hIcoLibIcons,SIZE_T dwCount,HANDLE *hResult);
void CListDestroyMenu (const GUI_DISPLAY_ITEM *pgdiItems,SIZE_T dwCount);
void CListShowMenuItem (HANDLE hMenuItem,BOOL bShow);
int ExtraSetIcon (HANDLE hExtraIcon,HANDLE hContact,HANDLE hImage,int iColumnType);
diff --git a/protocols/MRA/Mra_functions.cpp b/protocols/MRA/Mra_functions.cpp
index bb88dc3dcd..1cd2630f1c 100644
--- a/protocols/MRA/Mra_functions.cpp
+++ b/protocols/MRA/Mra_functions.cpp
@@ -1393,7 +1393,7 @@ return(dwRetErrorCode);
-void CListCreateMenu(LONG lPosition,LONG lPopupPosition,HANDLE hMainIcon,LPSTR pszContactOwner,LPSTR lpszCListMenuType,const GUI_DISPLAY_ITEM *pgdiItems,HANDLE *hIcoLibIcons,SIZE_T dwCount,HANDLE *hResult)
+void CListCreateMenu(LONG lPosition,LONG lPopupPosition,HANDLE hMainIcon,LPSTR pszContactOwner,BOOL bIsMain,const GUI_DISPLAY_ITEM *pgdiItems,HANDLE *hIcoLibIcons,SIZE_T dwCount,HANDLE *hResult)
{
if (pgdiItems && hIcoLibIcons && dwCount && hResult)
{
@@ -1423,7 +1423,7 @@ void CListCreateMenu(LONG lPosition,LONG lPopupPosition,HANDLE hMainIcon,LPSTR p
mi.flags=(CMIF_UNICODE);
}
- hResult[i]=(HANDLE)CallService(lpszCListMenuType,0,(LPARAM)&mi);
+ hResult[i] = (bIsMain) ? Menu_AddMainMenuItem(&mi) : Menu_AddContactMenuItem(&mi);
if (i==0 && hMainIcon)
{
diff --git a/protocols/MRA/Mra_svcs.cpp b/protocols/MRA/Mra_svcs.cpp
index fa996b1e0c..cb194fb575 100644
--- a/protocols/MRA/Mra_svcs.cpp
+++ b/protocols/MRA/Mra_svcs.cpp
@@ -30,8 +30,7 @@ INT_PTR LoadServices(void)
pszServiceFunctionName=szServiceFunction+PROTOCOL_NAME_LEN;
// Service creation
- for (SIZE_T i=0;i<SIZEOF(siPluginServices);i++)
- {
+ for (SIZE_T i=0;i<SIZEOF(siPluginServices);i++) {
memmove(pszServiceFunctionName,siPluginServices[i].lpszName,(lstrlenA(siPluginServices[i].lpszName)+1));
CreateServiceFunction(szServiceFunction,siPluginServices[i].lpFunc);
}
@@ -67,28 +66,24 @@ INT_PTR LoadModules(void)
// Main menu initialization
- CListCreateMenu(2000060000,500085000,(HANDLE)LoadImage(masMraSettings.hInstance,MAKEINTRESOURCE(IDI_MRA),IMAGE_ICON,0,0,LR_SHARED),NULL,MS_CLIST_ADDMAINMENUITEM,gdiMenuItems,masMraSettings.hMainMenuIcons,SIZEOF(gdiMenuItems),masMraSettings.hMainMenuItems);
+ CListCreateMenu(2000060000,500085000,(HANDLE)LoadImage(masMraSettings.hInstance,MAKEINTRESOURCE(IDI_MRA),IMAGE_ICON,0,0,LR_SHARED),NULL,TRUE,gdiMenuItems,masMraSettings.hMainMenuIcons,SIZEOF(gdiMenuItems),masMraSettings.hMainMenuItems);
// Contact menu initialization
- CListCreateMenu(2000060000,-500050000,NULL,NULL,MS_CLIST_ADDCONTACTMENUITEM,gdiContactMenuItems,masMraSettings.hContactMenuIcons,(SIZEOF(gdiContactMenuItems) - ((masMraSettings.heNudgeReceived==NULL)? 0:1)),masMraSettings.hContactMenuItems);
+ CListCreateMenu(2000060000,-500050000,NULL,NULL,FALSE,gdiContactMenuItems,masMraSettings.hContactMenuIcons,(SIZEOF(gdiContactMenuItems) - ((masMraSettings.heNudgeReceived==NULL)? 0:1)),masMraSettings.hContactMenuItems);
// xstatus menu
- if (ServiceExists(MS_CLIST_ADDSTATUSMENUITEM))
- {
- InitXStatusIcons();
- for(SIZE_T i=0;i<MRA_XSTATUS_COUNT;i++)
- {
- mir_snprintf(pszServiceFunctionName,(SIZEOF(szServiceFunction)-PROTOCOL_NAME_LEN),"/menuXStatus%ld",i);
- CreateServiceFunctionParam(szServiceFunction,MraXStatusMenu,i);
- }
+ InitXStatusIcons();
+ for(SIZE_T i=0;i<MRA_XSTATUS_COUNT;i++) {
+ mir_snprintf(pszServiceFunctionName,(SIZEOF(szServiceFunction)-PROTOCOL_NAME_LEN),"/menuXStatus%ld",i);
+ CreateServiceFunctionParam(szServiceFunction,MraXStatusMenu,i);
+ }
- masMraSettings.bHideXStatusUI=FALSE;
- masMraSettings.dwXStatusMode=DB_Mra_GetByte(NULL,DBSETTING_XSTATUSID,MRA_MIR_XSTATUS_NONE);
- if (IsXStatusValid(masMraSettings.dwXStatusMode)==FALSE) masMraSettings.dwXStatusMode=MRA_MIR_XSTATUS_NONE;
+ masMraSettings.bHideXStatusUI=FALSE;
+ masMraSettings.dwXStatusMode=DB_Mra_GetByte(NULL,DBSETTING_XSTATUSID,MRA_MIR_XSTATUS_NONE);
+ if (IsXStatusValid(masMraSettings.dwXStatusMode)==FALSE) masMraSettings.dwXStatusMode=MRA_MIR_XSTATUS_NONE;
- masMraSettings.hHookRebuildStatusMenu=HookEvent(ME_CLIST_PREBUILDSTATUSMENU,MraRebuildStatusMenu);
- MraRebuildStatusMenu(0,0);
- }
+ masMraSettings.hHookRebuildStatusMenu=HookEvent(ME_CLIST_PREBUILDSTATUSMENU,MraRebuildStatusMenu);
+ MraRebuildStatusMenu(0,0);
MraExtraIconsRebuild(0,0);
@@ -119,19 +114,19 @@ void UnloadModules()
}
// xstatus menu destroy
- if (ServiceExists(MS_CLIST_ADDSTATUSMENUITEM))
- {
- if (masMraSettings.hHookRebuildStatusMenu) {UnhookEvent(masMraSettings.hHookRebuildStatusMenu); masMraSettings.hHookRebuildStatusMenu=NULL;}
+ if (masMraSettings.hHookRebuildStatusMenu) {
+ UnhookEvent(masMraSettings.hHookRebuildStatusMenu);
+ masMraSettings.hHookRebuildStatusMenu=NULL;
+ }
- bzero(masMraSettings.hXStatusMenuItems,sizeof(masMraSettings.hXStatusMenuItems));
- // Service deletion
- for(SIZE_T i=0;i<MRA_XSTATUS_COUNT;i++)
- {
- mir_snprintf(pszServiceFunctionName,(SIZEOF(szServiceFunction)-PROTOCOL_NAME_LEN),"/menuXStatus%ld",i);
- DestroyServiceFunction(szServiceFunction);
- }
- DestroyXStatusIcons();
+ bzero(masMraSettings.hXStatusMenuItems,sizeof(masMraSettings.hXStatusMenuItems));
+
+ // Service deletion
+ for(SIZE_T i=0;i<MRA_XSTATUS_COUNT;i++) {
+ mir_snprintf(pszServiceFunctionName,(SIZEOF(szServiceFunction)-PROTOCOL_NAME_LEN),"/menuXStatus%ld",i);
+ DestroyServiceFunction(szServiceFunction);
}
+ DestroyXStatusIcons();
// Main menu destroy
CListDestroyMenu(gdiMenuItems,SIZEOF(gdiMenuItems));
@@ -943,7 +938,6 @@ int MraRebuildStatusMenu(WPARAM wParam,LPARAM lParam)
{
CHAR szServiceFunction[MAX_PATH*2],*pszServiceFunctionName,szValueName[MAX_PATH];
WCHAR szItem[MAX_PATH+64],szStatusTitle[STATUS_TITLE_MAX+4];
- HANDLE hXStatusRoot;
CLISTMENUITEM mi={0};
memmove(szServiceFunction,PROTOCOL_NAMEA,PROTOCOL_NAME_SIZE);
@@ -979,7 +973,7 @@ int MraRebuildStatusMenu(WPARAM wParam,LPARAM lParam)
mi.ptszName=lpcszXStatusNameDef[i];
mi.hIcon=NULL;
}
- masMraSettings.hXStatusMenuItems[i]=(HANDLE)CallService(MS_CLIST_ADDSTATUSMENUITEM,(WPARAM)&hXStatusRoot,(LPARAM)&mi);
+ masMraSettings.hXStatusMenuItems[i] = Menu_AddStatusMenuItem(&mi);
}
return(0);
}