fix(sheetset): safer sheet edits

- Place on Sheet gives its viewport a unique id (shared
  `Scene::next_viewport_id`, also used by the normal viewport commit).
- Renaming a sheet's layout in an open tab records undo and marks the tab
  modified; in a closed drawing the previous file is kept as `.bak`
  (ISAVEBAK) before it is written back.
- New Sheet saves the drawing before the `.dst`: a failed save leaves no
  sheet behind.
- Rename & Renumber Previous/Next no longer panics on an empty list.
- Leftovers: unused binding, a hard-coded localized Documents path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Hakan SevenandClaude Opus 5.5 committed 2026-10-06 09:29:23 +03:00
1 parent 8b9049c604
commit 40847d72a1
3 files changed
+79 -61

No files matched your search

+1 -19
View File
@@ -3417,25 +3417,7 @@ handles={handles_ms:.1} panel={:.1} ribbon={ribbon_ms:.1} tail={:.1} selected={}
{
// Assign a unique viewport ID (max existing id + 1, min 2).
if let codec::EntityType::Viewport(ref mut vp) = entity {
let layout_block = self.tabs[i].scene.current_layout_block_handle_pub();
let max_id = self.tabs[i]
.scene
.document
.entities()
.filter_map(|e| {
if let codec::EntityType::Viewport(v) = e {
if v.common.owner_handle == layout_block {
Some(v.id)
} else {
None
}
} else {
None
}
})
.max()
.unwrap_or(1);
vp.id = (max_id + 1).max(2);
vp.id = self.tabs[i].scene.next_viewport_id();
}
let layout = self.tabs[i].scene.current_layout.clone();