Commit graph

1174 commits

Author SHA1 Message Date
Simon Hausmann
d420d5efd7 internal cleanup: Rename Property::set_dirty() to mark_dirty() 2021-10-20 15:25:28 +02:00
Simon Hausmann
7d12fd7b4e Add support for tracking the length of a model in C++
Similar to the parent commit, the model tracks changes to the rows and
marks an internal property dirty. Since we have a base class this is a
little less intrusive.

cc #98
2021-10-20 15:25:28 +02:00
Simon Hausmann
63bf1af093 Add support for tracking the length of a model in Rust
This is done by exposing the ModelNotify to the caller via the new
ModelTracker trait, which has a function that allows "hooking" into the
dirty tracking of the size.

By extension, this also works in JavaScript.

cc #98
2021-10-20 15:25:28 +02:00
Olivier Goffart
6b55821707 sixtyfps-build: don't print rerun-if-changed before the compilation error
Because otherwise it shows in the output in case of .60 compilation error
2021-10-12 14:05:33 +02:00
Simon Hausmann
2983ae48c4 Remove unnecessary dependency 2021-10-08 10:02:02 +02:00
ogoffart
77fcd5221b Bump version number to 0.1.4 2021-10-07 09:36:43 +00:00
Olivier Goffart
4844450d01 Update the version in docs 2021-10-06 14:54:22 +02:00
Olivier Goffart
106f1b756b Fix sixtyfps-build always forcing a rebuild when a builtin image is include
We can't call return-if-changed with "builtin:" URL, otherwise cargo
thinks the build script always need to be re-run

Fix the gallery example always being rebuilt because it uses AboutSixtyFPS
2021-10-06 12:28:30 +02:00
Simon Hausmann
c91a38cdce Add support for embedding data in generated C++ code
This allows compiling with SIXTYFPS_EMBED_RESOURCES=true and
images/fonts are embedded as inline variables.

Generated data is emitted into the header file as

   inline uint8_t sfps_embedded_resources_123[789] = {
       0x1, 0x2, 0x3,
   };
2021-10-05 15:05:50 +02:00
ogoffart
8b9717633e Bump version number to 0.1.3 2021-10-05 10:31:45 +00:00
Olivier Goffart
ae3e1b4680 Allow normal Element to be in the Dialog's button row with dialog-button-role 2021-10-05 09:46:20 +02:00
Olivier Goffart
2716e4b4dd TouchArea: add the pointer-event callback
... instead of `pressed-changed`

This allows to see what mouse button was pressed.

Closes #535
2021-10-04 14:39:49 +02:00
Simon Hausmann
7a2f365941 Bump corrosion sha1
This includes improved cargo version parsing and better error messages when rustc isn't found.
2021-09-30 15:03:40 +02:00
Olivier Goffart
671df0f24f New widget: StandardButton 2021-09-29 16:25:44 +02:00
Simon Hausmann
4eef8c7688 Add API to sixtyfps::Image in Rust and C++ to access the optional path 2021-09-28 08:52:27 +02:00
Olivier Goffart
bbe178aadf Add links to the template repositories 2021-09-28 08:24:44 +02:00
Olivier Goffart
28932a32a5 Mention the bool type in the docs 2021-09-24 09:26:00 +02:00
Simon Hausmann
043c1932ad Make it possible to disable x11 support
The GL backend defaults to enabling X11. The default crate depends on
the GL backend but it doesn't specify default-features = false,
therefore x11 is basically always enabled.

In line with commit 1fd8c7236a, this
change makes sure that the defaults are defined in the tree entry
points: The Rust API crate, the interpreter crate and the CMake project
define the defaults. The latter already enabled X11 by default, but the
first two did not.
2021-09-22 11:32:51 +02:00
Simon Hausmann
45aa93f1b1 Make it possible to use the C++ build with Qt 6
Since we require Qt 5.15, we can use the versionless CMake targets and also
find Qt 6 first.
2021-09-20 17:02:35 +02:00
Simon Hausmann
324fb48499 Clean up generated C++ include directory handling
Don't generate the headers by default in the source directory, put them
into a sub-directory in OUT_DIR instead and convey that location via
links to the C++ test driver.
2021-09-18 07:32:53 +02:00
Simon Hausmann
4f158618a1 Fix make install in the C++ build running cbindgen
Make install would still trigger the generated_headers_target CMake
custom command - due to the use of add_dependencies - and that would end
up running cbindgen. That in turn breaks "make install" when it's run in
an environment that doesn't have cargo in PATH (for example when using
"sudo make install").

This patch folds the generation of the C++ header files into the build
of the sixtyfps-cpp crate - via build.rs. By default the headers are
placed in api/sixtyfps-cpp/generated_include but the CMake build
redirects that into the build directory.

Note: Due to the way that corrosion works, cargo is still run when
running "make install", but it's path is absolute and there should not
be any reliance on the PATH environment variable.
2021-09-18 07:32:53 +02:00
Simon Hausmann
562842f19e Bump minimum required CMake version from 3.16 to 3.19
The upcoming re-organization of the C++ header generation requires the
use of the CORROSION_ENVIRONMENT_VARIABLES target property, which in
turn requires CMake >= 3.19.
2021-09-18 07:32:53 +02:00
Simon Hausmann
0e191caf78 Improve cmake diagnostics
Print a feature summary. This also helps diagnose CI builds.
2021-09-16 10:41:33 +02:00
Simon Hausmann
fa294c9b02 Fix C++ warning about unused variable
The insert_it variable is unused, and some compilers warn about it, causing -Werror builds to fail.
2021-09-15 12:59:17 +02:00
Simon Hausmann
c3d0fd04af Add C++ API to introspect exported global singletons in the interpreter
This adds the necessary shims to expose the same API as Rust.
2021-09-15 07:56:28 +02:00
Olivier Goffart
c56b965672 Update version number in docs 2021-09-09 08:54:19 +02:00
Simon Hausmann
e193792194 Update copy of the SixtyFPS logo
Unfortunately the rtd theme doesn't support the logo url yet in
our setup, so update this svg copy as the original was updated to
remove the space between "Sixty" and "FPS".
2021-09-08 17:31:47 +02:00
Simon Hausmann
1fd8c7236a Make it possible to disable the GL backend in the CMake build
Even if SIXTYFPS_BACKEND_GL is set to OFF, we would default to enabling
X11, which translates to enabling the x11 feature, which in turn
implicitly activates the GL backend. In addition, the interpreter Rust
API crate also enables the GL backend in its defeaults.

In order to make it possible to turn off the GL backend, three changes are necessary:

* The default backend no more selects a default :-). Instead the Rust
  API crate, Rust interpreter API crate and the CMake project define
  the same features and defaults.
* The C++ crate depends on the interpreter without its defaults (which enable GL)
* In CMake the X11 and Wayland features become dependent options, that
  are only show in the CMake configure UI if the GL backend is enabled.
  This way a GL-disabled build won't also pass --features x11.
2021-09-08 17:13:10 +02:00
Olivier Goffart
fafcbfde2c Fix panic when trying to access layout cache of destroyed items
This can be reproduced by deleting the last item of the printer queue in the
printer demo.
It is a regression showing up because we now emit the MouseExit event after
the mouse grab as released.
The problem is that we upgrade the weak item, and call geometry() on it.
Calling geometry will re-evaluate the layout cache which will re-evaluate
the model which will result in the component being removed and the cache
entry having less item than expected.

It is ok to simply return 0. for these layout location since the item will
disapear anyway.
2021-09-08 14:42:08 +02:00
Simon Hausmann
7da24c40c3 Use the GL backend in the CI for node tests
In the CI we set SIXTYFPS_NO_QT=1 and this change removes the testing
backend from the nodejs tests, in order to fix #419 .
2021-09-06 15:56:59 +02:00
Olivier Goffart
619ce6c4f7 Struct exposed to .60 as struct need to be layed out in alphabetical order
because that's the order in which the C++ code generator pass the argument
to the agregate initialization
2021-09-05 09:29:00 +02:00
ogoffart
e54e03148f Bump version number to 0.1.2 2021-09-04 10:08:51 +02:00
Simon Hausmann
cca2a18edb Fix C++ build with the interpreter disabled 2021-09-03 14:33:55 +02:00
Simon Hausmann
5a81976f3b Allow selecting features in the CMake integration
Provide the same features as in the Rust API crate, as CMake
options.
2021-09-03 14:33:55 +02:00
Olivier Goffart
092d5d551f C++: add blocking_invoke_from_event_loop
A blocking version of invoke_from_event_loop
2021-09-01 23:19:13 +02:00
Olivier Goffart
e1be599bc0 Print an warning in stderr when modifying read-only model
... and improve the documentation of Model
2021-08-31 10:36:22 +02:00
Olivier Goffart
e22e870ce6 Adjustment to the rust documentation with regards to global singetons 2021-08-27 18:00:44 +02:00
Simon Hausmann
54182ff54b Add a section to the C++ intepreter intro about global singletons
Also minor fixes to the generated C++ global singleton docs.
2021-08-27 17:14:57 +02:00
Simon Hausmann
3212cda271 Add a section to the C++ docs about accessing global singletons 2021-08-27 17:08:57 +02:00
Simon Hausmann
8de3075270 C++ docs: rework the entry points
Move the sixtyfps::namespace entry into a dedicated C++ integration overview
page. Also duplicate and specialize the instantiation and model bits, which
differ between the compiled code and the interpreter.

Finally, fix the generated C++ docs to not mention that there's a constructor,
instead we generate a constructor function.
2021-08-27 16:56:36 +02:00
Simon Hausmann
499f75455e Re-order the side bar in the C++ docs
The new order is

    1. Getting Started
    2. C++ / .60 Integration
    3. Reference

The second section will host a broader introduction that is currently hiding
in the namespace.
2021-08-27 14:44:33 +02:00
Simon Hausmann
6d05959c93 Complete the generated C++ code docs to mention globals
But there's an entire section still missing with an example.
2021-08-27 14:28:33 +02:00
Simon Hausmann
4b8259017b Doc fixes
Try to use the term "global singleton" consistently. That's also the
term we use in the language reference.
2021-08-27 13:46:44 +02:00
Simon Hausmann
0bb586e70f Minor documentation fixes for the globals access API 2021-08-27 13:36:48 +02:00
Olivier Goffart
70c57844b7 Add invoke_global_callback to the C++ interpreter API 2021-08-27 13:36:48 +02:00
Simon Hausmann
c7ef3e0fb9 Link from the rust global docs to the singleton langref 2021-08-27 13:36:48 +02:00
Simon Hausmann
28dd54ebad Add docs for the Rust API of accessing globals 2021-08-27 13:36:48 +02:00
Simon Hausmann
7a8c798d70 Fix rust doc build 2021-08-27 13:36:48 +02:00
Olivier Goffart
0fad27e23e Add set_global_callback in the C++ interpreter API 2021-08-27 13:36:48 +02:00
Simon Hausmann
cf7d33fb5d Add support for accessing exported globals from Rust 2021-08-27 13:36:48 +02:00