From 74b497cf3a37c9bb60d11fedda8a24844daa1378 Mon Sep 17 00:00:00 2001 From: unspeaker Date: Fri, 15 Aug 2025 21:24:31 +0300 Subject: [PATCH] wip: some namespace progress --- crates/app/app.rs | 64 +++++++++++----------- crates/device/src/arranger/arranger_api.rs | 2 +- crates/engine/src/lib.rs | 2 - deps/tengri | 2 +- 4 files changed, 35 insertions(+), 35 deletions(-) diff --git a/crates/app/app.rs b/crates/app/app.rs index b7be6127..42507a32 100644 --- a/crates/app/app.rs +++ b/crates/app/app.rs @@ -238,7 +238,7 @@ fn render_dsl <'t, S> (state: &'t S, src: &str) -> Box> })) } -dsl_exp!(|app: App, tail| -> Box> { +dsl_exp_ns!(|app: App| -> Box> { ("bold", value: bool, x: Box>) => Box::new(Tui::bold(value, x)), ("fg", color: Color, x: Box>) => Box::new(Tui::fg(color, x)), ("bg", color: Color, x: Box>) => Box::new(Tui::bg(color, x)), @@ -249,24 +249,26 @@ dsl_exp!(|app: App, tail| -> Box> { ("bsp/w", a: Box>, b: Box>) => Box::new(Bsp::w(a, b)), ("bsp/a", a: Box>, b: Box>) => Box::new(Bsp::a(a, b)), ("bsp/b", a: Box>, b: Box>) => Box::new(Bsp::b(a, b)), - ("align/n", x: Box>) => Box::new(Align::n(a, b)), - ("align/s", x: Box>) => Box::new(Align::s(a, b)), - ("align/e", x: Box>) => Box::new(Align::e(a, b)), - ("align/w", x: Box>) => Box::new(Align::w(a, b)), - ("align/x", x: Box>) => Box::new(Align::x(a, b)), - ("align/y", x: Box>) => Box::new(Align::y(a, b)), - ("align/c", x: Box>) => Box::new(Align::c(a, b)), + ("align/n", x: Box>) => Box::new(Align::n(x)), + ("align/s", x: Box>) => Box::new(Align::s(x)), + ("align/e", x: Box>) => Box::new(Align::e(x)), + ("align/w", x: Box>) => Box::new(Align::w(x)), + ("align/x", x: Box>) => Box::new(Align::x(x)), + ("align/y", x: Box>) => Box::new(Align::y(x)), + ("align/c", x: Box>) => Box::new(Align::c(x)), ("fill/x", x: Box>) => Box::new(Fill::x(x)), ("fill/y", x: Box>) => Box::new(Fill::y(x)), ("fill/xy", x: Box>) => Box::new(Fill::xy(x)), }); -dsl_exp!(|app: App, tail| -> Color { - ("rgb", r: u8, g: u8, b: u8) => Color::Rgb(r, g, b), - ("g", n: u8) => Color::Rgb(n. n. n), +dsl_exp_ns!(|app: App| -> Color { + ("g", n: u8) => + Color::Rgb(n, n, n), + ("rgb", r: u8, g: u8, b: u8) => + Color::Rgb(r, g, b), }); -dsl_sym!(|app: App| -> Box> { +dsl_sym_ns!(|app: App| -> Box> { ":view/menu" => app.view(stringify!((bg (rgb 0 0 0) (bsp/s :view/ports/outs (bsp/s (bg (rgb 33 33 33) (bold :true "tek 0.3.0-rc.0"))) @@ -577,24 +579,24 @@ handle!(TuiIn:|self: App, input|{ //None //}) }); -dsl_sym!(|app: App| -> isize { +dsl_sym_ns!(|app: App| -> isize { ":_isize_stub" => -1 }); -dsl_sym!(|app: App| -> ItemTheme { +dsl_sym_ns!(|app: App| -> ItemTheme { ":_theme_stub" => Default::default() }); -dsl_sym!(|app: App| -> u16{ +dsl_sym_ns!(|app: App| -> u16{ ":w/sidebar" => app.project.w_sidebar(app.editor().is_some()), ":h/sample-detail" => 6.max(app.height() as u16 * 3 / 9), }); -dsl_sym!(|app: App| -> usize { +dsl_sym_ns!(|app: App| -> usize { ":scene-count" => app.scenes().len(), ":track-count" => app.tracks().len(), ":device-kind" => app.dialog.device_kind().unwrap_or(0), ":device-kind/next" => app.dialog.device_kind_next().unwrap_or(0), ":device-kind/prev" => app.dialog.device_kind_prev().unwrap_or(0), }); -dsl_sym!(|app: App| -> bool { +dsl_sym_ns!(|app: App| -> bool { ":focused/editor" => app.project.editor.is_some(), ":focused/dialog" => !matches!(app.dialog, Dialog::None), ":focused/message" => matches!(app.dialog, Dialog::Message(..)), @@ -609,7 +611,7 @@ dsl_sym!(|app: App| -> bool { ":focused/pool/rename" => matches!(app.pool.mode, Some(PoolMode::Rename(..))), ":focused/pool/length" => matches!(app.pool.mode, Some(PoolMode::Length(..))), }); -dsl_sym!(|app: App| -> Dialog { +dsl_sym_ns!(|app: App| -> Dialog { ":dialog/none" => Dialog::None, ":dialog/options" => Dialog::Options, ":dialog/device" => Dialog::Device(0), @@ -624,7 +626,7 @@ dsl_sym!(|app: App| -> Dialog { ":dialog/import/sample" => Dialog::Browser(BrowserTarget::ImportSample(Default::default()), Browser::new(None).unwrap().into()), ":dialog/export/sample" => Dialog::Browser(BrowserTarget::ExportSample(Default::default()), Browser::new(None).unwrap().into()), }); -dsl_sym!(|app: App| -> Selection { +dsl_sym_ns!(|app: App| -> Selection { ":select/scene" => app.selection().select_scene(app.tracks().len()), ":select/scene/next" => app.selection().select_scene_next(app.scenes().len()), ":select/scene/prev" => app.selection().select_scene_prev(), @@ -632,14 +634,14 @@ dsl_sym!(|app: App| -> Selection { ":select/track/next" => app.selection().select_track_next(app.tracks().len()), ":select/track/prev" => app.selection().select_track_prev(), }); -dsl_sym!(|app: App| -> Option { +dsl_sym_ns!(|app: App| -> Option { ":editor/pitch" => Some((app.editor().as_ref().map(|e|e.get_note_pos()).unwrap() as u8).into()) }); -dsl_sym!(|app: App| -> Option { +dsl_sym_ns!(|app: App| -> Option { ":selected/scene" => app.selection().scene(), ":selected/track" => app.selection().track(), }); -dsl_sym!(|app: App| -> Option>> { +dsl_sym_ns!(|app: App| -> Option>> { ":selected/clip" => if let Selection::TrackClip { track, scene } = app.selection() { app.scenes()[*scene].clips[*track].clone() } else { @@ -649,9 +651,9 @@ dsl_sym!(|app: App| -> Option>> { #[derive(Debug)] pub enum AppCommand { } -dsl_exp!(|app: App| -> AppCommand { - ("stop-all") => app.project.stop_all(), - ("enqueue", clip?: Option>>) => todo!(), +dsl_exp_ns!(|app: App| -> AppCommand { + ("stop-all") => todo!(),//app.project.stop_all(), + ("enqueue", clip: Option>>) => todo!(), ("history", delta: isize) => todo!(), ("zoom", zoom: usize) => todo!(), ("select", selection: Selection) => todo!(), @@ -662,12 +664,12 @@ dsl_exp!(|app: App| -> AppCommand { ("pool" / command: PoolCommand) => todo!(), ("pool" / editor: MidiEditCommand) => todo!(), }); -dsl_exp!(|app: App| -> DialogCommand {}); -dsl_exp!(|app: App| -> ArrangementCommand {}); -dsl_exp!(|app: App| -> ClockCommand {}); -dsl_exp!(|app: App| -> SamplerCommand {}); -dsl_exp!(|app: App| -> PoolCommand {}); -dsl_exp!(|app: App| -> MidiEditCommand {}); +dsl_exp_ns!(|app: App| -> DialogCommand {}); +dsl_exp_ns!(|app: App| -> ArrangementCommand {}); +dsl_exp_ns!(|app: App| -> ClockCommand {}); +dsl_exp_ns!(|app: App| -> SamplerCommand {}); +dsl_exp_ns!(|app: App| -> PoolCommand {}); +dsl_exp_ns!(|app: App| -> MidiEditCommand {}); impl App { pub fn focused_editor (&self) -> bool { false diff --git a/crates/device/src/arranger/arranger_api.rs b/crates/device/src/arranger/arranger_api.rs index 1df4dc13..c6576ac2 100644 --- a/crates/device/src/arranger/arranger_api.rs +++ b/crates/device/src/arranger/arranger_api.rs @@ -96,7 +96,7 @@ impl ArrangementCommand { let index = arranger.track_add(None, None, &[], &[])?.0; *arranger.selection_mut() = match arranger.selection() { Selection::Track(_) => Selection::Track(index), - Selection::TrackClip { track, scene } => Selection::TrackClip { + Selection::TrackClip { track: _, scene } => Selection::TrackClip { track: index, scene: *scene }, _ => *arranger.selection() diff --git a/crates/engine/src/lib.rs b/crates/engine/src/lib.rs index b0603952..e3ff52aa 100644 --- a/crates/engine/src/lib.rs +++ b/crates/engine/src/lib.rs @@ -88,11 +88,9 @@ mod time; pub use self::time::*; mod note; pub use self::note::*; pub mod jack; pub use self::jack::*; pub mod midi; pub use self::midi::*; - pub(crate) use std::sync::{Arc, RwLock, atomic::{AtomicUsize, AtomicBool, Ordering::Relaxed}}; pub(crate) use std::fmt::Debug; pub(crate) use std::ops::{Add, Sub, Mul, Div, Rem}; - pub(crate) use ::tengri::{from, Usually}; pub use ::atomic_float; pub(crate) use atomic_float::*; diff --git a/deps/tengri b/deps/tengri index a1190a24..d7884f62 160000 --- a/deps/tengri +++ b/deps/tengri @@ -1 +1 @@ -Subproject commit a1190a24a1bdea774cedf86fff7b7e407c0a4cc7 +Subproject commit d7884f6289ac6c7a88f806f4453fb7c246c87f0b