Commit graph

1059 commits

Author SHA1 Message Date
Tobias Hunger
3f5ad42683 Janitor: Fix typo in comment 2021-07-08 06:47:05 +02:00
Tobias Hunger
e5bdeaa804 Janitor: Remove unnecessary & 2021-07-07 08:42:28 +02:00
Tobias Hunger
23708a4a12 Janitor: Disable clippy error about f32 comparison 2021-07-06 22:54:05 +02:00
Tobias Hunger
4d712b3f4f Janitor: Clippy suggests to collapse these ifs 2021-07-06 22:34:21 +02:00
Tobias Hunger
9b929b287d Janitor: slice.iter().cloned().collect::<Vec<T>>() == slice.to_vec() 2021-07-05 09:48:29 +02:00
Tobias Hunger
8b3eda8a49 Janitor: Remove some useless 'static that clippy does not like 2021-07-05 09:48:29 +02:00
Tobias Hunger
96c792d7fc Janitor: self: &Self is not canonical. Use &self instead 2021-07-05 09:48:29 +02:00
Tobias Hunger
c56e20233b Janitor: Fix clippy error about a loop that never loops
This code abuses a loop for flow control. Split this out into a separate
function instead, using a custom enum to transfer the information back.

This is necessary since we need to transfer ownership of the
mouse_input_state back to the caller.

This change should not cause a behavior change.
2021-07-05 09:44:41 +02:00
Tobias Hunger
0aea249f1a Janitor: Fix spelling in docs and rename local variables 2021-07-03 18:22:01 +02:00
Tobias Hunger
39984b27db Janitor: Fix spelling in comments 2021-07-03 15:49:43 +02:00
Tobias Hunger
f762f6dab2 Sub_Assign should probably subtract, not add 2021-07-02 23:18:14 +02:00
Olivier Goffart
13bd828b96 Update license date 2021-07-02 15:55:54 +02:00
Olivier Goffart
9faf16ebe1 GridLayout: fix layout with rowspan and colspan
One should not simply distribute the maximum and minimum sizes amongst
the spans, one should make sure that each coinstraints is respected
2021-07-02 12:30:07 +02:00
Simon Hausmann
035dfc3d1f A few harmless spelling fixes 2021-06-30 22:14:10 +02:00
Olivier Goffart
032a158615 GridLayout and span: ensure that the preferred size is properly distributed 2021-06-29 14:54:47 +02:00
Simon Hausmann
504bad7109 Drive-by typo fixes 2021-06-29 14:32:02 +02:00
Olivier Goffart
a4b9c0ced5 Old printer demo: fix the layout
Also, make sure empty cell in a GridLayout stretches
2021-06-29 12:33:01 +02:00
Simon Hausmann
6ae940433e Fix typo
Installing that code spell checker is distracting :)
2021-06-29 10:23:45 +02:00
Olivier Goffart
ae114cf79d C++: don't re-export private symbol in the public API
Use the cbindgen_private namespace dirrectly from the generated code
2021-06-28 12:03:49 +02:00
Olivier Goffart
98cec35080 Increase version numbers 2021-06-28 10:39:43 +02:00
Tobias Hunger
13d7f5e7bd Janitor: Fix typos in comments and user-facing strings
Also adapt tests for error messages containing the fixed strings.

No behavior change is intended!
2021-06-28 08:32:25 +02:00
Tobias Hunger
87460c4ac8 Janitor: Fix typo in struct field name
No behavior change is intended here!
2021-06-28 08:32:00 +02:00
Olivier Goffart
be8c890bec Close the popup when reloading the component
Fix panic when reloading the interpreter when a popup is shown

Fixes #210
2021-06-23 13:32:46 +02:00
Olivier Goffart
32e59cf040 Fix division by 0 when layouting empty images 2021-06-22 14:27:01 +02:00
Olivier Goffart
dcbbd0cd7d Update dependencies 2021-06-22 11:15:20 +02:00
Olivier Goffart
d0923bd82f Height for width for Image in layout 2021-06-21 12:24:36 +02:00
Simon Hausmann
85474f7670 Add support for sixtyfps::Image::size() in C++
Also added a unit test for the C++ implementation.
2021-06-20 11:18:28 +02:00
Simon Hausmann
0fdb87cc69 Add Image::size()
This requires the image size query to be window independent and go
through the backend instead.

This implies minor changes for the Qt backend and bigger ones for the GL
backend:

* There exists now a thread-local IMAGE_CACHE, which is used by the
  backend's image_size() function as well as by the renderer for
  loading CPU side images.
* The image remain as decoded images in there (including SVG tree)
  and the window now has a texture_cache, which holds CachedImage
  with ImageData::Texture.
* Rendering an image item therefore fetches the CPU side image,
  calls upload_to_gpu() on it, which creates a new Rc<CachedImage>
  and that's stored in the texture_cache.
* The texture cache continues to be pruned when hiding the window.
2021-06-20 11:18:28 +02:00
Olivier Goffart
aed0e9849a Remove debug output 2021-06-18 20:31:33 +02:00
Olivier Goffart
4e0a91c35a Test for Flickable layout and small layout fix
Test for issue #194 which was already fixed.
And also fix a small other issue where the preferred size was not properly
computed in layouts.

