mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-09 05:06:43 +01:00
make vertical space for editor
This commit is contained in:
parent
36707fc7eb
commit
a0ce7522c3
2 changed files with 37 additions and 29 deletions
|
|
@ -5,7 +5,7 @@ pub fn map_south<O: Output>(
|
||||||
item_height: O::Unit,
|
item_height: O::Unit,
|
||||||
item: impl Content<O>
|
item: impl Content<O>
|
||||||
) -> impl Content<O> {
|
) -> impl Content<O> {
|
||||||
Push::y(item_offset, Align::n(Fixed::y(item_height, Fill::x(item))))
|
Push::y(item_offset, Align::n(Fixed::y(item_height, Align::n(Fill::x(item)))))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn map_south_west<O: Output>(
|
pub fn map_south_west<O: Output>(
|
||||||
|
|
|
||||||
|
|
@ -74,9 +74,10 @@ impl Arranger {
|
||||||
(move||Fixed::y(2, Map::new(||self.tracks_with_widths(), move|(_, track, x1, x2), i| {
|
(move||Fixed::y(2, Map::new(||self.tracks_with_widths(), move|(_, track, x1, x2), i| {
|
||||||
let color: ItemPalette = track.color();
|
let color: ItemPalette = track.color();
|
||||||
let color: ItemPalette = track.color().dark.into();
|
let color: ItemPalette = track.color().dark.into();
|
||||||
let until_next = Self::cell(color, Tui::bold(true, Self::cell_until_next(track, &self.clock().playhead)));
|
let cell = Self::cell_until_next(track, &self.clock().playhead);
|
||||||
let value = Tui::fg_bg(color.lightest.rgb, color.base.rgb, until_next);
|
let cell = Self::cell(color, Tui::bold(true, cell));
|
||||||
let cell = Bsp::s(value, phat_hi(color.dark.rgb, color.darker.rgb));
|
let cell = Tui::fg_bg(color.lightest.rgb, color.base.rgb, cell);
|
||||||
|
let cell = Bsp::s(cell, phat_hi(color.dark.rgb, color.darker.rgb));
|
||||||
Tui::bg(color.base.rgb, map_east(x1 as u16, (x2 - x1) as u16, cell))
|
Tui::bg(color.base.rgb, map_east(x1 as u16, (x2 - x1) as u16, cell))
|
||||||
})).boxed()).into()
|
})).boxed()).into()
|
||||||
}
|
}
|
||||||
|
|
@ -107,6 +108,22 @@ impl Arranger {
|
||||||
})).boxed()).into()
|
})).boxed()).into()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn scenes_with_heights (&self, h: usize) -> impl Iterator<Item = (usize, &ArrangerScene, usize, usize)> {
|
||||||
|
let mut y = 0;
|
||||||
|
let editing = self.editing;
|
||||||
|
let (selected_track, selected_scene) = match self.selected {
|
||||||
|
ArrangerSelection::Clip(t, s) => (Some(t), Some(s)),
|
||||||
|
_ => (None, None)
|
||||||
|
};
|
||||||
|
self.scenes.iter().enumerate().map(move|(s, scene)|{
|
||||||
|
let active = editing && selected_track.is_some() && selected_scene == Some(s);
|
||||||
|
let height = if active { 15 } else { h };
|
||||||
|
let data = (s, scene, y, y + height);
|
||||||
|
y += height;
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
fn scene_row_headers <'a> (&'a self) -> BoxThunk<'a, TuiOut> {
|
fn scene_row_headers <'a> (&'a self) -> BoxThunk<'a, TuiOut> {
|
||||||
(||{
|
(||{
|
||||||
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);
|
||||||
|
|
@ -138,7 +155,7 @@ impl Arranger {
|
||||||
Color::Rgb(0, 0, 0)
|
Color::Rgb(0, 0, 0)
|
||||||
);
|
);
|
||||||
*last_color.write().unwrap() = color;
|
*last_color.write().unwrap() = color;
|
||||||
map_south(y1 as u16, 3, Fill::x(cell))
|
map_south(y1 as u16, h + 1, Fixed::y(h + 1, cell))
|
||||||
}
|
}
|
||||||
))).boxed()
|
))).boxed()
|
||||||
}).into()
|
}).into()
|
||||||
|
|
@ -174,22 +191,21 @@ impl Arranger {
|
||||||
//TuiTheme::g(32).into(),
|
//TuiTheme::g(32).into(),
|
||||||
//);
|
//);
|
||||||
let active = editing && selected_track == Some(t) && selected_scene == Some(s);
|
let active = editing && selected_track == Some(t) && selected_scene == Some(s);
|
||||||
let cell = Either(active,
|
let editor = Thunk::new(||&self.editor);
|
||||||
Thunk::new(||&self.editor),
|
let cell = Thunk::new(move||phat_sel_3(
|
||||||
Thunk::new(move||phat_sel_3(
|
selected_track == Some(t) && selected_scene == Some(s),
|
||||||
selected_track == Some(t) && selected_scene == Some(s),
|
Tui::fg(TuiTheme::g(64), Push::x(1, Tui::bold(true, name.to_string()))),
|
||||||
Tui::fg(TuiTheme::g(64), Push::x(1, Tui::bold(true, name.to_string()))),
|
Tui::fg(TuiTheme::g(64), Push::x(1, Tui::bold(true, name.to_string()))),
|
||||||
Tui::fg(TuiTheme::g(64), Push::x(1, Tui::bold(true, name.to_string()))),
|
if selected_track == Some(t) && selected_scene.map(|s|s+1) == Some(s) {
|
||||||
if selected_track == Some(t) && selected_scene.map(|s|s+1) == Some(s) {
|
None
|
||||||
None
|
} else {
|
||||||
} else {
|
Some(TuiTheme::g(32).into())
|
||||||
Some(TuiTheme::g(32).into())
|
},
|
||||||
},
|
TuiTheme::g(32).into(),
|
||||||
TuiTheme::g(32).into(),
|
TuiTheme::g(32).into(),
|
||||||
TuiTheme::g(32).into(),
|
));
|
||||||
))
|
let cell = Either(active, editor, cell);
|
||||||
);
|
map_south(y1 as u16, h + 1, Fill::x(cell))
|
||||||
map_south(y1 as u16, 3, Fill::x(cell))
|
|
||||||
}
|
}
|
||||||
))).boxed()
|
))).boxed()
|
||||||
))
|
))
|
||||||
|
|
@ -239,14 +255,6 @@ impl Arranger {
|
||||||
Some(result)
|
Some(result)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn scenes_with_heights (&self, h: usize) -> impl Iterator<Item = (usize, &ArrangerScene, usize, usize)> {
|
|
||||||
let mut y = 0;
|
|
||||||
self.scenes.iter().enumerate().map(move|(index, scene)|{
|
|
||||||
let data = (index, scene, y, y + h);
|
|
||||||
y += h;
|
|
||||||
data
|
|
||||||
})
|
|
||||||
}
|
|
||||||
fn scene_rows (&self) -> impl Content<TuiOut> + use<'_> {
|
fn scene_rows (&self) -> impl Content<TuiOut> + use<'_> {
|
||||||
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);
|
||||||
Map::new(||self.scenes_with_heights(1), move|(_, scene, y1, y2), i| {
|
Map::new(||self.scenes_with_heights(1), move|(_, scene, y1, y2), i| {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue