Commit graph

34 commits

Author SHA1 Message Date
Olivier Goffart
ad2d19165a Rename the free_graphics_resources to component_destroyed
And do not iterate over the items anymore
2022-05-31 10:48:24 +02:00
Tobias Hunger
9b535e8ee8 janitor: use matches! 2022-05-22 11:59:00 +02:00
Tobias Hunger
a71848fd2c janitor: Avoid some allocations warned about by clippy 2022-05-22 11:59:00 +02:00
Olivier Goffart
b4ebd88d35 Implements @radial-gradient(circle, ...)
Only the circle is implemented so far.

Part of #263
2022-05-19 14:07:20 +02:00
Olivier Goffart
c8e3a05116 Fix C++ compilation when writing to the model data from a sub component 2022-05-13 13:00:01 +02:00
Tobias Hunger
416aa42d90 Component: Replace parent_item to parent_node
Remove the `parent_item` function. After the recent changes that did not
return an item anymore and since the item tree is exposed, this function
was only used to find the repeater a component was created by.

So replace the old function with a new one that only returns the parent
node in the parent component.

This saves a few lines of generated code that is not used anymore.

Co-authored-by: Simon Hausmann <hausmann@gmail.com>
2022-04-20 14:29:18 +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
Olivier Goffart
f8f61dc2b7 Fix a bunch more issue with PopupWindow
* Make sure that the compiler don't panic if the parent of a PopupWindow
   is optimized (by not optiizing such element)

 * Ensure that we can call popup.show() from within a deeper repeater

 * Ensure that the parent element of the popup is the right one in case of
   repeater (and not the node in the parent component)

This partially revert ad5991f8fa and
6c7a7aed0e because we must do the lower_popup
adter the repeater pass, because otherwise the parent element of the
created component for the PopupWindow might be wrong and it is not easy to
adjust (we would have to make Component::parent_element a RefCell or duplicate
it again.

Fixes #1132
2022-04-01 14:06:38 +02:00
Tobias Hunger
072a6fd5e4 Update internal/compiler/generator/cpp.rs
Co-authored-by: Olivier Goffart <olivier@woboq.com>
2022-03-31 17:43:57 +02:00
Tobias Hunger
e05d24b2cf c++: Implement subtree_index(...) 2022-03-31 17:43:57 +02:00
Tobias Hunger
1888ecfd65 c++: Generate better indices for the parent node of repeaters 2022-03-31 14:40:57 +02:00
Tobias Hunger
e5aadd7c26 C++: Make component_at() return a ComponentWeak 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
Tobias Hunger
86a6add32c janitor: Fix typos and make cspell happy 2022-03-18 10:15:44 +01:00
Tobias Hunger
ea684fa4de Add item_tree function to Component VTable 2022-03-14 17:19:31 +01:00
Tobias Hunger
095537e3fd Remove item from ItemTreeNode
... and make ItemTreeNode non-generic this way.

The Item is now only in the extra ItemArray struct and we are free to
expose the ItemTree further.
2022-03-14 09:43:50 +01:00
Tobias Hunger
5d3f296af9 API: Change WindowRc::free_graphics_resources and init_items on C++
Use the ItemArray in both cases.
2022-03-14 09:43:50 +01:00
Tobias Hunger
1fd14272cf Use item_array in C++ 2022-03-14 09:43:50 +01:00
Simon Hausmann
583c7a1b80 Fix C++ build
With ImageInner::StaticTextures (the variant) and StaticTextures (the
struct), we need to disambiguate for the generated enum contructor
functions. This is done by prefixing the enum variant with their name.
2022-03-03 14:39:11 +01:00
Olivier Goffart
0dc188f328 Support for referring to other globals from globals
- We need to make sure that the initialization of global is in the right order.
 - In C++ and rust, we need to add accessor to the global component
 - There can be `PropertyReference::Global` in binding of globals
 - The interpreter globals need to hold references to the global they may depend on

Fixes #175
2022-02-28 10:14:34 +01:00
Olivier Goffart
a32eee64a7 Count the uses of property, and do not generate properties that are not used 2022-02-17 16:25:48 +01:00
Olivier Goffart
9f77e9a2e8 llr: note when a property binding is for a StateInfo 2022-02-16 18:46:37 +01:00
Olivier Goffart
9e938046ca llr: Add a helper function 2022-02-16 18:46:37 +01:00
Olivier Goffart
76a1bf8d7d LLR: Put the expression into a RefCell so they can be optimized 2022-02-16 18:46:37 +01:00
Simon Hausmann
304e06f758 Begin rasterizing glyphs for glyph embedding
Enable with `SLINT_EMBED_GLYPHS=1` and select sizes like
`SLINT_FONT_SIZES=12,16`

This change just puts the data structures in place, rasterizes a fixed
subset, embeds that into the rust generated code and calls a backend
function for registering the font that is unimplemented.
2022-02-15 15:52:24 +01:00
Simon Hausmann
29cbb9e181 Change names of identifiers used for accessing embedded resources in the compiler
Instead of using SFPS (Slint_Fast_Packing_System) use SLINT :-)
2022-02-14 16:17:55 +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
Simon Hausmann
fcf59f3793 Rename the C++ header files 2022-02-02 13:07:26 +01:00
Simon Hausmann
7d297da2fc Rename the sixtyfps C++ namespaces 2022-02-02 12:11:27 +01:00
Simon Hausmann
5226feab01 Rename C++ pre-processor macros 2022-02-02 12:11:27 +01:00
Simon Hausmann
c846633708 Rename C ffi functions 2022-02-02 11:12:34 +01:00
Tobias Hunger
0d358251c9 Janitor: More clippy stuff 2022-01-31 20:59:45 +01:00
Tobias Hunger
cc568a63f5 Janitor: Fix stray @ in patterns 2022-01-31 20:59:45 +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_compiler/generator/cpp.rs (Browse further)