cmdsys: handle entered areas

This commit is contained in:
🪞👃🪞 2024-11-09 02:34:43 +01:00
parent 31c1db8a5c
commit 1085826849
4 changed files with 65 additions and 24 deletions

View file

@ -11,8 +11,18 @@ impl Content for Sequencer<Tui> {
}
}
impl Handle<Tui> for Sequencer<Tui> {
fn handle (&mut self, from: &TuiInput) -> Perhaps<bool> {
if let Some(command) = SequencerCommand::match_input(self, from) {
fn handle (&mut self, i: &TuiInput) -> Perhaps<bool> {
if let Some(entered) = self.entered() {
use SequencerFocus::*;
if let Some(true) = match entered {
Transport => self.transport.as_mut().map(|t|t.handle(i)).transpose()?.flatten(),
PhrasePool => self.phrases.write().unwrap().handle(i)?,
PhraseEditor => self.editor.handle(i)?,
} {
return Ok(Some(true))
}
}
if let Some(command) = SequencerCommand::match_input(self, i) {
let _undo = command.execute(self)?;
return Ok(Some(true))
}