From 7a20312b1ea4998111a05f207be8023a499050fb Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 13 May 2019 14:54:10 +0300 Subject: CDlgBase::SetMinSize - a way to get rid of WM_GETMINMAXINFO in DlgProc --- plugins/Scriver/src/chat_window.cpp | 13 ++----------- plugins/Scriver/src/msgdialog.cpp | 19 +++++-------------- plugins/Scriver/src/msgs.h | 1 - 3 files changed, 7 insertions(+), 26 deletions(-) (limited to 'plugins/Scriver/src') diff --git a/plugins/Scriver/src/chat_window.cpp b/plugins/Scriver/src/chat_window.cpp index 9b31e2e3bc..9ceec71ae4 100644 --- a/plugins/Scriver/src/chat_window.cpp +++ b/plugins/Scriver/src/chat_window.cpp @@ -227,6 +227,8 @@ bool CChatRoomDlg::OnInitDialog() m_pParent->iSplitterX = rc.right - rc.left; } + SetMinSize(350, m_minLogBoxHeight + TOOLBAR_HEIGHT + m_minEditBoxHeight + 5); + m_message.SendMsg(EM_SUBCLASSED, 0, 0); m_message.SendMsg(EM_SETEVENTMASK, 0, ENM_MOUSEEVENTS | ENM_KEYEVENTS | ENM_CHANGE | ENM_REQUESTRESIZE); @@ -1032,17 +1034,6 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) SetFocus(m_message.GetHwnd()); break; - case WM_GETMINMAXINFO: - { - MINMAXINFO *mmi = (MINMAXINFO*)lParam; - mmi->ptMinTrackSize.x = m_pParent->iSplitterX + 43; - if (mmi->ptMinTrackSize.x < 350) - mmi->ptMinTrackSize.x = 350; - - mmi->ptMinTrackSize.y = m_minLogBoxHeight + TOOLBAR_HEIGHT + m_minEditBoxHeight + 5; - } - break; - case WM_LBUTTONDBLCLK: if (LOWORD(lParam) < 30) ScrollToBottom(); diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index ab2d569f71..ddc1f27bda 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -229,9 +229,6 @@ bool CSrmmWindow::OnInitDialog() DWORD dwExStyle = GetWindowLongPtr(m_log.GetHwnd(), GWL_EXSTYLE); SetWindowLongPtr(m_log.GetHwnd(), GWL_EXSTYLE, (m_bUseRtl) ? dwExStyle | WS_EX_LEFTSCROLLBAR :dwExStyle & ~WS_EX_LEFTSCROLLBAR); - m_toolbarSize.cy = TOOLBAR_HEIGHT; - m_toolbarSize.cx = 0; - RECT rc; GetWindowRect(m_message.GetHwnd(), &rc); m_minLogBoxHeight = m_minEditBoxHeight = rc.bottom - rc.top; @@ -240,6 +237,8 @@ bool CSrmmWindow::OnInitDialog() if (m_pParent->iSplitterY == -1) m_pParent->iSplitterY = m_minEditBoxHeight; + SetMinSize(BOTTOM_RIGHT_AVATAR_HEIGHT, m_minLogBoxHeight + TOOLBAR_HEIGHT + m_minEditBoxHeight + max(INFO_BAR_HEIGHT, BOTTOM_RIGHT_AVATAR_HEIGHT - TOOLBAR_HEIGHT) + 5); + if (m_wszInitialText) { m_message.SetText(m_wszInitialText); mir_free(m_wszInitialText); @@ -839,7 +838,7 @@ void CSrmmWindow::MessageDialogResize(int w, int h) { ParentWindowData *pdat = m_pParent; bool bToolbar = (pdat->flags2 & SMF2_SHOWTOOLBAR) != 0; - int hSplitterPos = pdat->iSplitterY, toolbarHeight = (bToolbar) ? m_toolbarSize.cy : 0; + int hSplitterPos = pdat->iSplitterY, toolbarHeight = (bToolbar) ? TOOLBAR_HEIGHT : 0; int hSplitterMinTop = toolbarHeight + m_minLogBoxHeight, hSplitterMinBottom = m_minEditBoxHeight; int infobarInnerHeight = INFO_BAR_INNER_HEIGHT; int infobarHeight = INFO_BAR_HEIGHT; @@ -881,8 +880,8 @@ void CSrmmWindow::MessageDialogResize(int w, int h) if (avatarWidth > BOTTOM_RIGHT_AVATAR_HEIGHT && avatarWidth > w / 4) avatarWidth = w / 4; - if ((toolbarWidth - avatarWidth - 2) < m_toolbarSize.cx) - avatarWidth = toolbarWidth - m_toolbarSize.cx - 2; + if ((toolbarWidth - avatarWidth - 2) < 0) + avatarWidth = toolbarWidth - 2; toolbarWidth -= avatarWidth + 2; messageEditWidth -= avatarWidth + 1; @@ -1353,14 +1352,6 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) m_pParent = (ParentWindowData *)GetWindowLongPtr(m_hwndParent, GWLP_USERDATA); return TRUE; - case WM_GETMINMAXINFO: - { - MINMAXINFO *mmi = (MINMAXINFO *)lParam; - mmi->ptMinTrackSize.x = m_toolbarSize.cx + BOTTOM_RIGHT_AVATAR_HEIGHT; - mmi->ptMinTrackSize.y = m_minLogBoxHeight + m_toolbarSize.cy + m_minEditBoxHeight + max(INFO_BAR_HEIGHT, BOTTOM_RIGHT_AVATAR_HEIGHT - m_toolbarSize.cy) + 5; - } - return 0; - case WM_SIZE: if (wParam == SIZE_RESTORED || wParam == SIZE_MAXIMIZED) { RECT rc; diff --git a/plugins/Scriver/src/msgs.h b/plugins/Scriver/src/msgs.h index 41bf0a6e3e..88189fb316 100644 --- a/plugins/Scriver/src/msgs.h +++ b/plugins/Scriver/src/msgs.h @@ -117,7 +117,6 @@ class CSrmmWindow : public CScriverWindow bool m_bIncoming, m_bShowTyping; MEVENT m_hDbEventFirst, m_hDbEventLast, m_hDbUnreadEventFirst; - SIZE m_toolbarSize; int m_iWindowWasCascaded; int m_nTypeSecs, m_nTypeMode, m_nLastTyping; int m_iShowUnread; -- cgit v1.2.3