mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 20:26:42 +01:00
wip: refactor pt.41 (57e) nice
This commit is contained in:
parent
c875d87c33
commit
8856353eab
32 changed files with 911 additions and 1019 deletions
|
|
@ -8,7 +8,7 @@ impl TryFrom<&Arc<RwLock<JackClient>>> for TransportApp<Tui> {
|
|||
metronome: false,
|
||||
transport: jack.read().unwrap().transport(),
|
||||
jack: jack.clone(),
|
||||
clock: Arc::new(Clock::from(Instant::default()))
|
||||
clock: Arc::new(Clock::from(Instant::default())),
|
||||
focused: false,
|
||||
focus: TransportViewFocus::PlayPause,
|
||||
size: Measure::new(),
|
||||
|
|
@ -33,6 +33,12 @@ impl Handle<Tui> for TransportApp<Tui> {
|
|||
|
||||
pub type TransportAppCommand = AppViewCommand<TransportCommand>;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum TransportCommand {
|
||||
Clock(ClockCommand),
|
||||
Playhead(PlayheadCommand),
|
||||
}
|
||||
|
||||
impl InputToCommand<Tui, TransportApp<Tui>> for TransportAppCommand {
|
||||
fn input_to_command (app: &TransportApp<Tui>, input: &TuiInput) -> Option<Self> {
|
||||
use KeyCode::{Left, Right};
|
||||
|
|
@ -50,7 +56,7 @@ impl InputToCommand<Tui, TransportApp<Tui>> for TransportCommand {
|
|||
fn input_to_command (app: &TransportApp<Tui>, input: &TuiInput) -> Option<Self> {
|
||||
use KeyCode::Char;
|
||||
use AppViewFocus::Content;
|
||||
use TransportCommand::{SetBpm, SetQuant, SetSync};
|
||||
use ClockCommand::{SetBpm, SetQuant, SetSync};
|
||||
use TransportViewFocus::{Bpm, Quant, Sync, PlayPause, Clock};
|
||||
let clock = app.app.model.clock();
|
||||
Some(match input.event() {
|
||||
|
|
@ -113,7 +119,7 @@ impl Command<TransportApp<Tui>> for TransportAppCommand {
|
|||
|
||||
impl Command<TransportApp<Tui>> for TransportCommand {
|
||||
fn execute (self, state: &mut TransportApp<Tui>) -> Perhaps<Self> {
|
||||
use TransportCommand::{SetBpm, SetQuant, SetSync};
|
||||
use ClockCommand::{SetBpm, SetQuant, SetSync};
|
||||
let clock = state.app.model.clock();
|
||||
Ok(Some(match self {
|
||||
SetBpm(bpm) => SetBpm(clock.timebase().bpm.set(bpm)),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue