arranger: ClipsView at last

This commit is contained in:
🪞👃🪞 2025-05-17 08:03:38 +03:00
parent b5326b578c
commit 4d0868add8
6 changed files with 55 additions and 33 deletions

View file

@ -159,28 +159,6 @@ pub trait ScenesView: HasSceneScroll + Send + Sync {
)))
})))
}
fn scenes_clips_2 (&self, theme: ItemTheme) -> impl Content<TuiOut> {
let h = self.scenes().len() as u16 * 2;
let bg = theme.darker.rgb;
Fixed::y(h, Tui::bg(bg, Align::w(Fill::x(Map::new(
||self.scenes().iter().skip(self.scene_scroll()),
move|scene: &Scene, index1|
Push::y(index1 as u16 * 2u16, Fixed::xy(20, 2,
Map::new(
move||scene.clips.iter().skip(self.track_scroll()),
move|clip: &Option<Arc<RwLock<MidiClip>>>, 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))))))
}))))))))
}
fn scenes_with_clip (&self, track_index: usize) -> impl Iterator<Item=SceneWith<'_, Option<ItemTheme>>> + Send + Sync {
self.scenes_iter().map(move|(s, scene, y1, y2)|(s, scene, y1, y2,
(s>0).then(||self.arrangement().scenes()[s-1].clips[track_index].as_ref()