fix(annotative): make scale-manager rename and edits actually persist

Double-click rename did nothing and ratio edits were lost when switching
scales — and on drawings saved by other programs nothing could be edited
at all.

- Fallback scales were virtual (no Scale objects), so edit/rename no-oped;
  materialize the standard set into real staged objects when the manager
  opens, reverted on close unless applied.
- On third-party DWGs the mutators walked the root named-objects dict ->
  ACAD_SCALELIST, which can be unreachable, and matched dictionary keys
  that are internal ids (*A1, A0) rather than scale names. Locate the
  scale-list dict robustly and match scales by object name + handle.
- Rename rows inline via double-click; repair a dangling current-scale
  header pointer on staged rollback.
- Stage text/mleader style-manager edits on switch so they persist like
  the scale manager.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hakan Seven 2026-07-13 14:37:33 +03:00
commit 70225de11f
8 changed files with 414 additions and 190 deletions

View file

@ -497,7 +497,9 @@ pub(super) fn on_text_style_dialog_open(&mut self) -> Task<Message> {
Task::none()
}
pub(super) fn on_text_style_apply(&mut self) -> Task<Message> {
/// Write the editor buffers into the selected text style (staged, no
/// commit), so edits survive switching to another style as well as Apply.
pub(super) fn stage_textstyle_bufs(&mut self) {
let i = self.active_tab;
let name = self.textstyle_selected.clone();
let font = self.textstyle_font.clone();
@ -520,6 +522,10 @@ pub(super) fn on_text_style_dialog_open(&mut self) -> Task<Message> {
s.height = h.max(0.0);
}
}
}
pub(super) fn on_text_style_apply(&mut self) -> Task<Message> {
self.stage_textstyle_bufs();
self.style_stage_commit();
Task::none()
}
@ -838,7 +844,9 @@ pub(super) fn on_text_style_dialog_open(&mut self) -> Task<Message> {
Task::none()
}
pub(super) fn on_mleader_style_apply(&mut self) -> Task<Message> {
/// Write the editor buffers into the selected multileader style (staged, no
/// commit), so edits survive switching to another style as well as Apply.
pub(super) fn stage_mleaderstyle_bufs(&mut self) {
let i = self.active_tab;
let (ld, lg, asz, th, sf, bg, fsa, ssa, mp, dt, lc, tc) = (
self.mls_landing_distance.parse::<f64>().ok(),
@ -920,6 +928,10 @@ pub(super) fn on_text_style_dialog_open(&mut self) -> Task<Message> {
s.block_content_scale_z = v;
}
}
}
pub(super) fn on_mleader_style_apply(&mut self) -> Task<Message> {
self.stage_mleaderstyle_bufs();
self.style_stage_commit();
Task::none()
}