mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 04:06:45 +01:00
extract input parse functions
This commit is contained in:
parent
5ccc55a76f
commit
a509db7215
3 changed files with 206 additions and 206 deletions
|
|
@ -17,6 +17,7 @@ pub enum TransportFocus {
|
|||
Clock,
|
||||
Quant,
|
||||
}
|
||||
|
||||
/// Sections in the sequencer app that may be focused
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
|
||||
pub enum SequencerFocus {
|
||||
|
|
@ -27,6 +28,7 @@ pub enum SequencerFocus {
|
|||
/// The phrase editor (sequencer) is focused
|
||||
PhraseEditor,
|
||||
}
|
||||
|
||||
/// Sections in the arranger app that may be focused
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
|
||||
pub enum ArrangerFocus {
|
||||
|
|
@ -67,27 +69,6 @@ impl FocusWrap<TransportFocus> for Option<TransportFocus> {
|
|||
}
|
||||
}
|
||||
|
||||
impl TransportFocus {
|
||||
pub fn next (&mut self) {
|
||||
*self = match self {
|
||||
Self::PlayPause => Self::Bpm,
|
||||
Self::Bpm => Self::Quant,
|
||||
Self::Quant => Self::Sync,
|
||||
Self::Sync => Self::Clock,
|
||||
Self::Clock => Self::PlayPause,
|
||||
}
|
||||
}
|
||||
pub fn prev (&mut self) {
|
||||
*self = match self {
|
||||
Self::PlayPause => Self::Clock,
|
||||
Self::Bpm => Self::PlayPause,
|
||||
Self::Quant => Self::Bpm,
|
||||
Self::Sync => Self::Quant,
|
||||
Self::Clock => Self::Sync,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! impl_focus {
|
||||
($Struct:ident $Focus:ident $Grid:expr) => {
|
||||
impl HasFocus for $Struct {
|
||||
|
|
@ -132,24 +113,26 @@ macro_rules! impl_focus {
|
|||
}
|
||||
|
||||
impl_focus!(TransportTui TransportFocus [
|
||||
&[Menu],
|
||||
//&[Menu],
|
||||
&[Content(Bpm), Content(Sync), Content(PlayPause), Content(Clock), Content(Quant)],
|
||||
]);
|
||||
|
||||
impl_focus!(SequencerTui SequencerFocus [
|
||||
//&[
|
||||
//Menu,
|
||||
//Menu,
|
||||
//Menu,
|
||||
//Menu,
|
||||
//Menu,
|
||||
//],
|
||||
&[
|
||||
Menu,
|
||||
Menu,
|
||||
Menu,
|
||||
Menu,
|
||||
Menu,
|
||||
], &[
|
||||
Content(Transport(TransportFocus::Bpm)),
|
||||
Content(Transport(TransportFocus::Sync)),
|
||||
Content(Transport(TransportFocus::PlayPause)),
|
||||
Content(Transport(TransportFocus::Clock)),
|
||||
Content(Transport(TransportFocus::Quant))
|
||||
], &[
|
||||
],
|
||||
&[
|
||||
Content(Phrases),
|
||||
Content(Phrases),
|
||||
Content(PhraseEditor),
|
||||
|
|
@ -159,13 +142,14 @@ impl_focus!(SequencerTui SequencerFocus [
|
|||
]);
|
||||
|
||||
impl_focus!(ArrangerTui ArrangerFocus [
|
||||
//&[
|
||||
//Menu,
|
||||
//Menu,
|
||||
//Menu,
|
||||
//Menu,
|
||||
//Menu,
|
||||
//],
|
||||
&[
|
||||
Menu,
|
||||
Menu,
|
||||
Menu,
|
||||
Menu,
|
||||
Menu,
|
||||
], &[
|
||||
Content(Transport(TransportFocus::Bpm)),
|
||||
Content(Transport(TransportFocus::Sync)),
|
||||
Content(Transport(TransportFocus::PlayPause)),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue