Olivier Goffart
e4bd6bbfb8
Native style: respond to the StyleChange event
...
So that color scheme is updated when switching to the dark style, for example
Fixes #687
2021-11-29 17:18:23 +01:00
Simon Hausmann
4779c97ba2
Internal cleanup: Keep globals related data together
...
In ComponentDescription only keep a exported_globals_by_name that
maintains the index in the compiled_globals vector and in there store
the public properties of global singletons.
2021-09-15 07:56:28 +02:00
Simon Hausmann
a855d868fc
Add support for introspecting globals in the interpreter Rust API
...
Add three straight-forward functions:
* pub fn globals(&self) -> impl Iterator<Item = String> + '_
* pub fn global_properties( &self,
global_name: &str,
) -> Option<impl Iterator<Item = (String, ValueType)> + '_>
* pub fn global_callbacks(&self, global_name: &str
) -> Option<impl Iterator<Item = String> + '_>
Implementation wise this requires passing along a way to get the
non-normalized (original) export name, as globals() should return the
names as the developer/designer specified them, and
global_properties()/global_callbacks() normalizes.
2021-09-15 07:56:28 +02:00
Simon Hausmann
ee8e5699e5
Clean up global alias handling
...
Remove the internal name again and pick the first exported one when
assigning ids. This avoids internal names showing up in code completion
or the internal types leaking into generated code.
2021-08-31 17:09:11 +02:00
Simon Hausmann
0d19e2d9b9
Add support for global aliases
...
When exporting an global multiple times under different names, make sure
that they alias in the generated code.
As a consequence, the compiler maintains the original unique name and in
Rust and C++ makes only the exported names public. In the interpreter
the internal name is theoretically still accessible from the outside.
2021-08-31 17:09:11 +02:00
Olivier Goffart
a294ab4200
Interpreter: add set_global_callback
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
b07d52cd23
Support aliases to callbacks in globals
2021-08-24 12:36:16 +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
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
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
a071738a4a
Fix initialization order of globals
2021-05-20 13:40:51 +02:00
Olivier Goffart
21a80f4562
WIP: Layout refactoring
...
Instead of using a solve_layout function in the component, use property to hold
a layout cache.
This commit only implement the GridLayout and only the interpreter part
2021-05-11 14:59:57 +02:00
Olivier Goffart
7ae850d564
Rename Type::Length -> Type::PhysicalLength
2021-04-21 17:15:19 +02:00
Olivier Goffart
862f65c151
Fix panic in the interpreter when accessing uninitialized global
...
As the type of the Value wouldn't match the expected type
Fixes #173
(Also added a way to test the interpreter by making the interpreter
make sure the property "test", if it exists, is true)
2021-04-19 11:41:36 +02:00
Simon Hausmann
8372d3f6d8
Rename call_*
to invoke_*
for callbacks
...
Fixes #187
2021-03-15 17:01:05 +01:00
Simon Hausmann
9034bd3d1a
Move the refined eval::Value
API to api::Value
...
This is the new public value representation for the interpreter
2021-03-15 15:12:34 +01:00
Olivier Goffart
7584b571ea
Interpreter: refactor in preparation to expose a public API
2021-03-10 09:08:25 +01:00
Simon Hausmann
2f3c280ebe
Fix cargo fmt --check
...
Not sure what happened but I guess the new release made it stricter
2021-02-18 13:45:42 +01:00
Olivier Goffart
5a21f1bd81
Rename emit_ to call_ for callback
...
Signal was renamed to Callback, but one does not emit a callback, one calls it
2021-01-25 15:59:10 +01:00
Olivier Goffart
16f5a03c14
Run cargo fmt
2020-12-18 10:29:15 +01:00
Olivier Goffart
0d2d48be4f
Rename "signal" to "callback"
2020-12-18 09:51:01 +01:00
Olivier Goffart
e73bbbcd10
More work on signal returning value
2020-12-01 18:47:49 +01:00
Olivier Goffart
a82c23fc41
Add ability for the native style to export native Globals
2020-11-02 16:13:04 +01:00
Olivier Goffart
1479bc956e
Support for global in the interpreter
2020-10-29 11:01:04 +01:00