mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +01:00
add new Selection variants
This commit is contained in:
parent
7b432d12b4
commit
8adbdc5bc7
4 changed files with 161 additions and 109 deletions
|
|
@ -181,11 +181,12 @@ impl Tek {
|
|||
}
|
||||
|
||||
pub(crate) fn tracks_with_sizes (&self) -> impl TracksSizes<'_> {
|
||||
use Selection::*;
|
||||
let mut x = 0;
|
||||
let editing = self.is_editing();
|
||||
let active = match self.selected() {
|
||||
Selection::Track(t) if editing => Some(t),
|
||||
Selection::Clip(t, _) if editing => Some(t),
|
||||
Track(t) if editing => Some(t),
|
||||
TrackClip { track, .. } if editing => Some(track),
|
||||
_ => None
|
||||
};
|
||||
let bigger = self.editor_w();
|
||||
|
|
@ -200,10 +201,11 @@ impl Tek {
|
|||
pub(crate) fn scenes_with_sizes (&self, editing: bool, height: usize, larger: usize)
|
||||
-> impl ScenesSizes<'_>
|
||||
{
|
||||
use Selection::*;
|
||||
let (selected_track, selected_scene) = match self.selected() {
|
||||
Selection::Track(t) => (Some(*t), None),
|
||||
Selection::Scene(s) => (None, Some(*s)),
|
||||
Selection::Clip(t, s) => (Some(*t), Some(*s)),
|
||||
Track(t) => (Some(*t), None),
|
||||
Scene(s) => (None, Some(*s)),
|
||||
TrackClip { track, scene } => (Some(*track), Some(*scene)),
|
||||
_ => (None, None)
|
||||
};
|
||||
let mut y = 0;
|
||||
|
|
@ -304,8 +306,10 @@ impl<'a> ArrangerView<'a> {
|
|||
|
||||
/// Render input matrix.
|
||||
pub(crate) fn inputs (&'a self) -> impl Content<TuiOut> + 'a {
|
||||
Tui::bg(Color::Reset,
|
||||
Bsp::s(Bsp::s(self.input_routes(), self.input_ports()), self.input_intos()))
|
||||
Tui::bg(Color::Reset, Bsp::s(
|
||||
Bsp::s(self.input_routes(), self.input_ports()),
|
||||
self.input_intos()
|
||||
))
|
||||
}
|
||||
|
||||
fn input_routes (&'a self) -> impl Content<TuiOut> + 'a {
|
||||
|
|
@ -313,13 +317,12 @@ impl<'a> ArrangerView<'a> {
|
|||
.left(self.width_side,
|
||||
io_ports(Tui::g(224), Tui::g(32), ||self.app.inputs_with_sizes()))
|
||||
.middle(self.width_mid,
|
||||
per_track_top(
|
||||
self.width_mid,
|
||||
||self.app.tracks_with_sizes(),
|
||||
move|_, &Track { color, .. }|{
|
||||
io_conns(color.dark.rgb, color.darker.rgb, ||self.app.inputs_with_sizes())
|
||||
}
|
||||
))
|
||||
per_track_top(self.width_mid, ||self.app.tracks_with_sizes(),
|
||||
move|_, &Track { color, .. }|io_conns(
|
||||
color.dark.rgb,
|
||||
color.darker.rgb,
|
||||
||self.app.inputs_with_sizes()
|
||||
)))
|
||||
}
|
||||
|
||||
fn input_ports (&'a self) -> impl Content<TuiOut> + 'a {
|
||||
|
|
@ -353,14 +356,12 @@ impl<'a> ArrangerView<'a> {
|
|||
fn input_intos (&'a self) -> impl Content<TuiOut> + 'a {
|
||||
Tryptich::top(2)
|
||||
.left(self.width_side,
|
||||
Bsp::s(Align::e("Input:"), Align::e("Into:")))
|
||||
Bsp::s(Align::e("Input:"), Align::e("Into clip:")))
|
||||
.middle(self.width_mid,
|
||||
per_track_top(
|
||||
self.width_mid,
|
||||
||self.app.tracks_with_sizes(),
|
||||
|_, _|{
|
||||
Tui::bg(Reset, Align::c(Bsp::s(OctaveVertical::default(), " ------ ")))
|
||||
}))
|
||||
|_, _|Tui::bg(Reset, Align::c(Bsp::s(OctaveVertical::default(), " ------ ")))))
|
||||
}
|
||||
|
||||
/// Render output matrix.
|
||||
|
|
@ -370,20 +371,17 @@ impl<'a> ArrangerView<'a> {
|
|||
Bsp::s(self.output_ports(), self.output_conns()),
|
||||
)))
|
||||
}
|
||||
|
||||
fn output_nexts (&'a self) -> impl Content<TuiOut> + 'a {
|
||||
Tryptich::top(2)
|
||||
.left(self.width_side, Align::ne("From:"))
|
||||
.left(self.width_side, Align::ne("From clip:"))
|
||||
.middle(self.width_mid, per_track_top(
|
||||
self.width_mid,
|
||||
||self.tracks_with_sizes_scrolled(),
|
||||
|_, _|{
|
||||
Tui::bg(Reset, Align::c(Bsp::s(" ------ ", OctaveVertical::default())))
|
||||
}))
|
||||
|_, _|Tui::bg(Reset, Align::c(Bsp::s(" ------ ", OctaveVertical::default())))))
|
||||
}
|
||||
fn output_froms (&'a self) -> impl Content<TuiOut> + 'a {
|
||||
Tryptich::top(2)
|
||||
.left(self.width_side, Align::ne("Next:"))
|
||||
.left(self.width_side, Align::ne("Next clip:"))
|
||||
.middle(self.width_mid, per_track_top(
|
||||
self.width_mid,
|
||||
||self.tracks_with_sizes_scrolled(),
|
||||
|
|
@ -412,7 +410,11 @@ impl<'a> ArrangerView<'a> {
|
|||
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_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 ");
|
||||
|
|
@ -740,24 +742,26 @@ pub(crate) fn heading <'a> (
|
|||
pub(crate) fn io_ports <'a, T: PortsSizes<'a>> (
|
||||
fg: Color, bg: Color, iter: impl Fn()->T + Send + Sync + 'a
|
||||
) -> impl Content<TuiOut> + 'a {
|
||||
Map::new(iter,
|
||||
move|(index, name, connections, y, y2): (usize, &'a Arc<str>, &'a [PortConnect], usize, usize), _|
|
||||
map_south(y as u16, (y2-y) as u16, Bsp::s(
|
||||
Fill::x(Tui::bold(true, Tui::fg_bg(fg, bg, Align::w(Bsp::e(" ", name))))),
|
||||
Map::new(||connections.iter(), move|connect: &'a PortConnect, index|map_south(index as u16, 1,
|
||||
Fill::x(Align::w(Tui::bold(false, Tui::fg_bg(fg, bg,
|
||||
&connect.info)))))))))
|
||||
Map::new(iter, move|(
|
||||
index, name, connections, y, y2
|
||||
): (usize, &'a Arc<str>, &'a [PortConnect], usize, usize), _|
|
||||
map_south(y as u16, (y2-y) as u16, Bsp::s(
|
||||
Fill::x(Tui::bold(true, Tui::fg_bg(fg, bg, Align::w(Bsp::e(" ", name))))),
|
||||
Map::new(||connections.iter(), move|connect: &'a PortConnect, index|map_south(index as u16, 1,
|
||||
Fill::x(Align::w(Tui::bold(false, Tui::fg_bg(fg, bg,
|
||||
&connect.info)))))))))
|
||||
}
|
||||
|
||||
pub(crate) fn io_conns <'a, T: PortsSizes<'a>> (
|
||||
fg: Color, bg: Color, iter: impl Fn()->T + Send + Sync + 'a
|
||||
) -> impl Content<TuiOut> + 'a {
|
||||
Map::new(iter,
|
||||
move|(index, name, connections, y, y2): (usize, &'a Arc<str>, &'a [PortConnect], usize, usize), _|
|
||||
map_south(y as u16, (y2-y) as u16, Bsp::s(
|
||||
Fill::x(Tui::bold(true, wrap(bg, fg, Fill::x(Align::w("▞▞▞▞ ▞▞▞▞"))))),
|
||||
Map::new(||connections.iter(), move|connect, index|map_south(index as u16, 1,
|
||||
Fill::x(Align::w(Tui::bold(false, wrap(bg, fg, Fill::x(""))))))))))
|
||||
Map::new(iter, move|(
|
||||
index, name, connections, y, y2
|
||||
): (usize, &'a Arc<str>, &'a [PortConnect], usize, usize), _|
|
||||
map_south(y as u16, (y2-y) as u16, Bsp::s(
|
||||
Fill::x(Tui::bold(true, wrap(bg, fg, Fill::x(Align::w("▞▞▞▞ ▞▞▞▞"))))),
|
||||
Map::new(||connections.iter(), move|connect, index|map_south(index as u16, 1,
|
||||
Fill::x(Align::w(Tui::bold(false, wrap(bg, fg, Fill::x(""))))))))))
|
||||
}
|
||||
|
||||
pub(crate) fn per_track_top <'a, T: Content<TuiOut> + 'a, U: TracksSizes<'a>> (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue