Commit graph

134 commits

Author SHA1 Message Date
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
Simon Hausmann
b22bbb1c0f WIP: Implement the return statement 2021-01-25 15:32:00 +01:00
Simon Hausmann
f7ea2a9dce Forward focus() calls on items that have initial-focus defined
This also makes the focus() method available as a member function on any
item, but the resolve_element_reference_in_set_focus_calls() pass will
check if the elements are valid.

The check for `has-focus` to determine a focusable item was replaced
with an annotation on the built-in elements, so that `has-focus` can
later be implemented as a built-in function through the run-time,
without the need for a boolean property.
2021-01-20 14:31:01 +01:00
Simon Hausmann
6143d6c471 Minor cleanup
Turn the internal
 (crate::diagnostics::SourceFile, crate::diagnostics::Span)
tuple into a named SourceFile struct, for re-use later.
2021-01-20 12:07:37 +01:00
Simon Hausmann
58768bf70a Add default bindings for width/height for Image and Text to their implicit size 2021-01-15 17:58:32 +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
a37a287a17 Limit the conversion from percentage to lenght for the width and height property 2020-12-04 11:20:09 +01:00
Olivier Goffart
276e11a101 More work on signals with return value 2020-12-01 18:47:49 +01:00
Olivier Goffart
852eeb1c11 WIP popup 2020-11-30 15:20:51 +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
7967a074fb Fix accessing struct declared in a different file 2020-11-17 12:02:21 +01:00
Olivier Goffart
dd4435fe5d Add round/ceil/floor 2020-11-16 12:52:01 +01:00
Olivier Goffart
b45a14bd7a modulo 2020-11-13 16:07:18 +01:00
Olivier Goffart
d499e86640 Implement cubic-bezier 2020-11-13 13:36:32 +01:00