This commit is contained in:
i do not exist 2026-06-19 10:17:17 +03:00
parent 9283c54eec
commit b44dc635ef
3 changed files with 31 additions and 37 deletions

View file

@ -790,18 +790,17 @@ impl Arrangement {
view_track_row_section(theme,
button_3("d", "evice", format!("{}", self.track().map(|t|t.devices.len()).unwrap_or(0)), false),
button_2("D", "+", false),
thunk(move|to: &mut Tui|for (index, track, _x1, _x2) in self.tracks_with_sizes() {
wh_exact(track_width(index, track), h + 1,
bg(track.color.dark.term, origin_nw(iter_south(2, move||0..h,
|_, _index|wh_exact(track.width as u16, 2,
iter(||self.tracks_with_sizes(), move|(_, track, _x1, _x2), index| {
wh_exact(Some(track_width(index, track)), Some(h + 1),
bg(track.color.dark.term, origin_nw(iter_south(move||0..h,
|_, _index|wh_exact(Some(track.width as u16), Some(2),
fg_bg(
ItemTheme::G[32].lightest.term,
ItemTheme::G[32].dark.term,
origin_nw(format!(" · {}", "--"))
)
)))
)
).draw(to);
)))));
todo!()
})
)
}

View file

@ -404,20 +404,14 @@ pub fn view_transport (
/// let _ = tek::view_status(None, x.clone(), x.clone(), x.clone());
/// let _ = tek::view_status(Some("".into()), x.clone(), x.clone(), x.clone());
/// ```
pub fn view_status (
sel: Option<Arc<str>>,
sr: Arc<RwLock<String>>,
buf: Arc<RwLock<String>>,
lat: Arc<RwLock<String>>,
) -> impl Draw<Tui> {
pub fn view_status (sel: Option<Arc<str>>, sr: &str, buf: &str, lat: &str) -> impl Draw<Tui> {
let theme = ItemTheme::G[96];
let sr = field_h(theme, "SR", sr);
let buf = field_h(theme, "Buf", buf);
let lat = field_h(theme, "Lat", lat);
bg(Black, east!(above(
wh_full(origin_w(sel.map(|sel|field_h(theme, "Selected", sel)))),
wh_full(origin_e(east!(
field_h(theme, "SR", sr),
field_h(theme, "Buf", buf),
field_h(theme, "Lat", lat),
)))
wh_full(origin_e(east!(sr, buf, lat))),
)))
}
@ -466,24 +460,25 @@ pub fn view_wrap (bg: Color, fg: Color, content: impl Draw<Tui>) -> impl Draw<Tu
/// let _ = tek::view_meters(&[0.0, 0.0]);
/// ```
pub fn view_meter <'a> (label: &'a str, value: f32) -> impl Draw<Tui> + 'a {
south!(
field_h(ItemTheme::G[128], label, format!("{:>+9.3}", value)),
wh_exact(if value >= 0.0 { &"13" }
else if value >= -1.0 { &"12" }
else if value >= -2.0 { &"11" }
else if value >= -3.0 { &"10" }
else if value >= -4.0 { &"9" }
else if value >= -6.0 { &"8" }
else if value >= -9.0 { &"7" }
else if value >= -12.0 { &"6" }
else if value >= -15.0 { &"5" }
else if value >= -20.0 { &"4" }
else if value >= -25.0 { &"3" }
else if value >= -30.0 { &"2" }
else if value >= -40.0 { &"1" }
else { 0 }, 1, bg(if value >= 0.0 { Red }
else if value >= -3.0 { Yellow }
else { Green }, ())))
let f = field_h(ItemTheme::G[128], label, format!("{:>+9.3}", value));
let w = if value >= 0.0 { 13 }
else if value >= -1.0 { 12 }
else if value >= -2.0 { 11 }
else if value >= -3.0 { 10 }
else if value >= -4.0 { 9 }
else if value >= -6.0 { 8 }
else if value >= -9.0 { 7 }
else if value >= -12.0 { 6 }
else if value >= -15.0 { 5 }
else if value >= -20.0 { 4 }
else if value >= -25.0 { 3 }
else if value >= -30.0 { 2 }
else if value >= -40.0 { 1 }
else { 0 };
let c = if value >= 0.0 { Red }
else if value >= -3.0 { Yellow }
else { Green };
south!(f, wh_exact(Some(w), Some(1), bg(c, ())))
}
pub fn view_meters (values: &[f32;2]) -> impl Draw<Tui> + use<'_> {