Commit graph

148 commits

Author SHA1 Message Date
Olivier Goffart
0598b3f095 The debug() function can now take several args, and debug more types 2021-06-01 14:10:25 +02:00
Olivier Goffart
77b8bb615f Move some code in a new module 2021-06-01 12:50:29 +02:00
Olivier Goffart
a1880bd943 Report an error when trying to convert from logical to physical coordinate in a global 2021-05-20 18:11:58 +02:00
Olivier Goffart
a79a4351b5 Be smarter at detecting the constant property and at not generating bindings
this implies that we need to make sure the property are initialized in
order so that constant properties that depends on other constant properties
are correctly computed
2021-05-20 13:40:51 +02:00
Olivier Goffart
54be5f3a84 Some ground work to make more binding analysis
- Mark builtin properties that are modified by the native code as output
 - Record wether the property is set by code in the .60
 - Add a field that will tell us if a property binding is constant
2021-05-20 13:40:51 +02:00
Olivier Goffart
73c396ed7a Report binding loops for layouts 2021-05-18 12:25:19 +02:00
Olivier Goffart
3548c48bff Detect binding loop at compile-time
FIXME: i've currently disabled layout from the detection because it reports
error in our current examples
2021-05-15 15:49:27 +02:00
Olivier Goffart
c39cb48125 Move builtin types builtin function lookup in the lookup module
This way these function can also be auto-completed
2021-05-12 22:21:08 +02:00
Olivier Goffart
203c27c5e3 Properly visit the repeater_index expression in a Expression::LayoutCacheAccess 2021-05-11 14:59:57 +02:00
Olivier Goffart
81473c2541 Remove implicit_size from the Item vtable
Use the preferred size in the layouting_info instead.
2021-05-11 14:59:57 +02:00
Olivier Goffart
a43c2bb50a Component pretty print with indentation 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
1106f6f201 Fix conversion of some units 2021-05-07 17:13:38 +02:00
Olivier Goffart
f620351cbf Go to definition of structs
Also add the struct in the outline
2021-04-24 15:06:58 +02:00
Olivier Goffart
14772a9b58 Handle reduction of logical lenght when the units are more complex 2021-04-21 17:15:19 +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
069b5aa1a1 Refactor lookup
Share some code so we can eaily list all possibilities and we will use that
in the LSP for the completion
2021-04-16 23:41:59 +02:00
Simon Hausmann
f7ce1ba8b4 Generate registration code for custom fonts imported in .60 files
This removes the need to manually register fonts. This is initially
applied to the printer demo, but the other demos and removal of the
public manual registration API will come in follow-up commits.
2021-04-14 09:30:32 +02:00
Olivier Goffart
84501e630a Rename SyntaxNodeWithSourceFile to SyntaxNode
Same for SyntaxToken
2021-04-13 17:10:56 +02:00
Olivier Goffart
e67deebc76 Make rgb() and rgba() a macro that can take 3 or 4 arguments
and that accept both percent or integer

Closes #139
2021-04-12 15:19:15 +02:00
Seo Sanghyeon
0a76f40093 Add rgb function 2021-04-12 13:24:46 +02:00
Olivier Goffart
563866a60f Remove debug assertion that is not always true
because Int32 and Float32 can be compared but aren't the same type
2021-04-09 19:28:32 +02:00
Olivier Goffart
b45190ca2d Flickable geometry
Issue #192
2021-04-09 19:14:48 +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
989e916e8c Move NamedReference to its own module 2021-03-29 13:31:36 +02:00
Olivier Goffart
68157724cc No need to special case length casts for Expression::is_constant
Lenght cast lower to a FunctionCall which is not constant anyway
2021-03-23 13:22:49 +01:00
Olivier Goffart
3db3400951 Rename the Object type to Struct in the compiler 2021-03-16 12:38:53 +01:00
Olivier Goffart
730b1ccff2 Refactor diagnostic: Merge BuildDiagnostic and FileDiagnostic 2021-03-12 19:32:50 +01:00
Olivier Goffart
7c48bcdd4c Add the source file getter to the Spanned trait, and remove SpannedWithSourceFile 2021-03-11 14:09:55 +01:00
Olivier Goffart
436d113b1e Rename ResourceReference to ImageReference in the compiler 2021-03-11 10:29:05 +01:00
Olivier Goffart
c840b046ae Rename the "resource" type to "image" 2021-03-10 17:24:31 +01:00
Simon Hausmann
391d0152f0 Add Color::brighter/darker functions
These are exposed in .60 as well as in Rust and C++ and implemented by
converting to HSV color space and adjusting the brightness (value).
2021-02-24 10:49:27 +01:00
Olivier Goffart
5727a4cf02 implement square root 2021-02-20 08:53:08 +01:00
Simon Hausmann
8b28c4d792 Fix compilation with empty image urls when resource embedding is enabled
`@image-url("")` should translate to `Resource::None` instead of
`Resource::AbsolutePath` to avoid that the rust compiler tries to
include a directory when embedding images.
2021-02-17 16:01:54 +01:00
Simon Hausmann
2ce672bd68 Reduce dependencies
Use only specific lyon packages instead of pulling all of them in.
This slightly speeds up compilation as well as for example lyon_tesselation
doesn't need to be compiled anymore.
2021-02-09 17:22:01 +01:00
Olivier Goffart
431ce88326 sin/cos/tan and asin/acos/atan 2021-02-08 12:23:31 +01:00
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
Olivier Goffart
b75e135459 Support complex product of units
Fixes #68
2021-02-04 12:56:14 +01:00
Olivier Goffart
4643706409 Make sure linear gradiant always have all its stops 2021-02-03 15:42:35 +01:00
Simon Hausmann
6a1819e4fd Fix the type of Expression::LinearGradient
This allows assigning @linear-gradient to brush properties
2021-02-03 13:09:58 +01:00
Simon Hausmann
7982325da4 Change Rectangle::background's type to be a brush
This also introduces the brush type in the compiler and generators. At the
moment only conversion from Color is implemented.
2021-02-03 12:49:44 +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
294cf9bbe3 Convert from literal 0 to any unit-like types
cc #68
2021-02-02 15:38:07 +01:00
Olivier Goffart
ad1e18764a Make angle its own type 2021-02-01 14:49:25 +01:00
Olivier Goffart
2d12e118ac Resolve linear gradients 2021-02-01 14:25:27 +01:00
Olivier Goffart
52d750999b Pretty-print expression and better debug for Element 2021-01-28 14:36:16 +01:00
Olivier Goffart
23a511b380 Replace img!"..." by @image-url("...") 2021-01-28 11:49:24 +01:00
Olivier Goffart
c2dc0cef2c Finish return statement handling 2021-01-25 15:32:00 +01:00