Commit graph

963 commits

Author SHA1 Message Date
Olivier Goffart
8b10414451 Parse signal return type
(currently does nothing with it)
2020-12-01 18:47:49 +01:00
Olivier Goffart
2d016dffda Print the diagnostics in stderr for files which do not have span information 2020-12-01 12:10:43 +01:00
Olivier Goffart
e895e88e7f Disabled color for the line edit 2020-12-01 12:10:43 +01:00
Simon Hausmann
6fba6aca56 Consistency fix for transitions API
Use "in" and "out" instead of "to" and "out".
2020-12-01 11:18:47 +01:00
Olivier Goffart
c18f2ce1cc Fix disabled widgets in the native style 2020-12-01 10:59:57 +01:00
Simon Hausmann
133823ca4c Apply the object literal type merging also to the binary comparison operator 2020-12-01 10:57:47 +01:00
Simon Hausmann
798b08f2b1 Use smarter common-type determination code also for conditional expressions
This requires two changes to the function:

    (1) When we can't convert to one type to the other, try the reverse.
    (2) When merging fields, apply the algorithm recursively for common fields.
2020-12-01 10:57:47 +01:00
Simon Hausmann
9360fc3c5a Don't silently drop fields in object literals inside arrays
This patch tries to improve the ability to convert different kinds of
object literals in an array into a common type. We used to take the
first entry as the "shape" of all elements, which meant that if the
first element was missing a field it would be silently dropped from all
future fields.

Instead, this patch merges the fields.
2020-12-01 10:57:47 +01:00
Olivier Goffart
564d6a0744 Fix Popup in C++ 2020-12-01 10:24:37 +01:00
Olivier Goffart
5bdb9befb5 Use the PopupWindow in the native style combobox
Note: the background is not styled yet
2020-11-30 18:39:41 +01:00
Olivier Goffart
a973791676 Fix move property inside a popup 2020-11-30 18:39:41 +01:00
Olivier Goffart
7bfa998f00 Popup positioning 2020-11-30 18:39:41 +01:00
Olivier Goffart
b0a9d65f55 More Popup WIP 2020-11-30 18:39:41 +01:00
Olivier Goffart
f3d6ce1695 Fix visit_all_named_references once more
We must visit the layout of every component we see, including the ones
for the popups
2020-11-30 15:20:51 +01:00
Olivier Goffart
957867d72a More work on popup 2020-11-30 15:20:51 +01:00
Olivier Goffart
852eeb1c11 WIP popup 2020-11-30 15:20:51 +01:00
Olivier Goffart
5f93f88b77 Adjust the text of the error message when a property has a non-property type 2020-11-30 13:35:52 +01:00
Olivier Goffart
a4c538c615 Throw an error when using an element as a property type
We currently do not support that
2020-11-30 13:31:02 +01:00
Olivier Goffart
2fdf852289 Add the element name in the error when a property is not found 2020-11-30 13:01:39 +01:00
Olivier Goffart
4fc2880b98 Fix inlining::fixup_element_references
We need to recurse in the expression
2020-11-27 15:01:51 +01:00
Olivier Goffart
f1d61eb1c3 Fix the no_borrow visitor so they actually do not borrow 2020-11-26 17:16:21 +01:00
Olivier Goffart
5654ecccb4 Style: only have one level of braces in imports 2020-11-26 17:15:45 +01:00
Olivier Goffart
2245df7b14 Add a function to visit all expression within a component 2020-11-26 17:15:45 +01:00
Olivier Goffart
a53fa707ed Fixup previous patch
I think The expression need to be adapted after the optimized item get simplified,
but before moving the properties
2020-11-25 20:15:32 +01:00
Olivier Goffart
f8f02a13eb Refactor the helper to visit all named reference to take a component
If we want to add more expression or named reference in the component,
we then can just update that function
2020-11-25 17:15:27 +01:00
Olivier Goffart
0ad0c181e3 Take a component in the function that visit all elements 2020-11-25 15:16:39 +01:00
Olivier Goffart
c37f0ce4c4 Load the cursor width property from the style
Ideally we would put the bindings dirrectly in the builtins.60
But this is unfortunately not possible because the "StyleMetrics" is not
yet available there and that would be a circular dependencies.
2020-11-25 09:58:54 +01:00
Simon Hausmann
65e09c723a Use hover effects in the ugly style
Use a darker shade between the unpressed and the pressed shade when hovering
over controls that can be activated.
2020-11-24 22:12:17 +01:00
Simon Hausmann
727ab2ee9d Minor tweak to the ugly style
Don't use the shiny blue when pressing items - it's seemingly pretty
but it won't go well with a color change on hover.
2020-11-24 22:02:16 +01:00
Olivier Goffart
3ae7c6e0b5 Hover effect 2020-11-24 18:09:32 +01:00
Olivier Goffart
8a64f10e84 Remove ComponentVtable::input_event
And the custom handling of the mouse grabber
2020-11-24 16:23:37 +01:00
Olivier Goffart
0c97b4f296 More use of the ItemRc 2020-11-24 13:42:34 +01:00
Simon Hausmann
d80868bbf4 Add support for font_weight to Text and TextInput
This allows implementing another sliding puzzle theme feature, the
boldness of the tile number text in the simple theme when the tile is in
the correct position. For the other themes the weight is constant and
it's bold.

More cleanup to follow later: unify the font handle and FontCacheKey
handling, improve the API to allow for the use of symbolic constants
(normal, bold, etc.) instead of the CSS number values.
2020-11-24 10:10:00 +01:00
Simon Hausmann
3d85e45ec3 Add support for source clipping to the Image element
This allows rendering only a sub-rectangle of the original image, which
we can use right away in the sliding puzzle demo.
2020-11-23 15:46:59 +01:00
Simon Hausmann
fa95064363 Fix resource embedding across component boundaries
When referencing an image a repeated element and were targeting a
configuration that requires resource embedding, then that image would
not embedded.

This was due to the fact that we didn't recurse into sub-components in
the resource collection phase and the generators made a per-component
embedding decision. The field responsible for that was also not
propagated to sub-components.

This patch addresses these two bugs by cleaning up the entire mechanism:

The compiler first generates the new ResourceReference::AbsolutePath for
all img!"foo.png" expressions. If the compiler is configured to embed
resources, then the embed_resources pass will traverse all
sub-components and expressions in them to change them to
ResourceReference::EmbeddedData with a unique integer id. Simultaenously
all the resources to be embedded get also collected in the root
component, so that the build script as well as the generator can take
care of dependency handling and actual resource embedding.
2020-11-23 13:47:16 +01:00
Olivier Goffart
df318d9104 Fix states in the root of other components 2020-11-20 17:14:04 +01:00
Olivier Goffart
08fe5f6c72 Add a Clip 2020-11-20 15:45:45 +01:00
Simon Hausmann
89e0b57627 Rework and simplify the focus handling
Instead of determining the focus item through item tree traversal and
pointer comparison and storing the intermediate indices in the
components in the tree, remember the focus item by a pair of
VWeak<ComponentVTable, Dyn> and item_index: usize.

This speeds up determining the focus item as well as delivering events,
which can now be done directly after retrieving an ItemRef with
get_item_ref.

This also fixes the duplicate line edit focus in the 7gui cells
test case.
2020-11-20 15:33:15 +01:00
Olivier Goffart
551c50560f Fix warning with clang 2020-11-20 12:47:32 +01:00
Olivier Goffart
d5c4885955 Transitions in C++ 2020-11-20 11:38:03 +01:00
Olivier Goffart
091a0834d3 Transitions in rust (C++ and interpreter not implemented yet) 2020-11-20 10:30:17 +01:00
Olivier Goffart
865e6055f2 Work on transition: lower the transitions 2020-11-20 09:39:06 +01:00
Olivier Goffart
88ceeeb3e6 Error when a transition reffers to a state that does not exist 2020-11-20 09:39:06 +01:00
Olivier Goffart
4d4c73925c Some refactoring to prepare for transitions on properties 2020-11-20 09:39:06 +01:00
Simon Hausmann
78fae068dd Use ComponentRc during item tree traversal
This is in preparation for allowing the run-time / items to clone VRc's
of the component.

ComponentVTable functions like visit_children_item contine to take a
ComponentRefPin as "self" parameter type, as a VRc would not be
supported by rust right now. That means the implementation then uses
self_weak to obtain a strong self-reference.
2020-11-19 17:04:01 +01:00
Simon Hausmann
54cc66c400 Fix timing/placement of extra setup code
The setup code is used to place an initial set_focus_item call, for
example. In preparation for future changes, this needs to happen *after*
self_weak has been set up. For C++ this means placing the code into the
create() function, where there's no (implicit) this pointer, so we need
to use self in some places.
2020-11-19 17:00:56 +01:00
Simon Hausmann
9c9e6c7563 Clean up C++ repeated component creation
Centralize the self_weak setup to be emitted only once, in the create()
function. create() is now always emitted and equipped with a parent
parameter, for non-root components. This allows slightly simplifying the
generic repeater code.
2020-11-19 16:41:26 +01:00
Simon Hausmann
7d7903d1ae Fix warning about extra parentheses for conditionals 2020-11-19 15:50:26 +01:00
Simon Hausmann
ce8c728c57 Fix clang warning about implicitly truncating double to int
Well, let's do that explicitly then. The test case mod.60 uses

    mod(8.3, 10)
2020-11-19 15:46:07 +01:00
Olivier Goffart
15fd1c45a3 More warning fixes with clang 2020-11-19 15:04:39 +01:00