mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 11:46:41 +01:00
beginning to look hot
This commit is contained in:
parent
cdbcea0a8f
commit
13af81c5ad
3 changed files with 25 additions and 24 deletions
|
|
@ -181,9 +181,6 @@ impl Tek {
|
|||
}
|
||||
Ok(())
|
||||
}
|
||||
fn cell <T: Content<TuiOut>> (theme: ItemPalette, field: T) -> impl Content<TuiOut> {
|
||||
Tui::fg_bg(theme.lightest.rgb, theme.base.rgb, Fixed::y(1, field))
|
||||
}
|
||||
}
|
||||
pub trait Device: Send + Sync + std::fmt::Debug {
|
||||
fn boxed <'a> (self) -> Box<dyn Device + 'a> where Self: Sized + 'a { Box::new(self) }
|
||||
|
|
|
|||
|
|
@ -266,9 +266,10 @@ impl Tek {
|
|||
let tracks = move||self.tracks_sizes(self.is_editing(), self.editor_w()).map_while(filter);
|
||||
Align::x(Tui::bg(Yellow, Map::new(tracks, move|(index, track, x1, x2), _|{
|
||||
let width = (x2 - x1) as u16;
|
||||
let content = Fixed::y(1, f(index, track));
|
||||
let styled = Tui::fg_bg(track.color.lightest.rgb, track.color.base.rgb, content);
|
||||
map_east(x1 as u16, width, Align::y(Fixed::x(width, styled))) }))) }
|
||||
map_east(x1 as u16, width, Fixed::x(width, Tui::fg_bg(
|
||||
track.color.lightest.rgb,
|
||||
track.color.base.rgb,
|
||||
Fill::y(Align::y(Fixed::y(1, f(index, track))))))) }))) }
|
||||
fn per_track_top <'a, T: Content<TuiOut> + 'a> (
|
||||
&'a self, f: impl Fn(usize, &'a Track)->T + Send + Sync + 'a
|
||||
) -> impl Content<TuiOut> + 'a {
|
||||
|
|
@ -277,9 +278,10 @@ impl Tek {
|
|||
let tracks = move||self.tracks_sizes(self.is_editing(), self.editor_w()).map_while(filter);
|
||||
Align::x(Tui::bg(Green, Map::new(tracks, move|(index, track, x1, x2), _|{
|
||||
let width = (x2 - x1) as u16;
|
||||
let content = Fixed::y(1, f(index, track));
|
||||
let styled = Tui::fg_bg(track.color.lightest.rgb, track.color.base.rgb, content);
|
||||
map_east(x1 as u16, width, Fixed::x(width, styled)) }))) }
|
||||
map_east(x1 as u16, width, Fixed::x(width, Tui::fg_bg(
|
||||
track.color.lightest.rgb,
|
||||
track.color.base.rgb,
|
||||
Fixed::y(1, f(index, track))))) }))) }
|
||||
fn io_ports <'a, T: PortsSizes<'a>> (
|
||||
&'a self, fg: Color, bg: Color, iter: impl Fn()->T + Send + Sync + 'a
|
||||
) -> impl Content<TuiOut> + 'a {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ impl Tek {
|
|||
pub fn view_tracks (&self) -> impl Content<TuiOut> + use<'_> {
|
||||
let data = (self.selected.track().unwrap_or(0), self.tracks().len());
|
||||
self.fmtd.write().unwrap().trks.update(Some(data), rewrite!(buf, "({}/{})", data.0, data.1));
|
||||
self.row(self.w(), 3, Align::w(Bsp::e(
|
||||
self.row(self.w(), 1, Align::w(Bsp::e(
|
||||
self.button3(" t", "track", self.fmtd.read().unwrap().trks.view.clone()),
|
||||
self.button2(" T", "add track"),
|
||||
)), self.per_track(|t, track|{
|
||||
|
|
@ -34,20 +34,24 @@ impl Tek {
|
|||
})) }),
|
||||
move|(_, scene, y1, y2, prev), s| {
|
||||
let height = (1 + y2 - y1) as u16;
|
||||
let bg = scene.color;
|
||||
let fg = scene.color.lightest.rgb;
|
||||
let name = Some(scene.name.clone());
|
||||
map_south(y1 as u16, height, Fixed::y(height, self.view_clip_cell(
|
||||
true, s, &bg, prev, name, " ⯈ ", fg)))
|
||||
})).boxed(),
|
||||
let bg = scene.color;
|
||||
let fg = scene.color.lightest.rgb;
|
||||
let name = Some(scene.name.clone());
|
||||
let cell = self.clip_cell(true, s, &bg, prev, name, " ⯈ ", fg);
|
||||
map_south(y1 as u16, height, Fixed::y(height, cell)) })).boxed(),
|
||||
self.per_track(move|t, track|{
|
||||
let same_track = selected_track == Some(t+1);
|
||||
Map::new(
|
||||
move||self.scenes_sizes(editing, 2, 15).map_while(
|
||||
move|(s, scene, y1, y2)|if y2 as u16 > h { None } else { Some((s, scene, y1, y2, if s == 0 {
|
||||
None } else { Some(self.scenes[s-1].clips[t].as_ref()
|
||||
move|(s, scene, y1, y2)|if y2 as u16 > h {
|
||||
None
|
||||
} else { Some((s, scene, y1, y2, if s == 0 {
|
||||
None
|
||||
} else {
|
||||
Some(self.scenes[s-1].clips[t].as_ref()
|
||||
.map(|c|c.read().unwrap().color)
|
||||
.unwrap_or(ItemPalette::G[32])) })) }),
|
||||
.unwrap_or(ItemPalette::G[32]))
|
||||
})) }),
|
||||
move|(_, scene, y1, y2, prev), s| {
|
||||
let height = (1 + y2 - y1) as u16;
|
||||
let (name, fg, bg) = if let Some(clip) = &scene.clips[t] {
|
||||
|
|
@ -58,12 +62,10 @@ impl Tek {
|
|||
};
|
||||
let active = editing && same_track && selected_scene == Some(s+1);
|
||||
let edit = |x|Bsp::b(x, When(active, &self.editor));
|
||||
map_south(y1 as u16, height, edit(Fixed::y(height, self.view_clip_cell(
|
||||
same_track, s, &bg, prev, name, " ⏹ ", fg))))})
|
||||
}))
|
||||
}
|
||||
let cell = self.clip_cell(same_track, s, &bg, prev, name, " ⏹ ", fg);
|
||||
map_south(y1 as u16, height, edit(Fixed::y(height, cell)))}) })) }
|
||||
const TAB: &str = " Tab";
|
||||
fn view_clip_cell <'a> (
|
||||
fn clip_cell <'a> (
|
||||
&self,
|
||||
same_track: bool,
|
||||
scene: usize,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue