sweeeeping sweep

This commit is contained in:
🪞👃🪞 2024-12-31 04:12:09 +01:00
parent c9b09b7dea
commit e677d1d7d4
38 changed files with 766 additions and 691 deletions

View file

@ -23,7 +23,7 @@ from_jack!(|jack|TransportTui Self {
has_clock!(|self: TransportTui|&self.clock);
audio!(|self: TransportTui, client, scope|ClockAudio(self).process(client, scope));
handle!(<Tui>|self: TransportTui, from|TransportCommand::execute_with_state(self, from));
render!(<Tui>|self: TransportTui|Fixed::y(3, row!([
render!(Tui: (self: TransportTui) => Fixed::y(3, row!([
" ", Fixed::x(5, PlayPause(false)),
" ", Shrink::x(1, TransportView::new(self, Some(self.color), true)),
])));
@ -87,7 +87,7 @@ impl TransportView {
}
}
}
render!(<Tui>|self: TransportView|{
render!(Tui: (self: TransportView) => {
let color = self.color;
Fixed::y(3, Tui::bg(color.base.rgb, Fill::x(row!([
col!([
@ -106,14 +106,14 @@ render!(<Tui>|self: TransportView|{
]))))
});
struct TransportField<'a>(&'a str, &'a str, &'a ItemPalette);
render!(<Tui>|self: TransportField<'a>|row!([
render!(Tui: (self: TransportField<'a>) => row!([
Tui::fg_bg(self.2.lightest.rgb, self.2.base.rgb, Tui::bold(true, self.0)),
Tui::fg_bg(self.2.base.rgb, self.2.darkest.rgb, ""),
Tui::fg_bg(self.2.lightest.rgb, self.2.darkest.rgb, format!("{:>10}", self.1)),
Tui::fg_bg(self.2.darkest.rgb, self.2.base.rgb, ""),
]));
pub struct PlayPause(pub bool);
render!(<Tui>|self: PlayPause|Tui::bg(
render!(Tui: (self: PlayPause) => Tui::bg(
if self.0{Color::Rgb(0,128,0)}else{Color::Rgb(128,64,0)},
Fixed::x(5, col!(|add|if self.0 {
add(&Tui::fg(Color::Rgb(0, 255, 0), col!([
@ -146,8 +146,8 @@ pub enum TransportFocus {
Quant,
}
impl FocusWrap<TransportFocus> for TransportFocus {
fn wrap <'a, W: Render<Tui>> (self, focus: TransportFocus, content: &'a W)
-> impl Render<Tui> + 'a
fn wrap <'a, W: Content<Tui>> (self, focus: TransportFocus, content: &'a W)
-> impl Content<Tui> + 'a
{
let focused = focus == self;
let corners = focused.then_some(CORNERS);
@ -156,8 +156,8 @@ impl FocusWrap<TransportFocus> for TransportFocus {
}
}
impl FocusWrap<TransportFocus> for Option<TransportFocus> {
fn wrap <'a, W: Render<Tui>> (self, focus: TransportFocus, content: &'a W)
-> impl Render<Tui> + 'a
fn wrap <'a, W: Content<Tui>> (self, focus: TransportFocus, content: &'a W)
-> impl Content<Tui> + 'a
{
let focused = Some(focus) == self;
let corners = focused.then_some(CORNERS);