Commit graph

93 commits

Author SHA1 Message Date
Olivier Goffart
a39dd6ac4f Interpreter API: preserve the dashes and underscore when listing properties 2021-08-17 18:47:41 +02:00
Olivier Goffart
4e254445d9 Fix interpreter test 2021-08-10 22:21:01 +02:00
Olivier Goffart
532827b646 Fix the C++ interpreter API compatibility after the change from _ to -
Property name with _ should still be supported by set_property/get_property
2021-08-10 22:21:01 +02:00
Olivier Goffart
c25538c982 Normalize identifiers to - instead of _
As a result
 - The error messages will now show the error with `-` instead of `_`
 - The LSP will auto-complete with -
 - The interpreter's list of properties will list the property with '-'
   (but we made the change so that set_property, get_property, and so on
   work also if passed a '-')
2021-08-10 22:21:01 +02:00
Olivier Goffart
c33e4d76aa Use proper rustdoc link.
Its ``[`...`]``  not  ``[[..]]``
2021-08-07 17:07:41 +02:00
Tobias Hunger
24a2021226 Janitor: Fix clippy::needless_borrow 2021-08-04 22:50:35 +02:00
Tobias Hunger
3c9451f94c Janitor: Fix clippy::needless_question_mark 2021-08-04 22:50:35 +02:00
Simon Hausmann
29f5853332 Provide sixtyfps::Window by reference in the Rust API
This also removes Clone from the Window again, to avoid having to face
the question: Does cloning a window duplicate it on the screen?
2021-08-03 10:32:04 +02:00
Simon Hausmann
66891a299c Start a new sixtyfps::Window API for Rust, C++, the interpreters and JS
The generated component now provides access to a Window type
via the window() accessor function.

This is part of #333
2021-08-03 10:32:04 +02:00
Olivier Goffart
07bf0974d7 C++: Expose conversion betwen Value and Image
Closes #350
2021-07-26 14:12:32 +02:00
Tobias Hunger
9539a53480 Janitor: Fix clippy::redundant_clone 2021-07-23 13:48:52 +02:00
Tobias Hunger
3e0534afea Janitor: Fix clippy::needless_lifetimes 2021-07-23 13:48:52 +02:00
Simon Hausmann
1c285694d7 internal cleanup: Remove the use of ComponentWindow in the interpreter 2021-07-21 17:41:12 +02:00
Simon Hausmann
ef184f7f1a internal cleanup: Remove the rest of the ComponentWindow API
Now it just remains a wrapper around the Rc, and it can soon be moved to
the API crate hopefully.
2021-07-21 17:41:12 +02:00
Simon Hausmann
6e12b00b3f Re-add new constructor functions for ComponentCompiler and CompilerConfiguration
Amends commit dc51d4ccda

As discussed in #310
2021-07-12 13:26:17 +02:00
Tobias Hunger
dc51d4ccda Use impl Default instead of new() constructors 2021-07-12 13:22:25 +02:00
Olivier Goffart
13bd828b96 Update license date 2021-07-02 15:55:54 +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
Simon Hausmann
f377b5db6c C++: Document sixtyfps::interpreter::Value::Type 2021-06-21 15:50:58 +02:00
Olivier Goffart
deaa0fddb0 WIP layout: split vertical and horizontal cache
Split the vertical and horizontal pass into different property cache
This will allow to implement "height for with"

This patch does not port the Rust or C++ binding yet
2021-06-16 15:14:07 +02:00
Simon Hausmann
c0511a54ea Rename ComponentDefintion::callback_names() to just callbacks()
That's consistent with properties().
2021-06-07 12:08:35 +02:00
Simon Hausmann
855808f9b5 Add API to the Rust and C++ interpreter library to return the names of all publicly declared callbacks 2021-06-07 11:43:04 +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
236011d17c Make ComponentDefinition::properties only list the public properties as it should
Fixes #242
2021-05-25 15:48:22 +02:00
Olivier Goffart
8b16509422 Fix wasm build 2021-05-21 16:41:51 +02:00
Olivier Goffart
2265dd04e4 interpreter: wrap ComponentDescription in a ErasedComponentDescription
I'll need that for globals
2021-05-21 12:25:37 +02:00
Olivier Goffart
21a80f4562 WIP: Layout refactoring
Instead of using a solve_layout function in the component, use property to hold
a layout cache.

This commit only implement the GridLayout and only the interpreter part
2021-05-11 14:59:57 +02:00
Olivier Goffart
7ae850d564 Rename Type::Length -> Type::PhysicalLength 2021-04-21 17:15:19 +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
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
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
Simon Hausmann
8e05a15704 Polish the ComponentDefinition docs a little bit 2021-03-23 17:21:36 +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
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
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