From 7b0b7a3119a6c97f877a450edd7060805e7c1023 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 15 Jul 2022 11:14:28 +0300 Subject: StdMsg: resizer unification --- src/core/stdmsg/src/msgdialog.cpp | 150 ++++++++++++++++---------------------- src/core/stdmsg/src/msgs.cpp | 11 +-- src/core/stdmsg/src/msgs.h | 1 + 3 files changed, 66 insertions(+), 96 deletions(-) (limited to 'src/core/stdmsg') diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index 5014eabbb6..6ef54f7878 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -218,11 +218,11 @@ bool CMsgDialog::OnInitDialog() } if (m_bNoActivate) { - SetWindowPos(m_hwnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_SHOWWINDOW); + SetWindowPos(m_hwnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); StartFlash(); } else { - SetWindowPos(m_hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW); + SetWindowPos(m_hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); SetForegroundWindow(m_hwnd); SetFocus(m_message.GetHwnd()); } @@ -473,94 +473,66 @@ int CMsgDialog::Resizer(UTILRESIZECONTROL *urc) { bool bToolbar = g_plugin.bShowButtons; bool bSend = g_plugin.bSendButton; - - if (isChat()) { - bool bNick = m_si->iType != GCW_SERVER && m_bNicklistEnabled; - - switch (urc->wId) { - case IDOK: - urc->rcItem.left = bSend ? urc->dlgNewSize.cx - 64 + 2 : urc->dlgNewSize.cx; - urc->rcItem.right = urc->dlgNewSize.cx; - urc->rcItem.top = urc->dlgNewSize.cy - m_iSplitterY + 28; - urc->rcItem.bottom = urc->dlgNewSize.cy - 1; - return RD_ANCHORX_CUSTOM | RD_ANCHORY_CUSTOM; - - case IDC_SRMM_LOG: - urc->rcItem.top = 2; - urc->rcItem.left = 0; - urc->rcItem.right = bNick ? urc->dlgNewSize.cx - m_iSplitterX : urc->dlgNewSize.cx; - urc->rcItem.bottom = urc->dlgNewSize.cy - m_iSplitterY; - if (!bToolbar) - urc->rcItem.bottom += 20; - m_rcLog = urc->rcItem; - return RD_ANCHORX_CUSTOM | RD_ANCHORY_CUSTOM; - - case IDC_SRMM_NICKLIST: - urc->rcItem.top = 2; - urc->rcItem.right = urc->dlgNewSize.cx; - urc->rcItem.left = urc->dlgNewSize.cx - m_iSplitterX + 2; + bool bNick = false; + + if (isChat()) bNick = m_si->iType != GCW_SERVER && m_bNicklistEnabled; + + switch (urc->wId) { + case IDOK: + urc->rcItem.left = bSend ? urc->dlgNewSize.cx - 64 + 2 : urc->dlgNewSize.cx; + urc->rcItem.right = urc->dlgNewSize.cx; + urc->rcItem.top = urc->dlgNewSize.cy - m_iSplitterY + m_iBBarHeight; + urc->rcItem.bottom = urc->dlgNewSize.cy - 1; + return RD_ANCHORX_CUSTOM | RD_ANCHORY_CUSTOM; + + case IDC_SRMM_LOG: + urc->rcItem.top = 2; + urc->rcItem.left = 0; + urc->rcItem.right = bNick ? urc->dlgNewSize.cx - m_iSplitterX : urc->dlgNewSize.cx; + urc->rcItem.bottom = urc->dlgNewSize.cy - m_iSplitterY; + if (!bToolbar) + urc->rcItem.bottom += m_iBBarHeight - 4; + m_rcLog = urc->rcItem; + return RD_ANCHORX_CUSTOM | RD_ANCHORY_CUSTOM; + + case IDC_SRMM_NICKLIST: + urc->rcItem.top = 2; + urc->rcItem.right = urc->dlgNewSize.cx; + urc->rcItem.left = urc->dlgNewSize.cx - m_iSplitterX + 2; LBL_CalcBottom: - urc->rcItem.bottom = urc->dlgNewSize.cy - m_iSplitterY; - if (!bToolbar) - urc->rcItem.bottom += 20; - return RD_ANCHORX_CUSTOM | RD_ANCHORY_CUSTOM; - - case IDC_SPLITTERX: - urc->rcItem.top = 1; - urc->rcItem.left = urc->dlgNewSize.cx - m_iSplitterX; - urc->rcItem.right = urc->rcItem.left + 2; - goto LBL_CalcBottom; - - case IDC_SPLITTERY: - urc->rcItem.top = urc->dlgNewSize.cy - m_iSplitterY; - if (!bToolbar) - urc->rcItem.top += 20; - urc->rcItem.bottom = urc->rcItem.top + 2; - return RD_ANCHORX_WIDTH | RD_ANCHORY_CUSTOM; - - case IDC_SRMM_MESSAGE: - urc->rcItem.right = bSend ? urc->dlgNewSize.cx - 64 : urc->dlgNewSize.cx; - urc->rcItem.top = urc->dlgNewSize.cy - m_iSplitterY + 28; - urc->rcItem.bottom = urc->dlgNewSize.cy - 1; - return RD_ANCHORX_LEFT | RD_ANCHORY_CUSTOM; - } + urc->rcItem.bottom = urc->dlgNewSize.cy - m_iSplitterY; + if (!bToolbar) + urc->rcItem.bottom += 20; + return RD_ANCHORX_CUSTOM | RD_ANCHORY_CUSTOM; + + case IDC_SPLITTERX: + urc->rcItem.top = 1; + urc->rcItem.left = urc->dlgNewSize.cx - m_iSplitterX; + urc->rcItem.right = urc->rcItem.left + 2; + goto LBL_CalcBottom; + + case IDC_SPLITTERY: + urc->rcItem.top = urc->dlgNewSize.cy - m_iSplitterY; + if (!bToolbar) + urc->rcItem.top += 20; + urc->rcItem.bottom = urc->rcItem.top + 2; + return RD_ANCHORX_WIDTH | RD_ANCHORY_CUSTOM; + + case IDC_SRMM_MESSAGE: + urc->rcItem.right = bSend ? urc->dlgNewSize.cx - 64 : urc->dlgNewSize.cx; + urc->rcItem.top = urc->dlgNewSize.cy - m_iSplitterY + 28; + urc->rcItem.bottom = urc->dlgNewSize.cy - 1; + if (g_plugin.bShowAvatar && m_avatarPic) + urc->rcItem.left = m_avatarWidth + 4; + return RD_ANCHORX_CUSTOM | RD_ANCHORY_CUSTOM; + + case IDC_AVATAR: + urc->rcItem.top = urc->dlgNewSize.cy - (m_iSplitterY - m_iBBarHeight)/2 - m_avatarHeight/2 + 1; + urc->rcItem.bottom = urc->rcItem.top + m_avatarHeight + 2; + urc->rcItem.right = urc->rcItem.left + (m_avatarWidth + 2); + return RD_ANCHORX_LEFT | RD_ANCHORY_CUSTOM; } - else { - switch (urc->wId) { - case IDC_SRMM_LOG: - if (!g_plugin.bShowButtons) - urc->rcItem.top = 2; - urc->rcItem.bottom = urc->dlgNewSize.cy - m_iSplitterY; - m_rcLog = urc->rcItem; - return RD_ANCHORX_WIDTH | RD_ANCHORY_TOP; - case IDC_SPLITTERY: - urc->rcItem.top = urc->dlgNewSize.cy - m_iSplitterY; - urc->rcItem.bottom = urc->rcItem.top + 3; - return RD_ANCHORX_WIDTH | RD_ANCHORY_CUSTOM; - - case IDC_SRMM_MESSAGE: - urc->rcItem.right = bSend ? urc->dlgNewSize.cx - 64 : urc->dlgNewSize.cx - 1; - if (g_plugin.bShowAvatar && m_avatarPic) - urc->rcItem.left = m_avatarWidth + 4; - - urc->rcItem.top = urc->dlgNewSize.cy - m_iSplitterY + 3; - urc->rcItem.bottom = urc->dlgNewSize.cy - 1; - return RD_ANCHORX_CUSTOM | RD_ANCHORY_CUSTOM; - - case IDOK: - urc->rcItem.left = bSend ? urc->dlgNewSize.cx - 64 + 2 : urc->dlgNewSize.cx - 1; - urc->rcItem.right = urc->dlgNewSize.cx; - urc->rcItem.top = urc->dlgNewSize.cy - m_iSplitterY + 3; - urc->rcItem.bottom = urc->dlgNewSize.cy - 1; - return RD_ANCHORX_CUSTOM | RD_ANCHORY_CUSTOM; - - case IDC_AVATAR: - urc->rcItem.top = urc->rcItem.bottom - (m_avatarHeight + 2); - urc->rcItem.right = urc->rcItem.left + (m_avatarWidth + 2); - return RD_ANCHORX_LEFT | RD_ANCHORY_BOTTOM; - } - } return RD_ANCHORX_LEFT | RD_ANCHORY_TOP; } @@ -1363,7 +1335,7 @@ void CMsgDialog::onSplitterY(CSplitter *pSplitter) int toplimit = 63; if (!g_plugin.bShowButtons) - toplimit += 22; + toplimit += m_iBBarHeight; if (m_iSplitterY < m_minEditBoxSize.cy) m_iSplitterY = m_minEditBoxSize.cy; @@ -1576,7 +1548,7 @@ void CMsgDialog::UpdateSizeBar() } if (m_avatarPic && m_minEditBoxSize.cy <= m_avatarHeight) { - m_minEditBoxSize.cy = m_avatarHeight + 8; + m_minEditBoxSize.cy = m_avatarHeight + 28; if (m_iSplitterY < m_minEditBoxSize.cy) { m_iSplitterY = m_minEditBoxSize.cy; Resize(); diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index a8bc6ca8db..89e5395ace 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -403,13 +403,10 @@ void SetButtonsPos(HWND hwndDlg, bool bIsChat) int yPos; RECT rc; - if (bIsChat) { - GetWindowRect(GetDlgItem(hwndDlg, IDC_SPLITTERY), &rc); - POINT pt = { 0, rc.top }; - ScreenToClient(hwndDlg, &pt); - yPos = pt.y; - } - else yPos = 2; + GetWindowRect(GetDlgItem(hwndDlg, IDC_SPLITTERY), &rc); + POINT pt = { 0, rc.top }; + ScreenToClient(hwndDlg, &pt); + yPos = pt.y; GetClientRect(hwndDlg, &rc); int iLeftX = 2, iRightX = rc.right - 2, iGap = Srmm_GetButtonGap(); diff --git a/src/core/stdmsg/src/msgs.h b/src/core/stdmsg/src/msgs.h index 8438f529c1..cabd2ac248 100644 --- a/src/core/stdmsg/src/msgs.h +++ b/src/core/stdmsg/src/msgs.h @@ -99,6 +99,7 @@ class CMsgDialog : public CSrmmBaseDialog uint16_t m_wStatus = ID_STATUS_OFFLINE, m_wOldStatus = ID_STATUS_OFFLINE; uint16_t m_wMinute = 0; bool m_bIsMeta = false, m_bWindowCascaded = false, m_bNoActivate = false; + int m_iBBarHeight = 28; public: CMsgDialog(CTabbedWindow *pOwner, MCONTACT hContact); -- cgit v1.2.3