Commit graph

214 commits

Author SHA1 Message Date
Olivier Goffart
f27a2b8c74 Fix issues related to alias to globals
two problems
 - For the interpreter, properly handle the case of an alias to a global
 - For the rust generator, we can't return a reference to a property held
   in a global, so we must 'inline' the get_xx funciton on sub-components
2021-12-06 14:30:47 +01:00
Olivier Goffart
464ba195a8 Don't use deprecated API 2021-12-06 13:00:32 +01:00
Olivier Goffart
d1cae710df preprocess the images at compile time
For the MCU port, we need to proccess the image to save them in the binary
in a convenient format.
This patch start this work by trying to anaylyze what format should an image
be using, and saving it as a texture in the binary.

The current graphical backend and the C++ frontend are not yet supported
2021-11-19 15:54:45 +01:00
Olivier Goffart
dd3fa1c221 Make the BindingMap hold RefCell of the BindingExpression
This will allow later to be able to operate on the binding despite the
element is borrowed.

Since the Binding itself is in a RefCell, the analysis don't need to
be anymore.
To do this change, a small change in the binding_analysis logic was required
which means that we will now detect binding loop if a binding was causing
two binding loop. (before, only one binding loop was detected)
2021-11-11 11:14:59 +01:00
Simon Hausmann
13de800ba3 Internal cleanup: Rename layouting_info to layout_info
That's making the call on the Component VTable consistent(ish) with the Item VTable.
2021-11-08 10:24:30 +01:00
Olivier Goffart
567c644a5f Fix PopupWindow position when all elements are not inlined
Pass a reference to the parent item in the show_popup function
so we can compute the exact location at runtime.
2021-10-28 15:52:29 +02:00
Simon Hausmann
8596cca549 Fix model length tracking in the interpreter
Added the missing tracking call and fix the test to cover this properly.
2021-10-20 15:25:28 +02:00
James Blacklock
745abe7019 handle array length in eval.rs 2021-10-18 10:21:06 +02:00
Simon Hausmann
88ad176008 Improve diagnostics when images cannot be located for embedding
This is a two-stage change, that first centralizes the file I/O code
path for on-disk and builtin:/ files. Secondly the resource embedding
pass now produces diagnostics if a file cannot be located.
2021-10-05 23:16:46 +02:00
Simon Hausmann
4b267a8e9b Internal cleanup: Simplify string handling when accessing compiler-embedded files
For loading images that are included in the widget library that's included in turn
in the compiler binary, we need to create ImageInner::EmbeddedData
with &'static data and &'static file extension. The latter was
created using string interning, but we can also access the path of the
widget library data structure.
2021-10-05 23:16:46 +02:00
Simon Hausmann
332b149610 Add support for accessing resources from the embedded widget library in the interpreter 2021-10-05 23:16:46 +02:00
Olivier Goffart
730cbf1ef9 Interpreter: add type checking for declared properties
issue #512
2021-09-23 19:17:17 +02:00
Olivier Goffart
00cc8ec693 Add invoke_global_callback to the interpreter API 2021-08-27 13:36:48 +02:00
Olivier Goffart
a1803ec3a0 Interpreter: return a proper error from set_property instead of panic 2021-08-27 13:36:48 +02:00
Olivier Goffart
5f8cea5926 WIP interpreter API to access globals 2021-08-27 13:36:48 +02:00
Olivier Goffart
d5f4a796ad Fix interpreter panics when calling callback that weren't set 2021-08-24 11:37:47 +02:00
Olivier Goffart
b42c187ed1 Refactor the way the two-ways biding are represented internaly
Don't put them in a fake expression.
This simplifies a bit the expression handling, and will make
possible to fix analysis that needs a vew into the aliases
2021-08-20 18:26:36 +02:00
Tobias Hunger
d50dcf77f5 Janitor: Fix clippy::from_iter_instead_of_collect 2021-08-09 13:19:34 +02:00
Olivier Goffart
1dab4c35d9 For embedded data, store the extension in the binary
This is usefull for the detection of SVG
2021-08-03 16:15:31 +02:00
Simon Hausmann
29f5853332 Provide sixtyfps::Window by reference in the Rust API
This also removes Clone from the Window again, to avoid having to face
the question: Does cloning a window duplicate it on the screen?
2021-08-03 10:32:04 +02:00
Olivier Goffart
ba32777cab Refactoring: move the animation in the PropertyBinding struct
Since they always belong together.

This will help for issue #193
2021-07-23 15:25:53 +02:00
Tobias Hunger
9539a53480 Janitor: Fix clippy::redundant_clone 2021-07-23 13:48:52 +02:00
Tobias Hunger
f02ab4d8c3 Janitor: Remove some unnecessary & 2021-07-21 19:44:57 +02:00
Tobias Hunger
a8b2aa2f2d Janitor: Fix cspell complaining about toint 2021-07-21 19:44:57 +02:00
Tobias Hunger
56fea6e6c3 Janitor: Fix clippy::many_single_char_names 2021-07-21 19:44:57 +02:00
Simon Hausmann
1c285694d7 internal cleanup: Remove the use of ComponentWindow in the interpreter 2021-07-21 17:41:12 +02:00
Simon Hausmann
ef184f7f1a internal cleanup: Remove the rest of the ComponentWindow API
Now it just remains a wrapper around the Rc, and it can soon be moved to
the API crate hopefully.
2021-07-21 17:41:12 +02:00
Simon Hausmann
77ea5b7a15 API cleanup: hide the rest of the ComponentWindow "internals" 2021-07-21 17:41:12 +02:00
Olivier Goffart
cc8249212d Fix name conflict when having two global with the same name in different files
Give globals an unique id so two global with the same name imported
from different file don't clash

Fixes #159
2021-07-13 14:36:38 +02:00
Simon Hausmann
c40f3a57ee Add support for debug() in .60 logging to console.log in the online editor
In non-wasm builds debug_log! sends to eprintln!, so there should be no
change. For wasm debug_log! hoever goes to the console.
2021-07-09 11:08:23 +02:00
Olivier Goffart
13bd828b96 Update license date 2021-07-02 15:55:54 +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
Olivier Goffart
99c140ae08 Allow accessing the width and height of the image in .60
Closes #208
2021-06-21 11:22:50 +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
d758102f26 Make the orientation a static parameter to BuiltinFunction::ImplicitLayoutInfo 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
2483425d57 Add abs() 2021-06-11 14:17:47 +02:00
Olivier Goffart
522e78915f Fix the tests 2021-06-07 20:40:36 +02:00
Olivier Goffart
ce34ff87d0 Finish support for callback aliases
cc #111
2021-06-07 20:40:36 +02:00
Olivier Goffart
3ddc3c6ce5 Don't re-use Type::Void for inferred type
Make it explicit that it is inferred, and differentiate callback and property
2021-06-07 20:40:36 +02:00
Olivier Goffart
0598b3f095 The debug() function can now take several args, and debug more types 2021-06-01 14:10:25 +02:00
Olivier Goffart
0b3fecf300 WIP: API to expose image loading from C++ and Rust 2021-05-28 17:05:16 +02:00
Olivier Goffart
edfa6319b2 Fix alias to globals with the interpreter 2021-05-21 16:03:57 +02:00
Olivier Goffart
896336c5c6 interpreter: Make GlobalComponent actual dynamic component
Will be required to fix the bug setting two way binding to global
poprerties
2021-05-21 15:25:56 +02:00
Olivier Goffart
91b43017ad Fix build 2021-05-20 18:28:52 +02:00
Olivier Goffart
a1880bd943 Report an error when trying to convert from logical to physical coordinate in a global 2021-05-20 18:11:58 +02:00
Olivier Goffart
385844b6e5 Interpreter: make debug(...) go the the stderr instead of stdout
stdout breaks the LSP

Fixes #225
2021-05-17 12:56:33 +02:00
Olivier Goffart
a990e01cd8 Apply the layout restrictions to the parent element 2021-05-11 14:59:57 +02:00
Olivier Goffart
81473c2541 Remove implicit_size from the Item vtable
Use the preferred size in the layouting_info instead.
2021-05-11 14:59:57 +02:00