Commit Graph
133 Commits
Author SHA1 Message Date
Martino Ferrari f8a364e963 feat(plot): the figure crosshair marks the hovered row, and the stroke is thin, dashed and configurable
The figure sync learns which row the pointer is in and that row's local y, so the
shared x goes to every row and the horizontal line only to the hovered one -- a
crosshair that finally marks a row where its y means something. The stroke gains
Style::crosshair_width/_dash_on/_dash_off (logical; 0.75 / 4 / 4), a per-Crosshair
override, and a fragment-shader dash on v_along (off == 0 is solid), anchored to the
axes edge each line is staged from so the phase does not crawl.
2026-09-28 20:29:09 +02:00
Martino Ferrari eee7c34dd5 feat(plot): the figure crosshair marks the hovered row, and the stroke is thin, dashed and configurable 2026-09-28 20:17:01 +02:00
Martino Ferrari cae672bc99 fix(plot): a figure gives every row the same y gutter so the axes line up 2026-09-28 20:11:17 +02:00
Martino Ferrari 663b57c679 docs: spec and plan for figure y-gutter alignment, crosshair line and style, and cursor dragging 2026-09-28 19:57:19 +02:00
Martino Ferrari a14f333dbe fix(plot,render,glfw): a hue-neutral crosshair, an em-dash placeholder, one layout per figure event, and a usable readout switch 2026-09-28 19:38:30 +02:00
Martino Ferrari 10d5129fbf refactor(render): share the readout panel and swatch drawing with the legend 2026-09-28 19:25:33 +02:00
Martino Ferrari 29824b6919 fix(plot,glfw): layer the crosshair under the handles, sync it across a figure, and harden the lookup 2026-09-28 19:22:29 +02:00
Martino Ferrari 8e27e22ebe test(plot): pin the crosshair's lookup, readout, placement, sync and clip 2026-09-28 19:07:22 +02:00
Martino Ferrari fd0c471430 feat(plot): crosshair with an interpolated per-signal hover readout 2026-09-28 18:57:33 +02:00
Martino Ferrari a153b73ead fix(input): clamp a dragged ruler on an ordered y range and share the orientation test 2026-09-28 17:58:42 +02:00
Martino Ferrari 93ad774281 fix(render): keep a cursor parked on an axis bound inside and visible 2026-09-28 17:49:18 +02:00
Martino Ferrari eb7371d7a5 test(plot): pin the horizontal ruler's paint, edge behaviour and orientation rules 2026-09-28 17:34:43 +02:00
Martino Ferrari 63f9655ae1 feat(plot): horizontal rulers alongside the vertical cursors 2026-09-28 17:18:43 +02:00
Martino Ferrari 2d819c4228 fix(render): clip grid, traces, regions and cursors to the plot area 2026-09-28 17:00:02 +02:00
Martino Ferrari d853db62ae fix(text): carry a glyph's negative bearing and harden the bake's extents 2026-09-28 16:32:18 +02:00
Martino Ferrari b0f9fbbb35 docs: spec and plan for data clipping, horizontal rulers and the crosshair readout 2026-09-28 16:32:18 +02:00
Martino Ferrari 1b153b2ec3 fix(text): refuse an atlas that would overflow its own arithmetic, and clamp the cell before narrowing it 2026-09-28 16:13:56 +02:00
Martino Ferrari 14d664a246 feat(text): optional vendored stb_truetype backend for runtime external fonts 2026-09-28 16:07:27 +02:00
Martino Ferrari daff60e3f0 fix(input,examples): a linked figure's wheel anchor uses the group's live edge, and every demo verdict reaches its exit status
Review fix pass 1 on the task 7 work; four findings, all closed.

