mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +01:00
make horizontal space for editor
This commit is contained in:
parent
a0ce7522c3
commit
eee10cc3eb
1 changed files with 70 additions and 57 deletions
|
|
@ -160,20 +160,41 @@ impl Arranger {
|
||||||
))).boxed()
|
))).boxed()
|
||||||
}).into()
|
}).into()
|
||||||
}
|
}
|
||||||
|
pub fn tracks_with_widths (&self)
|
||||||
|
-> impl Iterator<Item = (usize, &ArrangerTrack, usize, usize)>
|
||||||
|
{
|
||||||
|
let active = match self.selected {
|
||||||
|
ArrangerSelection::Track(t) => Some(t),
|
||||||
|
ArrangerSelection::Clip(t, _) => Some(t),
|
||||||
|
_ => None
|
||||||
|
};
|
||||||
|
Self::tracks_with_widths_static(self.tracks.as_slice(), active)
|
||||||
|
}
|
||||||
|
fn tracks_with_widths_static (tracks: &[ArrangerTrack], active: Option<usize>)
|
||||||
|
-> impl Iterator<Item = (usize, &ArrangerTrack, usize, usize)>
|
||||||
|
{
|
||||||
|
let mut x = 0;
|
||||||
|
tracks.iter().enumerate().map(move |(index, track)|{
|
||||||
|
let width = if Some(index) == active { 40 } else { track.width };
|
||||||
|
let data = (index, track, x, x + width);
|
||||||
|
x += width;
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
fn scene_row_cells <'a> (&'a self) -> BoxThunk<'a, TuiOut> {
|
fn scene_row_cells <'a> (&'a self) -> BoxThunk<'a, TuiOut> {
|
||||||
let editing = self.editing;
|
let editing = self.editing;
|
||||||
(move||Fixed::y(2, Map::new(||self.tracks_with_widths(), move|(_, track, x1, x2), t| {
|
|
||||||
let w = (x2 - x1) as u16;
|
|
||||||
let cell = Bsp::s("[Rec]", "[Mon]");
|
|
||||||
let color: ItemPalette = track.color().dark.into();
|
|
||||||
let last_color = Arc::new(RwLock::new(ItemPalette::from(Color::Rgb(0, 0, 0))));
|
|
||||||
let (selected_track, selected_scene) = match self.selected {
|
let (selected_track, selected_scene) = match self.selected {
|
||||||
ArrangerSelection::Clip(t, s) => (Some(t), Some(s)),
|
ArrangerSelection::Clip(t, s) => (Some(t), Some(s)),
|
||||||
_ => (None, None)
|
_ => (None, None)
|
||||||
};
|
};
|
||||||
map_east(x1 as u16, w, Fixed::x(w, Tui::bg(Color::Rgb(0,0,0), Fill::y(Map::new(
|
let tracks = move||self.tracks_with_widths();
|
||||||
||self.scenes_with_heights(2),
|
let scenes = ||self.scenes_with_heights(2);
|
||||||
move|(_, scene, y1, y2), s| {
|
(move||Fixed::y(2, Map::new(tracks, move|(_, track, x1, x2), t| {
|
||||||
|
let w = (x2 - x1) as u16;
|
||||||
|
let cell = Bsp::s("[Rec]", "[Mon]");
|
||||||
|
let color: ItemPalette = track.color().dark.into();
|
||||||
|
let last_color = Arc::new(RwLock::new(ItemPalette::from(Color::Rgb(0, 0, 0))));
|
||||||
|
let cells = Map::new(scenes, move|(_, scene, y1, y2), s| {
|
||||||
let h = (y2 - y1) as u16;
|
let h = (y2 - y1) as u16;
|
||||||
let color = scene.color();
|
let color = scene.color();
|
||||||
let name = "⏹ ";
|
let name = "⏹ ";
|
||||||
|
|
@ -205,28 +226,20 @@ impl Arranger {
|
||||||
TuiTheme::g(32).into(),
|
TuiTheme::g(32).into(),
|
||||||
));
|
));
|
||||||
let cell = Either(active, editor, cell);
|
let cell = Either(active, editor, cell);
|
||||||
map_south(y1 as u16, h + 1, Fill::x(cell))
|
map_south(
|
||||||
}
|
y1 as u16,
|
||||||
))).boxed()
|
h + 1,
|
||||||
))
|
Fill::x(cell)
|
||||||
|
)
|
||||||
|
});
|
||||||
|
map_east(
|
||||||
|
x1 as u16,
|
||||||
|
w,
|
||||||
|
Fixed::x(w, Tui::bg(Color::Rgb(0,0,0), Fill::y(cells)).boxed())
|
||||||
|
)
|
||||||
})).boxed()).into()
|
})).boxed()).into()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn tracks_with_widths (&self)
|
|
||||||
-> impl Iterator<Item = (usize, &ArrangerTrack, usize, usize)>
|
|
||||||
{
|
|
||||||
Self::tracks_with_widths_static(self.tracks.as_slice())
|
|
||||||
}
|
|
||||||
fn tracks_with_widths_static (tracks: &[ArrangerTrack])
|
|
||||||
-> impl Iterator<Item = (usize, &ArrangerTrack, usize, usize)>
|
|
||||||
{
|
|
||||||
let mut x = 0;
|
|
||||||
tracks.iter().enumerate().map(move |(index, track)|{
|
|
||||||
let data = (index, track, x, x + track.width);
|
|
||||||
x += track.width;
|
|
||||||
data
|
|
||||||
})
|
|
||||||
}
|
|
||||||
fn track_column_separators <'a> (&'a self) -> impl Content<TuiOut> + 'a {
|
fn track_column_separators <'a> (&'a self) -> impl Content<TuiOut> + 'a {
|
||||||
let scenes_w = 16;//.max(SCENES_W_OFFSET + ArrangerScene::longest_name(&self.scenes) as u16);
|
let scenes_w = 16;//.max(SCENES_W_OFFSET + ArrangerScene::longest_name(&self.scenes) as u16);
|
||||||
let fg = Color::Rgb(64,64,64);
|
let fg = Color::Rgb(64,64,64);
|
||||||
|
|
@ -291,7 +304,7 @@ impl Arranger {
|
||||||
let name = Tui::fg_bg(scene.color.lightest.rgb, scene.color.base.rgb,
|
let name = Tui::fg_bg(scene.color.lightest.rgb, scene.color.base.rgb,
|
||||||
Expand::x(1, Tui::bold(true, scene.name.clone()))
|
Expand::x(1, Tui::bold(true, scene.name.clone()))
|
||||||
);
|
);
|
||||||
let clips = Map::new(||Arranger::tracks_with_widths_static(tracks), move|(index, track, x1, x2), _|
|
let clips = Map::new(||Arranger::tracks_with_widths_static(tracks, None), move|(index, track, x1, x2), _|
|
||||||
Push::x((x2 - x1) as u16, Self::cell_clip(scene, index, track, (x2 - x1) as u16, height))
|
Push::x((x2 - x1) as u16, Self::cell_clip(scene, index, track, (x2 - x1) as u16, height))
|
||||||
);
|
);
|
||||||
Fixed::y(height, Bsp::e(icon, Bsp::e(name, clips)))
|
Fixed::y(height, Bsp::e(icon, Bsp::e(name, clips)))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue