wip: some namespace progress
Some checks are pending
/ build (push) Waiting to run

This commit is contained in:
🪞👃🪞 2025-08-15 21:24:31 +03:00
parent ea47d605a6
commit 74b497cf3a
4 changed files with 35 additions and 35 deletions

View file

@ -238,7 +238,7 @@ fn render_dsl <'t, S> (state: &'t S, src: &str) -> Box<dyn Render<TuiOut>>
}))
}
dsl_exp!(|app: App, tail| -> Box<dyn Render<TuiOut>> {
dsl_exp_ns!(|app: App| -> Box<dyn Render<TuiOut>> {
("bold", value: bool, x: Box<dyn Render<TuiOut>>) => Box::new(Tui::bold(value, x)),
("fg", color: Color, x: Box<dyn Render<TuiOut>>) => Box::new(Tui::fg(color, x)),
("bg", color: Color, x: Box<dyn Render<TuiOut>>) => Box::new(Tui::bg(color, x)),
@ -249,24 +249,26 @@ dsl_exp!(|app: App, tail| -> Box<dyn Render<TuiOut>> {
("bsp/w", a: Box<dyn Render<TuiOut>>, b: Box<dyn Render<TuiOut>>) => Box::new(Bsp::w(a, b)),
("bsp/a", a: Box<dyn Render<TuiOut>>, b: Box<dyn Render<TuiOut>>) => Box::new(Bsp::a(a, b)),
("bsp/b", a: Box<dyn Render<TuiOut>>, b: Box<dyn Render<TuiOut>>) => Box::new(Bsp::b(a, b)),
("align/n", x: Box<dyn Render<TuiOut>>) => Box::new(Align::n(a, b)),
("align/s", x: Box<dyn Render<TuiOut>>) => Box::new(Align::s(a, b)),
("align/e", x: Box<dyn Render<TuiOut>>) => Box::new(Align::e(a, b)),
("align/w", x: Box<dyn Render<TuiOut>>) => Box::new(Align::w(a, b)),
("align/x", x: Box<dyn Render<TuiOut>>) => Box::new(Align::x(a, b)),
("align/y", x: Box<dyn Render<TuiOut>>) => Box::new(Align::y(a, b)),
("align/c", x: Box<dyn Render<TuiOut>>) => Box::new(Align::c(a, b)),
("align/n", x: Box<dyn Render<TuiOut>>) => Box::new(Align::n(x)),
("align/s", x: Box<dyn Render<TuiOut>>) => Box::new(Align::s(x)),
("align/e", x: Box<dyn Render<TuiOut>>) => Box::new(Align::e(x)),
("align/w", x: Box<dyn Render<TuiOut>>) => Box::new(Align::w(x)),
("align/x", x: Box<dyn Render<TuiOut>>) => Box::new(Align::x(x)),
("align/y", x: Box<dyn Render<TuiOut>>) => Box::new(Align::y(x)),
("align/c", x: Box<dyn Render<TuiOut>>) => Box::new(Align::c(x)),
("fill/x", x: Box<dyn Render<TuiOut>>) => Box::new(Fill::x(x)),
("fill/y", x: Box<dyn Render<TuiOut>>) => Box::new(Fill::y(x)),
("fill/xy", x: Box<dyn Render<TuiOut>>) => 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<dyn Render<TuiOut>> {
dsl_sym_ns!(|app: App| -> Box<dyn Render<TuiOut>> {
":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<u7> {
dsl_sym_ns!(|app: App| -> Option<u7> {
":editor/pitch" => Some((app.editor().as_ref().map(|e|e.get_note_pos()).unwrap() as u8).into())
});
dsl_sym!(|app: App| -> Option<usize> {
dsl_sym_ns!(|app: App| -> Option<usize> {
":selected/scene" => app.selection().scene(),
":selected/track" => app.selection().track(),
});
dsl_sym!(|app: App| -> Option<Arc<RwLock<MidiClip>>> {
dsl_sym_ns!(|app: App| -> Option<Arc<RwLock<MidiClip>>> {
":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<Arc<RwLock<MidiClip>>> {
#[derive(Debug)]
pub enum AppCommand {
}
dsl_exp!(|app: App| -> AppCommand {
("stop-all") => app.project.stop_all(),
("enqueue", clip?: Option<Arc<RwLock<MidiClip>>>) => todo!(),
dsl_exp_ns!(|app: App| -> AppCommand {
("stop-all") => todo!(),//app.project.stop_all(),
("enqueue", clip: Option<Arc<RwLock<MidiClip>>>) => 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

View file

@ -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()

View file

@ -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::*;