From e2492a1326fcee18c4508a698627944cd9abfc99 Mon Sep 17 00:00:00 2001 From: unspeaker Date: Wed, 18 Dec 2024 18:48:59 +0100 Subject: [PATCH] pass thru arranger commands to embedded sequencer --- crates/tek/src/tui/app_arranger.rs | 32 +++++++++++++++++------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/crates/tek/src/tui/app_arranger.rs b/crates/tek/src/tui/app_arranger.rs index bd05a5f9..9c617157 100644 --- a/crates/tek/src/tui/app_arranger.rs +++ b/crates/tek/src/tui/app_arranger.rs @@ -134,21 +134,19 @@ input_to_command!(ArrangerCommand: |state:ArrangerTui,input|{ use ArrangerCommand::*; // WSAD navigation, Q launches, E edits, PgUp/Down pool, Arrows editor match input.event() { + // TODO: u: undo + key_pat!(Char('u')) => { todo!("undo") }, + // TODO: Shift-U: redo + key_pat!(Char('U')) => { todo!("redo") }, + // TODO: k: toggle on-screen keyboard + key_pat!(Ctrl-Char('k')) => { todo!("keyboard") }, + // Transport: Play/pause key_pat!(Char(' ')) => Clock(if state.clock().is_stopped() { Play(None) } else { Pause(None) }), // Transport: Play from start or rewind to start key_pat!(Shift-Char(' ')) => Clock(if state.clock().is_stopped() { Play(Some(0)) } else { Pause(Some(0)) }), - // TODO: u: undo - key_pat!(Char('u')) => - { todo!("undo") }, - // TODO: Shift-U: redo - key_pat!(Char('U')) => - { todo!("redo") }, - // TODO: k: toggle on-screen keyboard - key_pat!(Ctrl-Char('k')) => - { todo!("keyboard") }, key_pat!(Char('e')) => Editor(PhraseCommand::Show(Some(state.phrases.phrase().clone()))), key_pat!(Char('l')) => @@ -170,11 +168,17 @@ input_to_command!(ArrangerCommand: |state:ArrangerTui,input|{ Selected::Clip(t, s) => return None, }, _ => match state.selected() { - Selected::Mix => to_arranger_mix_command(input)?, - Selected::Track(t) => to_arranger_track_command(input, t)?, - Selected::Scene(s) => to_arranger_scene_command(input, s)?, - Selected::Clip(t, s) => to_arranger_clip_command(input, t, s)?, - } + Selected::Mix => to_arranger_mix_command(input), + Selected::Track(t) => to_arranger_track_command(input, t), + Selected::Scene(s) => to_arranger_scene_command(input, s), + Selected::Clip(t, s) => to_arranger_clip_command(input, t, s), + }.or_else(||if let Some(command) = PhraseCommand::input_to_command(&state.editor, input) { + Some(Editor(command)) + } else if let Some(command) = PhrasesCommand::input_to_command(&state.phrases, input) { + Some(Phrases(command)) + } else { + None + })? } }); fn to_arranger_mix_command (input: &TuiInput) -> Option {