From ba430f779e1f3692d563c48b3517915429bd393d Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 11 Apr 2013 08:04:17 +0000 Subject: status icons almost recovered git-svn-id: http://svn.miranda-ng.org/main/trunk@4420 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/core/stdmsg/src/statusicon.cpp | 8 ++++---- src/modules/srmm/statusicon.cpp | 29 ++++------------------------- 2 files changed, 8 insertions(+), 29 deletions(-) (limited to 'src') diff --git a/src/core/stdmsg/src/statusicon.cpp b/src/core/stdmsg/src/statusicon.cpp index 68ad9d25d5..25e7813615 100644 --- a/src/core/stdmsg/src/statusicon.cpp +++ b/src/core/stdmsg/src/statusicon.cpp @@ -42,9 +42,9 @@ void DrawStatusIcons(HANDLE hContact, HDC hDC, RECT r, int gap) HICON hIcon; int x = r.left; - StatusIconData *sid; int nIcon = 0; - while ((sid = (StatusIconData*)CallService(MS_MSG_GETNTHICON, (WPARAM)hContact, nIcon++)) != NULL && x < r.right) { + StatusIconData *sid; + while ((sid = Srmm_GetNthIcon(hContact, nIcon++)) != 0 && x < r.right) { if ((sid->flags & MBF_DISABLED) && sid->hIconDisabled) hIcon = sid->hIconDisabled; else hIcon = sid->hIcon; @@ -58,7 +58,7 @@ void DrawStatusIcons(HANDLE hContact, HDC hDC, RECT r, int gap) void CheckIconClick(HANDLE hContact, HWND hwndFrom, POINT pt, RECT r, int gap, int click_flags) { int iconNum = (pt.x - r.left) / (GetSystemMetrics(SM_CXSMICON) + gap); - StatusIconData *sid = (StatusIconData*)CallService(MS_MSG_GETNTHICON, (WPARAM)hContact, iconNum); + StatusIconData *sid = Srmm_GetNthIcon(hContact, iconNum); if (sid == NULL) return; @@ -89,7 +89,7 @@ int DeinitStatusIcons() int GetStatusIconsCount(HANDLE hContact) { int nIcon = 0; - while ( CallService(MS_MSG_GETNTHICON, (WPARAM)hContact, nIcon) != NULL) + while ( Srmm_GetNthIcon(hContact, nIcon) != NULL) nIcon++; return nIcon; } diff --git a/src/modules/srmm/statusicon.cpp b/src/modules/srmm/statusicon.cpp index ca5f526fac..554df1565c 100644 --- a/src/modules/srmm/statusicon.cpp +++ b/src/modules/srmm/statusicon.cpp @@ -154,10 +154,10 @@ static INT_PTR GetNthIcon(WPARAM wParam, LPARAM lParam) if (nVis == (int)lParam) { memcpy(&res, &p, sizeof(res)); if (pc) { - res.hIcon = pc->hIcon; - res.hIconDisabled = pc->hIconDisabled; + if (pc->hIcon) res.hIcon = pc->hIcon; + if (pc->hIconDisabled) res.hIconDisabled = pc->hIconDisabled; + if (pc->szTooltip) res.szTooltip = pc->szTooltip; res.flags = pc->flags; - res.szTooltip = pc->szTooltip; } return (INT_PTR)&res; } @@ -169,25 +169,6 @@ static INT_PTR GetNthIcon(WPARAM wParam, LPARAM lParam) ///////////////////////////////////////////////////////////////////////////////////////// -static int OnWindowEvent(WPARAM, LPARAM lParam) -{ - MessageWindowEventData *evt = (MessageWindowEventData*)lParam; - if (evt->uType == MSG_WINDOW_EVT_CLOSE) { - for (int i=0; i < arIcons.getCount(); i++) { - StatusIconMain &p = arIcons[i]; - p.arChildren.remove((StatusIconChild*)&evt->hContact); - } - } - - return 0; -} - -static int OnModulesLoaded(WPARAM, LPARAM) -{ - HookEvent(ME_MSG_WINDOWEVENT, OnWindowEvent); - return 0; -} - void KillModuleSrmmIcons(int hLangpack) { for (int i=arIcons.getCount()-1; i >= 0; i--) { @@ -202,9 +183,7 @@ int LoadSrmmModule() CreateServiceFunction("MessageAPI/AddIcon", AddStatusIcon); CreateServiceFunction(MS_MSG_REMOVEICON, RemoveStatusIcon); CreateServiceFunction(MS_MSG_MODIFYICON, ModifyStatusIcon); - CreateServiceFunction(MS_MSG_GETNTHICON, GetNthIcon); - - HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); + CreateServiceFunction("MessageAPI/GetNthIcon", GetNthIcon); hHookIconsChanged = CreateHookableEvent(ME_MSG_ICONSCHANGED); return 0; -- cgit v1.2.3