Commit graph

354 commits

Author SHA1 Message Date
Tobias Hunger
ac207428dc Janitor: CSpell fixes
Mark up some special words in documents (like C++ lingo in rust files).
2021-07-06 22:44:09 +02:00
Tobias Hunger
39984b27db Janitor: Fix spelling in comments 2021-07-03 15:49:43 +02:00
Olivier Goffart
13bd828b96 Update license date 2021-07-02 15:55:54 +02:00
Simon Hausmann
adeb192f6e C++ API: Make LinearGradientBrush and GradientStop private API 2021-07-02 15:34:16 +02:00
Olivier Goffart
894a369737 C++: Fix warnings on windows
Unproperly escaped path with slashes
2021-07-01 13:50:27 +02:00
Olivier Goffart
35e20763a7 More replacement of &*std::begin with std::data
Complement the previous commit.
It is not ok to call *std::begin for an empty vector.

Also added a test for it.
2021-06-30 17:10:58 +02:00
Simon Hausmann
2662858a71 Fix assert with MSVC when deleting last item in C++ built printer demo
The generated code tries to compute the box layout info for an empty
repeater, where we end up calling `&*std::begin(cells)` and MSVC
asserts that this is dereferencing an invalid iterator. As Olivier spotted,
`std::data` comes to the assert-free rescue :-)
2021-06-30 17:03:28 +02:00
Olivier Goffart
ae114cf79d C++: don't re-export private symbol in the public API
Use the cbindgen_private namespace dirrectly from the generated code
2021-06-28 12:03:49 +02:00
Olivier Goffart
daff9e8e65 Move Callback and internal Models to the private_api namespace 2021-06-28 11:23:44 +02:00
Tobias Hunger
13d7f5e7bd Janitor: Fix typos in comments and user-facing strings
Also adapt tests for error messages containing the fixed strings.

No behavior change is intended!
2021-06-28 08:32:25 +02:00
Tobias Hunger
1e30bea812 Janitor: Fix typo in thread-local variable name
No behavior change is intended here!
2021-06-28 08:32:00 +02:00
Simon Hausmann
66299437f0 Fix C++ build
The path types are now all in the private_api namespace
2021-06-21 15:50:58 +02:00
Simon Hausmann
fe59fb3ec3 C++: Hide sixtyfps::PathData from the public API 2021-06-21 15:50:58 +02:00
Simon Hausmann
51bc21c9a5 C++: Hide AbstractRepeaterView, Repeater and ModelPeer
These are not public API.
2021-06-21 15:50:58 +02:00
Simon Hausmann
7f8f1b3105 Hide Property<T> and PropertyTracker<T> from the public C++ API
Move those two classes into the private_api namespace, which is excluded
from the API reference documentation.

For generate code the explicit qualification of Property<T> is changed,
for the cbindgen generated item types the private_api namespace is
pulled into the cbindgen_private namespace.
2021-06-21 15:50:58 +02:00
Olivier Goffart
99c140ae08 Allow accessing the width and height of the image in .60
Closes #208
2021-06-21 11:22:50 +02:00
Olivier Goffart
a97bcd5ae1 Use BTreeMap unstead of HashMap to store the bindings
Because the order is important to keep deterministic error and output
2021-06-18 21:47:00 +02:00
Olivier Goffart
d758102f26 Make the orientation a static parameter to BuiltinFunction::ImplicitLayoutInfo 2021-06-16 15:14:07 +02:00
Olivier Goffart
cfc04bb4ab C++: adapt to the layout horizontal/vertical split 2021-06-16 15:14:07 +02:00
Olivier Goffart
2483425d57 Add abs() 2021-06-11 14:17:47 +02:00
Olivier Goffart
ce34ff87d0 Finish support for callback aliases
cc #111
2021-06-07 20:40:36 +02:00
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