Provide a layout_info implementation for sub-components and call it. This
disables the lowering the implicit_layout_info call again,
also to ensure that when this
is installed from the use-site of the sub-component, the self can be used to obtain
the info (by calling the new generated function).
For the item index generation and the member population for the C++
structs, a level-order variant of `recurse_elem` is sufficient - as also
indicate by the unused item index parameters.
In the generator for producing the members of built-in items, repeaters
or sub-components, we don't need to traverse into sub-components. The
C++ compiler will take care of instantiating the fields of
sub-components after all.
For the item tree however we do need to recurse, so this change attempts
to do that. Repeaters are explicitly not handled yet though.
Instead of requiring inlining, assume that the generated code will provide an
implementation of layouting_info as well as root_item.
They're not implemented yet though.
Within sub-components we only know the local item index, and together with the
offset provided in the constructor we'll be able to
compute the correct index for items that's needed sometimes,
for example for focus setting.
The item indices are still wrong though, that'll need fixing in the corresponding pass.
Besides `is_global()` add `is_root_component` to Rc<Component>, so that
we can distinguish between the main component (that should have the full
API, etc.) and supplementary components.
This also avoids the generation of unnecessary members when inlining is
disabled.
The generation is still incomplete, but this change passes them to the C++ generator
when not inlining.
Another option would've been a "inline: bool", but that won't suffice in
the future when we may want to use heuristics to selectively inline some
and others not. And always taking used_types.sub_components is wrong
when inlining as those are ... inlined.
Similar to the parent commit, the model tracks changes to the rows and
marks an internal property dirty. Since we have a base class this is a
little less intrusive.
cc #98
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 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,
};
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 '-')