Commit graph

74 commits

Author SHA1 Message Date
Simon Hausmann
e914715d88 Rename Diagnostics to FileDiagnostics
As this structure holds the diagnostics just for one file.
2020-07-16 18:25:42 +02:00
Olivier Goffart
5e7d5369aa Few fixes to the layout and add a test that the items are well positioned 2020-07-16 17:22:29 +02:00
Simon Hausmann
0f0055b87c Cleanup in the expression resolution pass
It turns out that we don't need the type registry :-)
2020-07-15 13:28:56 +02:00
Simon Hausmann
5b43962bb2 Split up TypeRegistry
For a .60 files the locally defined components are now stored in a separate
per-document TypeRegistry instance that falls back to the global registry
for lookups.
2020-07-15 13:09:43 +02:00
Olivier Goffart
24033ecdc3 Support for logical_lenght type 2020-07-15 11:53:19 +02:00
Simon Hausmann
719bff4eca Minor cleanup
Don't require a mutable type registry for the compiler passes.
2020-07-15 11:25:28 +02:00
Olivier Goffart
8e7e3aaa7a Make the length its own unit 2020-07-14 17:45:03 +02:00
Olivier Goffart
952ddda7c4 Force duration to have an unit 2020-07-14 16:18:12 +02:00
Simon Hausmann
39359a4e26 Add support for an offset to PathLayout
This allows animating items on their position along the path.
2020-07-14 15:12:03 +02:00
Olivier Goffart
c30aa370f3 Parse units
They currently have no real meaning
2020-07-14 11:35:45 +02:00
Simon Hausmann
992f990fa8 Allow for fitting paths into a given bounding rectangle
... by applying a transformation. This allows designing a path in some
other path design tool and then make it fit using bindings.
2020-07-13 15:41:11 +02:00
Simon Hausmann
79ba943882 Allow for positioning grid layouts as well 2020-07-13 14:02:53 +02:00
Simon Hausmann
f6761e2c4c Allow for the positioning of PathLayouts via x/y properties
These are just "virtual" properties that will be transformed into
property members of the main struct through the optimized elements
sub-pass.
2020-07-13 13:34:04 +02:00
Simon Hausmann
e78dd1342a Fix optimized elements pass
Apply the move of bindings and properties also to the optimized elements themselves.
2020-07-13 13:30:55 +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
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
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
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
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
20369c7fc7 Fix nested components 2020-07-03 14:04:51 +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
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
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
3d85cb7f23 Add basic support for property animations to the rust generator
Setting values on animated properties now results in set_animated_value
being called on the property instead of set, and the animation data is
passed on the spot.
2020-06-24 17:54:25 +02:00
Simon Hausmann
ab697ab71d Parse animation declarations into the object tree
So

    animate x { ... }

is basically a short-hand for

    PropertyAnimation {
        ...
    }

    <magically associated that animation with x whenever x is changed>

We could also support a shared animation syntax in the future:

    blah := PropertyAnimation { ... }

    animate x with blah;
    animate y with blah;

This patch also adds a primitive PropertyAnimation struct, which will be
used by the generated code to collect the values specified in the .60
markup.
2020-06-24 17:43:48 +02:00
Olivier Goffart
f744fcccab Lookup within objects properties
Generated code not yet implemented
2020-06-22 17:35:01 +02:00
Olivier Goffart
53e61629ca Fix access to property declared within the repeater.
The move_declaration pass should recurse into sub-components for repeater elements
2020-06-22 10:26:22 +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
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
56aad7f474 Fix looking up of 'id' so that we can't access inaccessible id 2020-06-16 16:04:38 +02:00
Olivier Goffart
c940e8d734 Add missing files 2020-06-16 14:11:26 +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
81ce11ee8b Add a reference to the enclosing component in the element itself 2020-06-15 16:40:55 +02:00
Olivier Goffart
58ac9e964c Visit the model expression in the passes that visit the expressions 2020-06-15 14:00:39 +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
ef9d3963e4 Fix casting of conditional operator 2020-06-12 10:32:56 +02:00
Olivier Goffart
8713c10d48 Color literals 2020-06-11 19:26:41 +02:00
Simon Hausmann
be3d0ab369 Provide convenience accessors for public properties in C++
While properties declared in the root component are named as-is and
exposed as Property<T>, their get() function in particular is hard to
use because it requires an EvaluationContext as a parameter.

This patch adds get_foo() and set_foo() accessors for each public
property and hides the evaluation context business for the getter.

The added test uses this right away and adds missing test coverage for
the conditional expression.
2020-06-11 15:45:16 +02:00