glimmer-dsl-swt 4.22.2.5 → 4.23.0.1

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: 1ddae7932813d7434f6ea1013668ca03d899eae9dc6a0aacece9139f1172f98a
4
- data.tar.gz: dcf0088e2b10c5861f5833c6962c3f253e043f82e7d304fdd35b3a923241c5ee
3
+ metadata.gz: 9aabbb159eb1d27e98f8d8a51a9068c43e33a91e4bf249f44d0a965af81a4d8a
4
+ data.tar.gz: b4e45c49a1347c57ff6e7c8a5798dec9dba7d591e1f8aaf26f773b2708908c97
5
5
  SHA512:
6
- metadata.gz: fd84fc1cebaf9e93eff102853f27198cc3bfb4bd5cdad95c63a26a73a05e9331caf54c430883e14f41e8e58688d5e889d9ad0c9758da59341b98f60ec59a4330
7
- data.tar.gz: 99021203e9835c9204c248f6bffd333f48cf99dccc3ad5b6a223bb2db61217ff364110948b46da7999e9c3c1b0b8f452040270daf12e18f1d79f4b48b3a84808
6
+ metadata.gz: 64fb826450b35b43049a31b8f36bbdceb9d24c28e3b193e0d73322ca81f4d0f429a0a678ebd6c61c1d23ad3bd4e04618dabd95b0d6462ee32ec202a24be66842
7
+ data.tar.gz: 9cc1a23579587dd4694a496052a83a4f886ec7762622526595831784c4531fa1c9345d2c6ccc67f8cb93b8fef1e69a510e5b0aa471641db7f4746fd0f83e0e04
data/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Change Log
2
2
 
3
+ ## 4.23.0.1
4
+
5
+ - Add "Speed" menu to the Tetris sample
6
+ - Add "Show Next Block Preview" View menu item to the Tetris sample
7
+ - Document Glimmer::UI::Application alias for Glimmer::UI::CustomShell
8
+
9
+ ## 4.23.0.0
10
+
11
+ - Upgrade to SWT 4.23
12
+ - Upgrade to JDK 18
13
+
14
+ ## 4.22.2.6
15
+
16
+ - Fix issue whereby updating `string` property on the `text`/`string` shape does not trigger a redraw on the shape because the text dimensions remained the same despite the change of content (e.g. switching from `string` content of letter `A` to `S` results in the same dimensions)
17
+ - Canvas Shape DSL graduated from Beta to Final
18
+
3
19
  ## 4.22.2.5
4
20
 
5
21
  - Update all samples to match the [GLIMMER_STYLE_GUIDE.md](/docs/reference/GLIMMER_STYLE_GUIDE.md)
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.22.2.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.23.0.1
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)
@@ -8,6 +8,8 @@
8
8
 
9
9
  **(The Original Glimmer Library Handling the World’s Ruby GUI Needs Since 2007. Beware of Imitators!)**
10
10
 
