Commit graph

177 commits

Author SHA1 Message Date
Simon Hausmann
4a74f6d0a3 Implement releasing graphics resources in Rust via Drop
Further enhances #12
2020-08-14 13:44:53 +02:00
Simon Hausmann
b96b627a4f Release graphics resources of items when destroying components
This is only implemented for Rust at the moment.
2020-08-13 13:31:29 +02:00
Simon Hausmann
d3a474af26 Move corelib::Component and friends back into their dedicated component module 2020-08-12 11:39:07 +02:00
Simon Hausmann
b21aa4f9e7 Rename PropertyListenerScope to PropertyTracker 2020-08-12 11:31:33 +02:00
Simon Hausmann
0df86d7eeb Move corelib::abi::datastructures::Component to corelib 2020-08-12 10:53:03 +02:00
Olivier Goffart
f4cce26d51 Test the mouse click 2020-08-10 12:54:29 +02:00
Olivier Goffart
36243ccdf7 Traverse item front to back for input events 2020-08-10 10:45:02 +02:00
Olivier Goffart
0a56912d0f Mouse grab in rust 2020-08-07 16:06:49 +02:00
Olivier Goffart
5aa7ee86fe Use a newtype for VisitChildrenResult instead of just isize
Makes the code easier to unserstand
2020-08-07 16:06:49 +02:00
Olivier Goffart
55ec533c40 WIP input events
Compile and passes tests. But the mouse event are currently not working
2020-08-07 16:06:49 +02:00
Simon Hausmann
5b9c41b76b Add referenced image resources to the dependencies for the rust build 2020-08-07 13:35:44 +02:00
Simon Hausmann
3ad7a55038 Split corelib::abi::signals into corelib::signals and corelib::signals:ffi 2020-08-04 08:24:04 +02:00
Olivier Goffart
da11b33e9b Version check
Compilation error when the compiler and the runtime are not on the same version
2020-08-03 18:44:36 +02:00
Simon Hausmann
37f874a26b Rename test_ellapse_time to mock_elapsed_time 2020-08-03 17:52:42 +02:00
Simon Hausmann
f2166d91a6 Move tests out of abi 2020-08-03 17:48:17 +02:00
Simon Hausmann
0252d2ac34 Move slice out of abi 2020-08-03 17:41:16 +02:00
Simon Hausmann
9b13b363c3 Move corelib::abi::properties to corelib::properties
And the bits that are only there for the C binding are now in an ffi sub-module.
2020-08-03 17:32:28 +02:00
Simon Hausmann
a662d36dc3 Move ItemTreeNode from datastructures into item_tree 2020-08-03 14:38:08 +02:00
Simon Hausmann
76adda0abd Move ComponentWindow and friends from datastructures into eventloop 2020-08-03 14:26:47 +02:00
Simon Hausmann
45b02e9a3e Move the item visitor bits from datastructures into item_tree 2020-08-03 14:10:32 +02:00
Simon Hausmann
97a2fb2c7b Move datastructures::EasingCurve into animations 2020-08-03 13:49:20 +02:00
Simon Hausmann
30d7a0b36d Move PathData and friends from datastructure to
graphics
2020-08-03 13:43:44 +02:00
Simon Hausmann
b05a11945e Move datastructures::LayoutInfo into layout 2020-08-03 13:31:43 +02:00
Simon Hausmann
fa87363dc5 Move Point, Rect and Size into graphics
And move the expanded structures for cbindgen into an ffi sub-module.
2020-08-03 13:24:39 +02:00
Simon Hausmann
69beab5957 Rename corelib::abi::primitives to corelib::items 2020-08-03 10:32:03 +02:00
Simon Hausmann
6c5d423cd4 Rename sixtyfps_corelib to sixtyfps-corelib 2020-08-03 10:01:58 +02:00
Olivier Goffart
2e74fa43cd Use pin-weak from crates.io 2020-08-03 09:18:04 +02:00
Olivier Goffart
75671c18e7 Rename weak-pin crate to pin-weak 2020-07-31 18:18:12 +02:00
Simon Hausmann
884af3c88f Implement support for nested layouts in the Rust generator 2020-07-30 19:41:29 +02:00
Olivier Goffart
b57f3775c9 Refactor GridLayout 2020-07-28 10:31:05 +02:00
Simon Hausmann
09cae799d3 Fix return type of compile_syntax_node
All call sites are only interested in the root component, so might
as well return that.
2020-07-28 09:21:32 +02:00
Olivier Goffart
05c5f7c53d Test and fix animations on properties
The animation should not start when the property is initialized, only when the
property is set by the setter
2020-07-23 11:45:34 +02:00
Simon Hausmann
a9b0d84a72 Improve source file propagation
Instead of doing the SyntaxNodeWithSourceFile construction as late as
possible (in Document::from_node), we can do it as early as possible.
That'll reduce the chances of missing out the source file and prepares
for dependency loading just based on a SNWS :)

