mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +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 {
|
||||
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/message" => matches!(app.dialog, Dialog::Message(..)),
|
||||
":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)),
|
||||
"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/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)),
|
||||
|
|
@ -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)),
|
||||
});
|
||||
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 {
|
||||
let items = items.clone();
|
||||
let selected = *selected;
|
||||
|
|
@ -98,13 +118,6 @@ impl<'t> DslNs<'t, Box<dyn Render<TuiOut>>> for App {
|
|||
} else {
|
||||
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({
|
||||
let modes = app.config.modes.clone();
|
||||
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)))
|
||||
//},
|
||||
//
|
||||
//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> {
|
||||
//Fixed::y(1, Fill::x(Align::w(FieldH(self.color,
|
||||
//format!("History ({})", self.history.len()),
|
||||
|
|
|
|||
|
|
@ -125,10 +125,10 @@ impl Mode<Arc<str>> {
|
|||
Ok(())
|
||||
}
|
||||
pub fn load_one (&mut self, dsl: impl Dsl) -> Usually<()> {
|
||||
Ok(if let Ok(Some(expr)) = dsl.expr() && let Ok(Some(key)) = expr.head() {
|
||||
println!("Mode::load_one: {key} {:?}", expr.tail()?);
|
||||
Ok(if let Ok(Some(expr)) = dsl.expr() && let Ok(Some(head)) = expr.head() {
|
||||
println!("Mode::load_one: {head} {:?}", expr.tail());
|
||||
let tail = expr.tail()?.map(|x|x.trim()).unwrap_or("");
|
||||
match key {
|
||||
match head {
|
||||
"name" => self.name.push(tail.into()),
|
||||
"info" => self.info.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: unexpected expr: {key:?} {tail:?}").into())
|
||||
return Err(format!("Mode::load_one: unexpected expr: {head:?} {tail:?}").into())
|
||||
},
|
||||
};
|
||||
} else if let Ok(Some(word)) = dsl.word() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue