Two problems:
- We were not marking the property as dirty, so dependent property would not
update themselves
- In the generated rust/c++ code, we would not call set_animated_value
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.
This can be reproduced by deleting the last item of the printer queue in the
printer demo.
It is a regression showing up because we now emit the MouseExit event after
the mouse grab as released.
The problem is that we upgrade the weak item, and call geometry() on it.
Calling geometry will re-evaluate the layout cache which will re-evaluate
the model which will result in the component being removed and the cache
entry having less item than expected.
It is ok to simply return 0. for these layout location since the item will
disapear anyway.
Remove the internal name again and pick the first exported one when
assigning ids. This avoids internal names showing up in code completion
or the internal types leaking into generated code.
When exporting an global multiple times under different names, make sure
that they alias in the generated code.
As a consequence, the compiler maintains the original unique name and in
Rust and C++ makes only the exported names public. In the interpreter
the internal name is theoretically still accessible from the outside.
Don't put them in a fake expression.
This simplifies a bit the expression handling, and will make
possible to fix analysis that needs a vew into the aliases
When trying to reference an instance of a repeated item, for use with
ItemRc or VRef<Item>, the item_index (or id) of the ElementRc is not
directly what we want.
Adjust any element references to the repeater to to the inner instance
after creating them. Also make sure that the enclosing component is
respected in the C++ and Rust generators.
Fixes#422
As a result
- The error messages will now show the error with `-` instead of `_`
- The LSP will auto-complete with -
- The interpreter's list of properties will list the property with '-'
(but we made the change so that set_property, get_property, and so on
work also if passed a '-')
* Call unwrap() on the Result() returned by `load_from_path` to avoid `error[E0605]: non-primitive cast: `Result<Image, LoadImageError>` as `Image``
Tested manually with resource embedding disabled and compiling the memory game.
When setting a constant, we only need to use a closure for the
expression if it contains a return statement.
This saves about ~14000 llvm lines for a debug build of the printer
demo.
Further build on b3529d1b75 and move the
strong/weak reference dance into the API crate out of the generated
code.
Saves ~21k llvm lines on the printer demo (debug).
It's also possible to move the as_pin_ref() bit, but that didn't
really give any savings overall.
The binding setup functions (set_binding, set_animated_binding, etc.)
are taking the binding basically as an `impl Fn() -> T`, which means
each call site creates a new copy. The bodies of these can be quite big.
Since most of our uses follow the pattern of just capturing the
samereduce the number of copies needed parameter, we can reduce the
number of copies needed by providing wrappers.
With rustc 1.54.0 on my mbp and debug, the build time of
touch ../ui/printerdemo.60
cargo rustc
goes from 1m:15s down to 42s, and total llvm lines goes from
2079842 down to 1134237.
... by ignoring all style and complexity related lints, since humans don't typically consume the generated code.
Co-authored-by: Olivier Goffart <ogoffart@sixtyfps.io>
and replace it with the internal, re-exported WindowHandleAccess
one.
Strictly speaking, this is a breaking change. In practice the
returned type of this trait was in `sixtyfps::re_exports`, so any
public use is questionable :)
That's all it is nowadays, it's a wrapper around Rc<Window>. It's not an
alias because we need to also "wrap" it to C++ via cbindgen, but that's
about it.