mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-09 05:06:43 +01:00
switch around ownership of pool and editort
This commit is contained in:
parent
3f1a2fee80
commit
c7e7c9f68c
8 changed files with 157 additions and 150 deletions
|
|
@ -10,6 +10,8 @@ pub struct Arrangement {
|
|||
pub jack: Jack,
|
||||
/// Source of time
|
||||
pub clock: Clock,
|
||||
/// Allows one MIDI clip to be edited
|
||||
pub editor: Option<MidiEditor>,
|
||||
/// List of global midi inputs
|
||||
pub midi_ins: Vec<JackMidiIn>,
|
||||
/// List of global midi outputs
|
||||
|
|
@ -35,18 +37,17 @@ pub struct Arrangement {
|
|||
pub arranger: Arc<RwLock<Buffer>>,
|
||||
/// Display size
|
||||
pub size: Measure<TuiOut>,
|
||||
/// Contains all clips in arrangement
|
||||
pub pool: Pool,
|
||||
}
|
||||
|
||||
has!(Jack: |self: Arrangement|self.jack);
|
||||
has!(Clock: |self: Arrangement|self.clock);
|
||||
has!(Selection: |self: Arrangement|self.selection);
|
||||
has!(Vec<JackMidiIn>: |self: Arrangement|self.midi_ins);
|
||||
has!(Vec<JackMidiOut>: |self: Arrangement|self.midi_outs);
|
||||
has!(Vec<Scene>: |self: Arrangement|self.scenes);
|
||||
has!(Vec<Track>: |self: Arrangement|self.tracks);
|
||||
has!(Measure<TuiOut>: |self: Arrangement|self.size);
|
||||
has!(Jack: |self: Arrangement|self.jack);
|
||||
has!(Clock: |self: Arrangement|self.clock);
|
||||
has!(Selection: |self: Arrangement|self.selection);
|
||||
has!(Vec<JackMidiIn>: |self: Arrangement|self.midi_ins);
|
||||
has!(Vec<JackMidiOut>: |self: Arrangement|self.midi_outs);
|
||||
has!(Vec<Scene>: |self: Arrangement|self.scenes);
|
||||
has!(Vec<Track>: |self: Arrangement|self.tracks);
|
||||
has!(Measure<TuiOut>: |self: Arrangement|self.size);
|
||||
has!(Option<MidiEditor>: |self: Arrangement|self.editor);
|
||||
maybe_has!(Track: |self: Arrangement|
|
||||
{ Has::<Selection>::get(self).track().map(|index|Has::<Vec<Track>>::get(self).get(index)).flatten() };
|
||||
{ Has::<Selection>::get(self).track().map(|index|Has::<Vec<Track>>::get_mut(self).get_mut(index)).flatten() });
|
||||
|
|
@ -215,19 +216,13 @@ impl ScenesView for Arrangement {
|
|||
fn arrangement (&self) -> &Arrangement {
|
||||
self
|
||||
}
|
||||
fn scenes_height (&self) -> u16 {
|
||||
fn h_scenes (&self) -> u16 {
|
||||
(self.height() as u16).saturating_sub(20)
|
||||
}
|
||||
fn width_side (&self) -> u16 {
|
||||
fn w_side (&self) -> u16 {
|
||||
(self.width() as u16 * 2 / 10).max(20)
|
||||
}
|
||||
fn width_mid (&self) -> u16 {
|
||||
(self.width() as u16).saturating_sub(2 * self.width_side()).max(40)
|
||||
}
|
||||
fn scene_selected (&self) -> Option<usize> {
|
||||
self.selection().scene()
|
||||
}
|
||||
fn track_selected (&self) -> Option<usize> {
|
||||
self.selection().track()
|
||||
fn w_mid (&self) -> u16 {
|
||||
(self.width() as u16).saturating_sub(2 * self.w_side()).max(40)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue