mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 11:46:41 +01:00
implement phrase autoselect for arranger
This commit is contained in:
parent
3a4f069aa6
commit
b956fabe70
1 changed files with 20 additions and 1 deletions
|
|
@ -261,7 +261,6 @@ command!(|self:ArrangerCommand,state:ArrangerTui|{
|
||||||
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),
|
|
||||||
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!(); },
|
||||||
|
|
@ -278,6 +277,26 @@ command!(|self:ArrangerCommand,state:ArrangerTui|{
|
||||||
state.show_pool = show;
|
state.show_pool = show;
|
||||||
None
|
None
|
||||||
},
|
},
|
||||||
|
Phrases(cmd) => {
|
||||||
|
let mut default = |cmd: PhrasesCommand|cmd
|
||||||
|
.execute(&mut state.phrases)
|
||||||
|
.map(|x|x.map(Phrases));
|
||||||
|
match cmd {
|
||||||
|
// autoselect: automatically load selected phrase in editor
|
||||||
|
PhrasesCommand::Select(_) => {
|
||||||
|
let undo = default(cmd)?;
|
||||||
|
state.editor.set_phrase(Some(state.phrases.phrase()));
|
||||||
|
undo
|
||||||
|
},
|
||||||
|
// update color in all places simultaneously
|
||||||
|
PhrasesCommand::Phrase(PhrasePoolCommand::SetColor(index, _)) => {
|
||||||
|
let undo = default(cmd)?;
|
||||||
|
state.editor.set_phrase(Some(state.phrases.phrase()));
|
||||||
|
undo
|
||||||
|
},
|
||||||
|
_ => default(cmd)?
|
||||||
|
}
|
||||||
|
},
|
||||||
_ => { todo!() }
|
_ => { todo!() }
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue