Commit graph

489 commits

Author SHA1 Message Date
Olivier Goffart
1ba4450115 Apply suggestions from code review
Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>
2022-09-07 17:11:57 +02:00
Olivier Goffart
abbf1edd91 Better error message when using the software renderer with a .slint file not compiled for it 2022-09-07 17:11:57 +02:00
Olivier Goffart
8850959a2c Rename the backend feature flags 2022-09-07 17:11:57 +02:00
Olivier Goffart
15fa69ef55 Rename the compat-0-2-0 feature to compat-0.3.0
But keep a compat-0-2-0 fome compatibility anyway
2022-09-07 14:09:07 +02:00
Olivier Goffart
9d0e90c5b1 Test that trailing newline don't add a line 2022-09-07 13:49:02 +02:00
Olivier Goffart
ad80e3e5e2 Fix software renderer line breaker without the unicode feature
This change makes the test pass without the unicode feature.

Note that it is not possible to run the test without the unicode feature
unless one changes the Cargo.toml, so I did that locally to run the
tests
2022-09-07 13:49:02 +02:00
Olivier Goffart
b3605cb4ec Fix errors and warnings in the wasm build 2022-09-07 10:13:58 +02:00
Olivier Goffart
096103b472 Rename EventLoopError::NoEventLoopProvider 2022-09-07 10:13:58 +02:00
Olivier Goffart
6ede77436b api: Return an error from invoke_from_event_loop and quit_event_loop 2022-09-07 10:13:58 +02:00
Tobias Hunger
625546304c Remove software-renderer feature more aggressively
I missed some instances as the CI and @ogoffart both pointed out. Fix
that.

Also make the `text_layout`and `ìnteger-sqrt` features that were set by
the `swrenderer` feature mandatory -- by removing them completely.
2022-09-07 10:11:11 +02:00
Tobias Hunger
d880ef8eb5 api: Remove software-renderer feature 2022-09-07 10:11:11 +02:00
Tobias Hunger
639dcaf702 api: Rename module swrenderer to software_renderer
Also rename the `swrenderer` feature to `software-renderer`.
2022-09-07 10:11:11 +02:00
Olivier Goffart
cebc361b73 Refresh the window when showing a popup "inline"
Commit f715a0c214 change the show_popup
function not to make the window attribute tracker as dirty. This also
had the side effect of redrawing the window before.
But we do need to redraw the window when a popup appear
2022-09-07 09:20:38 +02:00
Olivier Goffart
fd73c906e8 Hide the internal Renderer trait in the docs 2022-09-06 18:30:45 +02:00
Olivier Goffart
4706d529e2 Rename BUFFER_COUNT to MAX_BUFFER_AGE
and remove the default value from the SoftwareRenderer
2022-09-06 18:30:45 +02:00
Simon Hausmann
3649390d85 doc: Remove the mention of euclid in the scale_factor function
We don't depend on euclid anymore in the public API

cc #1502
2022-09-06 16:19:27 +02:00
Simon Hausmann
7967bf1ab0 Replace the internal WindowHandleAccess trait with a helper function on WindowInner
The reversal of ownership removes the need for the glue trait in the
publicly visible API.
2022-09-06 16:17:06 +02:00
Simon Hausmann
ea94089b05 Provide an error enum for the error case of slint::platform::set_platform
cc #1502
2022-09-06 15:42:16 +02:00
Olivier Goffart
24244e3c7c janitor: Rename a variable 2022-09-06 13:43:52 +02:00
ogoffart
05a49da906 Bump version number to 0.3.0 2022-09-06 13:00:22 +02:00
Olivier Goffart
2760d96b79 Make VecModel::remove() return the removed value like Vec
Fixes #1221
2022-09-06 05:42:56 +02:00
Simon Hausmann
90ba9ffa17 Fix "glyph box" in AboutSlint when rendered on MCU
The AboutSlint text has a forced linebreak in it, which becomes a box
glyph on MCUs when the font on the host system doesn't use an empty
glyph but a box glyph for \n.

This patch explicitly excludes glyph clusters from text fragments that
feed into lines that originate from one of the three valid separators:
ascii newline, unicode paragraph and unicode line separators.
2022-09-05 21:42:26 +02:00
Olivier Goffart
f715a0c214 Try to fix the way the window is resized
- We must first set change the constraints before changing the size
   otherwise the new size might not be in the old constraint and the
   change might not take effect.

 - We must update the WindowItem's size even if the size of the window
   doesn't change. This happens when a component is set on a window that
   that doesn't change it size (eg, preview) but for which we need to
   set the geometry on the window