Closes #194
2021-06-18 14:27:01 +02:00
Simon Hausmann
6734c369c8 Fix internal docs of image_size() function
All implementations of the function return the actual source size in
pixels, disregarding the window scale factor. The function is called in
Image's layout_info() to return the image size as preferred size. Since
the logical length is the default length, there's no need to do any
scaling anyway.
2021-06-18 14:21:02 +02:00
Olivier Goffart
a0bea36e43 Fix preferred size of the Window with a layout
A few problem:
 - the horizontal and vertical property were swapped
 - The implementation of the "preferred_xxx" property was not materialized properly
   because the `bindings` were borrowed in the materialize_fake_properties pass
 - Since the Window has a stretch factor of 0., the preferred size of the inner layout
   was not taken into account when merging the LayoutInfo.  I believe taking the
   maximum preferred size is the right solution when merging them.
2021-06-18 13:51:25 +02:00
Olivier Goffart
51d532d209 Fix grid layout tests
One must make sure the initial preferred size is clamped within the
max and min size
2021-06-18 11:37:58 +02:00
Olivier Goffart
ef84923285 Get rid of the stretch dependency
Since we split the horizontal and vertical part, the stretch dependency is a bit overkill
and we can re-implement it ourselves.

This will also allow us to support colspan and rowspan properly
2021-06-18 10:28:43 +02:00
Olivier Goffart
a95ed99c4e Layout: properly propagate the preferred size 2021-06-17 11:23:58 +02:00
Olivier Goffart
c1a144c282 Layout height for width for the Text 2021-06-17 11:23:58 +02:00
Olivier Goffart
ce37cd2552 Rename a function to avoid confusion with a field 2021-06-16 15:14:07 +02:00
Olivier Goffart
deaa0fddb0 WIP layout: split vertical and horizontal cache
Split the vertical and horizontal pass into different property cache
This will allow to implement "height for with"

This patch does not port the Rust or C++ binding yet
2021-06-16 15:14:07 +02:00
Olivier Goffart
ee00c9eb92 Rename maximum- and minimum- properties to max- and min-
Issue #259
2021-06-14 10:28:30 +02:00
Olivier Goffart
0d09f69fb9 Upgrade lyon_path version since the PR in lyon_path was merged.
This should help for #253
2021-06-06 09:37:32 +02:00
Olivier Goffart
e7b75a2f2d ListView: Attempt to be a bit better as filling the element
Be sure to always instentiate at least enought element.
This is a problem if the items don't have the same height.

This only covers Rust and the interpreter
(The C++ code logic for the Listview currently instentiate all elements anyway)

Should help for issue #228
2021-06-01 17:27:09 +02:00
Simon Hausmann
3c0cf6390d Fix loop handling of animations on bindings
For regularly animated values, the loop count was always applied. For animations
triggered through bindings, the iteration count wasn't reset when the
animation restarted and therefore it looked like the loop count was only
applied once.

Fixes #250
2021-06-01 15:49:14 +02:00
Olivier Goffart
ea0abe3031 Fix a few UB found by miri
An empty vector is not a `SharedVectorInner<T>`, it is a `SharedVectorInner<()>`
And so it is UB to take a reference of a `SharedVectorInner<T>` for the empty vector
2021-06-01 11:52:43 +02:00
Simon Hausmann
538f1e5624 Fix min_size.width calculation with word-wrap is enabled
Apply Olivier's suggestion

Co-authored-by: Olivier Goffart <ogoffart@sixtyfps.io>
2021-06-01 10:52:26 +02:00
Simon Hausmann
5cad61bcd0 Fix disappearing text in vertical layouts with word-wrap and alignment
When a Text element has wrapping enabled, it should not have zero
minimum size. Otherwise the layout will give it a height of zero in the
layout in the test case and that'll make the text disappear. There are
different options but this patch goes for minimum height as if no
wrapping was enabled (so at least one line plus forced line breaks).

Fixes #246
2021-06-01 10:52:26 +02:00
Simon Hausmann
4a13bba32a Clean up GL resource handling
Make sure that we have a current GL context before deleting textures or other GL resources
2021-06-01 08:29:39 +02:00
Olivier Goffart
b5b715651d More replacement from ptr::read to drop_in_place
Should fix the asserts in C++.
2021-05-31 21:25:41 +02:00
Olivier Goffart
dc1cf645db Interpreter: Fix crash when dropping
the ptr::read will move the object in memory, which is not
allowed for our items which contains Pin'ed property.
2021-05-31 18:48:03 +02:00
Olivier Goffart
56a2225238 Make explicit that a the PropertyTracker need to be Pin
Even if it is a private function, it need to be pined as it register pointers
2021-05-31 18:48:03 +02:00
Olivier Goffart
142a8dc185 Rename ImageReference to ImageInner and make Immage.0 private 2021-05-28 17:05:16 +02:00