Widgets: fix every component-review finding in one refactor #19
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "WidgetsRefactor"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Widgets refactor: every finding of the components review, in one branch
This implements the findings of the Widgets components architecture review
(
reports/widgets-components-review.md): one mechanism per behaviour, adopted by every component and by theapplications on master that use them. 35 commits, each building on its own; 133 files, +6.6k / −3.3k lines.
Result per finding
ScrollViewis now a coreViewportwith one axis. Its own offset animation, 8 px touch-drag state machine, fling, two stretches and layout are gone. Fixed: a horizontal ScrollView now takes horizontal wheel and trackpad scrolling; Shift+wheel scrolls sideways in every scroller; there is onereveal(TextArea caret, TabView tabs); the carousel tells touchpad from wheel by the event's scroll source instead of testing for a whole-number delta; the Kanban horizontal-wheel workaround is deleted. Viewport gained per-edge stretch, glide,revealOffset, overlay hooks and the averaged release velocity, all with tests.Ui::claimDraghands a long press over as a drag.ReorderableListand Kanban use oneReorderSessionslot rule (a neighbour makes room when the lifted edge passes its middle; tests in core), one elevation shadow,Viewport::autoScrollAtand a landing glide. The list gained auto-scroll and the glide it never had.ListLayout's slot logic,CardLayoutandStripLayoutare gone.ListNavigator(core),ListRowandListView(model, reused rows, SelectionModel, Up/Down/Home/End/Page/Enter/Space/type-ahead, empty state). On top of them: search results, menus and dropdowns (they had no keyboard handling; now Up/Down/Home/End/type-ahead, Enter, Right/Left for submenus, and focus is returned when the menu closes), settings rows, the file browser, the LibraryViewer track list and the theme editor's colour list.graph::, with tests), andSelectionModel. Not done: a commonGraphCanvasbase on theViewportcamera (see the scope notes below).TitledPanel(header with leading and trailing slots, a body that can scroll, a footer, a corner slot, one content API). Dialog, DockPanel, FloatingPanel and StackPage are titled panels now.DockPanel::PanelLayout,Collapsible::SectionLayout,HeaderLayoutandCollapsibleRevealLayoutare replaced by stock layouts plusBoxLayout::setReversed.SegmentedControl<Value>on SelectionModel, with arrow keys. RadioGroup keeps its choice in the same model. The TabView tab strip and the MarkdownEditor mode buttons use it.PropertyList: rows bound once to a getter and setter (value, slider, checkbox, choice, text, custom).refresh()pulls values without writing them back. Used by the LibraryViewer track info (it was one\n-joined string) and the theme editor's metrics.Glyphset pluspaintGlyph. The set gains Volume, Muted and ResizeCorner, plus a turn for the opening chevron. Transport buttons, the check mark, the list grip, the dropdown chevron, number-field steps, the add-colour cell, the menu icon, the dock grip and the collapsible chevron all use it. No inline glyph drawing is left in the components.InteractionVisualand one elevation shadow. Buttons, toggles, window buttons, the scroll bar, ResizeHandle, the dock grip, Kanban cards, colour swatches and the seek handle fade the same way. Four privatewithAlphacopies becamePalette::faded.MenuEntry::command(commands, id)takes the label, shortcut, enabled and checked state fromCommands<Id>. NodeEditor's command switch is now aCommandsregistry with availability. Found by the new test: a menu behind a plain popup button never refreshed its entries' state; every menu now refreshes when it opens.emplaceChild, newemplaceChildAt).GridLayoutgains per-column widths (MarkdownView tables, PropertyList);RowLayoutgains overflow (MenuBar). Of 17 custom layouts, 11 remain; seven of them are thin subclasses of stock layouts or are layouts the review said to keep (see below).Applications updated in this branch
the track info is a PropertyList.
Verification
Sketch3D Entry, SketchGUI).
LibraryViewer 16 → 18, Sketch3D 2 (it did not build on master).
All other suites in the tree pass (Allocators, Callstack, Connection, Containers, DataAnalysis,
GraphicApplication 108, Math, Objects, RasterRender, RayTracer, Strings, TextEditor, Threading).
commit:
Scope notes and decisions to check
The look was checked through recorded draw commands in tests, not by eye. Please run the gallery and look at
Lists, Reorder, Kanban, Forms, Panels and the menus.
magnetic zoom steps and full view and the editor's free zoom behave differently on purpose, and moving them onto
one Viewport would change behaviour the current tests do not cover. Kept as follow-up work.
CarouselLayoutkept. Moving it onto the Viewport needs a paged inertia mode built fromMagneticStep. Its own wheel heuristic was fixed (scroll source); the layout itself was not replaced.
(starts the landing glide), AreaLayout (re-reveals the caret).
ScrollViewgainsrevealRangeandrevealOffsetFor;SearchField::rows()→results()/row(i);FileBrowser::rows()→listed();FileRowandscroll→list;LibraryWidget::visibleTracks()returns tracks, andtracks()is the list;Dialog::buttons(),Menu::items(),MenuBar::titles()andSettingsPage::rows()return plain pointers;TransportButton::Glyph→ coreGlyph;StackPage::setContenttakes a pointer like every titled panel.CommandRegistry and BoardCommand, their lists). They can adopt these components after this branch merges.
Objects'
osguses ImGui and is not affected.DocumentFolderPanelhas no user on master, so it was not added.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.