Skip to content

Controller Visualiser: realtime filter that dims non-matching models on the wiring pane#6191

Open
heffneil wants to merge 4 commits into
xLightsSequencer:masterfrom
heffneil:feature/controller-visualizer-filter
Open

Controller Visualiser: realtime filter that dims non-matching models on the wiring pane#6191
heffneil wants to merge 4 commits into
xLightsSequencer:masterfrom
heffneil:feature/controller-visualizer-filter

Conversation

@heffneil

Copy link
Copy Markdown
Contributor

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

  • New wxSearchCtrl sits above PanelController
  • Bound to wxEVT_TEXT so 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 #6190
  • Matching models: drawn at full opacity / full color
  • Non-matching models: drawn with a pale grey brush, outline and text — still visible, still clickable, just visually de-emphasized so the user's eye finds the matches
  • Cancel (X) button clears the filter
  • Works during drag / copy / paste — only the paint is affected; the underlying selection, hit-testing, and click handling are unchanged
  • Printing / export operations suppress the dimming so output is untouched regardless of filter state

Implementation

  • BaseCMObject gains static wxString _visualizerFilterLower so ModelCMObject::Draw can check "do I match?" with a cheap Contains() per model per paint, without plumbing a new parameter through every Draw call chain in the dialog
  • The filter is lowercased once on each text change (inside the handler) — paint-time comparisons reuse that pre-lowercased string instead of re-transforming each frame
  • Dimming uses solid pale greys (RGB 240/200/170) rather than alpha blending. wxDC alpha support is uneven across backends we ship (wxMSW, wxOSX, wxGTK) — solids render consistently on all three platforms
  • The new widget is constructed outside the wxSmith //(* ... //*) guard. Panel3's existing FlexGridSizer5 is preserved intact and re-parented into a new wxBoxSizer(wxVERTICAL). SetSizer(wrap, false) keeps the old sizer alive rather than deleting it. No .wxs file edit needed.

Files changed

  • src-ui-wx/setup/ControllerModelDialog.h — new TextCtrl_VisualizerFilter member + OnTextCtrl_VisualizerFilterText handler
  • src-ui-wx/setup/ControllerModelDialog.cpp — static filter on BaseCMObject, dim logic in ModelCMObject::Draw, widget wiring after the wxSmith guard

No new files, no project file updates needed for Windows / macOS / Linux.

Test plan

  • Build green on macOS Debug and Release (universal arm64 + x86_64)
  • Filter appears above the visualizer canvas
  • Typing narrows the visible set in realtime — matches stay solid, non-matches fade
  • X / cancel button clears the filter
  • Matching / dimming is purely visual — dimmed models are still interactive (click, drag, menu)
  • Dragging a model does not fade the drag source mid-drag
  • Windows / Linux smoke test — code is pure wx + std, no platform-specific APIs

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>
Copilot AI review requested due to automatic review settings April 21, 2026 03:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 wxSearchCtrl above PanelController (left pane) and bound it for live filtering.
  • Introduced a shared lowercased filter string and match helper on BaseCMObject.
  • Updated ModelCMObject::Draw to 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.

Comment thread src-ui-wx/setup/ControllerModelDialog.cpp Outdated
Comment thread src-ui-wx/setup/ControllerModelDialog.cpp Outdated
Comment thread src-ui-wx/setup/ControllerModelDialog.cpp
Comment thread src-ui-wx/setup/ControllerModelDialog.cpp Outdated
Comment thread src-ui-wx/setup/ControllerModelDialog.h Outdated
Comment thread src-ui-wx/setup/ControllerModelDialog.h Outdated
Comment thread src-ui-wx/setup/ControllerModelDialog.cpp Outdated
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>
@heffneil

Copy link
Copy Markdown
Contributor Author

Addressed all seven Copilot review findings in commit c3d46f3:

  1. Dimming scoped to controller pane only - gated on portMargin>0 so the right-pane "available models" list (which calls Draw with portMargin==0) stays untouched. Printing paths also use 0 and are naturally excluded.
  2. Dropped the dead !_dragging check - it read BaseCMObject::_dragging (a bool nothing ever sets) instead of the dialogs drag pointer, so the guard never fired anyway.
  3. Lowercase-caching comment rewritten to match what the code actually does (filter side is pre-lowercased on the handler; name side is lowercased per call, which is negligible for the tens of models on a single controller).
  4. Theme-aware dim palette - replaced the hard-coded 240/200/170 greys with blends between __backgroundBrush and __textForeground using IsDarkMode()-tuned weights, so dimmed items recede toward the background in both light and dark mode instead of standing out in dark mode.
  5. Tabs indentation in the .h block now matches surrounding wxSmith style.
  6. *OnTextCtrl_VisualizerFilterText declaration moved outside the //(Handlers ...) wxSmith guard so a future wxSmith regeneration cannot drop it.
  7. Static _visualizerFilterLower cleared at the start of the dialog constructor and end of the destructor so closing + reopening the dialog never shows an empty SearchCtrl while a stale filter still dims models.

Build green on macOS Debug.

@derwin12

Copy link
Copy Markdown
Contributor

Any issue ticket with some screen grabs or anything?

@heffneil

Copy link
Copy Markdown
Contributor Author

happy to demo for you in the zoomy roomy

@heffneil

Copy link
Copy Markdown
Contributor Author
Screenshot 2026-04-21 at 12 53 14 PM Here you go

@heffneil

Copy link
Copy Markdown
Contributor Author
Screenshot 2026-04-21 at 12 57 09 PM

@cybercop23

Copy link
Copy Markdown
Collaborator

Should the filter be on both lists? I think so.

@heffneil

Copy link
Copy Markdown
Contributor Author

the list on the right? There is another filter for it?

@cybercop23

Copy link
Copy Markdown
Collaborator

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.
Copilot AI review requested due to automatic review settings June 19, 2026 16:40
@heffneil

Copy link
Copy Markdown
Contributor Author

updated to conform to the request:

Screenshot 2026-06-19 at 12 42 23 PM Screenshot 2026-06-19 at 12 42 11 PM

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 4 comments.

Comment thread src-ui-wx/setup/ControllerModelDialog.cpp
Comment thread src-ui-wx/setup/ControllerModelDialog.cpp
Comment thread src-ui-wx/setup/ControllerModelDialog.cpp
Comment thread src-ui-wx/setup/ControllerModelDialog.cpp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants