mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 11:46:41 +01:00
impl has_phrases
This commit is contained in:
parent
c27a4a5232
commit
9497f530cd
5 changed files with 13 additions and 27 deletions
|
|
@ -5,6 +5,15 @@ pub trait HasPhrases {
|
|||
fn phrases_mut (&mut self) -> &mut Vec<Arc<RwLock<Phrase>>>;
|
||||
}
|
||||
|
||||
#[macro_export] macro_rules! has_phrases {
|
||||
(|$self:ident:$Struct:ident$(<$($L:lifetime),*$($T:ident$(:$U:path)?),*>)?|$cb:expr) => {
|
||||
impl $(<$($L),*$($T $(: $U)?),*>)? HasPhrases for $Struct $(<$($L),*$($T),*>)? {
|
||||
fn phrases (&$self) -> &Vec<Arc<RwLock<Phrase>>> { &$cb }
|
||||
fn phrases_mut (&mut $self) -> &mut Vec<Arc<RwLock<Phrase>>> { &mut$cb }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub trait HasPhrase {
|
||||
fn phrase (&self) -> &Arc<RwLock<Phrase>>;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ pub trait HasSize<E: Engine> {
|
|||
#[macro_export] macro_rules! has_size {
|
||||
(<$E:ty>|$self:ident:$Struct:ident$(<$($L:lifetime),*$($T:ident$(:$U:path)?),*>)?|$cb:expr) => {
|
||||
impl $(<$($L),*$($T $(: $U)?),*>)? HasSize<$E> for $Struct $(<$($L),*$($T),*>)? {
|
||||
fn size (&$self) -> &Measure<$E> { $cb } // TODO provide trait body
|
||||
fn size (&$self) -> &Measure<$E> { $cb }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -414,15 +414,7 @@ render!(|self: ArrangerTui|{
|
|||
|
||||
has_clock!(|self:ArrangerTui|&self.clock);
|
||||
has_clock!(|self:ArrangerTrack|self.player.clock());
|
||||
|
||||
impl HasPhrases for ArrangerTui {
|
||||
fn phrases (&self) -> &Vec<Arc<RwLock<Phrase>>> {
|
||||
&self.phrases.phrases
|
||||
}
|
||||
fn phrases_mut (&mut self) -> &mut Vec<Arc<RwLock<Phrase>>> {
|
||||
&mut self.phrases.phrases
|
||||
}
|
||||
}
|
||||
has_phrases!(|self:ArrangerTui|self.phrases.phrases);
|
||||
|
||||
impl HasPhraseList for ArrangerTui {
|
||||
fn phrases_focused (&self) -> bool {
|
||||
|
|
|
|||
|
|
@ -282,15 +282,7 @@ impl TransportControl<SequencerFocus> for SequencerTui {
|
|||
}
|
||||
|
||||
has_clock!(|self:SequencerTui|&self.clock);
|
||||
|
||||
impl HasPhrases for SequencerTui {
|
||||
fn phrases (&self) -> &Vec<Arc<RwLock<Phrase>>> {
|
||||
&self.phrases.phrases
|
||||
}
|
||||
fn phrases_mut (&mut self) -> &mut Vec<Arc<RwLock<Phrase>>> {
|
||||
&mut self.phrases.phrases
|
||||
}
|
||||
}
|
||||
has_phrases!(|self:SequencerTui|self.phrases.phrases);
|
||||
|
||||
impl HasPhraseList for SequencerTui {
|
||||
fn phrases_focused (&self) -> bool {
|
||||
|
|
|
|||
|
|
@ -180,14 +180,7 @@ impl From<&Arc<RwLock<Phrase>>> for PhraseListModel {
|
|||
}
|
||||
}
|
||||
|
||||
impl HasPhrases for PhraseListModel {
|
||||
fn phrases (&self) -> &Vec<Arc<RwLock<Phrase>>> {
|
||||
&self.phrases
|
||||
}
|
||||
fn phrases_mut (&mut self) -> &mut Vec<Arc<RwLock<Phrase>>> {
|
||||
&mut self.phrases
|
||||
}
|
||||
}
|
||||
has_phrases!(|self:PhraseListModel|self.phrases);
|
||||
|
||||
impl HasPhrase for PhraseListModel {
|
||||
fn phrase (&self) -> &Arc<RwLock<Phrase>> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue