Commit graph

440 commits

Author SHA1 Message Date
Olivier Goffart
ba1aff84d0 Layout refactoring: C++ part 2021-05-11 14:59:57 +02:00
Olivier Goffart
539a78e807 Rust: implement enough of PathLayout so that the tests passes
(does not implement the repeater case)
2021-05-11 14:59:57 +02:00
Olivier Goffart
f99d7de5ad Fixup layout in rust 2021-05-11 14:59:57 +02:00
Olivier Goffart
b01884f3b9 Layout refactor: do the rust 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
51836a9457 Attempt to fix a stack overflow in debug
The function that initialize all the bindings is huge, and its framz size is
too big. Put each binding evaluation in its own function seems to help
to avoid the stack overflow

Hopefully fixes #133
2021-05-05 22:01: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
f995ec44ae Fix build of rust generated font loading setup code
The font registration functions return void, so generate a semicolon at the end of the call, like with SetFocusItem.
2021-04-14 09:44:33 +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
4a79498761 Rename self_pinned to self_rc, that's a better name since _self is already pinned 2021-03-30 12:56:16 +02:00
Olivier Goffart
1b9ebda204 Rust generated code: Avoid using self_pinned when not needed 2021-03-30 12:55:10 +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
Simon Hausmann
b27034efa5 Rename sixtyfps::IntoWeak into sixtyfps::ComponentHandle and remove Clone from generated components
`ComponentHandle` offers a richer API of common functions, such as
`show()`/`hide()` as well as the new `clone_strong()` - that should help
to prevent mistakely created strong reference that may cause leaks.

Fixes #188
2021-03-15 16:01:13 +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
09ea6572e4 Rust: Fix if in box layouts 2021-02-17 09:22:39 +01:00
Olivier Goffart
2edf247023 Rust: fix compilation when using bindings in global 2021-02-16 15:16:01 +01:00
Olivier Goffart
b580736caf Fix error in the generated rust code with laoyut in for 2021-02-15 15:00:52 +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
81b63c3b3f Small reformating fix 2021-02-12 09:56:37 +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