midi: add pgup/pgdn; cleanup

This commit is contained in:
🪞👃🪞 2025-04-27 16:33:00 +03:00
parent 22155f7acf
commit 397e71edee
15 changed files with 96 additions and 212 deletions

View file

@ -1,53 +1,4 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
//fn to_clips_command (state: &MidiPool, input: &Event) -> Option<PoolCommand> {
//use KeyCode::{Up, Down, Delete, Char};
//use PoolCommand as Cmd;
//let index = state.clip_index();
//let count = state.clips().len();
//Some(match input {
//kpat!(Char('n')) => Cmd::Rename(ClipRenameCommand::Begin),
//kpat!(Char('t')) => Cmd::Length(ClipLengthCommand::Begin),
//kpat!(Char('m')) => Cmd::Import(FileBrowserCommand::Begin),
//kpat!(Char('x')) => Cmd::Export(FileBrowserCommand::Begin),
//kpat!(Char('c')) => Cmd::Clip(PoolClipCommand::SetColor(index, ItemColor::random())),
//kpat!(Char('[')) | kpat!(Up) => Cmd::Select(
//index.overflowing_sub(1).0.min(state.clips().len() - 1)
//),
//kpat!(Char(']')) | kpat!(Down) => Cmd::Select(
//index.saturating_add(1) % state.clips().len()
//),
//kpat!(Char('<')) => if index > 1 {
//state.set_clip_index(state.clip_index().saturating_sub(1));
//Cmd::Clip(PoolClipCommand::Swap(index - 1, index))
//} else {
//return None
//},
//kpat!(Char('>')) => if index < count.saturating_sub(1) {
//state.set_clip_index(state.clip_index() + 1);
//Cmd::Clip(PoolClipCommand::Swap(index + 1, index))
//} else {
//return None
//},
//kpat!(Delete) => if index > 0 {
//state.set_clip_index(index.min(count.saturating_sub(1)));
//Cmd::Clip(PoolClipCommand::Delete(index))
//} else {
//return None
//},
//kpat!(Char('a')) | kpat!(Shift-Char('A')) => Cmd::Clip(PoolClipCommand::Add(count, MidiClip::new(
//"Clip", true, 4 * PPQ, None, Some(ItemTheme::random())
//))),
//kpat!(Char('i')) => Cmd::Clip(PoolClipCommand::Add(index + 1, MidiClip::new(
//"Clip", true, 4 * PPQ, None, Some(ItemTheme::random())
//))),
//kpat!(Char('d')) | kpat!(Shift-Char('D')) => {
//let mut clip = state.clips()[index].read().unwrap().duplicate();
//clip.color = ItemTheme::random_near(clip.color, 0.25);
//Cmd::Clip(PoolClipCommand::Add(index + 1, clip))
//},
//_ => return None
//})
//}
//keymap!(KEYS_MIDI_EDITOR = |s: MidiEditor, _input: Event| MidiEditCommand {
//key(Up) => SetNoteCursor(s.note_pos() + 1),
//key(Char('w')) => SetNoteCursor(s.note_pos() + 1),
@ -74,12 +25,6 @@
//key(Char('_')) => SetTimeZoom(if s.time_lock().get() { s.time_zoom().get() } else { NoteDuration::next(s.time_zoom().get()) }),
//key(Char('=')) => SetTimeZoom(if s.time_lock().get() { s.time_zoom().get() } else { NoteDuration::prev(s.time_zoom().get()) }),
//key(Char('+')) => SetTimeZoom(if s.time_lock().get() { s.time_zoom().get() } else { NoteDuration::prev(s.time_zoom().get()) }),
//key(Enter) => PutNote,
//ctrl(key(Enter)) => AppendNote,
//key(Char(',')) => SetNoteLength(NoteDuration::prev(s.note_len())),
//key(Char('.')) => SetNoteLength(NoteDuration::next(s.note_len())),
//key(Char('<')) => SetNoteLength(NoteDuration::prev(s.note_len())),
//key(Char('>')) => SetNoteLength(NoteDuration::next(s.note_len())),
////// TODO: kpat!(Char('/')) => // toggle 3plet
////// TODO: kpat!(Char('?')) => // toggle dotted
//});