From b8ebaa0bdb6be17e014d7a382b86af8c028cf00d Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 26 Sep 2023 13:34:09 +0300 Subject: Group chat options are applied alongside the private window options update --- include/m_srmm_int.h | 2 +- libs/win32/mir_app.lib | Bin 271586 -> 271606 bytes libs/win64/mir_app.lib | Bin 270752 -> 270772 bytes plugins/Scriver/src/msgdialog.cpp | 5 +- plugins/Scriver/src/msgs.h | 1 - plugins/Scriver/src/msgutils.cpp | 84 +++++++++++++--------------- plugins/TabSRMM/src/generic_msghandlers.cpp | 16 ++++-- plugins/TabSRMM/src/msgdialog.cpp | 4 +- plugins/TabSRMM/src/msgdlgother.cpp | 15 ----- plugins/TabSRMM/src/msgs.h | 1 - src/core/stdmsg/src/chat_window.cpp | 24 -------- src/core/stdmsg/src/msgdialog.cpp | 25 ++++++++- src/core/stdmsg/src/msgs.h | 1 - src/mir_app/src/chat_svc.cpp | 2 +- src/mir_app/src/mir_app.def | 2 +- src/mir_app/src/mir_app64.def | 2 +- src/mir_app/src/srmm_base.cpp | 4 +- 17 files changed, 82 insertions(+), 106 deletions(-) diff --git a/include/m_srmm_int.h b/include/m_srmm_int.h index 29d99e69e0..94f6fbd6d3 100644 --- a/include/m_srmm_int.h +++ b/include/m_srmm_int.h @@ -330,6 +330,7 @@ public: void ScheduleRedrawLog(); void SetMessageText(const wchar_t *pwszText, bool bAppend = true); void ShowColorChooser(int iCtrlId); + void UpdateChatOptions(); void UpdateNickList(void); virtual void AddLog(const LOGINFO &lin); @@ -344,7 +345,6 @@ public: virtual void SetStatusText(const wchar_t *, HICON) {} virtual void ShowFilterMenu() {} virtual void UpdateFilterButton(); - virtual void UpdateOptions(); virtual void UpdateStatusBar() {} virtual void UpdateTitle() = 0; diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib index 1bb323dbac..f241c27403 100644 Binary files a/libs/win32/mir_app.lib and b/libs/win32/mir_app.lib differ diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib index 145ab13a7a..7a29e46a3e 100644 Binary files a/libs/win64/mir_app.lib and b/libs/win64/mir_app.lib differ diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index 4e1b373608..71ba4bb8a8 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -188,9 +188,9 @@ bool CMsgDialog::OnInitDialog() } CreateInfobar(); - + OnOptionsApplied(); + if (isChat()) { - UpdateOptions(); UpdateStatusBar(); UpdateTitle(); UpdateNickList(); @@ -217,7 +217,6 @@ bool CMsgDialog::OnInitDialog() } } - OnOptionsApplied(); PopupWindow(m_bIncoming); if (notifyUnread) { diff --git a/plugins/Scriver/src/msgs.h b/plugins/Scriver/src/msgs.h index f24d81b4d6..7c9fd6c3c5 100644 --- a/plugins/Scriver/src/msgs.h +++ b/plugins/Scriver/src/msgs.h @@ -138,7 +138,6 @@ public: void SetStatusText(const wchar_t *, HICON) override; void ShowFilterMenu() override; void UpdateFilterButton() override; - void UpdateOptions() override; void UpdateStatusBar() override; void UpdateTitle() override; diff --git a/plugins/Scriver/src/msgutils.cpp b/plugins/Scriver/src/msgutils.cpp index bdf74f2101..b51a30d967 100644 --- a/plugins/Scriver/src/msgutils.cpp +++ b/plugins/Scriver/src/msgutils.cpp @@ -296,14 +296,48 @@ void CMsgDialog::NotifyTyping(int mode) void CMsgDialog::OnOptionsApplied() { - if (isChat()) + GetAvatar(); + UpdateTitle(); + UpdateStatusBar(); + + if (isChat()) { + FixTabIcons(); + + // messagebox + COLORREF crFore; + LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, nullptr, &crFore); + + CHARFORMAT2 cf; + cf.cbSize = sizeof(CHARFORMAT2); + cf.dwMask = CFM_COLOR | CFM_BOLD | CFM_UNDERLINE | CFM_BACKCOLOR; + cf.dwEffects = 0; + cf.crTextColor = crFore; + cf.crBackColor = g_plugin.getDword(SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR); + m_message.SendMsg(EM_SETBKGNDCOLOR, 0, g_plugin.getDword(SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR)); + m_message.SendMsg(WM_SETFONT, (WPARAM)g_Settings.MessageBoxFont, MAKELPARAM(TRUE, 0)); + m_message.SendMsg(EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf); + + // nicklist + int ih = Chat_GetTextPixelSize(L"AQG_glo'", g_Settings.UserListFont, false); + int ih2 = Chat_GetTextPixelSize(L"AQG_glo'", g_Settings.UserListHeadingsFont, false); + int height = db_get_b(0, CHAT_MODULE, "NicklistRowDist", 12); + int font = ih > ih2 ? ih : ih2; + + // make sure we have space for icon! + if (Chat::bShowContactStatus) + font = font > 16 ? font : 16; + + m_nickList.SendMsg(LB_SETITEMHEIGHT, 0, height > font ? height : font); + InvalidateRect(m_nickList.GetHwnd(), nullptr, TRUE); + + m_message.SendMsg(EM_REQUESTRESIZE, 0, 0); + + UpdateChatOptions(); return; + } - GetAvatar(); SetDialogToType(); - m_pLog->UpdateOptions(); - COLORREF colour = g_plugin.getDword(SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR); m_message.SendMsg(EM_SETBKGNDCOLOR, 0, colour); InvalidateRect(m_message.GetHwnd(), nullptr, FALSE); @@ -326,9 +360,7 @@ void CMsgDialog::OnOptionsApplied() m_message.SendMsg(EM_SETLANGOPTIONS, 0, (LPARAM)m_message.SendMsg(EM_GETLANGOPTIONS, 0, 0) & ~IMF_AUTOKEYBOARD); SendMessage(m_hwnd, DM_REMAKELOG, 0, 0); - UpdateTitle(); UpdateTabControl(); - UpdateStatusBar(); m_message.SendMsg(EM_REQUESTRESIZE, 0, 0); SetupInfobar(); } @@ -616,46 +648,6 @@ void CMsgDialog::UpdateFilterButton() m_btnNickList.SendMsg(BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_plugin.getIcon(m_bNicklistEnabled ? IDI_NICKLIST2 : IDI_NICKLIST)); } -void CMsgDialog::UpdateOptions() -{ - GetAvatar(); - - UpdateStatusBar(); - UpdateTitle(); - FixTabIcons(); - - // messagebox - COLORREF crFore; - LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, nullptr, &crFore); - - CHARFORMAT2 cf; - cf.cbSize = sizeof(CHARFORMAT2); - cf.dwMask = CFM_COLOR | CFM_BOLD | CFM_UNDERLINE | CFM_BACKCOLOR; - cf.dwEffects = 0; - cf.crTextColor = crFore; - cf.crBackColor = g_plugin.getDword(SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR); - m_message.SendMsg(EM_SETBKGNDCOLOR, 0, g_plugin.getDword(SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR)); - m_message.SendMsg(WM_SETFONT, (WPARAM)g_Settings.MessageBoxFont, MAKELPARAM(TRUE, 0)); - m_message.SendMsg(EM_SETCHARFORMAT, SCF_ALL, (LPARAM)& cf); - - // nicklist - int ih = Chat_GetTextPixelSize(L"AQG_glo'", g_Settings.UserListFont, false); - int ih2 = Chat_GetTextPixelSize(L"AQG_glo'", g_Settings.UserListHeadingsFont, false); - int height = db_get_b(0, CHAT_MODULE, "NicklistRowDist", 12); - int font = ih > ih2 ? ih : ih2; - - // make sure we have space for icon! - if (Chat::bShowContactStatus) - font = font > 16 ? font : 16; - - m_nickList.SendMsg(LB_SETITEMHEIGHT, 0, height > font ? height : font); - InvalidateRect(m_nickList.GetHwnd(), nullptr, TRUE); - - m_message.SendMsg(EM_REQUESTRESIZE, 0, 0); - - CSuper::UpdateOptions(); -} - void CMsgDialog::UpdateStatusBar() { if (m_pParent->m_hwndActive != m_hwnd) diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index 7fbd56f602..618661c0ef 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -494,8 +494,6 @@ void CMsgDialog::DM_InitRichEdit() szStreamOut = m_message.GetRichTextRtf(); SetWindowText(m_message.GetHwnd(), L""); - m_pLog->UpdateOptions(); - m_message.SendMsg(EM_SETBKGNDCOLOR, 0, m_pContainer->m_theme.inputbg); CHARFORMAT2 cf2 = {}; @@ -850,6 +848,18 @@ void CMsgDialog::OnOptionsApplied() m_dwFlags = m_pContainer->m_theme.dwFlags; } + DM_InitRichEdit(); + GetSendFormat(); + + if (isChat()) { + m_btnOk.SendMsg(BUTTONSETASNORMAL, TRUE, 0); + + m_nickList.SetItemHeight(0, g_Settings.iNickListFontHeight); + InvalidateRect(m_nickList.GetHwnd(), nullptr, TRUE); + + UpdateChatOptions(); + } + LoadLocalFlags(); m_hTimeZone = TimeZone_CreateByContact(m_hContact, nullptr, TZF_KNOWNONLY); @@ -860,11 +870,9 @@ void CMsgDialog::OnOptionsApplied() // small inner margins (padding) for the text areas m_message.SendMsg(EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(3, 3)); - GetSendFormat(); SetDialogToType(); SendMessage(m_hwnd, DM_CONFIGURETOOLBAR, 0, 0); - DM_InitRichEdit(); if (m_hwnd == m_pContainer->m_hwndActive) SendMessage(m_pContainer->m_hwnd, WM_SIZE, 0, 0); InvalidateRect(m_message.GetHwnd(), nullptr, FALSE); diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 09aee40cb7..13fa713f86 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -563,10 +563,10 @@ bool CMsgDialog::OnInitDialog() LoadContactAvatar(); LoadOwnAvatar(); + OnOptionsApplied(); if (isChat()) { m_pLog->Clear(); - UpdateOptions(); UpdateStatusBar(); UpdateTitle(); m_hTabIcon = m_hTabStatusIcon; @@ -580,8 +580,6 @@ bool CMsgDialog::OnInitDialog() else { GetFirstEvent(); - OnOptionsApplied(); - DB::ECPTR pCursor(DB::EventsRev(m_hContact)); while (MEVENT hdbEvent = pCursor.FetchNext()) { DBEVENTINFO dbei = {}; diff --git a/plugins/TabSRMM/src/msgdlgother.cpp b/plugins/TabSRMM/src/msgdlgother.cpp index f8d98cd9a1..445cf5e874 100644 --- a/plugins/TabSRMM/src/msgdlgother.cpp +++ b/plugins/TabSRMM/src/msgdlgother.cpp @@ -2577,21 +2577,6 @@ void CMsgDialog::UpdateFilterButton() m_btnFilter.SendMsg(BUTTONSETOVERLAYICON, (LPARAM)(m_bFilterEnabled ? PluginConfig.g_iconOverlayDisabled : 0), 0); } -///////////////////////////////////////////////////////////////////////////////////////// - -void CMsgDialog::UpdateOptions() -{ - GetSendFormat(); - - DM_InitRichEdit(); - m_btnOk.SendMsg(BUTTONSETASNORMAL, TRUE, 0); - - m_nickList.SetItemHeight(0, g_Settings.iNickListFontHeight); - InvalidateRect(m_nickList.GetHwnd(), nullptr, TRUE); - - CSuper::UpdateOptions(); -} - ///////////////////////////////////////////////////////////////////////////////////////// // update the status bar field which displays the number of characters in the input area // and various indicators (caps lock, num lock, insert mode). diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index 5817cfcb88..29b34e0d32 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -602,7 +602,6 @@ public: void SetStatusText(const wchar_t *, HICON) override; void ShowFilterMenu() override; void UpdateFilterButton() override; - void UpdateOptions() override; void UpdateStatusBar() override; void UpdateTitle() override; diff --git a/src/core/stdmsg/src/chat_window.cpp b/src/core/stdmsg/src/chat_window.cpp index 08762670c6..39ab7e2873 100644 --- a/src/core/stdmsg/src/chat_window.cpp +++ b/src/core/stdmsg/src/chat_window.cpp @@ -50,30 +50,6 @@ void CMsgDialog::UpdateFilterButton() m_btnNickList.SendMsg(BM_SETIMAGE, IMAGE_ICON, (LPARAM)g_plugin.getIcon(m_bNicklistEnabled ? IDI_NICKLIST : IDI_NICKLIST2, FALSE)); } -void CMsgDialog::UpdateOptions() -{ - HICON hIcon = ImageList_GetIcon(Clist_GetImageList(), GetImageId(), ILD_TRANSPARENT); - SendMessage(m_pOwner->m_hwndStatus, SB_SETICON, 0, (LPARAM)hIcon); - DestroyIcon(hIcon); - - Window_SetIcon_IcoLib(m_pOwner->GetHwnd(), g_plugin.getIconHandle(IDI_CHANMGR)); - - // nicklist - int ih = Chat_GetTextPixelSize(L"AQGglo", g_Settings.UserListFont, FALSE); - int ih2 = Chat_GetTextPixelSize(L"AQGglo", g_Settings.UserListHeadingsFont, FALSE); - int height = db_get_b(0, CHAT_MODULE, "NicklistRowDist", 12); - int font = ih > ih2 ? ih : ih2; - - // make sure we have space for icon! - if (g_Settings.bShowContactStatus) - font = font > 16 ? font : 16; - - m_nickList.SendMsg(LB_SETITEMHEIGHT, 0, height > font ? height : font); - InvalidateRect(m_nickList.GetHwnd(), nullptr, TRUE); - - CSuper::UpdateOptions(); -} - void CMsgDialog::UpdateStatusBar() { wchar_t *ptszDispName = m_si->pMI->ptszModDispName; diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index 7794154a64..9de8fd65a1 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -140,7 +140,6 @@ bool CMsgDialog::OnInitDialog() if (isChat()) { OnActivate(); - UpdateOptions(); UpdateStatusBar(); UpdateTitle(); UpdateChatLog(); @@ -1074,6 +1073,29 @@ void CMsgDialog::TabAutoComplete() void CMsgDialog::OnOptionsApplied() { + if (isChat()) { + HICON hIcon = ImageList_GetIcon(Clist_GetImageList(), GetImageId(), ILD_TRANSPARENT); + SendMessage(m_pOwner->m_hwndStatus, SB_SETICON, 0, (LPARAM)hIcon); + DestroyIcon(hIcon); + + Window_SetIcon_IcoLib(m_pOwner->GetHwnd(), g_plugin.getIconHandle(IDI_CHANMGR)); + + // nicklist + int ih = Chat_GetTextPixelSize(L"AQGglo", g_Settings.UserListFont, FALSE); + int ih2 = Chat_GetTextPixelSize(L"AQGglo", g_Settings.UserListHeadingsFont, FALSE); + int height = db_get_b(0, CHAT_MODULE, "NicklistRowDist", 12); + int font = ih > ih2 ? ih : ih2; + + // make sure we have space for icon! + if (g_Settings.bShowContactStatus) + font = font > 16 ? font : 16; + + m_nickList.SendMsg(LB_SETITEMHEIGHT, 0, height > font ? height : font); + InvalidateRect(m_nickList.GetHwnd(), nullptr, TRUE); + + UpdateChatOptions(); + } + CustomButtonData *cbd; for (int i = 0; cbd = Srmm_GetNthButton(i); i++) { HWND hwndButton = GetDlgItem(m_hwnd, cbd->m_dwButtonCID); @@ -1103,7 +1125,6 @@ void CMsgDialog::OnOptionsApplied() UpdateTitle(); Resize(); - m_pLog->UpdateOptions(); m_message.SendMsg(EM_SETBKGNDCOLOR, 0, g_plugin.getDword(SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR)); // avatar stuff diff --git a/src/core/stdmsg/src/msgs.h b/src/core/stdmsg/src/msgs.h index 98670d6dee..3c82801813 100644 --- a/src/core/stdmsg/src/msgs.h +++ b/src/core/stdmsg/src/msgs.h @@ -144,7 +144,6 @@ public: void SetStatusText(const wchar_t *, HICON) override; void ShowFilterMenu() override; void UpdateFilterButton() override; - void UpdateOptions() override; void UpdateStatusBar() override; void UpdateTitle() override; diff --git a/src/mir_app/src/chat_svc.cpp b/src/mir_app/src/chat_svc.cpp index 73c6eb540a..df0b70c420 100644 --- a/src/mir_app/src/chat_svc.cpp +++ b/src/mir_app/src/chat_svc.cpp @@ -774,7 +774,7 @@ MIR_APP_DLL(void) Chat_UpdateOptions() { for (auto &si : g_arSessions) if (si->pDlg) - si->pDlg->UpdateOptions(); + si->pDlg->OnOptionsApplied(); } MIR_APP_DLL(int) Chat_IsMuted(MCONTACT hContact) diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index 8a939f15af..986b1c5182 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -321,7 +321,7 @@ Srmm_FindDialog @406 NONAME ?UpdateStatusBar@CSrmmBaseDialog@@UAEXXZ @417 NONAME Chat_UpdateOptions @418 NONAME ?RedrawLog@CSrmmBaseDialog@@QAEXXZ @419 NONAME -?UpdateOptions@CSrmmBaseDialog@@UAEXXZ @420 NONAME +?UpdateChatOptions@CSrmmBaseDialog@@QAEXXZ @420 NONAME ?ShowColorChooser@CSrmmBaseDialog@@QAEXH@Z @421 NONAME ?ShowFilterMenu@CSrmmBaseDialog@@UAEXXZ @422 NONAME ?OnInitDialog@CSrmmBaseDialog@@MAE_NXZ @423 NONAME diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index f36d40f651..3d6eca5103 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -321,7 +321,7 @@ Srmm_FindDialog @406 NONAME ?UpdateStatusBar@CSrmmBaseDialog@@UEAAXXZ @417 NONAME Chat_UpdateOptions @418 NONAME ?RedrawLog@CSrmmBaseDialog@@QEAAXXZ @419 NONAME -?UpdateOptions@CSrmmBaseDialog@@UEAAXXZ @420 NONAME +?UpdateChatOptions@CSrmmBaseDialog@@QEAAXXZ @420 NONAME ?ShowColorChooser@CSrmmBaseDialog@@QEAAXH@Z @421 NONAME ?ShowFilterMenu@CSrmmBaseDialog@@UEAAXXZ @422 NONAME ?OnInitDialog@CSrmmBaseDialog@@MEAA_NXZ @423 NONAME diff --git a/src/mir_app/src/srmm_base.cpp b/src/mir_app/src/srmm_base.cpp index 499bf58b67..3f69bf8fed 100644 --- a/src/mir_app/src/srmm_base.cpp +++ b/src/mir_app/src/srmm_base.cpp @@ -568,6 +568,7 @@ INT_PTR CSrmmBaseDialog::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case DM_OPTIONSAPPLIED: + m_pLog->UpdateOptions(); OnOptionsApplied(); return 0; @@ -637,9 +638,8 @@ bool CSrmmBaseDialog::IsSuitableEvent(const LOGINFO &lin) const return (m_si->iType == GCW_SERVER || (m_iLogFilterFlags & lin.iType)); } -void CSrmmBaseDialog::UpdateOptions() +void CSrmmBaseDialog::UpdateChatOptions() { - m_pLog->UpdateOptions(); UpdateFilterButton(); MODULEINFO *mi = m_si->pMI; -- cgit v1.2.3