Commit graph

1937 commits

Author SHA1 Message Date
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
65c2a1075e Janitor: find(X).is_some() == any(X) 2021-07-03 22:34:53 +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
Simon Hausmann
8dc6ee6fb1 Fix font fallback list on macOS with default family
Even with an empty font family we should produce a font fallback list, and we can.
Fixes the missing checkmark (when not affected by clipping).
2021-06-30 15:46:30 +02:00
Olivier Goffart
6ffe456fd8 Qt backend: use QChar::LineSeparator to split lines in a QTextLayout
That's better than re-layouting with setNumColumns
2021-06-30 13:33:19 +02:00
Olivier Goffart
5bbd4b1afb Qt backend Text elision with word-wrap 2021-06-30 13:33:19 +02:00
Olivier Goffart
bc8bc616ed GL backend: elide Text also when word-wrapping
In this case, the last line will have elipsis on the last line
when no more line can be printed

Note that the behavior is different with the Qt backend
2021-06-30 13:33:19 +02:00
Simon Hausmann
a0e827e200 Work around black window with vmware/glutin/windows10
Glutin's desire to default to srgb mysteriously creates a black window
on Windows 10 under Vmware. I tested this with many glutin apps and examples,
they all exhibit the same: black window,
working when query for srgb is turned off.

This used to work, so I suspect some change underneath on the vmware svga
driver perhaps, or Windows.
2021-06-29 22:53:48 +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
53ef31f0c1 Fix wrong text rendering with popups in the interpreter and the GL backend
The interpreter created an intermediate window for the component but
the regular parent window is used for rendering. This resulted in the situation
where the layout computation was done before rendering with the intermediate window,
the text layout was calculated and cached in the Text's cached rendering data.
That in turn is just an index into the window's rendering cache (arena),
which is also later used for rendering. The index is local to the window, so
during layout the index was assigned for the intermediate window and
when rendering it seemed valid and happened to also refer to a Text item in the
cache of the real window, but with the wrong size/data.

Fixes #278
2021-06-29 11:27:33 +02:00
Simon Hausmann
6ae940433e Fix typo
Installing that code spell checker is distracting :)
2021-06-29 10:23:45 +02:00
Olivier Goffart
a58daa31c9 Fix popup size 2021-06-29 09:30:07 +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
Simon Hausmann
61d533812d Bump femtovg and ttf_parser version
They are now in sync with the latest due to a new rustybuzz release
2021-06-28 11:08:06 +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
4b12ed03cf Janitor: Fix typo in local function name
No behavior change is intended!
2021-06-28 08:32:00 +02:00
Tobias Hunger
c482cd7a29 Janitor: Fix typo in local function name
No behavior change is intended!
2021-06-28 08:32:00 +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
Tobias Hunger
68259162c8 Janitor: Fix typo in local variable name
No behavior change is intended here.
2021-06-28 08:32:00 +02:00
Olivier Goffart
6ed58fb041 Testing backend: don't panic on popup close 2021-06-23 15:25:29 +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
Simon Hausmann
55d4a4f79e Bump femtovg to a released version 2021-06-22 18:06:43 +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
Simon Hausmann
59425b3f02 C++: Docs for sixtyfps::interpreter::Diagnostic and DiagnosticLevel 2021-06-22 08:34:33 +02:00
Simon Hausmann
f377b5db6c C++: Document sixtyfps::interpreter::Value::Type 2021-06-21 15:50:58 +02:00
Simon Hausmann
f7ff3ba0db C++: Document PropertyDescriptor 2021-06-21 15:50:58 +02:00
Simon Hausmann
596912a521 Fix panic in preview.html when loading images
Binding expressions may end up calling sixtyfps::Image:size(), which
requires a graphics backend to be set.

The wasm interpreter code path circumvents the
sixtyfps_corelib::backend::instance_or_init call and went straight to
the GL backend, so we need an extra call to ensure its creation.
2021-06-21 15:09:01 +02:00
Olivier Goffart
d0923bd82f Height for width for Image in layout 2021-06-21 12:24:36 +02:00
Olivier Goffart
99c140ae08 Allow accessing the width and height of the image in .60
Closes #208
2021-06-21 11:22:50 +02:00
Simon Hausmann
930412d3bb Fix size of default constructed sixtyfps::Image with GL backend
An empty image should have a zero (empty) size, like it does with the
testing and Qt backend.

The datastructures test in the CI revealed this.
2021-06-20 11:18:28 +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
a97bcd5ae1 Use BTreeMap unstead of HashMap to store the bindings
Because the order is important to keep deterministic error and output
2021-06-18 21:47:00 +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