wip: fix: 15 errors left here

This commit is contained in:
stop screaming 2026-02-20 00:50:15 +02:00
parent bba1f41ed5
commit 82ff49b386
8 changed files with 28 additions and 20 deletions

View file

@ -371,8 +371,8 @@ impl Arrangement {
}
pub(crate) fn wrap (bg: Color, fg: Color, content: impl Content<TuiOut>) -> impl Content<TuiOut> {
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)))
}

View file

@ -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(

View file

@ -170,8 +170,12 @@ impl MidiEditor {
}
}
impl Draw<TuiOut> for MidiEditor { fn draw (&self, to: &mut TuiOut) { self.content().draw(to) } }
impl Layout<TuiOut> for MidiEditor { fn layout (&self, to: [u16;4]) -> [u16;4] { self.content().layout(to) } }
impl Draw<TuiOut> for MidiEditor {
fn draw (&self, to: &mut TuiOut) { self.content().draw(to) }
}
impl Layout<TuiOut> for MidiEditor {
fn layout (&self, to: XYWH<u16>) -> XYWH<u16> { self.content().layout(to) }
}
impl HasContent<TuiOut> for MidiEditor {
fn content (&self) -> impl Content<TuiOut> { 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<TuiOut> for PianoHorizontal { fn draw (&self, to: &mut TuiOut) { self.content().draw(to) } }
impl Layout<TuiOut> for PianoHorizontal { fn layout (&self, to: [u16;4]) -> [u16;4] { self.content().layout(to) } }
impl Draw<TuiOut> for PianoHorizontal {
fn draw (&self, to: &mut TuiOut) { self.content().draw(to) }
}
impl Layout<TuiOut> for PianoHorizontal {
fn layout (&self, to: XYWH<u16>) -> XYWH<u16> { self.content().layout(to) }
}
impl HasContent<TuiOut> for PianoHorizontal {
fn content (&self) -> impl Content<TuiOut> {
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<TuiOut> + '_ {
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)) {

View file

@ -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<Arc<RwLock<Sample>>>) -> String {
fn draw_viewer (sample: Option<&Arc<RwLock<Sample>>>) -> impl Content<TuiOut> + 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();

View file

@ -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)

View file

@ -388,7 +388,7 @@ pub trait MidiRecord: MidiMonitor + HasClock + HasPlayClip {
}
}
pub trait MidiViewer: HasSize<TuiOut> + MidiRange + MidiPoint + Debug + Send + Sync {
pub trait MidiViewer: Measured<TuiOut> + MidiRange + MidiPoint + Debug + Send + Sync {
fn buffer_size (&self, clip: &MidiClip) -> (usize, usize);
fn redraw (&self);
fn clip (&self) -> &Option<Arc<RwLock<MidiClip>>>;

View file

@ -188,7 +188,7 @@ pub trait TracksView:
ScenesView +
HasMidiIns +
HasMidiOuts +
HasSize<TuiOut> +
Measured<TuiOut> +
HasTrackScroll +
HasSelection +
HasEditor +