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/MirOTR/MirOTR/src/svcs_srmm.cpp | 1 - plugins/Scriver/src/globals.cpp | 33 +++++-------------------------- plugins/Scriver/src/globals.h | 1 - plugins/Scriver/src/msgs.cpp | 8 ++++---- plugins/SpellChecker/src/spellchecker.cpp | 6 +----- protocols/JabberG/src/jabber_proto.cpp | 4 +--- 6 files changed, 11 insertions(+), 42 deletions(-) diff --git a/plugins/MirOTR/MirOTR/src/svcs_srmm.cpp b/plugins/MirOTR/MirOTR/src/svcs_srmm.cpp index f203f7d246..7f7987b7b4 100644 --- a/plugins/MirOTR/MirOTR/src/svcs_srmm.cpp +++ b/plugins/MirOTR/MirOTR/src/svcs_srmm.cpp @@ -118,7 +118,6 @@ void InitSRMM() StatusIconData sid = { sizeof(sid) }; sid.szModule = MODULENAME; - sid.dwId = 0; sid.hIcon = hIconFinished; sid.hIconDisabled = hIconNotSecure; sid.flags = MBF_DISABLED | MBF_HIDDEN; 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); } diff --git a/plugins/SpellChecker/src/spellchecker.cpp b/plugins/SpellChecker/src/spellchecker.cpp index 31f5e40057..f3358554aa 100644 --- a/plugins/SpellChecker/src/spellchecker.cpp +++ b/plugins/SpellChecker/src/spellchecker.cpp @@ -212,11 +212,7 @@ static int ModulesLoaded(WPARAM wParam, LPARAM lParam) mir_sntprintf(tmp, SIZEOF(tmp), _T("%s - %s"), TranslateT("Spell Checker"), languages[i]->full_name); sid.tszTooltip = tmp; - - HICON hIcon = (opts.use_flags) ? Skin_GetIconByHandle(languages[i]->hIcolib) : Skin_GetIcon("spellchecker_enabled"); - sid.hIcon = CopyIcon(hIcon); - Skin_ReleaseIcon(hIcon); - + sid.hIcon = (opts.use_flags) ? Skin_GetIconByHandle(languages[i]->hIcolib) : Skin_GetIcon("spellchecker_enabled"); Srmm_AddIcon(&sid); } diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index 3eb45ebe43..c47cf3eb90 100644 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -233,14 +233,12 @@ int CJabberProto::OnModulesLoadedEx(WPARAM, LPARAM) HookProtoEvent(ME_GC_EVENT, &CJabberProto::JabberGcEventHook); HookProtoEvent(ME_GC_BUILDMENU, &CJabberProto::JabberGcMenuHook); - HICON hIcon = LoadIconEx("main"); StatusIconData sid = { sizeof(sid) }; sid.szModule = m_szModuleName; - sid.hIcon = CopyIcon(hIcon); + sid.hIcon = LoadIconEx("main"); sid.flags = MBF_HIDDEN; sid.szTooltip = LPGEN("Jabber Resource"); Srmm_AddIcon(&sid); - Skin_ReleaseIcon(hIcon); HookProtoEvent(ME_MSG_ICONPRESSED, &CJabberProto::OnProcessSrmmIconClick); HookProtoEvent(ME_MSG_WINDOWEVENT, &CJabberProto::OnProcessSrmmEvent); -- cgit v1.2.3