Commit graph

165 commits

Author SHA1 Message Date
Olivier Goffart
f3f18259ae Some items default size is the parent size
Fixes #122
2020-12-02 18:36:23 +01:00
Olivier Goffart
57cf4e0988 Use transitions in the printer demo for the color level 2020-11-20 12:40:09 +01:00
Olivier Goffart
fd45f575d7 Some improvement of the main screen of the printer demo
Apply some of the hints from the reddit thread

 - make sure the icons are centered
 - make sure the spacing and padding of the main buttons are the same
 - make the color slightly lighter
 - align the title ind controls in the top bar
2020-11-16 17:23:56 +01:00
Simon Hausmann
94ed0ae1d1 Fix printer speed
Enable the turbo mode by default!
2020-11-11 15:10:07 +01:00
Simon Hausmann
9d9f5f5462 Simplify the settings page a bit
Use horizontal and vertical layouts to reduce the amount of nesting.
The resolution slider is a bit wider now, but that one needs a bit of extra work anyway :)
2020-11-11 15:10:07 +01:00
Simon Hausmann
1c787d2cb3 Use font-size instead of font_size 2020-11-11 09:38:01 +01:00
Simon Hausmann
c85aa9a758 Use dashed properties for text alignment 2020-11-11 09:35:09 +01:00
Olivier Goffart
5b4a974c72 Split each page of the printer demo in its own file 2020-11-02 21:39:14 +01:00
Simon Hausmann
a2ae00ee92 Begin splitting up the printer demo into multiple files 2020-11-02 13:40:34 +01:00
Olivier Goffart
b89e7bd3d3 Printer demo: Remove workaround now that for is supported in layout 2020-10-31 11:33:12 +01:00
Simon Hausmann
8bb6f58deb Minor ui fix in printer demo settings page
Don't let the slider "touch" the "Resolution" text label.
2020-10-27 19:33:37 +01:00
Olivier Goffart
d3801e26d3 Change the syntax of structures to require the struct keyword 2020-10-27 16:09:05 +01:00
Olivier Goffart
0973cc7f86 Small changes to prnitdemo layout
Ideally we should convert to box layouts anyway
2020-10-27 09:02:22 +01:00
Olivier Goffart
aabd13b5a9 Adjust the ugly style default stretches 2020-10-27 07:24:04 +01:00
Simon Hausmann
63a88ad452 Add smooth rounded borders to the fax page 2020-10-26 13:48:10 +01:00
Olivier Goffart
47bf84d85d Printer demo: some logic for the Fax page 2020-10-20 15:06:24 +02:00
Simon Hausmann
41ad33f443 Fix bug in struct initialization from object literals
When converting from object literal to object literal, we would check
recursively if the individual fields can be converted and then generate
code to convert each field.

For a conversion frmo object literal to a struct, we would a per-field
can_convert check as well, but there would not be any code (Expression)
generated for the conversion, instead it would be a straight cast. That
was fine so far in our tests and example code, because the fields never
required a conversion. With commit
071ab9fda1 the percentage number literals
used in the printer demo however would now require a conversion
(multiplication by 0.01) before the assignment to the float level field.

This patch adds the missing conversion by matching the Object -> Struct
conversion case, generating an intermediate Object type based on the
struct's properties, call maybe_convert recursively and *then* cast the
result to a struct.
2020-10-19 12:17:41 +02:00
Simon Hausmann
c9e5e5f25b Fix appearance of ink levels in printer demo
Work around a regression introduced in commit 071ab9fda1 that
I'll try to fix next week.
2020-10-17 13:31:37 +02:00
Simon Hausmann
96ead1d028
One more relative length use in the printer demo 2020-10-16 22:11:45 +02:00
Simon Hausmann
cfe0fb396c Use percentages in the printer demo
Looks a little prettier in the source code :)
2020-10-16 20:32:35 +02:00
Simon Hausmann
6aa292eac1 Change the names of the logical and physical pixel units
The logical pixels are now just called "px" and the less frequently
used physical pixels have the "phx" suffix.

The existing markup was adapted using the syntax updater and the
following patch:

    +    if node.kind() == SyntaxKind::NumberLiteral {
    +        if node.text().ends_with("lx") {
    +            return write!(
    +                file,
    +                "{}px",
    +                node.text().as_str().split_at(node.text().as_str().len() - 2).0
    +            );
    +        }
    +        if node.text().ends_with("px") {
    +            return write!(
    +                file,
    +                "{}phx",
    +                node.text().as_str().split_at(node.text().as_str().len() - 2).0
    +            );
    +        }
    +    }

