Controller Visualiser: realtime filter that dims non-matching models on the wiring pane#6191
Conversation
The right pane of ControllerModelDialog already has a live filter on the
"available models to drag onto this controller" list. The left pane -
where you actually see what is already wired onto the controller's
ports - had no search, so finding a specific already-assigned model in
a dense (100+ model) wiring view required scrolling around looking for
it.
Adds a wxSearchCtrl above Panel3's canvas. Type a substring of a model
name to dim every non-matching model that is currently on the
controller. Matching models stay at full opacity, so your eye finds
them immediately while the controller layout stays spatially intact.
- wxEVT_TEXT bound so the dimming updates on every keystroke, no
Enter required. The X / cancel button clears the filter.
- BaseCMObject gains a static _visualizerFilterLower (already
lowercased) so ModelCMObject::Draw can do a cheap Contains() check
per model per paint without plumbing a new parameter through every
Draw call chain.
- Dimming uses solid light grey brush/pen/text rather than alpha
blending - wxDC alpha is not uniformly supported across backends
we ship, and solid pales render identically on Windows, macOS and
Linux.
- Dragging a model suppresses its own dimming so the drag source
stays fully visible during the operation.
- Printing / export also suppresses dimming so output is unaffected
by whatever filter the user happened to have typed.
The new widget is constructed outside the wxSmith //(* ... //*) guard
and wraps Panel3's existing FlexGridSizer5 inside a new vertical box
sizer (SetSizer(..., false) to keep the old sizer alive). This avoids
any .wxs file edits.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds a realtime “find on controller” filter to the Controller Visualiser’s left wiring pane so users can visually locate already-assigned models without scrolling, by dimming non-matching model boxes during paint.
Changes:
- Added a new
wxSearchCtrlabovePanelController(left pane) and bound it for live filtering. - Introduced a shared lowercased filter string and match helper on
BaseCMObject. - Updated
ModelCMObject::Drawto apply a dimmed palette for non-matching models (skipping printing).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
src-ui-wx/setup/ControllerModelDialog.h |
Adds the visualizer filter control member and a new text-change handler declaration. |
src-ui-wx/setup/ControllerModelDialog.cpp |
Implements static filter state, dimming logic in Draw, and constructs/binds the new search control and sizer wrapping. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Seven findings, all resolved: 1. Dimming scoped to the controller-visualizer pane only. ModelCMObject::Draw is used by BOTH panes of the dialog: the left controller pane (which we want to dim) and the right "available models" pane (which must stay independent of the visualizer filter). The left pane calls Draw with a positive portMargin, the right pane passes 0 - so gating dimForFilter on portMargin>0 confines the effect to the intended pane. Printing paths also pass 0 so they're naturally excluded. 2. Dropped the !_dragging check. It read BaseCMObject::_dragging (a bool never written to anywhere) rather than the dialog's _dragging pointer, so the intended "skip dimming during drag" behaviour never actually fired. Removed instead of wiring in the real drag state - the dim is subtle enough that it doesn't interfere with drag operations in practice. 3. Comment on MatchesVisualizerFilter clarified. The old comment claimed the paint-time check avoided re-lowercasing each frame, but the code still did wxString(name).Lower() per call. Updated the comment to accurately describe what the code does (the filter side is pre-lowercased; the name side is lowercased per call, which is negligible for the tens-of-models typical of one controller). 4. Dimming palette is now theme-aware. The old hard-coded 240/200/170 greys looked correct in light mode but became MORE prominent than normal model colours in dark mode (where the background is near-black). The new palette blends the current __backgroundBrush colour with __textForeground using IsDarkMode()-tuned weights, so dimmed models always recede toward the background in either theme. 5. Re-indented the new .h block to use tabs, matching the surrounding wxSmith declarations style. 6. OnTextCtrl_VisualizerFilterText declaration moved out of the //(*Handlers ...) wxSmith guard. wxSmith doesn't know about this control (it's added manually after //*)) so a future regeneration would have dropped the handler declaration and broken the build. 7. BaseCMObject::_visualizerFilterLower is now cleared at the start of the dialog constructor and at the end of the destructor. Without this, closing and reopening the dialog would show an empty SearchCtrl while the static still held the previous session's filter - causing unexpected dimming until the user typed something. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Addressed all seven Copilot review findings in commit c3d46f3:
Build green on macOS Debug. |
|
Any issue ticket with some screen grabs or anything? |
|
happy to demo for you in the zoomy roomy |
|
Should the filter be on both lists? I think so. |
|
the list on the right? There is another filter for it? |
right, but that's for that side, you wouldn't want to do it on both. So say of the right/model pool doesn't have a filter, apply the same filter from the left, so you can see all wreaths (btw no more model for that - use the cirlce model) |
…#6191) Drop the separate visualizer filter box added by this PR and route the existing model-pool filter (TextCtrl_ModelFilter) to both panes: it still hides non-matching unassigned models in the pool and now also updates the visualizer dim filter so non-matching assigned models are dimmed on the controller. One filter box instead of two. The removed box was manually added (not wxSmith), so no .wxs change is needed; the surviving filter is the pre-existing wxSmith control.




Summary
Adds a realtime name filter to the left pane of the Controller Visualiser (
ControllerModelDialog). This is the pane where you actually see the models that are already wired onto the controller's ports — previously there was no way to find a specific model on a dense controller except scrolling.The existing filter on the right pane ("available models to drag onto the controller") is untouched.
How it works
wxSearchCtrlsits abovePanelControllerwxEVT_TEXTso filtering is live on every keystroke (no Enter required), matching the pattern of the other filter improvements shipped in Filter UX: Layout filter realtime, click-out clears filter, Sequencer filter exposed #6190Implementation
BaseCMObjectgainsstatic wxString _visualizerFilterLowersoModelCMObject::Drawcan check "do I match?" with a cheapContains()per model per paint, without plumbing a new parameter through everyDrawcall chain in the dialogwxDCalpha support is uneven across backends we ship (wxMSW,wxOSX,wxGTK) — solids render consistently on all three platforms//(* ... //*)guard.Panel3's existingFlexGridSizer5is preserved intact and re-parented into a newwxBoxSizer(wxVERTICAL).SetSizer(wrap, false)keeps the old sizer alive rather than deleting it. No.wxsfile edit needed.Files changed
src-ui-wx/setup/ControllerModelDialog.h— newTextCtrl_VisualizerFiltermember +OnTextCtrl_VisualizerFilterTexthandlersrc-ui-wx/setup/ControllerModelDialog.cpp— static filter onBaseCMObject, dim logic inModelCMObject::Draw, widget wiring after the wxSmith guardNo new files, no project file updates needed for Windows / macOS / Linux.
Test plan