add arranger cell bgs and partially update Justfile

This commit is contained in:
🪞👃🪞 2025-01-08 16:31:50 +01:00
parent 7bb3f6224d
commit 60258649fb
3 changed files with 39 additions and 73 deletions

View file

@ -98,69 +98,3 @@ has_clock!(|self: Arranger|&self.clock);
has_phrases!(|self: Arranger|self.pool.phrases);
has_editor!(|self: Arranger|self.editor);
handle!(TuiIn: |self: Arranger, input|ArrangerCommand::execute_with_state(self, input.event()));
//render!(TuiOut: (self: Arranger) => {
//let pool_w = if self.pool.visible { self.splits[1] } else { 0 };
//let color = self.color;
//let layout = Bsp::a(Fill::xy(ArrangerStatus::from(self)),
//Bsp::n(Fixed::x(pool_w, PoolView(self.pool.visible, &self.pool)),
//Bsp::n(TransportView::new(true, &self.clock),
//Bsp::s(Fixed::y(1, MidiEditStatus(&self.editor)),
//Bsp::n(Fill::x(Fixed::y(20,
//Bsp::a(Fill::xy(Tui::bg(color.darkest.rgb, "background")),
//Bsp::a(
//Fill::xy(Outer(Style::default().fg(color.dark.rgb).bg(color.darkest.rgb))),
//Self::render_mode(self))))), Fill::y(&"fixme: self.editor"))))));
//self.size.of(layout)
//});
///// Status bar for arranger app
//#[derive(Clone)]
//pub struct ArrangerStatus {
//pub(crate) width: usize,
//pub(crate) cpu: Option<Arc<str>>,
//pub(crate) size: Arc<str>,
//pub(crate) playing: bool,
//}
//from!(|state:&Arranger|ArrangerStatus = {
//let samples = state.clock.chunk.load(Relaxed);
//let rate = state.clock.timebase.sr.get();
//let buffer = samples as f64 / rate;
//let width = state.size.w();
//Self {
//width,
//playing: state.clock.is_rolling(),
//cpu: state.perf.percentage().map(|cpu|format!("│{cpu:.01}%").into()),
//size: format!("{}x{}│", width, state.size.h()).into(),
//}
//});
//render!(TuiOut: (self: ArrangerStatus) => Fixed::y(2, lay!(
//Self::help(),
//Fill::xy(Align::se(Tui::fg_bg(TuiTheme::orange(), TuiTheme::g(25), self.stats()))),
//)));
//impl ArrangerStatus {
//fn help () -> impl Content<TuiOut> {
//let single = |binding, command|row!(" ", col!(
//Tui::fg(TuiTheme::yellow(), binding),
//command
//));
//let double = |(b1, c1), (b2, c2)|col!(
//row!(" ", Tui::fg(TuiTheme::yellow(), b1), " ", c1,),
//row!(" ", Tui::fg(TuiTheme::yellow(), b2), " ", c2,),
//);
//Tui::fg_bg(TuiTheme::g(255), TuiTheme::g(50), row!(
//single("SPACE", "play/pause"),
//single(" Ctrl", " scroll"),
//single(" ▲▼▶◀", " cell"),
//double(("p", "put"), ("g", "get")),
//double(("q", "enqueue"), ("e", "edit")),
//single(" wsad", " note"),
//double(("a", "append"), ("s", "set"),),
//double((",.", "length"), ("<>", "triplet"),),
//double(("[]", "phrase"), ("{}", "order"),),
//))
//}
//fn stats (&self) -> impl Content<TuiOut> + use<'_> {
//row!(&self.cpu, &self.size)
//}
//}

View file

@ -53,6 +53,16 @@ impl Arranger {
)
}
fn phat_cell_3 <T: Content<TuiOut>> (top: Color, middle: Color, bottom: Color, field: T) -> impl Content<TuiOut> {
Bsp::s(
Self::phat_lo(middle, top),
Bsp::n(
Self::phat_hi(bottom, middle),
Fixed::y(1, Fill::x(Tui::bg(middle, field))),
)
)
}
fn output_row_header <'a> (&'a self) -> BoxThunk<'a, TuiOut> {
(||Tui::bold(true, Tui::fg_bg(TuiTheme::g(0), TuiTheme::g(200), "[ ] Out 1: NI")).boxed()).into()
}
@ -145,7 +155,29 @@ impl Arranger {
}).into()
}
fn scene_row_cells <'a> (&'a self) -> BoxThunk<'a, TuiOut> {
(||Tui::bg(self.color.darkest.rgb, "").boxed()).into()
(move||Fixed::y(2, Map::new(||self.tracks_with_widths(), move|(_, track, x1, x2), i| {
let w = (x2 - x1) as u16;
let cell = Bsp::s("[Rec]", "[Mon]");
let color: ItemPalette = track.color().dark.into();
let last_color = Arc::new(RwLock::new(ItemPalette::from(Color::Rgb(0, 0, 0))));
map_east(x1 as u16, w, Fixed::x(w, Tui::bg(Color::Rgb(0,0,0), Fill::y(Map::new(
||self.scenes_with_heights(2),
move|(_, scene, y1, y2), i| {
let h = (y2 - y1) as u16;
let color = scene.color();
let name = format!("🭬{}", &scene.name);
//*last_color.write().unwrap() = color
map_south(y1 as u16, 2, Fill::x(Self::phat_cell_3(
TuiTheme::g(32).into(),
TuiTheme::g(32).into(),
TuiTheme::g(32).into(),
//Tui::fg(TuiTheme::g(64), " ⏺ ")
Tui::fg(TuiTheme::g(64), "")
)))
}
))).boxed()
))
})).boxed()).into()
}
pub fn tracks_with_widths (&self)