mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
improve ui legibility immensely right after release
This commit is contained in:
parent
b20ebbd7be
commit
83f840a412
5 changed files with 40 additions and 57 deletions
35
src/field.rs
35
src/field.rs
|
|
@ -7,16 +7,12 @@ impl<T, U> Content<Tui> for Field<T, U>
|
|||
where T: AsRef<str> + Send + Sync, U: AsRef<str> + Send + Sync
|
||||
{
|
||||
fn content (&self) -> impl Content<Tui> {
|
||||
let ItemPalette { darkest, dark, lighter, lightest, .. } = self.0;
|
||||
row!(
|
||||
Tui::bg(self.0.darkest.rgb, Tui::fg(self.0.darker.rgb, "▐")),
|
||||
|
||||
Tui::bg(self.0.darker.rgb, Tui::fg(self.0.lighter.rgb,
|
||||
Tui::bold(true, format!("{}", self.1.as_ref())))),
|
||||
|
||||
Tui::bg(self.0.darkest.rgb, Tui::fg(self.0.darker.rgb, "▌")),
|
||||
|
||||
Tui::bg(self.0.darkest.rgb, Tui::fg(self.0.lightest.rgb,
|
||||
format!("{} ", self.2.as_ref())))
|
||||
Tui::fg_bg(dark.rgb, darkest.rgb, "▐"),
|
||||
Tui::fg_bg(lighter.rgb, dark.rgb, Tui::bold(true, format!("{}", self.1.as_ref()))),
|
||||
Tui::fg_bg(dark.rgb, darkest.rgb, "▌"),
|
||||
Tui::fg_bg(lightest.rgb, darkest.rgb, format!("{} ", self.2.as_ref()))
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -28,18 +24,13 @@ impl<T, U> Content<Tui> for FieldV<T, U>
|
|||
where T: AsRef<str> + Send + Sync, U: AsRef<str> + Send + Sync
|
||||
{
|
||||
fn content (&self) -> impl Content<Tui> {
|
||||
Bsp::e(
|
||||
Bsp::s(
|
||||
row!(
|
||||
Tui::bg(self.0.darkest.rgb, Tui::fg(self.0.darker.rgb, "▐")),
|
||||
Tui::bg(self.0.darker.rgb, Tui::fg(self.0.lighter.rgb,
|
||||
Tui::bold(true, format!("{}", self.1.as_ref())))),
|
||||
Tui::bg(self.0.darkest.rgb, Tui::fg(self.0.darker.rgb, "▌")),
|
||||
),
|
||||
Tui::bg(self.0.darkest.rgb, Tui::fg(self.0.lightest.rgb,
|
||||
format!(" {}", self.2.as_ref())))
|
||||
),
|
||||
" "
|
||||
)
|
||||
let ItemPalette { darkest, dark, lighter, lightest, .. } = self.0;
|
||||
let sep1 = Tui::bg(darkest.rgb, Tui::fg(dark.rgb, "▐"));
|
||||
let sep2 = Tui::bg(darkest.rgb, Tui::fg(dark.rgb, "▌"));
|
||||
let name = Tui::bg(dark.rgb, Tui::fg(lighter.rgb,
|
||||
Tui::bold(true, format!("{}", self.1.as_ref()))));
|
||||
let value = Tui::bg(darkest.rgb, Tui::fg(lightest.rgb,
|
||||
format!(" {} ", self.2.as_ref())));
|
||||
Bsp::e(Bsp::s(row!(sep1, name, sep2), value), " ")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use super::*;
|
|||
|
||||
render!(Tui: (self: Groovebox) => self.size.of(
|
||||
Bsp::s(self.toolbar_view(),
|
||||
Bsp::s(self.selector_view(),
|
||||
Bsp::n(self.selector_view(),
|
||||
Bsp::n(self.sample_view(),
|
||||
Bsp::n(self.status_view(),
|
||||
Bsp::w(self.pool_view(), Fill::xy(Bsp::e(self.sampler_view(), &self.editor)))))))));
|
||||
|
|
@ -16,38 +16,34 @@ impl Groovebox {
|
|||
Align::x(TransportView::new(true, &self.player.clock)),
|
||||
)))
|
||||
}
|
||||
fn status_view (&self) -> impl Content<Tui> + use<'_> {
|
||||
let note_pt = self.editor.note_point();
|
||||
lay!(
|
||||
Align::w(Fixed::y(1, SamplerStatus(&self.sampler, note_pt))),
|
||||
Align::x(Fixed::y(1, MidiEditStatus(&self.editor))),
|
||||
fn selector_view (&self) -> impl Content<Tui> + use<'_> {
|
||||
row!(
|
||||
MidiEditClip(&self.editor),
|
||||
MidiEditStatus(&self.editor),
|
||||
ClipSelected::play_phrase(&self.player),
|
||||
ClipSelected::next_phrase(&self.player),
|
||||
)
|
||||
}
|
||||
fn sampler_view (&self) -> impl Content<Tui> + use<'_> {
|
||||
let sampler_w = if !self.compact { 11 } else { 4 };
|
||||
let sampler_y = if self.compact { 1 } else { 0 };
|
||||
Fixed::x(sampler_w, Push::y(sampler_y, Fill::y(
|
||||
SampleList::new(self.compact, &self.sampler, &self.editor))))
|
||||
}
|
||||
fn sample_view (&self) -> impl Content<Tui> + use<'_> {
|
||||
let note_pt = self.editor.note_point();
|
||||
let sample_h = if self.compact { 0 } else { 5 };
|
||||
Max::y(sample_h, Fill::xy(
|
||||
SampleViewer::from_sampler(&self.sampler, note_pt)))
|
||||
}
|
||||
fn status_view (&self) -> impl Content<Tui> + use<'_> {
|
||||
let note_pt = self.editor.note_point();
|
||||
Align::w(Fixed::y(1, SamplerStatus(&self.sampler, note_pt)))
|
||||
}
|
||||
fn pool_view (&self) -> impl Content<Tui> + use<'_> {
|
||||
let w = self.size.w();
|
||||
let pool_w = if w > 60 { 20 } else if w > 40 { 15 } else { 10 };
|
||||
Fixed::x(if self.compact { 5 } else { pool_w },
|
||||
PoolView(self.compact, &self.pool))
|
||||
}
|
||||
fn selector_view (&self) -> impl Content<Tui> + use<'_> {
|
||||
lay!(
|
||||
Align::w(MidiEditClip(&self.editor)),
|
||||
Align::e(Bsp::e(
|
||||
ClipSelected::play_phrase(&self.player),
|
||||
ClipSelected::next_phrase(&self.player)
|
||||
))
|
||||
)
|
||||
fn sampler_view (&self) -> impl Content<Tui> + use<'_> {
|
||||
let sampler_w = if self.compact { 4 } else { 11 };
|
||||
let sampler_y = if self.compact { 0 } else { 1 };
|
||||
Fixed::x(sampler_w, Push::y(sampler_y, Fill::y(
|
||||
SampleList::new(self.compact, &self.sampler, &self.editor))))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@ render!(Tui: (self: MidiEditClip<'a>) => {
|
|||
} else {
|
||||
(ItemPalette::from(TuiTheme::g(64)), String::new(), 0, false)
|
||||
};
|
||||
Fixed::y(1, row!(
|
||||
Field(color, "Edit", name.to_string()),
|
||||
Field(color, "Length", length.to_string()),
|
||||
Field(color, "Loop", looped.to_string())
|
||||
))
|
||||
row!(
|
||||
FieldV(color, "Edit", name.to_string()),
|
||||
FieldV(color, "Length", length.to_string()),
|
||||
FieldV(color, "Loop", looped.to_string())
|
||||
)
|
||||
});
|
||||
|
||||
pub struct MidiEditStatus<'a>(pub &'a MidiEditor);
|
||||
|
|
@ -27,15 +27,11 @@ render!(Tui: (self: MidiEditStatus<'a>) => {
|
|||
let time_axis = self.0.time_axis().get();
|
||||
let time_zoom = self.0.time_zoom().get();
|
||||
let time_lock = if self.0.time_lock().get() { "[lock]" } else { " " };
|
||||
let time_field = Field(color, "Time", format!("{length}/{time_zoom}+{time_point} {time_lock}"));
|
||||
let time_field = FieldV(color, "Time", format!("{length}/{time_zoom}+{time_point} {time_lock}"));
|
||||
|
||||
let note_point = format!("{:>3}", self.0.note_point());
|
||||
let note_name = format!("{:4}", Note::pitch_to_name(self.0.note_point()));
|
||||
let note_len = format!("{:>4}", self.0.note_len());;;;
|
||||
let note_field = Field(color, "Note", format!("{note_name} {note_point} {note_len}"));
|
||||
|
||||
Tui::bg(color.darkest.rgb, Fill::x(Tui::fg(color.lightest.rgb, Bsp::e(
|
||||
time_field,
|
||||
note_field,
|
||||
))))
|
||||
let note_field = FieldV(color, "Note", format!("{note_name} {note_point} {note_len}"));
|
||||
Bsp::e(time_field, note_field,)
|
||||
});
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ pub struct ClipSelected {
|
|||
}
|
||||
|
||||
render!(Tui: (self: ClipSelected) =>
|
||||
Field(self.color, self.title, format!("{} {}", self.time, self.name)));
|
||||
FieldV(self.color, self.title, format!("{} {}", self.time, self.name)));
|
||||
|
||||
impl ClipSelected {
|
||||
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ use crate::*;
|
|||
|
||||
pub struct SamplerStatus<'a>(pub &'a Sampler, pub usize);
|
||||
|
||||
render!(Tui: (self: SamplerStatus<'a>) => self.0.mapped[self.1].as_ref().map(|sample|format!(
|
||||
render!(Tui: (self: SamplerStatus<'a>) => Tui::bold(true, Tui::fg(TuiTheme::g(224), self.0.mapped[self.1].as_ref().map(|sample|format!(
|
||||
"Sample {}-{}",
|
||||
sample.read().unwrap().start,
|
||||
sample.read().unwrap().end,
|
||||
)).unwrap_or_else(||"No sample".to_string()));
|
||||
)).unwrap_or_else(||"No sample".to_string()))));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue