summaryrefslogtreecommitdiff
path: root/plugins/Scriver/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2023-09-26 12:20:03 +0300
committerGeorge Hazan <george.hazan@gmail.com>2023-09-26 12:20:03 +0300
commitb6669f0ee3361891e9807e5c734bf9121e9cfb06 (patch)
tree89f4662ee0f9b743126b213354820fd1671a5657 /plugins/Scriver/src
parent82228dfaa3f7c387ff1f42e1698c4d68fe8e1335 (diff)
SRMM options update unification
Diffstat (limited to 'plugins/Scriver/src')
-rw-r--r--plugins/Scriver/src/msgdialog.cpp39
-rw-r--r--plugins/Scriver/src/msgoptions.cpp6
-rw-r--r--plugins/Scriver/src/msgs.h1
-rw-r--r--plugins/Scriver/src/msgutils.cpp39
4 files changed, 44 insertions, 41 deletions
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp
index d062cf512a..4e1b373608 100644
--- a/plugins/Scriver/src/msgdialog.cpp
+++ b/plugins/Scriver/src/msgdialog.cpp
@@ -217,7 +217,7 @@ bool CMsgDialog::OnInitDialog()
}
}
- SendMessage(m_hwnd, DM_OPTIONSAPPLIED, 0, 0);
+ OnOptionsApplied();
PopupWindow(m_bIncoming);
if (notifyUnread) {
@@ -891,43 +891,6 @@ INT_PTR CMsgDialog::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
}
break;
- case DM_OPTIONSAPPLIED:
- if (!isChat()) {
- 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);
-
- LOGFONT lf;
- LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, &lf, &colour);
-
- CHARFORMAT2 cf2;
- memset(&cf2, 0, sizeof(cf2));
- cf2.cbSize = sizeof(cf2);
- cf2.dwMask = CFM_COLOR | CFM_FACE | CFM_CHARSET | CFM_SIZE | CFM_WEIGHT | CFM_BOLD | CFM_ITALIC;
- cf2.crTextColor = colour;
- cf2.bCharSet = lf.lfCharSet;
- wcsncpy(cf2.szFaceName, lf.lfFaceName, LF_FACESIZE);
- cf2.dwEffects = ((lf.lfWeight >= FW_BOLD) ? CFE_BOLD : 0) | (lf.lfItalic ? CFE_ITALIC : 0);
- cf2.wWeight = (uint16_t)lf.lfWeight;
- cf2.bPitchAndFamily = lf.lfPitchAndFamily;
- cf2.yHeight = abs(lf.lfHeight) * 1440 / g_dat.logPixelSY;
- m_message.SendMsg(EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf2);
- 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();
- }
- break;
-
case DM_ACTIVATE:
if (isChat()) {
if (m_si->wState & STATE_TALK) {
diff --git a/plugins/Scriver/src/msgoptions.cpp b/plugins/Scriver/src/msgoptions.cpp
index b51cddc4fa..2a1975e5e6 100644
--- a/plugins/Scriver/src/msgoptions.cpp
+++ b/plugins/Scriver/src/msgoptions.cpp
@@ -75,7 +75,7 @@ int FontServiceFontsChanged(WPARAM, LPARAM)
{
LoadMsgLogIcons();
LoadInfobarFonts();
- Srmm_Broadcast(DM_OPTIONSAPPLIED, 0, 0);
+ Srmm_ApplyOptions();
return 0;
}
@@ -177,7 +177,7 @@ class CBaseOptionDlg : public CDlgBase
{
ReloadGlobals();
WindowList_Broadcast(g_dat.hParentWindowList, DM_OPTIONSAPPLIED, 0, 0);
- Srmm_Broadcast(DM_OPTIONSAPPLIED, 0, 0);
+ Srmm_ApplyOptions();
Chat_UpdateOptions();
}
@@ -739,7 +739,7 @@ public:
}
ReloadGlobals();
- Srmm_Broadcast(DM_OPTIONSAPPLIED, 0, 0);
+ Srmm_ApplyOptions();
return true;
}
diff --git a/plugins/Scriver/src/msgs.h b/plugins/Scriver/src/msgs.h
index c6422300d7..f24d81b4d6 100644
--- a/plugins/Scriver/src/msgs.h
+++ b/plugins/Scriver/src/msgs.h
@@ -133,6 +133,7 @@ public:
void EventAdded(MEVENT, const DB::EventInfo &dbei) override;
bool GetFirstEvent() override;
void LoadSettings() override;
+ void OnOptionsApplied() override;
void RemakeLog() override;
void SetStatusText(const wchar_t *, HICON) override;
void ShowFilterMenu() override;
diff --git a/plugins/Scriver/src/msgutils.cpp b/plugins/Scriver/src/msgutils.cpp
index bb9da0e619..4f4fb2349b 100644
--- a/plugins/Scriver/src/msgutils.cpp
+++ b/plugins/Scriver/src/msgutils.cpp
@@ -294,6 +294,45 @@ void CMsgDialog::NotifyTyping(int mode)
CallService(MS_PROTO_SELFISTYPING, m_hContact, m_nTypeMode);
}
+void CMsgDialog::OnOptionsApplied()
+{
+ if (isChat())
+ 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);
+
+ LOGFONT lf;
+ LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, &lf, &colour);
+
+ CHARFORMAT2 cf2;
+ memset(&cf2, 0, sizeof(cf2));
+ cf2.cbSize = sizeof(cf2);
+ cf2.dwMask = CFM_COLOR | CFM_FACE | CFM_CHARSET | CFM_SIZE | CFM_WEIGHT | CFM_BOLD | CFM_ITALIC;
+ cf2.crTextColor = colour;
+ cf2.bCharSet = lf.lfCharSet;
+ wcsncpy(cf2.szFaceName, lf.lfFaceName, LF_FACESIZE);
+ cf2.dwEffects = ((lf.lfWeight >= FW_BOLD) ? CFE_BOLD : 0) | (lf.lfItalic ? CFE_ITALIC : 0);
+ cf2.wWeight = (uint16_t)lf.lfWeight;
+ cf2.bPitchAndFamily = lf.lfPitchAndFamily;
+ cf2.yHeight = abs(lf.lfHeight) * 1440 / g_dat.logPixelSY;
+ m_message.SendMsg(EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf2);
+ 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();
+}
+
void CMsgDialog::Reattach(HWND hwndContainer)
{
MCONTACT hContact = m_hContact;