mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
add FieldV
This commit is contained in:
parent
52e34ce8a7
commit
c9a79b1f29
3 changed files with 34 additions and 14 deletions
|
|
@ -33,11 +33,11 @@ impl<'a> TransportView<'a> {
|
|||
render!(Tui: (self: TransportView<'a>) => Outer(
|
||||
Style::default().fg(TuiTheme::g(255)).bg(TuiTheme::g(0))
|
||||
).enclose(row!(
|
||||
BeatStats::new(self.compact, self.clock),
|
||||
" ",
|
||||
PlayPause { compact: self.compact, playing: self.clock.is_rolling() },
|
||||
" ",
|
||||
OutputStats::new(self.compact, self.clock),
|
||||
" ",
|
||||
PlayPause { compact: false, playing: self.clock.is_rolling() },
|
||||
" ",
|
||||
BeatStats::new(self.compact, self.clock),
|
||||
)));
|
||||
|
||||
pub struct PlayPause { pub compact: bool, pub playing: bool }
|
||||
|
|
@ -66,9 +66,9 @@ impl BeatStats {
|
|||
}
|
||||
render!(Tui: (self: BeatStats) => Tui::either(self.compact,
|
||||
row!(
|
||||
Field(TuiTheme::g(128).into(), "BPM", &self.bpm),
|
||||
Field(TuiTheme::g(128).into(), "Beat", &self.beat),
|
||||
Field(TuiTheme::g(128).into(), "Time", &self.time),
|
||||
FieldV(TuiTheme::g(128).into(), "BPM", &self.bpm),
|
||||
FieldV(TuiTheme::g(128).into(), "Beat", &self.beat),
|
||||
FieldV(TuiTheme::g(128).into(), "Time", &self.time),
|
||||
),
|
||||
col!(
|
||||
Bsp::e(Tui::fg(TuiTheme::g(255), &self.bpm), " BPM"),
|
||||
|
|
@ -95,9 +95,9 @@ impl OutputStats {
|
|||
}
|
||||
render!(Tui: (self: OutputStats) => Tui::either(self.compact,
|
||||
row!(
|
||||
Field(TuiTheme::g(128).into(), "SR", &self.sample_rate),
|
||||
Field(TuiTheme::g(128).into(), "Buf", &self.buffer_size),
|
||||
Field(TuiTheme::g(128).into(), "Lat", &self.latency),
|
||||
FieldV(TuiTheme::g(128).into(), "SR", &self.sample_rate),
|
||||
FieldV(TuiTheme::g(128).into(), "Buf", &self.buffer_size),
|
||||
FieldV(TuiTheme::g(128).into(), "Lat", &self.latency),
|
||||
),
|
||||
col!(
|
||||
Bsp::e(Tui::fg(TuiTheme::g(255), format!("{}", self.sample_rate)), " sample rate"),
|
||||
|
|
|
|||
23
src/field.rs
23
src/field.rs
|
|
@ -20,3 +20,26 @@ impl<T, U> Content<Tui> for Field<T, U>
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
pub struct FieldV<T, U>(pub ItemPalette, pub T, pub U)
|
||||
where T: AsRef<str> + Send + Sync, U: AsRef<str> + Send + Sync;
|
||||
|
||||
impl<T, U> Content<Tui> for FieldV<T, U>
|
||||
where T: AsRef<str> + Send + Sync, U: AsRef<str> + Send + Sync
|
||||
{
|
||||
fn content (&self) -> impl Content<Tui> {
|
||||
Bsp::e(
|
||||
Bsp::s(
|
||||
row!(
|
||||
Tui::bg(self.0.darkest.rgb, Tui::fg(self.0.darker.rgb, "▐")),
|
||||
Tui::bg(self.0.darker.rgb, Tui::fg(self.0.lighter.rgb,
|
||||
Tui::bold(true, format!("{}", self.1.as_ref())))),
|
||||
Tui::bg(self.0.darkest.rgb, Tui::fg(self.0.darker.rgb, "▌")),
|
||||
),
|
||||
Tui::bg(self.0.darkest.rgb, Tui::fg(self.0.lightest.rgb,
|
||||
format!(" {}", self.2.as_ref())))
|
||||
),
|
||||
" "
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -120,10 +120,7 @@ render!(Tui: (self: Groovebox) => {
|
|||
Fill::x(Fixed::y(if self.pool.visible { 3 } else { 1 }, lay!(
|
||||
Align::w(Meter("L/", self.sampler.input_meter[0])),
|
||||
Align::e(Meter("R/", self.sampler.input_meter[1])),
|
||||
Align::x(Tui::bg(TuiTheme::g(32), TransportView::new(
|
||||
!self.pool.visible,
|
||||
&self.player.clock
|
||||
))),
|
||||
Align::x(Tui::bg(TuiTheme::g(32), TransportView::new(true, &self.player.clock))),
|
||||
))),
|
||||
Bsp::s(
|
||||
lay!(Align::w(edit_clip), Align::e(selectors)),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue