mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-09 05:06:43 +01:00
FocusCommand, Command::translate, ret old from TimeUnit::set
This commit is contained in:
parent
2b78339e61
commit
fe25da4f53
9 changed files with 249 additions and 261 deletions
|
|
@ -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!(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue