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 | |
parent | bc2acff2ff61f3f929081798181422e6aceed4fa (diff) |
fixes #4743 (StdMsg, Scriver: при отправке сообщения кнопки форматирования не "отжимаются")
-rw-r--r-- | include/chat_resource.h | 1 | ||||
-rw-r--r-- | plugins/Scriver/src/msgdialog.cpp | 23 | ||||
-rw-r--r-- | plugins/TabSRMM/src/buttonsbar.cpp | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/generic_msghandlers.cpp | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgdialog.cpp | 47 | ||||
-rw-r--r-- | plugins/TabSRMM/src/resource.h | 1 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgdialog.cpp | 12 | ||||
-rw-r--r-- | src/mir_app/src/srmm_base.cpp | 48 |
8 files changed, 56 insertions, 80 deletions
diff --git a/include/chat_resource.h b/include/chat_resource.h index 6af1bc0d36..09b9ee68f0 100644 --- a/include/chat_resource.h +++ b/include/chat_resource.h @@ -36,3 +36,4 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define IDC_SRMM_MESSAGE 3012
#define IDC_SRMM_QUOTE 3013
#define IDC_SRMM_CLOSEQUOTE 3014
+#define IDC_SRMM_STRIKEOUT 3015
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index 2477dcbfa6..3778b66d69 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -1043,29 +1043,12 @@ INT_PTR CMsgDialog::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) pNmhdr = (LPNMHDR)lParam;
switch (pNmhdr->idFrom) {
case IDC_SRMM_LOG:
- switch (pNmhdr->code) {
- case EN_MSGFILTER:
- {
- int result = InputAreaShortcuts(m_message.GetHwnd(), ((MSGFILTER *)lParam)->msg, ((MSGFILTER *)lParam)->wParam, ((MSGFILTER *)lParam)->lParam);
- if (result != -1) {
- SetWindowLongPtr(m_hwnd, DWLP_MSGRESULT, TRUE);
- return TRUE;
- }
- }
-
- switch (((MSGFILTER *)lParam)->msg) {
- case WM_RBUTTONUP:
+ if (pNmhdr->code == EN_MSGFILTER) {
+ int result = InputAreaShortcuts(m_message.GetHwnd(), ((MSGFILTER *)lParam)->msg, ((MSGFILTER *)lParam)->wParam, ((MSGFILTER *)lParam)->lParam);
+ if (result != -1) {
SetWindowLongPtr(m_hwnd, DWLP_MSGRESULT, TRUE);
return TRUE;
}
- break;
- }
- break;
-
- case IDC_SRMM_MESSAGE:
- if (pNmhdr->code == EN_MSGFILTER && ((MSGFILTER *)lParam)->msg == WM_RBUTTONUP) {
- SetWindowLongPtr(m_hwnd, DWLP_MSGRESULT, TRUE);
- return TRUE;
}
break;
}
diff --git a/plugins/TabSRMM/src/buttonsbar.cpp b/plugins/TabSRMM/src/buttonsbar.cpp index 28bb14993e..95a49fe61b 100644 --- a/plugins/TabSRMM/src/buttonsbar.cpp +++ b/plugins/TabSRMM/src/buttonsbar.cpp @@ -40,7 +40,7 @@ static int CB_InitDefaultButtons(WPARAM, LPARAM) g_plugin.addButton(&bbd); bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISPUSHBUTTON | BBBF_CANBEHIDDEN | BBBF_CREATEBYID | BBBF_NOREADONLY; - bbd.dwButtonID = IDC_FONTSTRIKEOUT; + bbd.dwButtonID = IDC_SRMM_STRIKEOUT; bbd.dwDefPos = 70; bbd.hIcon = g_plugin.getIconHandle(IDI_STRIKEOUT); bbd.pwszTooltip = LPGENW("Strike-through text"); diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index 12f4643670..562349588c 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -172,7 +172,7 @@ LRESULT CMsgDialog::DM_MsgWindowCmdHandler(UINT cmd, WPARAM wParam, LPARAM lPara case IDC_SRMM_BOLD:
case IDC_SRMM_ITALICS:
case IDC_SRMM_UNDERLINE:
- case IDC_FONTSTRIKEOUT:
+ case IDC_SRMM_STRIKEOUT:
if (m_bSendFormat) { // dont use formatting if disabled
auto *pCtrl = (CCtrlButton*)FindControl(cmd);
if (!pCtrl->Enabled())
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index a0fdd09f57..2a1f028379 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -35,7 +35,7 @@ LIST<void> g_arUnreadWindows(1, PtrKeySortT); static int g_cLinesPerPage = 0;
static int g_iWheelCarryover = 0;
-static const UINT formatControls[] = { IDC_SRMM_BOLD, IDC_SRMM_ITALICS, IDC_SRMM_UNDERLINE, IDC_FONTSTRIKEOUT };
+static const UINT formatControls[] = { IDC_SRMM_BOLD, IDC_SRMM_ITALICS, IDC_SRMM_UNDERLINE, IDC_SRMM_STRIKEOUT };
static const UINT addControls[] = { IDC_ADD, IDC_CANCELADD };
static const UINT btnControls[] = { IDC_RETRY, IDC_CANCELSEND, IDC_MSGSENDLATER, IDC_ADD, IDC_CANCELADD };
static const UINT errorControls[] = { IDC_STATICERRORICON, IDC_STATICTEXT, IDC_RETRY, IDC_CANCELSEND, IDC_MSGSENDLATER };
@@ -326,7 +326,7 @@ CMsgDialog::CMsgDialog(int iDlgId, MCONTACT hContact) : m_btnAdd(this, IDC_ADD),
m_btnQuote(this, IDC_QUOTE),
m_btnCancelAdd(this, IDC_CANCELADD),
- m_btnStrikeout(this, IDC_FONTSTRIKEOUT)
+ m_btnStrikeout(this, IDC_SRMM_STRIKEOUT)
{
m_hContact = hContact;
@@ -571,9 +571,6 @@ bool CMsgDialog::OnInitDialog() UpdateTitle();
m_hTabIcon = m_hTabStatusIcon;
- if (!m_bSendFormat)
- ShowMultipleControls(m_hwnd, formatControls, _countof(formatControls), SW_HIDE);
-
UpdateNickList();
UpdateChatLog();
}
@@ -1665,46 +1662,6 @@ int CMsgDialog::OnFilter(MSGFILTER *pFilter) return 0;
}
}
-
- if ((msg == WM_LBUTTONDOWN || msg == WM_KEYUP || msg == WM_LBUTTONUP) && pFilter->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_FONTSTRIKEOUT);
-
- 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_FONTSTRIKEOUT, BST_CHECKED);
- }
- else if (bStrikeout == BST_CHECKED)
- CheckDlgButton(m_hwnd, IDC_FONTSTRIKEOUT, BST_UNCHECKED);
- }
switch (msg) {
case WM_LBUTTONDOWN:
diff --git a/plugins/TabSRMM/src/resource.h b/plugins/TabSRMM/src/resource.h index b9eb8f84a4..50b07bab75 100644 --- a/plugins/TabSRMM/src/resource.h +++ b/plugins/TabSRMM/src/resource.h @@ -193,7 +193,6 @@ #define IDC_ADD 1101
#define IDC_RTL 1103
#define IDC_CANCELADD 1112
-#define IDC_FONTSTRIKEOUT 1113
#define IDC_MATH_BKGCOLOUR 1124
#define IDC_FONTCOLOR 1127
#define IDC_LOGFROZENTEXT 1128
diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index 32d226af31..5e8c39785f 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -665,18 +665,6 @@ INT_PTR CMsgDialog::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) }
break;
- case WM_NOTIFY:
- switch (((LPNMHDR)lParam)->idFrom) {
- case IDC_SRMM_LOG:
- case IDC_SRMM_MESSAGE:
- if (((LPNMHDR)lParam)->code == EN_MSGFILTER && ((MSGFILTER *)lParam)->msg == WM_RBUTTONUP) {
- SetWindowLongPtr(m_hwnd, DWLP_MSGRESULT, TRUE);
- return TRUE;
- }
- break;
- }
- break;
-
case DM_UPDATETITLE:
if (lParam != 0) {
if (isChat()) {
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;
}
|