summaryrefslogtreecommitdiff
path: root/src/mir_app
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-03-26 21:52:00 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-03-26 21:52:00 +0300
commitd84b7beba3fd5148033b57b75c8299a2672377be (patch)
tree50b1a3ac0052aa58b7e7fd1250cf4152723d164a /src/mir_app
parent6ae4da7c29bf777cf96b651af1a9a429d20c7b9e (diff)
ME_SKIN2_ICONSCHANGED is totally obsoleted, thus removed
Diffstat (limited to 'src/mir_app')
-rw-r--r--src/mir_app/src/IcoLib.h5
-rw-r--r--src/mir_app/src/chat_svc.cpp4
-rw-r--r--src/mir_app/src/icolib.cpp21
-rw-r--r--src/mir_app/src/menu_utils.cpp2
-rw-r--r--src/mir_app/src/skin2opts.cpp4
5 files changed, 27 insertions, 9 deletions
diff --git a/src/mir_app/src/IcoLib.h b/src/mir_app/src/IcoLib.h
index 202e99fb96..7b4ea76779 100644
--- a/src/mir_app/src/IcoLib.h
+++ b/src/mir_app/src/IcoLib.h
@@ -111,6 +111,9 @@ IconSourceItem* GetIconSourceItem(const wchar_t* file, int indx, int cxIcon, int
IcolibItem* IcoLib_FindHIcon(HICON hIcon, bool &big);
IcolibItem* IcoLib_FindIcon(const char* pszIconName);
+void CreateImageLists();
+void DestroyImageLists();
+
int SkinOptionsInit(WPARAM, LPARAM);
extern mir_cs csIconList;
@@ -120,4 +123,4 @@ extern LIST<SectionItem> sectionList;
extern BOOL bNeedRebuild;
extern int iconEventActive;
extern HICON hIconBlank;
-extern HANDLE hIcons2ChangedEvent, hIconsChangedEvent;
+extern HANDLE hIconsChangedEvent;
diff --git a/src/mir_app/src/chat_svc.cpp b/src/mir_app/src/chat_svc.cpp
index 5b98f4fe44..9deb887ec7 100644
--- a/src/mir_app/src/chat_svc.cpp
+++ b/src/mir_app/src/chat_svc.cpp
@@ -764,6 +764,7 @@ int LoadChatModule(void)
HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown);
HookEvent(ME_SKIN_ICONSCHANGED, IconsChanged);
+ HookEvent(ME_FONT_RELOAD, FontsChanged);
g_hWindowList = WindowList_Create();
hHookEvent = CreateHookableEvent(ME_GC_HOOK_EVENT);
@@ -773,9 +774,6 @@ int LoadChatModule(void)
g_chatApi.hevPreCreate = CreateHookableEvent(ME_MSG_PRECREATEEVENT);
g_chatApi.hevWinPopup = CreateHookableEvent(ME_MSG_WINDOWPOPUP);
- HookEvent(ME_FONT_RELOAD, FontsChanged);
- HookEvent(ME_SKIN2_ICONSCHANGED, IconsChanged);
-
g_hMenu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_SRMM));
TranslateMenu(g_hMenu);
diff --git a/src/mir_app/src/icolib.cpp b/src/mir_app/src/icolib.cpp
index e40a83f971..bda29a14d8 100644
--- a/src/mir_app/src/icolib.cpp
+++ b/src/mir_app/src/icolib.cpp
@@ -28,7 +28,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static BOOL bModuleInitialized = FALSE;
static volatile LONG iStaticCount = 1;
-HANDLE hIcons2ChangedEvent, hIconsChangedEvent;
+static HIMAGELIST himlSmall, hImlBig;
+HANDLE hIconsChangedEvent;
HICON hIconBlank = nullptr;
@@ -64,6 +65,18 @@ LIST<IcolibItem> iconList(20, sttCompareIcons);
/////////////////////////////////////////////////////////////////////////////////////////
// Utility functions
+void CreateImageLists()
+{
+ himlSmall = ImageList_Create(g_iIconSX, g_iIconSY, ILC_COLOR32 | ILC_MASK, 50, 50);
+ hImlBig = ImageList_Create(g_iIconX, g_iIconY, ILC_COLOR32 | ILC_MASK, 50, 50);
+}
+
+void DestroyImageLists()
+{
+ ImageList_Destroy(himlSmall); himlSmall = 0;
+ ImageList_Destroy(hImlBig); hImlBig = 0;
+}
+
void __fastcall SafeDestroyIcon(HICON &hIcon)
{
if (hIcon != nullptr) {
@@ -781,9 +794,10 @@ int LoadIcoLibModule(void)
hIconBlank = LoadIconEx(g_plugin.getInst(), MAKEINTRESOURCE(IDI_BLANK), 0);
- hIcons2ChangedEvent = CreateHookableEvent(ME_SKIN2_ICONSCHANGED);
hIconsChangedEvent = CreateHookableEvent(ME_SKIN_ICONSCHANGED);
+ CreateImageLists();
+
HookEvent(ME_OPT_INITIALISE, SkinOptionsInit);
return 0;
}
@@ -794,7 +808,8 @@ void UnloadIcoLibModule(void)
return;
DestroyHookableEvent(hIconsChangedEvent);
- DestroyHookableEvent(hIcons2ChangedEvent);
+
+ DestroyImageLists();
for (auto &p : iconList)
delete p;
diff --git a/src/mir_app/src/menu_utils.cpp b/src/mir_app/src/menu_utils.cpp
index 799f417bdf..b2328884d0 100644
--- a/src/mir_app/src/menu_utils.cpp
+++ b/src/mir_app/src/menu_utils.cpp
@@ -1278,7 +1278,6 @@ static VOID CALLBACK PostRegisterIcons(HWND, UINT, UINT_PTR, DWORD)
static int OnModulesLoaded(WPARAM, LPARAM)
{
posttimerid = SetTimer(nullptr, 0, 5, (TIMERPROC)PostRegisterIcons);
- HookEvent(ME_SKIN2_ICONSCHANGED, OnIconLibChanges);
return 0;
}
@@ -1289,6 +1288,7 @@ int InitGenMenu()
HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
HookEvent(ME_OPT_INITIALISE, GenMenuOptInit);
+ HookEvent(ME_SKIN_ICONSCHANGED, OnIconLibChanges);
return 0;
}
diff --git a/src/mir_app/src/skin2opts.cpp b/src/mir_app/src/skin2opts.cpp
index ea8a54d6a8..24fe66819d 100644
--- a/src/mir_app/src/skin2opts.cpp
+++ b/src/mir_app/src/skin2opts.cpp
@@ -485,9 +485,11 @@ class CIcoLibOptsDlg : public CDlgBase
{
UpdateIconsPreview();
+ DestroyImageLists();
+ CreateImageLists();
+
iconEventActive = 1; // Disable icon destroying - performance boost
NotifyEventHooks(hIconsChangedEvent, 0, 0);
- NotifyEventHooks(hIcons2ChangedEvent, 0, 0);
iconEventActive = 0;
mir_cslock lck(csIconList); // Destroy unused icons