yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
menu_orchestrator.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_MENU_MENU_ORCHESTRATOR_H_
2#define YAZE_APP_EDITOR_MENU_MENU_ORCHESTRATOR_H_
3
4#include <functional>
5#include <string>
6
7#include "absl/status/status.h"
8#include "app/editor/editor.h"
13
14namespace yaze {
15namespace editor {
16
17// Forward declarations to avoid circular dependencies
18class EditorManager;
19class RomFileManager;
20class ProjectManager;
21class EditorRegistry;
22class WorkspaceWindowManager;
23class SessionCoordinator;
24class ToastManager;
25class PopupManager;
26
43 public:
44 // Constructor takes references to the managers it coordinates with
45 MenuOrchestrator(EditorManager* editor_manager, MenuBuilder& menu_builder,
46 RomFileManager& rom_manager, ProjectManager& project_manager,
47 EditorRegistry& editor_registry,
48 SessionCoordinator& session_coordinator,
49 ToastManager& toast_manager, PopupManager& popup_manager);
50 ~MenuOrchestrator() = default;
51
52 // Set optional dependencies for advanced features
54 window_manager_ = manager;
55 }
56 void SetStatusBar(StatusBar* bar) { status_bar_ = bar; }
57 void SetUserSettings(UserSettings* settings) { user_settings_ = settings; }
58
59 // Non-copyable due to reference members
62
63 // Main menu building interface
64 void BuildMainMenu();
65 void BuildFileMenu();
66 void BuildEditMenu();
67 void BuildViewMenu();
68 // Top-level "Windows" menu — panel toggles, sessions, and layout
69 // management. The legacy top-level "Window" menu has been folded in here as
70 // Sessions ▸ and Layout ▸ submenus.
71 void BuildPanelsMenu();
72 void BuildToolsMenu(); // Also contains former Debug menu items
73 void BuildHelpMenu();
74
75 // Menu state management
76 void ClearMenu();
77 void RefreshMenu();
78
79 // Menu item callbacks (delegated to appropriate managers)
80 void OnOpenRom();
81 void OnSaveRom();
82 void OnSaveRomAs();
83 void OnCreateProject();
84 void OnOpenProject();
85 void OnSaveProject();
86 void OnSaveProjectAs();
89
90 // Edit menu actions (delegate to current editor)
91 void OnUndo();
92 void OnRedo();
93 void OnCut();
94 void OnCopy();
95 void OnPaste();
96 void OnFind();
97
98 // Editor-specific menu actions
99 void OnSwitchToEditor(EditorType editor_type);
101 void OnShowDisplaySettings(); // Display settings popup
102 void OnShowHexEditor();
103 void OnShowPanelBrowser();
104 void OnShowPanelFinder();
105 void OnShowWelcomeScreen();
106
107#ifdef YAZE_BUILD_AGENT_UI
108 void OnShowAIAgent();
109 void OnShowProposalDrawer();
110#endif
111
112 // Session management menu actions
113 void OnCreateNewSession();
118
119 // Window management menu actions
120 void OnShowAllWindows();
121 void OnHideAllWindows();
125 void OnShowLayoutPresets();
129 void OnLoadModderLayout();
130
131 // Tool menu actions
132 void OnShowGlobalSearch();
135 void OnShowImGuiDemo();
136 void OnShowImGuiMetrics();
137 void OnShowMemoryEditor();
139
140 // ROM Analysis menu actions
141 void OnShowRomInfo();
142 void OnCreateBackup();
143 void OnValidateRom();
145 void OnTestSaveLoad();
146
147 // ZSCustomOverworld menu actions
148 void OnCheckRomVersion();
149 void OnUpgradeRom();
151
152 // Asar Integration menu actions
153 void OnToggleAsarPatch();
154 void OnLoadAsmFile();
155
156 // BPS Patch menu actions
157 void OnExportBpsPatch();
158 void OnApplyBpsPatch();
159
160 // Editor launch actions
162
163#ifdef YAZE_ENABLE_TESTING
164 void OnShowTestDashboard();
165 void OnRunAllTests();
166 void OnRunUnitTests();
167 void OnRunIntegrationTests();
168 void OnRunE2ETests();
169#endif
170
171#ifdef YAZE_WITH_GRPC
172 void OnStartCollaboration();
173 void OnJoinCollaboration();
174 void OnShowNetworkStatus();
175#endif
176
177 // Help menu actions
178 void OnShowAbout();
181 void OnShowCLIUsage();
183 void OnShowContributing();
184 void OnShowWhatsNew();
186
187 // Additional File menu actions
188 void OnShowSettings();
189 void OnQuit();
190
191 private:
192 // References to coordinated managers
201
202 // Optional dependencies for advanced features
206
207 // Menu state
209
210 // "Save Snapshot As..." modal state (lives here because the menu owns the
211 // modal open/close flow; implementation stays in menu_orchestrator.cc).
214
215 // Helper methods for menu construction
216 void AddFileMenuItems();
217 void AddEditMenuItems();
218 void AddViewMenuItems();
220 void AddLayoutMenuItems();
221 void AddPanelsMenuItems(); // Top-level panels menu items
222 void AddToolsMenuItems(); // Also contains former Debug menu items
223 void AddSearchMenuItems();
228 void AddTestingMenuItems();
229#ifdef YAZE_WITH_GRPC
230 void AddCollaborationMenuItems();
231#endif
232 // Submenus that live inside the top-level Windows menu.
233 void AddSessionsSubmenu();
234 void AddLayoutSubmenu();
235 void AddSidebarSubmenu();
236 void AddHelpMenuItems();
237
238 // Menu item validation helpers
239 bool CanSaveRom() const;
240 bool CanSaveProject() const;
241 bool HasActiveRom() const;
242 bool HasActiveProject() const;
243 bool HasProjectFile() const;
244 bool HasCurrentEditor() const;
245 bool HasMultipleSessions() const;
246
247 // Menu item text generation
248 std::string GetRomFilename() const;
249 std::string GetProjectName() const;
250 std::string GetCurrentEditorName() const;
251
252 // Shortcut key management
253 std::string GetShortcutForAction(const std::string& action) const;
255};
256
257} // namespace editor
258} // namespace yaze
259
260#endif // YAZE_APP_EDITOR_MENU_MENU_ORCHESTRATOR_H_
The EditorManager controls the main editor window and manages the various editor classes.
Manages editor types, categories, and lifecycle.
Fluent interface for building ImGui menus with icons.
Handles all menu building and UI coordination logic.
void SetUserSettings(UserSettings *settings)
void OnSwitchToEditor(EditorType editor_type)
SessionCoordinator & session_coordinator_
WorkspaceWindowManager * window_manager_
void SetStatusBar(StatusBar *bar)
MenuOrchestrator & operator=(const MenuOrchestrator &)=delete
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)
void SetWindowManager(WorkspaceWindowManager *manager)
std::string GetShortcutForAction(const std::string &action) const
MenuOrchestrator(const MenuOrchestrator &)=delete
Handles all project file operations with ROM-first workflow.
Handles all ROM file I/O operations.
High-level orchestrator for multi-session UI.
A session-aware status bar displayed at the bottom of the application.
Definition status_bar.h:54
Manages user preferences and settings persistence.
Central registry for all editor cards with session awareness and dependency injection.