mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 20:26:42 +01:00
devices can be focused again
This commit is contained in:
parent
b673e4c68d
commit
07084656b8
5 changed files with 61 additions and 26 deletions
|
|
@ -10,25 +10,40 @@ handle!{
|
|||
return Ok(true)
|
||||
};
|
||||
}
|
||||
let handle_focused = |state: &mut Self|handle_keymap(
|
||||
state, e, match state.section {
|
||||
AppSection::Arranger => self::arranger::KEYMAP_ARRANGER,
|
||||
AppSection::Sequencer => self::sequencer::KEYMAP_SEQUENCER,
|
||||
AppSection::Chain => self::chain::KEYMAP_CHAIN,
|
||||
}
|
||||
);
|
||||
Ok(if self.entered {
|
||||
handle_focused(self)?
|
||||
handle_focused(self, e)?
|
||||
|| handle_keymap(self, e, KEYMAP)?
|
||||
|| handle_keymap(self, e, KEYMAP_FOCUS)?
|
||||
} else {
|
||||
handle_keymap(self, e, KEYMAP)?
|
||||
|| handle_keymap(self, e, KEYMAP_FOCUS)?
|
||||
|| handle_focused(self)?
|
||||
|| handle_focused(self, e)?
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
fn handle_focused (state: &mut App, e: &AppEvent) -> Usually<bool> {
|
||||
match state.section {
|
||||
AppSection::Arranger =>
|
||||
handle_keymap(state, e, crate::control::arranger::KEYMAP_ARRANGER),
|
||||
AppSection::Sequencer =>
|
||||
handle_keymap(state, e, crate::control::sequencer::KEYMAP_SEQUENCER),
|
||||
AppSection::Chain => Ok(if state.entered {
|
||||
handle_device(state, e)? || handle_keymap(state, e, crate::control::chain::KEYMAP_CHAIN)?
|
||||
} else {
|
||||
handle_keymap(state, e, crate::control::chain::KEYMAP_CHAIN)? || handle_device(state, e)?
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
fn handle_device (state: &mut App, e: &AppEvent) -> Usually<bool> {
|
||||
state.track_mut()
|
||||
.and_then(|(_, track)|track.device_mut())
|
||||
.map(|mut device|device.handle(e))
|
||||
.transpose()
|
||||
.map(|x|x.unwrap_or(false))
|
||||
}
|
||||
|
||||
const KEYMAP_FOCUS: &'static [KeyBinding<App>] = keymap!(App {
|
||||
[Tab, NONE, "focus_next", "focus next area", focus_next],
|
||||
[Tab, SHIFT, "focus_prev", "focus previous area", focus_prev],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue