Commit graph

299 commits

Author SHA1 Message Date
Olivier Goffart
567c644a5f Fix PopupWindow position when all elements are not inlined
Pass a reference to the parent item in the show_popup function
so we can compute the exact location at runtime.
2021-10-28 15:52:29 +02:00
Olivier Goffart
7939d834d4 Fix panic in the interpreter if there are properties that are aliased to struct 2021-10-06 18:33:27 +02:00
Simon Hausmann
332b149610 Add support for accessing resources from the embedded widget library in the interpreter 2021-10-05 23:16:46 +02:00
Olivier Goffart
ae3e1b4680 Allow normal Element to be in the Dialog's button row with dialog-button-role 2021-10-05 09:46:20 +02:00
Olivier Goffart
2716e4b4dd TouchArea: add the pointer-event callback
... instead of `pressed-changed`

This allows to see what mouse button was pressed.

Closes #535
2021-10-04 14:39:49 +02:00
Olivier Goffart
671df0f24f New widget: StandardButton 2021-09-29 16:25:44 +02:00
Simon Hausmann
4779c97ba2 Internal cleanup: Keep globals related data together
In ComponentDescription only keep a exported_globals_by_name that
maintains the index in the compiled_globals vector and in there store
the public properties of global singletons.
2021-09-15 07:56:28 +02:00
Simon Hausmann
a855d868fc Add support for introspecting globals in the interpreter Rust API
Add three straight-forward functions:

    * pub fn globals(&self) -> impl Iterator<Item = String> + '_
    * pub fn global_properties( &self,
          global_name: &str,
      ) -> Option<impl Iterator<Item = (String, ValueType)> + '_>
    * pub fn global_callbacks(&self, global_name: &str
      ) -> Option<impl Iterator<Item = String> + '_>

Implementation wise this requires passing along a way to get the
non-normalized (original) export name, as globals() should return the
names as the developer/designer specified them, and
global_properties()/global_callbacks() normalizes.
2021-09-15 07:56:28 +02:00
Simon Hausmann
0d19e2d9b9 Add support for global aliases
When exporting an global multiple times under different names, make sure
that they alias in the generated code.

As a consequence, the compiler maintains the original unique name and in
Rust and C++ makes only the exported names public. In the interpreter
the internal name is theoretically still accessible from the outside.
2021-08-31 17:09:11 +02:00
Olivier Goffart
a1803ec3a0 Interpreter: return a proper error from set_property instead of panic 2021-08-27 13:36:48 +02:00
Olivier Goffart
5f8cea5926 WIP interpreter API to access globals 2021-08-27 13:36:48 +02:00
Olivier Goffart
b42c187ed1 Refactor the way the two-ways biding are represented internaly
Don't put them in a fake expression.
This simplifies a bit the expression handling, and will make
possible to fix analysis that needs a vew into the aliases
2021-08-20 18:26:36 +02:00
Olivier Goffart
5efa5bbf1d Added a commented out debug comment which I often use
It allows dumping the lowered object tree
2021-08-19 09:57:13 +02:00
Olivier Goffart
a39dd6ac4f Interpreter API: preserve the dashes and underscore when listing properties 2021-08-17 18:47:41 +02:00
Simon Hausmann
01c3347d19 Make fluent the new default style
It's not ugly :-)
2021-08-10 15:56:38 +02:00
Tobias Hunger
9dcd107e84 Janitor: Fix clippy::single_match 2021-08-09 13:19:34 +02:00
Olivier Goffart
16325d5474 Remove dbg! 2021-08-09 12:40:21 +02:00
Olivier Goffart
8728052578 Fix panic when typing into the line edit in the gallery
The problem was that the item array's parent was not properly
computed. Leading to corrupted item when getting the parent of the
focus item.
2021-08-09 12:00:17 +02:00
Olivier Goffart
c58ffe1589 Better panic message when we reference a property that does not exist 2021-08-06 15:58:13 +02:00
Tobias Hunger
04738a900f Janitor: Fix clippy::map_clone 2021-08-04 22:50:35 +02:00
Tobias Hunger
ce976a1dbb Janitor: Fix clippy::useless_conversion 2021-08-04 22:50:35 +02:00
Tobias Hunger
c74565a883 Janitor: Fix clippy::needless_return 2021-08-04 22:50:35 +02:00
Tobias Hunger
24a2021226 Janitor: Fix clippy::needless_borrow 2021-08-04 22:50:35 +02:00
Simon Hausmann
29f5853332 Provide sixtyfps::Window by reference in the Rust API
This also removes Clone from the Window again, to avoid having to face
the question: Does cloning a window duplicate it on the screen?
2021-08-03 10:32:04 +02:00
Olivier Goffart
6a32a8b37a Don't error on empty documents 2021-07-29 17:40:20 +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
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