mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 03:36:41 +01:00
This commit is contained in:
parent
7f03116cb3
commit
e987aa697d
16 changed files with 107 additions and 135 deletions
8
Cargo.lock
generated
8
Cargo.lock
generated
|
|
@ -2399,14 +2399,6 @@ dependencies = [
|
||||||
"xdg",
|
"xdg",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "tek_cli"
|
|
||||||
version = "0.2.1"
|
|
||||||
dependencies = [
|
|
||||||
"clap",
|
|
||||||
"tek",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tek_config"
|
name = "tek_config"
|
||||||
version = "0.2.1"
|
version = "0.2.1"
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ members = [
|
||||||
"./crates/device",
|
"./crates/device",
|
||||||
"./crates/config",
|
"./crates/config",
|
||||||
"./crates/app",
|
"./crates/app",
|
||||||
"./crates/cli",
|
|
||||||
]
|
]
|
||||||
exclude = [
|
exclude = [
|
||||||
"./deps/tengri"
|
"./deps/tengri"
|
||||||
|
|
|
||||||
|
|
@ -29,4 +29,8 @@ cli = ["clap"]
|
||||||
host = ["tek_device/lv2"]
|
host = ["tek_device/lv2"]
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
path = "app.rs"
|
path = "tek.rs"
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "tek"
|
||||||
|
path = "tek_cli.rs"
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
#![allow(unused, clippy::unit_arg)]
|
#![allow(unused, clippy::unit_arg)]
|
||||||
#![feature(adt_const_params, associated_type_defaults, if_let_guard, impl_trait_in_assoc_type,
|
#![feature(adt_const_params, associated_type_defaults, if_let_guard, impl_trait_in_assoc_type,
|
||||||
type_alias_impl_trait, trait_alias, type_changing_struct_update, closure_lifetime_binder)]
|
type_alias_impl_trait, trait_alias, type_changing_struct_update, closure_lifetime_binder)]
|
||||||
#[cfg(test)] mod app_test;
|
#[cfg(test)] mod tek_test;
|
||||||
mod app_bind; pub use self::app_bind::*;
|
mod tek_bind; pub use self::tek_bind::*;
|
||||||
mod app_data; pub use self::app_data::*;
|
mod tek_data; pub use self::tek_data::*;
|
||||||
mod app_deps; pub use self::app_deps::*;
|
mod tek_deps; pub use self::tek_deps::*;
|
||||||
mod app_jack; pub use self::app_jack::*;
|
mod tek_jack; pub use self::tek_jack::*;
|
||||||
mod app_menu; pub use self::app_menu::*;
|
mod tek_menu; pub use self::tek_menu::*;
|
||||||
mod app_view; pub use self::app_view::*;
|
mod tek_view; pub use self::tek_view::*;
|
||||||
/// Total state
|
/// Total state
|
||||||
#[derive(Default, Debug)]
|
#[derive(Default, Debug)]
|
||||||
pub struct App {
|
pub struct App {
|
||||||
|
|
@ -5,7 +5,7 @@ content!(TuiOut:|self: App|Fill::xy(Stack::above(|add|{
|
||||||
})));
|
})));
|
||||||
|
|
||||||
impl App {
|
impl App {
|
||||||
fn view <D: Dsl> (&self, index: D) -> Box<dyn Render<TuiOut>> {
|
fn view <'t, D: Dsl> (&'t self, index: D) -> TuiBox<'t> {
|
||||||
match index.src() {
|
match index.src() {
|
||||||
Ok(Some(src)) => render_dsl(self, src),
|
Ok(Some(src)) => render_dsl(self, src),
|
||||||
Ok(None) => Box::new(Tui::fg(Color::Rgb(192, 192, 192), "empty view")),
|
Ok(None) => Box::new(Tui::fg(Color::Rgb(192, 192, 192), "empty view")),
|
||||||
|
|
@ -17,10 +17,12 @@ impl App {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type TuiBox<'t> = Box<dyn Render<TuiOut> + 't>;
|
||||||
|
|
||||||
fn render_dsl <'t> (
|
fn render_dsl <'t> (
|
||||||
state: &'t impl DslNs<'t, Box<dyn Render<TuiOut>>>,
|
state: &'t impl DslNs<'t, TuiBox<'t>>,
|
||||||
src: &str
|
src: &str
|
||||||
) -> Box<dyn Render<TuiOut>> {
|
) -> TuiBox<'t> {
|
||||||
let err: Option<Box<dyn Error>> = match state.from(&src) {
|
let err: Option<Box<dyn Error>> = match state.from(&src) {
|
||||||
Ok(Some(value)) => return value, Ok(None) => None, Err(e) => Some(e),
|
Ok(Some(value)) => return value, Ok(None) => None, Err(e) => Some(e),
|
||||||
};
|
};
|
||||||
|
|
@ -41,51 +43,51 @@ fn render_dsl <'t> (
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'t> DslNs<'t, Box<dyn Render<TuiOut>>> for App {
|
impl<'t> DslNs<'t, TuiBox<'t>> for App {
|
||||||
dsl_exprs!(|app| -> Box<dyn Render<TuiOut>> {
|
dsl_exprs!(|app| -> TuiBox<'t> {
|
||||||
"text" (tail: Arc<str>) => Box::new(tail),
|
"text" (tail: Arc<str>) => Box::new(tail),
|
||||||
|
|
||||||
"fg" (color: Color, x: Box<dyn Render<TuiOut>>) => Box::new(Tui::fg(color, x)),
|
"fg" (color: Color, x: TuiBox<'t>) => Box::new(Tui::fg(color, x)),
|
||||||
"bg" (color: Color, x: Box<dyn Render<TuiOut>>) => Box::new(Tui::bg(color, x)),
|
"bg" (color: Color, x: TuiBox<'t>) => Box::new(Tui::bg(color, x)),
|
||||||
"fg/bg" (fg: Color, bg: Color, x: Box<dyn Render<TuiOut>>) => Box::new(Tui::fg_bg(fg, bg, x)),
|
"fg/bg" (fg: Color, bg: Color, x: TuiBox<'t>) => Box::new(Tui::fg_bg(fg, bg, x)),
|
||||||
|
|
||||||
"either" (cond: bool, a: Box<dyn Render<TuiOut>>, b: Box<dyn Render<TuiOut>>) =>
|
"either" (cond: bool, a: TuiBox<'t>, b: TuiBox<'t>) =>
|
||||||
Box::new(Either(cond, a, b)),
|
Box::new(Either(cond, a, b)),
|
||||||
|
|
||||||
"bsp/n" (a: Box<dyn Render<TuiOut>>, b: Box<dyn Render<TuiOut>>) => Box::new(Bsp::n(a, b)),
|
"bsp/n" (a: TuiBox<'t>, b: TuiBox<'t>) => Box::new(Bsp::n(a, b)),
|
||||||
"bsp/s" (a: Box<dyn Render<TuiOut>>, b: Box<dyn Render<TuiOut>>) => Box::new(Bsp::s(a, b)),
|
"bsp/s" (a: TuiBox<'t>, b: TuiBox<'t>) => Box::new(Bsp::s(a, b)),
|
||||||
"bsp/e" (a: Box<dyn Render<TuiOut>>, b: Box<dyn Render<TuiOut>>) => Box::new(Bsp::e(a, b)),
|
"bsp/e" (a: TuiBox<'t>, b: TuiBox<'t>) => Box::new(Bsp::e(a, b)),
|
||||||
"bsp/w" (a: Box<dyn Render<TuiOut>>, b: Box<dyn Render<TuiOut>>) => Box::new(Bsp::w(a, b)),
|
"bsp/w" (a: TuiBox<'t>, b: TuiBox<'t>) => Box::new(Bsp::w(a, b)),
|
||||||
"bsp/a" (a: Box<dyn Render<TuiOut>>, b: Box<dyn Render<TuiOut>>) => Box::new(Bsp::a(a, b)),
|
"bsp/a" (a: TuiBox<'t>, b: TuiBox<'t>) => Box::new(Bsp::a(a, b)),
|
||||||
"bsp/b" (a: Box<dyn Render<TuiOut>>, b: Box<dyn Render<TuiOut>>) => Box::new(Bsp::b(a, b)),
|
"bsp/b" (a: TuiBox<'t>, b: TuiBox<'t>) => Box::new(Bsp::b(a, b)),
|
||||||
|
|
||||||
"align/nw" (x: Box<dyn Render<TuiOut>>) => Box::new(Align::nw(x)),
|
"align/nw" (x: TuiBox<'t>) => Box::new(Align::nw(x)),
|
||||||
"align/ne" (x: Box<dyn Render<TuiOut>>) => Box::new(Align::ne(x)),
|
"align/ne" (x: TuiBox<'t>) => Box::new(Align::ne(x)),
|
||||||
"align/n" (x: Box<dyn Render<TuiOut>>) => Box::new(Align::n(x)),
|
"align/n" (x: TuiBox<'t>) => Box::new(Align::n(x)),
|
||||||
"align/s" (x: Box<dyn Render<TuiOut>>) => Box::new(Align::s(x)),
|
"align/s" (x: TuiBox<'t>) => Box::new(Align::s(x)),
|
||||||
"align/e" (x: Box<dyn Render<TuiOut>>) => Box::new(Align::e(x)),
|
"align/e" (x: TuiBox<'t>) => Box::new(Align::e(x)),
|
||||||
"align/w" (x: Box<dyn Render<TuiOut>>) => Box::new(Align::w(x)),
|
"align/w" (x: TuiBox<'t>) => Box::new(Align::w(x)),
|
||||||
"align/x" (x: Box<dyn Render<TuiOut>>) => Box::new(Align::x(x)),
|
"align/x" (x: TuiBox<'t>) => Box::new(Align::x(x)),
|
||||||
"align/y" (x: Box<dyn Render<TuiOut>>) => Box::new(Align::y(x)),
|
"align/y" (x: TuiBox<'t>) => Box::new(Align::y(x)),
|
||||||
"align/c" (x: Box<dyn Render<TuiOut>>) => Box::new(Align::c(x)),
|
"align/c" (x: TuiBox<'t>) => Box::new(Align::c(x)),
|
||||||
|
|
||||||
"fill/x" (x: Box<dyn Render<TuiOut>>) => Box::new(Fill::x(x)),
|
"fill/x" (x: TuiBox<'t>) => Box::new(Fill::x(x)),
|
||||||
"fill/y" (x: Box<dyn Render<TuiOut>>) => Box::new(Fill::y(x)),
|
"fill/y" (x: TuiBox<'t>) => Box::new(Fill::y(x)),
|
||||||
"fill/xy" (x: Box<dyn Render<TuiOut>>) => Box::new(Fill::xy(x)),
|
"fill/xy" (x: TuiBox<'t>) => Box::new(Fill::xy(x)),
|
||||||
|
|
||||||
"fixed/x" (x: u16, c: Box<dyn Render<TuiOut>>) => Box::new(Fixed::x(x, c)),
|
"fixed/x" (x: u16, c: TuiBox<'t>) => Box::new(Fixed::x(x, c)),
|
||||||
"fixed/y" (y: u16, c: Box<dyn Render<TuiOut>>) => Box::new(Fixed::y(y, c)),
|
"fixed/y" (y: u16, c: TuiBox<'t>) => Box::new(Fixed::y(y, c)),
|
||||||
"fixed/xy" (x: u16, y: u16, c: Box<dyn Render<TuiOut>>) => Box::new(Fixed::xy(x, y, c)),
|
"fixed/xy" (x: u16, y: u16, c: TuiBox<'t>) => Box::new(Fixed::xy(x, y, c)),
|
||||||
|
|
||||||
"min/x" (x: u16, c: Box<dyn Render<TuiOut>>) => Box::new(Min::x(x, c)),
|
"min/x" (x: u16, c: TuiBox<'t>) => Box::new(Min::x(x, c)),
|
||||||
"min/y" (y: u16, c: Box<dyn Render<TuiOut>>) => Box::new(Min::y(y, c)),
|
"min/y" (y: u16, c: TuiBox<'t>) => Box::new(Min::y(y, c)),
|
||||||
"min/xy" (x: u16, y: u16, c: Box<dyn Render<TuiOut>>) => Box::new(Min::xy(x, y, c)),
|
"min/xy" (x: u16, y: u16, c: TuiBox<'t>) => Box::new(Min::xy(x, y, c)),
|
||||||
|
|
||||||
"max/x" (x: u16, c: Box<dyn Render<TuiOut>>) => Box::new(Max::x(x, c)),
|
"max/x" (x: u16, c: TuiBox<'t>) => Box::new(Max::x(x, c)),
|
||||||
"max/y" (y: u16, c: Box<dyn Render<TuiOut>>) => Box::new(Max::y(y, c)),
|
"max/y" (y: u16, c: TuiBox<'t>) => Box::new(Max::y(y, c)),
|
||||||
"max/xy" (x: u16, y: u16, c: Box<dyn Render<TuiOut>>) => Box::new(Max::xy(x, y, c)),
|
"max/xy" (x: u16, y: u16, c: TuiBox<'t>) => Box::new(Max::xy(x, y, c)),
|
||||||
});
|
});
|
||||||
dsl_words!(|app| -> Box<dyn Render<TuiOut>> {
|
dsl_words!(|app| -> TuiBox<'t> {
|
||||||
":logo" => Box::new(Fixed::xy(32, 7, Tui::bold(true, Tui::fg(Rgb(240,200,180), Stack::south(|add|{
|
":logo" => Box::new(Fixed::xy(32, 7, Tui::bold(true, Tui::fg(Rgb(240,200,180), Stack::south(|add|{
|
||||||
add(&Fixed::y(1, ""));
|
add(&Fixed::y(1, ""));
|
||||||
add(&Fixed::y(1, ""));
|
add(&Fixed::y(1, ""));
|
||||||
|
|
@ -93,16 +95,16 @@ impl<'t> DslNs<'t, Box<dyn Render<TuiOut>>> for App {
|
||||||
add(&Fixed::y(1, Bsp::e("~~~~ ║ ~ ╟─╌ ~╟─< ~~ ", Bsp::e(Tui::fg(Rgb(230,100,40), "v0.3.0"), " ~~"))));
|
add(&Fixed::y(1, Bsp::e("~~~~ ║ ~ ╟─╌ ~╟─< ~~ ", Bsp::e(Tui::fg(Rgb(230,100,40), "v0.3.0"), " ~~"))));
|
||||||
add(&Fixed::y(1, "~~~~ ╨ ~ ╙──╜ ╨ ╜ ~~~~~~~~~~~~"));
|
add(&Fixed::y(1, "~~~~ ╨ ~ ╙──╜ ╨ ╜ ~~~~~~~~~~~~"));
|
||||||
}))))),
|
}))))),
|
||||||
":meters/input" => Box::new("Input Meters"),
|
":meters/input" => Box::new(Tui::bg(Rgb(30, 30, 30), Fill::y(Align::s("Input Meters")))),
|
||||||
":meters/output" => Box::new("Output Meters"),
|
":meters/output" => Box::new(Tui::bg(Rgb(30, 30, 30), Fill::y(Align::s("Output Meters")))),
|
||||||
":status" => Box::new("Status Bar"),
|
":status" => Box::new("Status Bar"),
|
||||||
":tracks/names" => Box::new("Track Names"),
|
":tracks/names" => Box::new(app.project.view_track_names(app.color.clone())),//Tui::bg(Rgb(40, 40, 40), Fill::x(Align::w("Track Names")))),
|
||||||
":tracks/inputs" => Box::new("Track Inputs"),
|
":tracks/inputs" => Box::new(Tui::bg(Rgb(40, 40, 40), Fill::x(Align::w("Track Inputs")))),
|
||||||
":tracks/devices" => Box::new("Track Devices"),
|
":tracks/devices" => Box::new(Tui::bg(Rgb(40, 40, 40), Fill::x(Align::w("Track Devices")))),
|
||||||
":tracks/outputs" => Box::new("Track Outputs"),
|
":tracks/outputs" => Box::new(Tui::bg(Rgb(40, 40, 40), Fill::x(Align::w("Track Outputs")))),
|
||||||
":scenes/names" => Box::new("Scene Names"),
|
":scenes/names" => Box::new("Scene Names"),
|
||||||
":editor" => Box::new("Editor"),
|
":editor" => Box::new("Editor"),
|
||||||
":scenes" => Box::new("Editor"),
|
":scenes" => Box::new("Scenes"),
|
||||||
":dialog/menu" => Box::new(if let Dialog::Menu(selected, items) = &app.dialog {
|
":dialog/menu" => Box::new(if let Dialog::Menu(selected, items) = &app.dialog {
|
||||||
let items = items.clone();
|
let items = items.clone();
|
||||||
let selected = *selected;
|
let selected = *selected;
|
||||||
|
|
@ -165,7 +167,7 @@ impl<'t> DslNs<'t, Box<dyn Render<TuiOut>>> for App {
|
||||||
Fill::x(Tui::bg(bg, Bsp::e(lb, Bsp::w(rb, "FIXME device name")))) }))) },
|
Fill::x(Tui::bg(bg, Bsp::e(lb, Bsp::w(rb, "FIXME device name")))) }))) },
|
||||||
});
|
});
|
||||||
/// Resolve an expression if known.
|
/// Resolve an expression if known.
|
||||||
fn from_expr <D: Dsl> (&self, dsl: &D) -> Perhaps<Box<dyn Render<TuiOut>>> {
|
fn from_expr <D: Dsl> (&self, dsl: &D) -> Perhaps<TuiBox<'t>> {
|
||||||
if let Some(head) = dsl.expr().head()? {
|
if let Some(head) = dsl.expr().head()? {
|
||||||
for (key, value) in Self::EXPRS.0.iter() {
|
for (key, value) in Self::EXPRS.0.iter() {
|
||||||
if head == *key {
|
if head == *key {
|
||||||
|
|
@ -176,7 +178,7 @@ impl<'t> DslNs<'t, Box<dyn Render<TuiOut>>> for App {
|
||||||
return Ok(None)
|
return Ok(None)
|
||||||
}
|
}
|
||||||
/// Resolve a symbol if known.
|
/// Resolve a symbol if known.
|
||||||
fn from_word <D: Dsl> (&self, dsl: &D) -> Perhaps<Box<dyn Render<TuiOut>>> {
|
fn from_word <D: Dsl> (&self, dsl: &D) -> Perhaps<TuiBox<'t>> {
|
||||||
if let Some(dsl) = dsl.word()? {
|
if let Some(dsl) = dsl.word()? {
|
||||||
let views = self.config.views.read().unwrap();
|
let views = self.config.views.read().unwrap();
|
||||||
if let Some(view) = views.get(dsl) {
|
if let Some(view) = views.get(dsl) {
|
||||||
|
|
@ -194,7 +196,7 @@ impl<'t> DslNs<'t, Box<dyn Render<TuiOut>>> for App {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn view_nil (_: &App) -> Box<dyn Render<TuiOut>> {
|
pub fn view_nil (_: &App) -> TuiBox {
|
||||||
Box::new(Fill::xy("·"))
|
Box::new(Fill::xy("·"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
[package]
|
|
||||||
name = "tek_cli"
|
|
||||||
edition = { workspace = true }
|
|
||||||
version = { workspace = true }
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
tek = { workspace = true }
|
|
||||||
clap = { workspace = true }
|
|
||||||
|
|
||||||
[[bin]]
|
|
||||||
name = "tek"
|
|
||||||
path = "./tek.rs"
|
|
||||||
|
|
@ -2,11 +2,11 @@ use crate::*;
|
||||||
|
|
||||||
impl Arrangement {
|
impl Arrangement {
|
||||||
pub fn view_inputs <'a> (&'a self, _theme: ItemTheme) -> impl Content<TuiOut> + 'a {
|
pub fn view_inputs <'a> (&'a self, _theme: ItemTheme) -> impl Content<TuiOut> + 'a {
|
||||||
Stack::south(move|add: &mut dyn FnMut(&dyn Render<TuiOut>)|{
|
Stack::south(move|add|{
|
||||||
add(&Fixed::y(1,
|
add(&Fixed::y(1,
|
||||||
Bsp::e(Fixed::x(20, Align::w(button_3("i", "nput ", format!("{}", self.midi_ins.len()), false))),
|
Bsp::e(Fixed::x(20, Align::w(button_3("i", "nput ", format!("{}", self.midi_ins.len()), false))),
|
||||||
Bsp::w(Fixed::x(4, button_2("I", "+", false)),
|
Bsp::w(Fixed::x(4, button_2("I", "+", false)),
|
||||||
Stack::east(move|add: &mut dyn FnMut(&dyn Render<TuiOut>)|{
|
Stack::east(move|add|{
|
||||||
for (_index, track, _x1, _x2) in self.tracks_with_sizes() {
|
for (_index, track, _x1, _x2) in self.tracks_with_sizes() {
|
||||||
add(&Tui::bg(track.color.dark.rgb, Align::w(Fixed::x(track.width as u16, row!(
|
add(&Tui::bg(track.color.dark.rgb, Align::w(Fixed::x(track.width as u16, row!(
|
||||||
Either(track.sequencer.monitoring, Tui::fg(Green, "mon "), "mon "),
|
Either(track.sequencer.monitoring, Tui::fg(Green, "mon "), "mon "),
|
||||||
|
|
@ -20,7 +20,7 @@ impl Arrangement {
|
||||||
Fixed::x(20, Align::w(Bsp::e(" ● ",
|
Fixed::x(20, Align::w(Bsp::e(" ● ",
|
||||||
Tui::bold(true, Tui::fg(Rgb(255,255,255), port.port_name()))))),
|
Tui::bold(true, Tui::fg(Rgb(255,255,255), port.port_name()))))),
|
||||||
Bsp::w(Fixed::x(4, ()),
|
Bsp::w(Fixed::x(4, ()),
|
||||||
Stack::east(move|add: &mut dyn FnMut(&dyn Render<TuiOut>)|{
|
Stack::east(move|add|{
|
||||||
for (_index, track, _x1, _x2) in self.tracks_with_sizes() {
|
for (_index, track, _x1, _x2) in self.tracks_with_sizes() {
|
||||||
add(&Tui::bg(track.color.darker.rgb, Align::w(Fixed::x(track.width as u16, row!(
|
add(&Tui::bg(track.color.darker.rgb, Align::w(Fixed::x(track.width as u16, row!(
|
||||||
Either(track.sequencer.monitoring, Tui::fg(Green, " ● "), " · "),
|
Either(track.sequencer.monitoring, Tui::fg(Green, " ● "), " · "),
|
||||||
|
|
@ -40,7 +40,7 @@ impl Arrangement {
|
||||||
let h = h as u16;
|
let h = h as u16;
|
||||||
let list = Bsp::s(
|
let list = Bsp::s(
|
||||||
Fixed::y(1, Fill::x(Align::w(button_3("o", "utput", format!("{}", self.midi_outs.len()), false)))),
|
Fixed::y(1, Fill::x(Align::w(button_3("o", "utput", format!("{}", self.midi_outs.len()), false)))),
|
||||||
Fixed::y(h - 1, Fill::xy(Align::nw(Stack::south(|add: &mut dyn FnMut(&dyn Render<TuiOut>)|{
|
Fixed::y(h - 1, Fill::xy(Align::nw(Stack::south(|add|{
|
||||||
for (_index, port) in self.midi_outs().iter().enumerate() {
|
for (_index, port) in self.midi_outs().iter().enumerate() {
|
||||||
add(&Fixed::y(1,Fill::x(Bsp::e(
|
add(&Fixed::y(1,Fill::x(Bsp::e(
|
||||||
Align::w(Bsp::e(" ● ", Tui::fg(Rgb(255,255,255),Tui::bold(true, port.port_name())))),
|
Align::w(Bsp::e(" ● ", Tui::fg(Rgb(255,255,255),Tui::bold(true, port.port_name())))),
|
||||||
|
|
@ -52,12 +52,12 @@ impl Arrangement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})))));
|
})))));
|
||||||
Fixed::y(h, self.view_track_row_section(theme, list, button_2("O", "+", false),
|
Fixed::y(h, Self::view_track_row_section(theme, list, button_2("O", "+", false),
|
||||||
Tui::bg(theme.darker.rgb, Align::w(Fill::x(
|
Tui::bg(theme.darker.rgb, Align::w(Fill::x(
|
||||||
Stack::east(move|add: &mut dyn FnMut(&dyn Render<TuiOut>)|{
|
Stack::east(move|add|{
|
||||||
for (index, track, _x1, _x2) in self.tracks_with_sizes() {
|
for (index, track, _x1, _x2) in self.tracks_with_sizes() {
|
||||||
add(&Fixed::x(self.track_width(index, track),
|
add(&Fixed::x(self.track_width(index, track),
|
||||||
Stack::south(move|add: &mut dyn FnMut(&dyn Render<TuiOut>)|{
|
Stack::south(move|add|{
|
||||||
add(&Fixed::y(1, Align::w(Bsp::e(
|
add(&Fixed::y(1, Align::w(Bsp::e(
|
||||||
Either(true, Tui::fg(Green, "play "), "play "),
|
Either(true, Tui::fg(Green, "play "), "play "),
|
||||||
Either(false, Tui::fg(Yellow, "solo "), "solo "),
|
Either(false, Tui::fg(Yellow, "solo "), "solo "),
|
||||||
|
|
@ -77,11 +77,11 @@ impl Arrangement {
|
||||||
for track in self.tracks().iter() {
|
for track in self.tracks().iter() {
|
||||||
h = h.max(track.devices.len() as u16 * 2);
|
h = h.max(track.devices.len() as u16 * 2);
|
||||||
}
|
}
|
||||||
self.view_track_row_section(
|
Self::view_track_row_section(
|
||||||
theme,
|
theme,
|
||||||
button_3("d", "evice", format!("{}", self.track().map(|t|t.devices.len()).unwrap_or(0)), false),
|
button_3("d", "evice", format!("{}", self.track().map(|t|t.devices.len()).unwrap_or(0)), false),
|
||||||
button_2("D", "+", false),
|
button_2("D", "+", false),
|
||||||
Stack::east(move|add: &mut dyn FnMut(&dyn Render<TuiOut>)|{
|
Stack::east(move|add|{
|
||||||
for (index, track, _x1, _x2) in self.tracks_with_sizes() {
|
for (index, track, _x1, _x2) in self.tracks_with_sizes() {
|
||||||
add(&Fixed::xy(self.track_width(index, track), h + 1,
|
add(&Fixed::xy(self.track_width(index, track), h + 1,
|
||||||
Tui::bg(track.color.dark.rgb, Align::nw(Map::south(2, move||0..h,
|
Tui::bg(track.color.dark.rgb, Align::nw(Map::south(2, move||0..h,
|
||||||
|
|
@ -135,8 +135,7 @@ pub trait TracksView:
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
fn view_track_row_section <'a> (
|
fn view_track_row_section (
|
||||||
&'a self,
|
|
||||||
_theme: ItemTheme,
|
_theme: ItemTheme,
|
||||||
button: impl Content<TuiOut>,
|
button: impl Content<TuiOut>,
|
||||||
button_add: impl Content<TuiOut>,
|
button_add: impl Content<TuiOut>,
|
||||||
|
|
@ -151,51 +150,44 @@ pub trait TracksView:
|
||||||
Fixed::x(12, Tui::bg(theme.darker.rgb, Fill::x(Align::e(content))))
|
Fixed::x(12, Tui::bg(theme.darker.rgb, Fill::x(Align::e(content))))
|
||||||
}
|
}
|
||||||
fn view_track_names (&self, theme: ItemTheme) -> impl Content<TuiOut> {
|
fn view_track_names (&self, theme: ItemTheme) -> impl Content<TuiOut> {
|
||||||
self.view_track_row_section(
|
let track_count = self.tracks().len();
|
||||||
theme,
|
let scene_count = self.scenes().len();
|
||||||
Bsp::s(
|
let selected = self.selection();
|
||||||
button_3("t", "rack ", if let Some(track) = self.selection().track() {
|
let button = Bsp::s(
|
||||||
format!("{track}/{}", self.tracks().len())
|
button_3("t", "rack ", format!("{}{track_count}", selected.track()
|
||||||
} else {
|
.map(|track|format!("{track}/")).unwrap_or_default()), false),
|
||||||
format!("{}", self.tracks().len())
|
button_3("s", "cene ", format!("{}{scene_count}", selected.scene()
|
||||||
}, false),
|
.map(|scene|format!("{scene}/")).unwrap_or_default()), false));
|
||||||
button_3("s", "cene ", if let Some(scene) = self.selection().scene() {
|
let button_2 = Bsp::s(
|
||||||
format!("{scene}/{}", self.scenes().len())
|
button_2("T", "+", false),
|
||||||
} else {
|
button_2("S", "+", false));
|
||||||
format!("{}", self.scenes().len())
|
Self::view_track_row_section(theme, button, button_2, Tui::bg(theme.darker.rgb,
|
||||||
}, false)
|
Fixed::y(2, Fill::x(Stack::east(move|add|{
|
||||||
),
|
for (index, track, _x1, _x2) in self.tracks_with_sizes() {
|
||||||
Bsp::s(
|
add(&Fixed::x(self.track_width(index, track),
|
||||||
button_2("T", "+", false),
|
Tui::bg(if selected.track() == Some(index) {
|
||||||
button_2("S", "+", false),
|
track.color.light.rgb
|
||||||
),
|
} else {
|
||||||
Tui::bg(theme.darker.rgb, Fixed::y(2, Fill::x(
|
track.color.base.rgb
|
||||||
Stack::east(move|add: &mut dyn FnMut(&dyn Render<TuiOut>)|{
|
}, Bsp::s(Fill::x(Align::nw(Bsp::e(
|
||||||
for (index, track, _x1, _x2) in self.tracks_with_sizes() {
|
format!("·t{index:02} "),
|
||||||
add(&Fixed::x(self.track_width(index, track),
|
Tui::fg(Rgb(255, 255, 255), Tui::bold(true, &track.name))
|
||||||
Tui::bg(if self.selection().track() == Some(index) {
|
))), ""))) );
|
||||||
track.color.light.rgb
|
}
|
||||||
} else {
|
})))))
|
||||||
track.color.base.rgb
|
|
||||||
}, Bsp::s(Fill::x(Align::nw(Bsp::e(
|
|
||||||
format!("·t{index:02} "),
|
|
||||||
Tui::fg(Rgb(255, 255, 255), Tui::bold(true, &track.name))
|
|
||||||
))), ""))) );
|
|
||||||
}
|
|
||||||
})))))
|
|
||||||
}
|
}
|
||||||
fn view_track_outputs <'a> (&'a self, theme: ItemTheme, _h: u16) -> impl Content<TuiOut> {
|
fn view_track_outputs <'a> (&'a self, theme: ItemTheme, _h: u16) -> impl Content<TuiOut> {
|
||||||
self.view_track_row_section(theme,
|
Self::view_track_row_section(theme,
|
||||||
Bsp::s(
|
Bsp::s(
|
||||||
Fill::x(Align::w(button_2("o", "utput", false))),
|
Fill::x(Align::w(button_2("o", "utput", false))),
|
||||||
Fill::xy(Stack::south(|add: &mut dyn FnMut(&dyn Render<TuiOut>)|{
|
Fill::xy(Stack::south(|add|{
|
||||||
for port in self.midi_outs().iter() {
|
for port in self.midi_outs().iter() {
|
||||||
add(&Fill::x(Align::w(port.port_name())));
|
add(&Fill::x(Align::w(port.port_name())));
|
||||||
}
|
}
|
||||||
}))),
|
}))),
|
||||||
button_2("O", "+", false),
|
button_2("O", "+", false),
|
||||||
Tui::bg(theme.darker.rgb, Align::w(Fill::x(
|
Tui::bg(theme.darker.rgb, Align::w(Fill::x(
|
||||||
Stack::east(move|add: &mut dyn FnMut(&dyn Render<TuiOut>)|{
|
Stack::east(move|add|{
|
||||||
for (index, track, _x1, _x2) in self.tracks_with_sizes() {
|
for (index, track, _x1, _x2) in self.tracks_with_sizes() {
|
||||||
add(&Fixed::x(self.track_width(index, track),
|
add(&Fixed::x(self.track_width(index, track),
|
||||||
Align::nw(Fill::y(Map::south(1, ||track.sequencer.midi_outs.iter(),
|
Align::nw(Fill::y(Map::south(1, ||track.sequencer.midi_outs.iter(),
|
||||||
|
|
@ -210,12 +202,12 @@ pub trait TracksView:
|
||||||
for track in self.tracks().iter() {
|
for track in self.tracks().iter() {
|
||||||
h = h.max(track.sequencer.midi_ins.len() as u16);
|
h = h.max(track.sequencer.midi_ins.len() as u16);
|
||||||
}
|
}
|
||||||
self.view_track_row_section(
|
Self::view_track_row_section(
|
||||||
theme,
|
theme,
|
||||||
button_2("i", "nput", false),
|
button_2("i", "nput", false),
|
||||||
button_2("I", "+", false),
|
button_2("I", "+", false),
|
||||||
Tui::bg(theme.darker.rgb, Align::w(Fill::x(
|
Tui::bg(theme.darker.rgb, Align::w(Fill::x(
|
||||||
Stack::east(move|add: &mut dyn FnMut(&dyn Render<TuiOut>)|{
|
Stack::east(move|add|{
|
||||||
for (index, track, _x1, _x2) in self.tracks_with_sizes() {
|
for (index, track, _x1, _x2) in self.tracks_with_sizes() {
|
||||||
add(&Fixed::xy(self.track_width(index, track), h + 1,
|
add(&Fixed::xy(self.track_width(index, track), h + 1,
|
||||||
Align::nw(Bsp::s(
|
Align::nw(Bsp::s(
|
||||||
|
|
@ -268,7 +260,7 @@ pub trait ScenesView:
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
fn view_scenes_names (&self) -> impl Content<TuiOut> {
|
fn view_scenes_names (&self) -> impl Content<TuiOut> {
|
||||||
Fixed::x(20, Stack::south(move|add: &mut dyn FnMut(&dyn Render<TuiOut>)|{
|
Fixed::x(20, Stack::south(move|add|{
|
||||||
for (index, scene, ..) in self.scenes_with_sizes() {
|
for (index, scene, ..) in self.scenes_with_sizes() {
|
||||||
add(&self.view_scene_name(index, scene));
|
add(&self.view_scene_name(index, scene));
|
||||||
}
|
}
|
||||||
|
|
@ -309,7 +301,7 @@ pub trait ClipsView:
|
||||||
{
|
{
|
||||||
self.clips_size().of(Fill::xy(Bsp::a(
|
self.clips_size().of(Fill::xy(Bsp::a(
|
||||||
Fill::xy(Align::se(Tui::fg(Green, format!("{}x{}", self.clips_size().w(), self.clips_size().h())))),
|
Fill::xy(Align::se(Tui::fg(Green, format!("{}x{}", self.clips_size().w(), self.clips_size().h())))),
|
||||||
Stack::<TuiOut, _>::east(move|column: &mut dyn FnMut(&dyn Render<TuiOut>)|{
|
Stack::<TuiOut, _>::east(move|column|{
|
||||||
for (track_index, track, _, _) in self.tracks_with_sizes() {
|
for (track_index, track, _, _) in self.tracks_with_sizes() {
|
||||||
//column(&Fixed::x(5, Fill::xy(Tui::bg(Green, "kyp"))));
|
//column(&Fixed::x(5, Fill::xy(Tui::bg(Green, "kyp"))));
|
||||||
column(&Fixed::x(
|
column(&Fixed::x(
|
||||||
|
|
@ -321,7 +313,7 @@ pub trait ClipsView:
|
||||||
}
|
}
|
||||||
|
|
||||||
fn view_track_clips <'a> (&'a self, track_index: usize, track: &'a Track) -> impl Content<TuiOut> + 'a {
|
fn view_track_clips <'a> (&'a self, track_index: usize, track: &'a Track) -> impl Content<TuiOut> + 'a {
|
||||||
Stack::south(move|cell: &mut dyn FnMut(&dyn Render<TuiOut>)|{
|
Stack::south(move|cell|{
|
||||||
for (scene_index, scene, ..) in self.scenes_with_sizes() {
|
for (scene_index, scene, ..) in self.scenes_with_sizes() {
|
||||||
let (name, theme): (Arc<str>, ItemTheme) = if let Some(Some(clip)) = &scene.clips.get(track_index) {
|
let (name, theme): (Arc<str>, ItemTheme) = if let Some(Some(clip)) = &scene.clips.get(track_index) {
|
||||||
let clip = clip.read().unwrap();
|
let clip = clip.read().unwrap();
|
||||||
|
|
|
||||||
2
deps/tengri
vendored
2
deps/tengri
vendored
|
|
@ -1 +1 @@
|
||||||
Subproject commit d9081087ecc41ad8514c17614daab4f34d3e876d
|
Subproject commit 34982a12ba5a3ed989fc032fe490e9cc9cb57334
|
||||||
9
tek.edn
9
tek.edn
|
|
@ -57,13 +57,8 @@
|
||||||
(keys :clock :arranger :global)
|
(keys :clock :arranger :global)
|
||||||
:arranger)
|
:arranger)
|
||||||
|
|
||||||
(view :arranger (bsp/w :meters/output (bsp/e :meters/input
|
(view :arranger (bsp/n :status (bsp/w :meters/output (bsp/e :meters/input
|
||||||
(bsp/n (fixed/y 2 :status) (bsp/n :tracks/inputs
|
(bsp/n :tracks/inputs (bsp/s :tracks/outputs (bsp/s :tracks/names (bsp/s :tracks/devices
|
||||||
(bsp/s :tracks/devices (bsp/s :tracks/outputs (bsp/s :tracks/names
|
|
||||||
(fill/xy (either :mode/editor (bsp/e :scenes/names :editor) :scenes))))))))))
|
|
||||||
(view :arranger (bsp/w :meters/output (bsp/e :meters/input
|
|
||||||
(bsp/n (fixed/y 2 :status) (bsp/n :tracks/inputs
|
|
||||||
(bsp/s :tracks/devices (bsp/s :tracks/outputs (bsp/s :tracks/names
|
|
||||||
(fill/xy (either :mode/editor (bsp/e :scenes/names :editor) :scenes))))))))))
|
(fill/xy (either :mode/editor (bsp/e :scenes/names :editor) :scenes))))))))))
|
||||||
|
|
||||||
(keys :arranger (see :color :launch :scenes :tracks)
|
(keys :arranger (see :color :launch :scenes :tracks)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue