wip: providing subcommands

This commit is contained in:
🪞👃🪞 2025-05-09 21:17:22 +03:00
parent bfa0ea1163
commit 419a07de8c
3 changed files with 47 additions and 82 deletions

View file

@ -21,39 +21,6 @@ handle!(TuiIn: |self: App, input|Ok(if let Some(command) = self.config.keys.comm
fn _todo_isize_stub (&self) -> isize {
todo!()
}
fn _todo_clip_cmd_stub (&self) -> ClipCommand {
todo!()
}
fn _todo_clock_cmd_stub (&self) -> ClockCommand {
todo!()
}
fn _todo_sampler_cmd_stub (&self) -> SamplerCommand {
todo!()
}
fn _todo_pool_cmd_stub (&self) -> PoolCommand {
todo!()
}
fn _todo_output_cmd_stub (&self) -> OutputCommand {
todo!()
}
fn _todo_input_cmd_stub (&self) -> InputCommand {
todo!()
}
fn _todo_midi_edit_cmd_stub (&self) -> MidiEditCommand {
todo!()
}
fn _todo_message_cmd_stub (&self) -> MessageCommand {
todo!()
}
fn _todo_scene_cmd_stub (&self) -> SceneCommand {
todo!()
}
fn _todo_device_cmd_stub (&self) -> DeviceCommand {
todo!()
}
fn _todo_track_cmd_stub (&self) -> TrackCommand {
todo!()
}
fn _todo_item_theme_stub (&self) -> ItemTheme {
todo!()
}
@ -209,18 +176,6 @@ handle!(TuiIn: |self: App, input|Ok(if let Some(command) = self.config.keys.comm
fn _todo_arc_str_stub (&self) -> Arc<str> {
todo!()
}
fn _todo_clip_command_stub (&self) -> PoolClipCommand {
todo!()
}
fn _todo_file_command_stub (&self) -> FileBrowserCommand {
todo!()
}
fn _todo_length_command_stub (&self) -> ClipLengthCommand {
todo!()
}
fn _todo_rename_command_stub (&self) -> ClipRenameCommand {
todo!()
}
fn clip_new (&self) -> MidiClip {
self.new_clip()
}
@ -352,6 +307,35 @@ handle!(TuiIn: |self: App, input|Ok(if let Some(command) = self.config.keys.comm
None
})
}
fn color (app: &mut App, theme: ItemTheme) -> Perhaps<Self> {
Ok(app.set_color(Some(theme)).map(|theme|Self::Color{theme}))
}
fn enqueue (app: &mut App, clip: Option<Arc<RwLock<MidiClip>>>) -> Perhaps<Self> {
todo!()
}
fn history (app: &mut App, delta: isize) -> Perhaps<Self> {
todo!()
}
fn zoom (app: &mut App, zoom: usize) -> Perhaps<Self> {
todo!()
}
fn launch (app: &mut App) -> Perhaps<Self> {
app.launch();
Ok(None)
}
fn select (app: &mut App, selection: Selection) -> Perhaps<Self> {
app.select(selection);
Ok(None)
//("select" [t: usize, s: usize] Some(match (t.expect("no track"), s.expect("no scene")) {
//(0, 0) => Self::Select(Selection::Mix),
//(t, 0) => Self::Select(Selection::Track(t)),
//(0, s) => Self::Select(Selection::Scene(s)),
//(t, s) => Self::Select(Selection::TrackClip { track: t, scene: s }) })))
}
fn stop_all (app: &mut App) -> Perhaps<Self> {
app.stop_all();
Ok(None)
}
fn sampler (app: &mut App, command: SamplerCommand) -> Perhaps<Self> {
Ok(app.sampler_mut()
.map(|s|command.delegate(s, |command|Self::Sampler{command}))
@ -382,34 +366,26 @@ handle!(TuiIn: |self: App, input|Ok(if let Some(command) = self.config.keys.comm
fn message (app: &mut App, command: MessageCommand) -> Perhaps<Self> {
Ok(command.delegate(app, |command|Self::Message{command})?)
}
fn color (app: &mut App, theme: ItemTheme) -> Perhaps<Self> {
Ok(app.set_color(Some(theme)).map(|theme|Self::Color{theme}))
}
fn enqueue (app: &mut App, clip: Option<Arc<RwLock<MidiClip>>>) -> Perhaps<Self> {
todo!()
impl<'state> Context<'state, ClockCommand> for App {
fn get <'source> (&'state self, iter: &mut TokenIter<'source>) -> Option<ClockCommand> {
Context::get(&self.clock, iter)
}
fn history (app: &mut App, delta: isize) -> Perhaps<Self> {
todo!()
}
fn zoom (app: &mut App, zoom: usize) -> Perhaps<Self> {
todo!()
impl<'state> Context<'state, MidiEditCommand> for App {
fn get <'source> (&'state self, iter: &mut TokenIter<'source>) -> Option<MidiEditCommand> {
self.editor().map(|e|Context::get(e, iter)).flatten()
}
fn launch (app: &mut App) -> Perhaps<Self> {
app.launch();
Ok(None)
}
fn select (app: &mut App, selection: Selection) -> Perhaps<Self> {
app.select(selection);
Ok(None)
//("select" [t: usize, s: usize] Some(match (t.expect("no track"), s.expect("no scene")) {
//(0, 0) => Self::Select(Selection::Mix),
//(t, 0) => Self::Select(Selection::Track(t)),
//(0, s) => Self::Select(Selection::Scene(s)),
//(t, s) => Self::Select(Selection::TrackClip { track: t, scene: s }) })))
impl<'state> Context<'state, PoolCommand> for App {
fn get <'source> (&'state self, iter: &mut TokenIter<'source>) -> Option<PoolCommand> {
self.pool().map(|p|Context::get(p, iter)).flatten()
}
fn stop_all (app: &mut App) -> Perhaps<Self> {
app.stop_all();
Ok(None)
}
impl<'state> Context<'state, SamplerCommand> for App {
fn get <'source> (&'state self, iter: &mut TokenIter<'source>) -> Option<SamplerCommand> {
self.sampler().map(|p|Context::get(p, iter)).flatten()
}
}

View file

@ -2,15 +2,4 @@ mod lv2_model; pub use self::lv2_model::*;
mod lv2_audio; pub use self::lv2_audio::*;
mod lv2_gui; pub use self::lv2_gui::*;
mod lv2_tui; pub use self::lv2_tui::*;
pub(self) use std::thread::JoinHandle;
pub(self) use ::livi::{
World,
Instance,
Plugin as LiviPlugin,
Features,
FeaturesBuilder,
Port as LiviPort,
event::LV2AtomSequence,
};

2
deps/tengri vendored

@ -1 +1 @@
Subproject commit 3bb38f2d27afc294349f72b1a2f7936bc9338d4f
Subproject commit 20ccff13de1957c1268c6fec64048d8ae1767fd5