wip11 (4e)

This commit is contained in:
🪞👃🪞 2024-12-09 21:06:39 +01:00
parent 06dab6d0d7
commit 83e64a3a10
3 changed files with 62 additions and 30 deletions

View file

@ -23,7 +23,7 @@ mod ctrl_transport; pub(crate) use ctrl_transport::*;
mod model_arranger; pub(crate) use model_arranger::*; mod model_arranger; pub(crate) use model_arranger::*;
//// ////////////////////////////////////////////////////////
mod model_clock; pub(crate) use model_clock::*; mod model_clock; pub(crate) use model_clock::*;

View file

@ -117,8 +117,8 @@ impl_focus!(SequencerTui SequencerFocus [
/// Status bar for sequencer app /// Status bar for sequencer app
#[derive(Clone)] #[derive(Clone)]
pub struct SequencerStatusBar { pub struct SequencerStatusBar {
pub(crate) cpu: Option<String>,
pub(crate) width: usize, pub(crate) width: usize,
pub(crate) cpu: Option<String>,
pub(crate) size: String, pub(crate) size: String,
pub(crate) res: String, pub(crate) res: String,
pub(crate) mode: &'static str, pub(crate) mode: &'static str,

View file

@ -31,9 +31,36 @@ render!(|self: SequencerTui|{
render!(|self: SequencerStatusBar|{ render!(|self: SequencerStatusBar|{
let orange = Color::Rgb(255,128,0); lay!(|add|if self.width > 60 {
add(&row!(![
SequencerMode::from(self),
SequencerStats::from(self),
]))
} else if self.width > 0 {
add(&col!(![
SequencerMode::from(self),
SequencerStats::from(self),
]))
} else {
Ok(())
})
let modeline = { });
struct SequencerMode {
mode: &'static str,
help: &'static [(&'static str, &'static str, &'static str)]
}
impl From<&SequencerStatusBar> for SequencerMode {
fn from (state: &SequencerStatusBar) -> Self {
Self {
mode: state.mode,
help: state.help,
}
}
}
render!(|self:SequencerMode|{
let orange = Color::Rgb(255,128,0);
let light = Color::Rgb(100,100,100); let light = Color::Rgb(100,100,100);
let yellow = Color::Rgb(255,255,0); let yellow = Color::Rgb(255,255,0);
let black = Color::Rgb(0,0,0); let black = Color::Rgb(0,0,0);
@ -43,9 +70,24 @@ render!(|self: SequencerStatusBar|{
row!([" ", prefix, Tui::fg(yellow, *hotkey), suffix]) row!([" ", prefix, Tui::fg(yellow, *hotkey), suffix])
})) }))
) )
}; });
let statusbar = { struct SequencerStats<'a> {
cpu: &'a Option<String>,
size: &'a String,
res: &'a String,
}
impl<'a> From<&'a SequencerStatusBar> for SequencerStats<'a> {
fn from (state: &'a SequencerStatusBar) -> Self {
Self {
cpu: &state.cpu,
size: &state.size,
res: &state.res,
}
}
}
render!(|self:SequencerStats<'a>|{
let orange = Color::Rgb(255,128,0);
let dark = Color::Rgb(100,100,100); let dark = Color::Rgb(100,100,100);
let cpu = &self.cpu; let cpu = &self.cpu;
let res = &self.res; let res = &self.res;
@ -55,14 +97,4 @@ render!(|self: SequencerStatusBar|{
Tui::fg(orange, res), Tui::fg(orange, res),
Tui::fg(orange, size), Tui::fg(orange, size),
])) ]))
};
lay!(|add|if self.width > 60 {
add(&row!(![modeline, statusbar]))
} else if self.width > 0 {
add(&col!(![modeline, statusbar]))
} else {
Ok(())
})
}); });