Commit graph

1488 commits

Author SHA1 Message Date
n-raine
beda5aca07 Add dark style detection support for GL backend
With the help of dark-light crate this is now exposed as dark-style
boolean property in NativeStyleMetrics.

Co-authored-by: Olivier Goffart <olivier@slint-ui.com>
Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>
2022-03-01 16:41:20 +01:00
Olivier Goffart
9a6c306017 We can now access the global from other globals 2022-02-28 10:14:34 +01:00
Olivier Goffart
0dc188f328 Support for referring to other globals from globals
- We need to make sure that the initialization of global is in the right order.
 - In C++ and rust, we need to add accessor to the global component
 - There can be `PropertyReference::Global` in binding of globals
 - The interpreter globals need to hold references to the global they may depend on

Fixes #175
2022-02-28 10:14:34 +01:00
Simon Hausmann
e15c8f0011 Bump fontdue dependency
After https://github.com/mooman219/fontdue/pull/103 was merged and released with 0.7.1,
we are now back to only one copy of ttf-parser.
2022-02-26 14:36:15 +01:00
Olivier Goffart
55fb9c13aa Mark the y properties of elements within a ListView as "set"
... also for oarent component.

The previous code did not set it as set for the parent components
causing the properties to be marked as const while they shouldn't

Fixes #983
2022-02-25 17:20:09 +01:00
Simon Hausmann
668e02aa83 Fix glyph embedding on Linux
Copy the fontconfig code from the GL backend to find out what the font for "sans-serif" is, in case we need a fallback.
2022-02-23 12:13:10 +01:00
Simon Hausmann
b482105402 Bump femtovg, fontdb, usvg and resvg dependencies
This re-aligns the ttf-parser and rustybuzz dependencies in the GL
backend. There's still one other version of ttf-parser pulled into the
compiler due to fontdue, but that's minor.
2022-02-21 09:10:11 +01:00
Olivier Goffart
ea4f27992e Mark constant properties of parent native type as such 2022-02-18 17:40:17 +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
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