mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +01:00
This commit is contained in:
parent
57102d7e6b
commit
b0ef0cfd21
6 changed files with 197 additions and 188 deletions
51
crates/device/src/clock/clock_view.rs
Normal file
51
crates/device/src/clock/clock_view.rs
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
use crate::*;
|
||||
|
||||
pub fn view_transport (
|
||||
play: bool,
|
||||
bpm: Arc<RwLock<String>>,
|
||||
beat: Arc<RwLock<String>>,
|
||||
time: Arc<RwLock<String>>,
|
||||
) -> impl Content<TuiOut> {
|
||||
let theme = ItemTheme::G[96];
|
||||
Tui::bg(Black, row!(Bsp::a(
|
||||
Fill::xy(Align::w(button_play_pause(play))),
|
||||
Fill::xy(Align::e(row!(
|
||||
FieldH(theme, "BPM", bpm),
|
||||
FieldH(theme, "Beat", beat),
|
||||
FieldH(theme, "Time", time),
|
||||
)))
|
||||
)))
|
||||
}
|
||||
|
||||
pub fn view_status (
|
||||
sel: Arc<str>,
|
||||
sr: Arc<RwLock<String>>,
|
||||
buf: Arc<RwLock<String>>,
|
||||
lat: Arc<RwLock<String>>,
|
||||
) -> impl Content<TuiOut> {
|
||||
let theme = ItemTheme::G[96];
|
||||
Tui::bg(Black, row!(Bsp::a(
|
||||
Fill::xy(Align::w(FieldH(theme, "Selected", sel))),
|
||||
Fill::xy(Align::e(row!(
|
||||
FieldH(theme, "SR", sr),
|
||||
FieldH(theme, "Buf", buf),
|
||||
FieldH(theme, "Lat", lat),
|
||||
)))
|
||||
)))
|
||||
}
|
||||
|
||||
pub(crate) 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(" ▗▄▖ ", " ▝▀▘ ",))))
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue