diff options
author | George Hazan <george.hazan@gmail.com> | 2023-10-12 17:34:38 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2023-10-12 17:34:38 +0300 |
commit | d160afb34dedf2abd93be57ef11336f2b0bc0e72 (patch) | |
tree | 1e6194ab2b984ad805a4d0604c17b5fb5bcd58a9 /plugins/Scriver | |
parent | 11988c90df38f9ee8297dc87599cd4e16ef59084 (diff) |
Scriver: minor code reordering
Diffstat (limited to 'plugins/Scriver')
-rw-r--r-- | plugins/Scriver/src/msgdialog.cpp | 10 | ||||
-rw-r--r-- | plugins/Scriver/src/msgutils.cpp | 59 |
2 files changed, 31 insertions, 38 deletions
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index 2299640531..23572ba2d1 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -182,6 +182,8 @@ bool CMsgDialog::OnInitDialog() m_message.SendMsg(EM_EXLIMITTEXT, 0, nMax);
}
+ m_pParent->AddChild(this);
+
CreateInfobar();
OnOptionsApplied();
@@ -190,9 +192,6 @@ bool CMsgDialog::OnInitDialog() UpdateTitle();
UpdateNickList();
UpdateChatLog();
-
- m_pParent->AddChild(this);
- PopupWindow(false);
}
else {
m_nickList.Hide();
@@ -200,8 +199,6 @@ bool CMsgDialog::OnInitDialog() bool notifyUnread = GetFirstEvent();
- m_pParent->AddChild(this);
-
DB::ECPTR pCursor(DB::EventsRev(m_hContact));
while (MEVENT hdbEvent = pCursor.FetchNext()) {
DBEVENTINFO dbei = {};
@@ -212,8 +209,6 @@ bool CMsgDialog::OnInitDialog() }
}
- PopupWindow(m_bIncoming);
-
if (notifyUnread) {
if (GetForegroundWindow() != m_hwndParent || m_pParent->m_hwndActive != m_hwnd) {
m_iShowUnread = 1;
@@ -227,6 +222,7 @@ bool CMsgDialog::OnInitDialog() if (m_iMessagesInProgress > 0)
ShowMessageSending();
}
+ PopupWindow(m_bIncoming);
NotifyEvent(MSG_WINDOW_EVT_OPEN);
return true;
diff --git a/plugins/Scriver/src/msgutils.cpp b/plugins/Scriver/src/msgutils.cpp index 026aedf664..9fc63dd7ab 100644 --- a/plugins/Scriver/src/msgutils.cpp +++ b/plugins/Scriver/src/msgutils.cpp @@ -296,6 +296,9 @@ void CMsgDialog::NotifyTyping(int mode) void CMsgDialog::OnOptionsApplied() { + CHARFORMAT2 cf = {}; + cf.cbSize = sizeof(CHARFORMAT2); + CSuper::OnOptionsApplied(); GetAvatar(); @@ -309,10 +312,7 @@ void CMsgDialog::OnOptionsApplied() 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)); @@ -332,39 +332,36 @@ void CMsgDialog::OnOptionsApplied() 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; } + else { + SetDialogToType(); + + 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); + + cf.dwMask = CFM_COLOR | CFM_FACE | CFM_CHARSET | CFM_SIZE | CFM_WEIGHT | CFM_BOLD | CFM_ITALIC; + cf.crTextColor = colour; + cf.bCharSet = lf.lfCharSet; + wcsncpy(cf.szFaceName, lf.lfFaceName, LF_FACESIZE); + cf.dwEffects = ((lf.lfWeight >= FW_BOLD) ? CFE_BOLD : 0) | (lf.lfItalic ? CFE_ITALIC : 0); + cf.wWeight = (uint16_t)lf.lfWeight; + cf.bPitchAndFamily = lf.lfPitchAndFamily; + cf.yHeight = abs(lf.lfHeight) * 1440 / g_dat.logPixelSY; + m_message.SendMsg(EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf); - SetDialogToType(); - - 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); + m_message.SendMsg(EM_SETLANGOPTIONS, 0, (LPARAM)m_message.SendMsg(EM_GETLANGOPTIONS, 0, 0) & ~IMF_AUTOKEYBOARD); + + SendMessage(m_hwnd, DM_REMAKELOG, 0, 0); + UpdateTabControl(); + SetupInfobar(); + } - SendMessage(m_hwnd, DM_REMAKELOG, 0, 0); - UpdateTabControl(); m_message.SendMsg(EM_REQUESTRESIZE, 0, 0); - SetupInfobar(); } void CMsgDialog::Reattach(HWND hwndContainer) |