mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-09 05:06:43 +01:00
cmdsys: focus enter
This commit is contained in:
parent
c551f83d5c
commit
31c1db8a5c
3 changed files with 28 additions and 9 deletions
|
|
@ -10,8 +10,6 @@ pub type PhraseChunk = [Vec<PhraseMessage>];
|
|||
pub struct Sequencer<E: Engine> {
|
||||
/// JACK client handle (needs to not be dropped for standalone mode to work).
|
||||
pub jack: Arc<RwLock<JackClient>>,
|
||||
/// Which view is focused
|
||||
pub focus_cursor: (usize, usize),
|
||||
/// Controls the JACK transport.
|
||||
pub transport: Option<Arc<RwLock<TransportToolbar<E>>>>,
|
||||
/// Global timebase
|
||||
|
|
@ -22,6 +20,10 @@ pub struct Sequencer<E: Engine> {
|
|||
pub editor: PhraseEditor<E>,
|
||||
/// Phrase player
|
||||
pub player: PhrasePlayer,
|
||||
/// Which view is focused
|
||||
pub focus_cursor: (usize, usize),
|
||||
/// Whether the currently focused item is entered
|
||||
pub entered: bool,
|
||||
}
|
||||
/// Sections in the sequencer app that may be focused
|
||||
#[derive(Copy, Clone, PartialEq, Eq)] pub enum SequencerFocus {
|
||||
|
|
@ -172,8 +174,13 @@ impl<E: Engine> FocusGrid for Sequencer<E> {
|
|||
&[SequencerFocus::Transport],
|
||||
&[SequencerFocus::PhrasePool, SequencerFocus::PhraseEditor],
|
||||
] }
|
||||
fn focus_enter (&mut self) { self.entered = true }
|
||||
fn focus_exit (&mut self) { self.entered = false }
|
||||
fn entered (&self) -> Option<Self::Item> {
|
||||
if self.entered { Some(self.focused()) } else { None }
|
||||
}
|
||||
fn update_focus (&mut self) {
|
||||
let focused = *self.focused();
|
||||
let focused = self.focused();
|
||||
if let Some(transport) = self.transport.as_ref() {
|
||||
transport.write().unwrap().focused = focused == SequencerFocus::Transport
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue