Commit graph

156 commits

Author SHA1 Message Date
Olivier Goffart
22fc82532c cargo fmt 2022-01-12 16:22:35 +01:00
Olivier Goffart
53c3e6a279 WIP: introduce the new llr module (Low Level Representation)
The main thing here is that the Component are in different data structure
depending on whether they are sub-component global component or repeated component

Then the properties at are the right place and there will be no more lookup
in the base. The PropertyReference knows how to access which property via which
element and such.

The idea is that it will be easier to lower from this representation than
what we currently do in each language backend.

This commit is still WIP, it is far from finished
2022-01-12 16:22:35 +01:00
Tobias Hunger
bfca0e3573 Mass update copyright messages to be more REUSE compliant 2021-12-22 10:06:12 +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
0484c7ea4b Rename the env variable
Co-authored-by: Simon Hausmann <simon.hausmann@sixtyfps.io>
2021-11-09 15:32:33 +01:00
Olivier Goffart
61202c6cba Make the inlining decision part of the CompilerConfiguration
This also enable disable inlining by default
2021-11-09 15:32:33 +01:00
Simon Hausmann
9028f69f27 C++ generator cleanup: Remove supplementary_components field again
This amends the parent commit, we don't need a separate vec, after
inlining the sub_components should simply be empty.
2021-10-28 15:52:29 +02:00
Simon Hausmann
b5f4a2c27c C++ generator: begin generating code for supplementary components
The generation is still incomplete, but this change passes them to the C++ generator
when not inlining.

Another option would've been a "inline: bool", but that won't suffice in
the future when we may want to use heuristics to selectively inline some
and others not. And always taking used_types.sub_components is wrong
when inlining as those are ... inlined.
2021-10-28 15:52:29 +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
Simon Hausmann
4a26faef9a Add AboutSixtyFPS element 2021-10-05 23:16:46 +02:00
Olivier Goffart
a094ce7a2a Add a warning on the internal crates documentation that we don't follow semver 2021-08-16 18:26:33 +02:00
Olivier Goffart
f73a369786 cargo fmt 2021-07-07 11:04:50 +02:00
Olivier Goffart
8f75aadc70 Move the passes module to its own file
The main reason is that i don't like to edit files named lib.rs
because there are so many files with the same name
2021-07-07 10:48:28 +02:00
Tobias Hunger
e5bdeaa804 Janitor: Remove unnecessary & 2021-07-07 08:42:28 +02:00
Olivier Goffart
67f0dc280f ptimized unused propery away
Currently, it is a bit limited in the amount of property that it removes
because it will not remove property that are used by properties being
removed, or will consider setting properties as an usage
2021-07-05 15:39:49 +02:00
Olivier Goffart
13bd828b96 Update license date 2021-07-02 15:55:54 +02:00
Olivier Goffart
962dc0075c Layout: Make the default padding and spacing 0
and add Box widgets that have proper defaults

Closes #200
2021-06-21 14:29:53 +02:00
Olivier Goffart
fb214a8246 Make sure that the with and height of the inserted Window are not maked as constant
We need to do the ensure_window pass before the binding_analysis
otherwise the with and height property of the root element
will be considered as constant and will not adapt to the window size.

Unfortunately we can't really test that now because our test system
doesn't really test the Window, but here is a testcase:

```
  MainWindow := Rectangle {
     preferred-width: 400px;
     preferred-height: 400px;
     background: yellow;
     VerticalLayout {
          Rectangle {
              background: red;
              Text { text: root.width / 1px; }
          }
     }
  }
```

(we should see the red rectangle)
2021-06-11 13:22:24 +02:00
Olivier Goffart
6c1aa9bd8f Add a pass to always have the top level as a Window 2021-06-09 11:02:55 +02:00
Olivier Goffart
715d38903f Allow to omit the type of aliases 2021-06-07 10:48:09 +02:00
Olivier Goffart
77b8bb615f Move some code in a new module 2021-06-01 12:50:29 +02:00
Olivier Goffart
1aed36d122 Be sure to propagate the fact that properties are changed for aliases 2021-05-21 10:06:26 +02:00
Olivier Goffart
8f94099a7e Fix reporting of uncalled "max" in imports 2021-05-20 18:11:58 +02:00
Olivier Goffart
a92d1af03c Move the public api check in its own passes
The pass must be done at the begining so that synthetised property don't
become public, and also so that analyses pass can use the public api information
2021-05-20 13:40:51 +02:00
Olivier Goffart
3548c48bff Detect binding loop at compile-time
FIXME: i've currently disabled layout from the detection because it reports
error in our current examples
2021-05-15 15:49:27 +02:00
Olivier Goffart
76a42cd757 Added support for static constant z ordering
Just re-order the children at compile time
2021-05-14 16:17:34 +02:00
Olivier Goffart
e7d7589538 Decent default binding for the materialized constraints 2021-05-11 14:59:57 +02:00
Olivier Goffart
a990e01cd8 Apply the layout restrictions to the parent element 2021-05-11 14:59:57 +02:00
Olivier Goffart
59654472d2 LSP: color providers 2021-04-18 23:27:14 +02:00
Olivier Goffart
59695bb3cf Fix cargo fmt 2021-04-17 09:34:47 +02:00
Olivier Goffart
069b5aa1a1 Refactor lookup
Share some code so we can eaily list all possibilities and we will use that
in the LSP for the completion
2021-04-16 23:41:59 +02:00
Olivier Goffart
ad298a309f WIP: LSP autocompletion of expression 2021-04-16 23:41:59 +02:00
Olivier Goffart
87f4a363cf Add support for opacity property 2021-04-15 15:05:09 +02:00
Simon Hausmann
f7ce1ba8b4 Generate registration code for custom fonts imported in .60 files
This removes the need to manually register fonts. This is initially
applied to the printer demo, but the other demos and removal of the
public manual registration API will come in follow-up commits.
2021-04-14 09:30:32 +02:00
Simon Hausmann
c301cc22b5 Collect foreign imports and filter out true type fonts/collections
Resolve them early enough to produce good diagnostics. Permit true type
fonts & collections.
2021-04-14 09:17:23 +02:00
Olivier Goffart
7a65f31cc1 the source_file is not optional 2021-04-13 17:26:24 +02:00
Olivier Goffart
84501e630a Rename SyntaxNodeWithSourceFile to SyntaxNode
Same for SyntaxToken
2021-04-13 17:10:56 +02:00
Olivier Goffart
80b236489e Add a clip property that can be set to the Rectangle 2021-04-12 18:48:43 +02:00
Olivier Goffart
a712f515fa Make the viewport element of the flickable a real Element in the object_tree 2021-04-09 19:14:48 +02:00
Olivier Goffart
c3ab89dd3e Refactor import opening and its hook
This way the hook is called regardless if the file exist in the import path or not
2021-04-06 12:27:59 +02:00
Olivier Goffart
989e916e8c Move NamedReference to its own module 2021-03-29 13:31:36 +02:00
Simon Hausmann
4a9cd954b8 Rework the Rust entry point API for the interpreter
Switch to the stateful `ComponentCompiler` concept that we discussed for the C++ API.
2021-03-18 18:20:50 +01:00
Simon Hausmann
3391aa0312 Remove the import resolve callback from the compiler configuration
Re-apply commit 2dcbc45cd6 but now do the
resolution from a relative import path to either an absolute path or url
in the compiler itself.
2021-03-16 14:21:33 +01:00
Simon Hausmann
e3a33dffe0 Revert "Remove the import resolve callback from the compiler configuration"
This reverts commit 2dcbc45cd6.

It breaks loading of the printer demo in the editor because in
import_file we fail to return the absolute path and thus end up
importing common.60 too many times.
2021-03-16 11:43:33 +01:00
Simon Hausmann
2dcbc45cd6 Remove the import resolve callback from the compiler configuration
It turns out that this isn't really needed with the current
implementation.
2021-03-15 20:02:46 +01:00
Olivier Goffart
730b1ccff2 Refactor diagnostic: Merge BuildDiagnostic and FileDiagnostic 2021-03-12 19:32:50 +01:00
Olivier Goffart
9eac131ae5 Add the logo in the docs 2021-02-12 08:24:42 +01:00
Olivier Goffart
0174db3679 Delay the percentage size conversion to after the layouting phase
So we can see inthe layouting phase if the size was in percent
2021-02-11 15:08:24 +01:00