Commit graph

273 commits

Author SHA1 Message Date
Tobias Hunger
97be634b9b Janitor: Fix clippy::match_like_matches_macro 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
8b022cd917 Janitor: Fix remaining instance of clippy::iter_cloned_collect 2021-07-21 19:44:57 +02:00
Simon Hausmann
1c285694d7 internal cleanup: Remove the use of ComponentWindow in the interpreter 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
Simon Hausmann
492af0f67c Rename the implementation of the Window item to WindowItem
If we were to add `sixtyfps:🪟:Window` to the re_exports, then
this clashes. We might rename the former, but this is a cleaner naming
in any case.

Relates to #333
2021-07-20 17:50:17 +02:00
Tobias Hunger
efc0d63e8b Janitor: iter().cloned().collect() on a slice to create a Vec == to_vec()
This is clippy::iter_cloned_collect
2021-07-15 07:55:06 +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
Olivier Goffart
13bd828b96 Update license date 2021-07-02 15:55:54 +02:00
Simon Hausmann
53ef31f0c1 Fix wrong text rendering with popups in the interpreter and the GL backend
The interpreter created an intermediate window for the component but
the regular parent window is used for rendering. This resulted in the situation
where the layout computation was done before rendering with the intermediate window,
the text layout was calculated and cached in the Text's cached rendering data.
That in turn is just an index into the window's rendering cache (arena),
which is also later used for rendering. The index is local to the window, so
during layout the index was assigned for the intermediate window and
when rendering it seemed valid and happened to also refer to a Text item in the
cache of the real window, but with the wrong size/data.

Fixes #278
2021-06-29 11:27:33 +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
Tobias Hunger
c482cd7a29 Janitor: Fix typo in local function name
No behavior change is intended!
2021-06-28 08:32:00 +02:00
Tobias Hunger
87460c4ac8 Janitor: Fix typo in struct field name
No behavior change is intended here!
2021-06-28 08:32:00 +02:00
Simon Hausmann
596912a521 Fix panic in preview.html when loading images
Binding expressions may end up calling sixtyfps::Image:size(), which
requires a graphics backend to be set.

The wasm interpreter code path circumvents the
sixtyfps_corelib::backend::instance_or_init call and went straight to
the GL backend, so we need an extra call to ensure its creation.
2021-06-21 15:09:01 +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
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
522e78915f Fix the tests 2021-06-07 20:40:36 +02:00
Olivier Goffart
ce34ff87d0 Finish support for callback aliases
cc #111
2021-06-07 20:40:36 +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
Olivier Goffart
0b3fecf300 WIP: API to expose image loading from C++ and Rust 2021-05-28 17:05:16 +02:00
Olivier Goffart
4584c40544 Rename items::Image to ImageItem
Because there will be soon a sixtyfps::Image and the names
can't clash
2021-05-28 17:05:16 +02:00
Olivier Goffart
236011d17c Make ComponentDefinition::properties only list the public properties as it should
Fixes #242
2021-05-25 15:48:22 +02:00
Olivier Goffart
edfa6319b2 Fix alias to globals with the interpreter 2021-05-21 16:03:57 +02:00
Olivier Goffart
896336c5c6 interpreter: Make GlobalComponent actual dynamic component
Will be required to fix the bug setting two way binding to global
poprerties
2021-05-21 15:25:56 +02:00
Olivier Goffart
2265dd04e4 interpreter: wrap ComponentDescription in a ErasedComponentDescription
I'll need that for globals
2021-05-21 12:25:37 +02:00
Olivier Goffart
2a1c7a9154 Mark aliased property of public api as set
So we don't optimize away binding that points to them

Fix the two_way_simple.60 test
2021-05-20 13:40:51 +02:00
Olivier Goffart
ff368db505 Interpreter: make sure that the properties are initialized in the right order 2021-05-20 13:40:51 +02:00
Olivier Goffart
fbdbe69fe7 Window: make hight and width fixed size, preferred-* property set the initial size
Issue #227
2021-05-18 10:23:06 +02:00
Olivier Goffart
720001a223 Remove the solve_layout from the component vtable
no longer required
2021-05-11 14:59:57 +02:00
Olivier Goffart
f6b71b36a7 Interpreter: fix layout_info for repeated component
We need to look at the layout_info_prop of the root element
2021-05-11 14:59:57 +02:00
Olivier Goffart
b463e3cca4 WIP refactor layout
This commit add support for the box layout
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
91ed04a72c Make length (still the default for all property) be the logical length
And a new `physical_length` is now the physical_length unit

Note: this does not change the runtime part yet
2021-04-21 17:15:19 +02:00
Olivier Goffart
7ae850d564 Rename Type::Length -> Type::PhysicalLength 2021-04-21 17:15:19 +02:00
Olivier Goffart
ba2f2d5719 Add an Opacity element that does nothing 2021-04-15 10:17:52 +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
c448003e2f Add test case for preferred size in boxes bug
Amends commit 7c1738eeea

This also adds the preferred-width/height fake properties to allow overriding.
2021-04-08 16:13:53 +02:00
Olivier Goffart
85986c39bd Layouting: make the materialize fake layout property have an actual value
So that when we query it from the code, it has a value
2021-04-08 14:35:16 +02:00
Simon Hausmann
625eb733d3 Fix initial focus test failure
Commit 162944b8c9 changed `set_component` to
clear the weak focus item ref (correct), which made the test failure. That's because
the interpreter called set_component after running the setup code (wrong).
2021-04-06 13:36:11 +02:00
Olivier Goffart
162944b8c9 Add ability in the interpreter to re-use an existing window 2021-04-03 10:00:12 +02:00
Simon Hausmann
e6d165dfbb Don't crash when instantiating .60 files with property <brush> 2021-03-31 08:42:54 +02:00
Simon Hausmann
9a6e9c3a53 Simplify internal interpreter property descriptor API
Return an iterator when querying the properties. This requires a
one-time copy of the property declarations out of the compiler data
structure, which is read-only.
2021-03-31 08:42:54 +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
48333370a6 Use the new interpreter API in things that depends on it 2021-03-15 17:29:27 +01:00
Simon Hausmann
8372d3f6d8 Rename call_* to invoke_* for callbacks
Fixes #187
2021-03-15 17:01:05 +01:00
Simon Hausmann
9034bd3d1a Move the refined eval::Value API to api::Value
This is the new public value representation for the interpreter
2021-03-15 15:12:34 +01:00
Olivier Goffart
730b1ccff2 Refactor diagnostic: Merge BuildDiagnostic and FileDiagnostic 2021-03-12 19:32:50 +01:00