Commit graph

255 commits

Author SHA1 Message Date
Olivier Goffart
55726cc10d fix two way binding when they are declared twice
Fix the galery's disable button not disabling most widgets
2021-02-05 18:33:28 +01:00
Simon Hausmann
c771bcff45 Print a warning when trying to animate deprecated properties 2021-02-02 22:58:54 +01:00
Simon Hausmann
e61529976e Issue warnings when creating bindings against deprecated properties 2021-02-02 22:42:02 +01:00
Simon Hausmann
1f091cb1c0 Rename Rectangle.color to Rectangle.background
Add support for built-in property aliases and rename `color` to
`background` - in preparation for it also changing to type brush.

Right now the alias is silent, a deprecation and overall change
will come in a subsequent change.
2021-02-02 17:01:12 +01:00
Olivier Goffart
c479fd132d Fix panic when @children is in the last component
Throw an error instead

Fixes #148
2021-02-02 16:44:09 +01:00
Olivier Goffart
e09fa06226 Fix nested for layouts
Fixes #149
2021-02-01 12:38:56 +01:00
Olivier Goffart
55fae15080 Debuging aid 2021-01-29 16:35:59 +01:00
Olivier Goffart
52d750999b Pretty-print expression and better debug for Element 2021-01-28 14:36:16 +01:00
Olivier Goffart
07df517473 Replace $children with @children 2021-01-28 11:55:08 +01:00
Olivier Goffart
9aca0b0a7e LSP: Allow to access to the type loader documents
So that we can go to the definition of un-open documents
2020-12-28 12:48:32 +01:00
Olivier Goffart
7fcb49bef1 Implement Go to definition for elements 2020-12-23 15:15:53 +01:00
Olivier Goffart
0d2d48be4f Rename "signal" to "callback" 2020-12-18 09:51:01 +01:00
Olivier Goffart
7f78bea8b5 Fix a bunch of cargo clippy warnings in the compiler 2020-12-07 12:54:38 +01:00
Olivier Goffart
ac3ce779e9 Make child_of_layout actually mean what it is named after 2020-12-02 18:36:23 +01:00
Olivier Goffart
276e11a101 More work on signals with return value 2020-12-01 18:47:49 +01:00
Olivier Goffart
7bfa998f00 Popup positioning 2020-11-30 18:39:41 +01:00
Olivier Goffart
f3d6ce1695 Fix visit_all_named_references once more
We must visit the layout of every component we see, including the ones
for the popups
2020-11-30 15:20:51 +01:00
Olivier Goffart
957867d72a More work on popup 2020-11-30 15:20:51 +01:00
Olivier Goffart
852eeb1c11 WIP popup 2020-11-30 15:20:51 +01:00
Olivier Goffart
5f93f88b77 Adjust the text of the error message when a property has a non-property type 2020-11-30 13:35:52 +01:00
Olivier Goffart
a4c538c615 Throw an error when using an element as a property type
We currently do not support that
2020-11-30 13:31:02 +01:00
Olivier Goffart
f1d61eb1c3 Fix the no_borrow visitor so they actually do not borrow 2020-11-26 17:16:21 +01:00
Olivier Goffart
2245df7b14 Add a function to visit all expression within a component 2020-11-26 17:15:45 +01:00
Olivier Goffart
f8f02a13eb Refactor the helper to visit all named reference to take a component
If we want to add more expression or named reference in the component,
we then can just update that function
2020-11-25 17:15:27 +01:00
Olivier Goffart
0ad0c181e3 Take a component in the function that visit all elements 2020-11-25 15:16:39 +01:00
Simon Hausmann
fa95064363 Fix resource embedding across component boundaries
When referencing an image a repeated element and were targeting a
configuration that requires resource embedding, then that image would
not embedded.

This was due to the fact that we didn't recurse into sub-components in
the resource collection phase and the generators made a per-component
embedding decision. The field responsible for that was also not
propagated to sub-components.

This patch addresses these two bugs by cleaning up the entire mechanism:

The compiler first generates the new ResourceReference::AbsolutePath for
all img!"foo.png" expressions. If the compiler is configured to embed
resources, then the embed_resources pass will traverse all
sub-components and expressions in them to change them to
ResourceReference::EmbeddedData with a unique integer id. Simultaenously
all the resources to be embedded get also collected in the root
component, so that the build script as well as the generator can take
care of dependency handling and actual resource embedding.
2020-11-23 13:47:16 +01:00
Olivier Goffart
df318d9104 Fix states in the root of other components 2020-11-20 17:14:04 +01:00
Simon Hausmann
89e0b57627 Rework and simplify the focus handling
Instead of determining the focus item through item tree traversal and
pointer comparison and storing the intermediate indices in the
components in the tree, remember the focus item by a pair of
VWeak<ComponentVTable, Dyn> and item_index: usize.

This speeds up determining the focus item as well as delivering events,
which can now be done directly after retrieving an ItemRef with
get_item_ref.

This also fixes the duplicate line edit focus in the 7gui cells
test case.
2020-11-20 15:33:15 +01:00
Olivier Goffart
091a0834d3 Transitions in rust (C++ and interpreter not implemented yet) 2020-11-20 10:30:17 +01:00
Olivier Goffart
88ceeeb3e6 Error when a transition reffers to a state that does not exist 2020-11-20 09:39:06 +01:00
Olivier Goffart
4d4c73925c Some refactoring to prepare for transitions on properties 2020-11-20 09:39:06 +01:00
Olivier Goffart
f131c2d081 When only importing a component, treat that component as the root component 2020-11-18 10:43:39 +01:00
Olivier Goffart
dec29e6d98 Allow to export structs 2020-11-17 12:22:10 +01:00
Olivier Goffart
7967a074fb Fix accessing struct declared in a different file 2020-11-17 12:02:21 +01:00
Olivier Goffart
281a744e86 Load the builtin from a fake .60 file 2020-11-04 16:56:35 +01:00
Olivier Goffart
decbe0ade5 Fix panic when exporting invalid types
And also still allow to export builtin component
2020-11-02 17:18:42 +01:00
Olivier Goffart
a82c23fc41 Add ability for the native style to export native Globals 2020-11-02 16:13:04 +01:00
Simon Hausmann
cba020182a Remove unused parameter 2020-10-29 14:03:15 +01:00
Simon Hausmann
e9bb668921 Replace errors with panics in the export processing
The errors here are not subject to regular test coverage because their
occurrence indicates a grave internal error. There should not be valid
input syntax that leads to this code path.
2020-10-29 14:00:52 +01:00
Olivier Goffart
1479bc956e Support for global in the interpreter 2020-10-29 11:01:04 +01:00
Olivier Goffart
5f5e5b7420 Access global properties from rust
C++ and interpreter implementation is still missing so the new stest is failling
2020-10-29 11:01:04 +01:00
Olivier Goffart
97166672c0 Semantic checks for the globals 2020-10-28 07:52:23 +01:00
Olivier Goffart
980aceded6 Parser: put the component name in a DeclaredIdentifier node
that way we will be able to have the global keyword as another identifier there
2020-10-28 07:18:24 +01:00
Olivier Goffart
d3801e26d3 Change the syntax of structures to require the struct keyword 2020-10-27 16:09:05 +01:00
Olivier Goffart
333c96fd79 Change Type::Object to be able to hold a name
Internally, structure will be represented with a Type::Object with a name
instead of a Component with a void base type
2020-10-27 16:09:05 +01:00
Olivier Goffart
27a6ff1227 Move Type and related concepts in a different module
Leaving only the TypeRegister in the typeregister module
2020-10-23 11:17:14 +02:00
Olivier Goffart
76b7f1aef6 Allow dashes in identifier
Currenly, dashes are normalized to '_'.
Dashes are not allowed at the begining of an identifier.
If an identifier with a dash is not found, we also look for identifier
without a dash and if that exist, we hint the user to use spaces.

Issue #52
2020-10-22 18:32:25 +02:00
Olivier Goffart
4fb87f401e Some fixes for the initializations of two way bindings within sub components
There are still more issues
2020-10-20 14:33:06 +02:00
Simon Hausmann
cf87ac804b Add support for relative lengths
Typically `some_length_prop: 40%` produces an error, but if there's a
matching property in the parent, then it will be allowed and interpreted
as relative value and creates a dynamically updated binding.
2020-10-16 18:54:04 +02:00
Simon Hausmann
1b4317a93a Minor cleanup in the layout code in the compiler
Free the term "Layout Constraints" for use later for the actual constraints
of layouts.
2020-10-13 18:00:54 +02:00