mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-09 05:06:43 +01:00
wip: inc/dec phrase length
This commit is contained in:
parent
26d75340f6
commit
ff342963a1
3 changed files with 56 additions and 13 deletions
|
|
@ -40,19 +40,39 @@ impl Handle<Tui> for PhrasePool<Tui> {
|
|||
key!(Shift-KeyCode::Char(c)) => { phrase.name.push(*c); },
|
||||
key!(KeyCode::Esc) => { phrase.name = old_name.clone(); self.mode = None; },
|
||||
key!(KeyCode::Enter) => { self.mode = None; },
|
||||
_ => return Ok(None)
|
||||
_ => return Ok(Some(true))
|
||||
}
|
||||
},
|
||||
Some(PhrasePoolMode::Length(phrase, length, focus)) => {
|
||||
todo!("edit phrase length");
|
||||
Some(PhrasePoolMode::Length(phrase, ref mut length, ref mut focus)) => {
|
||||
let mut phrase = self.phrases[phrase].write().unwrap();
|
||||
match from.event() {
|
||||
key!(KeyCode::Backspace) => { phrase.name.pop(); },
|
||||
key!(KeyCode::Char(c)) => { phrase.name.push(*c); },
|
||||
key!(Shift-KeyCode::Char(c)) => { phrase.name.push(*c); },
|
||||
//key!(KeyCode::Esc) => { phrase.name = old_name.clone(); self.mode = None; },
|
||||
key!(KeyCode::Left) => { focus.prev() },
|
||||
key!(KeyCode::Right) => { focus.next() },
|
||||
key!(KeyCode::Esc) => { self.mode = None; },
|
||||
key!(KeyCode::Enter) => { self.mode = None; },
|
||||
_ => return Ok(None)
|
||||
key!(KeyCode::Up) => match focus {
|
||||
PhraseLengthFocus::Bar => {
|
||||
*length += 4 * PPQ
|
||||
},
|
||||
PhraseLengthFocus::Beat => {
|
||||
*length += PPQ
|
||||
},
|
||||
PhraseLengthFocus::Tick => {
|
||||
*length += 1
|
||||
},
|
||||
},
|
||||
key!(KeyCode::Down) => match focus {
|
||||
PhraseLengthFocus::Bar => {
|
||||
*length = length.saturating_sub(4 * PPQ)
|
||||
},
|
||||
PhraseLengthFocus::Beat => {
|
||||
*length = length.saturating_sub(PPQ)
|
||||
},
|
||||
PhraseLengthFocus::Tick => {
|
||||
*length = length.saturating_sub(1)
|
||||
},
|
||||
},
|
||||
_ => return Ok(Some(true))
|
||||
}
|
||||
},
|
||||
None => match from.event() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue