mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-09 05:06:43 +01:00
wip: refactor pt.8, 512 errors lol
This commit is contained in:
parent
a1818a8504
commit
a784f7a6f2
19 changed files with 238 additions and 183 deletions
|
|
@ -2,7 +2,7 @@ use crate::*;
|
|||
|
||||
/// Sections in the arranger app that may be focused
|
||||
#[derive(Copy, Clone, PartialEq, Eq)]
|
||||
pub enum ArrangerAppFocus {
|
||||
pub enum ArrangerViewFocus {
|
||||
/// The transport (toolbar) is focused
|
||||
Transport,
|
||||
/// The arrangement (grid) is focused
|
||||
|
|
@ -14,15 +14,15 @@ pub enum ArrangerAppFocus {
|
|||
}
|
||||
|
||||
/// Focus layout of arranger app
|
||||
impl<E: Engine> FocusGrid for ArrangerApp<E> {
|
||||
type Item = ArrangerAppFocus;
|
||||
impl<E: Engine> FocusGrid for ArrangerView<E> {
|
||||
type Item = ArrangerViewFocus;
|
||||
fn cursor (&self) -> (usize, usize) { self.focus_cursor }
|
||||
fn cursor_mut (&mut self) -> &mut (usize, usize) { &mut self.focus_cursor }
|
||||
fn focus_enter (&mut self) {
|
||||
let focused = self.focused();
|
||||
if !self.entered {
|
||||
self.entered = true;
|
||||
use ArrangerAppFocus::*;
|
||||
use ArrangerViewFocus::*;
|
||||
if let Some(transport) = self.transport.as_ref() {
|
||||
//transport.write().unwrap().entered = focused == Transport
|
||||
}
|
||||
|
|
@ -39,15 +39,15 @@ impl<E: Engine> FocusGrid for ArrangerApp<E> {
|
|||
self.phrases.write().unwrap().entered = false;
|
||||
}
|
||||
}
|
||||
fn entered (&self) -> Option<ArrangerAppFocus> {
|
||||
fn entered (&self) -> Option<ArrangerViewFocus> {
|
||||
if self.entered {
|
||||
Some(self.focused())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
fn layout (&self) -> &[&[ArrangerAppFocus]] {
|
||||
use ArrangerAppFocus::*;
|
||||
fn layout (&self) -> &[&[ArrangerViewFocus]] {
|
||||
use ArrangerViewFocus::*;
|
||||
&[
|
||||
&[Transport, Transport],
|
||||
&[Arrangement, Arrangement],
|
||||
|
|
@ -55,7 +55,7 @@ impl<E: Engine> FocusGrid for ArrangerApp<E> {
|
|||
]
|
||||
}
|
||||
fn update_focus (&mut self) {
|
||||
use ArrangerAppFocus::*;
|
||||
use ArrangerViewFocus::*;
|
||||
let focused = self.focused();
|
||||
if let Some(transport) = self.transport.as_ref() {
|
||||
transport.write().unwrap().focused = focused == Transport
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue