mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
wip: more clocks
This commit is contained in:
parent
26a9efaa86
commit
cda0708642
3 changed files with 46 additions and 39 deletions
|
|
@ -110,9 +110,15 @@ impl Audio for ArrangerTui {
|
||||||
render!(|self: ArrangerTui|{
|
render!(|self: ArrangerTui|{
|
||||||
let arranger_focused = self.arranger_focused();
|
let arranger_focused = self.arranger_focused();
|
||||||
let border = Lozenge(Style::default().bg(TuiTheme::border_bg()).fg(TuiTheme::border_fg(arranger_focused)));
|
let border = Lozenge(Style::default().bg(TuiTheme::border_bg()).fg(TuiTheme::border_fg(arranger_focused)));
|
||||||
col_up!([
|
col!([
|
||||||
WorldClock::from(self),
|
lay!([
|
||||||
PlayClock::from(self),
|
Tui::fill_x(Lozenge(Style::default())),
|
||||||
|
Tui::outset_xy(1, 1, row!([
|
||||||
|
WorldClock::from(self),
|
||||||
|
" ",
|
||||||
|
PlayClock::from(self),
|
||||||
|
]))
|
||||||
|
]),
|
||||||
col!([
|
col!([
|
||||||
Tui::fixed_y(self.splits[0], lay!([
|
Tui::fixed_y(self.splits[0], lay!([
|
||||||
border.wrap(Tui::grow_y(1, Layers::new(move |add|{
|
border.wrap(Tui::grow_y(1, Layers::new(move |add|{
|
||||||
|
|
@ -332,7 +338,7 @@ render!(|self: ArrangerStatus|{
|
||||||
};
|
};
|
||||||
|
|
||||||
//let commands = commands.iter().reduce(String::new(), |s, (a, b, c)| format!("{s} {a}{b}{c}"));
|
//let commands = commands.iter().reduce(String::new(), |s, (a, b, c)| format!("{s} {a}{b}{c}"));
|
||||||
Tui::bg(status_bar_bg, Tui::fill_x(Tui::to_east(mode, commands)))
|
Tui::bg(status_bar_bg, Tui::fill_x(row!([mode, commands])))
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -630,37 +636,32 @@ render!(|self: ArrangerVerticalContent<'a>|Tui::fixed_y(
|
||||||
col!((scene, pulses) in self.scenes.iter().zip(self.rows.iter().map(|row|row.0)) => {
|
col!((scene, pulses) in self.scenes.iter().zip(self.rows.iter().map(|row|row.0)) => {
|
||||||
let height = 1.max((pulses / PPQ) as u16);
|
let height = 1.max((pulses / PPQ) as u16);
|
||||||
let playing = scene.is_playing(self.tracks);
|
let playing = scene.is_playing(self.tracks);
|
||||||
Tui::fixed_y(
|
Tui::fixed_y(height, row!([
|
||||||
height,
|
if playing { "▶ " } else { " " },
|
||||||
Tui::to_east(
|
Tui::bold(true, scene.name.read().unwrap().as_str()),
|
||||||
Tui::to_east(
|
row!((track, w) in self.cols.iter().map(|col|col.0).enumerate() => {
|
||||||
if playing { "▶ " } else { " " },
|
Tui::fixed_xy(w as u16, height, Layers::new(move |add|{
|
||||||
Tui::bold(true, scene.name.read().unwrap().as_str())
|
let mut bg = TuiTheme::border_bg();
|
||||||
),
|
match (self.tracks.get(track), scene.clips.get(track)) {
|
||||||
row!((track, w) in self.cols.iter().map(|col|col.0).enumerate() => {
|
(Some(track), Some(Some(phrase))) => {
|
||||||
Tui::fixed_xy(w as u16, height, Layers::new(move |add|{
|
let name = &(phrase as &Arc<RwLock<Phrase>>).read().unwrap().name;
|
||||||
let mut bg = TuiTheme::border_bg();
|
let name = format!("{}", name);
|
||||||
match (self.tracks.get(track), scene.clips.get(track)) {
|
let max_w = name.len().min((w as usize).saturating_sub(2));
|
||||||
(Some(track), Some(Some(phrase))) => {
|
let color = phrase.read().unwrap().color;
|
||||||
let name = &(phrase as &Arc<RwLock<Phrase>>).read().unwrap().name;
|
bg = color.dark.rgb;
|
||||||
let name = format!("{}", name);
|
if let Some((_, Some(ref playing))) = track.player.play_phrase() {
|
||||||
let max_w = name.len().min((w as usize).saturating_sub(2));
|
if *playing.read().unwrap() == *phrase.read().unwrap() {
|
||||||
let color = phrase.read().unwrap().color;
|
bg = color.light.rgb
|
||||||
bg = color.dark.rgb;
|
}
|
||||||
if let Some((_, Some(ref playing))) = track.player.play_phrase() {
|
};
|
||||||
if *playing.read().unwrap() == *phrase.read().unwrap() {
|
add(&Tui::fixed_x(w as u16, Tui::push_x(1, &name.as_str()[0..max_w])))?;
|
||||||
bg = color.light.rgb
|
},
|
||||||
}
|
_ => {}
|
||||||
};
|
};
|
||||||
add(&Tui::fixed_x(w as u16, Tui::push_x(1, &name.as_str()[0..max_w])))?;
|
//add(&Background(bg))
|
||||||
},
|
Ok(())
|
||||||
_ => {}
|
}))
|
||||||
};
|
})])
|
||||||
//add(&Background(bg))
|
|
||||||
Ok(())
|
|
||||||
}))
|
|
||||||
})
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
));
|
));
|
||||||
|
|
|
||||||
|
|
@ -90,8 +90,14 @@ render!(|self: SequencerTui|{
|
||||||
//col_up!([
|
//col_up!([
|
||||||
//Tui::max_y(2, SequencerStatusBar::from(self)),
|
//Tui::max_y(2, SequencerStatusBar::from(self)),
|
||||||
col!([
|
col!([
|
||||||
WorldClock::from(self),
|
lay!([
|
||||||
PlayClock::from(self),
|
Tui::fill_x(Lozenge(Style::default())),
|
||||||
|
Tui::outset_xy(1, 1, row!([
|
||||||
|
WorldClock::from(self),
|
||||||
|
" ",
|
||||||
|
PlayClock::from(self),
|
||||||
|
]))
|
||||||
|
]),
|
||||||
Tui::min_y(20, row!([
|
Tui::min_y(20, row!([
|
||||||
Tui::min_x(20, col!([
|
Tui::min_x(20, col!([
|
||||||
Tui::fixed_y(4, PhraseSelector::play_phrase(
|
Tui::fixed_y(4, PhraseSelector::play_phrase(
|
||||||
|
|
|
||||||
|
|
@ -123,13 +123,13 @@ render!(|self: PhraseView<'a>|{
|
||||||
add(&Tui::fill_xy(Tui::at_se(Tui::pull_x(1, Tui::fg(title_color, lower_right)))))?;
|
add(&Tui::fill_xy(Tui::at_se(Tui::pull_x(1, Tui::fg(title_color, lower_right)))))?;
|
||||||
Ok(())
|
Ok(())
|
||||||
});
|
});
|
||||||
let content = Tui::bg(Color::Rgb(40, 50, 30), Tui::fill_x(Tui::to_east(
|
let content = Tui::bg(Color::Rgb(40, 50, 30), Tui::fill_x(row!([
|
||||||
Tui::push_y(1, Tui::fill_y(Widget::new(|to:[u16;2]|Ok(Some(to.clip_w(2))), keys))),
|
Tui::push_y(1, Tui::fill_y(Widget::new(|to:[u16;2]|Ok(Some(to.clip_w(2))), keys))),
|
||||||
Tui::fill_x(lay!([
|
Tui::fill_x(lay!([
|
||||||
Tui::push_y(1, Tui::fill_x(Widget::new(|to|Ok(Some(to)), notes))),
|
Tui::push_y(1, Tui::fill_x(Widget::new(|to|Ok(Some(to)), notes))),
|
||||||
Tui::push_y(1, Widget::new(|to|Ok(Some(to)), cursor))
|
Tui::push_y(1, Widget::new(|to|Ok(Some(to)), cursor))
|
||||||
])),
|
])),
|
||||||
)));
|
])));
|
||||||
lay!([
|
lay!([
|
||||||
indicators,
|
indicators,
|
||||||
content
|
content
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue