Commit graph

24 commits

Author SHA1 Message Date
Olivier Goffart
d924ec6bd9 Fix a bug when using layout within a for loop 2020-09-07 14:03:46 +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
092411ccef Attempt to merge the layout code between rust and C++
This does not actually merge so much but it is better than nothing.

I was not able to merge the code from the interpreter because of the life time issues
2020-08-12 11:53:39 +02:00
Olivier Goffart
479173c22f Implement spacing in GridLayout 2020-08-05 15:42:38 +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
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
30acb11362 Fix handling of properties of nested optimized layout elements
We need to traverse also into the expressions of nested layouts to ensure
any references inside are updated as the
"virtual" properties are moved.
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
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
Olivier Goffart
8b6bb47af8 Create a type alias for Rc<RefCell<Element>> 2020-06-11 15:28:51 +02:00
Olivier Goffart
907bea3d3b Layout for rust 2020-06-10 19:41:24 +02:00
Olivier Goffart
96a372e45d Grid layout in the interpreter
current imploementation is just a prototype
2020-06-10 19:40:47 +02:00