mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +01:00
show hotkeys in status bar
This commit is contained in:
parent
51889d4b43
commit
86649ef994
3 changed files with 53 additions and 15 deletions
|
|
@ -133,24 +133,55 @@ impl From<&SequencerTui> for SequencerStatusBar {
|
|||
let samples = state.clock.chunk.load(Ordering::Relaxed);
|
||||
let rate = state.clock.current.timebase.sr.get() as f64;
|
||||
let buffer = samples as f64 / rate;
|
||||
let default_help = &[("", "⏎", " enter"), ("", "✣", " navigate")];
|
||||
Self {
|
||||
cpu: state.perf.percentage().map(|cpu|format!("│{cpu:.01}%")),
|
||||
size: format!("{}x{}│", state.size.w(), state.size.h()),
|
||||
res: format!("│{}s│{:.1}kHz│{:.1}ms│", samples, rate / 1000., buffer * 1000.),
|
||||
mode: match state.focused() {
|
||||
Transport(focus) => match focus {
|
||||
PlayPause => " PLAY/PAUSE ",
|
||||
Bpm => " TEMPO ",
|
||||
Sync => " LAUNCH SYNC ",
|
||||
Quant => " REC QUANT ",
|
||||
Clock => " SEEK ",
|
||||
},
|
||||
Transport(PlayPause) => " PLAY/PAUSE ",
|
||||
Transport(Bpm) => " TEMPO ",
|
||||
Transport(Sync) => " LAUNCH SYNC ",
|
||||
Transport(Quant) => " REC QUANT ",
|
||||
Transport(Clock) => " SEEK ",
|
||||
PhraseList => " PHRASES ",
|
||||
PhraseEditor => " EDIT MIDI ",
|
||||
PhrasePlay => " TO PLAY ",
|
||||
PhraseNext => " UP NEXT ",
|
||||
},
|
||||
help: &[]
|
||||
help: match state.focused() {
|
||||
Transport(PlayPause) => &[
|
||||
("", "⏎", " play/pause"),
|
||||
("", "✣", " navigate"),
|
||||
],
|
||||
Transport(Bpm) => &[
|
||||
("", ".,", " inc/dec"),
|
||||
("", "><", " fine"),
|
||||
],
|
||||
Transport(Sync) => &[
|
||||
("", ".,", " inc/dec"),
|
||||
],
|
||||
Transport(Quant) => &[
|
||||
("", ".,", " inc/dec"),
|
||||
],
|
||||
PhraseList => if state.entered() {
|
||||
&[
|
||||
("", "↕", " pick"),
|
||||
("", ".,", " move"),
|
||||
("", "⏎", " play"),
|
||||
("", "e", " edit"),
|
||||
]
|
||||
} else {
|
||||
default_help
|
||||
}
|
||||
_ => if state.entered() {
|
||||
&[
|
||||
("", "Esc", " exit")
|
||||
]
|
||||
} else {
|
||||
default_help
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -122,10 +122,11 @@ impl<'a> Content for PhraseView<'a> {
|
|||
let piano_roll = row!(keys, note_area).fill_x();
|
||||
let content = piano_roll.bg(Color::Rgb(40, 50, 30)).border(border);
|
||||
let content = lay!(content, playhead);
|
||||
let mut upper_left = format!("[{}] Sequencer", if *entered {"■"} else {" "});
|
||||
let mut name = "".to_string();
|
||||
if let Some(phrase) = phrase {
|
||||
upper_left = format!("{upper_left}: {}", phrase.read().unwrap().name);
|
||||
name = phrase.read().unwrap().name.clone();
|
||||
}
|
||||
let mut upper_left = format!("[{}] {name}", if *entered {"■"} else {" "},);
|
||||
let mut lower_right = format!("┤{}├", size.format());
|
||||
lower_right = format!("┤Zoom: {}├─{lower_right}", pulses_to_name(time_scale));
|
||||
//lower_right = format!("Zoom: {} (+{}:{}*{}|{})",
|
||||
|
|
|
|||
|
|
@ -29,9 +29,15 @@ impl Content for SequencerStatusBar {
|
|||
type Engine = Tui;
|
||||
fn content (&self) -> impl Widget<Engine = Tui> {
|
||||
let orange = Color::Rgb(255,128,0);
|
||||
let yellow = Color::Rgb(255,255,0);
|
||||
let black = Color::Rgb(0,0,0);
|
||||
lay!(
|
||||
row!(
|
||||
widget(&self.mode).bg(orange).fg(black).bold(true),
|
||||
row!((prefix, hotkey, suffix) in self.help => {
|
||||
row!(" ", *prefix, TuiStyle::fg(*hotkey, yellow), *suffix)
|
||||
})
|
||||
),
|
||||
row!(
|
||||
widget(&self.cpu).fg(orange),
|
||||
widget(&self.res).fg(orange),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue