wip: more flattening and view_arranger

This commit is contained in:
🪞👃🪞 2025-02-09 16:49:50 +01:00
parent e0f4ec9a15
commit 53f443f4bd
6 changed files with 94 additions and 81 deletions

View file

@ -34,7 +34,7 @@ impl Tek {
let theme = ItemPalette::G[96];
let fmtd = self.fmtd.read().unwrap();
Tui::bg(Black, row!(Bsp::a(
Fill::xy(Align::w(self.view_play_pause())),
Fill::xy(Align::w(button_play_pause(self.clock.is_rolling()))),
Fill::xy(Align::e(row!(
FieldH(theme, "BPM", fmtd.bpm.view.clone()),
FieldH(theme, "Beat", fmtd.beat.view.clone()),
@ -47,7 +47,9 @@ impl Tek {
let theme = ItemPalette::G[96];
let fmtd = self.fmtd.read().unwrap();
Tui::bg(Black, row!(Bsp::a(
Fill::xy(Align::w(FieldH(theme, "Selected", self.selected.describe(&self.tracks, &self.scenes)))),
Fill::xy(Align::w(
FieldH(theme, "Selected", self.selected.describe(&self.tracks, &self.scenes))
)),
Fill::xy(Align::e(row!(
FieldH(theme, "SR", fmtd.sr.view.clone()),
FieldH(theme, "Buf", fmtd.buf.view.clone()),
@ -55,17 +57,17 @@ impl Tek {
)))
)))
}
fn view_play_pause (&self) -> impl Content<TuiOut> + use<'_> {
let playing = self.clock.is_rolling();
let compact = true;//self.is_editing();
Tui::bg(
if playing{Rgb(0,128,0)}else{Rgb(128,64,0)},
Either::new(compact,
Thunk::new(move||Fixed::x(9, Either::new(playing,
Tui::fg(Rgb(0, 255, 0), " PLAYING "),
Tui::fg(Rgb(255, 128, 0), " STOPPED ")))),
Thunk::new(move||Fixed::x(5, Either::new(playing,
Tui::fg(Rgb(0, 255, 0), Bsp::s(" 🭍🭑🬽 ", " 🭞🭜🭘 ",)),
Tui::fg(Rgb(255, 128, 0), Bsp::s(" ▗▄▖ ", " ▝▀▘ ",)))))))
}
}
fn button_play_pause (playing: bool) -> impl Content<TuiOut> {
let compact = true;//self.is_editing();
Tui::bg(
if playing{Rgb(0,128,0)}else{Rgb(128,64,0)},
Either::new(compact,
Thunk::new(move||Fixed::x(9, Either::new(playing,
Tui::fg(Rgb(0, 255, 0), " PLAYING "),
Tui::fg(Rgb(255, 128, 0), " STOPPED ")))),
Thunk::new(move||Fixed::x(5, Either::new(playing,
Tui::fg(Rgb(0, 255, 0), Bsp::s(" 🭍🭑🬽 ", " 🭞🭜🭘 ",)),
Tui::fg(Rgb(255, 128, 0), Bsp::s(" ▗▄▖ ", " ▝▀▘ ",)))))))
}