shorten command names

This commit is contained in:
🪞👃🪞 2024-11-07 02:20:03 +01:00
parent dd72cea679
commit d3718f0b78

View file

@ -14,7 +14,7 @@ enum SequencerCommand {
}
#[derive(Clone, PartialEq)]
pub enum PhrasePoolCommand {
Previous,
Prev,
Next,
MoveUp,
MoveDown,
@ -40,9 +40,9 @@ pub enum PhraseRenameCommand {
pub enum PhraseLengthCommand {
Begin,
Next,
Previous,
Increment,
Decrement,
Prev,
Inc,
Dec,
Set(usize),
Confirm,
Cancel,
@ -53,8 +53,8 @@ pub enum PhraseEditorCommand {
ToggleDirection,
EnterEditMode,
ExitEditMode,
NoteLengthDecrement,
NoteLengthIncrement,
NoteLengthDec,
NoteLengthInc,
TimeZoomIn,
TimeZoomOut,
NoteAppend,
@ -96,7 +96,7 @@ impl HandleKey<SequencerCommand> for Sequencer<Tui> {
impl HandleKey<PhrasePoolCommand> for PhrasePool<Tui> {
fn match_input (&self, from: &TuiInput) -> Option<PhrasePoolCommand> {
match from.event() {
key!(KeyCode::Up) => Some(PhrasePoolCommand::Previous),
key!(KeyCode::Up) => Some(PhrasePoolCommand::Prev),
key!(KeyCode::Down) => Some(PhrasePoolCommand::Next),
key!(KeyCode::Char(',')) => Some(PhrasePoolCommand::MoveUp),
key!(KeyCode::Char('.')) => Some(PhrasePoolCommand::MoveDown),
@ -131,10 +131,10 @@ impl HandleKey<PhraseRenameCommand> for PhrasePool<Tui> {
impl HandleKey<PhraseLengthCommand> for PhrasePool<Tui> {
fn match_input (&self, from: &TuiInput) -> Option<PhraseLengthCommand> {
match from.event() {
key!(KeyCode::Up) => Some(PhraseLengthCommand::Increment),
key!(KeyCode::Down) => Some(PhraseLengthCommand::Decrement),
key!(KeyCode::Up) => Some(PhraseLengthCommand::Inc),
key!(KeyCode::Down) => Some(PhraseLengthCommand::Dec),
key!(KeyCode::Right) => Some(PhraseLengthCommand::Next),
key!(KeyCode::Left) => Some(PhraseLengthCommand::Previous),
key!(KeyCode::Left) => Some(PhraseLengthCommand::Prev),
key!(KeyCode::Enter) => Some(PhraseLengthCommand::Confirm),
key!(KeyCode::Esc) => Some(PhraseLengthCommand::Cancel),
_ => None
@ -147,8 +147,8 @@ impl HandleKey<PhraseEditorCommand> for PhraseEditor<Tui> {
key!(KeyCode::Char('`')) => Some(PhraseEditorCommand::ToggleDirection),
key!(KeyCode::Enter) => Some(PhraseEditorCommand::EnterEditMode),
key!(KeyCode::Esc) => Some(PhraseEditorCommand::ExitEditMode),
key!(KeyCode::Char('[')) => Some(PhraseEditorCommand::NoteLengthDecrement),
key!(KeyCode::Char(']')) => Some(PhraseEditorCommand::NoteLengthIncrement),
key!(KeyCode::Char('[')) => Some(PhraseEditorCommand::NoteLengthDec),
key!(KeyCode::Char(']')) => Some(PhraseEditorCommand::NoteLengthInc),
key!(KeyCode::Char('a')) => Some(PhraseEditorCommand::NoteAppend),
key!(KeyCode::Char('s')) => Some(PhraseEditorCommand::NoteSet),
key!(KeyCode::Char('-')) => Some(PhraseEditorCommand::TimeZoomOut),
@ -224,7 +224,7 @@ impl<E: Engine> Command<Sequencer<E>> for SequencerCommand {
impl<E: Engine> Command<PhrasePool<E>> for PhrasePoolCommand {
fn run (&self, state: &mut PhrasePool<E>) -> Perhaps<Self> {
match self {
Self::Previous => {
Self::Prev => {
state.select_prev()
},
Self::Next => {
@ -319,13 +319,13 @@ impl<E: Engine> Command<PhrasePool<E>> for PhraseLengthCommand {
Self::Begin => {
unreachable!();
},
Self::Previous => {
Self::Prev => {
focus.prev()
},
Self::Next => {
focus.next()
},
Self::Increment => match focus {
Self::Inc => match focus {
PhraseLengthFocus::Bar => {
*length += 4 * PPQ
},
@ -336,7 +336,7 @@ impl<E: Engine> Command<PhrasePool<E>> for PhraseLengthCommand {
*length += 1
},
},
Self::Decrement => match focus {
Self::Dec => match focus {
PhraseLengthFocus::Bar => {
*length = length.saturating_sub(4 * PPQ)
},
@ -387,10 +387,10 @@ impl<E: Engine> Command<PhraseEditor<E>> for PhraseEditorCommand {
Self::TimeZoomIn => {
state.time_zoom_in()
},
Self::NoteLengthDecrement => {
Self::NoteLengthDec => {
state.note_length_dec()
},
Self::NoteLengthIncrement => {
Self::NoteLengthInc => {
state.note_length_inc()
},
Self::NotePageUp => {