mirror of
https://codeberg.org/unspeaker/tek.git
synced 2026-08-28 21:06:56 +02:00
wip: simplify and document
This commit is contained in:
parent
701a651fbd
commit
b9e7b9732e
12 changed files with 116 additions and 72 deletions
|
|
@ -19,12 +19,12 @@ pub struct MidiEditor {
|
|||
/// View mode and state of editor
|
||||
pub mode: PianoHorizontal,
|
||||
/// Size of editor on screen
|
||||
pub size: Size,
|
||||
pub size: Sizer,
|
||||
}
|
||||
|
||||
impl_default!(MidiEditor: Self {
|
||||
mode: PianoHorizontal::new(None),
|
||||
size: Size(
|
||||
size: Sizer(
|
||||
Arc::new(0usize.into()),
|
||||
Arc::new(0usize.into()),
|
||||
),
|
||||
|
|
@ -255,13 +255,7 @@ pub trait MidiViewer: MidiRange + MidiPoint + Debug + Send + Sync {
|
|||
}
|
||||
}
|
||||
|
||||
impl_has!(Size: |self: MidiEditor| self.size);
|
||||
|
||||
impl Draw<Tui> for MidiEditor {
|
||||
fn draw (self, to: &mut Tui) -> Usually<XYWH<u16>> {
|
||||
self.mode.tui().draw(to)
|
||||
}
|
||||
}
|
||||
impl_has!(Sizer: |self: MidiEditor| self.size);
|
||||
|
||||
impl std::fmt::Debug for MidiEditor {
|
||||
fn fmt (&self, f: &mut Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
|
||||
|
|
@ -303,7 +297,7 @@ impl View<Tui> for MidiEditor {
|
|||
fn view (&self) -> impl Draw<Tui> {
|
||||
self.autoscroll();
|
||||
/*self.autozoom();*/
|
||||
self.size.of(&self.mode)
|
||||
self.size.of(self.mode.view())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue