menu works lol
Some checks are pending
/ build (push) Waiting to run

This commit is contained in:
🪞👃🪞 2025-08-24 01:44:18 +03:00
parent cfd19062fd
commit 559d2fc4a1
7 changed files with 125 additions and 72 deletions

View file

@ -1,9 +1,5 @@
use crate::*;
pub fn view_nil (_: &App) -> Box<dyn Render<TuiOut>> {
Box::new(Fill::xy("·"))
}
content!(TuiOut:|self: App|Fill::xy(Stack::above(|add|{
for dsl in self.mode.view.iter() { add(&Fill::xy(self.view(dsl.as_ref()))); }
})));
@ -20,6 +16,7 @@ impl App {
ViewCache::update_clock(&self.project.clock.view_cache, self.clock(), self.size.w() > 80)
}
}
fn render_dsl <'t> (
state: &'t impl DslNs<'t, Box<dyn Render<TuiOut>>>,
src: &str
@ -86,6 +83,21 @@ 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>> {
":dialog/menu" => Box::new(if let Dialog::Menu(selected, items) = &app.dialog {
let items = items.clone();
let selected = *selected;
Some(Fill::xy(Align::c(Tui::bg(Red, Fill::x(Stack::south(move|add|{
for (index, item) in items.iter().enumerate() {
add(&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) },
Fixed::y(2, Align::n(Fill::x(item)))
));
}
}))))))
} else {
None
}),
":templates" => Box::new({
let modes = app.config.modes.clone();
let height = (modes.read().unwrap().len() * 2) as u16;
@ -162,6 +174,10 @@ impl<'t> DslNs<'t, Box<dyn Render<TuiOut>>> for App {
}
}
pub fn view_nil (_: &App) -> Box<dyn Render<TuiOut>> {
Box::new(Fill::xy("·"))
}
//Bsp::s("",
//Map::south(1,
//move||app.config.binds.layers.iter()