diff --git a/Justfile b/Justfile index dd5824e4..94551690 100644 --- a/Justfile +++ b/Justfile @@ -2,7 +2,7 @@ export RUSTFLAGS := "--cfg procmacro2_semver_exempt -Zmacro-backtrace -Clink-arg export RUST_BACKTRACE := "1" default: - just -l + @just -l cloc: for src in {cli,edn/src,input/src,jack/src,midi/src,output/src,plugin/src,sampler/src,tek/src,time/src,tui/src}; do echo; echo $src; cloc --quiet $src; done diff --git a/app/tek_deps.rs b/app/tek_deps.rs index f497466f..b4af1e3f 100644 --- a/app/tek_deps.rs +++ b/app/tek_deps.rs @@ -1,7 +1,8 @@ pub(crate) use ::{ - tek_device::*, + tek_device::{*, tek_engine::*}, tengri::{ Usually, Perhaps, Has, MaybeHas, has, maybe_has, impl_debug, from, + wrap_inc, wrap_dec, dsl::*, input::*, output::*, diff --git a/app/tek_view.rs b/app/tek_view.rs index 7c1fce25..9198ca0c 100644 --- a/app/tek_view.rs +++ b/app/tek_view.rs @@ -51,7 +51,7 @@ impl View for App { let selected = selected; Some(Fill::XY(Thunk::new(move|to: &mut TuiOut|{ for (index, MenuItem(item, _)) in items.0.iter().enumerate() { - to.place(&Push::y((2 * index) as u16, + to.place(&Push::Y((2 * index) as u16, Tui::fg_bg( if *selected == index { Rgb(240,200,180) } else { Rgb(200, 200, 200) }, if *selected == index { Rgb(80, 80, 50) } else { Rgb(30, 30, 30) }, @@ -67,7 +67,7 @@ impl View for App { Some(":templates") => to.place(&{ let modes = self.config.modes.clone(); let height = (modes.read().unwrap().len() * 2) as u16; - Fixed::Y(height, Min::x(30, Thunk::new(move |to: &mut TuiOut|{ + Fixed::Y(height, Min::X(30, Thunk::new(move |to: &mut TuiOut|{ for (index, (id, profile)) in modes.read().unwrap().iter().enumerate() { let bg = if index == 0 { Rgb(70,70,70) } else { Rgb(50,50,50) }; let name = profile.name.get(0).map(|x|x.as_ref()).unwrap_or(""); @@ -77,21 +77,21 @@ impl View for App { let field_name = Fill::X(Align::w(Tui::fg(fg1, name))); let field_id = Fill::X(Align::e(Tui::fg(fg2, id))); let field_info = Fill::X(Align::w(info)); - to.place(&Push::y((2 * index) as u16, + to.place(&Push::Y((2 * index) as u16, Fixed::Y(2, Fill::X(Tui::bg(bg, Bsp::s( Bsp::a(field_name, field_id), field_info)))))); } }))) }), - Some(":sessions") => to.place(&Fixed::Y(6, Min::x(30, Thunk::new(|to: &mut TuiOut|{ + Some(":sessions") => to.place(&Fixed::Y(6, Min::X(30, Thunk::new(|to: &mut TuiOut|{ let fg = Rgb(224, 192, 128); for (index, name) in ["session1", "session2", "session3"].iter().enumerate() { let bg = if index == 0 { Rgb(50,50,50) } else { Rgb(40,40,40) }; - to.place(&Push::y((2 * index) as u16, + to.place(&Push::Y((2 * index) as u16, &Fixed::Y(2, Fill::X(Tui::bg(bg, Align::w(Tui::fg(fg, name))))))); } })))), - Some(":browse/title") => to.place(&Fill::X(Align::w(FieldV(Default::default(), + Some(":browse/title") => to.place(&Fill::X(Align::w(FieldV(ItemColor::default(), match self.dialog.browser_target().unwrap() { BrowseTarget::SaveProject => "Save project:", BrowseTarget::LoadProject => "Load project:", @@ -99,7 +99,7 @@ impl View for App { BrowseTarget::ExportSample(_) => "Export sample:", BrowseTarget::ImportClip(_) => "Import clip:", BrowseTarget::ExportClip(_) => "Export clip:", - }, Shrink::x(3, Fixed::Y(1, Tui::fg(Tui::g(96), RepeatH("🭻")))))))), + }, Shrink::X(3, Fixed::Y(1, Tui::fg(Tui::g(96), RepeatH("🭻")))))))), Some(":device") => { let selected = self.dialog.device_kind().unwrap(); to.place(&Bsp::s(Tui::bold(true, "Add device"), Map::south(1, @@ -149,8 +149,8 @@ fn view_logo () -> impl Content { //.filter_map(|x|if let Value::Exp(_, iter)=x.value{ Some(iter) } else { None }) //.skip(offset) //.take(20), - //|mut b,i|Fixed::x(60, Align::w(Bsp::e("(", Bsp::e( - //b.next().map(|t|Fixed::x(16, Align::w(Tui::fg(Rgb(64,224,0), format!("{}", t.value))))), + //|mut b,i|Fixed::X(60, Align::w(Bsp::e("(", Bsp::e( + //b.next().map(|t|Fixed::X(16, Align::w(Tui::fg(Rgb(64,224,0), format!("{}", t.value))))), //Bsp::e(" ", Align::w(format!("{}", b.0.0.trim()))))))))))), //Dialog::Browse(BrowseTarget::Load, browser) => { @@ -158,7 +158,7 @@ fn view_logo () -> impl Content { ////Bsp::s( ////Fill::X(Align::w(Margin::XY(1, 1, Bsp::e( ////Tui::bold(true, " Load project: "), - ////Shrink::x(3, Fixed::Y(1, RepeatH("🭻"))))))), + ////Shrink::X(3, Fixed::Y(1, RepeatH("🭻"))))))), ////Outer(true, Style::default().fg(Tui::g(96))) ////.enclose(Fill::XY(browser))) //}, @@ -167,7 +167,7 @@ fn view_logo () -> impl Content { ////Bsp::s( ////Fill::X(Align::w(Margin::XY(1, 1, Bsp::e( ////Tui::bold(true, " Export: "), - ////Shrink::x(3, Fixed::Y(1, RepeatH("🭻"))))))), + ////Shrink::X(3, Fixed::Y(1, RepeatH("🭻"))))))), ////Outer(true, Style::default().fg(Tui::g(96))) ////.enclose(Fill::XY(browser))) //}, @@ -176,7 +176,7 @@ fn view_logo () -> impl Content { ////Bsp::s( ////Fill::X(Align::w(Margin::XY(1, 1, Bsp::e( ////Tui::bold(true, " Import: "), - ////Shrink::x(3, Fixed::Y(1, RepeatH("🭻"))))))), + ////Shrink::X(3, Fixed::Y(1, RepeatH("🭻"))))))), ////Outer(true, Style::default().fg(Tui::g(96))) ////.enclose(Fill::XY(browser))) //}, @@ -196,13 +196,13 @@ fn view_logo () -> impl Content { //let hist_len = self.history.len(); //let hist_last = self.history.last(); //Fixed::Y(2, Stack::east(move|add: &mut dyn FnMut(&dyn Draw)|{ - //add(&Fixed::x(5, Tui::bg(if playing { Rgb(0, 128, 0) } else { Rgb(128, 64, 0) }, + //add(&Fixed::X(5, Tui::bg(if playing { Rgb(0, 128, 0) } else { Rgb(128, 64, 0) }, //Either::new(false, // TODO - //Thunk::new(move||Fixed::x(9, Either::new(playing, + //Thunk::new(move||Fixed::X(9, Either::new(playing, //Tui::fg(Rgb(0, 255, 0), " PLAYING "), //Tui::fg(Rgb(255, 128, 0), " STOPPED "))) //), - //Thunk::new(move||Fixed::x(5, Either::new(playing, + //Thunk::new(move||Fixed::X(5, Either::new(playing, //Tui::fg(Rgb(0, 255, 0), Bsp::s(" 🭍🭑🬽 ", " 🭞🭜🭘 ",)), //Tui::fg(Rgb(255, 128, 0), Bsp::s(" ▗▄▖ ", " ▝▀▘ ",)))) //) @@ -211,15 +211,15 @@ fn view_logo () -> impl Content { //add(&" "); //{ //let cache = cache.read().unwrap(); - //add(&Fixed::x(15, Align::w(Bsp::s( + //add(&Fixed::X(15, Align::w(Bsp::s( //FieldH(theme, "Beat", cache.beat.view.clone()), //FieldH(theme, "Time", cache.time.view.clone()), //)))); - //add(&Fixed::x(13, Align::w(Bsp::s( + //add(&Fixed::X(13, Align::w(Bsp::s( //Fill::X(Align::w(FieldH(theme, "BPM", cache.bpm.view.clone()))), //Fill::X(Align::w(FieldH(theme, "SR ", cache.sr.view.clone()))), //)))); - //add(&Fixed::x(12, Align::w(Bsp::s( + //add(&Fixed::X(12, Align::w(Bsp::s( //Fill::X(Align::w(FieldH(theme, "Buf", cache.buf.view.clone()))), //Fill::X(Align::w(FieldH(theme, "Lat", cache.lat.view.clone()))), //)))); @@ -246,11 +246,11 @@ fn view_logo () -> impl Content { //Fill::X(Align::w(Bsp::e( //Align::w(Tui::bg(if playing { Rgb(0, 128, 0) } else { Rgb(128, 64, 0) }, //Either::new(false, // TODO - //Thunk::new(move||Fixed::x(9, Either::new(playing, + //Thunk::new(move||Fixed::X(9, Either::new(playing, //Tui::fg(Rgb(0, 255, 0), " PLAYING "), //Tui::fg(Rgb(255, 128, 0), " STOPPED "))) //), - //Thunk::new(move||Fixed::x(5, Either::new(playing, + //Thunk::new(move||Fixed::X(5, Either::new(playing, //Tui::fg(Rgb(0, 255, 0), Bsp::s(" 🭍🭑🬽 ", " 🭞🭜🭘 ",)), //Tui::fg(Rgb(255, 128, 0), Bsp::s(" ▗▄▖ ", " ▝▀▘ ",)))) //) @@ -286,7 +286,7 @@ fn view_logo () -> impl Content { //Fill::XY(Tui::bg(bg.rgb, self.editor())) //} //pub fn view_editor_status (&self) -> impl Content + use<'_> { - //self.editor().map(|e|Fixed::x(20, Outer(true, Style::default().fg(Tui::g(96))).enclose( + //self.editor().map(|e|Fixed::X(20, Outer(true, Style::default().fg(Tui::g(96))).enclose( //Fill::Y(Align::n(Bsp::s(e.clip_status(), e.edit_status())))))) //} //pub fn view_midi_ins_status (&self) -> impl Content + use<'_> { @@ -303,7 +303,7 @@ fn view_logo () -> impl Content { //} //pub fn view_scenes (&self) -> impl Content + use<'_> { //Bsp::e( - //Fixed::x(20, Align::nw(self.project.view_scenes_names())), + //Fixed::X(20, Align::nw(self.project.view_scenes_names())), //self.project.view_scenes_clips(), //) //} @@ -327,7 +327,7 @@ fn view_logo () -> impl Content { //Fixed::Y(2, self.project.view_track_names(self.color)) //} //pub fn view_pool (&self) -> impl Content + use<'_> { - //Fixed::x(20, Bsp::s( + //Fixed::X(20, Bsp::s( //Fill::X(Align::w(FieldH(self.color, "Clip pool:", ""))), //Fill::Y(Align::n(Tui::bg(Rgb(0, 0, 0), Outer(true, Style::default().fg(Tui::g(96))) //.enclose(PoolView(&self.pool))))))) diff --git a/device/device.rs b/device/device.rs index 4a7c6987..0c808131 100644 --- a/device/device.rs +++ b/device/device.rs @@ -1,5 +1,7 @@ #![feature(trait_alias)] +pub use tek_engine; + pub(crate) use ::{ tek_engine::*, tek_engine::tengri::{