mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
align track header headers
This commit is contained in:
parent
0d9bb709a5
commit
a9288cb0c2
1 changed files with 35 additions and 30 deletions
|
|
@ -201,8 +201,6 @@ pub trait TracksView: HasSize<TuiOut> + HasTrackScroll + HasSelection + HasMidiI
|
|||
.then_some((t, track, x1, x2)))
|
||||
}
|
||||
fn view_track_names (&self, theme: ItemTheme) -> impl Content<TuiOut> {
|
||||
let header = Fixed::x(20, Tui::bg(theme.darkest.rgb,
|
||||
row!(Tui::bold(true, "[t]rack"), "[T] add")));
|
||||
let content = Fixed::y(1, Align::w(Tui::bg(theme.darker.rgb, Align::w(Fill::x(
|
||||
Stack::east(move|add: &mut dyn FnMut(&dyn Render<TuiOut>)|{
|
||||
for (index, track, x1, x2) in self
|
||||
|
|
@ -210,20 +208,21 @@ pub trait TracksView: HasSize<TuiOut> + HasTrackScroll + HasSelection + HasMidiI
|
|||
.skip(self.track_scroll())
|
||||
{
|
||||
(add)(&Fixed::x(track.width as u16,
|
||||
Tui::bg(track.color.dark.rgb, Align::nw(Tui::fg(
|
||||
Tui::bg(track.color.base.rgb, Align::nw(Tui::fg(
|
||||
Rgb(255, 255, 255), Tui::bold(true,
|
||||
format!("{}", track.name)))))));
|
||||
}
|
||||
}))))));
|
||||
Bsp::w(header, content)
|
||||
Bsp::w(
|
||||
self.view_track_header(theme, row!(Tui::bold(true, "[t]rack "), "[T] +")),
|
||||
content
|
||||
)
|
||||
}
|
||||
fn view_track_outputs <'a> (&'a self, theme: ItemTheme) -> impl Content<TuiOut> {
|
||||
let mut max_outputs = 0u16;
|
||||
for track in self.tracks().iter() {
|
||||
max_outputs = max_outputs.max(track.sequencer.midi_outs.len() as u16);
|
||||
}
|
||||
let header = Fixed::x(20, Tui::bg(theme.darkest.rgb,
|
||||
col!(Tui::bold(true, "[o]utput"), "[O] Add")));
|
||||
let content = Align::w(Fixed::y(max_outputs + 1,
|
||||
Tui::bg(theme.darker.rgb, Align::w(Fill::x(
|
||||
Stack::east(move|add: &mut dyn FnMut(&dyn Render<TuiOut>)|{
|
||||
|
|
@ -232,20 +231,23 @@ pub trait TracksView: HasSize<TuiOut> + HasTrackScroll + HasSelection + HasMidiI
|
|||
.skip(self.track_scroll())
|
||||
{
|
||||
(add)(&Fixed::x(track.width as u16, Align::nw(Bsp::s(
|
||||
format!("[mut] [sol]"),
|
||||
Tui::bg(track.color.base.rgb, Fill::x(Align::w(format!("[mut] [sol]")))),
|
||||
Map::south(1, ||track.sequencer.midi_outs.iter(),
|
||||
|port, index|Tui::fg(Rgb(255, 255, 255),
|
||||
format!("{index}: {}", port.name())))))));
|
||||
Tui::bg(track.color.dark.rgb, Fill::x(Align::w(
|
||||
format!("{index}: {}", port.name()))))))))));
|
||||
}
|
||||
}))))));
|
||||
Bsp::w(header, content)
|
||||
Bsp::w(
|
||||
self.view_track_header(theme, row!(Tui::bold(true, "[o]utput"), "[O] +")),
|
||||
content
|
||||
)
|
||||
}
|
||||
fn view_track_inputs <'a> (&'a self, theme: ItemTheme) -> impl Content<TuiOut> {
|
||||
let mut h = 0u16;
|
||||
for track in self.tracks().iter() {
|
||||
h = h.max(track.sequencer.midi_ins.len() as u16);
|
||||
}
|
||||
let header = Tui::bg(theme.darkest.rgb, row!(Tui::bold(true, "[i]nputs"), "[I] Add"));
|
||||
let content = Tui::bg(theme.darker.rgb, Align::w(Fill::x(
|
||||
Stack::east(move|add: &mut dyn FnMut(&dyn Render<TuiOut>)|{
|
||||
for (index, track, x1, x2) in self
|
||||
|
|
@ -253,16 +255,17 @@ pub trait TracksView: HasSize<TuiOut> + HasTrackScroll + HasSelection + HasMidiI
|
|||
.skip(self.track_scroll())
|
||||
{
|
||||
add(&Fixed::xy(track.width as u16, h + 1,
|
||||
Tui::bg(track.color.dark.rgb, Align::nw(Bsp::s(
|
||||
format!("[rec] [mon]"),
|
||||
Align::nw(Bsp::s(
|
||||
Tui::bg(track.color.base.rgb,
|
||||
Fill::x(Align::w(format!("[rec] [mon]")))),
|
||||
Map::south(1, ||track.sequencer.midi_ins.iter(),
|
||||
|port, index|Tui::fg(Rgb(255, 255, 255),
|
||||
format!("{index}: {}", port.name()))))))));
|
||||
|port, index|Tui::fg_bg(Rgb(255, 255, 255), track.color.dark.rgb,
|
||||
Fill::x(Align::w(format!("{index}: {}", port.name())))))))));
|
||||
}
|
||||
|
||||
}))));
|
||||
Bsp::w(
|
||||
Fixed::x(20, header),
|
||||
self.view_track_header(theme, row!(Tui::bold(true, "[i]nputs"), "[I] +")),
|
||||
Fixed::y(h, Fill::x(Align::w(Fixed::y(h + 1, content)))),
|
||||
)
|
||||
}
|
||||
|
|
@ -271,9 +274,10 @@ pub trait TracksView: HasSize<TuiOut> + HasTrackScroll + HasSelection + HasMidiI
|
|||
for track in self.tracks().iter() {
|
||||
h = h.max(track.devices.len() as u16);
|
||||
}
|
||||
let header = Tui::bg(theme.darkest.rgb, col!(Tui::bold(true, "[d]evice"), "[D] Add"));
|
||||
let content = Tui::bg(theme.darker.rgb, Align::w(Fill::x(
|
||||
Stack::east(move|add: &mut dyn FnMut(&dyn Render<TuiOut>)|{
|
||||
Bsp::w(
|
||||
self.view_track_header(theme, row!(Tui::bold(true, "[d]evice "), "[D]+")),
|
||||
Fixed::y(h, Tui::bg(theme.darker.rgb, Align::w(Fill::x(Stack::east(
|
||||
move|add: &mut dyn FnMut(&dyn Render<TuiOut>)|{
|
||||
for (index, track, x1, x2) in self
|
||||
.tracks_with_sizes(&self.selection(), None)
|
||||
.skip(self.track_scroll())
|
||||
|
|
@ -282,11 +286,12 @@ pub trait TracksView: HasSize<TuiOut> + HasTrackScroll + HasSelection + HasMidiI
|
|||
Tui::bg(track.color.dark.rgb, Align::nw(Map::south(1, move||0..h,
|
||||
|_, index|format!("{index}: {}", "--------"))))));
|
||||
}
|
||||
}))));
|
||||
Bsp::w(
|
||||
Fixed::x(20, header),
|
||||
Fixed::y(h, content),
|
||||
)
|
||||
}))))))
|
||||
}
|
||||
fn view_track_header <'a, T: Content<TuiOut>> (
|
||||
&'a self, theme: ItemTheme, content: T
|
||||
) -> impl Content<TuiOut> {
|
||||
Fixed::x(20, Tui::bg(theme.darker.rgb, Fill::x(Align::e(content))))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue