summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-09-20 19:15:17 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-09-20 19:15:17 +0000
commit56eb98aae89ed7c503b1e776625a0347786fc85c (patch)
treea2c0fc3af05685e2391c73ad37a8de39f7d75839
parent0308f566ea2232525f3dd53995050b78824521cd (diff)
mra icons are global now
git-svn-id: http://svn.miranda-ng.org/main/trunk@1611 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--protocols/MRA/Mra.cpp7
-rw-r--r--protocols/MRA/Mra.h23
-rw-r--r--protocols/MRA/MraIcons.cpp127
-rw-r--r--protocols/MRA/MraProto.cpp10
-rw-r--r--protocols/MRA/MraProto.h11
-rw-r--r--protocols/MRA/Mra_functions.cpp55
-rw-r--r--protocols/MRA/Mra_svcs.cpp50
7 files changed, 130 insertions, 153 deletions
diff --git a/protocols/MRA/Mra.cpp b/protocols/MRA/Mra.cpp
index 92a361ce61..52d05db75f 100644
--- a/protocols/MRA/Mra.cpp
+++ b/protocols/MRA/Mra.cpp
@@ -17,9 +17,10 @@ PLUGININFOEX pluginInfoEx = {
{ 0xe7c48bab, 0x8ace, 0x4cb3, { 0x84, 0x46, 0xd4, 0xb7, 0x34, 0x81, 0xf4, 0x97 } }
};
+void IconsLoad();
-int OnModulesLoaded (WPARAM wParam, LPARAM lParam);
-int OnPreShutdown (WPARAM wParam, LPARAM lParam);
+int OnModulesLoaded(WPARAM wParam, LPARAM lParam);
+int OnPreShutdown(WPARAM wParam, LPARAM lParam);
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID Reserved)
{
@@ -76,6 +77,8 @@ extern "C" MRA_API int Load(void)
{
mir_getLP(&pluginInfoEx);
+ IconsLoad();
+
size_t dwBuffLen;
WCHAR szBuff[MAX_FILEPATH];
LPSTR lpszFullFileName = (LPSTR)szBuff;
diff --git a/protocols/MRA/Mra.h b/protocols/MRA/Mra.h
index 0d4857d2d3..0374b4afa2 100644
--- a/protocols/MRA/Mra.h
+++ b/protocols/MRA/Mra.h
@@ -127,10 +127,11 @@ struct MRA_ADDR_LIST
// структура содержащая информацию по построению меню или расширеных иконок
struct GUI_DISPLAY_ITEM
{
- LPSTR lpszName; // имя сервиса, оно же имя в иколибе
- LPWSTR lpwszDescr; // текстовое описание отображаемое юзеру
- LONG defIcon; // иконка из ресурсов
- ServiceFunc lpFunc; // функция вызываемая меню
+ LPSTR lpszName; // имя сервиса, оно же имя в иколибе
+ LPWSTR lpwszDescr; // текстовое описание отображаемое юзеру
+ LONG defIcon; // иконка из ресурсов
+ ServiceFunc lpFunc; // функция вызываемая меню
+ HANDLE hIconHandle;
};
// структура содержащая информацию о сервисах/функциях
@@ -140,13 +141,9 @@ struct SERVICE_ITEM
ServiceFunc lpFunc; // функция вызываемая
};
-extern const GUI_DISPLAY_ITEM gdiMenuItems[];
-extern const GUI_DISPLAY_ITEM gdiContactMenuItems[];
-extern const GUI_DISPLAY_ITEM gdiExtraStatusIconsItems[];
-
-extern const int gdiMenuItemsCount;
-extern const int gdiContactMenuItemsCount;
-extern const int gdiExtraStatusIconsItemsCount;
+extern GUI_DISPLAY_ITEM gdiMenuItems[];
+extern GUI_DISPLAY_ITEM gdiContactMenuItems[];
+extern GUI_DISPLAY_ITEM gdiExtraStatusIconsItems[];
#include "proto.h"
#include "MraSendCommand.h"
@@ -271,8 +268,4 @@ DWORD GetMraStatusFromMiradaStatus (DWORD dwMirandaStatus, DWORD dwXStatusMi
DWORD GetMiradaStatusFromMraStatus (DWORD dwMraStatus, DWORD dwXStatusMra, DWORD *pdwXStatusMir);
DWORD GetMraXStatusIDFromMraUriStatus (LPSTR lpszStatusUri, size_t dwStatusUriSize);
-
-
-
-
#endif // !defined(AFX_MRA_H__F58D13FF_F6F2_476C_B8F0_7B9E9357CF48__INCLUDED_)
diff --git a/protocols/MRA/MraIcons.cpp b/protocols/MRA/MraIcons.cpp
index d45e03bd73..9477215bff 100644
--- a/protocols/MRA/MraIcons.cpp
+++ b/protocols/MRA/MraIcons.cpp
@@ -1,7 +1,51 @@
#include "Mra.h"
#include "MraIcons.h"
-void CMraProto::AddIcoLibItems(LPWSTR lpwszRootSectionName, LPWSTR lpwszSubSectionName, const GUI_DISPLAY_ITEM *pgdiItems, size_t dwCount, HANDLE *hResult)
+GUI_DISPLAY_ITEM gdiMenuItems[] =
+{
+ { MRA_GOTO_INBOX, MRA_GOTO_INBOX_STR, IDI_INBOX, &CMraProto::MraGotoInbox },
+ { MRA_SHOW_INBOX_STATUS, MRA_SHOW_INBOX_STATUS_STR, IDI_MAIL_NOTIFY, &CMraProto::MraShowInboxStatus },
+ { MRA_EDIT_PROFILE, MRA_EDIT_PROFILE_STR, IDI_PROFILE, &CMraProto::MraEditProfile },
+ { MRA_MY_ALBUM, MRA_MY_ALBUM_STR, IDI_MRA_PHOTO, &CMraProto::MyAlbum },
+ { MRA_MY_BLOG, MRA_MY_BLOG_STR, IDI_MRA_BLOGS, &CMraProto::MyBlog },
+ { MRA_MY_BLOGSTATUS, MRA_MY_BLOGSTATUS_STR, IDI_BLOGSTATUS, &CMraProto::MyBlogStatus },
+ { MRA_MY_VIDEO, MRA_MY_VIDEO_STR, IDI_MRA_VIDEO, &CMraProto::MyVideo },
+ { MRA_MY_ANSWERS, MRA_MY_ANSWERS_STR, IDI_MRA_ANSWERS, &CMraProto::MyAnswers },
+ { MRA_MY_WORLD, MRA_MY_WORLD_STR, IDI_MRA_WORLD, &CMraProto::MyWorld },
+ { MRA_ZHUKI, MRA_ZHUKI_STR, IDI_MRA_ZHUKI, &CMraProto::MraZhuki },
+ { MRA_CHAT, MRA_CHAT_STR, IDI_MRA_CHAT, &CMraProto::MraChat },
+ { MRA_WEB_SEARCH, MRA_WEB_SEARCH_STR, IDI_MRA_WEB_SEARCH, &CMraProto::MraWebSearch },
+ { MRA_UPD_ALL_USERS_INFO, MRA_UPD_ALL_USERS_INFO_STR, IDI_PROFILE, &CMraProto::MraUpdateAllUsersInfo },
+ { MRA_CHK_USERS_AVATARS, MRA_CHK_USERS_AVATARS_STR, IDI_PROFILE, &CMraProto::MraCheckUpdatesUsersAvt },
+ { MRA_REQ_AUTH_FOR_ALL, MRA_REQ_AUTH_FOR_ALL_STR, IDI_AUTHRUGUEST, &CMraProto::MraRequestAuthForAll }
+};
+
+GUI_DISPLAY_ITEM gdiContactMenuItems[] =
+{
+ { MRA_REQ_AUTH, MRA_REQ_AUTH_STR, IDI_AUTHRUGUEST, &CMraProto::MraRequestAuthorization },
+ { MRA_GRANT_AUTH, MRA_GRANT_AUTH_STR, IDI_AUTHGRANT, &CMraProto::MraGrantAuthorization },
+ { MRA_SEND_POSTCARD, MRA_SEND_POSTCARD_STR, IDI_MRA_POSTCARD, &CMraProto::MraSendPostcard },
+ { MRA_VIEW_ALBUM, MRA_VIEW_ALBUM_STR, IDI_MRA_PHOTO, &CMraProto::MraViewAlbum },
+ { MRA_READ_BLOG, MRA_READ_BLOG_STR , IDI_MRA_BLOGS, &CMraProto::MraReadBlog },
+ { MRA_REPLY_BLOG_STATUS, MRA_REPLY_BLOG_STATUS_STR, IDI_BLOGSTATUS, &CMraProto::MraReplyBlogStatus },
+ { MRA_VIEW_VIDEO, MRA_VIEW_VIDEO_STR, IDI_MRA_VIDEO, &CMraProto::MraViewVideo },
+ { MRA_ANSWERS, MRA_ANSWERS_STR, IDI_MRA_ANSWERS, &CMraProto::MraAnswers },
+ { MRA_WORLD, MRA_WORLD_STR, IDI_MRA_WORLD, &CMraProto::MraWorld },
+ { MRA_SEND_NUDGE, MRA_SENDNUDGE_STR, IDI_MRA_ALARM, NULL }
+};
+
+GUI_DISPLAY_ITEM gdiExtraStatusIconsItems[] =
+{
+ { ADV_ICON_DELETED_ID, ADV_ICON_DELETED_STR, (INT_PTR)IDI_ERROR, NULL },
+ { ADV_ICON_NOT_ON_SERVER_ID, ADV_ICON_NOT_ON_SERVER_STR, IDI_AUTHGRANT, NULL },
+ { ADV_ICON_NOT_AUTHORIZED_ID, ADV_ICON_NOT_AUTHORIZED_STR, IDI_AUTHRUGUEST, NULL },
+ { ADV_ICON_PHONE_ID, ADV_ICON_PHONE_STR, IDI_MRA_PHONE, NULL },
+ { ADV_ICON_BLOGSTATUS_ID, ADV_ICON_BLOGSTATUS_STR, IDI_BLOGSTATUS, NULL },
+};
+
+//////////////////////////////////////////////////////////////////////////////////////
+
+static void AddIcoLibItems(LPWSTR lpwszSubSectionName, GUI_DISPLAY_ITEM *pgdiItems, size_t dwCount)
{
char szBuff[MAX_PATH];
WCHAR wszSection[MAX_PATH], wszPath[MAX_FILEPATH];
@@ -15,16 +59,16 @@ void CMraProto::AddIcoLibItems(LPWSTR lpwszRootSectionName, LPWSTR lpwszSubSecti
if (lpwszSubSectionName == NULL) lpwszSubSectionName = L"";
GetModuleFileName(masMraSettings.hInstance, wszPath, SIZEOF(wszPath));
- mir_sntprintf(wszSection, SIZEOF(wszSection), L"%s%s%s", lpwszRootSectionName, m_tszUserName, lpwszSubSectionName);
+ mir_sntprintf(wszSection, SIZEOF(wszSection), L"Protocols/MRA/%s", lpwszSubSectionName);
for (size_t i = 0;i<dwCount;i++) {
- mir_snprintf(szBuff, SIZEOF(szBuff), "%s_%s", m_szModuleName, pgdiItems[i].lpszName);
+ mir_snprintf(szBuff, SIZEOF(szBuff), "MRA_%s", pgdiItems[i].lpszName);
sid.pszName = szBuff;
sid.pwszDescription = pgdiItems[i].lpwszDescr;
sid.iDefaultIndex = -pgdiItems[i].defIcon;
sid.hDefaultIcon = (HICON)LoadImage(masMraSettings.hInstance, MAKEINTRESOURCE(pgdiItems[i].defIcon), IMAGE_ICON, 0, 0, LR_SHARED);
if (sid.hDefaultIcon == NULL) sid.hDefaultIcon = (HICON)LoadImage(NULL, MAKEINTRESOURCE(pgdiItems[i].defIcon), IMAGE_ICON, 0, 0, LR_SHARED);
- hResult[i] = Skin_AddIcon(&sid);
+ pgdiItems[i].hIconHandle = Skin_AddIcon(&sid);
}
}
@@ -44,24 +88,15 @@ HICON IconLibGetIconEx(HANDLE hIcon, DWORD dwFlags)
return hiIcon;
}
-
//////////////////////////////////////////////////////////////////////////////////////
-void CMraProto::IconsLoad()
+void IconsLoad()
{
- AddIcoLibItems(L"Protocols/", L"/MainMenu", gdiMenuItems, gdiMenuItemsCount, hMainMenuIcons);
- AddIcoLibItems(L"Protocols/", L"/ContactMenu", gdiContactMenuItems, gdiContactMenuItemsCount, hContactMenuIcons);
-
- // Advanced Status Icons initialization
- AddIcoLibItems(L"Protocols/", L"/Extra status", gdiExtraStatusIconsItems, gdiExtraStatusIconsItemsCount, hAdvancedStatusIcons);
-}
-
+ AddIcoLibItems(L"MainMenu", gdiMenuItems, SIZEOF(gdiMenuItems));
+ AddIcoLibItems(L"ContactMenu", gdiContactMenuItems, SIZEOF(gdiContactMenuItems));
-void CMraProto::IconsUnLoad()
-{
// Advanced Status Icons initialization
- bzero(hAdvancedStatusIcons, sizeof(hAdvancedStatusIcons));
- bzero(hAdvancedStatusItems, sizeof(hAdvancedStatusItems));
+ AddIcoLibItems(L"Extra status", gdiExtraStatusIconsItems, SIZEOF(gdiExtraStatusIconsItems));
}
void CMraProto::InitXStatusIcons()
@@ -113,4 +148,62 @@ void CMraProto::DestroyXStatusIcons()
bzero(hXStatusAdvancedStatusItems, sizeof(hXStatusAdvancedStatusItems));
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
+void CMraProto::InitMenus()
+{
+ // Main menu initialization
+ HICON hMainIcon = (HICON)LoadImage(masMraSettings.hInstance, MAKEINTRESOURCE(IDI_MRA), IMAGE_ICON, 0, 0, LR_SHARED);
+ CListCreateMenu(200001, 500085000, hMainIcon, NULL, TRUE, gdiMenuItems, SIZEOF(gdiMenuItems), hMainMenuItems);
+
+ // Contact menu initialization
+ CListCreateMenu(2000060000, -500050000, NULL, NULL, FALSE, gdiContactMenuItems, SIZEOF(gdiContactMenuItems), hContactMenuItems);
+}
+void CMraProto::CListCreateMenu(LONG lPosition, LONG lPopupPosition, HICON hMainIcon, LPSTR pszContactOwner, BOOL bIsMain, const GUI_DISPLAY_ITEM *pgdiItems, size_t dwCount, HANDLE *hResult)
+{
+ if (!pgdiItems || !dwCount || !hResult)
+ return;
+
+ char szServiceFunction[MAX_PATH], *pszServiceFunctionName;
+ strncpy(szServiceFunction, m_szModuleName, sizeof(szServiceFunction));
+ pszServiceFunctionName = szServiceFunction + strlen(m_szModuleName);
+
+ CLISTMENUITEM mi = {0};
+ mi.cbSize = sizeof(mi);
+
+ HGENMENU (*fnAddFunc)(CLISTMENUITEM*);
+ if (bIsMain) {
+ fnAddFunc = Menu_AddProtoMenuItem;
+
+ HGENMENU hRootMenu = MO_GetProtoRootMenu(m_szModuleName);
+ if (hRootMenu == NULL) {
+ mi.ptszName = m_tszUserName;
+ 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 = m_tszUserName;
+ 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)
+ CreateObjectSvc(szServiceFunction, pgdiItems[i].lpFunc);
+ mi.position = int(lPosition + i);
+ mi.icolibItem = pgdiItems[i].hIconHandle;
+ mi.ptszName = pgdiItems[i].lpwszDescr;
+ hResult[i] = fnAddFunc(&mi);
+ }
+}
diff --git a/protocols/MRA/MraProto.cpp b/protocols/MRA/MraProto.cpp
index 563d2d3ca1..be7c61cc98 100644
--- a/protocols/MRA/MraProto.cpp
+++ b/protocols/MRA/MraProto.cpp
@@ -72,14 +72,7 @@ CMraProto::CMraProto(const char* _module, const TCHAR* _displayName) :
HookEvent(ME_SYSTEM_PRESHUTDOWN, &CMraProto::OnPreShutdown);
HookEvent(ME_CLIST_EXTRA_LIST_REBUILD, &CMraProto::MraExtraIconsRebuild);
- IconsLoad();
-
- // Main menu initialization
- HICON hMainIcon = (HICON)LoadImage(masMraSettings.hInstance, MAKEINTRESOURCE(IDI_MRA), IMAGE_ICON, 0, 0, LR_SHARED);
- CListCreateMenu(200001, 500085000, hMainIcon, NULL, TRUE, gdiMenuItems, hMainMenuIcons, gdiMenuItemsCount, hMainMenuItems);
-
- // Contact menu initialization
- CListCreateMenu(2000060000, -500050000, NULL, NULL, FALSE, gdiContactMenuItems, hContactMenuIcons, gdiContactMenuItemsCount, hContactMenuItems);
+ InitMenus();
// xstatus menu
InitXStatusIcons();
@@ -112,7 +105,6 @@ CMraProto::~CMraProto()
Netlib_CloseHandle(hNetlibUser);
DestroyXStatusIcons();
- IconsUnLoad();
if (heNudgeReceived)
DestroyHookableEvent(heNudgeReceived);
diff --git a/protocols/MRA/MraProto.h b/protocols/MRA/MraProto.h
index 4b575955e6..3203135a29 100644
--- a/protocols/MRA/MraProto.h
+++ b/protocols/MRA/MraProto.h
@@ -95,7 +95,6 @@ struct CMraProto : public PROTO_INTERFACE, public MZeroedObject
void ForkThread(ThreadFunc, void*);
HANDLE ForkThreadEx(ThreadFunc, void*, UINT* threadID = NULL);
HANDLE HookEvent(const char*, EventFunc);
- void AddIcoLibItems(LPWSTR lpwszRootSectionName, LPWSTR lpwszSubSectionName, const struct GUI_DISPLAY_ITEM *pgdiItems, size_t dwCount, HANDLE *hResult);
void ShowFormattedErrorMessage(LPWSTR lpwszErrText, DWORD dwErrorCode);
void MraPopupShowW(HANDLE hContact, DWORD dwType, DWORD dwFlags, LPWSTR lpszTitle, LPWSTR lpszMessage);
@@ -225,13 +224,8 @@ struct CMraProto : public PROTO_INTERFACE, public MZeroedObject
DWORD dwAPCThreadRunning;
HANDLE hAvatarsQueueHandle;
- HANDLE hMainMenuIcons[MAIN_MENU_ITEMS_COUNT+4];
HANDLE hMainMenuItems[MAIN_MENU_ITEMS_COUNT+4];
-
- HANDLE hContactMenuIcons[CONTACT_MENU_ITEMS_COUNT+4];
HANDLE hContactMenuItems[CONTACT_MENU_ITEMS_COUNT+4];
-
- HANDLE hAdvancedStatusIcons[ADV_ICON_MAX+4];
HANDLE hAdvancedStatusItems[ADV_ICON_MAX+4];
HWND hWndEMailPopupStatus;
@@ -312,8 +306,6 @@ struct CMraProto : public PROTO_INTERFACE, public MZeroedObject
DWORD MraRecvCommand_Message(DWORD dwTime, DWORD dwFlags, MRA_LPS *plpsFrom, MRA_LPS *plpsText, MRA_LPS *plpsRFTText, MRA_LPS *plpsMultiChatData);
- void IconsLoad();
- void IconsUnLoad();
void InitXStatusIcons();
void DestroyXStatusIcons();
void SetExtraIcons(HANDLE hContact);
@@ -328,7 +320,8 @@ struct CMraProto : public PROTO_INTERFACE, public MZeroedObject
void MraAPCQueueDestroy(PFIFO_MT pffmtAPCQueue);
void __cdecl MraUserAPCThreadProc(LPVOID lpParameter);
- void CListCreateMenu(LONG lPosition, LONG lPopupPosition, HICON hMainIcon, LPSTR pszContactOwner, BOOL bIsStatus, const struct GUI_DISPLAY_ITEM *pgdiItems, HANDLE *hIcoLibIcons, size_t dwCount, HANDLE *hResult);
+ void InitMenus();
+ void CListCreateMenu(LONG lPosition, LONG lPopupPosition, HICON hMainIcon, LPSTR pszContactOwner, BOOL bIsStatus, const struct GUI_DISPLAY_ITEM *pgdiItems, size_t dwCount, HANDLE *hResult);
void CListShowMenuItem(HANDLE hMenuItem, BOOL bShow);
DWORD ProtoBroadcastAckAsynchEx(HANDLE hContact, int type, int hResult, HANDLE hProcess, LPARAM lParam, size_t dwLparamSize);
diff --git a/protocols/MRA/Mra_functions.cpp b/protocols/MRA/Mra_functions.cpp
index 288793abe1..d812e5eb1d 100644
--- a/protocols/MRA/Mra_functions.cpp
+++ b/protocols/MRA/Mra_functions.cpp
@@ -767,8 +767,7 @@ void CMraProto::MraUpdateEmailStatus(LPSTR lpszFrom, size_t dwFromSize, LPSTR lp
lstrcpynW(szStatusText, szMailBoxStatus, SIZEOF(szStatusText));
}
- if (bTrayIconNewMailNotify)
- {
+ if (bTrayIconNewMailNotify) {
char szServiceFunction[MAX_PATH], *pszServiceFunctionName;
CLISTEVENT cle = {0};
@@ -776,7 +775,7 @@ void CMraProto::MraUpdateEmailStatus(LPSTR lpszFrom, size_t dwFromSize, LPSTR lp
//cle.hContact;
//cle.hDbEvent;
cle.lpszProtocol = m_szModuleName;
- cle.hIcon = IconLibGetIcon(hMainMenuIcons[0]);
+ cle.hIcon = IconLibGetIcon( gdiMenuItems[0].hIconHandle );
cle.flags = (CLEF_UNICODE|CLEF_PROTOCOLGLOBAL);
cle.pszService = "";
cle.ptszTooltip = szStatusText;
@@ -1283,54 +1282,6 @@ DWORD CMraProto::CreateBlobFromContact(HANDLE hContact, LPWSTR lpwszRequestReaso
return dwRetErrorCode;
}
-void CMraProto::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;
- strncpy(szServiceFunction, m_szModuleName, sizeof(szServiceFunction));
- pszServiceFunctionName = szServiceFunction + strlen(m_szModuleName);
-
- CLISTMENUITEM mi = {0};
- mi.cbSize = sizeof(mi);
-
- HGENMENU (*fnAddFunc)(CLISTMENUITEM*);
- if (bIsMain) {
- fnAddFunc = Menu_AddProtoMenuItem;
-
- HGENMENU hRootMenu = MO_GetProtoRootMenu(m_szModuleName);
- if (hRootMenu == NULL) {
- mi.ptszName = m_tszUserName;
- 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 = m_tszUserName;
- 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)
- CreateObjectSvc(szServiceFunction, pgdiItems[i].lpFunc);
- mi.position = int(lPosition + i);
- mi.icolibItem = hIcoLibIcons[i];
- mi.ptszName = pgdiItems[i].lpwszDescr;
- hResult[i] = fnAddFunc(&mi);
- }
-}
-
void CMraProto::CListShowMenuItem(HANDLE hMenuItem, BOOL bShow)
{
CLISTMENUITEM mi = {0};
@@ -1568,7 +1519,7 @@ INT_PTR CALLBACK SendReplyBlogStatusDlgProc(HWND hWndDlg, UINT message, WPARAM w
SetWindowLongPtr(hWndEdit, GWLP_USERDATA, (LONG_PTR)OldMessageEditProc);
SendMessage(hWndEdit, EM_LIMITTEXT, MICBLOG_STATUS_MAX, 0);
- SendMessage(hWndDlg, WM_SETICON, ICON_BIG, (LPARAM)IconLibGetIcon(dat->ppro->hMainMenuIcons[5]));
+ SendMessage(hWndDlg, WM_SETICON, ICON_BIG, (LPARAM)IconLibGetIcon(gdiMenuItems[5].hIconHandle));
// blog status message
if (dat->ppro->mraGetStaticStringW(dat->hContact, DBSETTING_BLOGSTATUS, szBuff, SIZEOF(szBuff), NULL))
diff --git a/protocols/MRA/Mra_svcs.cpp b/protocols/MRA/Mra_svcs.cpp
index 426343ebbd..a69220a1d8 100644
--- a/protocols/MRA/Mra_svcs.cpp
+++ b/protocols/MRA/Mra_svcs.cpp
@@ -1,54 +1,6 @@
#include "Mra.h"
#include "proto.h"
-const GUI_DISPLAY_ITEM gdiMenuItems[] =
-{
- { MRA_GOTO_INBOX, MRA_GOTO_INBOX_STR, IDI_INBOX, &CMraProto::MraGotoInbox },
- { MRA_SHOW_INBOX_STATUS, MRA_SHOW_INBOX_STATUS_STR, IDI_MAIL_NOTIFY, &CMraProto::MraShowInboxStatus },
- { MRA_EDIT_PROFILE, MRA_EDIT_PROFILE_STR, IDI_PROFILE, &CMraProto::MraEditProfile },
- { MRA_MY_ALBUM, MRA_MY_ALBUM_STR, IDI_MRA_PHOTO, &CMraProto::MyAlbum },
- { MRA_MY_BLOG, MRA_MY_BLOG_STR, IDI_MRA_BLOGS, &CMraProto::MyBlog },
- { MRA_MY_BLOGSTATUS, MRA_MY_BLOGSTATUS_STR, IDI_BLOGSTATUS, &CMraProto::MyBlogStatus },
- { MRA_MY_VIDEO, MRA_MY_VIDEO_STR, IDI_MRA_VIDEO, &CMraProto::MyVideo },
- { MRA_MY_ANSWERS, MRA_MY_ANSWERS_STR, IDI_MRA_ANSWERS, &CMraProto::MyAnswers },
- { MRA_MY_WORLD, MRA_MY_WORLD_STR, IDI_MRA_WORLD, &CMraProto::MyWorld },
- { MRA_ZHUKI, MRA_ZHUKI_STR, IDI_MRA_ZHUKI, &CMraProto::MraZhuki },
- { MRA_CHAT, MRA_CHAT_STR, IDI_MRA_CHAT, &CMraProto::MraChat },
- { MRA_WEB_SEARCH, MRA_WEB_SEARCH_STR, IDI_MRA_WEB_SEARCH, &CMraProto::MraWebSearch },
- { MRA_UPD_ALL_USERS_INFO, MRA_UPD_ALL_USERS_INFO_STR, IDI_PROFILE, &CMraProto::MraUpdateAllUsersInfo },
- { MRA_CHK_USERS_AVATARS, MRA_CHK_USERS_AVATARS_STR, IDI_PROFILE, &CMraProto::MraCheckUpdatesUsersAvt },
- { MRA_REQ_AUTH_FOR_ALL, MRA_REQ_AUTH_FOR_ALL_STR, IDI_AUTHRUGUEST, &CMraProto::MraRequestAuthForAll }
-};
-
-const int gdiMenuItemsCount = SIZEOF(gdiMenuItems);
-
-const GUI_DISPLAY_ITEM gdiContactMenuItems[] =
-{
- { MRA_REQ_AUTH, MRA_REQ_AUTH_STR, IDI_AUTHRUGUEST, &CMraProto::MraRequestAuthorization },
- { MRA_GRANT_AUTH, MRA_GRANT_AUTH_STR, IDI_AUTHGRANT, &CMraProto::MraGrantAuthorization },
- { MRA_SEND_POSTCARD, MRA_SEND_POSTCARD_STR, IDI_MRA_POSTCARD, &CMraProto::MraSendPostcard },
- { MRA_VIEW_ALBUM, MRA_VIEW_ALBUM_STR, IDI_MRA_PHOTO, &CMraProto::MraViewAlbum },
- { MRA_READ_BLOG, MRA_READ_BLOG_STR , IDI_MRA_BLOGS, &CMraProto::MraReadBlog },
- { MRA_REPLY_BLOG_STATUS, MRA_REPLY_BLOG_STATUS_STR, IDI_BLOGSTATUS, &CMraProto::MraReplyBlogStatus },
- { MRA_VIEW_VIDEO, MRA_VIEW_VIDEO_STR, IDI_MRA_VIDEO, &CMraProto::MraViewVideo },
- { MRA_ANSWERS, MRA_ANSWERS_STR, IDI_MRA_ANSWERS, &CMraProto::MraAnswers },
- { MRA_WORLD, MRA_WORLD_STR, IDI_MRA_WORLD, &CMraProto::MraWorld },
- { MRA_SEND_NUDGE, MRA_SENDNUDGE_STR, IDI_MRA_ALARM, NULL }
-};
-
-const int gdiContactMenuItemsCount = SIZEOF(gdiContactMenuItems);
-
-const GUI_DISPLAY_ITEM gdiExtraStatusIconsItems[] =
-{
- { ADV_ICON_DELETED_ID, ADV_ICON_DELETED_STR, (INT_PTR)IDI_ERROR, NULL },
- { ADV_ICON_NOT_ON_SERVER_ID, ADV_ICON_NOT_ON_SERVER_STR, IDI_AUTHGRANT, NULL },
- { ADV_ICON_NOT_AUTHORIZED_ID, ADV_ICON_NOT_AUTHORIZED_STR, IDI_AUTHRUGUEST, NULL },
- { ADV_ICON_PHONE_ID, ADV_ICON_PHONE_STR, IDI_MRA_PHONE, NULL },
- { ADV_ICON_BLOGSTATUS_ID, ADV_ICON_BLOGSTATUS_STR, IDI_BLOGSTATUS, NULL },
-};
-
-const int gdiExtraStatusIconsItemsCount = SIZEOF(gdiExtraStatusIconsItems);
-
const LPSTR lpcszStatusUri[] =
{
"", // offline // "status_0",
@@ -742,7 +694,7 @@ int CMraProto::MraExtraIconsApply(WPARAM wParam, LPARAM lParam)
int CMraProto::MraExtraIconsRebuild(WPARAM wParam, LPARAM lParam)
{
for (size_t i = 0; i < ADV_ICON_MAX; i++)
- hAdvancedStatusItems[i] = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)IconLibGetIcon(hAdvancedStatusIcons[i]), 0);
+ hAdvancedStatusItems[i] = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)IconLibGetIcon(gdiExtraStatusIconsItems[i].hIconHandle), 0);
for (size_t i = 0; i < MRA_XSTATUS_COUNT+1; i++)
hXStatusAdvancedStatusItems[i] = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)IconLibGetIcon(hXStatusAdvancedStatusIcons[i]), 0);