use keymap! in more places

This commit is contained in:
🪞👃🪞 2025-01-02 21:36:32 +01:00
parent 8dedc8fd5f
commit a82f73d475
6 changed files with 200 additions and 268 deletions

View file

@ -41,14 +41,16 @@ impl Groovebox {
player,
sampler,
_jack: jack.clone(),
pool: crate::pool::PoolModel::from(&phrase),
editor: crate::midi::MidiEditor::from(&phrase),
compact: true,
status: true,
size: Measure::new(),
midi_buf: vec![vec![];65536],
note_buf: vec![],
perf: PerfModel::default(),
status: true,
compact: true,
})
}
}
@ -144,7 +146,7 @@ pub enum GrooveboxCommand {
}
handle!(<Tui>|self: Groovebox, input|GrooveboxCommand::execute_with_state(self, input.event()));
keymap!(KEYS_GROOVEBOX: |state: Groovebox, input: Event| GrooveboxCommand {
keymap!(KEYS_GROOVEBOX = |state: Groovebox, input: Event| GrooveboxCommand {
// Tab: Toggle compact mode
key(Tab) => Cmd::Compact(!state.compact),
// q: Enqueue currently edited phrase
@ -179,13 +181,13 @@ keymap!(KEYS_GROOVEBOX: |state: Groovebox, input: Event| GrooveboxCommand {
} else {
return None
},
}, Some(if let Some(command) = MidiEditCommand::input_to_command(&state.editor, input) {
}, if let Some(command) = MidiEditCommand::input_to_command(&state.editor, input) {
Cmd::Editor(command)
} else if let Some(command) = PoolCommand::input_to_command(&state.pool, input) {
Cmd::Pool(command)
} else {
return None
}));
});
command!(|self: GrooveboxCommand, state: Groovebox|match self {
Self::Enqueue(phrase) => {