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();
128 void OnLoadModderLayout();
129
130 // Tool menu actions
131 void OnShowGlobalSearch();
134 void OnShowImGuiDemo();
135 void OnShowImGuiMetrics();
136 void OnShowMemoryEditor();
138
139 // ROM Analysis menu actions
140 void OnShowRomInfo();
141 void OnCreateBackup();
142 void OnValidateRom();
144 void OnTestSaveLoad();
145
146 // ZSCustomOverworld menu actions
147 void OnCheckRomVersion();
148 void OnUpgradeRom();
150
151 // Asar Integration menu actions
152 void OnToggleAsarPatch();
153 void OnLoadAsmFile();
154
155 // BPS Patch menu actions
156 void OnExportBpsPatch();
157 void OnApplyBpsPatch();
158
159 // Editor launch actions
161
162#ifdef YAZE_ENABLE_TESTING
163 void OnShowTestDashboard();
164 void OnRunAllTests();
165 void OnRunUnitTests();
166 void OnRunIntegrationTests();
167 void OnRunE2ETests();
168#endif
169
170#ifdef YAZE_WITH_GRPC
171 void OnStartCollaboration();
172 void OnJoinCollaboration();
173 void OnShowNetworkStatus();
174#endif
175
176 // Help menu actions
177 void OnShowAbout();
180 void OnShowCLIUsage();
182 void OnShowContributing();
183 void OnShowWhatsNew();
185
186 // Additional File menu actions
187 void OnShowSettings();
188 void OnQuit();
189
190 private:
191 // References to coordinated managers
200
201 // Optional dependencies for advanced features
205
206 // Menu state
208
209 // "Save Snapshot As..." modal state (lives here because the menu owns the
210 // modal open/close flow; implementation stays in menu_orchestrator.cc).
213
214 // Helper methods for menu construction
215 void AddFileMenuItems();
216 void AddEditMenuItems();
217 void AddViewMenuItems();
219 void AddLayoutMenuItems();
220 void AddPanelsMenuItems(); // Top-level panels menu items
221 void AddToolsMenuItems(); // Also contains former Debug menu items
222 void AddSearchMenuItems();
227 void AddTestingMenuItems();
228#ifdef YAZE_WITH_GRPC
229 void AddCollaborationMenuItems();
230#endif
231 // Submenus that live inside the top-level Windows menu.
232 void AddSessionsSubmenu();
233 void AddLayoutSubmenu();
234 void AddSidebarSubmenu();
235 void AddHelpMenuItems();
236
237 // Menu item validation helpers
238 bool CanSaveRom() const;
239 bool CanSaveProject() const;
240 bool HasActiveRom() const;
241 bool HasActiveProject() const;
242 bool HasProjectFile() const;
243 bool HasCurrentEditor() const;
244 bool HasMultipleSessions() const;
245
246 // Menu item text generation
247 std::string GetRomFilename() const;
248 std::string GetProjectName() const;
249 std::string GetCurrentEditorName() const;
250
251 // Shortcut key management
252 std::string GetShortcutForAction(const std::string& action) const;
254};
255
256} // namespace editor
257} // namespace yaze
258
259#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.