diff options
author | George Hazan <ghazan@miranda.im> | 2020-06-04 17:03:28 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2020-06-04 17:03:28 +0300 |
commit | f531ff887729783a7fe7a3e12ad12f658eefc7b0 (patch) | |
tree | 9e1844429448b6527ef7ca87163e44eafce250d8 /src/mir_core | |
parent | 1c2e5d128a7176ae827dda1e2a8fcc64e772a148 (diff) |
UI classes:
- CDlgBase::m_bSucceeded variable introduced to check whether IDOK was pressed or not;
- unused/useless buttons with id=IDOK or IDCANCEL removed;
- brnOk.OnClick replaced with OnApply calls;
- unused/useless calls of EndDialog/EndModal removed;
- minor code cleaning
Diffstat (limited to 'src/mir_core')
-rw-r--r-- | src/mir_core/src/CDlgBase.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/mir_core/src/CDlgBase.cpp b/src/mir_core/src/CDlgBase.cpp index 4ac2d5751d..f89f68139c 100644 --- a/src/mir_core/src/CDlgBase.cpp +++ b/src/mir_core/src/CDlgBase.cpp @@ -56,7 +56,7 @@ CDlgBase::CDlgBase(CMPluginBase &pPlug, int idDialog) CDlgBase::~CDlgBase() { - m_initialized = false; // prevent double call of destructor + m_bInitialized = false; // prevent double call of destructor if (m_hwnd) DestroyWindow(m_hwnd); } @@ -117,7 +117,7 @@ void CDlgBase::EndModal(INT_PTR nResult) void CDlgBase::NotifyChange(void) { - if (!m_initialized) + if (!m_bInitialized) return; OnChange(); @@ -202,7 +202,7 @@ INT_PTR CDlgBase::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_INITDIALOG: - m_initialized = false; + m_bInitialized = false; TranslateDialog_LP(m_hwnd, &m_pPlugin); ::EnumChildWindows(m_hwnd, &GlobalFieldEnum, LPARAM(this)); @@ -211,7 +211,7 @@ INT_PTR CDlgBase::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) if (!OnInitDialog()) return FALSE; - m_initialized = true; + m_bInitialized = true; return TRUE; case WM_CTLCOLOREDIT: @@ -285,10 +285,11 @@ INT_PTR CDlgBase::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) m_bExiting = true; // everything ok? good, let's close it - if (OnApply()) + if (OnApply()) { + m_bSucceeded = true; PostMessage(m_hwnd, WM_CLOSE, 0, 0); - else - m_bExiting = false; + } + else m_bExiting = false; } } } @@ -328,7 +329,7 @@ INT_PTR CDlgBase::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) return FALSE; case PSM_CHANGED: - if (m_initialized) + if (m_bInitialized) OnChange(); break; @@ -351,7 +352,7 @@ INT_PTR CDlgBase::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) if (OnClose()) { m_bExiting = true; if (m_isModal) - EndModal(0); + EndModal(m_bSucceeded ? IDOK : IDCANCEL); else DestroyWindow(m_hwnd); } @@ -368,7 +369,7 @@ INT_PTR CDlgBase::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) arDialogs.remove(idx); } m_hwnd = nullptr; - if (m_initialized) { + if (m_bInitialized) { if (m_isModal) m_isModal = false; else // modeless dialogs MUST be allocated with 'new' |