diff --git a/radiant/ui/mainframe/AuiLayout.cpp b/radiant/ui/mainframe/AuiLayout.cpp index d3a96400a2..211e524569 100644 --- a/radiant/ui/mainframe/AuiLayout.cpp +++ b/radiant/ui/mainframe/AuiLayout.cpp @@ -668,6 +668,8 @@ void AuiLayout::restoreStateFromRegistry() _auiMgr.LoadPerspective(storedPersp); } + ensureVisibleCenterPane(); + // After restoring the perspective, ensure all visible panes are active for (const auto& info : _panes) { @@ -684,4 +686,35 @@ void AuiLayout::restoreStateFromRegistry() } } +void AuiLayout::ensureVisibleCenterPane() +{ + // Ensure if we have a visible center pane + bool hasVisibleCenterPane = false; + wxAuiPaneInfo* centerOrthoPane = nullptr; + + for (const auto& info : _panes) + { + auto& paneInfo = _auiMgr.GetPane(info.paneName); + + if (!isCenterPane(paneInfo)) continue; + + if (paneInfo.IsShown()) + { + hasVisibleCenterPane = true; + } + + if (paneInfo.name == UserControl::OrthoView) + { + centerOrthoPane = &paneInfo; + } + } + + if (!hasVisibleCenterPane && centerOrthoPane != nullptr) + { + // Set the default ortho view center pane to visible + centerOrthoPane->Show(); + _auiMgr.Update(); + } +} + } // namespace ui diff --git a/radiant/ui/mainframe/AuiLayout.h b/radiant/ui/mainframe/AuiLayout.h index 01ec67441b..f92a565a78 100644 --- a/radiant/ui/mainframe/AuiLayout.h +++ b/radiant/ui/mainframe/AuiLayout.h @@ -85,6 +85,7 @@ class AuiLayout std::string generateUniquePaneName(const std::string& controlName); void convertPaneToPropertyTab(const std::string& paneName); + void ensureVisibleCenterPane(); }; } // namespace