arranger: trying to fix conditional layers

This commit is contained in:
🪞👃🪞 2025-05-17 21:56:46 +03:00
parent 9fcb5a08c6
commit 01db41b75d
5 changed files with 24 additions and 17 deletions

View file

@ -435,7 +435,8 @@ impl Configuration {
return Err(format!("(e4) unexpected non-symbol {next:?}").into())
};
if let Some(Token { value: Value::Str(path), .. }) = exp.peek() {
let token = exp.peek();
if let Some(Token { value: Value::Str(path), .. }) = token {
let path = base.as_ref().parent().unwrap().join(unquote(path));
if !std::fs::exists(&path)? {
return Err(format!("(e5) not found: {path:?}").into())
@ -448,7 +449,11 @@ impl Configuration {
map.add_layer_if(
Box::new(move |state|{
let mut exp = exp.clone();
Context::get(state, &mut exp).unwrap_or(false)
let value = Context::get(state, &mut format!(":{cond}").as_str().into()).unwrap_or(false);
if value {
panic!("layer-if cond={cond:?} exp={exp:?} value={value:?}");
}
value
}),
keys
);

View file

@ -123,10 +123,12 @@ impl App {
self.project.view_scenes_clips()
}
pub fn view_tracks_inputs <'a> (&'a self) -> impl Content<TuiOut> + use<'a> {
Fixed::y(1 + self.project.midi_ins.len() as u16, self.project.view_inputs(self.color))
Fixed::y(1 + self.project.midi_ins.len() as u16,
self.project.view_inputs(self.color))
}
pub fn view_tracks_outputs <'a> (&'a self) -> impl Content<TuiOut> + use<'a> {
Fixed::y(1 + self.project.midi_outs.len() as u16, self.project.view_outputs(self.color))
Fixed::y(1 + self.project.midi_outs.len() as u16,
self.project.view_outputs(self.color))
}
pub fn view_tracks_devices <'a> (&'a self) -> impl Content<TuiOut> + use<'a> {
Fixed::y(3, self.project.view_track_devices(self.color))