From 917f2ac608117c2e2eb2c8062e75d0a44177cc11 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 18 Nov 2012 21:52:25 +0000 Subject: global mra xstatus icons git-svn-id: http://svn.miranda-ng.org/main/trunk@2366 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/MRA/src/Mra.cpp | 3 +++ protocols/MRA/src/Mra.h | 5 +++++ protocols/MRA/src/MraIcons.cpp | 23 +++++++++++------------ protocols/MRA/src/MraProto.cpp | 7 ++----- protocols/MRA/src/MraProto.h | 4 ---- protocols/MRA/src/Mra_functions.cpp | 2 +- protocols/MRA/src/Mra_svcs.cpp | 2 +- 7 files changed, 23 insertions(+), 23 deletions(-) (limited to 'protocols') diff --git a/protocols/MRA/src/Mra.cpp b/protocols/MRA/src/Mra.cpp index 0dbbb3461b..082a2a9332 100644 --- a/protocols/MRA/src/Mra.cpp +++ b/protocols/MRA/src/Mra.cpp @@ -105,6 +105,8 @@ extern "C" MRA_API int Load(void) } } + InitXStatusIcons(); + HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); HookEvent(ME_SYSTEM_PRESHUTDOWN, OnPreShutdown); @@ -122,6 +124,7 @@ extern "C" MRA_API int Load(void) extern "C" MRA_API int Unload(void) { + DestroyXStatusIcons(); if (masMraSettings.hDLLXStatusIcons) { FreeLibrary(masMraSettings.hDLLXStatusIcons); masMraSettings.hDLLXStatusIcons = NULL; diff --git a/protocols/MRA/src/Mra.h b/protocols/MRA/src/Mra.h index a4773a74e0..2d6ee820a3 100644 --- a/protocols/MRA/src/Mra.h +++ b/protocols/MRA/src/Mra.h @@ -185,6 +185,8 @@ typedef struct extern MRA_SETTINGS masMraSettings; extern LIST g_Instances; +extern HANDLE hXStatusAdvancedStatusIcons[]; + INT_PTR LoadModules(); void UnloadModules(); void InitExtraIcons(); @@ -234,6 +236,9 @@ void MraAddrListFree(MRA_ADDR_LIST *pmalAddrList); DWORD MraAddrListGetFromBuff(LPSTR lpszAddreses, size_t dwAddresesSize, MRA_ADDR_LIST *pmalAddrList); DWORD MraAddrListGetToBuff(MRA_ADDR_LIST *pmalAddrList, LPSTR lpszBuff, size_t dwBuffSize, size_t *pdwBuffSizeRet); +void InitXStatusIcons(); +void DestroyXStatusIcons(); + DWORD MraGetVersionStringFromFormatted (LPSTR dwUserAgentFormatted, size_t dwUserAgentFormattedSize, LPSTR lpszVersion, size_t dwVersionSize, size_t *pdwVersionSizeRet); BOOL IsUnicodeEnv (); BOOL IsHTTPSProxyUsed (HANDLE hNetlibUser); diff --git a/protocols/MRA/src/MraIcons.cpp b/protocols/MRA/src/MraIcons.cpp index dc4e463d8e..504aebf7fa 100644 --- a/protocols/MRA/src/MraIcons.cpp +++ b/protocols/MRA/src/MraIcons.cpp @@ -1,6 +1,8 @@ #include "Mra.h" #include "MraIcons.h" +HANDLE hXStatusAdvancedStatusIcons[MRA_XSTATUS_COUNT+4]; + GUI_DISPLAY_ITEM gdiMenuItems[] = { { MRA_GOTO_INBOX, MRA_GOTO_INBOX_STR, IDI_INBOX, &CMraProto::MraGotoInbox }, @@ -92,25 +94,23 @@ HICON IconLibGetIconEx(HANDLE hIcon, DWORD dwFlags) void IconsLoad() { - AddIcoLibItems(L"MainMenu", gdiMenuItems, SIZEOF(gdiMenuItems)); - AddIcoLibItems(L"ContactMenu", gdiContactMenuItems, SIZEOF(gdiContactMenuItems)); + AddIcoLibItems(L"Main Menu", gdiMenuItems, SIZEOF(gdiMenuItems)); + AddIcoLibItems(L"Contact Menu", gdiContactMenuItems, SIZEOF(gdiContactMenuItems)); // Advanced Status Icons initialization AddIcoLibItems(L"Extra status", gdiExtraStatusIconsItems, SIZEOF(gdiExtraStatusIconsItems)); } -void CMraProto::InitXStatusIcons() +void InitXStatusIcons() { - WCHAR wszSection[MAX_PATH], wszPath[MAX_FILEPATH]; - mir_sntprintf(wszSection, SIZEOF(wszSection), L"Status Icons/%s/Custom Status", m_tszUserName); + WCHAR wszPath[MAX_FILEPATH]; if (masMraSettings.hDLLXStatusIcons) GetModuleFileName(masMraSettings.hDLLXStatusIcons, wszPath, SIZEOF(wszPath)); else bzero(wszPath, sizeof(wszPath)); - SKINICONDESC sid = {0}; - sid.cbSize = sizeof(sid); - sid.pwszSection = wszSection; + SKINICONDESC sid = { sizeof(sid) }; + sid.pwszSection = L"Protocols/MRA/Custom Status"; sid.pwszDefaultFile = wszPath; sid.cx = sid.cy = 16; sid.flags = SIDF_ALL_UNICODE; @@ -118,7 +118,7 @@ void CMraProto::InitXStatusIcons() hXStatusAdvancedStatusIcons[0] = NULL; for (int i = 1; i < MRA_XSTATUS_COUNT+1; i++) { char szBuff[MAX_PATH]; - mir_snprintf(szBuff, SIZEOF(szBuff), "%s_xstatus%ld", m_szModuleName, i); + mir_snprintf(szBuff, SIZEOF(szBuff), "mra_xstatus%ld", i); sid.pszName = szBuff; int iCurIndex = i+IDI_XSTATUS1-1; @@ -133,17 +133,16 @@ void CMraProto::InitXStatusIcons() } } -void CMraProto::DestroyXStatusIcons() +void DestroyXStatusIcons() { char szBuff[MAX_PATH]; for (size_t i = 1; i < MRA_XSTATUS_COUNT+1; i++) { - mir_snprintf(szBuff, SIZEOF(szBuff), "xstatus%ld", i); + mir_snprintf(szBuff, SIZEOF(szBuff), "mra_xstatus%ld", i); Skin_RemoveIcon(szBuff); } bzero(hXStatusAdvancedStatusIcons, sizeof(hXStatusAdvancedStatusIcons)); - bzero(hXStatusAdvancedStatusItems, sizeof(hXStatusAdvancedStatusItems)); } ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/protocols/MRA/src/MraProto.cpp b/protocols/MRA/src/MraProto.cpp index a19450dfdd..4d98c17a49 100644 --- a/protocols/MRA/src/MraProto.cpp +++ b/protocols/MRA/src/MraProto.cpp @@ -55,7 +55,6 @@ CMraProto::CMraProto(const char* _module, const TCHAR* _displayName) : InitContactMenu(); // xstatus menu - InitXStatusIcons(); for (size_t i = 0; i < MRA_XSTATUS_COUNT; i++) { char szServiceName[100]; mir_snprintf(szServiceName, SIZEOF(szServiceName), "/menuXStatus%ld", i); @@ -68,8 +67,8 @@ CMraProto::CMraProto(const char* _module, const TCHAR* _displayName) : HookEvent(ME_CLIST_PREBUILDSTATUSMENU, &CMraProto::MraRebuildStatusMenu); MraRebuildStatusMenu(0, 0); - hExtraXstatusIcon = ExtraIcon_Register("MRAXstatus", "Mail.ru Xstatus", "MRA_xstatus25"); - hExtraInfo = ExtraIcon_Register("MRAStatus", "Mail.ru extra info", "MRA_xstatus49"); + hExtraXstatusIcon = ExtraIcon_Register("MRAXstatus", "Mail.ru Xstatus", "mra_xstatus25"); + hExtraInfo = ExtraIcon_Register("MRAStatus", "Mail.ru extra info", "mra_xstatus49"); bHideXStatusUI = FALSE; m_iXStatus = mraGetByte(NULL, DBSETTING_XSTATUSID, MRA_MIR_XSTATUS_NONE); @@ -83,8 +82,6 @@ CMraProto::~CMraProto() { Netlib_CloseHandle(hNetlibUser); - DestroyXStatusIcons(); - if (heNudgeReceived) DestroyHookableEvent(heNudgeReceived); diff --git a/protocols/MRA/src/MraProto.h b/protocols/MRA/src/MraProto.h index 84828bce0b..18007f3b72 100644 --- a/protocols/MRA/src/MraProto.h +++ b/protocols/MRA/src/MraProto.h @@ -223,8 +223,6 @@ struct CMraProto : public PROTO_INTERFACE, public MZeroedObject BOOL bHideXStatusUI; HANDLE hXStatusMenuItems[MRA_XSTATUS_COUNT+4]; - HANDLE hXStatusAdvancedStatusIcons[MRA_XSTATUS_COUNT+4]; - HANDLE hXStatusAdvancedStatusItems[MRA_XSTATUS_COUNT+4]; HANDLE hExtraXstatusIcon; HANDLE hExtraInfo; @@ -296,8 +294,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 InitXStatusIcons(); - void DestroyXStatusIcons(); void SetExtraIcons(HANDLE hContact); #define MESSAGE_NOT_SPAM 1 diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp index a64b5c2cbe..cbb9fd585b 100644 --- a/protocols/MRA/src/Mra_functions.cpp +++ b/protocols/MRA/src/Mra_functions.cpp @@ -1225,7 +1225,7 @@ INT_PTR CALLBACK SetXStatusDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LP WCHAR szBuff[STATUS_TITLE_MAX+STATUS_DESC_MAX]; WNDPROC OldMessageEditProc; - dat->hDlgIcon = IconLibGetIcon(dat->ppro->hXStatusAdvancedStatusIcons[dat->dwXStatus]); + dat->hDlgIcon = IconLibGetIcon(hXStatusAdvancedStatusIcons[dat->dwXStatus]); dat->dwCountdown = 5; hWndEdit = GetDlgItem(hWndDlg, IDC_XTITLE); diff --git a/protocols/MRA/src/Mra_svcs.cpp b/protocols/MRA/src/Mra_svcs.cpp index 65ca091c10..dce170c9d7 100644 --- a/protocols/MRA/src/Mra_svcs.cpp +++ b/protocols/MRA/src/Mra_svcs.cpp @@ -157,7 +157,7 @@ void CMraProto::SetExtraIcons(HANDLE hContact) if (dwBlogStatusMsgSize) dwIconID = ADV_ICON_BLOGSTATUS; } - ExtraSetIcon(hExtraXstatusIcon, hContact, (( IsXStatusValid(dwXStatus) || dwXStatus == MRA_MIR_XSTATUS_UNKNOWN)? hXStatusAdvancedStatusItems[dwXStatus]:NULL)); + //ExtraSetIcon(hExtraXstatusIcon, hContact, (( IsXStatusValid(dwXStatus) || dwXStatus == MRA_MIR_XSTATUS_UNKNOWN)? hXStatusAdvancedStatusItems[dwXStatus]:NULL)); ExtraSetIcon(hExtraInfo, hContact, ((dwIconID != -1) ? hAdvancedStatusItems[dwIconID]:NULL)); } -- cgit v1.2.3