Commit graph

1597 commits

Author SHA1 Message Date
Olivier Goffart
131d14058b Fix C++ generated code when the numbers are too big 2021-09-05 09:29:00 +02:00
Olivier Goffart
d47b679114 Fix panic of the syntax_tests 2021-09-05 09:29:00 +02:00
Olivier Goffart
a883ca0569 Optimize away Rectangle that serve no purpose
Rectangles which do not draw anything and have no x or y don't need to be in
the item tree, we can just remove them.
2021-09-05 09:29:00 +02:00
Olivier Goffart
f69ad502d6 Update rowan version 2021-09-04 10:50:06 +02:00
ogoffart
e54e03148f Bump version number to 0.1.2 2021-09-04 10:08:51 +02:00
Olivier Goffart
a28bc7c629 Refactor the way the builtin files are loaded
So that we can share some code accross styles
2021-09-03 22:31:54 +02:00
Olivier Goffart
4f1eacd6d8 LineEdit is now able to scroll to keep the cursor visible 2021-09-02 17:20:44 +02:00
Olivier Goffart
b2392c25c7 Basic support for Multi-line TextInput 2021-09-01 16:52:37 +02:00
Simon Hausmann
ffc2c81bd0 Fix code comment about names of exported global 2021-08-31 17:09:11 +02:00
Simon Hausmann
ee8e5699e5 Clean up global alias handling
Remove the internal name again and pick the first exported one when
assigning ids. This avoids internal names showing up in code completion
or the internal types leaking into generated code.
2021-08-31 17:09:11 +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
Simon Hausmann
ab522eb147 Produce errors when exporting a name multiple times 2021-08-31 10:19:50 +02:00
Simon Hausmann
c3ca796b1d Fix missing compiler warning about duplicated ids when using id more than twice
Don't remove the id of a duplicate from the seen set, as it may appear
again.
2021-08-30 20:35:31 +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
3206d6fcfc Minor cleanup
In the compiler we can set the mark that a global component is meant for
export earlier.
2021-08-27 13:36:48 +02:00
Simon Hausmann
cf7d33fb5d Add support for accessing exported globals from Rust 2021-08-27 13:36:48 +02:00
Simon Hausmann
9868b693e2 Only publish exported globals in C++ and Rust 2021-08-27 13:36:48 +02:00
Olivier Goffart
81688906f7 C++ Interpreter: add API to get/set global value 2021-08-27 13:36:48 +02:00
Simon Hausmann
c5d2ac2dd3 Rust codegen: Generate structures with public acccessors for global structs
It's not possible to create these from Rust code (intentional) and the
accessor to reach the instances are not implemented yet.
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
5f8cea5926 WIP interpreter API to access globals 2021-08-27 13:36:48 +02:00
Olivier Goffart
11398c19eb First implementation of semantic token in the LSP 2021-08-25 13:26:50 +02:00
Olivier Goffart
b07d52cd23 Support aliases to callbacks in globals 2021-08-24 12:36:16 +02:00
Simon Hausmann
cdca921469 Apply the default text color from the style for the color of Text and TextInput elements
We apply a default window background from the palette to all `Window`
elements, and likewise we need to apply the default text color to Text
elements to ensure a readable contrast.

This also fixes the default text color when using Qt/native style in
dark mode on macOS.
2021-08-23 15:03:18 +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
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
Simon Hausmann
d5a969f804 fluent style: make combobox selection slightly more intuitive
Highlight (and select) items when hovering into the background, not just over the text.

This is done by making sure the touch area covers the entire item. The same change
is applied to the ugly style, which however isn't directly affected as it has not padding.
2021-08-19 09:40:46 +02:00
Simon Hausmann
a87fdcb499 Minor cleanup in fluent and ugly style
Use a property alias for the groupbox title
2021-08-19 09:12:18 +02:00
Tobias Hunger
d26707e41e Janitor: Fix clippy::bool_assert_comparison 2021-08-18 00:24:51 +02:00
Tobias Hunger
a387c0f60f Janitor: Fix clippy::needless_borrow 2021-08-18 00:24:51 +02:00
Tobias Hunger
c7d27d5ace Janitor: Fix clippy::redundant_clone 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
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
a094ce7a2a Add a warning on the internal crates documentation that we don't follow semver 2021-08-16 18:26:33 +02:00
Olivier Goffart
0b2fd617f0 Derive simple enum from Copy 2021-08-13 11:58:22 +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
144d1bed36 internal cleanup: replace use of imported function with qualified use 2021-08-12 18:07:58 +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
Simon Hausmann
01e2a14322 Remove unused properties from globals
The fluent style has a bunch of unused global color properties, which can be removed - for example.
2021-08-12 16:33:37 +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
d5b1a95f74 Turn the "duplicated id" error into a warning
Just for compatibility reason with 0.1.0, this is going to be turned
back into an error at a later point
2021-08-12 13:47:11 +02:00
Olivier Goffart
6cb1095e53 Styles: replace all _ by - 2021-08-10 22:21:01 +02:00
Olivier Goffart
7304907b11 Use dashes in builtins.60 2021-08-10 22:21:01 +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
Simon Hausmann
cb03f1fe8f Prospective fix for updater test
Add the font-size property also to the SpinBox in the fluent style, as the old printer demo expects the style to provide it.

Another way would be to run the test with the ugly style, but
that's just hiding the fact that there's an API difference.
2021-08-10 16:18:19 +02:00
Simon Hausmann
df238d738d Fix build of the old printer demo
It uses a font-size on the Button, which is present in the other styles.
2021-08-10 16:06:35 +02:00
Simon Hausmann
01c3347d19 Make fluent the new default style
It's not ugly :-)
2021-08-10 15:56:38 +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