mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
wip: switch piano to Bsp components
This commit is contained in:
parent
6cc81acd70
commit
8861dab9db
2 changed files with 22 additions and 37 deletions
|
|
@ -17,15 +17,15 @@ pub enum Bsp<E: Engine, X: Render<E>, Y: Render<E>> {
|
|||
Null(PhantomData<E>),
|
||||
}
|
||||
|
||||
render!(|self:Bsp<E: Engine, X: Render<E>, Y: Render<E>>|match self {
|
||||
Bsp::Null(_) => { () },
|
||||
Bsp::N(a, b) => { todo!("") },
|
||||
Bsp::S(a, b) => { todo!("") },
|
||||
Bsp::E(a, b) => { todo!("") },
|
||||
Bsp::W(a, b) => { todo!("") },
|
||||
Bsp::A(a, b) => { todo!("") },
|
||||
Bsp::B(a, b) => { todo!("") },
|
||||
});
|
||||
render!(|self:Bsp<E: Engine, X: Render<E>, Y: Render<E>>|render(|to|{Ok(match self {
|
||||
Bsp::Null(_) => (),
|
||||
Bsp::N(a, b) => (),
|
||||
Bsp::S(a, b) => (),
|
||||
Bsp::E(a, b) => (),
|
||||
Bsp::W(a, b) => (),
|
||||
Bsp::A(a, b) => (),
|
||||
Bsp::B(a, b) => (),
|
||||
})}));
|
||||
|
||||
impl<E: Engine, X: Render<E>, Y: Render<E>> Bsp<E, X, Y> {
|
||||
pub fn new (x: X) -> Self { Self::A(Some(x), None) }
|
||||
|
|
|
|||
|
|
@ -48,34 +48,19 @@ render!(|self: PianoHorizontal|{
|
|||
let time_point = self.point.time_point();
|
||||
let note_point = self.point.note_point();
|
||||
let note_len = self.point.note_len();
|
||||
let timeline = move||PianoHorizontalTimeline {
|
||||
color,
|
||||
time_start,
|
||||
time_zoom,
|
||||
};
|
||||
let notes = move||PianoHorizontalNotes {
|
||||
source: &self.buffer,
|
||||
time_start,
|
||||
note_hi,
|
||||
};
|
||||
let cursor = move||PianoHorizontalCursor {
|
||||
time_zoom,
|
||||
time_point,
|
||||
time_start,
|
||||
note_point: note_point,
|
||||
note_len: note_len,
|
||||
note_hi: note_hi,
|
||||
note_lo: note_lo,
|
||||
};
|
||||
let keys = move||PianoHorizontalKeys {
|
||||
color: self.color,
|
||||
note_lo,
|
||||
note_hi,
|
||||
note_point: Some(note_point),
|
||||
};
|
||||
Tui::fill_xy(Tui::bg(bg, Tui::split_s(false, 1,
|
||||
Tui::fill_x(Tui::push_x(5, timeline())),
|
||||
Tui::split_e(true, 5, Tui::debug(lay!([&self.size, notes(), cursor()])), keys()),
|
||||
let keys = move||PianoHorizontalKeys { color, note_lo, note_hi, note_point: Some(note_point), };
|
||||
let timeline = move||PianoHorizontalTimeline { color, time_start, time_zoom, };
|
||||
let notes = move||PianoHorizontalNotes { source: &self.buffer, time_start, note_hi, };
|
||||
let cursor = move||PianoHorizontalCursor { time_zoom, time_point, time_start, note_point, note_len, note_hi, note_lo, };
|
||||
let keys_width = 5;
|
||||
Tui::fill_xy(Tui::bg(bg, Bsp::s(
|
||||
Tui::fill_x(Tui::push_x(keys_width, timeline())),
|
||||
Bsp::w(
|
||||
Tui::shrink_x(keys_width,
|
||||
Tui::fill_x(Tui::debug(lay!([&self.size, notes(), cursor()]))),
|
||||
),
|
||||
Tui::fixed_x(keys_width, keys())
|
||||
),
|
||||
)))
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue