last small wave of 15 errors?

This commit is contained in:
🪞👃🪞 2025-05-14 17:15:27 +03:00
parent 4fe51b5267
commit 872c2d94d6
11 changed files with 181 additions and 189 deletions

View file

@ -30,9 +30,9 @@ handle!(TuiIn: |self: App, input|Ok(if let Some(command) = self.config.keys.comm
app.toggle_editor(Some(value));
Ok(None)
}
fn color (app: &mut App, theme: ItemTheme) -> Perhaps<Self> {
Ok(app.set_color(Some(theme)).map(|theme|Self::Color{theme}))
}
//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!()
}
@ -42,19 +42,18 @@ handle!(TuiIn: |self: App, input|Ok(if let Some(command) = self.config.keys.comm
fn zoom (app: &mut App, zoom: usize) -> Perhaps<Self> {
todo!()
}
fn launch (app: &mut App) -> Perhaps<Self> {
app.project.launch();
Ok(None)
}
//fn launch (app: &mut App) -> Perhaps<Self> {
//app.project.launch();
//Ok(None)
//}
fn select (app: &mut App, selection: Selection) -> Perhaps<Self> {
app.project.select(selection);
*app.project.selection_mut() = selection;
if let Some(ref mut editor) = app.editor {
editor.set_clip(match app.project.selected {
Some(Selection::TrackClip { track, scene })
if let Some(Some(Some(clip))) = app
editor.set_clip(match app.project.selection() {
Selection::TrackClip { track, scene } if let Some(Some(Some(clip))) = app
.project
.scenes.get(scene)
.map(|s|s.clips.get(track))
.scenes.get(*scene)
.map(|s|s.clips.get(*track))
=>
Some(clip),
_ =>
@ -79,14 +78,11 @@ handle!(TuiIn: |self: App, input|Ok(if let Some(command) = self.config.keys.comm
.transpose()?
.flatten())
}
fn arrange (app: &mut App, command: ArrangementCommand) -> Perhaps<Self> {
Ok(command.delegate(app, |command|Self::Arrange{command})?)
fn project (app: &mut App, command: ArrangementCommand) -> Perhaps<Self> {
Ok(command.delegate(&mut app.project, |command|Self::Project{command})?)
}
fn clock (app: &mut App, command: ClockCommand) -> Perhaps<Self> {
Ok(command.execute(&mut app.clock())?.map(|command|Self::Clock{command}))
}
fn device (app: &mut App, command: DeviceCommand) -> Perhaps<Self> {
Ok(command.delegate(app, |command|Self::Device{command})?)
Ok(command.execute(app.clock_mut())?.map(|command|Self::Clock{command}))
}
fn message (app: &mut App, command: MessageCommand) -> Perhaps<Self> {
Ok(command.delegate(app, |command|Self::Message{command})?)
@ -106,21 +102,20 @@ handle!(TuiIn: |self: App, input|Ok(if let Some(command) = self.config.keys.comm
})
}
fn pool (app: &mut App, command: PoolCommand) -> Perhaps<Self> {
Ok(if let Some(pool) = app.project.pool.as_mut() {
let undo = command.clone().delegate(pool, |command|AppCommand::Pool{command})?;
// update linked editor after pool action
app.editor.as_mut().map(|editor|match command {
// autoselect: automatically load selected clip in editor
PoolCommand::Select { .. } |
// autocolor: update color in all places simultaneously
PoolCommand::Clip { command: PoolClipCommand::SetColor { .. } } =>
editor.set_clip(pool.clip().as_ref()),
_ => {}
});
undo
} else {
None
})
let undo = command.clone().delegate(
&mut app.project.pool,
|command|AppCommand::Pool{command}
)?;
// update linked editor after pool action
app.editor.as_mut().map(|editor|match command {
// autoselect: automatically load selected clip in editor
PoolCommand::Select { .. } |
// autocolor: update color in all places simultaneously
PoolCommand::Clip { command: PoolClipCommand::SetColor { .. } } =>
editor.set_clip(app.project.pool.clip().as_ref()),
_ => {}
});
Ok(undo)
}
}
@ -138,7 +133,7 @@ impl<'state> Context<'state, MidiEditCommand> for App {
impl<'state> Context<'state, PoolCommand> for App {
fn get <'source> (&'state self, iter: &mut TokenIter<'source>) -> Option<PoolCommand> {
self.project.pool.map(|p|Context::get(p, iter)).flatten()
Context::get(&self.project.pool, iter)
}
}
@ -148,9 +143,15 @@ impl<'state> Context<'state, SamplerCommand> for App {
}
}
impl<'state> Context<'state, ArrangementCommand> for App {
fn get <'source> (&'state self, iter: &mut TokenIter<'source>) -> Option<ArrangementCommand> {
Context::get(&self.project, iter)
}
}
#[tengri_proc::command(App)] impl MessageCommand {
fn dismiss (app: &mut App) -> Perhaps<Self> {
app.message_dismiss();
app.dialog = None;
Ok(None)
}
}