110 if (!shortcut_manager) {
121 shortcut_manager,
"view.toggle_activity_bar", {ImGuiMod_Ctrl, ImGuiKey_B},
124 panel_manager->ToggleSidebarVisibility();
131 shortcut_manager,
"view.toggle_side_panel",
132 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_E},
135 panel_manager->TogglePanelExpanded();
141 shortcut_manager,
"Open", {ImGuiMod_Ctrl, ImGuiKey_O},
143 if (editor_manager) {
144 editor_manager->LoadRom();
149 RegisterIfValid(shortcut_manager,
"Save", {ImGuiMod_Ctrl, ImGuiKey_S},
151 if (editor_manager) {
152 editor_manager->SaveRom();
157 shortcut_manager,
"Save As", {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_S},
159 if (editor_manager) {
161 std::string filename =
162 editor_manager->GetCurrentRom()
163 ? editor_manager->GetCurrentRom()->filename()
165 editor_manager->SaveRomAs(filename);
171 shortcut_manager,
"Close ROM", {ImGuiMod_Ctrl, ImGuiKey_W},
173 if (editor_manager && editor_manager->GetCurrentRom()) {
174 editor_manager->GetCurrentRom()->Close();
180 shortcut_manager,
"Quit", {ImGuiMod_Ctrl, ImGuiKey_Q},
182 if (editor_manager) {
183 editor_manager->Quit();
189 shortcut_manager,
"Undo", {ImGuiMod_Ctrl, ImGuiKey_Z},
191 if (editor_manager && editor_manager->GetCurrentEditor()) {
192 editor_manager->GetCurrentEditor()->Undo();
198 shortcut_manager,
"Redo", {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_Z},
200 if (editor_manager && editor_manager->GetCurrentEditor()) {
201 editor_manager->GetCurrentEditor()->Redo();
207 shortcut_manager,
"Cut", {ImGuiMod_Ctrl, ImGuiKey_X},
209 if (editor_manager && editor_manager->GetCurrentEditor()) {
210 editor_manager->GetCurrentEditor()->Cut();
216 shortcut_manager,
"Copy", {ImGuiMod_Ctrl, ImGuiKey_C},
218 if (editor_manager && editor_manager->GetCurrentEditor()) {
219 editor_manager->GetCurrentEditor()->Copy();
225 shortcut_manager,
"Paste", {ImGuiMod_Ctrl, ImGuiKey_V},
227 if (editor_manager && editor_manager->GetCurrentEditor()) {
228 editor_manager->GetCurrentEditor()->Paste();
234 shortcut_manager,
"Find", {ImGuiMod_Ctrl, ImGuiKey_F},
236 if (editor_manager && editor_manager->GetCurrentEditor()) {
237 editor_manager->GetCurrentEditor()->Find();
243 shortcut_manager,
"Command Palette",
244 {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_P},
246 if (ui_coordinator) {
247 ui_coordinator->ShowCommandPalette();
253 shortcut_manager,
"Global Search",
254 {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_K},
256 if (ui_coordinator) {
257 ui_coordinator->ShowGlobalSearch();
263 shortcut_manager,
"Load Last ROM", {ImGuiMod_Ctrl, ImGuiKey_R},
266 if (!recent.GetRecentFiles().empty() && editor_manager) {
267 editor_manager->OpenRomOrProject(recent.GetRecentFiles().front());
273 shortcut_manager,
"Show About", ImGuiKey_F1,
276 popup_manager->Show(
"About");
281 auto register_editor_shortcut = [&](
EditorType type, ImGuiKey key) {
282 RegisterIfValid(shortcut_manager,
283 absl::StrFormat(
"switch.%d",
static_cast<int>(type)),
284 {ImGuiMod_Ctrl, key}, [editor_manager, type]() {
285 if (editor_manager) {
286 editor_manager->SwitchToEditor(type);
303 if (editor_manager) {
304 auto* editor_set = editor_manager->GetCurrentEditorSet();
305 if (editor_set && editor_set->GetMusicEditor()) {
306 auto* music_editor = editor_set->GetMusicEditor();
307 for (
const auto& def : kMusicEditorShortcuts) {
309 shortcut_manager, def.id, def.keys,
310 [music_editor,
id = def.id]() {
313 if (id ==
"music.play_pause") {
314 music_editor->TogglePlayPause();
315 }
else if (
id ==
"music.stop") {
316 music_editor->StopPlayback();
317 }
else if (
id ==
"music.speed_up" ||
318 id ==
"music.speed_up_keypad") {
319 music_editor->SpeedUp();
320 }
else if (
id ==
"music.speed_down" ||
321 id ==
"music.speed_down_keypad") {
322 music_editor->SlowDown();
331 if (editor_manager) {
332 auto* editor_set = editor_manager->GetCurrentEditorSet();
333 if (editor_set && editor_set->GetDungeonEditor()) {
334 auto* dungeon_editor = editor_set->GetDungeonEditor();
335 for (
const auto& def : kDungeonEditorShortcuts) {
337 shortcut_manager, def.id, def.keys,
338 [dungeon_editor,
id = def.id]() {
341 auto* obj_panel = dungeon_editor->object_editor_panel();
344 if (id ==
"dungeon.object.select_tool") {
346 obj_panel->CancelPlacement();
347 }
else if (
id ==
"dungeon.object.place_tool") {
350 }
else if (
id ==
"dungeon.object.delete_tool") {
352 obj_panel->DeleteSelectedObjects();
353 }
else if (
id ==
"dungeon.object.next_object") {
354 obj_panel->CycleObjectSelection(1);
355 }
else if (
id ==
"dungeon.object.prev_object") {
356 obj_panel->CycleObjectSelection(-1);
357 }
else if (
id ==
"dungeon.object.copy") {
358 obj_panel->CopySelectedObjects();
359 }
else if (
id ==
"dungeon.object.paste") {
360 obj_panel->PasteObjects();
361 }
else if (
id ==
"dungeon.object.delete") {
362 obj_panel->DeleteSelectedObjects();
371 if (editor_manager) {
372 auto* editor_set = editor_manager->GetCurrentEditorSet();
373 if (editor_set && editor_set->GetOverworldEditor()) {
374 auto* overworld_editor = editor_set->GetOverworldEditor();
377 shortcut_manager, def.id, def.keys,
378 [overworld_editor,
id = def.id]() {
379 if (!overworld_editor)
381 if (id ==
"overworld.brush_toggle") {
382 overworld_editor->ToggleBrushTool();
383 }
else if (
id ==
"overworld.fill") {
384 overworld_editor->ActivateFillTool();
385 }
else if (
id ==
"overworld.next_tile") {
386 overworld_editor->CycleTileSelection(1);
387 }
else if (
id ==
"overworld.prev_tile") {
388 overworld_editor->CycleTileSelection(-1);
391 Shortcut::Scope::kEditor);
397 if (editor_manager) {
398 auto* editor_set = editor_manager->GetCurrentEditorSet();
399 if (editor_set && editor_set->GetGraphicsEditor()) {
400 auto* graphics_editor = editor_set->GetGraphicsEditor();
403 shortcut_manager, def.id, def.keys,
404 [graphics_editor,
id = def.id]() {
405 if (!graphics_editor)
407 if (id ==
"graphics.next_sheet") {
408 graphics_editor->NextSheet();
409 }
else if (
id ==
"graphics.prev_sheet") {
410 graphics_editor->PrevSheet();
413 Shortcut::Scope::kEditor);
419 shortcut_manager,
"Editor Selection", {ImGuiMod_Ctrl, ImGuiKey_E},
421 if (ui_coordinator) {
422 ui_coordinator->ShowEditorSelection();
425 Shortcut::Scope::kGlobal);
428 shortcut_manager,
"Panel Browser",
429 {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_B},
431 if (ui_coordinator) {
432 ui_coordinator->ShowPanelBrowser();
435 Shortcut::Scope::kGlobal);
437 shortcut_manager,
"Panel Browser (Alt)",
438 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_P},
440 if (ui_coordinator) {
441 ui_coordinator->ShowPanelBrowser();
444 Shortcut::Scope::kGlobal);
450 shortcut_manager,
"Show Dungeon Panels",
451 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_D},
453 panel_manager->ShowAllPanelsInCategory(0,
"Dungeon");
455 Shortcut::Scope::kEditor);
457 shortcut_manager,
"Show Graphics Panels",
458 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_G},
460 panel_manager->ShowAllPanelsInCategory(0,
"Graphics");
462 Shortcut::Scope::kEditor);
464 shortcut_manager,
"Show Screen Panels",
465 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_S},
467 panel_manager->ShowAllPanelsInCategory(0,
"Screen");
469 Shortcut::Scope::kEditor);
472#ifdef YAZE_BUILD_AGENT_UI
474 {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_A},
476 if (editor_manager) {
477 editor_manager->ShowAIAgent();
482 {ImGuiMod_Ctrl, ImGuiKey_H}, [editor_manager]() {
483 if (editor_manager) {
484 editor_manager->ShowChatHistory();
489 {ImGuiMod_Ctrl, ImGuiMod_Shift,
492 if (editor_manager) {
493 editor_manager->ShowProposalDrawer();
502 "Layout: Apply Minimal Preset", [editor_manager]() {
503 if (editor_manager) {
504 editor_manager->ApplyLayoutPreset(
"Minimal");
508 "Layout: Apply Developer Preset", [editor_manager]() {
509 if (editor_manager) {
510 editor_manager->ApplyLayoutPreset(
"Developer");
514 "Layout: Apply Designer Preset", [editor_manager]() {
515 if (editor_manager) {
516 editor_manager->ApplyLayoutPreset(
"Designer");
520 "Layout: Apply Modder Preset", [editor_manager]() {
521 if (editor_manager) {
522 editor_manager->ApplyLayoutPreset(
"Modder");
526 "Layout: Apply Overworld Expert Preset", [editor_manager]() {
527 if (editor_manager) {
528 editor_manager->ApplyLayoutPreset(
"Overworld Expert");
532 "Layout: Apply Dungeon Expert Preset", [editor_manager]() {
533 if (editor_manager) {
534 editor_manager->ApplyLayoutPreset(
"Dungeon Expert");
538 "Layout: Apply Testing Preset", [editor_manager]() {
539 if (editor_manager) {
540 editor_manager->ApplyLayoutPreset(
"Testing");
544 "Layout: Apply Audio Preset", [editor_manager]() {
545 if (editor_manager) {
546 editor_manager->ApplyLayoutPreset(
"Audio");
550 "Layout: Reset Current Editor", [editor_manager]() {
551 if (editor_manager) {
552 editor_manager->ResetCurrentEditorLayout();
559 if (!shortcut_manager) {
567 RegisterIfValid(shortcut_manager,
"New Session",
568 {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_N},
569 [session_coordinator]() {
570 if (session_coordinator) {
571 session_coordinator->CreateNewSession();
575 RegisterIfValid(shortcut_manager,
"Duplicate Session",
576 {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_D},
577 [session_coordinator]() {
578 if (session_coordinator) {
579 session_coordinator->DuplicateCurrentSession();
583 RegisterIfValid(shortcut_manager,
"Close Session",
584 {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_W},
585 [session_coordinator]() {
586 if (session_coordinator) {
587 session_coordinator->CloseCurrentSession();
591 RegisterIfValid(shortcut_manager,
"Session Switcher",
592 {ImGuiMod_Ctrl, ImGuiKey_Tab}, [session_coordinator]() {
593 if (session_coordinator) {
594 session_coordinator->ShowSessionSwitcher();
598 RegisterIfValid(shortcut_manager,
"Save Layout",
599 {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_L},
600 [workspace_manager]() {
601 if (workspace_manager) {
602 workspace_manager->SaveWorkspaceLayout();
606 RegisterIfValid(shortcut_manager,
"Load Layout",
607 {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_O},
608 [workspace_manager]() {
609 if (workspace_manager) {
610 workspace_manager->LoadWorkspaceLayout();
616 RegisterIfValid(shortcut_manager,
"Reset Layout",
617 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_R},
618 [workspace_manager]() {
619 if (workspace_manager) {
620 workspace_manager->ResetWorkspaceLayout();
624 RegisterIfValid(shortcut_manager,
"Maximize Window", ImGuiKey_F11,
625 [workspace_manager]() {
626 if (workspace_manager) {
627 workspace_manager->MaximizeCurrentWindow();
631#ifdef YAZE_ENABLE_TESTING
632 RegisterIfValid(shortcut_manager,
"Test Dashboard",
633 {ImGuiMod_Ctrl, ImGuiKey_T}, [menu_orchestrator]() {
634 if (menu_orchestrator) {
635 menu_orchestrator->OnShowTestDashboard();