Skip to content

feat(colormap): add ColorMapRegistry service and wire to chart panel#62

Merged
pabloinigoblasco merged 1 commit into
developmentfrom
feat/colormap-registry-service
Apr 20, 2026
Merged

feat(colormap): add ColorMapRegistry service and wire to chart panel#62
pabloinigoblasco merged 1 commit into
developmentfrom
feat/colormap-registry-service

Conversation

@pabloinigoblasco
Copy link
Copy Markdown
Collaborator

@pabloinigoblasco pabloinigoblasco commented Apr 20, 2026

Summary

Introduce a dedicated ColorMapRegistry as a session-wide service — peer to DataEngine — that stores plugin-registered color evaluation callbacks and exposes an active selection to rendering consumers.

Plugins that publish colormaps receive the registry through a new optional bind_colormap_registry entry on the toolbox plugin vtable. The data-plane toolbox host no longer carries colormap-specific callbacks.

Why

The previous shape placed register_colormap / unregister_colormap on the toolbox host vtable. That coupled the generic data/writing host to a presentation concern and left no first-class home for the registry state. Lifting the registry to its own service — independent class, its own ABI fat pointer, owned by MainWindow alongside DataEngine — keeps each side cohesive: the host handles data, the registry handles named colormaps, and the chart reads from the registry directly.

Key pieces

  • pj_datastore/colormap_registry.{hpp,cpp} — new class with registerMap / unregisterMap / setActive / evaluate / hasActive. Qt-free, header + cpp.
  • pj_datastore/colormap_registry_host.{hpp,cpp}makeColorMapRegistryHost(ColorMapRegistry&) adapter that exposes a registry reference as a PJ_colormap_registry_t ABI fat pointer.
  • pj_base/plugin_data_api.h — drop register_colormap / unregister_colormap from PJ_toolbox_host_vtable_t; add the new ABI types.
  • pj_base/toolbox_protocol.h — add optional bind_colormap_registry to the toolbox plugin vtable.
  • pj_base/sdk/plugin_data_api.hpp — drop registerColorMap / unregisterColorMap from ToolboxHostView; add ColorMapRegistryView C++ wrapper.
  • pj_base/sdk/toolbox_plugin_base.hppbindColorMapRegistry virtual, trampoline, colorMapRegistry() accessor.
  • pj_plugins/toolbox_handle.hppbindColorMapRegistry pass-through.
  • pj_proto_app — owns the single ColorMapRegistry, threads it into each ToolboxSession, and feeds a live view to ChartPanel via setColorMap. Chart now tracks the last value per series.
  • Tests — mock vtables in pj_plugins updated.

Breaking change

This changes the toolbox host ABI. The matching plugin-side migration is in pj-official-plugins#NN (feat/colormap-registry-migration) — they must be merged together for CPM-pulled builds to stay green.

Test plan

  • pj_base + pj_datastore + pj_plugins tests green (ctest -R "toolbox_plugin_test|quaternion" passes)
  • Full build including proto_app + 12 plugins compiles with -Wall -Wextra -Werror
  • Runtime: open proto_app, load data, open ColorMap Editor, define a map, apply, see chart colors update

Introduces a dedicated ColorMapRegistry — a session-wide service, peer
to DataEngine — that stores plugin-registered color evaluation callbacks
and exposes an active selection to rendering consumers.

Plugins that publish colormaps receive the registry through a new optional
bind_colormap_registry entry on the toolbox plugin vtable; the data-plane
toolbox host no longer carries colormap-specific callbacks. pj_proto_app
owns one ColorMapRegistry, threads it into each ToolboxSession, and feeds
a live view to ChartPanel so registered maps take effect on the next
refresh.

Contents:
- pj_datastore/colormap_registry: new class with register/unregister/
  setActive/evaluate; independent, Qt-free, header + cpp
- pj_datastore/colormap_registry_host: adapter that exposes a registry
  reference as a PJ_colormap_registry_t ABI fat pointer
- pj_base/plugin_data_api.h: drop register_colormap/unregister_colormap
  from PJ_toolbox_host_vtable_t; add PJ_colormap_registry_t +
  PJ_colormap_registry_vtable_t
- pj_base/toolbox_protocol.h: add bind_colormap_registry to the toolbox
  plugin vtable (optional; host checks NULL)
- pj_base/sdk/plugin_data_api.hpp: drop registerColorMap/unregisterColorMap
  from ToolboxHostView; add ColorMapRegistryView C++ wrapper
- pj_base/sdk/toolbox_plugin_base.hpp: virtual bindColorMapRegistry,
  trampoline, colorMapRegistry() accessor
- pj_plugins/toolbox_handle.hpp: bindColorMapRegistry pass-through
- pj_datastore/plugin_data_host.cpp: remove the obsolete ColorMapEntry
  storage and the two vtable entries that routed through it
- pj_proto_app: ColorMapRegistry member in MainWindow, pass-through to
  ToolboxSession, ChartPanel setColorMap + per-series last_value
- tests: update mock toolbox host vtable in pj_plugins and toolbox_quaternion
@pabloinigoblasco pabloinigoblasco merged commit 56447a7 into development Apr 20, 2026
2 checks passed
@pabloinigoblasco pabloinigoblasco deleted the feat/colormap-registry-service branch May 4, 2026 12:36
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.

1 participant