Commit graph

685 commits

Author SHA1 Message Date
Simon Hausmann
7f3d1c3633 Small typo fix 2020-07-08 09:11:14 +02:00
Simon Hausmann
a5a9552557 Minor type registry cleanup
Collect all path elements in one slice, for easier re-use.
2020-07-08 09:09:06 +02:00
Simon Hausmann
c6c0f1f589 Make path arc rendering more robust
Some arcs may not result in any content, for example if the radius is too small
or start and end pointer overlap. Let Lyon do the
checking for us and handle it accordingly.

Newer versions of Lyon will allow the re-use of the SvgArc created temporarily.
2020-07-08 08:42:01 +02:00
Simon Hausmann
4c0755d6cc Change the way boolean literals are implemented
Instead of catching them at parsing time, catch them when trying to convert a qualified name node into an expression.
2020-07-07 22:53:35 +02:00
Simon Hausmann
22d838ffae Add support for true and false boolean literals 2020-07-07 22:11:41 +02:00
Simon Hausmann
f03ba40d50 Fix spurious test failures
The accepted child element types are stored in a hash map, so sort them
as part of the error message.
2020-07-07 18:21:59 +02:00
Simon Hausmann
89a05245f9 Fix SharedArray length in bytes to be a multiple of pointer alignment 2020-07-07 18:15:26 +02:00
Simon Hausmann
f646809ff4 Added ArcTo element for paths 2020-07-07 16:02:46 +02:00
Simon Hausmann
a83127ace8 Prepare the path element compilation for extensibility
Avoid any element specific code in the Rust and C++ generator and
minimize the involvement in the interpreter.
2020-07-07 14:14:17 +02:00
Simon Hausmann
1ab71b8ca3 Prepare the path element setup in the run-time for extensibility
Make the anonymous struct for the LineTo variant in the PathElement enum
as separate structure, which can be introspected using rtto::FieldInfo.
2020-07-07 14:14:17 +02:00
Simon Hausmann
9d9779ecde Fix linter warning
When docs are required, don't require them for the generated field offset module.
2020-07-07 14:14:17 +02:00
Simon Hausmann
9a73443e14 Allow for path elements to contain bindings 2020-07-07 14:14:17 +02:00
Simon Hausmann
9cf2d618d2 Use Lyon's path builder
Instead of trying to convert the individual (future) elements, let's use a builder.
This way the markup remains simple and due to
future support for bindings we can't really
pre-compute the path events anyway.
2020-07-07 14:14:17 +02:00
Simon Hausmann
fdf7169459 Fix is_constant for Expression::PathElements
Respect the constant'ness of the contained expressions.
2020-07-07 14:14:17 +02:00
Simon Hausmann
a71c67152e Revert "Prepare for additional path elements"
This reverts commit d143addb07.

We're going to need to support binding expressions in path elements.
2020-07-07 14:14:17 +02:00
Olivier Goffart
d0b44a125d Support for if expression in the interpreter
Dynamic model or expression not yet supported
2020-07-03 17:56:48 +02:00
Olivier Goffart
90532e80d2 C++: Support of dynamic model and if expression 2020-07-03 17:37:07 +02:00
Olivier Goffart
20369c7fc7 Fix nested components 2020-07-03 14:04:51 +02:00
Olivier Goffart
1cbd522a03 Rust: make non-constant model and if expression work 2020-07-03 14:04:23 +02:00
Olivier Goffart
769474a478 Introduce a property listener 2020-07-03 13:02:50 +02:00
Olivier Goffart
b529a021a2 Fix bug in the property linked list
Not having a prev can happen if the property itsalf was destroyed.
2020-07-02 18:08:46 +02:00
Olivier Goffart
90ed79e39f Remove unused code in the animation driver 2020-07-02 17:36:34 +02:00
Olivier Goffart
055a3baf90 Remove the binding when the animation on value is finished. 2020-07-02 17:28:04 +02:00
Olivier Goffart
9d852f802e Property refactoring
The tests are working and everything seems to be back normal.
But there is still some cleanup required
2020-07-02 14:14:49 +02:00
Simon Hausmann
facc18d0eb Fix formatting
RA stopped working for some odd reason :-/
2020-07-02 11:25:29 +02:00
Simon Hausmann
d143addb07 Prepare for additional path elements
Require that the values to the path element properties are numerical literals.
The conversion happens in the path "compilation" pass, where we can do more
pre-calcuation in the future.
2020-07-02 10:40:31 +02:00
Simon Hausmann
196aef5fbe Fix C++ linkage on Linux
Apply the same workaround for missing symbol exports as in commit
54f81d4d29
2020-07-02 09:10:06 +02:00
Simon Hausmann
9bf3533c9b Fix C++ build
Accidentally remove the .h extension from the color generated header file :)
2020-07-02 08:56:34 +02:00
Simon Hausmann
e54931ea9b Remove stray debug output 2020-07-02 08:50:16 +02:00
Simon Hausmann
5e61ed4ad2 Implement Path and LineTo in the markup 2020-07-01 15:13:23 +02:00
Simon Hausmann
4e22c2839e Add the rendering primitives for rendering a path
Right now the path is limited to polygons (only LineTo elements) and only the fill color can be specified.
2020-07-01 14:58:09 +02:00
Simon Hausmann
e4ab64f858 Add a SharedArray type
This is based on the SharedString code and will allow sharing ownership
of arrays between Rust and C++.
2020-07-01 14:58:09 +02:00
Olivier Goffart
6863c3f631 Use scoped_thread_local for the CURRENT_BINDING 2020-06-30 10:11:34 +02:00
Olivier Goffart
009addf9b4 Logical operations and comparisons and unary operators 2020-06-29 18:40:37 +02:00
Olivier Goffart
c4b1feeea0 Parse Equality opreration
(Code generation still missing)
2020-06-29 18:40:37 +02:00
Simon Hausmann
c653f555ea Begin parsing Path elements
As types they follow the regular syntax convention of elements and
properties, but they are contextually restricted.
2020-06-29 16:48:20 +02:00
Simon Hausmann
38b605998c Fix build 2020-06-29 16:44:54 +02:00
Simon Hausmann
85ac4ad824 Generalize the handling of contextual elements
Certainly elements are only allowed as children of certain others, such
as Row only within GridLayout, for example. This patch implements this
constraint at type lookup type and allows removing "Row" from the
general list of types that can be instantiated anywhere.

This mechanism will also be used for path elements, in the future.
2020-06-29 15:43:55 +02:00
Olivier Goffart
19a8559d3f WIP: Conditional elements
The parsing part is implemented, but not the backend as it requires
non-const "models"
2020-06-29 15:03:09 +02:00
Olivier Goffart
8851ad0f3d Interpreter: Don't copy the property_animations from the object_tree::Component to the ComponentDescription
They can be easily accessed from the original object_tree::Component
2020-06-29 11:01:20 +02:00
Olivier Goffart
89ad110fc2 Test nodejs driver: print compile error on the console if there are some 2020-06-29 10:52:48 +02:00
Olivier Goffart
967a2b94eb C++: put a pointer to the parent in the component 2020-06-29 10:35:18 +02:00
Olivier Goffart
f35c12aef1 Fix building of the nodejs frontend for the tests 2020-06-29 10:35:18 +02:00
Simon Hausmann
ba15a768d6 Add the ability to output rust code to the compiler cli 2020-06-29 09:00:35 +02:00
Simon Hausmann
df20072970 Fix comment 2020-06-29 09:00:35 +02:00
Simon Hausmann
b8ca0fe3c9 Add support for animating color properties 2020-06-27 16:51:48 +02:00
Simon Hausmann
be75cb2b21 Fix failing C++ build tests
Making color a real property type broke the build of tests that compare
color properties. Fix this and the incorrect decoding of
strings in the cast to colors, by providing a proper public C++ color
wrapper type.
2020-06-27 16:09:59 +02:00
Simon Hausmann
f7517f403c Make the color a valid property type
This replaces Property<u32> with Property<Color>
2020-06-26 21:46:37 +02:00
Simon Hausmann
288ad0cba8 Add support for animations of declared properties
* Make sure to move the animation declarations when moving property
  declarations to the root
* In the interpreter, we need to do a little extra dance to get the RTTI
  right for custom properties and also apply the animations.
2020-06-26 20:33:55 +02:00
Simon Hausmann
4f2f27cbda Simplify property and binding setting code in the interpreter
Change the Property RTTI to take an optional animation, instead of
having to match on each call site.
2020-06-26 20:33:55 +02:00