Commit graph

498 commits

Author SHA1 Message Date
Simon Hausmann
753ec83a05 Fix crash with VRc::borrow() on wasm32
When converting a Weak<VT, T> into Weak<VT, Dyn>, we were ignoring that
while T inside VRcInner may be at a certain offset to satisfy alignment,
the empty Dyn field may not and thus be at a different offset.

On wasm32 for example the compiler generated component struct has a
16-byte alignment, while the Dyn has none. So converting the Weak<VT,
Dyn> to a VRc<VT, Dyn> and then calling borrow() would use the wrong
instance pointer.

To fix this, this patch introduces an extra offset field that's
preserved during the casting and that's used for borrow() as well as
drop().
2020-11-12 11:04:56 +01:00
Simon Hausmann
a2dadf8fe8 Remove the component parameter from GenericWindow::process_key_input 2020-11-11 19:16:26 +01:00
Simon Hausmann
64b92df87e Initialize the component in the Window at component creation time
This will allow getting rid of the component as parameter to run()
2020-11-11 19:03:04 +01:00
Simon Hausmann
5d744c86c2 Begin passing the VRC<ComponentVTable, Dyn> into the run-time library
First by changing the signature of run() and by adding a self_weak
to the C++ struct.
2020-11-11 18:31:51 +01:00
Simon Hausmann
a9791c390d Wrap the main component in a VRc 2020-11-11 18:14:15 +01:00
Simon Hausmann
02904c4014 Simplify signature of Component::run
We don't need to pass the root item anymore since ComponentVTable
has now get_item_ref.
2020-11-11 15:55:03 +01:00
Olivier Goffart
7f66ca9584 Add a function in the ComponentVTable to get an ItemRef from an index
Needed to adjust vtable so it can work if the return type has a reference
2020-11-11 14:29:44 +01:00
Olivier Goffart
3886ed329f C++ docs update 2020-11-10 19:33:23 +01:00
Olivier Goffart
d6a440aa4a Change C++ API to use the ComponentHandle 2020-11-10 19:28:34 +01:00
Olivier Goffart
3194dd21ca Expose VRc to the C++ API
(Not yet in use in the code gen)
2020-11-10 12:43:19 +01:00
Olivier Goffart
503567d84c Update the documentation after the changes to ComponentHandle 2020-11-09 15:08:08 +01:00
Olivier Goffart
a1f1fcb3a6 Use VRc<ComponentVTable> in the rust generated code 2020-11-09 14:58:37 +01:00
Olivier Goffart
95c4bac794 Add a dealloc and drop_in_place function to the ComponentVTable 2020-11-06 17:13:01 +01:00
Olivier Goffart
4910c1fdaa Fix string comparison in C++ 2020-11-03 19:42:01 +01:00
Olivier Goffart
c1380875a9 Small code simplifications 2020-11-03 19:20:39 +01:00
Olivier Goffart
8a95b806c7 Strawman implementation of a combo box 2020-11-03 17:55:49 +01:00
Olivier Goffart
a6dbd0d7fa Fix C++ build on MSVC 2020-11-03 17:42:34 +01:00
Olivier Goffart
11e55dd8d2 String -> Float conversions 2020-11-03 15:19:58 +01:00
Simon Hausmann
7f47eb6558 Avoid issuing multiple fetch requests in the online editor for multiple imports of the same file
It's better if only polling the future will start the fetch operation
2020-11-03 14:16:41 +01:00
Simon Hausmann
43052dec42 Another typeloader cleanup
Use the same future interface with an std::io::Result in the
CompilerConfiguration for the fallback loading.
2020-11-03 13:54:09 +01:00
Olivier Goffart
e5302e0b7b Remove unused Type::EnumerationValue
Values are not their own types
2020-11-03 12:34:17 +01:00
Olivier Goffart
4a182ef4d0 Layout alignment 2020-11-03 12:22:34 +01:00
Olivier Goffart
a82c23fc41 Add ability for the native style to export native Globals 2020-11-02 16:13:04 +01:00
Simon Hausmann
d435a7c8b8 Fix loading of images from imported files in the online editor
We need to separate the url resolution step from the document fetching,
as we need to keep the loaded url in Rust for further
resolution.
2020-11-02 14:57:49 +01:00
Simon Hausmann
330f61d6c1 Add support for loading external files in the wasm interpreter
The imported files don't have tabs though, and caching is done entirely
by the browser.
2020-11-02 13:46:58 +01:00
Olivier Goffart
356cd8c3ee Fix compileation with clang
The operator== must be in the same namespace as the struct for ADL to work proprerly
2020-11-01 16:09:42 +01:00
Olivier Goffart
cc85aa818d C++: implements operator== for StandardListViewItem 2020-11-01 15:56:19 +01:00
Olivier Goffart
1eb7203ec8 Also do the comperty comparison in C++ 2020-10-31 14:36:38 +01:00
Olivier Goffart
2ece3817cc Make ModelHandle a struct
Last commit broke for structures containing models, because models are not PartialEq.
So we need to implement PartialEq for ModelHandle. Which means a struct needs to
be created
2020-10-31 13:32:19 +01:00
Olivier Goffart
b103aa3cfa Fix wasm build 2020-10-31 11:41:48 +01:00
Olivier Goffart
e4e7ae46f4 Support for for in box layout in the interpreter 2020-10-31 11:24:31 +01:00
Olivier Goffart
359f42c5f7 Prepare the compiler to be async
This will allow the online editor to load imports from URL asynchroniously later

Since currently the compiler is only working on a single thread, and that we
never await on a future that could block, it is allowed to use the spin_on executor
2020-10-30 15:00:04 +01:00
Olivier Goffart
5face45c51 Rename Component::compute_layout to apply_layout
And pass the expected rectangle.
This is currently not used yet but will be needed when we can have
repeated elements within a box layout
2020-10-29 19:08:52 +01:00
Olivier Goffart
263df7dc63 Remove the www from all sixtyfps.io URL 2020-10-29 11:06:06 +01:00
Olivier Goffart
70d6648880 Remove some remains of code that allowed to use Component as Object 2020-10-27 16:25:21 +01:00
Olivier Goffart
d3801e26d3 Change the syntax of structures to require the struct keyword 2020-10-27 16:09:05 +01:00
Olivier Goffart
333c96fd79 Change Type::Object to be able to hold a name
Internally, structure will be represented with a Type::Object with a name
instead of a Component with a void base type
2020-10-27 16:09:05 +01:00
Olivier Goffart
4a702243d1 Fix C++ layouts 2020-10-27 08:16:02 +01:00
Olivier Goffart
47be71e16d Introduce layout stretching 2020-10-26 16:40:35 +01:00
Olivier Goffart
aeade826fe New runtime implementation for the box layout
Currently only horizontal layout is supported
2020-10-26 14:19:12 +01:00
Olivier Goffart
211fa69ef5 Fix line ending 2020-10-26 14:19:12 +01:00
Olivier Goffart
27a6ff1227 Move Type and related concepts in a different module
Leaving only the TypeRegister in the typeregister module
2020-10-23 11:17:14 +02:00
Olivier Goffart
76b7f1aef6 Allow dashes in identifier
Currenly, dashes are normalized to '_'.
Dashes are not allowed at the begining of an identifier.
If an identifier with a dash is not found, we also look for identifier
without a dash and if that exist, we hint the user to use spaces.

Issue #52
2020-10-22 18:32:25 +02:00
Simon Hausmann
9d146b2b5f Add npm badge also to the node README 2020-10-22 13:30:50 +02:00
Simon Hausmann
008455a106 Include a license file in the node source package 2020-10-22 13:14:56 +02:00
Olivier Goffart
b5b5a24941 Change the verison of sixtyfps-node
Even if it is not published on crates.io, it should have a version that matches
sixtyfps version
2020-10-22 09:35:35 +02:00
Olivier Goffart
20cfb65e53 Bump version 2020-10-22 08:41:45 +02:00
Simon Hausmann
fae046cef4
Small typo fix 2020-10-21 21:35:45 +02:00
Simon Hausmann
68e35ab332 Fix removing todo items in node
After removal the index is wrong and I mistakely thought entries() adjuts.
2020-10-21 14:18:33 +02:00
Simon Hausmann
c59b1e61ac Fix a bug in sixtyfps.ArrayModel.remove
Report the correct index/size to the runtime.

Also added convenience entries()/values() functions that forward to the array.
2020-10-21 13:48:13 +02:00