wip: global enter

This commit is contained in:
🪞👃🪞 2024-11-09 01:17:41 +01:00
parent 2105d86428
commit 9b770c468f
6 changed files with 43 additions and 28 deletions

View file

@ -2,12 +2,7 @@ use crate::*;
#[derive(Clone, PartialEq)]
pub enum ArrangerCommand {
FocusNext,
FocusPrev,
FocusUp,
FocusDown,
FocusLeft,
FocusRight,
Focus(FocusCommand),
Transport(TransportCommand),
Phrases(PhrasePoolCommand),
Editor(PhraseEditorCommand),
@ -41,13 +36,18 @@ pub enum ArrangementCommand {
impl<E: Engine> Command<Arranger<E>> for ArrangerCommand {
fn execute (self, state: &mut Arranger<E>) -> Perhaps<Self> {
use ArrangerCommand::*;
use FocusCommand::*;
match self {
FocusNext => { state.focus_next(); },
FocusPrev => { state.focus_prev(); },
FocusUp => { state.focus_up(); },
FocusDown => { state.focus_down(); },
FocusLeft => { state.focus_left(); },
FocusRight => { state.focus_right(); },
Focus(command) => match command {
Next => { state.focus_next(); },
Prev => { state.focus_prev(); },
Up => { state.focus_up(); },
Down => { state.focus_down(); },
Left => { state.focus_left(); },
Right => { state.focus_right(); },
Enter => { unimplemented!() },
Exit => { unimplemented!() },
},
Transport(cmd) => if let Some(ref transport) = state.transport {
return cmd.execute(&mut*transport.write().unwrap()).map(|x|x.map(Transport))
},