glimmer-dsl-swt 4.18.5.5 → 4.18.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +42 -0
  3. data/README.md +4 -4
  4. data/VERSION +1 -1
  5. data/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md +95 -5
  6. data/docs/reference/GLIMMER_PACKAGING_AND_DISTRIBUTION.md +2 -0
  7. data/docs/reference/GLIMMER_SAMPLES.md +67 -0
  8. data/glimmer-dsl-swt.gemspec +18 -6
  9. data/lib/glimmer/dsl/swt/animation_expression.rb +1 -1
  10. data/lib/glimmer/dsl/swt/custom_shape_expression.rb +61 -0
  11. data/lib/glimmer/dsl/swt/custom_widget_expression.rb +1 -1
  12. data/lib/glimmer/dsl/swt/dsl.rb +1 -0
  13. data/lib/glimmer/dsl/swt/expand_item_expression.rb +4 -4
  14. data/lib/glimmer/dsl/swt/image_expression.rb +1 -1
  15. data/lib/glimmer/dsl/swt/multiply_expression.rb +1 -1
  16. data/lib/glimmer/dsl/swt/shape_expression.rb +1 -1
  17. data/lib/glimmer/dsl/swt/transform_expression.rb +1 -1
  18. data/lib/glimmer/dsl/swt/widget_expression.rb +2 -1
  19. data/lib/glimmer/swt/color_proxy.rb +1 -1
  20. data/lib/glimmer/swt/custom/shape.rb +173 -53
  21. data/lib/glimmer/swt/custom/shape/cubic.rb +118 -0
  22. data/lib/glimmer/swt/custom/shape/line.rb +47 -4
  23. data/lib/glimmer/swt/custom/shape/path.rb +240 -0
  24. data/lib/glimmer/swt/custom/shape/path_segment.rb +135 -0
  25. data/lib/glimmer/swt/custom/shape/point.rb +33 -0
  26. data/lib/glimmer/swt/custom/shape/polygon.rb +2 -2
  27. data/lib/glimmer/swt/custom/shape/quad.rb +114 -0
  28. data/lib/glimmer/swt/display_proxy.rb +1 -1
  29. data/lib/glimmer/swt/message_box_proxy.rb +1 -1
  30. data/lib/glimmer/swt/proxy_properties.rb +1 -1
  31. data/lib/glimmer/swt/shell_proxy.rb +1 -1
  32. data/lib/glimmer/swt/tab_folder_proxy.rb +52 -0
  33. data/lib/glimmer/swt/transform_proxy.rb +1 -1
  34. data/lib/glimmer/swt/widget_proxy.rb +1 -1
  35. data/lib/glimmer/ui/custom_shape.rb +281 -0
  36. data/samples/elaborate/mandelbrot_fractal.rb +1 -1
  37. data/samples/elaborate/stock_ticker.rb +214 -0
  38. data/samples/hello/hello_canvas.rb +3 -0
  39. data/samples/hello/hello_canvas_data_binding.rb +214 -0
  40. data/samples/hello/hello_canvas_path.rb +120 -0
  41. data/samples/hello/hello_custom_shape.rb +78 -0
  42. data/samples/hello/hello_shape.rb +71 -0
  43. metadata +16 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8fb342869be74c6e592466ad89d26798dde5cf8f3d6beb52b5bcf6a6e8f221f6
4
- data.tar.gz: c75442b7c5aeac5d77878d52e969669ea677877c12a43c97081155c5412c9c4c
3
+ metadata.gz: 3b4bc038d1fcf459041884946826daa84949318cd2d588f30bbc91ce9cc343f3
4
+ data.tar.gz: 143c076d20310e24ca2a6bd5db70f7bd87bd7c7b171a501c23874cdfd1a989f8
5
5
  SHA512:
6
- metadata.gz: d3e484674be4fa02ea232e1452a80c4fbb2f141bee407ef6ce922dd0f1e3616f6ee420fc57fdd3d9af6c9d993a88705d95e62d9a5573273e63638a5876bf53d9
7
- data.tar.gz: 6a76ebd41db15abe32ae22b2c675199595e196251b03a84ddad99a3aa2b254b43b8e50e339579764de667e10e3673814fb4ab3886aa9f27a9f8c43a7ca16bdcd
6
+ metadata.gz: ae508739a7a491f83853d67867b0c1600323216615909a1cca6aac4b2f373d5d74cad21c6dd08275ed83bc4e537e4b13ef357fdda436cbc6966dec821a3aade7
7
+ data.tar.gz: 7c8110b246fbc0ee40d99fd930be19d782e75846ada53ad2fe09c742cec5bf2de36f59ccbabd4600d81bc6ac4b7183fae397c6590bce2fd8377d7ca38c89e3f1
data/CHANGELOG.md CHANGED
@@ -1,5 +1,47 @@
1
1
  # Change Log
2
2
 
3
+ ### 4.18.7.0
4
+
5
+ - Support direct use of the `shape` keyword as a shape composite that could contain other shapes and shares common attributes (e.g. background color) with all of them
6
+ - Hello, Shape! Sample (implements a method-based custom shape containing other nested shapes)
7
+ - Support custom shapes via including the Glimmer::UI::CustomShape module to add new shape keywords to the Glimmer GUI DSL / Canvas Shape DSL, representing shapes composed of a group of nested shapes (e.g. `car` shape representing a group of nested `polygon` shapes)
8
+ - Hello, Custom Shape! Sample (redoes Hello, Shape! with the use of a class-based custom shape)
9
+ - Support :max value for Canvas Shape DSL width and height, meaning fill up parent (useful for using rectangles as borders)
10
+ - Upgrade to glimmer v1.2.0
11
+
12
+ ### 4.18.6.3
13
+
14
+ - Support `Glimmer::SWT::Custom::Shape::PathSegment#dispose` method
15
+ - Amend Hello, Canvas Path! sample with ability to regenerate paths
16
+ - Make `tab_folder` preinit all its tabs by default while supporting the SWT style of `:initialize_tabs_on_select` to init tabs on first select instead.
17
+ - Support trimming line style symbols (no need to say line_ before each style. e.g. `:line_solid` becomes `:solid`) in Canvas Shape DSL line_style property
18
+ - Support `antialias true` as an alternative to `antialias :on`, `antialias false` as an alternative to `antialias :off`, and `antialias nil` as an alternative to `antialias :default`
19
+
20
+ ### 4.18.6.2
21
+
22
+ - Hello, Canvas Data Binding! Sample
23
+ - Update Stock Ticker sample to keep stock names visible when scrolling graphs off the screen
24
+ - `rgb` keyword tolerance of nil values (converts to 0)
25
+ - Canvas Path DSL Data-Binding
26
+ - Added `Glimmer::SWT::Custom::Shape::PathSegment` `#path` and `#root_path` API methods to enable determining what path/root-path the path segment is part of.
27
+ - Fixed issues with geometry calculation of path segments (especially line)
28
+
29
+ ### 4.18.6.1
30
+
31
+ - Fixed issues with Canvas Path DSL handling of connected vs non-connected path segments (including in geometry calculations)
32
+ - Optimized Canvas Path DSL redraw performance by removing extra redraws
33
+ - Fixed issues in the Hello, Canvas Path! sample and renamed to Stock Ticker
34
+ - Added a new simpler Hello, Canvas Path! sample
35
+
36
+ ### 4.18.6.0
37
+
38
+ - Canvas Path DSL support (Alpha) for `path` as drawn or filled (`fill: true`) to the Canvas Shape DSL, supporting `point`, `line` (first point is auto-derived from previous point if not specified)
39
+ - Hello, Canvas Path! sample showing a Stock Ticker with line curves for multiple company stocks, animated with randomly generated data, moving to the left out of screen second by second. Has multiple tabs demonstrating different types of paths for graphing/charting of different real world business applications: point, line, quad, cubic.
40
+ - Fix issue to allow invocation of `set_min_size` off of `scrolled_composite` proxy directly (not just swt_widget), thus taking advantage of implicit `auto_exec`
41
+ - Support `Shape#content {}` method just like `WidgetProxy#content` to enable reopening and adding nested shapes at runtime after initial construction
42
+ - Support a path containing a `quad` bezier curve with `point_array` property
43
+ - Support a path containing a `cubic` bezier curve with `point_array` property
44
+
3
45
  ### 4.18.5.5
4
46
 
5
47
  - Automatically recalculate default size (width/height) to accomodate nested shapes when changing x/y/width/height sticking out of parent from right or bottom.
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for SWT 4.18.5.5
1
+ # [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for SWT 4.18.7.0
2
2
  ## JRuby Desktop Development GUI Framework
3
3
  [![Gem Version](https://badge.fury.io/rb/glimmer-dsl-swt.svg)](http://badge.fury.io/rb/glimmer-dsl-swt)
4
4
  [![Travis CI](https://travis-ci.com/AndyObtiva/glimmer-dsl-swt.svg?branch=master)](https://travis-ci.com/github/AndyObtiva/glimmer-dsl-swt)
@@ -13,7 +13,7 @@
13
13
  [<img src="https://covers.oreillystatic.com/images/9780596519650/lrg.jpg" width=105 /><br />
14
14
  Featured in JRuby Cookbook](http://shop.oreilly.com/product/9780596519650.do) and [Chalmers/Gothenburg University Software Engineering Master's Lecture Material](http://www.cse.chalmers.se/~bergert/slides/guest_lecture_DSLs.pdf)
15
15
 
16
- [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.18.5.5 includes [SWT 4.18](https://download.eclipse.org/eclipse/downloads/drops4/R-4.18-202012021800/), which was released on December 2, 2020. Gem version numbers are in sync with the SWT library versions. The first two digits represent the SWT version number. The last two digits represent the minor and patch versions of Glimmer DSL for SWT.
16
+ [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.18.7.0 includes [SWT 4.18](https://download.eclipse.org/eclipse/downloads/drops4/R-4.18-202012021800/), which was released on December 2, 2020. Gem version numbers are in sync with the SWT library versions. The first two digits represent the SWT version number. The last two digits represent the minor and patch versions of Glimmer DSL for SWT.
17
17
 
18
18
  [Glimmer DSL for SWT receives two updates per month](https://rubygems.org/gems/glimmer-dsl-swt/versions). You can trust [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) with your Ruby desktop GUI development needs! [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) brings great ideas to the table, such as declarative programming via domain specific languages, currently under-utilized in the GUI domain. That said, it may not be feature complete enough for everybody's needs, so please help make [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) even better by providing feedback and [contributing](#contributing) when possible. The project is very active, so any feature suggestions that are accepted could be implemented within weeks if not days. Also, you are welcome to [hire me](#hire-me) full-time if you want long-term development of [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) for your project needs.
19
19
 
@@ -340,7 +340,7 @@ jgem install glimmer-dsl-swt
340
340
 
341
341
  Or this command if you want a specific version:
342
342
  ```
343
- jgem install glimmer-dsl-swt -v 4.18.5.5
343
+ jgem install glimmer-dsl-swt -v 4.18.7.0
344
344
  ```
345
345
 
346
346
  `jgem` is JRuby's version of `gem` command.
@@ -358,7 +358,7 @@ Note: if you're using activerecord or activesupport, keep in mind that Glimmer u
358
358
 
359
359
  Add the following to `Gemfile`:
360
360
  ```
361
- gem 'glimmer-dsl-swt', '~> 4.18.5.5'
361
+ gem 'glimmer-dsl-swt', '~> 4.18.7.0'
362
362
  ```
363
363
 
364
364
  And, then run:
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.18.5.5
1
+ 4.18.7.0
@@ -39,8 +39,10 @@ This guide should help you get started with Glimmer DSL for SWT. For more advanc
39
39
  - [Shapes inside a Shape](#shapes-inside-a-shape)
40
40
  - [Shapes inside a Widget](#shapes-inside-a-widget)
41
41
  - [Shapes inside an Image](#shapes-inside-an-image)
42
+ - [Custom Shapes](#custom-shapes)
42
43
  - [Canvas Shape API](#canvas-shape-api)
43
44
  - [Pixel Graphics](#pixel-graphics)
45
+ - [Canvas Path DSL](#canvas-path-dsl)
44
46
  - [Canvas Transform DSL](#canvas-transform-dsl)
45
47
  - [Top-Level Transform Fluent Interface](#top-level-transform-fluent-interface)
46
48
  - [Canvas Animation DSL](#canvas-animation-dsl)
@@ -409,6 +411,14 @@ Example (you may copy/paste in [`girb`](GLIMMER_GIRB.md)):
409
411
  @shell.open
410
412
  ```
411
413
 
414
+ ##### Tab Folder API
415
+
416
+ Unlike basic SWT usage, `tab_folder` has the smart default of pre-initializing all tabs so that they are properly sized/filled so no delays occur when a user browses through them for the first time by selecting unselected tabs.
417
+
418
+ The [Stock Ticker](/docs/reference/GLIMMER_SAMPLES.md#stock-ticker) sample takes advantage of this to ensure all tabs are pre-initialized and filled with rendered data even before the user selects any of them.
419
+
420
+ That said, `tab_folder` can optionally receive a custom Glimmer SWT style named `:initialize_tabs_on_select`, which disables that behavior by going back to SWT's default of initializing tabs upon first selection (e.g. upon clicking with the mouse).
421
+
412
422
  ##### Shell Icon
413
423
 
414
424
  To set the shell icon, simply set the `image` property under the `shell` widget. This shows up in the operating system toolbar and app-switcher (e.g. CMD+TAB) (and application window top-left corner in Windows)
@@ -1414,7 +1424,7 @@ Optionally, a shape keyword takes a block that can set any attributes from [org.
1414
1424
  Here is a list of supported attributes nestable within a block under shapes:
1415
1425
  - `advanced` enables advanced graphics subsystem (boolean value). Typically gets enabled automatically when setting alpha, antialias, patterns, interpolation, clipping. Rendering sometimes differs between advanced and non-advanced mode for basic graphics too, so you could enable manually if you prefer its look even for basic graphics.
1416
1426
  - `alpha` sets transparency (integer between `0` and `255`)
1417
- - `antialias` enables antialiasing (SWT style value of `:default`, `:off`, `:on` whereby `:default` applies OS default, which varies per OS)
1427
+ - `antialias` enables antialiasing (SWT style value of `:default` (or nil), `:off` (or false), `:on` (or true) whereby `:default` applies OS default, which varies per OS)
1418
1428
  - `background` sets fill color for fillable shapes (standard color symbol (e.g. `:red`), `rgb(red_integer, green_integer, blue_integer)` color, or Color/ColorProxy object directly)
1419
1429
  - `background_pattern` sets fill gradient/image pattern for fillable shape background (takes the same arguments as the SWT [Pattern](https://help.eclipse.org/2020-12/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/graphics/Pattern.html) class [e.g. `background_pattern 2.3, 4.2, 5.4, 7.2, :red, :blue`] / note: this feature isn't extensively tested yet)
1420
1430
  - `clipping` clips area of painting (numeric values for `(x, y, width, height)`)
@@ -1426,7 +1436,7 @@ Here is a list of supported attributes nestable within a block under shapes:
1426
1436
  - `line_cap` sets line cap (SWT style value of `:cap_flat`, `:cap_round`, or `:cap_square`)
1427
1437
  - `line_dash` line dash float values (automatically sets `line_style` to SWT style value of `:line_custom`)
1428
1438
  - `line_join` line join style (SWT style value of `:join_miter`, `:join_round`, or `:join_bevel`)
1429
- - `line_style` line join style (SWT style value of `:line_solid`, `:line_dash`, `:line_dot`, `:line_dashdot`, or `:line_dashdotdot`)
1439
+ - `line_style` line join style (SWT style value of `:solid`, `:dash`, `:dot`, `:dashdot`, `:dashdotdot`, or `:custom` while requiring `line_dash` attribute (or alternatively with `line_` prefix as per official SWT docs like `:line_solid` for `:solid`)
1430
1440
  - `line_width` line width in integer (used in draw operations)
1431
1441
  - `text_anti_alias` enables text antialiasing (SWT style value of `:default`, `:off`, `:on` whereby `:default` applies OS default, which varies per OS)
1432
1442
  - `transform` sets transform object using [Canvas Transform DSL](#canvas-transform-dsl) syntax
@@ -1475,7 +1485,7 @@ Screenshot:
1475
1485
 
1476
1486
  If you specify the x and y coordinates as `:default`, `nil`, or leave them out, they get calculated automatically by centering the shape within its parent `canvas`.
1477
1487
 
1478
- Note that you could shift a shape off its centered position within its parent `canvas` by using `x_delta` and `y_delta` instead of `x` and `y`
1488
+ Note that you could shift a shape off its centered position within its parent `canvas` by setting `x` to `[:default, x_delta]` and `y` to `[:default, y_delta]`
1479
1489
 
1480
1490
  The round and gradient options could be dropped since Glimmer DSL for SWT supports auto-inference of them based on shape parameters.
1481
1491
 
@@ -1632,9 +1642,11 @@ Shapes can be nested within each other. If you nest a shape within another, its
1632
1642
 
1633
1643
  As such, if you move the parent, it moves all its children with it.
1634
1644
 
1635
- If you specify the x and y coordinates as `:default`, `nil`, or leave them out, they get calculated automatically by centering the shape within its parent shape relatively.
1645
+ If you specify the `x` and `y` coordinates as `:default`, `nil`, or leave them out, they get calculated automatically by centering the shape within its parent shape relatively.
1646
+
1647
+ If you specify the `width` and `height` parameters as `:default`, `nil`, or leave them out, they get calculated automatically from the shape's nested children shapes (e.g calculating the dimensions of a text from its extent according to its font size).
1636
1648
 
1637
- Note that you could shift a shape off its centered position within its parent shape by using `x_delta` and `y_delta` instead of `x` and `y`
1649
+ Note that you could shift a shape off its centered position within its parent shape by setting `x` to `[:default, x_delta]` and `y` to `[:default, y_delta]`
1638
1650
 
1639
1651
  Check [Hello, Canvas!](GLIMMER_SAMPLES.md#hello-canvas) for an example that nests lines, points, a polyline, and an image within a drawn rectangle parent:
1640
1652
 
@@ -1756,6 +1768,21 @@ shell {
1756
1768
 
1757
1769
  ![Image Shape DSL](/images/glimmer-example-image-shape-dsl-app-switcher-icon.png)
1758
1770
 
1771
+ #### Custom Shapes
1772
+
1773
+ Glimmer enables defining custom shape keywords, which represent shapes made up of other nested shapes.
1774
+
1775
+ Custom shapes expand a software engineer's Glimmer GUI DSL vocabulary in their app development to be able to represent
1776
+ higher visual concepts like vehicles, scenes, and characters with a single keyword (e.g. `car`, `beach`, `player`),
1777
+ which embody and abstract all the details relating to the visual concept. This enables orders of magnitudes in increased
1778
+ productivity and readability/maintainability as a result.
1779
+
1780
+ Just like [custom widgets](#custom-widgets), custom shapes can be defined in one of two ways:
1781
+ - method-based custom shapes: Use the `shape` keyword as a parent to represent a shape composite (similar to widget composite) and include other shapes like rectangles, polygons, and lines within.
1782
+ - class-based custom shapes: Include the `Glimmer::UI::CustomShape` supermodule and define the `options`, `body {}` block, and `before_body/after_body` hooks (similar to how it is down with [custom widgets](#custom-widgets))
1783
+
1784
+ Check out [Hello, Shape!](/docs/reference/GLIMMER_SAMPLES.md#hello-shape) and [Hello, Custom Shape!](/docs/reference/GLIMMER_SAMPLES.md#hello-custom-shape) for examples of both approaches.
1785
+
1759
1786
  #### Canvas Shape API
1760
1787
 
1761
1788
  These Canvas Shape API methods help with manipulating shapes upon user interaction, such as mouse clicking a specific shape.
@@ -1766,11 +1793,28 @@ They are implemented with the help of the highly robust Java built-in shape geom
1766
1793
  - `Shape#contain?(x, y)` : indicates if shape contains x, y point
1767
1794
  - `Shape#include?(x, y)` : indicates if shape includes x, y point on the edge if drawn or inside if filled (include uses contain for filled shapes)
1768
1795
  - `Shape#move_by(x_delta, y_delta)` : moves shape object at x, y location
1796
+ - `Shape#dispose` : disposes of shape, removing it form its parent canvas, widget, or shape
1797
+ - `Shape#content {}` : reopens a shape to add more content inside it using the Glimmer GUI DSL (e.g. Canvas Shape DSL) just like `WidgetProxy#content {}`.
1769
1798
  - `Shape#size` : calculated size for shape bounding box (e.g. a polygon with an irregular shape will have its bounding box width and height calculated)
1770
1799
  - `Shape#bounds` : calculated bounds (x, y, width, height) for shape bounding box (e.g. a polygon with an irregular shape will have its bounding box top-left x, y, width and height calculated)
1800
+ - `Shape#width` : static (including `:default`) or derived width for shape (including irregular geometric shapes like Polygon)
1801
+ - `Shape#height` : static (including `:default`) or derived height for shape (including irregular geometric shapes like Polygon)
1802
+ - `Shape#default_width?` : whether `:default` or `[:default, delta]` is set for static width
1803
+ - `Shape#default_height?` : whether `:default` or `[:default, delta]` is set for static height
1804
+ - `Shape#calculated_width` : calculated width for shape when set to :default to indicate it is sized by its children (e.g. in the case of containing text with a specific font size not knowing its width/height dimensions in advance)
1805
+ - `Shape#calculated_height` : calculated height for shape when set to :default to indicate it is sized by its children (e.g. in the case of containing text with a specific font size not knowing its width/height dimensions in advance)
1806
+ - `Shape#x` : top-left corner x position, static or `:default` (could be relative if shape is nested within another shape)
1807
+ - `Shape#y` : top-left corner y position, static or `:default` (could be relative if shape is nested within another shape)
1808
+ - `Shape#absolute_x` : absolute top-left corner x position
1809
+ - `Shape#absolute_y` : absolute top-left corner y position
1810
+ - `Shape#default_x?` : whether x is specified via `:default` style to indicate centering within parent (or `[:default, offset]`)
1811
+ - `Shape#default_y?` : calculated top-left corner y position
1812
+ - `Shape#calculated_x` : calculated top-left corner x position when default/delta is set (i.e. centered within parent)
1813
+ - `Shape#calculated_y` : calculated top-left corner y position when default/delta is set (i.e. centered within parent)
1771
1814
 
1772
1815
  Check [Hello, Canvas!](GLIMMER_SAMPLES.md#hello-canvas) for an example.
1773
1816
 
1817
+
1774
1818
  #### Pixel Graphics
1775
1819
 
1776
1820
  **(Early Alpha Feature)**
@@ -1953,6 +1997,52 @@ shell {
1953
1997
 
1954
1998
  As they say, there are many ways to skin a cat! This is in line with the Ruby way of providing more ways than one. Pick and choose the right tool for the job just like true software engineers.
1955
1999
 
2000
+ ### Canvas Path DSL
2001
+
2002
+ **(ALPHA FEATURE)**
2003
+
2004
+ Unlike common imperative GUI graphing toolkits, Glimmer enables declarative rendering of paths with the new Canvas Path DSL (Early Alpha) via the new `path { }` keyword and by nesting one of the following path segment keywords underneath:
2005
+ - `point(x1, y1)`: renders a Point (Dot) as part of a path.
2006
+ - `line(x1, y1, x2=nil, y2=nil)`: renders a Line as part of a path. If you drop x2, y2, it joins to the previous point automatically. You may repeat for a series of lines forming a curve.
2007
+ - `quad(x1, y1, x2, y2, x3=nil, y3=nil)`: renders a Quadratic Bezier Curve. If you drop x3 and y3, it joins to the previous point automatically.
2008
+ - `cubic(x1, y1, x2, y2, x3, y3, x4=nil, y4=nil)`: renders a Cubic Bezier Curve. If you drop x4 and y4, it joins to the previous point automatically.
2009
+
2010
+ Example:
2011
+
2012
+ ```ruby
2013
+ include Glimmer
2014
+
2015
+ shell {
2016
+ text 'Canvas Path Example'
2017
+ minimum_size 300, 300
2018
+
2019
+ canvas {
2020
+ path {
2021
+ foreground :black
2022
+ 250.times {|n|
2023
+ cubic(n + n%30, n+ n%50, 40, 40, 70, 70, n + 20 + n%30, n%30*-1 * n%50)
2024
+ }
2025
+ }
2026
+ }
2027
+
2028
+ }.open
2029
+ ```
2030
+
2031
+ ![Canvas Path Example](/images/glimmer-example-canvas-path.png)
2032
+
2033
+ Learn more at the [Hello, Canvas Path!](GLIMMER_SAMPLES.md#hello-canvas-path) and [Stock Ticker](GLIMMER_SAMPLES.md#stock-ticker) samples.
2034
+
2035
+ ![Stock Ticker](/images/glimmer-stock-ticker.gif)
2036
+
2037
+ #### Canvas Path API
2038
+
2039
+ Every path segment object (mixing in [`Glimmer::SWT::Custom::PathSegment`](/lib/glimmer/swt/custom/shape/path_segment.rb) like `path`, `point`, `line`, `quad`, and `cubic`) has the following API methods:
2040
+ - `#path`: indicates which path the segment is part of.
2041
+ - `#path_root`: indicates the root path the segment is part of.
2042
+ - `#dispose`: disposes a path segment from its path
2043
+ - `#content {}` : reopens a path to add more segments inside it using the Glimmer GUI DSL (e.g. Canvas Path DSL) just like `WidgetProxy#content {}`.
2044
+ - `#first_path_segment?`: indicates if the path segment is the first in the path
2045
+
1956
2046
  ### Canvas Transform DSL
1957
2047
 
1958
2048
  **(ALPHA FEATURE)**
@@ -12,6 +12,8 @@ glimmer package
12
12
 
13
13
  It works out of the box for any application scaffolded by [Glimmer Scaffolding](#scaffolding), generating all available packaging types on the current platform (e.g. `DMG`, `PKG`, `APP` on the Mac) and displaying a message indicating what pre-requisite setup tools are needed if not installed already (e.g. [Wix Toolset](https://wixtoolset.org/) to generate MSI files on Windows). If you install Wix, make sure it is on the system PATH by adding for example "C:\Program Files (x86)\WiX Toolset v3.11\bin" to the Windows Environment Variables.
14
14
 
15
+ (note: if you see this error on the Mac 'Error: Bundler "DMG Installer" (dmg) failed to produce a bundle.', ignore it as it should have produced a bundle anyways. It is a harmless issue in 3rd party dependency: javapackager.)
16
+
15
17
  You may choose to generate a specific type of packaging instead by addionally passing in the `[type]` option. For example, this generates an MSI setup file on Windows:
16
18
 
17
19
  ```
@@ -33,11 +33,15 @@
33
33
  - [Hello, Canvas!](#hello-canvas)
34
34
  - [Hello, Canvas Animation!](#hello-canvas-animation)
35
35
  - [Hello, Canvas Transform!](#hello-canvas-transform)
36
+ - [Hello, Canvas Path!](#hello-canvas-path)
37
+ - [Hello, Canvas Data Binding!](#hello-canvas-data-binding)
36
38
  - [Hello, Cursor!](#hello-cursor)
37
39
  - [Hello, Progress Bar!](#hello-progress-bar)
38
40
  - [Hello, Tree!](#hello-tree)
39
41
  - [Hello, Color Dialog!](#hello-color-dialog)
40
42
  - [Hello, Font Dialog!](#hello-font-dialog)
43
+ - [Hello, Shape!](#hello-shape)
44
+ - [Hello, Custom Shape!](#hello-custom-shape)
41
45
  - [Elaborate Samples](#elaborate-samples)
42
46
  - [User Profile](#user-profile)
43
47
  - [Login](#login)
@@ -45,6 +49,7 @@
45
49
  - [Contact Manager](#contact-manager)
46
50
  - [Glimmer Tetris](#glimmer-tetris)
47
51
  - [Mandelbrot Fractal](#mandelbrot-fractal)
52
+ - [Stock Ticker](#stock-ticker)
48
53
  - [External Samples](#external-samples)
49
54
  - [Glimmer Calculator](#glimmer-calculator)
50
55
  - [Gladiator](#gladiator)
@@ -616,6 +621,32 @@ Hello, Canvas Transform!
616
621
 
617
622
  ![Hello Canvas Transform](/images/glimmer-hello-canvas-transform.png)
618
623
 
624
+ #### Hello, Canvas Path!
625
+
626
+ This sample demonstrates the use of the `path`, `quad`, `cubic`, `line`, and `point` keywords as part of the [Canvas Path DSL](/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#canvas-path-dsl) within the [Canvas Shape DSL](/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#canvas-shape-dsl).
627
+
628
+ Code:
629
+
630
+ [samples/hello/hello_canvas_path.rb](/samples/hello/hello_canvas_path.rb)
631
+
632
+ Hello, Canvas Path!
633
+
634
+ ![Hello Canvas Path](/images/glimmer-hello-canvas-path.png)
635
+
636
+ #### Hello, Canvas Data Binding!
637
+
638
+ This sample demonstrates Canvas Shape DSL data-binding.
639
+
640
+ Code:
641
+
642
+ [samples/hello/hello_canvas_data_binding.rb](/samples/hello/hello_canvas_data_binding.rb)
643
+
644
+ Hello, Canvas Data Binding!
645
+
646
+ ![Hello Canvas Data Binding](/images/glimmer-hello-canvas-data-binding.png)
647
+
648
+ ![Hello Canvas Data Binding Line Changed](/images/glimmer-hello-canvas-data-binding-line-changed.png)
649
+
619
650
  #### Hello, Cursor!
620
651
 
621
652
  This sample demonstrates the use of the `cursor` property keyword to change the mouse cursor.
@@ -688,6 +719,32 @@ Hello, Font Dialog!
688
719
 
689
720
  ![Hello Font Dialog Font Changed](/images/glimmer-hello-font-dialog-font-changed.png)
690
721
 
722
+ #### Hello, Shape!
723
+
724
+ This sample demonstrates the use of the `shape` keyword, which represents shape composites that contain other nested shapes.
725
+
726
+ Code:
727
+
728
+ [samples/hello/hello_shape.rb](/samples/hello/hello_shape.rb)
729
+
730
+ Hello, Shape!
731
+
732
+ ![Hello Shape](/images/glimmer-hello-shape.png)
733
+
734
+ #### Hello, Custom Shape!
735
+
736
+ This sample demonstrates the use of the `Glimmer::UI::CustomShape` module, which is used to author new custom shape keywords.
737
+ It reimplements Hello, Shape! with a class-based custom shape instead of a method-based custom shape.
738
+ Just provides another option that is useful when defining more elaborate shapes to separate them from the main app code.
739
+
740
+ Code:
741
+
742
+ [samples/hello/hello_custom_shape.rb](/samples/hello/hello_custom_shape.rb)
743
+
744
+ Hello, Custom Shape!
745
+
746
+ ![Hello Custom Shape](/images/glimmer-hello-custom-shape.png)
747
+
691
748
  ### Elaborate Samples
692
749
 
693
750
  For more elaborate samples, check the following:
@@ -812,6 +869,16 @@ Code:
812
869
 
813
870
  ![Mandelbrot Fractal Help Menu](/images/glimmer-mandelbrot-menu-help.png)
814
871
 
872
+ #### Stock Ticker
873
+
874
+ This sample demonstrates a Stock Ticker that generates random stock price data for 4 different stocks and provides 4 different tab views of the graphed data using the [Canvas Path DSL](/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#canvas-path-dsl). It leverages a thread that runs in the background and ticks the stocks to generate random new stock prices before amending the graphed paths with them.
875
+
876
+ Code:
877
+
878
+ [samples/elaborate/stock_ticker.rb](/samples/elaborate/stock_ticker.rb)
879
+
880
+ ![Stock Ticker](/images/glimmer-stock-ticker.gif)
881
+
815
882
  ### External Samples
816
883
 
817
884
  #### Glimmer Calculator
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: glimmer-dsl-swt 4.18.5.5 ruby lib
5
+ # stub: glimmer-dsl-swt 4.18.7.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "glimmer-dsl-swt".freeze
9
- s.version = "4.18.5.5"
9
+ s.version = "4.18.7.0"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
13
13
  s.authors = ["AndyMaleh".freeze]
14
- s.date = "2021-02-27"
14
+ s.date = "2021-03-04"
15
15
  s.description = "Glimmer DSL for SWT (JRuby Desktop Development GUI Framework) is a native-GUI cross-platform desktop development library written in JRuby, an OS-threaded faster JVM version of Ruby. Glimmer's main innovation is a declarative Ruby DSL that enables productive and efficient authoring of desktop application user-interfaces by relying on the robust Eclipse SWT library. Glimmer additionally innovates by having built-in data-binding support, which greatly facilitates synchronizing the GUI with domain models, thus achieving true decoupling of object oriented components and enabling developers to solve business problems (test-first) without worrying about GUI concerns, or alternatively drive development GUI-first, and then write clean business models (test-first) afterwards. Not only does Glimmer provide a large set of GUI widgets, but it also supports drawing Canvas Graphics like Shapes and Animations. To get started quickly, Glimmer offers scaffolding options for Apps, Gems, and Custom Widgets. Glimmer also includes native-executable packaging support, sorely lacking in other libraries, thus enabling the delivery of desktop apps written in Ruby as truly native DMG/PKG/APP files on the Mac + App Store, MSI/EXE files on Windows, and Gem Packaged Shell Scripts on Linux.".freeze
16
16
  s.email = "andy.am@gmail.com".freeze
17
17
  s.executables = ["glimmer".freeze, "girb".freeze]
@@ -66,6 +66,7 @@ Gem::Specification.new do |s|
66
66
  "lib/glimmer/dsl/swt/column_properties_expression.rb",
67
67
  "lib/glimmer/dsl/swt/combo_selection_data_binding_expression.rb",
68
68
  "lib/glimmer/dsl/swt/cursor_expression.rb",
69
+ "lib/glimmer/dsl/swt/custom_shape_expression.rb",
69
70
  "lib/glimmer/dsl/swt/custom_widget_expression.rb",
70
71
  "lib/glimmer/dsl/swt/data_binding_expression.rb",
71
72
  "lib/glimmer/dsl/swt/dialog_expression.rb",
@@ -115,13 +116,17 @@ Gem::Specification.new do |s|
115
116
  "lib/glimmer/swt/custom/radio_group.rb",
116
117
  "lib/glimmer/swt/custom/shape.rb",
117
118
  "lib/glimmer/swt/custom/shape/arc.rb",
119
+ "lib/glimmer/swt/custom/shape/cubic.rb",
118
120
  "lib/glimmer/swt/custom/shape/focus.rb",
119
121
  "lib/glimmer/swt/custom/shape/image.rb",
120
122
  "lib/glimmer/swt/custom/shape/line.rb",
121
123
  "lib/glimmer/swt/custom/shape/oval.rb",
124
+ "lib/glimmer/swt/custom/shape/path.rb",
125
+ "lib/glimmer/swt/custom/shape/path_segment.rb",
122
126
  "lib/glimmer/swt/custom/shape/point.rb",
123
127
  "lib/glimmer/swt/custom/shape/polygon.rb",
124
128
  "lib/glimmer/swt/custom/shape/polyline.rb",
129
+ "lib/glimmer/swt/custom/shape/quad.rb",
125
130
  "lib/glimmer/swt/custom/shape/rectangle.rb",
126
131
  "lib/glimmer/swt/custom/shape/text.rb",
127
132
  "lib/glimmer/swt/date_time_proxy.rb",
@@ -144,6 +149,7 @@ Gem::Specification.new do |s|
144
149
  "lib/glimmer/swt/style_constantizable.rb",
145
150
  "lib/glimmer/swt/styled_text_proxy.rb",
146
151
  "lib/glimmer/swt/swt_proxy.rb",
152
+ "lib/glimmer/swt/tab_folder_proxy.rb",
147
153
  "lib/glimmer/swt/tab_item_proxy.rb",
148
154
  "lib/glimmer/swt/table_column_proxy.rb",
149
155
  "lib/glimmer/swt/table_proxy.rb",
@@ -152,6 +158,7 @@ Gem::Specification.new do |s|
152
158
  "lib/glimmer/swt/widget_listener_proxy.rb",
153
159
  "lib/glimmer/swt/widget_proxy.rb",
154
160
  "lib/glimmer/ui.rb",
161
+ "lib/glimmer/ui/custom_shape.rb",
155
162
  "lib/glimmer/ui/custom_shell.rb",
156
163
  "lib/glimmer/ui/custom_widget.rb",
157
164
  "lib/glimmer/util/proc_tracker.rb",
@@ -162,6 +169,7 @@ Gem::Specification.new do |s|
162
169
  "samples/elaborate/login.rb",
163
170
  "samples/elaborate/mandelbrot_fractal.rb",
164
171
  "samples/elaborate/meta_sample.rb",
172
+ "samples/elaborate/stock_ticker.rb",
165
173
  "samples/elaborate/tetris.rb",
166
174
  "samples/elaborate/tetris/model/block.rb",
167
175
  "samples/elaborate/tetris/model/game.rb",
@@ -180,6 +188,8 @@ Gem::Specification.new do |s|
180
188
  "samples/hello/hello_button.rb",
181
189
  "samples/hello/hello_canvas.rb",
182
190
  "samples/hello/hello_canvas_animation.rb",
191
+ "samples/hello/hello_canvas_data_binding.rb",
192
+ "samples/hello/hello_canvas_path.rb",
183
193
  "samples/hello/hello_canvas_transform.rb",
184
194
  "samples/hello/hello_checkbox.rb",
185
195
  "samples/hello/hello_checkbox_group.rb",
@@ -189,6 +199,7 @@ Gem::Specification.new do |s|
189
199
  "samples/hello/hello_computed.rb",
190
200
  "samples/hello/hello_computed/contact.rb",
191
201
  "samples/hello/hello_cursor.rb",
202
+ "samples/hello/hello_custom_shape.rb",
192
203
  "samples/hello/hello_custom_shell.rb",
193
204
  "samples/hello/hello_custom_widget.rb",
194
205
  "samples/hello/hello_date_time.rb",
@@ -209,6 +220,7 @@ Gem::Specification.new do |s|
209
220
  "samples/hello/hello_radio.rb",
210
221
  "samples/hello/hello_radio_group.rb",
211
222
  "samples/hello/hello_sash_form.rb",
223
+ "samples/hello/hello_shape.rb",
212
224
  "samples/hello/hello_spinner.rb",
213
225
  "samples/hello/hello_styled_text.rb",
214
226
  "samples/hello/hello_tab.rb",
@@ -230,7 +242,7 @@ Gem::Specification.new do |s|
230
242
  s.specification_version = 4
231
243
 
232
244
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
233
- s.add_runtime_dependency(%q<glimmer>.freeze, ["~> 1.1.2"])
245
+ s.add_runtime_dependency(%q<glimmer>.freeze, ["~> 1.2.0"])
234
246
  s.add_runtime_dependency(%q<super_module>.freeze, [">= 1.4.1", "< 2.0.0"])
235
247
  s.add_runtime_dependency(%q<nested_inherited_jruby_include_package>.freeze, [">= 0.3.0", "< 2.0.0"])
236
248
  s.add_runtime_dependency(%q<puts_debuggerer>.freeze, [">= 0.11.0", "< 2.0.0"])
@@ -248,7 +260,7 @@ Gem::Specification.new do |s|
248
260
  s.add_development_dependency(%q<simplecov>.freeze, ["~> 0.16.1"])
249
261
  s.add_development_dependency(%q<simplecov-lcov>.freeze, ["~> 0.7.0"])
250
262
  else
251
- s.add_dependency(%q<glimmer>.freeze, ["~> 1.1.2"])
263
+ s.add_dependency(%q<glimmer>.freeze, ["~> 1.2.0"])
252
264
  s.add_dependency(%q<super_module>.freeze, [">= 1.4.1", "< 2.0.0"])
253
265
  s.add_dependency(%q<nested_inherited_jruby_include_package>.freeze, [">= 0.3.0", "< 2.0.0"])
254
266
  s.add_dependency(%q<puts_debuggerer>.freeze, [">= 0.11.0", "< 2.0.0"])
@@ -267,7 +279,7 @@ Gem::Specification.new do |s|
267
279
  s.add_dependency(%q<simplecov-lcov>.freeze, ["~> 0.7.0"])
268
280
  end
269
281
  else
270
- s.add_dependency(%q<glimmer>.freeze, ["~> 1.1.2"])
282
+ s.add_dependency(%q<glimmer>.freeze, ["~> 1.2.0"])
271
283
  s.add_dependency(%q<super_module>.freeze, [">= 1.4.1", "< 2.0.0"])
272
284
  s.add_dependency(%q<nested_inherited_jruby_include_package>.freeze, [">= 0.3.0", "< 2.0.0"])
273
285
  s.add_dependency(%q<puts_debuggerer>.freeze, [">= 0.11.0", "< 2.0.0"])