enable menu modal

This commit is contained in:
🪞👃🪞 2025-04-26 18:02:11 +03:00
parent a0cc88ff26
commit cc94b3485e

View file

@ -40,70 +40,48 @@ expose!([self: Tek] {
impose!([app: Tek] { impose!([app: Tek] {
TekCommand => { TekCommand => {
("help" [] ("menu" [] Some(Self::ToggleMenu))
Some(Self::ToggleHelp)) ("help" [] Some(Self::ToggleHelp))
("stop" [] ("stop" [] Some(Self::StopAll))
Some(Self::StopAll)) ("undo" [d: usize] Some(Self::History(-(d.unwrap_or(0)as isize))))
("undo" [d: usize] ("redo" [d: usize] Some(Self::History(d.unwrap_or(0) as isize)))
Some(Self::History(-(d.unwrap_or(0)as isize)))) ("zoom" [z: usize] Some(Self::Zoom(z)))
("redo" [d: usize] ("edit" [] Some(Self::Edit(None)))
Some(Self::History(d.unwrap_or(0) as isize))) ("edit" [c: bool] Some(Self::Edit(c)))
("zoom" [z: usize] ("color" [] Some(Self::Color(ItemPalette::random())))
Some(Self::Zoom(z))) ("color" [c: Color] Some(Self::Color(c.map(ItemPalette::from).expect("no color"))))
("edit" [] ("enqueue" [c: Arc<RwLock<MidiClip>>] Some(Self::Enqueue(c)))
Some(Self::Edit(None))) ("launch" [] Some(Self::Launch))
("edit" [c: bool] ("scene" [,..a] SceneCommand::try_from_expr(app, a).map(Self::Scene))
Some(Self::Edit(c))) ("track" [,..a] TrackCommand::try_from_expr(app, a).map(Self::Track))
("color" [] ("input" [,..a] InputCommand::try_from_expr(app, a).map(Self::Input))
Some(Self::Color(ItemPalette::random()))) ("output" [,..a] OutputCommand::try_from_expr(app, a).map(Self::Output))
("color" [c: Color] ("select" [t: Selection] Some(t.map(Self::Select).expect("no selection")))
Some(Self::Color(c.map(ItemPalette::from).expect("no color")))) ("clip" [,..a] ClipCommand::try_from_expr(app, a)
("enqueue" [c: Arc<RwLock<MidiClip>>] .map(Self::Clip))
Some(Self::Enqueue(c))) ("clock" [,..a] ClockCommand::try_from_expr(app.clock(), a)
("launch" [] .map(Self::Clock))
Some(Self::Launch)) ("editor" [,..a] MidiEditCommand::try_from_expr(app.editor.as_ref().expect("no editor"), a)
("clip" [,..a] .map(Self::Editor))
ClipCommand::try_from_expr(app, a).map(Self::Clip)) ("pool" [,..a] PoolCommand::try_from_expr(app.pool.as_ref().expect("no pool"), a)
("clock" [,..a] .map(Self::Pool))
ClockCommand::try_from_expr(app.clock(), a).map(Self::Clock)) ("select" [t: usize, s: usize] Some(match (t.expect("no track"), s.expect("no scene")) {
("editor" [,..a]
MidiEditCommand::try_from_expr(app.editor.as_ref().expect("no editor"), a).map(Self::Editor))
("pool" [,..a]
PoolCommand::try_from_expr(app.pool.as_ref().expect("no pool"), a).map(Self::Pool))
//("sampler" [,..a]
// Self::Sampler( //SamplerCommand::try_from_expr(app.sampler().as_ref().expect("no sampler"), a).expect("invalid command")))
("scene" [,..a]
SceneCommand::try_from_expr(app, a).map(Self::Scene))
("track" [,..a]
TrackCommand::try_from_expr(app, a).map(Self::Track))
("input" [,..a]
InputCommand::try_from_expr(app, a).map(Self::Input))
("output" [,..a]
OutputCommand::try_from_expr(app, a).map(Self::Output))
("select" [t: Selection]
Some(t.map(Self::Select).expect("no selection")))
("select" [t: usize, s: usize]
Some(match (t.expect("no track"), s.expect("no scene")) {
(0, 0) => Self::Select(Selection::Mix), (0, 0) => Self::Select(Selection::Mix),
(t, 0) => Self::Select(Selection::Track(t)), (t, 0) => Self::Select(Selection::Track(t)),
(0, s) => Self::Select(Selection::Scene(s)), (0, s) => Self::Select(Selection::Scene(s)),
(t, s) => Self::Select(Selection::Clip(t, s)), (t, s) => Self::Select(Selection::Clip(t, s)),
})) }))
//("sampler" [,..a]
// Self::Sampler( //SamplerCommand::try_from_expr(app.sampler().as_ref().expect("no sampler"), a).expect("invalid command")))
} }
ClipCommand => { ClipCommand => {
("get" [a: usize, b: usize] ("get" [a: usize, b: usize] Some(Self::Get(a.unwrap(), b.unwrap())))
Some(Self::Get(a.unwrap(), b.unwrap()))) ("put" [a: usize, b: usize, c: Option<Arc<RwLock<MidiClip>>>] Some(Self::Put(a.unwrap(), b.unwrap(), c.unwrap())))
("put" [a: usize, b: usize, c: Option<Arc<RwLock<MidiClip>>>] ("enqueue" [a: usize, b: usize] Some(Self::Enqueue(a.unwrap(), b.unwrap())))
Some(Self::Put(a.unwrap(), b.unwrap(), c.unwrap()))) ("edit" [a: Option<Arc<RwLock<MidiClip>>>] Some(Self::Edit(a.unwrap())))
("enqueue" [a: usize, b: usize] ("loop" [a: usize, b: usize, c: bool] Some(Self::SetLoop(a.unwrap(), b.unwrap(), c.unwrap())))
Some(Self::Enqueue(a.unwrap(), b.unwrap()))) ("color" [a: usize, b: usize] Some(Self::SetColor(a.unwrap(), b.unwrap(), ItemPalette::random())))
("edit" [a: Option<Arc<RwLock<MidiClip>>>]
Some(Self::Edit(a.unwrap())))
("loop" [a: usize, b: usize, c: bool]
Some(Self::SetLoop(a.unwrap(), b.unwrap(), c.unwrap())))
("color" [a: usize, b: usize]
Some(Self::SetColor(a.unwrap(), b.unwrap(), ItemPalette::random())))
} }
InputCommand => { InputCommand => {
@ -115,43 +93,26 @@ impose!([app: Tek] {
} }
SceneCommand => { SceneCommand => {
("add" [] ("add" [] Some(Self::Add))
Some(Self::Add)) ("del" [a: usize] Some(Self::Del(0)))
("del" [a: usize] ("zoom" [a: usize] Some(Self::SetZoom(a.unwrap())))
Some(Self::Del(0))) ("color" [a: usize] Some(Self::SetColor(a.unwrap(), ItemPalette::G[128])))
("zoom" [a: usize] ("enqueue" [a: usize] Some(Self::Enqueue(a.unwrap())))
Some(Self::SetZoom(a.unwrap()))) ("swap" [a: usize, b: usize] Some(Self::Swap(a.unwrap(), b.unwrap())))
("color" [a: usize]
Some(Self::SetColor(a.unwrap(), ItemPalette::G[128])))
("enqueue" [a: usize]
Some(Self::Enqueue(a.unwrap())))
("swap" [a: usize, b: usize]
Some(Self::Swap(a.unwrap(), b.unwrap())))
} }
TrackCommand => { TrackCommand => {
("add" [] ("add" [] Some(Self::Add))
Some(Self::Add)) ("size" [a: usize] Some(Self::SetSize(a.unwrap())))
("size" [a: usize] ("zoom" [a: usize] Some(Self::SetZoom(a.unwrap())))
Some(Self::SetSize(a.unwrap()))) ("color" [a: usize] Some(Self::SetColor(a.unwrap(), ItemPalette::random())))
("zoom" [a: usize] ("del" [a: usize] Some(Self::Del(a.unwrap())))
Some(Self::SetZoom(a.unwrap()))) ("stop" [a: usize] Some(Self::Stop(a.unwrap())))
("color" [a: usize] ("swap" [a: usize, b: usize] Some(Self::Swap(a.unwrap(), b.unwrap())))
Some(Self::SetColor(a.unwrap(), ItemPalette::random()))) ("play" [] Some(Self::TogglePlay))
("del" [a: usize] ("solo" [] Some(Self::ToggleSolo))
Some(Self::Del(a.unwrap()))) ("rec" [] Some(Self::ToggleRecord))
("stop" [a: usize] ("mon" [] Some(Self::ToggleMonitor))
Some(Self::Stop(a.unwrap())))
("swap" [a: usize, b: usize]
Some(Self::Swap(a.unwrap(), b.unwrap())))
("play" []
Some(Self::TogglePlay))
("solo" []
Some(Self::ToggleSolo))
("rec" []
Some(Self::ToggleRecord))
("mon" []
Some(Self::ToggleMonitor))
} }
}); });
@ -169,7 +130,10 @@ defcom! { |self, app: Tek|
} }
ToggleMenu => { ToggleMenu => {
app.modal = Some(Modal::Menu); app.modal = match app.modal {
Some(Modal::Menu) => None,
_ => Some(Modal::Menu)
};
None None
} }