55e...
Some checks failed
/ build (push) Has been cancelled

This commit is contained in:
okay stopped screaming 2026-03-22 00:36:09 +02:00
parent 9ef63324af
commit 2fd5fbaaf9
5 changed files with 27 additions and 27 deletions

View file

@ -20,9 +20,9 @@ impl HasJack<'static> for Arrangement { fn jack (&self) -> &Jack<'static> { &sel
/// TODO rename to "render_cache" or smth /// TODO rename to "render_cache" or smth
pub arranger: Arc<RwLock<Buffer>>, pub arranger: Arc<RwLock<Buffer>>,
/// Display size /// Display size
pub size: Measure<Tui>, pub size: [AtomicUsize; 2],
/// Display size of clips area /// Display size of clips area
pub size_inner: Measure<Tui>, pub size_inner: [AtomicUsize; 2],
/// Source of time /// Source of time
#[cfg(feature = "clock")] pub clock: Clock, #[cfg(feature = "clock")] pub clock: Clock,
/// Allows one MIDI clip to be edited /// 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!(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<Track>: |self: Arrangement| self.tracks);
impl_has!(Vec<Scene>: |self: Arrangement| self.scenes); impl_has!(Vec<Scene>: |self: Arrangement| self.scenes);
impl_has!(Vec<MidiInput>: |self: Arrangement| self.midi_ins); 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_ref_opt!(Track: |self: Arrangement| self.selected_track());
impl_as_mut_opt!(Track: |self: Arrangement| self.selected_track_mut()); 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<Scene>>+AsMut<Vec<Scene>>> HasScenes for T {}
impl <T: AsRef<Vec<Track>>+AsMut<Vec<Track>>> HasTracks 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<Scene>+AsMutOpt<Scene>+Send+Sync> HasScene for T {}
impl <T: AsRefOpt<Track>+AsMutOpt<Track>+Send+Sync> HasTrack 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: ScenesView+HasMidiIns+HasMidiOuts+HasTrackScroll> TracksView for T {}
impl <T: TracksView+ScenesView+Send+Sync> ClipsView for T {} impl <T: TracksView+ScenesView+Send+Sync> ClipsView for T {}
pub trait ClipsView: TracksView + ScenesView { 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 { fn tracks_width_available (&self) -> u16 {
(self.measure_width() as u16).saturating_sub(40) (self.measure_width() as u16).saturating_sub(40)
@ -787,7 +787,7 @@ impl ScenesView for Arrangement {
} }
} }
impl HasClipsSize 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> = pub type SceneWith<'a, T> =

View file

@ -21,7 +21,7 @@ def_command!(FileBrowserCommand: |sampler: Sampler|{
pub filter: String, pub filter: String,
pub index: usize, pub index: usize,
pub scroll: usize, pub scroll: usize,
pub size: Measure<Tui>, pub size: [AtomicUsize; 2],
} }
pub(crate) struct EntriesIterator<'a> { pub(crate) struct EntriesIterator<'a> {

View file

@ -78,7 +78,7 @@ def_command!(SamplerCommand: |sampler: Sampler| {
/// Currently active modal, if any. /// Currently active modal, if any.
pub mode: Option<SamplerMode>, pub mode: Option<SamplerMode>,
/// Size of rendered sampler. /// Size of rendered sampler.
pub size: Measure<Tui>, pub size: [AtomicUsize;2],
/// Lowest note displayed. /// Lowest note displayed.
pub note_lo: AtomicUsize, pub note_lo: AtomicUsize,
/// Currently selected note. /// Currently selected note.

View file

@ -45,7 +45,7 @@ def_command!(MidiEditCommand: |editor: MidiEditor| {
/// ``` /// ```
pub struct MidiEditor { pub struct MidiEditor {
/// Size of editor on screen /// Size of editor on screen
pub size: Measure<Tui>, pub size: [AtomicUsize; 2],
/// View mode and state of editor /// View mode and state of editor
pub mode: PianoHorizontal, pub mode: PianoHorizontal,
} }
@ -60,13 +60,13 @@ pub struct MidiEditor {
/// Buffer where the whole clip is rerendered on change /// Buffer where the whole clip is rerendered on change
pub buffer: Arc<RwLock<BigBuffer>>, pub buffer: Arc<RwLock<BigBuffer>>,
/// Size of actual notes area /// Size of actual notes area
pub size: Measure<Tui>, pub size: [AtomicUsize; 2],
/// The display window /// The display window
pub range: MidiSelection, pub range: MidiSelection,
/// The note cursor /// The note cursor
pub point: MidiCursor, pub point: MidiCursor,
/// The highlight color palette /// The highlight color palette
pub color: ItemTheme, pub color: ItemTheme,
/// Width of the keyboard /// Width of the keyboard
pub keys_width: u16, pub keys_width: u16,
} }
@ -646,8 +646,8 @@ impl_has!(Sequencer: |self: Track| self.sequencer);
impl_has!(Clock: |self: Sequencer| self.clock); impl_has!(Clock: |self: Sequencer| self.clock);
impl_has!(Vec<MidiInput>: |self: Sequencer| self.midi_ins); impl_has!(Vec<MidiInput>: |self: Sequencer| self.midi_ins);
impl_has!(Vec<MidiOutput>: |self: Sequencer| self.midi_outs); impl_has!(Vec<MidiOutput>: |self: Sequencer| self.midi_outs);
impl_has!(Measure<Tui>: |self: MidiEditor| self.size); impl_has!([AtomicUsize; 2]: |self: MidiEditor| self.size);
impl_has!(Measure<Tui>: |self: PianoHorizontal| self.size); impl_has!([AtomicUsize; 2]: |self: PianoHorizontal| self.size);
impl_default!(Sequencer: Self { impl_default!(Sequencer: Self {
clock: Clock::default(), clock: Clock::default(),
play_clip: None, play_clip: None,
@ -890,7 +890,7 @@ impl_from!(MidiEditor: |clip: Option<Arc<RwLock<MidiClip>>>| {
model model
}); });
impl_default!(MidiEditor: Self { 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 { impl_default!(OctaveVertical: Self {
on: [false; 12], colors: [Rgb(255,255,255), Rgb(0,0,0), Rgb(255,0,0)] on: [false; 12], colors: [Rgb(255,255,255), Rgb(0,0,0), Rgb(255,0,0)]
@ -1040,7 +1040,7 @@ impl MidiEditor {
impl PianoHorizontal { impl PianoHorizontal {
pub fn new (clip: Option<&Arc<RwLock<MidiClip>>>) -> Self { 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)); let mut range = MidiSelection::from((12, true));
range.time_axis = size.x.clone(); range.time_axis = size.x.clone();
range.note_axis = size.y.clone(); range.note_axis = size.y.clone();

View file

@ -59,7 +59,7 @@ use clap::{self, Parser, Subcommand};
use builder_pattern::Builder; use builder_pattern::Builder;
use self::{ use self::{
arrange::*, clock::*, dialog::*, browse::*, select::*, sequence::*, device::*, arrange::*, clock::*, dialog::*, browse::*, select::*, sequence::*, device::*,
config::*, mode::*, view::*, bind::* config::*, mode::*, view::*, bind::*, sample::*, menu::*
}; };
extern crate xdg; extern crate xdg;
@ -588,7 +588,7 @@ pub(crate) const HEADER: &'static str = r#"
/// Must not be dropped for the duration of the process /// Must not be dropped for the duration of the process
pub jack: Jack<'static>, pub jack: Jack<'static>,
/// Display size /// Display size
pub size: Measure<Tui>, pub size: [AtomicUsize;2],
/// Performance counter /// Performance counter
pub perf: PerfModel, pub perf: PerfModel,
/// Available view modes and input bindings /// 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!(Vec<MidiOutput>: |self: App|self.project.midi_outs);
impl_has!(Dialog: |self: App|self.dialog); impl_has!(Dialog: |self: App|self.dialog);
impl_has!(Jack<'static>: |self: App|self.jack); 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!(Pool: |self: App|self.pool);
impl_has!(Selection: |self: App|self.project.selection); impl_has!(Selection: |self: App|self.project.selection);
impl_as_ref!(Vec<Scene>: |self: App|self.project.as_ref()); 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>> { pub trait HasDevices: AsRef<Vec<Device>> + AsMut<Vec<Device>> {
fn devices (&self) -> &Vec<Device> { self.as_ref() } 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 HasJack<'static> for App { fn jack (&self) -> &Jack<'static> { &self.jack } }
impl_default!(AppCommand: Self::Nop); impl_default!(AppCommand: Self::Nop);
primitive!(u8: try_to_u8); primitive!(u8: try_to_u8);