8200s territory

This commit is contained in:
🪞👃🪞 2024-12-19 20:29:37 +01:00
parent 69bc8e69fd
commit f921260f6f
4 changed files with 20 additions and 50 deletions

View file

@ -1,5 +1,4 @@
use crate::*;
#[derive(Debug)]
pub struct Mixer {
/// JACK client handle (needs to not be dropped for standalone mode to work).
@ -9,15 +8,8 @@ pub struct Mixer {
pub selected_track: usize,
pub selected_column: usize,
}
pub struct MixerAudio {
model: Arc<RwLock<Mixer>>
}
impl From<&Arc<RwLock<Mixer>>> for MixerAudio {
fn from (model: &Arc<RwLock<Mixer>>) -> Self {
Self { model: model.clone() }
}
}
from!(|mode: &Arc<RwLock<Mixer>>| MixerAudio = Self { model: model.clone() });
audio!(|self: MixerAudio, _, _|Control::Continue);

View file

@ -147,12 +147,7 @@ pub enum TransportFocus {
Clock,
Quant,
}
impl From<&TransportTui> for Option<TransportFocus> {
fn from (state: &TransportTui) -> Self {
Some(state.focus.inner())
}
}
from!(|state: &TransportTui|Option<TransportTui> = Some(state.focus.inner()));
impl FocusWrap<TransportFocus> for TransportFocus {
fn wrap <'a, W: Render<Tui>> (self, focus: TransportFocus, content: &'a W)

View file

@ -1,5 +1,4 @@
use crate::*;
pub struct ArrangerVColSep {
cols: Vec<(usize, usize)>,
scenes_w: u16,
@ -19,21 +18,14 @@ render!(<Tui>|self: ArrangerVColSep|render(move|to: &mut TuiOutput|{
}
})
}));
pub struct ArrangerVRowSep {
rows: Vec<(usize, usize)>,
sep_fg: Color,
}
impl From<(&ArrangerTui, usize)> for ArrangerVRowSep {
fn from ((state, factor): (&ArrangerTui, usize)) -> Self {
Self {
rows: ArrangerScene::ppqs(state.scenes(), factor),
sep_fg: TuiTheme::separator_fg(false),
}
}
}
from!(|args:(&ArrangerTui, usize)|ArrangerVRowSep = Self {
rows: ArrangerScene::ppqs(args.0.scenes(), args.1),
sep_fg: TuiTheme::separator_fg(false),
});
render!(<Tui>|self: ArrangerVRowSep|render(move|to: &mut TuiOutput|{
Ok(for y in self.rows.iter().map(|row|row.1) {
let y = to.area().y() + (y / PPQ) as u16 + 1;
@ -47,7 +39,6 @@ render!(<Tui>|self: ArrangerVRowSep|render(move|to: &mut TuiOutput|{
}
})
}));
pub struct ArrangerVCursor {
cols: Vec<(usize, usize)>,
rows: Vec<(usize, usize)>,
@ -56,20 +47,14 @@ pub struct ArrangerVCursor {
scenes_w: u16,
header_h: u16,
}
impl From<(&ArrangerTui, usize)> for ArrangerVCursor {
fn from ((state, factor): (&ArrangerTui, usize)) -> Self {
Self {
cols: track_widths(state.tracks()),
rows: ArrangerScene::ppqs(state.scenes(), factor),
focused: true,
selected: state.selected,
scenes_w: 3 + ArrangerScene::longest_name(state.scenes()) as u16,
header_h: 3,
}
}
}
from!(|args:(&ArrangerTui, usize)|ArrangerVCursor = Self {
cols: track_widths(state.tracks()),
rows: ArrangerScene::ppqs(args.0.scenes(), args.1),
focused: true,
selected: state.selected,
scenes_w: 3 + ArrangerScene::longest_name(state.scenes()) as u16,
header_h: 3,
});
render!(<Tui>|self: ArrangerVCursor|render(move|to: &mut TuiOutput|{
let area = to.area();
let focused = self.focused;

View file

@ -167,14 +167,12 @@ impl Default for PhraseListModel {
}
}
}
impl From<&Arc<RwLock<Phrase>>> for PhraseListModel {
fn from (phrase: &Arc<RwLock<Phrase>>) -> Self {
let mut model = Self::default();
model.phrases.push(phrase.clone());
model.phrase.store(1, Relaxed);
model
}
}
from!(|phrase:<&Arc<RwLock<Phrase>>>| PhraseListModel = {
let mut model = Self::default();
model.phrases.push(phrase.clone());
model.phrase.store(1, Relaxed);
model
});
has_phrases!(|self:PhraseListModel|self.phrases);
has_phrase!(|self:PhraseListModel|self.phrases[self.phrase_index()]);
impl PhraseListModel {