mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-09 05:06:43 +01:00
down to 48 ugly ones
This commit is contained in:
parent
57eff50973
commit
4fe51b5267
9 changed files with 104 additions and 101 deletions
|
|
@ -43,16 +43,16 @@ handle!(TuiIn: |self: App, input|Ok(if let Some(command) = self.config.keys.comm
|
|||
todo!()
|
||||
}
|
||||
fn launch (app: &mut App) -> Perhaps<Self> {
|
||||
app.launch();
|
||||
app.project.launch();
|
||||
Ok(None)
|
||||
}
|
||||
fn select (app: &mut App, selection: Selection) -> Perhaps<Self> {
|
||||
app.arranger.select(selection);
|
||||
app.project.select(selection);
|
||||
if let Some(ref mut editor) = app.editor {
|
||||
editor.set_clip(match app.arranger.selected {
|
||||
editor.set_clip(match app.project.selected {
|
||||
Some(Selection::TrackClip { track, scene })
|
||||
if let Some(Some(Some(clip))) = app
|
||||
.arranger
|
||||
.project
|
||||
.scenes.get(scene)
|
||||
.map(|s|s.clips.get(track))
|
||||
=>
|
||||
|
|
@ -70,11 +70,11 @@ handle!(TuiIn: |self: App, input|Ok(if let Some(command) = self.config.keys.comm
|
|||
// autoedit: load focused clip in editor.
|
||||
}
|
||||
fn stop_all (app: &mut App) -> Perhaps<Self> {
|
||||
app.stop_all();
|
||||
app.tracks_stop_all();
|
||||
Ok(None)
|
||||
}
|
||||
fn sampler (app: &mut App, command: SamplerCommand) -> Perhaps<Self> {
|
||||
Ok(app.sampler_mut()
|
||||
Ok(app.project.sampler_mut()
|
||||
.map(|s|command.delegate(s, |command|Self::Sampler{command}))
|
||||
.transpose()?
|
||||
.flatten())
|
||||
|
|
@ -83,7 +83,7 @@ handle!(TuiIn: |self: App, input|Ok(if let Some(command) = self.config.keys.comm
|
|||
Ok(command.delegate(app, |command|Self::Arrange{command})?)
|
||||
}
|
||||
fn clock (app: &mut App, command: ClockCommand) -> Perhaps<Self> {
|
||||
Ok(command.execute(&mut app.clock)?.map(|command|Self::Clock{command}))
|
||||
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})?)
|
||||
|
|
@ -95,7 +95,7 @@ handle!(TuiIn: |self: App, input|Ok(if let Some(command) = self.config.keys.comm
|
|||
Ok(if let Some(editor) = app.editor.as_mut() {
|
||||
let undo = command.clone().delegate(editor, |command|AppCommand::Editor{command})?;
|
||||
// update linked sampler after editor action
|
||||
app.sampler_mut().map(|sampler|match command {
|
||||
app.project.sampler_mut().map(|sampler|match command {
|
||||
// autoselect: automatically select sample in sampler
|
||||
MidiEditCommand::SetNotePos { pos } => { sampler.set_note_pos(pos); },
|
||||
_ => {}
|
||||
|
|
@ -106,7 +106,7 @@ 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.pool.as_mut() {
|
||||
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 {
|
||||
|
|
@ -126,7 +126,7 @@ handle!(TuiIn: |self: App, input|Ok(if let Some(command) = self.config.keys.comm
|
|||
|
||||
impl<'state> Context<'state, ClockCommand> for App {
|
||||
fn get <'source> (&'state self, iter: &mut TokenIter<'source>) -> Option<ClockCommand> {
|
||||
Context::get(&self.clock, iter)
|
||||
Context::get(&self.clock(), iter)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -138,13 +138,13 @@ 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.pool().map(|p|Context::get(p, iter)).flatten()
|
||||
self.project.pool.map(|p|Context::get(p, iter)).flatten()
|
||||
}
|
||||
}
|
||||
|
||||
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()
|
||||
self.project.sampler().map(|p|Context::get(p, iter)).flatten()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue