FocusCommand, Command::translate, ret old from TimeUnit::set

This commit is contained in:
🪞👃🪞 2024-11-08 22:53:08 +01:00
parent 2b78339e61
commit fe25da4f53
9 changed files with 249 additions and 261 deletions

View file

@ -38,27 +38,27 @@ pub enum ArrangementCommand {
GoLeft,
GoRight,
}
impl <E: Engine> Command<Arranger<E>> for ArrangerCommand {
fn run (&self, state: &mut Arranger<E>) -> Perhaps<Self> {
impl<E: Engine> Command<Arranger<E>> for ArrangerCommand {
fn execute (self, state: &mut Arranger<E>) -> Perhaps<Self> {
use ArrangerCommand::*;
match self {
FocusNext => { state.focus_next(); },
FocusPrev => { state.focus_prev(); },
FocusUp => { state.focus_up(); },
FocusDown => { state.focus_down(); },
FocusLeft => { state.focus_left(); },
FocusNext => { state.focus_next(); },
FocusPrev => { state.focus_prev(); },
FocusUp => { state.focus_up(); },
FocusDown => { state.focus_down(); },
FocusLeft => { state.focus_left(); },
FocusRight => { state.focus_right(); },
Transport(command) => if let Some(ref transport) = state.transport {
return command.run(&mut*transport.write().unwrap()).map(|x|x.map(Transport))
Transport(cmd) => if let Some(ref transport) = state.transport {
return cmd.execute(&mut*transport.write().unwrap()).map(|x|x.map(Transport))
},
Phrases(command) => {
return command.run(&mut*state.phrases.write().unwrap()).map(|x|x.map(Phrases))
Phrases(cmd) => {
return cmd.execute(&mut*state.phrases.write().unwrap()).map(|x|x.map(Phrases))
},
Editor(command) => {
return command.run(&mut state.editor).map(|x|x.map(Editor))
Editor(cmd) => {
return cmd.execute(&mut state.editor).map(|x|x.map(Editor))
},
Arrangement(command) => {
return command.run(&mut state.arrangement).map(|x|x.map(Arrangement))
Arrangement(cmd) => {
return cmd.execute(&mut state.arrangement).map(|x|x.map(Arrangement))
},
}
state.show_phrase();
@ -66,8 +66,8 @@ impl <E: Engine> Command<Arranger<E>> for ArrangerCommand {
Ok(None)
}
}
impl <E: Engine> Command<Arrangement<E>> for ArrangementCommand {
fn run (&self, state: &mut Arrangement<E>) -> Perhaps<Self> {
impl<E: Engine> Command<Arrangement<E>> for ArrangementCommand {
fn execute (self, state: &mut Arrangement<E>) -> Perhaps<Self> {
use ArrangementCommand::*;
match self {
New => todo!(),