mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 03:36:41 +01:00
This commit is contained in:
parent
f81f16b47b
commit
d10107684d
5 changed files with 37 additions and 27 deletions
|
|
@ -10,7 +10,8 @@ impl<'t> DslNs<'t, Arc<str>> for App {
|
||||||
|
|
||||||
impl<'t> DslNs<'t, bool> for App {
|
impl<'t> DslNs<'t, bool> for App {
|
||||||
dsl_words!(|app| -> bool {
|
dsl_words!(|app| -> bool {
|
||||||
":focused/editor" => app.project.editor.is_some(),
|
":mode/editor" => app.project.editor.is_some(),
|
||||||
|
|
||||||
":focused/dialog" => !matches!(app.dialog, Dialog::None),
|
":focused/dialog" => !matches!(app.dialog, Dialog::None),
|
||||||
":focused/message" => matches!(app.dialog, Dialog::Message(..)),
|
":focused/message" => matches!(app.dialog, Dialog::Message(..)),
|
||||||
":focused/add_device" => matches!(app.dialog, Dialog::Device(..)),
|
":focused/add_device" => matches!(app.dialog, Dialog::Device(..)),
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,9 @@ impl<'t> DslNs<'t, Box<dyn Render<TuiOut>>> for App {
|
||||||
"bg" (color: Color, x: Box<dyn Render<TuiOut>>) => Box::new(Tui::bg(color, x)),
|
"bg" (color: Color, x: Box<dyn Render<TuiOut>>) => Box::new(Tui::bg(color, x)),
|
||||||
"fg/bg" (fg: Color, bg: Color, x: Box<dyn Render<TuiOut>>) => Box::new(Tui::fg_bg(fg, bg, x)),
|
"fg/bg" (fg: Color, bg: Color, x: Box<dyn Render<TuiOut>>) => Box::new(Tui::fg_bg(fg, bg, x)),
|
||||||
|
|
||||||
|
"either" (cond: bool, a: Box<dyn Render<TuiOut>>, b: Box<dyn Render<TuiOut>>) =>
|
||||||
|
Box::new(Either(cond, a, b)),
|
||||||
|
|
||||||
"bsp/n" (a: Box<dyn Render<TuiOut>>, b: Box<dyn Render<TuiOut>>) => Box::new(Bsp::n(a, b)),
|
"bsp/n" (a: Box<dyn Render<TuiOut>>, b: Box<dyn Render<TuiOut>>) => Box::new(Bsp::n(a, b)),
|
||||||
"bsp/s" (a: Box<dyn Render<TuiOut>>, b: Box<dyn Render<TuiOut>>) => Box::new(Bsp::s(a, b)),
|
"bsp/s" (a: Box<dyn Render<TuiOut>>, b: Box<dyn Render<TuiOut>>) => Box::new(Bsp::s(a, b)),
|
||||||
"bsp/e" (a: Box<dyn Render<TuiOut>>, b: Box<dyn Render<TuiOut>>) => Box::new(Bsp::e(a, b)),
|
"bsp/e" (a: Box<dyn Render<TuiOut>>, b: Box<dyn Render<TuiOut>>) => Box::new(Bsp::e(a, b)),
|
||||||
|
|
@ -83,6 +86,23 @@ impl<'t> DslNs<'t, Box<dyn Render<TuiOut>>> for App {
|
||||||
"max/xy" (x: u16, y: u16, c: Box<dyn Render<TuiOut>>) => Box::new(Max::xy(x, y, c)),
|
"max/xy" (x: u16, y: u16, c: Box<dyn Render<TuiOut>>) => Box::new(Max::xy(x, y, c)),
|
||||||
});
|
});
|
||||||
dsl_words!(|app| -> Box<dyn Render<TuiOut>> {
|
dsl_words!(|app| -> Box<dyn Render<TuiOut>> {
|
||||||
|
":logo" => Box::new(Fixed::xy(32, 7, Tui::bold(true, Tui::fg(Rgb(240,200,180), Stack::south(|add|{
|
||||||
|
add(&Fixed::y(1, ""));
|
||||||
|
add(&Fixed::y(1, ""));
|
||||||
|
add(&Fixed::y(1, "~~ ╓─╥─╖ ╓──╖ ╥ ╖ ~~~~~~~~~~~~"));
|
||||||
|
add(&Fixed::y(1, Bsp::e("~~~~ ║ ~ ╟─╌ ~╟─< ~~ ", Bsp::e(Tui::fg(Rgb(230,100,40), "v0.3.0"), " ~~"))));
|
||||||
|
add(&Fixed::y(1, "~~~~ ╨ ~ ╙──╜ ╨ ╜ ~~~~~~~~~~~~"));
|
||||||
|
}))))),
|
||||||
|
":meters/input" => Box::new("Input Meters"),
|
||||||
|
":meters/output" => Box::new("Output Meters"),
|
||||||
|
":status" => Box::new("Status Bar"),
|
||||||
|
":tracks/names" => Box::new("Track Names"),
|
||||||
|
":tracks/inputs" => Box::new("Track Inputs"),
|
||||||
|
":tracks/devices" => Box::new("Track Devices"),
|
||||||
|
":tracks/outputs" => Box::new("Track Outputs"),
|
||||||
|
":scenes/names" => Box::new("Scene Names"),
|
||||||
|
":editor" => Box::new("Editor"),
|
||||||
|
":scenes" => Box::new("Editor"),
|
||||||
":dialog/menu" => Box::new(if let Dialog::Menu(selected, items) = &app.dialog {
|
":dialog/menu" => Box::new(if let Dialog::Menu(selected, items) = &app.dialog {
|
||||||
let items = items.clone();
|
let items = items.clone();
|
||||||
let selected = *selected;
|
let selected = *selected;
|
||||||
|
|
@ -98,13 +118,6 @@ impl<'t> DslNs<'t, Box<dyn Render<TuiOut>>> for App {
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}),
|
}),
|
||||||
":logo" => Box::new(Fixed::xy(32, 7, Tui::bold(true, Tui::fg(Rgb(240,200,180), Stack::south(|add|{
|
|
||||||
add(&Fixed::y(1, ""));
|
|
||||||
add(&Fixed::y(1, ""));
|
|
||||||
add(&Fixed::y(1, "~~ ╓─╥─╖ ╓──╖ ╥ ╖ ~~~~~~~~~~~~"));
|
|
||||||
add(&Fixed::y(1, Bsp::e("~~~~ ║ ~ ╟─╌ ~╟─< ~~ ", Bsp::e(Tui::fg(Rgb(230,100,40), "v0.3.0"), " ~~"))));
|
|
||||||
add(&Fixed::y(1, "~~~~ ╨ ~ ╙──╜ ╨ ╜ ~~~~~~~~~~~~"));
|
|
||||||
}))))),
|
|
||||||
":templates" => Box::new({
|
":templates" => Box::new({
|
||||||
let modes = app.config.modes.clone();
|
let modes = app.config.modes.clone();
|
||||||
let height = (modes.read().unwrap().len() * 2) as u16;
|
let height = (modes.read().unwrap().len() * 2) as u16;
|
||||||
|
|
@ -225,14 +238,6 @@ pub fn view_nil (_: &App) -> Box<dyn Render<TuiOut>> {
|
||||||
////.enclose(Fill::xy(browser)))
|
////.enclose(Fill::xy(browser)))
|
||||||
//},
|
//},
|
||||||
//
|
//
|
||||||
//pub fn view_meters_input (&self) -> impl Content<TuiOut> + use<'_> {
|
|
||||||
//self.project.sampler().map(|s|
|
|
||||||
//s.view_meters_input())
|
|
||||||
//}
|
|
||||||
//pub fn view_meters_output (&self) -> impl Content<TuiOut> + use<'_> {
|
|
||||||
//self.project.sampler().map(|s|
|
|
||||||
//s.view_meters_output())
|
|
||||||
//}
|
|
||||||
//pub fn view_history (&self) -> impl Content<TuiOut> {
|
//pub fn view_history (&self) -> impl Content<TuiOut> {
|
||||||
//Fixed::y(1, Fill::x(Align::w(FieldH(self.color,
|
//Fixed::y(1, Fill::x(Align::w(FieldH(self.color,
|
||||||
//format!("History ({})", self.history.len()),
|
//format!("History ({})", self.history.len()),
|
||||||
|
|
|
||||||
|
|
@ -125,10 +125,10 @@ impl Mode<Arc<str>> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
pub fn load_one (&mut self, dsl: impl Dsl) -> Usually<()> {
|
pub fn load_one (&mut self, dsl: impl Dsl) -> Usually<()> {
|
||||||
Ok(if let Ok(Some(expr)) = dsl.expr() && let Ok(Some(key)) = expr.head() {
|
Ok(if let Ok(Some(expr)) = dsl.expr() && let Ok(Some(head)) = expr.head() {
|
||||||
println!("Mode::load_one: {key} {:?}", expr.tail()?);
|
println!("Mode::load_one: {head} {:?}", expr.tail());
|
||||||
let tail = expr.tail()?.map(|x|x.trim()).unwrap_or("");
|
let tail = expr.tail()?.map(|x|x.trim()).unwrap_or("");
|
||||||
match key {
|
match head {
|
||||||
"name" => self.name.push(tail.into()),
|
"name" => self.name.push(tail.into()),
|
||||||
"info" => self.info.push(tail.into()),
|
"info" => self.info.push(tail.into()),
|
||||||
"view" => self.view.push(tail.into()),
|
"view" => self.view.push(tail.into()),
|
||||||
|
|
@ -139,7 +139,7 @@ impl Mode<Arc<str>> {
|
||||||
return Err(format!("Mode::load_one: self: incomplete: {expr:?}").into());
|
return Err(format!("Mode::load_one: self: incomplete: {expr:?}").into());
|
||||||
},
|
},
|
||||||
_ => {
|
_ => {
|
||||||
return Err(format!("Mode::load_one: unexpected expr: {key:?} {tail:?}").into())
|
return Err(format!("Mode::load_one: unexpected expr: {head:?} {tail:?}").into())
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
} else if let Ok(Some(word)) = dsl.word() {
|
} else if let Ok(Some(word)) = dsl.word() {
|
||||||
|
|
|
||||||
2
deps/tengri
vendored
2
deps/tengri
vendored
|
|
@ -1 +1 @@
|
||||||
Subproject commit 446ec7a71477e1b9ca117b7a23759d6318eb2cf0
|
Subproject commit d9081087ecc41ad8514c17614daab4f34d3e876d
|
||||||
16
tek.edn
16
tek.edn
|
|
@ -14,7 +14,7 @@
|
||||||
(view :menu (bg (g 40) (bsp/s :ports/out (bsp/n :ports/in
|
(view :menu (bg (g 40) (bsp/s :ports/out (bsp/n :ports/in
|
||||||
(bg (g 30) (bsp/s (fixed/y 7 :logo) (fill/xy :dialog/menu)))))))
|
(bg (g 30) (bsp/s (fixed/y 7 :logo) (fill/xy :dialog/menu)))))))
|
||||||
(view :ports/out (fill/x (fixed/y 3 (bsp/a (fill/x (align/w (text L-AUDIO-OUT)))
|
(view :ports/out (fill/x (fixed/y 3 (bsp/a (fill/x (align/w (text L-AUDIO-OUT)))
|
||||||
(bsp/a (text MIDI-OUT) (fill/x (align/e (text AUDIO-OUT R))))))))
|
(bsp/a (text MIDI-OUT) (fill/x (align/e (text AUDIO-OUT-R))))))))
|
||||||
(view :ports/in (fill/x (fixed/y 3 (bsp/a (fill/x (align/w (text L-AUDIO-IN)))
|
(view :ports/in (fill/x (fixed/y 3 (bsp/a (fill/x (align/w (text L-AUDIO-IN)))
|
||||||
(bsp/a (text MIDI-IN) (fill/x (align/e (text AUDIO-IN-R))))))))
|
(bsp/a (text MIDI-IN) (fill/x (align/e (text AUDIO-IN-R))))))))
|
||||||
(view :browse (bsp/s (padding/xy 3 1 :browse-title) (enclose (fg (g 96)) browser)))
|
(view :browse (bsp/s (padding/xy 3 1 :browse-title) (enclose (fg (g 96)) browser)))
|
||||||
|
|
@ -55,12 +55,16 @@
|
||||||
(mode :scene (keys :scene))
|
(mode :scene (keys :scene))
|
||||||
(mode :mix (keys :mix))
|
(mode :mix (keys :mix))
|
||||||
(keys :clock :arranger :global)
|
(keys :clock :arranger :global)
|
||||||
(view :arranger))
|
:arranger)
|
||||||
|
|
||||||
(view :arranger (bsp/w :meters/output (bsp/e :meters/input (stack/n
|
(view :arranger (bsp/w :meters/output (bsp/e :meters/input
|
||||||
(fixed/y 2 :status/h2) :tracks/inputs (stack/s
|
(bsp/n (fixed/y 2 :status) (bsp/n :tracks/inputs
|
||||||
:tracks/devices :tracks/outputs :tracks/names
|
(bsp/s :tracks/devices (bsp/s :tracks/outputs (bsp/s :tracks/names
|
||||||
(fill/xy (either :mode/editor (bsp/e :scenes/names :editor) :scenes)))))))
|
(fill/xy (either :mode/editor (bsp/e :scenes/names :editor) :scenes))))))))))
|
||||||
|
(view :arranger (bsp/w :meters/output (bsp/e :meters/input
|
||||||
|
(bsp/n (fixed/y 2 :status) (bsp/n :tracks/inputs
|
||||||
|
(bsp/s :tracks/devices (bsp/s :tracks/outputs (bsp/s :tracks/names
|
||||||
|
(fill/xy (either :mode/editor (bsp/e :scenes/names :editor) :scenes))))))))))
|
||||||
|
|
||||||
(keys :arranger (see :color :launch :scenes :tracks)
|
(keys :arranger (see :color :launch :scenes :tracks)
|
||||||
(@tab project/edit) (@enter project/edit)
|
(@tab project/edit) (@enter project/edit)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue