mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
show playing phrases in light color
This commit is contained in:
parent
bab0235c20
commit
02a4cf8a0a
1 changed files with 13 additions and 4 deletions
|
|
@ -229,18 +229,27 @@ impl<'a> Content for VerticalArranger<'a, Tui> {
|
|||
).fixed_xy(scene_title_w, height);
|
||||
// scene clips
|
||||
let scene_clip = |scene, track: usize, w: u16, h: u16|Layers::new(move |add|{
|
||||
let mut color = clip_bg;
|
||||
let mut bg = clip_bg;
|
||||
match (tracks.get(track), (scene as &Scene).clips.get(track)) {
|
||||
(Some(_), Some(Some(phrase))) => {
|
||||
(Some(track), Some(Some(phrase))) => {
|
||||
let name = &(phrase as &Arc<RwLock<Phrase>>).read().unwrap().name;
|
||||
let name = format!("{}", name);
|
||||
let max_w = name.len().min((w as usize).saturating_sub(2));
|
||||
let color = phrase.read().unwrap().color;
|
||||
add(&name.as_str()[0..max_w].push_x(1).fixed_x(w))?;
|
||||
color = (phrase as &Arc<RwLock<Phrase>>).read().unwrap().color.base.rgb;
|
||||
bg = if let Some((_, Some(ref playing))) = track.player.phrase {
|
||||
if *playing.read().unwrap() == *phrase.read().unwrap() {
|
||||
color.light.rgb
|
||||
} else {
|
||||
color.dark.rgb
|
||||
}
|
||||
} else {
|
||||
color.dark.rgb
|
||||
};
|
||||
},
|
||||
_ => {}
|
||||
};
|
||||
add(&Background(color))
|
||||
add(&Background(bg))
|
||||
}).fixed_xy(w, h);
|
||||
// tracks and scenes
|
||||
let content = col!(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue