diff --git a/README.md b/README.md index 9a9f8c30..082892f0 100644 --- a/README.md +++ b/README.md @@ -22,10 +22,11 @@ See `demos/project.edn` for the initial contents of the session. * [ ] Customize key map * [ ] MIDI map * [ ] Scriptable -* Save project - * [ ] Preserve layout +* Save project: + * [ ] Preserve EDN layout * Samples: * [ ] Sample browser + * [ ] Sample editor * [ ] Envelope * [ ] Stretch sample to BPM * [ ] Set BPM to sample diff --git a/src/control.rs b/src/control.rs index dbe4e744..08d56b75 100644 --- a/src/control.rs +++ b/src/control.rs @@ -1,4 +1,4 @@ -use crate::{core::*, handle, App, AppSection}; +use crate::{core::*, handle, App, AppFocus}; pubmod!{ arranger chain focus mixer plugin sampler sequencer transport } @@ -26,13 +26,13 @@ handle!{ fn handle_focused (state: &mut App, e: &AppEvent) -> Usually { match state.section { - AppSection::Transport => + AppFocus::Transport => handle_keymap(state, e, crate::control::transport::KEYMAP_TRANSPORT), - AppSection::Arranger => + AppFocus::Arranger => handle_keymap(state, e, crate::control::arranger::KEYMAP_ARRANGER), - AppSection::Sequencer => + AppFocus::Sequencer => handle_keymap(state, e, crate::control::sequencer::KEYMAP_SEQUENCER), - AppSection::Chain => Ok(if state.entered { + AppFocus::Chain => Ok(if state.entered { handle_device(state, e)? || handle_keymap(state, e, crate::control::chain::KEYMAP_CHAIN)? } else { diff --git a/src/control/focus.rs b/src/control/focus.rs index bab26405..fa0fb71d 100644 --- a/src/control/focus.rs +++ b/src/control/focus.rs @@ -1,4 +1,4 @@ -use crate::{core::*, model::{App, AppSection}}; +use crate::{core::*, model::{App, AppFocus}}; pub const KEYMAP_FOCUS: &'static [KeyBinding] = keymap!(App { [Char(';'), NONE, "command", "open command palette", |app: &mut App| { @@ -19,14 +19,14 @@ pub const KEYMAP_FOCUS: &'static [KeyBinding] = keymap!(App { pub fn focus_next (app: &mut App) -> Usually { app.section.next(); - app.transport.focused = app.section == AppSection::Transport; + app.transport.focused = app.section == AppFocus::Transport; app.transport.entered = app.entered; Ok(true) } pub fn focus_prev (app: &mut App) -> Usually { app.section.prev(); - app.transport.focused = app.section == AppSection::Transport; + app.transport.focused = app.section == AppFocus::Transport; app.transport.entered = app.entered; Ok(true) } diff --git a/src/model.rs b/src/model.rs index 18d29618..38007792 100644 --- a/src/model.rs +++ b/src/model.rs @@ -36,7 +36,7 @@ pub struct App { /// Optional modal dialog pub modal: Option>, /// Currently focused section - pub section: AppSection, + pub section: AppFocus, /// Whether the current focus section has input priority pub entered: bool, /// Display position of cursor within note range @@ -82,7 +82,7 @@ impl App { note_start: 2, scene_cursor: 1, scenes: vec![], - section: AppSection::default(), + section: AppFocus::default(), seq_mode: false, seq_buf: BufferedSequencerView::new(96, 16384), time_cursor: 0, @@ -155,9 +155,9 @@ impl App { } #[derive(PartialEq, Clone, Copy)] -pub enum AppSection { Transport, Arranger, Sequencer, Chain, } -impl Default for AppSection { fn default () -> Self { Self::Arranger } } -impl AppSection { +pub enum AppFocus { Transport, Arranger, Sequencer, Chain, } +impl Default for AppFocus { fn default () -> Self { Self::Arranger } } +impl AppFocus { pub fn prev (&mut self) { *self = match self { Self::Transport => Self::Chain, diff --git a/src/view/arranger.rs b/src/view/arranger.rs index 8fcdbdf0..6f8a46b7 100644 --- a/src/view/arranger.rs +++ b/src/view/arranger.rs @@ -14,7 +14,7 @@ pub struct ArrangerView<'a> { impl<'a> ArrangerView<'a> { pub fn new (app: &'a App, vertical: bool) -> Self { Self { - focused: app.section == AppSection::Arranger, + focused: app.section == AppFocus::Arranger, entered: app.entered, scenes: &app.scenes, tracks: &app.tracks, diff --git a/src/view/chain.rs b/src/view/chain.rs index df459a48..c601e260 100644 --- a/src/view/chain.rs +++ b/src/view/chain.rs @@ -18,7 +18,7 @@ impl<'a> ChainView<'a> { Self { direction, entered: app.entered, - focused: app.section == AppSection::Chain, + focused: app.section == AppFocus::Chain, track: match app.track_cursor { 0 => None, _ => app.tracks.get(app.track_cursor - 1) diff --git a/src/view/sequencer.rs b/src/view/sequencer.rs index caa19555..46cd3675 100644 --- a/src/view/sequencer.rs +++ b/src/view/sequencer.rs @@ -111,7 +111,7 @@ impl<'a> SequencerView<'a> { }; Self { phrase: app.phrase(), - focused: app.section == AppSection::Sequencer, + focused: app.section == AppFocus::Sequencer, entered: app.entered, ppq: app.transport.ppq(), now: app.transport.pulse(),