sampler: arrows select slot

This commit is contained in:
🪞👃🪞 2025-04-25 20:56:36 +03:00
parent b376d75396
commit 2877545140
3 changed files with 38 additions and 21 deletions

View file

@ -22,10 +22,11 @@ impl Sampler {
pub fn view_grid_cell <'a> (
&'a self, name: &'a str, x: u16, y: u16, w: u16, h: u16
) -> impl Content<TuiOut> + use<'a> {
let cursor = self.cursor();
let hi_fg = Color::Rgb(64, 64, 64);
let hi_bg = if y == 0 { Color::Reset } else { Color::Rgb(64, 64, 64) /*prev*/ };
let tx_fg = Color::Rgb(255, 255, 255);
let tx_bg = if x as usize == self.cursor.0 && y as usize == self.cursor.1 {
let tx_bg = if x as usize == cursor.0 && y as usize == cursor.1 {
Color::Rgb(96, 96, 96)
} else {
Color::Rgb(64, 64, 64)
@ -85,18 +86,6 @@ render!(TuiOut: |self: SamplesTui, to| {
}
});
impl NoteRange for Sampler {
fn note_lo (&self) -> &AtomicUsize { &self.note_lo }
fn note_axis (&self) -> &AtomicUsize { &self.size.y }
}
impl NotePoint for Sampler {
fn note_len (&self) -> usize {0/*TODO*/}
fn set_note_len (&self, x: usize) {}
fn note_pos (&self) -> usize { self.note_pt.load(Relaxed) }
fn set_note_pos (&self, x: usize) { self.note_pt.store(x, Relaxed); }
}
impl Sampler {
const _EMPTY: &[(f64, f64)] = &[(0., 0.), (1., 1.), (2., 2.), (0., 2.), (2., 0.)];
pub fn list <'a> (&'a self, compact: bool, editor: &MidiEditor) -> impl Content<TuiOut> + 'a {