mirror of
https://codeberg.org/unspeaker/tek.git
synced 2026-01-12 02:56:42 +01:00
update layout macro invocations
This commit is contained in:
parent
e677d1d7d4
commit
83eb9dd2fa
19 changed files with 153 additions and 169 deletions
|
|
@ -4,20 +4,21 @@ mod v_cursor; pub(crate) use self::v_cursor::*;
|
|||
mod v_head; pub(crate) use self::v_head::*;
|
||||
mod v_io; pub(crate) use self::v_io::*;
|
||||
mod v_sep; pub(crate) use self::v_sep::*;
|
||||
// egyptian snakes den
|
||||
const HEADER_H: u16 = 5;
|
||||
const SCENES_W_OFFSET: u16 = 3;
|
||||
impl ArrangerTui {
|
||||
pub fn render_mode_v (state: &ArrangerTui, factor: usize) -> impl Render<Tui> + use<'_> {
|
||||
lay!([
|
||||
pub fn render_mode_v (state: &ArrangerTui, factor: usize) -> impl Content<Tui> + use<'_> {
|
||||
lay!(
|
||||
ArrangerVColSep::from(state),
|
||||
ArrangerVRowSep::from((state, factor)),
|
||||
col!([
|
||||
col!(
|
||||
ArrangerVHead::from(state),
|
||||
ArrangerVIns::from(state),
|
||||
ArrangerVClips::from((state, factor)),
|
||||
ArrangerVClips::new(state, factor),
|
||||
ArrangerVOuts::from(state),
|
||||
]),
|
||||
),
|
||||
ArrangerVCursor::from((state, factor)),
|
||||
])
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,8 @@ impl<'a> ArrangerVClips<'a> {
|
|||
impl<'a, E: Engine> Content<E> for ArrangerVClips<'a> {
|
||||
fn content (&self) -> Option<impl Content<E>> {
|
||||
let iter = self.scenes.iter().zip(self.rows.iter().map(|row|row.0));
|
||||
let col = col_iter!(iter => |(scene, pulses)|Self::format_scene(self.tracks, scene, pulses));
|
||||
let col = Coll::map(self.scenes.iter().zip(self.rows.iter().map(|row|row.0)), |(scene, pulses), i|
|
||||
Self::format_scene(self.tracks, scene, pulses));
|
||||
Some(Fill::xy(col))
|
||||
}
|
||||
}
|
||||
|
|
@ -36,9 +37,8 @@ impl<'a> ArrangerVClips<'a> {
|
|||
if playing { "▶ " } else { " " }),
|
||||
Tui::fg_bg(scene.color.lightest.rgb, scene.color.base.rgb,
|
||||
Expand::x(1, Tui::bold(true, scene.name.read().unwrap().as_str()))),
|
||||
row_iter!((index, track, x1, x2) in ArrangerTrack::with_widths(tracks) => {
|
||||
Self::format_clip(scene, index, track, (x2 - x1) as u16, height)
|
||||
})))}
|
||||
Coll::map(ArrangerTrack::with_widths(tracks), |(index, track, x1, x2), _|
|
||||
Push::x(Self::format_clip(scene, index, track, (x2 - x1) as u16, height)))))}
|
||||
|
||||
fn format_clip (
|
||||
scene: &'a ArrangerScene, index: usize, track: &'a ArrangerTrack, w: u16, h: u16
|
||||
|
|
|
|||
|
|
@ -15,29 +15,27 @@ from!(<'a>|state: &'a ArrangerTui|ArrangerVHead<'a> = Self { // A
|
|||
scenes_w: SCENES_W_OFFSET + ArrangerScene::longest_name(&state.scenes) as u16,
|
||||
});
|
||||
|
||||
impl Content<Tui> for ArrangerVCursor {
|
||||
fn content (&self) -> Option<impl Content<Tui>> {
|
||||
|
||||
fn row <T: Content<Tui>> (color: ItemPalette, field: &T) -> impl Content<Tui> + use<'_, T> {
|
||||
row!([Tui::fg(color.light.rgb, "▎"), Tui::fg(color.lightest.rgb, field)])
|
||||
}
|
||||
|
||||
Some(Push::x(self.scenes_w, row_iter!(
|
||||
(_0, track, x1, x2) in ArrangerTrack::with_widths(self.tracks) => {
|
||||
let (w, h) = (ArrangerTrack::MIN_WIDTH.max(x2 - x1), HEADER_H);
|
||||
let color = track.color();
|
||||
Tui::bg(color.base.rgb, Min::xy(w as u16, h, Fixed::xy(w as u16, 5, col!([
|
||||
row(color, &Self::format_name(track, w)),
|
||||
row(color, &Self::format_input(track)?),
|
||||
row(color, &Self::format_output(track)?),
|
||||
row(color, &Self::format_elapsed(track, self.timebase)),
|
||||
row(color, &Self::format_until_next(track, self.current)),
|
||||
]))))
|
||||
}
|
||||
)))
|
||||
render!(Tui: (self: ArrangerVHead<'a>) => {
|
||||
|
||||
fn row <T: Content<Tui>> (color: ItemPalette, field: &T) -> impl Content<Tui> + use<'_, T> {
|
||||
row!(Tui::fg(color.light.rgb, "▎"), Tui::fg(color.lightest.rgb, field))
|
||||
}
|
||||
}
|
||||
|
||||
Some(Push::x(self.scenes_w,
|
||||
Coll::map(ArrangerTrack::with_widths(self.tracks), |(_, track, x1, x2), i| {
|
||||
let (w, h) = (ArrangerTrack::MIN_WIDTH.max(x2 - x1), HEADER_H);
|
||||
let color = track.color();
|
||||
Tui::bg(color.base.rgb, Min::xy(w as u16, h, Fixed::xy(w as u16, 5, col!(
|
||||
row(color, &Self::format_name(track, w)),
|
||||
row(color, &Self::format_input(track)?),
|
||||
row(color, &Self::format_output(track)?),
|
||||
row(color, &Self::format_elapsed(track, self.timebase)),
|
||||
row(color, &Self::format_until_next(track, self.current)),
|
||||
))))
|
||||
})
|
||||
))
|
||||
|
||||
});
|
||||
|
||||
impl ArrangerVHead<'_> {
|
||||
/// name and width of track
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue