squads: add "select all" toggle to squads sidebar - #1637
Open
Alistair-Afton wants to merge 4 commits into
Open
Alistair-Afton wants to merge 4 commits into
Alistair-Afton wants to merge 4 commits into
Conversation
Adds an overlay widget to the squads sidebar panel that selects all squads with one click (or the Ctrl-A hotkey). Activating it again when all squads are selected deselects them all. The widget anchors itself below the 'Create new squad' button and tracks external selection changes so its state stays accurate when the user clicks individual squad checkboxes. User-set positions (via gui/overlay) are respected. Implements DFHack/dfhack#5762
Move the widget from below the button to directly above it, centered on the button — the space below collides with the order icon row (shown when squads are selected) and the button's hover help text. Replace ToggleHotkeyLabel's On/Off suffix with a plain HotkeyLabel whose text switches between 'Select all' and 'Deselect all'. Fix the anchor never updating: frame.t/r changes only take effect after updateLayout(), which now runs when the anchored position changes. Also gate rescans on squad count/scroll/window-height so repositioning is near-instant while staying cheap, and retry while unanchored so a transient scan miss doesn't stick.
With a 0.1s update throttle the widget rendered at its default position before the anchor scan ran, visibly jumping to its final spot. Run the anchor check every tick (gated by the existing cheap scan-key bail) so it is positioned before the first visible frame.
The disband prompt shares the dwarfmode/Squads focus string, so the widget stayed visible (and kept consuming its hotkey) over it. Gate widget visibility on the squads interface's disband_confirmation flag.
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.
Fixes DFHack/dfhack#5762.
Adds a
Ctrl-A: Select alltoggle to the squads sidebar via an overlay widget (squads.select_all).Ctrl-Ahotkeygui/overlayare respected)dwarfmode/Squadsfocus)Test plan
test -t overlay/squads— 4/4 tests pass (hotkey select, hotkey deselect, click toggle, external-change tracking)