Commit graph

661 commits

Author SHA1 Message Date
Simon Hausmann
1b1a9ef06a Add a test-case for the ctrl+a shortcut to select all text 2021-09-07 11:33:28 +02:00
Olivier Goffart
d35c92bdc2 Make tests/cases/text/default_color.60 not depend on the style 2021-09-06 21:52:12 +02:00
Simon Hausmann
7da24c40c3 Use the GL backend in the CI for node tests
In the CI we set SIXTYFPS_NO_QT=1 and this change removes the testing
backend from the nodejs tests, in order to fix #419 .
2021-09-06 15:56:59 +02:00
Simon Hausmann
4d3f08d954 Allow global singletons to have default callback handlers
It's already working, we just need to remove the error handling :-)

Fixes #467
2021-09-06 13:56:27 +02:00
Simon Hausmann
2159ad5775 Restore test case
The changes in f8876fe2b2 were unintentional.
2021-09-06 13:09:57 +02:00
Olivier Goffart
4aeb9bcd08 Interpreter: fix comparison of enums
We need to normalize native enum to use dashes
2021-09-06 12:22:24 +02:00
Olivier Goffart
f8876fe2b2 Implement the image-rendering in the Qt backend
cc #465
2021-09-06 10:49:56 +02:00
Ryan Van Gilder
e7245cd0af cargo fmt and remove uneeded HorizontalLayout import 2021-09-06 10:03:51 +02:00
Ryan Van Gilder
4d1d0e73a4 Rename image-scaling to image-rendering to align with CSS 2021-09-06 10:03:51 +02:00
Olivier Goffart
6906475e22 Remove the unicode test
The GCC version on the CI is still too old

Also this fixes the CI not running the C++ driver tests
2021-09-05 09:29:00 +02:00
ogoffart
e54e03148f Bump version number to 0.1.2 2021-09-04 10:08:51 +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
fe94f93755 Test the use of global callback from rust and C++ 2021-08-27 13:56:54 +02:00
Simon Hausmann
26a63fcf22 Change example docs of global exports to use a re-export
That's the more typical use-case to also deal with name spaces, where
this is done at import time.

The modified test case tries to ensure that this also works.
2021-08-27 13:38:57 +02:00
Simon Hausmann
cf7d33fb5d Add support for accessing exported globals from Rust 2021-08-27 13:36:48 +02:00
Simon Hausmann
5e833e5d23 Add support for accessing globals from C++ 2021-08-27 13:36:48 +02:00
Olivier Goffart
6450f8b8d7 Fix the text_default_color test on my machine
It was using the native style for me, which does not default to black
2021-08-24 14:03:50 +02:00
Olivier Goffart
5f1cf00fe7 Add test that make sure that reading from a model after writing to it works 2021-08-24 12:59:40 +02:00
Olivier Goffart
b07d52cd23 Support aliases to callbacks in globals 2021-08-24 12:36:16 +02:00
Olivier Goffart
d5f4a796ad Fix interpreter panics when calling callback that weren't set 2021-08-24 11:37:47 +02:00
Simon Hausmann
2458ac5d02 Fix panic when calling focus() on a repeated element
When trying to reference an instance of a repeated item, for use with
ItemRc or VRef<Item>, the item_index (or id) of the ElementRc is not
directly what we want.

Adjust any element references to the repeater to to the inner instance
after creating them. Also make sure that the enclosing component is
respected in the C++ and Rust generators.

Fixes #422
2021-08-20 15:39:54 +02:00
Tobias Hunger
31a3240733 Janitor: Fix clippy::into_iter_on_ref 2021-08-18 00:24:51 +02:00
Tobias Hunger
aea4ecca99 Apply pre-commit hooks to all files 2021-08-17 22:38:16 +02:00
Olivier Goffart
a39dd6ac4f Interpreter API: preserve the dashes and underscore when listing properties 2021-08-17 18:47:41 +02:00
Olivier Goffart
2c1e39f00e Fix priority when merging two_way_binding
We should not increase the priority when merging two way binding, only when
inlining.

This fixes the iot-dashboard's devices widget which were sometimes not
transparent as they should have been.
This was not deterministic because the order in which the two way binding are
merged is not deterministic because of hash table, and sometimes one binding
ended up having a higher priority as it should have had.
2021-08-17 11:57:35 +02:00
Olivier Goffart
143510b593 Set the width of items in a ListView
Fixes #408
2021-08-13 11:57:56 +02:00
Olivier Goffart
7859e2f06e Fix opacity property at the root of a repeated element in layout
This fix the layout of the printing-queue in the printer demo
2021-08-12 20:10:21 +02:00
Simon Hausmann
e935e159ee Fix import of types with an underscore
In Exports::from_node() we use parser::identifier_text to extract the
names, which are normalized (with dashes). We need to do the same in

ImportedName::from_node() in order to allow something like

    export Main_Window := ...

and then

    import { Main-Window } from "foo.60";

or even just

    import { Main_Window } from "foo.60";

(that regressed)
2021-08-12 18:03:01 +02:00
Olivier Goffart
a5689a6389 Flickable: Ignore repeated child elements in geometry computation to avoid compiler panic
This fixes a panic but ideally, we should merge the layout info of each children

cc #407
2021-08-12 16:17:13 +02:00
Olivier Goffart
1246b28006 Add test that unicode in identifier works
With GCC 10 and Rust 1.53, this is supported so just add a test for it
2021-08-12 10:20:26 +02:00
Olivier Goffart
c25538c982 Normalize identifiers to - instead of _
As a result
 - The error messages will now show the error with `-` instead of `_`
 - The LSP will auto-complete with -
 - The interpreter's list of properties will list the property with '-'
   (but we made the change so that set_property, get_property, and so on
   work also if passed a '-')
2021-08-10 22:21:01 +02:00
Olivier Goffart
76de53cead Update cbindgen 2021-08-10 10:49:43 +02:00
ogoffart
53f286258c Bump version number to 0.1.1 2021-08-10 08:06:20 +00:00
Olivier Goffart
5d9608a565 Keep the Rotate element as internal 2021-08-09 17:43:22 +02:00
Olivier Goffart
b6137ecbc4 Error when trying to use internal builtin items 2021-08-09 17:43:22 +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
d2e2eecf0d Allow parent element to contain contraints and still be able to set the height or width 2021-08-07 14:05:05 +02:00
Olivier Goffart
d41839abe3 Compiler pass for the TabWidget
it will lower the TabWidget into a TabWidgetImpl and the tabs into TabImpl
2021-08-06 15:58:13 +02:00
Olivier Goffart
29e0ae913c TabBar: implement something in the ugly style
and change the TabImpl API
2021-08-06 15:58:13 +02:00
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
341387c8d0 Provide sixtyfps::Window by reference in the generated C++ API 2021-08-03 10:32:04 +02:00
Simon Hausmann
23da97bc75 minor cleanup
Rename window_ to window_rc for the private window member in the generated C++ struct.
2021-08-03 10:32:04 +02:00
Simon Hausmann
66891a299c Start a new sixtyfps::Window API for Rust, C++, the interpreters and JS
The generated component now provides access to a Window type
via the window() accessor function.

This is part of #333
2021-08-03 10:32:04 +02:00
Simon Hausmann
5fd63b63f1 Add build test coverage for using images but not embedding them
The rust generator produced some code that didn't compile, which is fixed now.
2021-08-03 10:31:29 +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
Simon Hausmann
17b3fbc7cf Fix cursor navigation when using combining characters
The cursor navigation left/right (and subsequently text selection) needs
to respect grapheme boundaries. Since we already depend on the
unicode-segmentation crate through femtovg, we might as well use the
functionality for determining grapheme boundaries from there.

The only place where the cursor navigation is allowed to break that is
when using backspace, as that allows the user to break glyph clusters.
2021-08-01 09:35:19 +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
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
7f611d21e3 Fix Angles conversion 2021-07-26 17:36:02 +02:00