mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 11:46:41 +01:00
fix editor behaviors
This commit is contained in:
parent
6408cd26b8
commit
968441850f
8 changed files with 151 additions and 148 deletions
|
|
@ -44,8 +44,8 @@ command!(|self:FileBrowserCommand,state:SamplerTui|match self {
|
|||
//_ => match input {
|
||||
//// load sample
|
||||
//kpat!(Shift-Char('L')) => Self::Import(FileBrowserCommand::Begin),
|
||||
//kpat!(KeyCode::Up) => Self::Select(state.note_point().overflowing_add(1).0.min(127)),
|
||||
//kpat!(KeyCode::Down) => Self::Select(state.note_point().overflowing_sub(1).0.min(127)),
|
||||
//kpat!(KeyCode::Up) => Self::Select(state.note_pos().overflowing_add(1).0.min(127)),
|
||||
//kpat!(KeyCode::Down) => Self::Select(state.note_pos().overflowing_sub(1).0.min(127)),
|
||||
//_ => return None
|
||||
//}
|
||||
//});
|
||||
|
|
@ -58,8 +58,8 @@ command!(|self: SamplerTuiCommand, state: SamplerTui|match self {
|
|||
None
|
||||
},
|
||||
Self::Select(index) => {
|
||||
let old = state.note_point();
|
||||
state.set_note_point(index);
|
||||
let old = state.note_pos();
|
||||
state.set_note_pos(index);
|
||||
Some(Self::Select(old))
|
||||
},
|
||||
Self::Sample(cmd) => cmd.execute(&mut state.state)?.map(Self::Sample),
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ content!(TuiOut: |self: SamplerTui| {
|
|||
Fill::xy(SamplesTui {
|
||||
color: self.color,
|
||||
note_hi: self.note_hi(),
|
||||
note_pt: self.note_point(),
|
||||
note_pt: self.note_pos(),
|
||||
height: self.size.h(),
|
||||
}),
|
||||
))),
|
||||
|
|
@ -74,14 +74,14 @@ impl NoteRange for SamplerTui {
|
|||
impl NotePoint for SamplerTui {
|
||||
fn note_len (&self) -> usize {0/*TODO*/}
|
||||
fn set_note_len (&self, x: usize) {}
|
||||
fn note_point (&self) -> usize { self.note_pt.load(Relaxed) }
|
||||
fn set_note_point (&self, x: usize) { self.note_pt.store(x, Relaxed); }
|
||||
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 {
|
||||
let note_lo = editor.note_lo().load(Relaxed);
|
||||
let note_pt = editor.note_point();
|
||||
let note_pt = editor.note_pos();
|
||||
let note_hi = editor.note_hi();
|
||||
Outer(Style::default().fg(TuiTheme::g(96))).enclose(Map::new(move||(note_lo..=note_hi).rev(), move|note, i| {
|
||||
let offset = |a|Push::y(i as u16, Align::n(Fixed::y(1, Fill::x(a))));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue