This refactor is to help make future maintenance easier.
Items are now consistently named as brush instead of color.
Instead of one huge brush picker file, various elements such as gradients live in their own file.
The brush picker is also made a bit less 'smart' and doesn't have to fully understand how the current color or brush needs to be updated or if the data tab live preview needs to be updated. In turn the PickerData has been made smarter and looks after these updates.
This has fixed a few bug regarding gradient stops.
Although technically Slint hex colors are #RGBA values, it's common to not see the alpha when its 100% i.e. FF. So a color in code would look like #d1d1d1 and not #d1d1d1ff. However any hex color created by the live-preview components always shows the alpha even if it's 100%.
This change clips the FF from the values create via Slint code. However brush stops are created via Rust and need a separate fix.
Brush and color property widgets no longer show the default value of 'transparent' when a value has not been set. Instead the common symbol for no set color from other tools (a red diagonal line on a white background) is used.
When clicked the color picker is then shown and is populated with a default color that is 100% opaque.
Potential fix for a set of complex gradient stop re-ordering interactions.
Previously when dragging a gradient stop past other stops the items did not re-order as expcected. The current focused stop did not update. Stops could stick to the dragging stop. Stop sliders could disapear from view. These should be fixed but need more manual testing.
This also includes some minor bug fixes:
Floating panels block scroll wheel events to stop the underlying canvas being scrolled.
Hex color value should be applied when defocusing the TextEdit,
This is only exposed when internal types are exposed (such as in the lsp).
The plan is to make this public under a new name/global after the release.
Co-authored-by: Olivier Goffart <olivier.goffart@slint.dev>
In slintpad the editor should follow the selection in the live preview
closely. So always ask to get focus and make sure to switch to the
editor that asks to get focused.
In the test, `reexport.slint` depends on `bar.slint`
When parsing `reexport.slint` we shouldn't clear previously reported
error from previously parsed `bar.slint`. The errors are still there.
When asked to drop a document, don't make it a fatal error. Also, when the conversion fails for loading or closing, print the path to stderr. Maybe we can learn something there.
cc #8089
cc #7333
cc #4926
live-preview: Keep gradient stops sorted
... when reading them from code and when inserting
new stops.
* live-preview: Add a API to move gradient stops
Gradient stops need to be sorted now, so we need to
have a new API for moving gradient stops -- so the
model can stay sorted as we drag stops around.
With jemalloc the page size is a compile time constant that results in
the process aborting on memory allocation if the compile time determined
page size does not match the kernel reported page size at run-time.
When we, or our users, compile the above programs for aarch64-linux,
there is a fair expectation that the resulting binary works on any
aarch64-linux system. As we can't determine the target page size
reliably, disable jemalloc.
Fixes#8134