diff --git a/src/arranger.rs b/src/arranger.rs index 92545ec2..bbf09a6b 100644 --- a/src/arranger.rs +++ b/src/arranger.rs @@ -108,18 +108,15 @@ render!(TuiOut: (self: Arranger) => { let pool_w = if self.pool.visible { self.splits[1] } else { 0 }; let color = self.color; self.size.of( - Bsp::n(Fixed::y(2, ArrangerStatus::from(self)), - Bsp::n(Fixed::y(1, MidiEditStatus(&self.editor)), - Bsp::w(Fixed::x(pool_w, PoolView(self.pool.visible, &self.pool)), - col!( - TransportView::new(true, &self.clock), - Fill::x(Fixed::y(20, lay!( - Fill::xy(Tui::bg(color.darkest.rgb, "")), - Fill::xy(Outer(Style::default().fg(color.dark.rgb).bg(color.darkest.rgb))), - Self::render_mode(self), - ))), - Fill::xy(&"FIXME: editor"), - ))))) + Bsp::n(Fill::xy(ArrangerStatus::from(self)), + Bsp::s(Fixed::y(1, MidiEditStatus(&self.editor)), + Bsp::n(Fixed::x(pool_w, PoolView(self.pool.visible, &self.pool)), + Bsp::n(TransportView::new(true, &self.clock), + Bsp::n(Fill::x(Fixed::y(20, lay!( + Fill::xy(Tui::bg(color.darkest.rgb, "")), + Fill::xy(Outer(Style::default().fg(color.dark.rgb).bg(color.darkest.rgb))), + Self::render_mode(self), + ))), Fill::y(&"fixme: self.editor"))))))) }); audio!(|self: Arranger, client, scope|{ // Start profiling cycle @@ -161,3 +158,54 @@ has_clock!(|self: Arranger|&self.clock); has_phrases!(|self: Arranger|self.pool.phrases); has_editor!(|self: Arranger|self.editor); handle!(TuiIn: |self: Arranger, input|ArrangerCommand::execute_with_state(self, input.event())); + +/// Status bar for arranger app +#[derive(Clone)] +pub struct ArrangerStatus { + pub(crate) width: usize, + pub(crate) cpu: Option, + pub(crate) size: String, + pub(crate) playing: bool, +} +from!(|state:&Arranger|ArrangerStatus = { + let samples = state.clock.chunk.load(Relaxed); + let rate = state.clock.timebase.sr.get(); + let buffer = samples as f64 / rate; + let width = state.size.w(); + Self { + width, + playing: state.clock.is_rolling(), + cpu: state.perf.percentage().map(|cpu|format!("│{cpu:.01}%")), + size: format!("{}x{}│", width, state.size.h()), + } +}); +render!(TuiOut: (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 { + 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!( + single("SPACE", "play/pause"), + single(" Ctrl", " scroll"), + single(" ▲▼▶◀", " cell"), + double(("p", "put"), ("g", "get")), + double(("q", "enqueue"), ("e", "edit")), + single(" wsad", " note"), + double(("a", "append"), ("s", "set"),), + double((",.", "length"), ("<>", "triplet"),), + double(("[]", "phrase"), ("{}", "order"),), + )) + } + fn stats (&self) -> impl Content + use<'_> { + row!(&self.cpu, &self.size) + } +} diff --git a/src/status.rs b/src/status.rs index 40b0045a..bb77ea85 100644 --- a/src/status.rs +++ b/src/status.rs @@ -49,53 +49,3 @@ impl SequencerStatus { } } -/// Status bar for arranger app -#[derive(Clone)] -pub struct ArrangerStatus { - pub(crate) width: usize, - pub(crate) cpu: Option, - pub(crate) size: String, - pub(crate) playing: bool, -} -from!(|state:&Arranger|ArrangerStatus = { - let samples = state.clock.chunk.load(Relaxed); - let rate = state.clock.timebase.sr.get(); - let buffer = samples as f64 / rate; - let width = state.size.w(); - Self { - width, - playing: state.clock.is_rolling(), - cpu: state.perf.percentage().map(|cpu|format!("│{cpu:.01}%")), - size: format!("{}x{}│", width, state.size.h()), - } -}); -render!(TuiOut: (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 { - 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!( - single("SPACE", "play/pause"), - single(" Ctrl", " scroll"), - single(" ▲▼▶◀", " cell"), - double(("p", "put"), ("g", "get")), - double(("q", "enqueue"), ("e", "edit")), - single(" wsad", " note"), - double(("a", "append"), ("s", "set"),), - double((",.", "length"), ("<>", "triplet"),), - double(("[]", "phrase"), ("{}", "order"),), - )) - } - fn stats (&self) -> impl Content + use<'_> { - row!(&self.cpu, &self.size) - } -}