add debug borders to scene grid to diagnose misalignment

This commit is contained in:
🪞👃🪞 2025-01-14 22:41:43 +01:00
parent ce91e1a043
commit fadaaa1620
2 changed files with 14 additions and 13 deletions

View file

@ -103,8 +103,8 @@ edn_view!(TuiOut: |self: App| self.size.of(EdnView::from_source(self, self.edn.a
":tracks" => self.row(self.w(), 3, self.track_header(), self.track_cells()).boxed(), ":tracks" => self.row(self.w(), 3, self.track_header(), self.track_cells()).boxed(),
":inputs" => self.row(self.w(), 3, self.input_header(), self.input_cells()).boxed(), ":inputs" => self.row(self.w(), 3, self.input_header(), self.input_cells()).boxed(),
":outputs" => self.row(self.w(), 3, self.output_header(), self.output_cells()).boxed(), ":outputs" => self.row(self.w(), 3, self.output_header(), self.output_cells()).boxed(),
":scenes" => self.row(self.w(), self.size.h().saturating_sub(9) as u16, ":scenes" => Rugged(Style::default()).enclose(self.row(self.w(), self.size.h().saturating_sub(12) as u16,
self.scene_header(), self.scene_cells(self.is_editing())).boxed() }}); Rugged(Style::default()).enclose(self.scene_header()), self.scene_cells(self.is_editing()))).boxed() }});
impl App { impl App {
pub fn clock ( pub fn clock (
jack: &Arc<RwLock<JackConnection>>, jack: &Arc<RwLock<JackConnection>>,
@ -352,7 +352,7 @@ impl App {
Fill::x(Fixed::y(h + 1, cell)) Fill::x(Fixed::y(h + 1, cell))
) )
}); });
let column = Fixed::x(w, Tui::bg(Color::Reset, Align::y(cells)).boxed()); let column = Fixed::x(w, Align::y(Rugged(Style::default()).enclose(cells))).boxed();
Fixed::x(w, map_east(x1 as u16, w, column)) Fixed::x(w, map_east(x1 as u16, w, column))
}))).boxed()).into() }))).boxed()).into()
} }
@ -651,8 +651,8 @@ pub trait HasTracks: HasSelection + HasClock + HasJack + HasEditor + Send + Sync
} }
fn track_header <'a> (&'a self) -> BoxThunk<'a, TuiOut> { fn track_header <'a> (&'a self) -> BoxThunk<'a, TuiOut> {
(||Tui::bg(TuiTheme::g(32), Bsp::s( (||Tui::bg(TuiTheme::g(32), Bsp::s(
help_tag("add ", "t", "rack"), button(" C-t ", " add track "),
help_tag("", "a", "dd scene"), button(" C-a ", " add scene "),
)).boxed()).into() )).boxed()).into()
} }
fn track_cells <'a> (&'a self) -> BoxThunk<'a, TuiOut> { fn track_cells <'a> (&'a self) -> BoxThunk<'a, TuiOut> {
@ -673,7 +673,7 @@ pub trait HasTracks: HasSelection + HasClock + HasJack + HasEditor + Send + Sync
fn input_header <'a> (&'a self) -> BoxThunk<'a, TuiOut> { fn input_header <'a> (&'a self) -> BoxThunk<'a, TuiOut> {
let fg = TuiTheme::g(224); let fg = TuiTheme::g(224);
let bg = TuiTheme::g(64); let bg = TuiTheme::g(64);
(move||Bsp::s(help_tag("midi ", "I", "ns"), self.midi_ins().get(0).map(|inp|Bsp::s( (move||Bsp::s(button(" I ", " midi ins "), self.midi_ins().get(0).map(|inp|Bsp::s(
Fill::x(Tui::bold(true, Tui::fg_bg(fg, bg, Align::w(inp.name.clone())))), Fill::x(Tui::bold(true, Tui::fg_bg(fg, bg, Align::w(inp.name.clone())))),
inp.connect.get(0).map(|connect|Fill::x(Align::w(Tui::bold(false, inp.connect.get(0).map(|connect|Fill::x(Align::w(Tui::bold(false,
Tui::fg_bg(fg, bg, connect.info()))))), Tui::fg_bg(fg, bg, connect.info()))))),
@ -701,7 +701,7 @@ pub trait HasTracks: HasSelection + HasClock + HasJack + HasEditor + Send + Sync
fn output_header <'a> (&'a self) -> BoxThunk<'a, TuiOut> { fn output_header <'a> (&'a self) -> BoxThunk<'a, TuiOut> {
let fg = TuiTheme::g(224); let fg = TuiTheme::g(224);
let bg = TuiTheme::g(64); let bg = TuiTheme::g(64);
(move||Bsp::s(help_tag("midi ", "O", "uts"), self.midi_outs().get(0).map(|out|Bsp::s( (move||Bsp::s(button(" O ", " midi outs "), self.midi_outs().get(0).map(|out|Bsp::s(
Fill::x(Tui::bold(true, Tui::fg_bg(fg, bg, Align::w(out.name.clone())))), Fill::x(Tui::bold(true, Tui::fg_bg(fg, bg, Align::w(out.name.clone())))),
out.connect.get(0).map(|connect|Fill::x(Align::w(Tui::bold(false, out.connect.get(0).map(|connect|Fill::x(Align::w(Tui::bold(false,
Tui::fg_bg(fg, bg, connect.info()))))), Tui::fg_bg(fg, bg, connect.info()))))),
@ -969,10 +969,11 @@ audio!(|self: App, client, scope|{
self.perf.update(t0, scope); self.perf.update(t0, scope);
Control::Continue Control::Continue
}); });
fn help_tag <'a> (before: &'a str, key: &'a str, after: &'a str) -> impl Content<TuiOut> + 'a { fn button <'a> (key: &'a str, label: &'a str) -> impl Content<TuiOut> + 'a {
let lo = TuiTheme::g(128); Tui::bold(true, Bsp::e(
let hi = TuiTheme::orange(); Margin::x(1, Tui::fg_bg(TuiTheme::g(0), TuiTheme::orange(), key)),
Tui::bold(true, row!(Tui::fg(lo, before), Tui::fg(hi, key), Tui::fg(lo, after))) Margin::x(1, Tui::fg_bg(TuiTheme::g(255), TuiTheme::g(96), label)),
))
} }
#[derive(Debug, Default)] struct Meter<'a>(pub &'a str, pub f32); #[derive(Debug, Default)] struct Meter<'a>(pub &'a str, pub f32);
content!(TuiOut: |self: Meter<'a>| col!( content!(TuiOut: |self: Meter<'a>| col!(
@ -999,7 +1000,7 @@ content!(TuiOut: |self: Meters<'a>| col!(
format!("R/{:>+9.3}", self.0[1]) format!("R/{:>+9.3}", self.0[1])
)); ));
pub struct ClockView<'a> { pub compact: bool, pub clock: &'a Clock } pub struct ClockView<'a> { pub compact: bool, pub clock: &'a Clock }
content!(TuiOut: |self: ClockView<'a>| Outer(Style::default().fg(TuiTheme::g(255))).enclose(row!( content!(TuiOut: |self: ClockView<'a>| Outer(Style::default().fg(TuiTheme::g(0))).enclose(row!(
OutputStats::new(self.compact, self.clock), OutputStats::new(self.compact, self.clock),
" ", " ",
PlayPause { compact: false, playing: self.clock.is_rolling() }, PlayPause { compact: false, playing: self.clock.is_rolling() },

View file

@ -1,3 +1,3 @@
(bsp/s (fixed/y 2 :toolbar) (bsp/s (fixed/y 2 :toolbar)
(fill/x (align/c (bsp/w (fixed/x :pool-w :pool) (fill/x (align/c (bsp/w (fixed/x :pool-w :pool)
(bsp/s :outputs (bsp/s :inputs (bsp/s :tracks :scenes))))))) (bsp/n (fixed/y 3 :outputs) (bsp/n (fixed/y 3 :inputs) (bsp/n (fixed/y 3 :tracks) :scenes)))))))