refactor(editor): streamline window management in EditorManager

- Removed redundant window management methods from EditorManager, reducing code bloat and improving maintainability.
- Inline delegation for window management functions has been implemented in the header file, enhancing performance and clarity.
- Updated MenuOrchestrator to include new commands for showing the command palette, memory editor, and resource label manager, improving user interaction.

Benefits:
- Simplifies the EditorManager class, leading to a more organized codebase.
- Enhances user experience by providing quick access to additional functionalities through the menu system.
This commit is contained in:
scawful
2025-10-15 01:12:44 -04:00
parent a8ae108e8a
commit 37a33fe25f
4 changed files with 145 additions and 74 deletions

View File

@@ -713,7 +713,7 @@ void EditorManager::Initialize(gfx::IRenderer* renderer,
std::vector<ImGuiKey>{ImGuiKey_O, ImGuiMod_Ctrl, ImGuiMod_Shift},
[this]() { LoadWorkspaceLayout(); });
context_.shortcut_manager.RegisterShortcut(
"Maximize Window", ImGuiKey_F11, [this]() { MaximizeCurrentWindow(); });
"Maximize Window", ImGuiKey_F11, [this]() { workspace_manager_.MaximizeCurrentWindow(); });
}
void EditorManager::OpenEditorAndCardsFromFlags(const std::string& editor_name,
@@ -2365,51 +2365,7 @@ std::string EditorManager::GenerateUniqueEditorTitle(
return std::string(base_name);
}
void EditorManager::ResetWorkspaceLayout() {
// Show confirmation popup first, then delegate to WindowDelegate
popup_manager_->Show("Layout Reset Confirm");
window_delegate_.ResetWorkspaceLayout();
}
void EditorManager::SaveWorkspaceLayout() {
window_delegate_.SaveWorkspaceLayout();
toast_manager_.Show("Workspace layout saved", editor::ToastType::kSuccess);
}
void EditorManager::LoadWorkspaceLayout() {
window_delegate_.LoadWorkspaceLayout();
toast_manager_.Show("Workspace layout loaded", editor::ToastType::kSuccess);
}
void EditorManager::ShowAllWindows() {
// Delegate to UICoordinator for clean separation of concerns
if (ui_coordinator_) {
ui_coordinator_->ShowAllWindows();
}
}
void EditorManager::HideAllWindows() {
// Delegate to UICoordinator for clean separation of concerns
if (ui_coordinator_) {
ui_coordinator_->HideAllWindows();
}
}
void EditorManager::MaximizeCurrentWindow() {
// Delegate to WindowDelegate
// Note: This requires tracking the current focused window
toast_manager_.Show("Current window maximized", editor::ToastType::kInfo);
}
void EditorManager::RestoreAllWindows() {
// Restore all windows to normal size
toast_manager_.Show("All windows restored", editor::ToastType::kInfo);
}
void EditorManager::CloseAllFloatingWindows() {
// Close all floating (undocked) windows
toast_manager_.Show("All floating windows closed", editor::ToastType::kInfo);
}
// Window management methods removed - now inline in header for reduced bloat
void EditorManager::LoadDeveloperLayout() {
if (!current_editor_set_)