diff --git a/src/app.rs b/src/app.rs index 58057bf4..e362debd 100644 --- a/src/app.rs +++ b/src/app.rs @@ -59,11 +59,11 @@ impl App { /// Create a new application instance from a backend, project, config, and mode /// /// ``` - /// let jack = tek::tengri::Jack::new(&"test_tek").expect("failed to connect to jack"); + /// let jack = tek::tengri::sing::Jack::new(&"test_tek").expect("failed to connect to jack"); /// let proj = tek::Arrangement::default(); /// let mut conf = tek::Config::default(); /// conf.add("(mode hello)"); - /// let tek = tek::tek(&jack, proj, conf, "hello"); + /// let tek = tek::App::new(&jack, proj, conf, "hello"); /// ``` pub fn new ( jack: &Jack<'static>, project: Arrangement, config: Config, mode: impl AsRef @@ -523,15 +523,7 @@ fn tek_word (state: &App, to: &mut Tui, dsl: &impl Expression) -> Usually h_exact(Some(6), w_min(Some(30), thunk(|to: &mut Tui|{ - let f = Rgb(224, 192, 128); - for (index, name) in ["session1", "session2", "session3"].iter().enumerate() { - let b = if index == 0 { Rgb(50,50,50) } else { Rgb(40,40,40) }; - y_push((2 * index) as u16, - &h_exact(2, w_full(bg(b, origin_w(fg(f, name)))))).draw(to); - } - Ok(to.area().into()) - }))).draw(to), + Some(":sessions") => view_sessions().draw(to), Some(":browse/title") => w_full(origin_w(field_v(ItemTheme::default(), match state.dialog.browser_target().unwrap() { @@ -562,7 +554,7 @@ fn tek_word (state: &App, to: &mut Tui, dsl: &impl Expression) -> Usually, body: &impl Lang /// /// ``` /// let lang = "(@x (nop)) (@y (nop) (nop))"; -/// let bind = tek::Bind::>::load(&lang).unwrap(); +/// let bind = tek::Bind::>::load(&lang).unwrap(); /// assert_eq!(bind.query(&'x'.into()).map(|x|x.len()), Some(1)); /// //assert_eq!(bind.query(&'y'.into()).map(|x|x.len()), Some(2)); /// ``` diff --git a/src/app/cli.rs b/src/app/cli.rs index 8c03d5b7..28c75e27 100644 --- a/src/app/cli.rs +++ b/src/app/cli.rs @@ -98,7 +98,7 @@ impl Action { } => { let name = name.as_ref().map_or("tek", |x|x.as_str()); let jack = Jack::new(&name)?; - let proj = tek_project_new( + let mut proj = tek_project_new( &jack, Clock::new(&jack, *bpm)?, &lf, <, &rf, &rt, &mf, &mt, &mfr, &mtr )?; proj.tracks_add(tracks.unwrap_or(0), None, &[], &[])?; @@ -135,7 +135,8 @@ impl Action { //// FIXME: They don't work properly. //Ok(app) //})?)?; - } + }, + _ => todo!() } Ok(()) } diff --git a/src/app/view.rs b/src/app/view.rs index b11832a8..ca56d703 100644 --- a/src/app/view.rs +++ b/src/app/view.rs @@ -23,9 +23,9 @@ pub fn view_logo () -> impl Draw { } /// ``` -/// let x = std::sync::Arc::>::default(); -/// let _ = tek::view_transport(true, x.clone(), x.clone(), x.clone()); -/// let _ = tek::view_transport(false, x.clone(), x.clone(), x.clone()); +/// let x = ""; +/// let _ = tek::view_transport(true, x.as_ref(), x.as_ref(), x.as_ref()); +/// let _ = tek::view_transport(false, x.as_ref(), x.as_ref(), x.as_ref()); /// ``` pub fn view_transport (play: bool, bpm: &str, beat: &str, time: &str) -> impl Draw { let theme = ItemTheme::G[96]; @@ -40,9 +40,9 @@ pub fn view_transport (play: bool, bpm: &str, beat: &str, time: &str) -> impl Dr } /// ``` -/// let x = std::sync::Arc::>::default(); -/// let _ = tek::view_status(None, x.clone(), x.clone(), x.clone()); -/// let _ = tek::view_status(Some("".into()), x.clone(), x.clone(), x.clone()); +/// let x = ""; +/// let _ = tek::view_status(None, x.as_ref(), x.as_ref(), x.as_ref()); +/// let _ = tek::view_status(Some("".into()), x.as_ref(), x.as_ref(), x.as_ref()); /// ``` pub fn view_status (sel: Option<&str>, sr: &str, buf: &str, lat: &str) -> impl Draw { let theme = ItemTheme::G[96]; @@ -569,3 +569,18 @@ pub fn field_h (theme: ItemTheme, head: impl Draw, body: impl Dra pub fn field_v (theme: ItemTheme, head: impl Draw, body: impl Draw) -> impl Draw { } + +pub fn view_sessions () -> impl Draw { + let h = 6; + let w = Some(30); + let f = Rgb(224, 192, 128); + h_exact(h, w_min(w, thunk(move |to: &mut Tui|{ + for (index, name) in ["session1", "session2", "session3"].iter().enumerate() { + let b = if index == 0 { Rgb(50,50,50) } else { Rgb(40,40,40) }; + let y = (2 * index) as u16; + let h = 2; + y_push(y, &h_exact(h, w_full(bg(b, origin_w(fg(f, name)))))).draw(to); + } + Ok(to.area().into()) + }))) +}