mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 11:46:41 +01:00
align command buttons
This commit is contained in:
parent
29b2789be6
commit
aeb1f7a9e0
5 changed files with 52 additions and 38 deletions
|
|
@ -24,7 +24,7 @@
|
|||
(bsp/s
|
||||
:view-status-h2
|
||||
(bsp/n (fill/x (align/w :view-tracks-inputs))
|
||||
(bsp/n (fill/x (align/w :view-tracks-devices))
|
||||
(bsp/s (fill/x (align/w :view-tracks-names))
|
||||
(bsp/s (fill/x (align/w :view-tracks-outputs))
|
||||
(bsp/s (fill/x (align/w :view-tracks-tracks))
|
||||
(bsp/s (fill/x (align/w :view-tracks-devices))
|
||||
:view-tracks-scenes)))))))))
|
||||
|
|
|
|||
|
|
@ -118,13 +118,13 @@ impl App {
|
|||
Fixed::y(2, self.project.view_track_inputs(self.color))
|
||||
}
|
||||
pub fn view_tracks_outputs <'a> (&'a self) -> impl Content<TuiOut> + use<'a> {
|
||||
Fixed::y(3, self.project.view_track_outputs(self.color))
|
||||
Fixed::y(1 + self.project.midi_outs.len() as u16, self.project.view_track_outputs(self.color, self.midi_outs().len().min(24) as u16))
|
||||
}
|
||||
pub fn view_tracks_devices <'a> (&'a self) -> impl Content<TuiOut> + use<'a> {
|
||||
Fixed::y(3, self.project.view_track_devices(self.color))
|
||||
}
|
||||
pub fn view_tracks_tracks <'a> (&'a self) -> impl Content<TuiOut> + use<'a> {
|
||||
Fixed::y(1, self.project.view_track_names(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))
|
||||
}
|
||||
pub fn view_pool (&self) -> impl Content<TuiOut> + use<'_> {
|
||||
Fixed::x(20, Bsp::s(
|
||||
|
|
|
|||
|
|
@ -56,11 +56,11 @@ pub enum LaunchMode {
|
|||
/// 🎧 Multi-track MIDI sequencer.
|
||||
Arranger {
|
||||
/// Number of scenes
|
||||
#[arg(short = 'y', long, default_value_t = 8)] scenes: usize,
|
||||
#[arg(short = 'y', long, default_value_t = 16)] scenes: usize,
|
||||
/// Number of tracks
|
||||
#[arg(short = 'x', long, default_value_t = 4)] tracks: usize,
|
||||
#[arg(short = 'x', long, default_value_t = 12)] tracks: usize,
|
||||
/// Width of tracks
|
||||
#[arg(short = 'w', long, default_value_t = 14)] track_width: usize,
|
||||
#[arg(short = 'w', long, default_value_t = 15)] track_width: usize,
|
||||
},
|
||||
/// TODO: A MIDI-controlled audio mixer
|
||||
Mixer,
|
||||
|
|
|
|||
|
|
@ -129,6 +129,22 @@ impl ArrangementCommand {
|
|||
todo!("delegate");
|
||||
Ok(None)
|
||||
}
|
||||
fn output_add (arranger: &mut Arrangement) -> Perhaps<Self> {
|
||||
arranger.midi_outs.push(JackMidiOut::new(
|
||||
arranger.jack(),
|
||||
format!("/M{}", arranger.midi_outs.len() + 1),
|
||||
&[]
|
||||
)?);
|
||||
Ok(None)
|
||||
}
|
||||
fn input_add (arranger: &mut Arrangement) -> Perhaps<Self> {
|
||||
arranger.midi_ins.push(JackMidiIn::new(
|
||||
arranger.jack(),
|
||||
format!("M{}/", arranger.midi_ins.len() + 1),
|
||||
&[]
|
||||
)?);
|
||||
Ok(None)
|
||||
}
|
||||
fn scene_add (arranger: &mut Arrangement) -> Perhaps<Self> {
|
||||
let index = arranger.scene_add(None, None)?.0;
|
||||
*arranger.selection_mut() = match arranger.selection() {
|
||||
|
|
|
|||
|
|
@ -55,9 +55,9 @@ pub trait TracksView:
|
|||
content: impl Content<TuiOut>
|
||||
) -> impl Content<TuiOut> {
|
||||
Bsp::w(
|
||||
Fixed::x(4, button_add),
|
||||
Fill::y(Fixed::x(4, Align::nw(button_add))),
|
||||
Bsp::e(
|
||||
Fixed::x(20, Align::w(button)),
|
||||
Fixed::x(20, Fill::y(Align::nw(button))),
|
||||
Fill::xy(Align::c(content))
|
||||
)
|
||||
)
|
||||
|
|
@ -72,7 +72,7 @@ pub trait TracksView:
|
|||
theme,
|
||||
button_2("t", "rack", false),
|
||||
button_2("T", "+", false),
|
||||
Tui::bg(theme.darker.rgb, Fixed::y(1, Fill::x(
|
||||
Tui::bg(theme.darker.rgb, Fixed::y(2, 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),
|
||||
|
|
@ -80,39 +80,37 @@ pub trait TracksView:
|
|||
track.color.light.rgb
|
||||
} else {
|
||||
track.color.base.rgb
|
||||
}, Align::nw(Bsp::e(
|
||||
}, Bsp::s(Fill::x(Align::nw(Bsp::e(
|
||||
format!("·t{index:02} "),
|
||||
Tui::fg(Rgb(255, 255, 255), Tui::bold(true, &track.name))
|
||||
)))));
|
||||
))), Tui::bg(if self.selection().track() == Some(index) {
|
||||
track.color.light.rgb
|
||||
} else {
|
||||
track.color.base.rgb
|
||||
}, Fill::x(Align::w(format!("·mute ·solo"))))))));
|
||||
}
|
||||
})))))
|
||||
}
|
||||
fn view_track_outputs <'a> (&'a self, theme: ItemTheme) -> impl Content<TuiOut> {
|
||||
let mut h = 0u16;
|
||||
for track in self.tracks().iter() {
|
||||
h = h.max(track.sequencer.midi_outs.len() as u16);
|
||||
}
|
||||
self.view_track_row_section(
|
||||
theme,
|
||||
button_2("o", "utput", false),
|
||||
fn view_track_outputs <'a> (&'a self, theme: ItemTheme, h: u16) -> impl Content<TuiOut> {
|
||||
self.view_track_row_section(theme,
|
||||
Bsp::s(
|
||||
Fill::x(Align::w(button_2("o", "utput", false))),
|
||||
Fill::xy(Stack::south(|add: &mut dyn FnMut(&dyn Render<TuiOut>)|{
|
||||
for port in self.midi_outs().iter() {
|
||||
add(&Push::x(2, Fill::x(Align::w(port.name()))));
|
||||
}
|
||||
}))),
|
||||
button_2("O", "+", false),
|
||||
Align::w(Fixed::y(1 + h*2,
|
||||
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),
|
||||
Align::nw(Bsp::n(
|
||||
Tui::bg(if self.selection().track() == Some(index) {
|
||||
track.color.light.rgb
|
||||
} else {
|
||||
track.color.base.rgb
|
||||
}, Fill::x(Align::w(format!("·mute ·solo")))),
|
||||
Map::south(2, ||track.sequencer.midi_outs.iter(),
|
||||
|port, index|Tui::fg(Rgb(255, 255, 255),
|
||||
Fixed::y(2, Tui::bg(track.color.dark.rgb, Fill::x(Align::w(
|
||||
format!("·o{index:02} {}", port.name())))))))))));
|
||||
}
|
||||
})))))))
|
||||
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),
|
||||
Align::nw(Fill::y(Map::south(1, ||track.sequencer.midi_outs.iter(),
|
||||
|port, index|Tui::fg(Rgb(255, 255, 255),
|
||||
Fixed::y(1, Tui::bg(track.color.dark.rgb, Fill::x(Align::w(
|
||||
format!("·o{index:02} {}", port.name())))))))))));
|
||||
}
|
||||
})))))
|
||||
}
|
||||
fn view_track_devices <'a> (&'a self, theme: ItemTheme) -> impl Content<TuiOut> {
|
||||
let mut h = 2u16;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue