clone EdnItem

This commit is contained in:
🪞👃🪞 2025-01-05 22:52:35 +01:00
parent 400fd9b6e9
commit 3dd8a7bc0d
8 changed files with 190 additions and 169 deletions

View file

@ -8,10 +8,11 @@ const EDN: &'static str = include_str!("groovebox.edn");
impl Content<TuiOut> for Groovebox {
fn content (&self) -> impl Render<TuiOut> {
self.size.of(EdnView::new(self, EDN))
self.size.of(EdnView::from_source(self, EDN))
}
}
// this works:
//render!(TuiOut: (self: Groovebox) => self.size.of(
//Bsp::s(self.toolbar_view(),
//Bsp::n(self.selector_view(),
@ -59,6 +60,54 @@ impl Groovebox {
}
}
///// Status bar for sequencer app
//#[derive(Clone)]
//pub struct GrooveboxStatus {
//pub(crate) width: usize,
//pub(crate) cpu: Option<String>,
//pub(crate) size: String,
//pub(crate) playing: bool,
//}
//from!(|state: &Groovebox|GrooveboxStatus = {
//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}%")),
//size: format!("{}x{}│", width, state.size.h()),
//}
//});
//render!(TuiOut: (self: GrooveboxStatus) => Fixed::y(2, lay!(
//Self::help(),
//Fill::xy(Align::se(Tui::fg_bg(TuiTheme::orange(), TuiTheme::g(25), self.stats()))),
//)));
//impl GrooveboxStatus {
//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"),
//double(("▲▼▶◀", "cursor"), ("Ctrl", "scroll"), ),
//double(("a", "append"), ("s", "set note"),),
//double((",.", "length"), ("<>", "triplet"), ),
//double(("[]", "phrase"), ("{}", "order"), ),
//double(("q", "enqueue"), ("e", "edit"), ),
//double(("c", "color"), ("", ""),),
//))
//}
//fn stats (&self) -> impl Content<TuiOut> + use<'_> {
//row!(&self.cpu, &self.size)
//}
//}
//render!(TuiOut: (self: Groovebox) => self.size.of(
//Bsp::s(self.toolbar_view(),
//Bsp::n(self.selector_view(),