fix(device): last 8 left to full compile?
Some checks are pending
/ build (push) Waiting to run

This commit is contained in:
stop screaming 2026-02-20 00:55:20 +02:00
parent 82ff49b386
commit 2d7ca155e0
7 changed files with 38 additions and 29 deletions

View file

@ -314,13 +314,13 @@ impl Arrangement {
#[cfg(feature = "scene")] #[cfg(feature = "scene")]
impl ScenesView for Arrangement { impl ScenesView for Arrangement {
fn h_scenes (&self) -> u16 { fn h_scenes (&self) -> u16 {
(self.height() as u16).saturating_sub(20) (self.measure_height() as u16).saturating_sub(20)
} }
fn w_side (&self) -> u16 { fn w_side (&self) -> u16 {
(self.width() as u16 * 2 / 10).max(20) (self.measure_width() as u16 * 2 / 10).max(20)
} }
fn w_mid (&self) -> u16 { fn w_mid (&self) -> u16 {
(self.width() as u16).saturating_sub(2 * self.w_side()).max(40) (self.measure_width() as u16).saturating_sub(2 * self.w_side()).max(40)
} }
} }

View file

@ -53,15 +53,7 @@ impl Browse {
files.push((name, format!("📄 {decoded}"))); files.push((name, format!("📄 {decoded}")));
} }
} }
Ok(Self { Ok(Self { cwd, dirs, files, ..Default::default() })
cwd,
dirs,
files,
filter: "".to_string(),
index: 0,
scroll: 0,
size: Measure::new(),
})
} }
pub fn len (&self) -> usize { pub fn len (&self) -> usize {

View file

@ -1,5 +1,23 @@
use crate::*; use crate::*;
impl<T: Has<Option<MidiEditor>>> HasEditor for T {}
pub trait HasEditor: Has<Option<MidiEditor>> {
fn editor (&self) -> Option<&MidiEditor> {
self.get().as_ref()
}
fn editor_mut (&mut self) -> Option<&mut MidiEditor> {
self.get_mut().as_mut()
}
fn is_editing (&self) -> bool {
self.editor().is_some()
}
fn editor_w (&self) -> usize {
self.editor().map(|e|e.size.w()).unwrap_or(0) as usize
}
fn editor_h (&self) -> usize {
self.editor().map(|e|e.size.h()).unwrap_or(0) as usize
}
}
#[macro_export] macro_rules! has_editor { #[macro_export] macro_rules! has_editor {
(|$self:ident: $Struct:ident|{ (|$self:ident: $Struct:ident|{
editor = $e0:expr; editor = $e0:expr;
@ -16,14 +34,6 @@ use crate::*;
} }
}; };
} }
impl<T: Has<Option<MidiEditor>>> HasEditor for T {}
pub trait HasEditor: Has<Option<MidiEditor>> {
fn editor (&self) -> Option<&MidiEditor> { self.get().as_ref() }
fn editor_mut (&mut self) -> Option<&mut MidiEditor> { self.get_mut().as_mut() }
fn is_editing (&self) -> bool { self.editor().is_some() }
fn editor_w (&self) -> usize { self.editor().map(|e|e.size.w()).unwrap_or(0) }
fn editor_h (&self) -> usize { self.editor().map(|e|e.size.h()).unwrap_or(0) }
}
/// Contains state for viewing and editing a clip /// Contains state for viewing and editing a clip
pub struct MidiEditor { pub struct MidiEditor {
@ -34,7 +44,14 @@ pub struct MidiEditor {
} }
has!(Measure<TuiOut>: |self: MidiEditor|self.size); has!(Measure<TuiOut>: |self: MidiEditor|self.size);
impl Default for MidiEditor { fn default () -> Self { Self { size: Measure::new(), mode: PianoHorizontal::new(None), } } } impl Default for MidiEditor {
fn default () -> Self {
Self {
size: Measure::new(0, 0),
mode: PianoHorizontal::new(None),
}
}
}
impl std::fmt::Debug for MidiEditor { impl std::fmt::Debug for MidiEditor {
fn fmt (&self, f: &mut Formatter<'_>) -> std::result::Result<(), std::fmt::Error> { fn fmt (&self, f: &mut Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
f.debug_struct("MidiEditor").field("mode", &self.mode).finish() f.debug_struct("MidiEditor").field("mode", &self.mode).finish()
@ -247,7 +264,7 @@ has!(Measure<TuiOut>:|self:PianoHorizontal|self.size);
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(); let size = Measure::new(0, 0);
let mut range = MidiRangeModel::from((12, true)); let mut range = MidiRangeModel::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

@ -135,7 +135,7 @@ audio!(|self: Lv2, _client, scope|{
impl Draw<TuiOut> for Lv2 { impl Draw<TuiOut> for Lv2 {
fn draw (&self, to: &mut TuiOut) { fn draw (&self, to: &mut TuiOut) {
let area = to.area(); let area = to.area();
let [x, y, _, height] = area; let XYWH(x, y, _, height) = area;
let mut width = 20u16; let mut width = 20u16;
let start = self.selected.saturating_sub((height as usize / 2).saturating_sub(1)); let start = self.selected.saturating_sub((height as usize / 2).saturating_sub(1));
let end = start + height as usize - 2; let end = start + height as usize - 2;

View file

@ -12,7 +12,7 @@ pub struct Log10Meter(pub f32);
impl Layout<TuiOut> for Log10Meter {} impl Layout<TuiOut> for Log10Meter {}
impl Draw<TuiOut> for Log10Meter { impl Draw<TuiOut> for Log10Meter {
fn draw (&self, to: &mut TuiOut) { fn draw (&self, to: &mut TuiOut) {
let [x, y, w, h] = to.area(); let XYWH(x, y, w, h) = to.area();
let signal = 100.0 - f32::max(0.0, f32::min(100.0, self.0.abs())); let signal = 100.0 - f32::max(0.0, f32::min(100.0, self.0.abs()));
let v = (signal * h as f32 / 100.0).ceil() as u16; let v = (signal * h as f32 / 100.0).ceil() as u16;
let y2 = y + h; let y2 = y + h;
@ -36,7 +36,7 @@ pub struct RmsMeter(pub f32);
impl Layout<TuiOut> for RmsMeter {} impl Layout<TuiOut> for RmsMeter {}
impl Draw<TuiOut> for RmsMeter { impl Draw<TuiOut> for RmsMeter {
fn draw (&self, to: &mut TuiOut) { fn draw (&self, to: &mut TuiOut) {
let [x, y, w, h] = to.area(); let XYWH(x, y, w, h) = to.area();
let signal = f32::max(0.0, f32::min(100.0, self.0.abs())); let signal = f32::max(0.0, f32::min(100.0, self.0.abs()));
let v = (signal * h as f32).ceil() as u16; let v = (signal * h as f32).ceil() as u16;
let y2 = y + h; let y2 = y + h;

View file

@ -108,7 +108,7 @@ pub trait ScenesView:
} else { } else {
Self::H_SCENE Self::H_SCENE
}; };
if y + height <= self.clips_size().h() as u16 { if y + height <= self.clips_size().h() as usize {
let data = (s, scene, y, y + height); let data = (s, scene, y, y + height);
y += height; y += height;
Some(data) Some(data)

View file

@ -195,16 +195,16 @@ pub trait TracksView:
HasClipsSize HasClipsSize
{ {
fn tracks_width_available (&self) -> u16 { fn tracks_width_available (&self) -> u16 {
(self.width() as u16).saturating_sub(40) (self.measure_width() as u16).saturating_sub(40)
} }
/// Iterate over tracks with their corresponding sizes. /// Iterate over tracks with their corresponding sizes.
fn tracks_with_sizes (&self) -> impl TracksSizes<'_> { fn tracks_with_sizes (&self) -> impl TracksSizes<'_> {
let _editor_width = self.editor().map(|e|e.width()); let _editor_width = self.editor().map(|e|e.measure_width());
let _active_track = self.selection().track(); let _active_track = self.selection().track();
let mut x = 0; let mut x = 0;
self.tracks().iter().enumerate().map_while(move |(index, track)|{ self.tracks().iter().enumerate().map_while(move |(index, track)|{
let width = track.width.max(8); let width = track.width.max(8);
if x + width < self.clips_size().w() { if x + width < self.clips_size().w() as usize {
let data = (index, track, x, x + width); let data = (index, track, x, x + width);
x += width + Self::TRACK_SPACING; x += width + Self::TRACK_SPACING;
Some(data) Some(data)