From b6669f0ee3361891e9807e5c734bf9121e9cfb06 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 26 Sep 2023 12:20:03 +0300 Subject: SRMM options update unification --- plugins/TabSRMM/src/chat_options.cpp | 2 +- plugins/TabSRMM/src/generic_msghandlers.cpp | 17 ++++++++--------- plugins/TabSRMM/src/msgdialog.cpp | 10 +++------- plugins/TabSRMM/src/msgoptions.cpp | 8 ++++---- plugins/TabSRMM/src/msgs.cpp | 2 +- plugins/TabSRMM/src/msgs.h | 2 +- plugins/TabSRMM/src/userprefs.cpp | 2 +- 7 files changed, 19 insertions(+), 24 deletions(-) (limited to 'plugins/TabSRMM/src') diff --git a/plugins/TabSRMM/src/chat_options.cpp b/plugins/TabSRMM/src/chat_options.cpp index 0294bb5c45..250346da03 100644 --- a/plugins/TabSRMM/src/chat_options.cpp +++ b/plugins/TabSRMM/src/chat_options.cpp @@ -402,7 +402,7 @@ int FontServiceFontsChanged(WPARAM, LPARAM) FreeTabConfig(); ReloadTabConfig(); Skin->setupAeroSkins(); - Srmm_Broadcast(DM_OPTIONSAPPLIED, 1, 0); + Srmm_ApplyOptions(); return 0; } diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index 7d1e8ceb35..7fbd56f602 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -842,7 +842,7 @@ void CMsgDialog::DM_NotifyTyping(int mode) } } -void CMsgDialog::DM_OptionsApplied(bool bRemakeLog) +void CMsgDialog::OnOptionsApplied() { m_szMicroLf[0] = 0; if (!m_pContainer->m_theme.isPrivate) { @@ -868,14 +868,13 @@ void CMsgDialog::DM_OptionsApplied(bool bRemakeLog) if (m_hwnd == m_pContainer->m_hwndActive) SendMessage(m_pContainer->m_hwnd, WM_SIZE, 0, 0); InvalidateRect(m_message.GetHwnd(), nullptr, FALSE); - if (bRemakeLog) { - if (IsIconic(m_pContainer->m_hwnd)) - m_bDeferredRemakeLog = true; - else if (isChat()) - RedrawLog(); - else - RemakeLog(); - } + + if (IsIconic(m_pContainer->m_hwnd)) + m_bDeferredRemakeLog = true; + else if (isChat()) + RedrawLog(); + else + RemakeLog(); ShowWindow(m_hwndPanelPicParent, SW_SHOW); EnableWindow(m_hwndPanelPicParent, TRUE); diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 8f6d86edb5..09aee40cb7 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -580,7 +580,7 @@ bool CMsgDialog::OnInitDialog() else { GetFirstEvent(); - DM_OptionsApplied(); + OnOptionsApplied(); DB::ECPTR pCursor(DB::EventsRev(m_hContact)); while (MEVENT hdbEvent = pCursor.FetchNext()) { @@ -1434,7 +1434,7 @@ int CMsgDialog::OnFilter(MSGFILTER *pFilter) db_unset(m_hContact, SRMSGMOD_T, "mwmask"); db_unset(m_hContact, SRMSGMOD_T, "mwflags"); } - DM_OptionsApplied(); + OnOptionsApplied(); RemakeLog(); } return _dlgReturn(m_hwnd, 1); @@ -2188,7 +2188,7 @@ INT_PTR CMsgDialog::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) if (isChat()) RedrawLog(); else - DM_OptionsApplied(); + OnOptionsApplied(); break; case WM_NOTIFY: @@ -2331,10 +2331,6 @@ INT_PTR CMsgDialog::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) UpdateWindowIcon(); return 0; - case DM_OPTIONSAPPLIED: - DM_OptionsApplied(lParam == 0); - return 0; - case DM_UPDATESTATUSMSG: m_pPanel.Invalidate(); return 0; diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp index ab56521362..2d22090b74 100644 --- a/plugins/TabSRMM/src/msgoptions.cpp +++ b/plugins/TabSRMM/src/msgoptions.cpp @@ -289,7 +289,7 @@ public: CacheMsgLogIcons(); PluginConfig.reloadSettings(); CSkin::setAeroEffect(-1); - Srmm_Broadcast(DM_OPTIONSAPPLIED, 1, 0); + Srmm_ApplyOptions(); Srmm_Broadcast(DM_FORCEDREMAKELOG, 0, 0); SendMessage(GetParent(m_hwnd), WM_COMMAND, IDCANCEL, 0); } @@ -423,7 +423,7 @@ public: db_set_b(0, SRMSGMOD_T, "dontscaleavatars", chkAvaPreserve.GetState()); PluginConfig.reloadSettings(); - Srmm_Broadcast(DM_OPTIONSAPPLIED, 1, 0); + Srmm_ApplyOptions(); return true; } @@ -852,7 +852,7 @@ public: else db_set_dw(0, SRMSGMOD_T, "maxhist", 0); PluginConfig.reloadSettings(); - Srmm_Broadcast(DM_OPTIONSAPPLIED, 1, 0); + Srmm_ApplyOptions(); return true; } @@ -1093,7 +1093,7 @@ public: db_set_b(0, SRMSGMOD_T, "escmode", cmbEscMode.GetCurSel()); PluginConfig.reloadSettings(); - Srmm_Broadcast(DM_OPTIONSAPPLIED, 0, 0); + Srmm_ApplyOptions(); return true; } diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp index 7343237d28..db04ba7685 100644 --- a/plugins/TabSRMM/src/msgs.cpp +++ b/plugins/TabSRMM/src/msgs.cpp @@ -623,7 +623,7 @@ int IconsChanged(WPARAM, LPARAM) { CreateImageList(false); CacheMsgLogIcons(); - Srmm_Broadcast(DM_OPTIONSAPPLIED, 0, 0); + Srmm_ApplyOptions(); Srmm_Broadcast(DM_UPDATEWINICON, 0, 0); return 0; } diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index 4aef4ccf63..5817cfcb88 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -597,6 +597,7 @@ public: bool GetFirstEvent() override; bool IsActive() const override; void LoadSettings() override; + void OnOptionsApplied() override; void RemakeLog() override; void SetStatusText(const wchar_t *, HICON) override; void ShowFilterMenu() override; @@ -630,7 +631,6 @@ public: void LogEvent(DB::EventInfo &dbei); - void DM_OptionsApplied(bool bRemakeLog = true); void DM_RecalcPictureSize(void); void DM_ScrollToBottom(WPARAM wParam, LPARAM lParam); diff --git a/plugins/TabSRMM/src/userprefs.cpp b/plugins/TabSRMM/src/userprefs.cpp index 944474d85a..70ff19332e 100644 --- a/plugins/TabSRMM/src/userprefs.cpp +++ b/plugins/TabSRMM/src/userprefs.cpp @@ -342,7 +342,7 @@ public: fShouldHide = false; else ShowWindow(dat->m_pContainer->m_hwnd, SW_HIDE); - dat->DM_OptionsApplied(); + dat->OnOptionsApplied(); dat->RemakeLog(); if (fShouldHide) ShowWindow(dat->m_pContainer->m_hwnd, SW_SHOWNORMAL); -- cgit v1.2.3