update docs and extract handle_modal

This commit is contained in:
🪞👃🪞 2024-07-13 23:29:51 +03:00
parent 81ea049773
commit f49615d598
9 changed files with 27 additions and 23 deletions

View file

@ -4,13 +4,8 @@ use crate::{core::*, handle, App, AppFocus};
handle!{
App |self, e| {
if let Some(ref mut modal) = self.modal {
if modal.handle(e)? {
if modal.exited() {
self.modal = None;
}
return Ok(true)
};
if handle_modal(self, e)? {
return Ok(true)
}
Ok(if self.entered {
handle_focused(self, e)?
@ -24,6 +19,18 @@ handle!{
}
}
fn handle_modal (state: &mut App, e: &AppEvent) -> Usually<bool> {
if let Some(ref mut modal) = state.modal {
if modal.handle(e)? {
if modal.exited() {
state.modal = None;
}
return Ok(true)
};
}
Ok(false)
}
fn handle_focused (state: &mut App, e: &AppEvent) -> Usually<bool> {
match state.section {
AppFocus::Transport =>

View file

@ -1,11 +1,2 @@
//! Music-making apparatuses.
//!
//! The following devices are provided:
//!
//! - Transport controller
//! - Arranger (clip launcher)
//! - Sequencer (phrase editor)
//! - Plugin (currently LV2 only)
//! - Sampler (currently 16bit samples only)
crate::core::pubmod!{arranger looper mixer plugin sampler sequencer transport}

View file

@ -1,4 +1,4 @@
/// Arrangement editor.
//! Clip launcher and arrangement editor.
use crate::{core::*, model::*, view::*};

View file

@ -1,6 +1,7 @@
//! TODO: audio looper (merge with [crate::devices::sampler::Sampler]?)
use crate::core::*;
/// TODO: audio looper. (Integrate with [crate::model::Sampler]?)
pub struct Looper {
pub name: String
}

View file

@ -1,4 +1,6 @@
use crate::{core::*, model::*};
//! TODO: audio mixer (merge with [crate::devices::arranger::Arranger]?)
use crate::core::*;
// TODO:
// - Meters: propagate clipping:
@ -10,7 +12,6 @@ use crate::{core::*, model::*};
//("Ins/Del", "Add/remove track"),
//];
/// TODO: audio mixer.
pub struct Mixer {
pub name: String,
pub tracks: Vec<MixerTrack>,

View file

@ -1,5 +1,6 @@
use crate::core::*;
//! Plugin (currently LV2 only; TODO other formats)
use crate::core::*;
use ::livi::{
World,
Instance,

View file

@ -1,5 +1,6 @@
use crate::{core::*, model::*};
//! Sampler (currently 16bit WAVs at system rate; TODO convert/resample)
use crate::{core::*, model::*};
/// Key bindings for sampler device.
pub const KEYMAP_SAMPLER: &'static [KeyBinding<Sampler>] = keymap!(Sampler {

View file

@ -1,4 +1,4 @@
/// Phrase editor.
//! Phrase editor.
use crate::{core::*, model::*, view::*};

View file

@ -1,3 +1,5 @@
//! Transport controller.
use crate::{core::*, view::*, model::App};
/// Key bindings for transport toolbar.