P1e: persist undo and redo history across reloads
This commit is contained in:
@@ -141,6 +141,8 @@ pub struct ProjectData {
|
||||
pub cores: Vec<Core>,
|
||||
pub journal: Vec<JournalEntry>,
|
||||
pub seq: u64,
|
||||
pub history: Vec<ProjectEdit>,
|
||||
pub redo: Vec<ProjectEdit>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Serialize, Deserialize)]
|
||||
@@ -271,8 +273,8 @@ impl Session {
|
||||
cores: data.cores,
|
||||
journal: data.journal,
|
||||
project_name: data.name,
|
||||
history: Vec::new(),
|
||||
redo: Vec::new(),
|
||||
history: data.history,
|
||||
redo: data.redo,
|
||||
engine,
|
||||
};
|
||||
session.sanitize_faces();
|
||||
@@ -296,6 +298,14 @@ impl Session {
|
||||
!self.redo.is_empty()
|
||||
}
|
||||
|
||||
pub fn history(&self) -> &[ProjectEdit] {
|
||||
&self.history
|
||||
}
|
||||
|
||||
pub fn redo(&self) -> &[ProjectEdit] {
|
||||
&self.redo
|
||||
}
|
||||
|
||||
pub fn bpm(&self) -> f32 {
|
||||
self.bpm
|
||||
}
|
||||
@@ -1227,6 +1237,8 @@ mod tests {
|
||||
cores: vec![test_core()],
|
||||
journal: Vec::new(),
|
||||
seq: 0,
|
||||
history: Vec::new(),
|
||||
redo: Vec::new(),
|
||||
},
|
||||
);
|
||||
engine.clear();
|
||||
|
||||
Reference in New Issue
Block a user