Commit graph

948 commits

Author SHA1 Message Date
Simon Hausmann
298c8586d2 Fix window property propagation for the nodejs front-end 2020-07-16 08:20:20 +02:00
Simon Hausmann
64a4e749b7 Simplify path setup in the Diagnostics
Pass the path to the parse function, as that's easier at most call sites.
Also offer a convenience parse_file function.
2020-07-15 19:21:25 +02:00
Olivier Goffart
0fbf38f642 Let the compilerlib compile without the codemap dependencies
The idea is that we wouldn't need to bring this dependencies
if the interpreter is running on wasm for example
2020-07-15 19:08:00 +02:00
Olivier Goffart
dfd4a35e35 Set the DPI property according to the window's screen 2020-07-15 18:46:55 +02:00
Olivier Goffart
1dec276002 Continue adapting the window size
Implement the Rust and C++ part
2020-07-15 17:52:14 +02:00
Simon Hausmann
ddc4fb6e1f WIP: window size
Just playing around with propagating the width/height of the window.
2020-07-15 17:52:14 +02:00
Simon Hausmann
055517dc2c Remove duplicated code in Diagnostics emission 2020-07-15 17:34:11 +02:00
Simon Hausmann
8e047d3761 Simplify compiler diagnostics API
Don't require the callers to hold on to the source code string until an
eventual diagnostics code path is hit. Instead it turns out it's
simpler to let the parser consume the source code as string, where
internally after tokenizing it can be moved into the diagnostics and
from there into the code map if needed.

There are a few places where we now clone the source code, but that's
only in cases where we also extract stuff separately (test code) or the
syntax updater.
2020-07-15 17:34:11 +02:00
Olivier Goffart
96e5738785 Add a DPI variable in the interpreter and in the C++ backend 2020-07-15 17:13:23 +02:00
Olivier Goffart
20e7f3178e Rust: add a dpi variable in the component which is used when converting px to lx 2020-07-15 16:39:43 +02:00
Simon Hausmann
46bae52c15 Add support for loading types from a directory containing .60 files 2020-07-15 14:39:45 +02:00
Simon Hausmann
107aa63a7c Add the ability to extend a type registry with a .60 file 2020-07-15 14:30:02 +02:00
Simon Hausmann
2ac0805409 Minor cleanup
Don't need an accessor function in the Document for a public field. That said,
the choice of registry instance for the path "compilation" doesn't really matter,
as the lookup shall always end up
in the global registry.
2020-07-15 13:36:30 +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
Simon Hausmann
8b2ff87db9 Minor cleanup
Don't concatenate paths as strings with directory separators, use the
variant to create from an iterator. This could also be cannonicalized,
but it's not necessary AFAICS.
2020-07-14 22:12:31 +02:00
Olivier Goffart
8e7e3aaa7a Make the length its own unit 2020-07-14 17:45:03 +02:00
Olivier Goffart
4b20bf97ef Add px unit in many places
(This was done automatically with the updater)
2020-07-14 17:14:59 +02:00
Simon Hausmann
0fd3680542 Small typo fix 2020-07-14 16:48:10 +02:00
Simon Hausmann
855be51e82 Fix PropertyAnimation field population in Rust generator
Correctly use a separating comma when there are multiple bindings. This
also revers commit bcf5609d73.
2020-07-14 16:33:54 +02:00
Olivier Goffart
952ddda7c4 Force duration to have an unit 2020-07-14 16:18:12 +02:00
Simon Hausmann
bcf5609d73 Avoid test failure
Work around a problem with specifying multiple properties in property animations.
While trying to find what the problem is
and how to fix it, this patch avoids the
test failure in the CI.
2020-07-14 16:12:22 +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
Simon Hausmann
1845e495fe Fix path layout positioning
The local parameter t on a path segment wasn't normalized to the length
of the segment itself.
2020-07-14 14:23:43 +02:00
Simon Hausmann
f8024e6658 Add support for looping in animations 2020-07-14 13:22:28 +02:00
Olivier Goffart
c30aa370f3 Parse units
They currently have no real meaning
2020-07-14 11:35:45 +02:00
Simon Hausmann
a3f365417c Center items on a path layout 2020-07-14 09:43:59 +02:00
Olivier Goffart
e00491811b Get rid of the context in properties/signal 2020-07-13 18:49:06 +02:00
Olivier Goffart
ab7ae9f3e2 Some refactoring of the rust generated code
Always use a Pin<Rc> for the component. (This is required to support repeater
within repeater as well anyway)
Do not use the context within the binding. We can get along by simply capturing
a weak pointer to the component
2020-07-13 16:37:54 +02:00
Simon Hausmann
1a0d053889 Align default path layout tolerance
Use the same tolerance as when rendering
2020-07-13 16:12:38 +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
Olivier Goffart
868468b101 Interpreter: Do not use the parent component from the context 2020-07-13 13:13:23 +02:00
Olivier Goffart
d392e00c1c Implement dynamic models in the interpreter 2020-07-13 11:50:57 +02:00
Olivier Goffart
905dca7d19 Remove debug output 2020-07-13 11:50:39 +02:00
Olivier Goffart
c3d4a0fe4a Add the if.60 testcase 2020-07-13 11:40:16 +02:00
Simon Hausmann
6243df1702 Avoid unnecessary path building
When the path was constructed from events (SVG commands), then we don't really need to build an intermediate path,
neither for rendering nor for path layouting.
2020-07-10 13:59:40 +02:00
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
7c4b12a0ce Remove unused path event data structures 2020-07-10 13:02:12 +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
69325a1a5b Get rid of PathElements::StaticElements
This functionality can be folded into SharedArray later, if needed.
2020-07-10 12:47:27 +02:00
Simon Hausmann
ad98ae65ae Avoid unnecessary path building 2020-07-10 10:24:36 +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