45 if (!shortcut_manager) {
55 shortcut_manager,
"global.toggle_sidebar",
56 {ImGuiKey_LeftCtrl, ImGuiKey_B},
59 ui_coordinator->ToggleCardSidebar();
63 RegisterIfValid(shortcut_manager,
"Open", {ImGuiMod_Ctrl, ImGuiKey_O},
66 editor_manager->LoadRom();
70 RegisterIfValid(shortcut_manager,
"Save", {ImGuiMod_Ctrl, ImGuiKey_S},
73 editor_manager->SaveRom();
77 RegisterIfValid(shortcut_manager,
"Save As",
78 {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_S},
82 std::string filename = editor_manager->GetCurrentRom()
83 ? editor_manager->GetCurrentRom()->filename()
85 editor_manager->SaveRomAs(filename);
89 RegisterIfValid(shortcut_manager,
"Close ROM", {ImGuiMod_Ctrl, ImGuiKey_W},
91 if (editor_manager && editor_manager->GetCurrentRom()) {
92 editor_manager->GetCurrentRom()->Close();
96 RegisterIfValid(shortcut_manager,
"Quit", {ImGuiMod_Ctrl, ImGuiKey_Q},
99 editor_manager->Quit();
103 RegisterIfValid(shortcut_manager,
"Undo", {ImGuiMod_Ctrl, ImGuiKey_Z},
105 if (editor_manager && editor_manager->GetCurrentEditor()) {
106 editor_manager->GetCurrentEditor()->Undo();
110 RegisterIfValid(shortcut_manager,
"Redo",
111 {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_Z},
113 if (editor_manager && editor_manager->GetCurrentEditor()) {
114 editor_manager->GetCurrentEditor()->Redo();
118 RegisterIfValid(shortcut_manager,
"Cut", {ImGuiMod_Ctrl, ImGuiKey_X},
120 if (editor_manager && editor_manager->GetCurrentEditor()) {
121 editor_manager->GetCurrentEditor()->Cut();
125 RegisterIfValid(shortcut_manager,
"Copy", {ImGuiMod_Ctrl, ImGuiKey_C},
127 if (editor_manager && editor_manager->GetCurrentEditor()) {
128 editor_manager->GetCurrentEditor()->Copy();
132 RegisterIfValid(shortcut_manager,
"Paste", {ImGuiMod_Ctrl, ImGuiKey_V},
134 if (editor_manager && editor_manager->GetCurrentEditor()) {
135 editor_manager->GetCurrentEditor()->Paste();
139 RegisterIfValid(shortcut_manager,
"Find", {ImGuiMod_Ctrl, ImGuiKey_F},
141 if (editor_manager && editor_manager->GetCurrentEditor()) {
142 editor_manager->GetCurrentEditor()->Find();
147 shortcut_manager,
"Command Palette",
148 {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_P},
150 if (ui_coordinator) {
151 ui_coordinator->ShowCommandPalette();
156 shortcut_manager,
"Global Search",
157 {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_K},
159 if (ui_coordinator) {
160 ui_coordinator->ShowGlobalSearch();
164 RegisterIfValid(shortcut_manager,
"Load Last ROM",
165 {ImGuiMod_Ctrl, ImGuiKey_R},
168 if (!recent.GetRecentFiles().empty() && editor_manager) {
169 editor_manager->OpenRomOrProject(
170 recent.GetRecentFiles().front());
174 RegisterIfValid(shortcut_manager,
"Show About", ImGuiKey_F1,
177 popup_manager->Show(
"About");
181 auto register_editor_shortcut = [&](
EditorType type, ImGuiKey key) {
182 RegisterIfValid(shortcut_manager,
183 absl::StrFormat(
"switch.%d",
static_cast<int>(type)),
184 {ImGuiMod_Ctrl, key},
185 [editor_manager, type]() {
186 if (editor_manager) {
187 editor_manager->SwitchToEditor(type);
203 RegisterIfValid(shortcut_manager,
"Editor Selection",
204 {ImGuiMod_Ctrl, ImGuiKey_E},
206 if (ui_coordinator) {
207 ui_coordinator->ShowEditorSelection();
212 shortcut_manager,
"Card Browser",
213 {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_B},
215 if (ui_coordinator) {
216 ui_coordinator->ShowCardBrowser();
222 RegisterIfValid(shortcut_manager,
"Show Dungeon Cards",
223 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_D},
225 card_registry->ShowAllCardsInCategory(
"Dungeon");
227 RegisterIfValid(shortcut_manager,
"Show Graphics Cards",
228 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_G},
230 card_registry->ShowAllCardsInCategory(
"Graphics");
232 RegisterIfValid(shortcut_manager,
"Show Screen Cards",
233 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_S},
235 card_registry->ShowAllCardsInCategory(
"Screen");
240 RegisterIfValid(shortcut_manager,
"Agent Editor",
241 {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_A},
243 if (editor_manager) {
244 editor_manager->ShowAIAgent();
248 RegisterIfValid(shortcut_manager,
"Agent Chat History",
249 {ImGuiMod_Ctrl, ImGuiKey_H},
251 if (editor_manager) {
252 editor_manager->ShowChatHistory();
256 RegisterIfValid(shortcut_manager,
"Proposal Drawer",
257 {ImGuiMod_Ctrl | ImGuiMod_Shift, ImGuiKey_R},
259 if (editor_manager) {
260 editor_manager->ShowProposalDrawer();
268 if (!shortcut_manager) {
276 RegisterIfValid(shortcut_manager,
"New Session",
277 {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_N},
278 [session_coordinator]() {
279 if (session_coordinator) {
280 session_coordinator->CreateNewSession();
284 RegisterIfValid(shortcut_manager,
"Duplicate Session",
285 {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_D},
286 [session_coordinator]() {
287 if (session_coordinator) {
288 session_coordinator->DuplicateCurrentSession();
292 RegisterIfValid(shortcut_manager,
"Close Session",
293 {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_W},
294 [session_coordinator]() {
295 if (session_coordinator) {
296 session_coordinator->CloseCurrentSession();
300 RegisterIfValid(shortcut_manager,
"Session Switcher",
301 {ImGuiMod_Ctrl, ImGuiKey_Tab},
302 [session_coordinator]() {
303 if (session_coordinator) {
304 session_coordinator->ShowSessionSwitcher();
308 RegisterIfValid(shortcut_manager,
"Save Layout",
309 {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_L},
310 [workspace_manager]() {
311 if (workspace_manager) {
312 workspace_manager->SaveWorkspaceLayout();
316 RegisterIfValid(shortcut_manager,
"Load Layout",
317 {ImGuiMod_Ctrl, ImGuiMod_Shift, ImGuiKey_O},
318 [workspace_manager]() {
319 if (workspace_manager) {
320 workspace_manager->LoadWorkspaceLayout();
325 RegisterIfValid(shortcut_manager,
"Reset Layout",
326 {ImGuiMod_Ctrl, ImGuiMod_Alt, ImGuiKey_R},
327 [workspace_manager]() {
328 if (workspace_manager) {
329 workspace_manager->ResetWorkspaceLayout();
333 RegisterIfValid(shortcut_manager,
"Maximize Window", ImGuiKey_F11,
334 [workspace_manager]() {
335 if (workspace_manager) {
336 workspace_manager->MaximizeCurrentWindow();
340#ifdef YAZE_ENABLE_TESTING
341 RegisterIfValid(shortcut_manager,
"Test Dashboard",
342 {ImGuiMod_Ctrl, ImGuiKey_T},
343 [menu_orchestrator]() {
344 if (menu_orchestrator) {
345 menu_orchestrator->OnShowTestDashboard();