From c8849dbbfa7f938cd6235ab92ec966d9e0ef250e Mon Sep 17 00:00:00 2001 From: Aurora Date: Wed, 18 Aug 2021 23:39:16 +0300 Subject: [PATCH] fix shortcuts --- src/settings/shortcuts.json5 | 9 +++++---- src/ui/elements/playbuttonsbar/main.ts | 12 +++++++----- src/ui/windows/editor.ts | 22 +++++++++++++++++++--- 3 files changed, 31 insertions(+), 12 deletions(-) diff --git a/src/settings/shortcuts.json5 b/src/settings/shortcuts.json5 index f729bbf..7905696 100644 --- a/src/settings/shortcuts.json5 +++ b/src/settings/shortcuts.json5 @@ -157,11 +157,12 @@ "ui.save": [ "ctrl+S" ], /* shortcut for saving the project */ "ui.saveas": [ "ctrl+shift+S" ], /* shortcut for saving the project as another file */ - "ui.play": [ "Enter", "F5" ], /* shortcut for playing from start */ - "ui.playpattern": [ "F6" ], /* shortcut for playing back the current pattern */ + "ui.playstart": [ "shift+Enter" ], /* shortcut for playing from the start of the first pattern */ + "ui.play": [ "Enter", "F5" ], /* shortcut for playing from the current pattern */ + "ui.repeatpattern": [ "F6" ], /* shortcut for repeating the current pattern */ "ui.playrow": [ "F7" ], /* shortcut for playing from the current row */ - "ui.playstep": [ "ctrl+Enter" ], /* shortcut for playing from the current row */ - "ui.stop": [ "F5", "F6", "F7", "Enter" ], /* shortcut for stopping playback */ + "ui.playstep": [ "ctrl+Enter" ], /* shortcut for stepping the current row */ + "ui.stop": [ "F8", "Enter" ], /* shortcut for stopping playback */ "ui.record": [ "Space" ], /* shortcut for toggling record mode */ "ui.muteselected": [ "F9" ], /* shortcut for muting selected channel */ diff --git a/src/ui/elements/playbuttonsbar/main.ts b/src/ui/elements/playbuttonsbar/main.ts index e6e76ec..498ba1e 100644 --- a/src/ui/elements/playbuttonsbar/main.ts +++ b/src/ui/elements/playbuttonsbar/main.ts @@ -94,11 +94,13 @@ export class PlayBar implements UIComponent { }, }, { - tooltip: "Start playback", + tooltip: "Start playback at current pattern.\nCTRL+Click = Start from current row.", click: async(e:MouseEvent) => { // change playback mode to play all if(e.button === 0 && Tab.active && Tab.active.playMode !== PlayMode.PlayAll) { - if(await startPlayback(0, false, false)) { + const row = Tab.active.activeRow, cr = e.ctrlKey ? row : row - (row % (Tab.active.module?.patternRows ?? 1)); + + if(await startPlayback(cr, false, false)) { Tab.active.playMode = PlayMode.PlayAll; } } @@ -108,13 +110,13 @@ export class PlayBar implements UIComponent { }, }, { - tooltip: "Repeat pattern", + tooltip: "Repeat playback of the current pattern.\nCTRL+Click = Start from current row.", click: async(e:MouseEvent) => { // change playback mode to play pattern if(e.button === 0 && Tab.active && Tab.active.playMode !== PlayMode.PlayPattern) { - const row = Tab.active.activeRow; + const row = Tab.active.activeRow, cr = e.ctrlKey ? row : row - (row % (Tab.active.module?.patternRows ?? 1)); - if(await startPlayback(row - (row % (Tab.active.module?.patternRows ?? 1)), true, false)) { + if(await startPlayback(cr, true, false)) { Tab.active.playMode = PlayMode.PlayPattern; } } diff --git a/src/ui/windows/editor.ts b/src/ui/windows/editor.ts index eff7e07..d099b3a 100644 --- a/src/ui/windows/editor.ts +++ b/src/ui/windows/editor.ts @@ -351,7 +351,9 @@ async function loadMainShortcuts() { } // toggle play mode - if(await startPlayback(0, false, false)){ + const row = Tab.active.activeRow; + + if(await startPlayback(row - (row % (Tab.active.module?.patternRows ?? 1)), false, false)){ Tab.active.playMode = PlayMode.PlayAll; } @@ -365,7 +367,7 @@ async function loadMainShortcuts() { } // toggle play mode - if(await startPlayback(Tab.active.playMode === PlayMode.Stopped ? Tab.active.activeRow : -1, false, false)){ + if(await startPlayback(Tab.active.activeRow, false, false)){ Tab.active.playMode = PlayMode.PlayAll; } @@ -373,7 +375,7 @@ async function loadMainShortcuts() { }, /* shortcut for enabling play pattern mode */ - playpattern: async() => { + repeatpattern: async() => { if(!Tab.active || Tab.active.playMode === PlayMode.PlayPattern){ return false; } @@ -388,6 +390,20 @@ async function loadMainShortcuts() { return true; }, + /* shortcut for enabling play pattern mode */ + playstart: async() => { + if(!Tab.active || Tab.active.playMode === PlayMode.PlayPattern){ + return false; + } + + // toggle play mode + if(await startPlayback(0, false, false)){ + Tab.active.playMode = PlayMode.PlayAll; + } + + return true; + }, + /* shortcut for enabling play mode */ playstep: async() => { if(!Tab.active){