mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 03:36:41 +01:00
tengri 0.5.2: specify Map types/lifetimes
This commit is contained in:
parent
9c95ca9613
commit
d83be2ef1f
8 changed files with 36 additions and 35 deletions
|
|
@ -1,7 +1,7 @@
|
|||
(bsp/n
|
||||
(fixed/y 2 :transport)
|
||||
(fixed/y 1 :transport)
|
||||
(bsp/s
|
||||
(fixed/y 2 :status)
|
||||
(fixed/y 1 :status)
|
||||
(fill/xy
|
||||
(bsp/a
|
||||
(fill/xy
|
||||
|
|
|
|||
|
|
@ -53,9 +53,9 @@ pub struct TekCli {
|
|||
/// Multi-track MIDI sequencer.
|
||||
Arranger {
|
||||
/// Number of scenes
|
||||
#[arg(short = 'y', long, default_value_t = 12)] scenes: usize,
|
||||
#[arg(short = 'y', long, default_value_t = 4)] scenes: usize,
|
||||
/// Number of tracks
|
||||
#[arg(short = 'x', long, default_value_t = 16)] tracks: usize,
|
||||
#[arg(short = 'x', long, default_value_t = 4)] tracks: usize,
|
||||
/// Width of tracks
|
||||
#[arg(short = 'w', long, default_value_t = 12)] track_width: usize,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ impl<'a> Content<TuiOut> for ArrangerView<'a> {
|
|||
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(track_scroll(scene_scroll(self.scenes()))))))
|
||||
ins(scene_scroll(track_scroll(tracks(outs(bg(self.scenes()))))))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -119,21 +119,23 @@ 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), _|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, index|map_south(index as u16, 1,
|
||||
Fill::x(Align::w(Tui::bold(false, Tui::fg_bg(fg, bg,
|
||||
&connect.info)))))))))
|
||||
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), _|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(""))))))))))
|
||||
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>> (
|
||||
|
|
@ -141,14 +143,13 @@ pub(crate) fn per_track_top <'a, T: Content<TuiOut> + 'a, U: TracksSizes<'a>> (
|
|||
tracks: impl Fn() -> U + Send + Sync + 'a,
|
||||
callback: impl Fn(usize, &'a Track)->T + Send + Sync + 'a
|
||||
) -> impl Content<TuiOut> + 'a {
|
||||
Align::x(Tui::bg(Reset, Map::new(tracks, move|(index, track, x1, x2), _|{
|
||||
let width = (x2 - x1) as u16;
|
||||
map_east(x1 as u16, width, Fixed::x(width, Tui::fg_bg(
|
||||
track.color.lightest.rgb,
|
||||
track.color.base.rgb,
|
||||
callback(index, track)
|
||||
)))
|
||||
})))
|
||||
Align::x(Tui::bg(Reset, Map::new(tracks,
|
||||
move|(index, track, x1, x2): (usize, &'a Track, usize, usize), _|{
|
||||
let width = (x2 - x1) as u16;
|
||||
map_east(x1 as u16, width, Fixed::x(width, Tui::fg_bg(
|
||||
track.color.lightest.rgb,
|
||||
track.color.base.rgb,
|
||||
callback(index, track))))})))
|
||||
}
|
||||
|
||||
pub(crate) fn per_track <'a, T: Content<TuiOut> + 'a, U: TracksSizes<'a>> (
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ impl Tek {
|
|||
}
|
||||
/// Height available to display tracks.
|
||||
pub(crate) fn h_tracks_area (&self) -> u16 {
|
||||
self.h().saturating_sub(self.h_inputs() + self.h_outputs() + 10)
|
||||
self.h().saturating_sub(self.h_inputs() + self.h_outputs())
|
||||
}
|
||||
/// Height available to display tracks.
|
||||
pub(crate) fn h_scenes_area (&self) -> u16 {
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ impl<'a> ArrangerView<'a> {
|
|||
||self.tracks_with_sizes_scrolled(),
|
||||
move|track_index, track|Map::new(
|
||||
||self.scenes_with_track_colors(),
|
||||
move|(scene_index, scene, y1, y2, prev_scene): SceneWithColor, _|
|
||||
move|(scene_index, scene, y1, y2, prev_scene): SceneWithColor<'a>, _|
|
||||
view_scene_clip(
|
||||
self.width_mid,
|
||||
(1 + y2 - y1) as u16,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue