mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +01:00
wip: implement focus_next and focus_prev
This commit is contained in:
parent
a694903bdb
commit
cd9244ec88
4 changed files with 37 additions and 60 deletions
|
|
@ -2,8 +2,6 @@ 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.
|
||||
|
|
@ -29,8 +27,8 @@ impl<E: Engine> FocusGrid<ArrangerFocus> for Arranger<E> {
|
|||
fn layout (&self) -> &[&[ArrangerFocus]] {
|
||||
&[
|
||||
&[ArrangerFocus::Transport],
|
||||
&[ArrangerFocus::Arrangement],
|
||||
&[ArrangerFocus::PhrasePool, ArrangerFocus::PhraseEditor],
|
||||
&[ArrangerFocus::Arrangement, ArrangerFocus::Arrangement],
|
||||
&[ArrangerFocus::PhrasePool, ArrangerFocus::PhraseEditor],
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
@ -184,12 +182,12 @@ impl<E: Engine> Arrangement<E> {
|
|||
for track_index in 0..self.tracks.len() {
|
||||
if let Some(phrase) = scene.clip(track_index) {
|
||||
let len = phrase.read().unwrap().name.read().unwrap().len();
|
||||
lens[track_index] = lens[track_index].max(len);
|
||||
lens[track_index] = lens[track_index].max(len + 16);
|
||||
}
|
||||
}
|
||||
}
|
||||
let mut total = 0;
|
||||
let mut to_x_and_w = |len: &usize|{ total = total + *len; (total - *len, *len) };
|
||||
let to_x_and_w = |len: &usize|{ total = total + *len; (*len, total - *len) };
|
||||
let mut lens: Vec<(usize, usize)> = lens.iter().map(to_x_and_w).collect();
|
||||
lens.push((0, total));
|
||||
lens
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue