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) {
231 std::string filename =
232 editor_manager->GetCurrentRom()
233 ? editor_manager->GetCurrentRom()->filename()
235 editor_manager->SaveRomAs(filename);
241 shortcut_manager,
"Close ROM", {ImGuiMod_Ctrl, ImGuiKey_W},
243 if (editor_manager && editor_manager->GetCurrentRom()) {
244 editor_manager->GetCurrentRom()->Close();
250 shortcut_manager,
"Quit", {ImGuiMod_Ctrl, ImGuiKey_Q},
252 if (editor_manager) {
253 editor_manager->Quit();
259 shortcut_manager,
"Undo", {ImGuiMod_Ctrl, ImGuiKey_Z},
261 if (editor_manager && editor_manager->GetCurrentEditor()) {
262 editor_manager->GetCurrentEditor()->Undo();
268 shortcut_manager,
"Redo", {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_Z},
270 if (editor_manager && editor_manager->GetCurrentEditor()) {
271 editor_manager->GetCurrentEditor()->Redo();
277 shortcut_manager,
"Cut", {ImGuiMod_Ctrl, ImGuiKey_X},
279 if (editor_manager && editor_manager->GetCurrentEditor()) {
280 editor_manager->GetCurrentEditor()->Cut();
286 shortcut_manager,
"Copy", {ImGuiMod_Ctrl, ImGuiKey_C},
288 if (editor_manager && editor_manager->GetCurrentEditor()) {
289 editor_manager->GetCurrentEditor()->Copy();
295 shortcut_manager,
"Paste", {ImGuiMod_Ctrl, ImGuiKey_V},
297 if (editor_manager && editor_manager->GetCurrentEditor()) {
298 editor_manager->GetCurrentEditor()->Paste();
304 shortcut_manager,
"Find", {ImGuiMod_Ctrl, ImGuiKey_F},
306 if (editor_manager && editor_manager->GetCurrentEditor()) {
307 editor_manager->GetCurrentEditor()->Find();
313 shortcut_manager,
"Command Palette",
314 {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_P},
316 if (ui_coordinator) {
317 ui_coordinator->ShowCommandPalette();
323 shortcut_manager,
"Global Search",
324 {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_K},
326 if (ui_coordinator) {
327 ui_coordinator->ShowGlobalSearch();
333 shortcut_manager,
"Load Last ROM", {ImGuiMod_Ctrl, ImGuiKey_R},
336 if (!recent.GetRecentFiles().empty() && editor_manager) {
337 editor_manager->OpenRomOrProject(recent.GetRecentFiles().front());
343 shortcut_manager,
"Show About", ImGuiKey_F1,
346 popup_manager->Show(
"About");
351 auto register_editor_shortcut = [&](
EditorType type, ImGuiKey key) {
352 RegisterIfValid(shortcut_manager,
353 absl::StrFormat(
"switch.%d",
static_cast<int>(type)),
354 {ImGuiMod_Ctrl, key}, [editor_manager, type]() {
355 if (editor_manager) {
356 editor_manager->SwitchToEditor(type);
375 auto register_editor_command = [&](
EditorType type,
const std::string& name) {
377 absl::StrFormat(
"Switch to %s Editor", name), [editor_manager, type]() {
378 if (editor_manager) {
379 editor_manager->SwitchToEditor(type);
396 if (editor_manager) {
397 for (
const auto& def : kMusicEditorShortcuts) {
399 shortcut_manager, def.id, def.keys,
400 [editor_manager,
id = def.id]() {
403 auto* current_editor = editor_manager->GetCurrentEditor();
404 if (!current_editor ||
405 current_editor->type() != EditorType::kMusic) {
408 auto* editor_set = editor_manager->GetCurrentEditorSet();
410 editor_set ? editor_set->GetMusicEditor() :
nullptr;
414 if (
id ==
"music.play_pause") {
415 music_editor->TogglePlayPause();
416 }
else if (
id ==
"music.stop") {
417 music_editor->StopPlayback();
418 }
else if (
id ==
"music.speed_up" ||
419 id ==
"music.speed_up_keypad") {
420 music_editor->SpeedUp();
421 }
else if (
id ==
"music.speed_down" ||
422 id ==
"music.speed_down_keypad") {
423 music_editor->SlowDown();
431 if (editor_manager) {
432 for (
const auto& def : kDungeonEditorShortcuts) {
434 shortcut_manager, def.id, def.keys,
435 [editor_manager,
id = def.id]() {
438 auto* current_editor = editor_manager->GetCurrentEditor();
439 if (!current_editor ||
440 current_editor->type() != EditorType::kDungeon) {
443 auto* editor_set = editor_manager->GetCurrentEditorSet();
444 auto* dungeon_editor =
445 editor_set ? editor_set->GetDungeonEditor() :
nullptr;
448 auto* obj_selector = dungeon_editor->object_editor_panel();
449 auto* obj_editor = dungeon_editor->object_editor_content();
450 if (!obj_selector || !obj_editor)
453 if (
id ==
"dungeon.object.select_tool") {
455 obj_selector->CancelPlacement();
456 }
else if (
id ==
"dungeon.object.place_tool") {
459 }
else if (
id ==
"dungeon.object.delete_tool") {
461 obj_editor->DeleteSelectedObjects();
462 }
else if (
id ==
"dungeon.object.next_object") {
463 obj_editor->CycleObjectSelection(1);
464 }
else if (
id ==
"dungeon.object.prev_object") {
465 obj_editor->CycleObjectSelection(-1);
466 }
else if (
id ==
"dungeon.object.copy") {
467 obj_editor->CopySelectedObjects();
468 }
else if (
id ==
"dungeon.object.paste") {
469 obj_editor->PasteObjects();
470 }
else if (
id ==
"dungeon.object.delete") {
471 obj_editor->DeleteSelectedObjects();
479 if (editor_manager) {
482 shortcut_manager, def.id, def.keys,
483 [editor_manager,
id = def.id]() {
486 auto* current_editor = editor_manager->GetCurrentEditor();
487 if (!current_editor ||
488 current_editor->type() != EditorType::kOverworld) {
491 auto* editor_set = editor_manager->GetCurrentEditorSet();
492 auto* overworld_editor =
493 editor_set ? editor_set->GetOverworldEditor() :
nullptr;
494 if (!overworld_editor)
497 if (
id ==
"overworld.brush_toggle") {
498 overworld_editor->ToggleBrushTool();
499 }
else if (
id ==
"overworld.fill") {
500 overworld_editor->ActivateFillTool();
501 }
else if (
id ==
"overworld.next_tile") {
502 overworld_editor->CycleTileSelection(1);
503 }
else if (
id ==
"overworld.prev_tile") {
504 overworld_editor->CycleTileSelection(-1);
507 Shortcut::Scope::kEditor);
512 if (editor_manager) {
515 shortcut_manager, def.id, def.keys,
516 [editor_manager,
id = def.id]() {
519 auto* current_editor = editor_manager->GetCurrentEditor();
520 if (!current_editor ||
521 current_editor->type() != EditorType::kGraphics) {
524 auto* editor_set = editor_manager->GetCurrentEditorSet();
525 auto* graphics_editor =
526 editor_set ? editor_set->GetGraphicsEditor() :
nullptr;
527 if (!graphics_editor)
530 if (
id ==
"graphics.next_sheet") {
531 graphics_editor->NextSheet();
532 }
else if (
id ==
"graphics.prev_sheet") {
533 graphics_editor->PrevSheet();
536 Shortcut::Scope::kEditor);
541 shortcut_manager,
"Editor Selection", {ImGuiMod_Ctrl, ImGuiKey_E},
543 if (ui_coordinator) {
544 ui_coordinator->ShowEditorSelection();
547 Shortcut::Scope::kGlobal);
550 shortcut_manager,
"Panel Browser",
551 {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_B},
553 if (ui_coordinator) {
554 ui_coordinator->ShowWindowBrowser();
557 Shortcut::Scope::kGlobal);
559 shortcut_manager,
"Window Browser",
560 {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_B},
562 if (ui_coordinator) {
563 ui_coordinator->ShowWindowBrowser();
566 Shortcut::Scope::kGlobal);
568 shortcut_manager,
"Panel Browser (Alt)",
569 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_P},
571 if (ui_coordinator) {
572 ui_coordinator->ShowWindowBrowser();
575 Shortcut::Scope::kGlobal);
577 shortcut_manager,
"Window Browser (Alt)",
578 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_P},
580 if (ui_coordinator) {
581 ui_coordinator->ShowWindowBrowser();
584 Shortcut::Scope::kGlobal);
587 shortcut_manager,
"View: Previous Right Panel",
588 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_LeftBracket},
590 if (!editor_manager) {
593 if (
auto* right_panel = editor_manager->right_drawer_manager()) {
594 right_panel->CycleToPreviousDrawer();
597 Shortcut::Scope::kGlobal);
599 shortcut_manager,
"View: Previous Right Drawer",
600 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_LeftBracket},
602 if (!editor_manager) {
605 if (
auto* right_drawer = editor_manager->right_drawer_manager()) {
606 right_drawer->CycleToPreviousDrawer();
609 Shortcut::Scope::kGlobal);
612 shortcut_manager,
"View: Next Right Panel",
613 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_RightBracket},
615 if (!editor_manager) {
618 if (
auto* right_panel = editor_manager->right_drawer_manager()) {
619 right_panel->CycleToNextDrawer();
622 Shortcut::Scope::kGlobal);
624 shortcut_manager,
"View: Next Right Drawer",
625 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_RightBracket},
627 if (!editor_manager) {
630 if (
auto* right_drawer = editor_manager->right_drawer_manager()) {
631 right_drawer->CycleToNextDrawer();
634 Shortcut::Scope::kGlobal);
636 if (window_manager) {
640 shortcut_manager,
"Show Dungeon Panels",
641 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_D},
643 window_manager->ShowAllWindowsInCategory(0,
"Dungeon");
645 Shortcut::Scope::kEditor);
647 shortcut_manager,
"Show Dungeon Windows",
648 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_D},
650 window_manager->ShowAllWindowsInCategory(0,
"Dungeon");
652 Shortcut::Scope::kEditor);
654 shortcut_manager,
"Show Graphics Panels",
655 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_G},
657 window_manager->ShowAllWindowsInCategory(0,
"Graphics");
659 Shortcut::Scope::kEditor);
661 shortcut_manager,
"Show Graphics Windows",
662 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_G},
664 window_manager->ShowAllWindowsInCategory(0,
"Graphics");
666 Shortcut::Scope::kEditor);
668 shortcut_manager,
"Show Screen Panels",
669 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_S},
671 window_manager->ShowAllWindowsInCategory(0,
"Screen");
673 Shortcut::Scope::kEditor);
675 shortcut_manager,
"Show Screen Windows",
676 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_S},
678 window_manager->ShowAllWindowsInCategory(0,
"Screen");
680 Shortcut::Scope::kEditor);
683#ifdef YAZE_BUILD_AGENT_UI
685 {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_A},
687 if (editor_manager) {
688 editor_manager->ShowAIAgent();
693 {ImGuiMod_Ctrl, ImGuiKey_H}, [editor_manager]() {
694 if (editor_manager) {
695 editor_manager->ShowChatHistory();
700 {ImGuiMod_Ctrl, ImGuiMod_Shift,
703 if (editor_manager) {
704 editor_manager->ShowProposalDrawer();
712 shortcut_manager->
RegisterCommand(
"Layout Profile: Code", [editor_manager]() {
713 if (editor_manager) {
714 editor_manager->ApplyLayoutProfile(
"code");
718 "Layout Profile: Debug", [editor_manager]() {
719 if (editor_manager) {
720 editor_manager->ApplyLayoutProfile(
"debug");
724 "Layout Profile: Mapping", [editor_manager]() {
725 if (editor_manager) {
726 editor_manager->ApplyLayoutProfile(
"mapping");
729 shortcut_manager->
RegisterCommand(
"Layout Profile: Chat", [editor_manager]() {
730 if (editor_manager) {
731 editor_manager->ApplyLayoutProfile(
"chat");
735 "Layout Snapshot: Capture", [editor_manager]() {
736 if (editor_manager) {
737 editor_manager->CaptureTemporaryLayoutSnapshot();
741 "Layout Snapshot: Restore", [editor_manager]() {
742 if (editor_manager) {
743 editor_manager->RestoreTemporaryLayoutSnapshot();
747 "Layout Snapshot: Clear", [editor_manager]() {
748 if (editor_manager) {
749 editor_manager->ClearTemporaryLayoutSnapshot();
754 "Layout: Apply Minimal Preset", [editor_manager]() {
755 if (editor_manager) {
756 editor_manager->ApplyLayoutPreset(
"Minimal");
760 "Layout: Apply Developer Preset", [editor_manager]() {
761 if (editor_manager) {
762 editor_manager->ApplyLayoutPreset(
"Developer");
766 "Layout: Apply Designer Preset", [editor_manager]() {
767 if (editor_manager) {
768 editor_manager->ApplyLayoutPreset(
"Designer");
772 "Layout: Apply Modder Preset", [editor_manager]() {
773 if (editor_manager) {
774 editor_manager->ApplyLayoutPreset(
"Modder");
778 "Layout: Apply Overworld Expert Preset", [editor_manager]() {
779 if (editor_manager) {
780 editor_manager->ApplyLayoutPreset(
"Overworld Expert");
784 "Layout: Apply Dungeon Expert Preset", [editor_manager]() {
785 if (editor_manager) {
786 editor_manager->ApplyLayoutPreset(
"Dungeon Expert");
790 "Layout: Apply Testing Preset", [editor_manager]() {
791 if (editor_manager) {
792 editor_manager->ApplyLayoutPreset(
"Testing");
796 "Layout: Apply Audio Preset", [editor_manager]() {
797 if (editor_manager) {
798 editor_manager->ApplyLayoutPreset(
"Audio");
802 "Layout: Reset Current Editor", [editor_manager]() {
803 if (editor_manager) {
804 editor_manager->ResetCurrentEditorLayout();
811 if (editor_manager) {
812 using DrawerType = RightDrawerManager::DrawerType;
813 auto* right_drawer_manager = editor_manager->right_drawer_manager();
814 if (right_drawer_manager) {
819 DrawerCmd drawer_cmds[] = {
820 {
"View: Toggle AI Agent Panel", DrawerType::kAgentChat},
821 {
"View: Toggle AI Agent Drawer", DrawerType::kAgentChat},
822 {
"View: Toggle Proposals Panel", DrawerType::kProposals},
823 {
"View: Toggle Proposals Drawer", DrawerType::kProposals},
824 {
"View: Toggle Settings Panel", DrawerType::kSettings},
825 {
"View: Toggle Settings Drawer", DrawerType::kSettings},
826 {
"View: Toggle Help Panel", DrawerType::kHelp},
827 {
"View: Toggle Help Drawer", DrawerType::kHelp},
828 {
"View: Toggle Notifications", DrawerType::kNotifications},
829 {
"View: Toggle Notifications Drawer", DrawerType::kNotifications},
830 {
"View: Toggle Properties Panel", DrawerType::kProperties},
831 {
"View: Toggle Properties Drawer", DrawerType::kProperties},
832 {
"View: Toggle Project Panel", DrawerType::kProject},
833 {
"View: Toggle Project Drawer", DrawerType::kProject},
835 for (
const auto& cmd : drawer_cmds) {
837 cmd.label, [right_drawer_manager, drawer_type = cmd.type]() {
838 right_drawer_manager->ToggleDrawer(drawer_type);
842 "View: Previous Right Panel", [right_drawer_manager]() {
843 right_drawer_manager->CycleToPreviousDrawer();
846 "View: Previous Right Drawer", [right_drawer_manager]() {
847 right_drawer_manager->CycleToPreviousDrawer();
850 "View: Next Right Panel", [right_drawer_manager]() {
851 right_drawer_manager->CycleToNextDrawer();
854 "View: Next Right Drawer", [right_drawer_manager]() {
855 right_drawer_manager->CycleToNextDrawer();
863 if (window_manager) {
864 auto categories = window_manager->GetAllCategories();
868 "View: Show Panel Browser",
869 [window_manager]() { window_manager->TriggerShowWindowBrowser(); });
871 "View: Show Window Browser",
872 [window_manager]() { window_manager->TriggerShowWindowBrowser(); });
874 for (
const auto& category : categories) {
875 auto windows = window_manager->GetWindowsInCategory(session_id, category);
876 for (
const auto& window : windows) {
877 const std::string window_id = window.card_id;
878 const std::string display_name = window.display_name;
881 absl::StrFormat(
"View: Show %s", display_name),
882 [window_manager, window_id]() {
883 if (window_manager) {
884 window_manager->OpenWindow(0, window_id);
888 absl::StrFormat(
"View: Hide %s", display_name),
889 [window_manager, window_id]() {
890 if (window_manager) {
891 window_manager->CloseWindow(0, window_id);
895 absl::StrFormat(
"View: Toggle %s", display_name),
896 [window_manager, window_id]() {
897 if (window_manager) {
898 window_manager->ToggleWindow(0, window_id);
903 absl::StrFormat(
"View: Open %s Window", display_name),
904 [window_manager, window_id]() {
905 if (window_manager) {
906 window_manager->OpenWindow(0, window_id);
910 absl::StrFormat(
"View: Close %s Window", display_name),
911 [window_manager, window_id]() {
912 if (window_manager) {
913 window_manager->CloseWindow(0, window_id);
917 absl::StrFormat(
"View: Toggle %s Window", display_name),
918 [window_manager, window_id]() {
919 if (window_manager) {
920 window_manager->ToggleWindow(0, window_id);
926 absl::StrFormat(
"View: Show All %s Panels", category),
927 [window_manager, category]() {
928 if (window_manager) {
929 window_manager->ShowAllWindowsInCategory(0, category);
933 absl::StrFormat(
"View: Hide All %s Panels", category),
934 [window_manager, category]() {
935 if (window_manager) {
936 window_manager->HideAllWindowsInCategory(0, category);
940 absl::StrFormat(
"View: Show All %s Windows", category),
941 [window_manager, category]() {
942 if (window_manager) {
943 window_manager->ShowAllWindowsInCategory(0, category);
947 absl::StrFormat(
"View: Hide All %s Windows", category),
948 [window_manager, category]() {
949 if (window_manager) {
950 window_manager->HideAllWindowsInCategory(0, category);