wip: cmdsys: define arranger commands

This commit is contained in:
🪞👃🪞 2024-11-07 01:10:52 +01:00
parent abbe0dc8f7
commit 1f375219db
3 changed files with 40 additions and 2 deletions

View file

@ -26,7 +26,7 @@ pub trait Command<T>: Sized {
}
pub trait HandleKey<C: Command<Self> + 'static>: Sized {
const HANDLE_KEY_MAP: &'static [(KeyEvent, C)];
const HANDLE_KEY_MAP: &'static [(KeyEvent, C)]; // FIXME: needs to be method
fn match_key (key: &KeyEvent) -> Option<&'static C> {
for (binding, command) in Self::HANDLE_KEY_MAP.iter() {
if key == binding {

View file

@ -1,4 +1,42 @@
use crate::*;
#[derive(Clone, PartialEq)]
enum ArrangerCommand {
FocusNext,
FocusPrev,
FocusUp,
FocusDown,
FocusLeft,
FocusRight,
Transport(TransportCommand),
Phrase(PhrasePoolCommand),
Editor(PhraseEditorCommand),
Arrangement(ArrangementCommand),
}
#[derive(Clone, PartialEq)]
enum ArrangementCommand {
ToggleViewMode,
Delete,
Activate,
Increment,
Decrement,
ZoomIn,
ZoomOut,
MoveBack,
MoveForward,
RandomColor,
Put,
Get,
AddScene,
AddTrack,
ToggleLoop,
GoUp,
GoDown,
GoLeft,
GoRight,
}
/// Handle top-level events in standalone arranger.
impl Handle<Tui> for Arranger<Tui> {
fn handle (&mut self, from: &TuiInput) -> Perhaps<bool> {

View file

@ -11,7 +11,6 @@ enum SequencerCommand {
Transport(TransportCommand),
Phrase(PhrasePoolCommand),
Editor(PhraseEditorCommand),
// TODO: 1-8 seek markers that by default start every 8th of the phrase
}
#[derive(Clone, PartialEq)]
pub enum PhrasePoolCommand {
@ -50,6 +49,7 @@ pub enum PhraseLengthCommand {
}
#[derive(Clone, PartialEq)]
pub enum PhraseEditorCommand {
// TODO: 1-9 seek markers that by default start every 8th of the phrase
ToggleDirection,
EnterEditMode,
ExitEditMode,