The button bevel was rendered upside down, which happens due to some
weird double y-axis inversion, which goes away when passing the QWidget
pointer to the style. When using the Qt backend, we can do that.
We can't call return-if-changed with "builtin:" URL, otherwise cargo
thinks the build script always need to be re-run
Fix the gallery example always being rebuilt because it uses AboutSixtyFPS
When the PM_LayoutHorizontalSpacing pixel metric is negative, we're supposed to call
layoutSpacing() on the style. Until we have a detailed
overview over the controls, a default spacing is better than -1 :-)
Turn message about inability to embed images into a warning for now
We do test our tutorial and in the CI build we enforce embedding,
so the icon paths there don't work.
This is a two-stage change, that first centralizes the file I/O code
path for on-disk and builtin:/ files. Secondly the resource embedding
pass now produces diagnostics if a file cannot be located.
For loading images that are included in the widget library that's included in turn
in the compiler binary, we need to create ImageInner::EmbeddedData
with &'static data and &'static file extension. The latter was
created using string interning, but we can also access the path of the
widget library data structure.
The options in sixtyfps-viewer --help used to look like this:
```
OPTIONS:
--backend <backend> The rendering backend [default: ]
-I <include path for other .60 files>...
--load-data <load data file> Load properties from a json file ('-' for stdin)
--save-data <save data file> Store properties values in a json file at exit ('-' for stdout)
--style <style name> The style name ('native', 'fluent', or 'ugly') [default: ]
```
This patch removes the useless "[default: ]" part. These are options,
so even without this text it should be very obvious that the `--style`
and the `--backend` parameters are indeed optional.
In the CMake build on Linux, enable resource embedding.
This is a compromise clearly - it would be best to enable it on all, but
OTOH this slows down compilation. There's also no test for whether this
works at run-time, it would be best to have an API for that, i.e. the
ability to annotate an @image-url.
This allows compiling with SIXTYFPS_EMBED_RESOURCES=true and
images/fonts are embedded as inline variables.
Generated data is emitted into the header file as
inline uint8_t sfps_embedded_resources_123[789] = {
0x1, 0x2, 0x3,
};
The database is not empty, as the changed expect() suggests, but instead
it just means that the family could not be found. This can happen for
example with something like this:
export App := Window {
Text {
text: "Ok";
font-family: "Non-existent";
}
}
or it can also happen when loading the printer demo in the online
editor, where a custom font is supposed to be available but that's not
implemented for wasm builds.
So instead of panicing, fall back to querying for a last-resort
sans-serif family.
For Linux, we register fontconfig's choice for sans-serif, otherwise
fontdb has defaults for macOS and Windows, and for wasm we register our
copy of DejaVu. So that cannot really fail....
When processing window specific events, or generally when accessing
the ALL_WINDOWS refcell, keep the time for borrow to an absolute
miniumum. That way any subsequent method calls may further acquire the
refcell.
This patch re-organizes the entire deeply nested window event handling
in a function with slightly less indentation.
Fixes a panic when calling hide on a Window from within a callback
handler.
Fixes#539