consistent track sections

This commit is contained in:
🪞👃🪞 2025-01-23 21:36:15 +01:00
parent 9462a3f2a4
commit af958b275d

View file

@ -208,7 +208,7 @@ impl Tek {
};
let header: ThunkBox<_> = io_header!(
self,
" I ",
" I ",
" midi ins",
self.midi_ins.len(),
self.midi_ins().get(0).map(move|input: &JackMidiIn|Bsp::s(
@ -221,11 +221,11 @@ impl Tek {
let bg = if self.selected().track() == Some(t+1) { track.color.light.rgb } else { track.color.base.rgb };
let bg2 = if t > 0 { self.tracks()[t - 1].color.base.rgb } else { Reset };
Bsp::s(
Self::wrap(bg, bg2, fg, Tui::bold(true, row!(
Self::wrap(bg, fg, Tui::bold(true, row!(
Tui::fg_bg(if rec { White } else { track.color.darkest.rgb }, bg, "Recrd"),
Tui::fg_bg(if mon { White } else { track.color.darkest.rgb }, bg, "Monit"),
))),
Self::wrap(bg, bg2, fg, row!(
Self::wrap(bg, fg, row!(
Tui::fg_bg(if rec { White } else { track.color.darkest.rgb }, bg, "P▞▞▞▞"),
Tui::fg_bg(if mon { White } else { track.color.darkest.rgb }, bg, "S▞▞▞▞"),
))
@ -240,7 +240,7 @@ impl Tek {
for midi_out in self.midi_outs.iter() { h += midi_out.conn().len() }
let header: ThunkBox<_> = io_header!(
self,
" O ",
" O ",
" midi outs",
self.midi_outs.len(),
self.midi_outs().get(0).map(move|output: &JackMidiOut|Bsp::s(
@ -253,11 +253,11 @@ impl Tek {
let bg = if self.selected().track() == Some(t+1) { track.color.light.rgb } else { track.color.base.rgb };
let bg2 = if t > 0 { self.tracks()[t - 1].color.base.rgb } else { Reset };
Bsp::s(
Self::wrap(bg, bg2, fg, Tui::bold(true, row!(
Self::wrap(bg, fg, Tui::bold(true, row!(
Tui::fg_bg(if mute { White } else { track.color.darkest.rgb }, bg, "Play "),
Tui::fg_bg(if solo { White } else { track.color.darkest.rgb }, bg, "Solo "),
))),
Self::wrap(bg, bg2, fg, row!(
Self::wrap(bg, fg, row!(
Tui::fg_bg(if mute { White } else { track.color.darkest.rgb }, bg, "P▞▞▞▞"),
Tui::fg_bg(if solo { White } else { track.color.darkest.rgb }, bg, "S▞▞▞▞"),
))
@ -265,8 +265,8 @@ impl Tek {
});
self.view_row(self.w(), h as u16, header, cells)
}
fn wrap (bg: Color, bg2: Color, fg: Color, content: impl Content<TuiOut>) -> impl Content<TuiOut> {
Bsp::e(Tui::fg_bg(bg, bg2, ""), Bsp::w(Tui::fg_bg(bg, Reset, ""), Tui::fg_bg(fg, bg, content)))
fn wrap (bg: Color, fg: Color, content: impl Content<TuiOut>) -> impl Content<TuiOut> {
Bsp::e(Tui::fg_bg(bg, Reset, ""), Bsp::w(Tui::fg_bg(bg, Reset, ""), Tui::fg_bg(fg, bg, content)))
}
fn view_tracks (&self) -> impl Content<TuiOut> + use<'_> {
let height = 1;
@ -277,10 +277,10 @@ impl Tek {
let name = &track.name;
let fg = track.color.lightest.rgb;
let bg = if active { track.color.light.rgb } else { track.color.base.rgb };
let bg2 = if t > 0 { self.tracks()[t - 1].color.base.rgb } else { Reset };
let bg2 = Reset;//if t > 0 { self.tracks()[t - 1].color.base.rgb } else { Reset };
let bfg = if active { Rgb(255,255,255) } else { Rgb(0,0,0) };
Outer(active, Style::default().fg(bfg).bg(bg))
.enclose(Self::wrap(bg, bg2, fg, Tui::bold(true, Fill::x(Align::nw(name)))))
.enclose(Self::wrap(bg, fg, Tui::bold(true, Fill::x(Align::nw(name)))))
});
self.view_row(self.w(), height, header, content)
}
@ -288,7 +288,7 @@ impl Tek {
let data = (self.selected.track().unwrap_or(0), self.tracks().len());
self.fmtd.write().unwrap().trks.update(Some(data),
rewrite!(buf, "({}/{})", data.0, data.1));
button(" C-t ", Bsp::e(" add track ",
button(" T ", Bsp::e(" track ",
self.fmtd.read().unwrap().trks.view.clone()))
}
fn view_scene_add (&self) -> impl Content<TuiOut> + use<'_> {