mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
wip: reenable dynamic dispatch
This commit is contained in:
parent
600d0b3aca
commit
ac3827b8f3
11 changed files with 997 additions and 194 deletions
|
|
@ -1,6 +1,12 @@
|
|||
use crate::*;
|
||||
use super::*;
|
||||
use std::marker::ConstParamTy;
|
||||
render!(Tui: (self: Groovebox) => self.size.of(
|
||||
Bsp::s(self.toolbar_view(),
|
||||
Bsp::n(self.selector_view(),
|
||||
Bsp::n(self.sample_view(),
|
||||
Bsp::n(self.status_view(),
|
||||
Bsp::w(self.pool_view(), Fill::xy(Bsp::e(self.sampler_view(), &self.editor)))))))));
|
||||
|
||||
const GROOVEBOX_EDN: &'static str = include_str!("groovebox.edn");
|
||||
|
||||
|
|
@ -9,12 +15,6 @@ impl Content<Tui> for Groovebox {
|
|||
EdnView::parse(self.edn.as_slice())
|
||||
}
|
||||
}
|
||||
//render!(Tui: (self: Groovebox) => self.size.of(
|
||||
//Bsp::s(self.toolbar_view(),
|
||||
//Bsp::n(self.selector_view(),
|
||||
//Bsp::n(self.sample_view(),
|
||||
//Bsp::n(self.status_view(),
|
||||
//Bsp::w(self.pool_view(), Fill::xy(Bsp::e(self.sampler_view(), &self.editor)))))))));
|
||||
|
||||
macro_rules! edn_context {
|
||||
($Struct:ident |$l:lifetime, $state:ident| {
|
||||
|
|
@ -61,34 +61,39 @@ macro_rules! edn_context {
|
|||
}
|
||||
|
||||
edn_context!(Groovebox |'a, state| {
|
||||
":input-meter-l" = input_meter_l: Meter<'a> => Meter("L/", state.sampler.input_meter[0]),
|
||||
":input-meter-r" = input_meter_r: Meter<'a> => Meter("R/", state.sampler.input_meter[1]),
|
||||
|
||||
":transport" = transport: TransportView<'a> => TransportView::new(true, &state.player.clock),
|
||||
|
||||
":clip-play" = clip_play: ClipSelected => ClipSelected::play_phrase(&state.player),
|
||||
":clip-next" = clip_next: ClipSelected => ClipSelected::next_phrase(&state.player),
|
||||
":clip-edit" = clip_edit: MidiEditClip<'a> => MidiEditClip(&state.editor),
|
||||
|
||||
":edit-stat" = edit_stat: MidiEditStatus<'a> => MidiEditStatus(&state.editor),
|
||||
|
||||
":sample-h" = sample_h: u16 => if state.compact { 0 } else { 5 },
|
||||
":sample-view" = sample_view: SampleViewer => SampleViewer::from_sampler(
|
||||
&state.sampler, state.editor.note_point()),
|
||||
":sample-stat" = sample_stat: SamplerStatus<'a> => SamplerStatus(
|
||||
&state.sampler, state.editor.note_point()),
|
||||
|
||||
":input-meter-l" = input_meter_l: Meter<'a> =>
|
||||
Meter("L/", state.sampler.input_meter[0]),
|
||||
":input-meter-r" = input_meter_r: Meter<'a> =>
|
||||
Meter("R/", state.sampler.input_meter[1]),
|
||||
":transport" = transport: TransportView<'a> =>
|
||||
TransportView::new(true, &state.player.clock),
|
||||
":clip-play" = clip_play: ClipSelected =>
|
||||
ClipSelected::play_phrase(&state.player),
|
||||
":clip-next" = clip_next: ClipSelected =>
|
||||
ClipSelected::next_phrase(&state.player),
|
||||
":clip-edit" = clip_edit: MidiEditClip<'a> =>
|
||||
MidiEditClip(&state.editor),
|
||||
":edit-stat" = edit_stat: MidiEditStatus<'a> =>
|
||||
MidiEditStatus(&state.editor),
|
||||
":sample-h" = sample_h: u16 =>
|
||||
if state.compact { 0 } else { 5 },
|
||||
":sample-view" = sample_view: SampleViewer =>
|
||||
SampleViewer::from_sampler(&state.sampler, state.editor.note_point()),
|
||||
":sample-stat" = sample_stat: SamplerStatus<'a> =>
|
||||
SamplerStatus(&state.sampler, state.editor.note_point()),
|
||||
":pool-w" = pool_w: u16 => if state.compact { 5 } else {
|
||||
let w = state.size.w();
|
||||
if w > 60 { 20 } else if w > 40 { 15 } else { 10 } },
|
||||
":pool-view" = pool_view: PoolView<'a> => PoolView(state.compact, &state.pool),
|
||||
|
||||
":samples-w" = samples_w: u16 => if state.compact { 4 } else { 11 },
|
||||
":samples-y" = samples_y: u16 => if state.compact { 1 } else { 0 },
|
||||
":pool-view" = pool_view: PoolView<'a> =>
|
||||
PoolView(state.compact, &state.pool),
|
||||
":samples-w" = samples_w: u16 =>
|
||||
if state.compact { 4 } else { 11 },
|
||||
":samples-y" = samples_y: u16 =>
|
||||
if state.compact { 1 } else { 0 },
|
||||
":samples-view" = samples_view: SampleList<'a> => SampleList::new(
|
||||
state.compact, &state.sampler, &state.editor),
|
||||
|
||||
":midi-view" = midi_view: &'a MidiEditor => &state.editor,
|
||||
":midi-view" = midi_view: &'a MidiEditor =>
|
||||
&state.editor,
|
||||
});
|
||||
|
||||
//impl Groovebox {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue