mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 04:06:45 +01:00
highlight commands in status bar
This commit is contained in:
parent
66483f8371
commit
727702778b
2 changed files with 73 additions and 32 deletions
|
|
@ -4,7 +4,7 @@ impl Content for Arranger<Tui> {
|
|||
type Engine = Tui;
|
||||
fn content (&self) -> impl Widget<Engine = Tui> {
|
||||
Split::down(
|
||||
2,
|
||||
1,
|
||||
widget(&self.transport),
|
||||
Split::up(
|
||||
1,
|
||||
|
|
@ -35,26 +35,67 @@ impl Content for ArrangerStatusBar {
|
|||
Self::PhraseView => "SEQ VIEW",
|
||||
Self::PhraseEdit => "SEQ EDIT",
|
||||
};
|
||||
let label = TuiStyle::bg(format!(" {label} "), Color::Rgb(150, 160, 90))
|
||||
let mode = TuiStyle::bg(format!(" {label} "), Color::Rgb(150, 160, 90))
|
||||
.fg(Color::Rgb(0, 0, 0))
|
||||
.bold(true);
|
||||
row!(label, " ", match self {
|
||||
Self::ArrangementMix =>
|
||||
"[<>]Resize arranger",
|
||||
Self::ArrangementClip =>
|
||||
"[G]et [S]et [A]dd [I]nsert [D]uplicate [E]dit [C]olor re[N]ame [,.]Choose",
|
||||
Self::ArrangementTrack =>
|
||||
"[,.]Resize [<>]Move",
|
||||
Self::PhrasePool =>
|
||||
"[A]ppend [I]nsert [D]uplicate [C]olor re[N]ame leng[T]h [,.]Move [<>]Resize list",
|
||||
Self::PhraseView =>
|
||||
"[Enter]Edit notes [Arrows/PgUp/PgDn]Scroll",
|
||||
Self::PhraseEdit =>
|
||||
"[Esc]Exit edit mode [A]ppend [S]et",
|
||||
_ => ""
|
||||
})
|
||||
let commands = match self {
|
||||
Self::ArrangementMix => command(&[
|
||||
["", "<>", "resize view"],
|
||||
]),
|
||||
Self::ArrangementClip => command(&[
|
||||
["", "g", "et"],
|
||||
["", "s", "et"],
|
||||
["", "a", "dd"],
|
||||
["", "i", "ns"],
|
||||
["", "d", "up"],
|
||||
["", "e", "dit"],
|
||||
["", "c", "olor"],
|
||||
["re", "n", "ame"],
|
||||
["", ",.", "select"],
|
||||
]),
|
||||
Self::ArrangementTrack => command(&[
|
||||
["", ",.", "resize"],
|
||||
["", "<>", "move"],
|
||||
["", "i", "nput"],
|
||||
["", "o", "utput"],
|
||||
["", "m", "ute"],
|
||||
["", "s", "olo"],
|
||||
]),
|
||||
Self::PhrasePool => command(&[
|
||||
["", "a", "ppend"],
|
||||
["", "i", "nsert"],
|
||||
["", "d", "uplicate"],
|
||||
["", "c", "olor"],
|
||||
["re", "n", "ame"],
|
||||
["leng", "t", "h"],
|
||||
["", ",.", "move"],
|
||||
["", "<>", "resize view"],
|
||||
]),
|
||||
Self::PhraseView => command(&[
|
||||
["", "enter", " edit"],
|
||||
["", "arrows/pgup/pgdn", " scroll"],
|
||||
]),
|
||||
Self::PhraseEdit => command(&[
|
||||
["", "esc", " exit"],
|
||||
["", "a", "ppend"],
|
||||
["", "s", "et"],
|
||||
]),
|
||||
_ => command(&[])
|
||||
};
|
||||
//let commands = commands.iter().reduce(String::new(), |s, (a, b, c)| format!("{s} {a}{b}{c}"));
|
||||
row!(mode, commands)
|
||||
}
|
||||
}
|
||||
fn command (
|
||||
commands: &[[impl Widget<Engine = Tui>;3]]
|
||||
) -> impl Widget<Engine = Tui> + '_ {
|
||||
Stack::right(|add|{
|
||||
for [a, b, c] in commands.iter() {
|
||||
add(&row!(" ", widget(a), widget(b).bold(true).fg(Color::Rgb(255,255,0)), widget(c)))?;
|
||||
}
|
||||
Ok(())
|
||||
})
|
||||
}
|
||||
impl Content for Arrangement<Tui> {
|
||||
type Engine = Tui;
|
||||
fn content (&self) -> impl Widget<Engine = Tui> {
|
||||
|
|
@ -64,14 +105,14 @@ impl Content for Arrangement<Tui> {
|
|||
ArrangementViewMode::Vertical(factor) => add(&VerticalArranger(&self, factor))
|
||||
}?;
|
||||
let color = if self.focused{Color::Rgb(150, 160, 90)}else{Color::Rgb(120, 130, 100)};
|
||||
if self.focused {
|
||||
let commands = "[G]et [S]et [A]dd [I]nsert [D]uplicate [E]dit [C]olor";
|
||||
let lower_left = Align::SW(TuiStyle::fg(commands, color).push_x(1));
|
||||
add(&lower_left)?;
|
||||
}
|
||||
let description = self.selected.description(&self.tracks, &self.scenes);
|
||||
let lower_right = Align::SE(TuiStyle::fg(description.as_str(), color).pull_x(1));
|
||||
add(&lower_right)?;
|
||||
//if self.focused {
|
||||
//let commands = "[G]et [S]et [A]dd [I]nsert [D]uplicate [E]dit [C]olor";
|
||||
//let lower_left = Align::SW(TuiStyle::fg(commands, color).push_x(1));
|
||||
//add(&lower_left)?;
|
||||
//}
|
||||
//let description = self.selected.description(&self.tracks, &self.scenes);
|
||||
//let lower_right = Align::SE(TuiStyle::fg(description.as_str(), color).pull_x(1));
|
||||
//add(&lower_right)?;
|
||||
let upper_left = TuiStyle::fg("Session", color).push_x(1);
|
||||
add(&upper_left)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -17,14 +17,14 @@ impl Content for TransportToolbar<Tui> {
|
|||
_ => unreachable!(),
|
||||
}
|
||||
).min_xy(11, 2).push_x(1)),
|
||||
self.focus.wrap(self.focused, TransportToolbarFocus::Bpm, &Outset::X(1u16, col! {
|
||||
"BPM", format!("{}.{:03}", self.bpm as usize, (self.bpm * 1000.0) % 1000.0)
|
||||
self.focus.wrap(self.focused, TransportToolbarFocus::Bpm, &Outset::X(1u16, row! {
|
||||
"BPM ", format!("{}.{:03}", self.bpm as usize, (self.bpm * 1000.0) % 1000.0)
|
||||
})),
|
||||
self.focus.wrap(self.focused, TransportToolbarFocus::Quant, &Outset::X(1u16, col! {
|
||||
"QUANT", ppq_to_name(self.quant as usize)
|
||||
self.focus.wrap(self.focused, TransportToolbarFocus::Quant, &Outset::X(1u16, row! {
|
||||
"QUANT ", ppq_to_name(self.quant as usize)
|
||||
})),
|
||||
self.focus.wrap(self.focused, TransportToolbarFocus::Sync, &Outset::X(1u16, col! {
|
||||
"SYNC", ppq_to_name(self.sync as usize)
|
||||
self.focus.wrap(self.focused, TransportToolbarFocus::Sync, &Outset::X(1u16, row! {
|
||||
"SYNC ", ppq_to_name(self.sync as usize)
|
||||
})),
|
||||
self.focus.wrap(self.focused, TransportToolbarFocus::Clock, &{
|
||||
let Self { frame: _frame, pulse, ppq, usecs, .. } = self;
|
||||
|
|
@ -34,7 +34,7 @@ impl Content for TransportToolbar<Tui> {
|
|||
let (minutes, seconds) = (seconds / 60, seconds % 60);
|
||||
let time1 = format!("{bars}.{beats}.{pulses:02}");
|
||||
let time2 = format!("{minutes}:{seconds:02}:{msecs:03}");
|
||||
col!(time1.as_str(), time2.as_str()).outset_x(1)
|
||||
row!(time1.as_str(), time2.as_str()).outset_x(1)
|
||||
}),
|
||||
).fill_x().bg(Color::Rgb(40, 50, 30))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue