mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 11:46:41 +01:00
remove HasFocus from SequencerTui; update status bar
This commit is contained in:
parent
a5bcf3798e
commit
f783984a74
3 changed files with 20 additions and 61 deletions
|
|
@ -107,9 +107,10 @@ impl Command<SequencerTui> for SequencerCommand {
|
||||||
|
|
||||||
impl Command<SequencerTui> for FocusCommand<SequencerFocus> {
|
impl Command<SequencerTui> for FocusCommand<SequencerFocus> {
|
||||||
fn execute (self, state: &mut SequencerTui) -> Perhaps<FocusCommand<SequencerFocus>> {
|
fn execute (self, state: &mut SequencerTui) -> Perhaps<FocusCommand<SequencerFocus>> {
|
||||||
if let FocusCommand::Set(to) = self {
|
// Focus commands can be received but are ignored.
|
||||||
state.set_focused(to);
|
//if let FocusCommand::Set(to) = self {
|
||||||
}
|
//state.set_focused(to);
|
||||||
|
//}
|
||||||
Ok(None)
|
Ok(None)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -300,18 +301,6 @@ impl HasPhraseList for SequencerTui {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HasFocus for SequencerTui {
|
|
||||||
type Item = SequencerFocus;
|
|
||||||
/// Get the currently focused item.
|
|
||||||
fn focused (&self) -> Self::Item {
|
|
||||||
self.focus
|
|
||||||
}
|
|
||||||
/// Get the currently focused item.
|
|
||||||
fn set_focused (&mut self, to: Self::Item) {
|
|
||||||
self.focus = to
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Into<Option<TransportFocus>> for SequencerFocus {
|
impl Into<Option<TransportFocus>> for SequencerFocus {
|
||||||
fn into (self) -> Option<TransportFocus> {
|
fn into (self) -> Option<TransportFocus> {
|
||||||
if let Self::Transport(transport) = self {
|
if let Self::Transport(transport) = self {
|
||||||
|
|
|
||||||
|
|
@ -214,7 +214,7 @@ impl Handle<Tui> for TransportTui {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait TransportControl<T>: HasClock + HasFocus<Item = T> {
|
pub trait TransportControl<T>: HasClock + {
|
||||||
fn transport_focused (&self) -> Option<TransportFocus>;
|
fn transport_focused (&self) -> Option<TransportFocus>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,60 +50,30 @@ impl StatusBar for SequencerStatusBar {
|
||||||
|
|
||||||
impl From<&SequencerTui> for SequencerStatusBar {
|
impl From<&SequencerTui> for SequencerStatusBar {
|
||||||
fn from (state: &SequencerTui) -> Self {
|
fn from (state: &SequencerTui) -> Self {
|
||||||
use super::app_transport::TransportFocus::*;
|
|
||||||
use super::app_sequencer::SequencerFocus::*;
|
|
||||||
let samples = state.clock.chunk.load(Ordering::Relaxed);
|
let samples = state.clock.chunk.load(Ordering::Relaxed);
|
||||||
let rate = state.clock.timebase.sr.get() as f64;
|
let rate = state.clock.timebase.sr.get() as f64;
|
||||||
let buffer = samples as f64 / rate;
|
let buffer = samples as f64 / rate;
|
||||||
let width = state.size.w();
|
let width = state.size.w();
|
||||||
let default_help = &[("", "⏎", " enter"), ("", "✣", " navigate")];
|
|
||||||
Self {
|
Self {
|
||||||
width,
|
width,
|
||||||
cpu: state.perf.percentage().map(|cpu|format!("│{cpu:.01}%")),
|
cpu: state.perf.percentage().map(|cpu|format!("│{cpu:.01}%")),
|
||||||
size: format!("{}x{}│", width, state.size.h()),
|
size: format!("{}x{}│", width, state.size.h()),
|
||||||
res: format!("│{}s│{:.1}kHz│{:.1}ms│", samples, rate / 1000., buffer * 1000.),
|
res: format!("│{}s│{:.1}kHz│{:.1}ms│", samples, rate / 1000., buffer * 1000.),
|
||||||
mode: match state.focused() {
|
mode: " SEQUENCER ",
|
||||||
Transport(PlayPause) => " PLAY/PAUSE ",
|
help: &[
|
||||||
Transport(Bpm) => " TEMPO ",
|
("", "SPACE", " play/pause"),
|
||||||
Transport(Sync) => " LAUNCH SYNC ",
|
("", "✣", " cursor"),
|
||||||
Transport(Quant) => " REC QUANT ",
|
("", "Ctrl-✣", " scroll"),
|
||||||
Transport(Clock) => " SEEK ",
|
("", ".,", " length"),
|
||||||
//PhrasePlay => " TO PLAY ",
|
("", "><", " triplet"),
|
||||||
//PhraseNext => " UP NEXT ",
|
("", "[]", " phrase"),
|
||||||
PhraseList => " PHRASES ",
|
("", "{}", " order"),
|
||||||
PhraseEditor => " EDIT MIDI ",
|
("en", "q", "ueue"),
|
||||||
},
|
("", "e", "dit"),
|
||||||
help: match state.focused() {
|
("", "a", "dd note"),
|
||||||
Transport(PlayPause) => &[
|
("", "A", "dd phrase"),
|
||||||
("", "⏎", " play/pause"),
|
("", "D", "uplicate phrase"),
|
||||||
("", "✣", " navigate"),
|
]
|
||||||
],
|
|
||||||
Transport(Bpm) => &[
|
|
||||||
("", ".,", " inc/dec"),
|
|
||||||
("", "><", " fine"),
|
|
||||||
],
|
|
||||||
Transport(Sync) => &[
|
|
||||||
("", ".,", " inc/dec"),
|
|
||||||
],
|
|
||||||
Transport(Quant) => &[
|
|
||||||
("", ".,", " inc/dec"),
|
|
||||||
],
|
|
||||||
Transport(Clock) => &[
|
|
||||||
("", ".,", " by beat"),
|
|
||||||
("", "<>", " by time"),
|
|
||||||
],
|
|
||||||
PhraseList => &[
|
|
||||||
("", "↕", " pick"),
|
|
||||||
("", ".,", " move"),
|
|
||||||
("", "⏎", " play"),
|
|
||||||
("", "e", " edit"),
|
|
||||||
],
|
|
||||||
PhraseEditor => &[
|
|
||||||
("", "✣", " cursor"),
|
|
||||||
("", "Ctrl-✣", " scroll"),
|
|
||||||
],
|
|
||||||
_ => default_help,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue