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 SevenandClaude Opus 4.8 committed 2026-07-11 01:27:17 +03:00
1 parent 5c4ba97c5f
commit ba3b3202e8
20 files changed
+1085 -76

No files matched your search

+11 -1
View File
@@ -5,7 +5,15 @@ edition = "2021"
build = "build.rs"
[workspace]
members = ["crates/ocs_plugin_api"]
# `dwg-thumbnailer-win` is a Windows-only COM DLL (`#![cfg(windows)]`): it
# compiles to an empty cdylib on Linux/macOS and to the real handler on Windows,
# where the `build-windows` CI job (`cargo build --release`) compiles and thus
# verifies it.
members = [
"crates/ocs_plugin_api",
"crates/dwg-thumbnailer",
"crates/dwg-thumbnailer-win",
]
# Embed the application icon into the Windows .exe so Explorer, the taskbar,
# the Start-menu tile and file-association entries show it (issue #107).
@@ -50,6 +58,8 @@ clap = { version = "4", features = ["derive"] }
# Opt-in logging via --log / RUST_LOG (surfaces wgpu / iced / winit diagnostics).
env_logger = "0.11"
acadrust = "0.4"
# Shared DWG embedded-preview extraction (Start-page + file-manager thumbnails).
dwg-thumbnailer = { path = "crates/dwg-thumbnailer" }
flate2 = "1"
image = { version = "0.25", default-features = false, features = ["png", "jpeg", "bmp", "tiff"] }
inventory = "0.3"