Commit graph

505 commits

Author SHA1 Message Date
Simon Hausmann
0eab14139e Add convenience implementations of From for ModelRc from slices and arrays
Fixes #2787
2023-06-06 14:38:52 +02:00
Simon Hausmann
1bf05eae7c
Add support for absolute-x and absolute-y properties on any element (#2823)
Fixes #1691
2023-06-06 14:37:53 +02:00
Olivier Goffart
7d69d9b5b6 C++: Move the interpreter ComponentCompiler on the heap
It is too fragile otherwise
2023-06-05 16:34:59 +02:00
Olivier Goffart
ce25fb65a6 Pass the translation domain to the runtime
For rust, it uses the crate name, for others, it needs to be passed in
the comment line
2023-06-05 16:34:59 +02:00
Olivier Goffart
a3855f1bcb WIP: add a formatting function that works in the interpreter 2023-06-05 16:34:59 +02:00
Olivier Goffart
dcd8450dfa WIP: start working on translations: @tr()
This commit just do the parsing of the @tr macro.
2023-06-05 16:34:59 +02:00
Amirhossein Akhlaghpour
3a4f3c61d5
Add @rust-attr on scturct (#2785)
Fixes: #2660
2023-06-05 16:29:55 +02:00
Simon Hausmann
0f54b9599b Add support for manually closing PopupWindows
This patch adds a `close()` function that can be called to close a popup
window, and a `close-to-click` boolean that can be set to false to
disable the default behavior.
2023-06-02 18:07:49 +02:00
Olivier Goffart
5599bd44e0 Remove Color::opaque
It is not a right name and i don't think it is a so common operation
2023-06-02 17:02:08 +02:00
Olivier Goffart
4845241ebf Rename translucent to transparentize and mixed to mix 2023-06-02 17:02:08 +02:00
Arthur Araruna
64ad1ce357 Add some color and brush manipulation funcs (#2565)
The added functions enable mixing colors and manipulating the opacity
of colors and brushes.

They enable the behavior of some of the available functions from SASS and are
added for future use for adding the Adwaita style (future PR).
2023-06-02 17:02:08 +02:00
Simon Hausmann
c428601370
Add support for select-all(), cut(), copy() and paste() functions on text input elements (#2804)
In the compiler this is still very primitive, but an attempt to start a
generic interface. The basic assumption is that all item functions will
eventually need access to the window adapter and itemrc. Support for
additional arguments is still missing.

Also missing is support for the function access via rtti in the
interpreter, hence the hardcoding at the moment.
2023-06-01 16:04:53 +02:00
Olivier Goffart
864e23aa5f Fix panic n the interpreter when using an easing as a property
Closes #2666

Thanks to @colelawrence for the initial patch
2023-05-16 15:25:26 +02:00
Simon Hausmann
e0bcfff0ab Fix doctests
Don't run them with the winit backend, and that'll try to create an
event loop in a thread.
2023-05-11 10:42:09 +02:00
Simon Hausmann
7df902b53c winit: Create a winit window at renderer creation time
This simplifies the logic for how to apply window related requests as
they can be applied to the winit window immediately.

It also simplifies the state handling in the WinitWindowAdapter, as
there's no more distinction between mapped and unmapped. We always map
now (winit does).

One related change in core is that the window properties are now sent to
the backend before calling show(), instead of after.
2023-05-11 10:42:09 +02:00
Simon Hausmann
481288d489 Initial support for rendering with Skia and Vulkan
Closes #1546
2023-05-09 08:58:35 +02:00
Simon Hausmann
098a078008 Make it possible for the window adapter creation to fail
The creation of the renderer might fail, for example if we tried to
create an OpenGL renderer on a display that doesn't support OpenGL. We
should catch that in the future and fall back to the software renderer.
2023-04-27 17:37:36 +02:00
Tobias Hunger
43aae1de1c Interpreter: Include the id := in Elements
Include the "id :=" part when highlighting an Element. This places the
cursor at the 'i' now.

Done-with: @ogoffart
2023-04-26 20:49:12 +02:00
Tobias Hunger
9448e98d8a Interpreter: Extract element range finding 2023-04-26 20:49:12 +02:00
ogoffart
dfd5fc38b3 Bump version number to 1.0.3 2023-04-26 14:04:08 +00:00
Tobias Hunger
1c9430489f Interpreter: Turn off highlighting when switching to/from design mode
... and do not add highlights based on cursor position in a document
while in design mode.
2023-04-26 14:50:40 +02:00
ogoffart
53cce5bf44 Bump version number to 1.0.2 2023-04-26 11:33:16 +02:00
Tobias Hunger
18253b5150 LSP: Use crosshair cursor in design mode 2023-04-24 16:44:49 +02:00
Simon Hausmann
6c8fa5f215
Fix duplicated loading/embedding of images (#2612)
For .slint files that are included, we canonicalize the path before
adding it into the import stack, to avoid duplicates. We didn't do that
for images in the global_embedded_resources.

Ensure this by canonicalizing as early as possible.

Fixes #2608
2023-04-21 13:15:22 +02:00
Olivier Goffart
d5d71626c0
Docs: document that the renderer-winit-* feature must be used with winit features
Closes #2506
2023-04-20 11:29:50 +02:00
Tobias Hunger
982277db2a Interpreter: Pick better start item in design mode
Only start at the current item if that contains the clicked position.

This leads to the first click always going for a sensible leaf-most
item.
2023-04-19 16:49:02 +02:00
Tobias Hunger
1b9d0a577d Interpreter: Make item selection in design mode more robust
We need to check whether we wrapped around in the main part of the
logic: find_next can be called repeatedly in one walk of a tree, so it
fails if there are two or more items that are all sorted out later.
2023-04-19 16:49:02 +02:00
Tobias Hunger
893983e8d3
Slintpad: Add picker mode where you can click on something in the preview and the editor focuses on that (#2567)
* compiler: Make mapping from source offset to line/column more reusable
* compiler: Improve mapping of offset to line/column
* Fix unit tests after line mapping update
* interpreter: Add code to have a element picker mode
* slintpad: Add picker mode to the preview
* slintpad: Do not try to highlight "empty" highlight requests
* Slintpad: Cycle through all the possible elements in design mode
* Slintpad: Ignore builtins and eat less clicks
* Slintpad: Highlight the element selected in design mode
* Slintpad: Do not use static mut variable in design mode
* slintpad: Rename `set_current_element_information_callback`
* Interpreter: Do not use unsafe in design mode code

Done with: @ogoffart and @tronical
2023-04-18 23:11:08 +02:00
ogoffart
bd63218412 Bump version number to 1.0.1 2023-04-18 14:56:40 +00:00
Simon Hausmann
2cb0b2233a Attempt at making the C/C++ ABI more robust
Add explicit enum values for repr(C) enums that have attributes like
cfg, so that even if there's a cfg gap in an enum (say cfg(feature =
"svg")) it won't break the ABI.

See also 004dce6c0b
2023-04-14 14:57:47 +02:00
Olivier Goffart
a57c7eb6bc Added TextInputInterface.text-input-focused 2023-04-12 14:49:08 +02:00
Olivier Goffart
fd3f974d7e Don't use old syntax in docs 2023-04-06 17:06:46 +02:00
Simon Hausmann
8ffb5131c7
Introduce error handling in the FemtoVG and Skia renderers (#2402)
Avoid unwrap() and expect() and instead propagate errors all the way
down to run_event_loop(), show(), and hide() in the Slint AIP.
2023-03-24 14:18:11 +01:00
Olivier Goffart
4cf44ea69d Mark StandardListViewItem and TableColumn as #[non_exhaustive]
Closes #2330
2023-03-18 09:04:48 +01:00
Tobias Hunger
3ac01c3f07 clippy: Fix clippy warnings 2023-03-09 09:35:29 +01:00
Simon Hausmann
1d82c179d1 Fix panic when invoking unused callback aliases with the interpreter
Don't try to install a callback handler that captures an invalid
expression. The llr pass has an invalid expression guard, and so does
the rest of this handle_property_bindings_init callback.

Fixes #2319
2023-03-02 19:02:25 +01:00
Olivier Goffart
f231522f7e Change the homepage URL in the Rust API's Cargo.toml 2023-02-20 08:52:38 +01:00
Olivier Goffart
8450e01a3f
Change the name of the compat feature (#2230)
And remove the compat-0-2-0 and compat-0-3-0 features
2023-02-16 09:40:44 +01:00
Olivier Goffart
e57627d535 Use the new syntax in more tests
That are failing otherwise as there would be a warning
2023-02-14 12:38:39 +01:00
Olivier Goffart
6889dfa5f5 Rust: Make new(), run() and show() report errors from the backend
Fixes #2198
2023-02-10 05:00:03 +01:00
ogoffart
e7f48512ee Bump version number to 1.0.0 2023-02-03 11:07:15 +01:00
Simon Hausmann
8c807cb1da
Remove slint::Image::stride() (#2147)
cc #2138
2023-01-30 13:59:31 +01:00
Olivier Goffart
a0fb8bc771 Remove support of old SIXTYFPS_ env variable, and sixtyfps_widgets.60 2023-01-26 13:36:38 +01:00
Olivier Goffart
a3ec320bfb Remove some deprecated stuff
CC #2024
2023-01-26 11:19:21 +01:00
Olivier Goffart
a0fdf94fb1 StandardTableView: Remove the editable feature for now
This commit can be reverted when we want to introduce it again.
There is a few bugs with the editable property:
 - The text is not in sync with the model if the model changes after an
   edit. (can be seen by making an edit and then sort)
 - The highlight of the current row doesn't work properly
 - We should probably only edit on double click or some shortcut instead
   of just clicking
 - The editable field exist but does nothing for the StandardListView
2023-01-24 07:31:29 +01:00
Olivier Goffart
66b848227b StandardTableView resizable columns 2023-01-23 16:26:49 +01:00
Simon Hausmann
24dcef5fed
First stage of cleaning up the export handling of the slint root component (#2095)
We implicitly export the last component of a .slint file to the generator.
Issue a warning when that happens and suggest to export it explicitly.
2023-01-23 15:19:49 +01:00
Simon Hausmann
629c7ed80e Remove undocumented and dysfunctional PathLayout
This type is poorly implemented and not documented. Let's remove it for now.
It shall remain available in the git history in the event of a resurrection.
2023-01-21 13:10:19 +01:00
Simon Hausmann
96c80a2dd1
Fix crash when using an int model in a repeater with a negative value (#2063)
Make sure that we return an unsigned for row_count() in C++ and Rust by ensuring an unsigned int model at creation time.

For the interpreter this "worked" by chance as casting a negative floating
number to usize automatically caps at zero, and all values are stored as f64. For safety this patch
applies the same fix though, to be on the safe side.
2023-01-14 21:20:14 +01:00
Florian Blasius
f2aab576f4
Add StandardTableView widget (#2032)
* Text only StandardTableView with column and rows
* Text editing of cells
* Sort by column ascending and descending
* Variants of the TableView for native, fluent and material
2023-01-12 19:41:12 +01:00