Simon Hausmann
36bd645e09
First stab at supporting animations in the interpreter.
...
The sub-optimal RTTI bits are replaced with a superior solution in the
follow-up commit :-)
2020-06-26 11:07:18 +02:00
Olivier Goffart
1b748792ad
Visit the item as Pin
...
A preparation to have Property::get to take Pin<Self>
2020-06-25 18:50:20 +02:00
Simon Hausmann
c18861125d
Small typo fix :-)
2020-06-25 14:22:10 +02:00
Olivier Goffart
f50a705e00
Add the #[pin] attribute to be able to project to the pinned item
2020-06-25 12:18:09 +02:00
Olivier Goffart
caca0d0ba4
Put the component in a Pin<>
...
Removed the drop and create from the ComponentVTable:
since we are not using VBox<ComponentVTable>, this simplifies a bit
the code of the interpreter and everything else.
But there is still a lot of changes everywhere to support that the Component
is pinned.
This is just for the component. Which would be required if later we want
to access the properties as Pin<Property<_>>. But we have not yet ability
to do projections
2020-06-24 14:13:27 +02:00
Olivier Goffart
85b06c3342
Interpreter: support for Object as Value
2020-06-22 19:03:54 +02:00
Olivier Goffart
f744fcccab
Lookup within objects properties
...
Generated code not yet implemented
2020-06-22 17:35:01 +02:00
Olivier Goffart
fa0c393dca
Interpreter: Fix property access from parent component in repeater element
2020-06-22 15:22:38 +02:00
Olivier Goffart
f8b7989c0b
Access the properties in the parent component of a repeated element
...
This required some refactoring of the EvaluationContext structure to include the parent context
2020-06-22 14:38:38 +02:00
Olivier Goffart
1bb8d94ab8
Support array for model in rust and in the interpreter
2020-06-19 19:46:59 +02:00
Olivier Goffart
6238d0d14f
Prepare for the ability to access the model
...
Add an expression type for the access of the model variable from a repeater
2020-06-19 13:46:55 +02:00
Olivier Goffart
864e74601d
Add a Model type for
...
I guess in the future we want to make model a type that knows its inside
2020-06-19 13:13:19 +02:00
Olivier Goffart
be8f127317
Object and array parsing
2020-06-18 15:22:30 +02:00
Olivier Goffart
8f0520f2be
Repeater in the viewer
2020-06-17 15:43:57 +02:00
Olivier Goffart
5cd4ed7347
Arithmetic operations
2020-06-16 19:04:03 +02:00
Olivier Goffart
d7fe69ff74
Lookup the index from a repeater expression
2020-06-16 17:23:38 +02:00
Olivier Goffart
a4423374d8
Fix warnings
2020-06-16 13:59:10 +02:00
Olivier Goffart
6122f91fba
Begin with the generation of rhe repeater (rust only for now)
2020-06-16 13:47:02 +02:00
Olivier Goffart
2fa7005c9a
Interpreter: Int32 is a i32, so it can represent the negative numbers
2020-06-15 16:46:27 +02:00
Olivier Goffart
81ce11ee8b
Add a reference to the enclosing component in the element itself
2020-06-15 16:40:55 +02:00
Olivier Goffart
9adc55cd70
Partially revert the refactoring that changed the Element::children list
...
Put the information about RepeatedElement in an Option within the normlal Element
2020-06-15 13:42:11 +02:00
Olivier Goffart
136a90907b
Refactor the element children to account for RepeatedElements
2020-06-12 22:24:50 +02:00
Olivier Goffart
95f63795d5
Gate the corelib::rtti module on the rtti feature
2020-06-12 21:04:27 +02:00
Olivier Goffart
30b201d946
Reduce the use of unsafe in corelib and in the rust backend
2020-06-12 19:03:15 +02:00
Olivier Goffart
e7644eba94
Fix C++ compilation with the new item visitor
2020-06-12 17:09:51 +02:00
Olivier Goffart
66dc643bf9
WIP: refactor the item visitor
...
The C++ part hasn't been ported yet and some things still need polish
Introduce a visitor to not rely on the unsafe ItemTreeNode array.
2020-06-12 13:32:40 +02:00
Simon Hausmann
84d8eaa130
Add support for emitting signals for nodejs and the interpreter
...
This also enables the property and signal accessor test case for js.
2020-06-12 10:38:01 +02:00
Olivier Goffart
e95d7da888
Parser: typed syntax node accessor
2020-06-11 17:50:28 +02:00
Olivier Goffart
8b6bb47af8
Create a type alias for Rc<RefCell<Element>>
2020-06-11 15:28:51 +02:00
Olivier Goffart
9c23326c60
Layout for the C++ as well
2020-06-10 19:41:24 +02:00
Olivier Goffart
907bea3d3b
Layout for rust
2020-06-10 19:41:24 +02:00
Olivier Goffart
96a372e45d
Grid layout in the interpreter
...
current imploementation is just a prototype
2020-06-10 19:40:47 +02:00
Simon Hausmann
63f81e1991
Add basic support for conditional expressions
...
Todo are automated tests and cleaning up the C++ implementation.
2020-06-10 16:04:15 +02:00
Simon Hausmann
ea52c7c9c9
Fix typo
2020-06-10 12:03:46 +02:00
Olivier Goffart
58618c0683
Documentation for the interpreter
2020-06-10 09:26:11 +02:00
Olivier Goffart
300cb26208
Rename the interpreter crate to sixtyfps_interpreter
2020-06-10 08:41:49 +02:00
Simon Hausmann
1404cb73ae
Add support for embedding resources in the rust generator
...
This is relatively straight-forward via a pass in the compiler to
collect the resources to embed and then use include_bytes! (once per
resource).
What's really annoying is that the rust resource enum can't store a
&'static [u8] because cbindgen doesn't represent that, probably because
the slice representation isn't guaranteed to stay as it is. So instead
this, for now, uses raw pointers.
2020-06-09 22:54:29 +02:00
Simon Hausmann
5bae6e01a5
Prepare for the ability to embed image data
...
The Image's source property used to be a string. Now it is a Resource
enum, which can either be None or an absolute file path to the image on
disk. This also replaces the internal Image type.
The compiler internally resolves the img bang expression to a resource
reference, which shall remain just an absolute path. For now the target
generator passes that through, but in the future the target generator
may choose a target specific way of embedding the data and thus
generating a different Resource type in the final code (through
compile_expression in the cpp and rust generator).
The C++ binding is a bit messy as cbindgen doesn't really support
exporting enums that can be constructed on the C++ side. So instead we
use cbindgen to merely export the type internally and only use the tag
from it then. The public API is then a custom Resource type that is
meant to be binary compatible.
2020-06-09 22:54:29 +02:00
Simon Hausmann
afd7319ae5
Rename corelib to sixtyfps_corelib
...
This is consistent with the other packages and since corelib is now also
a cdylib, libsixtyfps_corelib.so looks much better than libcorelib.so
:-)
2020-06-09 13:27:18 +02:00
Olivier Goffart
c05da294a1
Add GridLayout and Row
...
The compiler currently lowers them to nothing
2020-06-09 12:46:16 +02:00
Olivier Goffart
9fc60e104f
Add another way to load .60 files from a build script
2020-06-05 13:45:38 +02:00
Olivier Goffart
3651885d87
Move the compiler binary in tools/
...
And rename sixtyfps_compiler to sixtyfps_compilerlib
2020-06-05 09:23:38 +02:00
Olivier Goffart
7a8c549625
Be able to read or write properties from JS
2020-06-04 15:48:39 +02:00
Olivier Goffart
49d2aec7e2
Node: add possibility to add signal handler
...
Right now, this only works once and then panic the second time
2020-06-04 12:49:33 +02:00
Olivier Goffart
5ee09398e8
Node: Allow to init properties to value
2020-06-03 17:33:45 +02:00
Olivier Goffart
30d61452ba
Interpreter and node API: some refactoring towards being able to set properties from JS
2020-06-03 17:33:43 +02:00
Olivier Goffart
fd829fc89f
Some more refactoring of the interpreter
...
Move the content of lib.rs to a module so we can have some
kind of public api in the lib.rs
2020-06-03 17:33:26 +02:00
Olivier Goffart
0a48252702
Interpreter: implement the ComponentVTable properly
...
with the drop and construct function
2020-06-03 17:33:26 +02:00
Olivier Goffart
8cfde5be5e
Refactor the creation of dynamic type in the viewer
...
Put the creation of dynamic type in another module.
Respect the alignement.
2020-06-03 17:33:26 +02:00
Olivier Goffart
a8f02df642
Refactor the viewer into a binary, and an interpreter crate
...
The interpreter can be used from other crates such as the test or the JS for example
2020-06-02 17:05:48 +02:00