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,
"Global Search",
319 {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_K},
321 if (ui_coordinator) {
322 ui_coordinator->ShowGlobalSearch();
328 shortcut_manager,
"Load Last ROM", {ImGuiMod_Ctrl, ImGuiKey_R},
331 if (!recent.GetRecentFiles().empty() && editor_manager) {
332 editor_manager->OpenRomOrProject(recent.GetRecentFiles().front());
338 shortcut_manager,
"Show About", ImGuiKey_F1,
341 popup_manager->Show(
"About");
346 auto register_editor_shortcut = [&](
EditorType type, ImGuiKey key) {
347 RegisterIfValid(shortcut_manager,
348 absl::StrFormat(
"switch.%d",
static_cast<int>(type)),
349 {ImGuiMod_Ctrl, key}, [editor_manager, type]() {
350 if (editor_manager) {
351 editor_manager->SwitchToEditor(type);
370 auto register_editor_command = [&](
EditorType type,
const std::string& name) {
372 absl::StrFormat(
"Switch to %s Editor", name), [editor_manager, type]() {
373 if (editor_manager) {
374 editor_manager->SwitchToEditor(type);
391 if (editor_manager) {
392 for (
const auto& def : kMusicEditorShortcuts) {
394 shortcut_manager, def.id, def.keys,
395 [editor_manager,
id = def.id]() {
398 auto* current_editor = editor_manager->GetCurrentEditor();
399 if (!current_editor ||
400 current_editor->type() != EditorType::kMusic) {
403 auto* editor_set = editor_manager->GetCurrentEditorSet();
405 editor_set ? editor_set->GetMusicEditor() :
nullptr;
409 if (
id ==
"music.play_pause") {
410 music_editor->TogglePlayPause();
411 }
else if (
id ==
"music.stop") {
412 music_editor->StopPlayback();
413 }
else if (
id ==
"music.speed_up" ||
414 id ==
"music.speed_up_keypad") {
415 music_editor->SpeedUp();
416 }
else if (
id ==
"music.speed_down" ||
417 id ==
"music.speed_down_keypad") {
418 music_editor->SlowDown();
426 if (editor_manager) {
427 for (
const auto& def : kDungeonEditorShortcuts) {
429 shortcut_manager, def.id, def.keys,
430 [editor_manager,
id = def.id]() {
433 auto* current_editor = editor_manager->GetCurrentEditor();
434 if (!current_editor ||
435 current_editor->type() != EditorType::kDungeon) {
438 auto* editor_set = editor_manager->GetCurrentEditorSet();
439 auto* dungeon_editor =
440 editor_set ? editor_set->GetDungeonEditor() :
nullptr;
443 auto* obj_selector = dungeon_editor->object_editor_panel();
444 auto* obj_editor = dungeon_editor->object_editor_content();
445 if (!obj_selector || !obj_editor)
448 if (
id ==
"dungeon.object.select_tool") {
450 obj_selector->CancelPlacement();
451 }
else if (
id ==
"dungeon.object.place_tool") {
454 }
else if (
id ==
"dungeon.object.delete_tool") {
456 obj_editor->DeleteSelectedObjects();
457 }
else if (
id ==
"dungeon.object.next_object") {
458 obj_editor->CycleObjectSelection(1);
459 }
else if (
id ==
"dungeon.object.prev_object") {
460 obj_editor->CycleObjectSelection(-1);
461 }
else if (
id ==
"dungeon.object.copy") {
462 obj_editor->CopySelectedObjects();
463 }
else if (
id ==
"dungeon.object.paste") {
464 obj_editor->PasteObjects();
465 }
else if (
id ==
"dungeon.object.delete") {
466 obj_editor->DeleteSelectedObjects();
474 if (editor_manager) {
477 shortcut_manager, def.id, def.keys,
478 [editor_manager,
id = def.id]() {
481 auto* current_editor = editor_manager->GetCurrentEditor();
482 if (!current_editor ||
483 current_editor->type() != EditorType::kOverworld) {
486 auto* editor_set = editor_manager->GetCurrentEditorSet();
487 auto* overworld_editor =
488 editor_set ? editor_set->GetOverworldEditor() :
nullptr;
489 if (!overworld_editor)
492 if (
id ==
"overworld.brush_toggle") {
493 overworld_editor->ToggleBrushTool();
494 }
else if (
id ==
"overworld.fill") {
495 overworld_editor->ActivateFillTool();
496 }
else if (
id ==
"overworld.next_tile") {
497 overworld_editor->CycleTileSelection(1);
498 }
else if (
id ==
"overworld.prev_tile") {
499 overworld_editor->CycleTileSelection(-1);
502 Shortcut::Scope::kEditor);
507 if (editor_manager) {
510 shortcut_manager, def.id, def.keys,
511 [editor_manager,
id = def.id]() {
514 auto* current_editor = editor_manager->GetCurrentEditor();
515 if (!current_editor ||
516 current_editor->type() != EditorType::kGraphics) {
519 auto* editor_set = editor_manager->GetCurrentEditorSet();
520 auto* graphics_editor =
521 editor_set ? editor_set->GetGraphicsEditor() :
nullptr;
522 if (!graphics_editor)
525 if (
id ==
"graphics.next_sheet") {
526 graphics_editor->NextSheet();
527 }
else if (
id ==
"graphics.prev_sheet") {
528 graphics_editor->PrevSheet();
531 Shortcut::Scope::kEditor);
536 shortcut_manager,
"Editor Selection", {ImGuiMod_Ctrl, ImGuiKey_E},
538 if (ui_coordinator) {
539 ui_coordinator->ShowEditorSelection();
542 Shortcut::Scope::kGlobal);
545 shortcut_manager,
"Panel Browser",
546 {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_B},
548 if (ui_coordinator) {
549 ui_coordinator->ShowWindowBrowser();
552 Shortcut::Scope::kGlobal);
554 shortcut_manager,
"Window Browser",
555 {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_B},
557 if (ui_coordinator) {
558 ui_coordinator->ShowWindowBrowser();
561 Shortcut::Scope::kGlobal);
563 shortcut_manager,
"Panel Browser (Alt)",
564 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_P},
566 if (ui_coordinator) {
567 ui_coordinator->ShowWindowBrowser();
570 Shortcut::Scope::kGlobal);
572 shortcut_manager,
"Window Browser (Alt)",
573 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_P},
575 if (ui_coordinator) {
576 ui_coordinator->ShowWindowBrowser();
579 Shortcut::Scope::kGlobal);
582 shortcut_manager,
"View: Previous Right Panel",
583 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_LeftBracket},
585 if (!editor_manager) {
588 if (
auto* right_panel = editor_manager->right_drawer_manager()) {
589 right_panel->CycleToPreviousDrawer();
592 Shortcut::Scope::kGlobal);
594 shortcut_manager,
"View: Previous Right Drawer",
595 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_LeftBracket},
597 if (!editor_manager) {
600 if (
auto* right_drawer = editor_manager->right_drawer_manager()) {
601 right_drawer->CycleToPreviousDrawer();
604 Shortcut::Scope::kGlobal);
607 shortcut_manager,
"View: Next Right Panel",
608 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_RightBracket},
610 if (!editor_manager) {
613 if (
auto* right_panel = editor_manager->right_drawer_manager()) {
614 right_panel->CycleToNextDrawer();
617 Shortcut::Scope::kGlobal);
619 shortcut_manager,
"View: Next Right Drawer",
620 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_RightBracket},
622 if (!editor_manager) {
625 if (
auto* right_drawer = editor_manager->right_drawer_manager()) {
626 right_drawer->CycleToNextDrawer();
629 Shortcut::Scope::kGlobal);
631 if (window_manager) {
635 shortcut_manager,
"Show Dungeon Panels",
636 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_D},
638 window_manager->ShowAllWindowsInCategory(
639 window_manager->GetActiveSessionId(),
"Dungeon");
641 Shortcut::Scope::kEditor);
643 shortcut_manager,
"Show Dungeon Windows",
644 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_D},
646 window_manager->ShowAllWindowsInCategory(
647 window_manager->GetActiveSessionId(),
"Dungeon");
649 Shortcut::Scope::kEditor);
651 shortcut_manager,
"Show Graphics Panels",
652 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_G},
654 window_manager->ShowAllWindowsInCategory(
655 window_manager->GetActiveSessionId(),
"Graphics");
657 Shortcut::Scope::kEditor);
659 shortcut_manager,
"Show Graphics Windows",
660 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_G},
662 window_manager->ShowAllWindowsInCategory(
663 window_manager->GetActiveSessionId(),
"Graphics");
665 Shortcut::Scope::kEditor);
667 shortcut_manager,
"Show Screen Panels",
668 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_S},
670 window_manager->ShowAllWindowsInCategory(
671 window_manager->GetActiveSessionId(),
"Screen");
673 Shortcut::Scope::kEditor);
675 shortcut_manager,
"Show Screen Windows",
676 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_S},
678 window_manager->ShowAllWindowsInCategory(
679 window_manager->GetActiveSessionId(),
"Screen");
681 Shortcut::Scope::kEditor);
684#ifdef YAZE_BUILD_AGENT_UI
686 {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_A},
688 if (editor_manager) {
689 editor_manager->ShowAIAgent();
694 {ImGuiMod_Ctrl, ImGuiKey_H}, [editor_manager]() {
695 if (editor_manager) {
696 editor_manager->ShowChatHistory();
701 {ImGuiMod_Ctrl, ImGuiMod_Shift,
704 if (editor_manager) {
705 editor_manager->ShowProposalDrawer();
713 shortcut_manager->
RegisterCommand(
"Layout Profile: Code", [editor_manager]() {
714 if (editor_manager) {
715 editor_manager->ApplyLayoutProfile(
"code");
719 "Layout Profile: Debug", [editor_manager]() {
720 if (editor_manager) {
721 editor_manager->ApplyLayoutProfile(
"debug");
725 "Layout Profile: Mapping", [editor_manager]() {
726 if (editor_manager) {
727 editor_manager->ApplyLayoutProfile(
"mapping");
730 shortcut_manager->
RegisterCommand(
"Layout Profile: Chat", [editor_manager]() {
731 if (editor_manager) {
732 editor_manager->ApplyLayoutProfile(
"chat");
736 "Layout Snapshot: Capture", [editor_manager]() {
737 if (editor_manager) {
738 editor_manager->CaptureTemporaryLayoutSnapshot();
742 "Layout Snapshot: Restore", [editor_manager]() {
743 if (editor_manager) {
744 editor_manager->RestoreTemporaryLayoutSnapshot();
748 "Layout Snapshot: Clear", [editor_manager]() {
749 if (editor_manager) {
750 editor_manager->ClearTemporaryLayoutSnapshot();
755 "Layout: Apply Minimal Preset", [editor_manager]() {
756 if (editor_manager) {
757 editor_manager->ApplyLayoutPreset(
"Minimal");
761 "Layout: Apply Developer Preset", [editor_manager]() {
762 if (editor_manager) {
763 editor_manager->ApplyLayoutPreset(
"Developer");
767 "Layout: Apply Designer Preset", [editor_manager]() {
768 if (editor_manager) {
769 editor_manager->ApplyLayoutPreset(
"Designer");
773 "Layout: Apply Modder Preset", [editor_manager]() {
774 if (editor_manager) {
775 editor_manager->ApplyLayoutPreset(
"Modder");
779 "Layout: Apply Overworld Expert Preset", [editor_manager]() {
780 if (editor_manager) {
781 editor_manager->ApplyLayoutPreset(
"Overworld Expert");
785 "Layout: Apply Dungeon Expert Preset", [editor_manager]() {
786 if (editor_manager) {
787 editor_manager->ApplyLayoutPreset(
"Dungeon Expert");
791 "Layout: Apply Testing Preset", [editor_manager]() {
792 if (editor_manager) {
793 editor_manager->ApplyLayoutPreset(
"Testing");
797 "Layout: Apply Audio Preset", [editor_manager]() {
798 if (editor_manager) {
799 editor_manager->ApplyLayoutPreset(
"Audio");
803 "Layout: Reset Current Editor", [editor_manager]() {
804 if (editor_manager) {
805 editor_manager->ResetCurrentEditorLayout();
812 if (editor_manager) {
813 using DrawerType = RightDrawerManager::DrawerType;
814 auto* right_drawer_manager = editor_manager->right_drawer_manager();
815 if (right_drawer_manager) {
820 DrawerCmd drawer_cmds[] = {
821 {
"View: Toggle AI Agent Panel", DrawerType::kAgentChat},
822 {
"View: Toggle AI Agent Drawer", DrawerType::kAgentChat},
823 {
"View: Toggle Proposals Panel", DrawerType::kProposals},
824 {
"View: Toggle Proposals Drawer", DrawerType::kProposals},
825 {
"View: Toggle Settings Panel", DrawerType::kSettings},
826 {
"View: Toggle Settings Drawer", DrawerType::kSettings},
827 {
"View: Toggle Help Panel", DrawerType::kHelp},
828 {
"View: Toggle Help Drawer", DrawerType::kHelp},
829 {
"View: Toggle Notifications", DrawerType::kNotifications},
830 {
"View: Toggle Notifications Drawer", DrawerType::kNotifications},
831 {
"View: Toggle Properties Panel", DrawerType::kProperties},
832 {
"View: Toggle Properties Drawer", DrawerType::kProperties},
833 {
"View: Toggle Project Panel", DrawerType::kProject},
834 {
"View: Toggle Project Drawer", DrawerType::kProject},
836 for (
const auto& cmd : drawer_cmds) {
838 cmd.label, [right_drawer_manager, drawer_type = cmd.type]() {
839 right_drawer_manager->ToggleDrawer(drawer_type);
843 "View: Previous Right Panel", [right_drawer_manager]() {
844 right_drawer_manager->CycleToPreviousDrawer();
847 "View: Previous Right Drawer", [right_drawer_manager]() {
848 right_drawer_manager->CycleToPreviousDrawer();
851 "View: Next Right Panel", [right_drawer_manager]() {
852 right_drawer_manager->CycleToNextDrawer();
855 "View: Next Right Drawer", [right_drawer_manager]() {
856 right_drawer_manager->CycleToNextDrawer();
864 if (window_manager) {
865 auto categories = window_manager->GetAllCategories();
866 const size_t registration_session_id = window_manager->GetActiveSessionId();
869 "View: Show Panel Browser",
870 [window_manager]() { window_manager->TriggerShowWindowBrowser(); });
872 "View: Show Window Browser",
873 [window_manager]() { window_manager->TriggerShowWindowBrowser(); });
875 for (
const auto& category : categories) {
876 auto windows = window_manager->GetWindowsInCategory(
877 registration_session_id, category);
878 for (
const auto& window : windows) {
879 const std::string window_id = window.card_id;
880 const std::string display_name = window.display_name;
883 absl::StrFormat(
"View: Show %s", display_name),
884 [window_manager, window_id]() {
885 if (window_manager) {
886 window_manager->OpenWindow(window_manager->GetActiveSessionId(),
891 absl::StrFormat(
"View: Hide %s", display_name),
892 [window_manager, window_id]() {
893 if (window_manager) {
894 window_manager->CloseWindow(
895 window_manager->GetActiveSessionId(), window_id);
899 absl::StrFormat(
"View: Toggle %s", display_name),
900 [window_manager, window_id]() {
901 if (window_manager) {
902 window_manager->ToggleWindow(
903 window_manager->GetActiveSessionId(), window_id);
908 absl::StrFormat(
"View: Open %s Window", display_name),
909 [window_manager, window_id]() {
910 if (window_manager) {
911 window_manager->OpenWindow(window_manager->GetActiveSessionId(),
916 absl::StrFormat(
"View: Close %s Window", display_name),
917 [window_manager, window_id]() {
918 if (window_manager) {
919 window_manager->CloseWindow(
920 window_manager->GetActiveSessionId(), window_id);
924 absl::StrFormat(
"View: Toggle %s Window", display_name),
925 [window_manager, window_id]() {
926 if (window_manager) {
927 window_manager->ToggleWindow(
928 window_manager->GetActiveSessionId(), window_id);
934 absl::StrFormat(
"View: Show All %s Panels", category),
936 if (window_manager) {
937 window_manager->ShowAllWindowsInCategory(
938 window_manager->GetActiveSessionId(),
category);
942 absl::StrFormat(
"View: Hide All %s Panels", category),
944 if (window_manager) {
945 window_manager->HideAllWindowsInCategory(
946 window_manager->GetActiveSessionId(),
category);
950 absl::StrFormat(
"View: Show All %s Windows", category),
952 if (window_manager) {
953 window_manager->ShowAllWindowsInCategory(
954 window_manager->GetActiveSessionId(),
category);
958 absl::StrFormat(
"View: Hide All %s Windows", category),
960 if (window_manager) {
961 window_manager->HideAllWindowsInCategory(
962 window_manager->GetActiveSessionId(),
category);