mirror of
https://codeberg.org/unspeaker/tek.git
synced 2026-04-03 12:50:44 +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
|
-> impl Draw<Tui> + 'a
|
||||||
{
|
{
|
||||||
self.clips_size().of(wh_full(above(
|
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 (
|
thunk(|to: &mut Tui|for (
|
||||||
track_index, track, _, _
|
track_index, track, _, _
|
||||||
) in self.tracks_with_sizes() {
|
) in self.tracks_with_sizes() {
|
||||||
|
|
@ -128,20 +128,20 @@ pub trait ClipsView: TracksView + ScenesView {
|
||||||
} else {
|
} else {
|
||||||
(" ⏹ -- ".into(), ItemTheme::G[32])
|
(" ⏹ -- ".into(), ItemTheme::G[32])
|
||||||
};
|
};
|
||||||
let fg = theme.lightest.rgb;
|
let fg = theme.lightest.term;
|
||||||
let mut outline = theme.base.rgb;
|
let mut outline = theme.base.term;
|
||||||
let bg = if self.selection().track() == Some(track_index)
|
let bg = if self.selection().track() == Some(track_index)
|
||||||
&& self.selection().scene() == Some(scene_index)
|
&& self.selection().scene() == Some(scene_index)
|
||||||
{
|
{
|
||||||
outline = theme.lighter.rgb;
|
outline = theme.lighter.term;
|
||||||
theme.light.rgb
|
theme.light.term
|
||||||
} else if self.selection().track() == Some(track_index)
|
} else if self.selection().track() == Some(track_index)
|
||||||
|| self.selection().scene() == Some(scene_index)
|
|| self.selection().scene() == Some(scene_index)
|
||||||
{
|
{
|
||||||
outline = theme.darkest.rgb;
|
outline = theme.darkest.term;
|
||||||
theme.base.rgb
|
theme.base.term
|
||||||
} else {
|
} else {
|
||||||
theme.dark.rgb
|
theme.dark.term
|
||||||
};
|
};
|
||||||
let w = if self.selection().track() == Some(track_index)
|
let w = if self.selection().track() == Some(track_index)
|
||||||
&& let Some(editor) = self.editor ()
|
&& let Some(editor) = self.editor ()
|
||||||
|
|
@ -162,8 +162,8 @@ pub trait ClipsView: TracksView + ScenesView {
|
||||||
wh_full(Outer(true, Style::default().fg(outline))),
|
wh_full(Outer(true, Style::default().fg(outline))),
|
||||||
wh_full(below(
|
wh_full(below(
|
||||||
below(
|
below(
|
||||||
Tui::fg_bg(outline, bg, wh_full("")),
|
fg_bg(outline, bg, wh_full("")),
|
||||||
wh_full(origin_nw(Tui::fg_bg(fg, bg, Tui::bold(true, name)))),
|
wh_full(origin_nw(fg_bg(fg, bg, bold(true, name)))),
|
||||||
),
|
),
|
||||||
wh_full(when(self.selection().track() == Some(track_index)
|
wh_full(when(self.selection().track() == Some(track_index)
|
||||||
&& self.selection().scene() == Some(scene_index)
|
&& self.selection().scene() == Some(scene_index)
|
||||||
|
|
@ -208,17 +208,17 @@ pub trait TracksView: ScenesView + HasMidiIns + HasMidiOuts + HasTrackScroll {
|
||||||
let button_2 = south(
|
let button_2 = south(
|
||||||
button_2("T", "+", false),
|
button_2("T", "+", false),
|
||||||
button_2("S", "+", 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|{
|
h_exact(2, thunk(|to: &mut Tui|{
|
||||||
for (index, track, x1, _x2) in self.tracks_with_sizes() {
|
for (index, track, x1, _x2) in self.tracks_with_sizes() {
|
||||||
to.place(&x_push(x1 as u16, w_exact(track_width(index, track),
|
to.place(&x_push(x1 as u16, w_exact(track_width(index, track),
|
||||||
Tui::bg(if selected.track() == Some(index) {
|
bg(if selected.track() == Some(index) {
|
||||||
track.color.light.rgb
|
track.color.light.term
|
||||||
} else {
|
} else {
|
||||||
track.color.base.rgb
|
track.color.base.term
|
||||||
}, south(w_full(origin_nw(east(
|
}, south(w_full(origin_nw(east(
|
||||||
format!("·t{index:02} "),
|
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())));
|
to.place(&w_full(origin_w(port.port_name())));
|
||||||
})),
|
})),
|
||||||
button_2("O", "+", false),
|
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() {
|
for (index, track, _x1, _x2) in self.tracks_with_sizes() {
|
||||||
to.place(&w_exact(track_width(index, track),
|
to.place(&w_exact(track_width(index, track),
|
||||||
origin_nw(h_full(iter_south(1, ||track.sequencer.midi_outs.iter(),
|
origin_nw(h_full(iter_south(1, ||track.sequencer.midi_outs.iter(),
|
||||||
|port, index|Tui::fg(Rgb(255, 255, 255),
|
|port, index|fg(Rgb(255, 255, 255),
|
||||||
h_exact(1, Tui::bg(track.color.dark.rgb, w_full(origin_w(
|
h_exact(1, bg(track.color.dark.term, w_full(origin_w(
|
||||||
format!("·o{index:02} {}", port.port_name())))))))))));}}))))
|
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() {
|
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,
|
to.place(&wh_exact(track_width(index, track), h + 1,
|
||||||
origin_nw(south(
|
origin_nw(south(
|
||||||
Tui::bg(track.color.base.rgb,
|
bg(track.color.base.term,
|
||||||
w_full(origin_w(east!(
|
w_full(origin_w(east!(
|
||||||
either(track.sequencer.monitoring, Tui::fg(Green, "●mon "), "·mon "),
|
either(track.sequencer.monitoring, fg(Green, "●mon "), "·mon "),
|
||||||
either(track.sequencer.recording, Tui::fg(Red, "●rec "), "·rec "),
|
either(track.sequencer.recording, fg(Red, "●rec "), "·rec "),
|
||||||
either(track.sequencer.overdub, Tui::fg(Yellow, "●dub "), "·dub "),
|
either(track.sequencer.overdub, fg(Yellow, "●dub "), "·dub "),
|
||||||
)))),
|
)))),
|
||||||
iter_south(1, ||track.sequencer.midi_ins.iter(),
|
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())))))))));
|
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),
|
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
|
Self::H_SCENE as u16
|
||||||
};
|
};
|
||||||
let bg = if self.selection().scene() == Some(index) {
|
let bg = if self.selection().scene() == Some(index) {
|
||||||
scene.color.light.rgb
|
scene.color.light.term
|
||||||
} else {
|
} else {
|
||||||
scene.color.base.rgb
|
scene.color.base.term
|
||||||
};
|
};
|
||||||
let a = w_full(origin_w(east(format!("·s{index:02} "),
|
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(),
|
let b = when(self.selection().scene() == Some(index) && self.is_editing(),
|
||||||
wh_full(origin_nw(south(
|
wh_full(origin_nw(south(
|
||||||
self.editor().as_ref().map(|e|e.clip_status()),
|
self.editor().as_ref().map(|e|e.clip_status()),
|
||||||
self.editor().as_ref().map(|e|e.edit_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,
|
iter(tracks,
|
||||||
move|(index, track, x1, x2): (usize, &'a Track, usize, usize), _|{
|
move|(index, track, x1, x2): (usize, &'a Track, usize, usize), _|{
|
||||||
let width = (x2 - x1) as u16;
|
let width = (x2 - x1) as u16;
|
||||||
iter_east(x1 as u16, width, w_exact(width, Tui::fg_bg(
|
iter_east(x1 as u16, width, w_exact(width, fg_bg(
|
||||||
track.color.lightest.rgb,
|
track.color.lightest.term,
|
||||||
track.color.base.rgb,
|
track.color.base.term,
|
||||||
callback(index, track))))})
|
callback(index, track))))})
|
||||||
}
|
}
|
||||||
/// Create a new track connecting the [Sequencer] to a [Sampler].
|
/// 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,
|
tracks: impl Fn() -> U + Send + Sync + 'a,
|
||||||
callback: impl Fn(usize, &'a Track)->T + Send + Sync + 'a
|
callback: impl Fn(usize, &'a Track)->T + Send + Sync + 'a
|
||||||
) -> impl Draw<Tui> + '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), _|{
|
move|(index, track, x1, x2): (usize, &'a Track, usize, usize), _|{
|
||||||
let width = (x2 - x1) as u16;
|
let width = (x2 - x1) as u16;
|
||||||
iter_east(x1 as u16, width, w_exact(width, Tui::fg_bg(
|
iter_east(x1 as u16, width, w_exact(width, fg_bg(
|
||||||
track.color.lightest.rgb,
|
track.color.lightest.term,
|
||||||
track.color.base.rgb,
|
track.color.base.term,
|
||||||
callback(index, track))))})))
|
callback(index, track))))})))
|
||||||
}
|
}
|
||||||
#[cfg(all(feature = "select"))] impl_as_ref_opt!(Scene: |self: App| self.project.as_ref_opt());
|
#[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))),
|
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() {
|
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")]
|
#[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!(
|
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, Tui::fg(Green, "mon "), "mon "),
|
either(track.sequencer.monitoring, fg(Green, "mon "), "mon "),
|
||||||
either(track.sequencer.recording, Tui::fg(Red, "rec "), "rec "),
|
either(track.sequencer.recording, fg(Red, "rec "), "rec "),
|
||||||
either(track.sequencer.overdub, Tui::fg(Yellow, "dub "), "dub "),
|
either(track.sequencer.overdub, fg(Yellow, "dub "), "dub "),
|
||||||
))))))
|
))))))
|
||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
#[cfg(feature = "track")] fn view_inputs_row (&self, port: &MidiInput) -> impl Draw<Tui> {
|
#[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() {
|
west(w_exact(4, ()), thunk(move|to: &mut Tui|for (_index, track, _x1, _x2) in self.tracks_with_sizes() {
|
||||||
#[cfg(feature = "track")]
|
#[cfg(feature = "track")]
|
||||||
to.place(&Tui::bg(track.color.darker.rgb, origin_w(w_exact(track.width as u16, east!(
|
to.place(&bg(track.color.darker.term, origin_w(w_exact(track.width as u16, east!(
|
||||||
either(track.sequencer.monitoring, Tui::fg(Green, " ● "), " · "),
|
either(track.sequencer.monitoring, fg(Green, " ● "), " · "),
|
||||||
either(track.sequencer.recording, Tui::fg(Red, " ● "), " · "),
|
either(track.sequencer.recording, fg(Red, " ● "), " · "),
|
||||||
either(track.sequencer.overdub, Tui::fg(Yellow, " ● "), " · "),
|
either(track.sequencer.overdub, fg(Yellow, " ● "), " · "),
|
||||||
)))))
|
)))))
|
||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
|
|
@ -693,7 +693,7 @@ impl Arrangement {
|
||||||
h_exact(h - 1, wh_full(origin_nw(thunk(|to: &mut Tui|{
|
h_exact(h - 1, wh_full(origin_nw(thunk(|to: &mut Tui|{
|
||||||
for (_index, port) in self.midi_outs().iter().enumerate() {
|
for (_index, port) in self.midi_outs().iter().enumerate() {
|
||||||
to.place(&h_exact(1,w_full(east(
|
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!("{}/{} ",
|
w_full(origin_e(format!("{}/{} ",
|
||||||
port.port().get_connections().len(),
|
port.port().get_connections().len(),
|
||||||
port.connections.len())))))));
|
port.connections.len())))))));
|
||||||
|
|
@ -703,19 +703,19 @@ impl Arrangement {
|
||||||
}
|
}
|
||||||
})))));
|
})))));
|
||||||
h_exact(h, view_track_row_section(theme, list, button_2("O", "+", false),
|
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|{
|
thunk(|to: &mut Tui|{
|
||||||
for (index, track, _x1, _x2) in self.tracks_with_sizes() {
|
for (index, track, _x1, _x2) in self.tracks_with_sizes() {
|
||||||
to.place(&w_exact(track_width(index, track),
|
to.place(&w_exact(track_width(index, track),
|
||||||
thunk(|to: &mut Tui|{
|
thunk(|to: &mut Tui|{
|
||||||
to.place(&h_exact(1, origin_w(east(
|
to.place(&h_exact(1, origin_w(east(
|
||||||
either(true, Tui::fg(Green, "play "), "play "),
|
either(true, fg(Green, "play "), "play "),
|
||||||
either(false, Tui::fg(Yellow, "solo "), "solo "),
|
either(false, fg(Yellow, "solo "), "solo "),
|
||||||
))));
|
))));
|
||||||
for (_index, port) in self.midi_outs().iter().enumerate() {
|
for (_index, port) in self.midi_outs().iter().enumerate() {
|
||||||
to.place(&h_exact(1, origin_w(east(
|
to.place(&h_exact(1, origin_w(east(
|
||||||
either(true, Tui::fg(Green, " ● "), " · "),
|
either(true, fg(Green, " ● "), " · "),
|
||||||
either(false, Tui::fg(Yellow, " ● "), " · "),
|
either(false, fg(Yellow, " ● "), " · "),
|
||||||
))));
|
))));
|
||||||
for (_index, _conn) in port.connections.iter().enumerate() {
|
for (_index, _conn) in port.connections.iter().enumerate() {
|
||||||
to.place(&h_exact(1, w_full("")));
|
to.place(&h_exact(1, w_full("")));
|
||||||
|
|
@ -732,11 +732,11 @@ impl Arrangement {
|
||||||
button_2("D", "+", false),
|
button_2("D", "+", false),
|
||||||
thunk(move|to: &mut Tui|for (index, track, _x1, _x2) in self.tracks_with_sizes() {
|
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,
|
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,
|
|_, _index|wh_exact(track.width as u16, 2,
|
||||||
Tui::fg_bg(
|
fg_bg(
|
||||||
ItemTheme::G[32].lightest.rgb,
|
ItemTheme::G[32].lightest.term,
|
||||||
ItemTheme::G[32].dark.rgb,
|
ItemTheme::G[32].dark.term,
|
||||||
origin_nw(format!(" · {}", "--")))))))));
|
origin_nw(format!(" · {}", "--")))))))));
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -246,8 +246,8 @@ impl<'a> PoolView<'a> {
|
||||||
fn tui (&self) -> impl Draw<Tui> {
|
fn tui (&self) -> impl Draw<Tui> {
|
||||||
let Self(pool) = self;
|
let Self(pool) = self;
|
||||||
//let color = self.1.clip().map(|c|c.read().unwrap().color).unwrap_or_else(||Tui::g(32).into());
|
//let color = self.1.clip().map(|c|c.read().unwrap().color).unwrap_or_else(||Tui::g(32).into());
|
||||||
//let on_bg = |x|x;//below(Repeat(" "), Tui::bg(color.darkest.rgb, x));
|
//let on_bg = |x|x;//below(Repeat(" "), Tui::bg(color.darkest.term, x));
|
||||||
//let border = |x|x;//Outer(Style::default().fg(color.dark.rgb).bg(color.darkest.rgb)).enclose(x);
|
//let border = |x|x;//Outer(Style::default().fg(color.dark.term).bg(color.darkest.term)).enclose(x);
|
||||||
//let height = pool.clips.read().unwrap().len() as u16;
|
//let height = pool.clips.read().unwrap().len() as u16;
|
||||||
w_exact(20, h_full(origin_n(iter(
|
w_exact(20, h_full(origin_n(iter(
|
||||||
||pool.clips().clone().into_iter(),
|
||pool.clips().clone().into_iter(),
|
||||||
|
|
@ -256,8 +256,8 @@ impl<'a> PoolView<'a> {
|
||||||
let item_offset = i as u16 * item_height;
|
let item_offset = i as u16 * item_height;
|
||||||
let selected = i == pool.clip_index();
|
let selected = i == pool.clip_index();
|
||||||
let MidiClip { ref name, color, length, .. } = *clip.read().unwrap();
|
let MidiClip { ref name, color, length, .. } = *clip.read().unwrap();
|
||||||
let bg = if selected { color.light.rgb } else { color.base.rgb };
|
let bg = if selected { color.light.term } else { color.base.term };
|
||||||
let fg = color.lightest.rgb;
|
let fg = color.lightest.term;
|
||||||
let name = if false { format!(" {i:>3}") } else { format!(" {i:>3} {name}") };
|
let name = if false { format!(" {i:>3}") } else { format!(" {i:>3} {name}") };
|
||||||
let length = if false { String::default() } else { format!("{length} ") };
|
let length = if false { String::default() } else { format!("{length} ") };
|
||||||
h_exact(1, iter_south(item_offset, item_height, Tui::bg(bg, below!(
|
h_exact(1, iter_south(item_offset, item_height, Tui::bg(bg, below!(
|
||||||
|
|
|
||||||
10
src/mix.rs
10
src/mix.rs
|
|
@ -4,16 +4,18 @@ use crate::*;
|
||||||
Log10,
|
Log10,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone)] pub struct Log10Meter(pub f32);
|
#[derive(Debug, Default, Clone)]
|
||||||
|
pub struct Log10Meter(pub f32);
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone)] pub struct RmsMeter(pub f32);
|
#[derive(Debug, Default, Clone)]
|
||||||
|
pub struct RmsMeter(pub f32);
|
||||||
|
|
||||||
#[derive(Debug, Default)] pub enum MixingMode {
|
#[derive(Debug, Default)]
|
||||||
|
pub enum MixingMode {
|
||||||
#[default] Summing,
|
#[default] Summing,
|
||||||
Average,
|
Average,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[cfg(test)] mod test_view_meter {
|
#[cfg(test)] mod test_view_meter {
|
||||||
use super::*;
|
use super::*;
|
||||||
use proptest::prelude::*;
|
use proptest::prelude::*;
|
||||||
|
|
|
||||||
|
|
@ -1078,25 +1078,25 @@ impl PianoHorizontal {
|
||||||
if note == (127-note_point) || time == time_point {
|
if note == (127-note_point) || time == time_point {
|
||||||
cell.set_bg(Rgb(0,0,0));
|
cell.set_bg(Rgb(0,0,0));
|
||||||
} else {
|
} else {
|
||||||
cell.set_bg(clip.color.darkest.rgb);
|
cell.set_bg(clip.color.darkest.term);
|
||||||
}
|
}
|
||||||
if time % 384 == 0 {
|
if time % 384 == 0 {
|
||||||
cell.set_fg(clip.color.darker.rgb);
|
cell.set_fg(clip.color.darker.term);
|
||||||
cell.set_char('│');
|
cell.set_char('│');
|
||||||
} else if time % 96 == 0 {
|
} else if time % 96 == 0 {
|
||||||
cell.set_fg(clip.color.dark.rgb);
|
cell.set_fg(clip.color.dark.term);
|
||||||
cell.set_char('╎');
|
cell.set_char('╎');
|
||||||
} else if time % note_len == 0 {
|
} else if time % note_len == 0 {
|
||||||
cell.set_fg(clip.color.darker.rgb);
|
cell.set_fg(clip.color.darker.term);
|
||||||
cell.set_char('┊');
|
cell.set_char('┊');
|
||||||
} else if (127 - note) % 12 == 0 {
|
} else if (127 - note) % 12 == 0 {
|
||||||
cell.set_fg(clip.color.darker.rgb);
|
cell.set_fg(clip.color.darker.term);
|
||||||
cell.set_char('=');
|
cell.set_char('=');
|
||||||
} else if (127 - note) % 6 == 0 {
|
} else if (127 - note) % 6 == 0 {
|
||||||
cell.set_fg(clip.color.darker.rgb);
|
cell.set_fg(clip.color.darker.term);
|
||||||
cell.set_char('—');
|
cell.set_char('—');
|
||||||
} else {
|
} else {
|
||||||
cell.set_fg(clip.color.darker.rgb);
|
cell.set_fg(clip.color.darker.term);
|
||||||
cell.set_char('·');
|
cell.set_char('·');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1106,7 +1106,7 @@ impl PianoHorizontal {
|
||||||
///
|
///
|
||||||
/// This mode uses full blocks on note on and half blocks on legato: █▄ █▄ █▄
|
/// This mode uses full blocks on note on and half blocks on legato: █▄ █▄ █▄
|
||||||
fn draw_fg (buf: &mut BigBuffer, clip: &MidiClip, zoom: usize) {
|
fn draw_fg (buf: &mut BigBuffer, clip: &MidiClip, zoom: usize) {
|
||||||
let style = Style::default().fg(clip.color.base.rgb);//.bg(Rgb(0, 0, 0));
|
let style = Style::default().fg(clip.color.base.term);//.bg(Rgb(0, 0, 0));
|
||||||
let mut notes_on = [false;128];
|
let mut notes_on = [false;128];
|
||||||
for (x, time_start) in (0..clip.length).step_by(zoom).enumerate() {
|
for (x, time_start) in (0..clip.length).step_by(zoom).enumerate() {
|
||||||
for (_y, note) in (0..=127).rev().enumerate() {
|
for (_y, note) in (0..=127).rev().enumerate() {
|
||||||
|
|
@ -1178,7 +1178,7 @@ impl PianoHorizontal {
|
||||||
let time_pos = self.get_time_pos();
|
let time_pos = self.get_time_pos();
|
||||||
let time_start = self.get_time_start();
|
let time_start = self.get_time_start();
|
||||||
let time_zoom = self.get_time_zoom();
|
let time_zoom = self.get_time_zoom();
|
||||||
let style = Some(Style::default().fg(self.color.lightest.rgb));
|
let style = Some(Style::default().fg(self.color.lightest.term));
|
||||||
Thunk::new(move|to: &mut Tui|{
|
Thunk::new(move|to: &mut Tui|{
|
||||||
let XYWH(x0, y0, w, _) = to.area();
|
let XYWH(x0, y0, w, _) = to.area();
|
||||||
for (_area_y, screen_y, note) in note_y_iter(note_lo, note_hi, y0) {
|
for (_area_y, screen_y, note) in note_y_iter(note_lo, note_hi, y0) {
|
||||||
|
|
@ -1209,7 +1209,7 @@ impl PianoHorizontal {
|
||||||
let note_pos = state.get_note_pos();
|
let note_pos = state.get_note_pos();
|
||||||
let key_style = Some(Style::default().fg(Rgb(192, 192, 192)).bg(Rgb(0, 0, 0)));
|
let key_style = Some(Style::default().fg(Rgb(192, 192, 192)).bg(Rgb(0, 0, 0)));
|
||||||
let off_style = Some(Style::default().fg(Tui::g(255)));
|
let off_style = Some(Style::default().fg(Tui::g(255)));
|
||||||
let on_style = Some(Style::default().fg(Rgb(255,0,0)).bg(color.base.rgb).bold());
|
let on_style = Some(Style::default().fg(Rgb(255,0,0)).bg(color.base.term).bold());
|
||||||
h_full(w_exact(self.keys_width, Thunk::new(move|to: &mut Tui|{
|
h_full(w_exact(self.keys_width, Thunk::new(move|to: &mut Tui|{
|
||||||
let XYWH(x, y0, _w, _h) = to.area();
|
let XYWH(x, y0, _w, _h) = to.area();
|
||||||
for (_area_y, screen_y, note) in note_y_iter(note_lo, note_hi, y0) {
|
for (_area_y, screen_y, note) in note_y_iter(note_lo, note_hi, y0) {
|
||||||
|
|
|
||||||
76
src/tek.rs
76
src/tek.rs
|
|
@ -183,7 +183,7 @@ fn tek_inc (state: &mut App, axis: &ControlAxis) -> Perhaps<AppCommand> {
|
||||||
Ok(match (&state.dialog, axis) {
|
Ok(match (&state.dialog, axis) {
|
||||||
(Dialog::None, _) => todo!(),
|
(Dialog::None, _) => todo!(),
|
||||||
(Dialog::Menu(_, _), ControlAxis::Y) => AppCommand::SetDialog { dialog: state.dialog.menu_next() }
|
(Dialog::Menu(_, _), ControlAxis::Y) => AppCommand::SetDialog { dialog: state.dialog.menu_next() }
|
||||||
.execute(state)?,
|
.act(state)?,
|
||||||
_ => todo!()
|
_ => todo!()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -192,7 +192,7 @@ fn tek_dec (state: &mut App, axis: &ControlAxis) -> Perhaps<AppCommand> {
|
||||||
Ok(match (&state.dialog, axis) {
|
Ok(match (&state.dialog, axis) {
|
||||||
(Dialog::None, _) => None,
|
(Dialog::None, _) => None,
|
||||||
(Dialog::Menu(_, _), ControlAxis::Y) => AppCommand::SetDialog { dialog: state.dialog.menu_prev() }
|
(Dialog::Menu(_, _), ControlAxis::Y) => AppCommand::SetDialog { dialog: state.dialog.menu_prev() }
|
||||||
.execute(state)?,
|
.act(state)?,
|
||||||
_ => todo!()
|
_ => todo!()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -219,7 +219,7 @@ fn execute_commands (
|
||||||
) -> Usually<Vec<(AppCommand, Option<AppCommand>)>> {
|
) -> Usually<Vec<(AppCommand, Option<AppCommand>)>> {
|
||||||
let mut history = vec![];
|
let mut history = vec![];
|
||||||
for command in commands.into_iter() {
|
for command in commands.into_iter() {
|
||||||
let result = command.execute(app);
|
let result = command.act(app);
|
||||||
match result { Err(err) => { history.push((command, None)); return Err(err) }
|
match result { Err(err) => { history.push((command, None)); return Err(err) }
|
||||||
Ok(undo) => { history.push((command, undo)); } };
|
Ok(undo) => { history.push((command, undo)); } };
|
||||||
}
|
}
|
||||||
|
|
@ -358,11 +358,11 @@ def_sizes_iter!(TracksSizes => Track);
|
||||||
/// let _ = tek::view_logo();
|
/// let _ = tek::view_logo();
|
||||||
/// ```
|
/// ```
|
||||||
pub fn view_logo () -> impl Draw<Tui> {
|
pub fn view_logo () -> impl Draw<Tui> {
|
||||||
wh_exact(32, 7, Tui::bold(true, Tui::fg(Rgb(240,200,180), south!{
|
wh_exact(32, 7, bold(true, fg(Rgb(240,200,180), south!{
|
||||||
h_exact(1, ""),
|
h_exact(1, ""),
|
||||||
h_exact(1, ""),
|
h_exact(1, ""),
|
||||||
h_exact(1, "~~ ╓─╥─╖ ╓──╖ ╥ ╖ ~~~~~~~~~~~~"),
|
h_exact(1, "~~ ╓─╥─╖ ╓──╖ ╥ ╖ ~~~~~~~~~~~~"),
|
||||||
h_exact(1, east("~~~~ ║ ~ ╟─╌ ~╟─< ~~ ", east(Tui::fg(Rgb(230,100,40), "v0.3.0"), " ~~"))),
|
h_exact(1, east("~~~~ ║ ~ ╟─╌ ~╟─< ~~ ", east(fg(Rgb(230,100,40), "v0.3.0"), " ~~"))),
|
||||||
h_exact(1, "~~~~ ╨ ~ ╙──╜ ╨ ╜ ~~~~~~~~~~~~"),
|
h_exact(1, "~~~~ ╨ ~ ╙──╜ ╨ ╜ ~~~~~~~~~~~~"),
|
||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
|
|
@ -379,7 +379,7 @@ pub fn view_transport (
|
||||||
time: Arc<RwLock<String>>,
|
time: Arc<RwLock<String>>,
|
||||||
) -> impl Draw<Tui> {
|
) -> impl Draw<Tui> {
|
||||||
let theme = ItemTheme::G[96];
|
let theme = ItemTheme::G[96];
|
||||||
Tui::bg(Black, east!(above(
|
bg(Black, east!(above(
|
||||||
wh_full(origin_w(button_play_pause(play))),
|
wh_full(origin_w(button_play_pause(play))),
|
||||||
wh_full(origin_e(east!(
|
wh_full(origin_e(east!(
|
||||||
field_h(theme, "BPM", bpm),
|
field_h(theme, "BPM", bpm),
|
||||||
|
|
@ -401,7 +401,7 @@ pub fn view_status (
|
||||||
lat: Arc<RwLock<String>>,
|
lat: Arc<RwLock<String>>,
|
||||||
) -> impl Draw<Tui> {
|
) -> impl Draw<Tui> {
|
||||||
let theme = ItemTheme::G[96];
|
let theme = ItemTheme::G[96];
|
||||||
Tui::bg(Black, east!(above(
|
bg(Black, east!(above(
|
||||||
wh_full(origin_w(sel.map(|sel|field_h(theme, "Selected", sel)))),
|
wh_full(origin_w(sel.map(|sel|field_h(theme, "Selected", sel)))),
|
||||||
wh_full(origin_e(east!(
|
wh_full(origin_e(east!(
|
||||||
field_h(theme, "SR", sr),
|
field_h(theme, "SR", sr),
|
||||||
|
|
@ -416,15 +416,15 @@ pub fn view_status (
|
||||||
/// ```
|
/// ```
|
||||||
pub fn button_play_pause (playing: bool) -> impl Draw<Tui> {
|
pub fn button_play_pause (playing: bool) -> impl Draw<Tui> {
|
||||||
let compact = true;//self.is_editing();
|
let compact = true;//self.is_editing();
|
||||||
Tui::bg(if playing { Rgb(0, 128, 0) } else { Rgb(128, 64, 0) },
|
bg(if playing { Rgb(0, 128, 0) } else { Rgb(128, 64, 0) },
|
||||||
either(compact,
|
either(compact,
|
||||||
Thunk::new(move|to: &mut Tui|to.place(&w_exact(9, either(playing,
|
Thunk::new(move|to: &mut Tui|to.place(&w_exact(9, either(playing,
|
||||||
Tui::fg(Rgb(0, 255, 0), " PLAYING "),
|
fg(Rgb(0, 255, 0), " PLAYING "),
|
||||||
Tui::fg(Rgb(255, 128, 0), " STOPPED ")))
|
fg(Rgb(255, 128, 0), " STOPPED ")))
|
||||||
)),
|
)),
|
||||||
Thunk::new(move|to: &mut Tui|to.place(&w_exact(5, either(playing,
|
Thunk::new(move|to: &mut Tui|to.place(&w_exact(5, either(playing,
|
||||||
Tui::fg(Rgb(0, 255, 0), south(" 🭍🭑🬽 ", " 🭞🭜🭘 ",)),
|
fg(Rgb(0, 255, 0), south(" 🭍🭑🬽 ", " 🭞🭜🭘 ",)),
|
||||||
Tui::fg(Rgb(255, 128, 0), south(" ▗▄▖ ", " ▝▀▘ ",))))
|
fg(Rgb(255, 128, 0), south(" ▗▄▖ ", " ▝▀▘ ",))))
|
||||||
))
|
))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
@ -446,9 +446,9 @@ pub fn button_play_pause (playing: bool) -> impl Draw<Tui> {
|
||||||
/// let _ = tek::view_wrap(bg, fg, "and then blue, too!");
|
/// let _ = tek::view_wrap(bg, fg, "and then blue, too!");
|
||||||
/// ```
|
/// ```
|
||||||
pub fn view_wrap (bg: Color, fg: Color, content: impl Draw<Tui>) -> impl Draw<Tui> {
|
pub fn view_wrap (bg: Color, fg: Color, content: impl Draw<Tui>) -> impl Draw<Tui> {
|
||||||
let left = Tui::fg_bg(bg, Reset, w_exact(1, y_repeat("▐")));
|
let left = fg_bg(bg, Reset, w_exact(1, y_repeat("▐")));
|
||||||
let right = Tui::fg_bg(bg, Reset, w_exact(1, y_repeat("▌")));
|
let right = fg_bg(bg, Reset, w_exact(1, y_repeat("▌")));
|
||||||
east(left, west(right, Tui::fg_bg(fg, bg, content)))
|
east(left, west(right, fg_bg(fg, bg, content)))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ```
|
/// ```
|
||||||
|
|
@ -471,7 +471,7 @@ pub fn view_meter <'a> (label: &'a str, value: f32) -> impl Draw<Tui> + 'a {
|
||||||
else if value >= -25.0 { 3 }
|
else if value >= -25.0 { 3 }
|
||||||
else if value >= -30.0 { 2 }
|
else if value >= -30.0 { 2 }
|
||||||
else if value >= -40.0 { 1 }
|
else if value >= -40.0 { 1 }
|
||||||
else { 0 }, 1, Tui::bg(if value >= 0.0 { Red }
|
else { 0 }, 1, bg(if value >= 0.0 { Red }
|
||||||
else if value >= -3.0 { Yellow }
|
else if value >= -3.0 { Yellow }
|
||||||
else { Green }, ())))
|
else { Green }, ())))
|
||||||
}
|
}
|
||||||
|
|
@ -509,15 +509,15 @@ pub fn draw_info_v (sample: Option<&Arc<RwLock<Sample>>>) -> impl Draw<Tui> + us
|
||||||
w_full(origin_w(field_h(theme, "Trans ", "0"))),
|
w_full(origin_w(field_h(theme, "Trans ", "0"))),
|
||||||
w_full(origin_w(field_h(theme, "Gain ", format!("{}", sample.gain)))),
|
w_full(origin_w(field_h(theme, "Gain ", format!("{}", sample.gain)))),
|
||||||
)))
|
)))
|
||||||
}), Thunk::new(|to: &mut Tui|to.place(&Tui::fg(Red, south!(
|
}), Thunk::new(|to: &mut Tui|to.place(&fg(Red, south!(
|
||||||
Tui::bold(true, "× No sample."),
|
bold(true, "× No sample."),
|
||||||
"[r] record",
|
"[r] record",
|
||||||
"[Shift-F9] import",
|
"[Shift-F9] import",
|
||||||
)))))
|
)))))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn draw_status (sample: Option<&Arc<RwLock<Sample>>>) -> impl Draw<Tui> {
|
pub fn draw_status (sample: Option<&Arc<RwLock<Sample>>>) -> impl Draw<Tui> {
|
||||||
Tui::bold(true, Tui::fg(Tui::g(224), sample
|
bold(true, fg(g(224), sample
|
||||||
.map(|sample|{
|
.map(|sample|{
|
||||||
let sample = sample.read().unwrap();
|
let sample = sample.read().unwrap();
|
||||||
format!("Sample {}-{}", sample.start, sample.end)
|
format!("Sample {}-{}", sample.start, sample.end)
|
||||||
|
|
@ -526,14 +526,14 @@ pub fn draw_status (sample: Option<&Arc<RwLock<Sample>>>) -> impl Draw<Tui> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn view_track_header (theme: ItemTheme, content: impl Draw<Tui>) -> impl Draw<Tui> {
|
pub fn view_track_header (theme: ItemTheme, content: impl Draw<Tui>) -> impl Draw<Tui> {
|
||||||
w_exact(12, Tui::bg(theme.darker.rgb, w_full(origin_e(content))))
|
w_exact(12, bg(theme.darker.term, w_full(origin_e(content))))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn view_ports_status <'a, T: JackPort> (theme: ItemTheme, title: &'a str, ports: &'a [T])
|
pub fn view_ports_status <'a, T: JackPort> (theme: ItemTheme, title: &'a str, ports: &'a [T])
|
||||||
-> impl Draw<Tui> + use<'a, T>
|
-> impl Draw<Tui> + use<'a, T>
|
||||||
{
|
{
|
||||||
let ins = ports.len() as u16;
|
let ins = ports.len() as u16;
|
||||||
let frame = Outer(true, Style::default().fg(Tui::g(96)));
|
let frame = Outer(true, Style::default().fg(g(96)));
|
||||||
let iter = move||ports.iter();
|
let iter = move||ports.iter();
|
||||||
let names = iter_south(1, iter, move|port, index|h_full(origin_w(format!(" {index} {}", port.port_name()))));
|
let names = iter_south(1, iter, move|port, index|h_full(origin_w(format!(" {index} {}", port.port_name()))));
|
||||||
let field = field_v(theme, title, names);
|
let field = field_v(theme, title, names);
|
||||||
|
|
@ -547,9 +547,9 @@ pub fn io_ports <'a, T: PortsSizes<'a>> (
|
||||||
_index, name, connections, y, y2
|
_index, name, connections, y, y2
|
||||||
): (usize, &'a Arc<str>, &'a [Connect], usize, usize), _|
|
): (usize, &'a Arc<str>, &'a [Connect], usize, usize), _|
|
||||||
iter_south(y as u16, (y2-y) as u16, south(
|
iter_south(y as u16, (y2-y) as u16, south(
|
||||||
h_full(Tui::bold(true, Tui::fg_bg(fg, bg, origin_w(east(&" ", name))))),
|
h_full(bold(true, fg_bg(fg, bg, origin_w(east(&" ", name))))),
|
||||||
iter(||connections.iter(), move|connect: &'a Connect, index|iter_south(index as u16, 1,
|
iter(||connections.iter(), move|connect: &'a Connect, index|iter_south(index as u16, 1,
|
||||||
h_full(origin_w(Tui::bold(false, Tui::fg_bg(fg, bg,
|
h_full(origin_w(bold(false, fg_bg(fg, bg,
|
||||||
&connect.info)))))))))
|
&connect.info)))))))))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -735,16 +735,16 @@ fn app_understand_word (state: &App, to: &mut Tui, dsl: &impl Expression) -> Usu
|
||||||
Some(":logo") => to.place(&view_logo()),
|
Some(":logo") => to.place(&view_logo()),
|
||||||
Some(":status") => to.place(&h_exact(1, "TODO: Status Bar")),
|
Some(":status") => to.place(&h_exact(1, "TODO: Status Bar")),
|
||||||
Some(":meters") => match frags.next() {
|
Some(":meters") => match frags.next() {
|
||||||
Some("input") => to.place(&Tui::bg(Rgb(30, 30, 30), h_full(origin_s("Input Meters")))),
|
Some("input") => to.place(&bg(Rgb(30, 30, 30), h_full(origin_s("Input Meters")))),
|
||||||
Some("output") => to.place(&Tui::bg(Rgb(30, 30, 30), h_full(origin_s("Output Meters")))),
|
Some("output") => to.place(&bg(Rgb(30, 30, 30), h_full(origin_s("Output Meters")))),
|
||||||
_ => panic!()
|
_ => panic!()
|
||||||
},
|
},
|
||||||
Some(":tracks") => match frags.next() {
|
Some(":tracks") => match frags.next() {
|
||||||
None => to.place(&"TODO tracks"),
|
None => to.place(&"TODO tracks"),
|
||||||
Some("names") => to.place(&state.project.view_track_names(state.color.clone())),//Tui::bg(Rgb(40, 40, 40), w_full(origin_w("Track Names")))),
|
Some("names") => to.place(&state.project.view_track_names(state.color.clone())),//bg(Rgb(40, 40, 40), w_full(origin_w("Track Names")))),
|
||||||
Some("inputs") => to.place(&Tui::bg(Rgb(40, 40, 40), w_full(origin_w("Track Inputs")))),
|
Some("inputs") => to.place(&bg(Rgb(40, 40, 40), w_full(origin_w("Track Inputs")))),
|
||||||
Some("devices") => to.place(&Tui::bg(Rgb(40, 40, 40), w_full(origin_w("Track Devices")))),
|
Some("devices") => to.place(&bg(Rgb(40, 40, 40), w_full(origin_w("Track Devices")))),
|
||||||
Some("outputs") => to.place(&Tui::bg(Rgb(40, 40, 40), w_full(origin_w("Track Outputs")))),
|
Some("outputs") => to.place(&bg(Rgb(40, 40, 40), w_full(origin_w("Track Outputs")))),
|
||||||
_ => panic!()
|
_ => panic!()
|
||||||
},
|
},
|
||||||
Some(":scenes") => match frags.next() {
|
Some(":scenes") => match frags.next() {
|
||||||
|
|
@ -760,7 +760,7 @@ fn app_understand_word (state: &App, to: &mut Tui, dsl: &impl Expression) -> Usu
|
||||||
Some(wh_full(Thunk::new(move|to: &mut Tui|{
|
Some(wh_full(Thunk::new(move|to: &mut Tui|{
|
||||||
for (index, MenuItem(item, _)) in items.0.iter().enumerate() {
|
for (index, MenuItem(item, _)) in items.0.iter().enumerate() {
|
||||||
to.place(&y_push((2 * index) as u16,
|
to.place(&y_push((2 * index) as u16,
|
||||||
Tui::fg_bg(
|
fg_bg(
|
||||||
if *selected == index { Rgb(240,200,180) } else { Rgb(200, 200, 200) },
|
if *selected == index { Rgb(240,200,180) } else { Rgb(200, 200, 200) },
|
||||||
if *selected == index { Rgb(80, 80, 50) } else { Rgb(30, 30, 30) },
|
if *selected == index { Rgb(80, 80, 50) } else { Rgb(30, 30, 30) },
|
||||||
h_exact(2, origin_n(w_full(item)))
|
h_exact(2, origin_n(w_full(item)))
|
||||||
|
|
@ -782,11 +782,11 @@ fn app_understand_word (state: &App, to: &mut Tui, dsl: &impl Expression) -> Usu
|
||||||
let info = profile.info.get(0).map(|x|x.as_ref()).unwrap_or("<no info>");
|
let info = profile.info.get(0).map(|x|x.as_ref()).unwrap_or("<no info>");
|
||||||
let fg1 = Rgb(224, 192, 128);
|
let fg1 = Rgb(224, 192, 128);
|
||||||
let fg2 = Rgb(224, 128, 32);
|
let fg2 = Rgb(224, 128, 32);
|
||||||
let field_name = w_full(origin_w(Tui::fg(fg1, name)));
|
let field_name = w_full(origin_w(fg(fg1, name)));
|
||||||
let field_id = w_full(origin_e(Tui::fg(fg2, id)));
|
let field_id = w_full(origin_e(fg(fg2, id)));
|
||||||
let field_info = w_full(origin_w(info));
|
let field_info = w_full(origin_w(info));
|
||||||
to.place(&y_push((2 * index) as u16,
|
to.place(&y_push((2 * index) as u16,
|
||||||
h_exact(2, w_full(Tui::bg(bg, south(
|
h_exact(2, w_full(bg(bg, south(
|
||||||
above(field_name, field_id), field_info))))));
|
above(field_name, field_id), field_info))))));
|
||||||
}
|
}
|
||||||
})))
|
})))
|
||||||
|
|
@ -796,7 +796,7 @@ fn app_understand_word (state: &App, to: &mut Tui, dsl: &impl Expression) -> Usu
|
||||||
for (index, name) in ["session1", "session2", "session3"].iter().enumerate() {
|
for (index, name) in ["session1", "session2", "session3"].iter().enumerate() {
|
||||||
let bg = if index == 0 { Rgb(50,50,50) } else { Rgb(40,40,40) };
|
let bg = if index == 0 { Rgb(50,50,50) } else { Rgb(40,40,40) };
|
||||||
to.place(&y_push((2 * index) as u16,
|
to.place(&y_push((2 * index) as u16,
|
||||||
&h_exact(2, w_full(Tui::bg(bg, origin_w(Tui::fg(fg, name)))))));
|
&h_exact(2, w_full(bg(bg, origin_w(fg(fg, name)))))));
|
||||||
}
|
}
|
||||||
})))),
|
})))),
|
||||||
Some(":browse/title") => to.place(&w_full(origin_w(field_v(ItemColor::default(),
|
Some(":browse/title") => to.place(&w_full(origin_w(field_v(ItemColor::default(),
|
||||||
|
|
@ -807,16 +807,16 @@ fn app_understand_word (state: &App, to: &mut Tui, dsl: &impl Expression) -> Usu
|
||||||
BrowseTarget::ExportSample(_) => "Export sample:",
|
BrowseTarget::ExportSample(_) => "Export sample:",
|
||||||
BrowseTarget::ImportClip(_) => "Import clip:",
|
BrowseTarget::ImportClip(_) => "Import clip:",
|
||||||
BrowseTarget::ExportClip(_) => "Export clip:",
|
BrowseTarget::ExportClip(_) => "Export clip:",
|
||||||
}, w_shrink(3, h_exact(1, Tui::fg(Tui::g(96), x_repeat("🭻")))))))),
|
}, w_shrink(3, h_exact(1, fg(g(96), x_repeat("🭻")))))))),
|
||||||
Some(":device") => {
|
Some(":device") => {
|
||||||
let selected = state.dialog.device_kind().unwrap();
|
let selected = state.dialog.device_kind().unwrap();
|
||||||
to.place(&south(Tui::bold(true, "Add device"), iter_south(1,
|
to.place(&south(bold(true, "Add device"), iter_south(1,
|
||||||
move||device_kinds().iter(),
|
move||device_kinds().iter(),
|
||||||
move|_label: &&'static str, i|{
|
move|_label: &&'static str, i|{
|
||||||
let bg = if i == selected { Rgb(64,128,32) } else { Rgb(0,0,0) };
|
let bg = if i == selected { Rgb(64,128,32) } else { Rgb(0,0,0) };
|
||||||
let lb = if i == selected { "[ " } else { " " };
|
let lb = if i == selected { "[ " } else { " " };
|
||||||
let rb = if i == selected { " ]" } else { " " };
|
let rb = if i == selected { " ]" } else { " " };
|
||||||
w_full(Tui::bg(bg, east(lb, west(rb, "FIXME device name")))) })))
|
w_full(bg(bg, east(lb, west(rb, "FIXME device name")))) })))
|
||||||
},
|
},
|
||||||
Some(":debug") => to.place(&h_exact(1, format!("[{:?}]", to.area()))),
|
Some(":debug") => to.place(&h_exact(1, format!("[{:?}]", to.area()))),
|
||||||
Some(_) => {
|
Some(_) => {
|
||||||
|
|
@ -956,7 +956,7 @@ impl App {
|
||||||
impl Draw<Tui> for App {
|
impl Draw<Tui> for App {
|
||||||
fn draw (self, to: &mut Tui) -> Usually<XYWH<u16>> {
|
fn draw (self, to: &mut Tui) -> Usually<XYWH<u16>> {
|
||||||
if let Some(e) = self.error.read().unwrap().as_ref() {
|
if let Some(e) = self.error.read().unwrap().as_ref() {
|
||||||
to.show(to.area(), e);
|
to.place_at(to.area(), e);
|
||||||
}
|
}
|
||||||
for (index, dsl) in self.mode.view.iter().enumerate() {
|
for (index, dsl) in self.mode.view.iter().enumerate() {
|
||||||
if let Err(e) = self.understand(to, dsl) {
|
if let Err(e) = self.understand(to, dsl) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue