wip: command palette

This commit is contained in:
🪞👃🪞 2024-07-12 15:39:38 +03:00
parent 6a738375e2
commit 145827913a
4 changed files with 137 additions and 15 deletions

View file

@ -46,7 +46,11 @@ fn handle_device (state: &mut App, e: &AppEvent) -> Usually<bool> {
.map(|x|x.unwrap_or(false))
}
const KEYMAP_FOCUS: &'static [KeyBinding<App>] = keymap!(App {
pub const KEYMAP_FOCUS: &'static [KeyBinding<App>] = keymap!(App {
[Char(';'), NONE, "command", "open command palette", |app: &mut App| {
app.modal = Some(Box::new(crate::view::HelpModal::new()));
Ok(true)
}],
[Tab, NONE, "focus_next", "focus next area", focus_next],
[Tab, SHIFT, "focus_prev", "focus previous area", focus_prev],
[Esc, NONE, "focus_exit", "unfocus", |app: &mut App|{
@ -59,8 +63,8 @@ const KEYMAP_FOCUS: &'static [KeyBinding<App>] = keymap!(App {
}],
});
const KEYMAP: &'static [KeyBinding<App>] = keymap!(App {
[F(1), NONE, "help_toggle", "toggle help", |_: &mut App| {Ok(true)}],
pub const KEYMAP: &'static [KeyBinding<App>] = keymap!(App {
//[F(1), NONE, "help_toggle", "toggle help", |_: &mut App| {Ok(true)}],
[Up, NONE, "focus_prev", "focus previous area", |app: &mut App|match app.track_cursor {
0 => {app.section = AppSection::Arranger;Ok(true)},
@ -88,20 +92,20 @@ const KEYMAP: &'static [KeyBinding<App>] = keymap!(App {
Ok(true)
}],
[Char('+'), NONE, "quant_inc", "Quantize coarser", |app: &mut App| {
[Char('+'), NONE, "quant_inc", "quantize coarser", |app: &mut App| {
app.transport.quant = next_note_length(app.transport.quant);
Ok(true)
}],
[Char('_'), NONE, "quant_dec", "Quantize finer", |app: &mut App| {
[Char('_'), NONE, "quant_dec", "quantize finer", |app: &mut App| {
app.transport.quant = prev_note_length(app.transport.quant);
Ok(true)
}],
[Char('='), NONE, "zoom_in", "Zoom in", |app: &mut App| {
[Char('='), NONE, "zoom_in", "show fewer ticks per block", |app: &mut App| {
app.seq_buf.time_zoom = prev_note_length(app.seq_buf.time_zoom);
Ok(true)
}],
[Char('-'), NONE, "zoom_out", "Zoom out", |app: &mut App| {
[Char('-'), NONE, "zoom_out", "show more ticks per block", |app: &mut App| {
app.seq_buf.time_zoom = next_note_length(app.seq_buf.time_zoom);
Ok(true)
}],