diff --git a/radiant/ui/mainframe/AuiLayout.cpp b/radiant/ui/mainframe/AuiLayout.cpp index e3e6ade097..1466a97254 100644 --- a/radiant/ui/mainframe/AuiLayout.cpp +++ b/radiant/ui/mainframe/AuiLayout.cpp @@ -23,11 +23,15 @@ namespace { const std::string RKEY_ROOT = "user/ui/mainFrame/aui"; + // Minimum size of docked panels + const wxSize MIN_SIZE(128, 128); + // Return a pane info with default options - wxAuiPaneInfo DEFAULT_PANE_INFO(const std::string& caption) + wxAuiPaneInfo DEFAULT_PANE_INFO(const std::string& caption, + const wxSize& minSize) { return wxAuiPaneInfo().Caption(caption).Layer(1).CloseButton(false) - .MinSize(wxSize(128, 128)); + .MinSize(minSize); } } @@ -37,6 +41,12 @@ AuiLayout::AuiLayout() { } +void AuiLayout::addPane(wxWindow* window, const wxAuiPaneInfo& info) +{ + _auiMgr.AddPane(window, info); + _panes.push_back(window); +} + std::string AuiLayout::getName() { return AUI_LAYOUT_NAME; @@ -85,12 +95,23 @@ void AuiLayout::activate() // Add the camera and notebook to the left, as with the Embedded layout, and // the 2D view on the right - _auiMgr.AddPane(_camWnd->getMainWidget(), - DEFAULT_PANE_INFO(_("Camera")).Left().Position(0)); - _auiMgr.AddPane(notebookPanel, - DEFAULT_PANE_INFO(_("Properties")).Left().Position(1)); - _auiMgr.AddPane(xywnd->getGLWidget(), - DEFAULT_PANE_INFO(_("2D View")).Right()); + wxSize size = topLevelParent->GetSize(); + size.Scale(0.5, 1.0); + addPane(xywnd->getGLWidget(), + DEFAULT_PANE_INFO(_("2D View"), size).Right()); + addPane(_camWnd->getMainWidget(), + DEFAULT_PANE_INFO(_("Camera"), size).Left().Position(0)); + addPane(notebookPanel, + DEFAULT_PANE_INFO(_("Properties"), size).Left().Position(1)); + _auiMgr.Update(); + + // Nasty hack to get the panes sized properly. Since BestSize() is + // completely ignored (at least on Linux), we have to add the panes with a + // large *minimum* size and then reset this size after the initial addition. + for (wxWindow* w: _panes) + { + _auiMgr.GetPane(w).MinSize(MIN_SIZE); + } _auiMgr.Update(); // Hide the camera toggle option for non-floating views diff --git a/radiant/ui/mainframe/AuiLayout.h b/radiant/ui/mainframe/AuiLayout.h index b83c9cf85a..2fef8b2cf0 100644 --- a/radiant/ui/mainframe/AuiLayout.h +++ b/radiant/ui/mainframe/AuiLayout.h @@ -26,9 +26,16 @@ class AuiLayout: public IMainFrameLayout // Main AUI manager wxAuiManager _auiMgr; + // List of panes managed by the AUI manager + using Panes = std::list; + Panes _panes; + // Main constructor AuiLayout(); + // Add a pane to the wxAuiManager and store it in the list + void addPane(wxWindow* window, const wxAuiPaneInfo& info); + public: // IMainFrameLayout implementation std::string getName() override;