new key binding macro

This commit is contained in:
🪞👃🪞 2025-01-02 21:03:20 +01:00
parent 5bc19a45d2
commit 6c266fcfca
16 changed files with 254 additions and 251 deletions

View file

@ -10,7 +10,7 @@ pub struct TransportTui {
}
has_clock!(|self: TransportTui|&self.clock);
audio!(|self: TransportTui, client, scope|ClockAudio(self).process(client, scope));
handle!(<Tui>|self: TransportTui, from|TransportCommand::execute_with_state(self, from));
handle!(<Tui>|self: TransportTui, input|TransportCommand::execute_with_state(self, input.event()));
render!(Tui: (self: TransportTui) => TransportView {
compact: false,
clock: &self.clock
@ -115,10 +115,10 @@ command!(|self:TransportCommand,state:TransportTui|match self {
Self::Clock(cmd) => cmd.execute(state)?.map(Self::Clock),
_ => unreachable!(),
});
impl InputToCommand<Tui, TransportTui> for TransportCommand {
fn input_to_command (state: &TransportTui, input: &TuiIn) -> Option<Self> {
impl InputToCommand<Event, TransportTui> for TransportCommand {
fn input_to_command (state: &TransportTui, input: &Event) -> Option<Self> {
use TransportCommand::*;
Some(match input.event() {
Some(match input {
key_pat!(Char(' ')) => Clock(if state.clock().is_stopped() {
Play(None)
} else {