forked from 1b-agent/opencadstudio-upstream
feat(python): text and dimension styles (doc.text_styles, doc.dim_styles)
Extends TableOperation with text style create/modify, dimension style create/modify (DimStyle fields as a validated JSON object), rename, delete and set-current. Reuses OCS's style in-use scan and reference-following rename (four style_ops methods widened to pub(super)); a renamed text style also updates dimension styles that name it. Real-IPC audit with DWG/DXF persistence and undo, IPC and Python unit tests, docs. Four cadcodec findings are pinned by canaries. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b7b6e2cef5
commit
aaea15e4ef
11 files changed
+894
-8
No files matched your search
@@ -271,7 +271,7 @@ impl OpenCADStudio {
|
||||
}
|
||||
}
|
||||
|
||||
fn style_exists(&self, kind: StyleKind, name: &str) -> bool {
|
||||
pub(super) fn style_exists(&self, kind: StyleKind, name: &str) -> bool {
|
||||
self.style_names(kind)
|
||||
.iter()
|
||||
.any(|n| n.eq_ignore_ascii_case(name))
|
||||
@@ -308,7 +308,7 @@ impl OpenCADStudio {
|
||||
|
||||
/// Refresh anything that mirrors the style list / current style after a
|
||||
/// mutation (ribbon dropdowns, geometry that depends on the style).
|
||||
fn after_style_change(&mut self, kind: StyleKind) {
|
||||
pub(super) fn after_style_change(&mut self, kind: StyleKind) {
|
||||
if kind.in_ribbon() {
|
||||
self.sync_ribbon_styles();
|
||||
}
|
||||
@@ -405,7 +405,7 @@ impl OpenCADStudio {
|
||||
false
|
||||
}
|
||||
|
||||
fn remove_style_storage(&mut self, kind: StyleKind, name: &str) -> bool {
|
||||
pub(super) fn remove_style_storage(&mut self, kind: StyleKind, name: &str) -> bool {
|
||||
let doc = &mut self.tabs[self.active_tab].scene.document;
|
||||
match kind {
|
||||
StyleKind::Text => doc.text_styles.remove(name).is_some(),
|
||||
@@ -541,7 +541,7 @@ impl OpenCADStudio {
|
||||
|
||||
/// Rename `old`→`new` in the backing store, re-keying table entries and
|
||||
/// rewriting name-based references + current-style pointers.
|
||||
fn rename_style_storage(&mut self, kind: StyleKind, old: &str, new: &str) {
|
||||
pub(super) fn rename_style_storage(&mut self, kind: StyleKind, old: &str, new: &str) {
|
||||
let i = self.active_tab;
|
||||
match kind {
|
||||
StyleKind::Text => {
|
||||
|
||||
Reference in new issue
Block a user