This commit is contained in:
@@ -34,46 +34,14 @@ pub(super) fn handle_main_page(ctx: &mut InputContext, key: KeyEvent, ctrl: bool
|
||||
ctx.playing
|
||||
.store(ctx.app.playback.playing, Ordering::Relaxed);
|
||||
}
|
||||
KeyCode::Left if shift && !ctrl => {
|
||||
if ctx.app.editor_ctx.selection_anchor.is_none() {
|
||||
ctx.dispatch(AppCommand::SetSelectionAnchor(ctx.app.editor_ctx.step));
|
||||
}
|
||||
ctx.dispatch(AppCommand::PrevStep);
|
||||
}
|
||||
KeyCode::Right if shift && !ctrl => {
|
||||
if ctx.app.editor_ctx.selection_anchor.is_none() {
|
||||
ctx.dispatch(AppCommand::SetSelectionAnchor(ctx.app.editor_ctx.step));
|
||||
}
|
||||
ctx.dispatch(AppCommand::NextStep);
|
||||
}
|
||||
KeyCode::Up if shift && !ctrl => {
|
||||
if ctx.app.editor_ctx.selection_anchor.is_none() {
|
||||
ctx.dispatch(AppCommand::SetSelectionAnchor(ctx.app.editor_ctx.step));
|
||||
}
|
||||
ctx.dispatch(AppCommand::StepUp);
|
||||
}
|
||||
KeyCode::Down if shift && !ctrl => {
|
||||
if ctx.app.editor_ctx.selection_anchor.is_none() {
|
||||
ctx.dispatch(AppCommand::SetSelectionAnchor(ctx.app.editor_ctx.step));
|
||||
}
|
||||
ctx.dispatch(AppCommand::StepDown);
|
||||
}
|
||||
KeyCode::Left => {
|
||||
ctx.app.editor_ctx.clear_selection();
|
||||
ctx.dispatch(AppCommand::PrevStep);
|
||||
}
|
||||
KeyCode::Right => {
|
||||
ctx.app.editor_ctx.clear_selection();
|
||||
ctx.dispatch(AppCommand::NextStep);
|
||||
}
|
||||
KeyCode::Up => {
|
||||
ctx.app.editor_ctx.clear_selection();
|
||||
ctx.dispatch(AppCommand::StepUp);
|
||||
}
|
||||
KeyCode::Down => {
|
||||
ctx.app.editor_ctx.clear_selection();
|
||||
ctx.dispatch(AppCommand::StepDown);
|
||||
}
|
||||
KeyCode::Left if shift && !ctrl => shift_navigate(ctx, AppCommand::PrevStep),
|
||||
KeyCode::Right if shift && !ctrl => shift_navigate(ctx, AppCommand::NextStep),
|
||||
KeyCode::Up if shift && !ctrl => shift_navigate(ctx, AppCommand::StepUp),
|
||||
KeyCode::Down if shift && !ctrl => shift_navigate(ctx, AppCommand::StepDown),
|
||||
KeyCode::Left => navigate(ctx, AppCommand::PrevStep),
|
||||
KeyCode::Right => navigate(ctx, AppCommand::NextStep),
|
||||
KeyCode::Up => navigate(ctx, AppCommand::StepUp),
|
||||
KeyCode::Down => navigate(ctx, AppCommand::StepDown),
|
||||
KeyCode::Esc => {
|
||||
ctx.app.editor_ctx.clear_selection();
|
||||
}
|
||||
@@ -214,12 +182,12 @@ pub(super) fn handle_main_page(ctx: &mut InputContext, key: KeyEvent, ctrl: bool
|
||||
}
|
||||
KeyCode::Char('m') => {
|
||||
let (bank, pattern) = (ctx.app.editor_ctx.bank, ctx.app.editor_ctx.pattern);
|
||||
ctx.app.mute.toggle_mute(bank, pattern);
|
||||
ctx.app.playback.toggle_mute(bank, pattern);
|
||||
ctx.app.send_mute_state(ctx.seq_cmd_tx);
|
||||
}
|
||||
KeyCode::Char('x') => {
|
||||
let (bank, pattern) = (ctx.app.editor_ctx.bank, ctx.app.editor_ctx.pattern);
|
||||
ctx.app.mute.toggle_solo(bank, pattern);
|
||||
ctx.app.playback.toggle_solo(bank, pattern);
|
||||
ctx.app.send_mute_state(ctx.seq_cmd_tx);
|
||||
}
|
||||
KeyCode::Char('M') => {
|
||||
@@ -245,3 +213,15 @@ pub(super) fn handle_main_page(ctx: &mut InputContext, key: KeyEvent, ctrl: bool
|
||||
}
|
||||
InputResult::Continue
|
||||
}
|
||||
|
||||
fn shift_navigate(ctx: &mut InputContext, cmd: AppCommand) {
|
||||
if ctx.app.editor_ctx.selection_anchor.is_none() {
|
||||
ctx.dispatch(AppCommand::SetSelectionAnchor(ctx.app.editor_ctx.step));
|
||||
}
|
||||
ctx.dispatch(cmd);
|
||||
}
|
||||
|
||||
fn navigate(ctx: &mut InputContext, cmd: AppCommand) {
|
||||
ctx.app.editor_ctx.clear_selection();
|
||||
ctx.dispatch(cmd);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user