mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
add Measure::of
This commit is contained in:
parent
6b073988c2
commit
5b57f2b998
4 changed files with 21 additions and 54 deletions
|
|
@ -65,6 +65,9 @@ impl<E: Engine> Measure<E> {
|
||||||
y: Arc::new(0.into()),
|
y: Arc::new(0.into()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
pub fn of <T: Content<E>> (&self, item: T) -> Bsp<E, Fill<E, &Self>, T> {
|
||||||
|
Bsp::b(Fill::xy(&self), item)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///// A scrollable area.
|
///// A scrollable area.
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ has_size!(<Tui>|self: MidiEditor|&self.size);
|
||||||
render!(Tui: (self: MidiEditor) => {
|
render!(Tui: (self: MidiEditor) => {
|
||||||
self.autoscroll();
|
self.autoscroll();
|
||||||
self.autozoom();
|
self.autozoom();
|
||||||
Fill::xy(Tui::bg(Color::Black, Bsp::b(&self.size, &self.mode)))
|
Fill::xy(Bsp::b(&self.size, &self.mode))
|
||||||
});
|
});
|
||||||
|
|
||||||
impl MidiView<Tui> for MidiEditor {}
|
impl MidiView<Tui> for MidiEditor {}
|
||||||
|
|
|
||||||
|
|
@ -11,67 +11,30 @@ render!(Tui: (self: PianoHorizontal) => {
|
||||||
} else {
|
} else {
|
||||||
(ItemPalette::from(TuiTheme::g(64)), String::new(), 0, false)
|
(ItemPalette::from(TuiTheme::g(64)), String::new(), 0, false)
|
||||||
};
|
};
|
||||||
//let field = move|x, y|row!(
|
let field = move|x, y|row!(
|
||||||
//Tui::fg_bg(color.lighter.rgb, color.darker.rgb, Tui::bold(true, x)),
|
Tui::fg_bg(color.lighter.rgb, color.darker.rgb, Tui::bold(true, x)),
|
||||||
//Tui::fg_bg(color.lighter.rgb, color.dark.rgb, y),
|
Tui::fg_bg(color.lighter.rgb, color.dark.rgb, y),
|
||||||
//);
|
|
||||||
let keys_width = 5;
|
|
||||||
let keys = move||PianoHorizontalKeys(self);
|
|
||||||
let timeline = move||PianoHorizontalTimeline(self);
|
|
||||||
let notes = move||PianoHorizontalNotes(self);
|
|
||||||
let cursor = move||PianoHorizontalCursor(self);
|
|
||||||
let status = move||row!(
|
|
||||||
//" ",
|
|
||||||
row!("Edit:", name.to_string()), " ",
|
|
||||||
row!("Length:", length.to_string()), " ",
|
|
||||||
row!("Loop:", looped.to_string())
|
|
||||||
);
|
);
|
||||||
Bsp::s(
|
Bsp::s(
|
||||||
Fixed::y(1, status()),
|
Fixed::y(1, row!(
|
||||||
|
field("Edit:", name.to_string()), " ",
|
||||||
|
field("Length:", length.to_string()), " ",
|
||||||
|
field("Loop:", looped.to_string())
|
||||||
|
)),
|
||||||
Bsp::s(
|
Bsp::s(
|
||||||
Fixed::y(1, Bsp::e(
|
Fixed::y(1, Bsp::e(
|
||||||
Fixed::x(self.keys_width, ""),
|
Fixed::x(self.keys_width, ""),
|
||||||
Fill::x(timeline()),
|
Fill::x(PianoHorizontalTimeline(self)),
|
||||||
)),
|
)),
|
||||||
Fill::xy(Bsp::e(
|
Fill::xy(Bsp::e(
|
||||||
Fixed::x(self.keys_width, keys()),
|
Fixed::x(self.keys_width, PianoHorizontalKeys(self)),
|
||||||
Fill::xy("test")
|
Fill::xy(self.size.of(lay!(
|
||||||
//Fill::xy(lay!(
|
Fill::xy(PianoHorizontalNotes(self)),
|
||||||
//&self.size,
|
Fill::xy(PianoHorizontalCursor(self)),
|
||||||
//Fill::xy(lay!(
|
))),
|
||||||
//Fill::xy(notes()),
|
|
||||||
//Fill::xy(cursor()),
|
|
||||||
//))
|
|
||||||
//)),
|
|
||||||
)),
|
)),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
//"kyp"
|
|
||||||
//Outer(Style::default().fg(self.color.dark.rgb).bg(self.color.darkest.rgb)).enclose("kyp");
|
|
||||||
//with_border(lay!(
|
|
||||||
//row!(
|
|
||||||
////" ",
|
|
||||||
//field("Edit:", name.to_string()), " ",
|
|
||||||
//field("Length:", length.to_string()), " ",
|
|
||||||
//field("Loop:", looped.to_string())
|
|
||||||
//)),
|
|
||||||
//Padding::xy(0, 1, Fill::xy(Bsp::s(
|
|
||||||
//Fixed::y(1, Bsp::e(
|
|
||||||
//Fixed::x(self.keys_width, ""),
|
|
||||||
//Fill::x(timeline()),
|
|
||||||
//)),
|
|
||||||
//Bsp::e(
|
|
||||||
//Fixed::x(self.keys_width, keys()),
|
|
||||||
//Fill::xy(lay!(
|
|
||||||
//&self.size,
|
|
||||||
//Fill::xy(lay!(
|
|
||||||
//Fill::xy(notes()),
|
|
||||||
//Fill::xy(cursor()),
|
|
||||||
//))
|
|
||||||
//)),
|
|
||||||
//),
|
|
||||||
//)))
|
|
||||||
//))
|
|
||||||
});
|
});
|
||||||
|
|
||||||
impl PianoHorizontal {
|
impl PianoHorizontal {
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,14 @@ pub struct PianoHorizontalNotes<'a>(pub(crate) &'a PianoHorizontal);
|
||||||
|
|
||||||
render!(Tui: |self: PianoHorizontalNotes<'a>, render|{
|
render!(Tui: |self: PianoHorizontalNotes<'a>, render|{
|
||||||
let time_start = self.0.time_start().get();
|
let time_start = self.0.time_start().get();
|
||||||
|
let note_axis = self.0.note_axis().get();
|
||||||
let note_lo = self.0.note_lo().get();
|
let note_lo = self.0.note_lo().get();
|
||||||
let note_hi = self.0.note_hi();
|
let note_hi = self.0.note_hi();
|
||||||
let note_point = self.0.note_point();
|
let note_point = self.0.note_point();
|
||||||
let source = &self.0.buffer;
|
let source = &self.0.buffer;
|
||||||
let [x0, y0, w, h] = render.area().xywh();
|
let [x0, y0, w, h] = render.area().xywh();
|
||||||
if h as usize != self.0.note_axis().get() {
|
if h as usize != note_axis {
|
||||||
panic!("area height mismatch");
|
panic!("area height mismatch: {h} <> {note_axis}");
|
||||||
}
|
}
|
||||||
for (area_x, screen_x) in (x0..x0+w).enumerate() {
|
for (area_x, screen_x) in (x0..x0+w).enumerate() {
|
||||||
for (area_y, screen_y, note) in note_y_iter(note_lo, note_hi, y0) {
|
for (area_y, screen_y, note) in note_y_iter(note_lo, note_hi, y0) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue