Add StepGrid step-sequencer widget - #540
Merged
Merged
Conversation
This was referenced Sep 29, 2026
Also folds in: - Count StepGrid demo and test steps with LINQ Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HgjMCJ9MQRmUk6c8KABDYH
matt-edmondson
force-pushed
the
claude/project-thread-g9k1ol-step-grid
branch
from
September 30, 2026 10:44
7239741 to
f6762c2
Compare
matt-edmondson
changed the base branch from
main
to
claude/project-thread-g9k1ol-piano-keyboard
September 30, 2026 10:44
This was referenced Sep 30, 2026
|
This was referenced Sep 30, 2026
Base automatically changed from
claude/project-thread-g9k1ol-piano-keyboard
to
main
September 30, 2026 11:27
This was referenced Oct 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Requested by Matt · project thread
Before:
ktsu.ImGui.Widgetshas no step sequencer. A drum pattern or a gate sequence means drawing a grid of cells and writing your own click and drag handling.After:
ImGuiWidgets.StepGrid(label, steps, rows, stepCount, playingStep, stepsPerBeat, cellSize, rowLabels)draws a rows × steps grid over a caller-ownedSpan<bool>. Pressing a cell toggles it, and dragging from there paints the same value across every cell the pointer crosses. It shades beat groups, highlights the playing column, and draws optional row labels. The method returns true on any frame the pattern changed. Each cell is probe-addressable as{label}/r{row}s{step}.How: geometry, hit testing and the toggle-then-paint gesture live in
StepGridLayoutandStepGridState, which are internal and nested inImGuiWidgetsthe same wayHandleTrackStateis. They need no ImGui context, andtests/ImGui.Widgets.Tests/StepGridStateTests.cscovers them (21 tests). The only item the widget submits is oneInvisibleButtonover the cells. It does not reuseGrid, as decided on the issue.tests/ImGui.Widgets.UITests/StepGridTests.cs(11 tests) drives the widget in isolation.Also in this PR:
examples/ImGuiWidgetsDemo/StepGridDemo.cs. For now it's registered with one line each inSignalDemos; that moves toDemoSections.csonce Split the widgets demo into one class per section #534 lands.Deviations from the issue text worth checking:
BeginTooltip/TextUnformatted, notSetTooltip, so a label containing%isn't read as a format string.Not included: the rendered tile image
docs/gallery/widgets/stepgrid.png. This environment can't upload Git LFS objects, so it needs a localdotnet run -c Release --project tools/WidgetGallery -- --only StepGrid. The composite gallery sheets were not regenerated either.Checks run locally in Release:
WidgetGallery --checkclean, gallery UI tests 5/5.EverySection_CanBeExpandedWithoutErrorpasses only oncektsu.pnghas been pulled from LFS. With a pointer checkout it fails at "Mobile - Decorators" on main too.This branch appends to the same shared lists as the other widget PRs (#539 and the two to come):
SignalDemos,WidgetDemoSections,InputAndControls.cs, and the CLAUDE.md and README feature lists. Any conflicts between them are adjacent additions, so resolve them by keeping both sides.Closes #526
🤖 Generated with Claude Code
https://claude.ai/code/session_01PndoA4WHoRsyywzECYDNX3
Generated by Claude Code