mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
fix track titles and colors
This commit is contained in:
parent
85ef1087db
commit
1757fdf765
1 changed files with 13 additions and 9 deletions
|
|
@ -63,22 +63,26 @@ render!(<Tui>|self: ArrangerVHead<'a>|Tui::push_x(self.scenes_w, row!(
|
|||
(_, track, x1, x2) in ArrangerTrack::with_widths(self.tracks) => {
|
||||
let (w, h) = (ArrangerTrack::MIN_WIDTH.max(x2 - x1), HEADER_H);
|
||||
let color = track.color();
|
||||
fn row <T: Render<Tui>> (color: ItemPalette, field: &T) -> impl Render<Tui> + use<'_, T> {
|
||||
row!([
|
||||
Tui::fg(color.light.rgb, "▎"),
|
||||
Tui::fg(color.lightest.rgb, field)
|
||||
])
|
||||
}
|
||||
Tui::bg(color.base.rgb, Tui::min_xy(w as u16, h, Fixed::wh(w as u16, 5, col!([
|
||||
row!(![Tui::fg(color.light.rgb, "▎"), Self::format_name(track, w)]),
|
||||
row!(![Tui::fg(color.light.rgb, "▎"), Self::format_input(track)?]),
|
||||
row!(![Tui::fg(color.light.rgb, "▎"), Self::format_output(track)?]),
|
||||
row!(![Tui::fg(color.light.rgb, "▎"), Self::format_elapsed(track, &self.timebase)]),
|
||||
row!(![Tui::fg(color.light.rgb, "▎"), Self::format_until_next(track, &self.current)]),
|
||||
row(color, &Self::format_name(track, w)),
|
||||
row(color, &Self::format_input(track)?),
|
||||
row(color, &Self::format_output(track)?),
|
||||
row(color, &Self::format_elapsed(track, &self.timebase)),
|
||||
row(color, &Self::format_until_next(track, &self.current)),
|
||||
]))))
|
||||
}
|
||||
)));
|
||||
impl<'a> ArrangerVHead<'a> {
|
||||
/// name and width of track
|
||||
fn format_name (track: &ArrangerTrack, w: usize) -> impl Render<Tui> {
|
||||
let name = track.name().read().unwrap();
|
||||
let max_w = w.saturating_sub(1).min(name.len()).max(2);
|
||||
let name = String::from(&name[0..max_w]);
|
||||
Tui::bold(true, Tui::fg(track.color.lightest.rgb, name));
|
||||
let name = track.name().read().unwrap().clone();
|
||||
Tui::bold(true, Tui::fg(track.color.lightest.rgb, name))
|
||||
}
|
||||
/// input port
|
||||
fn format_input (track: &ArrangerTrack) -> Usually<impl Render<Tui>> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue