two problems
- For the interpreter, properly handle the case of an alias to a global
- For the rust generator, we can't return a reference to a property held
in a global, so we must 'inline' the get_xx funciton on sub-components
I used a `#[cfg(..)]` instead of a feature flag because then it is enabled
for both the compiler and the lib at the same time, and since it is only a debug stuff
it does not need to be enabled within the project. So one must enable it with
`RUSTFLAGS='--cfg sixtyfps_debug_property'`
After commit becb4574c1 we'll
make sure not to set the plugin application attribute when initializing
the Qt backend. Unfortunately in the generated struct the NativeStyleMetrics field
is placed and initialized before the m_window. The Default::default() impl
calls `ensure_initialized()` with `from_qt_backend = false` because we don't
know what backend is being used. Since due to the ordering this is the first
call to `ensure_initialized()`, we'll end up setting the plugin application
attribute.
This patch fixes that by ensuring that the m_window field always comes first,
which is initialized with a call into the run-time library, which in turn
delegates to the backend. That'll be the Qt backend and we'll initialize
the application object correctly.
For the MCU port, we need to proccess the image to save them in the binary
in a convenient format.
This patch start this work by trying to anaylyze what format should an image
be using, and saving it as a texture in the binary.
The current graphical backend and the C++ frontend are not yet supported
This will allow later to be able to operate on the binding despite the
element is borrowed.
Since the Binding itself is in a RefCell, the analysis don't need to
be anymore.
To do this change, a small change in the binding_analysis logic was required
which means that we will now detect binding loop if a binding was causing
two binding loop. (before, only one binding loop was detected)
Somehow the focus_change_subcompo test missed this case and the visible
issue of this off-by-one was that
the combo boxes in the printer demo's settings page opened at the wrong location (wrong parent).
We use the setup_code for that for now, so apply the same logic as in the C++ generator.
However there's more work to be done later to make forward-focus work corectly into sub-components.
```
error[E0599]: no method named `unwrap` found for struct `sixtyfps::re_exports::OnceCell` in the current scope
--> .../test-driver-rust-0868c471dd25beed/out/imports_external_type.rs:384:29
|
384 | &_self.root.unwrap().upgrade(),
| ^^^^^^ method not found in `sixtyfps::re_exports::OnceCell<VWeak<sixtyfps::re_exports::ComponentVTable, imports_external_type::sixtyfps_generated_TestCase::InnerTestCase>>`
```
* Generate a visit_dynamic_children dispatch function in sub-components and call it
* Add a self_weak to sub-components
* Fix access to the window from within repeated components
* Fix the parent type of repeated elements within sub-components to be a VWeakMapped instead of VWeak
* Fix the build of the parent_item() implementation of repeated elements within sub-comps. The parent index might still be wrong, needs to be checked.
We generate a getter that hides the renaming. Instead of returning a field offset, we
might as well use the same code as for the value getter
and return a `Pin<&Property<T>>`.
What doesn't work yet are aliases to globals, because that
uses a temporary.
At the use-size a binding for width and height is created that
uses the layout info. So that function needs to be emitted for sub-components,
and access to the window needs to be provided as well.
There's cleanup for later, which is unifying the name (layout vs layouting)
and shortening the signature for
sub-component calls (no need for the window parameter).
Declare a const getter function that retrieves the field offset and call it from access_member.
Right now the indirection through
the function is not needed, but
it will be necessary when supporting aliases.
instead of in the sixtyfps! macro, so se actually see where the error is in
the generated code.
This also expose a bunch of warning that were not being taken care on.
* For sub-components create a super-primitive struct with just its fields
and a new() function to create it. There's no init() function yet.
* Provide access to the root item of the sub-component
This just makes the most trivial example work:
```
SubComp := Rectangle {}
App := Window {
SubComp {
background: green;
}
}
```
Pass the sub-component as a parameter in enter_component(), as it's needed in the C++
implementation, it's readily available (no need to unwrap again) and Rust will need it, too.
Avoid creating an intermediate array of items to free the graphics resources.
Instead call run-time function with the item tree as a parameter, which is traversed.
It's practically the same data structure that was previously created, except
that it is shared/global and has little holes for the dynamic tree items, but those are easy to skip.
This is done by exposing the ModelNotify to the caller via the new
ModelTracker trait, which has a function that allows "hooking" into the
dirty tracking of the size.
By extension, this also works in JavaScript.
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.