diff --git a/config/config_arranger.edn b/config/config_arranger.edn index 7d61e025..07f0d65a 100644 --- a/config/config_arranger.edn +++ b/config/config_arranger.edn @@ -29,4 +29,4 @@ (fixed/x 20 :view-pool) (bsp/e (fixed/x 20 (fill/xy (align/n :view-arranger-scene-names))) - (fill/xy :view-arranger)))))) + (fill/xy (align/n :view-arranger-scene-clips))))))) diff --git a/crates/app/src/view.rs b/crates/app/src/view.rs index 09a3518d..2d347a3b 100644 --- a/crates/app/src/view.rs +++ b/crates/app/src/view.rs @@ -92,6 +92,40 @@ impl App { pub fn view_arranger (&self) -> impl Content + use<'_> { ArrangerView::new(&self.project, self.editor.as_ref()) } + pub fn view_arranger_scene_names <'a> (&'a self) -> impl Content + use<'a> { + let h = self.project.scenes.len() as u16 * 2; + let bg = self.color.darker.rgb; + Fixed::y(h, Tui::bg(bg, Align::w(Fill::x(Map::new( + ||self.project.scenes.iter().skip(self.project.scene_scroll), + move|scene: &Scene, index| + Push::y(index as u16 * 2u16, Fixed::xy(20, 2, + Tui::bg(scene.color.dark.rgb, Align::nw(Bsp::e( + format!(" {index:2} "), + Tui::fg(Rgb(255, 255, 255), + Tui::bold(true, format!("{}", scene.name))))))))))))) + } + pub fn view_arranger_scene_clips <'a> (&'a self) -> impl Content + use<'a> { + let h = self.project.scenes.len() as u16 * 2; + let bg = self.color.darker.rgb; + Fixed::y(h, Tui::bg(bg, Align::w(Fill::x(Map::new( + ||self.project.scenes.iter().skip(self.project.scene_scroll), + move|scene: &'a Scene, index1| + Push::y(index1 as u16 * 2u16, Fixed::xy(20, 2, + Map::new( + move||scene.clips.iter().skip(self.project.track_scroll), + move|clip: &'a Option>>, index2|{ + let (theme, text) = if let Some(clip) = clip { + let clip = clip.read().unwrap(); + (clip.color, clip.name.clone()) + } else { + (scene.color, Default::default()) + }; + Push::x(index2 as u16 * 14, Tui::bg(theme.dark.rgb, Bsp::e( + format!(" {index1:2} {index2:2} "), + Tui::fg(Rgb(255, 255, 255), + Tui::bold(true, format!("{}", text)))))) + })))))))) + } pub fn view_arranger_track_names (&self) -> impl Content + use<'_> { let mut max_outputs = 0u16; for track in self.project.tracks.iter() { @@ -100,14 +134,14 @@ impl App { Bsp::w( Fixed::x(20, Tui::bg(self.color.darkest.rgb, col!(Tui::bold(true, "[t]rack"), "[T] Add"))), - Fixed::y(max_outputs + 1, Tui::bg(self.color.darker.rgb, Align::w(Fill::x(Map::new( + Align::w(Fixed::y(max_outputs + 1, Tui::bg(self.color.darker.rgb, Align::w(Fill::x(Map::new( ||self.project.tracks_with_sizes(&self.project.selection, None) .skip(self.project.track_scroll), move|(index, track, x1, x2): (usize, &Track, usize, usize), _| - Push::x(x2 as u16, Fixed::xy(track.width as u16, max_outputs + 1, + Push::x(index as u16 * 14, Fixed::xy(track.width as u16, max_outputs + 1, Tui::bg(track.color.dark.rgb, Align::nw(Bsp::s( Tui::fg(Rgb(255, 255, 255), Tui::bold(true, format!("{}", track.name))), - format!("{index} {x1} {x2}")))))))))))) + format!("{index} {x1} {x2}"))))))))))))) } pub fn view_arranger_track_outputs <'a> (&'a self) -> impl Content + use<'a> { let mut max_outputs = 0u16; @@ -117,7 +151,7 @@ impl App { Bsp::w( Fixed::x(20, Tui::bg(self.color.darkest.rgb, col!(Tui::bold(true, "[o]utput"), "[O] Add"))), - Fixed::y(max_outputs + 1, Tui::bg(self.color.darker.rgb, Align::w(Fill::x(Map::new( + Align::w(Fixed::y(max_outputs + 1, Tui::bg(self.color.darker.rgb, Align::w(Fill::x(Map::new( ||self.project.tracks_with_sizes(&self.project.selection, None) .skip(self.project.track_scroll), move|(index, track, x1, x2): (usize, &'a Track, usize, usize), _| @@ -128,7 +162,7 @@ impl App { format!("[mut] [sol]"), Map::south(1, ||track.sequencer.midi_outs.iter(), |port, index|Tui::fg(Rgb(255, 255, 255), - format!("{index}: {}", port.name())))))))))))))) + format!("{index}: {}", port.name()))))))))))))))) } pub fn view_arranger_track_inputs <'a> (&'a self) -> impl Content + use<'a> { let mut max_inputs = 0u16; @@ -138,7 +172,7 @@ impl App { Bsp::w( Fixed::x(20, Tui::bg(self.color.darkest.rgb, col!(Tui::bold(true, "[i]nputs"), "[I] Add"))), - Fixed::y(max_inputs + 1, Tui::bg(self.color.darker.rgb, Align::w(Fill::x(Map::new( + Fill::x(Align::w(Fixed::y(max_inputs + 1, Tui::bg(self.color.darker.rgb, Align::w(Fill::x(Map::new( ||self.project.tracks_with_sizes(&self.project.selection, None) .skip(self.project.track_scroll), move|(index, track, x1, x2): (usize, &'a Track, usize, usize), _| @@ -147,7 +181,7 @@ impl App { format!("[rec] [mon]"), Map::south(1, ||track.sequencer.midi_ins.iter(), |port, index|Tui::fg(Rgb(255, 255, 255), - format!("{index}: {}", port.name())))))))))))))) + format!("{index}: {}", port.name())))))))))))))))) } pub fn view_arranger_track_devices <'a> (&'a self) -> impl Content + use<'a> { let mut max_devices = 2u16; @@ -181,18 +215,6 @@ impl App { Align::nw(Map::south(1, ||track.devices.iter(), |device, index|format!("{index}: {}", device.name()))))))))))) } - pub fn view_arranger_scene_names <'a> (&'a self) -> impl Content + use<'a> { - Fixed::y(self.project.scenes.len() as u16 * 2, - Tui::bg(self.color.darker.rgb, - Align::w(Fill::x(Map::new( - ||self.project.scenes.iter().skip(self.project.scene_scroll), - move|scene: &Scene, index| - Push::y(index as u16 * 2u16, Fixed::xy(20, 2, - Tui::bg(scene.color.dark.rgb, Align::nw(Bsp::e( - format!(" {index:2} "), - Tui::fg(Rgb(255, 255, 255), - Tui::bold(true, format!("{}", scene.name))))))))))))) - } pub fn view_pool (&self) -> impl Content + use<'_> { Fixed::x(20, Bsp::s( Fill::x(Align::w(FieldH(self.color, "Clip pool:", ""))),