summaryrefslogtreecommitdiff
path: root/plugins/Scriver
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-04-04 17:12:36 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-04-04 17:12:36 +0300
commitf5a06e8c7677cb29b100314d17b5931f85c3d33f (patch)
tree8ee401be5558d7f6e5148fed2adb8a79dcb9592a /plugins/Scriver
parentcb9750e8ef71c32441c34c169101c4329a9ac8b5 (diff)
- GC_FONTSIZE considered useless;
- archaic linked list of modules replaced with the standard LIST<> which is much faster - fix for the module destruction
Diffstat (limited to 'plugins/Scriver')
-rw-r--r--plugins/Scriver/src/chat_main.cpp51
1 files changed, 24 insertions, 27 deletions
diff --git a/plugins/Scriver/src/chat_main.cpp b/plugins/Scriver/src/chat_main.cpp
index 2c845d7a0a..9840936d74 100644
--- a/plugins/Scriver/src/chat_main.cpp
+++ b/plugins/Scriver/src/chat_main.cpp
@@ -29,32 +29,6 @@ pfnDoPopup oldDoPopup;
GlobalLogSettings g_Settings;
-void LoadModuleIcons(MODULEINFO *mi)
-{
- HIMAGELIST hList = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 0, 0);
-
- int overlayIcon = ImageList_AddIcon(hList, GetCachedIcon("chat_overlay"));
- ImageList_SetOverlayImage(hList, overlayIcon, 1);
-
- int index = ImageList_AddIcon(hList, Skin_LoadProtoIcon(mi->pszModule, ID_STATUS_ONLINE));
-
- if (mi->hOnlineIcon) DestroyIcon(mi->hOnlineIcon);
- mi->hOnlineIcon = ImageList_GetIcon(hList, index, ILD_TRANSPARENT);
-
- if (mi->hOnlineTalkIcon) DestroyIcon(mi->hOnlineTalkIcon);
- mi->hOnlineTalkIcon = ImageList_GetIcon(hList, index, ILD_TRANSPARENT | INDEXTOOVERLAYMASK(1));
-
- index = ImageList_AddIcon(hList, Skin_LoadProtoIcon(mi->pszModule, ID_STATUS_OFFLINE));
-
- if (mi->hOfflineIcon) DestroyIcon(mi->hOfflineIcon);
- mi->hOfflineIcon = ImageList_GetIcon(hList, index, ILD_TRANSPARENT);
-
- if (mi->hOfflineTalkIcon) DestroyIcon(mi->hOfflineTalkIcon);
- mi->hOfflineTalkIcon = ImageList_GetIcon(hList, index, ILD_TRANSPARENT | INDEXTOOVERLAYMASK(1));
-
- ImageList_Destroy(hList);
-}
-
static void OnReplaceSession(SESSION_INFO *si)
{
if (si->pDlg)
@@ -100,9 +74,31 @@ static void OnFlashWindow(SESSION_INFO *si, int bInactive)
SendMessage(hwndParent, CM_STARTFLASHING, 0, 0);
}
+static void OnDestroyModule(MODULEINFO *mi)
+{
+ if (mi->hOnlineIcon) DestroyIcon(mi->hOnlineIcon);
+ if (mi->hOnlineTalkIcon) DestroyIcon(mi->hOnlineTalkIcon);
+ if (mi->hOfflineIcon) DestroyIcon(mi->hOfflineIcon);
+ if (mi->hOfflineTalkIcon) DestroyIcon(mi->hOfflineTalkIcon);
+}
+
static void OnCreateModule(MODULEINFO *mi)
{
- LoadModuleIcons(mi);
+ HIMAGELIST hList = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 0, 0);
+
+ int overlayIcon = ImageList_AddIcon(hList, GetCachedIcon("chat_overlay"));
+ ImageList_SetOverlayImage(hList, overlayIcon, 1);
+
+ int index = ImageList_AddIcon(hList, Skin_LoadProtoIcon(mi->pszModule, ID_STATUS_ONLINE));
+ mi->hOnlineIcon = ImageList_GetIcon(hList, index, ILD_TRANSPARENT);
+ mi->hOnlineTalkIcon = ImageList_GetIcon(hList, index, ILD_TRANSPARENT | INDEXTOOVERLAYMASK(1));
+
+ index = ImageList_AddIcon(hList, Skin_LoadProtoIcon(mi->pszModule, ID_STATUS_OFFLINE));
+ mi->hOfflineIcon = ImageList_GetIcon(hList, index, ILD_TRANSPARENT);
+ mi->hOfflineTalkIcon = ImageList_GetIcon(hList, index, ILD_TRANSPARENT | INDEXTOOVERLAYMASK(1));
+
+ ImageList_Destroy(hList);
+
mi->hOnlineIconBig = Skin_LoadProtoIcon(mi->pszModule, ID_STATUS_ONLINE, true);
mi->hOfflineIconBig = Skin_LoadProtoIcon(mi->pszModule, ID_STATUS_OFFLINE, true);
}
@@ -137,6 +133,7 @@ int Chat_Load()
pci = Chat_GetInterface(&data);
pci->OnCreateModule = OnCreateModule;
+ pci->OnDestroyModule = OnDestroyModule;
pci->OnLoadSettings = OnLoadSettings;
pci->OnSetStatus = OnSetStatus;