diff options
author | George Hazan <george.hazan@gmail.com> | 2024-10-17 19:41:54 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2024-10-17 19:41:54 +0300 |
commit | 5268eaf791d272a8e723d9c3533ab714427bb114 (patch) | |
tree | 78b14bcc8abb5ebb06f2b7501b6743ce5a611dd4 /src/mir_app | |
parent | bc2acff2ff61f3f929081798181422e6aceed4fa (diff) |
fixes #4743 (StdMsg, Scriver: при отправке сообщения кнопки форматирования не "отжимаются")
Diffstat (limited to 'src/mir_app')
-rw-r--r-- | src/mir_app/src/srmm_base.cpp | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/mir_app/src/srmm_base.cpp b/src/mir_app/src/srmm_base.cpp index ab0096c557..b6420f9d7b 100644 --- a/src/mir_app/src/srmm_base.cpp +++ b/src/mir_app/src/srmm_base.cpp @@ -660,6 +660,54 @@ INT_PTR CSrmmBaseDialog::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) LPNMHDR hdr = (LPNMHDR)lParam;
if (hdr->hwndFrom == m_pLog->GetHwnd())
m_pLog->Notify(wParam, lParam);
+ else if (hdr->code == EN_MSGFILTER) {
+ auto *F = ((MSGFILTER *)lParam);
+ if ((F->msg == WM_LBUTTONDOWN || F->msg == WM_KEYUP || F->msg == WM_LBUTTONUP) && F->nmhdr.idFrom == IDC_SRMM_MESSAGE) {
+ int bBold = IsDlgButtonChecked(m_hwnd, IDC_SRMM_BOLD);
+ int bItalic = IsDlgButtonChecked(m_hwnd, IDC_SRMM_ITALICS);
+ int bUnder = IsDlgButtonChecked(m_hwnd, IDC_SRMM_UNDERLINE);
+ int bStrikeout = IsDlgButtonChecked(m_hwnd, IDC_SRMM_STRIKEOUT);
+
+ CHARFORMAT2 cf2;
+ cf2.cbSize = sizeof(CHARFORMAT2);
+ cf2.dwMask = CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE | CFM_UNDERLINETYPE | CFM_STRIKEOUT;
+ cf2.dwEffects = 0;
+ m_message.SendMsg(EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf2);
+ if (cf2.dwEffects & CFE_BOLD) {
+ if (bBold == BST_UNCHECKED)
+ CheckDlgButton(m_hwnd, IDC_SRMM_BOLD, BST_CHECKED);
+ }
+ else if (bBold == BST_CHECKED)
+ CheckDlgButton(m_hwnd, IDC_SRMM_BOLD, BST_UNCHECKED);
+
+ if (cf2.dwEffects & CFE_ITALIC) {
+ if (bItalic == BST_UNCHECKED)
+ CheckDlgButton(m_hwnd, IDC_SRMM_ITALICS, BST_CHECKED);
+ }
+ else if (bItalic == BST_CHECKED)
+ CheckDlgButton(m_hwnd, IDC_SRMM_ITALICS, BST_UNCHECKED);
+
+ if (cf2.dwEffects & CFE_UNDERLINE && (cf2.bUnderlineType & CFU_UNDERLINE || cf2.bUnderlineType & CFU_UNDERLINEWORD)) {
+ if (bUnder == BST_UNCHECKED)
+ CheckDlgButton(m_hwnd, IDC_SRMM_UNDERLINE, BST_CHECKED);
+ }
+ else if (bUnder == BST_CHECKED)
+ CheckDlgButton(m_hwnd, IDC_SRMM_UNDERLINE, BST_UNCHECKED);
+
+ if (cf2.dwEffects & CFE_STRIKEOUT) {
+ if (bStrikeout == BST_UNCHECKED)
+ CheckDlgButton(m_hwnd, IDC_SRMM_STRIKEOUT, BST_CHECKED);
+ }
+ else if (bStrikeout == BST_CHECKED)
+ CheckDlgButton(m_hwnd, IDC_SRMM_STRIKEOUT, BST_UNCHECKED);
+ }
+
+ if ((hdr->idFrom == IDC_SRMM_LOG || hdr->idFrom == IDC_SRMM_MESSAGE) && F->msg == WM_RBUTTONUP) {
+ SetWindowLongPtr(m_hwnd, DWLP_MSGRESULT, TRUE);
+ return TRUE;
+ }
+
+ }
break;
}
|