mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
arranger: ClipsView at last
This commit is contained in:
parent
b5326b578c
commit
4d0868add8
6 changed files with 55 additions and 33 deletions
|
|
@ -34,3 +34,33 @@ impl ClipCommand {
|
|||
impl Arrangement {
|
||||
|
||||
}
|
||||
|
||||
impl ClipsView for Arrangement {}
|
||||
|
||||
impl<'a> ClipsView for ArrangerView<'a> {}
|
||||
|
||||
pub trait ClipsView: HasTrackScroll + HasSceneScroll + Send + Sync {
|
||||
fn scenes_clips_2 <'a> (&'a self, theme: ItemTheme) -> impl Content<TuiOut> + 'a {
|
||||
Fixed::y(self.scenes().len() as u16 * 2,
|
||||
Tui::bg(theme.darker.rgb,
|
||||
Align::w(Fill::x(Map::new(
|
||||
||self.scenes().iter().skip(self.scene_scroll()),
|
||||
move|scene: &'a Scene, index|self.track_scenes(scene, index))))))
|
||||
}
|
||||
fn track_scenes (&self, scene: &Scene, scene_index: usize) -> impl Content<TuiOut> {
|
||||
Push::y(scene_index as u16 * 2u16, Fixed::xy(20, 2, Map::new(
|
||||
move||scene.clips.iter().skip(self.track_scroll()),
|
||||
move|clip: &Option<Arc<RwLock<MidiClip>>>, track_index|{
|
||||
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(track_index as u16 * 14, Tui::bg(theme.dark.rgb, Bsp::e(
|
||||
format!(" {scene_index:2} {track_index:2} "),
|
||||
Tui::fg(Rgb(255, 255, 255),
|
||||
Tui::bold(true, format!("{}", text))))))
|
||||
})))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue