mirror of
https://codeberg.org/unspeaker/tek.git
synced 2026-04-03 21:00:44 +02:00
parent
9ef63324af
commit
2fd5fbaaf9
5 changed files with 27 additions and 27 deletions
|
|
@ -20,9 +20,9 @@ impl HasJack<'static> for Arrangement { fn jack (&self) -> &Jack<'static> { &sel
|
|||
/// TODO rename to "render_cache" or smth
|
||||
pub arranger: Arc<RwLock<Buffer>>,
|
||||
/// Display size
|
||||
pub size: Measure<Tui>,
|
||||
pub size: [AtomicUsize; 2],
|
||||
/// Display size of clips area
|
||||
pub size_inner: Measure<Tui>,
|
||||
pub size_inner: [AtomicUsize; 2],
|
||||
/// Source of time
|
||||
#[cfg(feature = "clock")] pub clock: Clock,
|
||||
/// Allows one MIDI clip to be edited
|
||||
|
|
@ -84,7 +84,7 @@ impl HasJack<'static> for Arrangement { fn jack (&self) -> &Jack<'static> { &sel
|
|||
}
|
||||
|
||||
impl_has!(Jack<'static>: |self: Arrangement| self.jack);
|
||||
impl_has!(Measure<Tui>: |self: Arrangement| self.size);
|
||||
impl_has!([AtomicUsize; 2]: |self: Arrangement| self.size);
|
||||
impl_has!(Vec<Track>: |self: Arrangement| self.tracks);
|
||||
impl_has!(Vec<Scene>: |self: Arrangement| self.scenes);
|
||||
impl_has!(Vec<MidiInput>: |self: Arrangement| self.midi_ins);
|
||||
|
|
@ -96,12 +96,12 @@ impl_as_mut_opt!(MidiEditor: |self: Arrangement| self.editor.as_mut());
|
|||
impl_as_ref_opt!(Track: |self: Arrangement| self.selected_track());
|
||||
impl_as_mut_opt!(Track: |self: Arrangement| self.selected_track_mut());
|
||||
|
||||
impl <T: AsRef<Vec<Scene>>+AsMut<Vec<Scene>>> HasScenes for T {}
|
||||
impl <T: AsRef<Vec<Track>>+AsMut<Vec<Track>>> HasTracks for T {}
|
||||
impl <T: AsRefOpt<Scene>+AsMutOpt<Scene>+Send+Sync> HasScene for T {}
|
||||
impl <T: AsRefOpt<Track>+AsMutOpt<Track>+Send+Sync> HasTrack for T {}
|
||||
impl <T: ScenesView+HasMidiIns+HasMidiOuts+HasTrackScroll+Measured<Tui>> TracksView for T {}
|
||||
impl <T: TracksView+ScenesView+Send+Sync> ClipsView for T {}
|
||||
impl <T: AsRef<Vec<Scene>>+AsMut<Vec<Scene>>> HasScenes for T {}
|
||||
impl <T: AsRef<Vec<Track>>+AsMut<Vec<Track>>> HasTracks for T {}
|
||||
impl <T: AsRefOpt<Scene>+AsMutOpt<Scene>+Send+Sync> HasScene for T {}
|
||||
impl <T: AsRefOpt<Track>+AsMutOpt<Track>+Send+Sync> HasTrack for T {}
|
||||
impl <T: ScenesView+HasMidiIns+HasMidiOuts+HasTrackScroll> TracksView for T {}
|
||||
impl <T: TracksView+ScenesView+Send+Sync> ClipsView for T {}
|
||||
|
||||
pub trait ClipsView: TracksView + ScenesView {
|
||||
|
||||
|
|
@ -173,7 +173,7 @@ pub trait ClipsView: TracksView + ScenesView {
|
|||
|
||||
}
|
||||
|
||||
pub trait TracksView: ScenesView + HasMidiIns + HasMidiOuts + HasTrackScroll + Measured<Tui> {
|
||||
pub trait TracksView: ScenesView + HasMidiIns + HasMidiOuts + HasTrackScroll {
|
||||
|
||||
fn tracks_width_available (&self) -> u16 {
|
||||
(self.measure_width() as u16).saturating_sub(40)
|
||||
|
|
@ -787,7 +787,7 @@ impl ScenesView for Arrangement {
|
|||
}
|
||||
}
|
||||
impl HasClipsSize for Arrangement {
|
||||
fn clips_size (&self) -> &Measure<Tui> { &self.size_inner }
|
||||
fn clips_size (&self) -> &[AtomicUsize; 2] { &self.size_inner }
|
||||
}
|
||||
|
||||
pub type SceneWith<'a, T> =
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ def_command!(FileBrowserCommand: |sampler: Sampler|{
|
|||
pub filter: String,
|
||||
pub index: usize,
|
||||
pub scroll: usize,
|
||||
pub size: Measure<Tui>,
|
||||
pub size: [AtomicUsize; 2],
|
||||
}
|
||||
|
||||
pub(crate) struct EntriesIterator<'a> {
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ def_command!(SamplerCommand: |sampler: Sampler| {
|
|||
/// Currently active modal, if any.
|
||||
pub mode: Option<SamplerMode>,
|
||||
/// Size of rendered sampler.
|
||||
pub size: Measure<Tui>,
|
||||
pub size: [AtomicUsize;2],
|
||||
/// Lowest note displayed.
|
||||
pub note_lo: AtomicUsize,
|
||||
/// Currently selected note.
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ def_command!(MidiEditCommand: |editor: MidiEditor| {
|
|||
/// ```
|
||||
pub struct MidiEditor {
|
||||
/// Size of editor on screen
|
||||
pub size: Measure<Tui>,
|
||||
pub size: [AtomicUsize; 2],
|
||||
/// View mode and state of editor
|
||||
pub mode: PianoHorizontal,
|
||||
}
|
||||
|
|
@ -60,13 +60,13 @@ pub struct MidiEditor {
|
|||
/// Buffer where the whole clip is rerendered on change
|
||||
pub buffer: Arc<RwLock<BigBuffer>>,
|
||||
/// Size of actual notes area
|
||||
pub size: Measure<Tui>,
|
||||
pub size: [AtomicUsize; 2],
|
||||
/// The display window
|
||||
pub range: MidiSelection,
|
||||
pub range: MidiSelection,
|
||||
/// The note cursor
|
||||
pub point: MidiCursor,
|
||||
pub point: MidiCursor,
|
||||
/// The highlight color palette
|
||||
pub color: ItemTheme,
|
||||
pub color: ItemTheme,
|
||||
/// Width of the keyboard
|
||||
pub keys_width: u16,
|
||||
}
|
||||
|
|
@ -646,8 +646,8 @@ impl_has!(Sequencer: |self: Track| self.sequencer);
|
|||
impl_has!(Clock: |self: Sequencer| self.clock);
|
||||
impl_has!(Vec<MidiInput>: |self: Sequencer| self.midi_ins);
|
||||
impl_has!(Vec<MidiOutput>: |self: Sequencer| self.midi_outs);
|
||||
impl_has!(Measure<Tui>: |self: MidiEditor| self.size);
|
||||
impl_has!(Measure<Tui>: |self: PianoHorizontal| self.size);
|
||||
impl_has!([AtomicUsize; 2]: |self: MidiEditor| self.size);
|
||||
impl_has!([AtomicUsize; 2]: |self: PianoHorizontal| self.size);
|
||||
impl_default!(Sequencer: Self {
|
||||
clock: Clock::default(),
|
||||
play_clip: None,
|
||||
|
|
@ -890,7 +890,7 @@ impl_from!(MidiEditor: |clip: Option<Arc<RwLock<MidiClip>>>| {
|
|||
model
|
||||
});
|
||||
impl_default!(MidiEditor: Self {
|
||||
size: Measure::new(0, 0), mode: PianoHorizontal::new(None)
|
||||
size: [0, 0].into(), mode: PianoHorizontal::new(None)
|
||||
});
|
||||
impl_default!(OctaveVertical: Self {
|
||||
on: [false; 12], colors: [Rgb(255,255,255), Rgb(0,0,0), Rgb(255,0,0)]
|
||||
|
|
@ -1040,7 +1040,7 @@ impl MidiEditor {
|
|||
|
||||
impl PianoHorizontal {
|
||||
pub fn new (clip: Option<&Arc<RwLock<MidiClip>>>) -> Self {
|
||||
let size = Measure::new(0, 0);
|
||||
let size = [0, 0].into();
|
||||
let mut range = MidiSelection::from((12, true));
|
||||
range.time_axis = size.x.clone();
|
||||
range.note_axis = size.y.clone();
|
||||
|
|
|
|||
10
src/tek.rs
10
src/tek.rs
|
|
@ -59,7 +59,7 @@ use clap::{self, Parser, Subcommand};
|
|||
use builder_pattern::Builder;
|
||||
use self::{
|
||||
arrange::*, clock::*, dialog::*, browse::*, select::*, sequence::*, device::*,
|
||||
config::*, mode::*, view::*, bind::*
|
||||
config::*, mode::*, view::*, bind::*, sample::*, menu::*
|
||||
};
|
||||
|
||||
extern crate xdg;
|
||||
|
|
@ -588,7 +588,7 @@ pub(crate) const HEADER: &'static str = r#"
|
|||
/// Must not be dropped for the duration of the process
|
||||
pub jack: Jack<'static>,
|
||||
/// Display size
|
||||
pub size: Measure<Tui>,
|
||||
pub size: [AtomicUsize;2],
|
||||
/// Performance counter
|
||||
pub perf: PerfModel,
|
||||
/// Available view modes and input bindings
|
||||
|
|
@ -611,7 +611,7 @@ impl_has!(Vec<MidiInput>: |self: App|self.project.midi_ins);
|
|||
impl_has!(Vec<MidiOutput>: |self: App|self.project.midi_outs);
|
||||
impl_has!(Dialog: |self: App|self.dialog);
|
||||
impl_has!(Jack<'static>: |self: App|self.jack);
|
||||
impl_has!(Measure<Tui>: |self: App|self.size);
|
||||
impl_has!([AtomicUsize;2]: |self: App|self.size);
|
||||
impl_has!(Pool: |self: App|self.pool);
|
||||
impl_has!(Selection: |self: App|self.project.selection);
|
||||
impl_as_ref!(Vec<Scene>: |self: App|self.project.as_ref());
|
||||
|
|
@ -688,7 +688,7 @@ namespace!(App: Option<Arc<RwLock<MidiClip>>> {
|
|||
};
|
||||
});
|
||||
|
||||
pub trait HasClipsSize { fn clips_size (&self) -> &Measure<Tui>; }
|
||||
pub trait HasClipsSize { fn clips_size (&self) -> &[AtomicUsize;2]; }
|
||||
|
||||
pub trait HasDevices: AsRef<Vec<Device>> + AsMut<Vec<Device>> {
|
||||
fn devices (&self) -> &Vec<Device> { self.as_ref() }
|
||||
|
|
@ -965,7 +965,7 @@ impl Draw<Tui> for App {
|
|||
}
|
||||
}
|
||||
}
|
||||
impl HasClipsSize for App { fn clips_size (&self) -> &Measure<Tui> { &self.project.size_inner } }
|
||||
impl HasClipsSize for App { fn clips_size (&self) -> &[AtomicUsize;2] { &self.project.size_inner } }
|
||||
impl HasJack<'static> for App { fn jack (&self) -> &Jack<'static> { &self.jack } }
|
||||
impl_default!(AppCommand: Self::Nop);
|
||||
primitive!(u8: try_to_u8);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue