mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 11:46:41 +01:00
misc view tweaks
This commit is contained in:
parent
b4761a9679
commit
944fcfa017
1 changed files with 39 additions and 50 deletions
|
|
@ -23,8 +23,8 @@ impl Tek {
|
|||
|
||||
pub fn view_modal (&self) -> impl Content<TuiOut> + use<'_> {
|
||||
When::new(self.modal.is_some(), Bsp::b(
|
||||
Fill::xy(Tui::fg_bg(Color::Rgb(64,64,64), Color::Rgb(32,32,32), "")),
|
||||
Fixed::xy(30, 15, Tui::fg_bg(Color::Rgb(255,255,255), Color::Rgb(16,16,16), Bsp::b(
|
||||
Fill::xy(Tui::fg_bg(Rgb(64,64,64), Rgb(32,32,32), "")),
|
||||
Fixed::xy(30, 15, Tui::fg_bg(Rgb(255,255,255), Rgb(16,16,16), Bsp::b(
|
||||
Repeat(" "),
|
||||
Outer(true, Style::default().fg(Tui::g(96)))
|
||||
.enclose(self.modal.map(|modal|match modal {
|
||||
|
|
@ -37,7 +37,7 @@ impl Tek {
|
|||
|
||||
fn view_modal_menu (&self) -> impl Content<TuiOut> {
|
||||
let options = ||["Projects", "Settings", "Help", "Quit"].iter();
|
||||
let option = |a,i|Tui::fg(Color::Rgb(255,255,255), format!("{}", a));
|
||||
let option = |a,i|Tui::fg(Rgb(255,255,255), format!("{}", a));
|
||||
Bsp::s(Tui::bold(true, "tek!"), Bsp::s("", Map::south(1, options, option)))
|
||||
}
|
||||
|
||||
|
|
@ -51,14 +51,14 @@ impl Tek {
|
|||
None
|
||||
});
|
||||
let binding = |mut binding: TokenIter, _|Bsp::e(
|
||||
Fixed::x(15, Align::w(Tui::bold(true, Tui::fg(Color::Rgb(255,192,0), if let Some(Token {
|
||||
Fixed::x(15, Align::w(Tui::bold(true, Tui::fg(Rgb(255,192,0), if let Some(Token {
|
||||
value: Value::Sym(key), ..
|
||||
}) = binding.next() {
|
||||
Some(key.to_string())
|
||||
} else {
|
||||
None
|
||||
})))),
|
||||
Bsp::e(" ", Tui::fg(Color::Rgb(255,255,255), if let Some(Token {
|
||||
Bsp::e(" ", Tui::fg(Rgb(255,255,255), if let Some(Token {
|
||||
value: Value::Key(command), ..
|
||||
}) = binding.next() {
|
||||
Some(command.to_string())
|
||||
|
|
@ -255,10 +255,10 @@ pub(crate) struct ArrangerView<'a> {
|
|||
|
||||
impl<'a> Content<TuiOut> for ArrangerView<'a> {
|
||||
fn content (&self) -> impl Render<TuiOut> {
|
||||
let ins = |x|Bsp::s(self.inputs(), x);
|
||||
let tracks = |x|Bsp::s(self.tracks(), x);
|
||||
let ins = |x|Bsp::s(self.inputs(), x);
|
||||
let tracks = |x|Bsp::s(self.tracks(), x);
|
||||
let outs = |x|Bsp::n(self.outputs(), x);
|
||||
let bg = |x|Tui::bg(Color::Reset, x);
|
||||
let bg = |x|Tui::bg(Reset, x);
|
||||
//let track_scroll = |x|Bsp::s(&self.track_scroll, x);
|
||||
//let scene_scroll = |x|Bsp::e(&self.scene_scroll, x);
|
||||
ins(tracks(outs(bg(self.scenes()))))
|
||||
|
|
@ -306,7 +306,7 @@ impl<'a> ArrangerView<'a> {
|
|||
|
||||
/// Render input matrix.
|
||||
pub(crate) fn inputs (&'a self) -> impl Content<TuiOut> + 'a {
|
||||
Tui::bg(Color::Reset, Bsp::s(
|
||||
Tui::bg(Reset, Bsp::s(
|
||||
Bsp::s(self.input_routes(), self.input_ports()),
|
||||
self.input_intos()
|
||||
))
|
||||
|
|
@ -366,7 +366,7 @@ impl<'a> ArrangerView<'a> {
|
|||
|
||||
/// Render output matrix.
|
||||
pub(crate) fn outputs (&'a self) -> impl Content<TuiOut> + 'a {
|
||||
Tui::bg(Color::Reset, Align::n(Bsp::s(
|
||||
Tui::bg(Reset, Align::n(Bsp::s(
|
||||
Bsp::s(self.output_nexts(), self.output_froms()),
|
||||
Bsp::s(self.output_ports(), self.output_conns()),
|
||||
)))
|
||||
|
|
@ -409,34 +409,29 @@ impl<'a> ArrangerView<'a> {
|
|||
.right(self.width_side,
|
||||
button_2("O", "add midi out", self.is_editing))
|
||||
.middle(self.width_mid,
|
||||
per_track_top(
|
||||
self.width_mid,
|
||||
||self.tracks_with_sizes_scrolled(),
|
||||
move|i, t|{
|
||||
let mute = false;
|
||||
let solo = false;
|
||||
let mute = if mute { White } else { t.color.darkest.rgb };
|
||||
let solo = if solo { White } else { t.color.darkest.rgb };
|
||||
let bg_1 = if self.track_selected == Some(i) {
|
||||
t.color.light.rgb
|
||||
} else {
|
||||
t.color.base.rgb
|
||||
};
|
||||
let bg_2 = if i > 0 { t.color.base.rgb } else { Reset };
|
||||
let mute = Tui::fg_bg(mute, bg_1, "Play ");
|
||||
let solo = Tui::fg_bg(solo, bg_1, "Solo ");
|
||||
wrap(bg_1, Tui::g(224), Tui::bold(true, Fill::x(Bsp::e(mute, solo))))
|
||||
}))
|
||||
per_track_top(self.width_mid, ||self.tracks_with_sizes_scrolled(), move|i, t|{
|
||||
let mute = false;
|
||||
let solo = false;
|
||||
let mute = if mute { White } else { t.color.darkest.rgb };
|
||||
let solo = if solo { White } else { t.color.darkest.rgb };
|
||||
let bg_1 = if self.track_selected == Some(i) {
|
||||
t.color.light.rgb
|
||||
} else {
|
||||
t.color.base.rgb
|
||||
};
|
||||
let bg_2 = if i > 0 { t.color.base.rgb } else { Reset };
|
||||
let mute = Tui::fg_bg(mute, bg_1, "Play ");
|
||||
let solo = Tui::fg_bg(solo, bg_1, "Solo ");
|
||||
wrap(bg_1, Tui::g(224), Tui::bold(true, Fill::x(Bsp::e(mute, solo))))
|
||||
}))
|
||||
}
|
||||
|
||||
fn output_conns (&'a self) -> impl Content<TuiOut> + 'a {
|
||||
Tryptich::top(self.outputs_height)
|
||||
.left(self.width_side,
|
||||
io_ports(Tui::g(224), Tui::g(32), ||self.app.outputs_with_sizes()))
|
||||
.middle(self.width_mid, per_track_top(
|
||||
self.width_mid,
|
||||
||self.tracks_with_sizes_scrolled(),
|
||||
|_, t|io_conns(
|
||||
.middle(self.width_mid,
|
||||
per_track_top(self.width_mid, ||self.tracks_with_sizes_scrolled(), |_, t|io_conns(
|
||||
t.color.dark.rgb,
|
||||
t.color.darker.rgb,
|
||||
||self.app.outputs_with_sizes()
|
||||
|
|
@ -457,7 +452,7 @@ impl<'a> ArrangerView<'a> {
|
|||
track.color.base
|
||||
}.rgb,
|
||||
track.color.lightest.rgb,
|
||||
Tui::bold(true, Fill::x(Align::nw(&track.name)))
|
||||
Tui::bold(true, Fill::xy(Align::nw(&track.name)))
|
||||
)))
|
||||
}
|
||||
|
||||
|
|
@ -689,17 +684,14 @@ pub(crate) fn view_meters (values: &[f32;2]) -> impl Content<TuiOut> + use<'_> {
|
|||
}
|
||||
|
||||
pub(crate) fn wrap (bg: Color, fg: Color, content: impl Content<TuiOut>) -> impl Content<TuiOut> {
|
||||
let left = Tui::fg_bg(bg, Reset, "▐");
|
||||
let right = Tui::fg_bg(bg, Reset, "▌");
|
||||
let left = Tui::fg_bg(bg, Reset, Fixed::x(1, RepeatV("▐")));
|
||||
let right = Tui::fg_bg(bg, Reset, Fixed::x(1, RepeatV("▌")));
|
||||
Bsp::e(left, Bsp::w(right, Tui::fg_bg(fg, bg, content)))
|
||||
}
|
||||
|
||||
pub(crate) fn button_2 <'a, K, L> (
|
||||
key: K, label: L, editing: bool,
|
||||
) -> impl Content<TuiOut> + 'a where
|
||||
K: Content<TuiOut> + 'a,
|
||||
L: Content<TuiOut> + 'a,
|
||||
{
|
||||
pub(crate) fn button_2 <'a> (
|
||||
key: impl Content<TuiOut> + 'a, label: impl Content<TuiOut> + 'a, editing: bool,
|
||||
) -> impl Content<TuiOut> + 'a {
|
||||
let key = Tui::fg_bg(Tui::g(0), Tui::orange(), Bsp::e(
|
||||
Tui::fg_bg(Tui::orange(), Reset, "▐"),
|
||||
Bsp::e(key, Tui::fg(Tui::g(96), "▐"))
|
||||
|
|
@ -927,7 +919,7 @@ content!(TuiOut: |self: PoolView<'a>| {
|
|||
let border = |x|x;//Outer(Style::default().fg(color.dark.rgb).bg(color.darkest.rgb)).enclose(x);
|
||||
let iter = | |model.clips().clone().into_iter();
|
||||
let height = clips.read().unwrap().len() as u16;
|
||||
Tui::bg(Color::Reset, Fixed::y(height, on_bg(border(Map::new(iter, move|clip: Arc<RwLock<MidiClip>>, i|{
|
||||
Tui::bg(Reset, Fixed::y(height, on_bg(border(Map::new(iter, move|clip: Arc<RwLock<MidiClip>>, i|{
|
||||
let item_height = 1;
|
||||
let item_offset = i as u16 * item_height;
|
||||
let selected = i == model.clip_index();
|
||||
|
|
@ -946,18 +938,15 @@ content!(TuiOut: |self: PoolView<'a>| {
|
|||
});
|
||||
|
||||
content!(TuiOut: |self: ClipLength| {
|
||||
use ClipLengthFocus::*;
|
||||
let bars = ||self.bars_string();
|
||||
let beats = ||self.beats_string();
|
||||
let ticks = ||self.ticks_string();
|
||||
match self.focus {
|
||||
None =>
|
||||
row!(" ", bars(), ".", beats(), ".", ticks()),
|
||||
Some(ClipLengthFocus::Bar) =>
|
||||
row!("[", bars(), "]", beats(), ".", ticks()),
|
||||
Some(ClipLengthFocus::Beat) =>
|
||||
row!(" ", bars(), "[", beats(), "]", ticks()),
|
||||
Some(ClipLengthFocus::Tick) =>
|
||||
row!(" ", bars(), ".", beats(), "[", ticks()),
|
||||
None => row!(" ", bars(), ".", beats(), ".", ticks()),
|
||||
Some(Bar) => row!("[", bars(), "]", beats(), ".", ticks()),
|
||||
Some(Beat) => row!(" ", bars(), "[", beats(), "]", ticks()),
|
||||
Some(Tick) => row!(" ", bars(), ".", beats(), "[", ticks()),
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue