Add file format version
This commit is contained in:
parent
56ed3b7c01
commit
57ef9e5e0e
|
|
@ -30,5 +30,7 @@ pub mod commands {
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
pub struct DocumentSnapshot {
|
pub struct DocumentSnapshot {
|
||||||
|
pub format_version_major: u16,
|
||||||
|
pub format_version_minor: u16,
|
||||||
pub canvas_elements: Vec<canvas::CanvasElement>,
|
pub canvas_elements: Vec<canvas::CanvasElement>,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -187,7 +187,7 @@ impl AppDelegate<StilettoState> for Delegate {
|
||||||
data.canvas.set_from_snapshot(document_snapshot);
|
data.canvas.set_from_snapshot(document_snapshot);
|
||||||
info!("Loaded file {}", file_info.path().display());
|
info!("Loaded file {}", file_info.path().display());
|
||||||
} else {
|
} else {
|
||||||
warn!("didn't work: {:?}", res_snapshot.err());
|
warn!("Error while loading {}: {:?}", file_info.path().display(), res_snapshot.err());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Handled::Yes;
|
return Handled::Yes;
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,8 @@ impl CanvasState {
|
||||||
|
|
||||||
pub fn get_document_snapshot(&self) -> DocumentSnapshot {
|
pub fn get_document_snapshot(&self) -> DocumentSnapshot {
|
||||||
DocumentSnapshot {
|
DocumentSnapshot {
|
||||||
|
format_version_major: 0,
|
||||||
|
format_version_minor: 1,
|
||||||
canvas_elements: self
|
canvas_elements: self
|
||||||
.versioned_canvas
|
.versioned_canvas
|
||||||
.get()
|
.get()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue