From: <sv...@op...> - 2024-11-10 00:59:29
|
Author: sagamusix Date: Sun Nov 10 01:59:17 2024 New Revision: 22132 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=22132 Log: [Imp] Allow the main toolbar to wrap if the main window is too narrow. Modified: trunk/OpenMPT/mptrack/Mainbar.cpp Modified: trunk/OpenMPT/mptrack/Mainbar.cpp ============================================================================== --- trunk/OpenMPT/mptrack/Mainbar.cpp Sun Nov 10 00:38:13 2024 (r22131) +++ trunk/OpenMPT/mptrack/Mainbar.cpp Sun Nov 10 01:59:17 2024 (r22132) @@ -45,6 +45,19 @@ CSize CToolBarEx::CalcDynamicLayout(int nLength, DWORD dwMode) { + // Make the toolbar go into multiline mode when it's docked + if(dwMode & LM_HORZDOCK) + { + if(auto mainFrm = CMainFrame::GetMainFrame()) + { + CRect rect; + mainFrm->GetClientRect(rect); + nLength = rect.right; + dwMode &= ~LM_HORZDOCK; + dwMode |= LM_COMMIT; + } + } + CSize sizeResult; // if we're committing set the buttons appropriately if(dwMode & LM_COMMIT) @@ -227,9 +240,7 @@ BOOL CMainToolBar::Create(CWnd *parent) { - DWORD dwStyle = WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_SIZE_DYNAMIC | CBRS_TOOLTIPS | CBRS_FLYBY; - - if(!CToolBar::Create(parent, dwStyle)) + if(!CToolBar::Create(parent, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_SIZE_DYNAMIC | CBRS_TOOLTIPS | CBRS_FLYBY)) return FALSE; SetButtons(MainButtons, static_cast<int>(std::size(MainButtons))); |