11
+ [GLIMMER VIDEO TUTORIAL CHANNEL](https://www.youtube.com/channel/UC5hzDE23HZXsZLAxYk2UJEw)
12
+
11
13
  [Glimmer](https://github.com/AndyObtiva/glimmer) DSL for [SWT](https://www.eclipse.org/swt/) 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](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#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](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#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 afterwards. Not only does Glimmer provide a large set of GUI [widgets](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#widgets), but it also supports drawing Canvas Graphics like [Shapes](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#canvas-shape-dsl) and [Animations](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#canvas-animation-dsl). To get started quickly, [Glimmer](https://rubygems.org/gems/glimmer) offers [scaffolding](docs/reference/GLIMMER_COMMAND.md#scaffolding) options for [Apps](#in-production), [Gems](docs/reference/GLIMMER_COMMAND.md#custom-shell-gem), and [Custom Widgets](docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#custom-widgets). [Glimmer](https://rubygems.org/gems/glimmer) also includes native-executable [packaging](docs/reference/GLIMMER_PACKAGING_AND_DISTRIBUTION.md) 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), MSI/EXE files on [Windows](https://www.microsoft.com/en-ca/windows), and DEB/RPM files on [Linux](https://www.linux.org/). [Glimmer](https://github.com/AndyObtiva/glimmer) was the [first Ruby gem](https://rubygems.org/gems/glimmer) to bring [SWT](https://www.eclipse.org/swt/) (Standard Widget Toolkit) to [Ruby](https://www.ruby-lang.org/en/), thanks to creator [Andy Maleh](https://andymaleh.blogspot.com/), EclipseCon/EclipseWorld/RubyConf speaker.
12
14
 
13
15
  [<img src="https://covers.oreillystatic.com/images/9780596519650/lrg.jpg" width=105 /><br />
@@ -17,7 +19,7 @@ Featured in JRuby Cookbook](http://shop.oreilly.com/product/9780596519650.do) an
17
19
 
18
20
  ![Eclipse SWT RCP NASA Mars Rover](/images/glimmer-eclipse-swt-rcp-nasa-mars-rover.png)
19
21
 
20
- [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.22.2.5 includes [SWT 4.22](https://download.eclipse.org/eclipse/downloads/drops4/R-4.22-202111241800/), which was released on November 24, 2021. 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.
22
+ [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.23.0.1 includes [SWT 4.23](https://download.eclipse.org/eclipse/downloads/drops4/R-4.23-202203080310/), which was released on March 8, 2022. 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.
21
23
 
22
24
  **Starting in version 4.20.0.0, [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) comes with the new [***Shine***](/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#shine) syntax** for highly intuitive and visually expressive View/Model Attribute Mapping, relying on `<=>` for bidirectional (two-way) data-binding and `<=` for unidirectional (one-way) data-binding, providing an alternative to the `bind` keyword.
23
25
 
@@ -27,9 +29,9 @@ Please help make [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt
27
29
  DSL | Platforms | Native? | Vector Graphics? | Pros | Cons | Prereqs
28
30
  ----|-----------|---------|------------------|------|------|--------
29
31
  [Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)](https://github.com/AndyObtiva/glimmer-dsl-swt) | Mac / Windows / Linux | Yes | Yes (Canvas Shape DSL) | Very Mature / Scaffolding / Native Executable Packaging / Custom Widgets | Slow JRuby Startup Time / Heavy Memory Footprint | Java / JRuby
30
- [Glimmer DSL for Opal (Pure Ruby Web GUI and Auto-Webifier of Desktop Apps)](https://github.com/AndyObtiva/glimmer-dsl-opal) | All Web Browsers | No | Yes (Canvas Shape DSL) | Simpler than All JavaScript Technologies / Auto-Webify Desktop Apps | Setup Process / Only Rails 5 Support for Now | Rails
32
+ [Glimmer DSL for Opal (Pure Ruby Web GUI and Auto-Webifier of Desktop Apps)](https://github.com/AndyObtiva/glimmer-dsl-opal) | All Web Browsers | No | Yes (Canvas Shape DSL) | Simpler than All JavaScript Technologies / Auto-Webify Desktop Apps | Setup Process / Incomplete Alpha | Rails
31
33
  [Glimmer DSL for LibUI (Prerequisite-Free Ruby Desktop Development GUI Library)](https://github.com/AndyObtiva/glimmer-dsl-libui) | Mac / Windows / Linux | Yes | Yes (Area API) | Fast Startup Time / Light Memory Footprint | LibUI is an Incomplete Mid-Alpha Only | None Other Than MRI Ruby
32
- [Glimmer DSL for Tk (MRI Ruby Desktop Development GUI Library)](https://github.com/AndyObtiva/glimmer-dsl-tk) | Mac / Windows / Linux | Some Native-Themed Widgets (Not Truly Native) | Yes (Canvas) | Fast Startup Time / Light Memory Footprint | Widgets Do Not Look Truly Native, Espcially on Linux | ActiveTcl / MRI Ruby
34
+ [Glimmer DSL for Tk (Ruby Tk Desktop Development GUI Library)](https://github.com/AndyObtiva/glimmer-dsl-tk) | Mac / Windows / Linux | Some Native-Themed Widgets (Not Truly Native) | Yes (Canvas) | Fast Startup Time / Light Memory Footprint | Widgets Do Not Look Truly Native, Espcially on Linux | ActiveTcl / MRI Ruby
33
35
  [Glimmer DSL for GTK (Ruby-GNOME Desktop Development GUI Library)](https://github.com/AndyObtiva/glimmer-dsl-gtk) | Mac / Windows / Linux | Only on Linux | Yes (Cairo) | Complete Access to GNOME Features on Linux (Forte) | Not Native on Mac and Windows | None Other Than MRI Ruby on Linux / Brew Packages on Mac / MSYS & MING Toolchains on Windows / MRI Ruby
34
36
  [Glimmer DSL for FX (FOX Toolkit Ruby Desktop Development GUI Library)](https://github.com/AndyObtiva/glimmer-dsl-fx) | Mac (requires XQuartz) / Windows / Linux | No | Yes (Canvas) | No Prerequisites on Windows (Forte Since Binaries Are Included Out of The Box) | Widgets Do Not Look Native / Mac Usage Obtrusively Starts XQuartz | None Other Than MRI Ruby on Windows / XQuarts on Mac / MRI Ruby
35
37
  [Glimmer DSL for JFX (JRuby JavaFX Desktop Development GUI Library)](https://github.com/AndyObtiva/glimmer-dsl-jfx) | Mac / Windows / Linux | No | Yes (javafx.scene.shape and javafx.scene.canvas) | Rich in Custom Widgets | Slow JRuby Startup Time / Heavy Memory Footprint / Widgets Do Not Look Native | Java / JRuby / JavaFX SDK
@@ -240,7 +242,7 @@ Glimmer app:
240
242
 
241
243
  ## Background
242
244
 
243
- [Ruby](https://www.ruby-lang.org) is a dynamically-typed object-oriented language, which provides great productivity gains due to its powerful expressive syntax and dynamic nature. While it is proven by the [Ruby](https://www.ruby-lang.org) on Rails framework for web development, it currently lacks a robust platform-independent framework for building desktop applications. Given that [Java](https://www.oracle.com/ca-en/java/) libraries can now be utilized in Ruby code through JRuby, Eclipse technologies, such as [SWT](https://www.eclipse.org/swt/), JFace, and RCP can help fill the gap of desktop application development with Ruby.
245
+ [Ruby](https://www.ruby-lang.org) is a dynamically-typed object-oriented language, which provides great productivity gains due to its expressive syntax and dynamic nature. While it is proven by the [Ruby](https://www.ruby-lang.org) on Rails framework for web development, it currently lacks a robust platform-independent framework for building desktop applications. Given that [Java](https://www.oracle.com/ca-en/java/) libraries can now be utilized in Ruby code through JRuby, Eclipse technologies, such as [SWT](https://www.eclipse.org/swt/), JFace, and RCP can help fill the gap of desktop application development with Ruby.
244
246
 
245
247
  ## Software Architecture
246
248
 
@@ -299,10 +301,10 @@ https://www.eclipse.org/swt/faq.php
299
301
 
300
302
  ## Pre-requisites
301
303
 
302
- - JDK 17 (17.0.1) (find at https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html / Ensure PATH includes Java bin directory for `jpackage` command to work when packaging Glimmer applications)
303
- - [RVM](http://rvm.io) on Mac & Linux (not available on Windows)
304
+ - JDK 18 (find at https://www.oracle.com/java/technologies/downloads / Ensure `PATH` env var includes Java bin directory for `jpackage` command to work when packaging Glimmer applications / Preferably setup `JAVA_HOME` env var too to point to JDK home directory before installing JRuby)
305
+ - [RVM](http://rvm.io) on Mac & Linux (not needed on Windows)
304
306
  - JRuby 9.3.3.0 (supporting Ruby 2.6.x syntax) (get via [RVM](http://rvm.io) on Mac and Linux by running `rvm install jruby-9.3.3.0`; On Windows, find at [https://www.jruby.org/download](https://www.jruby.org/download))
305
- - SWT 4.22 (already included in the [glimmer-dsl-swt](https://rubygems.org/gems/glimmer-dsl-swt) gem). Note that SWT supports ARM64/AARCH64 on Mac and Linux since version 4.20.
307
+ - SWT 4.23 (already included in the [glimmer-dsl-swt](https://rubygems.org/gems/glimmer-dsl-swt) gem). Note that SWT supports ARM64/AARCH64 on Mac and Linux since version 4.20
306
308
  - Git (comes with Mac and Linux. Install on Windows: https://git-scm.com/download/win )
307
309
 
308
310
  Glimmer might still work on other versions of Java, JRuby and SWT, but there are no guarantees, so it is best to stick to the pre-requisites outlined above.
@@ -331,7 +333,7 @@ jgem install glimmer-dsl-swt
331
333
 
332
334
  Or this command if you want a specific version:
333
335
  ```
334
- jgem install glimmer-dsl-swt -v 4.22.2.5
336
+ jgem install glimmer-dsl-swt -v 4.23.0.1
335
337
  ```
336
338
 
337
339
  `jgem` is JRuby's version of `gem` command.
@@ -359,7 +361,7 @@ Note: if you're using activerecord or activesupport, keep in mind that Glimmer u
359
361
 
360
362
  Add the following to `Gemfile`:
361
363
  ```
362
- gem 'glimmer-dsl-swt', '~> 4.22.2.5'
364
+ gem 'glimmer-dsl-swt', '~> 4.23.0.1'
363
365
  ```
364
366
 
365
367
  And, then run:
@@ -382,7 +384,7 @@ glimmer
382
384
  ```
383
385
 
384
386
  ```
385
- Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.22.2.5
387
+ Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.23.0.1
386
388
 
387
389
  Usage: glimmer [--bundler] [--pd] [--quiet] [--debug] [--log-level=VALUE] [[ENV_VAR=VALUE]...] [[-jruby-option]...] (application.rb or task[task_args]) [[application2.rb]...]
388
390
 
@@ -459,13 +461,15 @@ In a nutshell, the Glimmer GUI DSL syntax consists mainly of:
459
461
 
460
462
  1. Keywords
461
463
 
464
+ Widgets are declared with keywords denoting their name in underscored format.
465
+
462
466
  Example of a keyword representing a table widget:
463
467
 
464
468
  ```ruby
465
469
  table
466
470
  ```
467
471
 
468
- 2. Style/Args
472
+ Widgets may optionally receive symbol-style/args within parentheses (otherwise, when there are no style/args, the parentheses are left out).
469
473
 
470
474
  Example of a multi-line selection table widget:
471
475
 
@@ -473,7 +477,9 @@ Example of a multi-line selection table widget:
473
477
  table(:multi)
474
478
  ```
475
479
 
476
- 3. Content/Properties
480
+ 2. Content/Properties
481
+
482
+ Widget content is always housed within a curly-brace (`{}`) style block.
477
483
 
478
484
  Example of a multi-line selection table widget with a table column as content that has a header `text` property as 'Name'.
479
485
 
@@ -485,6 +491,37 @@ table(:multi) {
485
491
  }
486
492
  ```
487
493
 
494
+ 3. Listeners
495
+
496
+ Listeners embody the [Observer Design Pattern](https://en.wikipedia.org/wiki/Observer_pattern) and always start with `on_` followed by an event name (e.g. `on_widget_selected`). Also, they are an exception to Glimmer's syntax that requires a `do; end` style block to clearly demarcate as logic as opposed to View syntax.
497
+
498
+ Example of a button widget with a `text` property and an `on_widget_selected` listener.
499
+
500
+ ```ruby
501
+ button {
502
+ text 'Click'
503
+
504
+ on_widget_selected do
505
+ message_box {
506
+ text 'Clicked'
507
+ message 'Thank you for clicking!'
508
+ }.open
509
+ end
510
+ }
511
+ ```
512
+
513
+ 4. Methods
514
+
515
+ Widgets have methods that invoke operations on them. Sometimes, they are required to be called in order to display the widgets (like the `open` method on `shell` and `message_box`)
516
+
517
+ Example of a shell with a `text` property and an invoked `open` method operation.
518
+
519
+ ```ruby
520
+ shell {
521
+ text 'Hello, World!'
522
+ }.open
523
+ ```
524
+
488
525
  If you need more widgets, you can check out the [Nebula Project](https://github.com/AndyObtiva/glimmer-cw-nebula) (50+ enterprise-grade custom widgets)
489
526
 
490
527
  Learn more at:
@@ -530,10 +567,14 @@ If you have a Glimmer app you would like referenced here, please mention in a Pu
530
567
 
531
568
  ### Are We There Yet?
532
569
 
570
+ This [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) application connects to a database using [ActiveRecord](https://rubygems.org/gems/activerecord).
571
+
533
572
  [<img alt="Are We There Yet Logo" src="https://raw.githubusercontent.com/AndyObtiva/are-we-there-yet/master/are-we-there-yet-logo.svg" width="40" />Are We There Yet?](https://github.com/AndyObtiva/are-we-there-yet): A tool that helps you learn when your small projects will finish
534
573
 
535
574
  ### Garderie Rainbow Daily Agenda
536
575
 
576
+ This [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) application connects to a [Rails](https://rubyonrails.org/) server to submit an application.
577
+
537
578
  [<img alt="Garderie Rainbow Daily Agenda Logo" src="https://github.com/AndyObtiva/garderie_rainbow_daily_agenda/raw/master/images/garderie_rainbow_daily_agenda_logo.png" width="40" />Garderie Rainbow Daily Agenda](https://github.com/AndyObtiva/garderie_rainbow_daily_agenda): A child nursery daily agenda reporting desktop app
538
579
 
539
580
  ### Glimmer Gab
@@ -552,6 +593,10 @@ If you have a Glimmer app you would like referenced here, please mention in a Pu
552
593
 
553
594
  [Befunge 98 GUI](https://github.com/AndyObtiva/befunge98/tree/gui)
554
595
 
596
+ ### Glimmer Klondike Solitaire
597
+
598
+ [<img alt="Glimmer Klondike Solitaire Icon" src="https://raw.githubusercontent.com/AndyObtiva/glimmer_klondike_solitaire/master/icons/linux/Glimmer%20Klondike%20Solitaire.png" height=40 /> Glimmer Klondike Solitaire](https://github.com/AndyObtiva/glimmer_klondike_solitaire)
599
+
555
600
  ### Glimmer Metronome
556
601
 
557
602
  [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer_metronome/master/icons/linux/Glimmer%20Metronome.png" height=40 /> Glimmer Metronome](https://github.com/AndyObtiva/glimmer_metronome)
@@ -597,6 +642,7 @@ Learn more by reading the [GPG](https://github.com/AndyObtiva/glimmer/blob/maste
597
642
 
598
643
  ## Resources
599
644
 
645
+ * [Glimmer DSL for SWT Video Tutorials](https://andymaleh.blogspot.com/search/label/Tutorial+SWT) ([Video Tutorial Playlist](https://www.youtube.com/watch?v=Mi5phsSdNAA&list=PLSN9HhZ_0-n741vRa_dL-M81cLbqD_kem) and [Video Tutorial Channel](https://www.youtube.com/channel/UC5hzDE23HZXsZLAxYk2UJEw))
600
646
  * [Code Master Blog](http://andymaleh.blogspot.com/search/label/Glimmer)
601
647
  * [JRuby Cookbook by Justin Edelson & Henry Liu](http://shop.oreilly.com/product/9780596519650.do)
602
648
  * [InfoQ Article](http://www.infoq.com/news/2008/02/glimmer-jruby-swt)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.22.2.5
1
+ 4.23.0.1
@@ -332,8 +332,8 @@ This is not an exaustive list, but should give you a good start in learning Glim
332
332
  - `time`: featured in [Hello, Table!](/docs/reference/GLIMMER_SAMPLES.md#hello-table) / [Hello, Date Time!](/docs/reference/GLIMMER_SAMPLES.md#hello-date-time)
333
333
  - `tool_bar`: featured in [Hello, Tool Bar!](/docs/reference/GLIMMER_SAMPLES.md#hello-tool-bar)
334
334
  - `tool_item`: featured in [Hello, Tool Bar!](/docs/reference/GLIMMER_SAMPLES.md#hello-tool-bar)
335
- - Glimmer::UI::CustomWidget: ability to define any keyword as a custom widget - featured in [Hello, Custom Widget!](/docs/reference/GLIMMER_SAMPLES.md#hello-custom-widget)
336
- - Glimmer::UI::CustomShell: ability to define any keyword as a custom shell (aka custom window) that opens in a new browser window (tab) automatically unless there is no shell open in the current browser window (tab) - featured in [Hello, Custom Shell!](/docs/reference/GLIMMER_SAMPLES.md#hello-custom-shell)
335
+ - `Glimmer::UI::CustomWidget`: ability to define any keyword as a custom widget - featured in [Hello, Custom Widget!](/docs/reference/GLIMMER_SAMPLES.md#hello-custom-widget)
336
+ - `Glimmer::UI::CustomShell` (alias: `Glimmer::UI::Application`): ability to define any keyword as a custom shell (aka custom window or app) - featured in [Hello, Custom Shell!](/docs/reference/GLIMMER_SAMPLES.md#hello-custom-shell)
337
337
 
338
338
  **Layouts:**
339
339
  - `grid_layout`: featured in [Hello, Layout!](/docs/reference/GLIMMER_SAMPLES.md#hello-layout) / [Hello, Custom Shell!](/docs/reference/GLIMMER_SAMPLES.md#hello-custom-shell) / [Hello, Computed!](/docs/reference/GLIMMER_SAMPLES.md#hello-computed) / [Hello, Table!](/docs/reference/GLIMMER_SAMPLES.md#hello-table) / [Hello, Pop Up Context Menu!](/docs/reference/GLIMMER_SAMPLES.md#hello-pop-up-context-menu) / [Hello, Menu Bar!](/docs/reference/GLIMMER_SAMPLES.md#hello-menu-bar) / [Hello, List Single Selection!](/docs/reference/GLIMMER_SAMPLES.md#hello-list-single-selection) / [Hello, List Multi Selection!](/docs/reference/GLIMMER_SAMPLES.md#hello-list-multi-selection) / [Contact Manager](/docs/reference/GLIMMER_SAMPLES.md#contact-manager) / [Login](/docs/reference/GLIMMER_SAMPLES.md#login) / [Tic Tac Toe](/docs/reference/GLIMMER_SAMPLES.md#tic-tac-toe)
@@ -1736,8 +1736,6 @@ https://help.eclipse.org/2019-12/nftopic/org.eclipse.platform.doc.isv/reference/
1736
1736
 
1737
1737
  ### Canvas Shape DSL
1738
1738
 
1739
- **(BETA FEATURE)**
1740
-
1741
1739
  While other GUI toolkits only offer a way to draw graphics imperatively (e.g. draw_arc, draw_rectangle, move_to, line_to, etc...), Glimmer DSL for SWT breaks away from the mold by enabling software engineers to draw graphics declaratively. Simply declare all the shapes you want to see with their attributes, like background/foreground colors, and Glimmer DSL for SWT takes care of the rest, painting graphics on a blank `canvas` widget or amending/decorating an existing widget. This is accomplished through the Canvas Shape DSL, a sub-DSL of the Glimmer GUI DSL, which makes it possible to draw graphics declaratively with very understandable and maintainable syntax. Still, for the rare cases where imperative logic is needed, Glimmer DSL for SWT supports imperative painting of graphics through direct usage of SWT.
1742
1740
 
1743
1741
  ![Canvas Shape DSL Line](/images/glimmer-canvas-shape-dsl-line.png)
@@ -2723,8 +2721,6 @@ Check [Hello, Canvas!](/docs/reference/GLIMMER_SAMPLES.md#hello-canvas) for an e
2723
2721
 
2724
2722
  #### Pixel Graphics
2725
2723
 
2726
- **(BETA FEATURE)**
2727
-
2728
2724
  If you need to paint pixel graphics, use the optimized `pixel` keyword alternative to `point`, which takes foreground as a hash argument and bypasses the [Glimmer DSL Engine chain of responsibility](https://github.com/AndyObtiva/glimmer#dsl-engine), thus rendering faster when having very large pixel counts.
2729
2725
 
2730
2726
  Example (you may copy/paste in [`girb`](GLIMMER_GIRB.md)):
@@ -2905,8 +2901,6 @@ As they say, there are many ways to skin a cat! This is in line with the Ruby wa
2905
2901
 
2906
2902
  ### Canvas Path DSL
2907
2903
 
2908
- **(BETA FEATURE)**
2909
-
2910
2904
  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:
2911
2905
  - `point(x1, y1)`: renders a Point (Dot) as part of a path.
2912
2906
  - `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.
@@ -2951,8 +2945,6 @@ Every path segment object (mixing in [`Glimmer::SWT::Custom::PathSegment`](/lib/
2951
2945
 
2952
2946
  ### Canvas Transform DSL
2953
2947
 
2954
- **(BETA FEATURE)**
2955
-
2956
2948
  The transform DSL builds [org.eclipse.swt.graphics.Transform](https://help.eclipse.org/2020-12/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/graphics/Transform.html) objects with a nice declarative syntax.
2957
2949
 
2958
2950
  `transform` keyword builds a `Transform` object. It optionally takes the transformation matrix elements: (m11, m12, m21, m22, dx, dy)
@@ -3811,7 +3803,7 @@ Custom widgets are brand new Glimmer DSL keywords that represent aggregates of e
3811
3803
 
3812
3804
  You can find out about [published Glimmer Custom Widgets](https://github.com/AndyObtiva/glimmer-dsl-swt#gem-listing) by running the `glimmer list:gems:customwidget` command
3813
3805
 
3814
- Glimmer supports three ways of creating custom widgets with minimal code:
3806
+ Glimmer supports two ways of creating custom widgets with minimal code:
3815
3807
  1. Method-based Custom Widgets (for single-view-internal reuse): Extract a method containing Glimmer DSL widget syntax. Useful for quickly eliminating redundant code within a single view.
3816
3808
  2. Class-based Custom Widgets (for multiple-view-external reuse): Create a class that includes the `Glimmer::UI::CustomWidget` module and Glimmer DSL widget syntax in a `body {}` block. This will automatically extend Glimmer's DSL syntax with an underscored lowercase keyword matching the class name by convention. Useful in making a custom widget available in many views.
3817
3809
 
@@ -4429,9 +4421,11 @@ Also, you may check out [Hello, Custom Widget!](/docs/reference/GLIMMER_SAMPLES.
4429
4421
 
4430
4422
  ### Custom Shells
4431
4423
 
4432
- Custom shells are a kind of custom widgets that have shells only as the body root. They can be self-contained applications that may be opened and hidden/closed independently of the main app.
4424
+ Custom shell is a kind of a [custom widget](#custom-widgets) that has `shell` (window) as the body root widget. It can be used to represent an application or a reusable window that may be opened/hidden/closed independently of the main application.
4425
+
4426
+ Except in the case of small demos, it is always recommended to build [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) applications as custom shells.
4433
4427
 
4434
- They may also be chained in a wizard fashion.
4428
+ Custom shells may also be chained in a wizard fashion in some cases.
4435
4429
 
4436
4430
  You can find out about [published Glimmer Custom Shells](https://github.com/AndyObtiva/glimmer-dsl-swt#gem-listing) by running the `glimmer list:gems:customshell` command
4437
4431
 
@@ -4468,33 +4462,41 @@ class WizardStep
4468
4462
  }
4469
4463
  end
4470
4464
 
4471
- shell { |app_shell|
4472
- text "Wizard"
4473
- minimum_size 200, 100
4474
- @current_step_number = 1
4475
- @wizard_steps = 5.times.map { |n|
4476
- wizard_step(number: n+1, step_count: 5) {
4477
- on_swt_hide do
4478
- if @current_step_number < 5
4479
- @current_step_number += 1
4465
+ class Wizard
4466
+ include Glimmer::UI::CustomShell
4467
+
4468
+ body {
4469
+ shell { |app_shell|
4470
+ text "Wizard"
4471
+ minimum_size 200, 100
4472
+ @current_step_number = 1
4473
+ @wizard_steps = 5.times.map { |n|
4474
+ wizard_step(number: n+1, step_count: 5) {
4475
+ on_swt_hide do
4476
+ if @current_step_number < 5
4477
+ @current_step_number += 1
4478
+ app_shell.hide
4479
+ @wizard_steps[@current_step_number - 1].open
4480
+ end
4481
+ end
4482
+ }
4483
+ }
4484
+ button {
4485
+ text "Start"
4486
+ font height: 40
4487
+ on_widget_selected do
4480
4488
  app_shell.hide
4481
4489
  @wizard_steps[@current_step_number - 1].open
4482
4490
  end
4483
- end
4491
+ }
4484
4492
  }
4485
4493
  }
4486
- button {
4487
- text "Start"
4488
- font height: 40
4489
- on_widget_selected do
4490
- app_shell.hide
4491
- @wizard_steps[@current_step_number - 1].open
4492
- end
4493
- }
4494
- }.open
4494
+ end
4495
+
4496
+ Wizard.launch
4495
4497
  ```
4496
4498
 
4497
- If you use a Custom Shell as the top-level app shell, you may invoke the class method `.launch` instead to avoid building an app class yourself or including Glimmer into the top-level namespace (e.g. `Tetris.launch` instead of `include Glimmer; tetris.open`)
4499
+ If you use a Custom Shell as the top-level app shell, you may invoke the class method `.launch` instead of `open` to avoid building an app class yourself or including Glimmer into the top-level namespace (e.g. `Tetris.launch` instead of `include Glimmer; tetris.open`)
4498
4500
 
4499
4501
  You may check out [Hello, Custom Shell!](/docs/reference/GLIMMER_SAMPLES.md#hello-custom-shell) for another example.
4500
4502
 
@@ -84,7 +84,6 @@
84
84
  - [Glimmer Calculator](#glimmer-calculator)
85
85
  - [Gladiator](#gladiator)
86
86
  - [Timer](#timer)
87
- - [Glimmer Klondike Solitaire](#glimmer-klondike-solitaire)
88
87
  - [License](#license)
89
88
 
90
89
  ## Samples
@@ -115,6 +114,8 @@ For hello-type simple samples, check the following.
115
114
 
116
115
  #### Hello, World!
117
116
 
117
+ [Hello, World! Video Tutorial](https://www.youtube.com/watch?v=Mi5phsSdNAA&list=PLSN9HhZ_0-n741vRa_dL-M81cLbqD_kem&index=1)
118
+
118
119
  Code:
119
120
 
120
121
  [samples/hello/hello_world.rb](/samples/hello/hello_world.rb)
@@ -195,6 +196,8 @@ Code:
195
196
 
196
197
  #### Hello, Layout!
197
198
 
199
+ [Hello, Layout! Video Tutorial](https://www.youtube.com/watch?v=dAVFR9Y_thY&list=PLSN9HhZ_0-n741vRa_dL-M81cLbqD_kem&index=4)
200
+
198
201
  This sample demonstrates the standard 3 layouts in SWT (though one can write their own for very advanced applications): `fill_layout`, `row_layout`, and `grid_layout`
199
202
 
200
203
  Code:
@@ -261,6 +264,8 @@ Always On Top Shell
261
264
 
262
265
  #### Hello, Tab!
263
266
 
267
+ [Hello, Tab! Video Tutorial](https://www.youtube.com/watch?v=cMwlYZ78uaQ&list=PLSN9HhZ_0-n741vRa_dL-M81cLbqD_kem&index=3)
268
+
264
269
  Code:
265
270
 
266
271
  [samples/hello/hello_tab.rb](/samples/hello/hello_tab.rb)
@@ -360,6 +365,8 @@ Code:
360
365
 
361
366
  #### Hello, Message Box!
362
367
 
368
+ [Hello, Message Box! Video Tutorial](https://www.youtube.com/watch?v=N0sDcr0xp40&list=PLSN9HhZ_0-n741vRa_dL-M81cLbqD_kem&index=2)
369
+
363
370
  This sample demonstrates a `message_box` dialog.
364
371
 
365
372
  Code:
@@ -1251,7 +1258,7 @@ Code:
1251
1258
 
1252
1259
  ![Klondike Solitaire Played](/images/glimmer-klondike-solitaire-played.png)
1253
1260
 
1254
- Check out a souped up large-card-size packaged version of the game in the [Glimmer Klondike Solitaire](#glimmer-klondike-solitaire) external sample.
1261
+ Check out a souped up large-card-size packaged version of the game in the [Glimmer Klondike Solitaire](https://github.com/AndyObtiva/glimmer_klondike_solitaire) application.
1255
1262
 
1256
1263
  #### Battleship
1257
1264
 
@@ -1422,14 +1429,6 @@ Gladiator is a good demonstration of:
1422
1429
 
1423
1430
  [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer-cs-timer/master/glimmer-timer-screenshot.png" />](https://github.com/AndyObtiva/glimmer-cs-timer)
1424
1431
 
1425
- #### Glimmer Klondike Solitaire
1426
-
1427
- This is a souped up version of the Klondike Solitaire elaborate sample, which is built as an external application to enable packaging as a native executable installer. Enjoy!
1428
-
1429
- [<img alt="Glimmer Klondike Solitaire Icon" src="https://raw.githubusercontent.com/AndyObtiva/glimmer_klondike_solitaire/master/package/linux/Glimmer%20Klondike%20Solitaire.png" height=40 /> Glimmer Klondike Solitaire](https://github.com/AndyObtiva/glimmer_klondike_solitaire)
1430
-
1431
- ![Glimmer Klondike Solitaire](https://raw.githubusercontent.com/AndyObtiva/glimmer_klondike_solitaire/master/images/glimmer-klondike-solitaire.png)
1432
-
1433
1432
  ## License
1434
1433
 
1435
1434
  [MIT](LICENSE.txt)
Binary file
@@ -25,7 +25,7 @@ require 'os'
25
25
  module Glimmer
26
26
  module RakeTask
27
27
  module Package
28
- JDK_VERSION = '17.0.1'
28
+ JDK_VERSION = ' 18'
29
29
 
30
30
  class << self
31
31
  attr_accessor :jpackage_extra_args
@@ -1026,14 +1026,17 @@ module Glimmer
1026
1026
 
1027
1027
  def ensure_extent(paint_event)
1028
1028
  old_extent = @extent
1029
+ old_extent_args = @extent_args
1029
1030
  if ['text', 'string'].include?(@name)
1030
1031
  extent_args = [string]
1031
1032
  extent_flags = SWTProxy[:draw_transparent, :draw_delimiter] if current_parameter_name?(:is_transparent) && is_transparent
1032
1033
  extent_flags = flags if current_parameter_name?(:flags)
1033
1034
  extent_args << extent_flags unless extent_flags.nil?
1034
1035
  self.extent = paint_event.gc.send("#{@name}Extent", *extent_args)
1036
+ @extent_args = extent_args
1035
1037
  end
1036
- if !@extent.nil? && (old_extent&.x != @extent&.x || old_extent&.y != @extent&.y) # TODO add a check to text content changing too
1038
+ # comparing extent_args with old ones ensures that if content changes, calculated_args_changed! is called
1039
+ if !@extent.nil? && (old_extent&.x != @extent&.x || old_extent&.y != @extent&.y || @extent_args != old_extent_args)
1037
1040
  calculated_args_changed!
1038
1041
  parent.calculated_args_changed_for_defaults! if parent.is_a?(Shape)
1039
1042
  end
@@ -1101,10 +1104,11 @@ module Glimmer
1101
1104
  default_x? && x_delta,
1102
1105
  default_y? && default_y,
1103
1106
  default_y? && y_delta,
1107
+ (['text', 'string'].include?(@name) && string),
1104
1108
  ]
1105
1109
  if calculated_args_dependencies != @calculated_args_dependencies
1106
1110
  # avoid recalculating values again
1107
- x, y, parent_absolute_x, parent_absolute_y, default_width, default_width_delta, default_height, default_height_delta, max_width, max_width_delta, max_height, max_height_delta, default_x, default_x_delta, default_y, default_y_delta = @calculated_args_dependencies = calculated_args_dependencies
1111
+ x, y, parent_absolute_x, parent_absolute_y, default_width, default_width_delta, default_height, default_height_delta, max_width, max_width_delta, max_height, max_height_delta, default_x, default_x_delta, default_y, default_y_delta, string = @calculated_args_dependencies = calculated_args_dependencies
1108
1112
  # Note: Must set x and move_by because not all shapes have a real x and some must translate all their points with move_by
1109
1113
  # TODO change that by setting a bounding box for all shapes with a calculated top-left x, y and
1110
1114
  # a setter that does the moving inside them instead so that I could rely on absolute_x and absolute_y
@@ -36,21 +36,27 @@ class Tetris
36
36
  PREVIEW_PLAYFIELD_WIDTH = 4
37
37
  PREVIEW_PLAYFIELD_HEIGHT = 2
38
38
  SCORE_MULTIPLIER = {1 => 40, 2 => 100, 3 => 300, 4 => 1200}
39
+ UP_ARROW_ACTIONS = %i[instant_down rotate_right rotate_left]
40
+ SPEEDS = %i[snail sloth turtle rabbit gorilla bear horse gazelle cheetah falcon]
41
+ SPEED_INITIAL_DELAYS = SPEEDS.each_with_index.inject({}) {|hash, speed_index_pair| hash.merge(speed_index_pair.first => 1.1 - speed_index_pair.last*(0.1)) }
39
42
 
40
43
  attr_reader :playfield_width, :playfield_height
41
- attr_accessor :game_over, :paused, :preview_tetromino, :lines, :score, :level, :high_scores, :beeping, :added_high_score, :show_high_scores, :up_arrow_action
44
+ attr_accessor :game_over, :paused, :preview_tetromino, :lines, :score, :level, :high_scores, :beeping, :added_high_score, :show_high_scores, :up_arrow_action, :show_preview_tetromino, :initial_delay
42
45
  alias game_over? game_over
43
46
  alias paused? paused
44
47
  alias beeping? beeping
45
48
  alias added_high_score? added_high_score
49
+ alias show_preview_tetromino? show_preview_tetromino
46
50
 
47
51
  def initialize(playfield_width = PLAYFIELD_WIDTH, playfield_height = PLAYFIELD_HEIGHT)
52
+ @initial_delay = SPEED_INITIAL_DELAYS[:snail]
48
53
  @playfield_width = playfield_width
49
54
  @playfield_height = playfield_height
50
55
  @high_scores = []
51
56
  @show_high_scores = false
52
57
  @beeping = true
53
58
  @up_arrow_action = :rotate_left
59
+ @show_preview_tetromino = true
54
60
  load_high_scores!
55
61
  end
56
62
 
@@ -198,35 +204,31 @@ class Tetris
198
204
  end
199
205
 
200
206
  def delay
201
- [1.1 - (level.to_i * 0.1), 0.001].max
207
+ [@initial_delay - (level.to_i * 0.1), 0.001].max
202
208
  end
203
209
 
204
210
  def beep
205
211
  @beeper&.call if beeping
206
212
  end
207
-
208
- def instant_down_on_up=(value)
209
- self.up_arrow_action = :instant_down if value
210
- end
211
-
212
- def instant_down_on_up
213
- self.up_arrow_action == :instant_down
214
- end
215
-
216
- def rotate_right_on_up=(value)
217
- self.up_arrow_action = :rotate_right if value
218
- end
219
-
220
- def rotate_right_on_up
221
- self.up_arrow_action == :rotate_right
222
- end
223
-
224
- def rotate_left_on_up=(value)
225
- self.up_arrow_action = :rotate_left if value
213
+
214
+ SPEED_INITIAL_DELAYS.each do |speed, speed_initial_day|
215
+ define_method("speed_#{speed}=") do |is_true|
216
+ self.initial_delay = speed_initial_day if is_true
217
+ end
218
+
219
+ define_method("speed_#{speed}") do
220
+ self.initial_delay == speed_initial_day
221
+ end
226
222
  end
227
-
228
- def rotate_left_on_up
229
- self.up_arrow_action == :rotate_left
223
+
224
+ UP_ARROW_ACTIONS.each do |up_arrow_action_symbol|
225
+ define_method("#{up_arrow_action_symbol}_on_up=") do |is_true|
226
+ self.up_arrow_action = up_arrow_action_symbol if is_true
227
+ end
228
+
229
+ define_method("#{up_arrow_action_symbol}_on_up") do
230
+ self.up_arrow_action == up_arrow_action_symbol
231
+ end
230
232
  end
231
233
 
232
234
  def reset_tetrominoes
@@ -44,11 +44,15 @@ class Tetris
44
44
  margin_right block_size
45
45
  margin_height block_size
46
46
  }
47
+
47
48
  label(:center) {
48
49
  text 'Next'
49
50
  font name: @font_name, height: @font_height, style: FONT_TITLE_STYLE
51
+ visible <= [game, :show_preview_tetromino]
52
+ }
53
+ playfield(game_playfield: game.preview_playfield, playfield_width: Model::Game::PREVIEW_PLAYFIELD_WIDTH, playfield_height: Model::Game::PREVIEW_PLAYFIELD_HEIGHT, block_size: block_size) {
54
+ visible <= [game, :show_preview_tetromino]
50
55
  }
51
- playfield(game_playfield: game.preview_playfield, playfield_width: Model::Game::PREVIEW_PLAYFIELD_WIDTH, playfield_height: Model::Game::PREVIEW_PLAYFIELD_HEIGHT, block_size: block_size)
52
56
 
53
57
  label(:center) {
54
58
  text 'Score'
@@ -71,6 +71,14 @@ class Tetris
71
71
  menu {
72
72
  text '&View'
73
73
 
74
+ menu_item(:check) {
75
+ text 'Show Next Block Preview'
76
+ accelerator COMMAND_KEY, :shift, :p
77
+ selection <=> [game, :show_preview_tetromino]
78
+ }
79
+
80
+ menu_item(:separator)
81
+
74
82
  menu {
75
83
  text '&High Scores'
76
84
  menu_item(:check) {
@@ -89,6 +97,17 @@ class Tetris
89
97
  }
90
98
  } # end of menu
91
99
 
100
+ menu {
101
+ text '&Speed'
102
+
103
+ Model::Game::SPEEDS.each do |speed|
104
+ menu_item(:radio) {
105
+ text speed.to_s.capitalize
106
+ selection <=> [game, "speed_#{speed}", computed_by: :initial_delay]
107
+ }
108
+ end
109
+ }
110
+
92
111
  menu {
93
112
  text '&Options'
94
113
  menu_item(:check) {
Binary file
Binary file
Binary file
Binary file
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glimmer-dsl-swt
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.22.2.5
4
+ version: 4.23.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Maleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-10 00:00:00.000000000 Z
11
+ date: 2022-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement