wip: more edn rendering setup

This commit is contained in:
🪞👃🪞 2025-01-05 04:48:01 +01:00
parent 174a7ee614
commit f1b3fc0040
10 changed files with 85 additions and 47 deletions

View file

@ -1 +1 @@
:test
:hello

View file

@ -1,8 +1,20 @@
use tek_edn::*;
use tek_edn::{*, tek_layout::{*, tek_engine::{*, tui::{*, TuiRun}}}};
use std::sync::{Arc, RwLock};
const SOURCE: &'static str = include_str!("edn01.edn");
const EDN: &'static str = include_str!("edn01.edn");
fn main () {
Tui::run(Arc::new(RwLock::new(Demo::new())))?;
fn main () -> Usually<()> {
let state = Arc::new(RwLock::new(Example));
Tui::new().unwrap().run(&state)?;
Ok(())
}
pub struct Example;
impl EdnLayout<Tui> for Example {
fn get_content <'a> (&'a self, sym: &'a str) -> Box<EdnRender<'a, Tui>> {
Box::new(Thunk::new(move||if sym == ":hello" { "Hello world!" } else { "" }))
}
}
impl Handle<Tui> for Example {}

View file

@ -1,12 +1 @@
(sized
(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/s :hello :world)

View file

@ -1,8 +1,20 @@
use tek_edn::*;
use tek_edn::{*, tek_layout::{*, tek_engine::{*, tui::{*, TuiRun}}}};
use std::sync::{Arc, RwLock};
const SOURCE: &'static str = include_str!("edn02.edn");
const EDN: &'static str = include_str!("edn02.edn");
fn main () {
Tui::run(Arc::new(RwLock::new(Demo::new())))?;
fn main () -> Usually<()> {
let state = Arc::new(RwLock::new(Example));
Tui::new().unwrap().run(&state)?;
Ok(())
}
pub struct Example;
impl EdnLayout<Tui> for Example {
fn get_content <'a> (&'a self, sym: &'a str) -> Box<EdnRender<'a, Tui>> {
Box::new(Thunk::new(move||if sym == ":hello" { "Hello world!" } else { "" }))
}
}
impl Handle<Tui> for Example {}