wip: sample selector

This commit is contained in:
🪞👃🪞 2024-07-20 19:47:42 +03:00
parent 4603bbd0da
commit f303a8d552
13 changed files with 278 additions and 125 deletions

View file

@ -1,11 +1,14 @@
//! Application state.
use crate::{core::*, devices::{arranger::*, sequencer::*, transport::*}};
use once_cell::sync::Lazy;
/// Global modal dialog
pub static MODAL: Lazy<Arc<Mutex<Option<Box<dyn Exit>>>>> =
Lazy::new(||Arc::new(Mutex::new(None)));
/// Root of application state.
pub struct App {
/// Optional modal dialog
pub modal: Option<Box<dyn Exit>>,
/// Whether the currently focused section has input priority
pub entered: bool,
/// Currently focused section
@ -38,11 +41,10 @@ impl App {
let xdg = Arc::new(microxdg::XdgApp::new("tek")?);
let first_run = crate::config::AppPaths::new(&xdg)?.should_create();
let jack = JackClient::Inactive(Client::new("tek", ClientOptions::NO_START_SERVER)?.0);
*MODAL.lock().unwrap() = first_run.then(||{
Exit::boxed(crate::devices::setup::SetupModal(Some(xdg.clone()), false))
});
Ok(Self {
modal: first_run.then(||{
Exit::boxed(crate::devices::setup::SetupModal(Some(xdg.clone()), false))
}),
entered: true,
section: AppFocus::default(),
transport: TransportToolbar::new(Some(jack.transport())),