20 new errors rear their ugly heads

This commit is contained in:
🪞👃🪞 2024-09-05 23:19:53 +03:00
parent 92d747ba2a
commit e7f2284e5e
8 changed files with 167 additions and 174 deletions

View file

@ -2,48 +2,45 @@ use crate::*;
impl Handle<Tui> for Sequencer {
fn handle (&mut self, from: &Tui) -> Perhaps<bool> {
handle_keymap(self, &from.event(), KEYMAP_SEQUENCER)
match from.event() {
// NONE, "seq_cursor_up", "move cursor up", |sequencer: &mut Sequencer| {
key!(KeyCode::Up) => {
match self.entered {
true => { self.note_axis.point_dec(); },
false => { self.note_axis.start_dec(); },
}
Ok(Some(true))
},
// NONE, "seq_cursor_down", "move cursor down", |self: &mut Sequencer| {
key!(KeyCode::Down) => {
match self.entered {
true => { self.note_axis.point_inc(); },
false => { self.note_axis.start_inc(); },
}
Ok(Some(true))
},
// NONE, "seq_cursor_left", "move cursor up", |self: &mut Sequencer| {
key!(KeyCode::Left) => {
match self.entered {
true => { self.time_axis.point_dec(); },
false => { self.time_axis.start_dec(); },
}
Ok(Some(true))
},
// NONE, "seq_cursor_right", "move cursor up", |self: &mut Sequencer| {
key!(KeyCode::Right) => {
match self.entered {
true => { self.time_axis.point_inc(); },
false => { self.time_axis.start_inc(); },
}
Ok(Some(true))
},
// NONE, "seq_mode_switch", "switch the display mode", |self: &mut Sequencer| {
key!(KeyCode::Char('`')) => {
self.mode = !self.mode;
Ok(Some(true))
},
_ => Ok(None)
}
}
}
/// Key bindings for phrase editor.
pub const KEYMAP_SEQUENCER: &'static [KeyBinding<Sequencer>] = keymap!(Sequencer {
[Up, NONE, "seq_cursor_up", "move cursor up", |sequencer: &mut Sequencer| {
match sequencer.entered {
true => { sequencer.note_axis.point_dec(); },
false => { sequencer.note_axis.start_dec(); },
}
Ok(true)
}],
[Down, NONE, "seq_cursor_down", "move cursor down", |sequencer: &mut Sequencer| {
match sequencer.entered {
true => { sequencer.note_axis.point_inc(); },
false => { sequencer.note_axis.start_inc(); },
}
Ok(true)
}],
[Left, NONE, "seq_cursor_left", "move cursor up", |sequencer: &mut Sequencer| {
match sequencer.entered {
true => { sequencer.time_axis.point_dec(); },
false => { sequencer.time_axis.start_dec(); },
}
Ok(true)
}],
[Right, NONE, "seq_cursor_right", "move cursor up", |sequencer: &mut Sequencer| {
match sequencer.entered {
true => { sequencer.time_axis.point_inc(); },
false => { sequencer.time_axis.start_inc(); },
}
Ok(true)
}],
[Char('`'), NONE, "seq_mode_switch", "switch the display mode", |sequencer: &mut Sequencer| {
sequencer.mode = !sequencer.mode;
Ok(true)
}],
/*
[Char('a'), NONE, "note_add", "Add note", note_add],
[Char('z'), NONE, "note_del", "Delete note", note_del],
[CapsLock, NONE, "advance", "Toggle auto advance", nop],
[Char('w'), NONE, "rest", "Advance by note duration", nop],
*/
});