fix sequencer

This commit is contained in:
🪞👃🪞 2025-01-06 21:18:10 +01:00
parent 647f07c446
commit c159889ad8
2 changed files with 22 additions and 13 deletions

View file

@ -6,19 +6,19 @@ use EdnItem::*;
const EDN: &'static str = include_str!("groovebox.edn");
impl Content<TuiOut> for Groovebox {
fn content (&self) -> impl Render<TuiOut> {
self.size.of(EdnView::from_source(self, EDN))
}
}
//impl Content<TuiOut> for Groovebox {
//fn content (&self) -> impl Render<TuiOut> {
//self.size.of(EdnView::from_source(self, EDN))
//}
//}
// this works:
//render!(TuiOut: (self: Groovebox) => self.size.of(
//Bsp::s(self.toolbar_view(),
//Bsp::n(self.selector_view(),
//Bsp::n(self.sample_view(),
//Bsp::n(self.status_view(),
//Bsp::w(self.pool_view(), Fill::xy(Bsp::e(self.sampler_view(), &self.editor)))))))));
render!(TuiOut: (self: Groovebox) => self.size.of(
Bsp::s(self.toolbar_view(),
Bsp::n(self.selector_view(),
Bsp::n(self.sample_view(),
Bsp::n(self.status_view(),
Bsp::w(self.pool_view(), Fill::xy(Bsp::e(self.sampler_view(), &self.editor)))))))));
impl Groovebox {
fn toolbar_view (&self) -> impl Content<TuiOut> + use<'_> {

View file

@ -49,17 +49,26 @@ from_jack!(|jack|Sequencer {
});
render!(TuiOut: (self: Sequencer) => self.size.of(
Bsp::s(self.toolbar_view(),
Bsp::n(self.selector_view(),
Bsp::n(self.status_view(),
Bsp::w(self.pool_view(), Fill::xy(&self.editor))))));
Bsp::w(self.pool_view(), Fill::xy(&self.editor)))))));
impl Sequencer {
fn toolbar_view (&self) -> impl Content<TuiOut> + use<'_> {
self.transport.then(||TransportView::new(true, &self.clock))
Fill::x(Fixed::y(2, Align::x(TransportView::new(true, &self.player.clock))))
}
fn status_view (&self) -> impl Content<TuiOut> + use<'_> {
let edit_clip = MidiEditClip(&self.editor);
let selectors = When(self.selectors, Bsp::e(ClipSelected::play_phrase(&self.player), ClipSelected::next_phrase(&self.player)));
row!(selectors, edit_clip, MidiEditStatus(&self.editor))
}
fn selector_view (&self) -> impl Content<TuiOut> + use<'_> {
row!(
ClipSelected::play_phrase(&self.player),
ClipSelected::next_phrase(&self.player),
MidiEditClip(&self.editor),
MidiEditStatus(&self.editor),
)
}
fn pool_view (&self) -> impl Content<TuiOut> + use<'_> {
let w = self.size.w();
let phrase_w = if w > 60 { 20 } else if w > 40 { 15 } else { 10 };