Olivier Goffart
0b3fecf300
WIP: API to expose image loading from C++ and Rust
2021-05-28 17:05:16 +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
ba1aff84d0
Layout refactoring: C++ part
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
Simon Hausmann
5d6c8e7ee1
Make the export of the vtable getter functions conditional
...
We only need the create these getter functions and export them on Windows
for ffi enabled builds.
2021-05-11 08:03:50 +02:00
Simon Hausmann
28701d2f90
Fix item vtable usage on Windows
...
The item tree is intended to be initialized with pointers to the item
vtables, which are implemented using data relocation records that
resolve to the symbols exported by the sixtyfps_cpp shared library.
On windows, according to
https://docs.microsoft.com/en-us/cpp/c-language/rules-and-limitations-for-dllimport-dllexport?view=msvc-160
such data relocations are not supported, so this patch implements the
fallback through getter functions.
2021-05-10 22:54:06 +02:00
Simon Hausmann
4198513832
Add a dummy indirection in C++ for the item vtable access
...
This will allow for a compile-time decision in the future whether
to use the vtable symbol or getter function.
2021-05-10 22:54:06 +02:00
Olivier Goffart
0083bd8d23
Fix return statement in the C++ generated code
...
The template parameter of the ReturnWrapper could be deduced to
a wrong type (eg: int instead of float) so we must add it explicitly
2021-04-27 10:17:09 +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
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
3f3a4c4ec9
Store the actual property declaration node
...
so that the goto definition can go to the right location
2021-04-18 14:19:38 +02:00
Simon Hausmann
afe3df6381
Remove the public API for registering fonts by path or memory chunk
...
This is not needed anymore in the light of being able to write `import "blah.ttf"` in .60 markup
2021-04-14 10:01:33 +02:00
Simon Hausmann
5e7a030e67
Fix cargo fmt
...
Remove trailing whitespace
2021-04-14 09:49:02 +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
Olivier Goffart
ca64a540c4
Continue support for rgb() function
...
Fixup of previous commit which was part of https://github.com/sixtyfpsui/sixtyfps/pull/139
2021-04-12 15:18:25 +02:00
Seo Sanghyeon
0a76f40093
Add rgb function
2021-04-12 13:24:46 +02:00
Olivier Goffart
a712f515fa
Make the viewport element of the flickable a real Element in the object_tree
2021-04-09 19:14:48 +02:00
Olivier Goffart
85986c39bd
Layouting: make the materialize fake layout property have an actual value
...
So that when we query it from the code, it has a value
2021-04-08 14:35:16 +02:00
Simon Hausmann
dca6f959cd
Fix C++ build of demos not rendering correctly
...
Call set_component only on the top-level app component, not on each repeated instance, etc.
2021-04-06 14:02:50 +02:00
Simon Hausmann
0e5ac6fbb8
Fix build of generated C++ code
...
Amend commit bd79bb6ac8
2021-04-06 13:58:33 +02:00
Simon Hausmann
bd79bb6ac8
Fix init order of generated C++ code
...
Like in commit 625eb733d3
for the
interpreter, call `set_component` on the Window before running the setup
code that might set the focus_item.
2021-04-06 13:42:15 +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
3db3400951
Rename the Object type to Struct in the compiler
2021-03-16 12:38:53 +01:00
Simon Hausmann
8372d3f6d8
Rename call_*
to invoke_*
for callbacks
...
Fixes #187
2021-03-15 17:01:05 +01:00
Olivier Goffart
014e13b05f
Make Diagnostic field private
2021-03-15 10:37:24 +01:00
Olivier Goffart
730b1ccff2
Refactor diagnostic: Merge BuildDiagnostic and FileDiagnostic
2021-03-12 19:32:50 +01:00
Olivier Goffart
11e0be5130
Add the SourceLocation into the Diagnostic
2021-03-12 12:49:19 +01:00
Olivier Goffart
fc35d101d9
Rename diagnostics::level to DiagnosticLevel
2021-03-11 16:27:40 +01:00
Olivier Goffart
436d113b1e
Rename ResourceReference
to ImageReference
in the compiler
2021-03-11 10:29:05 +01:00
Olivier Goffart
6f88d78303
Rename Resource
to ImageReference
in the runtime
2021-03-11 10:06:23 +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
Olivier Goffart
68de483f30
Ensure that the repeater are updated when we compute the layouts
...
Fixes #167
2021-02-12 10:07:33 +01:00
Olivier Goffart
096f55e365
Change behavior of percent sice within the layout
...
So that size with percentages don't affect the maximum/minimum size
Fixes #117
2021-02-11 20:32:26 +01:00
Simon Hausmann
2dd5ea61bb
Add support for Path.fill-rule
...
For some reason it's not working with the Qt renderer though
2021-02-10 14:08:32 +01:00
Simon Hausmann
57d3a34996
Prospective fix for doc errors
...
In the nightly it appears that `no_mangle` is now considered "unsafe",
so we need to allow that in the ffi modules. For the layout code this
patch also creates that ffi module with prefixed function names, like in
the other modules and only allows unsafe in there.
2021-02-10 11:26:28 +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
d49532182a
Fix test_cpp_expr_trigo on windows
...
Too difficult to access PI in C++ in a cross platform way.
It is simpler get the value from rust.
2021-02-08 14:59:54 +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
Simon Hausmann
50d9211e0a
Fix failing default_color.60 test
...
Allow converting a brush to a color. In the case of a gradient, the color of the first stop is returned.
For the C++ generator this requires adding the extra case of explicitly
calling the `Brush(const Color &)` constructor, despite it being implicit,
in order to generate the correct code when we have IR that casts twice:
```
Expression::Cast {
from: Expression::Cast {
from: Expression::Cast {
from: Expression::NumberLiteral(...),
to: Type::Color,
}
to: Type::Brush,
},
to: Type::Color,
}
```
2021-02-04 13:44:10 +01:00
Olivier Goffart
4643706409
Make sure linear gradiant always have all its stops
2021-02-03 15:42:35 +01:00
Simon Hausmann
262eb00af4
Allow an implicit conversion from a color or a linear gradient to Brush in C++
2021-02-03 14:42:21 +01:00
Simon Hausmann
1d54947de9
Fix compilation of @linear-gradient with brush properties in C++
2021-02-03 13:22:44 +01:00