mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
browser with target action
This commit is contained in:
parent
b7152ef807
commit
c66a006120
10 changed files with 102 additions and 56 deletions
|
|
@ -67,7 +67,7 @@ impl App {
|
|||
}
|
||||
pub fn browser (&self) -> Option<&Browser> {
|
||||
self.dialog.as_ref().and_then(|dialog|match dialog {
|
||||
Dialog::Save(b) | Dialog::Load(b) => Some(b),
|
||||
Dialog::Browser(_, b) => Some(b),
|
||||
_ => None
|
||||
})
|
||||
}
|
||||
|
|
@ -156,11 +156,20 @@ pub enum Dialog {
|
|||
Menu(usize),
|
||||
Device(usize),
|
||||
Message(Message),
|
||||
Save(Browser),
|
||||
Load(Browser),
|
||||
Browser(BrowserTarget, Browser),
|
||||
Options,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum BrowserTarget {
|
||||
SaveProject,
|
||||
LoadProject,
|
||||
ImportSample(Arc<RwLock<Option<Sample>>>),
|
||||
ExportSample(Arc<RwLock<Option<Sample>>>),
|
||||
ImportClip(Arc<RwLock<Option<MidiClip>>>),
|
||||
ExportClip(Arc<RwLock<Option<MidiClip>>>),
|
||||
}
|
||||
|
||||
/// Various possible messages
|
||||
#[derive(PartialEq, Clone, Copy, Debug)]
|
||||
pub enum Message {
|
||||
|
|
@ -235,10 +244,22 @@ impl App {
|
|||
Some(Dialog::Menu(0))
|
||||
}
|
||||
fn dialog_save (&self) -> Option<Dialog> {
|
||||
Some(Dialog::Save(Default::default()))
|
||||
Some(Dialog::Browser(BrowserTarget::SaveProject, Default::default()))
|
||||
}
|
||||
fn dialog_load (&self) -> Option<Dialog> {
|
||||
Some(Dialog::Load(Default::default()))
|
||||
Some(Dialog::Browser(BrowserTarget::LoadProject, Default::default()))
|
||||
}
|
||||
fn dialog_import_clip (&self) -> Option<Dialog> {
|
||||
Some(Dialog::Browser(BrowserTarget::ImportClip(Default::default()), Default::default()))
|
||||
}
|
||||
fn dialog_export_clip (&self) -> Option<Dialog> {
|
||||
Some(Dialog::Browser(BrowserTarget::ExportClip(Default::default()), Default::default()))
|
||||
}
|
||||
fn dialog_import_sample (&self) -> Option<Dialog> {
|
||||
Some(Dialog::Browser(BrowserTarget::ImportSample(Default::default()), Default::default()))
|
||||
}
|
||||
fn dialog_export_sample (&self) -> Option<Dialog> {
|
||||
Some(Dialog::Browser(BrowserTarget::ExportSample(Default::default()), Default::default()))
|
||||
}
|
||||
fn dialog_options (&self) -> Option<Dialog> {
|
||||
Some(Dialog::Options)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue