Commit graph

68 commits

Author SHA1 Message Date
Simon Hausmann
aafb96cb93 Get rid of abi::datastructures::WindowProperties
Instead, pass a reference to the root item when mapping the window,
at which point we can downcast to the new Window item. If we have one,
then we'll read its width/height (for initial values) and install
bindings to keep them up-to-date.
2020-08-12 09:44:42 +02:00
Simon Hausmann
f2eec61968 Add a window to the top-level component
This means that we always have a window and for the C++
API we don't require this ComponentWindow use anymore.
2020-08-11 13:38:38 +02:00
Olivier Goffart
f0511c9210 Fix javascript from last commit 2020-08-10 14:11:33 +02:00
Olivier Goffart
f4cce26d51 Test the mouse click 2020-08-10 12:54:29 +02:00
Simon Hausmann
fcc819e395 Add support for enums to the compiler
This replaces the duplicated text alignment enums
2020-08-07 13:15:43 +02:00
Simon Hausmann
aecf6a8878 Center text in buttons in the demo and gallery
This adds horizontal_alignment/vertical_alignment properties, along with
width/height to Text.

This still uses a hard-coded enumeration in the compiler, which is meant
to go away in favor of general enum support.
2020-08-07 10:02:52 +02:00
Simon Hausmann
41671e3efb Represent the window scale factor conversions in the IR
That means less code in the generators and easier to extend in the
future with more built-in functions.
2020-08-04 12:49:37 +02:00
Simon Hausmann
37f874a26b Rename test_ellapse_time to mock_elapsed_time 2020-08-03 17:52:42 +02:00
Simon Hausmann
f2166d91a6 Move tests out of abi 2020-08-03 17:48:17 +02:00
Olivier Goffart
5f38f03a1b Test setting signal handler and a few fix to make it work
We were not parsing CodeBlock node from the signal handler correctly,
we wer eonly taking the first expression instead of the whole codeblock

In JS, emitting signal before the show() did not update the GLOBAL_CONTEXT
needed to emit signals defined in JS
2020-08-03 15:01:10 +02:00
Simon Hausmann
ce7f66320b Move datastructures::Resource into graphics
It's only used for graphics at the moment and used
for image resources.
2020-08-03 12:47:05 +02:00
Simon Hausmann
aa398c6277 Rename Resource::EmbeddedDataOwned -> EmbeddedRgbaImage 2020-08-03 12:20:17 +02:00
Olivier Goffart
00c32e9c6d vtable: remove the convinient type alias from the macro
If one really need them, they can be implemented by the user
2020-08-03 11:03:24 +02:00
Simon Hausmann
6c5d423cd4 Rename sixtyfps_corelib to sixtyfps-corelib 2020-08-03 10:01:58 +02:00
Olivier Goffart
46a011683f Implement easing curve in the runtime 2020-07-29 15:20:28 +02:00
Olivier Goffart
feec73674f Start implementing easing curve 2020-07-29 15:19:41 +02:00
Olivier Goffart
b8299747c6 WIP: some draft of a Qt style 2020-07-24 17:59:23 +02:00
Simon Hausmann
88fb491837 Add support for mapping elements to different native classes
The Rectangle element has properties for a border outline. If those are
used, then the generated code should use BorderRectangle. But if they are
not used, then we can fall back to just generating a Rectangle.
2020-07-24 17:48:19 +02:00
Olivier Goffart
232848de9e Make sure that there is only one error reported when assigning to invalid
This also start parsing assignment ('=') as a self assignement
but the code generation is not yet implmented
2020-07-24 11:33:00 +02:00
Olivier Goffart
05c5f7c53d Test and fix animations on properties
The animation should not start when the property is initialized, only when the
property is set by the setter
2020-07-23 11:45:34 +02:00
Simon Hausmann
0aaa163058 Add support for specifying include paths to the nodejs API
I tried passing this as a component of the file name (uri style with a query),
but nodejs wants only valid paths for
require() calls. So instead this uses simply an environment variable.
2020-07-19 18:29:37 +02:00
Simon Hausmann
2f0718bffa Add include path options to the viewer and compiler
This allows specifying additional component locations. It works for
simple structs, but not yet for more complex types due to a bug yet to
be fixed :-)
2020-07-17 15:26:35 +02:00
Simon Hausmann
298c8586d2 Fix window property propagation for the nodejs front-end 2020-07-16 08:20:20 +02:00
Olivier Goffart
dfd4a35e35 Set the DPI property according to the window's screen 2020-07-15 18:46:55 +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
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
24033ecdc3 Support for logical_lenght type 2020-07-15 11:53:19 +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
Olivier Goffart
e00491811b Get rid of the context in properties/signal 2020-07-13 18:49:06 +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
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
be60079f21 Add support for pre-compiled paths
They are represented as lyon-style path events. We can use this to
compile SVG paths ahead of time and use them
without including lyon's SVG path builder.
2020-07-09 10:43:49 +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
5629683942 Remove PathElements::as_slice()
This function is not needed anymore
2020-07-09 08:54:19 +02:00
Simon Hausmann
f646809ff4 Added ArcTo element for paths 2020-07-07 16:02:46 +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
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
f7517f403c Make the color a valid property type
This replaces Property<u32> with Property<Color>
2020-06-26 21:46:37 +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
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
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
Simon Hausmann
9df888578f Expose a ComponentWindow type in Rust
This comes with a factory function that re-directs to the backend and a
run member function to replace
sixtyfps_runtime_run_component_with_gl_renderer. For now it's all still
hidden in the generated run() method.
2020-06-17 19:15:18 +02:00
Olivier Goffart
58b450b7de Supress warning about unused variable and add a small test
No need to chack that the signal exist since `emit_signal` will
actually return an error in that case already, and this is not
possible to call emit_signal on a invalid signal from the public
API

The test is unrelated
2020-06-12 11:11:45 +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
Simon Hausmann
1a7a95a890 Reformat to pass CI 2020-06-10 18:53:57 +02:00