wip(p62,e21)

This commit is contained in:
🪞👃🪞 2024-11-21 00:53:11 +01:00
parent 76da19d9c6
commit 5673dd7e8a
14 changed files with 170 additions and 190 deletions

View file

@ -1,17 +1,12 @@
use crate::*;
impl<T> InputToCommand<Tui, T> for TransportCommand
where
T: TransportControl
+ HasFocus<Item = TransportFocus>
+ FocusEnter<Item = TransportFocus>
{
impl<T: TransportControl> InputToCommand<Tui, T> for TransportCommand {
fn input_to_command (state: &T, input: &TuiInput) -> Option<Self> {
use KeyCode::Char;
use ClockCommand::{SetBpm, SetQuant, SetSync};
use TransportFocus as Focused;
use TransportCommand::{Focus, Clock, Playhead};
let focused = state.focused();
let focused = state.transport_focused();
Some(match input.event() {
key!(Left) => Focus(FocusCommand::Prev),
key!(Right) => Focus(FocusCommand::Next),
@ -57,7 +52,6 @@ where
T: SequencerControl + TransportControl + PhrasesControl + PhraseEditorControl + PlayheadApi
+ HasFocus<Item = SequencerFocus>
+ FocusGrid<Item = SequencerFocus>
+ FocusEnter<Item = SequencerFocus>
{
fn input_to_command (state: &T, input: &TuiInput) -> Option<Self> {
use FocusCommand::*;
@ -73,14 +67,11 @@ where
key!(KeyCode::Right) => Some(Self::Focus(Right)),
_ => Some(match state.focused() {
SequencerFocus::Transport => {
use TransportCommand::{Clock, Playhead};
use TransportCommand::{Clock, Playhead, Focus};
match TransportCommand::input_to_command(state, input)? {
Clock(command) => {
todo!()
},
Playhead(command) => {
todo!()
},
Clock(command) => { todo!() },
Playhead(command) => { todo!() },
Focus(command) => { todo!() },
}
},
SequencerFocus::Phrases =>
@ -110,23 +101,21 @@ impl InputToCommand<Tui, ArrangerTui> for ArrangerCommand {
key!(KeyCode::Esc) => Self::Focus(Exit),
key!(KeyCode::Char(' ')) => Self::Playhead(PlayheadCommand::Play(None)),
_ => match state.focused() {
ArrangerFocus::Menu => { todo!() },
ArrangerFocus::Transport => {
use TransportCommand::{Clock, Playhead};
use TransportCommand::{Clock, Playhead, Focus};
match TransportCommand::input_to_command(state, input)? {
Clock(command) => {
todo!()
},
Playhead(command) => {
todo!()
},
Clock(command) => { todo!() },
Playhead(command) => { todo!() },
Focus(command) => { todo!() }
}
},
ArrangerFocus::PhraseEditor => Editor(
PhraseCommand::input_to_command(state, input)?
),
ArrangerFocus::Phrases => match input.event() {
key!(KeyCode::Char('e')) => EditPhrase(Some(state.phrase().clone())),
_ => Phrases(PhrasePoolCommand::input_to_command(state, input)?)
key!(KeyCode::Char('e')) => EditPhrase(state.phrase().clone()),
_ => Phrases(PhrasesCommand::input_to_command(state, input)?)
},
ArrangerFocus::Arranger => {
use ArrangerSelection as Select;
@ -134,7 +123,7 @@ impl InputToCommand<Tui, ArrangerTui> for ArrangerCommand {
use ArrangerClipCommand as Clip;
use ArrangerSceneCommand as Scene;
match input.event() {
key!(KeyCode::Char('e')) => EditPhrase(state.phrase()),
key!(KeyCode::Char('e')) => EditPhrase(state.phrase().clone()),
_ => match input.event() {
// FIXME: boundary conditions
@ -361,10 +350,7 @@ impl<T: PhrasesControl> InputToCommand<Tui, T> for PhraseRenameCommand {
}
}
impl<T> InputToCommand<Tui, T> for PhraseCommand
where
T: PhraseEditorControl + FocusEnter
{
impl<T: PhraseEditorControl> InputToCommand<Tui, T> for PhraseCommand {
fn input_to_command (state: &T, from: &TuiInput) -> Option<Self> {
use PhraseCommand::*;
Some(match from.event() {