Olivier Goffart
d924ec6bd9
Fix a bug when using layout within a for loop
2020-09-07 14:03:46 +02:00
Olivier Goffart
59dbb610be
Materialize fake properties such as layout width/height
2020-09-01 18:49:49 +02:00
Olivier Goffart
2144975dad
Fix setting row in GridLayout with the row property
2020-09-01 14:27:00 +02:00
Olivier Goffart
a36cb2d9b4
Layout: add a padding shorthand property
...
Also fix a bug in the C++ code generator where two layout have padding
in the same component
2020-09-01 13:29:13 +02:00
Simon Hausmann
5dbd0b213c
Add support for grid layout padding
2020-08-28 15:06:14 +02:00
Simon Hausmann
7976a4057f
Improve handling of nested layouts
...
We support directly nested layouts, but we did not support indirect
nesting:
GridLayout {
Rectangle {
l2 := GridLayout { ... }
}
}
This patch fixes that by detecting this scenario and merging the layout
info of the element (Rectangle) and the layout inside (l2). This makes
it much easier to create re-usable components that use layouts
themselves and allows placing them in layouts.
2020-08-28 15:06:14 +02:00
Olivier Goffart
58cdaeb8dd
Update license header to mention that commertial option are available
2020-08-26 13:23:42 +02:00
Simon Hausmann
2823f32692
Apply license headers to all non-binary/non-json sources
2020-08-17 17:55:20 +02:00
Olivier Goffart
7e1af72a2e
Implement minimum/maximum width/height properties
2020-08-12 14:00:51 +02:00
Olivier Goffart
479173c22f
Implement spacing in GridLayout
2020-08-05 15:42:38 +02:00
Simon Hausmann
e0c9f9a71d
Parse nested grid layouts
...
They don't work at run-time yet though.
2020-07-30 10:22:29 +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
8f8971f321
Move the grid and path layout extraction code into separate helper function
...
That'll make it easier to call them for nested layouts.
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
733f44f50b
Error when using a layout property outside of a layout
2020-07-28 18:24:36 +02:00
Olivier Goffart
5b2add75e4
Parse the row/col/rowspan/colspan in a layout
2020-07-28 18:04:16 +02:00
Olivier Goffart
f02512f467
Allow to get the span of a binding
2020-07-28 18:02:23 +02:00
Olivier Goffart
b57f3775c9
Refactor GridLayout
2020-07-28 10:31:05 +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
abe6888296
Collect proper per-file diagnostics in the compiler passes
...
When creating diagnostics in the passes, report them correctly in the
build diagnostics. There's no automated test yet, but it was manually
verified.
2020-07-21 15:27:41 +02:00
Simon Hausmann
f8c0eb0bd6
Prepare for passing passing more information from syntax node to diagnostics
...
Let the bulk of the push_error() calls take a Spanned trait impl, so
that we can pass node on the call sites. Then when later change the
underyling trait to pass something that can also provide the source file
and we don't have to change all call sites again.
2020-07-20 16:01:15 +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
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
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
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
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
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
56aad7f474
Fix looking up of 'id' so that we can't access inaccessible id
2020-06-16 16:04:38 +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
8b6bb47af8
Create a type alias for Rc<RefCell<Element>>
2020-06-11 15:28:51 +02:00
Olivier Goffart
96a372e45d
Grid layout in the interpreter
...
current imploementation is just a prototype
2020-06-10 19:40:47 +02:00
Olivier Goffart
ed69f4c432
WIP layouts
2020-06-10 19:40:47 +02:00
Olivier Goffart
a756b7fa0e
Keep a reference to the AST node in the Element structure
...
So we can give error for elements
2020-06-09 18:20:32 +02:00
Olivier Goffart
c05da294a1
Add GridLayout and Row
...
The compiler currently lowers them to nothing
2020-06-09 12:46:16 +02:00