Olivier Goffart
23fe57827d
Fix event handling in interpreter
...
The type was not right
2020-08-10 17:25:35 +02:00
Olivier Goffart
9af5c0b69d
Slider in Qt style
2020-08-10 16:01:06 +02:00
Olivier Goffart
36243ccdf7
Traverse item front to back for input events
2020-08-10 10:45:02 +02:00
Olivier Goffart
2c276bba63
Handle grabbing in the interpreter
2020-08-07 16:06:49 +02:00
Olivier Goffart
5aa7ee86fe
Use a newtype for VisitChildrenResult instead of just isize
...
Makes the code easier to unserstand
2020-08-07 16:06:49 +02:00
Olivier Goffart
55ec533c40
WIP input events
...
Compile and passes tests. But the mouse event are currently not working
2020-08-07 16:06:49 +02:00
Olivier Goffart
479173c22f
Implement spacing in GridLayout
2020-08-05 15:42:38 +02:00
Simon Hausmann
5dfb9aa875
Fix initialize size of printer demo
...
Map it to 800x600 logical pixels for a better initial look.
This implements respecting the initial values for width/height and tries
to apply them to the window begin created.
The PinnedOptionalProp wrapper is needed because while cbindgen mapped
the previous Option<&...> to a raw pointer, the new Option<Pin<&...>> is
not detected as a pointer.
2020-08-05 13:22:53 +02:00
Olivier Goffart
2dd3cecc5a
Add a SpinBox
2020-08-05 12:56:13 +02:00
Olivier Goffart
894d44e3ac
Correctly print syntax errors in the viewer
...
(instead of panicking because of invalid synstax_node invariant)
2020-08-04 12:59:49 +02:00
Simon Hausmann
4f0bf0b982
Rename dpi to (window) scale_factor
2020-08-04 09:01:30 +02:00
Simon Hausmann
0252d2ac34
Move slice out of abi
2020-08-03 17:41:16 +02:00
Simon Hausmann
9b13b363c3
Move corelib::abi::properties to corelib::properties
...
And the bits that are only there for the C binding are now in an ffi sub-module.
2020-08-03 17:32:28 +02:00
Olivier Goffart
1bfd708784
Change the field_offsets() function to a FIELD_OFFSETS associated const
2020-08-03 16:04:55 +02:00
Simon Hausmann
a662d36dc3
Move ItemTreeNode from datastructures into item_tree
2020-08-03 14:38:08 +02:00
Simon Hausmann
45b02e9a3e
Move the item visitor bits from datastructures into item_tree
2020-08-03 14:10:32 +02:00
Simon Hausmann
b05a11945e
Move datastructures::LayoutInfo into layout
2020-08-03 13:31:43 +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
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
69beab5957
Rename corelib::abi::primitives to corelib::items
2020-08-03 10:32:03 +02:00
Simon Hausmann
c29791fbaa
Replace a few qualified abi::primitives paths with uses
...
That'll make it easier to do the next rename :-)
2020-08-03 10:13:32 +02:00
Simon Hausmann
480a8470f5
Remove dead code
2020-07-30 19:51:33 +02:00
Simon Hausmann
1265c7f3d1
Fix crash with path layouts in the interpreter
2020-07-30 15:32:24 +02:00
Simon Hausmann
3f58d011c2
Add support for nested grid layouts to the interpreter
2020-07-30 14:46:08 +02:00
Olivier Goffart
9760cf4969
Begin to implement a Flickable
...
The implementation is still very rough and will need to be improved
2020-07-30 14:36:21 +02:00
Simon Hausmann
94433b9bf1
Implement get_property_ref for Layouts in the interpreter
...
We can fetch the Property<> references from the custom_properties hash
by using the property name that was changed in the moving declarations
pass.
2020-07-30 10:24:03 +02:00
Simon Hausmann
e881d89bf9
Get rid of visible x/y properties in GridLayout
...
It doesn't really make sense to have them in the API, the grid layout is
supposed to "own" the surrounding space. That can be an element and then
it should be a (0, 0) and distribute the element's width/height, or in
the future it can be a cell of a grid layout. Then there's an (x/y), but
that's implicit / hidden.
2020-07-29 18:52:22 +02:00
Simon Hausmann
4fccbba29d
Prepare for "virtualizing" the grid layout's width/height
...
Instead of storing the "within" element that we unconditionally take the
"width" and "height" properties from, let's pass through a property
reference expression to the width/height to use. For now that's still
the layout parent's width/height, but with this it can be replaced in
the future to refer to a "virtual" property that belongs to parent cell.
2020-07-29 18:52:22 +02:00
Simon Hausmann
00271a3746
Extend the layout data structure in the compiler to allow nesting
2020-07-29 18:52:22 +02:00
Simon Hausmann
f853843bc4
Store layouts in a common enum and vector
...
That'll make it easier later to allow for nesting them.
2020-07-29 18:52:02 +02:00
Olivier Goffart
b57f3775c9
Refactor GridLayout
2020-07-28 10:31:05 +02:00
Simon Hausmann
09cae799d3
Fix return type of compile_syntax_node
...
All call sites are only interested in the root component, so might
as well return that.
2020-07-28 09:21:32 +02:00
Simon Hausmann
2425c366db
Fix build without Qt, part 2
...
A really clean build still brough up the issue that the C++ code was failing to build.
Instead, guard those places with #cfg just in the style crate and provide
"empty" items otherwise. That also simplifies the usage site again.
This time tested with git clean -fdx :-)
2020-07-28 08:58:13 +02:00
Simon Hausmann
b07f577aa4
Fix build without Qt
...
If we can't find qmake, don't use the qt_style crate
2020-07-27 15:26:13 +02:00
Olivier Goffart
d77d7cddc3
The viewer can use the Qt style with --style qt
2020-07-24 18:06:55 +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
Simon Hausmann
6c27451761
Begin separating builtin elements from the underlying types
...
This uses a NativeClass type in the registry to represent the underlying
Rust/C++ types.
2020-07-24 16:11:46 +02:00
Simon Hausmann
a03e0dc5d6
Fix gallery.60 in the interpreter
...
Forgot to collect RTTI for BorderRectangle :-)
2020-07-24 10:34:27 +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
Olivier Goffart
1a1d3dbec0
Store two consecutive read of the same variable in a temporary variable
...
Avoid to create too many dependencies when not required.
Especially the state transformation can create a lots of read to the same property
2020-07-22 17:24:26 +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
Olivier Goffart
6c54dfb67d
Layout the item in a PathLayout if they are part of a repeater
2020-07-17 15:00:12 +02:00
Simon Hausmann
ada5f68908
Add aggregating BuildDiagnostics
...
This type aggregates different per-file diagnostics into a similar interface,
in preparation for reporting diagnostics from multiple source files.
2020-07-17 12:10:25 +02:00
Simon Hausmann
5dc53f0f79
Remove unused diagnostics argument in the interpreter
2020-07-17 11:52:29 +02:00
Simon Hausmann
893b5132c8
Further encapsulate Diagnostics
...
Use has_error() and a new convenience function to get the diagnostics as a string vector.
2020-07-17 11:52:29 +02:00
Simon Hausmann
732a56259f
Simplify compilation call sites further
...
Move run_passes into the library compilation function. That way the
FileDiagnostics are created by the parser, can be passed on to the library
compilation function and after that we don't need them anymore and can
replace them with future BuildDiagnostics for example.
2020-07-16 18:53:59 +02:00
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
Simon Hausmann
c3aae7648a
Further simplify compilation call sites
...
Remove the need to construct the type registry at all the call sites by
offering a compile_syntax_node function in the compiler library.
2020-07-16 09:25:26 +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
dfd4a35e35
Set the DPI property according to the window's screen
2020-07-15 18:46:55 +02:00