Skip to content

Commit

Permalink
#6144: Add a failsafe to ensure DR has a visible center pane
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Oct 30, 2022
1 parent b40ab43 commit 27442de
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
33 changes: 33 additions & 0 deletions radiant/ui/mainframe/AuiLayout.cpp
Expand Up @@ -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)
{
Expand All @@ -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
1 change: 1 addition & 0 deletions radiant/ui/mainframe/AuiLayout.h
Expand Up @@ -85,6 +85,7 @@ class AuiLayout
std::string generateUniquePaneName(const std::string& controlName);

void convertPaneToPropertyTab(const std::string& paneName);
void ensureVisibleCenterPane();
};

} // namespace

0 comments on commit 27442de

Please sign in to comment.