Commit graph

1488 commits

Author SHA1 Message Date
Simon Hausmann
70f3f50359 mcu: Add support for automatic font size detection
Continue to support specififying logical font sizes in the compile step
via SLINT_FONT_SIZES, but additionally look for Text/TextInput/Window elements
and extract any constant font sizes
found.

This makes it work out of the box with the printer demo.
2022-04-08 15:11:26 +02:00
Simon Hausmann
819c058fd6 Add support for multiplication and divison to the constant propagation when only one unit is present 2022-04-08 15:11:26 +02:00
Tobias Hunger
a639cc5acb fluent: Make checkmark in Combobox look slimmer 2022-04-07 13:48:01 +02:00
Tobias Hunger
6795564414 fluent: Make ComboBox dropdown icon thinner
This is closer to the original.
2022-04-07 13:48:01 +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
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
8a036ef293 rust: Generate better indices for the parent node of repeaters
Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>
2022-03-31 14:40:57 +02:00
Olivier Goffart
ad5991f8fa Fix PopupWindow within repeater
* The LLR expect that the popup_window is actually contained in it's parent
   component popup_windows, otherwise the context is not correct.
 * There is no index property for a PopupWindow

Fixes #1113
2022-03-30 16:46:55 +02:00
Olivier Goffart
6622f33327
Fix conversion of struct with array of literals (#1109)
Fixes #944
2022-03-28 14:41:11 +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
Olivier Goffart
cf49568373 Compiler: make the image processing an enum in the config 2022-03-24 13:16:21 +01:00
Olivier Goffart
41b20fdd59 MCU build system: pass information about embedding images and glyph to the compiler
... using metadata from the build script send with the DEP_I_SLINT_BACKEND_MCU

Saves two environment variable that we don't have to pass
2022-03-24 13:16:21 +01:00
Tobias Hunger
24d325a53b Do not eat all keypresses in SpinBox 2022-03-22 18:34:05 +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
Tobias Hunger
0c952ddee7 rust: Simplify item_tree() method by making the tree const 2022-03-21 19:21:57 +01:00
Olivier Goffart
6c7a7aed0e Error out when a PopupWindow is in a if or for
instead of panicking

We need to mve stuff in the parent element and that doesn't work if
it is a repeated element. Also there would not be ways to call show
on it anyway.

Fixes #1079
2022-03-21 12:50:49 +01:00
Tobias Hunger
86a6add32c janitor: Fix typos and make cspell happy 2022-03-18 10:15:44 +01:00
Olivier Goffart
ca5151de11 C++: implement Window::on_close_requested 2022-03-17 14:49:12 +01:00
Olivier Goffart
6653651199 Fixes Listview's element height when the height is specified in the parent sub-component
Fixes #1057
2022-03-17 09:04:32 +01:00
Lukas Jung
8240531e6e move actual-current-item to FocusScope 2022-03-16 08:48:30 +01:00
Lukas Jung
9d18882f9d reset StandardListView's current-item if it is out of bounds 2022-03-16 08:48:30 +01:00
Tobias Hunger
ea684fa4de Add item_tree function to Component VTable 2022-03-14 17:19:31 +01:00
Tobias Hunger
bdc3778cec Rename init/free item functions back 2022-03-14 09:43:50 +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
Tobias Hunger
6681545aca Use item_array in rust 2022-03-14 09:43:50 +01:00
Tobias Hunger
b95342551b Add index into item_array into ItemTreeNode 2022-03-14 09:43:50 +01:00
Simon Hausmann
43759cd1bb Fix elided text rendering on mcu
Commit aee3ffca27 accidentally removed the elision character
2022-03-10 11:43:01 +01:00
Simon Hausmann
aee3ffca27 Add additional glyphs for embedding
Co-authored-by: Olivier Goffart <olivier.goffart@slint-ui.com>
2022-03-10 10:51:32 +01:00
Simon Hausmann
abca5bed78 Include elision character in bitmap glyphs 2022-03-10 10:51:32 +01:00
Simon Hausmann
f5a34b3df0 Add colon to the list of hard-coded glyphs to cover 2022-03-10 10:51:32 +01:00
ogoffart
7b50791db4 Bump version number to 0.2.2 2022-03-10 08:48:33 +00:00
Olivier Goffart
8bf47a2b74 Properly compute the binding priority in case of several level of inlining
The problem is that if some bindings are coming from already inlined elements
they should have a higher priority field, so that whenmerging the two way
binding, we keep the least deep value

Fixes: #1026
2022-03-09 17:43:28 +01:00
Olivier Goffart
7d6c1f375a Properly error out when element type are used within composite types
Fix #1021
2022-03-09 09:22:27 +01:00
Olivier Goffart
a0c914c43e Mark aliases as used (and potentially overwritten) by derived component
Fix #1009
2022-03-04 11:50:06 +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
Simon Hausmann
f1dae75d53 Fix interpreter ffi build
Commit 738ac0dc01 increased the size of the ImageInner::StaticTextures variant,
which breaks the size assertions in the interpreter ffi build.

This changes fixes that by reducing the size of the ImageInner variant again by
moving all the fields into a separate struct.
2022-03-03 14:04:45 +01:00
Simon Hausmann
738ac0dc01 mcu: scale images at compile time (#966)
Apply a scale factor to reduce the size of embedded images at compile
time.
2022-03-03 13:28:47 +01:00
Olivier Goffart
c9319add6a Export the input-type from the LineEdit 2022-03-02 21:55:49 +01:00
Lukas Jung
c15b0e1486 Add focus and keyboard control to native/qt spinbox 2022-03-02 17:51:31 +01:00
Lukas Jung
103b069dde implement keyboard control for fluent widget 2022-03-02 17:51:31 +01:00
Jared Moulton
b884a4ca19 Fix CI issues, remove references to replace-char, add a test, fix creation of string 2022-03-02 15:47:32 +01:00
Jared Moulton
fdbc8056b3 Add an option to draw *'s instead of characters for password fields 2022-03-02 15:47:32 +01:00
Simon Hausmann
19a3b67ac2 Use the new dark-style property to select about logo 2022-03-01 16:41:20 +01:00