mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-08 04:36:45 +01:00
autoselect
This commit is contained in:
parent
ddba9e0382
commit
b799f6dbd0
2 changed files with 33 additions and 21 deletions
|
|
@ -74,7 +74,17 @@ impl Command<SequencerTui> for SequencerCommand {
|
||||||
fn execute (self, state: &mut SequencerTui) -> Perhaps<Self> {
|
fn execute (self, state: &mut SequencerTui) -> Perhaps<Self> {
|
||||||
Ok(match self {
|
Ok(match self {
|
||||||
Self::Focus(cmd) => cmd.execute(state)?.map(Focus),
|
Self::Focus(cmd) => cmd.execute(state)?.map(Focus),
|
||||||
Self::Phrases(cmd) => cmd.execute(&mut state.phrases)?.map(Phrases),
|
Self::Phrases(cmd) => {
|
||||||
|
match cmd {
|
||||||
|
// autoselect: automatically load selected phrase in editor
|
||||||
|
PhrasesCommand::Select(_) => {
|
||||||
|
let undo = cmd.execute(&mut state.phrases)?.map(Phrases);
|
||||||
|
Editor(Show(Some(state.phrases.phrase().clone()))).execute(state)?;
|
||||||
|
undo
|
||||||
|
},
|
||||||
|
_ => cmd.execute(&mut state.phrases)?.map(Phrases)
|
||||||
|
}
|
||||||
|
},
|
||||||
Self::Editor(cmd) => cmd.execute(&mut state.editor)?.map(Editor),
|
Self::Editor(cmd) => cmd.execute(&mut state.editor)?.map(Editor),
|
||||||
Self::Clock(cmd) => cmd.execute(state)?.map(Clock),
|
Self::Clock(cmd) => cmd.execute(state)?.map(Clock),
|
||||||
Self::Enqueue(phrase) => {
|
Self::Enqueue(phrase) => {
|
||||||
|
|
@ -370,8 +380,8 @@ render!(|self: SequencerStatusBar|Tui::fixed_y(2, row!([
|
||||||
command
|
command
|
||||||
])]);
|
])]);
|
||||||
let double = |(b1, c1), (b2, c2)|col!([
|
let double = |(b1, c1), (b2, c2)|col!([
|
||||||
row!([" ", Tui::fg(TuiTheme::yellow(), b1), " ", c1, " "]),
|
row!([" ", Tui::fg(TuiTheme::yellow(), b1), " ", c1,]),
|
||||||
row!([" ", Tui::fg(TuiTheme::yellow(), b2), " ", c2, " "]),
|
row!([" ", Tui::fg(TuiTheme::yellow(), b2), " ", c2,]),
|
||||||
]);
|
]);
|
||||||
Tui::bg(bg, Tui::fg(fg, row!([
|
Tui::bg(bg, Tui::fg(fg, row!([
|
||||||
single("SPACE", "play/pause"),
|
single("SPACE", "play/pause"),
|
||||||
|
|
|
||||||
|
|
@ -236,26 +236,28 @@ render!(|self:PhraseEditStatus<'a>|row!(|add|{
|
||||||
let bg = color.darker.rgb;
|
let bg = color.darker.rgb;
|
||||||
let fg = color.lightest.rgb;
|
let fg = color.lightest.rgb;
|
||||||
add(&Tui::fill_x(Tui::bg(bg, row!(|add|{
|
add(&Tui::fill_x(Tui::bg(bg, row!(|add|{
|
||||||
add(&Tui::fixed_xy(16, 3, col!(![
|
add(&Tui::fixed_xy(26, 3, col!(![
|
||||||
row!(![" Edit ", Tui::bold(true, format!("{name}"))]),
|
row!(![" Edit ", Tui::bold(true, format!("{name}"))]),
|
||||||
row!(![" Length ", Tui::bold(true, format!("{length}"))]),
|
row!(![" Length ", Tui::bold(true, format!("{length}"))]),
|
||||||
row!(![" Loop ", Tui::bold(true, format!("on"))]),
|
row!(![" Loop ", Tui::bold(true, format!("on"))])])))?;
|
||||||
])))?;
|
add(&Tui::fixed_xy(25, 3, col!(![
|
||||||
add(&Tui::fixed_xy(12, 3, col!(![
|
|
||||||
row!(!["Time ", Tui::bold(true, format!("{}", self.0.time_point()))]),
|
row!(!["Time ", Tui::bold(true, format!("{}", self.0.time_point()))]),
|
||||||
row!(!["Note ", Tui::bold(true, format!("{}", self.0.note_point()))]),
|
row!(!["View ", Tui::bold(true, format!("{}-{} ({}*{})",
|
||||||
row!(!["Len ", Tui::bold(true, format!("{}", self.0.note_len()))]),
|
self.0.time_start(),
|
||||||
])))?;
|
self.0.time_end(),
|
||||||
add(&Tui::fixed_xy(20, 3, col!(![
|
self.0.time_axis(),
|
||||||
row!(!["TimeRange ", Tui::bold(true, format!("{}-{}", self.0.time_start(), self.0.time_end()))]),
|
self.0.time_zoom()))])])))?;
|
||||||
row!(!["TimeAxis ", Tui::bold(true, format!("{}", self.0.time_axis()))]),
|
add(&Tui::fixed_xy(25, 3, col!(![
|
||||||
row!(!["TimeZoom ", Tui::bold(true, format!("{} {}", self.0.time_zoom(), self.0.time_lock()))]),
|
row!(!["Note ", Tui::bold(true, format!("{:4} ({:3}) {:4}",
|
||||||
])))?;
|
to_note_name(self.0.note_point()),
|
||||||
add(&Tui::fixed_xy(20, 3, col!(![
|
self.0.note_point(),
|
||||||
row!(!["NoteRange", Tui::bold(true, format!("{}-{}", self.0.note_lo(), self.0.note_hi()))]),
|
self.0.note_len()))]),
|
||||||
row!(!["NoteAxis ", Tui::bold(true, format!("{}", self.0.note_axis()))]),
|
row!(!["View ", Tui::bold(true, format!("{}-{} ({})",
|
||||||
""
|
to_note_name(self.0.note_lo()),
|
||||||
])))?;
|
to_note_name(self.0.note_hi()),
|
||||||
|
self.0.note_axis()))])])))?;
|
||||||
|
add(&Tui::fixed_xy(16, 3, col!(![
|
||||||
|
row!(!["TimeLock ", Tui::bold(true, format!("{}", self.0.time_lock()))])])))?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}))))
|
}))))
|
||||||
}));
|
}));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue