diff --git a/deps/tengri b/deps/tengri index ecae2082..090546b2 160000 --- a/deps/tengri +++ b/deps/tengri @@ -1 +1 @@ -Subproject commit ecae2082edf1f3aa4ae048625c24a00f5fb13e56 +Subproject commit 090546b2d6fba3beb69b8ff65b30e5492d8a7b66 diff --git a/device/arranger.rs b/device/arranger.rs index 4206c369..af479133 100644 --- a/device/arranger.rs +++ b/device/arranger.rs @@ -371,8 +371,8 @@ impl Arrangement { } pub(crate) fn wrap (bg: Color, fg: Color, content: impl Content) -> impl Content { - let left = Tui::fg_bg(bg, Reset, Fixed::X(1, RepeatV("▐"))); - let right = Tui::fg_bg(bg, Reset, Fixed::X(1, RepeatV("▌"))); + let left = Tui::fg_bg(bg, Reset, Fixed::X(1, Repeat::Y("▐"))); + let right = Tui::fg_bg(bg, Reset, Fixed::X(1, Repeat::Y("▌"))); Bsp::e(left, Bsp::w(right, Tui::fg_bg(fg, bg, content))) } diff --git a/device/clip.rs b/device/clip.rs index ac0ca95b..0d503641 100644 --- a/device/clip.rs +++ b/device/clip.rs @@ -186,16 +186,16 @@ pub trait ClipsView: let w = if self.selection().track() == Some(track_index) && let Some(editor) = self.editor () { - editor.width().max(24).max(track.width) + (editor.measure_width() as usize).max(24).max(track.width) } else { track.width } as u16; let y = if self.selection().scene() == Some(scene_index) && let Some(editor) = self.editor () { - editor.height().max(12) + (editor.measure_height() as usize).max(12) } else { - Self::H_SCENE + Self::H_SCENE as usize } as u16; to.place(&Fixed::XY(w, y, Bsp::b( diff --git a/device/editor.rs b/device/editor.rs index 20bd1b1f..72098c52 100644 --- a/device/editor.rs +++ b/device/editor.rs @@ -170,8 +170,12 @@ impl MidiEditor { } } -impl Draw for MidiEditor { fn draw (&self, to: &mut TuiOut) { self.content().draw(to) } } -impl Layout for MidiEditor { fn layout (&self, to: [u16;4]) -> [u16;4] { self.content().layout(to) } } +impl Draw for MidiEditor { + fn draw (&self, to: &mut TuiOut) { self.content().draw(to) } +} +impl Layout for MidiEditor { + fn layout (&self, to: XYWH) -> XYWH { self.content().layout(to) } +} impl HasContent for MidiEditor { fn content (&self) -> impl Content { self.autoscroll(); /*self.autozoom();*/ self.size.of(&self.mode) } } @@ -267,8 +271,12 @@ pub(crate) fn note_y_iter (note_lo: usize, note_hi: usize, y0: u16) (note_lo..=note_hi).rev().enumerate().map(move|(y, n)|(y, y0 + y as u16, n)) } -impl Draw for PianoHorizontal { fn draw (&self, to: &mut TuiOut) { self.content().draw(to) } } -impl Layout for PianoHorizontal { fn layout (&self, to: [u16;4]) -> [u16;4] { self.content().layout(to) } } +impl Draw for PianoHorizontal { + fn draw (&self, to: &mut TuiOut) { self.content().draw(to) } +} +impl Layout for PianoHorizontal { + fn layout (&self, to: XYWH) -> XYWH { self.content().layout(to) } +} impl HasContent for PianoHorizontal { fn content (&self) -> impl Content { Bsp::s( @@ -357,7 +365,7 @@ impl PianoHorizontal { let buffer = self.buffer.clone(); Thunk::new(move|to: &mut TuiOut|{ let source = buffer.read().unwrap(); - let [x0, y0, w, _h] = to.area().xywh(); + let XYWH(x0, y0, w, _h) = to.area(); //if h as usize != note_axis { //panic!("area height mismatch: {h} <> {note_axis}"); //} @@ -391,7 +399,7 @@ impl PianoHorizontal { let time_zoom = self.get_time_zoom(); let style = Some(Style::default().fg(self.color.lightest.rgb)); Thunk::new(move|to: &mut TuiOut|{ - let [x0, y0, w, _] = to.area().xywh(); + let XYWH(x0, y0, w, _) = to.area(); for (_area_y, screen_y, note) in note_y_iter(note_lo, note_hi, y0) { if note == note_pos { for x in 0..w { @@ -422,7 +430,7 @@ impl PianoHorizontal { let off_style = Some(Style::default().fg(Tui::g(255))); let on_style = Some(Style::default().fg(Rgb(255,0,0)).bg(color.base.rgb).bold()); Fill::Y(Fixed::X(self.keys_width, Thunk::new(move|to: &mut TuiOut|{ - let [x, y0, _w, _h] = to.area().xywh(); + let XYWH(x, y0, _w, _h) = to.area(); for (_area_y, screen_y, note) in note_y_iter(note_lo, note_hi, y0) { to.blit(&to_key(note), x, screen_y, key_style); if note > 127 { @@ -438,7 +446,7 @@ impl PianoHorizontal { } fn timeline (&self) -> impl Content + '_ { Fill::X(Fixed::Y(1, Thunk::new(move|to: &mut TuiOut|{ - let [x, y, w, _h] = to.area(); + let XYWH(x, y, w, _h) = to.area(); let style = Some(Style::default().dim()); let length = self.clip.as_ref().map(|p|p.read().unwrap().length).unwrap_or(1); for (area_x, screen_x) in (0..w).map(|d|(d, d+x)) { diff --git a/device/sampler.rs b/device/sampler.rs index 77aea1b2..c4905944 100644 --- a/device/sampler.rs +++ b/device/sampler.rs @@ -760,9 +760,9 @@ impl Sampler { let lo_fg = Color::Rgb(64, 64, 64); let lo_bg = if y == 7 { Color::Reset } else { tx_bg }; Fixed::XY(w, h, Bsp::s( - Fixed::Y(1, Tui::fg_bg(hi_fg, hi_bg, RepeatH(Phat::<()>::LO))), + Fixed::Y(1, Tui::fg_bg(hi_fg, hi_bg, Repeat::X(Phat::<()>::LO))), Bsp::n( - Fixed::Y(1, Tui::fg_bg(lo_fg, lo_bg, RepeatH(Phat::<()>::HI))), + Fixed::Y(1, Tui::fg_bg(lo_fg, lo_bg, Repeat::X(Phat::<()>::HI))), Fill::X(Fixed::Y(1, Tui::fg_bg(tx_fg, tx_bg, name))), ), )) @@ -883,7 +883,7 @@ fn draw_list_item (sample: &Option>>) -> String { fn draw_viewer (sample: Option<&Arc>>) -> impl Content + use<'_> { let min_db = -64.0; Thunk::new(move|to: &mut TuiOut|{ - let [x, y, width, height] = to.area(); + let XYWH(x, y, width, height) = to.area(); let area = Rect { x, y, width, height }; if let Some(sample) = &sample { let sample = sample.read().unwrap(); diff --git a/device/scene.rs b/device/scene.rs index 271daa5d..3de97989 100644 --- a/device/scene.rs +++ b/device/scene.rs @@ -108,7 +108,7 @@ pub trait ScenesView: } else { Self::H_SCENE }; - if y + height <= self.clips_size().h() { + if y + height <= self.clips_size().h() as u16 { let data = (s, scene, y, y + height); y += height; Some(data) diff --git a/device/sequencer.rs b/device/sequencer.rs index 46c93cd3..c12a263f 100644 --- a/device/sequencer.rs +++ b/device/sequencer.rs @@ -388,7 +388,7 @@ pub trait MidiRecord: MidiMonitor + HasClock + HasPlayClip { } } -pub trait MidiViewer: HasSize + MidiRange + MidiPoint + Debug + Send + Sync { +pub trait MidiViewer: Measured + MidiRange + MidiPoint + Debug + Send + Sync { fn buffer_size (&self, clip: &MidiClip) -> (usize, usize); fn redraw (&self); fn clip (&self) -> &Option>>; diff --git a/device/track.rs b/device/track.rs index c583381c..15b38dcf 100644 --- a/device/track.rs +++ b/device/track.rs @@ -188,7 +188,7 @@ pub trait TracksView: ScenesView + HasMidiIns + HasMidiOuts + - HasSize + + Measured + HasTrackScroll + HasSelection + HasEditor +