mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +01:00
unify edn_view entrypoint
This commit is contained in:
parent
df50bb9f47
commit
9cd6e9f195
16 changed files with 603 additions and 541 deletions
0
midi/src/midi-view.edn
Normal file
0
midi/src/midi-view.edn
Normal file
|
|
@ -7,11 +7,25 @@ pub trait HasEditor {
|
|||
fn editor_h (&self) -> usize { 0 }
|
||||
}
|
||||
#[macro_export] macro_rules! has_editor {
|
||||
(|$self:ident: $Struct:ident|{
|
||||
editor = $e0:expr;
|
||||
editor_w = $e1:expr;
|
||||
editor_h = $e2:expr;
|
||||
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_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 }
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
/// Contains state for viewing and editing a clip
|
||||
pub struct MidiEditor {
|
||||
|
|
@ -32,7 +46,7 @@ impl Default for MidiEditor {
|
|||
mode: PianoHorizontal::new(None),
|
||||
size: Measure::new(),
|
||||
keymap: EdnKeymap(
|
||||
EdnItem::<String>::read_all(include_str!("../edn/midi-keys.edn"))
|
||||
EdnItem::<String>::read_all(include_str!("midi_editor_keys.edn"))
|
||||
.expect("failed to load keymap for MidiEditor")
|
||||
)
|
||||
}
|
||||
|
|
|
|||
20
midi/src/midi_editor_keys.edn
Normal file
20
midi/src/midi_editor_keys.edn
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
(:enter add :false)
|
||||
(:shift-enter add :true)
|
||||
(:del del :false)
|
||||
(:shift-del del :true)
|
||||
(:comma note/length :prev-note-length)
|
||||
(:period note/length :next-note-length)
|
||||
(:plus note/range :next-note-range)
|
||||
(:underscore note/range :prev-note-range)
|
||||
(:up note/point :next-note-point)
|
||||
(:down note/point :prev-note-point)
|
||||
(:left time/point :next-time-point)
|
||||
(:right time/point :prev-time-point)
|
||||
(:z time/lock :next-time-lock)
|
||||
(:equal time/zoom :next-time-zoom)
|
||||
(:minus time/zoom :prev-time-zoom)
|
||||
(:space clock/play :play-current)
|
||||
(:shift-space clock/play :play-start)
|
||||
(:u history :history-prev)
|
||||
(:r history :history-next)
|
||||
(:tab compact :next-compact)
|
||||
0
midi/src/piano-view-h.edn
Normal file
0
midi/src/piano-view-h.edn
Normal file
0
midi/src/piano-view-v.edn
Normal file
0
midi/src/piano-view-v.edn
Normal file
13
midi/src/pool-keys.edn
Normal file
13
midi/src/pool-keys.edn
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
(:n clip/rename/begin)
|
||||
(:t clip/length/begin)
|
||||
(:m clip/import/begin)
|
||||
(:x clip/export/begin)
|
||||
(:c clip/color/random)
|
||||
(:bracket-open clip/select/prev)
|
||||
(:bracket-close clip/select/next)
|
||||
(:lt clip/move/prev)
|
||||
(:gt clip/move/next)
|
||||
(:del clip/delete)
|
||||
(:shift-a clip/add)
|
||||
(:i clip/insert)
|
||||
(:d clip/duplicate)
|
||||
Loading…
Add table
Add a link
Reference in a new issue