sweeeeping sweep

This commit is contained in:
🪞👃🪞 2024-12-31 04:12:09 +01:00
parent c9b09b7dea
commit e677d1d7d4
38 changed files with 766 additions and 691 deletions

View file

@ -6,7 +6,6 @@ use self::piano_h_cursor::*;
mod piano_h_keys;
pub(crate) use self::piano_h_keys::*;
pub use self::piano_h_keys::render_keys_v;
mod piano_h_notes; use self::piano_h_notes::*;
@ -54,38 +53,30 @@ impl PianoHorizontal {
}
}
render!(<Tui>|self: PianoHorizontal|{
render!(Tui: (self: PianoHorizontal) => {
let (color, name, length, looped) = if let Some(phrase) = self.phrase().as_ref().map(|p|p.read().unwrap()) {
(phrase.color, phrase.name.clone(), phrase.length, phrase.looped)
} else {
(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.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 border = Fill::xy(Outer(Style::default().fg(self.color.dark.rgb).bg(self.color.darkest.rgb)));
let with_border = |x|lay!([border, Padding::xy(0, 0, &x)]);
with_border(lay!([
Push::x(0, row!(![
with_border(lay!(
Push::x(0, 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, ""),
@ -95,14 +86,14 @@ render!(<Tui>|self: PianoHorizontal|{
Fixed::x(self.keys_width, keys()),
Fill::xy(lay!([
&self.size,
Fill::xy(lay!([
Fill::xy(lay!(
Fill::xy(notes()),
Fill::xy(cursor()),
]))
))
])),
),
)))
]))
))
});
impl PianoHorizontal {