Commit graph

444 commits

Author SHA1 Message Date
Simon Hausmann
491b064e27 Fix loading of the printer demo in the online editor
Don't panic when loading a path from the file system fails, instead print an error.
2021-04-27 14:38:46 +02:00
Simon Hausmann
140de87351 Add a brief overview section to the C++ interpreter namespace
This mirrors the Rust module side.

Unfortunately the code examples aren't rendered correctly :(
2021-04-27 13:02:41 +02:00
Olivier Goffart
3380383787 Bump version number
(Does not include docs and README yet)
2021-04-26 13:16:48 +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
862f65c151 Fix panic in the interpreter when accessing uninitialized global
As the type of the Value wouldn't match the expected type

Fixes #173

(Also added a way to test the interpreter by making the interpreter
make sure the property "test", if it exists, is true)
2021-04-19 11:41:36 +02:00
Olivier Goffart
ba2f2d5719 Add an Opacity element that does nothing 2021-04-15 10:17:52 +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
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
Simon Hausmann
794d3ec6ec Revert "Add a nodejs testing function for apply_layout"
This reverts commit beb5d63d1b.

Oops, the more modern style *is* to use send_mouse_click.
2021-04-08 16:58:37 +02:00
Simon Hausmann
beb5d63d1b Add a nodejs testing function for apply_layout
This will allow making the JS test code more similar to the C++/Rust code,
allowing replacing synthetic mouse clicks.
2021-04-08 16:51:51 +02:00
Simon Hausmann
c448003e2f Add test case for preferred size in boxes bug
Amends commit 7c1738eeea

This also adds the preferred-width/height fake properties to allow overriding.
2021-04-08 16:13:53 +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
625eb733d3 Fix initial focus test failure
Commit 162944b8c9 changed `set_component` to
clear the weak focus item ref (correct), which made the test failure. That's because
the interpreter called set_component after running the setup code (wrong).
2021-04-06 13:36:11 +02:00
Olivier Goffart
c3ab89dd3e Refactor import opening and its hook
This way the hook is called regardless if the file exist in the import path or not
2021-04-06 12:27:59 +02:00
Simon Hausmann
1e4921de13 Fix LSP server staying alive when closing preview window
* Provide an internal behavior parameter to run_event_loop() that we can use
from the preview to not quit when the last window was closed.
* Fix Drop for the winit event loop GraphicsWindow to drop the backend window correctly
  when unmapping, not when the graphics window dies. Otherwise QuitOnLastWindowClosed doesn't work.
2021-04-06 12:11:55 +02:00
Olivier Goffart
162944b8c9 Add ability in the interpreter to re-use an existing window 2021-04-03 10:00:12 +02:00
Simon Hausmann
e6d165dfbb Don't crash when instantiating .60 files with property <brush> 2021-03-31 08:42:54 +02:00
Simon Hausmann
70653ec7cd Add C++ API for ComponentDefinition::properties() 2021-03-31 08:42:54 +02:00
Simon Hausmann
342f77139b Add public Rust interpreter API to introspect the public properties 2021-03-31 08:42:54 +02:00
Simon Hausmann
9a6e9c3a53 Simplify internal interpreter property descriptor API
Return an iterator when querying the properties. This requires a
one-time copy of the property declarations out of the compiler data
structure, which is read-only.
2021-03-31 08:42:54 +02:00
Simon Hausmann
bb6020496e Hide Value::ImageReferenc from the public interpreter API for now 2021-03-30 10:46:51 +02:00
Simon Hausmann
2904ee71e0 Move ValueType into the public Rust interpreter API
That way we can use it to expose the list of public properties
2021-03-30 10:38:02 +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
Simon Hausmann
841da01717 Fix build of sixtyfps-interpreter with ffi support on armv7
The alignment and sizes are different for some of the enums, so their opaque counterparts need
to be defined accordingly in order for the assertions in ffi.rs to pass.
2021-03-24 11:57:35 +01:00
Simon Hausmann
bb44671cd9 Fix Rust doc build
The interpreter when built with ffi needs the corelib's ffi enabled to access corelib:🪟ffi::ComponentWindowOpaque
2021-03-23 17:55:48 +01:00
Simon Hausmann
8e05a15704 Polish the ComponentDefinition docs a little bit 2021-03-23 17:21:36 +01:00
Olivier Goffart
1dba04721a Add a qt_viewer example that uses QWidget 2021-03-23 17:13:41 +01:00
Simon Hausmann
90d3953d42 Polish the ComponentDefinition docs a little bit 2021-03-23 17:10:14 +01:00
Simon Hausmann
c06b0e10e1 Add/sync class summary docs for interpreter::Struct 2021-03-23 12:57:40 +01:00
Simon Hausmann
2fed4ddaed Split the interpreter ffi module into a separate file 2021-03-22 15:15:07 +01:00
Simon Hausmann
e1f9347aaa Add a diagnostics getter to ComponentCompiler 2021-03-19 18:34:39 +01:00
Olivier Goffart
f2ffc0ebf6 ComponentDefinition::create in C++
Note thate there is a hack so `ComponentHandle<ComponentInstance>` (which is
binary compatible with `VRc<ComponentVTable, ErasedComponentBox>` works
2021-03-19 18:10:38 +01:00
Simon Hausmann
3ad41a551b Minor cleanup
When getting the include paths, avoid one intermediate String allocation
and go straight from str to SharedString
2021-03-19 18:08:53 +01:00
Simon Hausmann
6efc594cf9 Fix doc tests 2021-03-19 17:54:05 +01:00
Simon Hausmann
9eecdefb35 Add ComponentCompiler::build_from_path 2021-03-19 17:26:19 +01:00
Simon Hausmann
fd9d154b27 Add getter/setter for the style 2021-03-19 17:17:57 +01:00
Simon Hausmann
4705c455b9 Remove CompilerConfiguration from the interpreter API
It's not needed anymore with `ComponentCompiler` (I forgot to remove it)
2021-03-19 17:02:19 +01:00
Simon Hausmann
9dcabbe876 Cleanup
Pull in spin_on only if we use ffi
2021-03-19 17:00:51 +01:00
Simon Hausmann
2d790c202f Revert accidental publishing of internal ffi functions
Not needed as long as everything is within ffi
2021-03-19 16:53:27 +01:00
Simon Hausmann
3588d6ffbe Start exposing ComponentDefinition to C++ 2021-03-19 16:50:12 +01:00
Simon Hausmann
591ae8557b Add include_paths setter/getter to ComponentCompiler 2021-03-19 09:56:46 +01:00
Simon Hausmann
14cda0a9b4 Use Self::foo instead of LongerTypeName::foo in the Rust API docs 2021-03-19 09:28:44 +01:00
Simon Hausmann
7af77839ad Add the skeleton for CompilerCompiler in C++ 2021-03-19 09:26:42 +01:00
Simon Hausmann
de8ad46633 Fix doc warnings 2021-03-18 18:31:42 +01:00