wip: directional focus!

This commit is contained in:
🪞👃🪞 2024-10-09 14:49:00 +03:00
parent ec3eb40bb4
commit 225eda0d24
5 changed files with 118 additions and 59 deletions

View file

@ -2,6 +2,8 @@ use crate::*;
/// Root level object for standalone `tek_arranger`
pub struct Arranger<E: Engine> {
/// Index of currently focused component
pub focus: ArrangerFocus,
/// Controls the JACK transport.
pub transport: Option<Arc<RwLock<TransportToolbar<E>>>>,
/// Contains all the sequencers.
@ -12,10 +14,25 @@ pub struct Arranger<E: Engine> {
pub editor: PhraseEditor<E>,
/// This allows the sequencer view to be moved or hidden.
pub show_sequencer: Option<tek_core::Direction>,
/// Index of currently focused component
pub focus: usize,
/// Slot for modal dialog displayed on top of app.
pub modal: Option<Box<dyn ContentComponent<E>>>,
/// Focus cursor
pub focus_cursor: (usize, usize)
}
/// Sections in the arranger that may be focused
#[derive(Copy, Clone, PartialEq, Eq)]
pub enum ArrangerFocus { Transport, Arrangement, PhrasePool, PhraseEditor }
/// Focus layout of arranger.
impl<E: Engine> FocusGrid<ArrangerFocus> for Arranger<E> {
fn cursor (&self) -> (usize, usize) { self.focus_cursor }
fn cursor_mut (&mut self) -> &mut (usize, usize) { &mut self.focus_cursor }
fn layout (&self) -> &[&[ArrangerFocus]] {
&[
&[ArrangerFocus::Transport],
&[ArrangerFocus::Arrangement],
&[ArrangerFocus::PhrasePool, ArrangerFocus::PhraseEditor],
]
}
}
/// Represents the tracks and scenes of the composition.
pub struct Arrangement<E: Engine> {