refactor(editor): enhance MenuOrchestrator with new UI controls and editor actions
- 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.
This commit is contained in:
@@ -138,7 +138,7 @@ EditorManager::EditorManager()
|
|||||||
// Initialize MenuOrchestrator after SessionCoordinator is created
|
// Initialize MenuOrchestrator after SessionCoordinator is created
|
||||||
menu_orchestrator_ = std::make_unique<MenuOrchestrator>(
|
menu_orchestrator_ = std::make_unique<MenuOrchestrator>(
|
||||||
this, menu_builder_, rom_file_manager_, project_manager_, editor_registry_,
|
this, menu_builder_, rom_file_manager_, project_manager_, editor_registry_,
|
||||||
*session_coordinator_, toast_manager_);
|
*session_coordinator_, toast_manager_, *popup_manager_);
|
||||||
|
|
||||||
// Initialize UICoordinator after all other components are created
|
// Initialize UICoordinator after all other components are created
|
||||||
ui_coordinator_ = std::make_unique<UICoordinator>(
|
ui_coordinator_ = std::make_unique<UICoordinator>(
|
||||||
|
|||||||
@@ -146,6 +146,7 @@ class EditorManager {
|
|||||||
absl::Status SetCurrentRom(Rom* rom);
|
absl::Status SetCurrentRom(Rom* rom);
|
||||||
auto GetCurrentRom() -> Rom* { return current_rom_; }
|
auto GetCurrentRom() -> Rom* { return current_rom_; }
|
||||||
auto GetCurrentEditorSet() -> EditorSet* { return current_editor_set_; }
|
auto GetCurrentEditorSet() -> EditorSet* { return current_editor_set_; }
|
||||||
|
auto GetCurrentEditor() -> Editor* { return current_editor_; }
|
||||||
auto overworld() -> yaze::zelda3::Overworld* { return ¤t_editor_set_->overworld_editor_.overworld(); }
|
auto overworld() -> yaze::zelda3::Overworld* { return ¤t_editor_set_->overworld_editor_.overworld(); }
|
||||||
|
|
||||||
// Session management helpers
|
// Session management helpers
|
||||||
@@ -225,6 +226,21 @@ class EditorManager {
|
|||||||
std::string GenerateUniqueEditorTitle(EditorType type, size_t session_index) const;
|
std::string GenerateUniqueEditorTitle(EditorType type, size_t session_index) const;
|
||||||
bool HasDuplicateSession(const std::string& filepath);
|
bool HasDuplicateSession(const std::string& filepath);
|
||||||
void RenameSession(size_t index, const std::string& new_name);
|
void RenameSession(size_t index, const std::string& new_name);
|
||||||
|
void Quit() { quit_ = true; }
|
||||||
|
|
||||||
|
// UI visibility controls (public for MenuOrchestrator)
|
||||||
|
void ShowGlobalSearch() {
|
||||||
|
if (ui_coordinator_) ui_coordinator_->ShowGlobalSearch();
|
||||||
|
}
|
||||||
|
void ShowPerformanceDashboard() {
|
||||||
|
if (ui_coordinator_) ui_coordinator_->SetPerformanceDashboardVisible(true);
|
||||||
|
}
|
||||||
|
void ShowImGuiDemo() {
|
||||||
|
if (ui_coordinator_) ui_coordinator_->SetImGuiDemoVisible(true);
|
||||||
|
}
|
||||||
|
void ShowImGuiMetrics() {
|
||||||
|
if (ui_coordinator_) ui_coordinator_->SetImGuiMetricsVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
// ROM and Project operations (public for MenuOrchestrator)
|
// ROM and Project operations (public for MenuOrchestrator)
|
||||||
absl::Status LoadRom();
|
absl::Status LoadRom();
|
||||||
|
|||||||
@@ -4,12 +4,14 @@
|
|||||||
#include "app/editor/editor.h"
|
#include "app/editor/editor.h"
|
||||||
#include "app/editor/editor_manager.h"
|
#include "app/editor/editor_manager.h"
|
||||||
#include "app/editor/system/editor_registry.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/project_manager.h"
|
||||||
#include "app/editor/system/rom_file_manager.h"
|
#include "app/editor/system/rom_file_manager.h"
|
||||||
#include "app/editor/system/session_coordinator.h"
|
#include "app/editor/system/session_coordinator.h"
|
||||||
#include "app/editor/system/toast_manager.h"
|
#include "app/editor/system/toast_manager.h"
|
||||||
#include "app/editor/ui/menu_builder.h"
|
#include "app/editor/ui/menu_builder.h"
|
||||||
#include "app/gui/core/icons.h"
|
#include "app/gui/core/icons.h"
|
||||||
|
#include "app/rom.h"
|
||||||
|
|
||||||
namespace yaze {
|
namespace yaze {
|
||||||
namespace editor {
|
namespace editor {
|
||||||
@@ -21,14 +23,16 @@ MenuOrchestrator::MenuOrchestrator(
|
|||||||
ProjectManager& project_manager,
|
ProjectManager& project_manager,
|
||||||
EditorRegistry& editor_registry,
|
EditorRegistry& editor_registry,
|
||||||
SessionCoordinator& session_coordinator,
|
SessionCoordinator& session_coordinator,
|
||||||
ToastManager& toast_manager)
|
ToastManager& toast_manager,
|
||||||
|
PopupManager& popup_manager)
|
||||||
: editor_manager_(editor_manager),
|
: editor_manager_(editor_manager),
|
||||||
menu_builder_(menu_builder),
|
menu_builder_(menu_builder),
|
||||||
rom_manager_(rom_manager),
|
rom_manager_(rom_manager),
|
||||||
project_manager_(project_manager),
|
project_manager_(project_manager),
|
||||||
editor_registry_(editor_registry),
|
editor_registry_(editor_registry),
|
||||||
session_coordinator_(session_coordinator),
|
session_coordinator_(session_coordinator),
|
||||||
toast_manager_(toast_manager) {
|
toast_manager_(toast_manager),
|
||||||
|
popup_manager_(popup_manager) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuOrchestrator::BuildMainMenu() {
|
void MenuOrchestrator::BuildMainMenu() {
|
||||||
@@ -84,50 +88,23 @@ void MenuOrchestrator::AddFileMenuItems() {
|
|||||||
// ROM Information and Validation
|
// ROM Information and Validation
|
||||||
menu_builder_
|
menu_builder_
|
||||||
.Item("ROM Information", ICON_MD_INFO,
|
.Item("ROM Information", ICON_MD_INFO,
|
||||||
[this]() {
|
[this]() { OnShowRomInfo(); }, nullptr,
|
||||||
// TODO: Show ROM info popup
|
|
||||||
toast_manager_.Show("ROM Information", ToastType::kInfo);
|
|
||||||
}, nullptr,
|
|
||||||
[this]() { return HasActiveRom(); })
|
[this]() { return HasActiveRom(); })
|
||||||
.Item("Create Backup", ICON_MD_BACKUP,
|
.Item("Create Backup", ICON_MD_BACKUP,
|
||||||
[this]() {
|
[this]() { OnCreateBackup(); }, nullptr,
|
||||||
if (HasActiveRom()) {
|
|
||||||
auto status = rom_manager_.CreateBackup();
|
|
||||||
if (!status.ok()) {
|
|
||||||
toast_manager_.Show(
|
|
||||||
absl::StrFormat("Backup failed: %s", status.message()),
|
|
||||||
ToastType::kError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, nullptr,
|
|
||||||
[this]() { return HasActiveRom(); })
|
[this]() { return HasActiveRom(); })
|
||||||
.Item("Validate ROM", ICON_MD_CHECK_CIRCLE,
|
.Item("Validate ROM", ICON_MD_CHECK_CIRCLE,
|
||||||
[this]() {
|
[this]() { OnValidateRom(); }, nullptr,
|
||||||
if (HasActiveRom()) {
|
|
||||||
auto status = rom_manager_.ValidateRom();
|
|
||||||
if (!status.ok()) {
|
|
||||||
toast_manager_.Show(
|
|
||||||
absl::StrFormat("Validation failed: %s", status.message()),
|
|
||||||
ToastType::kError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, nullptr,
|
|
||||||
[this]() { return HasActiveRom(); })
|
[this]() { return HasActiveRom(); })
|
||||||
.Separator();
|
.Separator();
|
||||||
|
|
||||||
// Settings and Quit
|
// Settings and Quit
|
||||||
menu_builder_
|
menu_builder_
|
||||||
.Item("Settings", ICON_MD_SETTINGS,
|
.Item("Settings", ICON_MD_SETTINGS,
|
||||||
[this]() {
|
[this]() { OnShowSettings(); })
|
||||||
// TODO: Show settings editor
|
|
||||||
toast_manager_.Show("Settings", ToastType::kInfo);
|
|
||||||
})
|
|
||||||
.Separator()
|
.Separator()
|
||||||
.Item("Quit", ICON_MD_EXIT_TO_APP,
|
.Item("Quit", ICON_MD_EXIT_TO_APP,
|
||||||
[this]() {
|
[this]() { OnQuit(); }, "Ctrl+Q");
|
||||||
// TODO: Signal quit to EditorManager
|
|
||||||
toast_manager_.Show("Quit requested", ToastType::kInfo);
|
|
||||||
}, "Ctrl+Q");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuOrchestrator::BuildEditMenu() {
|
void MenuOrchestrator::BuildEditMenu() {
|
||||||
@@ -137,51 +114,33 @@ void MenuOrchestrator::BuildEditMenu() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MenuOrchestrator::AddEditMenuItems() {
|
void MenuOrchestrator::AddEditMenuItems() {
|
||||||
// Undo/Redo operations
|
// Undo/Redo operations - delegate to current editor
|
||||||
menu_builder_
|
menu_builder_
|
||||||
.Item("Undo", ICON_MD_UNDO,
|
.Item("Undo", ICON_MD_UNDO,
|
||||||
[this]() {
|
[this]() { OnUndo(); }, "Ctrl+Z",
|
||||||
// TODO: Delegate to current editor
|
|
||||||
toast_manager_.Show("Undo", ToastType::kInfo);
|
|
||||||
}, "Ctrl+Z",
|
|
||||||
[this]() { return HasCurrentEditor(); })
|
[this]() { return HasCurrentEditor(); })
|
||||||
.Item("Redo", ICON_MD_REDO,
|
.Item("Redo", ICON_MD_REDO,
|
||||||
[this]() {
|
[this]() { OnRedo(); }, "Ctrl+Y",
|
||||||
// TODO: Delegate to current editor
|
|
||||||
toast_manager_.Show("Redo", ToastType::kInfo);
|
|
||||||
}, "Ctrl+Y",
|
|
||||||
[this]() { return HasCurrentEditor(); })
|
[this]() { return HasCurrentEditor(); })
|
||||||
.Separator();
|
.Separator();
|
||||||
|
|
||||||
// Clipboard operations
|
// Clipboard operations - delegate to current editor
|
||||||
menu_builder_
|
menu_builder_
|
||||||
.Item("Cut", ICON_MD_CONTENT_CUT,
|
.Item("Cut", ICON_MD_CONTENT_CUT,
|
||||||
[this]() {
|
[this]() { OnCut(); }, "Ctrl+X",
|
||||||
// TODO: Delegate to current editor
|
|
||||||
toast_manager_.Show("Cut", ToastType::kInfo);
|
|
||||||
}, "Ctrl+X",
|
|
||||||
[this]() { return HasCurrentEditor(); })
|
[this]() { return HasCurrentEditor(); })
|
||||||
.Item("Copy", ICON_MD_CONTENT_COPY,
|
.Item("Copy", ICON_MD_CONTENT_COPY,
|
||||||
[this]() {
|
[this]() { OnCopy(); }, "Ctrl+C",
|
||||||
// TODO: Delegate to current editor
|
|
||||||
toast_manager_.Show("Copy", ToastType::kInfo);
|
|
||||||
}, "Ctrl+C",
|
|
||||||
[this]() { return HasCurrentEditor(); })
|
[this]() { return HasCurrentEditor(); })
|
||||||
.Item("Paste", ICON_MD_CONTENT_PASTE,
|
.Item("Paste", ICON_MD_CONTENT_PASTE,
|
||||||
[this]() {
|
[this]() { OnPaste(); }, "Ctrl+V",
|
||||||
// TODO: Delegate to current editor
|
|
||||||
toast_manager_.Show("Paste", ToastType::kInfo);
|
|
||||||
}, "Ctrl+V",
|
|
||||||
[this]() { return HasCurrentEditor(); })
|
[this]() { return HasCurrentEditor(); })
|
||||||
.Separator();
|
.Separator();
|
||||||
|
|
||||||
// Search operations
|
// Search operations
|
||||||
menu_builder_
|
menu_builder_
|
||||||
.Item("Find", ICON_MD_SEARCH,
|
.Item("Find", ICON_MD_SEARCH,
|
||||||
[this]() {
|
[this]() { OnFind(); }, "Ctrl+F",
|
||||||
// TODO: Delegate to current editor
|
|
||||||
toast_manager_.Show("Find", ToastType::kInfo);
|
|
||||||
}, "Ctrl+F",
|
|
||||||
[this]() { return HasCurrentEditor(); })
|
[this]() { return HasCurrentEditor(); })
|
||||||
.Item("Find in Files", ICON_MD_SEARCH,
|
.Item("Find in Files", ICON_MD_SEARCH,
|
||||||
[this]() { OnShowGlobalSearch(); }, "Ctrl+Shift+F");
|
[this]() { OnShowGlobalSearch(); }, "Ctrl+Shift+F");
|
||||||
@@ -260,7 +219,39 @@ void MenuOrchestrator::BuildWindowMenu() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MenuOrchestrator::AddWindowMenuItems() {
|
void MenuOrchestrator::AddWindowMenuItems() {
|
||||||
// Window Management
|
// 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_
|
menu_builder_
|
||||||
.Item("Show All Windows", ICON_MD_VISIBILITY,
|
.Item("Show All Windows", ICON_MD_VISIBILITY,
|
||||||
[this]() { OnShowAllWindows(); })
|
[this]() { OnShowAllWindows(); })
|
||||||
@@ -268,26 +259,14 @@ void MenuOrchestrator::AddWindowMenuItems() {
|
|||||||
[this]() { OnHideAllWindows(); })
|
[this]() { OnHideAllWindows(); })
|
||||||
.Separator();
|
.Separator();
|
||||||
|
|
||||||
// Layout Management
|
// Workspace Presets
|
||||||
menu_builder_
|
menu_builder_
|
||||||
.Item("Reset Layout", ICON_MD_RESTORE,
|
.Item("Developer Layout", ICON_MD_DEVELOPER_MODE,
|
||||||
[this]() { OnResetWorkspaceLayout(); })
|
[this]() { OnLoadDeveloperLayout(); })
|
||||||
.Item("Save Layout", ICON_MD_SAVE,
|
.Item("Designer Layout", ICON_MD_DESIGN_SERVICES,
|
||||||
[this]() { OnSaveWorkspaceLayout(); })
|
[this]() { OnLoadDesignerLayout(); })
|
||||||
.Item("Load Layout", ICON_MD_FOLDER_OPEN,
|
.Item("Modder Layout", ICON_MD_CONSTRUCTION,
|
||||||
[this]() { OnLoadWorkspaceLayout(); });
|
[this]() { OnLoadModderLayout(); });
|
||||||
|
|
||||||
// Session Management (if multiple sessions)
|
|
||||||
if (HasMultipleSessions()) {
|
|
||||||
menu_builder_
|
|
||||||
.Separator()
|
|
||||||
.Item("New Session", ICON_MD_ADD,
|
|
||||||
[this]() { OnCreateNewSession(); })
|
|
||||||
.Item("Duplicate Session", ICON_MD_CONTENT_COPY,
|
|
||||||
[this]() { OnDuplicateCurrentSession(); })
|
|
||||||
.Item("Close Session", ICON_MD_CLOSE,
|
|
||||||
[this]() { OnCloseCurrentSession(); });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuOrchestrator::BuildHelpMenu() {
|
void MenuOrchestrator::BuildHelpMenu() {
|
||||||
@@ -298,13 +277,32 @@ void MenuOrchestrator::BuildHelpMenu() {
|
|||||||
|
|
||||||
void MenuOrchestrator::AddHelpMenuItems() {
|
void MenuOrchestrator::AddHelpMenuItems() {
|
||||||
menu_builder_
|
menu_builder_
|
||||||
|
.Item("Getting Started", ICON_MD_PLAY_ARROW,
|
||||||
|
[this]() { OnShowGettingStarted(); })
|
||||||
.Item("User Guide", ICON_MD_HELP,
|
.Item("User Guide", ICON_MD_HELP,
|
||||||
[this]() { OnShowUserGuide(); })
|
[this]() { OnShowUserGuide(); })
|
||||||
.Item("Keyboard Shortcuts", ICON_MD_KEYBOARD,
|
.Item("Keyboard Shortcuts", ICON_MD_KEYBOARD,
|
||||||
[this]() { OnShowKeyboardShortcuts(); })
|
[this]() { OnShowKeyboardShortcuts(); })
|
||||||
.Separator()
|
.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,
|
.Item("About", ICON_MD_INFO,
|
||||||
[this]() { OnShowAbout(); });
|
[this]() { OnShowAbout(); }, "F1");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Menu state management
|
// Menu state management
|
||||||
@@ -398,6 +396,85 @@ void MenuOrchestrator::OnSaveProjectAs() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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
|
// Editor-specific menu actions
|
||||||
void MenuOrchestrator::OnSwitchToEditor(EditorType editor_type) {
|
void MenuOrchestrator::OnSwitchToEditor(EditorType editor_type) {
|
||||||
// Delegate to EditorManager which manages editor switching
|
// Delegate to EditorManager which manages editor switching
|
||||||
@@ -437,6 +514,17 @@ void MenuOrchestrator::OnSwitchToSession(size_t session_index) {
|
|||||||
session_coordinator_.SwitchToSession(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
|
// Window management menu actions
|
||||||
void MenuOrchestrator::OnShowAllWindows() {
|
void MenuOrchestrator::OnShowAllWindows() {
|
||||||
// Delegate to EditorManager
|
// Delegate to EditorManager
|
||||||
@@ -473,41 +561,148 @@ void MenuOrchestrator::OnLoadWorkspaceLayout() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
// Tool menu actions
|
||||||
void MenuOrchestrator::OnShowGlobalSearch() {
|
void MenuOrchestrator::OnShowGlobalSearch() {
|
||||||
// TODO: Show global search dialog
|
if (editor_manager_) {
|
||||||
toast_manager_.Show("Global Search", ToastType::kInfo);
|
editor_manager_->ShowGlobalSearch();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuOrchestrator::OnShowPerformanceDashboard() {
|
void MenuOrchestrator::OnShowPerformanceDashboard() {
|
||||||
// TODO: Show performance dashboard
|
if (editor_manager_) {
|
||||||
toast_manager_.Show("Performance Dashboard", ToastType::kInfo);
|
editor_manager_->ShowPerformanceDashboard();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuOrchestrator::OnShowImGuiDemo() {
|
void MenuOrchestrator::OnShowImGuiDemo() {
|
||||||
// TODO: Show ImGui demo
|
if (editor_manager_) {
|
||||||
toast_manager_.Show("ImGui Demo", ToastType::kInfo);
|
editor_manager_->ShowImGuiDemo();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuOrchestrator::OnShowImGuiMetrics() {
|
void MenuOrchestrator::OnShowImGuiMetrics() {
|
||||||
// TODO: Show ImGui metrics
|
if (editor_manager_) {
|
||||||
toast_manager_.Show("ImGui Metrics", ToastType::kInfo);
|
editor_manager_->ShowImGuiMetrics();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Help menu actions
|
// Help menu actions
|
||||||
void MenuOrchestrator::OnShowAbout() {
|
void MenuOrchestrator::OnShowAbout() {
|
||||||
// TODO: Show about dialog
|
popup_manager_.Show("About");
|
||||||
toast_manager_.Show("About YAZE", ToastType::kInfo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuOrchestrator::OnShowKeyboardShortcuts() {
|
void MenuOrchestrator::OnShowKeyboardShortcuts() {
|
||||||
// TODO: Show keyboard shortcuts dialog
|
popup_manager_.Show("Keyboard Shortcuts");
|
||||||
toast_manager_.Show("Keyboard Shortcuts", ToastType::kInfo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuOrchestrator::OnShowUserGuide() {
|
void MenuOrchestrator::OnShowUserGuide() {
|
||||||
// TODO: Show user guide
|
popup_manager_.Show("User Guide");
|
||||||
toast_manager_.Show("User Guide", ToastType::kInfo);
|
}
|
||||||
|
|
||||||
|
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
|
// Menu item validation helpers
|
||||||
@@ -528,8 +723,7 @@ bool MenuOrchestrator::HasActiveProject() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool MenuOrchestrator::HasCurrentEditor() const {
|
bool MenuOrchestrator::HasCurrentEditor() const {
|
||||||
// TODO: Check if there's a current active editor
|
return editor_manager_ && editor_manager_->GetCurrentEditor() != nullptr;
|
||||||
return true; // Placeholder
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MenuOrchestrator::HasMultipleSessions() const {
|
bool MenuOrchestrator::HasMultipleSessions() const {
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ class ProjectManager;
|
|||||||
class EditorRegistry;
|
class EditorRegistry;
|
||||||
class SessionCoordinator;
|
class SessionCoordinator;
|
||||||
class ToastManager;
|
class ToastManager;
|
||||||
|
class PopupManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class MenuOrchestrator
|
* @class MenuOrchestrator
|
||||||
@@ -44,7 +45,8 @@ class MenuOrchestrator {
|
|||||||
ProjectManager& project_manager,
|
ProjectManager& project_manager,
|
||||||
EditorRegistry& editor_registry,
|
EditorRegistry& editor_registry,
|
||||||
SessionCoordinator& session_coordinator,
|
SessionCoordinator& session_coordinator,
|
||||||
ToastManager& toast_manager);
|
ToastManager& toast_manager,
|
||||||
|
PopupManager& popup_manager);
|
||||||
~MenuOrchestrator() = default;
|
~MenuOrchestrator() = default;
|
||||||
|
|
||||||
// Non-copyable due to reference members
|
// Non-copyable due to reference members
|
||||||
@@ -73,6 +75,14 @@ class MenuOrchestrator {
|
|||||||
void OnSaveProject();
|
void OnSaveProject();
|
||||||
void OnSaveProjectAs();
|
void OnSaveProjectAs();
|
||||||
|
|
||||||
|
// Edit menu actions (delegate to current editor)
|
||||||
|
void OnUndo();
|
||||||
|
void OnRedo();
|
||||||
|
void OnCut();
|
||||||
|
void OnCopy();
|
||||||
|
void OnPaste();
|
||||||
|
void OnFind();
|
||||||
|
|
||||||
// Editor-specific menu actions
|
// Editor-specific menu actions
|
||||||
void OnSwitchToEditor(EditorType editor_type);
|
void OnSwitchToEditor(EditorType editor_type);
|
||||||
void OnShowEditorSelection();
|
void OnShowEditorSelection();
|
||||||
@@ -83,6 +93,8 @@ class MenuOrchestrator {
|
|||||||
void OnDuplicateCurrentSession();
|
void OnDuplicateCurrentSession();
|
||||||
void OnCloseCurrentSession();
|
void OnCloseCurrentSession();
|
||||||
void OnSwitchToSession(size_t session_index);
|
void OnSwitchToSession(size_t session_index);
|
||||||
|
void OnShowSessionSwitcher();
|
||||||
|
void OnShowSessionManager();
|
||||||
|
|
||||||
// Window management menu actions
|
// Window management menu actions
|
||||||
void OnShowAllWindows();
|
void OnShowAllWindows();
|
||||||
@@ -90,6 +102,10 @@ class MenuOrchestrator {
|
|||||||
void OnResetWorkspaceLayout();
|
void OnResetWorkspaceLayout();
|
||||||
void OnSaveWorkspaceLayout();
|
void OnSaveWorkspaceLayout();
|
||||||
void OnLoadWorkspaceLayout();
|
void OnLoadWorkspaceLayout();
|
||||||
|
void OnShowLayoutPresets();
|
||||||
|
void OnLoadDeveloperLayout();
|
||||||
|
void OnLoadDesignerLayout();
|
||||||
|
void OnLoadModderLayout();
|
||||||
|
|
||||||
// Tool menu actions
|
// Tool menu actions
|
||||||
void OnShowGlobalSearch();
|
void OnShowGlobalSearch();
|
||||||
@@ -101,6 +117,21 @@ class MenuOrchestrator {
|
|||||||
void OnShowAbout();
|
void OnShowAbout();
|
||||||
void OnShowKeyboardShortcuts();
|
void OnShowKeyboardShortcuts();
|
||||||
void OnShowUserGuide();
|
void OnShowUserGuide();
|
||||||
|
void OnShowGettingStarted();
|
||||||
|
void OnShowAsarIntegration();
|
||||||
|
void OnShowBuildInstructions();
|
||||||
|
void OnShowCLIUsage();
|
||||||
|
void OnShowTroubleshooting();
|
||||||
|
void OnShowContributing();
|
||||||
|
void OnShowWhatsNew();
|
||||||
|
void OnShowSupportedFeatures();
|
||||||
|
|
||||||
|
// Additional File menu actions
|
||||||
|
void OnShowRomInfo();
|
||||||
|
void OnCreateBackup();
|
||||||
|
void OnValidateRom();
|
||||||
|
void OnShowSettings();
|
||||||
|
void OnQuit();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// References to coordinated managers
|
// References to coordinated managers
|
||||||
@@ -111,6 +142,7 @@ class MenuOrchestrator {
|
|||||||
EditorRegistry& editor_registry_;
|
EditorRegistry& editor_registry_;
|
||||||
SessionCoordinator& session_coordinator_;
|
SessionCoordinator& session_coordinator_;
|
||||||
ToastManager& toast_manager_;
|
ToastManager& toast_manager_;
|
||||||
|
PopupManager& popup_manager_;
|
||||||
|
|
||||||
// Menu state
|
// Menu state
|
||||||
bool menu_needs_refresh_ = false;
|
bool menu_needs_refresh_ = false;
|
||||||
|
|||||||
@@ -171,12 +171,26 @@ std::string RomFileManager::GetRomTitle() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
absl::Status RomFileManager::ValidateRom() {
|
absl::Status RomFileManager::ValidateRom() {
|
||||||
if (!IsRomLoaded()) {
|
return ValidateRom(current_rom_);
|
||||||
return absl::FailedPreconditionError("No ROM loaded to validate");
|
}
|
||||||
|
|
||||||
|
absl::Status RomFileManager::ValidateRom(Rom* rom) {
|
||||||
|
if (!rom || !rom->is_loaded()) {
|
||||||
|
return absl::FailedPreconditionError("No valid ROM to validate");
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Implement ROM validation logic
|
// TODO: Implement ROM validation logic
|
||||||
// This would check ROM integrity, checksums, etc.
|
// This would check ROM integrity, checksums, expected data structures, etc.
|
||||||
|
|
||||||
|
// Basic validation: check if ROM size is reasonable
|
||||||
|
if (rom->size() < 512 * 1024 || rom->size() > 8 * 1024 * 1024) {
|
||||||
|
return absl::InvalidArgumentError("ROM size is outside expected range");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if ROM title is readable
|
||||||
|
if (rom->title().empty()) {
|
||||||
|
return absl::InvalidArgumentError("ROM title is empty or invalid");
|
||||||
|
}
|
||||||
|
|
||||||
if (toast_manager_) {
|
if (toast_manager_) {
|
||||||
toast_manager_->Show("ROM validation passed", ToastType::kSuccess);
|
toast_manager_->Show("ROM validation passed", ToastType::kSuccess);
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ class RomFileManager {
|
|||||||
|
|
||||||
// Validation and backup
|
// Validation and backup
|
||||||
absl::Status ValidateRom();
|
absl::Status ValidateRom();
|
||||||
|
absl::Status ValidateRom(Rom* rom); // Validate a specific ROM
|
||||||
absl::Status CreateBackup();
|
absl::Status CreateBackup();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
Reference in New Issue
Block a user