104 if (!shortcut_manager) {
114 RegisterIfValid(shortcut_manager,
"view.toggle_activity_bar",
115 {ImGuiMod_Ctrl, ImGuiKey_B},
118 panel_manager->ToggleSidebarVisibility();
124 RegisterIfValid(shortcut_manager,
"view.toggle_side_panel",
125 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_E},
128 panel_manager->TogglePanelExpanded();
133 RegisterIfValid(shortcut_manager,
"Open", {ImGuiMod_Ctrl, ImGuiKey_O},
135 if (editor_manager) {
136 editor_manager->LoadRom();
140 RegisterIfValid(shortcut_manager,
"Save", {ImGuiMod_Ctrl, ImGuiKey_S},
142 if (editor_manager) {
143 editor_manager->SaveRom();
147 RegisterIfValid(shortcut_manager,
"Save As",
148 {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_S},
150 if (editor_manager) {
152 std::string filename =
153 editor_manager->GetCurrentRom()
154 ? editor_manager->GetCurrentRom()->filename()
156 editor_manager->SaveRomAs(filename);
161 RegisterIfValid(shortcut_manager,
"Close ROM", {ImGuiMod_Ctrl, ImGuiKey_W},
163 if (editor_manager && editor_manager->GetCurrentRom()) {
164 editor_manager->GetCurrentRom()->Close();
169 RegisterIfValid(shortcut_manager,
"Quit", {ImGuiMod_Ctrl, ImGuiKey_Q},
171 if (editor_manager) {
172 editor_manager->Quit();
177 RegisterIfValid(shortcut_manager,
"Undo", {ImGuiMod_Ctrl, ImGuiKey_Z},
179 if (editor_manager && editor_manager->GetCurrentEditor()) {
180 editor_manager->GetCurrentEditor()->Undo();
184 RegisterIfValid(shortcut_manager,
"Redo", {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_Z},
186 if (editor_manager && editor_manager->GetCurrentEditor()) {
187 editor_manager->GetCurrentEditor()->Redo();
191 RegisterIfValid(shortcut_manager,
"Cut", {ImGuiMod_Ctrl, ImGuiKey_X},
193 if (editor_manager && editor_manager->GetCurrentEditor()) {
194 editor_manager->GetCurrentEditor()->Cut();
198 RegisterIfValid(shortcut_manager,
"Copy", {ImGuiMod_Ctrl, ImGuiKey_C},
200 if (editor_manager && editor_manager->GetCurrentEditor()) {
201 editor_manager->GetCurrentEditor()->Copy();
205 RegisterIfValid(shortcut_manager,
"Paste", {ImGuiMod_Ctrl, ImGuiKey_V},
207 if (editor_manager && editor_manager->GetCurrentEditor()) {
208 editor_manager->GetCurrentEditor()->Paste();
212 RegisterIfValid(shortcut_manager,
"Find", {ImGuiMod_Ctrl, ImGuiKey_F},
214 if (editor_manager && editor_manager->GetCurrentEditor()) {
215 editor_manager->GetCurrentEditor()->Find();
219 RegisterIfValid(shortcut_manager,
"Command Palette", {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_P},
221 if (ui_coordinator) {
222 ui_coordinator->ShowCommandPalette();
227 RegisterIfValid(shortcut_manager,
"Global Search", {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_K},
229 if (ui_coordinator) {
230 ui_coordinator->ShowGlobalSearch();
236 shortcut_manager,
"Load Last ROM", {ImGuiMod_Ctrl, ImGuiKey_R},
239 if (!recent.GetRecentFiles().empty() && editor_manager) {
240 editor_manager->OpenRomOrProject(recent.GetRecentFiles().front());
244 RegisterIfValid(shortcut_manager,
"Show About", ImGuiKey_F1,
247 popup_manager->Show(
"About");
251 auto register_editor_shortcut = [&](
EditorType type, ImGuiKey key) {
252 RegisterIfValid(shortcut_manager,
253 absl::StrFormat(
"switch.%d",
static_cast<int>(type)),
254 {ImGuiMod_Ctrl, key}, [editor_manager, type]() {
255 if (editor_manager) {
256 editor_manager->SwitchToEditor(type);
273 if (editor_manager) {
274 auto* editor_set = editor_manager->GetCurrentEditorSet();
275 if (editor_set && editor_set->GetMusicEditor()) {
276 auto* music_editor = editor_set->GetMusicEditor();
277 for (
const auto& def : kMusicEditorShortcuts) {
278 RegisterIfValid(shortcut_manager, def.id, def.keys,
279 [music_editor,
id = def.id]() {
280 if (!music_editor) return;
281 if (id ==
"music.play_pause") {
282 music_editor->TogglePlayPause();
283 }
else if (
id ==
"music.stop") {
284 music_editor->StopPlayback();
285 }
else if (
id ==
"music.speed_up" ||
286 id ==
"music.speed_up_keypad") {
287 music_editor->SpeedUp();
288 }
else if (
id ==
"music.speed_down" ||
289 id ==
"music.speed_down_keypad") {
290 music_editor->SlowDown();
299 if (editor_manager) {
300 auto* editor_set = editor_manager->GetCurrentEditorSet();
301 if (editor_set && editor_set->GetDungeonEditor()) {
302 auto* dungeon_editor = editor_set->GetDungeonEditor();
303 for (
const auto& def : kDungeonEditorShortcuts) {
304 RegisterIfValid(shortcut_manager, def.id, def.keys,
305 [dungeon_editor,
id = def.id]() {
306 if (!dungeon_editor) return;
307 auto* obj_panel = dungeon_editor->object_editor_panel();
308 if (!obj_panel) return;
309 if (id ==
"dungeon.object.select_tool") {
311 obj_panel->CancelPlacement();
312 }
else if (
id ==
"dungeon.object.place_tool") {
315 }
else if (
id ==
"dungeon.object.delete_tool") {
317 obj_panel->DeleteSelectedObjects();
318 }
else if (
id ==
"dungeon.object.next_object") {
319 obj_panel->CycleObjectSelection(1);
320 }
else if (
id ==
"dungeon.object.prev_object") {
321 obj_panel->CycleObjectSelection(-1);
322 }
else if (
id ==
"dungeon.object.copy") {
323 obj_panel->CopySelectedObjects();
324 }
else if (
id ==
"dungeon.object.paste") {
325 obj_panel->PasteObjects();
326 }
else if (
id ==
"dungeon.object.delete") {
327 obj_panel->DeleteSelectedObjects();
336 if (editor_manager) {
337 auto* editor_set = editor_manager->GetCurrentEditorSet();
338 if (editor_set && editor_set->GetOverworldEditor()) {
339 auto* overworld_editor = editor_set->GetOverworldEditor();
342 [overworld_editor,
id = def.id]() {
343 if (!overworld_editor) return;
344 if (id ==
"overworld.brush_toggle") {
345 overworld_editor->ToggleBrushTool();
346 }
else if (
id ==
"overworld.fill") {
347 overworld_editor->ActivateFillTool();
348 }
else if (
id ==
"overworld.next_tile") {
349 overworld_editor->CycleTileSelection(1);
350 }
else if (
id ==
"overworld.prev_tile") {
351 overworld_editor->CycleTileSelection(-1);
354 Shortcut::Scope::kEditor);
360 if (editor_manager) {
361 auto* editor_set = editor_manager->GetCurrentEditorSet();
362 if (editor_set && editor_set->GetGraphicsEditor()) {
363 auto* graphics_editor = editor_set->GetGraphicsEditor();
366 [graphics_editor,
id = def.id]() {
367 if (!graphics_editor) return;
368 if (id ==
"graphics.next_sheet") {
369 graphics_editor->NextSheet();
370 }
else if (
id ==
"graphics.prev_sheet") {
371 graphics_editor->PrevSheet();
374 Shortcut::Scope::kEditor);
380 RegisterIfValid(shortcut_manager,
"Editor Selection", {ImGuiMod_Ctrl, ImGuiKey_E},
382 if (ui_coordinator) {
383 ui_coordinator->ShowEditorSelection();
385 }, Shortcut::Scope::kGlobal);
387 RegisterIfValid(shortcut_manager,
"Panel Browser", {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_B},
389 if (ui_coordinator) {
390 ui_coordinator->ShowPanelBrowser();
392 }, Shortcut::Scope::kGlobal);
393 RegisterIfValid(shortcut_manager,
"Panel Browser (Alt)", {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_P},
395 if (ui_coordinator) {
396 ui_coordinator->ShowPanelBrowser();
398 }, Shortcut::Scope::kGlobal);
403 RegisterIfValid(shortcut_manager,
"Show Dungeon Panels", {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_D},
405 panel_manager->ShowAllPanelsInCategory(0,
"Dungeon");
406 }, Shortcut::Scope::kEditor);
407 RegisterIfValid(shortcut_manager,
"Show Graphics Panels", {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_G},
409 panel_manager->ShowAllPanelsInCategory(0,
"Graphics");
410 }, Shortcut::Scope::kEditor);
411 RegisterIfValid(shortcut_manager,
"Show Screen Panels", {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_S},
413 panel_manager->ShowAllPanelsInCategory(0,
"Screen");
414 }, Shortcut::Scope::kEditor);
417#ifdef YAZE_BUILD_AGENT_UI
418 RegisterIfValid(shortcut_manager,
"Agent Editor", {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_A}, [editor_manager]() {
419 if (editor_manager) {
420 editor_manager->ShowAIAgent();
424 RegisterIfValid(shortcut_manager,
"Agent Sidebar", {ImGuiMod_Ctrl, ImGuiKey_H}, [editor_manager]() {
425 if (editor_manager) {
426 editor_manager->ShowChatHistory();
431 {ImGuiMod_Ctrl, ImGuiMod_Shift,
434 if (editor_manager) {
435 editor_manager->ShowProposalDrawer();
445 if (editor_manager) {
446 editor_manager->ApplyLayoutPreset(
"Minimal");
451 if (editor_manager) {
452 editor_manager->ApplyLayoutPreset(
"Developer");
457 if (editor_manager) {
458 editor_manager->ApplyLayoutPreset(
"Designer");
463 if (editor_manager) {
464 editor_manager->ApplyLayoutPreset(
"Modder");
467 shortcut_manager->
RegisterCommand(
"Layout: Apply Overworld Expert Preset",
469 if (editor_manager) {
470 editor_manager->ApplyLayoutPreset(
"Overworld Expert");
473 shortcut_manager->
RegisterCommand(
"Layout: Apply Dungeon Expert Preset",
475 if (editor_manager) {
476 editor_manager->ApplyLayoutPreset(
"Dungeon Expert");
481 if (editor_manager) {
482 editor_manager->ApplyLayoutPreset(
"Testing");
487 if (editor_manager) {
488 editor_manager->ApplyLayoutPreset(
"Audio");
493 if (editor_manager) {
494 editor_manager->ResetCurrentEditorLayout();
501 if (!shortcut_manager) {
509 RegisterIfValid(shortcut_manager,
"New Session", {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_N}, [session_coordinator]() {
510 if (session_coordinator) {
511 session_coordinator->CreateNewSession();
515 RegisterIfValid(shortcut_manager,
"Duplicate Session", {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_D}, [session_coordinator]() {
516 if (session_coordinator) {
517 session_coordinator->DuplicateCurrentSession();
521 RegisterIfValid(shortcut_manager,
"Close Session", {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_W}, [session_coordinator]() {
522 if (session_coordinator) {
523 session_coordinator->CloseCurrentSession();
527 RegisterIfValid(shortcut_manager,
"Session Switcher", {ImGuiMod_Ctrl, ImGuiKey_Tab}, [session_coordinator]() {
528 if (session_coordinator) {
529 session_coordinator->ShowSessionSwitcher();
533 RegisterIfValid(shortcut_manager,
"Save Layout", {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_L}, [workspace_manager]() {
534 if (workspace_manager) {
535 workspace_manager->SaveWorkspaceLayout();
539 RegisterIfValid(shortcut_manager,
"Load Layout", {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_O}, [workspace_manager]() {
540 if (workspace_manager) {
541 workspace_manager->LoadWorkspaceLayout();
547 RegisterIfValid(shortcut_manager,
"Reset Layout", {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_R}, [workspace_manager]() {
548 if (workspace_manager) {
549 workspace_manager->ResetWorkspaceLayout();
553 RegisterIfValid(shortcut_manager,
"Maximize Window", ImGuiKey_F11,
554 [workspace_manager]() {
555 if (workspace_manager) {
556 workspace_manager->MaximizeCurrentWindow();
560#ifdef YAZE_ENABLE_TESTING
561 RegisterIfValid(shortcut_manager,
"Test Dashboard",
562 {ImGuiMod_Ctrl, ImGuiKey_T},
563 [menu_orchestrator]() {
564 if (menu_orchestrator) {
565 menu_orchestrator->OnShowTestDashboard();