mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 11:46:41 +01:00
update layout macro invocations
This commit is contained in:
parent
e677d1d7d4
commit
83eb9dd2fa
19 changed files with 153 additions and 169 deletions
|
|
@ -23,10 +23,10 @@ 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)),
|
||||
])));
|
||||
)));
|
||||
impl std::fmt::Debug for TransportTui {
|
||||
fn fmt (&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
|
||||
f.debug_struct("TransportTui")
|
||||
|
|
@ -89,42 +89,42 @@ impl TransportView {
|
|||
}
|
||||
render!(Tui: (self: TransportView) => {
|
||||
let color = self.color;
|
||||
Fixed::y(3, Tui::bg(color.base.rgb, Fill::x(row!([
|
||||
col!([
|
||||
Fixed::y(3, Tui::bg(color.base.rgb, Fill::x(row!(
|
||||
col!(
|
||||
TransportField(" Beat", self.beat.as_str(), &color),
|
||||
TransportField(" Time", format!("{:.1}s", self.current_second).as_str(), &color),
|
||||
TransportField(" BPM", self.bpm.as_str(), &color),
|
||||
]),
|
||||
col!([
|
||||
),
|
||||
col!(
|
||||
TransportField(" Rate", format!("{}", self.sr).as_str(), &color),
|
||||
TransportField(" Chunk", format!("{}", self.chunk).as_str(), &color),
|
||||
TransportField(" Lag", format!("{:.3}ms", self.latency).as_str(), &color),
|
||||
]),
|
||||
col!([
|
||||
),
|
||||
col!(
|
||||
//Field(" CPU%", format!("{:.1}ms", self.perf).as_str(), &color),
|
||||
]),
|
||||
]))))
|
||||
),
|
||||
))))
|
||||
});
|
||||
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(
|
||||
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!([
|
||||
add(&Tui::fg(Color::Rgb(0, 255, 0), col!(
|
||||
" 🭍🭑🬽 ",
|
||||
" 🭞🭜🭘 ",
|
||||
])))
|
||||
)))
|
||||
} else {
|
||||
add(&Tui::fg(Color::Rgb(255, 128, 0), col!([
|
||||
add(&Tui::fg(Color::Rgb(255, 128, 0), col!(
|
||||
" ▗▄▖ ",
|
||||
" ▝▀▘ ",
|
||||
])))
|
||||
)))
|
||||
}))
|
||||
));
|
||||
impl HasFocus for TransportTui {
|
||||
|
|
@ -152,7 +152,7 @@ impl FocusWrap<TransportFocus> for TransportFocus {
|
|||
let focused = focus == self;
|
||||
let corners = focused.then_some(CORNERS);
|
||||
//let highlight = focused.then_some(Tui::bg(Color::Rgb(60, 70, 50)));
|
||||
lay!([corners, /*highlight,*/ *content])
|
||||
lay!(corners, /*highlight,*/ *content)
|
||||
}
|
||||
}
|
||||
impl FocusWrap<TransportFocus> for Option<TransportFocus> {
|
||||
|
|
@ -162,7 +162,7 @@ impl FocusWrap<TransportFocus> for Option<TransportFocus> {
|
|||
let focused = Some(focus) == self;
|
||||
let corners = focused.then_some(CORNERS);
|
||||
//let highlight = focused.then_some(Background(Color::Rgb(60, 70, 50)));
|
||||
lay!([corners, /*highlight,*/ *content])
|
||||
lay!(corners, /*highlight,*/ *content)
|
||||
}
|
||||
}
|
||||
pub trait TransportControl<T>: HasClock + {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue