Commit graph

255 commits

Author SHA1 Message Date
Simon Hausmann
38cf156bf9 Fix regression of two-way binding on default geom'ed properties causing binding loop
Commit 064c39d625 introduced the regression that
if a two-way binding was set on a property that we'd also set a default geometry
on, we'd end up applying that on the two-way binding, causing a binding loop.

set_binding_if_not_set needs to only set the binding if... there's really none yet.

Fixes #385
2021-08-03 23:24:49 +02:00
Simon Hausmann
064c39d625 Fix disappearing elements with implicit width/height
When an element gets its width and height from the parent through an implicit 100% binding,
those bindings were missing when an animation was pre-defined.

The provided new-type wrapper offers a function to deal with replacing just
binding expression, instead of the
expression *and* the animation.

Fixes #376
2021-08-02 16:31:10 +02:00
Tobias Hunger
539e155061 Janitor: Fix clippy::for_kv_map 2021-07-30 09:27:48 +02:00
Olivier Goffart
e0fad7fbdf Proper .60 compilation error when changing a property linked with a two way binding in a state
Instead of generating wrong code or panic
2021-07-27 10:18:24 +02:00
Olivier Goffart
f544e67fa1 Fix panic or invalid code caused by invalid expression in the tree
When there is an animaiton but no expression, the binding is
left with an invalid expression.
State was keeping that invalid expression as part of sub expression
this is a regression since commit ba32777cab
2021-07-27 09:10:33 +02:00
Olivier Goffart
be37a9f69a Allow angle and duration in the public API snce we document it 2021-07-26 17:36:02 +02:00
Olivier Goffart
01f11695a7 Properly merge the animation when inlining and removing aliases
Fix #193
Fix #345
2021-07-23 15:25:53 +02:00
Olivier Goffart
ba32777cab Refactoring: move the animation in the PropertyBinding struct
Since they always belong together.

This will help for issue #193
2021-07-23 15:25:53 +02:00
Tobias Hunger
aeebbb1d96 Janitor: Fix remaining clippy::option_map_unit_fn 2021-07-21 19:44:57 +02:00
Olivier Goffart
a987b225b5 Collect all used components before inlining
And do some passes before inlining

We will need the list of components before inlining in order to generate
them if we disable inlining

So we can do some passes on each component before they are inlining

I tried to put the flickable pass in that list, but it did not work
if the Flickable itself is the root of a component
2021-07-07 17:58:43 +02:00
Tobias Hunger
e5bdeaa804 Janitor: Remove unnecessary & 2021-07-07 08:42:28 +02:00
Olivier Goffart
13bd828b96 Update license date 2021-07-02 15:55:54 +02:00
Tobias Hunger
13d7f5e7bd Janitor: Fix typos in comments and user-facing strings
Also adapt tests for error messages containing the fixed strings.

No behavior change is intended!
2021-06-28 08:32:25 +02:00
Olivier Goffart
9d2bd11098 Error when having an animation in a transition on a property which is not part of the state
Fixes #255
2021-06-23 13:05:25 +02:00
Olivier Goffart
a97bcd5ae1 Use BTreeMap unstead of HashMap to store the bindings
Because the order is important to keep deterministic error and output
2021-06-18 21:47:00 +02:00
Olivier Goffart
42c25248a8 Allow to give a name to for and if 2021-06-18 16:40:40 +02:00
Olivier Goffart
0b6bd7b219 Fix accessing elided property
Fixes #177
2021-06-18 15:08:30 +02:00
Olivier Goffart
7aba0f2a0b Layout split of horizontal/vertical
Rust part
2021-06-16 15:14:07 +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
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
3ddc3c6ce5 Don't re-use Type::Void for inferred type
Make it explicit that it is inferred, and differentiate callback and property
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
Simon Hausmann
96aeffa092 Accept .otf files
ttf_parser (used by rustybuzz and femtovg) supports them, and Qt supports them, too.
2021-06-03 10:55:58 +02:00
Olivier Goffart
6fae458c2d Properly merge analysis of base component 2021-05-20 13:40:51 +02:00
Olivier Goffart
54be5f3a84 Some ground work to make more binding analysis
- Mark builtin properties that are modified by the native code as output
 - Record wether the property is set by code in the .60
 - Add a field that will tell us if a property binding is constant
2021-05-20 13:40:51 +02:00
Olivier Goffart
a990e01cd8 Apply the layout restrictions to the parent element 2021-05-11 14:59:57 +02:00
Olivier Goffart
a43c2bb50a Component pretty print with indentation 2021-05-11 14:59:57 +02:00
Olivier Goffart
21a80f4562 WIP: Layout refactoring
Instead of using a solve_layout function in the component, use property to hold
a layout cache.

This commit only implement the GridLayout and only the interpreter part
2021-05-11 14:59:57 +02:00
Olivier Goffart
e163794549 Fix panic when a non-element type is used as an element 2021-05-07 15:36:10 +02:00
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