From e47e740b5138c81b7ddac61e99fa8bb9a39a3559 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 1 Jan 2014 18:53:46 +0000 Subject: useless icon copying removed git-svn-id: http://svn.miranda-ng.org/main/trunk@7447 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Scriver/src/globals.cpp | 33 +++++---------------------------- plugins/Scriver/src/globals.h | 1 - plugins/Scriver/src/msgs.cpp | 8 ++++---- 3 files changed, 9 insertions(+), 33 deletions(-) (limited to 'plugins/Scriver') diff --git a/plugins/Scriver/src/globals.cpp b/plugins/Scriver/src/globals.cpp index deb259b09f..de9442118d 100644 --- a/plugins/Scriver/src/globals.cpp +++ b/plugins/Scriver/src/globals.cpp @@ -107,23 +107,6 @@ void RegisterIcons(void) ///////////////////////////////////////////////////////////////////////////////////////// -HICON hIconList[SIZEOF(iconList)]; - -BOOL IsStaticIcon(HICON hIcon) -{ - for (int i = 0; i < SIZEOF(hIconList); i++) - if (hIcon == hIconList[i]) - return TRUE; - - return FALSE; -} - -void ReleaseIconSmart(HICON hIcon) -{ - if (!IsStaticIcon(hIcon)) - Skin_ReleaseIcon(hIcon); -} - int ImageList_AddIcon_Ex(HIMAGELIST hIml, int id) { HICON hIcon = LoadSkinnedIcon(id); int res = ImageList_AddIcon(hIml, hIcon); @@ -153,10 +136,6 @@ int ImageList_AddIcon_ProtoEx(HIMAGELIST hIml, const char* szProto, int status) void ReleaseIcons() { - for (int i = 0; i < SIZEOF(hIconList); i++) - if (hIconList[i] != NULL) - Skin_ReleaseIcon(hIconList[i]); - Skin_ReleaseIcon(g_dat.hMsgIcon); Skin_ReleaseIcon(g_dat.hMsgIconBig); Skin_ReleaseIcon(g_dat.hIconChatBig); @@ -166,20 +145,18 @@ HICON GetCachedIcon(const char *name) { for (int i = 0; i < SIZEOF(iconList); i++) if (!strcmp(iconList[i].szName, name)) - return hIconList[i]; + return Skin_GetIconByHandle(iconList[i].hIcolib); return NULL; } -void LoadGlobalIcons() { +void LoadGlobalIcons() +{ int i; - int overlayIcon; - for (i = 0; i < SIZEOF(iconList); i++) - hIconList[i] = Skin_GetIcon(iconList[i].szName); g_dat.hMsgIcon = LoadSkinnedIcon(SKINICON_EVENT_MESSAGE); g_dat.hMsgIconBig = LoadSkinnedIconBig(SKINICON_EVENT_MESSAGE); - g_dat.hIconChatBig = Skin_GetIcon("chat_window"); + g_dat.hIconChatBig = Skin_GetIcon("chat_window", true); ImageList_RemoveAll(g_dat.hButtonIconList); ImageList_RemoveAll(g_dat.hChatButtonIconList); @@ -195,7 +172,7 @@ void LoadGlobalIcons() { ImageList_AddIcon(g_dat.hChatButtonIconList, GetCachedIcon(chatButtonIcons[i])); ImageList_AddIcon(g_dat.hHelperIconList, GetCachedIcon("scriver_OVERLAY")); - overlayIcon = ImageList_AddIcon(g_dat.hHelperIconList, GetCachedIcon("scriver_OVERLAY")); + int overlayIcon = ImageList_AddIcon(g_dat.hHelperIconList, GetCachedIcon("scriver_OVERLAY")); ImageList_SetOverlayImage(g_dat.hHelperIconList, overlayIcon, 1); for (i=IDI_GOOGLE; i < IDI_LASTICON; i++) { HICON hIcon = (HICON)LoadImage(g_hInst, MAKEINTRESOURCE(i), IMAGE_ICON, 0, 0, 0); diff --git a/plugins/Scriver/src/globals.h b/plugins/Scriver/src/globals.h index 17d542d110..20cd1e1a19 100644 --- a/plugins/Scriver/src/globals.h +++ b/plugins/Scriver/src/globals.h @@ -135,7 +135,6 @@ int ImageList_AddIcon_Ex(HIMAGELIST hIml, int id); int ImageList_AddIcon_Ex2(HIMAGELIST hIml, HICON hIcon); int ImageList_ReplaceIcon_Ex(HIMAGELIST hIml, int nIndex, int id); int ImageList_AddIcon_ProtoEx(HIMAGELIST hIml, const char* szProto, int status); -void ReleaseIconSmart(HICON hIcon); void StreamInTestEvents(HWND hEditWnd, GlobalMessageData *gdat); diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp index 2cd0c51bf3..3d75a9223c 100644 --- a/plugins/Scriver/src/msgs.cpp +++ b/plugins/Scriver/src/msgs.cpp @@ -389,8 +389,8 @@ static void RegisterStatusIcons() StatusIconData sid = { sizeof(sid) }; sid.szModule = SRMMMOD; sid.dwId = 1; - sid.hIcon = CopyIcon(GetCachedIcon("scriver_TYPING")); - sid.hIconDisabled = CopyIcon(GetCachedIcon("scriver_TYPINGOFF")); + sid.hIcon = GetCachedIcon("scriver_TYPING"); + sid.hIconDisabled = GetCachedIcon("scriver_TYPINGOFF"); sid.flags = MBF_HIDDEN; Srmm_AddIcon(&sid); } @@ -400,8 +400,8 @@ void ChangeStatusIcons() StatusIconData sid = { sizeof(sid) }; sid.szModule = SRMMMOD; sid.dwId = 1; - sid.hIcon = CopyIcon(GetCachedIcon("scriver_TYPING")); - sid.hIconDisabled = CopyIcon(GetCachedIcon("scriver_TYPINGOFF")); + sid.hIcon = GetCachedIcon("scriver_TYPING"); + sid.hIconDisabled = GetCachedIcon("scriver_TYPINGOFF"); sid.flags = MBF_HIDDEN; Srmm_ModifyIcon(NULL, &sid); } -- cgit v1.2.3