From 70cb8e86b37400038044e5176686a10d78f66c48 Mon Sep 17 00:00:00 2001 From: tillvit Date: Fri, 30 Aug 2024 11:33:40 -0400 Subject: [PATCH] Add F5/F6 to swap between charts --- app/src/data/KeybindData.ts | 34 ++++++++++++++++++++++++++++++++++ app/src/data/MenubarData.ts | 11 +++++++++++ 2 files changed, 45 insertions(+) diff --git a/app/src/data/KeybindData.ts b/app/src/data/KeybindData.ts index 1d79f9f9..34ba02ae 100644 --- a/app/src/data/KeybindData.ts +++ b/app/src/data/KeybindData.ts @@ -1423,4 +1423,38 @@ export const KEYBIND_DATA: { [key: string]: Keybind } = { disabled: app => !app.chartManager.chartView, callback: app => app.windowManager.openWindow(new NoteskinWindow(app)), }, + previousChart: { + label: "Previous chart", + combos: [{ key: "F5", mods: [] }], + disabled: app => !app.chartManager.chartView, + callback: app => { + if (!app.chartManager.loadedSM?.charts || !app.chartManager.loadedChart) + return + const charts = + app.chartManager.loadedSM?.charts[ + app.chartManager.loadedChart.gameType.id + ] + const curIndex = charts.indexOf(app.chartManager.loadedChart) + if (charts[curIndex - 1]) { + app.chartManager.loadChart(charts[curIndex - 1]) + } + }, + }, + nextChart: { + label: "Next chart", + combos: [{ key: "F6", mods: [] }], + disabled: app => !app.chartManager.chartView, + callback: app => { + if (!app.chartManager.loadedSM?.charts || !app.chartManager.loadedChart) + return + const charts = + app.chartManager.loadedSM?.charts[ + app.chartManager.loadedChart.gameType.id + ] + const curIndex = charts.indexOf(app.chartManager.loadedChart) + if (charts[curIndex + 1]) { + app.chartManager.loadChart(charts[curIndex + 1]) + } + }, + }, } diff --git a/app/src/data/MenubarData.ts b/app/src/data/MenubarData.ts index 38d724d3..a5a5d6e0 100644 --- a/app/src/data/MenubarData.ts +++ b/app/src/data/MenubarData.ts @@ -285,6 +285,17 @@ export const MENUBAR_DATA: { [key: string]: MenuMain } = { { type: "separator", }, + { + type: "selection", + id: "previousChart", + }, + { + type: "selection", + id: "nextChart", + }, + { + type: "separator", + }, { type: "selection", id: "songProperties",