mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 11:46:41 +01:00
edn arranger
This commit is contained in:
parent
1fe60bff5f
commit
f7d9d2e107
2 changed files with 30 additions and 21 deletions
3
tek/src/arranger.edn
Normal file
3
tek/src/arranger.edn
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
(bsp/s :toolbar
|
||||
(fill/x (align/c (bsp/w :pool
|
||||
(bsp/n :inputs (bsp/s :outputs (bsp/s :tracks :scenes)))))))
|
||||
|
|
@ -27,35 +27,41 @@ pub struct Arranger {
|
|||
}
|
||||
pub(crate) const HEADER_H: u16 = 0; // 5
|
||||
pub(crate) const SCENES_W_OFFSET: u16 = 0;
|
||||
render!(TuiOut: (self: Arranger) => {
|
||||
let scenes_w = self.sidebar_w();
|
||||
let tracks_w = self.tracks_with_sizes().last().unwrap().3 as u16;
|
||||
let h = self.size.h() as u16;
|
||||
let ins = 1 + self.midi_ins[0].connect.len() as u16;
|
||||
let outs = 1 + self.midi_outs[0].connect.len() as u16;
|
||||
let toolbar = |x|Bsp::s(self.toolbar_view(), x);
|
||||
let pool = |x|Bsp::w(self.pool_view(), x);
|
||||
let editing = |x|Bsp::n(Bsp::e(self.editor.clip_status(), self.editor.edit_status()), x);
|
||||
let playing = |x|x;//Bsp::s(self.play_row(tracks_w), Fill::y(x));
|
||||
let next = |x|x;//Bsp::s(self.next_row(tracks_w), Fill::y(x));
|
||||
let tracks = |x|Bsp::s(self.track_row(tracks_w), Fill::y(Align::c(x)));
|
||||
let outputs = |x|Bsp::s(self.output_row(tracks_w), Fill::y(x));
|
||||
let scenes = |x|Bsp::s(self.scene_row(tracks_w), x);
|
||||
let inputs = |x|Bsp::n(self.input_row(tracks_w), Fill::y(x));
|
||||
self.size.of(toolbar(Fill::xy(Align::c(
|
||||
editing(pool(inputs(outputs(playing(next(tracks(scenes(Fill::xy("")))))))))
|
||||
))))
|
||||
});
|
||||
render!(TuiOut: (self: Arranger) => self.size.of(EdnView::from_source(self, Self::EDN)));
|
||||
impl EdnViewData<TuiOut> for &Arranger {
|
||||
fn get_content <'a> (&'a self, item: EdnItem<&'a str>) -> RenderBox<'a, TuiOut> {
|
||||
use EdnItem::*;
|
||||
let scenes_w = self.sidebar_w();
|
||||
let tracks_w = self.tracks_with_sizes().last().unwrap().3 as u16;
|
||||
match item {
|
||||
Nil => Box::new(()),
|
||||
Exp(items) => Box::new(EdnView::from_items(*self, items.as_slice())),
|
||||
Sym(":editor") => (&self.editor).boxed(),
|
||||
Sym(":pool") => self.pool().boxed(),
|
||||
Sym(":status") => self.status().boxed(),
|
||||
Sym(":toolbar") => self.toolbar().boxed(),
|
||||
Sym(":tracks") => self.track_row(tracks_w).boxed(),
|
||||
Sym(":scenes") => self.scene_row(tracks_w).boxed(),
|
||||
Sym(":inputs") => self.input_row(tracks_w).boxed(),
|
||||
Sym(":outputs") => self.output_row(tracks_w).boxed(),
|
||||
_ => panic!("no content for {item:?}")
|
||||
}
|
||||
}
|
||||
}
|
||||
impl Arranger {
|
||||
const EDN: &'static str = include_str!("arranger.edn");
|
||||
pub const LEFT_SEP: char = '▎';
|
||||
pub const TRACK_MIN_WIDTH: usize = 4;
|
||||
|
||||
fn toolbar_view (&self) -> impl Content<TuiOut> + use<'_> {
|
||||
fn toolbar (&self) -> impl Content<TuiOut> + use<'_> {
|
||||
Fill::x(Fixed::y(2, Align::x(TransportView::new(true, &self.clock))))
|
||||
}
|
||||
fn pool_view (&self) -> impl Content<TuiOut> + use<'_> {
|
||||
fn pool (&self) -> impl Content<TuiOut> + use<'_> {
|
||||
Align::e(Fixed::x(self.sidebar_w(), PoolView(self.compact, &self.pool)))
|
||||
}
|
||||
fn status (&self) -> impl Content<TuiOut> + use<'_> {
|
||||
Bsp::e(self.editor.clip_status(), self.editor.edit_status())
|
||||
}
|
||||
fn is_editing (&self) -> bool {
|
||||
!self.pool.visible
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue