Simon Hausmann
535da41ae0
More naming cleanups
...
PathData::PathElements has one redundant "Path" in the name, so eliminate
for Events and Elements.
2020-07-10 13:06:28 +02:00
Simon Hausmann
1f7ae1b318
Rename PathElements to PathData
...
as it can now consists of elements or events.
2020-07-10 13:01:05 +02:00
Simon Hausmann
4b6e549b96
Simplify compiled path data structure
...
Use two arrays, one for events and one for coordinates. That simplifies
the code generator and the generated code, and it also provides for
a more compact memory representation.
2020-07-10 10:20:59 +02:00
Simon Hausmann
264b1f650f
Use std::size instead of hand-written version
...
Less is more :-)
2020-07-09 15:40:01 +02:00
Simon Hausmann
1a70213c05
Fix path layout implementation to allow positioning
...
This is not exposed in the API yet though.
2020-07-09 15:38:26 +02:00
Simon Hausmann
4b75ec0ee8
Lay out items on a path
...
This works, but it's still missing support for positioning of the layout
itself.
2020-07-09 15:32:47 +02:00
Simon Hausmann
a679f33871
Process path elements in PathLayout
...
Collect them and assign them to an "elements" property, like with Path {}.
Also process paths before layouts.
2020-07-09 14:18:27 +02:00
Simon Hausmann
5e8d23a287
Accept PathLayout just by syntax
2020-07-09 14:18:26 +02:00
Simon Hausmann
251ef7fc97
Add support for SVG commands in Path elements
...
Using the commands property we can just paste SVG paths. This makes it
much easier to write examples/demos. A good online path designer is
for example https://codepen.io/anthonydugois/pen/mewdyZ
2020-07-09 13:41:57 +02:00
Simon Hausmann
c17c06c6e7
Making closing of a path optional
...
By default paths are not closed and they can be closed using a Close {}
element.
2020-07-09 09:52:09 +02:00
Simon Hausmann
f45ff6ce79
Add support for stroking paths
...
This will make it easier to visualize the path for layouts.
2020-07-09 09:36:16 +02:00
Simon Hausmann
7c8cd63ddc
Fix formatting
2020-07-08 20:26:28 +02:00
Simon Hausmann
8c7068ebfc
Fix spurious test failures with type hierarchies
...
Make sure the error output is always the same and doesn't depend on the randomness
of HashSet.
2020-07-08 10:24:13 +02:00
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
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
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
9a73443e14
Allow for path elements to contain bindings
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
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
5e61ed4ad2
Implement Path and LineTo in the markup
2020-07-01 15:13:23 +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
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
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
Olivier Goffart
d267039fa8
Put a pointer to the parent component in the component
...
This means we must use Rc for the component so we can use Weak for the parent pointer.
The idea is to get rid later of the context
2020-06-26 19:26:55 +02:00
Olivier Goffart
2d22bac451
Use Pin<&Self> for Property::get
2020-06-26 13:18:04 +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
e6b386ab53
Implement property animations for C++
2020-06-25 13:38:51 +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
Simon Hausmann
e7ba02c85a
Fix animation of properties by value in the Rust generator
...
Don't require an evaluation context when setting up an animated value.
We can find out what the current value is inside evaluate.
2020-06-25 08:20:37 +02:00