1. The Qt demo's region sat across the middle of the window, which is exactly
   where its own scripted input check pans: after the check's box zoom the press
   opened DragMode::MoveRegion, the x range never moved, and the check printed
   'input check pan FAIL' -- under an exit 0, because the verdict was printed and
   not returned. The region now rides the left sixth (as the GLFW demo's does),
   both checks pass, and the verdict is wired to the exit status. The same audit
   found two more printed-only verdicts -- the GTK demo's scripted-resize layout
   check and its screenshot write (and Qt's) -- now wired too. What stays
   printed-only is the screenshot line of the GLFW host and the ImGui widget,
   where the dump happens inside the adapter's frame loop.

2. A follow-ing link group was invisible to the input layer: a member's own axis
   must be XFollow::Off (link_x() refuses a Live member), so Controller's
   x_zoom_anchor() extrapolated a coordinate from the pointer instead of using
   the live edge and a wheel over a row's axis strip walked the window back by
   19% of its width (behind 0.000000 -> 0.285809 s). The group now publishes its
   own edge to every member (Axis::live_owner + Plot::set_x_live_owner, written
   by Figure::push_link, cleared when the group stops following or the row
   unlinks), and x_zoom_anchor() reads it. Public-header addition, called out.
   Measured after: behind 0.012992 s and the window's right edge bit-identical to
   the edge the group published at the gesture.

3. The multiplot summary printed x_link_count() -- a number of groups -- under
   'rows in it'. It now reports the members and the group count separately, and
   every row line carries its own group id.

4. Host::controller_at() promised to clamp a pixel in a row gap to the nearest
   row and only clamped below the last one, so a gap pixel went to row 0. It now
   selects by distance, and tests/test_glfw_host.cpp pins it with a 40 px gap --
   the first coverage of the host's figure routing, which needs no window.

New cases: tests/test_controller.cpp x2 (the anchor and the hint's lifecycle),
tests/test_glfw_host.cpp x3 (routing, the gap, the single-plot fallback): 229
cases, 0 failed, ASan clean. All five demos exit 0, the three self-checking
modes exit 0, and the amended assertions were confirmed failing against the
pre-fix behaviour.
2026-09-28 15:52:08 +02:00
Martino Ferrari a70c381a1e fix(examples): keep the glfw demo's region off the pan path, and print the multiplot's region geometry
Adding a grabbable region across the middle of the glfw demo turned the pan
gesture PLOT_DEMO_FOLLOW makes -- and a user's own centre drag -- into a region
drag, which that mode's self-check reported as 'distance behind only by the pan:
NO' and exit 1. The region now rides the left sixth of the live window, so a
press in the middle pans exactly as it always did, and the reason is written
where the bounds are placed.

The multiplot demo also prints its region's last-frame fill rect and bound
columns, so the exit frame's region pixels can be read against the geometry
Plot::layout() measured.

Report: .superpowers/sdd/p2-task-7-report.md
2026-09-28 15:36:25 +02:00
Martino Ferrari 942f88c568 feat(examples): a three-row synced Figure demo, on a GLFW host that draws one
The multi-plot example the phase exists for: three plots stacked in one
Figure, sharing one x link with following armed, each row carrying its own
named signals and its own legend, driven by six StreamSeries at 500 kS/s.
Two cursors and a region with an exact statistics readout reach the direct
manipulation of spec §5 in the same frame, and PLOT_DEMO_SYNC=1 is a
self-checking mode that exits non-zero unless all three rows hold one range
and the shared right edge keeps tracking the newest sample through a zoom, a
pan on another row and more arriving data.

The GLFW host gains the figure mode the demo needs: set_figure() makes the
run loop draw the Figure instead of its own plot and route each pointer,
wheel and key event to the row it lands in, through one Controller per row
(row_controller()). All of it is opt-in; the single-plot path is untouched.
2026-09-28 15:24:22 +02:00
Martino Ferrari 770da4c2b2 fix(plot): a figure row's strip shows labels and title independently, and the shared axis is the bottom row's strip 2026-09-28 15:07:39 +02:00
Martino Ferrari 8f1e60a105 feat(plot): Figure with stacked rows and a synchronised x axis 2026-09-28 14:42:17 +02:00
Martino Ferrari 7cc06f07f5 fix(input): refuse non-finite region bounds, keep narrow regions movable, republish hot handles 2026-09-28 14:08:11 +02:00
Martino Ferrari 4681d7015b feat(examples): drive a region through the glfw demo and verify its geometry 2026-09-28 13:54:59 +02:00
Martino Ferrari 4e0e0ae0b3 test(plot): region removal re-indexes the ids and the statistics cache 2026-09-28 13:53:26 +02:00
Martino Ferrari 5e610bc138 test(input): pin the region snap's once-on-release rule and the live-follow data anchoring 2026-09-28 13:50:52 +02:00
Martino Ferrari 354e79eea2 feat(input): draggable cursors, regions and measurement-band edges 2026-09-28 13:47:35 +02:00
Martino Ferrari f423cf6f99 test(input): region, cursor and band-edge direct-manipulation cases (spec §5) 2026-09-28 13:42:26 +02:00
Martino Ferrari e4d48cc6c3 wip(plot): region layout, hot handles and draggable handles (build restored) 2026-09-28 13:28:51 +02:00
Martino Ferrari 7d2349555d fix(plot): a degenerate range cannot strand a live axis, and the demo's follow check fails the run 2026-09-28 13:14:50 +02:00
Martino Ferrari 77e861f79e feat(input): live x follow with relative zoom and mouse panning 2026-09-28 13:01:48 +02:00
Martino Ferrari eaae07d8e0 feat(render): independent major and minor grid classes tied to the tick set 2026-09-28 12:42:22 +02:00
Martino Ferrari 69495a3799 fix(render): convert Trace::width through the UI scale, and fold the controller's tolerance conversion into Style::device() 2026-09-28 12:26:06 +02:00
Martino Ferrari 7500fc90d2 feat(render): logical style metrics with a UI scale, so chrome has a consistent physical size 2026-09-28 12:17:53 +02:00
Martino Ferrari 1f03631e98 docs: spec and plan for DPI-consistent sizing, grid classes, and live follow with zoom and panning 2026-09-28 11:56:26 +02:00
Martino Ferrari 2d51b978d7 feat(plot): per-trace legend with measured layout and swatches 2026-09-28 11:56:06 +02:00
Martino Ferrari 9dc3b1e5e6 fix(render): drop x title rows the chrome clamp cut short 2026-09-28 11:32:54 +02:00
Martino Ferrari e211701d05 fix(render): drop y title columns the chrome clamp cut short 2026-09-28 11:26:24 +02:00
Martino Ferrari daeb31b1ea feat(plot): vertical y-axis label via a rotated text run 2026-09-28 11:14:36 +02:00
Martino Ferrari 1cb5970757 fix(render): environment-aware atlas drift guard, pinned text scale, shipped-atlas coverage 2026-09-28 10:54:00 +02:00
Martino Ferrari 5ca3587325 feat(render): anti-aliased embedded Adwaita Mono atlas, generated and committed 2026-09-28 10:40:23 +02:00
Martino Ferrari 3ff7b9c978 fix(render): gate TextAtlas::sync on the loader, and cover three review findings
Review of the atlas refactor found one Important and three Minor issues:

- Important: TextAtlas::sync called glGetIntegerv before any available() check,
  so a host that synced before plot::gl::load() -- which is legal for a public
  class Tasks 2 and 8 build backends on -- segfaulted on a null entry point
  instead of receiving the Status the interface promises. It now follows the
  handle-constructor convention (available(), then the entry point itself) and
  reports Unsupported.
- empty() no longer means "a GL name exists": releasing one is a
  glDeleteTextures call, so the no-atlas path forgets the atlas and only resets
  the texture when there is a table to release it with.
- end_frame's comment still claimed the frame hands back the unpack alignment
  init() set, contradicting the code below it and renderer.hpp.
- The orientation case's texel probe mapped the atlas' u along the cell's +v
  axis and vice versa, which is a no-op for its two diagonal probes -- so it
  could not fail on a transposed UV mapping, and its own comment misstated the
  rule. Probes now follow the shader's rule and include an off-diagonal pair.
- The null-glyph path of add_text (and its twin in walk_text_clipped) was
  unreached by any case.

Cases: text_atlas_reports_a_status_when_the_entry_points_are_missing,
add_text_skips_a_codepoint_the_backend_cannot_draw.
2026-09-28 10:22:38 +02:00
Martino Ferrari e1f6b61b7d docs: atlases are fixed-cell grids; state the constraint instead of discovering it 2026-09-28 10:10:41 +02:00
Martino Ferrari ffc060d6ca refactor(render): the atlas is a declared fixed-cell grid, and staging checks it
The text pipeline stages a glyph's rect *origin* per instance and carries the
rect's *size* once per draw, so a backend whose glyphs have differing rect sizes
-- a TrueType packing trimmed to ink, which is Task 8's shape -- would have drawn
every glyph at whichever size it happened to be told, with nothing downstream
able to tell. Make that constraint structural rather than documented:

- TextBackend::cell_uv() declares the one cell size, and the contract (an atlas
  is a fixed-cell grid; a proportional face draws its glyphs *into* a uniform
  cell instead of trimming each rect to its ink, and why the pipeline needs it)
  is stated on the atlas accessors.
- glyph_is_cell() is the check; add_text()/set_cell() declare the cell from the
  backend, and the staging path asserts it for every glyph in a debug build.
  A release build draws on with the cell it was told, as before.
- Renderer::flush_text() takes u_glyph_uv from the backend, not from the batch,
  so the draw's one rect size can never come from whichever glyph was staged
  first.
2026-09-28 10:09:50 +02:00
Martino Ferrari e074f57ddf refactor(render): TextBackend owns its atlas, and staged glyphs carry a rotation basis 2026-09-28 09:57:28 +02:00
Martino Ferrari 90e17a0a11 docs: spec and plan for vertical y label, fonts, legend, draggable areas and synced multi-plot 2026-09-28 09:32:02 +02:00
Martino Ferrari d110bfd459 feat: embeddable OpenGL time-series plotting library (plot) 2026-09-28 08:20:05 +02:00
Martino Ferrari a08b184481 fix(plot,render,gl): live streaming measurements, handed-back GL state
Final whole-branch review fixes.

1 (Important). Plot::measurement() cached on (series pointer, sample count)
only, so a saturated StreamSeries -- whose size() stays pinned while x0()
advances every acquire() -- froze its readout on the first saturated frame
until a cursor moved. The cache key now carries the series' x0() (new
MeasureSlot::last_x0), so a sliding window recomputes and a static series
still does not: asserted with a new macro-gated counter hook
(plot/detail/measure_count.hpp, PLOT_COUNT_MEASURE_RECOMPUTES, wired like the
pyramid and ring counters, absent from the release library). New case
saturated_stream_measurement_tracks_the_sliding_window: saturated ring,
stationary cursors, ramp in absolute x -- zero recomputes for repeated reads
with nothing moving, one per acquire while it slides.

2-3, 9. Spec: 4.3 described a GL_LINE_STRIP path that does not exist (there is
one rasteriser -- instanced anti-aliased quads -- and dense_threshold_spp
selects the gather level, not a primitive); 8 named a PLOT_GL_CHECK() macro
that exists nowhere, and stated no exception policy. The table, the field's
comment and 8 now describe the real gather-level threshold, the real
glGetError() drain plus the stores' drop-to-orphan fallbacks, and the real
policy: library failures return Status/bool, allocating entry points propagate
std::bad_alloc.

4. The frame handed back neither GL_UNPACK_ALIGNMENT (init() sets 1 for the
atlas) nor the clear colour (queried once with a new glGetFloatv entry).
end_frame() restores both and renderer.hpp lists them in the residue
contract.

5. draw() kept a host TextBackend for layout while drawing with its own font.
The renderer now installs its font unconditionally -- strips and labels measure
and draw with one backend -- with a debug-build diagnostic if a different one
was set, and Plot::set_text_backend() is documented as the no-renderer path.
New case renderer_measures_the_labels_it_draws asserts layout, measuring and
the drawn label's ink agree.

6-10. draw()'s style overwrite stated at the call site; the load-sensitive
wall-clock bound in test_measure.cpp replaced by a counter assertion (same
interval, same fold count over a 512x length ratio); dump_frame_ppm drops
noexcept and says why it may allocate; error.txt ignored (not this project's,
not generated here) rather than deleted.

Verified: debug and release build clean (-Wall -Wextra -Wpedantic -Wconversion
-Wshadow), 4/4 ctest entries pass, 130 cases pass (was 127), umbrella and
header self-containment checks pass, and no counter symbol in the release
archive.
2026-09-28 03:42:34 +02:00
Martino Ferrari f363523195 fix(build): keep counter instrumentation out of the installed release library
The linux-release preset inherited PLOT_BUILD_TESTS=ON, so the release build
compiled the pyramid cover/merge and ring upload/wait/slot counters into
libplot_core.a and cmake --install shipped them. Set PLOT_BUILD_TESTS=OFF in the
preset; the suite keeps running in linux-debug and linux-asan, which are
unchanged.

Also pin the two header properties the plan calls Global Constraints and that
nothing guarded: every header under include/plot/ compiles standalone, and
include/plot/plot.hpp includes every public one. tests/CMakeLists.txt globs the
headers at configure time (CONFIGURE_DEPENDS) and generates one TU per header
plus an umbrella TU that constructs Plot, Renderer, data::StreamSeries and
input::Controller; a ctest entry builds the header TUs and runs the umbrella,
and cmake/plot_umbrella_check.cmake fails configure and ctest when a public
header is missing from the umbrella.
2026-09-28 03:25:59 +02:00