arranger: almost look like somethin now

This commit is contained in:
🪞👃🪞 2025-05-17 16:23:13 +03:00
parent ef6aa9ab07
commit 701ea3fc27
5 changed files with 97 additions and 76 deletions

View file

@ -14,12 +14,45 @@ impl App {
pub fn view_nil (&self) -> impl Content<TuiOut> + use<'_> {
"nil"
}
pub fn view_status_h2 (&self) -> impl Content<TuiOut> + use<'_> {
self.update_clock();
let theme = self.color;
let playing = self.clock().is_rolling();
Fixed::y(2, Stack::east(move|add: &mut dyn FnMut(&dyn Render<TuiOut>)|{
add(&Fixed::x(5, Tui::bg(if playing { Rgb(0, 128, 0) } else { Rgb(128, 64, 0) },
Either::new(false, // TODO
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(" ▗▄▖ ", " ▝▀▘ ",))))
)
)
)));
{
let cache = self.view_cache.read().unwrap();
add(&Align::w(Bsp::s(
FieldH(theme, "Beat", cache.beat.view.clone()),
FieldH(theme, "Time", cache.time.view.clone()),
)));
add(&Align::w(Bsp::s(
Fill::x(Align::w(FieldH(theme, "BPM", cache.bpm.view.clone()))),
Fill::x(Align::w(FieldH(theme, "SR ", cache.sr.view.clone()))),
)));
add(&FieldH(theme, "Buf",
Bsp::e(cache.buf.view.clone(), Bsp::e(" = ", cache.lat.view.clone()))
));
}
}))
}
pub fn view_status_v (&self) -> impl Content<TuiOut> + use<'_> {
self.update_clock();
let cache = self.view_cache.read().unwrap();
let theme = self.color;
let playing = self.clock().is_rolling();
Tui::bg(theme.darkest.rgb, Fixed::xy(20, 6, Outer(true, Style::default().fg(Tui::g(96))).enclose(
Tui::bg(theme.darker.rgb, Fixed::xy(20, 5, Outer(true, Style::default().fg(Tui::g(96))).enclose(
col!(
Fill::x(Align::w(Bsp::e(
Align::w(Tui::bg(if playing { Rgb(0, 128, 0) } else { Rgb(128, 64, 0) },
@ -41,8 +74,7 @@ impl App {
))),
Fill::x(Align::w(FieldH(theme, "BPM", cache.bpm.view.clone()))),
Fill::x(Align::w(FieldH(theme, "SR ", cache.sr.view.clone()))),
Fill::x(Align::w(FieldH(theme, "Buf", cache.buf.view.clone()))),
Fill::x(Align::w(FieldH(theme, "Lat", cache.lat.view.clone()))),
Fill::x(Align::w(FieldH(theme, "Buf", Bsp::e(cache.buf.view.clone(), Bsp::e(" = ", cache.lat.view.clone()))))),
))))
}
pub fn view_status (&self) -> impl Content<TuiOut> + use<'_> {
@ -76,11 +108,35 @@ impl App {
pub fn view_audio_outs_status (&self) -> impl Content<TuiOut> + use<'_> {
self.project.view_audio_outs_status(self.color)
}
pub fn view_arranger_scenes_names (&self) -> impl Content<TuiOut> + use<'_> {
self.project.view_scenes_names()
pub fn view_arranger_scenes (&self) -> impl Content<TuiOut> + use<'_> {
Bsp::e(
Fixed::x(20, Align::nw(self.project.view_scenes_names())),
Bsp::w(self.view_pool(), self.project.view_scenes_clips()),
)
}
pub fn view_arranger_scenes_clips (&self) -> impl Content<TuiOut> + use<'_> {
self.project.view_scenes_clips()
pub fn view_arranger_inputs <'a> (&'a self) -> impl Content<TuiOut> + use<'a> {
Fixed::y(3, Bsp::e(
Fixed::x(20, Tui::bg(self.color.darker.rgb, Fill::xy(""))),
self.project.view_track_inputs(self.color)
))
}
pub fn view_arranger_outputs <'a> (&'a self) -> impl Content<TuiOut> + use<'a> {
Fixed::y(3, Bsp::e(
Fixed::x(20, Tui::bg(self.color.darker.rgb, Fill::xy(""))),
self.project.view_track_outputs(self.color)
))
}
pub fn view_arranger_devices <'a> (&'a self) -> impl Content<TuiOut> + use<'a> {
Fixed::y(3, Bsp::e(
Fixed::x(20, Tui::bg(self.color.darker.rgb, Fill::xy(""))),
self.project.view_track_devices(self.color)
))
}
pub fn view_arranger_tracks <'a> (&'a self) -> impl Content<TuiOut> + use<'a> {
Fixed::y(2, Bsp::e(
Fixed::x(20, Tui::bg(self.color.darker.rgb, Fill::xy(""))),
self.project.view_track_names(self.color)
))
}
pub fn view_arranger_track_names (&self) -> impl Content<TuiOut> + use<'_> {
self.project.view_track_names(self.color)
@ -103,8 +159,7 @@ impl App {
Fixed::x(20, Tui::bg(self.color.darkest.rgb,
col!(Tui::bold(true, "Devices"), "[d] Select", "[D] Add"))),
Fixed::y(max_devices + 1, Tui::bg(self.color.darker.rgb, Align::w(Fill::x(Map::new(
||self.project.tracks_with_sizes(&self.project.selection, None)
.skip(self.project.track_scroll),
||self.project.tracks_with_sizes_scrolled(),
move|(index, track, x1, x2): (usize, &'a Track, usize, usize), _|
Push::x(x2 as u16, Fixed::xy(track.width as u16, max_devices + 1,
Align::nw(Map::south(1, ||track.devices.iter(),
@ -248,17 +303,6 @@ impl ScenesView for App {
}
}
pub(crate) fn heading <'a> (
key: &'a str,
label: &'a str,
count: usize,
content: impl Content<TuiOut> + Send + Sync + 'a,
editing: bool,
) -> impl Content<TuiOut> + 'a {
let count = format!("{count}");
Fill::xy(Align::w(Bsp::s(Fill::x(Align::w(button_3(key, label, count, editing))), content)))
}
/// Clear a pre-allocated buffer, then write into it.
#[macro_export] macro_rules! rewrite {
($buf:ident, $($rest:tt)*) => { |$buf,_,_|{ $buf.clear(); write!($buf, $($rest)*) } }