mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-11 14:16:42 +01:00
update layout macro invocations
This commit is contained in:
parent
e677d1d7d4
commit
83eb9dd2fa
19 changed files with 153 additions and 169 deletions
|
|
@ -2,22 +2,19 @@ use crate::*;
|
|||
|
||||
pub struct MidiEditStatus<'a>(pub &'a MidiEditor);
|
||||
render!(Tui: (self:MidiEditStatus<'a>) => {
|
||||
|
||||
let (color, name, length, looped) = if let Some(phrase) = self.0.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.light.rgb, color.darker.rgb, Tui::bold(true, "│")),
|
||||
Tui::fg_bg(color.lightest.rgb, color.dark.rgb, &y),
|
||||
]);
|
||||
|
||||
);
|
||||
let bg = color.darkest.rgb;
|
||||
let fg = color.lightest.rgb;
|
||||
Tui::bg(bg, Fill::x(Tui::fg(fg, row!([
|
||||
Tui::bg(bg, Fill::x(Tui::fg(fg, row!(
|
||||
field(" Time", format!("{}/{}-{} ({}*{}) {}",
|
||||
self.0.time_point(), self.0.time_start().get(), self.0.time_end(),
|
||||
self.0.time_axis().get(), self.0.time_zoom().get(),
|
||||
|
|
@ -27,7 +24,7 @@ render!(Tui: (self:MidiEditStatus<'a>) => {
|
|||
self.0.note_point(), to_note_name(self.0.note_point()), self.0.note_len(),
|
||||
to_note_name(self.0.note_lo().get()), to_note_name(self.0.note_hi()),
|
||||
self.0.note_axis().get()))
|
||||
]))))
|
||||
))))
|
||||
});
|
||||
|
||||
/// Status bar for sequencer app
|
||||
|
|
@ -50,21 +47,21 @@ from!(|state:&SequencerTui|SequencerStatus = {
|
|||
size: format!("{}x{}│", width, state.size.h()),
|
||||
}
|
||||
});
|
||||
render!(Tui: (self: SequencerStatus) => Fixed::y(2, lay!([
|
||||
render!(Tui: (self: SequencerStatus) => Fixed::y(2, lay!(
|
||||
Self::help(),
|
||||
Fill::xy(Align::se(Tui::fg_bg(TuiTheme::orange(), TuiTheme::g(25), self.stats()))),
|
||||
])));
|
||||
)));
|
||||
impl SequencerStatus {
|
||||
fn help () -> impl Content<Tui> {
|
||||
let single = |binding, command|row!([" ", col!([
|
||||
let single = |binding, command|row!(" ", col!(
|
||||
Tui::fg(TuiTheme::yellow(), binding),
|
||||
command
|
||||
])]);
|
||||
let double = |(b1, c1), (b2, c2)|col!([
|
||||
row!([" ", Tui::fg(TuiTheme::yellow(), b1), " ", c1,]),
|
||||
row!([" ", Tui::fg(TuiTheme::yellow(), b2), " ", c2,]),
|
||||
]);
|
||||
Tui::fg_bg(TuiTheme::g(255), TuiTheme::g(50), row!([
|
||||
));
|
||||
let double = |(b1, c1), (b2, c2)|col!(
|
||||
row!(" ", Tui::fg(TuiTheme::yellow(), b1), " ", c1,),
|
||||
row!(" ", Tui::fg(TuiTheme::yellow(), b2), " ", c2,),
|
||||
);
|
||||
Tui::fg_bg(TuiTheme::g(255), TuiTheme::g(50), row!(
|
||||
single("SPACE", "play/pause"),
|
||||
double(("▲▼▶◀", "cursor"), ("Ctrl", "scroll"), ),
|
||||
double(("a", "append"), ("s", "set note"),),
|
||||
|
|
@ -72,10 +69,10 @@ impl SequencerStatus {
|
|||
double(("[]", "phrase"), ("{}", "order"), ),
|
||||
double(("q", "enqueue"), ("e", "edit"), ),
|
||||
double(("c", "color"), ("", ""),),
|
||||
]))
|
||||
))
|
||||
}
|
||||
fn stats (&self) -> impl Content<Tui> + use<'_> {
|
||||
row!([&self.cpu, &self.size])
|
||||
row!(&self.cpu, &self.size)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -99,10 +96,10 @@ from!(|state: &Groovebox|GrooveboxStatus = {
|
|||
size: format!("{}x{}│", width, state.size.h()),
|
||||
}
|
||||
});
|
||||
render!(Tui: (self: GrooveboxStatus) => Fixed::y(2, lay!([
|
||||
render!(Tui: (self: GrooveboxStatus) => Fixed::y(2, lay!(
|
||||
Self::help(),
|
||||
Fill::xy(Align::se(Tui::fg_bg(TuiTheme::orange(), TuiTheme::g(25), self.stats()))),
|
||||
])));
|
||||
)));
|
||||
impl GrooveboxStatus {
|
||||
fn help () -> impl Content<Tui> {
|
||||
let single = |binding, command|row!(" ", col!(
|
||||
|
|
@ -148,21 +145,21 @@ from!(|state:&ArrangerTui|ArrangerStatus = {
|
|||
size: format!("{}x{}│", width, state.size.h()),
|
||||
}
|
||||
});
|
||||
render!(Tui: (self: ArrangerStatus) => Fixed::y(2, lay!([
|
||||
render!(Tui: (self: ArrangerStatus) => Fixed::y(2, lay!(
|
||||
Self::help(),
|
||||
Fill::xy(Align::se(Tui::fg_bg(TuiTheme::orange(), TuiTheme::g(25), self.stats()))),
|
||||
])));
|
||||
)));
|
||||
impl ArrangerStatus {
|
||||
fn help () -> impl Content<Tui> {
|
||||
let single = |binding, command|row!([" ", col!([
|
||||
let single = |binding, command|row!(" ", col!(
|
||||
Tui::fg(TuiTheme::yellow(), binding),
|
||||
command
|
||||
])]);
|
||||
let double = |(b1, c1), (b2, c2)|col!([
|
||||
row!([" ", Tui::fg(TuiTheme::yellow(), b1), " ", c1,]),
|
||||
row!([" ", Tui::fg(TuiTheme::yellow(), b2), " ", c2,]),
|
||||
]);
|
||||
Tui::fg_bg(TuiTheme::g(255), TuiTheme::g(50), row!([
|
||||
));
|
||||
let double = |(b1, c1), (b2, c2)|col!(
|
||||
row!(" ", Tui::fg(TuiTheme::yellow(), b1), " ", c1,),
|
||||
row!(" ", Tui::fg(TuiTheme::yellow(), b2), " ", c2,),
|
||||
);
|
||||
Tui::fg_bg(TuiTheme::g(255), TuiTheme::g(50), row!(
|
||||
single("SPACE", "play/pause"),
|
||||
single(" Ctrl", " scroll"),
|
||||
single(" ▲▼▶◀", " cell"),
|
||||
|
|
@ -172,9 +169,9 @@ impl ArrangerStatus {
|
|||
double(("a", "append"), ("s", "set"),),
|
||||
double((",.", "length"), ("<>", "triplet"),),
|
||||
double(("[]", "phrase"), ("{}", "order"),),
|
||||
]))
|
||||
))
|
||||
}
|
||||
fn stats (&self) -> impl Content<Tui> + use<'_> {
|
||||
row!([&self.cpu, &self.size])
|
||||
row!(&self.cpu, &self.size)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue