feat(annotative): add/remove drawing annotation scales

The drawing's annotation-scale list (ACAD_SCALELIST) is now editable, so the
set of scales offered by the status-bar scale pill can be grown or trimmed:

- Scene::add_scale / remove_scale create or drop a Scale object and its
  SCALELIST dictionary entry (creating the SCALELIST dictionary, and
  registering it in the root, for drawings that carry none).
- SCALELISTEDIT gains ADD <ratio> / DELETE <name> alongside the existing
  listing (e.g. `SCALELISTEDIT ADD 1:50`).
- The scale popup (model space) grows a delete affordance on each non-active
  scale and a "+ Add scale..." row that primes the command line. The current
  annotation scale is protected from deletion.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-07-13 10:18:05 +03:00
1 parent fc5e93dcc1
commit b1eba180eb
5 files changed
+233 -20

No files matched your search

+25
View File
@@ -1647,6 +1647,31 @@ impl OpenCADStudio {
self.scale_popup_open = false;
Task::none()
}
Message::ScaleListDelete(name) => {
let i = self.active_tab;
let current = self.tabs[i]
.scene
.document
.header
.current_annotation_scale
.clone();
// Keep the popup open so several can be removed in a row; never
// remove the current annotation scale out from under the drawing.
if !name.eq_ignore_ascii_case(&current) {
self.push_undo_snapshot(i, "SCALELISTEDIT");
if self.tabs[i].scene.remove_scale(&name) {
self.tabs[i].dirty = true;
}
}
Task::none()
}
Message::ScaleListAddPrompt => {
// Close the popup and prime the command line; the user types the
// ratio (e.g. 1:50) and commits it via SCALELISTEDIT ADD.
self.scale_popup_open = false;
self.command_line.input = "SCALELISTEDIT ADD ".to_string();
Task::none()
}
Message::ToggleLayoutList => {
self.layout_list_open ^= true;
Task::none()