Feat: add hidden mode and new documentation
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
//! Project and settings save/load.
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
@@ -10,6 +12,7 @@ use crate::state::StagedChange;
|
||||
use super::App;
|
||||
|
||||
impl App {
|
||||
/// Persist user preferences (audio, display, link, MIDI) via confy.
|
||||
pub fn save_settings(&self, link: &LinkState) {
|
||||
let settings = Settings {
|
||||
audio: crate::settings::AudioSettings {
|
||||
@@ -72,8 +75,12 @@ impl App {
|
||||
settings.save();
|
||||
}
|
||||
|
||||
/// Flush the editor, capture playing state, and write the project file.
|
||||
pub fn save(&mut self, path: PathBuf, link: &LinkState, snapshot: &SequencerSnapshot) {
|
||||
self.save_editor_to_step();
|
||||
if self.page == crate::page::Page::Script {
|
||||
self.save_script_from_editor();
|
||||
}
|
||||
self.project_state.project.sample_paths = self.audio.config.sample_paths.clone();
|
||||
self.project_state.project.tempo = link.tempo();
|
||||
self.project_state.project.playing_patterns = snapshot
|
||||
@@ -105,6 +112,7 @@ impl App {
|
||||
}
|
||||
}
|
||||
|
||||
/// Replace the current project, reset undo/variables, recompile, and restore playing patterns.
|
||||
fn apply_project(&mut self, project: model::Project, label: String, link: &LinkState) {
|
||||
let tempo = project.tempo;
|
||||
let playing = project.playing_patterns.clone();
|
||||
@@ -122,6 +130,8 @@ impl App {
|
||||
self.dict.lock().clear();
|
||||
|
||||
self.evaluate_prelude(link);
|
||||
self.load_script_to_editor();
|
||||
self.script_editor.dirty = true;
|
||||
|
||||
for (bank, pattern) in playing {
|
||||
self.playback.queued_changes.push(StagedChange {
|
||||
|
||||
Reference in New Issue
Block a user