mirror of
https://codeberg.org/unspeaker/tek.git
synced 2026-09-18 12:56:42 +02:00
This commit is contained in:
parent
3deef0641d
commit
d495d97516
16 changed files with 462 additions and 425 deletions
|
|
@ -50,36 +50,32 @@ pub trait ClipsView: TracksView + ScenesView {
|
|||
fn view_scenes_clips (&self) -> impl Draw<Tui> {
|
||||
let select = self.selection();
|
||||
let editor = self.editor();
|
||||
let size = self.clips_size();
|
||||
let editing = self.is_editing();
|
||||
return size.of(
|
||||
above(
|
||||
fg(Green, format!("{}x{}", size.w(), size.h())).align_se().full_wh(),
|
||||
iter_east(move||self.tracks_with_sizes().map(move|(
|
||||
track_index, track, _, _
|
||||
)| {
|
||||
iter_south(move||self.scenes_with_sizes().map(move|(
|
||||
scene_index, scene, _, _
|
||||
)| {
|
||||
let (name, theme): (Arc<str>, ItemTheme) = view_scene_name_theme(scene, track_index);
|
||||
let f = theme.lightest.term;
|
||||
let (b, o) = view_scene_bg(theme, select, track_index, scene_index);
|
||||
let w = view_scene_w(track, select, track_index, editor);
|
||||
let y = view_scene_y(select, scene_index, editor);
|
||||
let is_selected = view_scene_sel(select, track_index, scene_index, editing);
|
||||
with_clips_size(true, self.clips_size(), iter_east(move||self.tracks_with_sizes()
|
||||
.map(move|(track_index, track, _, _)|iter_south(move||self.scenes_with_sizes()
|
||||
.map(move|(scene_index, scene, _, _)|{
|
||||
let (name, theme): (Arc<str>, ItemTheme) = view_scene_name_theme(scene, track_index);
|
||||
let f = theme.lightest.term;
|
||||
let (b, o) = view_scene_bg(theme, select, track_index, scene_index);
|
||||
let is_selected = view_scene_sel(select, track_index, scene_index, editing);
|
||||
below(
|
||||
Outer(true, Style::default().fg(o)).full_wh(),
|
||||
below(
|
||||
Outer(true, Style::default().fg(o)).full_wh(),
|
||||
below(
|
||||
below(
|
||||
fg_bg(o, b, "".full_wh()),
|
||||
fg_bg(f, b, bold(true, name)).align_nw().full_wh(),
|
||||
),
|
||||
when(is_selected, editor).full_wh()
|
||||
).full_wh()
|
||||
).exact_wh(w, y)
|
||||
})).full_h().exact_w(track.width as u16)
|
||||
}))
|
||||
).full_wh());
|
||||
fg_bg(o, b, "".full_wh()),
|
||||
fg_bg(f, b, bold(true, name)).align_nw().full_wh(),
|
||||
),
|
||||
when(is_selected, editor).full_wh()
|
||||
).full_wh()
|
||||
).exact_wh(
|
||||
view_scene_w(track, select, track_index, editor),
|
||||
view_scene_y(select, scene_index, editor),
|
||||
)
|
||||
})
|
||||
)
|
||||
.full_h()
|
||||
.exact_w(track.width as u16))
|
||||
)).align_c()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -92,6 +88,11 @@ fn view_scene_name_theme (scene: &Scene, track_index: usize) -> (Arc<str>, ItemT
|
|||
}
|
||||
}
|
||||
|
||||
fn with_clips_size (show: bool, size: &Sizer, content: impl Draw<Tui>) -> impl Draw<Tui> {
|
||||
let wh = east!(size.w() as usize, "x", size.h() as usize);
|
||||
size.of(above(when(show, fg(Green, wh).align_se().full_wh()), content))
|
||||
}
|
||||
|
||||
fn view_scene_bg (
|
||||
theme: ItemTheme, select: &Selection, track_index: usize, scene_index: usize
|
||||
) -> (Color, Color) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue