Files
OneCAD-Draft/packaging/windows/main.wxs
T
Hakan SevenandClaude Opus 4.8 ba3b3202e8 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 <[email protected]>
2026-07-11 01:27:17 +03:00

287 lines
11 KiB
XML

<?xml version='1.0' encoding='windows-1252'?>
<!--
WiX source for the Windows MSI installer.
Build (CI / locally with WiX Toolset 3.x in PATH):
candle.exe -arch x64 -dVersion=<x.y.z> -dSource=target\release\OpenCADStudio.exe \
-dIcon=packaging\windows\AppIcon.ico packaging\windows\main.wxs \
-out packaging\windows\main.wixobj
light.exe packaging\windows\main.wixobj -ext WixUIExtension -out OpenCADStudio.msi
Provides:
* Per-machine install under Program Files\Open CAD Studio.
* Start Menu shortcut under Programs\Open CAD Studio.
* Desktop shortcut.
* File associations for .dwg and .dxf via a single ProgID; both
route through `OpenCADStudio.exe "%1"` so the OS hands the file
path to the app as argv[1] (consumed in OpenCADStudio::boot).
* Default Programs registration (Capabilities + RegisteredApplications)
so the app shows up in Settings > Default Apps and can be set as the
default handler for .dwg / .dxf.
* Standard Add/Remove Programs entry with icon.
* MajorUpgrade — installing a newer MSI replaces the old version.
-->
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
<Product
Id='*'
Name='Open CAD Studio'
UpgradeCode='bd6bceab-6c7a-4ce2-a62d-6ef06a92f8b1'
Manufacturer='Hakan Seven'
Language='1033'
Codepage='1252'
Version='$(var.Version)'>
<Package
Id='*'
Keywords='Installer'
Description='Open CAD Studio Installer'
Manufacturer='Hakan Seven'
InstallerVersion='450'
Languages='1033'
Compressed='yes'
InstallScope='perMachine'
SummaryCodepage='1252' />
<MajorUpgrade
Schedule='afterInstallInitialize'
DowngradeErrorMessage='A newer version of [ProductName] is already installed. Setup will now exit.' />
<Media Id='1' Cabinet='product.cab' EmbedCab='yes' />
<Icon Id='AppIcon.ico' SourceFile='$(var.Icon)' />
<Property Id='ARPPRODUCTICON' Value='AppIcon.ico' />
<Property Id='ARPHELPLINK' Value='https://github.com/HakanSeven12/OpenCADStudio' />
<Property Id='ARPURLINFOABOUT' Value='https://github.com/HakanSeven12/OpenCADStudio' />
<Property Id='ARPURLUPDATEINFO' Value='https://github.com/HakanSeven12/OpenCADStudio/releases' />
<Property Id='ARPCONTACT' Value='Hakan Seven' />
<Property Id='ARPCOMMENTS' Value='2D/3D CAD application for DWG and DXF drawings.' />
<!--
Hide "Repair" from the Apps & Features entry — there is no repair flow.
"Modify" is deliberately left enabled: WixUI_FeatureTree supports it, so
users can add/remove the optional Desktop shortcut feature later.
-->
<Property Id='ARPNOREPAIR' Value='1' />
<Directory Id='TARGETDIR' Name='SourceDir'>
<Directory Id='ProgramFiles64Folder'>
<Directory Id='APPLICATIONROOTDIRECTORY' Name='Open CAD Studio'>
<Component Id='MainExecutable' Guid='2900c116-e9a5-4650-8a4c-48c0987d1a33' Win64='yes'>
<File
Id='OpenCADStudioEXE'
Name='OpenCADStudio.exe'
DiskId='1'
Source='$(var.Source)'
KeyPath='yes'>
<Shortcut
Id='StartMenuShortcut'
Directory='ProgramMenuDir'
Name='Open CAD Studio'
Description='Launch Open CAD Studio'
WorkingDirectory='APPLICATIONROOTDIRECTORY'
Icon='AppIcon.ico'
IconIndex='0'
Advertise='yes' />
</File>
<!-- DWG/DXF file-type icons, generated from the mimetype SVGs
(CI: magick image-vnd.{dwg,dxf}.svg -> {dwg,dxf}.ico). -->
<File Id='DwgIco' Name='dwg.ico' DiskId='1' Source='packaging\windows\dwg.ico' />
<File Id='DxfIco' Name='dxf.ico' DiskId='1' Source='packaging\windows\dxf.ico' />
<!-- DWG thumbnail provider (IThumbnailProvider). Ships beside the
exe; OpenCADStudio self-registers it under HKCU on startup
(see file_association::install_thumbnailer). -->
<File
Id='DwgThumbDll'
Name='dwg_thumbnailer_win.dll'
DiskId='1'
Source='target\release\dwg_thumbnailer_win.dll' />
<!--
File associations. Two ProgIDs (one per extension) so the
`<Verb Id='open'>` rows don't collide on the same registry
primary key — both ProgIDs invoke the same exe with the
file path as `argv[1]`.
-->
<ProgId
Id='OpenCADStudio.DWG'
Description='DWG Drawing'
Icon='DwgIco'
IconIndex='0'>
<Extension Id='dwg' ContentType='image/vnd.dwg'>
<Verb Id='open' Command='Open' TargetFile='OpenCADStudioEXE' Argument='"%1"' />
</Extension>
</ProgId>
<ProgId
Id='OpenCADStudio.DXF'
Description='DXF Drawing'
Icon='DxfIco'
IconIndex='0'>
<Extension Id='dxf' ContentType='image/vnd.dxf'>
<Verb Id='open' Command='Open' TargetFile='OpenCADStudioEXE' Argument='"%1"' />
</Extension>
</ProgId>
</Component>
<!--
Default Programs registration. The ProgId/Extension rows above
register the handlers, but modern Windows (8+) guards the actual
default via a per-user UserChoice hash an installer can't forge.
Publishing Capabilities + a RegisteredApplications entry is the
supported way in: it makes Open CAD Studio appear in Settings >
Default Apps and the "Open with" list, so .dwg / .dxf can be set
to it. The keys are HKLM-wide, so the shell picks them up on its
next association query without a forced refresh.
-->
<Component Id='DefaultPrograms' Guid='6f3e9b2a-1c4d-4f8a-9b7e-2d5a8c1f0e63' Win64='yes'>
<!--
Applications\<exename>\DefaultIcon is what Windows shows in the
"Open with" context-menu list and "Choose another app" picker.
Without it the entry appears with a blank generic document icon.
-->
<RegistryValue
Root='HKLM'
Key='SOFTWARE\Classes\Applications\OpenCADStudio.exe\DefaultIcon'
Type='string'
Value='[APPLICATIONROOTDIRECTORY]OpenCADStudio.exe,0'
KeyPath='yes' />
<RegistryValue
Root='HKLM'
Key='SOFTWARE\Classes\Applications\OpenCADStudio.exe'
Name='FriendlyAppName'
Type='string'
Value='Open CAD Studio' />
<RegistryValue
Root='HKLM'
Key='SOFTWARE\Classes\Applications\OpenCADStudio.exe\shell\open\command'
Type='string'
Value='"[APPLICATIONROOTDIRECTORY]OpenCADStudio.exe" "%1"' />
<RegistryValue
Root='HKLM'
Key='SOFTWARE\Classes\Applications\OpenCADStudio.exe\SupportedTypes'
Name='.dwg'
Type='string'
Value='' />
<RegistryValue
Root='HKLM'
Key='SOFTWARE\Classes\Applications\OpenCADStudio.exe\SupportedTypes'
Name='.dxf'
Type='string'
Value='' />
<RegistryValue
Root='HKLM'
Key='Software\Open CAD Studio\Capabilities'
Name='ApplicationName'
Type='string'
Value='Open CAD Studio' />
<RegistryValue
Root='HKLM'
Key='Software\Open CAD Studio\Capabilities'
Name='ApplicationDescription'
Type='string'
Value='2D/3D CAD application for DWG and DXF drawings.' />
<RegistryValue
Root='HKLM'
Key='Software\Open CAD Studio\Capabilities\FileAssociations'
Name='.dwg'
Type='string'
Value='OpenCADStudio.DWG' />
<RegistryValue
Root='HKLM'
Key='Software\Open CAD Studio\Capabilities\FileAssociations'
Name='.dxf'
Type='string'
Value='OpenCADStudio.DXF' />
<RegistryValue
Root='HKLM'
Key='Software\RegisteredApplications'
Name='Open CAD Studio'
Type='string'
Value='Software\Open CAD Studio\Capabilities' />
</Component>
</Directory>
</Directory>
<Directory Id='ProgramMenuFolder'>
<Directory Id='ProgramMenuDir' Name='Open CAD Studio'>
<Component Id='ProgramMenuDirComp' Guid='34a788ba-f9d4-4e73-b1ff-9eb8749b369e'>
<RemoveFolder Id='ProgramMenuDir' On='uninstall' />
<RegistryValue
Root='HKCU'
Key='Software\Open CAD Studio'
Name='installed'
Type='integer'
Value='1'
KeyPath='yes' />
</Component>
</Directory>
</Directory>
<!--
Desktop shortcut. A non-advertised shortcut with an explicit Target;
the HKCU registry value is the component KeyPath (a shortcut on its own
cannot be a KeyPath for a per-user resource).
-->
<Directory Id='DesktopFolder' Name='Desktop'>
<Component Id='DesktopShortcutComp' Guid='c5c7f1c4-3d8a-4efd-b049-4662d9143dcd'>
<Shortcut
Id='DesktopShortcut'
Name='Open CAD Studio'
Description='Launch Open CAD Studio'
Target='[APPLICATIONROOTDIRECTORY]OpenCADStudio.exe'
WorkingDirectory='APPLICATIONROOTDIRECTORY'
Icon='AppIcon.ico'
IconIndex='0' />
<RegistryValue
Root='HKCU'
Key='Software\Open CAD Studio'
Name='desktop_shortcut'
Type='integer'
Value='1'
KeyPath='yes' />
</Component>
</Directory>
</Directory>
<Feature Id='Complete' Title='Open CAD Studio' Level='1' Display='expand'>
<ComponentRef Id='MainExecutable' />
<ComponentRef Id='DefaultPrograms' />
<ComponentRef Id='ProgramMenuDirComp' />
<!-- Optional, user-deselectable in the feature tree (default on). -->
<Feature
Id='DesktopShortcut'
Title='Desktop shortcut'
Description='Add a shortcut to Open CAD Studio on the desktop.'
Level='1'
Absent='allow'>
<ComponentRef Id='DesktopShortcutComp' />
</Feature>
</Feature>
<!--
Refresh the shell after install so the new .dwg / .dxf file-type icons
and associations appear immediately instead of only after a reboot or an
icon-cache rebuild. `ie4uinit -show` rebuilds the per-user icon cache.
Immediate execution keeps property access ([SystemFolder]); Return='ignore'
means it can never fail the install, and the NOT REMOVE condition skips it
on uninstall.
-->
<CustomAction
Id='RefreshShellIcons'
Directory='APPLICATIONROOTDIRECTORY'
ExeCommand='"[SystemFolder]ie4uinit.exe" -show'
Execute='immediate'
Return='ignore' />
<InstallExecuteSequence>
<Custom Action='RefreshShellIcons' After='InstallFinalize'>NOT REMOVE</Custom>
</InstallExecuteSequence>
<!-- Installer UI + finish-screen launch checkbox (see ui.wxs). -->
<UIRef Id='OpenCADStudioUI' />
</Product>
</Wix>