compact sample list

This commit is contained in:
🪞👃🪞 2025-05-14 20:44:25 +03:00
parent d45bd2122e
commit 4a9e9132f3
3 changed files with 9 additions and 5 deletions

View file

@ -87,7 +87,7 @@ impl App {
))
}
pub fn view_samples_keys (&self) -> impl Content<TuiOut> + use<'_> {
self.project.sampler().map(|s|s.view_list(false, self.editor().unwrap()))
self.project.sampler().map(|s|s.view_list(true, self.editor().unwrap()))
}
pub fn view_samples_grid (&self) -> impl Content<TuiOut> + use<'_> {
self.project.sampler().map(|s|s.view_grid())

View file

@ -8,7 +8,7 @@ content!(TuiOut: |self: PoolView<'a>| {
//let on_bg = |x|x;//Bsp::b(Repeat(" "), Tui::bg(color.darkest.rgb, x));
//let border = |x|x;//Outer(Style::default().fg(color.dark.rgb).bg(color.darkest.rgb)).enclose(x);
let height = pool.clips.read().unwrap().len() as u16;
Fixed::x(20, Fill::y(Align::c(Map::new(
Fixed::x(20, Fill::y(Align::n(Map::new(
||pool.clips().clone().into_iter(),
move|clip: Arc<RwLock<MidiClip>>, i: usize|{
let item_height = 1;

View file

@ -59,7 +59,7 @@ impl Sampler {
let note_lo = editor.get_note_lo();
let note_pt = editor.get_note_pos();
let note_hi = editor.get_note_hi();
Fixed::x(12, Map::south(
Fixed::x(if compact { 4 } else { 12 }, Map::south(
1,
move||(note_lo..=note_hi).rev(),
move|note, _index| {
@ -234,7 +234,7 @@ fn draw_info (sample: Option<&Arc<RwLock<Sample>>>) -> impl Content<TuiOut> + us
}
fn draw_info_v (sample: Option<&Arc<RwLock<Sample>>>) -> impl Content<TuiOut> + use<'_> {
When(sample.is_some(), Thunk::new(move||{
Either(sample.is_some(), Thunk::new(move||{
let sample = sample.unwrap().read().unwrap();
let theme = sample.color;
Fixed::x(20, col!(
@ -245,7 +245,11 @@ fn draw_info_v (sample: Option<&Arc<RwLock<Sample>>>) -> impl Content<TuiOut> +
Fill::x(Align::w(FieldH(theme, "Trans ", "0 "))),
Fill::x(Align::w(FieldH(theme, "Gain ", format!("{}", sample.gain)))),
))
}))
}), Thunk::new(move||Tui::fg(Red, col!(
"× No sample.",
"Press record",
"or import.",
))))
}
fn draw_status (sample: Option<&Arc<RwLock<Sample>>>) -> impl Content<TuiOut> {