feat(thumbnails): embed DWG previews and wire cross-platform file thumbnails

Round-trip a raster preview through the DWG's embedded preview slot and
surface it to the OS file managers, so drawings show their contents in
Explorer / Finder / Nautilus instead of a generic document icon.

OCS:
* io::thumbnail — rasterize the scene to a BMP DIB on save (embedded via
  acadrust's new Preview type) and read it back on open for the Start
  page recent list; `--dwg-thumbnail IN OUT SIZE` CLI extracts a badged
  PNG for external thumbnailers.
* io::file_association::install_thumbnailer — self-install the OS
  integration on startup: Linux writes a .thumbnailer + hicolor mimetype
  icons; Windows registers the IThumbnailProvider DLL under HKCU.

Shared core:
* crates/dwg-thumbnailer — lean (image-only) preview extractor + the
  `badge_dwg` full-width "DWG" band, used by every platform so the
  ribbon is single-sourced. Ships an rlib+staticlib.
* crates/dwg-thumbnailer-win — IThumbnailProvider COM in-proc server
  (cfg(windows), CI-built as a workspace member).
* macos/ — QuickLook thumbnail extension (Swift + C-ABI bridge to the
  core staticlib), assembled into a .appex.

Icons & packaging (single SVG source -> per-platform assets in CI):
* assets/mimetypes/image-vnd.{dwg,dxf}.svg — themed file icons.
* packaging: WiX ships dwg/dxf.ico + the thumbnail DLL and points the
  ProgIds at them; Info.plist gets CFBundleTypeIconFile + the QuickLook
  extension in Contents/PlugIns.
* release.yml — generate .ico (Windows) and .icns (macOS) from the SVGs,
  build the QuickLook .appex, and bundle everything.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hakan Seven 2026-07-11 01:27:17 +03:00
commit ba3b3202e8
20 changed files with 1085 additions and 76 deletions

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- OpenCADStudio DWG file-type icon (freedesktop mimetypes/image-vnd.dwg). -->
<svg viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<!-- Page -->
<path d="M12 3 H30 L40 13 V43 Q40 45 38 45 H12 Q10 45 10 43 V5 Q10 3 12 3 Z"
fill="#F4F4F5" stroke="#C4C4C8" stroke-width="0.8"/>
<!-- Folded corner -->
<path d="M30 3 V13 H40 Z" fill="#D9D9DC"/>
<path d="M30 3 V13 H40" fill="none" stroke="#C4C4C8" stroke-width="0.8"/>
<!-- Format band -->
<rect x="7" y="27" width="34" height="13" rx="2" fill="#B03020"/>
<text x="24" y="36.5" font-family="'DejaVu Sans','Helvetica',sans-serif"
font-weight="700" font-size="9" letter-spacing="0.5"
fill="#FFFFFF" text-anchor="middle">DWG</text>
</svg>

After

Width:  |  Height:  |  Size: 788 B

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- OpenCADStudio DXF file-type icon (freedesktop mimetypes/image-vnd.dxf). -->
<svg viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<!-- Page -->
<path d="M12 3 H30 L40 13 V43 Q40 45 38 45 H12 Q10 45 10 43 V5 Q10 3 12 3 Z"
fill="#F4F4F5" stroke="#C4C4C8" stroke-width="0.8"/>
<!-- Folded corner -->
<path d="M30 3 V13 H40 Z" fill="#D9D9DC"/>
<path d="M30 3 V13 H40" fill="none" stroke="#C4C4C8" stroke-width="0.8"/>
<!-- Format band -->
<rect x="7" y="27" width="34" height="13" rx="2" fill="#2C6FB0"/>
<text x="24" y="36.5" font-family="'DejaVu Sans','Helvetica',sans-serif"
font-weight="700" font-size="9" letter-spacing="0.5"
fill="#FFFFFF" text-anchor="middle">DXF</text>
</svg>

After

Width:  |  Height:  |  Size: 788 B