Write some amount of documentation

This commit is contained in:
2026-01-31 01:46:18 +01:00
parent 4772b02f77
commit 4f9b1f39f9
57 changed files with 2096 additions and 198 deletions

View File

@@ -281,6 +281,45 @@ impl App {
self.project_state.mark_dirty(change.bank, change.pattern);
}
pub fn execute_script_oneshot(
&self,
script: &str,
link: &LinkState,
audio_tx: &arc_swap::ArcSwap<Sender<crate::engine::AudioCommand>>,
) -> Result<(), String> {
let (bank, pattern) = self.current_bank_pattern();
let step_idx = self.editor_ctx.step;
let speed = self
.project_state
.project
.pattern_at(bank, pattern)
.speed
.multiplier();
let ctx = StepContext {
step: step_idx,
beat: link.beat(),
bank,
pattern,
tempo: link.tempo(),
phase: link.phase(),
slot: 0,
runs: 0,
iter: 0,
speed,
fill: false,
nudge_secs: 0.0,
};
let cmds = self.script_engine.evaluate(script, &ctx)?;
for cmd in cmds {
let _ = audio_tx
.load()
.send(crate::engine::AudioCommand::Evaluate { cmd, time: None });
}
Ok(())
}
pub fn compile_current_step(&mut self, link: &LinkState) {
let step_idx = self.editor_ctx.step;
let (bank, pattern) = self.current_bank_pattern();
@@ -1117,12 +1156,20 @@ impl App {
AppCommand::PageDown => self.page.down(),
// Help navigation
AppCommand::HelpNextTopic => {
self.ui.help_topic = (self.ui.help_topic + 1) % help_view::topic_count();
AppCommand::HelpToggleFocus => {
use crate::state::HelpFocus;
self.ui.help_focus = match self.ui.help_focus {
HelpFocus::Topics => HelpFocus::Content,
HelpFocus::Content => HelpFocus::Topics,
};
}
AppCommand::HelpPrevTopic => {
AppCommand::HelpNextTopic(n) => {
let count = help_view::topic_count();
self.ui.help_topic = (self.ui.help_topic + count - 1) % count;
self.ui.help_topic = (self.ui.help_topic + n) % count;
}
AppCommand::HelpPrevTopic(n) => {
let count = help_view::topic_count();
self.ui.help_topic = (self.ui.help_topic + count - (n % count)) % count;
}
AppCommand::HelpScrollDown(n) => {
let s = self.ui.help_scroll_mut();