mirror of
https://codeberg.org/unspeaker/tek.git
synced 2026-07-18 00:06:59 +02:00
This commit is contained in:
parent
54ab1d8ba1
commit
c72fe8ab23
5 changed files with 112 additions and 110 deletions
108
src/arrange.rs
108
src/arrange.rs
|
|
@ -109,7 +109,7 @@ pub trait ClipsView: TracksView + ScenesView {
|
|||
-> impl Draw<Tui> + 'a
|
||||
{
|
||||
self.clips_size().of(wh_full(above(
|
||||
wh_full(origin_se(Tui::fg(Green, format!("{}x{}", self.clips_size().w(), self.clips_size().h())))),
|
||||
wh_full(origin_se(fg(Green, format!("{}x{}", self.clips_size().w(), self.clips_size().h())))),
|
||||
thunk(|to: &mut Tui|for (
|
||||
track_index, track, _, _
|
||||
) in self.tracks_with_sizes() {
|
||||
|
|
@ -128,20 +128,20 @@ pub trait ClipsView: TracksView + ScenesView {
|
|||
} else {
|
||||
(" ⏹ -- ".into(), ItemTheme::G[32])
|
||||
};
|
||||
let fg = theme.lightest.rgb;
|
||||
let mut outline = theme.base.rgb;
|
||||
let fg = theme.lightest.term;
|
||||
let mut outline = theme.base.term;
|
||||
let bg = if self.selection().track() == Some(track_index)
|
||||
&& self.selection().scene() == Some(scene_index)
|
||||
{
|
||||
outline = theme.lighter.rgb;
|
||||
theme.light.rgb
|
||||
outline = theme.lighter.term;
|
||||
theme.light.term
|
||||
} else if self.selection().track() == Some(track_index)
|
||||
|| self.selection().scene() == Some(scene_index)
|
||||
{
|
||||
outline = theme.darkest.rgb;
|
||||
theme.base.rgb
|
||||
outline = theme.darkest.term;
|
||||
theme.base.term
|
||||
} else {
|
||||
theme.dark.rgb
|
||||
theme.dark.term
|
||||
};
|
||||
let w = if self.selection().track() == Some(track_index)
|
||||
&& let Some(editor) = self.editor ()
|
||||
|
|
@ -162,8 +162,8 @@ pub trait ClipsView: TracksView + ScenesView {
|
|||
wh_full(Outer(true, Style::default().fg(outline))),
|
||||
wh_full(below(
|
||||
below(
|
||||
Tui::fg_bg(outline, bg, wh_full("")),
|
||||
wh_full(origin_nw(Tui::fg_bg(fg, bg, Tui::bold(true, name)))),
|
||||
fg_bg(outline, bg, wh_full("")),
|
||||
wh_full(origin_nw(fg_bg(fg, bg, bold(true, name)))),
|
||||
),
|
||||
wh_full(when(self.selection().track() == Some(track_index)
|
||||
&& self.selection().scene() == Some(scene_index)
|
||||
|
|
@ -208,17 +208,17 @@ pub trait TracksView: ScenesView + HasMidiIns + HasMidiOuts + HasTrackScroll {
|
|||
let button_2 = south(
|
||||
button_2("T", "+", false),
|
||||
button_2("S", "+", false));
|
||||
view_track_row_section(theme, button, button_2, Tui::bg(theme.darker.rgb,
|
||||
view_track_row_section(theme, button, button_2, bg(theme.darker.term,
|
||||
h_exact(2, thunk(|to: &mut Tui|{
|
||||
for (index, track, x1, _x2) in self.tracks_with_sizes() {
|
||||
to.place(&x_push(x1 as u16, w_exact(track_width(index, track),
|
||||
Tui::bg(if selected.track() == Some(index) {
|
||||
track.color.light.rgb
|
||||
bg(if selected.track() == Some(index) {
|
||||
track.color.light.term
|
||||
} else {
|
||||
track.color.base.rgb
|
||||
track.color.base.term
|
||||
}, south(w_full(origin_nw(east(
|
||||
format!("·t{index:02} "),
|
||||
Tui::fg(Rgb(255, 255, 255), Tui::bold(true, &track.name))
|
||||
fg(Rgb(255, 255, 255), bold(true, &track.name))
|
||||
))), ""))) ));}}))))
|
||||
}
|
||||
|
||||
|
|
@ -229,12 +229,12 @@ pub trait TracksView: ScenesView + HasMidiIns + HasMidiOuts + HasTrackScroll {
|
|||
to.place(&w_full(origin_w(port.port_name())));
|
||||
})),
|
||||
button_2("O", "+", false),
|
||||
Tui::bg(theme.darker.rgb, origin_w(thunk(|to: &mut Tui|{
|
||||
bg(theme.darker.term, origin_w(thunk(|to: &mut Tui|{
|
||||
for (index, track, _x1, _x2) in self.tracks_with_sizes() {
|
||||
to.place(&w_exact(track_width(index, track),
|
||||
origin_nw(h_full(iter_south(1, ||track.sequencer.midi_outs.iter(),
|
||||
|port, index|Tui::fg(Rgb(255, 255, 255),
|
||||
h_exact(1, Tui::bg(track.color.dark.rgb, w_full(origin_w(
|
||||
|port, index|fg(Rgb(255, 255, 255),
|
||||
h_exact(1, bg(track.color.dark.term, w_full(origin_w(
|
||||
format!("·o{index:02} {}", port.port_name())))))))))));}}))))
|
||||
}
|
||||
|
||||
|
|
@ -246,18 +246,18 @@ pub trait TracksView: ScenesView + HasMidiIns + HasMidiOuts + HasTrackScroll {
|
|||
let content = thunk(move|to: &mut Tui|for (index, track, _x1, _x2) in self.tracks_with_sizes() {
|
||||
to.place(&wh_exact(track_width(index, track), h + 1,
|
||||
origin_nw(south(
|
||||
Tui::bg(track.color.base.rgb,
|
||||
bg(track.color.base.term,
|
||||
w_full(origin_w(east!(
|
||||
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 "),
|
||||
either(track.sequencer.monitoring, fg(Green, "●mon "), "·mon "),
|
||||
either(track.sequencer.recording, fg(Red, "●rec "), "·rec "),
|
||||
either(track.sequencer.overdub, fg(Yellow, "●dub "), "·dub "),
|
||||
)))),
|
||||
iter_south(1, ||track.sequencer.midi_ins.iter(),
|
||||
|port, index|Tui::fg_bg(Rgb(255, 255, 255), track.color.dark.rgb,
|
||||
|port, index|fg_bg(Rgb(255, 255, 255), track.color.dark.term,
|
||||
w_full(origin_w(format!("·i{index:02} {}", port.port_name())))))))));
|
||||
});
|
||||
view_track_row_section(theme, button_2("i", "nput", false), button_2("I", "+", false),
|
||||
Tui::bg(theme.darker.rgb, origin_w(content)))
|
||||
bg(theme.darker.term, origin_w(content)))
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -301,17 +301,17 @@ pub trait ScenesView: HasEditor + HasSelection + HasSceneScroll + HasClipsSize +
|
|||
Self::H_SCENE as u16
|
||||
};
|
||||
let bg = if self.selection().scene() == Some(index) {
|
||||
scene.color.light.rgb
|
||||
scene.color.light.term
|
||||
} else {
|
||||
scene.color.base.rgb
|
||||
scene.color.base.term
|
||||
};
|
||||
let a = w_full(origin_w(east(format!("·s{index:02} "),
|
||||
Tui::fg(Tui::g(255), Tui::bold(true, &scene.name)))));
|
||||
fg(g(255), bold(true, &scene.name)))));
|
||||
let b = when(self.selection().scene() == Some(index) && self.is_editing(),
|
||||
wh_full(origin_nw(south(
|
||||
self.editor().as_ref().map(|e|e.clip_status()),
|
||||
self.editor().as_ref().map(|e|e.edit_status())))));
|
||||
wh_exact(20, h, Tui::bg(bg, origin_nw(south(a, b))))
|
||||
wh_exact(20, h, bg(bg, origin_nw(south(a, b))))
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -447,9 +447,9 @@ pub trait HasTrack: AsRefOpt<Track> + AsMutOpt<Track> {
|
|||
iter(tracks,
|
||||
move|(index, track, x1, x2): (usize, &'a Track, usize, usize), _|{
|
||||
let width = (x2 - x1) as u16;
|
||||
iter_east(x1 as u16, width, w_exact(width, Tui::fg_bg(
|
||||
track.color.lightest.rgb,
|
||||
track.color.base.rgb,
|
||||
iter_east(x1 as u16, width, w_exact(width, fg_bg(
|
||||
track.color.lightest.term,
|
||||
track.color.base.term,
|
||||
callback(index, track))))})
|
||||
}
|
||||
/// Create a new track connecting the [Sequencer] to a [Sampler].
|
||||
|
|
@ -504,12 +504,12 @@ pub trait HasTrack: AsRefOpt<Track> + AsMutOpt<Track> {
|
|||
tracks: impl Fn() -> U + Send + Sync + 'a,
|
||||
callback: impl Fn(usize, &'a Track)->T + Send + Sync + 'a
|
||||
) -> impl Draw<Tui> + 'a {
|
||||
origin_x(Tui::bg(Reset, iter(tracks,
|
||||
origin_x(bg(Reset, iter(tracks,
|
||||
move|(index, track, x1, x2): (usize, &'a Track, usize, usize), _|{
|
||||
let width = (x2 - x1) as u16;
|
||||
iter_east(x1 as u16, width, w_exact(width, Tui::fg_bg(
|
||||
track.color.lightest.rgb,
|
||||
track.color.base.rgb,
|
||||
iter_east(x1 as u16, width, w_exact(width, fg_bg(
|
||||
track.color.lightest.term,
|
||||
track.color.base.term,
|
||||
callback(index, track))))})))
|
||||
}
|
||||
#[cfg(all(feature = "select"))] impl_as_ref_opt!(Scene: |self: App| self.project.as_ref_opt());
|
||||
|
|
@ -664,21 +664,21 @@ impl Arrangement {
|
|||
east(w_exact(20, origin_w(button_3("i", "nput ", format!("{}", self.midi_ins.len()), false))),
|
||||
west(w_exact(4, button_2("I", "+", false)), thunk(move|to: &mut Tui|for (_index, track, x1, _x2) in self.tracks_with_sizes() {
|
||||
#[cfg(feature = "track")]
|
||||
to.place(&x_push(x1 as u16, Tui::bg(track.color.dark.rgb, origin_w(w_exact(track.width as u16, east!(
|
||||
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 "),
|
||||
to.place(&x_push(x1 as u16, bg(track.color.dark.term, origin_w(w_exact(track.width as u16, east!(
|
||||
either(track.sequencer.monitoring, fg(Green, "mon "), "mon "),
|
||||
either(track.sequencer.recording, fg(Red, "rec "), "rec "),
|
||||
either(track.sequencer.overdub, fg(Yellow, "dub "), "dub "),
|
||||
))))))
|
||||
})))
|
||||
}
|
||||
#[cfg(feature = "track")] fn view_inputs_row (&self, port: &MidiInput) -> impl Draw<Tui> {
|
||||
east(w_exact(20, origin_w(east(" ● ", Tui::bold(true, Tui::fg(Rgb(255,255,255), port.port_name()))))),
|
||||
east(w_exact(20, origin_w(east(" ● ", bold(true, fg(Rgb(255,255,255), port.port_name()))))),
|
||||
west(w_exact(4, ()), thunk(move|to: &mut Tui|for (_index, track, _x1, _x2) in self.tracks_with_sizes() {
|
||||
#[cfg(feature = "track")]
|
||||
to.place(&Tui::bg(track.color.darker.rgb, origin_w(w_exact(track.width as u16, east!(
|
||||
either(track.sequencer.monitoring, Tui::fg(Green, " ● "), " · "),
|
||||
either(track.sequencer.recording, Tui::fg(Red, " ● "), " · "),
|
||||
either(track.sequencer.overdub, Tui::fg(Yellow, " ● "), " · "),
|
||||
to.place(&bg(track.color.darker.term, origin_w(w_exact(track.width as u16, east!(
|
||||
either(track.sequencer.monitoring, fg(Green, " ● "), " · "),
|
||||
either(track.sequencer.recording, fg(Red, " ● "), " · "),
|
||||
either(track.sequencer.overdub, fg(Yellow, " ● "), " · "),
|
||||
)))))
|
||||
})))
|
||||
}
|
||||
|
|
@ -693,7 +693,7 @@ impl Arrangement {
|
|||
h_exact(h - 1, wh_full(origin_nw(thunk(|to: &mut Tui|{
|
||||
for (_index, port) in self.midi_outs().iter().enumerate() {
|
||||
to.place(&h_exact(1,w_full(east(
|
||||
origin_w(east(" ● ", Tui::fg(Rgb(255,255,255),Tui::bold(true, port.port_name())))),
|
||||
origin_w(east(" ● ", fg(Rgb(255,255,255),bold(true, port.port_name())))),
|
||||
w_full(origin_e(format!("{}/{} ",
|
||||
port.port().get_connections().len(),
|
||||
port.connections.len())))))));
|
||||
|
|
@ -703,19 +703,19 @@ impl Arrangement {
|
|||
}
|
||||
})))));
|
||||
h_exact(h, view_track_row_section(theme, list, button_2("O", "+", false),
|
||||
Tui::bg(theme.darker.rgb, origin_w(w_full(
|
||||
bg(theme.darker.term, origin_w(w_full(
|
||||
thunk(|to: &mut Tui|{
|
||||
for (index, track, _x1, _x2) in self.tracks_with_sizes() {
|
||||
to.place(&w_exact(track_width(index, track),
|
||||
thunk(|to: &mut Tui|{
|
||||
to.place(&h_exact(1, origin_w(east(
|
||||
either(true, Tui::fg(Green, "play "), "play "),
|
||||
either(false, Tui::fg(Yellow, "solo "), "solo "),
|
||||
either(true, fg(Green, "play "), "play "),
|
||||
either(false, fg(Yellow, "solo "), "solo "),
|
||||
))));
|
||||
for (_index, port) in self.midi_outs().iter().enumerate() {
|
||||
to.place(&h_exact(1, origin_w(east(
|
||||
either(true, Tui::fg(Green, " ● "), " · "),
|
||||
either(false, Tui::fg(Yellow, " ● "), " · "),
|
||||
either(true, fg(Green, " ● "), " · "),
|
||||
either(false, fg(Yellow, " ● "), " · "),
|
||||
))));
|
||||
for (_index, _conn) in port.connections.iter().enumerate() {
|
||||
to.place(&h_exact(1, w_full("")));
|
||||
|
|
@ -732,11 +732,11 @@ impl Arrangement {
|
|||
button_2("D", "+", false),
|
||||
thunk(move|to: &mut Tui|for (index, track, _x1, _x2) in self.tracks_with_sizes() {
|
||||
to.place(&wh_exact(track_width(index, track), h + 1,
|
||||
Tui::bg(track.color.dark.rgb, origin_nw(iter_south(2, move||0..h,
|
||||
bg(track.color.dark.term, origin_nw(iter_south(2, move||0..h,
|
||||
|_, _index|wh_exact(track.width as u16, 2,
|
||||
Tui::fg_bg(
|
||||
ItemTheme::G[32].lightest.rgb,
|
||||
ItemTheme::G[32].dark.rgb,
|
||||
fg_bg(
|
||||
ItemTheme::G[32].lightest.term,
|
||||
ItemTheme::G[32].dark.term,
|
||||
origin_nw(format!(" · {}", "--")))))))));
|
||||
}))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue