Commit graph

555 commits

Author SHA1 Message Date
Simon Hausmann
a9f386c5b8 c++ llr: set the model binding on repeaters 2022-01-19 10:02:23 +01:00
Olivier Goffart
fbea46a13e llr-cpp: more layout_info 2022-01-19 10:02:23 +01:00
Simon Hausmann
bc2d92efdc c++ llr: emit Repeater<C, M> members for repeaters 2022-01-19 10:02:23 +01:00
Simon Hausmann
4d42995321 c++ llr: Generate the repeated component (aka item tree) 2022-01-19 10:02:23 +01:00
Simon Hausmann
eb433bf1da c++ llr: move create() function and destructor into generate_item_tree
That's where it belongs, for re-use also f repeaters in the future.
2022-01-19 10:02:23 +01:00
Olivier Goffart
fee6a26fed llr-cpp: Some layout code
This is still untested
2022-01-19 10:02:23 +01:00
Simon Hausmann
ec6f40083a c++ lrr: add nodes for repeaters to the item tree 2022-01-19 10:02:23 +01:00
Olivier Goffart
fe1e559a94 llr-cpp: initialize two way bindings 2022-01-19 10:02:23 +01:00
Tobias Hunger
8b1ea21ec4 llr-cpp: Implement some builtin functions
Add tests to make sure this actually works:-)
2022-01-19 10:02:23 +01:00
Simon Hausmann
ed60de2f01 c++ llr: add initial support for sub-components
The internal API changes a bit: generate_sub_component populates given struct with what's needed for the sub-component.

Every sub-component (including the main public compo) gets an init() function that,
similar to Rust, takes a root pointer and the tree indices.
2022-01-19 10:02:23 +01:00
Simon Hausmann
76b6e75543 cpp llr: Fix image/resource embedding
Re-enable the old code :-)
2022-01-19 10:02:23 +01:00
Simon Hausmann
abe69aa4a3 c++ llr: implement property assignment and callback calls 2022-01-19 10:02:23 +01:00
Simon Hausmann
fd4ea37ff7 c++ llr: fix support for callback initialization and declaration in the public API 2022-01-19 10:02:23 +01:00
Simon Hausmann
440c15d1b2 cpp llr: Re-add generation of structs (not llr bound) and implement Expression::Array for models 2022-01-19 10:02:23 +01:00
Simon Hausmann
cc580e4476 llr cpp: implement mod
Co-authored-by: Tobias Hunger <hunger@users.noreply.github.com>
2022-01-19 10:02:23 +01:00
Simon Hausmann
52a21ebf2d llr c++: fix generated property getters/setters
Use the new access_member function
2022-01-19 10:02:23 +01:00
Simon Hausmann
da3d97b4bf c++ llr: remove llr_ prefix from ported functions and comment/remove out old ones 2022-01-19 10:02:23 +01:00
Simon Hausmann
9b570c7365 llr cpp: Remove some commented out code that exists also in the origin non-llr method 2022-01-19 10:02:23 +01:00
Simon Hausmann
79ea070bdc cpp llr: Fix -Werror build 2022-01-19 10:02:23 +01:00
Simon Hausmann
010d374c05 Fill out more component vtable stubs to fix linking 2022-01-19 10:02:23 +01:00
Simon Hausmann
f96df74a6f llr cpp: compile the most basic export App := Window {} test case
Linking still fails though
2022-01-19 10:02:23 +01:00
Simon Hausmann
0b7eae426d llr cpp: add rudimentary support for declaring properties/callbacks 2022-01-19 10:02:23 +01:00
Simon Hausmann
eddf176d49 llr cpp: Implement more of llr_compile_expression 2022-01-19 10:02:23 +01:00
Simon Hausmann
90e9829233 cpp llr: implement PropertyReference::Local 2022-01-19 10:02:23 +01:00
Simon Hausmann
62486ed41f Implement more of llr_compile_expression
* PropertyReference
 * BinaryExpression
 * Cast
2022-01-19 10:02:23 +01:00
Simon Hausmann
51d3376731 Begin generating basic property init expressions with the llr in C++ 2022-01-19 10:02:23 +01:00
Tobias Hunger
8150e5271d WIP: Make cpp.rs use LLR 2022-01-19 10:02:23 +01:00
Simon Hausmann
360a3c3b30 Re-evaluate bindings when data in models accessed via index expressions change
Call the new track_row_data_changes function in the model before
retrieving the data.
2022-01-14 13:38:25 +01:00
Olivier Goffart
d3a9437309 Support for writing in the model with the [] syntax 2022-01-14 13:38:25 +01:00
James Blacklock
7ad1ba209d Add support for array index expressions
This is a squash of the changes in
https://github.com/sixtyfpsui/sixtyfps/pull/605
2022-01-14 13:38:25 +01:00
Simon Hausmann
6e2f55e1b8 Fix calls to solve_path_layout
The function takes a reference to the `PathLayoutData` struct, which in
turn had a reference to the path data. The old rust generator had
special knowledge of calling solve_path_layout, so it knew to take a
reference of the path data.

In the llr there's no expression to take a reference. However since
PathData is cheap to move/copy (just holds SharedVector), we can pass it
by value (move) in the PathLayoutData.

This also means a copy in C++, which I *think* is safe, because the
constructor and destructor will be called on the C++ side, and the Rust
side still just operates on references or would try to move out a field
from the struct.
2022-01-12 16:22:35 +01:00
Simon Hausmann
44297bad24 Fix build of generated Rust code for path elements with the llr
* Move the C++ elements back into private_api (despite being generated), so that struct_name_to_tokens can generate the right name in re_exports
* When generating the llr_Expression::Struct for the path elements, make sure
  that all fields are filled out, to avoid an empty value expression in Expression::Struct
  in the Rust generator. Since we don't generate tuples but a named struct, we must provide all fields.
2022-01-12 16:22:35 +01:00
Simon Hausmann
31471fcf89 Complete path support in the llr / rust generator
This patch takes care of the lowering of events/coordinates arrays as
path data, which originates from a `commands: ...` string of SVG path
commands.

In order to minimize the path specific code in the generator, the
compile_paths now generates a Vec<Expression> for the events and
coordinates.
2022-01-12 16:22:35 +01:00
Simon Hausmann
9e61d4168b Fix build of Paths with path elements with rust/llr
A `Path` with `MoveTo`/`LineTo`/etc. sub-elements now maps to an Expression::PathData of type
Type::PathData.

The llr lowering creates an Array of Type::PathElement, which is casted to PathData.

This only covers the element case. The compiled path events are still todo.
2022-01-12 16:22:35 +01:00
Tobias Hunger
79e2456ead Allow for bigger indices in VisitChildrenResult
The indexes stored in `VisitChildrenResult` are unsigned. We have 64
bits to store two values and we need to have one special value as a flag.

So accept any index `< u32::MAX` instead of `< i32::MAX`, which should
allow for more data to be visited;-)
2022-01-08 20:55:22 +01:00
Jared Moulton
c5c139fbc9
Feat: Add math funcs Log10, Log2, Log and Exp (#813)
Implement Math.log and Math.pow
2022-01-07 12:07:58 +01:00
Tobias Hunger
3e448f75eb
janitor: Remove some unnecessary references
These are immediently dereferenced by the compiler according to clippy.

Remove some now unnecessary muts to make things build again.
2022-01-04 18:22:15 +01:00
Tobias Hunger
767704a88b
janitor: Remove some redundant closures 2022-01-04 18:21:07 +01:00
Tobias Hunger
d54e2a642a
Janitor: Change push_str of a one-char str to push 2022-01-04 09:39:41 +01:00
Tobias Hunger
bfca0e3573 Mass update copyright messages to be more REUSE compliant 2021-12-22 10:06:12 +01:00
Olivier Goffart
53775465dc
C++: add version macro
Fixes #705
2021-12-06 15:36:16 +01:00
Olivier Goffart
47a4463abc Rename the sub component id to avoid error in the generated code with duplicated names 2021-11-23 12:03:03 +01:00
Olivier Goffart
d1cae710df preprocess the images at compile time
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
2021-11-19 15:54:45 +01:00
Olivier Goffart
dd3fa1c221 Make the BindingMap hold RefCell of the BindingExpression
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)
2021-11-11 11:14:59 +01:00
Simon Hausmann
8ff27671ef Fix absolute item index computation for children of nested sub-components
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).
2021-11-09 14:52:47 +01:00
Olivier Goffart
aea68b9ad8 C++: Fix subcomponents/nested_repeater.60 when not inlining
More or less the same fix as what was done in rust when the test was added
2021-11-09 12:40:04 +01:00
Simon Hausmann
13de800ba3 Internal cleanup: Rename layouting_info to layout_info
That's making the call on the Component VTable consistent(ish) with the Item VTable.
2021-11-08 10:24:30 +01:00
Simon Hausmann
7354b17a6a Minor cleanup in ItemTreeBuilder trait
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.
2021-11-04 17:55:39 +01:00
Simon Hausmann
ac945a8f37 Minor cleanup in C++ code generator
In the tree builder's enter_component we registered the sub-component as a member
and also registered the member initializer
in the constructor.

However the call to `init()` to initialize the bindings was registered in `enter_component_children` for no good reason.

It's cleaner to do that all in one place.
2021-11-04 16:27:35 +01:00
Simon Hausmann
2b98e503f1 Fix build by adding missing Write trait use 2021-11-04 11:03:44 +01:00