Fixes #49
2020-10-16 07:19:40 +02:00
John
d8a76aba7c Update printerdemo.60
Fixed alignment of the back arrow and the title
2020-10-13 21:36:58 +02:00
Olivier Goffart
ed83fa7aa2 Fix the animation in the printer demo.
We don't want 'x' to depends from properties which are themself animated,
otherwise it just restarts the animation on every frames
2020-10-13 12:14:11 +02:00
Simon Hausmann
bc8fefd631 Use a dummy list view in the print page
Better than hello world :-)
2020-10-13 11:56:50 +02:00
Simon Hausmann
9f115ca004 printer demo: Use a layout for the copy page 2020-10-13 11:52:58 +02:00
Simon Hausmann
d771143f68 Make it possible to exit the printer demo
... by clicking on the power button :-)

Calling exit is a big rough, but simplest and fastest for now.
2020-10-07 15:53:07 +02:00
Olivier Goffart
221bb853d7 Change the exaple to used named struct for models 2020-09-17 14:00:50 +02:00
Simon Hausmann
625cb6c6b8 Add a constructor to Text and let the color default to black
We really shouldn't require specifying a color for every Text {} element just in order
to see *some* text.

For Rectangle OTOH transparent is a good default (and thus for Color), hence
this change just to Text.

Right now the constructor bit is also a bit repetitive, this could
perhaps be folded into BuiltinItem to generate the ffi, default impl and
forward to an init function if it exists.
2020-09-16 08:20:13 +02:00
Simon Hausmann
6b8ccc5ef4 Some touch-ups for the printer demo's settings page 2020-09-09 08:53:15 +02:00
Simon Hausmann
ec07d6bfe8 Tweaks to the color schemes of the printer demo and ugly style/gallery
The printer demo looks slightly less boring on white background with brighter colors.

In exchange, the controls can become more dull and hopefully easier to see.
2020-09-08 15:30:28 +02:00
Olivier Goffart
0751552068 Printer demo: the ink data now comes from the native code 2020-09-04 15:49:33 +02:00
Simon Hausmann
7ca8cf7cdd Change the color scheme of the printer demo a little
To adjust for better contrast in the style changes
2020-09-02 09:25:39 +02:00
Simon Hausmann
704644c752 Reduce use of bright colors in the printer demo
Use slightly aggressive colors for the buttons of the printer demo,
shrink the ink cartridge bars a little and replace the red for the 2000
with a more subtle silver.

Based on privately received feedback ;-)
2020-09-01 15:05:40 +02:00
Olivier Goffart
9782d85fdb Native style works with C++ 2020-09-01 12:25:11 +02:00
Olivier Goffart
58cdaeb8dd Update license header to mention that commertial option are available 2020-08-26 13:23:42 +02:00
Olivier Goffart
dcf5e63203 Put the shebang before the license header 2020-08-24 12:28:02 +02:00
Olivier Goffart
725db91878 Fax page 2020-08-24 08:38:30 +02:00
Simon Hausmann
2823f32692 Apply license headers to all non-binary/non-json sources 2020-08-17 17:55:20 +02:00
Simon Hausmann
86b67787a1 More printer demo polish
* Align the images on the main screen buttons
    * Increase the spacing between the images and the button text
2020-08-14 14:27:34 +02:00
Simon Hausmann
85b1ec0ea9 Add a subtle background gradient 2020-08-14 14:20:36 +02:00
Simon Hausmann
1a42f446a2 Replace the logo in the printer demo with a visual power button 2020-08-14 14:04:09 +02:00
Simon Hausmann
92d5f4d493 Place the project logo in the top right corner of the printer demo
That'll look nicer in the screenshot :)
2020-08-13 18:19:53 +02:00
Olivier Goffart
f7c1e112b3 Some stuff in the home screen of the printer demo 2020-08-12 14:54:08 +02:00
Simon Hausmann
aafb96cb93 Get rid of abi::datastructures::WindowProperties
Instead, pass a reference to the root item when mapping the window,
at which point we can downcast to the new Window item. If we have one,
then we'll read its width/height (for initial values) and install
bindings to keep them up-to-date.
2020-08-12 09:44:42 +02:00
Olivier Goffart
b5c9bf5d10 Settings page for the printer demo
Fix the text maximum size so it can be put in a layout
2020-08-11 12:08:44 +02:00
Olivier Goffart
36243ccdf7 Traverse item front to back for input events 2020-08-10 10:45:02 +02:00
Olivier Goffart
2ba40ebc96 Printerdemo: small effect on press
It works now that we have a grabbed item.
2020-08-07 16:32:49 +02:00
Olivier Goffart
0a56912d0f Mouse grab in rust 2020-08-07 16:06:49 +02:00
Simon Hausmann
8b74381097 Some work on the copy page 2020-08-07 15:53:59 +02:00
Simon Hausmann
a6c7dd1610 Add placeholder pages for copy/fax/settings 2020-08-07 13:49:24 +02:00