diff options
author | George Hazan <ghazan@miranda.im> | 2018-03-06 16:17:32 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-03-06 16:17:32 +0300 |
commit | 7071e88fdeeaa146c8e72894c6eae58f438f2690 (patch) | |
tree | 5befaa1f5dc66da5b1b907eb9894880b28f8b2ac /src/mir_app | |
parent | 909c090503ce1021a69e7793c550b857ef025e77 (diff) |
PSN_WIZFINISH: new WM_NOTIFY event to be called when one of the options tabs is changed
Diffstat (limited to 'src/mir_app')
-rw-r--r-- | src/mir_app/src/options.cpp | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/src/mir_app/src/options.cpp b/src/mir_app/src/options.cpp index 62a549b9bc..a9fe26c40a 100644 --- a/src/mir_app/src/options.cpp +++ b/src/mir_app/src/options.cpp @@ -289,6 +289,16 @@ struct OptionsPageData : public MZeroedObject }
};
+static int CompareOPD(const OptionsPageData *p1, const OptionsPageData *p2)
+{
+ int res = mir_wstrcmp(p1->ptszGroup, p2->ptszGroup);
+ if (!res)
+ res = mir_wstrcmp(p1->ptszTitle, p2->ptszTitle);
+ if (!res)
+ res = mir_wstrcmp(p1->ptszTab, p2->ptszTab);
+ return res;
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
// Options dialog
@@ -812,13 +822,12 @@ public: virtual void OnApply() override
{
- PSHNOTIFY pshn;
m_btnApply.Disable();
SetFocus(m_pageTree.GetHwnd());
OptionsPageData *opd = getCurrent();
if (opd != nullptr) {
- pshn.hdr.idFrom = 0;
+ PSHNOTIFY pshn = {};
pshn.lParam = IDC_APPLY;
pshn.hdr.code = PSN_KILLACTIVE;
pshn.hdr.hwndFrom = opd->getHwnd();
@@ -826,10 +835,16 @@ public: return;
}
+ LIST<OptionsPageData> arChanged(10, CompareOPD);
+
+ PSHNOTIFY pshn = {};
pshn.hdr.code = PSN_APPLY;
for (int i = 0; i < m_arOpd.getCount(); i++) {
OptionsPageData *p = m_arOpd[i];
- if (p->getHwnd() == nullptr || !p->changed) continue;
+ if (p->getHwnd() == nullptr || !p->changed)
+ continue;
+
+ arChanged.insert(p);
p->changed = 0;
pshn.hdr.hwndFrom = p->getHwnd();
if (SendMessage(p->getHwnd(), WM_NOTIFY, 0, (LPARAM)&pshn) == PSNRET_INVALID_NOCHANGEPAGE) {
@@ -843,6 +858,20 @@ public: return;
}
}
+
+ pshn.hdr.code = PSN_WIZFINISH;
+ for (int i = 0; i < arChanged.getCount(); i++) {
+ OptionsPageData *p = arChanged[i];
+ if (p->ptszTab == nullptr)
+ continue;
+
+ // calculate last changed tab
+ OptionsPageData *p2 = arChanged[i+1];
+ if (p2 != nullptr && !mir_wstrcmp(p->ptszTitle, p2->ptszTitle) && !mir_wstrcmp(p->ptszGroup, p2->ptszGroup))
+ continue;
+
+ SendMessage(p->pDialog->GetHwnd(), WM_NOTIFY, 0, (LPARAM)&pshn);
+ }
}
void btnApply_Click(CCtrlButton*)
|