Commit graph

147 commits

Author SHA1 Message Date
Simon Hausmann
686df50e9f Revive support for rotation of elements
The rotation-angle/rotation-origin-x/y properties are lowered to an
injected Rotate element, that we already had.

This needs further fixes for transforming input events and an
implementation of rotation in Skia.
2022-08-11 10:34:41 +02:00
Simon Hausmann
5f4923a6f0 Fix build with slint_int_coord 2022-07-22 23:09:08 +02:00
Simon Hausmann
0ab71ec503 Perform resolution of font properties against the window defaults in the core library
This simplifies the renderer handling - the FontRequest arriving there
will always be resolved.

And this reduces the amount of property dependencies: If a Text elements
specifies a font-family, no dependency to the window's
default-font-family is created.
2022-07-22 23:09:08 +02:00
Olivier Goffart
3639ba2644 Don't expose the KeyEventType to .slint
This enum is not used in any builtin things anyway, so it shouldn't be
used at all in .slint code.
2022-07-22 12:23:52 +02:00
Olivier Goffart
ac4f3e97ad Change slint enum values to be PascalCase in rust
... while still being kebab-case in .slint

Some enums might become public API and we want to have them as
PascalCase to respect the rust conventions
2022-07-22 12:23:52 +02:00
Olivier Goffart
d2186593c0 Pass the ItemRc to each draw_function
So that it can be used as a key to the cache
2022-05-31 10:48:24 +02:00
Olivier Goffart
63b38d7f89 Move the Flickable item and implementation in the same module
The flickable module was created to hold the implementation for the Flickable
at a time were all the items lived in the items.rs module.
Now that some items moved into sub modules of items, we can also move the Flickable
in such module, alongside its implementation
2022-04-22 15:26:13 +02:00
Olivier Goffart
e85e69fda0
Declare .slint enum in one place in i-slint-common
This avoid repeating the enums both in the compiler and in
the runtime library, and register them in a bunch of other places.

So it should be easier to add enums and enum values

Since cbindgen doesn't see through the macro, generate the enum
manually
2022-04-14 19:17:48 +02:00
Simon Hausmann
1b656ecb0d Clean up optimization to skip layers for opacity elements 2022-04-13 17:38:56 +02:00
Tobias Hunger
c825eee228 janitor: Update global cspell
Update global cspell words and remove some file-wide words.

Also remove a manual test that is now also run as a proper test case.
2022-04-12 12:03:45 +02:00
Tobias Hunger
73e178a840 Add enabled property to FocusScope 2022-04-12 10:48:09 +02:00
Olivier Goffart
1b91158b46 corelib: allow to use i32 for coordinate instead of f32 2022-04-11 17:46:50 +02:00
Olivier Goffart
0429e11cf7 Refactor: Move ItemRc and ItemWeak to item_tree.rs
Keep items.rs for the implementation of items, and move the logic
that helprs navigating the tree to the item_tree.rs module
2022-04-07 16:59:38 +02:00
Tobias Hunger
99ac33c440
Debug for ItemRc (#1151)
* vtable: Add Debug implementation to VRc

This will just print the pointer value to be able to destinguish between
different VRcs.

* Derive Debug implmentation for ItemRc

This needs vtable::VRc to have a Debug implementation!

* Update helper_crates/vtable/src/vrc.rs

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>
2022-04-06 16:14:30 +02:00
Tobias Hunger
52c2fe585d
Fix forward tabbing through items (#1149)
* Fix forward tabbing through items

The implmentation never properly stepped out of repeaters, so it went
into a loop when a repeater was below a node without siblings. This in
turn led to the window aborting the focus item search. So the focus
never moved forward.

Add a test to make sure this stays fixed.

* Update internal/core/items.rs

Co-authored-by: Simon Hausmann <hausmann@gmail.com>

Co-authored-by: Simon Hausmann <hausmann@gmail.com>
2022-04-06 13:11:36 +02:00
Olivier Goffart
40c98d6d05 Update cbindgen and enable MouseCursor::move
cbindgen 0.21 was released which contains https://github.com/eqrion/cbindgen/pull/724
which allow to use raw identifier in enums shared with C++.
So now we can have `MouseCursor.move` in slint  despite it being a rust keyword

Note that the strum macro also have trouble with the raw identifier, so we
take that in account in the conversion functions in the interpreter
2022-04-05 06:39:50 +02:00
Tobias Hunger
0ca23948fb Do not overflow when walking the tree 2022-03-31 16:29:38 +02:00
Simon Hausmann
dbebdc190b Fix no_std build 2022-03-31 10:13:33 +02:00
Tobias Hunger
5a4226c03e Make tree-walking code DRY-er
Reuse step_into_node over redoing almost the same code again.
2022-03-31 10:09:34 +02:00
Tobias Hunger
03e6f104be Make ComponentItemTree::new take a ComponentRefPin 2022-03-28 14:13:36 +02:00
Tobias Hunger
c443bb43cf Implement focus movement on ItemRc 2022-03-28 14:13:36 +02:00
Tobias Hunger
be43b648e1 Make visibility status of an item available on ItemRc 2022-03-28 14:13:36 +02:00
Tobias Hunger
d24906e2c2 Implement navigation of logical item tree on ItemRc 2022-03-28 14:13:36 +02:00
Tobias Hunger
ee68716d07 Component: Add information to stich together ItemTrees
Add accessors to the information necessary to stitch together the
Component-wide ItemTrees (which include DynamicNodes) into one logical
tree of Items.
2022-03-28 14:13:36 +02:00
Simon Hausmann
033cf3721e Improve performance of opacity rendering
Avoid an opacity layer also in the case where it is applied to an element with no children.
2022-03-25 10:50:02 +01:00
Simon Hausmann
bef31d3169 Rename the layer boolean property to cache-rendering-hit 2022-03-21 20:22:43 +01:00
Simon Hausmann
535e134223 Add a Layer element that's created when using a layer boolean property
For now no backend implements this optimization hint.
2022-03-21 20:22:43 +01:00
Simon Hausmann
d97710f3f9 Implement correct opacity for the GL backend
This also separates the blend-to-screen part of render_layer into a
helper function, as that will be useful in the future with public layer
elements.

Relates to #725
2022-03-18 16:35:26 +01:00
Simon Hausmann
91b3765e97 Improve method naming in ItemRenderer
Use `visit_` for the pattern where the trait offers a default implementation that calls other
methods to do the actual work.
2022-03-18 15:42:49 +01:00
Simon Hausmann
f04f0a3e48 GL backend: use direct layers for non-rectangular clips
Delegate the decision how to implement the Clip element entirely into the backend,
where the GL backend can now explicitly render
children into a layer, instead of the hack with a layer in the renderer's
state and the extra save/restore pair.
2022-03-18 15:42:49 +01:00
Simon Hausmann
6a6a26569d Add support for rendering complex clip paths into cached layers
If the renderer supports it, clip elements with a complex clip render
the sub-tree into a cached layer.
2022-03-18 15:42:49 +01:00
Simon Hausmann
75949e702c Prepare item rendering for children self-handling
The render function now takes a self_rc and returns a enum that permits
the implementation to handle rendering of children on its own and
thus make the caller skip that traversal step.
2022-03-18 15:42:49 +01:00
Lukas Jung
c15b0e1486 Add focus and keyboard control to native/qt spinbox 2022-03-02 17:51:31 +01:00
Tobias Hunger
f3feab1267
Implement ptr_eq for VWeak and PartialEq for Items (#976)
* Implement ptr_eq for VWeaks

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>
2022-02-21 17:45:18 +01:00
Tobias Hunger
6795d3ee00
Introduce a FocusEventResult enum (#975) 2022-02-21 17:43:41 +01:00
Olivier Goffart
f9fd523583 Update internal/core/items.rs
Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>
2022-02-15 12:02:27 +01:00
Olivier Goffart
efd6c63b8e Fix animation in the flickable
This is a regression since the introduciton of iteration_count which defaults
to 0 for animation started programatically

Also add a test.

Fix #951
2022-02-15 12:02:27 +01:00
Tobias Hunger
4230ac2572
Update copyright information to reflect name change
Also run resue over the codebase and fix complaints from that tool.
2022-02-09 10:27:47 +01:00
Tobias Hunger
de4e195280
Rename internal crates and add a README.md to them
The README.md contains the warning that used to be in lib.rs.

Add README.md files to all internal crates

... pointing to the official public crate to use instead.

Rename internal crates

fixup: README files

fixup rename
2022-02-07 13:12:48 +01:00
Simon Hausmann
125b90a64b Merge remote-tracking branch 'origin/master' into wip/rename
Conflicts:
	api/cpp/cbindgen.rs
	api/cpp/include/slint.h
	examples/CMakeLists.txt
	examples/imagefilter/Cargo.toml
	examples/plotter/main.rs
	internal/backends/mcu/lib.rs
2022-02-04 16:47:20 +01:00
Tobias Hunger
b348d1af44 PropertyAnimation: Make iteration-count: n run animations n times
Side-effect: The code handles invalid inputs to duration/delay better.
2022-02-04 10:42:25 +01:00
Olivier Goffart
c00884d5a2 Rename SixtyFPSElement 2022-02-02 14:29:30 +01:00
Simon Hausmann
7d297da2fc Rename the sixtyfps C++ namespaces 2022-02-02 12:11:27 +01:00
Simon Hausmann
c846633708 Rename C ffi functions 2022-02-02 11:12:34 +01:00
Olivier Goffart
03534039d6 Replace more .60 by .slint
Mainly an automated change with
    git grep -O"sed -i 's/\.60/.slint/g'" -w "\.60"

and some manual checks
2022-02-02 10:12:31 +01:00
Simon Hausmann
8399de5c6a Rename the sixtyfps-corelib-macros crate 2022-02-01 18:03:47 +01:00
Tobias Hunger
e6b24bceec [reorg]: Set up and populate the internal directory
Move "internal" crates into the `internal` directory. This first batch
includes most of sixtyfps_runtime but leaves the rendering backends
alone for now.

pre-commit applied some cleanups to the moved files:
 - Consistent newline at end of file policy
 - trimming trailing whitespace
 - Formatting Cargo.toml files.
2022-01-31 16:00:50 +01:00
Renamed from sixtyfps_runtime/corelib/items.rs (Browse further)