Commit graph

175 commits

Author SHA1 Message Date
Olivier Goffart
f620351cbf Go to definition of structs
Also add the struct in the outline
2021-04-24 15:06:58 +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
87f4a363cf Add support for opacity property 2021-04-15 15:05:09 +02:00
Olivier Goffart
e34b88d658 Fix panic in invalid export 2021-04-15 11:46:05 +02:00
Olivier Goffart
49477724c6 Fix panic when invalid property 2021-04-15 11:24:49 +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
Olivier Goffart
11aff782de Fix crash with drop-shadow in a repeater that contains layout
The layout are going to be optimized, and the optimized item's enclosing component
must be adjusted
2021-04-14 16:13:56 +02:00
Olivier Goffart
84e0b24550 Some refactoring of the syntax_nodes module
Ensure that the node always contains the write kind by panicking
if it doesn't.

Add some documentation for the macro that declares them
2021-04-14 11:46:49 +02:00
Simon Hausmann
c301cc22b5 Collect foreign imports and filter out true type fonts/collections
Resolve them early enough to produce good diagnostics. Permit true type
fonts & collections.
2021-04-14 09:17:23 +02:00
Simon Hausmann
cbf2b51670 Allow empty imports
Allow import "blah.60" or, more likely in the future, import "foo.ttf".
2021-04-14 09:01:49 +02:00
Olivier Goffart
7a65f31cc1 the source_file is not optional 2021-04-13 17:26:24 +02:00
Olivier Goffart
84501e630a Rename SyntaxNodeWithSourceFile to SyntaxNode
Same for SyntaxToken
2021-04-13 17:10:56 +02:00
Olivier Goffart
a712f515fa Make the viewport element of the flickable a real Element in the object_tree 2021-04-09 19:14:48 +02:00
Simon Hausmann
9a06a29314 Implement dynamic image-fit and aspect ratio behavior for Image elements
This is part of #168 where `image-fit` has dynamic defaults and missing
width or height property bindings are installed with an aspect ratio
preserving behavior.
2021-04-09 15:17:52 +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
3db3400951 Rename the Object type to Struct in the compiler 2021-03-16 12:38:53 +01:00
Olivier Goffart
730b1ccff2 Refactor diagnostic: Merge BuildDiagnostic and FileDiagnostic 2021-03-12 19:32:50 +01:00
Olivier Goffart
968dfaae87 Put what is the FileDiagnostics into the SourceFile so the SourceFile has the content 2021-03-11 16:23:46 +01:00
Olivier Goffart
7c48bcdd4c Add the source file getter to the Spanned trait, and remove SpannedWithSourceFile 2021-03-11 14:09:55 +01:00
Olivier Goffart
a8475d062c Fix the priority when inlining and improve debug output
This is just an improvement on 55726cc10d
but is not yet a complete fix for #161, because we do not merge all
bindings that still need to be merged
2021-02-08 10:17:35 +01:00
Olivier Goffart
55726cc10d fix two way binding when they are declared twice
Fix the galery's disable button not disabling most widgets
2021-02-05 18:33:28 +01:00
Simon Hausmann
c771bcff45 Print a warning when trying to animate deprecated properties 2021-02-02 22:58:54 +01:00
Simon Hausmann
e61529976e Issue warnings when creating bindings against deprecated properties 2021-02-02 22:42:02 +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
c479fd132d Fix panic when @children is in the last component
Throw an error instead

Fixes #148
2021-02-02 16:44:09 +01:00
Olivier Goffart
e09fa06226 Fix nested for layouts
Fixes #149
2021-02-01 12:38:56 +01:00
Olivier Goffart
55fae15080 Debuging aid 2021-01-29 16:35:59 +01:00
Olivier Goffart
52d750999b Pretty-print expression and better debug for Element 2021-01-28 14:36:16 +01:00
Olivier Goffart
07df517473 Replace $children with @children 2021-01-28 11:55:08 +01:00
Olivier Goffart
9aca0b0a7e LSP: Allow to access to the type loader documents
So that we can go to the definition of un-open documents
2020-12-28 12:48:32 +01:00
Olivier Goffart
7fcb49bef1 Implement Go to definition for elements 2020-12-23 15:15:53 +01:00
Olivier Goffart
0d2d48be4f Rename "signal" to "callback" 2020-12-18 09:51:01 +01:00
Olivier Goffart
7f78bea8b5 Fix a bunch of cargo clippy warnings in the compiler 2020-12-07 12:54:38 +01:00
Olivier Goffart
ac3ce779e9 Make child_of_layout actually mean what it is named after 2020-12-02 18:36:23 +01:00
Olivier Goffart
276e11a101 More work on signals with return value 2020-12-01 18:47:49 +01:00
Olivier Goffart
7bfa998f00 Popup positioning 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
f1d61eb1c3 Fix the no_borrow visitor so they actually do not borrow 2020-11-26 17:16:21 +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
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
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
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
091a0834d3 Transitions in rust (C++ and interpreter not implemented yet) 2020-11-20 10:30:17 +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