glimmer-dsl-swt 4.18.0.2 → 4.18.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7aaf0dca4f250ba15d538f31b0d127fa1f49187208dde61e11fb7d59ce54b33b
4
- data.tar.gz: 2fc8e9ea4778467e9f29c90c1e5eaa908eb73fa2df0fea2680141f2c89492174
3
+ metadata.gz: 86c6cb24dde4db7916e8af3e1c2e61c8146d1be0893ff9d59f3546867438032d
4
+ data.tar.gz: 63a055522af49c34e2bf1fad56f2fa54fab9842129c99816561bc60081b3373a
5
5
  SHA512:
6
- metadata.gz: 5babde26d2b5440917f5b30ba2409701f11fa7210e190922ab3d4873d2db03113b5a3b68adfe1a97767cff2ed931259728dc4735cee596aec09c0f21cc9ed3d6
7
- data.tar.gz: 198238910b291593d4249716b29e7ce52fce909d3f1b4e8606d1451c9c22b19a74cc0f19fdda2f6f7a3f4182cc0fc595770bc5359ca82890db5b4892204e54bb
6
+ metadata.gz: 132c53c40c35a0e05a3f44953651b1418b453b6cf8d9bd8cd2f5d90bfa1ce1254b816f5bfb0c26fa7222e924818817dbf8260f4107f92c54816de2c42545e21d
7
+ data.tar.gz: cd8c874d5549295a0466944a2a3257405f3f670417dce6cade8c80202a5016d3b86a1cf7393479694c9fd0e2ea080a9fd4e965c57d653ae62653140883d612fc
@@ -1,5 +1,53 @@
1
1
  # Change Log
2
2
 
3
+ ### 4.18.2.2
4
+
5
+ - Fixed issue with processing shape color due to missing Color class package name
6
+
7
+ ### 4.18.2.1
8
+
9
+ - Ensure drawing image works in Shape DSL
10
+ - Support passing image as simply an image path or image proxy to Shape DSL image method
11
+
12
+ ### 4.18.2.0
13
+
14
+ - Canvas animation start method (useful if animation had a frame count limit or cycle count limit and needed to be started again after it stopped)
15
+ - Canvas animation stop method
16
+ - Canvas animation restart method (restarts from frame 1)
17
+ - Canvas animation started? # meaning it is animating
18
+ - Canvas animation stopped? # meaning it has stopped animating
19
+ - Canvas animation duration_limit option
20
+ - Make gradient/round rectangles in Shape DSL receive an option of `gradient: true` and `round: true` instead of prefix
21
+ - Canvas Shape DSL support for Background/Foreground Pattern (NOTE: not extensively tested yet)
22
+ - Canvas Shape DSL smart defaults for background/foreground depending on shape being drawn
23
+ - Canvas Shape DSL smart defaults for fill option depending on shape being drawn
24
+ - Added fallback font "Courier" for `code_text` widget when "Consolas" is not available.
25
+
26
+ ### 4.18.1.1
27
+
28
+ - Add smart defaults for round rectangle angles (defaults to 60 degrees angles)
29
+ - Add smart default for gradient rectangle vertical option
30
+ - Small update to Hello, Canvas! Sample
31
+ - Convert SWT style symbol to SWT style integer if method takes integer but receives a symbol (or string)
32
+ - Make polygon not require [] for its array args
33
+ - Allow cycle to receive splatted array as varargs
34
+ - Change references to `Display.setAppName` and `Display.setAppVersion` to `Display.app_name =` and `Display.app_version =`
35
+ - Default Glimmer app name to "Glimmer" (instead of previous "SWT") unless `Display.app_name = "Somename"` is set by consumer before instantiating first display
36
+ - Set default background to system widget background default for fill shapes
37
+ - Set default foreground to black for draw shapes
38
+ - Fix issue with shapes always requiring a block (even an empty one) to render
39
+ - Fix issue with animation requiring changes to canvas directly in addition to shapes
40
+ - Fix issue with `glimmer list:gems:dsl` command
41
+ - Fix issue with scaffolding still depending on git-glimmer despite being merged back to git gem
42
+
43
+ ### 4.18.1.0
44
+
45
+ - Canvas Shape DSL
46
+ - Hello, Canvas! Sample
47
+ - Animation DSL
48
+ - Hello, Canvas Animation! Sample
49
+ - Fixed issue with async_exec not working in ShellProxy when delegate widget is nil
50
+
3
51
  ### 4.18.0.2
4
52
 
5
53
  - Minor update on Hello, Dialog! Sample
data/README.md CHANGED
@@ -1,6 +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.0.2
2
-
3
-
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.2.2
4
2
  ## JRuby Desktop Development GUI Framework
5
3
  [![Gem Version](https://badge.fury.io/rb/glimmer-dsl-swt.svg)](http://badge.fury.io/rb/glimmer-dsl-swt)
6
4
  [![Travis CI](https://travis-ci.com/AndyObtiva/glimmer-dsl-swt.svg?branch=master)](https://travis-ci.com/github/AndyObtiva/glimmer-dsl-swt)
@@ -10,9 +8,7 @@
10
8
 
11
9
  **[Contributors Wanted! (Submit a Glimmer App Sample to Get Started)](#contributing)**
12
10
 
13
- (The Original Glimmer Library Since 2007. Beware of Imitators!)
14
-
15
- [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer) is a native-GUI cross-platform desktop development library written in [JRuby](https://www.jruby.org/), an OS-threaded faster version of [Ruby](https://www.ruby-lang.org/en/). [Glimmer](https://github.com/AndyObtiva/glimmer)'s main innovation is a declarative [Ruby DSL](#glimmer-dsl-syntax) that enables productive and efficient authoring of desktop application user-interfaces while relying on the robust [Eclipse SWT library](https://www.eclipse.org/swt/). [Glimmer](https://rubygems.org/gems/glimmer) additionally innovates by having built-in [data-binding](#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. To get started quickly, [Glimmer](https://rubygems.org/gems/glimmer) offers [scaffolding](#scaffolding) options for [Apps](#in-production), [Gems](#custom-shell-gem), and [Custom Widgets](#custom-widgets). [Glimmer](https://rubygems.org/gems/glimmer) also includes native-executable [packaging](#packaging--distribution) support, sorely lacking in other libraries, thus enabling the delivery of desktop apps written in [Ruby](https://www.ruby-lang.org/en/) as truly native DMG/PKG/APP files on the [Mac](https://www.apple.com/ca/macos) + [App Store](https://developer.apple.com/macos/distribution/), MSI/EXE files on [Windows](https://www.microsoft.com/en-ca/windows), and [Gem Packaged Shell Scripts](#custom-shell-gem) on [Linux](https://www.linux.org/).
11
+ [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer) is a native-GUI cross-platform desktop development library written in [JRuby](https://www.jruby.org/), an OS-threaded faster JVM version of [Ruby](https://www.ruby-lang.org/en/). [Glimmer](https://github.com/AndyObtiva/glimmer)'s main innovation is a declarative [Ruby DSL](#glimmer-dsl-syntax) that enables productive and efficient authoring of desktop application user-interfaces by relying on the robust [Eclipse SWT library](https://www.eclipse.org/swt/). [Glimmer](https://rubygems.org/gems/glimmer) additionally innovates by having built-in [data-binding](#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](#widgets), but it also supports drawing Canvas Graphics like [Shapes](#canvas-shape-dsl) and [Animations](#canvas-animation-dsl). To get started quickly, [Glimmer](https://rubygems.org/gems/glimmer) offers [scaffolding](#scaffolding) options for [Apps](#in-production), [Gems](#custom-shell-gem), and [Custom Widgets](#custom-widgets). [Glimmer](https://rubygems.org/gems/glimmer) also includes native-executable [packaging](#packaging--distribution) support, sorely lacking in other libraries, thus enabling the delivery of desktop apps written in [Ruby](https://www.ruby-lang.org/en/) as truly native DMG/PKG/APP files on the [Mac](https://www.apple.com/ca/macos) + [App Store](https://developer.apple.com/macos/distribution/), MSI/EXE files on [Windows](https://www.microsoft.com/en-ca/windows), and [Gem Packaged Shell Scripts](#custom-shell-gem) on [Linux](https://www.linux.org/).
16
12
 
17
13
  [Glimmer receives two updates per month](https://rubygems.org/gems/glimmer-dsl-swt/versions). You can trust [Glimmer](https://rubygems.org/gems/glimmer) with your Ruby desktop GUI development needs. Please make [Glimmer](https://rubygems.org/gems/glimmer) even better by providing feedback and [contributing](#contributing) when possible.
18
14
 
@@ -286,6 +282,8 @@ Glimmer App:
286
282
  - [Cursor](#cursor)
287
283
  - [Layouts](#layouts)
288
284
  - [Layout Data](#layout-data)
285
+ - [Canvas Shape DSL](#canvas-shape-dsl)
286
+ - [Canvas Animation DSL](#canvas-animation-dsl)
289
287
  - [Data-Binding](#data-binding)
290
288
  - [General Examples](#general-examples)
291
289
  - [Combo](#combo)
@@ -359,6 +357,8 @@ Glimmer App:
359
357
  - [Hello, Button!](#hello-button)
360
358
  - [Hello, Link!](#hello-link)
361
359
  - [Hello, Dialog!](#hello-dialog)
360
+ - [Hello, Canvas!](#hello-canvas)
361
+ - [Hello, Canvas Animation!](#hello-canvas-animation)
362
362
  - [Elaborate Samples](#elaborate-samples)
363
363
  - [User Profile](#user-profile)
364
364
  - [Login](#login)
@@ -452,7 +452,7 @@ jgem install glimmer-dsl-swt
452
452
 
453
453
  Or this command if you want a specific version:
454
454
  ```
455
- jgem install glimmer-dsl-swt -v 4.18.0.2
455
+ jgem install glimmer-dsl-swt -v 4.18.2.2
456
456
 
457
457
 
458
458
  ```
@@ -472,7 +472,7 @@ Note: if you're using activerecord or activesupport, keep in mind that Glimmer u
472
472
 
473
473
  Add the following to `Gemfile`:
474
474
  ```
475
- gem 'glimmer-dsl-swt', '~> 4.18.0.2
475
+ gem 'glimmer-dsl-swt', '~> 4.18.2.2
476
476
  '
477
477
  ```
478
478
 
@@ -531,7 +531,7 @@ bin/glimmer samples
531
531
  Below are the full usage instructions that come up when running `glimmer` without args.
532
532
 
533
533
  ```
534
- Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.18.0.2
534
+ Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.18.2.2
535
535
 
536
536
 
537
537
 
@@ -589,6 +589,8 @@ glimmer samples/hello/hello_world.rb samples/hello/hello_tab.rb
589
589
 
590
590
  Launches samples/hello/hello_world.rb and samples/hello_tab.rb at the same time, each in a separate JRuby thread.
591
591
 
592
+ Note: under Zsh (Z Shell), glimmer can only be used in its advanced TUI mode (e.g. `glimmer` and then selecting a task) not the primitive rake task mode (e.g. `glimmer scaffold[app]`)
593
+
592
594
  ### Glimmer Samples
593
595
 
594
596
  You can list available Glimmer samples by running:
@@ -1009,8 +1011,8 @@ Output:
1009
1011
  Name Gem Version Author Description
1010
1012
 
1011
1013
  Css glimmer-dsl-css 1.1.0 AndyMaleh Glimmer DSL for CSS
1012
- Opal glimmer-dsl-opal 0.8.0 AndyMaleh Glimmer DSL for Opal
1013
- Swt glimmer-dsl-swt 4.18.0.2
1014
+ Opal glimmer-dsl-opal 0.10.2 AndyMaleh Glimmer DSL for Opal
1015
+ Swt glimmer-dsl-swt 4.18.2.2
1014
1016
 
1015
1017
  AndyMaleh Glimmer DSL for SWT
1016
1018
  Tk glimmer-dsl-tk 0.0.6 AndyMaleh Glimmer DSL for Tk
@@ -1078,6 +1080,8 @@ With `glimmer-dsl-swt` installed, you may want to run `girb` instead of standard
1078
1080
  girb
1079
1081
  ```
1080
1082
 
1083
+ ![GIRB](images/glimmer-girb.png)
1084
+
1081
1085
  If you cloned [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt) project locally, you may run `bin/girb` instead.
1082
1086
 
1083
1087
  ```
@@ -1343,7 +1347,8 @@ This is not an exaustive list, but should give you a good start in learning Glim
1343
1347
  **Event loop:**
1344
1348
  - `display`: featured in [Tic Tac Toe](#tic-tac-toe)
1345
1349
  - `async_exec`: featured in [Hello, Custom Widget!](#hello-custom-widget) / [Hello, Custom Shell!](#hello-custom-shell)
1346
-
1350
+ - `sync_exec`: executes a block on the event loop synchronously (usually from another thread)
1351
+ - `timer_exec`: executes a block after a delay of time has passed
1347
1352
 
1348
1353
  #### SWT Proxies
1349
1354
 
@@ -2285,6 +2290,179 @@ Also, for a reference, check the SWT API:
2285
2290
 
2286
2291
  https://help.eclipse.org/2019-12/nftopic/org.eclipse.platform.doc.isv/reference/api/index.html
2287
2292
 
2293
+
2294
+ ### Canvas Shape DSL
2295
+
2296
+ Glimmer supports drawing graphics directly on a `canvas` widget via SWT (or any widget for that matter though `canvas` is recommended for drawing).
2297
+
2298
+ This is accomplished via the Shape DSL a sub-DSL of the Glimmer GUI DSL, which makes it possible to draw graphics declaratively with very understandable and maintainable syntax.
2299
+
2300
+ Shape keywords and their args (including defaults) are listed below (they basically match method names and arguments on [org.eclipse.swt.graphics.GC](https://help.eclipse.org/2020-12/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/graphics/GC.html) minus the `draw` or `fill` prefix in downcase):
2301
+ - `arc​(x, y, width, height, startAngle, arcAngle, fill: false)` arc is part of a circle within an oval area, denoted by start angle (degrees) and end angle (degrees)
2302
+ - `focus​(x, y, width, height)` this is just like rectangle but its foreground color is always that of the OS widget focus color (useful when capturing user interaction via a shape)
2303
+ - `image(image, x, y)` [image](#image)
2304
+ - `line(x1, y1, x2, y2)` line
2305
+ - `oval(x, y, width, height, fill: false)` oval if width does not match heigh and circle if width matches height. Can be optionally filled.
2306
+ - `point​(x, y)` point
2307
+ - `polygon(pointArray, fill: false)` polygon consisting of points, which close automatically to form a shape that can be optionally filled (when points only form a line, it does not show up as filled)
2308
+ - `polyline(pointArray)` polyline is just like a polygon, but it does not close up to form a shape, remaining open (unless the points close themselves by having the last point or an intermediate point match the first)
2309
+ - `rectangle(x, y, width, height, fill: false)` standard rectangle, which can be optionally filled
2310
+ - `rectangle(x, y, width, height, arcWidth = 60, arcHeight = 60, fill: false, round: true)` round rectangle, which can be optionally filled, and takes optional extra round angle arguments
2311
+ - `rectangle​(x, y, width, height, vertical = true, fill: true, gradient: true)` gradient rectangle, which is always filled, and takes an optional extra argument to specify true for vertical gradient (default) and false for horizontal gradient
2312
+ - `text(string, x, y, flags = nil)` text with optional flags (flag format is `swt(comma_separated_flags)` where flags can be :draw_delimiter (i.e. new lines), :draw_tab, :draw_mnemonic, and :draw_transparent as explained in [GC API](https://help.eclipse.org/2020-12/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/graphics/GC.html))
2313
+
2314
+ Shape keywords that can be filled with color can take an keyword argument `fill: true` (defaults to false when not specified)
2315
+
2316
+ Optionally, a shape keyword takes a block that can set any attributes from [org.eclipse.swt.graphics.GC](https://help.eclipse.org/2020-12/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/graphics/GC.html) (methods starting with `set`), which enable setting the `background` for filling and `foreground` for drawing.
2317
+
2318
+ Here is a list of supported attributes nestable within a block under shapes:
2319
+ - `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.
2320
+ - `alpha` sets transparency (integer between `0` and `255`)
2321
+ - `antialias` enables antialiasing (SWT style value of `:default`, `:off`, `:on` whereby `:default` applies OS default, which varies per OS)
2322
+ - `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)
2323
+ - `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)
2324
+ - `clipping` clips area of painting (​numeric values for `(x, y, width, height)`)
2325
+ - `fill_rule` sets filling rule (SWT style value of `:fill_even_odd` or `:fill_winding`)
2326
+ - `font` sets font (Hash of `:name`, `:height`, and `:style` just like standard widget font property, or Font/FontProxy object directly)
2327
+ - `foreground` sets draw color for drawable shapes (standard color symbol (e.g. `:red`), `rgb(red_integer, green_integer, blue_integer)` color, or Color/ColorProxy object directly)
2328
+ - `foreground_pattern` sets foreground gradient/image pattern for drawable shape lines (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. `foreground_pattern 2.3, 4.2, 5.4, 7.2, :red, :blue`] / note: this feature isn't extensively tested yet)
2329
+ - `interpolation` sets the interpolation value (SWT style value of `:default`, `:none`, `:low`, `:high`)
2330
+ - `line_cap` sets line cap (SWT style value of `:cap_flat`, `:cap_round`, or `:cap_square`)
2331
+ - `line_dash` line dash float values (automatically sets `line_style` to SWT style value of `:line_custom`)
2332
+ - `line_join` line join style (SWT style value of `:join_miter`, `:join_round`, or `:join_bevel`)
2333
+ - `line_style` line join style (SWT style value of `:line_solid`, `:line_dash`, `:line_dot`, `:line_dashdot`, or `:line_dashdotdot`)
2334
+ - `line_width` line width in integer (used in draw operations)
2335
+ - `text_anti_alias` enables text antialiasing (SWT style value of `:default`, `:off`, `:on` whereby `:default` applies OS default, which varies per OS)
2336
+
2337
+ Example (you may copy/paste in [`girb`](#girb-glimmer-irb-command)):
2338
+
2339
+ ```ruby
2340
+ include Glimmer
2341
+
2342
+ shell {
2343
+ text 'Canvas Example'
2344
+ minimum_size 320, 400
2345
+
2346
+ canvas {
2347
+ background :yellow
2348
+ rectangle(0, 0, 220, 400, fill: true) {
2349
+ background :red
2350
+ }
2351
+ rectangle(50, 20, 300, 150, 30, 50, round: true, fill: true) {
2352
+ background :magenta
2353
+ }
2354
+ rectangle(150, 200, 100, 70, true, gradient: true) {
2355
+ background :dark_magenta
2356
+ foreground :yellow
2357
+ }
2358
+ rectangle(200, 80, 108, 36) {
2359
+ foreground color(:dark_blue)
2360
+ }
2361
+ }
2362
+ }.open
2363
+ ```
2364
+
2365
+ Screenshot:
2366
+
2367
+ ![Canvas Animation Example](images/glimmer-example-canvas.png)
2368
+
2369
+ Learn more at the [Hello, Canvas! Sample](#hello-canvas).
2370
+
2371
+ If you get extremely stuck, remember that you could always default to direct [SWT GC usage]([org.eclipse.swt.graphics.GC](https://help.eclipse.org/2020-12/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/graphics/GC.html) and learn more at the [SWT Graphics Guide](https://www.eclipse.org/articles/Article-SWT-graphics/SWT_graphics.html) and [SWT Image Guide](https://www.eclipse.org/articles/Article-SWT-images/graphics-resources.html#Saving%20Images).
2372
+
2373
+ Example of manually doing the same things as in the above example without relying on the declarative Glimmer Shape DSL:
2374
+
2375
+ ```ruby
2376
+ include Glimmer
2377
+
2378
+ shell {
2379
+ text 'Canvas Manual Example'
2380
+ minimum_size 320, 400
2381
+
2382
+ canvas {
2383
+ background :yellow
2384
+
2385
+ on_paint_control { |event|
2386
+ event.gc.setBackground(color(:red).swt_color)
2387
+ event.gc.fillRectangle(0, 0, 220, 400)
2388
+
2389
+ event.gc.setBackground(color(:magenta).swt_color)
2390
+ event.gc.fillRoundRectangle(50, 20, 300, 150, 30, 50)
2391
+
2392
+ event.gc.setBackground(color(:dark_magenta).swt_color)
2393
+ event.gc.fillGradientRectangle(150, 200, 100, 70, true)
2394
+
2395
+ event.gc.setForeground(color(:dark_blue).swt_color)
2396
+ event.gc.drawRectangle(200, 80, 108, 36)
2397
+ }
2398
+ }
2399
+ }.open
2400
+ ```
2401
+
2402
+ In any case, if there is anything missing you would like added to the Glimmer Shape DSL that you saw available in the SWT APIs, you may [report an issue](https://github.com/AndyObtiva/glimmer-dsl-swt/issues) or implement yourself and [contribute](#contributing) via a Pull Request.
2403
+
2404
+ ### Canvas Animation DSL
2405
+
2406
+ (note: this is a very new feature of Glimmer. It may change a bit while getting battle tested. As always, you could default to basic SWT usage if needed.)
2407
+
2408
+ Glimmer additionally provides built-in support for animations via a declarative Animation DSL, another sub-DSL of the Glimmer GUI DSL.
2409
+
2410
+ Animations take advantage of multi-threading, each animation runs in its own independent thread of execution while updating the GUI asynchronously.
2411
+
2412
+ This example says it all (it moves a tiny red square across a blue background) (you may copy/paste in [`girb`](#girb-glimmer-irb-command)):
2413
+
2414
+ ```ruby
2415
+ include Glimmer
2416
+
2417
+ shell {
2418
+ text 'Canvas Animation Example'
2419
+ minimum_size 400, 400
2420
+
2421
+ canvas {
2422
+ animation {
2423
+ every 0.1
2424
+
2425
+ frame { |index|
2426
+ background rgb(index%100, index%100 + 100, index%55 + 200)
2427
+ rectangle(index, index, 20, 20, fill: true) {
2428
+ background :red
2429
+ }
2430
+ }
2431
+ }
2432
+ }
2433
+ }.open
2434
+ ```
2435
+
2436
+ Screenshot:
2437
+
2438
+ ![Canvas Animation Example](images/glimmer-example-canvas-animation.png)
2439
+
2440
+ Keywords:
2441
+ - `animation` declares an animation under a canvas, which renders frames using a frame block indefinitely or finitely depending on (cycle_count/frame_count) properties
2442
+ - `every` specifies delay in seconds between every two frame renders
2443
+ - `frame` a block that can contain Shape DSL syntax that is rendered dynamically with variables calculated on the fly
2444
+ - `cycle` a property that takes an array to cycle into a second variable for the `frame` block
2445
+ - `cycle_count` an optional cycle count limit after which the animation stops
2446
+ - `frame_count` an optional frame count limit after which the animation stops
2447
+ - `started` a boolean indicating if the animation is started right away or stopped waiting for manual startup via `#start` method
2448
+
2449
+ API of Animation Object (returned from `animation` keyword):
2450
+ - `#start` starts an animation that is indefinite or has never been started before (i.e. having `started: false` option). Otherwise, resumes a stopped animation that has not been completed.
2451
+ - `#stop` stops animation. Maintains progress when `frame_count`, `cycle_count`, or `duration_limit` are set and haven't finished. That way, if `#start` is called, animation resumes from where it stopped exactly to completion.
2452
+ - `#restart` restarts animation, restarting progress of `frame_count`, `cycle_count`, and `duration_limit` if set.
2453
+ - `#started?` returns whether animation started
2454
+ - `#stopped?` returns whether animation stopped
2455
+ - `#indefinite?` (alias `infinite?`) returns true if animation does not have `frame_count`, `cycle_count`, or `duration_limit`
2456
+ - `#finite?` returns true if animation has `frame_count`, `cycle_count` (with `cycle`), or `duration_limit`
2457
+ - `#frame_count_limited?` returns true if `frame_count` is specified
2458
+ - `#cycle_enabled?` returns true if `cycle` is specified
2459
+ - `#cycle_limited?` returns true if `cycle_count` is specified
2460
+ - `#duration_limited?` returns true if `duration_limit` is specified
2461
+
2462
+ Learn more at the [Hello, Canvas Animation! Sample](#hello-canvas-animation).
2463
+
2464
+ If there is anything missing you would like added to the Glimmer Animation DSL that you saw available in the SWT APIs, you may [report an issue](https://github.com/AndyObtiva/glimmer-dsl-swt/issues) or implement yourself and [contribute](#contributing) via a Pull Request.
2465
+
2288
2466
  ### Data-Binding
2289
2467
 
2290
2468
  Data-binding is done with `bind` command following widget property to bind and taking model and bindable attribute as arguments.
@@ -3468,12 +3646,12 @@ Example.new
3468
3646
 
3469
3647
  Application name (shows up on the Mac in top menu bar) and version may be specified upon [packaging](#packaging--distribution) by specifying "-Bmac.CFBundleName" and "-Bmac.CFBundleVersion" options.
3470
3648
 
3471
- Still, if you would like proper application name to show up on the Mac top menu bar during development, you may do so by invoking the SWT Display.setAppName method before any Display object has been instantiated (i.e. before any Glimmer widget like shell has been declared).
3649
+ Still, if you would like proper application name to show up on the Mac top menu bar during development, you may do so by invoking the SWT `Display.app_name=` method before any Display object has been instantiated (i.e. before any Glimmer widget like shell has been declared).
3472
3650
 
3473
3651
  Example (you may copy/paste in [`girb`](#girb-glimmer-irb-command)):
3474
3652
 
3475
3653
  ```ruby
3476
- Display.setAppName('Glimmer Demo')
3654
+ Display.app_name = 'Glimmer Demo'
3477
3655
 
3478
3656
  shell(:no_resize) {
3479
3657
  text "Glimmer"
@@ -3483,7 +3661,7 @@ shell(:no_resize) {
3483
3661
  }.open
3484
3662
  ```
3485
3663
 
3486
- Also, you may invoke `Display.setAppVersion('1.0.0')` if needed for OS app version identification reasons during development, replacing `'1.0.0'` with your application version.
3664
+ Also, you may invoke `Display.app_version = '1.0.0'` if needed for OS app version identification reasons during development, replacing `'1.0.0'` with your application version.
3487
3665
 
3488
3666
  #### Checkbox Group Widget
3489
3667
 
@@ -4357,6 +4535,34 @@ Hello, Dialog! Open Dialog
4357
4535
 
4358
4536
  ![Hello Dialog Open Dialog](images/glimmer-hello-dialog-open-dialog.png)
4359
4537
 
4538
+ #### Hello, Canvas!
4539
+
4540
+ This sample demonstrates the use of the `canvas` widget and [Shape DSL](#canvas-shape-dsl) in Glimmer.
4541
+
4542
+ Code:
4543
+
4544
+ [samples/hello/hello_canvas.rb](samples/hello/hello_canvas.rb)
4545
+
4546
+ Hello, Canvas!
4547
+
4548
+ ![Hello Canvas](images/glimmer-hello-canvas.png)
4549
+
4550
+ #### Hello, Canvas Animation!
4551
+
4552
+ This sample demonstrates the use of the `canvas` widget and [Animation DSL](#canvas-animation-dsl) in Glimmer.
4553
+
4554
+ Code:
4555
+
4556
+ [samples/hello/hello_canvas_animation.rb](samples/hello/hello_canvas_animation.rb)
4557
+
4558
+ Hello, Canvas Animation!
4559
+
4560
+ ![Hello Canvas Animation](images/glimmer-hello-canvas-animation.png)
4561
+
4562
+ Hello, Canvas Animation Another Frame!
4563
+
4564
+ ![Hello Canvas Animation Frame 2](images/glimmer-hello-canvas-animation-frame2.png)
4565
+
4360
4566
  ### Elaborate Samples
4361
4567
 
4362
4568
  For more elaborate samples, check the following:
@@ -4454,7 +4660,7 @@ Gladiator is a good demonstration of:
4454
4660
 
4455
4661
  #### Timer
4456
4662
 
4457
- [<img alt="Glimmer Timer Icon" src="https://raw.githubusercontent.com/AndyObtiva/glimmer-cs-timer/master/images/glimmer-timer-logo.png" height=40 /> Timer](https://github.com/AndyObtiva/glimmer-cs-timer) is a sample app demonstrating data-binding, multi-threading, and Java (Sound) library integration in a desktop application.
4663
+ [<img alt="Glimmer Timer Icon" src="https://raw.githubusercontent.com/AndyObtiva/glimmer-cs-timer/master/images/glimmer-timer-logo.png" height=40 /> Timer](https://github.com/AndyObtiva/glimmer-cs-timer) is a sample app demonstrating data-binding, multi-threading, and JSound (Java Sound) library integration in a desktop application.
4458
4664
 
4459
4665
  [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer-cs-timer/master/glimmer-timer-screenshot.png" />](https://github.com/AndyObtiva/glimmer-cs-timer)
4460
4666
 
@@ -4547,6 +4753,8 @@ require_relative '../app/my_application.rb'
4547
4753
 
4548
4754
  ### javapackager Extra Arguments
4549
4755
 
4756
+ (note: currently `Glimmer::RakeTask::Package.javapackager_extra_args` is only honored when packaging from bash, not zsh)
4757
+
4550
4758
  In order to explicitly configure javapackager, Mac package attributes, or sign your Mac app to distribute on the App Store, you can follow more advanced instructions for `javapackager` here:
4551
4759
  - https://docs.oracle.com/javase/9/tools/javapackager.htm#JSWOR719
4552
4760
  - https://docs.oracle.com/javase/8/docs/technotes/tools/unix/javapackager.html
@@ -4655,6 +4863,16 @@ By the way, keep in mind that during normal operation, it does also indicate a f
4655
4863
  Exec failed with code 2 command [[/usr/bin/SetFile, -c, icnC, /var/folders/4_/g1sw__tx6mjdgyh3mky7vydc0000gp/T/fxbundler4076750801763032201/images/MathBowling/.VolumeIcon.icns] in unspecified directory
4656
4864
  ```
4657
4865
 
4866
+ 3. Zsh (Z Shell)
4867
+
4868
+ Currently, `Glimmer::RakeTask::Package.javapackager_extra_args` is only honored when packaging from bash, not zsh.
4869
+
4870
+ You can get around that in zsh by running glimmer package commands with `bash -c` prefix:
4871
+
4872
+ ```
4873
+ bash -c 'glimmer package'
4874
+ ```
4875
+
4658
4876
  ## App Updates
4659
4877
 
4660
4878
  Glimmer already supports automatic (and manual) app updates via the Mac App Store for Mac apps. Simply run the `glimmer package` command with the Mac App Store keys configured as per [Mac Application Distribution](mac-application-distribution) instructions and you get automatic (and manual) app update support courtesy of the Mac App Store.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.18.0.2
1
+ 4.18.2.2
@@ -2,17 +2,17 @@
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.0.2 ruby lib
5
+ # stub: glimmer-dsl-swt 4.18.2.2 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "glimmer-dsl-swt".freeze
9
- s.version = "4.18.0.2"
9
+ s.version = "4.18.2.2"
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-01-13"
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 version of Ruby. Glimmer's main innovation is a declarative Ruby DSL that enables productive and efficient authoring of desktop application user-interfaces while 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. 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
14
+ s.date = "2021-01-22"
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]
18
18
  s.extra_rdoc_files = [
@@ -42,6 +42,7 @@ Gem::Specification.new do |s|
42
42
  "lib/glimmer/data_binding/table_items_binding.rb",
43
43
  "lib/glimmer/data_binding/tree_items_binding.rb",
44
44
  "lib/glimmer/data_binding/widget_binding.rb",
45
+ "lib/glimmer/dsl/swt/animation_expression.rb",
45
46
  "lib/glimmer/dsl/swt/async_exec_expression.rb",
46
47
  "lib/glimmer/dsl/swt/bind_expression.rb",
47
48
  "lib/glimmer/dsl/swt/block_property_expression.rb",
@@ -73,6 +74,7 @@ Gem::Specification.new do |s|
73
74
  "lib/glimmer/dsl/swt/radio_group_selection_data_binding_expression.rb",
74
75
  "lib/glimmer/dsl/swt/rgb_expression.rb",
75
76
  "lib/glimmer/dsl/swt/rgba_expression.rb",
77
+ "lib/glimmer/dsl/swt/shape_expression.rb",
76
78
  "lib/glimmer/dsl/swt/shell_expression.rb",
77
79
  "lib/glimmer/dsl/swt/swt_expression.rb",
78
80
  "lib/glimmer/dsl/swt/sync_exec_expression.rb",
@@ -89,9 +91,12 @@ Gem::Specification.new do |s|
89
91
  "lib/glimmer/rake_task/scaffold.rb",
90
92
  "lib/glimmer/swt/color_proxy.rb",
91
93
  "lib/glimmer/swt/cursor_proxy.rb",
94
+ "lib/glimmer/swt/custom/animation.rb",
92
95
  "lib/glimmer/swt/custom/checkbox_group.rb",
93
96
  "lib/glimmer/swt/custom/code_text.rb",
97
+ "lib/glimmer/swt/custom/drawable.rb",
94
98
  "lib/glimmer/swt/custom/radio_group.rb",
99
+ "lib/glimmer/swt/custom/shape.rb",
95
100
  "lib/glimmer/swt/date_time_proxy.rb",
96
101
  "lib/glimmer/swt/directory_dialog_proxy.rb",
97
102
  "lib/glimmer/swt/display_proxy.rb",
@@ -105,6 +110,7 @@ Gem::Specification.new do |s|
105
110
  "lib/glimmer/swt/menu_proxy.rb",
106
111
  "lib/glimmer/swt/message_box_proxy.rb",
107
112
  "lib/glimmer/swt/packages.rb",
113
+ "lib/glimmer/swt/properties.rb",
108
114
  "lib/glimmer/swt/sash_form_proxy.rb",
109
115
  "lib/glimmer/swt/scrolled_composite_proxy.rb",
110
116
  "lib/glimmer/swt/shell_proxy.rb",
@@ -132,6 +138,8 @@ Gem::Specification.new do |s|
132
138
  "samples/elaborate/user_profile.rb",
133
139
  "samples/hello/hello_browser.rb",
134
140
  "samples/hello/hello_button.rb",
141
+ "samples/hello/hello_canvas.rb",
142
+ "samples/hello/hello_canvas_animation.rb",
135
143
  "samples/hello/hello_checkbox.rb",
136
144
  "samples/hello/hello_checkbox_group.rb",
137
145
  "samples/hello/hello_combo.rb",
@@ -174,7 +182,7 @@ Gem::Specification.new do |s|
174
182
  s.specification_version = 4
175
183
 
176
184
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
177
- s.add_runtime_dependency(%q<glimmer>.freeze, ["~> 1.0.7"])
185
+ s.add_runtime_dependency(%q<glimmer>.freeze, ["~> 1.0.8"])
178
186
  s.add_runtime_dependency(%q<super_module>.freeze, [">= 1.4.1", "< 2.0.0"])
179
187
  s.add_runtime_dependency(%q<nested_inherited_jruby_include_package>.freeze, [">= 0.3.0", "< 2.0.0"])
180
188
  s.add_runtime_dependency(%q<puts_debuggerer>.freeze, [">= 0.11.0", "< 2.0.0"])
@@ -193,7 +201,7 @@ Gem::Specification.new do |s|
193
201
  s.add_development_dependency(%q<simplecov>.freeze, ["~> 0.16.1"])
194
202
  s.add_development_dependency(%q<simplecov-lcov>.freeze, ["~> 0.7.0"])
195
203
  else
196
- s.add_dependency(%q<glimmer>.freeze, ["~> 1.0.7"])
204
+ s.add_dependency(%q<glimmer>.freeze, ["~> 1.0.8"])
197
205
  s.add_dependency(%q<super_module>.freeze, [">= 1.4.1", "< 2.0.0"])
198
206
  s.add_dependency(%q<nested_inherited_jruby_include_package>.freeze, [">= 0.3.0", "< 2.0.0"])
199
207
  s.add_dependency(%q<puts_debuggerer>.freeze, [">= 0.11.0", "< 2.0.0"])
@@ -213,7 +221,7 @@ Gem::Specification.new do |s|
213
221
  s.add_dependency(%q<simplecov-lcov>.freeze, ["~> 0.7.0"])
214
222
  end
215
223
  else
216
- s.add_dependency(%q<glimmer>.freeze, ["~> 1.0.7"])
224
+ s.add_dependency(%q<glimmer>.freeze, ["~> 1.0.8"])
217
225
  s.add_dependency(%q<super_module>.freeze, [">= 1.4.1", "< 2.0.0"])
218
226
  s.add_dependency(%q<nested_inherited_jruby_include_package>.freeze, [">= 0.3.0", "< 2.0.0"])
219
227
  s.add_dependency(%q<puts_debuggerer>.freeze, [">= 0.11.0", "< 2.0.0"])