summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-12-06 19:22:19 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-12-06 19:22:19 +0300
commit5a16d189158c71db28c481a44706c73c83fd6e76 (patch)
tree4771bbef05a0980c1cb5378c942752b2e82c6ded
parent31c93335992e5527e23523e84687c2fb52340d91 (diff)
KillModuleOptions - more handly helper than an event hook
-rw-r--r--include/m_options.h2
-rw-r--r--libs/win32/mir_app.libbin130476 -> 130706 bytes
-rw-r--r--libs/win64/mir_app.libbin126064 -> 126274 bytes
-rw-r--r--src/mir_app/src/mir_app.def1
-rw-r--r--src/mir_app/src/mir_app64.def1
-rw-r--r--src/mir_app/src/newplugins.cpp1
-rw-r--r--src/mir_app/src/options.cpp59
7 files changed, 35 insertions, 29 deletions
diff --git a/include/m_options.h b/include/m_options.h
index e89de0af08..bd1b3faea2 100644
--- a/include/m_options.h
+++ b/include/m_options.h
@@ -84,6 +84,8 @@ struct OPTIONSDIALOGPAGE
EXTERN_C MIR_APP_DLL(int) Options_AddPage(WPARAM wParam, OPTIONSDIALOGPAGE *odp, int = hLangpack);
+EXTERN_C MIR_APP_DLL(void) KillModuleOptions(int _hLang);
+
// The behaviour if the options dialog is already open is that it will just be
// activated, the page won't be changed. This may change in the future.
diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib
index aec20bcdc9..98c7ad2967 100644
--- a/libs/win32/mir_app.lib
+++ b/libs/win32/mir_app.lib
Binary files differ
diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib
index 82df5e5b91..a24d42c3c8 100644
--- a/libs/win64/mir_app.lib
+++ b/libs/win64/mir_app.lib
Binary files differ
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def
index 089e2f3ae4..055c4aa466 100644
--- a/src/mir_app/src/mir_app.def
+++ b/src/mir_app/src/mir_app.def
@@ -487,3 +487,4 @@ Clist_SetStatusMode @464
?MetaDetouchSub@MDatabaseCommon@@UAGHPAUDBCachedContact@@H@Z @492 NONAME
?MetaSetDefault@MDatabaseCommon@@UAGHPAUDBCachedContact@@@Z @493 NONAME
?EnumResidentSettings@MDatabaseCommon@@UAGHP6AHPBDPAX@Z1@Z @494 NONAME
+KillModuleOptions @495
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def
index 6970a920e7..fa96e4fb75 100644
--- a/src/mir_app/src/mir_app64.def
+++ b/src/mir_app/src/mir_app64.def
@@ -487,3 +487,4 @@ Clist_SetStatusMode @464
?MetaDetouchSub@MDatabaseCommon@@UEAAHPEAUDBCachedContact@@H@Z @492 NONAME
?MetaSetDefault@MDatabaseCommon@@UEAAHPEAUDBCachedContact@@@Z @493 NONAME
?EnumResidentSettings@MDatabaseCommon@@UEAAHP6AHPEBDPEAX@Z1@Z @494 NONAME
+KillModuleOptions @495
diff --git a/src/mir_app/src/newplugins.cpp b/src/mir_app/src/newplugins.cpp
index 82c4d9066b..a080c0eab0 100644
--- a/src/mir_app/src/newplugins.cpp
+++ b/src/mir_app/src/newplugins.cpp
@@ -377,6 +377,7 @@ int Plugin_UnloadDyn(pluginEntry *p)
KillModuleExtraIcons(_hLang);
KillModuleSrmmIcons(_hLang);
KillModuleToolbarIcons(_hLang);
+ KillModuleOptions(_hLang);
}
NotifyFastHook(hevUnloadModule, (WPARAM)p->bpi.pluginInfo, (LPARAM)p->bpi.hInst);
diff --git a/src/mir_app/src/options.cpp b/src/mir_app/src/options.cpp
index 565a45790a..15ae8796c8 100644
--- a/src/mir_app/src/options.cpp
+++ b/src/mir_app/src/options.cpp
@@ -31,7 +31,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define FILTER_TIMEOUT_TIMER 10012
#define HM_MODULELOAD (WM_USER+12)
-#define HM_MODULEUNLOAD (WM_USER+13)
#define ALL_MODULES_FILTER LPGENW("<all modules>")
#define CORE_MODULES_FILTER LPGENW("<core modules>")
@@ -366,7 +365,7 @@ class COptionsDlg : public CDlgBase
RECT m_rcTab;
HFONT m_hBoldFont;
wchar_t m_szFilterString[1024];
- HANDLE m_hPluginLoad, m_hPluginUnload;
+ HANDLE m_hPluginLoad;
const wchar_t *m_szCaption, *m_szGroup, *m_szPage, *m_szTab;
const OptionsPageList &m_pages;
@@ -685,27 +684,6 @@ class COptionsDlg : public CDlgBase
RebuildPageTree();
}
- void UnloadOptionsModule(HINSTANCE hInst)
- {
- bool bToRebuildTree = false;
-
- for (int i = m_arOpd.getCount() - 1; i >= 0; i--) {
- OptionsPageData *opd = m_arOpd[i];
- if (opd->getInst() != hInst)
- continue;
-
- if (m_currentPage > i)
- m_currentPage--;
-
- m_arOpd.remove(i);
- delete opd;
- bToRebuildTree = true;
- }
-
- if (bToRebuildTree)
- RebuildPageTree();
- }
-
OptionsPageData* getCurrent() const
{ return (m_currentPage == -1) ? nullptr : m_arOpd[m_currentPage];
}
@@ -759,7 +737,6 @@ public:
m_hBoldFont = CreateFontIndirect(&lf);
m_hPluginLoad = HookEventMessage(ME_SYSTEM_MODULELOAD, m_hwnd, HM_MODULELOAD);
- m_hPluginUnload = HookEventMessage(ME_SYSTEM_MODULEUNLOAD, m_hwnd, HM_MODULEUNLOAD);
m_currentPage = -1;
ptrW lastPage, lastGroup, lastTab;
@@ -818,7 +795,6 @@ public:
m_szFilterString[0] = 0;
UnhookEvent(m_hPluginLoad);
- UnhookEvent(m_hPluginUnload);
SaveOptionsTreeState();
Window_FreeIcon_IcoLib(m_hwnd);
@@ -1046,10 +1022,6 @@ public:
LoadOptionsModule((HINSTANCE)lParam);
break;
- case HM_MODULEUNLOAD:
- UnloadOptionsModule((HINSTANCE)lParam);
- break;
-
case PSM_CHANGED:
m_btnApply.Enable();
{
@@ -1111,6 +1083,27 @@ public:
m_pageTree.SelectItem(hItem);
}
}
+
+ void KillModule(int _hLang)
+ {
+ bool bToRebuildTree = false;
+
+ for (int i = m_arOpd.getCount() - 1; i >= 0; i--) {
+ OptionsPageData *opd = m_arOpd[i];
+ if (opd->hLangpack != _hLang)
+ continue;
+
+ if (m_currentPage > i)
+ m_currentPage--;
+
+ m_arOpd.remove(i);
+ delete opd;
+ bToRebuildTree = true;
+ }
+
+ if (bToRebuildTree)
+ RebuildPageTree();
+ }
};
void OpenAccountOptions(PROTOACCOUNT *pa)
@@ -1203,6 +1196,14 @@ MIR_APP_DLL(int) Options_AddPage(WPARAM wParam, OPTIONSDIALOGPAGE *odp, int _hLa
/////////////////////////////////////////////////////////////////////////////////////////
+MIR_APP_DLL(void) KillModuleOptions(int _hLang)
+{
+ if (pOptionsDlg != nullptr)
+ pOptionsDlg->KillModule(_hLang);
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
static INT_PTR OpenOptionsDialog(WPARAM, LPARAM)
{
OpenOptionsNow(0, nullptr, nullptr, nullptr, false);