wip: preparing to run groovebox from edn

This commit is contained in:
🪞👃🪞 2025-01-05 17:10:57 +01:00
parent ce4574ed78
commit a6efde40f8
5 changed files with 43 additions and 28 deletions

View file

@ -61,11 +61,11 @@ impl Groovebox {
has_clock!(|self: Groovebox|self.player.clock());
impl EdnViewData<Tui> for Groovebox {
fn get_bool (&self, item: &str) -> bool { todo!() }
fn get_unit (&self, item: &str) -> u16 {
impl EdnViewData<Tui> for &Groovebox {
fn get_bool (&self, item: EdnItem<&str>) -> bool { todo!() }
fn get_unit (&self, item: EdnItem<&str>) -> u16 {
use EdnItem::*;
match item {
match item.to_str() {
":sample-h" => if self.compact { 0 } else { 5 },
":samples-w" => if self.compact { 4 } else { 11 },
":samples-y" => if self.compact { 1 } else { 0 },
@ -76,9 +76,9 @@ impl EdnViewData<Tui> for Groovebox {
_ => 0
}
}
fn get_content <'a> (&'a self, item: &str) -> RenderBox<'a, Tui> {
fn get_content <'a> (&'a self, item: EdnItem<&str>) -> RenderBox<'a, Tui> {
use EdnItem::*;
match item {
match item.to_str() {
":input-meter-l" => Box::new(Meter("L/", self.sampler.input_meter[0])),
":input-meter-r" => Box::new(Meter("R/", self.sampler.input_meter[1])),

View file

@ -1,12 +1,16 @@
(sized
(bsp/s (fill/x (fixed/y 2 (lay
(bsp/s
(fill/x (fixed/y 2 (lay
(align/w :input-meter-l)
(align/e :input-meter-r)
(align/x :transport))))
(bsp/n (row :clip-play :clip-next :clip-edit :edit-stat)
(bsp/n (max/y :sample-h (fill/xy :sample-view))
(bsp/n (align/w (fixed/y 1 :sample-stat))
(bsp/n (fixed/x :pool-w :pool-view)
(fill/xy (bsp/e
(fixed/x :samples-w (push/y :samples-y :samples-view))
:midi-view))))))))
(bsp/n
(row :clip-play :clip-next :clip-edit :edit-stat)
(bsp/n
(max/y :sample-h (fill/xy :sample-view))
(bsp/n
(align/w (fixed/y 1 :sample-stat))
(bsp/n
(fixed/x :pool-w :pool-view)
(fill/xy (bsp/e
(fixed/x :samples-w (push/y :samples-y :samples-view))
:midi-view)))))))

View file

@ -4,6 +4,14 @@ use std::marker::ConstParamTy;
use tek_engine::Render;
use EdnItem::*;
const EDN: &'static str = include_str!("groovebox.edn");
//impl Content<Tui> for Groovebox {
//fn content (&self) -> impl Render<Tui> {
//self.size.of(EdnView::new(self, EDN).expect("failed to build view"))
//}
//}
render!(Tui: (self: Groovebox) => self.size.of(
Bsp::s(self.toolbar_view(),
Bsp::n(self.selector_view(),