Commit graph

651 commits

Author SHA1 Message Date
Simon Hausmann
f4ffbd3d3d Fix panic when editing text after programmatically replacing it
When replacing the text, it may happen that the cursor position becomes outdated.
As per #331 we should make sure that this is handled also on an API level,
but this patch at least avoids the panic triggered by using editing.
2021-07-19 18:30:06 +02:00
Olivier Goffart
722ae70284 Test: Don't use rust syntax to initialize C++ struct
I wonder why it worked with gcc, this is not even the C++20 syntax
2021-07-15 18:35:44 +02:00
Olivier Goffart
e633ee825d Fix error with struct that are only referenced by callbacks
We would have a compilation error in rust or C++ because the
collect_struct visitor would not visit these type and not produce
them correctly
2021-07-15 14:06:49 +02:00
Olivier Goffart
cc8249212d Fix name conflict when having two global with the same name in different files
Give globals an unique id so two global with the same name imported
from different file don't clash

Fixes #159
2021-07-13 14:36:38 +02:00
Olivier Goffart
1eb54a4743 The clip property now clips the mouse events
Fixes #180

Note that there is still a small issue that the clipped element may
not recieve the MouseExit event because it is still considered
having the mouse.
2021-07-12 15:39:39 +02:00
Tobias Hunger
dc51d4ccda Use impl Default instead of new() constructors 2021-07-12 13:22:25 +02:00
Olivier Goffart
7193cbeec1 Revert "C++ Fix struct with a field that has the same name as the struct itself"
This reverts commit 9e70e009a2.

This turns out to break CI

Changed the test not to use the same name for a field and the struct
2021-07-09 15:52:28 +02:00
Olivier Goffart
9e70e009a2 C++ Fix struct with a field that has the same name as the struct itself 2021-07-09 14:37:42 +02:00
Olivier Goffart
6ed5044940 Fix rust compilation when using keywords in struct 2021-07-09 13:33:09 +02:00
Olivier Goffart
5c18e100b0 Fix unary operator + in rust 2021-07-09 12:52:18 +02:00
Olivier Goffart
8e52b7d865 Fix bug that caused two way binding to sometimes disapear 2021-07-08 17:44:50 +02:00
Olivier Goffart
6cd9d77abd Test flickable to actually test something
For some reason the test was disabled, and one of the value was off

Also add a InheritFlickable (just so we test Flickable in sub components)
2021-07-07 17:48:34 +02:00
Olivier Goffart
920903ad19 Throw an error if there are duplicated id in a component 2021-07-07 12:31:40 +02:00
Tobias Hunger
ec5646566a Janitor: Use insert over insert_str to insert a single character 2021-07-03 22:34:53 +02:00
Tobias Hunger
af7e53566b Janitor: clippy says to prefer writeln! over write! ending in \n 2021-07-03 22:34:53 +02:00
Olivier Goffart
13bd828b96 Update license date 2021-07-02 15:55:54 +02:00
Olivier Goffart
9faf16ebe1 GridLayout: fix layout with rowspan and colspan
One should not simply distribute the maximum and minimum sizes amongst
the spans, one should make sure that each coinstraints is respected
2021-07-02 12:30:07 +02:00
Olivier Goffart
35e20763a7 More replacement of &*std::begin with std::data
Complement the previous commit.
It is not ok to call *std::begin for an empty vector.

Also added a test for it.
2021-06-30 17:10:58 +02:00
Olivier Goffart
32e59cf040 Fix division by 0 when layouting empty images 2021-06-22 14:27:01 +02:00
Olivier Goffart
cb75d44acc Fix setting model properties to aliased properties 2021-06-22 13:31:27 +02:00
Olivier Goffart
d0923bd82f Height for width for Image in layout 2021-06-21 12:24:36 +02:00
Olivier Goffart
c0d813424d Add C++/Rust/JS test for accessing image dimensions 2021-06-21 12:00:57 +02:00
Olivier Goffart
99c140ae08 Allow accessing the width and height of the image in .60
Closes #208
2021-06-21 11:22:50 +02:00
Olivier Goffart
42c25248a8 Allow to give a name to for and if 2021-06-18 16:40:40 +02:00
Olivier Goffart
52e85933ed Fix unit tests
Code was moved, so the test need to be adapted to that
2021-06-18 15:46:45 +02:00
Olivier Goffart
0b6bd7b219 Fix accessing elided property
Fixes #177
2021-06-18 15:08:30 +02:00
Olivier Goffart
4e0a91c35a Test for Flickable layout and small layout fix
Test for issue #194 which was already fixed.
And also fix a small other issue where the preferred size was not properly
computed in layouts.

Closes #194
2021-06-18 14:27:01 +02:00
Olivier Goffart
a0bea36e43 Fix preferred size of the Window with a layout
A few problem:
 - the horizontal and vertical property were swapped
 - The implementation of the "preferred_xxx" property was not materialized properly
   because the `bindings` were borrowed in the materialize_fake_properties pass
 - Since the Window has a stretch factor of 0., the preferred size of the inner layout
   was not taken into account when merging the LayoutInfo.  I believe taking the
   maximum preferred size is the right solution when merging them.
2021-06-18 13:51:25 +02:00
Olivier Goffart
51d532d209 Fix grid layout tests
One must make sure the initial preferred size is clamped within the
max and min size
2021-06-18 11:37:58 +02:00
Simon Hausmann
9965dca031 Fix formatting 2021-06-17 11:20:44 +02:00
Simon Hausmann
7b95371c78 Move the Rust tutorial into a sub-directory
To make room for the C++ version next to it :-)
2021-06-17 11:04:43 +02:00
Olivier Goffart
deaa0fddb0 WIP layout: split vertical and horizontal cache
Split the vertical and horizontal pass into different property cache
This will allow to implement "height for with"

This patch does not port the Rust or C++ binding yet
2021-06-16 15:14:07 +02:00
Simon Hausmann
cf5d554338 Fix doctests on Windows, part 3
It seems that the path attribute takes a unix-style path, even on Windows.
2021-06-16 14:22:59 +02:00
Simon Hausmann
4153c03477 Prospective fix for doctests on Windows 2021-06-16 14:03:46 +02:00
Simon Hausmann
8bc8767e17 Test the tutorial Rust code in doctests
This implicitly also "tests" the .60 code since we're using the macro
2021-06-16 13:35:16 +02:00
Olivier Goffart
ee00c9eb92 Rename maximum- and minimum- properties to max- and min-
Issue #259
2021-06-14 10:28:30 +02:00
Olivier Goffart
2483425d57 Add abs() 2021-06-11 14:17:47 +02:00
Olivier Goffart
6c1aa9bd8f Add a pass to always have the top level as a Window 2021-06-09 11:02:55 +02:00
Olivier Goffart
ce34ff87d0 Finish support for callback aliases
cc #111
2021-06-07 20:40:36 +02:00
Olivier Goffart
715d38903f Allow to omit the type of aliases 2021-06-07 10:48:09 +02:00
Olivier Goffart
0598b3f095 The debug() function can now take several args, and debug more types 2021-06-01 14:10:25 +02:00
Simon Hausmann
5cad61bcd0 Fix disappearing text in vertical layouts with word-wrap and alignment
When a Text element has wrapping enabled, it should not have zero
minimum size. Otherwise the layout will give it a height of zero in the
layout in the test case and that'll make the text disappear. There are
different options but this patch goes for minimum height as if no
wrapping was enabled (so at least one line plus forced line breaks).

Fixes #246
2021-06-01 10:52:26 +02:00
Olivier Goffart
4b00f42324 Fix clicking on the home page in the interpreted printerdemo
Turns out the declared `clicked` callback was overriding the TouchArea one
since the refctor of the interpreted global components
2021-05-28 18:32:05 +02:00
Simon Hausmann
cc9d5e09f0 Add support for clip on Path elements
This allows clipping the viewbox conveniently.
2021-05-21 19:51:00 +02:00
Olivier Goffart
edfa6319b2 Fix alias to globals with the interpreter 2021-05-21 16:03:57 +02:00
Olivier Goffart
1aed36d122 Be sure to propagate the fact that properties are changed for aliases 2021-05-21 10:06:26 +02:00
Olivier Goffart
a071738a4a Fix initialization order of globals 2021-05-20 13:40:51 +02:00
Olivier Goffart
6fae458c2d Properly merge analysis of base component 2021-05-20 13:40:51 +02:00
Simon Hausmann
a7ce64657c Restore source compatibility for drop-shadow-blur
Let's keep source compatibility and define `drop-shadow-blur` to be a radius.
The CSS spec says that the standard deviation is half of the radius.

We just need to scale again and increase the shadow rect to make sure that no borders are visible.
2021-05-20 12:14:05 +02:00
Simon Hausmann
bb7b301b10 GL backend: new box drop shadow implementation
This replaces the box gradient with a new implementation that
behaves like the HTML Canvas element, by applying a gaussian
blur to the alpha of the rectangle to shadow.

The drop-shadow-blur property is changed to be now just a "level", like
the HTML Canvas shadowBlur property, which is defined to be half of the
standard deviation of the gaussian blur to be applied.
2021-05-20 08:50:02 +02:00