convert to layout suffixes

This commit is contained in:
i do not exist 2026-07-07 16:35:52 +03:00
parent 2d64f63741
commit d8a767326c
6 changed files with 245 additions and 230 deletions

View file

@ -27,8 +27,14 @@ impl_has!(Sizer: |self: PianoHorizontal| self.size);
impl View<Tui> for PianoHorizontal {
fn view (&self) -> impl Draw<Tui> {
south(
east(w_exact(5, format!("{}x{}", self.size.w(), self.size.h())), self.timeline()),
east(self.keys(), self.size.of(below(wh_full(self.notes()), wh_full(self.cursor())))),
east(
format!("{}x{}", self.size.w(), self.size.h()).exact_w(5),
self.timeline()
),
east(
self.keys(),
self.size.of(below(self.notes().full_wh(), self.cursor().full_wh()))
),
)
}
}
@ -203,7 +209,7 @@ impl PianoHorizontal {
let key_style = Some(Style::default().fg(Rgb(192, 192, 192)).bg(Rgb(0, 0, 0)));
let off_style = Some(Style::default().fg(g(255)));
let on_style = Some(Style::default().fg(Rgb(255,0,0)).bg(color.base.term).bold());
h_full(w_exact(self.keys_width, thunk(move|to: &mut Tui|{
thunk(move|to: &mut Tui|{
let xywh = to.area().into();
let XYWH(x, y0, _w, _h) = xywh;
for (_area_y, screen_y, note) in note_y_iter(note_lo, note_hi, y0) {
@ -218,11 +224,11 @@ impl PianoHorizontal {
};
}
Ok(Some(xywh))
})))
}).exact_w(self.keys_width).full_h()
}
fn timeline (&self) -> impl Draw<Tui> + '_ {
w_full(h_exact(1, thunk(move|to: &mut Tui|{
thunk(move|to: &mut Tui|{
let xywh = to.area().into();
let XYWH(x, y, w, _h) = xywh;
let style = Some(Style::default().dim());
@ -234,7 +240,7 @@ impl PianoHorizontal {
}
}
Ok(Some(xywh))
})))
}).exact_h(1).full_w()
}
}