Commit graph

670 commits

Author SHA1 Message Date
Guilhem Vallat
aada8bb485 include geometries in Element debug print 2023-09-13 16:08:37 +02:00
Guilhem Vallat
5cf1a45e41 Remove duplicated geometry properties from items 2023-09-13 16:08:37 +02:00
Olivier Goffart
2b44ed47a2 Fix PopupWindow positioning
The WindowItem did not have a x or y before, so these property
were unused for it's geometry(), but now it is used in the new
item_geometry on the ComponentVTable.
So make sure we don't initialize them
2023-09-13 16:08:37 +02:00
Olivier Goffart
31252547e0 Fix generation of geometry prop for some primitives 2023-09-13 16:08:37 +02:00
Olivier Goffart
e04835d209 Fix computation of the item sub range
We need to account for the repeater count in the item sub-range
2023-09-13 16:08:37 +02:00
Olivier Goffart
e0fd9a6105 WIP: Add item_geometry to the ComponentVTable
(unused yet)
2023-09-13 16:08:37 +02:00
Olivier Goffart
2a8ebb9752 Flickable: don't make the viewport special
Instead: add the viewport propety directly in the Flickable

Simplifies the compiler's code generation a bit
2023-09-13 16:08:37 +02:00
Simon Hausmann
3652f58a3f Change item indices from usize to u32
So that the compiler and run-time can never disagree on the
number of bytes the item index can use.
2023-09-12 08:53:58 +02:00
Aurindam Jana
e01e9685be
Update Slint logo folder with new design (#3432)
This PR updates the logos and branding guideline of Slint to match the new website design. The new logos are a 1:1 replacement of the old logos except for the circular logo. In the new logo design, there isn't a separate circular logo, as the square logo with circular crop can be used. Further, the logo folder also contains logos in CMYK for use in printed materials. The PMS is just the color value in the naming and can be used where Pantome colors are required. The README has been updated to explain which logos to use when as well as the Slint "blue" color.
2023-09-11 16:41:06 +02:00
J-P Nurmi
8284674d4d VSCode: add "Remove element" code action 2023-09-08 16:38:16 +02:00
Thorbjørn Lindeijer
74b37df4db
Optimize StandardTableView in Fluent, Material and Native styles (#3425)
* Optimize StandardTableView in Fluent and Material styles

By using a ListView instead of a ScrollView + VerticalLayout, we trigger
the optimization where only visible children are being instantiated.

For the Fluent style, this was making the rows more compact, so I've
added additional padding to the TableViewCell to compensate. I don't
know where the padding used to come from.

I didn't touch Cupertino style since it's currently work-in-progress.
This optimization can be done there as well.

For the Native style, this optimization isn't as straight-forward
because it uses a NativeScrollView + Flickable directly rather than a
the ScrollView.

* Optimize StandardTableView for Native style

Using the ListView makes it possible to only instantiate the visible
items, which makes the StandardTableView a lot faster for larger models
(already very noticeably in the gallery example).

When using a ListView, StandardTableView lost access to the
NativeScrollView.native-padding-top/left properties, which are now
exposed through the ScrollView item.

It could also no longer position the Flickable below the header (or in
doing so, would take the scrollbar along with it), so a property was
added to ScrollView for that purpose as well.

* Introduced InternalScrollView

This avoids exposing additional properties on the ScrollView for just
the native style.

* Fix missing default values for Native style ScrollView

Added minimum size, preferred size and stretch factors (they were not
present before introducing InternalScrollView either, but are added now
for consistency with the other styles).
2023-09-08 08:23:03 +02:00
Olivier Goffart
f73c1cf80d Compiler: fix conversion from unnamed to named struct
Fixes #2765
2023-09-07 14:57:05 +02:00
Olivier Goffart
cf19749943
Make a pass to remove the Expression::Return instruction
So it doesn't appear in the LLR and the C++ codegen can be simplified.
In particular, this removes the need to throw/catch exception to handle return
across generated lambdas
2023-09-06 14:10:26 +02:00
tronical
b8b9db4e42 Bump version number to 1.3.0 2023-09-05 15:46:36 +02:00
Olivier Goffart
dac5016771 Warn when using a Path with the software renderer
CC: #2026
2023-08-31 12:37:48 +02:00
Olivier Goffart
4920224be0
Rename Slider::vertical to Slider::orientation 2023-08-30 13:43:59 +02:00
Olivier Goffart
f8e731ab70 Fix material ComboBox height in layout
It specified a height: 100% which set the layout info to have a
`min_percent: 100.0` which bubbles on other layout.
Arguably that's a bug in layouts but this 100% shouldn't be there.
CC: #3346
2023-08-25 09:57:06 +02:00
Olivier Goffart
ff3ca79258
Software renderer: fix the rendering of svg with transparency
resvg renders the svg with premultiplied alpha. So we need to take that
into account when pre-rendering images
2023-08-24 09:39:07 +02:00
Simon Hausmann
21d44e3a31 Fix data section placement for pre-compiled textures in C++
Place pre-rendered textures into read-only data, instead of the data
section.

Amends 3db168d03d
2023-08-23 18:57:40 +02:00
Olivier Goffart
0345c9bc48 Debug: use pretty-print to dump the LLR
the Debug trait for the LLR isn't that usefull
2023-08-22 16:20:13 +02:00
Olivier Goffart
f100ee48ff Fix alias to externaly modified property not being marked as such
In the case of bug #3318, the implicit alias to the window's height or
width was removed but the propery was not marked as externaly modified,
causing later pass to optimize and inline things that shouldn't

Fixes #3318
2023-08-22 16:20:13 +02:00
Olivier Goffart
7994579c1e Fix Material Slider appearence
regression since 4b9fb89332
2023-08-22 09:21:41 +02:00
Simon Hausmann
e683a6338a Make inclusion of various C++ header files optional
Only include iostream, cmath, and cstdlib if needed.
2023-08-21 17:56:50 +02:00
Simon Hausmann
8d0a73c1d4 C++: Add iostream to the list of included header files
When using debug() we generate calls to `std::cout`.
2023-08-21 17:56:50 +02:00
Florian Blasius
80407d0375
Added cupertino style for std-widgets (#3301)
* Started with cupertino style
2023-08-21 11:04:18 +02:00
Simon Hausmann
96d7bb132c reuse: remove glob for markdown files
Instead, place the copyright and license right into the source.

To satisfy reuse, this also removes the unnecessary MIT.txt
symlinks.
2023-08-17 08:55:28 +02:00
Tobias Hunger
09d3eaf00a Update license symlinks
run `cargo xtask check_reuse_compliance --fix-symlinks`
2023-08-16 11:46:15 +02:00
Eric
4b9fb89332
add property for slider to support vertical orientation (#3236) 2023-08-16 09:58:50 +02:00
Olivier Goffart
8b73d8ce05 Dep updates 2023-08-15 15:43:59 +02:00
Olivier Goffart
a310fdc912 Fix panic when parsing invalid gradiant
Fixes #3241
2023-08-09 21:20:54 +02:00
darknight
37488f015d Refactoring: define macro rules to group builtin structs
apply new macro for struct declaration, type register,
doc generation, cpp header generation, struct-value conversion.
2023-08-03 11:01:18 +02:00
Olivier Goffart
ad389aa4eb linuxkms: Implement keyboard input and clamp mouse
Unfortunately, this is currently not mapped to the right keyboard layout

Also keep the mouse clamped in the visible area.
And make it start in the middle of the screen.
2023-07-31 17:27:53 +02:00
Simon Hausmann
ad84114bae Fix build of generated C++ code with older macOS versions
Avoid the use of std::optional<T>::value.

Amends 0ba6ef1c24
2023-07-31 14:37:45 +02:00
Simon Hausmann
7ff7c2f875 Fix let-else formatting
Nightly now supports it and thus `cargo +nightly fmt` yields a
difference.
2023-07-28 13:43:21 +02:00
Tobias Hunger
b55cdb9cf4 Make ComponentContainer a compiler configuration feature
Require `SLINT_EXPERIMENTAL_FEATURES` to be set in the environment to
enable `ComponentContainer` and `component-factory`.
2023-07-27 12:04:16 +02:00
Tobias Hunger
baa4eb1ea3 Get rid of the window when building an embedded component
... now that we can get the WindowAdapter from the parent component when
we embed it.
2023-07-27 12:04:16 +02:00
Tobias Hunger
a362b7a1ae Add window_adapter to ComponentVTable
Make it duplicate as `maybe_window_adapter` with a boolean `do_create`
parameter.
2023-07-27 12:04:16 +02:00
Tobias Hunger
de96455dda No more panic when the interpreter runs into an ComponentContainer
... in one of the components it manages.
2023-07-27 12:04:16 +02:00
Tobias Hunger
9de515b768 Implement embedding in rust 2023-07-27 12:04:16 +02:00
Tobias Hunger
5db78b6dd2 Implement LLR code lowering for ComponentContainer 2023-07-27 12:04:16 +02:00
Tobias Hunger
d47d52bf52 ItemVTable::init(...): Take an ItemRc so that the itan can know where in the Item Tree it is located 2023-07-27 12:04:16 +02:00
Tobias Hunger
74ef877f70 Add embed_component to ComponentVTable 2023-07-27 12:04:16 +02:00
Tobias Hunger
689238a3af Lower ComponentContainer into two objects
... so that we have one that controls the embedding operation and one
that we can turn into a dynamic tree node where the actual embedding
happens.

Mark the placeholder Element as `is_component_placeholder` and make sure to not
optimize out that object in a later pass.

Adapt Element creation to account for the new
`is_component_placeholder`.
2023-07-27 12:04:16 +02:00
Tobias Hunger
eb84994e7a Add lower_component_container pass
Do some diagnostics in that pass.
2023-07-27 12:04:16 +02:00
Tobias Hunger
05e9ce078a Add a simplistic ComponentContainer element
It just registers the type, nothing more.
2023-07-27 12:04:16 +02:00
Tobias Hunger
2840886d28 Add component-factory type to Slint language
Add a type "component-factory" to the Slint language.
2023-07-27 12:04:16 +02:00
Florian Blasius
297b55dbdd
Added item-pointer-event to StdListView (#3165) 2023-07-26 14:43:55 +02:00
Olivier Goffart
bde0ae7585 Compiler: Fix access_item_rc in the generator for complex path
Fixes #3148
2023-07-26 13:45:20 +02:00
ogoffart
aebaa7d6c9 Bump version number to 1.2.0 2023-07-25 10:44:53 +00:00
Olivier Goffart
f1f5a86d0d Fix calling the open_import_fallback for non existing files
(Note: This code path is not run for wasm because dounce::canonicalize
is not used there, but it was used for the test)
2023-07-24 18:21:53 +02:00