mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
groovebox: spiffy sidebar
This commit is contained in:
parent
0f16c89248
commit
d45bd2122e
6 changed files with 137 additions and 44 deletions
|
|
@ -14,6 +14,36 @@ impl App {
|
|||
pub fn view_nil (&self) -> impl Content<TuiOut> + use<'_> {
|
||||
"nil"
|
||||
}
|
||||
pub fn view_status_v (&self) -> impl Content<TuiOut> + use<'_> {
|
||||
self.update_clock();
|
||||
let cache = self.view_cache.read().unwrap();
|
||||
let theme = self.color;
|
||||
let playing = self.clock().is_rolling();
|
||||
Fixed::xy(20, 7, col!(
|
||||
Fill::x(Align::w(Bsp::e(
|
||||
Align::w(Tui::bg(if playing { Rgb(0, 128, 0) } else { Rgb(128, 64, 0) },
|
||||
Either::new(false, // TODO
|
||||
Thunk::new(move||Fixed::x(9, Either::new(playing,
|
||||
Tui::fg(Rgb(0, 255, 0), " PLAYING "),
|
||||
Tui::fg(Rgb(255, 128, 0), " STOPPED ")))
|
||||
),
|
||||
Thunk::new(move||Fixed::x(5, Either::new(playing,
|
||||
Tui::fg(Rgb(0, 255, 0), Bsp::s(" 🭍🭑🬽 ", " 🭞🭜🭘 ",)),
|
||||
Tui::fg(Rgb(255, 128, 0), Bsp::s(" ▗▄▖ ", " ▝▀▘ ",))))
|
||||
)
|
||||
)
|
||||
)),
|
||||
Bsp::s(
|
||||
FieldH(theme, "Beat", cache.beat.view.clone()),
|
||||
FieldH(theme, "Time", cache.time.view.clone()),
|
||||
),
|
||||
))),
|
||||
Fill::x(Align::w(FieldH(theme, "BPM", cache.bpm.view.clone()))),
|
||||
Fill::x(Align::w(FieldH(theme, "SR ", cache.sr.view.clone()))),
|
||||
Fill::x(Align::w(FieldH(theme, "Buf", cache.buf.view.clone()))),
|
||||
Fill::x(Align::w(FieldH(theme, "Lat", cache.lat.view.clone()))),
|
||||
))
|
||||
}
|
||||
pub fn view_status (&self) -> impl Content<TuiOut> + use<'_> {
|
||||
self.update_clock();
|
||||
let cache = self.view_cache.read().unwrap();
|
||||
|
|
@ -27,13 +57,34 @@ impl App {
|
|||
cache.bpm.view.clone(), cache.beat.view.clone(), cache.time.view.clone())
|
||||
}
|
||||
pub fn view_editor (&self) -> impl Content<TuiOut> + use<'_> {
|
||||
self.editor().map(|e|Bsp::n(Bsp::e(e.clip_status(), e.edit_status()), e))
|
||||
self.editor()
|
||||
}
|
||||
pub fn view_editor_status (&self) -> impl Content<TuiOut> + use<'_> {
|
||||
Fixed::y(5, self.editor().map(|e|Bsp::s(e.clip_status(), e.edit_status())))
|
||||
}
|
||||
pub fn view_ports_status (&self) -> impl Content<TuiOut> + use<'_> {
|
||||
self.project.get_track().map(|track|Bsp::s(
|
||||
Fixed::y(4.max(track.sequencer.midi_ins.len() as u16), Align::n(Map::south(1,
|
||||
||track.sequencer.midi_ins.iter(),
|
||||
|port, index|Fixed::x(20, FieldV(
|
||||
self.color,
|
||||
format!("IN {index}: "),
|
||||
format!("{}", port.name())))))),
|
||||
Fixed::y(4.max(track.sequencer.midi_outs.len() as u16), Align::n(Map::south(1,
|
||||
||track.sequencer.midi_outs.iter(),
|
||||
|port, index|Fixed::x(20, FieldV(
|
||||
self.color,
|
||||
format!("OUT {index}: "),
|
||||
format!("{}", port.name()))))))))
|
||||
}
|
||||
pub fn view_arranger (&self) -> impl Content<TuiOut> + use<'_> {
|
||||
ArrangerView::new(&self.project, self.editor.as_ref())
|
||||
}
|
||||
pub fn view_pool (&self) -> impl Content<TuiOut> + use<'_> {
|
||||
PoolView(&self.project.pool)
|
||||
Fixed::x(20, Bsp::s(
|
||||
Fill::x(Align::w(Bsp::s("", FieldH(self.color, "Pool", "")))),
|
||||
Fill::y(Align::n(Tui::bg(Black, PoolView(&self.project.pool)))),
|
||||
))
|
||||
}
|
||||
pub fn view_samples_keys (&self) -> impl Content<TuiOut> + use<'_> {
|
||||
self.project.sampler().map(|s|s.view_list(false, self.editor().unwrap()))
|
||||
|
|
@ -47,6 +98,9 @@ impl App {
|
|||
pub fn view_sample_info (&self) -> impl Content<TuiOut> + use<'_> {
|
||||
self.project.sampler().map(|s|s.view_sample_info(self.editor().unwrap().get_note_pos()))
|
||||
}
|
||||
pub fn view_sample_status (&self) -> impl Content<TuiOut> + use<'_> {
|
||||
self.project.sampler().map(|s|s.view_sample_status(self.editor().unwrap().get_note_pos()))
|
||||
}
|
||||
pub fn view_meters_input (&self) -> impl Content<TuiOut> + use<'_> {
|
||||
self.project.sampler().map(|s|s.view_meters_input())
|
||||
}
|
||||
|
|
@ -63,9 +117,9 @@ impl App {
|
|||
Dialog::Help(offset) =>
|
||||
self.view_dialog_help(*offset).boxed(),
|
||||
Dialog::Save(browser) =>
|
||||
self.view_dialog_save().boxed(),
|
||||
self.view_dialog_save(browser).boxed(),
|
||||
Dialog::Load(browser) =>
|
||||
self.view_dialog_load().boxed(),
|
||||
self.view_dialog_load(browser).boxed(),
|
||||
Dialog::Options =>
|
||||
self.view_dialog_options().boxed(),
|
||||
Dialog::Device(index) =>
|
||||
|
|
@ -108,21 +162,21 @@ impl App {
|
|||
pub fn view_dialog_message <'a> (&'a self, message: &'a Message) -> impl Content<TuiOut> + use<'a> {
|
||||
Bsp::s(message, Bsp::s("", "[ OK ]"))
|
||||
}
|
||||
pub fn view_dialog_save <'a> (&'a self) -> impl Content<TuiOut> + use<'a> {
|
||||
pub fn view_dialog_save <'a> (&'a self, browser: &'a Browser) -> impl Content<TuiOut> + use<'a> {
|
||||
Bsp::s(
|
||||
Fill::x(Align::w(Margin::xy(1, 1, Bsp::e(
|
||||
Tui::bold(true, " Save project: "),
|
||||
Shrink::x(3, Fixed::y(1, RepeatH("🭻"))))))),
|
||||
Outer(true, Style::default().fg(Tui::g(96)))
|
||||
.enclose(Fill::xy("todo file browser")))
|
||||
.enclose(Fill::xy(browser)))
|
||||
}
|
||||
pub fn view_dialog_load <'a> (&'a self) -> impl Content<TuiOut> + use<'a> {
|
||||
pub fn view_dialog_load <'a> (&'a self, browser: &'a Browser) -> impl Content<TuiOut> + use<'a> {
|
||||
Bsp::s(
|
||||
Fill::x(Align::w(Margin::xy(1, 1, Bsp::e(
|
||||
Tui::bold(true, " Load project: "),
|
||||
Shrink::x(3, Fixed::y(1, RepeatH("🭻"))))))),
|
||||
Outer(true, Style::default().fg(Tui::g(96)))
|
||||
.enclose(Fill::xy("todo file browser")))
|
||||
.enclose(Fill::xy(browser)))
|
||||
}
|
||||
pub fn view_dialog_options <'a> (&'a self) -> impl Content<TuiOut> + use<'a> {
|
||||
"TODO"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue