fix(pdf): follow-ups to the PDF underlay merge

- Pin cadcodec upstream at d290dbe (the merged underlay change) and
  cadkernel at 4134ae3, which follows it; drop the fork patch, move the
  plugin-API and web-worker crates and the Python plugin lock to the same
  codec so one copy is built.
- "Import as block" with raster images left IMAGE entities without an
  image definition: block definition now creates it like add_entity does,
  through one shared helper.
- The three preview outlines (attach frame, clip boundary, import area)
  stay f64 instead of casting world points to f32.
- Page size / total / PDF scale entries use the catalog's positional
  placeholder; the bare {name} form failed to format in 20 locales.
- The Underlay Layers bulb is the SVG layer icon, not a text glyph.
- PDF dialogs use the shared dialog buttons and radios.
- Options opened from a PDF dialog clears its saved state on return.
- Paper-space underlay background reuses the model block handle already
  resolved; dead `let _ = i` lines and a misplaced doc comment removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Hakan SevenandClaude Opus 5.5 committed 2026-09-24 23:24:51 +03:00
1 parent 2e60c4da1b
commit d5016c7044
34 files changed
+129 -156

No files matched your search

+26 -22
View File
@@ -343,28 +343,7 @@ impl Scene {
None
};
// Auto-create an ImageDefinition object for new RasterImage entities
// that don't already reference one.
if let EntityType::RasterImage(ref mut img) = entity {
if img.definition_handle.is_none() {
use acadrust::objects::{ImageDefinition, ObjectType};
let def_handle = Handle::new(self.document.next_handle());
if self.is_recording_undo() {
self.record_undo_object_before(def_handle, None);
}
let mut img_def = ImageDefinition::with_dimensions(
&img.file_path,
img.size.x as u32,
img.size.y as u32,
);
img_def.handle = def_handle;
img_def.is_loaded = true;
self.document
.objects
.insert(def_handle, ObjectType::ImageDefinition(img_def));
img.definition_handle = Some(def_handle);
}
}
self.ensure_image_definition(&mut entity);
// Register the entity's layer if it names one no LAYER command created
// (e.g. a plugin-supplied layer) so it survives a DWG save instead of
@@ -1069,6 +1048,30 @@ impl Scene {
/// caller starts an interactive insert so paste-as-block can prompt for the
/// drop point. The geometry comes from the clipboard rather than live
/// entities, so there is nothing to stage or erase. (#129)
/// Give a new RasterImage the ImageDefinition object it must reference,
/// unless it already names one.
fn ensure_image_definition(&mut self, entity: &mut EntityType) {
let EntityType::RasterImage(img) = entity else {
return;
};
if img.definition_handle.is_some() {
return;
}
use acadrust::objects::{ImageDefinition, ObjectType};
let def_handle = Handle::new(self.document.next_handle());
if self.is_recording_undo() {
self.record_undo_object_before(def_handle, None);
}
let mut img_def =
ImageDefinition::with_dimensions(&img.file_path, img.size.x as u32, img.size.y as u32);
img_def.handle = def_handle;
img_def.is_loaded = true;
self.document
.objects
.insert(def_handle, ObjectType::ImageDefinition(img_def));
img.definition_handle = Some(def_handle);
}
pub fn define_block_from_owned_entities(
&mut self,
entities: Vec<EntityType>,
@@ -1125,6 +1128,7 @@ impl Scene {
Self::reset_clone_subhandles(&mut self.document, &mut entity);
entity.common_mut().handle = Handle::NULL;
entity.common_mut().owner_handle = br_handle;
self.ensure_image_definition(&mut entity);
let handle = self
.document
.add_entity(entity)