2022-09-05 16:19:27 +02:00
Olivier Goffart
0085145d10 MCU documentation 2022-09-04 18:31:26 +02:00
Olivier Goffart
9a2b1c7b6b Don't export PLATFORM_INSTANCE in the public API
Use a hidden internal helper function instead
2022-09-03 11:45:54 +02:00
Olivier Goffart
ec19ef77f1 platform: don't re-export types that are no longer needed 2022-09-03 11:11:43 +02:00
Simon Hausmann
f648f152f9 Improve debug_log interface in the Platform
Pass Arguments and let the caller decide how/when to convert to a string.
2022-09-02 20:13:41 +02:00
Simon Hausmann
cde6cc2110 Simplify debug_log macro 2022-09-02 20:13:41 +02:00
Simon Hausmann
437218db70 Replace the built-in defmt debug logging to the platform trait
This way we don't have to add defmt, esp32-println and others as features to corelib and the slint api crate
(which would also expose them as public dependencies),
but instead this can be simply delegated to the Platform trait.
2022-09-02 20:13:41 +02:00
Olivier Goffart
3f1324cc61 Allow to run the software backend without the femtovg backend 2022-09-02 16:38:35 +02:00
Simon Hausmann
7e5de3d5d3 Remove use of euclid types and tags for logical/physical position and size in the public API
Instead provide our own types.
2022-09-02 11:05:53 +02:00
Simon Hausmann
85461d380d Remove euclid from the public re-export of the Slint crate 2022-09-02 11:05:53 +02:00
Olivier Goffart
e0f1fdf298 Rgb565Pixel: remove color accessor, add conversion to Rgb8Pixel
Closes #1540

(Went or Rgb8Pixel instead of color, because color can have alpha)
2022-09-01 13:58:38 +02:00
Olivier Goffart
a647fe2d74 Rgb656Pixel: Mask the shifted value to prevent overflow in the addition 2022-09-01 13:58:38 +02:00
Olivier Goffart
1237285fef Fixup some documentaion links
And add a test in the CI that checks for warnings in the internal
crates

(Also changed --exlcude in the test to be matching the one from build,
since c++ test are tested separately)
2022-09-01 12:16:24 +02:00
Olivier Goffart
fcca38e0f6 Rename set_event_loop_quit_on_last_window_closed to remove EventLoopQuitBehavior
For the winit backend, also make the function work after a call to run()
2022-09-01 12:08:05 +02:00
Simon Hausmann
581bd04253 Fix build without std and no additional debug output support
Do nothing then
2022-09-01 09:19:22 +02:00
Simon Hausmann
d57a26276f
Fix typo
Spotted by @BartBM
2022-08-31 21:21:27 +02:00
Simon Hausmann
9338d31535 Remove the use of euclid types from the software renderer public API
Closes #1538
2022-08-31 09:23:38 +02:00
Olivier Goffart
b9c2dec922 API: seal the WindowAdaptor trait
And hide most of its functions in the sealed trait.
2022-08-30 22:21:24 +02:00
Olivier Goffart
383f86712d Fix test for the SoftwareRenderer::render_by_line
was not updated to new api
2022-08-30 22:21:03 +02:00
Tobias Hunger
0daa2513af API cleanup: Rename PointerEvent to WindowEvent
Also rename members and related functions as specified in #1543.

Fixes: #1543
2022-08-30 16:47:55 +02:00
Tobias Hunger
09e685ef51 Fix typos 2022-08-30 08:34:45 +02:00
Tobias Hunger
3430a13bf8 API cleanup: Remove quit behavior parameter from run_event_loop 2022-08-30 08:34:45 +02:00
Olivier Goffart
cb8a59683f Fix formating 2022-08-29 19:45:29 +02:00
Olivier Goffart
9952f7e6b9 impl Deref for the SimpleSoftwareWindow 2022-08-29 19:45:29 +02:00
Olivier Goffart
3ed8ca6fc8 Introduce MinimalSoftwareWindow
This simplifies the implementation of the pico and STM, as they both
have the same PlatformWindow implementation, and is likely to be the
same for every MCU
2022-08-29 19:45:29 +02:00
Simon Hausmann
41affeb68f Fix element rotation when the element is translated
For example

    Image {
        x: 150px;
        y: 50px;
        rotation-angle: 45deg;
    }

will end up rendering as if x and y are zero. This is because during
the injection we "move" x and y to the Rotate
element as bindings, but due to the lack of built-in
x/y properties, dummy properties are materialized
and they are not applied for the regular per-item translation.

Add x/y to the Rotate element and then it works.
2022-08-29 17:52:37 +02:00
Olivier Goffart
396a2c5ecb Implement std::fmt::Write for SharedString and add a format! macro 2022-08-29 17:25:24 +02:00
Tobias Hunger
38350db9a0 Fixes pointed out by Olivier and CI 2022-08-29 16:53:47 +02:00