mirror of
https://codeberg.org/unspeaker/tek.git
synced 2026-10-08 18:56:42 +02:00
collect tek_view, tek_ctrl
This commit is contained in:
parent
c5d6ce24b2
commit
186b81f29c
47 changed files with 2665 additions and 2893 deletions
|
|
@ -131,50 +131,6 @@ pub type MidiData = Vec<Vec<MidiMessage>>;
|
|||
impl PartialEq for MidiClip { fn eq (&self, other: &Self) -> bool { self.uuid == other.uuid } }
|
||||
impl Eq for MidiClip {}
|
||||
|
||||
impl HasMidiClip for Project {
|
||||
fn clip (&self) -> Option<Arc<RwLock<MidiClip>>> { None }
|
||||
}
|
||||
impl HasMidiClip for App {
|
||||
fn clip (&self) -> Option<Arc<RwLock<MidiClip>>> { self.project.clip() }
|
||||
}
|
||||
|
||||
impl<T: HasMidiClip
|
||||
+ Namespace<Option<bool>>
|
||||
+ Namespace<Option<ItemTheme>>
|
||||
> MidiClipController for T {}
|
||||
|
||||
#[tek_proc::commands(MidiClipCommand)]
|
||||
pub trait MidiClipController: HasMidiClip
|
||||
+ Namespace<Option<bool>>
|
||||
+ Namespace<Option<ItemTheme>>
|
||||
{
|
||||
|
||||
/// Create a clip at the current position if it does not already exist.
|
||||
#[command(Upsert = "upsert")]
|
||||
fn clip_upsert (&mut self) -> Perhaps<MidiClipCommand> {
|
||||
let clip = self.clip();
|
||||
//let old = self.scenes[scene].clips[track].clone();
|
||||
//self.scenes[scene].clips[track] = clip;
|
||||
//old
|
||||
todo!()
|
||||
}
|
||||
|
||||
#[command(SetColor = "color")]
|
||||
fn clip_set_color (&mut self, color: Option<ItemTheme>) -> Perhaps<MidiClipCommand> {
|
||||
Ok(self.clip().map(|clip|MidiClipCommand::SetColor {
|
||||
color: Some(clip.write().set_color(color))
|
||||
}))
|
||||
}
|
||||
|
||||
/// Toggle looping for the active clip
|
||||
#[command(SetLoop = "loop")]
|
||||
fn clip_toggle_loop (&mut self, looping: Option<bool>) -> Perhaps<MidiClipCommand> {
|
||||
Ok(self.clip().map(|clip|MidiClipCommand::SetLoop {
|
||||
looping: Some(clip.write().toggle_loop(looping))
|
||||
}))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
impl HasClipsSize for App { fn clips_size (&self) -> &Sizer { &self.project.size_inner } }
|
||||
impl HasClipsSize for Project { fn clips_size (&self) -> &Sizer { &self.size_inner } }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue