yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
menu_orchestrator.cc
Go to the documentation of this file.
1#include "menu_orchestrator.h"
2
3#include "absl/strings/str_format.h"
4#include "core/features.h"
5#include "app/editor/editor.h"
14#include "app/gui/core/icons.h"
15#include "app/rom.h"
17
18namespace yaze {
19namespace editor {
20
22 EditorManager* editor_manager,
23 MenuBuilder& menu_builder,
24 RomFileManager& rom_manager,
25 ProjectManager& project_manager,
26 EditorRegistry& editor_registry,
27 SessionCoordinator& session_coordinator,
28 ToastManager& toast_manager,
29 PopupManager& popup_manager)
30 : editor_manager_(editor_manager),
31 menu_builder_(menu_builder),
32 rom_manager_(rom_manager),
33 project_manager_(project_manager),
34 editor_registry_(editor_registry),
35 session_coordinator_(session_coordinator),
36 toast_manager_(toast_manager),
37 popup_manager_(popup_manager) {
38}
39
41 ClearMenu();
42
43 // Build all menu sections in order
48 BuildDebugMenu(); // Add Debug menu between Tools and Window
51
52 // Draw the constructed menu
54
55 menu_needs_refresh_ = false;
56}
57
63
65 // ROM Operations
67 .Item("Open ROM", ICON_MD_FILE_OPEN,
68 [this]() { OnOpenRom(); }, "Ctrl+O")
69 .Item("Save ROM", ICON_MD_SAVE,
70 [this]() { OnSaveRom(); }, "Ctrl+S",
71 [this]() { return CanSaveRom(); })
72 .Item("Save As...", ICON_MD_SAVE_AS,
73 [this]() { OnSaveRomAs(); }, nullptr,
74 [this]() { return CanSaveRom(); })
75 .Separator();
76
77 // Project Operations
79 .Item("New Project", ICON_MD_CREATE_NEW_FOLDER,
80 [this]() { OnCreateProject(); })
81 .Item("Open Project", ICON_MD_FOLDER_OPEN,
82 [this]() { OnOpenProject(); })
83 .Item("Save Project", ICON_MD_SAVE,
84 [this]() { OnSaveProject(); }, nullptr,
85 [this]() { return CanSaveProject(); })
86 .Item("Save Project As...", ICON_MD_SAVE_AS,
87 [this]() { OnSaveProjectAs(); }, nullptr,
88 [this]() { return CanSaveProject(); })
89 .Separator();
90
91 // ROM Information and Validation
93 .Item("ROM Information", ICON_MD_INFO,
94 [this]() { OnShowRomInfo(); }, nullptr,
95 [this]() { return HasActiveRom(); })
96 .Item("Create Backup", ICON_MD_BACKUP,
97 [this]() { OnCreateBackup(); }, nullptr,
98 [this]() { return HasActiveRom(); })
99 .Item("Validate ROM", ICON_MD_CHECK_CIRCLE,
100 [this]() { OnValidateRom(); }, nullptr,
101 [this]() { return HasActiveRom(); })
102 .Separator();
103
104 // Settings and Quit
106 .Item("Settings", ICON_MD_SETTINGS,
107 [this]() { OnShowSettings(); })
108 .Separator()
109 .Item("Quit", ICON_MD_EXIT_TO_APP,
110 [this]() { OnQuit(); }, "Ctrl+Q");
111}
112
118
120 // Undo/Redo operations - delegate to current editor
122 .Item("Undo", ICON_MD_UNDO,
123 [this]() { OnUndo(); }, "Ctrl+Z",
124 [this]() { return HasCurrentEditor(); })
125 .Item("Redo", ICON_MD_REDO,
126 [this]() { OnRedo(); }, "Ctrl+Y",
127 [this]() { return HasCurrentEditor(); })
128 .Separator();
129
130 // Clipboard operations - delegate to current editor
133 [this]() { OnCut(); }, "Ctrl+X",
134 [this]() { return HasCurrentEditor(); })
135 .Item("Copy", ICON_MD_CONTENT_COPY,
136 [this]() { OnCopy(); }, "Ctrl+C",
137 [this]() { return HasCurrentEditor(); })
138 .Item("Paste", ICON_MD_CONTENT_PASTE,
139 [this]() { OnPaste(); }, "Ctrl+V",
140 [this]() { return HasCurrentEditor(); })
141 .Separator();
142
143 // Search operations
145 .Item("Find", ICON_MD_SEARCH,
146 [this]() { OnFind(); }, "Ctrl+F",
147 [this]() { return HasCurrentEditor(); })
148 .Item("Find in Files", ICON_MD_SEARCH,
149 [this]() { OnShowGlobalSearch(); }, "Ctrl+Shift+F");
150}
151
157
159 // Editor Selection
161 .Item("Editor Selection", ICON_MD_DASHBOARD,
162 [this]() { OnShowEditorSelection(); }, "Ctrl+E")
163 .Separator();
164
165 // Individual Editor Shortcuts
167 .Item("Overworld", ICON_MD_MAP,
168 [this]() { OnSwitchToEditor(EditorType::kOverworld); }, "Ctrl+1")
169 .Item("Dungeon", ICON_MD_CASTLE,
170 [this]() { OnSwitchToEditor(EditorType::kDungeon); }, "Ctrl+2")
171 .Item("Graphics", ICON_MD_IMAGE,
172 [this]() { OnSwitchToEditor(EditorType::kGraphics); }, "Ctrl+3")
173 .Item("Sprites", ICON_MD_TOYS,
174 [this]() { OnSwitchToEditor(EditorType::kSprite); }, "Ctrl+4")
175 .Item("Messages", ICON_MD_CHAT_BUBBLE,
176 [this]() { OnSwitchToEditor(EditorType::kMessage); }, "Ctrl+5")
177 .Item("Music", ICON_MD_MUSIC_NOTE,
178 [this]() { OnSwitchToEditor(EditorType::kMusic); }, "Ctrl+6")
179 .Item("Palettes", ICON_MD_PALETTE,
180 [this]() { OnSwitchToEditor(EditorType::kPalette); }, "Ctrl+7")
181 .Item("Screens", ICON_MD_TV,
182 [this]() { OnSwitchToEditor(EditorType::kScreen); }, "Ctrl+8")
183 .Item("Assembly", ICON_MD_CODE,
184 [this]() { OnSwitchToEditor(EditorType::kAssembly); }, "Ctrl+9")
185 .Item("Hex Editor", ICON_MD_DATA_ARRAY,
186 [this]() { OnShowHexEditor(); }, "Ctrl+0")
187 .Separator();
188
189 // Special Editors
190#ifdef YAZE_WITH_GRPC
192 .Item("AI Agent", ICON_MD_SMART_TOY,
193 [this]() { OnShowAIAgent(); }, "Ctrl+Shift+A")
194 .Item("Chat History", ICON_MD_CHAT,
195 [this]() { OnShowChatHistory(); }, "Ctrl+H")
196 .Item("Proposal Drawer", ICON_MD_PREVIEW,
197 [this]() { OnShowProposalDrawer(); }, "Ctrl+Shift+R");
198#endif
199
201 .Item("Emulator", ICON_MD_VIDEOGAME_ASSET,
202 [this]() { OnShowEmulator(); }, "Ctrl+Shift+E")
203 .Separator();
204
205 // Settings and UI
207 .Item("Display Settings", ICON_MD_DISPLAY_SETTINGS,
208 [this]() { OnShowDisplaySettings(); })
209 .Separator();
210
211 // Additional UI Elements
213 .Item("Card Browser", ICON_MD_DASHBOARD,
214 [this]() { OnShowCardBrowser(); }, "Ctrl+Shift+B")
215 .Item("Welcome Screen", ICON_MD_HOME,
216 [this]() { OnShowWelcomeScreen(); });
217}
218
224
226 // Core Tools - keep these in Tools menu
228 .Item("Global Search", ICON_MD_SEARCH,
229 [this]() { OnShowGlobalSearch(); }, "Ctrl+Shift+F")
230 .Item("Command Palette", ICON_MD_SEARCH,
231 [this]() { OnShowCommandPalette(); }, "Ctrl+Shift+P")
232 .Separator();
233
234 // Resource Management
236 .Item("Resource Label Manager", ICON_MD_LABEL,
237 [this]() { OnShowResourceLabelManager(); })
238 .Separator();
239
240 // Collaboration (GRPC builds only)
241#ifdef YAZE_WITH_GRPC
243 .BeginSubMenu("Collaborate", ICON_MD_PEOPLE)
244 .Item("Start Collaboration Session", ICON_MD_PLAY_CIRCLE,
245 [this]() { OnStartCollaboration(); })
246 .Item("Join Collaboration Session", ICON_MD_GROUP_ADD,
247 [this]() { OnJoinCollaboration(); })
248 .Item("Network Status", ICON_MD_CLOUD,
249 [this]() { OnShowNetworkStatus(); })
250 .EndMenu();
251#endif
252}
253
259
261 // Testing section (move from Tools if present)
262#ifdef YAZE_ENABLE_TESTING
264 .BeginSubMenu("Testing", ICON_MD_SCIENCE)
265 .Item("Test Dashboard", ICON_MD_DASHBOARD,
266 [this]() { OnShowTestDashboard(); }, "Ctrl+T")
267 .Item("Run All Tests", ICON_MD_PLAY_ARROW,
268 [this]() { OnRunAllTests(); })
269 .Item("Run Unit Tests", ICON_MD_CHECK_BOX,
270 [this]() { OnRunUnitTests(); })
271 .Item("Run Integration Tests", ICON_MD_INTEGRATION_INSTRUCTIONS,
272 [this]() { OnRunIntegrationTests(); })
273 .Item("Run E2E Tests", ICON_MD_VISIBILITY,
274 [this]() { OnRunE2ETests(); })
275 .EndMenu()
276 .Separator();
277#endif
278
279 // ROM Analysis submenu
281 .BeginSubMenu("ROM Analysis", ICON_MD_STORAGE)
282 .Item("ROM Information", ICON_MD_INFO,
283 [this]() { OnShowRomInfo(); }, nullptr,
284 [this]() { return HasActiveRom(); })
285 .Item("Data Integrity Check", ICON_MD_ANALYTICS,
286 [this]() { OnRunDataIntegrityCheck(); }, nullptr,
287 [this]() { return HasActiveRom(); })
288 .Item("Test Save/Load", ICON_MD_SAVE_ALT,
289 [this]() { OnTestSaveLoad(); }, nullptr,
290 [this]() { return HasActiveRom(); })
291 .EndMenu();
292
293 // ZSCustomOverworld submenu
295 .BeginSubMenu("ZSCustomOverworld", ICON_MD_CODE)
296 .Item("Check ROM Version", ICON_MD_INFO,
297 [this]() { OnCheckRomVersion(); }, nullptr,
298 [this]() { return HasActiveRom(); })
299 .Item("Upgrade ROM", ICON_MD_UPGRADE,
300 [this]() { OnUpgradeRom(); }, nullptr,
301 [this]() { return HasActiveRom(); })
302 .Item("Toggle Custom Loading", ICON_MD_SETTINGS,
303 [this]() { OnToggleCustomLoading(); })
304 .EndMenu();
305
306 // Asar Integration submenu
308 .BeginSubMenu("Asar Integration", ICON_MD_BUILD)
309 .Item("Asar Status", ICON_MD_INFO,
311 .Item("Toggle ASM Patch", ICON_MD_CODE,
312 [this]() { OnToggleAsarPatch(); }, nullptr,
313 [this]() { return HasActiveRom(); })
314 .Item("Load ASM File", ICON_MD_FOLDER_OPEN,
315 [this]() { OnLoadAsmFile(); })
316 .EndMenu();
317
319
320 // Development Tools
322 .Item("Memory Editor", ICON_MD_MEMORY,
323 [this]() { OnShowMemoryEditor(); })
324 .Item("Assembly Editor", ICON_MD_CODE,
325 [this]() { OnShowAssemblyEditor(); })
326 .Item("Feature Flags", ICON_MD_FLAG,
328 .Separator()
329 .Item("Performance Dashboard", ICON_MD_SPEED,
330 [this]() { OnShowPerformanceDashboard(); });
331
332#ifdef YAZE_WITH_GRPC
334 .Item("Agent Proposals", ICON_MD_PREVIEW,
335 [this]() { OnShowProposalDrawer(); });
336#endif
337
339
340 // ImGui Debug Windows
342 .Item("ImGui Demo", ICON_MD_HELP,
343 [this]() { OnShowImGuiDemo(); })
344 .Item("ImGui Metrics", ICON_MD_ANALYTICS,
345 [this]() { OnShowImGuiMetrics(); });
346}
347
353
355 // Sessions Submenu
357 .BeginSubMenu("Sessions", ICON_MD_TAB)
358 .Item("New Session", ICON_MD_ADD,
359 [this]() { OnCreateNewSession(); }, "Ctrl+Shift+N")
360 .Item("Duplicate Session", ICON_MD_CONTENT_COPY,
361 [this]() { OnDuplicateCurrentSession(); }, nullptr,
362 [this]() { return HasActiveRom(); })
363 .Item("Close Session", ICON_MD_CLOSE,
364 [this]() { OnCloseCurrentSession(); }, "Ctrl+Shift+W",
365 [this]() { return HasMultipleSessions(); })
366 .Separator()
367 .Item("Session Switcher", ICON_MD_SWITCH_ACCOUNT,
368 [this]() { OnShowSessionSwitcher(); }, "Ctrl+Tab",
369 [this]() { return HasMultipleSessions(); })
370 .Item("Session Manager", ICON_MD_VIEW_LIST,
371 [this]() { OnShowSessionManager(); })
372 .EndMenu()
373 .Separator();
374
375 // Layout Management
377 .Item("Save Layout", ICON_MD_SAVE,
378 [this]() { OnSaveWorkspaceLayout(); }, "Ctrl+Shift+S")
379 .Item("Load Layout", ICON_MD_FOLDER_OPEN,
380 [this]() { OnLoadWorkspaceLayout(); }, "Ctrl+Shift+O")
381 .Item("Reset Layout", ICON_MD_RESET_TV,
382 [this]() { OnResetWorkspaceLayout(); })
383 .Item("Layout Presets", ICON_MD_BOOKMARK,
384 [this]() { OnShowLayoutPresets(); })
385 .Separator();
386
387 // Window Visibility
389 .Item("Show All Windows", ICON_MD_VISIBILITY,
390 [this]() { OnShowAllWindows(); })
391 .Item("Hide All Windows", ICON_MD_VISIBILITY_OFF,
392 [this]() { OnHideAllWindows(); })
393 .Separator();
394
395 // Workspace Presets
397 .Item("Developer Layout", ICON_MD_DEVELOPER_MODE,
398 [this]() { OnLoadDeveloperLayout(); })
399 .Item("Designer Layout", ICON_MD_DESIGN_SERVICES,
400 [this]() { OnLoadDesignerLayout(); })
401 .Item("Modder Layout", ICON_MD_CONSTRUCTION,
402 [this]() { OnLoadModderLayout(); });
403}
404
410
413 .Item("Getting Started", ICON_MD_PLAY_ARROW,
414 [this]() { OnShowGettingStarted(); })
415 .Item("Asar Integration", ICON_MD_CODE,
416 [this]() { OnShowAsarIntegration(); })
417 .Item("Build Instructions", ICON_MD_BUILD,
418 [this]() { OnShowBuildInstructions(); })
419 .Item("CLI Usage", ICON_MD_TERMINAL,
420 [this]() { OnShowCLIUsage(); })
421 .Separator()
422 .Item("Supported Features", ICON_MD_CHECK_CIRCLE,
423 [this]() { OnShowSupportedFeatures(); })
424 .Item("What's New", ICON_MD_NEW_RELEASES,
425 [this]() { OnShowWhatsNew(); })
426 .Separator()
427 .Item("Troubleshooting", ICON_MD_BUILD_CIRCLE,
428 [this]() { OnShowTroubleshooting(); })
429 .Item("Contributing", ICON_MD_VOLUNTEER_ACTIVISM,
430 [this]() { OnShowContributing(); })
431 .Separator()
432 .Item("About", ICON_MD_INFO,
433 [this]() { OnShowAbout(); }, "F1");
434}
435
436// Menu state management
440
444
445// Menu item callbacks - delegate to appropriate managers
447 // Delegate to EditorManager's LoadRom which handles session management
448 if (editor_manager_) {
449 auto status = editor_manager_->LoadRom();
450 if (!status.ok()) {
452 absl::StrFormat("Failed to load ROM: %s", status.message()),
454 }
455 }
456}
457
459 // Delegate to EditorManager's SaveRom which handles editor data saving
460 if (editor_manager_) {
461 auto status = editor_manager_->SaveRom();
462 if (!status.ok()) {
464 absl::StrFormat("Failed to save ROM: %s", status.message()),
466 } else {
467 toast_manager_.Show("ROM saved successfully", ToastType::kSuccess);
468 }
469 }
470}
471
475
477 // Delegate to EditorManager which handles the full project creation flow
478 if (editor_manager_) {
479 auto status = editor_manager_->CreateNewProject();
480 if (!status.ok()) {
482 absl::StrFormat("Failed to create project: %s", status.message()),
484 }
485 }
486}
487
489 // Delegate to EditorManager which handles ROM loading and session creation
490 if (editor_manager_) {
491 auto status = editor_manager_->OpenProject();
492 if (!status.ok()) {
494 absl::StrFormat("Failed to open project: %s", status.message()),
496 }
497 }
498}
499
501 // Delegate to EditorManager which updates project with current state
502 if (editor_manager_) {
503 auto status = editor_manager_->SaveProject();
504 if (!status.ok()) {
506 absl::StrFormat("Failed to save project: %s", status.message()),
508 } else {
509 toast_manager_.Show("Project saved successfully", ToastType::kSuccess);
510 }
511 }
512}
513
515 // Delegate to EditorManager
516 if (editor_manager_) {
517 auto status = editor_manager_->SaveProjectAs();
518 if (!status.ok()) {
520 absl::StrFormat("Failed to save project as: %s", status.message()),
522 }
523 }
524}
525
526// Edit menu actions - delegate to current editor
528 if (editor_manager_) {
529 auto* current_editor = editor_manager_->GetCurrentEditor();
530 if (current_editor) {
531 auto status = current_editor->Undo();
532 if (!status.ok()) {
533 toast_manager_.Show(absl::StrFormat("Undo failed: %s", status.message()),
535 }
536 }
537 }
538}
539
541 if (editor_manager_) {
542 auto* current_editor = editor_manager_->GetCurrentEditor();
543 if (current_editor) {
544 auto status = current_editor->Redo();
545 if (!status.ok()) {
546 toast_manager_.Show(absl::StrFormat("Redo failed: %s", status.message()),
548 }
549 }
550 }
551}
552
554 if (editor_manager_) {
555 auto* current_editor = editor_manager_->GetCurrentEditor();
556 if (current_editor) {
557 auto status = current_editor->Cut();
558 if (!status.ok()) {
559 toast_manager_.Show(absl::StrFormat("Cut failed: %s", status.message()),
561 }
562 }
563 }
564}
565
567 if (editor_manager_) {
568 auto* current_editor = editor_manager_->GetCurrentEditor();
569 if (current_editor) {
570 auto status = current_editor->Copy();
571 if (!status.ok()) {
572 toast_manager_.Show(absl::StrFormat("Copy failed: %s", status.message()),
574 }
575 }
576 }
577}
578
580 if (editor_manager_) {
581 auto* current_editor = editor_manager_->GetCurrentEditor();
582 if (current_editor) {
583 auto status = current_editor->Paste();
584 if (!status.ok()) {
585 toast_manager_.Show(absl::StrFormat("Paste failed: %s", status.message()),
587 }
588 }
589 }
590}
591
593 if (editor_manager_) {
594 auto* current_editor = editor_manager_->GetCurrentEditor();
595 if (current_editor) {
596 auto status = current_editor->Find();
597 if (!status.ok()) {
598 toast_manager_.Show(absl::StrFormat("Find failed: %s", status.message()),
600 }
601 }
602 }
603}
604
605// Editor-specific menu actions
607 // Delegate to EditorManager which manages editor switching
608 if (editor_manager_) {
609 editor_manager_->SwitchToEditor(editor_type);
610 }
611}
612
614 // Delegate to UICoordinator for editor selection dialog display
615 if (editor_manager_) {
616 if (auto* ui = editor_manager_->ui_coordinator()) {
617 ui->ShowEditorSelection();
618 }
619 }
620}
621
625
627 // Show hex editor card via EditorCardManager
628 if (editor_manager_) {
630 }
631}
632
638
644
650
651#ifdef YAZE_WITH_GRPC
652void MenuOrchestrator::OnShowAIAgent() {
653 if (editor_manager_) {
654 editor_manager_->ShowAIAgent();
655 }
656}
657
658void MenuOrchestrator::OnShowChatHistory() {
659 if (editor_manager_) {
660 editor_manager_->ShowChatHistory();
661 }
662}
663
664void MenuOrchestrator::OnShowProposalDrawer() {
665 if (editor_manager_) {
666 editor_manager_->ShowProposalDrawer();
667 }
668}
669#endif
670
671// Session management menu actions
675
679
683
684void MenuOrchestrator::OnSwitchToSession(size_t session_index) {
686}
687
689 // Delegate to UICoordinator for session switcher UI
690 if (editor_manager_) {
691 if (auto* ui = editor_manager_->ui_coordinator()) {
692 ui->ShowSessionSwitcher();
693 }
694 }
695}
696
698 // TODO: Show session manager dialog
699 toast_manager_.Show("Session Manager", ToastType::kInfo);
700}
701
702// Window management menu actions
704 // Delegate to EditorManager
705 if (editor_manager_) {
707 }
708}
709
711 // Delegate to EditorManager
712 if (editor_manager_) {
714 }
715}
716
718 // Delegate to EditorManager
719 if (editor_manager_) {
721 }
722}
723
725 // Delegate to EditorManager
726 if (editor_manager_) {
728 }
729}
730
732 // Delegate to EditorManager
733 if (editor_manager_) {
735 }
736}
737
739 // TODO: Show layout presets dialog
740 toast_manager_.Show("Layout Presets", ToastType::kInfo);
741}
742
748
754
760
761// Tool menu actions
767
773
779
785
791
797
803
804#ifdef YAZE_ENABLE_TESTING
805void MenuOrchestrator::OnShowTestDashboard() {
806 if (editor_manager_) {
807 editor_manager_->ShowTestDashboard();
808 }
809}
810
811void MenuOrchestrator::OnRunAllTests() {
812 toast_manager_.Show("Running all tests...", ToastType::kInfo);
813 // TODO: Implement test runner integration
814}
815
816void MenuOrchestrator::OnRunUnitTests() {
817 toast_manager_.Show("Running unit tests...", ToastType::kInfo);
818 // TODO: Implement unit test runner
819}
820
821void MenuOrchestrator::OnRunIntegrationTests() {
822 toast_manager_.Show("Running integration tests...", ToastType::kInfo);
823 // TODO: Implement integration test runner
824}
825
826void MenuOrchestrator::OnRunE2ETests() {
827 toast_manager_.Show("Running E2E tests...", ToastType::kInfo);
828 // TODO: Implement E2E test runner
829}
830#endif
831
832#ifdef YAZE_WITH_GRPC
833void MenuOrchestrator::OnStartCollaboration() {
834 toast_manager_.Show("Starting collaboration session...", ToastType::kInfo);
835 // TODO: Implement collaboration session start
836}
837
838void MenuOrchestrator::OnJoinCollaboration() {
839 toast_manager_.Show("Joining collaboration session...", ToastType::kInfo);
840 // TODO: Implement collaboration session join
841}
842
843void MenuOrchestrator::OnShowNetworkStatus() {
844 toast_manager_.Show("Network Status", ToastType::kInfo);
845 // TODO: Show network status dialog
846}
847#endif
848
849// Help menu actions
853
857
861
865
869
873
877
881
885
886// Additional File menu actions
890
892 if (editor_manager_) {
893 // Create backup via ROM directly (from original implementation)
894 auto* rom = editor_manager_->GetCurrentRom();
895 if (rom && rom->is_loaded()) {
896 Rom::SaveSettings settings;
897 settings.backup = true;
898 settings.filename = rom->filename();
899 auto status = rom->SaveToFile(settings);
900 if (status.ok()) {
901 toast_manager_.Show("Backup created successfully", ToastType::kSuccess);
902 } else {
904 absl::StrFormat("Backup failed: %s", status.message()),
906 }
907 }
908 }
909}
910
912 if (editor_manager_) {
914 if (status.ok()) {
915 toast_manager_.Show("ROM validation passed", ToastType::kSuccess);
916 } else {
918 absl::StrFormat("ROM validation failed: %s", status.message()),
920 }
921 }
922}
923
925 // Activate settings editor
926 if (editor_manager_) {
928 }
929}
930
932 if (editor_manager_) {
934 }
935}
936
937// Menu item validation helpers
939 auto* rom = editor_manager_->GetCurrentRom();
940 return rom ? rom_manager_.IsRomLoaded(rom) : false;
941}
942
946
948 auto* rom = editor_manager_->GetCurrentRom();
949 return rom ? rom_manager_.IsRomLoaded(rom) : false;
950}
951
955
959
963
964// Menu item text generation
966 auto* rom = editor_manager_->GetCurrentRom();
967 return rom ? rom_manager_.GetRomFilename(rom) : "";
968}
969
972}
973
975 // TODO: Get current editor name
976 return "Unknown Editor";
977}
978
979// Shortcut key management
980std::string MenuOrchestrator::GetShortcutForAction(const std::string& action) const {
981 // TODO: Implement shortcut mapping
982 return "";
983}
984
986 // TODO: Register global keyboard shortcuts
987}
988
989// ============================================================================
990// Debug Menu Actions
991// ============================================================================
992
994#ifdef YAZE_ENABLE_TESTING
995 if (!editor_manager_) return;
996 auto* rom = editor_manager_->GetCurrentRom();
997 if (!rom || !rom->is_loaded()) return;
998
999 toast_manager_.Show("Running ROM integrity tests...", ToastType::kInfo);
1000 // This would integrate with the test system in master
1001 // For now, just show a placeholder
1002 toast_manager_.Show("Data integrity check completed", ToastType::kSuccess, 3.0f);
1003#else
1004 toast_manager_.Show("Testing not enabled in this build", ToastType::kWarning);
1005#endif
1006}
1007
1009#ifdef YAZE_ENABLE_TESTING
1010 if (!editor_manager_) return;
1011 auto* rom = editor_manager_->GetCurrentRom();
1012 if (!rom || !rom->is_loaded()) return;
1013
1014 toast_manager_.Show("Running ROM save/load tests...", ToastType::kInfo);
1015 // This would integrate with the test system in master
1016 toast_manager_.Show("Save/load test completed", ToastType::kSuccess, 3.0f);
1017#else
1018 toast_manager_.Show("Testing not enabled in this build", ToastType::kWarning);
1019#endif
1020}
1021
1023 if (!editor_manager_) return;
1024 auto* rom = editor_manager_->GetCurrentRom();
1025 if (!rom || !rom->is_loaded()) return;
1026
1027 // Check ZSCustomOverworld version
1028 uint8_t version = (*rom)[zelda3::OverworldCustomASMHasBeenApplied];
1029 std::string version_str = (version == 0xFF)
1030 ? "Vanilla"
1031 : absl::StrFormat("v%d", version);
1032
1034 absl::StrFormat("ROM: %s | ZSCustomOverworld: %s",
1035 rom->title().c_str(), version_str.c_str()),
1036 ToastType::kInfo, 5.0f);
1037}
1038
1040 if (!editor_manager_) return;
1041 auto* rom = editor_manager_->GetCurrentRom();
1042 if (!rom || !rom->is_loaded()) return;
1043
1045 "Use Overworld Editor to upgrade ROM version",
1046 ToastType::kInfo, 4.0f);
1047}
1048
1050 auto& flags = core::FeatureFlags::get();
1051 flags.overworld.kLoadCustomOverworld = !flags.overworld.kLoadCustomOverworld;
1052
1054 absl::StrFormat("Custom Overworld Loading: %s",
1055 flags.overworld.kLoadCustomOverworld ? "Enabled" : "Disabled"),
1057}
1058
1060 if (!editor_manager_) return;
1061 auto* rom = editor_manager_->GetCurrentRom();
1062 if (!rom || !rom->is_loaded()) return;
1063
1064 auto& flags = core::FeatureFlags::get();
1065 flags.overworld.kApplyZSCustomOverworldASM = !flags.overworld.kApplyZSCustomOverworldASM;
1066
1068 absl::StrFormat("ZSCustomOverworld ASM Application: %s",
1069 flags.overworld.kApplyZSCustomOverworldASM ? "Enabled" : "Disabled"),
1071}
1072
1074 toast_manager_.Show("ASM file loading not yet implemented", ToastType::kWarning);
1075}
1076
1082
1083} // namespace editor
1084} // namespace yaze
static Flags & get()
Definition features.h:82
The EditorManager controls the main editor window and manages the various editor classes.
void SwitchToEditor(EditorType editor_type)
UICoordinator * ui_coordinator()
absl::Status CreateNewProject(const std::string &template_name="Basic ROM Hack")
auto GetCurrentEditor() const -> Editor *
absl::Status LoadRom()
Load a ROM file into a new or existing session.
auto GetCurrentRom() const -> Rom *
absl::Status SaveRom()
Save the current ROM file.
Manages editor types, categories, and lifecycle.
Fluent interface for building ImGui menus with icons.
MenuBuilder & Item(const char *label, const char *icon, Callback callback, const char *shortcut=nullptr, EnabledCheck enabled=nullptr, EnabledCheck checked=nullptr)
Add a menu item.
void Draw()
Draw the menu bar (call in main menu bar)
void Clear()
Clear all menus.
MenuBuilder & BeginMenu(const char *label, const char *icon=nullptr)
Begin a top-level menu.
MenuBuilder & Separator()
Add a separator.
MenuBuilder & EndMenu()
End the current menu/submenu.
MenuBuilder & BeginSubMenu(const char *label, const char *icon=nullptr, EnabledCheck enabled=nullptr)
Begin a submenu.
void OnSwitchToSession(size_t session_index)
void OnSwitchToEditor(EditorType editor_type)
SessionCoordinator & session_coordinator_
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)
std::string GetCurrentEditorName() const
std::string GetShortcutForAction(const std::string &action) const
void Show(const char *name)
Handles all project file operations.
std::string GetProjectName() const
Handles all ROM file I/O operations.
absl::Status ValidateRom(Rom *rom)
std::string GetRomFilename(Rom *rom) const
bool IsRomLoaded(Rom *rom) const
High-level orchestrator for multi-session UI.
void Show(const std::string &message, ToastType type=ToastType::kInfo, float ttl_seconds=3.0f)
#define ICON_MD_DEVELOPER_MODE
Definition icons.h:547
#define ICON_MD_FOLDER_OPEN
Definition icons.h:811
#define ICON_MD_CONTENT_CUT
Definition icons.h:464
#define ICON_MD_SAVE_ALT
Definition icons.h:1643
#define ICON_MD_VOLUNTEER_ACTIVISM
Definition icons.h:2110
#define ICON_MD_SETTINGS
Definition icons.h:1697
#define ICON_MD_FILE_OPEN
Definition icons.h:745
#define ICON_MD_CHECK_BOX
Definition icons.h:396
#define ICON_MD_EXIT_TO_APP
Definition icons.h:697
#define ICON_MD_INFO
Definition icons.h:991
#define ICON_MD_CHAT
Definition icons.h:392
#define ICON_MD_MEMORY
Definition icons.h:1193
#define ICON_MD_STORAGE
Definition icons.h:1863
#define ICON_MD_UPGRADE
Definition icons.h:2045
#define ICON_MD_VIEW_LIST
Definition icons.h:2090
#define ICON_MD_SEARCH
Definition icons.h:1671
#define ICON_MD_DATA_ARRAY
Definition icons.h:517
#define ICON_MD_NEW_RELEASES
Definition icons.h:1289
#define ICON_MD_PLAY_ARROW
Definition icons.h:1477
#define ICON_MD_SAVE_AS
Definition icons.h:1644
#define ICON_MD_DESIGN_SERVICES
Definition icons.h:539
#define ICON_MD_INTEGRATION_INSTRUCTIONS
Definition icons.h:1006
#define ICON_MD_CONSTRUCTION
Definition icons.h:456
#define ICON_MD_RESET_TV
Definition icons.h:1599
#define ICON_MD_MAP
Definition icons.h:1171
#define ICON_MD_CODE
Definition icons.h:432
#define ICON_MD_LABEL
Definition icons.h:1051
#define ICON_MD_VIDEOGAME_ASSET
Definition icons.h:2074
#define ICON_MD_REDO
Definition icons.h:1568
#define ICON_MD_CHAT_BUBBLE
Definition icons.h:393
#define ICON_MD_SWITCH_ACCOUNT
Definition icons.h:1911
#define ICON_MD_VISIBILITY
Definition icons.h:2099
#define ICON_MD_SPEED
Definition icons.h:1815
#define ICON_MD_CASTLE
Definition icons.h:378
#define ICON_MD_BUILD_CIRCLE
Definition icons.h:327
#define ICON_MD_MUSIC_NOTE
Definition icons.h:1262
#define ICON_MD_CONTENT_PASTE
Definition icons.h:465
#define ICON_MD_HOME
Definition icons.h:951
#define ICON_MD_VISIBILITY_OFF
Definition icons.h:2100
#define ICON_MD_DISPLAY_SETTINGS
Definition icons.h:585
#define ICON_MD_ADD
Definition icons.h:84
#define ICON_MD_SCIENCE
Definition icons.h:1654
#define ICON_MD_PLAY_CIRCLE
Definition icons.h:1478
#define ICON_MD_IMAGE
Definition icons.h:980
#define ICON_MD_CHECK_CIRCLE
Definition icons.h:398
#define ICON_MD_TERMINAL
Definition icons.h:1949
#define ICON_MD_PREVIEW
Definition icons.h:1510
#define ICON_MD_FLAG
Definition icons.h:782
#define ICON_MD_BUILD
Definition icons.h:326
#define ICON_MD_CREATE_NEW_FOLDER
Definition icons.h:481
#define ICON_MD_DASHBOARD
Definition icons.h:515
#define ICON_MD_SAVE
Definition icons.h:1642
#define ICON_MD_BOOKMARK
Definition icons.h:283
#define ICON_MD_TAB
Definition icons.h:1928
#define ICON_MD_PEOPLE
Definition icons.h:1399
#define ICON_MD_BACKUP
Definition icons.h:229
#define ICON_MD_PALETTE
Definition icons.h:1368
#define ICON_MD_CONTENT_COPY
Definition icons.h:463
#define ICON_MD_TV
Definition icons.h:2030
#define ICON_MD_CLOUD
Definition icons.h:421
#define ICON_MD_CLOSE
Definition icons.h:416
#define ICON_MD_ANALYTICS
Definition icons.h:152
#define ICON_MD_TOYS
Definition icons.h:2000
#define ICON_MD_HELP
Definition icons.h:931
#define ICON_MD_UNDO
Definition icons.h:2037
#define ICON_MD_SMART_TOY
Definition icons.h:1779
#define ICON_MD_GROUP_ADD
Definition icons.h:897
constexpr const char * kRomInfo
constexpr const char * kAbout
constexpr const char * kTroubleshooting
constexpr const char * kWhatsNew
constexpr const char * kSupportedFeatures
constexpr const char * kSaveAs
constexpr const char * kDisplaySettings
constexpr const char * kCLIUsage
constexpr const char * kAsarIntegration
constexpr const char * kFeatureFlags
constexpr const char * kGettingStarted
constexpr const char * kContributing
constexpr const char * kBuildInstructions
constexpr int OverworldCustomASMHasBeenApplied
Definition common.h:50
Main namespace for the application.
Definition controller.cc:20
std::string filename
Definition rom.h:80