apply command! in arranger (8456l)

This commit is contained in:
🪞👃🪞 2024-12-18 13:48:52 +01:00
parent 623fce73a4
commit 417b097c6f

View file

@ -124,44 +124,27 @@ audio!(|self: ArrangerTui, client, scope|{
Phrases(PhrasesCommand), Phrases(PhrasesCommand),
Editor(PhraseCommand), Editor(PhraseCommand),
} }
impl Command<ArrangerTui> for ArrangerCommand { command!(|self:ArrangerCommand,state:ArrangerTui|{
fn execute (self, state: &mut ArrangerTui) -> Perhaps<Self> { use ArrangerCommand::*;
use ArrangerCommand::*; match self {
Ok(match self { Focus(cmd) => cmd.execute(state)?.map(Focus),
Focus(cmd) => cmd.execute(state)?.map(Focus), Scene(cmd) => cmd.execute(state)?.map(Scene),
Scene(cmd) => cmd.execute(state)?.map(Scene), Track(cmd) => cmd.execute(state)?.map(Track),
Track(cmd) => cmd.execute(state)?.map(Track), Clip(cmd) => cmd.execute(state)?.map(Clip),
Clip(cmd) => cmd.execute(state)?.map(Clip), Phrases(cmd) => cmd.execute(&mut state.phrases)?.map(Phrases),
Phrases(cmd) => cmd.execute(&mut state.phrases)?.map(Phrases), Editor(cmd) => cmd.execute(&mut state.editor)?.map(Editor),
Editor(cmd) => cmd.execute(&mut state.editor)?.map(Editor), Clock(cmd) => cmd.execute(state)?.map(Clock),
Clock(cmd) => cmd.execute(state)?.map(Clock), Zoom(_) => { todo!(); },
Zoom(_) => { todo!(); }, Select(selected) => {
Select(selected) => { *state.selected_mut() = selected;
*state.selected_mut() = selected; None
None },
}, _ => { todo!() }
_ => { todo!() }
})
} }
} });
impl Command<ArrangerTui> for ArrangerSceneCommand { command!(|self:ArrangerSceneCommand,_state:ArrangerTui|None);
fn execute (self, _state: &mut ArrangerTui) -> Perhaps<Self> { command!(|self:ArrangerTrackCommand,_state:ArrangerTui|None);
//todo!(); command!(|self:ArrangerClipCommand, _state:ArrangerTui|None);
Ok(None)
}
}
impl Command<ArrangerTui> for ArrangerTrackCommand {
fn execute (self, _state: &mut ArrangerTui) -> Perhaps<Self> {
//todo!();
Ok(None)
}
}
impl Command<ArrangerTui> for ArrangerClipCommand {
fn execute (self, _state: &mut ArrangerTui) -> Perhaps<Self> {
//todo!();
Ok(None)
}
}
pub trait ArrangerControl: TransportControl<ArrangerFocus> { pub trait ArrangerControl: TransportControl<ArrangerFocus> {
fn selected (&self) -> ArrangerSelection; fn selected (&self) -> ArrangerSelection;
fn selected_mut (&mut self) -> &mut ArrangerSelection; fn selected_mut (&mut self) -> &mut ArrangerSelection;