mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
mostly formatting
This commit is contained in:
parent
f1f3a7de10
commit
26eb5f0315
2 changed files with 51 additions and 55 deletions
|
|
@ -69,15 +69,15 @@ impl Command<ArrangerTui> for ArrangerCommand {
|
|||
fn execute (self, state: &mut ArrangerTui) -> Perhaps<Self> {
|
||||
use ArrangerCommand::*;
|
||||
Ok(match self {
|
||||
Focus(cmd) => cmd.execute(state)?.map(Focus),
|
||||
Scene(cmd) => cmd.execute(state)?.map(Scene),
|
||||
Track(cmd) => cmd.execute(state)?.map(Track),
|
||||
Clip(cmd) => cmd.execute(state)?.map(Clip),
|
||||
Phrases(cmd) => cmd.execute(state)?.map(Phrases),
|
||||
Editor(cmd) => cmd.execute(state)?.map(Editor),
|
||||
Clock(cmd) => cmd.execute(state)?.map(Clock),
|
||||
Zoom(zoom) => { todo!(); },
|
||||
Select(selected) => {
|
||||
Focus(cmd) => cmd.execute(state)?.map(Focus),
|
||||
Scene(cmd) => cmd.execute(state)?.map(Scene),
|
||||
Track(cmd) => cmd.execute(state)?.map(Track),
|
||||
Clip(cmd) => cmd.execute(state)?.map(Clip),
|
||||
Phrases(cmd) => cmd.execute(state)?.map(Phrases),
|
||||
Editor(cmd) => cmd.execute(state)?.map(Editor),
|
||||
Clock(cmd) => cmd.execute(state)?.map(Clock),
|
||||
Zoom(zoom) => { todo!(); },
|
||||
Select(selected) => {
|
||||
*state.selected_mut() = selected;
|
||||
None
|
||||
},
|
||||
|
|
@ -121,11 +121,12 @@ pub enum PhrasesCommand {
|
|||
|
||||
impl<T: PhrasesControl> Command<T> for PhrasesCommand {
|
||||
fn execute (self, state: &mut T) -> Perhaps<Self> {
|
||||
use PhrasesCommand::*;
|
||||
Ok(match self {
|
||||
Self::Phrase(command) => command.execute(state)?.map(Self::Phrase),
|
||||
Self::Rename(command) => command.execute(state)?.map(Self::Rename),
|
||||
Self::Length(command) => command.execute(state)?.map(Self::Length),
|
||||
Self::Select(phrase) => {
|
||||
Phrase(command) => command.execute(state)?.map(Phrase),
|
||||
Rename(command) => command.execute(state)?.map(Rename),
|
||||
Length(command) => command.execute(state)?.map(Length),
|
||||
Select(phrase) => {
|
||||
state.set_phrase_index(phrase);
|
||||
None
|
||||
},
|
||||
|
|
@ -149,32 +150,22 @@ impl<T: PhrasesControl> Command<T> for PhraseLengthCommand {
|
|||
use PhraseLengthFocus::*;
|
||||
use PhraseLengthCommand::*;
|
||||
let mut mode = state.phrases_mode_mut().clone();
|
||||
if let Some(PhrasesMode::Length(
|
||||
phrase,
|
||||
ref mut length,
|
||||
ref mut focus,
|
||||
)) = mode {
|
||||
if let Some(PhrasesMode::Length(phrase, ref mut length, ref mut focus)) = mode {
|
||||
match self {
|
||||
Self::Cancel => {
|
||||
*state.phrases_mode_mut() = None;
|
||||
},
|
||||
Self::Prev => {
|
||||
focus.prev()
|
||||
},
|
||||
Self::Next => {
|
||||
focus.next()
|
||||
},
|
||||
Self::Inc => match focus {
|
||||
Cancel => { *state.phrases_mode_mut() = None; },
|
||||
Prev => { focus.prev() },
|
||||
Next => { focus.next() },
|
||||
Inc => match focus {
|
||||
Bar => { *length += 4 * PPQ },
|
||||
Beat => { *length += PPQ },
|
||||
Tick => { *length += 1 },
|
||||
},
|
||||
Self::Dec => match focus {
|
||||
Dec => match focus {
|
||||
Bar => { *length = length.saturating_sub(4 * PPQ) },
|
||||
Beat => { *length = length.saturating_sub(PPQ) },
|
||||
Tick => { *length = length.saturating_sub(1) },
|
||||
},
|
||||
Self::Set(length) => {
|
||||
Set(length) => {
|
||||
let mut phrase = state.phrases()[phrase].write().unwrap();
|
||||
let old_length = phrase.length;
|
||||
phrase.length = length;
|
||||
|
|
@ -210,10 +201,8 @@ where
|
|||
{
|
||||
fn execute (self, state: &mut T) -> Perhaps<Self> {
|
||||
use PhraseRenameCommand::*;
|
||||
if let Some(PhrasesMode::Rename(
|
||||
phrase,
|
||||
ref mut old_name
|
||||
)) = state.phrases_mode_mut().clone() {
|
||||
let mut mode = state.phrases_mode_mut().clone();
|
||||
if let Some(PhrasesMode::Rename(phrase, ref mut old_name)) = mode {
|
||||
match self {
|
||||
Set(s) => {
|
||||
state.phrases()[phrase].write().unwrap().name = s.into();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue