diff --git a/src/arranger/arranger_command.rs b/src/arranger/arranger_command.rs index d9d2736a..b50fb419 100644 --- a/src/arranger/arranger_command.rs +++ b/src/arranger/arranger_command.rs @@ -11,7 +11,7 @@ use ClockCommand::{Play, Pause}; Select(ArrangerSelection), Zoom(usize), Phrases(PoolCommand), - Editor(PhraseCommand), + Editor(MidiEditCommand), StopAll, Clear, } @@ -57,7 +57,7 @@ input_to_command!(ArrangerCommand: |state: ArrangerTui, input|match input.e key_pat!(Shift-Char(' ')) => Self::Clock(if state.clock().is_stopped() { Play(Some(0)) } else { Pause(Some(0)) }), key_pat!(Char('e')) => - Self::Editor(PhraseCommand::Show(Some(state.phrases.phrase().clone()))), + Self::Editor(MidiEditCommand::Show(Some(state.phrases.phrase().clone()))), key_pat!(Ctrl-Left) => Self::Scene(ArrangerSceneCommand::Add), key_pat!(Ctrl-Char('t')) => @@ -152,7 +152,7 @@ input_to_command!(ArrangerCommand: |state: ArrangerTui, input|match input.e _ => None }, } - }.or_else(||if let Some(command) = PhraseCommand::input_to_command(&state.editor, input) { + }.or_else(||if let Some(command) = MidiEditCommand::input_to_command(&state.editor, input) { Some(Self::Editor(command)) } else if let Some(command) = PoolCommand::input_to_command(&state.phrases, input) { Some(Self::Phrases(command)) diff --git a/src/groovebox.rs b/src/groovebox.rs index 8de7ecf6..3c1b8b06 100644 --- a/src/groovebox.rs +++ b/src/groovebox.rs @@ -3,7 +3,7 @@ use super::*; use KeyCode::{Char, Delete, Tab, Up, Down, Left, Right}; use ClockCommand::{Play, Pause}; use GrooveboxCommand as Cmd; -use PhraseCommand::*; +use MidiEditCommand::*; use PhrasePoolCommand::*; pub struct Groovebox { @@ -183,7 +183,7 @@ pub enum GrooveboxCommand { History(isize), Clock(ClockCommand), Pool(PoolCommand), - Editor(PhraseCommand), + Editor(MidiEditCommand), Enqueue(Option>>), Sampler(SamplerCommand), } @@ -230,7 +230,7 @@ input_to_command!(GrooveboxCommand: |state: Groovebox, input|match input.ev // For the rest, use the default keybindings of the components. // The ones defined above supersede them. - _ => if let Some(command) = PhraseCommand::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) diff --git a/src/midi/midi_editor.rs b/src/midi/midi_editor.rs index cc56e5bc..aa81c71b 100644 --- a/src/midi/midi_editor.rs +++ b/src/midi/midi_editor.rs @@ -1,6 +1,6 @@ use crate::*; use KeyCode::{Char, Up, Down, Left, Right, Enter}; -use PhraseCommand::*; +use MidiEditCommand::*; pub trait HasEditor { fn editor (&self) -> &MidiEditor; @@ -15,7 +15,7 @@ pub trait HasEditor { } #[derive(Clone, Debug)] -pub enum PhraseCommand { +pub enum MidiEditCommand { // TODO: 1-9 seek markers that by default start every 8th of the phrase AppendNote, PutNote, @@ -29,12 +29,12 @@ pub enum PhraseCommand { Show(Option>>), } -event_map_input_to_command!(Tui: MidiEditor: PhraseCommand: MidiEditor::KEYS); +event_map_input_to_command!(Tui: MidiEditor: MidiEditCommand: MidiEditor::KEYS); pub(crate) type KeyMapping = [(E, &'static dyn Fn(&T)->U);N]; impl MidiEditor { - const KEYS: KeyMapping<31, Event, Self, PhraseCommand> = [ + const KEYS: KeyMapping<31, Event, Self, MidiEditCommand> = [ (kexp!(Ctrl-Alt-Up), &|s: &Self|SetNoteScroll(s.note_point() + 3)), (kexp!(Ctrl-Alt-Down), &|s: &Self|SetNoteScroll(s.note_point().saturating_sub(3))), (kexp!(Ctrl-Alt-Left), &|s: &Self|SetTimeScroll(s.time_point().saturating_sub(s.time_zoom().get()))), @@ -74,9 +74,9 @@ impl MidiEditor { } } -impl Command for PhraseCommand { +impl Command for MidiEditCommand { fn execute (self, state: &mut MidiEditor) -> Perhaps { - use PhraseCommand::*; + use MidiEditCommand::*; match self { Show(phrase) => { state.set_phrase(phrase.as_ref()); }, PutNote => { state.put_note(false); }, diff --git a/src/sequencer.rs b/src/sequencer.rs index 4a830965..530660e7 100644 --- a/src/sequencer.rs +++ b/src/sequencer.rs @@ -2,7 +2,7 @@ use crate::*; use ClockCommand::{Play, Pause}; use KeyCode::{Tab, Char}; use SequencerCommand as Cmd; -use PhraseCommand::*; +use MidiEditCommand::*; use PhrasePoolCommand::*; /// Root view for standalone `tek_sequencer`. pub struct SequencerTui { @@ -95,7 +95,7 @@ handle!(|self:SequencerTui,input|SequencerCommand::execute_with_state(self, History(isize), Clock(ClockCommand), Pool(PoolCommand), - Editor(PhraseCommand), + Editor(MidiEditCommand), Enqueue(Option>>), } input_to_command!(SequencerCommand: |state: SequencerTui, input|match input.event() { @@ -133,7 +133,7 @@ input_to_command!(SequencerCommand: |state: SequencerTui, input|match input }, // For the rest, use the default keybindings of the components. // The ones defined above supersede them. - _ => if let Some(command) = PhraseCommand::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.phrases, input) { Cmd::Pool(command)