Olivier Goffart
91ed04a72c
Make length
(still the default for all property) be the logical length
...
And a new `physical_length` is now the physical_length unit
Note: this does not change the runtime part yet
2021-04-21 17:15:19 +02:00
Olivier Goffart
7ae850d564
Rename Type::Length -> Type::PhysicalLength
2021-04-21 17:15:19 +02:00
Olivier Goffart
3f3a4c4ec9
Store the actual property declaration node
...
so that the goto definition can go to the right location
2021-04-18 14:19:38 +02:00
Olivier Goffart
aeff269bd4
Fix another panic caused by some NamedReference of the layout not being visited
2021-04-14 17:23:33 +02:00
Simon Hausmann
c448003e2f
Add test case for preferred size in boxes bug
...
Amends commit 7c1738eeea
This also adds the preferred-width/height fake properties to allow overriding.
2021-04-08 16:13:53 +02:00
Olivier Goffart
85986c39bd
Layouting: make the materialize fake layout property have an actual value
...
So that when we query it from the code, it has a value
2021-04-08 14:35:16 +02:00
Olivier Goffart
5dfa2549c8
Put the named reference in a Rc so it will be easier to compute the use count and suck
2021-03-29 15:16:41 +02:00
Olivier Goffart
096f55e365
Change behavior of percent sice within the layout
...
So that size with percentages don't affect the maximum/minimum size
Fixes #117
2021-02-11 20:32:26 +01:00
Simon Hausmann
1f091cb1c0
Rename Rectangle.color to Rectangle.background
...
Add support for built-in property aliases and rename `color` to
`background` - in preparation for it also changing to type brush.
Right now the alias is silent, a deprecation and overall change
will come in a subsequent change.
2021-02-02 17:01:12 +01:00
Olivier Goffart
e2db0e49dc
Fix explicit size in box layouts using for
...
Fixes #147
2021-01-29 16:35:59 +01:00
Olivier Goffart
8e8c6ab690
Avoid self-references in the created layout properties
...
Fixes #140
2021-01-28 15:06:19 +01:00
Simon Hausmann
9df18a3747
Apply default layout spacing and padding from the style
...
Extract the StyleMetrics from the style and pass it to the layout
lowering pass for application.
The tests were adjusted to explicitly specify the padding/spacing to
override the ugly style default.
2020-11-04 15:20:43 +01:00
Olivier Goffart
4a182ef4d0
Layout alignment
2020-11-03 12:22:34 +01:00
Olivier Goffart
f855b18fb0
Implement min/max size restriction on the window
...
(Implemented in the interpreter only for now)
2020-10-29 19:08:52 +01:00
Olivier Goffart
a4671502ab
Allow to speccify a fixed width/height in the layout by setting the height or width
2020-10-26 19:09:01 +01:00
Olivier Goffart
9ec2013a3a
Layout refactor: move the constraints dirrectly into the layout item
2020-10-26 17:17:29 +01:00
Olivier Goffart
47be71e16d
Introduce layout stretching
2020-10-26 16:40:35 +01:00
Olivier Goffart
7ff0b4b73f
Vertical layout
2020-10-26 14:19:12 +01:00
Olivier Goffart
aeade826fe
New runtime implementation for the box layout
...
Currently only horizontal layout is supported
2020-10-26 14:19:12 +01:00
Olivier Goffart
537051a1e4
Refactor get_layout_info_ref to contains the constraints
2020-10-26 14:19:12 +01:00
Olivier Goffart
c659c4369a
Refactor the Layout generation code
2020-10-26 10:07:31 +01:00
Olivier Goffart
de17702a38
Layout: Attempt to reduce code duplication between rust and c++ codegen
2020-10-24 12:15:21 +02:00
Olivier Goffart
ed01d8369a
Start working on VerticalLayout/HorizontalLayout
2020-10-23 14:08:58 +02:00
Olivier Goffart
27a6ff1227
Move Type and related concepts in a different module
...
Leaving only the TypeRegister in the typeregister module
2020-10-23 11:17:14 +02:00
Simon Hausmann
d8459ef00e
GridLayout cleanup
...
Separate out the padding and spacing parameter handling. A separate data
holds these and the code generation is also split out into
helper functions in the C++ and Rust generator. This will allow re-use in the future.
2020-10-13 22:52:04 +02:00
Simon Hausmann
e5b8e5d64d
Prepare for more code sharing in layout handling
...
Move layout constraints for layout items into a separate
helper struct.
2020-10-13 18:17:47 +02:00
Simon Hausmann
1b4317a93a
Minor cleanup in the layout code in the compiler
...
Free the term "Layout Constraints" for use later for the actual constraints
of layouts.
2020-10-13 18:00:54 +02:00
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