diff --git a/crates/device/src/arranger/arranger_view.rs b/crates/device/src/arranger/arranger_view.rs index 5f45499b..c9ebc98a 100644 --- a/crates/device/src/arranger/arranger_view.rs +++ b/crates/device/src/arranger/arranger_view.rs @@ -13,26 +13,26 @@ impl Arrangement { Bsp::w(Fixed::x(4, button_2("I", "+", false)), Stack::east(move|add: &mut dyn FnMut(&dyn Render)|{ for (index, track, x1, x2) in self.tracks_with_sizes() { - add(&Align::w(row!( + add(&Tui::bg(track.color.dark.rgb, Align::w(Fixed::x(track.width as u16, row!( Either(track.sequencer.monitoring, Tui::fg(Green, "mon "), "mon "), Either(track.sequencer.recording, Tui::fg(Red, "rec "), "rec "), Either(track.sequencer.overdub, Tui::fg(Yellow, "dub "), "dub "), - ))) + ))))) } }))))); for (index, port) in self.midi_ins().iter().enumerate() { - add(&Fixed::y(1, - Bsp::e(Fixed::x(20, Align::w(format!(" ● i{index:02} {}", port.name()))), - Bsp::w(Fixed::x(4, ()), - Stack::east(move|add: &mut dyn FnMut(&dyn Render)|{ - for (index, track, x1, x2) in self.tracks_with_sizes() { - add(&Align::w(row!( - Either(track.sequencer.monitoring, Tui::fg(Green, " ● "), " · "), - Either(track.sequencer.recording, Tui::fg(Red, " ● "), " · "), - Either(track.sequencer.overdub, Tui::fg(Yellow, " ● "), " · "), - ))) - } - }))))); + add(&Fixed::y(1, Bsp::e( + Fixed::x(20, Align::w(Bsp::e(" ● ", Tui::bold(true, Tui::fg(Rgb(255,255,255),port.name()))))), + Bsp::w(Fixed::x(4, ()), + Stack::east(move|add: &mut dyn FnMut(&dyn Render)|{ + for (index, track, x1, x2) in self.tracks_with_sizes() { + add(&Tui::bg(track.color.darker.rgb, Align::w(Fixed::x(track.width as u16, row!( + Either(track.sequencer.monitoring, Tui::fg(Green, " ● "), " · "), + Either(track.sequencer.recording, Tui::fg(Red, " ● "), " · "), + Either(track.sequencer.overdub, Tui::fg(Yellow, " ● "), " · "), + ))))) + } + }))))); } }) } @@ -47,7 +47,7 @@ impl Arrangement { Fixed::y(h - 1, Fill::xy(Align::nw(Stack::south(|add: &mut dyn FnMut(&dyn Render)|{ for (index, port) in self.midi_outs().iter().enumerate() { add(&Fixed::y(1,Fill::x(Bsp::e( - Align::w(Bsp::e(format!(" ● o{index:02} "), Tui::fg(Rgb(255,255,255),Tui::bold(true, port.name())))), + Align::w(Bsp::e(" ● ", Tui::fg(Rgb(255,255,255),Tui::bold(true, port.name())))), Fill::x(Align::e(format!("{}/{} ", port.port().get_connections().len(), port.conn().len()))))))); diff --git a/crates/device/src/lib.rs b/crates/device/src/lib.rs index 6041e16c..a4ca5930 100644 --- a/crates/device/src/lib.rs +++ b/crates/device/src/lib.rs @@ -38,3 +38,42 @@ mod dialog; pub use self::dialog::*; #[cfg(feature = "vst2")] mod vst2; #[cfg(feature = "vst2")] pub use self::vst2::*; #[cfg(feature = "vst3")] mod vst3; #[cfg(feature = "vst3")] pub use self::vst3::*; #[cfg(feature = "clap")] mod clap; #[cfg(feature = "clap")] pub use self::clap::*; + +pub fn button_2 <'a> ( + key: impl Content + 'a, label: impl Content + 'a, editing: bool, +) -> impl Content + 'a { + let key = Tui::fg_bg(Tui::orange(), Tui::g(0), Bsp::e( + Tui::fg(Tui::g(0), "▐"), + Bsp::e(key, Tui::fg(Tui::g(96), "▐")) + )); + let label = When::new(!editing, Tui::fg_bg(Tui::g(255), Tui::g(96), label)); + Tui::bold(true, Bsp::e(key, label)) +} + +pub fn button_3 <'a, K, L, V> ( + key: K, + label: L, + value: V, + editing: bool, +) -> impl Content + 'a where + K: Content + 'a, + L: Content + 'a, + V: Content + 'a, +{ + let key = Tui::fg_bg(Tui::orange(), Tui::g(0), + Bsp::e(Tui::fg(Tui::g(0), "▐"), Bsp::e(key, Tui::fg(if editing { + Tui::g(128) + } else { + Tui::g(96) + }, "▐")))); + let label = Bsp::e( + When::new(!editing, Bsp::e( + Tui::fg_bg(Tui::g(255), Tui::g(96), label), + Tui::fg_bg(Tui::g(128), Tui::g(96), "▐"), + )), + Bsp::e( + Tui::fg_bg(Tui::g(224), Tui::g(128), value), + Tui::fg_bg(Tui::g(128), Reset, "▌"), + )); + Tui::bold(true, Bsp::e(key, label)) +} diff --git a/deps/tengri b/deps/tengri index 9a12e0c7..921378b6 160000 --- a/deps/tengri +++ b/deps/tengri @@ -1 +1 @@ -Subproject commit 9a12e0c7bab24cb708d503e860d93677ae306961 +Subproject commit 921378b6dbb38d4f301f688abd1cfef9bdc0f941