- Expanded MenuOrchestrator to include additional UI visibility controls and editor action delegations, improving user interaction and functionality. - Introduced methods for showing global search, performance dashboard, and ImGui metrics, along with editor actions like undo, redo, cut, copy, paste, and find. - Updated the EditorManager to support new functionalities, including session management and layout presets. Benefits: - Streamlines user experience by providing quick access to essential features and enhancing the overall architecture of the editor. - Improves maintainability by clearly defining roles for UI and editor operations within the MenuOrchestrator.
759 lines
22 KiB
C++
759 lines
22 KiB
C++
#include "menu_orchestrator.h"
|
|
|
|
#include "absl/strings/str_format.h"
|
|
#include "app/editor/editor.h"
|
|
#include "app/editor/editor_manager.h"
|
|
#include "app/editor/system/editor_registry.h"
|
|
#include "app/editor/system/popup_manager.h"
|
|
#include "app/editor/system/project_manager.h"
|
|
#include "app/editor/system/rom_file_manager.h"
|
|
#include "app/editor/system/session_coordinator.h"
|
|
#include "app/editor/system/toast_manager.h"
|
|
#include "app/editor/ui/menu_builder.h"
|
|
#include "app/gui/core/icons.h"
|
|
#include "app/rom.h"
|
|
|
|
namespace yaze {
|
|
namespace editor {
|
|
|
|
MenuOrchestrator::MenuOrchestrator(
|
|
EditorManager* editor_manager,
|
|
MenuBuilder& menu_builder,
|
|
RomFileManager& rom_manager,
|
|
ProjectManager& project_manager,
|
|
EditorRegistry& editor_registry,
|
|
SessionCoordinator& session_coordinator,
|
|
ToastManager& toast_manager,
|
|
PopupManager& popup_manager)
|
|
: editor_manager_(editor_manager),
|
|
menu_builder_(menu_builder),
|
|
rom_manager_(rom_manager),
|
|
project_manager_(project_manager),
|
|
editor_registry_(editor_registry),
|
|
session_coordinator_(session_coordinator),
|
|
toast_manager_(toast_manager),
|
|
popup_manager_(popup_manager) {
|
|
}
|
|
|
|
void MenuOrchestrator::BuildMainMenu() {
|
|
ClearMenu();
|
|
|
|
// Build all menu sections in order
|
|
BuildFileMenu();
|
|
BuildEditMenu();
|
|
BuildViewMenu();
|
|
BuildToolsMenu();
|
|
BuildWindowMenu();
|
|
BuildHelpMenu();
|
|
|
|
// Draw the constructed menu
|
|
menu_builder_.Draw();
|
|
|
|
menu_needs_refresh_ = false;
|
|
}
|
|
|
|
void MenuOrchestrator::BuildFileMenu() {
|
|
menu_builder_.BeginMenu("File");
|
|
AddFileMenuItems();
|
|
menu_builder_.EndMenu();
|
|
}
|
|
|
|
void MenuOrchestrator::AddFileMenuItems() {
|
|
// ROM Operations
|
|
menu_builder_
|
|
.Item("Open ROM", ICON_MD_FILE_OPEN,
|
|
[this]() { OnOpenRom(); }, "Ctrl+O")
|
|
.Item("Save ROM", ICON_MD_SAVE,
|
|
[this]() { OnSaveRom(); }, "Ctrl+S",
|
|
[this]() { return CanSaveRom(); })
|
|
.Item("Save As...", ICON_MD_SAVE_AS,
|
|
[this]() { OnSaveRomAs(); }, nullptr,
|
|
[this]() { return CanSaveRom(); })
|
|
.Separator();
|
|
|
|
// Project Operations
|
|
menu_builder_
|
|
.Item("New Project", ICON_MD_CREATE_NEW_FOLDER,
|
|
[this]() { OnCreateProject(); })
|
|
.Item("Open Project", ICON_MD_FOLDER_OPEN,
|
|
[this]() { OnOpenProject(); })
|
|
.Item("Save Project", ICON_MD_SAVE,
|
|
[this]() { OnSaveProject(); }, nullptr,
|
|
[this]() { return CanSaveProject(); })
|
|
.Item("Save Project As...", ICON_MD_SAVE_AS,
|
|
[this]() { OnSaveProjectAs(); }, nullptr,
|
|
[this]() { return CanSaveProject(); })
|
|
.Separator();
|
|
|
|
// ROM Information and Validation
|
|
menu_builder_
|
|
.Item("ROM Information", ICON_MD_INFO,
|
|
[this]() { OnShowRomInfo(); }, nullptr,
|
|
[this]() { return HasActiveRom(); })
|
|
.Item("Create Backup", ICON_MD_BACKUP,
|
|
[this]() { OnCreateBackup(); }, nullptr,
|
|
[this]() { return HasActiveRom(); })
|
|
.Item("Validate ROM", ICON_MD_CHECK_CIRCLE,
|
|
[this]() { OnValidateRom(); }, nullptr,
|
|
[this]() { return HasActiveRom(); })
|
|
.Separator();
|
|
|
|
// Settings and Quit
|
|
menu_builder_
|
|
.Item("Settings", ICON_MD_SETTINGS,
|
|
[this]() { OnShowSettings(); })
|
|
.Separator()
|
|
.Item("Quit", ICON_MD_EXIT_TO_APP,
|
|
[this]() { OnQuit(); }, "Ctrl+Q");
|
|
}
|
|
|
|
void MenuOrchestrator::BuildEditMenu() {
|
|
menu_builder_.BeginMenu("Edit");
|
|
AddEditMenuItems();
|
|
menu_builder_.EndMenu();
|
|
}
|
|
|
|
void MenuOrchestrator::AddEditMenuItems() {
|
|
// Undo/Redo operations - delegate to current editor
|
|
menu_builder_
|
|
.Item("Undo", ICON_MD_UNDO,
|
|
[this]() { OnUndo(); }, "Ctrl+Z",
|
|
[this]() { return HasCurrentEditor(); })
|
|
.Item("Redo", ICON_MD_REDO,
|
|
[this]() { OnRedo(); }, "Ctrl+Y",
|
|
[this]() { return HasCurrentEditor(); })
|
|
.Separator();
|
|
|
|
// Clipboard operations - delegate to current editor
|
|
menu_builder_
|
|
.Item("Cut", ICON_MD_CONTENT_CUT,
|
|
[this]() { OnCut(); }, "Ctrl+X",
|
|
[this]() { return HasCurrentEditor(); })
|
|
.Item("Copy", ICON_MD_CONTENT_COPY,
|
|
[this]() { OnCopy(); }, "Ctrl+C",
|
|
[this]() { return HasCurrentEditor(); })
|
|
.Item("Paste", ICON_MD_CONTENT_PASTE,
|
|
[this]() { OnPaste(); }, "Ctrl+V",
|
|
[this]() { return HasCurrentEditor(); })
|
|
.Separator();
|
|
|
|
// Search operations
|
|
menu_builder_
|
|
.Item("Find", ICON_MD_SEARCH,
|
|
[this]() { OnFind(); }, "Ctrl+F",
|
|
[this]() { return HasCurrentEditor(); })
|
|
.Item("Find in Files", ICON_MD_SEARCH,
|
|
[this]() { OnShowGlobalSearch(); }, "Ctrl+Shift+F");
|
|
}
|
|
|
|
void MenuOrchestrator::BuildViewMenu() {
|
|
menu_builder_.BeginMenu("View");
|
|
AddViewMenuItems();
|
|
menu_builder_.EndMenu();
|
|
}
|
|
|
|
void MenuOrchestrator::AddViewMenuItems() {
|
|
// Editor Selection
|
|
menu_builder_
|
|
.Item("Editor Selection", ICON_MD_DASHBOARD,
|
|
[this]() { OnShowEditorSelection(); }, "Ctrl+E")
|
|
.Separator();
|
|
|
|
// Individual Editor Shortcuts
|
|
menu_builder_
|
|
.Item("Overworld", ICON_MD_MAP,
|
|
[this]() { OnSwitchToEditor(EditorType::kOverworld); }, "Ctrl+1")
|
|
.Item("Dungeon", ICON_MD_CASTLE,
|
|
[this]() { OnSwitchToEditor(EditorType::kDungeon); }, "Ctrl+2")
|
|
.Item("Graphics", ICON_MD_IMAGE,
|
|
[this]() { OnSwitchToEditor(EditorType::kGraphics); }, "Ctrl+3")
|
|
.Item("Sprites", ICON_MD_TOYS,
|
|
[this]() { OnSwitchToEditor(EditorType::kSprite); }, "Ctrl+4")
|
|
.Item("Messages", ICON_MD_CHAT_BUBBLE,
|
|
[this]() { OnSwitchToEditor(EditorType::kMessage); }, "Ctrl+5")
|
|
.Item("Music", ICON_MD_MUSIC_NOTE,
|
|
[this]() { OnSwitchToEditor(EditorType::kMusic); }, "Ctrl+6")
|
|
.Item("Palettes", ICON_MD_PALETTE,
|
|
[this]() { OnSwitchToEditor(EditorType::kPalette); }, "Ctrl+7")
|
|
.Item("Screens", ICON_MD_TV,
|
|
[this]() { OnSwitchToEditor(EditorType::kScreen); }, "Ctrl+8")
|
|
.Item("Hex Editor", ICON_MD_DATA_ARRAY,
|
|
[this]() { OnSwitchToEditor(EditorType::kHex); }, "Ctrl+9")
|
|
.Item("Assembly", ICON_MD_CODE,
|
|
[this]() { OnSwitchToEditor(EditorType::kAssembly); }, "Ctrl+0")
|
|
.Separator();
|
|
|
|
// Display Settings
|
|
menu_builder_
|
|
.Item("Display Settings", ICON_MD_DISPLAY_SETTINGS,
|
|
[this]() { OnShowDisplaySettings(); });
|
|
}
|
|
|
|
void MenuOrchestrator::BuildToolsMenu() {
|
|
menu_builder_.BeginMenu("Tools");
|
|
AddToolsMenuItems();
|
|
menu_builder_.EndMenu();
|
|
}
|
|
|
|
void MenuOrchestrator::AddToolsMenuItems() {
|
|
// Development Tools
|
|
menu_builder_
|
|
.Item("Global Search", ICON_MD_SEARCH,
|
|
[this]() { OnShowGlobalSearch(); }, "Ctrl+Shift+F")
|
|
.Item("Performance Dashboard", ICON_MD_SPEED,
|
|
[this]() { OnShowPerformanceDashboard(); })
|
|
.Separator();
|
|
|
|
// Debug Tools
|
|
menu_builder_
|
|
.Item("ImGui Demo", ICON_MD_BUG_REPORT,
|
|
[this]() { OnShowImGuiDemo(); })
|
|
.Item("ImGui Metrics", ICON_MD_ANALYTICS,
|
|
[this]() { OnShowImGuiMetrics(); });
|
|
}
|
|
|
|
void MenuOrchestrator::BuildWindowMenu() {
|
|
menu_builder_.BeginMenu("Window");
|
|
AddWindowMenuItems();
|
|
menu_builder_.EndMenu();
|
|
}
|
|
|
|
void MenuOrchestrator::AddWindowMenuItems() {
|
|
// Sessions Submenu
|
|
menu_builder_
|
|
.BeginSubMenu("Sessions", ICON_MD_TAB)
|
|
.Item("New Session", ICON_MD_ADD,
|
|
[this]() { OnCreateNewSession(); }, "Ctrl+Shift+N")
|
|
.Item("Duplicate Session", ICON_MD_CONTENT_COPY,
|
|
[this]() { OnDuplicateCurrentSession(); }, nullptr,
|
|
[this]() { return HasActiveRom(); })
|
|
.Item("Close Session", ICON_MD_CLOSE,
|
|
[this]() { OnCloseCurrentSession(); }, "Ctrl+Shift+W",
|
|
[this]() { return HasMultipleSessions(); })
|
|
.Separator()
|
|
.Item("Session Switcher", ICON_MD_SWITCH_ACCOUNT,
|
|
[this]() { OnShowSessionSwitcher(); }, "Ctrl+Tab",
|
|
[this]() { return HasMultipleSessions(); })
|
|
.Item("Session Manager", ICON_MD_VIEW_LIST,
|
|
[this]() { OnShowSessionManager(); })
|
|
.EndMenu()
|
|
.Separator();
|
|
|
|
// Layout Management
|
|
menu_builder_
|
|
.Item("Save Layout", ICON_MD_SAVE,
|
|
[this]() { OnSaveWorkspaceLayout(); }, "Ctrl+Shift+S")
|
|
.Item("Load Layout", ICON_MD_FOLDER_OPEN,
|
|
[this]() { OnLoadWorkspaceLayout(); }, "Ctrl+Shift+O")
|
|
.Item("Reset Layout", ICON_MD_RESET_TV,
|
|
[this]() { OnResetWorkspaceLayout(); })
|
|
.Item("Layout Presets", ICON_MD_BOOKMARK,
|
|
[this]() { OnShowLayoutPresets(); })
|
|
.Separator();
|
|
|
|
// Window Visibility
|
|
menu_builder_
|
|
.Item("Show All Windows", ICON_MD_VISIBILITY,
|
|
[this]() { OnShowAllWindows(); })
|
|
.Item("Hide All Windows", ICON_MD_VISIBILITY_OFF,
|
|
[this]() { OnHideAllWindows(); })
|
|
.Separator();
|
|
|
|
// Workspace Presets
|
|
menu_builder_
|
|
.Item("Developer Layout", ICON_MD_DEVELOPER_MODE,
|
|
[this]() { OnLoadDeveloperLayout(); })
|
|
.Item("Designer Layout", ICON_MD_DESIGN_SERVICES,
|
|
[this]() { OnLoadDesignerLayout(); })
|
|
.Item("Modder Layout", ICON_MD_CONSTRUCTION,
|
|
[this]() { OnLoadModderLayout(); });
|
|
}
|
|
|
|
void MenuOrchestrator::BuildHelpMenu() {
|
|
menu_builder_.BeginMenu("Help");
|
|
AddHelpMenuItems();
|
|
menu_builder_.EndMenu();
|
|
}
|
|
|
|
void MenuOrchestrator::AddHelpMenuItems() {
|
|
menu_builder_
|
|
.Item("Getting Started", ICON_MD_PLAY_ARROW,
|
|
[this]() { OnShowGettingStarted(); })
|
|
.Item("User Guide", ICON_MD_HELP,
|
|
[this]() { OnShowUserGuide(); })
|
|
.Item("Keyboard Shortcuts", ICON_MD_KEYBOARD,
|
|
[this]() { OnShowKeyboardShortcuts(); })
|
|
.Separator()
|
|
.Item("Asar Integration", ICON_MD_CODE,
|
|
[this]() { OnShowAsarIntegration(); })
|
|
.Item("Build Instructions", ICON_MD_BUILD,
|
|
[this]() { OnShowBuildInstructions(); })
|
|
.Item("CLI Usage", ICON_MD_TERMINAL,
|
|
[this]() { OnShowCLIUsage(); })
|
|
.Separator()
|
|
.Item("Supported Features", ICON_MD_CHECK_CIRCLE,
|
|
[this]() { OnShowSupportedFeatures(); })
|
|
.Item("What's New", ICON_MD_NEW_RELEASES,
|
|
[this]() { OnShowWhatsNew(); })
|
|
.Separator()
|
|
.Item("Troubleshooting", ICON_MD_BUILD_CIRCLE,
|
|
[this]() { OnShowTroubleshooting(); })
|
|
.Item("Contributing", ICON_MD_VOLUNTEER_ACTIVISM,
|
|
[this]() { OnShowContributing(); })
|
|
.Separator()
|
|
.Item("About", ICON_MD_INFO,
|
|
[this]() { OnShowAbout(); }, "F1");
|
|
}
|
|
|
|
// Menu state management
|
|
void MenuOrchestrator::ClearMenu() {
|
|
menu_builder_.Clear();
|
|
}
|
|
|
|
void MenuOrchestrator::RefreshMenu() {
|
|
menu_needs_refresh_ = true;
|
|
}
|
|
|
|
// Menu item callbacks - delegate to appropriate managers
|
|
void MenuOrchestrator::OnOpenRom() {
|
|
// Delegate to EditorManager's LoadRom which handles session management
|
|
if (editor_manager_) {
|
|
auto status = editor_manager_->LoadRom();
|
|
if (!status.ok()) {
|
|
toast_manager_.Show(
|
|
absl::StrFormat("Failed to load ROM: %s", status.message()),
|
|
ToastType::kError);
|
|
}
|
|
}
|
|
}
|
|
|
|
void MenuOrchestrator::OnSaveRom() {
|
|
// Delegate to EditorManager's SaveRom which handles editor data saving
|
|
if (editor_manager_) {
|
|
auto status = editor_manager_->SaveRom();
|
|
if (!status.ok()) {
|
|
toast_manager_.Show(
|
|
absl::StrFormat("Failed to save ROM: %s", status.message()),
|
|
ToastType::kError);
|
|
} else {
|
|
toast_manager_.Show("ROM saved successfully", ToastType::kSuccess);
|
|
}
|
|
}
|
|
}
|
|
|
|
void MenuOrchestrator::OnSaveRomAs() {
|
|
// TODO: Show save dialog and delegate to rom_manager_
|
|
toast_manager_.Show("Save ROM As", ToastType::kInfo);
|
|
}
|
|
|
|
void MenuOrchestrator::OnCreateProject() {
|
|
// Delegate to EditorManager which handles the full project creation flow
|
|
if (editor_manager_) {
|
|
auto status = editor_manager_->CreateNewProject();
|
|
if (!status.ok()) {
|
|
toast_manager_.Show(
|
|
absl::StrFormat("Failed to create project: %s", status.message()),
|
|
ToastType::kError);
|
|
}
|
|
}
|
|
}
|
|
|
|
void MenuOrchestrator::OnOpenProject() {
|
|
// Delegate to EditorManager which handles ROM loading and session creation
|
|
if (editor_manager_) {
|
|
auto status = editor_manager_->OpenProject();
|
|
if (!status.ok()) {
|
|
toast_manager_.Show(
|
|
absl::StrFormat("Failed to open project: %s", status.message()),
|
|
ToastType::kError);
|
|
}
|
|
}
|
|
}
|
|
|
|
void MenuOrchestrator::OnSaveProject() {
|
|
// Delegate to EditorManager which updates project with current state
|
|
if (editor_manager_) {
|
|
auto status = editor_manager_->SaveProject();
|
|
if (!status.ok()) {
|
|
toast_manager_.Show(
|
|
absl::StrFormat("Failed to save project: %s", status.message()),
|
|
ToastType::kError);
|
|
} else {
|
|
toast_manager_.Show("Project saved successfully", ToastType::kSuccess);
|
|
}
|
|
}
|
|
}
|
|
|
|
void MenuOrchestrator::OnSaveProjectAs() {
|
|
// Delegate to EditorManager
|
|
if (editor_manager_) {
|
|
auto status = editor_manager_->SaveProjectAs();
|
|
if (!status.ok()) {
|
|
toast_manager_.Show(
|
|
absl::StrFormat("Failed to save project as: %s", status.message()),
|
|
ToastType::kError);
|
|
}
|
|
}
|
|
}
|
|
|
|
// Edit menu actions - delegate to current editor
|
|
void MenuOrchestrator::OnUndo() {
|
|
if (editor_manager_) {
|
|
auto* current_editor = editor_manager_->GetCurrentEditor();
|
|
if (current_editor) {
|
|
auto status = current_editor->Undo();
|
|
if (!status.ok()) {
|
|
toast_manager_.Show(absl::StrFormat("Undo failed: %s", status.message()),
|
|
ToastType::kError);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
void MenuOrchestrator::OnRedo() {
|
|
if (editor_manager_) {
|
|
auto* current_editor = editor_manager_->GetCurrentEditor();
|
|
if (current_editor) {
|
|
auto status = current_editor->Redo();
|
|
if (!status.ok()) {
|
|
toast_manager_.Show(absl::StrFormat("Redo failed: %s", status.message()),
|
|
ToastType::kError);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
void MenuOrchestrator::OnCut() {
|
|
if (editor_manager_) {
|
|
auto* current_editor = editor_manager_->GetCurrentEditor();
|
|
if (current_editor) {
|
|
auto status = current_editor->Cut();
|
|
if (!status.ok()) {
|
|
toast_manager_.Show(absl::StrFormat("Cut failed: %s", status.message()),
|
|
ToastType::kError);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
void MenuOrchestrator::OnCopy() {
|
|
if (editor_manager_) {
|
|
auto* current_editor = editor_manager_->GetCurrentEditor();
|
|
if (current_editor) {
|
|
auto status = current_editor->Copy();
|
|
if (!status.ok()) {
|
|
toast_manager_.Show(absl::StrFormat("Copy failed: %s", status.message()),
|
|
ToastType::kError);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
void MenuOrchestrator::OnPaste() {
|
|
if (editor_manager_) {
|
|
auto* current_editor = editor_manager_->GetCurrentEditor();
|
|
if (current_editor) {
|
|
auto status = current_editor->Paste();
|
|
if (!status.ok()) {
|
|
toast_manager_.Show(absl::StrFormat("Paste failed: %s", status.message()),
|
|
ToastType::kError);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
void MenuOrchestrator::OnFind() {
|
|
if (editor_manager_) {
|
|
auto* current_editor = editor_manager_->GetCurrentEditor();
|
|
if (current_editor) {
|
|
auto status = current_editor->Find();
|
|
if (!status.ok()) {
|
|
toast_manager_.Show(absl::StrFormat("Find failed: %s", status.message()),
|
|
ToastType::kError);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Editor-specific menu actions
|
|
void MenuOrchestrator::OnSwitchToEditor(EditorType editor_type) {
|
|
// Delegate to EditorManager which manages editor switching
|
|
if (editor_manager_) {
|
|
editor_manager_->SwitchToEditor(editor_type);
|
|
}
|
|
}
|
|
|
|
void MenuOrchestrator::OnShowEditorSelection() {
|
|
// Delegate to EditorManager
|
|
if (editor_manager_) {
|
|
editor_manager_->ShowEditorSelection();
|
|
}
|
|
}
|
|
|
|
void MenuOrchestrator::OnShowDisplaySettings() {
|
|
// Delegate to EditorManager
|
|
if (editor_manager_) {
|
|
editor_manager_->ShowDisplaySettings();
|
|
}
|
|
}
|
|
|
|
// Session management menu actions
|
|
void MenuOrchestrator::OnCreateNewSession() {
|
|
session_coordinator_.CreateNewSession();
|
|
}
|
|
|
|
void MenuOrchestrator::OnDuplicateCurrentSession() {
|
|
session_coordinator_.DuplicateCurrentSession();
|
|
}
|
|
|
|
void MenuOrchestrator::OnCloseCurrentSession() {
|
|
session_coordinator_.CloseCurrentSession();
|
|
}
|
|
|
|
void MenuOrchestrator::OnSwitchToSession(size_t session_index) {
|
|
session_coordinator_.SwitchToSession(session_index);
|
|
}
|
|
|
|
void MenuOrchestrator::OnShowSessionSwitcher() {
|
|
if (editor_manager_) {
|
|
editor_manager_->ShowSessionSwitcher();
|
|
}
|
|
}
|
|
|
|
void MenuOrchestrator::OnShowSessionManager() {
|
|
// TODO: Show session manager dialog
|
|
toast_manager_.Show("Session Manager", ToastType::kInfo);
|
|
}
|
|
|
|
// Window management menu actions
|
|
void MenuOrchestrator::OnShowAllWindows() {
|
|
// Delegate to EditorManager
|
|
if (editor_manager_) {
|
|
editor_manager_->ShowAllWindows();
|
|
}
|
|
}
|
|
|
|
void MenuOrchestrator::OnHideAllWindows() {
|
|
// Delegate to EditorManager
|
|
if (editor_manager_) {
|
|
editor_manager_->HideAllWindows();
|
|
}
|
|
}
|
|
|
|
void MenuOrchestrator::OnResetWorkspaceLayout() {
|
|
// Delegate to EditorManager
|
|
if (editor_manager_) {
|
|
editor_manager_->ResetWorkspaceLayout();
|
|
}
|
|
}
|
|
|
|
void MenuOrchestrator::OnSaveWorkspaceLayout() {
|
|
// Delegate to EditorManager
|
|
if (editor_manager_) {
|
|
editor_manager_->SaveWorkspaceLayout();
|
|
}
|
|
}
|
|
|
|
void MenuOrchestrator::OnLoadWorkspaceLayout() {
|
|
// Delegate to EditorManager
|
|
if (editor_manager_) {
|
|
editor_manager_->LoadWorkspaceLayout();
|
|
}
|
|
}
|
|
|
|
void MenuOrchestrator::OnShowLayoutPresets() {
|
|
// TODO: Show layout presets dialog
|
|
toast_manager_.Show("Layout Presets", ToastType::kInfo);
|
|
}
|
|
|
|
void MenuOrchestrator::OnLoadDeveloperLayout() {
|
|
if (editor_manager_) {
|
|
editor_manager_->LoadDeveloperLayout();
|
|
}
|
|
}
|
|
|
|
void MenuOrchestrator::OnLoadDesignerLayout() {
|
|
if (editor_manager_) {
|
|
editor_manager_->LoadDesignerLayout();
|
|
}
|
|
}
|
|
|
|
void MenuOrchestrator::OnLoadModderLayout() {
|
|
if (editor_manager_) {
|
|
editor_manager_->LoadModderLayout();
|
|
}
|
|
}
|
|
|
|
// Tool menu actions
|
|
void MenuOrchestrator::OnShowGlobalSearch() {
|
|
if (editor_manager_) {
|
|
editor_manager_->ShowGlobalSearch();
|
|
}
|
|
}
|
|
|
|
void MenuOrchestrator::OnShowPerformanceDashboard() {
|
|
if (editor_manager_) {
|
|
editor_manager_->ShowPerformanceDashboard();
|
|
}
|
|
}
|
|
|
|
void MenuOrchestrator::OnShowImGuiDemo() {
|
|
if (editor_manager_) {
|
|
editor_manager_->ShowImGuiDemo();
|
|
}
|
|
}
|
|
|
|
void MenuOrchestrator::OnShowImGuiMetrics() {
|
|
if (editor_manager_) {
|
|
editor_manager_->ShowImGuiMetrics();
|
|
}
|
|
}
|
|
|
|
// Help menu actions
|
|
void MenuOrchestrator::OnShowAbout() {
|
|
popup_manager_.Show("About");
|
|
}
|
|
|
|
void MenuOrchestrator::OnShowKeyboardShortcuts() {
|
|
popup_manager_.Show("Keyboard Shortcuts");
|
|
}
|
|
|
|
void MenuOrchestrator::OnShowUserGuide() {
|
|
popup_manager_.Show("User Guide");
|
|
}
|
|
|
|
void MenuOrchestrator::OnShowGettingStarted() {
|
|
popup_manager_.Show("Getting Started");
|
|
}
|
|
|
|
void MenuOrchestrator::OnShowAsarIntegration() {
|
|
popup_manager_.Show("Asar Integration");
|
|
}
|
|
|
|
void MenuOrchestrator::OnShowBuildInstructions() {
|
|
popup_manager_.Show("Build Instructions");
|
|
}
|
|
|
|
void MenuOrchestrator::OnShowCLIUsage() {
|
|
popup_manager_.Show("CLI Usage");
|
|
}
|
|
|
|
void MenuOrchestrator::OnShowTroubleshooting() {
|
|
popup_manager_.Show("Troubleshooting");
|
|
}
|
|
|
|
void MenuOrchestrator::OnShowContributing() {
|
|
popup_manager_.Show("Contributing");
|
|
}
|
|
|
|
void MenuOrchestrator::OnShowWhatsNew() {
|
|
popup_manager_.Show("Whats New v03");
|
|
}
|
|
|
|
void MenuOrchestrator::OnShowSupportedFeatures() {
|
|
popup_manager_.Show("Supported Features");
|
|
}
|
|
|
|
// Additional File menu actions
|
|
void MenuOrchestrator::OnShowRomInfo() {
|
|
popup_manager_.Show("ROM Information");
|
|
}
|
|
|
|
void MenuOrchestrator::OnCreateBackup() {
|
|
if (editor_manager_) {
|
|
// Create backup via ROM directly (from original implementation)
|
|
auto* rom = editor_manager_->GetCurrentRom();
|
|
if (rom && rom->is_loaded()) {
|
|
Rom::SaveSettings settings;
|
|
settings.backup = true;
|
|
settings.filename = rom->filename();
|
|
auto status = rom->SaveToFile(settings);
|
|
if (status.ok()) {
|
|
toast_manager_.Show("Backup created successfully", ToastType::kSuccess);
|
|
} else {
|
|
toast_manager_.Show(
|
|
absl::StrFormat("Backup failed: %s", status.message()),
|
|
ToastType::kError);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
void MenuOrchestrator::OnValidateRom() {
|
|
if (editor_manager_) {
|
|
auto status = rom_manager_.ValidateRom(editor_manager_->GetCurrentRom());
|
|
if (status.ok()) {
|
|
toast_manager_.Show("ROM validation passed", ToastType::kSuccess);
|
|
} else {
|
|
toast_manager_.Show(
|
|
absl::StrFormat("ROM validation failed: %s", status.message()),
|
|
ToastType::kError);
|
|
}
|
|
}
|
|
}
|
|
|
|
void MenuOrchestrator::OnShowSettings() {
|
|
// Activate settings editor
|
|
if (editor_manager_) {
|
|
editor_manager_->SwitchToEditor(EditorType::kSettings);
|
|
}
|
|
}
|
|
|
|
void MenuOrchestrator::OnQuit() {
|
|
if (editor_manager_) {
|
|
editor_manager_->Quit();
|
|
}
|
|
}
|
|
|
|
// Menu item validation helpers
|
|
bool MenuOrchestrator::CanSaveRom() const {
|
|
return rom_manager_.IsRomLoaded();
|
|
}
|
|
|
|
bool MenuOrchestrator::CanSaveProject() const {
|
|
return project_manager_.HasActiveProject();
|
|
}
|
|
|
|
bool MenuOrchestrator::HasActiveRom() const {
|
|
return rom_manager_.IsRomLoaded();
|
|
}
|
|
|
|
bool MenuOrchestrator::HasActiveProject() const {
|
|
return project_manager_.HasActiveProject();
|
|
}
|
|
|
|
bool MenuOrchestrator::HasCurrentEditor() const {
|
|
return editor_manager_ && editor_manager_->GetCurrentEditor() != nullptr;
|
|
}
|
|
|
|
bool MenuOrchestrator::HasMultipleSessions() const {
|
|
return session_coordinator_.HasMultipleSessions();
|
|
}
|
|
|
|
// Menu item text generation
|
|
std::string MenuOrchestrator::GetRomFilename() const {
|
|
return rom_manager_.GetRomFilename();
|
|
}
|
|
|
|
std::string MenuOrchestrator::GetProjectName() const {
|
|
return project_manager_.GetProjectName();
|
|
}
|
|
|
|
std::string MenuOrchestrator::GetCurrentEditorName() const {
|
|
// TODO: Get current editor name
|
|
return "Unknown Editor";
|
|
}
|
|
|
|
// Shortcut key management
|
|
std::string MenuOrchestrator::GetShortcutForAction(const std::string& action) const {
|
|
// TODO: Implement shortcut mapping
|
|
return "";
|
|
}
|
|
|
|
void MenuOrchestrator::RegisterGlobalShortcuts() {
|
|
// TODO: Register global keyboard shortcuts
|
|
}
|
|
|
|
} // namespace editor
|
|
} // namespace yaze
|