This also makes the source_file optional in the SNWS, but that's
consistent with what the diagnostics expect.
2020-07-22 16:10:02 +02:00
Simon Hausmann
31223c4b96 Store the path in the diagnostics as Rc
This string (path) will be shared a lot more often in the future.
2020-07-20 15:35:43 +02:00
Simon Hausmann
a178b9b2e3 Add support for include paths to the procedural macro
Using a #[include_path="../path"] attribute. Not quite perfect, but it works :-)
2020-07-17 17:44:32 +02:00
Olivier Goffart
6c54dfb67d Layout the item in a PathLayout if they are part of a repeater 2020-07-17 15:00:12 +02:00
Olivier Goffart
0feec40a31 Add a quick and dirty code indenter so the generated code has several lines
This helps to debug error messages
2020-07-17 15:00:12 +02:00
Simon Hausmann
893b5132c8 Further encapsulate Diagnostics
Use has_error() and a new convenience function to get the diagnostics as a string vector.
2020-07-17 11:52:29 +02:00
Simon Hausmann
732a56259f Simplify compilation call sites further
Move run_passes into the library compilation function. That way the
FileDiagnostics are created by the parser, can be passed on to the library
compilation function and after that we don't need them anymore and can
replace them with future BuildDiagnostics for example.
2020-07-16 18:53:59 +02:00
Simon Hausmann
4c1e4c4da4 Reduce direct access to CompilerDiagnostic::message
Instead use to_string(), to make it easier to change in the future.
2020-07-16 18:22:23 +02:00
Olivier Goffart
170564ecea Implement % as a unit 2020-07-16 11:24:46 +02:00
Simon Hausmann
c3aae7648a Further simplify compilation call sites
Remove the need to construct the type registry at all the call sites by
offering a compile_syntax_node function in the compiler library.
2020-07-16 09:25:26 +02:00
Simon Hausmann
64a4e749b7 Simplify path setup in the Diagnostics
Pass the path to the parse function, as that's easier at most call sites.
Also offer a convenience parse_file function.
2020-07-15 19:21:25 +02:00
Simon Hausmann
8e047d3761 Simplify compiler diagnostics API
Don't require the callers to hold on to the source code string until an
eventual diagnostics code path is hit. Instead it turns out it's
simpler to let the parser consume the source code as string, where
internally after tokenizing it can be moved into the diagnostics and
from there into the code map if needed.

There are a few places where we now clone the source code, but that's
only in cases where we also extract stuff separately (test code) or the
syntax updater.
2020-07-15 17:34:11 +02:00
Simon Hausmann
5b43962bb2 Split up TypeRegistry
For a .60 files the locally defined components are now stored in a separate
per-document TypeRegistry instance that falls back to the global registry
for lookups.
2020-07-15 13:09:43 +02:00
Olivier Goffart
e00491811b Get rid of the context in properties/signal 2020-07-13 18:49:06 +02:00
Olivier Goffart
ab7ae9f3e2 Some refactoring of the rust generated code
Always use a Pin<Rc> for the component. (This is required to support repeater
within repeater as well anyway)
Do not use the context within the binding. We can get along by simply capturing
a weak pointer to the component
2020-07-13 16:37:54 +02:00
Simon Hausmann
4b75ec0ee8 Lay out items on a path
This works, but it's still missing support for positioning of the layout
itself.
2020-07-09 15:32:47 +02:00
Simon Hausmann
9a73443e14 Allow for path elements to contain bindings 2020-07-07 14:14:17 +02:00
Olivier Goffart
1cbd522a03 Rust: make non-constant model and if expression work 2020-07-03 14:04:23 +02:00