shorten TuiIn, TuiOut

This commit is contained in:
🪞👃🪞 2024-12-31 23:42:35 +01:00
parent ca16a91015
commit 21741ebc52
20 changed files with 77 additions and 75 deletions

View file

@ -180,12 +180,12 @@ command!(|self:TransportCommand,state:TransportTui|match self {
//Ok(None)
//});
impl InputToCommand<Tui, TransportTui> for TransportCommand {
fn input_to_command (state: &TransportTui, input: &TuiInput) -> Option<Self> {
fn input_to_command (state: &TransportTui, input: &TuiIn) -> Option<Self> {
to_transport_command(state, input)
.or_else(||to_focus_command(input).map(TransportCommand::Focus))
}
}
pub fn to_transport_command <T, U> (state: &T, input: &TuiInput) -> Option<TransportCommand>
pub fn to_transport_command <T, U> (state: &T, input: &TuiIn) -> Option<TransportCommand>
where
T: TransportControl<U>,
U: Into<Option<TransportFocus>>,
@ -228,7 +228,7 @@ where
}
})
}
fn to_bpm_command (input: &TuiInput, bpm: f64) -> Option<TransportCommand> {
fn to_bpm_command (input: &TuiIn, bpm: f64) -> Option<TransportCommand> {
Some(match input.event() {
key_pat!(Char(',')) => Clock(SetBpm(bpm - 1.0)),
key_pat!(Char('.')) => Clock(SetBpm(bpm + 1.0)),
@ -237,7 +237,7 @@ fn to_bpm_command (input: &TuiInput, bpm: f64) -> Option<TransportCommand> {
_ => return None,
})
}
fn to_quant_command (input: &TuiInput, quant: &Quantize) -> Option<TransportCommand> {
fn to_quant_command (input: &TuiIn, quant: &Quantize) -> Option<TransportCommand> {
Some(match input.event() {
key_pat!(Char(',')) => Clock(SetQuant(quant.prev())),
key_pat!(Char('.')) => Clock(SetQuant(quant.next())),
@ -246,7 +246,7 @@ fn to_quant_command (input: &TuiInput, quant: &Quantize) -> Option<TransportComm
_ => return None,
})
}
fn to_sync_command (input: &TuiInput, sync: &LaunchSync) -> Option<TransportCommand> {
fn to_sync_command (input: &TuiIn, sync: &LaunchSync) -> Option<TransportCommand> {
Some(match input.event() {
key_pat!(Char(',')) => Clock(SetSync(sync.prev())),
key_pat!(Char('.')) => Clock(SetSync(sync.next())),
@ -255,7 +255,7 @@ fn to_sync_command (input: &TuiInput, sync: &LaunchSync) -> Option<TransportComm
_ => return None,
})
}
fn to_seek_command (input: &TuiInput) -> Option<TransportCommand> {
fn to_seek_command (input: &TuiIn) -> Option<TransportCommand> {
Some(match input.event() {
key_pat!(Char(',')) => todo!("transport seek bar"),
key_pat!(Char('.')) => todo!("transport seek bar"),