From c657140a8aba3e92154c8ca2622c74308ccdf19c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 30 Oct 2022 18:54:56 +0300 Subject: fixes #3232 (DbEditorPP: splitter is broken) --- plugins/DbEditorPP/src/main_window.cpp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'plugins/DbEditorPP/src/main_window.cpp') diff --git a/plugins/DbEditorPP/src/main_window.cpp b/plugins/DbEditorPP/src/main_window.cpp index b0b8221c22..20a066e0ed 100644 --- a/plugins/DbEditorPP/src/main_window.cpp +++ b/plugins/DbEditorPP/src/main_window.cpp @@ -356,22 +356,18 @@ int CMainDlg::Resizer(UTILRESIZECONTROL *urc) void CMainDlg::onChange_Splitter(CSplitter *) { - RECT rc2; - GetWindowRect(m_hwnd, &rc2); - RECT rc; - GetClientRect(m_hwnd, &rc); - POINT pt = { m_splitter.GetPos(), 0 }; - ScreenToClient(m_hwnd, &pt); + GetWindowRect(m_hwnd, &rc); - m_splitterPos = rc.left + pt.x + 1; + m_splitterPos = m_splitter.GetPos() + 1; if (m_splitterPos < 150) m_splitterPos = 150; - if (m_splitterPos > rc2.right - rc2.left - 150) - m_splitterPos = rc2.right - rc2.left - 150; - SetWindowLongPtr(GetDlgItem(m_hwnd, IDC_SPLITTER), GWLP_USERDATA, m_splitterPos); - g_plugin.setWord("Splitter", (uint16_t)m_splitterPos); + int iMaxPanelWidth = rc.right - rc.left - 150; + if (m_splitterPos > iMaxPanelWidth) + m_splitterPos = iMaxPanelWidth; + + g_plugin.setWord("Splitter", (uint16_t)m_splitterPos); PostMessage(m_hwnd, WM_SIZE, 0, 0); } -- cgit v1.2.3