mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-28 03:11:47 +00:00
* Add wxInspector dep * Initial intergration of wxInspector * docs: add wxInspector plugins design spec Design spec for two wxInspector plugins (DPIAware + CustomWidgets) that expose OrcaSlicer's custom control properties in the inspector property grid. Covers: DPIAware scale-factor properties, Button, CheckBox, TextInput, SwitchButton, ProgressBar, Label, and LabeledStaticBox. * docs: add wxInspector plugins implementation plan 6-task plan covering: source changes to existing widget headers, DPIAwarePlugin, CustomWidgetsPlugin, registration helper, MainFrame/CMake wiring, and build verification. * feat: add getters/setters for wxInspector plugin access Add minimal public accessors to DPIAware (set_scale_factor, set_prev_scale_factor, set_em_unit, force_rescale), Button (GetStyle, GetType, IsSelected), CheckBox (IsHalfChecked), TextInput (GetCornerRadius), and LabeledStaticBox (GetCornerRadius, GetBorderWidth, GetBorderColor, GetScale). * feat: add wxInspector plugin registration helper Add RegisterOrcaInspectorPlugins() inline function that creates and registers the DPIAwarePlugin and CustomWidgetsPlugin as static instances (matching wxInspector's built-in pattern). * feat: add DPIAware wxInspector plugin Exposes DPI scaling properties (scale_factor, prev_scale_factor, em_unit, normal_font, force_rescale) on DPIFrame and DPIDialog widgets. Uses dynamic_cast for detection and a template helper to capture the correct static type for lambda accessors. * feat: add OrcaCustomWidgets wxInspector plugin Exposes Orca-specific properties on 7 widget types: - Button: Style, Type, Selected - CheckBox: Half Checked - TextInput: Label, Text Value, Corner Radius - SwitchButton: Value - ProgressBar: Proportion, Show Number - Label: Is Hyperlink, Font Point Size - LabeledStaticBox: Corner Radius, Border Width, Border Color, Scale Each widget type uses dynamic_cast for safe detection. * feat: wire wxInspector plugins into MainFrame and build Call RegisterOrcaInspectorPlugins() in MainFrame constructor after SetupInspectorAccelerator(). Add all 5 plugin source files to SLIC3R_GUI_SOURCES in CMakeLists.txt. * fix: move plugin registration to GUI_App::on_init_inner Register plugins once in app init rather than in MainFrame constructor, which may be recreated during the application lifetime. * fix: include plugin headers in Registration.hpp for complete types Static locals require complete type. Include DPIAwarePlugin.hpp and CustomWidgetsPlugin.hpp instead of forward-declaring. Also remove unused include from MainFrame.cpp (registration moved to GUI_App). * fix: qualify DPIFrame/DPIDialog with Slic3r::GUI namespace * Make DPIDialog inspectable. For other dialogs, we will add them if necessary later. * docs: add spec for moving wxInspectable into DPIAware template Move wxInspector::wxInspectable base class from DPIDialog and MainFrame into the common DPIAware<P> template, making all DPIAware widgets automatically visible in the inspector tree. Co-Authored-By: Claude <noreply@anthropic.com> * docs: add implementation plan for moving wxInspectable into DPIAware Co-Authored-By: Claude <noreply@anthropic.com> * docs: update spec/plan — move SetupInspectorAccelerator into DPIAware too Co-Authored-By: Claude <noreply@anthropic.com> * refactor: move wxInspectable and SetupInspectorAccelerator into DPIAware DPIAware<P> now inherits wxInspector::wxInspectable and calls SetupInspectorAccelerator in its constructor, making all DPIAware widgets automatically appear in the inspector tree with the Ctrl+Shift+I shortcut. DPIDialog now uses 'using' to inherit the constructor. Remove redundant wxInspectable inheritance and SetupInspectorAccelerator calls from DPIDialog and MainFrame. Co-Authored-By: Claude <noreply@anthropic.com> * fix: use LB_HYPERLINK constant instead of magic number 0x0020 Co-Authored-By: Claude <noreply@anthropic.com> * Clean up * Fix Linux build * Don't build wxInspector sample * Use shallow clone * Try fix flatpak build * Attempt to fix build again * Fix build failure caused by https://github.com/wxWidgets/wxWidgets/commit/436c16135ec7ddf580f44624bf74c592aae43b66 * wxWidgets build only download required submodules * This should fix build on Windows on ARM * Enable PIC * Disable layout inspector by default for public release * Use wxInspector 1.0.0 release --------- Co-authored-by: Claude <noreply@anthropic.com>
112 lines
4.3 KiB
Markdown
112 lines
4.3 KiB
Markdown
# Move `wxInspectable` into `DPIAware` — Implementation Plan
|
|
|
|
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
|
|
|
|
**Goal:** Move `wxInspector::wxInspectable` from individual leaf classes into the common `DPIAware<P>` template so every DPIAware widget is automatically inspectable and gets the inspector keyboard shortcut.
|
|
|
|
**Architecture:** `DPIAware<P>` gains `wxInspector::wxInspectable` as a second base class and calls `SetupInspectorAccelerator(this)` in its constructor. `DPIDialog` and `MainFrame` drop their now-redundant `wxInspectable` inheritance and `SetupInspectorAccelerator` calls.
|
|
|
|
**Tech Stack:** C++17, wxWidgets, wxInspector
|
|
|
|
## Global Constraints
|
|
|
|
- Build with `D:\VisualStudio\2026\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe`
|
|
- Use `--config RelWithDebInfo` for all builds
|
|
- Cross-platform: must compile on Windows, macOS, and Linux
|
|
- Match existing code style: PascalCase classes, `#pragma once`
|
|
- Do NOT commit files under `.superpowers/`
|
|
- Do NOT commit `task.md`
|
|
|
|
---
|
|
|
|
### Task 1: Move `wxInspectable` and `SetupInspectorAccelerator` into `DPIAware<P>`
|
|
|
|
**Files:**
|
|
- Modify: `src/slic3r/GUI/GUI_Utils.hpp:92` (DPIAware template — add wxInspectable base + SetupInspectorAccelerator call)
|
|
- Modify: `src/slic3r/GUI/GUI_Utils.hpp:276` (DPIDialog — drop wxInspectable + SetupInspectorAccelerator)
|
|
- Modify: `src/slic3r/GUI/MainFrame.hpp:96` (MainFrame — drop wxInspectable)
|
|
- Modify: `src/slic3r/GUI/MainFrame.cpp:304` (MainFrame constructor — drop SetupInspectorAccelerator)
|
|
|
|
**Interfaces:**
|
|
- Consumes: Nothing (standalone refactor)
|
|
- Produces: All DPIAware widgets automatically inherit `wxInspector::wxInspectable` and get Ctrl+Shift+I accelerator
|
|
|
|
- [ ] **Step 1: Add `wxInspectable` to `DPIAware<P>` and call `SetupInspectorAccelerator`**
|
|
|
|
In `src/slic3r/GUI/GUI_Utils.hpp`, line 92, change the base class:
|
|
|
|
```cpp
|
|
// Before:
|
|
template<class P> class DPIAware : public P
|
|
// After:
|
|
template<class P> class DPIAware : public P, public wxInspector::wxInspectable
|
|
```
|
|
|
|
In the constructor body of `DPIAware<P>`, after `this->CenterOnParent();` (currently line 110), add:
|
|
|
|
```cpp
|
|
SetupInspectorAccelerator(this);
|
|
```
|
|
|
|
(`<wx/inspector/inspector.h>` is already included at line 23.)
|
|
|
|
- [ ] **Step 2: Remove redundant `wxInspectable` and `SetupInspectorAccelerator` from `DPIDialog`**
|
|
|
|
In `src/slic3r/GUI/GUI_Utils.hpp`, line 276, change:
|
|
|
|
```cpp
|
|
// Before:
|
|
class DPIDialog : public DPIAware<wxDialog>, public wxInspector::wxInspectable
|
|
// After:
|
|
class DPIDialog : public DPIAware<wxDialog>
|
|
```
|
|
|
|
In the `DPIDialog` constructor body, remove the `SetupInspectorAccelerator(this);` line (currently line 286). The rest of the constructor stays.
|
|
|
|
- [ ] **Step 3: Remove redundant `wxInspectable` from `MainFrame`**
|
|
|
|
In `src/slic3r/GUI/MainFrame.hpp`, line 96, change:
|
|
|
|
```cpp
|
|
// Before:
|
|
class MainFrame : public DPIFrame, public wxInspector::wxInspectable
|
|
// After:
|
|
class MainFrame : public DPIFrame
|
|
```
|
|
|
|
`MainFrame` now gets `wxInspectable` through `DPIFrame` → `DPIAware<wxFrame>`.
|
|
|
|
- [ ] **Step 4: Remove redundant `SetupInspectorAccelerator` from `MainFrame` constructor**
|
|
|
|
In `src/slic3r/GUI/MainFrame.cpp`, line 304, remove the line:
|
|
|
|
```cpp
|
|
SetupInspectorAccelerator(this);
|
|
```
|
|
|
|
It is now called automatically by the `DPIAware<wxFrame>` constructor.
|
|
|
|
- [ ] **Step 5: Build to verify compilation**
|
|
|
|
```powershell
|
|
$cmakePath = "D:\VisualStudio\2026\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe"
|
|
& $cmakePath --build . --config RelWithDebInfo --target ALL_BUILD -- -m
|
|
```
|
|
|
|
Expected: Build succeeds with zero new errors or warnings.
|
|
|
|
- [ ] **Step 6: Commit**
|
|
|
|
```bash
|
|
git add src/slic3r/GUI/GUI_Utils.hpp src/slic3r/GUI/MainFrame.hpp src/slic3r/GUI/MainFrame.cpp
|
|
git commit -m "refactor: move wxInspectable and SetupInspectorAccelerator into DPIAware
|
|
|
|
DPIAware<P> now inherits wxInspector::wxInspectable and calls
|
|
SetupInspectorAccelerator in its constructor, making all DPIAware
|
|
widgets automatically appear in the inspector tree with the
|
|
Ctrl+Shift+I shortcut. Remove redundant wxInspectable inheritance
|
|
and SetupInspectorAccelerator calls from DPIDialog and MainFrame.
|
|
|
|
Co-Authored-By: Claude <noreply@anthropic.com>"
|
|
```
|