Commit graph

280 commits

Author SHA1 Message Date
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
Olivier Goffart
d70a304e2b fix slint_debug_property cfg build 2022-02-18 12:24:35 +01:00
Simon Hausmann
e30e18a450 janitor: Bump RazrFalcon's dependencies 2022-02-18 10:46:21 +01:00
Olivier Goffart
992507eadd Fix the inliner thinking property are not modified when they are 2022-02-17 16:25:48 +01:00
Olivier Goffart
a32eee64a7 Count the uses of property, and do not generate properties that are not used 2022-02-17 16:25:48 +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
Olivier Goffart
2fbc23e174 Add an internal doc comment 2022-02-16 18:46:37 +01:00
Olivier Goffart
6f3668324f llr inlining: fix checking of builtin global properties 2022-02-16 18:46:37 +01:00
Olivier Goffart
85e88eb3d6 Silent warning in the generated code.
Inlining may cause global to become unused.
In a perfect world, We should remove the global completely instead, but
that will be for a followup patch
2022-02-16 18:46:37 +01:00
Olivier Goffart
3483ca17a7 LLR: optimization pass to inline property access
When the property access a binding that itself is only accessing one binding
2022-02-16 18:46:37 +01:00
Olivier Goffart
b31b3e112a Mark public properties as set
Since they can be set from the native code

The current code in NamedReference::is_constant and such always check for
expose_in_public_api already, this is now redundent
2022-02-16 18:46:37 +01:00
Olivier Goffart
068a7a51b5 Rust generator: Fix type conversion when creating a Point
Before it used to always be a property access, but now it may be inlined
and result in a f64 or int expression
2022-02-16 18:46:37 +01:00
Olivier Goffart
dc3c91dd9f llr: Fix the type of LayoutCacheAccess
It access the element of the array.
This starts to be important when that expression starts being inlined
in more complex expressions
2022-02-16 18:46:37 +01:00
Olivier Goffart
21546722ad LLr: Add a pretty printer
It's far from complete, but already allow some debugging
2022-02-16 18:46:37 +01:00
Olivier Goffart
9f77e9a2e8 llr: note when a property binding is for a StateInfo 2022-02-16 18:46:37 +01:00
Olivier Goffart
a158c4b527 llr: Add visitors 2022-02-16 18:46:37 +01:00
Olivier Goffart
cc212c9d71 llr: keep property analysis 2022-02-16 18:46:37 +01:00
Olivier Goffart
9e938046ca llr: Add a helper function 2022-02-16 18:46:37 +01:00
Olivier Goffart
76a1bf8d7d LLR: Put the expression into a RefCell so they can be optimized 2022-02-16 18:46:37 +01:00
Simon Hausmann
27a8c33c07 janitor: fix wasm build of the compiler
Seems weird, but the wasm-interpreter needs the compiler lib :)
2022-02-15 16:03:17 +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
Tobias Hunger
c072998719 Let's not hard-code the list of styles 2022-02-15 13:55:50 +01:00
Tobias Hunger
e5582a8a17 Update internal/compiler/typeloader.rs
Co-authored-by: Olivier Goffart <olivier@woboq.com>
2022-02-15 13:55:50 +01:00
Tobias Hunger
da0deb4119 Test style error when creating TypeLoader 2022-02-15 13:55:50 +01:00
Tobias Hunger
98cf796866 Scan for style files in the include directories 2022-02-15 13:55:50 +01:00
Tobias Hunger
0ee0eaf25e Simplify code a bit
... as suggested by @tronical

Co-authored-by: Simon Hausmann <hausmann@gmail.com>
2022-02-15 13:55:50 +01:00
Tobias Hunger
e3908cfce6 Do not continue on errors when creating the TypeLoader 2022-02-15 13:55:50 +01:00
Tobias Hunger
d64dfa500c Error out when selecting unknown styles 2022-02-15 13:55:50 +01:00
Simon Hausmann
29cbb9e181 Change names of identifiers used for accessing embedded resources in the compiler
Instead of using SFPS (Slint_Fast_Packing_System) use SLINT :-)
2022-02-14 16:17:55 +01:00
ogoffart
ecd0fb7ecd Bump version number to 0.2.1 2022-02-10 16:25:28 +01:00
Tobias Hunger
58e7caafb0
Fix LICENSES symlinks 2022-02-09 17:05:47 +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
f0b047057b Fix HighDPI on windows with the rust generator and the native style and qt backend
We must create the window first to initialize the backend before
the style is called because it would initialize qt as a plugin instead
of as a proper application, and it would then not initialize the high dpi mode
2022-02-09 09:47:39 +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
Olivier Goffart
c5a2e96755 Fix opacity on Image in for in layout
Do the default_geometry pass before injecting elements:
The reason is that the defaut_geometry pass must know if an element is in
a layout and what kind of default geometry needs to be applied depending
on its actual structure, not whatever results after we injected elements

We were relying on the default_geometry pass to set the size of elements,
but that doesn't work for elements that are not covering 100% of their
parents by default. So to that manually instead.

Fixes #915
2022-02-07 18:07:09 +01:00
Olivier Goffart
2816a09911 Fix a panic occuring when some layout may still contains reference to optimized item
We need to simplify all the optimized items before the move_declaration pass
This include innter item of repeater that might be used by layouts

But that also means we can now uptimize children of layouts
2022-02-07 18:07:09 +01:00
Simon Hausmann
e5483f2836 Add support for selecting the style via SIXTYFPS_STYLE as fallback
This makes transitioning easier
2022-02-07 17:49:44 +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
Olivier Goffart
e4a41a28b7 llr: Fix accessing members of ArrayIndex expressions
We were not computing the type of a ArrayIndex expression correctly:
It should be the elemtn types of array, not the array itself
2022-02-06 11:26:24 +01:00
Olivier Goffart
0dba666d1f Rust generator: Fix compilation returning from void callbacks
If a callback returning voids ends in a statement that returns something,
we would have an error in the rust generated code as we end our function
with an expression that is not `()`
2022-02-06 10:33:36 +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
Olivier Goffart
54d9ebdc19 Fix documentation warnings about non-existing links 2022-02-04 14:53:23 +01:00
Olivier Goffart
c5ef368a3f Fix LSP semantic coloration bailing out sometimes
Step to reproduce:

```
xx := Window {
   TouchArea {
      clicked => {
         if (true) {}
         // note: because there is no else, the semantic colouring is bailing out now
      }
   }
   TouchArea { clicked => {} }
}
```

This is caused by a bug in rowan::SyntaxToken::next_token that doesn't visit
the next token if it has an empty node

Unfortunately, the LSP has no tests, so I couldn't add one easily
2022-02-04 13:26:30 +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
Tobias Hunger
b4f689c3fb object_tree: Make implementation DRYer
Extract common code applying default property values into a function.
2022-02-04 10:42:25 +01:00
Simon Hausmann
378483037c Bump image and femtovg dependencies 2022-02-04 10:00:00 +01:00
Olivier Goffart
3fdab32d87 Upload a bunch of versions of the logo
Examples will be able to use the logo from their location in `../../../logo/xxx.svg`
Some other things that needs to have the logo in their directory can use symlinks.
But because of the situation of windows, we can't use symlink for things our users
need to build and this is the case for the compiler-internal (because the C++ build
use the code from the repository),  so there is a copy of the 'full' logo in
internal/comoiler/widgets/common
2022-02-03 11:54:05 +01:00