137 if (!shortcut_manager) {
148 shortcut_manager,
"view.toggle_activity_bar", {ImGuiMod_Ctrl, ImGuiKey_B},
150 if (window_manager) {
151 window_manager->ToggleSidebarVisibility();
158 shortcut_manager,
"view.toggle_side_panel",
159 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_E},
161 if (window_manager) {
162 window_manager->ToggleSidebarExpanded();
169 shortcut_manager,
"ui.font_scale_increase",
170 {ImGuiMod_Ctrl, ImGuiKey_Equal},
172 AdjustUiFontScaleBy(editor_manager, kUiFontScaleStep);
177 shortcut_manager,
"ui.font_scale_increase_keypad",
178 {ImGuiMod_Ctrl, ImGuiKey_KeypadAdd},
180 AdjustUiFontScaleBy(editor_manager, kUiFontScaleStep);
185 shortcut_manager,
"ui.font_scale_decrease",
186 {ImGuiMod_Ctrl, ImGuiKey_Minus},
188 AdjustUiFontScaleBy(editor_manager, -kUiFontScaleStep);
193 shortcut_manager,
"ui.font_scale_decrease_keypad",
194 {ImGuiMod_Ctrl, ImGuiKey_KeypadSubtract},
196 AdjustUiFontScaleBy(editor_manager, -kUiFontScaleStep);
201 shortcut_manager,
"ui.font_scale_reset", {ImGuiMod_Ctrl, ImGuiKey_0},
203 if (!editor_manager || ImGui::GetIO().WantTextInput) {
206 editor_manager->SetFontGlobalScale(1.0f);
211 shortcut_manager,
"Open", {ImGuiMod_Ctrl, ImGuiKey_O},
213 if (editor_manager) {
214 editor_manager->LoadRom();
219 RegisterIfValid(shortcut_manager,
"Save", {ImGuiMod_Ctrl, ImGuiKey_S},
221 if (editor_manager) {
222 editor_manager->SaveRom();
227 shortcut_manager,
"Save As", {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_S},
229 if (editor_manager && editor_manager->popup_manager()) {
236 shortcut_manager,
"Close ROM", {ImGuiMod_Ctrl, ImGuiKey_W},
238 if (editor_manager) {
239 editor_manager->CloseCurrentSession();
245 shortcut_manager,
"Quit", {ImGuiMod_Ctrl, ImGuiKey_Q},
247 if (editor_manager) {
248 editor_manager->Quit();
254 shortcut_manager,
"Undo", {ImGuiMod_Ctrl, ImGuiKey_Z},
256 if (editor_manager && editor_manager->GetCurrentEditor()) {
257 editor_manager->GetCurrentEditor()->Undo();
263 shortcut_manager,
"Redo", {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_Z},
265 if (editor_manager && editor_manager->GetCurrentEditor()) {
266 editor_manager->GetCurrentEditor()->Redo();
272 shortcut_manager,
"Cut", {ImGuiMod_Ctrl, ImGuiKey_X},
274 if (editor_manager && editor_manager->GetCurrentEditor()) {
275 editor_manager->GetCurrentEditor()->Cut();
281 shortcut_manager,
"Copy", {ImGuiMod_Ctrl, ImGuiKey_C},
283 if (editor_manager && editor_manager->GetCurrentEditor()) {
284 editor_manager->GetCurrentEditor()->Copy();
290 shortcut_manager,
"Paste", {ImGuiMod_Ctrl, ImGuiKey_V},
292 if (editor_manager && editor_manager->GetCurrentEditor()) {
293 editor_manager->GetCurrentEditor()->Paste();
299 shortcut_manager,
"Find", {ImGuiMod_Ctrl, ImGuiKey_F},
301 if (editor_manager && editor_manager->GetCurrentEditor()) {
302 editor_manager->GetCurrentEditor()->Find();
308 shortcut_manager,
"Command Palette",
309 {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_P},
311 if (ui_coordinator) {
312 ui_coordinator->ShowCommandPalette();
318 shortcut_manager,
"Window Finder", {ImGuiMod_Ctrl, ImGuiKey_P},
320 if (ui_coordinator) {
321 ui_coordinator->ShowPanelFinder();
327 shortcut_manager,
"Keyboard Shortcuts",
328 {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_Slash},
330 if (ui_coordinator) {
331 ui_coordinator->ShowShortcutsBrowser();
337 shortcut_manager,
"Global Search",
338 {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_K},
340 if (ui_coordinator) {
341 ui_coordinator->ShowGlobalSearch();
347 shortcut_manager,
"Load Last ROM", {ImGuiMod_Ctrl, ImGuiKey_R},
350 if (!recent.GetRecentFiles().empty() && editor_manager) {
351 editor_manager->OpenRomOrProject(recent.GetRecentFiles().front());
357 shortcut_manager,
"Show About", ImGuiKey_F1,
360 popup_manager->Show(
"About");
365 auto register_editor_shortcut = [&](
EditorType type, ImGuiKey key) {
366 RegisterIfValid(shortcut_manager,
367 absl::StrFormat(
"switch.%d",
static_cast<int>(type)),
368 {ImGuiMod_Ctrl, key}, [editor_manager, type]() {
369 if (editor_manager) {
370 editor_manager->SwitchToEditor(type);
389 auto register_editor_command = [&](
EditorType type,
const std::string& name) {
391 absl::StrFormat(
"Switch to %s Editor", name), [editor_manager, type]() {
392 if (editor_manager) {
393 editor_manager->SwitchToEditor(type);
410 if (editor_manager) {
411 for (
const auto& def : kMusicEditorShortcuts) {
413 shortcut_manager, def.id, def.keys,
414 [editor_manager,
id = def.id]() {
417 auto* current_editor = editor_manager->GetCurrentEditor();
418 if (!current_editor ||
419 current_editor->type() != EditorType::kMusic) {
422 auto* editor_set = editor_manager->GetCurrentEditorSet();
424 editor_set ? editor_set->GetMusicEditor() :
nullptr;
428 if (
id ==
"music.play_pause") {
429 music_editor->TogglePlayPause();
430 }
else if (
id ==
"music.stop") {
431 music_editor->StopPlayback();
432 }
else if (
id ==
"music.speed_up" ||
433 id ==
"music.speed_up_keypad") {
434 music_editor->SpeedUp();
435 }
else if (
id ==
"music.speed_down" ||
436 id ==
"music.speed_down_keypad") {
437 music_editor->SlowDown();
445 if (editor_manager) {
446 for (
const auto& def : kDungeonEditorShortcuts) {
448 shortcut_manager, def.id, def.keys,
449 [editor_manager,
id = def.id]() {
452 auto* current_editor = editor_manager->GetCurrentEditor();
453 if (!current_editor ||
454 current_editor->type() != EditorType::kDungeon) {
457 auto* editor_set = editor_manager->GetCurrentEditorSet();
458 auto* dungeon_editor =
459 editor_set ? editor_set->GetDungeonEditor() :
nullptr;
462 auto* obj_selector = dungeon_editor->object_editor_panel();
463 auto* obj_editor = dungeon_editor->object_editor_content();
464 if (!obj_selector || !obj_editor)
467 if (
id ==
"dungeon.object.select_tool") {
469 obj_selector->CancelPlacement();
470 }
else if (
id ==
"dungeon.object.place_tool") {
473 }
else if (
id ==
"dungeon.object.delete_tool") {
474 dungeon_editor->QueueRoomCanvasDeleteShortcut();
475 }
else if (
id ==
"dungeon.object.next_object") {
476 obj_editor->CycleObjectSelection(1);
477 }
else if (
id ==
"dungeon.object.prev_object") {
478 obj_editor->CycleObjectSelection(-1);
479 }
else if (
id ==
"dungeon.object.copy") {
480 obj_editor->CopySelectedObjects();
481 }
else if (
id ==
"dungeon.object.paste") {
482 obj_editor->PasteObjects();
483 }
else if (
id ==
"dungeon.object.delete") {
484 dungeon_editor->QueueRoomCanvasDeleteShortcut();
492 if (editor_manager) {
495 shortcut_manager, def.id, def.keys,
496 [editor_manager,
id = def.id]() {
499 auto* current_editor = editor_manager->GetCurrentEditor();
500 if (!current_editor ||
501 current_editor->type() != EditorType::kOverworld) {
504 auto* editor_set = editor_manager->GetCurrentEditorSet();
505 auto* overworld_editor =
506 editor_set ? editor_set->GetOverworldEditor() :
nullptr;
507 if (!overworld_editor)
510 if (
id ==
"overworld.brush_toggle") {
511 overworld_editor->ToggleBrushTool();
512 }
else if (
id ==
"overworld.fill") {
513 overworld_editor->ActivateFillTool();
514 }
else if (
id ==
"overworld.next_tile") {
515 overworld_editor->CycleTileSelection(1);
516 }
else if (
id ==
"overworld.prev_tile") {
517 overworld_editor->CycleTileSelection(-1);
520 Shortcut::Scope::kEditor);
525 if (editor_manager) {
528 shortcut_manager, def.id, def.keys,
529 [editor_manager,
id = def.id]() {
532 auto* current_editor = editor_manager->GetCurrentEditor();
533 if (!current_editor ||
534 current_editor->type() != EditorType::kGraphics) {
537 auto* editor_set = editor_manager->GetCurrentEditorSet();
538 auto* graphics_editor =
539 editor_set ? editor_set->GetGraphicsEditor() :
nullptr;
540 if (!graphics_editor)
543 if (
id ==
"graphics.next_sheet") {
544 graphics_editor->NextSheet();
545 }
else if (
id ==
"graphics.prev_sheet") {
546 graphics_editor->PrevSheet();
549 Shortcut::Scope::kEditor);
554 shortcut_manager,
"Editor Selection", {ImGuiMod_Ctrl, ImGuiKey_E},
556 if (ui_coordinator) {
557 ui_coordinator->ShowEditorSelection();
560 Shortcut::Scope::kGlobal);
563 shortcut_manager,
"Panel Browser",
564 {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_B},
566 if (ui_coordinator) {
567 ui_coordinator->ShowWindowBrowser();
570 Shortcut::Scope::kGlobal);
572 shortcut_manager,
"Window Browser",
573 {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_B},
575 if (ui_coordinator) {
576 ui_coordinator->ShowWindowBrowser();
579 Shortcut::Scope::kGlobal);
581 shortcut_manager,
"Panel Browser (Alt)",
582 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_P},
584 if (ui_coordinator) {
585 ui_coordinator->ShowWindowBrowser();
588 Shortcut::Scope::kGlobal);
590 shortcut_manager,
"Window Browser (Alt)",
591 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_P},
593 if (ui_coordinator) {
594 ui_coordinator->ShowWindowBrowser();
597 Shortcut::Scope::kGlobal);
600 shortcut_manager,
"View: Previous Right Panel",
601 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_LeftBracket},
603 if (!editor_manager) {
606 if (
auto* right_panel = editor_manager->right_drawer_manager()) {
607 right_panel->CycleToPreviousDrawer();
610 Shortcut::Scope::kGlobal);
612 shortcut_manager,
"View: Previous Right Drawer",
613 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_LeftBracket},
615 if (!editor_manager) {
618 if (
auto* right_drawer = editor_manager->right_drawer_manager()) {
619 right_drawer->CycleToPreviousDrawer();
622 Shortcut::Scope::kGlobal);
625 shortcut_manager,
"View: Next Right Panel",
626 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_RightBracket},
628 if (!editor_manager) {
631 if (
auto* right_panel = editor_manager->right_drawer_manager()) {
632 right_panel->CycleToNextDrawer();
635 Shortcut::Scope::kGlobal);
637 shortcut_manager,
"View: Next Right Drawer",
638 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_RightBracket},
640 if (!editor_manager) {
643 if (
auto* right_drawer = editor_manager->right_drawer_manager()) {
644 right_drawer->CycleToNextDrawer();
647 Shortcut::Scope::kGlobal);
649 if (window_manager) {
653 shortcut_manager,
"Show Dungeon Panels",
654 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_D},
656 window_manager->ShowAllWindowsInCategory(
657 window_manager->GetActiveSessionId(),
"Dungeon");
659 Shortcut::Scope::kEditor);
661 shortcut_manager,
"Show Dungeon Windows",
662 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_D},
664 window_manager->ShowAllWindowsInCategory(
665 window_manager->GetActiveSessionId(),
"Dungeon");
667 Shortcut::Scope::kEditor);
669 shortcut_manager,
"Show Graphics Panels",
670 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_G},
672 window_manager->ShowAllWindowsInCategory(
673 window_manager->GetActiveSessionId(),
"Graphics");
675 Shortcut::Scope::kEditor);
677 shortcut_manager,
"Show Graphics Windows",
678 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_G},
680 window_manager->ShowAllWindowsInCategory(
681 window_manager->GetActiveSessionId(),
"Graphics");
683 Shortcut::Scope::kEditor);
685 shortcut_manager,
"Show Screen Panels",
686 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_S},
688 window_manager->ShowAllWindowsInCategory(
689 window_manager->GetActiveSessionId(),
"Screen");
691 Shortcut::Scope::kEditor);
693 shortcut_manager,
"Show Screen Windows",
694 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_S},
696 window_manager->ShowAllWindowsInCategory(
697 window_manager->GetActiveSessionId(),
"Screen");
699 Shortcut::Scope::kEditor);
702#ifdef YAZE_BUILD_AGENT_UI
704 {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_A},
706 if (editor_manager) {
707 editor_manager->ShowAIAgent();
712 {ImGuiMod_Ctrl, ImGuiKey_H}, [editor_manager]() {
713 if (editor_manager) {
714 editor_manager->ShowChatHistory();
719 {ImGuiMod_Ctrl, ImGuiMod_Shift,
722 if (editor_manager) {
723 editor_manager->ShowProposalDrawer();
731 shortcut_manager->
RegisterCommand(
"Layout Profile: Code", [editor_manager]() {
732 if (editor_manager) {
733 editor_manager->ApplyLayoutProfile(
"code");
737 "Layout Profile: Debug", [editor_manager]() {
738 if (editor_manager) {
739 editor_manager->ApplyLayoutProfile(
"debug");
743 "Layout Profile: Mapping", [editor_manager]() {
744 if (editor_manager) {
745 editor_manager->ApplyLayoutProfile(
"mapping");
748 shortcut_manager->
RegisterCommand(
"Layout Profile: Chat", [editor_manager]() {
749 if (editor_manager) {
750 editor_manager->ApplyLayoutProfile(
"chat");
754 "Layout Snapshot: Capture", [editor_manager]() {
755 if (editor_manager) {
756 editor_manager->CaptureTemporaryLayoutSnapshot();
760 "Layout Snapshot: Restore", [editor_manager]() {
761 if (editor_manager) {
762 editor_manager->RestoreTemporaryLayoutSnapshot();
766 "Layout Snapshot: Clear", [editor_manager]() {
767 if (editor_manager) {
768 editor_manager->ClearTemporaryLayoutSnapshot();
773 "Layout: Apply Minimal Preset", [editor_manager]() {
774 if (editor_manager) {
775 editor_manager->ApplyLayoutPreset(
"Minimal");
779 "Layout: Apply Developer Preset", [editor_manager]() {
780 if (editor_manager) {
781 editor_manager->ApplyLayoutPreset(
"Developer");
785 "Layout: Apply Designer Preset", [editor_manager]() {
786 if (editor_manager) {
787 editor_manager->ApplyLayoutPreset(
"Designer");
791 "Layout: Apply Modder Preset", [editor_manager]() {
792 if (editor_manager) {
793 editor_manager->ApplyLayoutPreset(
"Modder");
797 "Layout: Apply Overworld Expert Preset", [editor_manager]() {
798 if (editor_manager) {
799 editor_manager->ApplyLayoutPreset(
"Overworld Expert");
803 "Layout: Apply Dungeon Expert Preset", [editor_manager]() {
804 if (editor_manager) {
805 editor_manager->ApplyLayoutPreset(
"Dungeon Expert");
809 "Layout: Apply Testing Preset", [editor_manager]() {
810 if (editor_manager) {
811 editor_manager->ApplyLayoutPreset(
"Testing");
815 "Layout: Apply Audio Preset", [editor_manager]() {
816 if (editor_manager) {
817 editor_manager->ApplyLayoutPreset(
"Audio");
821 "Layout: Reset Current Editor", [editor_manager]() {
822 if (editor_manager) {
823 editor_manager->ResetCurrentEditorLayout();
830 if (editor_manager) {
831 using DrawerType = RightDrawerManager::DrawerType;
832 auto* right_drawer_manager = editor_manager->right_drawer_manager();
833 if (right_drawer_manager) {
838 DrawerCmd drawer_cmds[] = {
839 {
"View: Toggle AI Agent Panel", DrawerType::kAgentChat},
840 {
"View: Toggle AI Agent Drawer", DrawerType::kAgentChat},
841 {
"View: Toggle Proposals Panel", DrawerType::kProposals},
842 {
"View: Toggle Proposals Drawer", DrawerType::kProposals},
843 {
"View: Toggle Settings Panel", DrawerType::kSettings},
844 {
"View: Toggle Settings Drawer", DrawerType::kSettings},
845 {
"View: Toggle Help Panel", DrawerType::kHelp},
846 {
"View: Toggle Help Drawer", DrawerType::kHelp},
847 {
"View: Toggle Notifications", DrawerType::kNotifications},
848 {
"View: Toggle Notifications Drawer", DrawerType::kNotifications},
849 {
"View: Toggle Properties Panel", DrawerType::kProperties},
850 {
"View: Toggle Properties Drawer", DrawerType::kProperties},
851 {
"View: Toggle Project Panel", DrawerType::kProject},
852 {
"View: Toggle Project Drawer", DrawerType::kProject},
854 for (
const auto& cmd : drawer_cmds) {
856 cmd.label, [right_drawer_manager, drawer_type = cmd.type]() {
857 right_drawer_manager->ToggleDrawer(drawer_type);
861 "View: Previous Right Panel", [right_drawer_manager]() {
862 right_drawer_manager->CycleToPreviousDrawer();
865 "View: Previous Right Drawer", [right_drawer_manager]() {
866 right_drawer_manager->CycleToPreviousDrawer();
869 "View: Next Right Panel", [right_drawer_manager]() {
870 right_drawer_manager->CycleToNextDrawer();
873 "View: Next Right Drawer", [right_drawer_manager]() {
874 right_drawer_manager->CycleToNextDrawer();
882 if (window_manager) {
883 auto categories = window_manager->GetAllCategories();
884 const size_t registration_session_id = window_manager->GetActiveSessionId();
887 "View: Show Panel Browser",
888 [window_manager]() { window_manager->TriggerShowWindowBrowser(); });
890 "View: Show Window Browser",
891 [window_manager]() { window_manager->TriggerShowWindowBrowser(); });
893 for (
const auto& category : categories) {
894 auto windows = window_manager->GetWindowsInCategory(
895 registration_session_id, category);
896 for (
const auto& window : windows) {
897 const std::string window_id = window.card_id;
898 const std::string display_name = window.display_name;
901 absl::StrFormat(
"View: Show %s", display_name),
902 [window_manager, window_id]() {
903 if (window_manager) {
904 window_manager->OpenWindow(window_manager->GetActiveSessionId(),
909 absl::StrFormat(
"View: Hide %s", display_name),
910 [window_manager, window_id]() {
911 if (window_manager) {
912 window_manager->CloseWindow(
913 window_manager->GetActiveSessionId(), window_id);
917 absl::StrFormat(
"View: Toggle %s", display_name),
918 [window_manager, window_id]() {
919 if (window_manager) {
920 window_manager->ToggleWindow(
921 window_manager->GetActiveSessionId(), window_id);
926 absl::StrFormat(
"View: Open %s Window", display_name),
927 [window_manager, window_id]() {
928 if (window_manager) {
929 window_manager->OpenWindow(window_manager->GetActiveSessionId(),
934 absl::StrFormat(
"View: Close %s Window", display_name),
935 [window_manager, window_id]() {
936 if (window_manager) {
937 window_manager->CloseWindow(
938 window_manager->GetActiveSessionId(), window_id);
942 absl::StrFormat(
"View: Toggle %s Window", display_name),
943 [window_manager, window_id]() {
944 if (window_manager) {
945 window_manager->ToggleWindow(
946 window_manager->GetActiveSessionId(), window_id);
952 absl::StrFormat(
"View: Show All %s Panels", category),
954 if (window_manager) {
955 window_manager->ShowAllWindowsInCategory(
956 window_manager->GetActiveSessionId(),
category);
960 absl::StrFormat(
"View: Hide All %s Panels", category),
962 if (window_manager) {
963 window_manager->HideAllWindowsInCategory(
964 window_manager->GetActiveSessionId(),
category);
968 absl::StrFormat(
"View: Show All %s Windows", category),
970 if (window_manager) {
971 window_manager->ShowAllWindowsInCategory(
972 window_manager->GetActiveSessionId(),
category);
976 absl::StrFormat(
"View: Hide All %s Windows", category),
978 if (window_manager) {
979 window_manager->HideAllWindowsInCategory(
980 window_manager->GetActiveSessionId(),
category);