From b953aabe9b8c3d8f0eb8f93194e61d2e7cf095ee Mon Sep 17 00:00:00 2001 From: codereader Date: Mon, 31 Oct 2022 06:05:01 +0100 Subject: [PATCH] #6146: Make properties panel closeable, but don't destroy the contained window --- radiant/ui/mainframe/AuiLayout.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/radiant/ui/mainframe/AuiLayout.cpp b/radiant/ui/mainframe/AuiLayout.cpp index 211e524569..47e7cd0525 100644 --- a/radiant/ui/mainframe/AuiLayout.cpp +++ b/radiant/ui/mainframe/AuiLayout.cpp @@ -30,6 +30,7 @@ namespace const std::string PANE_NAME_ATTRIBUTE = "paneName"; const std::string STATE_ATTRIBUTE = "state"; const std::string CONTROL_NAME_ATTRIBUTE = "controlName"; + constexpr const char* const PROPERTIES_PANEL = "PropertiesPanel"; constexpr int AuiLayoutVersion = 1; // Minimum size of docked panels @@ -268,8 +269,8 @@ void AuiLayout::activate() addPane(cameraControl->getControlName(), camera, DEFAULT_PANE_INFO(cameraControl->getDisplayName(), size).Left().Position(0)); - addPane("PropertiesPanel", _propertyNotebook, - DEFAULT_PANE_INFO(_("Properties"), size).Left().Position(1).CloseButton(false).DestroyOnClose(false)); + addPane(PROPERTIES_PANEL, _propertyNotebook, + DEFAULT_PANE_INFO(_("Properties"), size).Left().Position(1).DestroyOnClose(false)); addPane(orthoViewControl->getControlName(), orthoViewControl->createWidget(managedArea), DEFAULT_PANE_INFO(orthoViewControl->getDisplayName(), size).CenterPane()); _auiMgr.Update(); @@ -668,6 +669,10 @@ void AuiLayout::restoreStateFromRegistry() _auiMgr.LoadPerspective(storedPersp); } + // Make sure the properties panel can be closed (the flag might still be set on the stored perspective) + auto& propertyPane = _auiMgr.GetPane(PROPERTIES_PANEL); + propertyPane.CloseButton(true).DestroyOnClose(false); + ensureVisibleCenterPane(); // After restoring the perspective, ensure all visible panes are active