From 95aa036670a1ce2c461ffd9bd3a586d191ee4675 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 19 Jul 2012 22:48:01 +0000 Subject: - various icolib fixes; - code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@1061 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/MetaContacts/icons.cpp | 48 ++++++++++++---------------------- plugins/MetaContacts/meta_services.cpp | 2 -- plugins/MetaContacts/metacontacts.h | 2 +- 3 files changed, 17 insertions(+), 35 deletions(-) (limited to 'plugins/MetaContacts') diff --git a/plugins/MetaContacts/icons.cpp b/plugins/MetaContacts/icons.cpp index 829636be1f..e6cbc9a3a3 100644 --- a/plugins/MetaContacts/icons.cpp +++ b/plugins/MetaContacts/icons.cpp @@ -1,8 +1,5 @@ #include "metacontacts.h" -HANDLE hIcoLibIconsChanged = NULL; - - typedef struct { char* szDescr; char* szName; @@ -20,26 +17,18 @@ static IconStruct iconList[] = { }; -HICON LoadIconEx(IconIndex i) { - HICON hIcon; - - if (hIcoLibIconsChanged) - hIcon = (HICON)CallService(MS_SKIN2_GETICON, 0, (LPARAM)iconList[(int)i].szName); - else - hIcon = (HICON)LoadImage(hInstance, MAKEINTRESOURCE(iconList[(int)i].defIconID), IMAGE_ICON, 0, 0, 0); - - return hIcon; +HICON LoadIconEx(IconIndex i) +{ + return Skin_GetIcon(iconList[i].szName); } - -void ReleaseIconEx(HICON hIcon) { - if (hIcoLibIconsChanged) - CallService(MS_SKIN2_RELEASEICON, (WPARAM)hIcon, 0); - else - DestroyIcon(hIcon); +void ReleaseIconEx(HICON hIcon) +{ + Skin_ReleaseIcon(hIcon); } -int ReloadIcons(WPARAM wParam, LPARAM lParam) { +int ReloadIcons(WPARAM wParam, LPARAM lParam) +{ // fix menu icons CLISTMENUITEM menu = {0}; @@ -73,29 +62,24 @@ int ReloadIcons(WPARAM wParam, LPARAM lParam) { return 0; } -void InitIcons(void) { +void InitIcons(void) +{ + TCHAR path[MAX_PATH]; + GetModuleFileName(hInstance, path, SIZEOF(path)); + SKINICONDESC sid = {0}; - char path[MAX_PATH]; - int i; - sid.cbSize = sizeof(SKINICONDESC); sid.pszSection = META_PROTO; sid.pszDefaultFile = path; - GetModuleFileName(hInstance, path, sizeof(path)); - for (i = 0; i < sizeof(iconList) / sizeof(IconStruct); ++i) - { - sid.pszDescription = Translate(iconList[i].szDescr); + for (int i=0; i < SIZEOF(iconList); ++i) { + sid.pszDescription = iconList[i].szDescr; sid.pszName = iconList[i].szName; sid.iDefaultIndex = -iconList[i].defIconID; Skin_AddIcon(&sid); } - hIcoLibIconsChanged = HookEvent(ME_SKIN2_ICONSCHANGED, ReloadIcons); + HookEvent(ME_SKIN2_ICONSCHANGED, ReloadIcons); ReloadIcons(0, 0); } - -void DeinitIcons(void) { - if (hIcoLibIconsChanged) UnhookEvent(hIcoLibIconsChanged); -} diff --git a/plugins/MetaContacts/meta_services.cpp b/plugins/MetaContacts/meta_services.cpp index 1fe1d9af4d..94aea51fc9 100644 --- a/plugins/MetaContacts/meta_services.cpp +++ b/plugins/MetaContacts/meta_services.cpp @@ -2072,6 +2072,4 @@ void Meta_CloseHandles() // lets leave them, hey? (why?) for (i=0;i #include #include +#include #define META_PROTO "MetaContacts" #define META_FILTER "MetaContactsFilter" @@ -224,7 +225,6 @@ INT_PTR MyDBGetContactSetting(HANDLE hContact, const char *szModule, const char // IcoLib support void InitIcons(void); -void DeinitIcons(void); typedef enum {I_MENUOFF, I_MENU, I_CONVERT, I_ADD, I_EDIT, I_SETDEFAULT, I_REMOVE} IconIndex; HICON LoadIconEx(IconIndex i); -- cgit v1.2.3