remove ArrangerView<'a>

This commit is contained in:
🪞👃🪞 2025-05-17 09:02:33 +03:00
parent e9b4a2ca78
commit a7f37e52cf
12 changed files with 843 additions and 949 deletions

View file

@ -1,11 +1,5 @@
use crate::*;
impl<'state> Context<'state, ClipCommand> for Arrangement {
fn get <'source> (&'state self, iter: &mut TokenIter<'source>) -> Option<ClipCommand> {
Context::get(&self, iter)
}
}
#[tengri_proc::expose]
impl MidiClip {
fn _todo_opt_bool_stub_ (&self) -> Option<bool> { todo!() }
@ -30,46 +24,3 @@ impl ClipCommand {
todo!()
}
}
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(index, scene))))))
}
fn track_scenes <'a> (
&'a self,
scene_index: usize,
scene: &'a Scene
) -> impl Content<TuiOut> + 'a {
Push::y(scene_index as u16 * 2u16, Fixed::xy(20, 2, Map::new(
move||scene.clips.iter().skip(self.track_scroll()),
move|clip: &'a Option<Arc<RwLock<MidiClip>>>, track_index|
self.track_scene_clip(scene_index, scene, track_index, clip))))
}
fn track_scene_clip (
&self,
scene_index: usize,
scene: &Scene,
track_index: usize,
clip: &Option<Arc<RwLock<MidiClip>>>
) -> impl Content<TuiOut> {
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))))))
}
}