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

@ -22,10 +22,10 @@
(bsp/w :view-meters-output
(bsp/e :view-meters-input
(bsp/n (fixed/y 2 :view-status-h2)
(bsp/n (fill/x (align/w :view-tracks-inputs))
(bsp/s (fill/x (align/w :view-tracks-devices))
(bsp/s (fill/x (align/w :view-tracks-outputs))
(bsp/s (fill/x (align/w :view-tracks-names))
(bsp/n :view-tracks-inputs
(bsp/s :view-tracks-devices
(bsp/s :view-tracks-outputs
(bsp/s :view-tracks-names
(fill/xy (either :is-editing
(bsp/e (fixed/x 20 :view-scenes-names) :view-editor)
(bsp/e :view-scenes-names :view-editor)
:view-scenes)))))))))))

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

View file

@ -240,13 +240,13 @@ pub trait ScenesView:
fn w_side (&self) -> u16;
fn w_mid (&self) -> u16;
fn scenes_with_sizes (&self) -> impl ScenesSizes<'_> {
let editing = self.editor().is_some();
let height = Self::H_SCENE;
let larger = 8;//FIXME//self.editor().map(|e|e.height()).unwrap_or(Self::H_SCENE);
let selected_track = self.selection().track();
let selected_scene = self.selection().scene();
let mut y = 0;
self.scenes().iter().enumerate().skip(self.scene_scroll()).map_while(move|(s, scene)|{
let height = if self.selection().scene() == Some(s) && self.editor().is_some() {
8
} else {
Self::H_SCENE
};
if y + height <= self.clips_size().h() {
let data = (s, scene, y, y + height);
y += height;
@ -257,11 +257,11 @@ pub trait ScenesView:
})
}
fn view_scenes_names (&self) -> impl Content<TuiOut> {
Stack::south(move|add: &mut dyn FnMut(&dyn Render<TuiOut>)|{
Fixed::x(20, Stack::south(move|add: &mut dyn FnMut(&dyn Render<TuiOut>)|{
for (index, scene, ..) in self.scenes_with_sizes() {
add(&self.view_scene_name(index, scene));
}
})
}))
}
fn view_scene_name (&self, index: usize, scene: &Scene) -> impl Content<TuiOut> {
let h = if self.selection().scene() == Some(index) && let Some(editor) = self.editor() {

2
deps/tengri vendored

@ -1 +1 @@
Subproject commit f21781e81664e1991e3985e2377becca9c1d58cf
Subproject commit 9a12e0c7bab24cb708d503e860d93677ae306961