Tobias Hunger
34d461cb2b
Janitor: Fix clippy::clone_on_copy
2021-07-30 09:27:48 +02:00
Tobias Hunger
f9f05c3c58
Janitor: Fix clippy::map_clone
2021-07-30 09:27:48 +02:00
Tobias Hunger
b5e0d919f1
Janitor: Fix clippy::single_match
2021-07-30 09:27:48 +02:00
Tobias Hunger
539e155061
Janitor: Fix clippy::for_kv_map
2021-07-30 09:27:48 +02:00
Simon Hausmann
b3529d1b75
Rust: Speed up compilation times of generated code
...
The binding setup functions (set_binding, set_animated_binding, etc.)
are taking the binding basically as an `impl Fn() -> T`, which means
each call site creates a new copy. The bodies of these can be quite big.
Since most of our uses follow the pattern of just capturing the
samereduce the number of copies needed parameter, we can reduce the
number of copies needed by providing wrappers.
With rustc 1.54.0 on my mbp and debug, the build time of
touch ../ui/printerdemo.60
cargo rustc
goes from 1m:15s down to 42s, and total llvm lines goes from
2079842 down to 1134237.
2021-07-30 09:22:20 +02:00
Simon Hausmann
3f716ae558
Reduce clippy warnings in generated code even more
...
... by ignoring all style and complexity related lints, since humans don't typically consume the generated code.
Co-authored-by: Olivier Goffart <ogoffart@sixtyfps.io>
2021-07-30 09:20:01 +02:00
Simon Hausmann
3aa0b7bb8d
clippy: ignore warning about ref-deref for field-offset access
...
As per commit f7248a4863
this *is* a necessary thing for us to do.
2021-07-30 09:20:01 +02:00
Simon Hausmann
a2e800abac
clippy: ignore single binding in match warning in generated visit_dynamic
...
This is a harmless warning affecting only readability, so apply it
to the whole module.
2021-07-30 09:20:01 +02:00
Simon Hausmann
11bc09f153
clippy: don't covert self_rc into... the same type in the new() function of generated code
2021-07-30 09:20:01 +02:00
Olivier Goffart
f38ce3c090
Fix the tests
2021-07-29 18:25:23 +02:00
Olivier Goffart
6a32a8b37a
Don't error on empty documents
2021-07-29 17:40:20 +02:00
Olivier Goffart
b0b3912c27
Add support for the visible property
2021-07-29 15:02:25 +02:00
Olivier Goffart
bd52f4d444
Allow the clip property to be a dynamic property
2021-07-29 15:02:25 +02:00
Olivier Goffart
09c36ae965
Test for commit e0fad7fbdf
2021-07-29 13:25:47 +02:00
Simon Hausmann
2b5badcae2
Fix cargo fmt
2021-07-28 17:08:27 +02:00
Simon Hausmann
fd26dd4944
Fix expected error messages
...
Amends a3652e6823
2021-07-28 17:08:27 +02:00
Simon Hausmann
be05b54fa1
Tweak error message for conditionals/for in grid
...
Will adapt the tests in the next commit
Co-authored-by: Olivier Goffart <ogoffart@sixtyfps.io>
2021-07-28 17:08:27 +02:00
Simon Hausmann
e8727e98c5
Produce an error message when using if or for in grid layouts
...
An early error is better than a build error at compile time of generated code.
2021-07-28 17:08:27 +02:00
Simon Hausmann
14c6819791
Add support for icons in the Button widget
...
The icon in the gallery example was generated via https://emoji.aranja.com
2021-07-27 19:37:06 +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
7f611d21e3
Fix Angles conversion
2021-07-26 17:36:02 +02:00
Olivier Goffart
74bc9521b9
Fix the scope while resolving a model expression
...
The `self` was always referring to the `root` instead of the enclosing
element.
2021-07-26 11:08:46 +02:00
Olivier Goffart
ac751c1052
Re-arrenge a match
...
looks prettier this way
2021-07-23 17:11:54 +02:00
Olivier Goffart
ae210e79ec
Properly handle self assignment on non-float types
2021-07-23 16:33:50 +02:00
Olivier Goffart
807377ed40
fix warnings
2021-07-23 15:40:11 +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
2cdc5848a2
Janitor: Replace float comparison dance with approx_eq from euclid
...
Sixtyfps uses euclid already, so let's use euclid for float comparisons
as well.
I changed the code to decide whether a number is a positive integer to
make do without a comparison along the way.
2021-07-23 13:48:52 +02:00
Tobias Hunger
9539a53480
Janitor: Fix clippy::redundant_clone
2021-07-23 13:48:52 +02:00
Tobias Hunger
d64291245e
Janitor: Fix clippy::len_zero
2021-07-23 13:48:52 +02:00
Tobias Hunger
3e0534afea
Janitor: Fix clippy::needless_lifetimes
2021-07-23 13:48:52 +02:00
Tobias Hunger
9e224f579c
Janitor: Fix clippy::comparison_to_empty
2021-07-23 13:48:52 +02:00
Simon Hausmann
4f13238ff5
Fix preview on rectangles with opacity or drop shadow
...
Instead of producing an error, produce just a warning that the effect won't
be visible on root elements.
2021-07-23 11:41:28 +02:00
Olivier Goffart
2447de3d1b
We should only set the height of the element in a repeater for the children of ListView
2021-07-22 18:18:58 +02:00
Olivier Goffart
6aa6dec9b4
Small simplification on the usages of ListView
...
Now that the height computation is done properly
2021-07-22 17:29:53 +02:00
Olivier Goffart
ff8f7930d2
ListView: fix default height of items
2021-07-22 17:13:36 +02:00
Olivier Goffart
8743ff87ed
Consider that elements in a listview are part of a layout
2021-07-22 14:38:58 +02:00
Olivier Goffart
19ad14b6f2
C++: Fix assigning a @linear-gradient to a color property
2021-07-22 14:38:58 +02:00
Olivier Goffart
c2433d0f0b
Fix panic when parsing linear-gradient with a trailing coma
2021-07-22 14:38:58 +02:00
Olivier Goffart
f7923bfb77
Fix an error ending by a period
...
Reword the error because we might not even have an identifier
2021-07-22 14:38:58 +02:00
Simon Hausmann
d6eb45b4f8
Regression: Fix missing window background
...
After commit 492af0f67c
the native class
name of "Window" changed to "WindowItem", so the string based check here
didn't match anymore. For consistency this match now uses the element
name instead, like in other places in the compiler.
2021-07-22 13:02:04 +02:00
Simon Hausmann
3146fb7764
internal cleanup: Remove the sixtyfps::testing::HasWindow trait
...
and replace it with the internal, re-exported WindowHandleAccess
one.
Strictly speaking, this is a breaking change. In practice the
returned type of this trait was in `sixtyfps::re_exports`, so any
public use is questionable :)
2021-07-21 20:33:02 +02:00
Simon Hausmann
eaddbe664e
internal cleanup: Rename ComponentWindow to WindowRc
...
That's all it is nowadays, it's a wrapper around Rc<Window>. It's not an
alias because we need to also "wrap" it to C++ via cbindgen, but that's
about it.
2021-07-21 20:33:02 +02:00
Tobias Hunger
aeebbb1d96
Janitor: Fix remaining clippy::option_map_unit_fn
2021-07-21 19:44:57 +02:00
Simon Hausmann
ef184f7f1a
internal cleanup: Remove the rest of the ComponentWindow API
...
Now it just remains a wrapper around the Rc, and it can soon be moved to
the API crate hopefully.
2021-07-21 17:41:12 +02:00
Simon Hausmann
77ea5b7a15
API cleanup: hide the rest of the ComponentWindow "internals"
2021-07-21 17:41:12 +02:00
Simon Hausmann
4c1d9dc03e
internal cleanup: Remove the poup functions from ComponentWindow
...
Use WindowHandleAccess instead. Also the clone()
isn't needed anymore since the function take a self reference instead of an Rc<Self> by value.
2021-07-21 17:41:12 +02:00
Simon Hausmann
e005058285
internal cleanup: remove free_graphics_resource from the public ComponentWindow API
...
Use the WindowHandleAccess backdoor instead.
2021-07-21 17:41:12 +02:00