WIP: Sheet Set Manager palette, wizard, properties and sheet set fields

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
ramox81andClaude Opus 5.5 committed 2026-10-05 09:10:17 +03:00
1 parent b8def31145
commit 0e1e13e524
44 files changed
+4752 -10

No files matched your search

+18
View File
@@ -71,6 +71,14 @@ impl FieldContext for OcsFieldContext<'_> {
os_date_locale()
}
fn sheet_sets(
&self,
f: &mut dyn FnMut(&codec::sheet_set::SheetSetDatabase) -> Option<String>,
) -> Option<String> {
let sets = SHEET_SETS.read().ok()?;
sets.iter().find_map(|db| f(db))
}
fn getenv(&self, name: &str) -> Option<String> {
#[cfg(not(target_arch = "wasm32"))]
{
@@ -84,6 +92,16 @@ impl FieldContext for OcsFieldContext<'_> {
}
}
/// The sheet sets open in the Sheet Set Manager, for `\AcSm` fields. The
/// manager replaces the list whenever a set opens, closes or changes.
static SHEET_SETS: std::sync::RwLock<Vec<codec::sheet_set::SheetSetDatabase>> = std::sync::RwLock::new(Vec::new());
pub fn set_sheet_sets(sets: Vec<codec::sheet_set::SheetSetDatabase>) {
if let Ok(mut guard) = SHEET_SETS.write() {
*guard = sets;
}
}
/// Re-evaluate the field hosted by entity `host` (usually an MTEXT), or `None`
/// to keep the cached text. Thin wrapper over the library engine.
pub fn resolve(document: &CadDocument, host: Handle) -> Option<String> {