add Exit trait to modals

This commit is contained in:
🪞👃🪞 2024-07-12 16:05:16 +03:00
parent 0cc8d88e5f
commit 33e5f47526
6 changed files with 67 additions and 33 deletions

View file

@ -34,7 +34,7 @@ pub struct App {
/// Display buffer for sequencer
pub seq_buf: BufferedSequencerView,
/// Optional modal dialog
pub modal: Option<Box<dyn Component>>,
pub modal: Option<Box<dyn Exit>>,
/// Currently focused section
pub section: AppSection,
/// Whether the current focus section has input priority
@ -57,8 +57,6 @@ pub struct App {
xdg: Option<Arc<XdgApp>>,
/// Main audio outputs.
audio_outs: Vec<Arc<Port<Unowned>>>,
/// Tick enable?
metronome: bool,
/// Number of frames requested by process callback
chunk_size: usize,
@ -78,10 +76,8 @@ impl App {
chunk_size: 0,
entered: true,
jack: Some(jack),
metronome: false,
midi_in: None,
midi_ins: vec![],
modal: first_run.then(||crate::config::SetupModal(Some(xdg.clone())).boxed()),
note_cursor: 0,
note_start: 2,
scene_cursor: 1,
@ -92,6 +88,9 @@ impl App {
time_cursor: 0,
track_cursor: 1,
tracks: vec![],
modal: first_run.then(
||Exit::boxed(crate::config::SetupModal(Some(xdg.clone()), false))
),
xdg: Some(xdg),
})
}