120 if (!shortcut_manager) {
131 shortcut_manager,
"view.toggle_activity_bar", {ImGuiMod_Ctrl, ImGuiKey_B},
134 panel_manager->ToggleSidebarVisibility();
141 shortcut_manager,
"view.toggle_side_panel",
142 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_E},
145 panel_manager->TogglePanelExpanded();
151 shortcut_manager,
"Open", {ImGuiMod_Ctrl, ImGuiKey_O},
153 if (editor_manager) {
154 editor_manager->LoadRom();
159 RegisterIfValid(shortcut_manager,
"Save", {ImGuiMod_Ctrl, ImGuiKey_S},
161 if (editor_manager) {
162 editor_manager->SaveRom();
167 shortcut_manager,
"Save As", {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_S},
169 if (editor_manager) {
171 std::string filename =
172 editor_manager->GetCurrentRom()
173 ? editor_manager->GetCurrentRom()->filename()
175 editor_manager->SaveRomAs(filename);
181 shortcut_manager,
"Close ROM", {ImGuiMod_Ctrl, ImGuiKey_W},
183 if (editor_manager && editor_manager->GetCurrentRom()) {
184 editor_manager->GetCurrentRom()->Close();
190 shortcut_manager,
"Quit", {ImGuiMod_Ctrl, ImGuiKey_Q},
192 if (editor_manager) {
193 editor_manager->Quit();
199 shortcut_manager,
"Undo", {ImGuiMod_Ctrl, ImGuiKey_Z},
201 if (editor_manager && editor_manager->GetCurrentEditor()) {
202 editor_manager->GetCurrentEditor()->Undo();
208 shortcut_manager,
"Redo", {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_Z},
210 if (editor_manager && editor_manager->GetCurrentEditor()) {
211 editor_manager->GetCurrentEditor()->Redo();
217 shortcut_manager,
"Cut", {ImGuiMod_Ctrl, ImGuiKey_X},
219 if (editor_manager && editor_manager->GetCurrentEditor()) {
220 editor_manager->GetCurrentEditor()->Cut();
226 shortcut_manager,
"Copy", {ImGuiMod_Ctrl, ImGuiKey_C},
228 if (editor_manager && editor_manager->GetCurrentEditor()) {
229 editor_manager->GetCurrentEditor()->Copy();
235 shortcut_manager,
"Paste", {ImGuiMod_Ctrl, ImGuiKey_V},
237 if (editor_manager && editor_manager->GetCurrentEditor()) {
238 editor_manager->GetCurrentEditor()->Paste();
244 shortcut_manager,
"Find", {ImGuiMod_Ctrl, ImGuiKey_F},
246 if (editor_manager && editor_manager->GetCurrentEditor()) {
247 editor_manager->GetCurrentEditor()->Find();
253 shortcut_manager,
"Command Palette",
254 {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_P},
256 if (ui_coordinator) {
257 ui_coordinator->ShowCommandPalette();
263 shortcut_manager,
"Global Search",
264 {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_K},
266 if (ui_coordinator) {
267 ui_coordinator->ShowGlobalSearch();
273 shortcut_manager,
"Load Last ROM", {ImGuiMod_Ctrl, ImGuiKey_R},
276 if (!recent.GetRecentFiles().empty() && editor_manager) {
277 editor_manager->OpenRomOrProject(recent.GetRecentFiles().front());
283 shortcut_manager,
"Show About", ImGuiKey_F1,
286 popup_manager->Show(
"About");
291 auto register_editor_shortcut = [&](
EditorType type, ImGuiKey key) {
292 RegisterIfValid(shortcut_manager,
293 absl::StrFormat(
"switch.%d",
static_cast<int>(type)),
294 {ImGuiMod_Ctrl, key}, [editor_manager, type]() {
295 if (editor_manager) {
296 editor_manager->SwitchToEditor(type);
315 auto register_editor_command = [&](
EditorType type,
const std::string& name) {
317 absl::StrFormat(
"Switch to %s Editor", name), [editor_manager, type]() {
318 if (editor_manager) {
319 editor_manager->SwitchToEditor(type);
336 if (editor_manager) {
337 for (
const auto& def : kMusicEditorShortcuts) {
339 shortcut_manager, def.id, def.keys,
340 [editor_manager,
id = def.id]() {
343 auto* current_editor = editor_manager->GetCurrentEditor();
344 if (!current_editor ||
345 current_editor->type() != EditorType::kMusic) {
348 auto* editor_set = editor_manager->GetCurrentEditorSet();
350 editor_set ? editor_set->GetMusicEditor() :
nullptr;
354 if (
id ==
"music.play_pause") {
355 music_editor->TogglePlayPause();
356 }
else if (
id ==
"music.stop") {
357 music_editor->StopPlayback();
358 }
else if (
id ==
"music.speed_up" ||
359 id ==
"music.speed_up_keypad") {
360 music_editor->SpeedUp();
361 }
else if (
id ==
"music.speed_down" ||
362 id ==
"music.speed_down_keypad") {
363 music_editor->SlowDown();
371 if (editor_manager) {
372 for (
const auto& def : kDungeonEditorShortcuts) {
374 shortcut_manager, def.id, def.keys,
375 [editor_manager,
id = def.id]() {
378 auto* current_editor = editor_manager->GetCurrentEditor();
379 if (!current_editor ||
380 current_editor->type() != EditorType::kDungeon) {
383 auto* editor_set = editor_manager->GetCurrentEditorSet();
384 auto* dungeon_editor =
385 editor_set ? editor_set->GetDungeonEditor() :
nullptr;
388 auto* obj_panel = dungeon_editor->object_editor_panel();
392 if (
id ==
"dungeon.object.select_tool") {
394 obj_panel->CancelPlacement();
395 }
else if (
id ==
"dungeon.object.place_tool") {
398 }
else if (
id ==
"dungeon.object.delete_tool") {
400 obj_panel->DeleteSelectedObjects();
401 }
else if (
id ==
"dungeon.object.next_object") {
402 obj_panel->CycleObjectSelection(1);
403 }
else if (
id ==
"dungeon.object.prev_object") {
404 obj_panel->CycleObjectSelection(-1);
405 }
else if (
id ==
"dungeon.object.copy") {
406 obj_panel->CopySelectedObjects();
407 }
else if (
id ==
"dungeon.object.paste") {
408 obj_panel->PasteObjects();
409 }
else if (
id ==
"dungeon.object.delete") {
410 obj_panel->DeleteSelectedObjects();
418 if (editor_manager) {
421 shortcut_manager, def.id, def.keys,
422 [editor_manager,
id = def.id]() {
425 auto* current_editor = editor_manager->GetCurrentEditor();
426 if (!current_editor ||
427 current_editor->type() != EditorType::kOverworld) {
430 auto* editor_set = editor_manager->GetCurrentEditorSet();
431 auto* overworld_editor =
432 editor_set ? editor_set->GetOverworldEditor() :
nullptr;
433 if (!overworld_editor)
436 if (
id ==
"overworld.brush_toggle") {
437 overworld_editor->ToggleBrushTool();
438 }
else if (
id ==
"overworld.fill") {
439 overworld_editor->ActivateFillTool();
440 }
else if (
id ==
"overworld.next_tile") {
441 overworld_editor->CycleTileSelection(1);
442 }
else if (
id ==
"overworld.prev_tile") {
443 overworld_editor->CycleTileSelection(-1);
446 Shortcut::Scope::kEditor);
451 if (editor_manager) {
454 shortcut_manager, def.id, def.keys,
455 [editor_manager,
id = def.id]() {
458 auto* current_editor = editor_manager->GetCurrentEditor();
459 if (!current_editor ||
460 current_editor->type() != EditorType::kGraphics) {
463 auto* editor_set = editor_manager->GetCurrentEditorSet();
464 auto* graphics_editor =
465 editor_set ? editor_set->GetGraphicsEditor() :
nullptr;
466 if (!graphics_editor)
469 if (
id ==
"graphics.next_sheet") {
470 graphics_editor->NextSheet();
471 }
else if (
id ==
"graphics.prev_sheet") {
472 graphics_editor->PrevSheet();
475 Shortcut::Scope::kEditor);
480 shortcut_manager,
"Editor Selection", {ImGuiMod_Ctrl, ImGuiKey_E},
482 if (ui_coordinator) {
483 ui_coordinator->ShowEditorSelection();
486 Shortcut::Scope::kGlobal);
489 shortcut_manager,
"Panel Browser",
490 {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_B},
492 if (ui_coordinator) {
493 ui_coordinator->ShowPanelBrowser();
496 Shortcut::Scope::kGlobal);
498 shortcut_manager,
"Panel Browser (Alt)",
499 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_P},
501 if (ui_coordinator) {
502 ui_coordinator->ShowPanelBrowser();
505 Shortcut::Scope::kGlobal);
508 shortcut_manager,
"View: Previous Right Panel",
509 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_LeftBracket},
511 if (!editor_manager) {
514 if (
auto* right_panel = editor_manager->right_panel_manager()) {
515 right_panel->CycleToPreviousPanel();
518 Shortcut::Scope::kGlobal);
521 shortcut_manager,
"View: Next Right Panel",
522 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_RightBracket},
524 if (!editor_manager) {
527 if (
auto* right_panel = editor_manager->right_panel_manager()) {
528 right_panel->CycleToNextPanel();
531 Shortcut::Scope::kGlobal);
537 shortcut_manager,
"Show Dungeon Panels",
538 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_D},
540 panel_manager->ShowAllPanelsInCategory(0,
"Dungeon");
542 Shortcut::Scope::kEditor);
544 shortcut_manager,
"Show Graphics Panels",
545 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_G},
547 panel_manager->ShowAllPanelsInCategory(0,
"Graphics");
549 Shortcut::Scope::kEditor);
551 shortcut_manager,
"Show Screen Panels",
552 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_S},
554 panel_manager->ShowAllPanelsInCategory(0,
"Screen");
556 Shortcut::Scope::kEditor);
559#ifdef YAZE_BUILD_AGENT_UI
561 {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_A},
563 if (editor_manager) {
564 editor_manager->ShowAIAgent();
569 {ImGuiMod_Ctrl, ImGuiKey_H}, [editor_manager]() {
570 if (editor_manager) {
571 editor_manager->ShowChatHistory();
576 {ImGuiMod_Ctrl, ImGuiMod_Shift,
579 if (editor_manager) {
580 editor_manager->ShowProposalDrawer();
588 shortcut_manager->
RegisterCommand(
"Layout Profile: Code", [editor_manager]() {
589 if (editor_manager) {
590 editor_manager->ApplyLayoutProfile(
"code");
594 "Layout Profile: Debug", [editor_manager]() {
595 if (editor_manager) {
596 editor_manager->ApplyLayoutProfile(
"debug");
600 "Layout Profile: Mapping", [editor_manager]() {
601 if (editor_manager) {
602 editor_manager->ApplyLayoutProfile(
"mapping");
605 shortcut_manager->
RegisterCommand(
"Layout Profile: Chat", [editor_manager]() {
606 if (editor_manager) {
607 editor_manager->ApplyLayoutProfile(
"chat");
611 "Layout Snapshot: Capture", [editor_manager]() {
612 if (editor_manager) {
613 editor_manager->CaptureTemporaryLayoutSnapshot();
617 "Layout Snapshot: Restore", [editor_manager]() {
618 if (editor_manager) {
619 editor_manager->RestoreTemporaryLayoutSnapshot();
623 "Layout Snapshot: Clear", [editor_manager]() {
624 if (editor_manager) {
625 editor_manager->ClearTemporaryLayoutSnapshot();
630 "Layout: Apply Minimal Preset", [editor_manager]() {
631 if (editor_manager) {
632 editor_manager->ApplyLayoutPreset(
"Minimal");
636 "Layout: Apply Developer Preset", [editor_manager]() {
637 if (editor_manager) {
638 editor_manager->ApplyLayoutPreset(
"Developer");
642 "Layout: Apply Designer Preset", [editor_manager]() {
643 if (editor_manager) {
644 editor_manager->ApplyLayoutPreset(
"Designer");
648 "Layout: Apply Modder Preset", [editor_manager]() {
649 if (editor_manager) {
650 editor_manager->ApplyLayoutPreset(
"Modder");
654 "Layout: Apply Overworld Expert Preset", [editor_manager]() {
655 if (editor_manager) {
656 editor_manager->ApplyLayoutPreset(
"Overworld Expert");
660 "Layout: Apply Dungeon Expert Preset", [editor_manager]() {
661 if (editor_manager) {
662 editor_manager->ApplyLayoutPreset(
"Dungeon Expert");
666 "Layout: Apply Testing Preset", [editor_manager]() {
667 if (editor_manager) {
668 editor_manager->ApplyLayoutPreset(
"Testing");
672 "Layout: Apply Audio Preset", [editor_manager]() {
673 if (editor_manager) {
674 editor_manager->ApplyLayoutPreset(
"Audio");
678 "Layout: Reset Current Editor", [editor_manager]() {
679 if (editor_manager) {
680 editor_manager->ResetCurrentEditorLayout();
687 if (editor_manager) {
688 using PanelType = RightPanelManager::PanelType;
689 auto* rpm = editor_manager->right_panel_manager();
695 PanelCmd panel_cmds[] = {
696 {
"View: Toggle AI Agent Panel", PanelType::kAgentChat},
697 {
"View: Toggle Proposals Panel", PanelType::kProposals},
698 {
"View: Toggle Settings Panel", PanelType::kSettings},
699 {
"View: Toggle Help Panel", PanelType::kHelp},
700 {
"View: Toggle Notifications", PanelType::kNotifications},
701 {
"View: Toggle Properties Panel", PanelType::kProperties},
702 {
"View: Toggle Project Panel", PanelType::kProject},
704 for (
const auto& cmd : panel_cmds) {
707 [rpm, panel_type = cmd.type]() { rpm->TogglePanel(panel_type); });
709 shortcut_manager->
RegisterCommand(
"View: Previous Right Panel", [rpm]() {
710 rpm->CycleToPreviousPanel();
713 [rpm]() { rpm->CycleToNextPanel(); });
721 auto categories = panel_manager->GetAllCategories();
724 for (
const auto& category : categories) {
725 auto panels = panel_manager->GetPanelsInCategory(session_id, category);
727 for (
const auto& panel : panels) {
728 std::string panel_id = panel.card_id;
729 std::string display_name = panel.display_name;
733 absl::StrFormat(
"View: Show %s", display_name),
734 [panel_manager, panel_id]() {
736 panel_manager->ShowPanel(0, panel_id);
742 absl::StrFormat(
"View: Hide %s", display_name),
743 [panel_manager, panel_id]() {
745 panel_manager->HidePanel(0, panel_id);
751 absl::StrFormat(
"View: Toggle %s", display_name),
752 [panel_manager, panel_id]() {
754 panel_manager->TogglePanel(0, panel_id);
761 for (
const auto& category : categories) {
763 absl::StrFormat(
"View: Show All %s Panels", category),
764 [panel_manager, category]() {
766 panel_manager->ShowAllPanelsInCategory(0, category);
771 absl::StrFormat(
"View: Hide All %s Panels", category),
772 [panel_manager, category]() {
774 panel_manager->HideAllPanelsInCategory(0, category);
783 if (!shortcut_manager) {
791 RegisterIfValid(shortcut_manager,
"New Session",
792 {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_N},
793 [session_coordinator]() {
794 if (session_coordinator) {
795 session_coordinator->CreateNewSession();
799 RegisterIfValid(shortcut_manager,
"Duplicate Session",
800 {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_D},
801 [session_coordinator]() {
802 if (session_coordinator) {
803 session_coordinator->DuplicateCurrentSession();
807 RegisterIfValid(shortcut_manager,
"Close Session",
808 {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_W},
809 [session_coordinator]() {
810 if (session_coordinator) {
811 session_coordinator->CloseCurrentSession();
815 RegisterIfValid(shortcut_manager,
"Session Switcher",
816 {ImGuiMod_Ctrl, ImGuiKey_Tab}, [session_coordinator]() {
817 if (session_coordinator) {
818 session_coordinator->ShowSessionSwitcher();
822 RegisterIfValid(shortcut_manager,
"Save Layout",
823 {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_L},
824 [workspace_manager]() {
825 if (workspace_manager) {
826 workspace_manager->SaveWorkspaceLayout();
830 RegisterIfValid(shortcut_manager,
"Load Layout",
831 {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_O},
832 [workspace_manager]() {
833 if (workspace_manager) {
834 workspace_manager->LoadWorkspaceLayout();
840 RegisterIfValid(shortcut_manager,
"Reset Layout",
841 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_R},
842 [workspace_manager]() {
843 if (workspace_manager) {
844 workspace_manager->ResetWorkspaceLayout();
848 RegisterIfValid(shortcut_manager,
"Maximize Window", ImGuiKey_F11,
849 [workspace_manager]() {
850 if (workspace_manager) {
851 workspace_manager->MaximizeCurrentWindow();
855#ifdef YAZE_ENABLE_TESTING
856 RegisterIfValid(shortcut_manager,
"Test Dashboard",
857 {ImGuiMod_Ctrl, ImGuiKey_T}, [menu_orchestrator]() {
858 if (menu_orchestrator) {
859 menu_orchestrator->OnShowTestDashboard();