mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 03:36:41 +01:00
use stack in view_inputs
This commit is contained in:
parent
50c263b4d3
commit
958e602577
3 changed files with 61 additions and 49 deletions
2
Justfile
2
Justfile
|
|
@ -64,7 +64,7 @@ arranger-ext:
|
|||
arranger-release:
|
||||
{{release}} {{name}} {{bpm}} arranger
|
||||
arranger-release-ext:
|
||||
{{release}} {{name}} {{bpm}} {{midi-in}} {{midi-out}} arranger
|
||||
{{release}} {{name}} {{bpm}} {{midi-in}} {{firefox-in}} {{midi-out}} arranger
|
||||
|
||||
groovebox:
|
||||
{{debug}} {{name}} {{bpm}} groovebox
|
||||
|
|
|
|||
|
|
@ -127,11 +127,10 @@ impl App {
|
|||
self.project.view_inputs(self.color))
|
||||
}
|
||||
pub fn view_tracks_outputs <'a> (&'a self) -> impl Content<TuiOut> + use<'a> {
|
||||
Fixed::y(1 + self.project.midi_outs.len() as u16,
|
||||
self.project.view_outputs(self.color))
|
||||
self.project.view_outputs(self.color)
|
||||
}
|
||||
pub fn view_tracks_devices <'a> (&'a self) -> impl Content<TuiOut> + use<'a> {
|
||||
Fixed::y(2, self.project.view_track_devices(self.color))
|
||||
Fixed::y(4, self.project.view_track_devices(self.color))
|
||||
}
|
||||
pub fn view_tracks_names <'a> (&'a self) -> impl Content<TuiOut> + use<'a> {
|
||||
Fixed::y(2, self.project.view_track_names(self.color))
|
||||
|
|
|
|||
|
|
@ -7,78 +7,91 @@ impl Arrangement {
|
|||
h = h.max(self.midi_ins.len() as u16);
|
||||
}
|
||||
let h = h + 1;
|
||||
let list = Fixed::x(20, Fill::y(Stack::south(move|add: &mut dyn FnMut(&dyn Render<TuiOut>)|{
|
||||
add(&Fixed::y(1, Align::w(
|
||||
button_3("i", "nput ", format!("{}", self.midi_ins.len()), false))));
|
||||
for (index, port) in self.midi_ins.iter().enumerate() {
|
||||
add(&Fixed::y(1, Fill::x(Align::w(format!("·i{index:02} {}", port.name())))));
|
||||
}
|
||||
})));
|
||||
self.view_track_row_section(theme, list, button_2("I", "+", false),
|
||||
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() {
|
||||
add(&Fixed::x(self.track_width(index, track),
|
||||
Stack::south(move|add: &mut dyn FnMut(&dyn Render<TuiOut>)|{
|
||||
let index = 0;
|
||||
add(&Fixed::y(1, track.sequencer.midi_ins.get(0).map(|port|
|
||||
Tui::fg_bg(Rgb(255, 255, 255), track.color.base.rgb,
|
||||
Fill::x(Align::w(format!("·i{index:02} {}", port.name())))))));
|
||||
for (index, port) in self.midi_ins().iter().enumerate() {
|
||||
add(&Fixed::y(1, Align::w(row!(
|
||||
Either(track.sequencer.monitoring, Tui::fg(Green, "●mon "), "·mon "),
|
||||
Either(track.sequencer.recording, Tui::fg(Red, "●rec "), "·rec "),
|
||||
Either(track.sequencer.overdub, Tui::fg(Yellow, "●dub "), "·dub "),
|
||||
))));
|
||||
Stack::south(move|add: &mut dyn FnMut(&dyn Render<TuiOut>)|{
|
||||
add(&Fixed::y(1,
|
||||
Bsp::e(Fixed::x(20, Align::w(button_3("i", "nput ", format!("{}", self.midi_ins.len()), false))),
|
||||
Bsp::w(Fixed::x(4, button_2("I", "+", false)),
|
||||
Stack::east(move|add: &mut dyn FnMut(&dyn Render<TuiOut>)|{
|
||||
for (index, track, x1, x2) in self.tracks_with_sizes() {
|
||||
add(&Align::w(row!(
|
||||
Either(track.sequencer.monitoring, Tui::fg(Green, "mon "), "mon "),
|
||||
Either(track.sequencer.recording, Tui::fg(Red, "rec "), "rec "),
|
||||
Either(track.sequencer.overdub, Tui::fg(Yellow, "dub "), "dub "),
|
||||
)))
|
||||
}
|
||||
})))));
|
||||
for (index, port) in self.midi_ins().iter().enumerate() {
|
||||
add(&Fixed::y(1,
|
||||
Bsp::e(Fixed::x(20, Align::w(format!(" ● i{index:02} {}", port.name()))),
|
||||
Bsp::w(Fixed::x(4, ()),
|
||||
Stack::east(move|add: &mut dyn FnMut(&dyn Render<TuiOut>)|{
|
||||
for (index, track, x1, x2) in self.tracks_with_sizes() {
|
||||
add(&Align::w(row!(
|
||||
Either(track.sequencer.monitoring, Tui::fg(Green, " ● "), " · "),
|
||||
Either(track.sequencer.recording, Tui::fg(Red, " ● "), " · "),
|
||||
Either(track.sequencer.overdub, Tui::fg(Yellow, " ● "), " · "),
|
||||
)))
|
||||
}
|
||||
})))}})))))
|
||||
})))));
|
||||
}
|
||||
})
|
||||
}
|
||||
pub fn view_outputs <'a> (&'a self, theme: ItemTheme) -> impl Content<TuiOut> + 'a {
|
||||
let mut h = 1u16;
|
||||
for track in self.tracks().iter() {
|
||||
h = h.max(track.sequencer.midi_outs.len() as u16);
|
||||
let mut h = 1;
|
||||
for output in self.midi_outs().iter() {
|
||||
h += 1 + output.conn().len();
|
||||
}
|
||||
let h = h + 1;
|
||||
let h = h as u16;
|
||||
let list = Bsp::s(
|
||||
Fixed::y(1, Fill::x(Align::w(button_3("o", "utput", format!("{}", self.midi_outs.len()), false)))),
|
||||
Fixed::y(h - 1, Fill::xy(Align::nw(Stack::south(|add: &mut dyn FnMut(&dyn Render<TuiOut>)|{
|
||||
for (index, port) in self.midi_outs().iter().enumerate() {
|
||||
add(&Fill::x(Align::w(format!("·o{index:02} {}", port.name()))));
|
||||
add(&Fixed::y(1,Fill::x(Bsp::e(
|
||||
Align::w(Bsp::e(format!(" ● o{index:02} "), Tui::fg(Rgb(255,255,255),Tui::bold(true, port.name())))),
|
||||
Fill::x(Align::e(format!("{}/{} ",
|
||||
port.port().get_connections().len(),
|
||||
port.conn().len())))))));
|
||||
for (index, conn) in port.conn().iter().enumerate() {
|
||||
add(&Fixed::y(1, Fill::x(Align::w(format!(" c{index:02}{}", conn.info())))));
|
||||
}
|
||||
}
|
||||
})))));
|
||||
self.view_track_row_section(theme, list, button_2("O", "+", false),
|
||||
Fixed::y(h, self.view_track_row_section(theme, list, button_2("O", "+", false),
|
||||
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() {
|
||||
add(&Fixed::x(self.track_width(index, track),
|
||||
Stack::south(move|add: &mut dyn FnMut(&dyn Render<TuiOut>)|{
|
||||
let index = 0;
|
||||
add(&Fixed::y(1, track.sequencer.midi_outs.get(0).map(|port|
|
||||
Tui::fg_bg(Rgb(255, 255, 255), track.color.base.rgb,
|
||||
Fill::x(Align::w(format!("·o{index:02} {}", port.name())))))));
|
||||
add(&Fixed::y(1, Align::w(Bsp::e(
|
||||
Either(true, Tui::fg(Green, "play "), "play "),
|
||||
Either(false, Tui::fg(Yellow, "solo "), "solo "),
|
||||
))));
|
||||
for (index, port) in self.midi_outs().iter().enumerate() {
|
||||
add(&Fixed::y(1, Align::w(Bsp::e(
|
||||
Either(true, Tui::fg(Green, "●play "), "·play "),
|
||||
Either(false, Tui::fg(Yellow, "●solo "), "·solo "),
|
||||
|
||||
Either(true, Tui::fg(Green, " ● "), " · "),
|
||||
Either(false, Tui::fg(Yellow, " ● "), " · "),
|
||||
))));
|
||||
}
|
||||
})))}})))))
|
||||
for (index, conn) in port.conn().iter().enumerate() {
|
||||
add(&Fixed::y(1, Fill::x("")));
|
||||
}
|
||||
}})))}}))))))
|
||||
}
|
||||
pub fn view_track_devices <'a> (&'a self, theme: ItemTheme) -> impl Content<TuiOut> + 'a {
|
||||
let mut h = 2u16;
|
||||
for track in self.tracks().iter() {
|
||||
h = h.max(track.devices.len() as u16);
|
||||
h = h.max(track.devices.len() as u16 * 2);
|
||||
}
|
||||
self.view_track_row_section(
|
||||
theme,
|
||||
button_3("d", "evice", format!("{}", self.track().map(|t|t.devices.len()).unwrap_or(0)), false),
|
||||
button_3("d", "evice", format!("{}", self.track().map(|t|t.devices.len()).unwrap_or(0)), false),
|
||||
button_2("D", "+", false),
|
||||
Stack::east(move|add: &mut dyn FnMut(&dyn Render<TuiOut>)|{
|
||||
for (index, track, x1, x2) in self.tracks_with_sizes() {
|
||||
add(&Fixed::xy(self.track_width(index, track), h + 1,
|
||||
Tui::bg(track.color.dark.rgb, Align::nw(Map::south(1, move||0..h,
|
||||
|_, index|format!("·d{index:02} {}", "--------"))))));
|
||||
Tui::bg(track.color.dark.rgb, Align::nw(Map::south(2, move||0..h,
|
||||
|_, index|Fixed::xy(track.width as u16, 2, Tui::bg(ItemTheme::G[32].base.rgb,
|
||||
Align::nw(format!(" · {}", "--")))))))));
|
||||
}
|
||||
}))
|
||||
}
|
||||
|
|
@ -129,7 +142,7 @@ pub trait TracksView:
|
|||
theme: ItemTheme,
|
||||
button: impl Content<TuiOut>,
|
||||
button_add: impl Content<TuiOut>,
|
||||
content: impl Content<TuiOut>
|
||||
content: impl Content<TuiOut>
|
||||
) -> impl Content<TuiOut> {
|
||||
Bsp::w(Fill::y(Fixed::x(4, Align::nw(button_add))),
|
||||
Bsp::e(Fixed::x(20, Fill::y(Align::nw(button))), Fill::xy(Align::c(content))))
|
||||
|
|
@ -201,7 +214,7 @@ pub trait TracksView:
|
|||
}
|
||||
self.view_track_row_section(
|
||||
theme,
|
||||
button_2("i", "nput", false),
|
||||
button_2("i", "nput", false),
|
||||
button_2("I", "+", false),
|
||||
Tui::bg(theme.darker.rgb, Align::w(Fill::x(
|
||||
Stack::east(move|add: &mut dyn FnMut(&dyn Render<TuiOut>)|{
|
||||
|
|
@ -230,7 +243,7 @@ pub trait ScenesView:
|
|||
HasSceneScroll +
|
||||
HasClipsSize +
|
||||
Send +
|
||||
Sync
|
||||
Sync
|
||||
{
|
||||
/// Default scene height.
|
||||
const H_SCENE: usize = 2;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue