PrinterInstallerMap: add map wizard page (TBitmapImage hotspots)
Implements the click-to-select site map UI on a custom Inno wizard page, replacing the blocked Edge .bat-download flow. - New record fields MapLeft, MapTop on PrinterDataArray; QueryPrinters pulls them from the api_printers.asp JSON via the existing JsonGetString helper. - BuildMapPage creates a custom wizard page (CreateCustomPage), places a stretched background TBitmapImage with the bundled site map BMP, then overlays one TBitmapImage per printer with a non-empty mapleft+maptop. Each hotspot is a 14x14 square with its own OnClick. - MapHotspotClick toggles PrinterSelectionPage.Values[I] for the linked printer and swaps the hotspot bitmap (gray<->lime) to reflect the new state. Two shared TBitmaps are pre-rendered once via TCanvas. - PrinterSelectionPage is re-anchored to PrinterMapPage.ID so the selections from the map flow into the existing checkbox page where the user can review and adjust. - ShouldSkipPage skips the map page when no printers have map coords, preserving legacy behaviour if api_printers.asp is not yet extended or if the database has no coordinates set. - Bundled sitemap2025-dark.bmp (880x680, ~1.7 MB) was scaled down from shopdb's sitemap2025-dark.png via PIL (Inno's TBitmap.LoadFromFile is BMP-only). Untested. Needs Inno Setup 6.x compile on Windows + the api_printers.asp extension to return mapleft, maptop. README documents the privileges model (admin required, supportuser at UAC) and the Inno class-subset gotchas verified during design. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -25,15 +25,36 @@ This variant replaces the web map UI with an in-installer wizard page so the ope
|
||||
|
||||
## Status
|
||||
|
||||
Stub. `.iss` header renamed; map wizard page not yet implemented. Tracked work:
|
||||
Map wizard page implemented end-to-end in `.iss`. Untested: needs Windows + Inno Setup 6.x compiler, plus the `api_printers.asp` extension below to return map coords. ShopDB rows that already have `mapleft + maptop` set will populate hotspots; rows missing coords fall through to the checkbox page (legacy behaviour).
|
||||
|
||||
- [ ] Extend `api_printers.asp` to return `mapleft, maptop`.
|
||||
- [ ] Add `sitemap2025-dark.png` to `[Files]`.
|
||||
- [ ] Implement `MapPage` Pascal procedure (TScrollBox + TImage + click-to-toggle hotspots).
|
||||
- [ ] Wire selected printer IDs into the existing `SelectedPrinters` array used by the checkbox page.
|
||||
- [ ] Code-signing cert (separate task - see project memory).
|
||||
- [ ] Rebuild + sign + bake into PXE image.
|
||||
Tracked work:
|
||||
|
||||
- [x] Add `MapLeft, MapTop` fields to `PrinterDataArray` record + `JsonGetString` parsing.
|
||||
- [x] Add `sitemap2025-dark.bmp` (880x680, scaled-down, ~1.7 MB) to `[Files]`. Inno's `TBitmap.LoadFromFile` is BMP-only, so the source PNG was converted with PIL.
|
||||
- [x] Implement `BuildMapPage` (`CreateCustomPage` + stretched background `TBitmapImage` + per-printer hotspot `TBitmapImage` overlays) and `MapHotspotClick` (toggles `PrinterSelectionPage.Values[I]` + swaps the hotspot's bitmap).
|
||||
- [x] Anchor `PrinterSelectionPage` after `PrinterMapPage.ID` (was after `wpWelcome`); checkbox page sees the map's selections.
|
||||
- [x] `ShouldSkipPage` skips the map page when no printers have map coords (graceful degrade if API is not yet extended).
|
||||
- [ ] **ShopDB**: extend `api_printers.asp` to return `mapleft, maptop` per printer row (additive change).
|
||||
- [ ] **Build**: Inno Setup compile on Windows. Target: `OutputBaseFilename=PrinterInstallerMap`.
|
||||
- [ ] **Code-signing cert**: `proudlock.tech` M365 artifact certs are not Authenticode (wrong EKU); pursue GE AD CS cert instead. See project memory note.
|
||||
- [ ] **Sign + bake into PXE image**.
|
||||
- [ ] **Test on win11 VM**: cold install, /PRINTER= silent path, map-only-vs-checkbox-only printers, no-coords graceful skip.
|
||||
|
||||
## Privileges
|
||||
|
||||
`PrivilegesRequired=admin` (inherited from PrinterInstaller). pnputil, TCP/IP port creation, `Add-Printer`, and trusted-publisher cert install all need elevation. Shopfloor user can launch but Windows shows a UAC prompt; supportuser creds satisfy it. Acceptable for the operator-driven adhoc workflow this installer targets. For unattended bulk per-PC deployment, use a GE-Enforce manifest entry (runs as SYSTEM, no UI, no UAC) instead of this installer.
|
||||
|
||||
## Implementation notes
|
||||
|
||||
- **Map source**: `printers.mapleft, maptop` are top-left-origin pixel coords on a 3300x2550 site map. Inno is also top-left-origin, so coords are used directly with no Y-flip (the Leaflet asp inverts Y because Leaflet `CRS.Simple` is Y-up, which is a Leaflet quirk - not present here).
|
||||
- **Scaling**: bundled BMP is 880x680 to keep file size sane. At wizard time the BMP is stretch-painted into the wizard surface at fit-and-letterbox scale; hotspots are positioned in the same scaled coordinate space (multiplying `mapleft, maptop` by the same scale factor).
|
||||
- **Hotspot graphic**: 14x14 square (no transparency, since Inno's exposed TBitmap surface does not document a TransparentColor path). Square reads cleanly enough on the dark map.
|
||||
- **Inno class subset gotchas verified before coding**:
|
||||
- `TBitmapImage` has `OnClick(Sender)` only - no `OnMouseDown` with X/Y. Per-hotspot child controls are the documented workaround for click-to-coords.
|
||||
- `TScrollBox` is not exposed; the bundled BMP is stretched to fit instead of scrolled.
|
||||
- `TBitmap.LoadFromFile` is BMP-only (PNG path goes through `TPngImage` which has no `LoadFromFile`); PNG was pre-converted.
|
||||
- `TWizardPage.OnActivate`, `ShouldSkipPage`, `NextButtonClick` all exposed as expected.
|
||||
|
||||
## Build / sign / deploy
|
||||
|
||||
Same as `PrinterInstaller/`. See `../PrinterInstaller/README.md` for the build matrix.
|
||||
Same as `PrinterInstaller/`. See `../PrinterInstaller/README.md` for the build matrix. Output filename is `PrinterInstallerMap.exe`.
|
||||
|
||||
Reference in New Issue
Block a user