wip: scrollable arranger

This commit is contained in:
🪞👃🪞 2025-02-09 17:15:15 +01:00
parent 53f443f4bd
commit 1924d51323
3 changed files with 18 additions and 11 deletions

View file

@ -145,5 +145,7 @@ fn heading <'a> (
let _ = heading("", "", 0, "", true);
let _ = heading("", "", 0, "", false);
let _ = wrap(Reset, Reset, "");
let _ = row(0, 0, 0, "", "", "");
let _ = row_top(0, 0, 0, "", "", "");
}
}

View file

@ -25,7 +25,7 @@ impl Tek {
/// as the rendering logic of [redraw_arranger] is only invoked on
/// changes to the content.
pub fn view_arranger (&self) -> impl Content<TuiOut> + use<'_> {
ThunkRender::new(move|to: &mut TuiOut|{
Fill::xy(ThunkRender::new(move|to: &mut TuiOut|{
let [x0, y0, w, h] = to.area().xywh();
let source = self.arranger.read().unwrap();
for (source_x, target_x) in (x0..x0+w).enumerate() {
@ -33,15 +33,14 @@ impl Tek {
let source_pos = Position::from((source_x as u16, source_y as u16));
let target_pos = Position::from((target_x, target_y));
if let Some(target) = to.buffer.cell_mut(target_pos) {
//target.set_bg(Color::Red);
if let Some(source) = source.cell(source_pos) {
*target = source.clone();
}
}
}
}
// TODO
()
})
}))
}
/// Display the current scene scroll state.
@ -308,17 +307,12 @@ fn io_conns <'a, T: PortsSizes<'a>> (
#[cfg(test)] mod test {
use super::*;
#[test] fn test_view_arranger () {
let app = Tek::default();
let mut app = Tek::default();
app.editor = Some(Default::default());
let _ = io_ports(Reset, Reset, ||app.inputs_sizes());
let _ = io_conns(Reset, Reset, ||app.outputs_sizes());
let _ = app.per_track(|_, _|());
let _ = app.per_track_top(|_, _|());
let _ = app.redraw_arranger();
//let _ = app.view_editor();
//let _ = app.view_pool();
//let _ = app.row(0, 0, "", "", "");
//let _ = app.row_top(0, 0, "", "", "");
//let _ = app.io_ports(Reset, Reset, ||[].iter());
//let _ = app.io_conns(Reset, Reset, ||[].iter());
}
}

View file

@ -71,3 +71,14 @@ fn button_play_pause (playing: bool) -> impl Content<TuiOut> {
Tui::fg(Rgb(0, 255, 0), Bsp::s(" 🭍🭑🬽 ", " 🭞🭜🭘 ",)),
Tui::fg(Rgb(255, 128, 0), Bsp::s(" ▗▄▖ ", " ▝▀▘ ",)))))))
}
#[cfg(test)] mod test {
use super::*;
#[test] fn test_view_clock () {
let _ = button_play_pause(true);
let mut app = Tek::default();
let _ = app.view_transport();
let _ = app.view_status();
let _ = app.update_clock();
}
}