From a455124c53674338f581a1970768182223c3a49a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 21 Nov 2023 18:19:29 +0300 Subject: tabSRMM: read-only message processing --- plugins/TabSRMM/src/generic_msghandlers.cpp | 2 +- plugins/TabSRMM/src/msgdialog.cpp | 10 +++++----- plugins/TabSRMM/src/msgdlgother.cpp | 12 +++++++++++- 3 files changed, 17 insertions(+), 7 deletions(-) (limited to 'plugins/TabSRMM/src') diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index fddd88cc6e..efd782565d 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -1038,7 +1038,7 @@ void CMsgDialog::DM_HandleAutoSizeRequest(REQRESIZE* rr) if (rr == nullptr || GetForegroundWindow() != m_pContainer->m_hwnd) return; - if (!m_bIsAutosizingInput || m_iInputAreaHeight == -1) + if (!m_bIsAutosizingInput || m_iInputAreaHeight == -1 || m_bReadOnly) return; LONG heightLimit = M.GetDword("autoSplitMinLimit", 0); diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 3362b32625..5d34a57ecd 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -125,8 +125,6 @@ void CMsgDialog::SetDialogToType() Utils::enableDlgControl(m_hwnd, IDC_TIME, true); - m_message.Show(); - ShowMultipleControls(m_hwnd, errorControls, _countof(errorControls), m_bErrorState ? SW_SHOW : SW_HIDE); if (!m_SendFormat) @@ -141,9 +139,12 @@ void CMsgDialog::SetDialogToType() GetAvatarVisibility(); Utils::showDlgControl(m_hwnd, IDC_CONTACTPIC, m_bShowAvatar ? SW_SHOW : SW_HIDE); - Utils::showDlgControl(m_hwnd, IDC_SPLITTERY, m_bIsAutosizingInput ? SW_HIDE : SW_SHOW); Utils::showDlgControl(m_hwnd, IDC_MULTISPLITTER, (m_sendMode & SMODE_MULTIPLE) ? SW_SHOW : SW_HIDE); + Utils::showDlgControl(m_hwnd, IDC_SPLITTERY, m_bIsAutosizingInput ? SW_HIDE : SW_SHOW); + if (m_bReadOnly) + Utils::enableDlgControl(m_hwnd, IDC_SPLITTERY, false); + EnableSendButton(GetWindowTextLength(m_message.GetHwnd()) != 0); UpdateTitle(); Resize(); @@ -1211,11 +1212,11 @@ int CMsgDialog::Resizer(UTILRESIZECONTROL *urc) return RD_ANCHORX_CUSTOM | RD_ANCHORY_CUSTOM; case IDC_SPLITTERY: + urc->rcItem.left = 0; urc->rcItem.right = urc->dlgNewSize.cx; if (isChat()) { urc->rcItem.top = urc->dlgNewSize.cy - m_iSplitterY + DPISCALEY_S(23); urc->rcItem.bottom = urc->rcItem.top + DPISCALEY_S(2); - urc->rcItem.left = 0; urc->rcItem.bottom++; urc->rcItem.top++; return RD_ANCHORX_CUSTOM | RD_ANCHORY_CUSTOM; @@ -1223,7 +1224,6 @@ int CMsgDialog::Resizer(UTILRESIZECONTROL *urc) urc->rcItem.top -= m_iSplitterY - m_originalSplitterY; urc->rcItem.bottom = urc->rcItem.top + DPISCALEY_S(2); OffsetRect(&urc->rcItem, 0, 1); - urc->rcItem.left = 0; if (m_bUseOffset) urc->rcItem.right -= (m_pic.cx); // + DPISCALEX(2)); diff --git a/plugins/TabSRMM/src/msgdlgother.cpp b/plugins/TabSRMM/src/msgdlgother.cpp index 15c6dd4732..ab8093c632 100644 --- a/plugins/TabSRMM/src/msgdlgother.cpp +++ b/plugins/TabSRMM/src/msgdlgother.cpp @@ -1404,6 +1404,11 @@ void CMsgDialog::LoadSettings() void CMsgDialog::LoadSplitter() { + if (m_bReadOnly) { + m_iSplitterY = DPISCALEY_S(22); + return; + } + if (m_bIsAutosizingInput) { m_iSplitterY = (m_pContainer->cfg.flags.m_bBottomToolbar) ? DPISCALEY_S(46 + 22) : DPISCALEY_S(46); @@ -1864,7 +1869,7 @@ void CMsgDialog::SaveAvatarToFile(HBITMAP hbm, int isOwnPic) void CMsgDialog::SaveSplitter() { - if (m_bIsAutosizingInput) + if (m_bIsAutosizingInput || m_bReadOnly) return; if (m_iSplitterY < DPISCALEY_S(MINSPLITTERY) || m_iSplitterY < 0) @@ -2154,6 +2159,11 @@ void CMsgDialog::ShowFilterMenu() void CMsgDialog::ShowPicture(bool showNewPic) { + if (m_bReadOnly) { + m_bShowAvatar = false; + return; + } + if (!m_pPanel.isActive()) m_pic.cy = m_pic.cx = DPISCALEY_S(60); -- cgit v1.2.3