Commit graph

422 commits

Author SHA1 Message Date
Simon Hausmann
6748563dc6 Fix non-wrapped text with multiple break opportunities 2022-03-10 10:51:32 +01:00
Simon Hausmann
62d633a572 Add convenience function for measuring paragraph sizes 2022-03-10 10:51:32 +01:00
Simon Hausmann
72186cd891 Make the available width an option 2022-03-10 10:51:32 +01:00
Simon Hausmann
1a73460a6a Add basic text layout module for use with the MCU
This is based on the unicode line breaking algorithm (uses crate for
that), which also supports forced line breaks. The shaping is generic,
so on the MCU side we can do without at first.
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
bc38d31bcb Save one property dependency when accessing dirty model 2022-03-07 19:06:23 +01:00
Olivier Goffart
24237377cf Don't register dependencies when computing the dirty geometry 2022-03-07 19:06:23 +01:00
Olivier Goffart
2fd4b4ccfb Print what property was marked as constant when we assert because of modifying non-const 2022-03-04 11:11:40 +01:00
Olivier Goffart
3703c862a0 Fix BorrowMutError panic
Introduced in commit b2caa75

Fixes #1010
2022-03-04 09:16:57 +01:00
Olivier Goffart
b2caa757e7 Partial renderer: Initial work 2022-03-03 14:58:48 +01:00
Olivier Goffart
b6ef333444 Rendering: put the clipping an a function in the ItemRenderer trait
This will allow partial updates
2022-03-03 14:58:48 +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
Lukas Jung
c15b0e1486 Add focus and keyboard control to native/qt spinbox 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
5493b30d4d Bump strum dependency 2022-02-28 08:53:00 +01:00
Tobias Hunger
f3feab1267
Implement ptr_eq for VWeak and PartialEq for Items (#976)
* Implement ptr_eq for VWeaks

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>
2022-02-21 17:45:18 +01:00
Tobias Hunger
6795d3ee00
Introduce a FocusEventResult enum (#975) 2022-02-21 17:43:41 +01:00
Simon Hausmann
ae2ee04c33 Make it possible to run unit tests in corelib standalone
We need to enable the compat-0-2-0 feature of the slint crate.
2022-02-21 16:30:15 +01:00
Olivier Goffart
c941946f49 Debug: make sure that more properties have debug_name
The global properties, and base properties were not named

This adds a Property::new_named regardless if debug is enabled or not
2022-02-18 17:40:17 +01:00
Simon Hausmann
f912ec7e6b Fix scaling of glyphs and improve type safety in the MCU backend
The code was mixing logical and physical sizes, causing glyphs being
doubly scaled down. Instead, this patch introduces:

 * Physical* and Logical* euclid length/size/rect aliases
 * some extraction traits for getting the scalars in rects/sizes as lengths (until euclid has them
built-in)
 * wrapper traits/types for safely extracting the physical font metrics the
 compiler generates (i16)
 * Fix a bug in the text height calculation where we failed to take the
   descent into account
2022-02-17 15:07:57 +01:00
Tobias Hunger
7210ea5448
Fix doc strings
Use singular form when refering to one child only.
2022-02-17 13:06:00 +01:00
Tobias Hunger
f5ad73969f
Quieten some clippy warnings. 2022-02-17 09:36:16 +01:00
Simon Hausmann
07da5c1c36 janitor: Fix license headers 2022-02-15 15:55:41 +01:00
Simon Hausmann
304e06f758 Begin rasterizing glyphs for glyph embedding
Enable with `SLINT_EMBED_GLYPHS=1` and select sizes like
`SLINT_FONT_SIZES=12,16`

This change just puts the data structures in place, rasterizes a fixed
subset, embeds that into the rust generated code and calls a backend
function for registering the font that is unimplemented.
2022-02-15 15:52:24 +01:00
Olivier Goffart
f9fd523583 Update internal/core/items.rs
Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>
2022-02-15 12:02:27 +01:00
Olivier Goffart
efd6c63b8e Fix animation in the flickable
This is a regression since the introduciton of iteration_count which defaults
to 0 for animation started programatically

Also add a test.

Fix #951
2022-02-15 12:02:27 +01:00
Olivier Goffart
7a7a21ca54 Fix build with no_std 2022-02-14 16:21:31 +01:00
ogoffart
ecd0fb7ecd Bump version number to 0.2.1 2022-02-10 16:25:28 +01:00
Olivier Goffart
40d8cbf130 Don't put the version for local dev-dependency
Otherwise we can't upload them to crate.io
2022-02-10 08:20:54 +01:00
Tobias Hunger
58e7caafb0
Fix LICENSES symlinks 2022-02-09 17:05:47 +01:00
Olivier Goffart
3d209287c2 Docs: add a note that only exported global from the main file are exposed 2022-02-09 14:49:20 +01:00
Tobias Hunger
4230ac2572
Update copyright information to reflect name change
Also run resue over the codebase and fix complaints from that tool.
2022-02-09 10:27:47 +01:00
Olivier Goffart
753784c331
C++: drops IntSize in favor of Size<T> (#922)
Fixes #909

Since we declare the struct in C++, we don't need to declare it in
rust for cbindgen anymore, as long as we expose the Size2D type from
euclid to the cbindgen_private namespace
2022-02-08 14:12:52 +01:00
Simon Hausmann
034804d2e5 janitor: Fix doc link to slint::Window
For the RenderingState we can't use the same trick as the same doc is also used for C++ :-(
2022-02-08 10:24:05 +01:00
Olivier Goffart
1425ef63de Change the Url from sixtyfps.io to slint-ui.com
Also, change the URL of the logo in the docs
2022-02-08 08:52:46 +01:00
Olivier Goffart
00ff5e21a7 Update git repository URL 2022-02-08 08:26:21 +01:00
Olivier Goffart
91e107150e Merge remote-tracking branch 'origin/wip/rename'
Conflicts:
	examples/opengl_underlay/index.html
	examples/opengl_underlay/main.cpp
2022-02-08 07:29:41 +01:00
Simon Hausmann
2d14da2a43 Fix GL example not updating on Windows
The winit event loop needs a similar Poll nudge as for wasm in order for request_redraw() to work :-(
2022-02-07 17:49:11 +01:00
Tobias Hunger
ca469048c6 Replace cat picture used in examples
* Use a jpg over an png, which is much smaller
* Do not round the image
* Change the image file extensions used in the demos to reflect the
  actual image format being used
* Do not use symlinks for images: This breaks the WASM demos
2022-02-07 15:29:13 +01:00
Tobias Hunger
de4e195280
Rename internal crates and add a README.md to them
The README.md contains the warning that used to be in lib.rs.

Add README.md files to all internal crates

... pointing to the official public crate to use instead.

Rename internal crates

fixup: README files

fixup rename
2022-02-07 13:12:48 +01:00
Simon Hausmann
0b6beb081b Minor fixup to the C++ rendering notifier API
Add the graphics state enum to the callback, too. When we add support for different backends,
it would be nice if it didn't require an API change.

 It's duplicated from Rust
because it doesn't provide values. The WebLG one doesn't make sense for C++ and
the proc address closure isn't ffi safe.

(It could be manually bridged thought)
2022-02-07 08:50:09 +01:00
Olivier Goffart
4115af88bd Fixup previous merge 2022-02-04 17:43:15 +01:00
Simon Hausmann
125b90a64b Merge remote-tracking branch 'origin/master' into wip/rename
Conflicts:
	api/cpp/cbindgen.rs
	api/cpp/include/slint.h
	examples/CMakeLists.txt
	examples/imagefilter/Cargo.toml
	examples/plotter/main.rs
	internal/backends/mcu/lib.rs
2022-02-04 16:47:20 +01:00
Simon Hausmann
18bba6ede4 Add sixtyfps::Window::request_redraw()
This allows scheduling a redraw of a Window explicitly. Unfortunately it
comes with a winit caveat :(
2022-02-04 15:41:53 +01:00
Simon Hausmann
8959eac3d0 Add rendering callbacks to sixtyfps::Window
This API allows specifying a callback that will be invoked when setting
up graphics (great for compiling shaders), before rendering a frame (but
after the clearning of the surface background), after rendering a frame
(before swapbuffers) and when releasing graphics resources.
2022-02-04 15:41:53 +01:00
Olivier Goffart
54d9ebdc19 Fix documentation warnings about non-existing links 2022-02-04 14:53:23 +01:00
Tobias Hunger
b348d1af44 PropertyAnimation: Make iteration-count: n run animations n times
Side-effect: The code handles invalid inputs to duration/delay better.
2022-02-04 10:42:25 +01:00