diff options
author | George Hazan <george.hazan@gmail.com> | 2012-06-24 22:50:32 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-06-24 22:50:32 +0000 |
commit | e1e2063eee00d455fc54f64363b3cc535edf1750 (patch) | |
tree | 22ebcad764c23e84509b0d6bb30715db720a97dc | |
parent | 843145196e0aa520ba23b6f6cffc393118bcf46a (diff) |
fix for menu creation
git-svn-id: http://svn.miranda-ng.org/main/trunk@620 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | protocols/MRA/Mra.h | 60 | ||||
-rw-r--r-- | protocols/MRA/Mra_functions.cpp | 86 | ||||
-rw-r--r-- | protocols/MRA/Mra_svcs.cpp | 4 |
3 files changed, 77 insertions, 73 deletions
diff --git a/protocols/MRA/Mra.h b/protocols/MRA/Mra.h index e927d76dbc..b83d722fb7 100644 --- a/protocols/MRA/Mra.h +++ b/protocols/MRA/Mra.h @@ -370,61 +370,61 @@ BOOL DB_GetContactSettingBlob(HANDLE hContact,LPSTR lpszModule,LPSTR lpszValueNa -DWORD MraGetVersionStringFromFormated (LPSTR lpszUserAgentFormated,SIZE_T dwUserAgentFormatedSize,LPSTR lpszVersion,SIZE_T dwVersionSize,SIZE_T *pdwVersionSizeRet);
+DWORD MraGetVersionStringFromFormated (LPSTR lpszUserAgentFormated,SIZE_T dwUserAgentFormatedSize,LPSTR lpszVersion,SIZE_T dwVersionSize,SIZE_T *pdwVersionSizeRet);
HANDLE MraHContactFromEmail (LPSTR lpszEMail,SIZE_T dwEMailSize,BOOL bAddIfNeeded,BOOL bTemporary,BOOL *pbAdded);
BOOL MraUpdateContactInfo (HANDLE hContact);
-DWORD MraContactCapabilitiesGet (HANDLE hContact);
-void MraContactCapabilitiesSet (HANDLE hContact,DWORD dwFutureFlags);
-DWORD MraGetContactStatus (HANDLE hContact);
-DWORD MraSetContactStatus (HANDLE hContact,DWORD dwNewStatus);
+DWORD MraContactCapabilitiesGet (HANDLE hContact);
+void MraContactCapabilitiesSet (HANDLE hContact,DWORD dwFutureFlags);
+DWORD MraGetContactStatus (HANDLE hContact);
+DWORD MraSetContactStatus (HANDLE hContact,DWORD dwNewStatus);
void MraUpdateEmailStatus (LPSTR lpszFrom,SIZE_T dwFromSize,LPSTR lpszSubject,SIZE_T dwSubjectSize,DWORD dwDate,DWORD dwUIDL);
BOOL IsUnicodeEnv ();
BOOL IsHTTPSProxyUsed (HANDLE hNetlibUser);
BOOL IsContactMra (HANDLE hContact);
-BOOL IsContactMraProto (HANDLE hContact);
-BOOL IsEMailMy (LPSTR lpszEMail,SIZE_T dwEMailSize);
+BOOL IsContactMraProto (HANDLE hContact);
+BOOL IsEMailMy (LPSTR lpszEMail,SIZE_T dwEMailSize);
BOOL IsEMailChatAgent (LPSTR lpszEMail,SIZE_T dwEMailSize);
-BOOL IsContactChatAgent (HANDLE hContact);
-BOOL IsEMailMR (LPSTR lpszEMail,SIZE_T dwEMailSize);
-BOOL GetEMailFromString (LPSTR lpszBuff,SIZE_T dwBuffSize,LPSTR *plpszEMail,SIZE_T *pdwEMailSize);
+BOOL IsContactChatAgent (HANDLE hContact);
+BOOL IsEMailMR (LPSTR lpszEMail,SIZE_T dwEMailSize);
+BOOL GetEMailFromString (LPSTR lpszBuff,SIZE_T dwBuffSize,LPSTR *plpszEMail,SIZE_T *pdwEMailSize);
DWORD GetContactEMailCount (HANDLE hContact,BOOL bMRAOnly);
BOOL GetContactFirstEMail (HANDLE hContact,BOOL bMRAOnly,LPSTR lpszRetBuff,SIZE_T dwRetBuffSize,SIZE_T *pdwRetBuffSize);
-DWORD MraAPCQueueAdd (PAPCFUNC pfnAPC,PFIFO_MT pffmtAPCQueue,ULONG_PTR dwData);
-void MraAPCQueueDestroy (PFIFO_MT pffmtAPCQueue);
+DWORD MraAPCQueueAdd (PAPCFUNC pfnAPC,PFIFO_MT pffmtAPCQueue,ULONG_PTR dwData);
+void MraAPCQueueDestroy (PFIFO_MT pffmtAPCQueue);
void ShowFormatedErrorMessage (LPWSTR lpwszErrText,DWORD dwErrorCode);
-DWORD ProtoBroadcastAckAsynchEx (const char *szModule,HANDLE hContact,int type,int result,HANDLE hProcess,LPARAM lParam,SIZE_T dwLparamSize);
+DWORD ProtoBroadcastAckAsynchEx (const char *szModule,HANDLE hContact,int type,int result,HANDLE hProcess,LPARAM lParam,SIZE_T dwLparamSize);
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,BOOL bIsStatus,const GUI_DISPLAY_ITEM *pgdiItems,HANDLE *hIcoLibIcons,SIZE_T dwCount,HANDLE *hResult);
+DWORD CreateBlobFromContact (HANDLE hContact,LPWSTR lpwszRequestReason,SIZE_T dwRequestReasonSize,LPBYTE lpbBuff,SIZE_T dwBuffSize,SIZE_T *pdwBuffSizeRet);
+void CListCreateMenu (LONG lPosition,LONG lPopupPosition,HICON 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);
+void CListShowMenuItem (HANDLE hMenuItem,BOOL bShow);
int ExtraSetIcon (HANDLE hExtraIcon,HANDLE hContact,HANDLE hImage,int iColumnType);
-SIZE_T CopyNumber (LPCVOID lpcOutBuff,LPCVOID lpcBuff,SIZE_T dwLen);
-BOOL IsPhone (LPSTR lpszString,SIZE_T dwStringSize);
-BOOL IsContactPhone (HANDLE hContact,LPSTR lpszPhone,SIZE_T dwPhoneSize);
+SIZE_T CopyNumber (LPCVOID lpcOutBuff,LPCVOID lpcBuff,SIZE_T dwLen);
+BOOL IsPhone (LPSTR lpszString,SIZE_T dwStringSize);
+BOOL IsContactPhone (HANDLE hContact,LPSTR lpszPhone,SIZE_T dwPhoneSize);
HANDLE MraHContactFromPhone (LPSTR lpszPhone,SIZE_T dwPhoneSize,BOOL bAddIfNeeded,BOOL bTemporary,BOOL *pbAdded);
-void EnableControlsArray (HWND hWndDlg,WORD *pwControlsList,SIZE_T dwControlsListCount,BOOL bEnabled);
+void EnableControlsArray (HWND hWndDlg,WORD *pwControlsList,SIZE_T dwControlsListCount,BOOL bEnabled);
BOOL MraRequestXStatusDetails (DWORD dwXStatus);
-BOOL MraSendReplyBlogStatus (HANDLE hContact);
+BOOL MraSendReplyBlogStatus (HANDLE hContact);
DWORD GetYears (CONST PSYSTEMTIME pcstSystemTime);
DWORD FindFile (LPWSTR lpszFolder,DWORD dwFolderLen,LPWSTR lpszFileName,DWORD dwFileNameLen,LPWSTR lpszRetFilePathName,DWORD dwRetFilePathLen,DWORD *pdwRetFilePathLen);
-DWORD MemFillRandom (LPVOID lpBuff,SIZE_T dwBuffSize);
-BOOL SetPassDB (LPSTR lpszBuff,SIZE_T dwBuffSize);
-BOOL GetPassDB (LPSTR lpszBuff,SIZE_T dwBuffSize,SIZE_T *pdwBuffSize);
-DWORD DecodeXML (LPTSTR lptszMessage,SIZE_T dwMessageSize,LPTSTR lptszMessageConverted,SIZE_T dwMessageConvertedBuffSize,SIZE_T *pdwMessageConvertedSize);
-DWORD EncodeXML (LPTSTR lptszMessage,SIZE_T dwMessageSize,LPTSTR lptszMessageConverted,SIZE_T dwMessageConvertedBuffSize,SIZE_T *pdwMessageConvertedSize);
+DWORD MemFillRandom (LPVOID lpBuff,SIZE_T dwBuffSize);
+BOOL SetPassDB (LPSTR lpszBuff,SIZE_T dwBuffSize);
+BOOL GetPassDB (LPSTR lpszBuff,SIZE_T dwBuffSize,SIZE_T *pdwBuffSize);
+DWORD DecodeXML (LPTSTR lptszMessage,SIZE_T dwMessageSize,LPTSTR lptszMessageConverted,SIZE_T dwMessageConvertedBuffSize,SIZE_T *pdwMessageConvertedSize);
+DWORD EncodeXML (LPTSTR lptszMessage,SIZE_T dwMessageSize,LPTSTR lptszMessageConverted,SIZE_T dwMessageConvertedBuffSize,SIZE_T *pdwMessageConvertedSize);
DWORD StartConnect ();
-void MraThreadClean ();
+void MraThreadClean ();
DWORD GetMraStatusFromMiradaStatus (DWORD dwMirandaStatus,DWORD dwXStatusMir,DWORD *pdwXStatusMra);
DWORD GetMiradaStatusFromMraStatus (DWORD dwMraStatus,DWORD dwXStatusMra,DWORD *pdwXStatusMir);
-DWORD GetMraXStatusIDFromMraUriStatus (LPSTR lpszStatusUri,SIZE_T dwStatusUriSize);
+DWORD GetMraXStatusIDFromMraUriStatus (LPSTR lpszStatusUri,SIZE_T dwStatusUriSize);
-DWORD GetContactFlags (HANDLE hContact);
-DWORD SetContactFlags (HANDLE hContact,DWORD dwContactFlag);
+DWORD GetContactFlags (HANDLE hContact);
+DWORD SetContactFlags (HANDLE hContact,DWORD dwContactFlag);
DWORD GetContactBasicInfoW (HANDLE hContact,DWORD *pdwID,DWORD *pdwGroupID,DWORD *pdwContactFlag,DWORD *pdwContactSeverFlags,DWORD *pdwStatus,LPSTR lpszEMail,SIZE_T dwEMailSize,SIZE_T *pdwEMailSize,LPWSTR lpwszNick,SIZE_T dwNickSize,SIZE_T *pdwNickSize,LPSTR lpszPhones,SIZE_T dwPhonesSize,SIZE_T *pdwPhonesSize);
diff --git a/protocols/MRA/Mra_functions.cpp b/protocols/MRA/Mra_functions.cpp index 4764ded024..d96e15f9a0 100644 --- a/protocols/MRA/Mra_functions.cpp +++ b/protocols/MRA/Mra_functions.cpp @@ -1393,47 +1393,51 @@ return(dwRetErrorCode); -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)
- {
- char szServiceFunction[MAX_PATH],*pszServiceFunctionName;
- CLISTMENUITEM mi={0};
-
- memmove(szServiceFunction,PROTOCOL_NAMEA,PROTOCOL_NAME_SIZE);
- pszServiceFunctionName=szServiceFunction+PROTOCOL_NAME_LEN;
-
- mi.cbSize=sizeof(mi);
- mi.popupPosition=lPopupPosition;
- mi.ptszPopupName=PROTOCOL_DISPLAY_NAMEW;
- mi.pszService=szServiceFunction;
- mi.flags=(CMIF_UNICODE|CMIF_ICONFROMICOLIB);
-
- for (SIZE_T i=0;i<dwCount;i++)
- {
- memmove(pszServiceFunctionName,pgdiItems[i].lpszName,(lstrlenA(pgdiItems[i].lpszName)+1));
- if (pgdiItems[i].lpFunc)
- CreateServiceFunction(szServiceFunction,pgdiItems[i].lpFunc);
- mi.position=(lPosition+i);
- mi.icolibItem=hIcoLibIcons[i];
- mi.ptszName=pgdiItems[i].lpwszDescr;
-
- if (i==0 && hMainIcon)
- {
- mi.icolibItem=hMainIcon;
- mi.flags=(CMIF_UNICODE);
- }
-
- hResult[i] = (bIsMain) ? Menu_AddProtoMenuItem(&mi) : Menu_AddContactMenuItem(&mi);
-
- if (i==0 && hMainIcon)
- {
- mi.flags=CMIM_FLAGS|CMIM_ICON|CMIF_ICONFROMICOLIB;
- mi.icolibItem=hIcoLibIcons[i];
- CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)hResult[i],(LPARAM)&mi);
- mi.flags=(CMIF_UNICODE|CMIF_ICONFROMICOLIB);
- }
- }
+void CListCreateMenu(LONG lPosition,LONG lPopupPosition,HICON hMainIcon,LPSTR pszContactOwner,BOOL bIsMain,const GUI_DISPLAY_ITEM *pgdiItems,HANDLE *hIcoLibIcons,SIZE_T dwCount,HANDLE *hResult)
+{
+ if (!pgdiItems || !hIcoLibIcons || !dwCount || !hResult)
+ return;
+
+ char szServiceFunction[MAX_PATH],*pszServiceFunctionName;
+ memmove(szServiceFunction, PROTOCOL_NAMEA, PROTOCOL_NAME_SIZE);
+ pszServiceFunctionName = szServiceFunction + PROTOCOL_NAME_LEN;
+
+ CLISTMENUITEM mi = {0};
+ mi.cbSize = sizeof(mi);
+
+ HGENMENU (*fnAddFunc)(CLISTMENUITEM*);
+ if (bIsMain) {
+ fnAddFunc = Menu_AddProtoMenuItem;
+
+ HGENMENU hRootMenu = MO_GetProtoRootMenu(PROTOCOL_NAMEA);
+ if (hRootMenu == NULL) {
+ mi.ptszName = PROTOCOL_NAMEW;
+ mi.position = -1999901008;
+ mi.hParentMenu = HGENMENU_ROOT;
+ mi.flags = CMIF_ROOTPOPUP | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED;
+ mi.hIcon = hMainIcon;
+ hRootMenu = Menu_AddProtoMenuItem(&mi);
+ }
+ mi.hParentMenu = hRootMenu;
+ mi.flags = CMIF_UNICODE | CMIF_ICONFROMICOLIB | CMIF_CHILDPOPUP;
+ }
+ else {
+ fnAddFunc = Menu_AddContactMenuItem;
+ mi.ptszPopupName = PROTOCOL_DISPLAY_NAMEW;
+ mi.flags = CMIF_UNICODE | CMIF_ICONFROMICOLIB;
+ }
+
+ mi.popupPosition = lPopupPosition;
+ mi.pszService = szServiceFunction;
+
+ for (size_t i=0; i < dwCount; i++) {
+ memmove(pszServiceFunctionName, pgdiItems[i].lpszName, lstrlenA(pgdiItems[i].lpszName)+1);
+ if (pgdiItems[i].lpFunc)
+ CreateServiceFunction(szServiceFunction,pgdiItems[i].lpFunc);
+ mi.position = lPosition + i;
+ mi.icolibItem = hIcoLibIcons[i];
+ mi.ptszName = pgdiItems[i].lpwszDescr;
+ hResult[i] = fnAddFunc(&mi);
}
}
diff --git a/protocols/MRA/Mra_svcs.cpp b/protocols/MRA/Mra_svcs.cpp index 896d33ae82..5834da5f7f 100644 --- a/protocols/MRA/Mra_svcs.cpp +++ b/protocols/MRA/Mra_svcs.cpp @@ -64,9 +64,9 @@ INT_PTR LoadModules(void) masMraSettings.hHookExtraIconsApply=HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY,MraExtraIconsApply);
masMraSettings.hHookExtraIconsRebuild=HookEvent(ME_CLIST_EXTRA_LIST_REBUILD,MraExtraIconsRebuild);
-
// Main menu initialization
- 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);
+ HICON hMainIcon = (HICON)LoadImage(masMraSettings.hInstance,MAKEINTRESOURCE(IDI_MRA),IMAGE_ICON,0,0,LR_SHARED);
+ CListCreateMenu(200001,500085000,hMainIcon,NULL,TRUE,gdiMenuItems,masMraSettings.hMainMenuIcons,SIZEOF(gdiMenuItems),masMraSettings.hMainMenuItems);
// Contact menu initialization
CListCreateMenu(2000060000,-500050000,NULL,NULL,FALSE,gdiContactMenuItems,masMraSettings.hContactMenuIcons,(SIZEOF(gdiContactMenuItems) - ((masMraSettings.heNudgeReceived==NULL)? 0:1)),masMraSettings.hContactMenuItems);
|