From d83be2ef1f62b98f81ec4976e87f5ed3aab6eee3 Mon Sep 17 00:00:00 2001 From: unspeaker <hora.nqma@protonmail.com> Date: Fri, 4 Apr 2025 01:54:20 +0300 Subject: [PATCH] tengri 0.5.2: specify Map types/lifetimes --- Cargo.lock | 20 ++++++++++---------- Cargo.toml | 2 +- app/edn/view_arranger.edn | 4 ++-- app/src/cli.rs | 4 ++-- app/src/view.rs | 2 +- app/src/view/view_layout.rs | 35 ++++++++++++++++++----------------- app/src/view/view_sizes.rs | 2 +- app/src/view/view_track.rs | 2 +- 8 files changed, 36 insertions(+), 35 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 954dbf81..975d1e75 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1580,8 +1580,8 @@ dependencies = [ [[package]] name = "tengri" -version = "0.5.1" -source = "git+https://codeberg.org/unspeaker/tengri?rev=829d35b#829d35b61fc4323273613695f02bb1e6bfde0cbd" +version = "0.5.2" +source = "git+https://codeberg.org/unspeaker/tengri?rev=86236b7#86236b76cd421a67ece0633d38436cd38c770d9e" dependencies = [ "tengri_dsl", "tengri_input", @@ -1591,8 +1591,8 @@ dependencies = [ [[package]] name = "tengri_dsl" -version = "0.5.1" -source = "git+https://codeberg.org/unspeaker/tengri?rev=829d35b#829d35b61fc4323273613695f02bb1e6bfde0cbd" +version = "0.5.2" +source = "git+https://codeberg.org/unspeaker/tengri?rev=86236b7#86236b76cd421a67ece0633d38436cd38c770d9e" dependencies = [ "itertools 0.14.0", "konst", @@ -1601,24 +1601,24 @@ dependencies = [ [[package]] name = "tengri_input" -version = "0.5.1" -source = "git+https://codeberg.org/unspeaker/tengri?rev=829d35b#829d35b61fc4323273613695f02bb1e6bfde0cbd" +version = "0.5.2" +source = "git+https://codeberg.org/unspeaker/tengri?rev=86236b7#86236b76cd421a67ece0633d38436cd38c770d9e" dependencies = [ "tengri_dsl", ] [[package]] name = "tengri_output" -version = "0.5.1" -source = "git+https://codeberg.org/unspeaker/tengri?rev=829d35b#829d35b61fc4323273613695f02bb1e6bfde0cbd" +version = "0.5.2" +source = "git+https://codeberg.org/unspeaker/tengri?rev=86236b7#86236b76cd421a67ece0633d38436cd38c770d9e" dependencies = [ "tengri_dsl", ] [[package]] name = "tengri_tui" -version = "0.5.1" -source = "git+https://codeberg.org/unspeaker/tengri?rev=829d35b#829d35b61fc4323273613695f02bb1e6bfde0cbd" +version = "0.5.2" +source = "git+https://codeberg.org/unspeaker/tengri?rev=86236b7#86236b76cd421a67ece0633d38436cd38c770d9e" dependencies = [ "atomic_float", "better-panic", diff --git a/Cargo.toml b/Cargo.toml index 62ddf02a..dfb43c76 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,7 +19,7 @@ lto = false [workspace.dependencies.tengri] git = "https://codeberg.org/unspeaker/tengri" -rev = "829d35b" +rev = "86236b7" features = [ "tui", "dsl" ] [workspace.dependencies] diff --git a/app/edn/view_arranger.edn b/app/edn/view_arranger.edn index 01c42c51..79aa05ed 100644 --- a/app/edn/view_arranger.edn +++ b/app/edn/view_arranger.edn @@ -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 diff --git a/app/src/cli.rs b/app/src/cli.rs index 2dfc31d2..38b52c9e 100644 --- a/app/src/cli.rs +++ b/app/src/cli.rs @@ -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, }, diff --git a/app/src/view.rs b/app/src/view.rs index e46382db..10eb466f 100644 --- a/app/src/view.rs +++ b/app/src/view.rs @@ -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())))))) } } diff --git a/app/src/view/view_layout.rs b/app/src/view/view_layout.rs index 7e57bafe..34fb37e8 100644 --- a/app/src/view/view_layout.rs +++ b/app/src/view/view_layout.rs @@ -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>> ( diff --git a/app/src/view/view_sizes.rs b/app/src/view/view_sizes.rs index e3de0d7b..edbc5b07 100644 --- a/app/src/view/view_sizes.rs +++ b/app/src/view/view_sizes.rs @@ -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 { diff --git a/app/src/view/view_track.rs b/app/src/view/view_track.rs index d0df6e5a..61f06d9c 100644 --- a/app/src/view/view_track.rs +++ b/app/src/view/view_track.rs @@ -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,