mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-09 21:26:43 +01:00
wip11 (4e)
This commit is contained in:
parent
06dab6d0d7
commit
83e64a3a10
3 changed files with 62 additions and 30 deletions
|
|
@ -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::*;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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,
|
||||||
|
|
|
||||||
|
|
@ -31,38 +31,70 @@ render!(|self: SequencerTui|{
|
||||||
|
|
||||||
render!(|self: SequencerStatusBar|{
|
render!(|self: SequencerStatusBar|{
|
||||||
|
|
||||||
let orange = Color::Rgb(255,128,0);
|
|
||||||
|
|
||||||
let modeline = {
|
|
||||||
let light = Color::Rgb(100,100,100);
|
|
||||||
let yellow = Color::Rgb(255,255,0);
|
|
||||||
let black = Color::Rgb(0,0,0);
|
|
||||||
Tui::to_east(
|
|
||||||
Tui::bg(orange, Tui::fg(black, Tui::bold(true, self.mode))),
|
|
||||||
Tui::bg(light, row!((prefix, hotkey, suffix) in self.help.iter() => {
|
|
||||||
row!([" ", prefix, Tui::fg(yellow, *hotkey), suffix])
|
|
||||||
}))
|
|
||||||
)
|
|
||||||
};
|
|
||||||
|
|
||||||
let statusbar = {
|
|
||||||
let dark = Color::Rgb(100,100,100);
|
|
||||||
let cpu = &self.cpu;
|
|
||||||
let res = &self.res;
|
|
||||||
let size = &self.size;
|
|
||||||
Tui::bg(dark, row!([
|
|
||||||
Tui::fg(orange, cpu),
|
|
||||||
Tui::fg(orange, res),
|
|
||||||
Tui::fg(orange, size),
|
|
||||||
]))
|
|
||||||
};
|
|
||||||
|
|
||||||
lay!(|add|if self.width > 60 {
|
lay!(|add|if self.width > 60 {
|
||||||
add(&row!(![modeline, statusbar]))
|
add(&row!(![
|
||||||
|
SequencerMode::from(self),
|
||||||
|
SequencerStats::from(self),
|
||||||
|
]))
|
||||||
} else if self.width > 0 {
|
} else if self.width > 0 {
|
||||||
add(&col!(![modeline, statusbar]))
|
add(&col!(![
|
||||||
|
SequencerMode::from(self),
|
||||||
|
SequencerStats::from(self),
|
||||||
|
]))
|
||||||
} else {
|
} else {
|
||||||
Ok(())
|
Ok(())
|
||||||
})
|
})
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
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 yellow = Color::Rgb(255,255,0);
|
||||||
|
let black = Color::Rgb(0,0,0);
|
||||||
|
Tui::to_east(
|
||||||
|
Tui::bg(orange, Tui::fg(black, Tui::bold(true, self.mode))),
|
||||||
|
Tui::bg(light, row!((prefix, hotkey, suffix) in self.help.iter() => {
|
||||||
|
row!([" ", prefix, Tui::fg(yellow, *hotkey), suffix])
|
||||||
|
}))
|
||||||
|
)
|
||||||
|
});
|
||||||
|
|
||||||
|
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 cpu = &self.cpu;
|
||||||
|
let res = &self.res;
|
||||||
|
let size = &self.size;
|
||||||
|
Tui::bg(dark, row!([
|
||||||
|
Tui::fg(orange, cpu),
|
||||||
|
Tui::fg(orange, res),
|
||||||
|
Tui::fg(orange, size),
|
||||||
|
]))
|
||||||
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue