mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-09 05:06:43 +01:00
down to 48 ugly ones
This commit is contained in:
parent
57eff50973
commit
4fe51b5267
9 changed files with 104 additions and 101 deletions
|
|
@ -102,8 +102,8 @@ impl MidiViewer for MidiEditor {
|
|||
}
|
||||
|
||||
pub trait HasEditor {
|
||||
fn editor (&self) -> &Option<MidiEditor>;
|
||||
fn editor_mut (&mut self) -> &Option<MidiEditor>;
|
||||
fn editor (&self) -> Option<&MidiEditor>;
|
||||
fn editor_mut (&mut self) -> Option<&mut MidiEditor>;
|
||||
fn is_editing (&self) -> bool { true }
|
||||
fn editor_w (&self) -> usize { 0 }
|
||||
fn editor_h (&self) -> usize { 0 }
|
||||
|
|
@ -117,17 +117,12 @@ pub trait HasEditor {
|
|||
is_editing = $e3:expr;
|
||||
}) => {
|
||||
impl HasEditor for $Struct {
|
||||
fn editor (&$self) -> &Option<MidiEditor> { &$e0 }
|
||||
fn editor_mut (&mut $self) -> &Option<MidiEditor> { &mut $e0 }
|
||||
fn editor (&$self) -> Option<&MidiEditor> { $e0.as_ref() }
|
||||
fn editor_mut (&mut $self) -> Option<&mut MidiEditor> { $e0.as_mut() }
|
||||
fn editor_w (&$self) -> usize { $e1 }
|
||||
fn editor_h (&$self) -> usize { $e2 }
|
||||
fn is_editing (&$self) -> bool { $e3 }
|
||||
}
|
||||
};
|
||||
(|$self:ident:$Struct:ident$(<$($L:lifetime),*$($T:ident$(:$U:path)?),*>)?|$cb:expr) => {
|
||||
impl $(<$($L),*$($T $(: $U)?),*>)? HasEditor for $Struct $(<$($L),*$($T),*>)? {
|
||||
fn editor (&$self) -> &MidiEditor { &$cb }
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue