store updated phrase length; enter/exit phrase editor

This commit is contained in:
🪞👃🪞 2024-10-16 12:29:45 +03:00
parent ff342963a1
commit d29dd56198
3 changed files with 42 additions and 34 deletions

View file

@ -44,12 +44,14 @@ impl Handle<Tui> for PhrasePool<Tui> {
}
},
Some(PhrasePoolMode::Length(phrase, ref mut length, ref mut focus)) => {
let mut phrase = self.phrases[phrase].write().unwrap();
match from.event() {
key!(KeyCode::Left) => { focus.prev() },
key!(KeyCode::Right) => { focus.next() },
key!(KeyCode::Esc) => { self.mode = None; },
key!(KeyCode::Enter) => { self.mode = None; },
key!(KeyCode::Enter) => {
self.phrases[phrase].write().unwrap().length = *length;
self.mode = None;
},
key!(KeyCode::Up) => match focus {
PhraseLengthFocus::Bar => {
*length += 4 * PPQ
@ -99,6 +101,8 @@ impl Handle<Tui> for PhraseEditor<Tui> {
key!(KeyCode::Char('`')) => {
self.mode = !self.mode;
},
key!(KeyCode::Enter) => { self.entered = true; },
key!(KeyCode::Esc) => { self.entered = false; },
key!(KeyCode::Up) => match self.entered {
true => { self.note_axis.point_dec(); },
false => { self.note_axis.start_dec(); },