Commit graph

652 commits

Author SHA1 Message Date
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
Olivier Goffart
5dea1f1d29 compiler: Fix loading relative path to the workdir
This should in principle not be allowed, it should be relative to the
file itself.
Make it a warning, and at least, don't duplicate the globals

Fixes #2719
2023-07-24 18:21:53 +02:00
Olivier Goffart
37f11e566b Better error when using ';' instead of ',' when declaring struct 2023-07-24 12:31:41 +02:00
Florian Blasius
d65c8a1774
Added current-item-changed to StdListView and current-row-change to StdTableView (#3135) 2023-07-23 08:42:28 +02:00
Guiguiprim
ef8ddaaa1d
Add native support for min/max 2023-07-21 16:26:41 +02:00
Florian Blasius
1ecd36d51a
Fixed enabled in fluent ComboBox (#3127)
* Fixed enabled in fluent ComboBox
* Updated changelog
2023-07-21 07:59:36 +02:00
Simon Hausmann
0b760cc7f7 Fix C++ embedded glyphset generation
Declare the correct array length

Amends 917cecff85
2023-07-20 18:17:05 +02:00
Simon Hausmann
3db168d03d C++: Attempt to place embedded into read-only data sections 2023-07-20 16:20:51 +02:00
Simon Hausmann
917cecff85 Add support for embedding bitmap fonts in C++ 2023-07-20 16:20:51 +02:00
Guilhem Vallat
0ebcc2be70 remove clippy warning in rust code gen
This generated a `clippy::clone-on-ref-ptr` warning
2023-07-19 11:04:25 +02:00
Olivier Goffart
d5d772dcbd
Compiler: Visit the model and other "side" named reference in binding_analysis (#3109)
This is necessary for the `is_used` to be set properly

Fixes #3107
2023-07-19 09:53:38 +02:00
Aleš Katona
44fb865ad4
add row-pointer-event callback to tableview (#3082) 2023-07-19 08:34:24 +02:00
Florian Blasius
94ce4ebaee
Fixed text input on fluent and material SpinBox (#3101) 2023-07-18 07:43:37 +00:00
Eric
1b0d3b1061
Add edited callback for SpinBox (#3096)
* add edited callback for SpinBox
* fix compile error
* add inline comment for callback definition
2023-07-18 07:53:54 +02:00
Olivier Goffart
57e9b5b796 Don't panic when an unresolved alias has a binding
Fixes #3085

When there are both a binding and a two way binding, we must keep the
two way binding in our bindings map. Otherwise type inference will not
work
2023-07-14 14:13:48 +02:00
Olivier Goffart
c990660500 Run the import pass even when building the object tree fails.
This improve the code coverage of syntax_text, so some adjustment had to
be made.
This may add more error in the main file, but this make it the same
behavior as for imported files and lsp who were already running these
passes all the time
2023-07-14 14:13:48 +02:00
Simon Hausmann
59d869cb84 Fix missing invocation of init() on Items with C++
In Rust, register_component in the run-time library is called unconditionally and
invokes init(). The window adapter is an optional
parameter.

In C++, we'd call register_component only if we had a window adapter, which meant
that we're missing init calls().

Amends cd9994306e
2023-07-14 13:09:45 +02:00
Olivier Goffart
81e5d3bb36 Fix setting rotation-angle and opacity from a callback
... if they are not set as actual binding before

As reported in #3068

The problem is that the pass will properly create the Rotation or
Opacity item, but will not create the two way binding if there is no
existing binding. This causes code like `img.rotation-angle = ...` to
change the rotation angle of the image, but not its parent Rotation
item.
Fix it by making sure there is always a binding.

Since the change only affect visual representation, I abused one of the
screenshot test to test this feature. And I also patched another bug
that some #[allow(unused_parens)] was not set in the 'init' callback and
would cause a warning in the test
2023-07-11 20:07:49 +02:00
Aurindam Jana
5a4a7fee63
Update royalty free license to 1.1 (#2994) 2023-07-10 10:12:11 +02:00