wip: distribute layout operator parsing

This commit is contained in:
🪞👃🪞 2025-01-13 23:21:56 +01:00
parent 4af6e011b6
commit fa70a42bad
12 changed files with 150 additions and 81 deletions

View file

@ -39,11 +39,11 @@ render!(TuiOut: (self: ClockView<'a>) => Outer(
pub struct PlayPause { pub compact: bool, pub playing: bool }
render!(TuiOut: (self: PlayPause) => Tui::bg(
if self.playing{Color::Rgb(0,128,0)}else{Color::Rgb(128,64,0)},
Either(self.compact,
Thunk::new(||Fixed::x(9, Either(self.playing,
Either::new(self.compact,
Thunk::new(||Fixed::x(9, Either::new(self.playing,
Tui::fg(Color::Rgb(0, 255, 0), " PLAYING "),
Tui::fg(Color::Rgb(255, 128, 0), " STOPPED ")))),
Thunk::new(||Fixed::x(5, Either(self.playing,
Thunk::new(||Fixed::x(5, Either::new(self.playing,
Tui::fg(Color::Rgb(0, 255, 0), Bsp::s(" 🭍🭑🬽 ", " 🭞🭜🭘 ",)),
Tui::fg(Color::Rgb(255, 128, 0), Bsp::s(" ▗▄▖ ", " ▝▀▘ ",))))))));
@ -63,7 +63,7 @@ impl BeatStats {
Self { compact, bpm, beat, time }
}
}
render!(TuiOut: (self: BeatStats) => Either(self.compact,
render!(TuiOut: (self: BeatStats) => Either::new(self.compact,
row!(
FieldV(TuiTheme::g(128).into(), "BPM", &self.bpm),
FieldV(TuiTheme::g(128).into(), "Beat", &self.beat),
@ -92,7 +92,7 @@ impl OutputStats {
}
}
}
render!(TuiOut: (self: OutputStats) => Either(self.compact,
render!(TuiOut: (self: OutputStats) => Either::new(self.compact,
row!(
FieldV(TuiTheme::g(128).into(), "SR", &self.sample_rate),
FieldV(TuiTheme::g(128).into(), "Buf", &self.buffer_size),

View file

@ -1,6 +1,7 @@
use crate::*;
/// Performance counter
#[derive(Debug)]
pub struct PerfModel {
pub enabled: bool,
clock: quanta::Clock,