wip: refactor pt.32: 89 errors, traits

This commit is contained in:
🪞👃🪞 2024-11-15 00:17:36 +01:00
parent 8b5931c321
commit ce78b95d8a
28 changed files with 946 additions and 822 deletions

View file

@ -62,21 +62,21 @@ impl InputToCommand<Tui, ArrangerApp<Tui>> for ArrangerAppCommand {
key!(KeyCode::Enter) => Self::Focus(Enter),
key!(KeyCode::Esc) => Self::Focus(Exit),
key!(KeyCode::Char(' ')) => {
Self::App(Transport(TransportViewCommand::Transport(TransportCommand::Play(None))))
Self::App(Transport(TransportCommand::Play(None)))
},
_ => Self::App(match view.focused() {
Content(ArrangerViewFocus::Transport) => Transport(
TransportViewCommand::input_to_command(&view.sequencer.transport, input)?
TransportCommand::input_to_command(&view.app.sequencer.transport, input)?
),
Content(ArrangerViewFocus::PhraseEditor) => Editor(
PhraseEditorCommand::input_to_command(&view.sequencer.editor, input)?
PhraseEditorCommand::input_to_command(&view.app.sequencer.editor, input)?
),
Content(ArrangerViewFocus::PhrasePool) => match input.event() {
key!(KeyCode::Char('e')) => EditPhrase(
Some(view.sequencer.phrases.phrase().clone())
Some(view.app.phrases.phrase().clone())
),
_ => Phrases(
PhrasePoolViewCommand::input_to_command(&view.sequencer.phrases, input)?
PhrasePoolViewCommand::input_to_command(&view.app.phrases, input)?
)
},
Content(ArrangerViewFocus::Arranger) => {
@ -237,23 +237,23 @@ impl Command<ArrangerApp<Tui>> for ArrangerViewCommand {
/// Root view for standalone `tek_arranger`
pub struct ArrangerView<E: Engine> {
pub model: ArrangerModel,
/// Sequencer component
pub sequencer: SequencerView<E>,
/// Height of arrangement
pub split: u16,
/// Currently selected element.
pub selected: ArrangerSelection,
/// Display mode of arranger
pub mode: ArrangerMode,
/// Background color of arrangement
pub color: ItemColor,
/// Whether the arranger is currently focused
pub focused: bool,
/// Whether this is currently in edit mode
pub entered: bool,
/// Width and height of arrangement area at last render
pub size: Measure<E>,
jack: Arc<RwLock<JackClient>>,
clock: Arc<Clock>,
transport: jack::Transport,
metronome: bool,
transport: TransportModel,
phrases: Vec<Arc<RwLock<Phrase>>>,
tracks: Vec<ArrangerTrack>,
scenes: Vec<ArrangerScene>,
name: Arc<RwLock<String>>,
sequencer: SequencerView<E>,
splits: [u16;2],
selected: ArrangerSelection,
mode: ArrangerMode,
color: ItemColor,
focused: bool,
entered: bool,
size: Measure<E>,
}
/// Display mode of arranger