glimmer-dsl-swt 4.18.2.3 → 4.18.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +59 -0
- data/README.md +267 -39
- data/VERSION +1 -1
- data/glimmer-dsl-swt.gemspec +14 -6
- data/lib/ext/glimmer/config.rb +24 -7
- data/lib/glimmer/data_binding/widget_binding.rb +14 -4
- data/lib/glimmer/dsl/swt/color_expression.rb +4 -4
- data/lib/glimmer/dsl/swt/data_binding_expression.rb +3 -3
- data/lib/glimmer/dsl/swt/dsl.rb +1 -0
- data/lib/glimmer/dsl/swt/multiply_expression.rb +53 -0
- data/lib/glimmer/dsl/swt/property_expression.rb +4 -2
- data/lib/glimmer/dsl/swt/shape_expression.rb +2 -4
- data/lib/glimmer/dsl/swt/transform_expression.rb +55 -0
- data/lib/glimmer/dsl/swt/widget_expression.rb +2 -1
- data/lib/glimmer/swt/color_proxy.rb +28 -6
- data/lib/glimmer/swt/custom/drawable.rb +8 -0
- data/lib/glimmer/swt/custom/shape.rb +66 -26
- data/lib/glimmer/swt/directory_dialog_proxy.rb +3 -3
- data/lib/glimmer/swt/display_proxy.rb +25 -4
- data/lib/glimmer/swt/file_dialog_proxy.rb +3 -3
- data/lib/glimmer/swt/layout_data_proxy.rb +3 -3
- data/lib/glimmer/swt/shell_proxy.rb +20 -5
- data/lib/glimmer/swt/table_proxy.rb +19 -4
- data/lib/glimmer/swt/transform_proxy.rb +109 -0
- data/lib/glimmer/swt/widget_listener_proxy.rb +14 -5
- data/lib/glimmer/swt/widget_proxy.rb +31 -20
- data/lib/glimmer/ui/custom_shell.rb +13 -11
- data/lib/glimmer/ui/custom_widget.rb +68 -44
- data/samples/elaborate/meta_sample.rb +81 -24
- data/samples/elaborate/tetris.rb +102 -47
- data/samples/elaborate/tetris/model/block.rb +2 -2
- data/samples/elaborate/tetris/model/game.rb +236 -74
- data/samples/elaborate/tetris/model/past_game.rb +26 -0
- data/samples/elaborate/tetris/model/tetromino.rb +123 -35
- data/samples/elaborate/tetris/view/block.rb +34 -9
- data/samples/elaborate/tetris/view/high_score_dialog.rb +114 -0
- data/samples/elaborate/tetris/view/playfield.rb +12 -5
- data/samples/elaborate/tetris/view/score_lane.rb +87 -0
- data/samples/elaborate/tetris/view/tetris_menu_bar.rb +123 -0
- data/samples/elaborate/tic_tac_toe.rb +4 -4
- data/samples/hello/hello_canvas_transform.rb +40 -0
- data/samples/hello/hello_link.rb +1 -1
- metadata +12 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed3de759196522f355d23f94734175e7bd1f5957b25637005d2b266f0868cd3d
|
4
|
+
data.tar.gz: 4cf0d426d9ab01d53de2c52246be5521bce14e963b1269568d8ecee6f0d01326
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f2a0569e88e07cedbd989aae075e1bf03721f88dc647906e1ce7c16492a59d129f282dd8ce53f535e76027cb402b3ea07a5b56d1ac8d2303dbdc468c1cd17741
|
7
|
+
data.tar.gz: d58989c1839bbe0d15e8fd8a96cdfb917a4c2a2bc9cc0382e2271ef40445b0b891d3ddd06e8f05b361535cfa57915e57e8cbbca0e2d19c2b2425670addfdbfba
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,64 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
### 4.18.3.2
|
4
|
+
|
5
|
+
- Tetris High Scores
|
6
|
+
- Tetris Modify High Score Player Name
|
7
|
+
- Tetris Show High Scores (Menu Item + Accelerator)
|
8
|
+
- Tetris add a menu item with beep enablement option
|
9
|
+
- Tetris Clear High Scores
|
10
|
+
- Tetris Add left and right alt (option) buttons as alternative to shift for rotation. Use left ctrl as rotate left. Use a, s, d as left, down, right.
|
11
|
+
- Fix issues relating to setting parenthood with custom widgets before building their body (instead of after)
|
12
|
+
- Fix issues relating to not respecting arity of passed in table editing callbacks: before_write, after_write, and after_cancel
|
13
|
+
|
14
|
+
### 4.18.3.1
|
15
|
+
|
16
|
+
- Provide an auto_sync_exec all data-binding config option to automatically sync_exec GUI calls from other threads instead of requiring users to use sync_exec on model attribute-change logic. Default value to false.
|
17
|
+
- Have CustomShell::launch method take options to pass to custom shell keyword invocation
|
18
|
+
- Update Glimmer Meta-Sample to load entire gem into user directory (since some new samples rely on images)
|
19
|
+
- Update Glimmer Meta-Sample to display errors in a `dialog` instead of a `message_box` to allow scrolling
|
20
|
+
- Removed newly added CustomShell::shutdown as unnecessary (could just do CustomShell::launchd_custom_shell.close)
|
21
|
+
- Supporting deregistering Display listeners just like standard listeners via deregister
|
22
|
+
- Enhance performance of excluded keyword check
|
23
|
+
- Remove CustomWidget support for multiple before_body/after_body blocks instead of one each since it is not needed.
|
24
|
+
- Add new :fill_screen style for `shell` to start app filling the screen size (not full screen mode though)
|
25
|
+
- Tetris Menu Bar with Game Menu -> Start, Pause, Restart, and Exit
|
26
|
+
- Tetris refactor mutation methods to end with bangs
|
27
|
+
- Tetris Stop game if user does not play again in the end (instead of closing it)
|
28
|
+
- End Tetris Thread loop gracefully if game over is encountered
|
29
|
+
- Tetris use more observers instead of callbacks to Game
|
30
|
+
- Turn Tetris::Model::Game class from a singleton class to a standard class supporting instances
|
31
|
+
- Fix issue of `tetris` keyword not found when run from meta-sample app
|
32
|
+
|
33
|
+
### 4.18.3.0
|
34
|
+
|
35
|
+
- Canvas Transform DSL (DSL declared Transform objects are auto-disposed after getting used by their parent shape)
|
36
|
+
- Canvas support a top-level Transform DSL fluent interface for methods that use Transform arguments manually (e.g. tr1 = transform.rotate(90).translate(0, -100))
|
37
|
+
- Hello, Canvas Transformation!
|
38
|
+
|
39
|
+
### 4.18.2.5
|
40
|
+
|
41
|
+
- ColorProxy args now are automatically fit into 0..255 bounds upon use of the `color`/`rgb`/`rgba` keywords
|
42
|
+
- Canvas Shape DSL (Property) Data-Binding support (No Argument Data-Binding support yet)
|
43
|
+
- Add a more bevel 3D look to Tetris blocks
|
44
|
+
- Use flyweight pattern with colors
|
45
|
+
- Use flyweight pattern with widget classes
|
46
|
+
- Use flyweight pattern with custom widget classes
|
47
|
+
- Optimized performance of Canvas Shape DSL
|
48
|
+
- Optimized performance of Tetris game
|
49
|
+
- Fixed issue with top-level sync_exec/async_exec use randomly bombing
|
50
|
+
|
51
|
+
### 4.18.2.4
|
52
|
+
|
53
|
+
- Tetris scoring
|
54
|
+
- Tetris eliminated Line tracking
|
55
|
+
- Tetris level tracking and speed-ups
|
56
|
+
- Tetris preview upcoming tetromino shape
|
57
|
+
- Added parent_proxy to CustomWidget and CustomShell classes
|
58
|
+
- Update CustomShell#center and ShellProxy#center to center_within_display to avoid clash with `row_layout` center property
|
59
|
+
- Fixed issue with shell/dialog/custom-shell not maintaining parent when not passed
|
60
|
+
- Fix Tetris sideways edge detection
|
61
|
+
|
3
62
|
### 4.18.2.3
|
4
63
|
|
5
64
|
- Added Tetris Elaborate Sample
|
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.2
|
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.3.2
|
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,7 +8,7 @@
|
|
8
8
|
|
9
9
|
**[Contributors Wanted! (Submit a Glimmer App Sample to Get Started)](#contributing)**
|
10
10
|
|
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)
|
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) s [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/).
|
12
12
|
|
13
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.
|
14
14
|
|
@@ -24,7 +24,7 @@ Glimmer DSL gems:
|
|
24
24
|
- [glimmer-dsl-opal](https://github.com/AndyObtiva/glimmer-dsl-opal): Glimmer DSL for Opal (Pure Ruby Web GUI and Auto-Webifier of Desktop Apps)
|
25
25
|
- [glimmer-dsl-xml](https://github.com/AndyObtiva/glimmer-dsl-xml): Glimmer DSL for XML (& HTML)
|
26
26
|
- [glimmer-dsl-css](https://github.com/AndyObtiva/glimmer-dsl-css): Glimmer DSL for CSS
|
27
|
-
- [glimmer-dsl-tk](https://github.com/AndyObtiva/glimmer-dsl-tk): Glimmer DSL for Tk (Ruby Desktop Development GUI Library)
|
27
|
+
- [glimmer-dsl-tk](https://github.com/AndyObtiva/glimmer-dsl-tk): Glimmer DSL for Tk (MRI Ruby Desktop Development GUI Library)
|
28
28
|
|
29
29
|
## Examples
|
30
30
|
|
@@ -226,6 +226,11 @@ Glimmer App:
|
|
226
226
|
|
227
227
|
[![Math Bowling App Screenshot](https://raw.githubusercontent.com/AndyObtiva/MathBowling/master/Math-Bowling-Screenshot.png)](https://github.com/AndyObtiva/MathBowling)
|
228
228
|
|
229
|
+
**Note:** I offer Glimmer DSL for SWT as a free and open-source [Ruby Gem](https://rubygems.org/gems/glimmer-dsl-swt) that represents my interests in Ruby Programming, Desktop GUI application development with SWT, Object Oriented Design, Design Patterns, and Software Architecture.
|
230
|
+
Additionally, I am sharing my professional experience and expertise in Eclipse SWT given that I am an [EclipseCon](http://andymaleh.blogspot.com/2007/03/eclipsecon-2007-day-3.html)/[EclipseWorld](http://andymaleh.blogspot.com/2008/11/eclipseworld-2008-highlights.html) presenter and have built professional applications in SWT/JFace/RCP for Obtiva and the Pampered Chef in the past. This is also done in the hopes that it would indirectly bring me work in a field I am extremely passionate about.
|
231
|
+
That said, please keep in mind that I myself am learning topics in Software Engineering too everyday, including newer editions of SWT and JRuby, which seem to pop up every quarter.
|
232
|
+
If you see anything that needs to be improved, please do not hesitate to contact me on [Gitter](https://gitter.im/AndyObtiva/glimmer) or submit [Issues](https://github.com/AndyObtiva/glimmer-dsl-swt/issues)/[Pull-Requests](https://github.com/AndyObtiva/glimmer-dsl-swt/pulls).
|
233
|
+
|
229
234
|
## Table of contents
|
230
235
|
|
231
236
|
- [Glimmer (JRuby Desktop Development GUI Framework)](#jruby-desktop-development-gui-framework)
|
@@ -236,6 +241,7 @@ Glimmer App:
|
|
236
241
|
- [Desktop Apps Built with Glimmer DSL for SWT](#desktop-apps-built-with-glimmer-dsl-for-swt)
|
237
242
|
- [Table of contents](#table-of-contents)
|
238
243
|
- [Background](#background)
|
244
|
+
- [Software Architecture](#software-architecture)
|
239
245
|
- [Platform Support](#platform-support)
|
240
246
|
- [Pre-requisites](#pre-requisites)
|
241
247
|
- [Setup](#setup)
|
@@ -283,6 +289,7 @@ Glimmer App:
|
|
283
289
|
- [Layouts](#layouts)
|
284
290
|
- [Layout Data](#layout-data)
|
285
291
|
- [Canvas Shape DSL](#canvas-shape-dsl)
|
292
|
+
- [Canvas Transform DSL](#canvas-transform-dsl)
|
286
293
|
- [Canvas Animation DSL](#canvas-animation-dsl)
|
287
294
|
- [Data-Binding](#data-binding)
|
288
295
|
- [General Examples](#general-examples)
|
@@ -301,7 +308,7 @@ Glimmer App:
|
|
301
308
|
- [Custom Widget API](#custom-widget-api)
|
302
309
|
- [Content/Options Example](#contentoptions-example)
|
303
310
|
- [Gotcha](#gotcha)
|
304
|
-
- [Final Notes](#final-notes)
|
311
|
+
- [Custom Widget Final Notes](#custom-widget-final-notes)
|
305
312
|
- [Custom Shells](#custom-shells)
|
306
313
|
- [Drag and Drop](#drag-and-drop)
|
307
314
|
- [Miscellaneous](#miscellaneous)
|
@@ -359,6 +366,7 @@ Glimmer App:
|
|
359
366
|
- [Hello, Dialog!](#hello-dialog)
|
360
367
|
- [Hello, Canvas!](#hello-canvas)
|
361
368
|
- [Hello, Canvas Animation!](#hello-canvas-animation)
|
369
|
+
- [Hello, Canvas Transform!](#hello-canvas-transform)
|
362
370
|
- [Elaborate Samples](#elaborate-samples)
|
363
371
|
- [User Profile](#user-profile)
|
364
372
|
- [Login](#login)
|
@@ -398,7 +406,39 @@ Glimmer App:
|
|
398
406
|
|
399
407
|
## Background
|
400
408
|
|
401
|
-
Ruby 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 on Rails framework for web development, it currently lacks a robust platform-independent framework for building desktop applications. Given that Java libraries can now be utilized in Ruby code through JRuby, Eclipse technologies, such as SWT, JFace, and RCP can help fill the gap of desktop application development with Ruby.
|
409
|
+
[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 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.
|
410
|
+
|
411
|
+
## Software Architecture
|
412
|
+
|
413
|
+
There are several requirements for building enterprise-level/consumer-level desktop GUI applications:
|
414
|
+
- Cross-Platform Support (Mac, Windows, Linux) without compilation/recompilation
|
415
|
+
- OS Native Look & Feel
|
416
|
+
- High Performance
|
417
|
+
- Productivity
|
418
|
+
- Maintainability
|
419
|
+
- Extensibility
|
420
|
+
- Native Executable Packaging
|
421
|
+
- Multi-Threading / Parallel Programming
|
422
|
+
- Arbitrary Graphics Painting
|
423
|
+
- Audio Support
|
424
|
+
|
425
|
+
Glimmer provides cross-platform support that does not require Ruby compilation (like Tk does), thanks to JRuby, a JVM (Java Virtual Machine) faster OS-threaded version of Ruby.
|
426
|
+
|
427
|
+
Glimmer leverages SWT (Standard Widget Toolkit), which provides cross-platform widgets that automatically use the native GUI libraries under each operating system, such as Win32 on Windows, Cocoa on Mac, and GTK on Linux.
|
428
|
+
|
429
|
+
Furthermore, what is special about SWT regarding "High Performance" is that it does all the GUI painting natively outside of Java, thus producing GUI that runs at maximum performance even in Ruby. As such, you do not need to worry about Ruby dynamic typing getting in the way of GUI performance. It has ZERO effect on it and since SWT supports making asynchronous calls for GUI rendering, you could avoid blocking the GUI completely with any computations happening in Ruby no matter how complex, thus never affecting the responsiveness of GUI of applications while taking full advantage of the productivity benefits of Ruby dynamic typing.
|
430
|
+
|
431
|
+
Glimmer takes this further by providing a very programmer friendly DSL (Domain Specific Language) that visually maps lightweight Ruby syntax to the containment hierarchy of GUI widgets (meaning Ruby blocks nested within each other map to GUI widgets nested within each other). This provides maximum productivity and maintainability.
|
432
|
+
|
433
|
+
Extensibility has never been simpler in desktop GUI application development than with Glimmer, which provides the ability to support any new custom keywords through custom widgets and custom shells (windows). Basically, you map a keyword by declaring a view class matching its name by convention with a GUI body that simply consists of reusable Glimmer GUI syntax. They can be passive views or smart views with additional logic. This provides the ultimate realization of Object Oriented Programming and micro-level MVC pattern.
|
434
|
+
|
435
|
+
Thanks to Java and JRuby, Glimmer apps can be packaged as cross-platform JAR files (with JRuby Warbler) and native executables (with Java Packager) as Mac APP/DMG/PACKAGE or Windows EXE/MSI.
|
436
|
+
|
437
|
+
The Java Virtual Machine already supports OS-native threads, so Glimmer apps can have multiple things running in parallel with no problem.
|
438
|
+
|
439
|
+
SWT supports Canvas graphics drawing, and Glimmer takes that further by provding a Canvas Shape/Transform/Animation DSL, making it very simple to decorate any existing widgets or add new widgets with a completely custom look and feel if needed for branding or entertainment (gaming) purposes.
|
440
|
+
|
441
|
+
Audio is supported via the Java Sound library in a cross-platform approach and video is supported via a Glimmer custom widget, so any Glimmer app can be enhanced with audio and video where needed.
|
402
442
|
|
403
443
|
## Platform Support
|
404
444
|
|
@@ -453,7 +493,7 @@ jgem install glimmer-dsl-swt
|
|
453
493
|
|
454
494
|
Or this command if you want a specific version:
|
455
495
|
```
|
456
|
-
jgem install glimmer-dsl-swt -v 4.18.2
|
496
|
+
jgem install glimmer-dsl-swt -v 4.18.3.2
|
457
497
|
|
458
498
|
|
459
499
|
```
|
@@ -473,7 +513,7 @@ Note: if you're using activerecord or activesupport, keep in mind that Glimmer u
|
|
473
513
|
|
474
514
|
Add the following to `Gemfile`:
|
475
515
|
```
|
476
|
-
gem 'glimmer-dsl-swt', '~> 4.18.2
|
516
|
+
gem 'glimmer-dsl-swt', '~> 4.18.3.2
|
477
517
|
'
|
478
518
|
```
|
479
519
|
|
@@ -532,7 +572,7 @@ bin/glimmer samples
|
|
532
572
|
Below are the full usage instructions that come up when running `glimmer` without args.
|
533
573
|
|
534
574
|
```
|
535
|
-
Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.18.2
|
575
|
+
Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.18.3.2
|
536
576
|
|
537
577
|
|
538
578
|
|
@@ -808,7 +848,7 @@ glimmer run
|
|
808
848
|
|
809
849
|
#### Custom Shell
|
810
850
|
|
811
|
-
To scaffold a Glimmer custom shell (full window view) for an existing Glimmer app, run the following command:
|
851
|
+
To scaffold a Glimmer [custom shell](#custom-shells) (full window view) for an existing Glimmer app, run the following command:
|
812
852
|
|
813
853
|
```
|
814
854
|
glimmer scaffold:customshell[name]
|
@@ -822,7 +862,7 @@ glimmer scaffold:cs[name]
|
|
822
862
|
|
823
863
|
#### Custom Widget
|
824
864
|
|
825
|
-
To scaffold a Glimmer custom widget (part of a view) for an existing Glimmer app, run the following command:
|
865
|
+
To scaffold a Glimmer [custom widget](#custom-widgets) (part of a view) for an existing Glimmer app, run the following command:
|
826
866
|
|
827
867
|
```
|
828
868
|
glimmer scaffold:customwidget[name]
|
@@ -836,7 +876,7 @@ glimmer scaffold:cw[name]
|
|
836
876
|
|
837
877
|
#### Custom Shell Gem
|
838
878
|
|
839
|
-
Custom shell gems are self-contained Glimmer apps as well as reusable custom shells.
|
879
|
+
Custom shell gems are self-contained Glimmer apps as well as reusable [custom shells](#custom-shells).
|
840
880
|
They have everything scaffolded Glimmer apps come with in addition to gem content like a [Juwelier](https://rubygems.org/gems/juwelier) Rakefile that can build gemspec and release gems.
|
841
881
|
Unlike scaffolded Glimmer apps, custom shell gem content lives under the `lib` directory (not `app`).
|
842
882
|
They can be packaged as both a native executable (e.g. Mac DMG/PKG/APP) and a Ruby gem.
|
@@ -871,7 +911,7 @@ Examples:
|
|
871
911
|
|
872
912
|
#### Custom Widget Gem
|
873
913
|
|
874
|
-
To scaffold a Glimmer custom widget gem (part of a view distributed as a Ruby gem), run the following command:
|
914
|
+
To scaffold a Glimmer [custom widget](#custom-widgets) gem (part of a view distributed as a Ruby gem), run the following command:
|
875
915
|
|
876
916
|
```
|
877
917
|
glimmer scaffold:gem:customwidget[name,namespace]
|
@@ -897,7 +937,7 @@ Examples:
|
|
897
937
|
|
898
938
|
### Gem Listing
|
899
939
|
|
900
|
-
The `glimmer` command comes with tasks for listing Glimmer related gems to make it easy to find Glimmer Custom Shells, Custom Widgets, and DSLs published by others in the Glimmer community on [rubygems.org](http://www.rubygems.org).
|
940
|
+
The `glimmer` command comes with tasks for listing Glimmer related gems to make it easy to find Glimmer [Custom Shells](#custom-shells), [Custom Widgets](#custom-widgets), and DSLs published by others in the Glimmer community on [rubygems.org](http://www.rubygems.org).
|
901
941
|
|
902
942
|
#### Listing Custom Shell Gems
|
903
943
|
|
@@ -1013,7 +1053,7 @@ Output:
|
|
1013
1053
|
|
1014
1054
|
Css glimmer-dsl-css 1.1.0 AndyMaleh Glimmer DSL for CSS
|
1015
1055
|
Opal glimmer-dsl-opal 0.10.2 AndyMaleh Glimmer DSL for Opal
|
1016
|
-
Swt glimmer-dsl-swt 4.18.2
|
1056
|
+
Swt glimmer-dsl-swt 4.18.3.2
|
1017
1057
|
|
1018
1058
|
AndyMaleh Glimmer DSL for SWT
|
1019
1059
|
Tk glimmer-dsl-tk 0.0.6 AndyMaleh Glimmer DSL for Tk
|
@@ -1091,7 +1131,12 @@ bin/girb
|
|
1091
1131
|
|
1092
1132
|
Watch out for hands-on examples in this README indicated by "you may copy/paste in [`girb`](#girb-glimmer-irb-command)"
|
1093
1133
|
|
1094
|
-
Keep in mind that all samples live under [https://github.com/AndyObtiva/glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt)
|
1134
|
+
Keep in mind that all samples live under [https://github.com/AndyObtiva/glimmer-dsl-swt/samples](https://github.com/AndyObtiva/glimmer-dsl-swt/samples)
|
1135
|
+
|
1136
|
+
If you need a more GUI interactive option to experiement with Glimmer GUI DSL Syntax, you may try:
|
1137
|
+
- [Glimmer Meta-Sample (The Sample of Samples)](#samples): allows launching Glimmer samples and viewing/editing code to learn/experiment too.
|
1138
|
+
- ["Ugliest Editor Ever"](https://github.com/AndyObtiva/glimmer-cs-gladiator)
|
1139
|
+
- Just build your own GUI editor using the [Glimmer DSL for SWT Ruby Gem](https://rubygems.org/gems/glimmer-dsl-swt).
|
1095
1140
|
|
1096
1141
|
## Glimmer GUI DSL Syntax
|
1097
1142
|
|
@@ -1502,7 +1547,7 @@ Although SWT Display is not technically a widget, it has similar APIs and DSL su
|
|
1502
1547
|
|
1503
1548
|
#### Multi-Threading
|
1504
1549
|
|
1505
|
-
[JRuby](https://www.jruby.org/) supports [truly parallel multi-threading](https://github.com/jruby/jruby/wiki/Concurrency-in-jruby) since it relies on the JVM (Java Virtual Machine). As such, it enables development of highly-interactive desktop applications that can do background work while the user is interacting with the GUI.
|
1550
|
+
[JRuby](https://www.jruby.org/) supports [truly parallel multi-threading](https://github.com/jruby/jruby/wiki/Concurrency-in-jruby) since it relies on the JVM (Java Virtual Machine). As such, it enables development of highly-interactive desktop applications that can do background work while the user is interacting with the GUI. However, any code that interacts with the GUI from a thread other than the main (first) GUI thread must do so only through sync_exec (if it is standard synchronous code) or async_exec.
|
1506
1551
|
|
1507
1552
|
##### async_exec
|
1508
1553
|
|
@@ -1933,7 +1978,7 @@ style = swt(:shell_trim, :max!) # creates a shell trim style without the maximiz
|
|
1933
1978
|
|
1934
1979
|
SWT Shell widget by default is resizable. To make it non-resizable, one must pass a complicated style bit concoction like `swt(:shell_trim, :resize!, :max!)`.
|
1935
1980
|
|
1936
|
-
Glimmer makes this easier by alternatively
|
1981
|
+
Glimmer makes this easier by alternatively ing a `:no_resize` extra SWT style, added for convenience.
|
1937
1982
|
This makes declaring a non-resizable window as easy as:
|
1938
1983
|
|
1939
1984
|
```ruby
|
@@ -2334,31 +2379,40 @@ Here is a list of supported attributes nestable within a block under shapes:
|
|
2334
2379
|
- `line_style` line join style (SWT style value of `:line_solid`, `:line_dash`, `:line_dot`, `:line_dashdot`, or `:line_dashdotdot`)
|
2335
2380
|
- `line_width` line width in integer (used in draw operations)
|
2336
2381
|
- `text_anti_alias` enables text antialiasing (SWT style value of `:default`, `:off`, `:on` whereby `:default` applies OS default, which varies per OS)
|
2382
|
+
- `transform` sets transform object using [Canvas Transform DSL](#canvas-transform-dsl) syntax
|
2337
2383
|
|
2338
2384
|
Example (you may copy/paste in [`girb`](#girb-glimmer-irb-command)):
|
2339
2385
|
|
2340
2386
|
```ruby
|
2341
2387
|
include Glimmer
|
2342
2388
|
|
2389
|
+
# image object has to be declared outside the canvas and shell to avoid confusing with canvas image property
|
2390
|
+
image_object = image(File.expand_path('./icons/scaffold_app.png'), width: 100)
|
2391
|
+
|
2343
2392
|
shell {
|
2344
2393
|
text 'Canvas Example'
|
2345
2394
|
minimum_size 320, 400
|
2346
2395
|
|
2347
2396
|
canvas {
|
2348
|
-
background :
|
2397
|
+
background :dark_yellow
|
2349
2398
|
rectangle(0, 0, 220, 400, fill: true) {
|
2350
|
-
background :
|
2399
|
+
background :dark_red
|
2351
2400
|
}
|
2352
2401
|
rectangle(50, 20, 300, 150, 30, 50, round: true, fill: true) {
|
2353
|
-
background :
|
2402
|
+
background :yellow
|
2354
2403
|
}
|
2355
2404
|
rectangle(150, 200, 100, 70, true, gradient: true) {
|
2356
|
-
background :
|
2405
|
+
background :dark_red
|
2357
2406
|
foreground :yellow
|
2358
2407
|
}
|
2408
|
+
text('Glimmer', 208, 83) {
|
2409
|
+
font height: 25, style: :bold
|
2410
|
+
}
|
2359
2411
|
rectangle(200, 80, 108, 36) {
|
2360
|
-
foreground
|
2412
|
+
foreground :black
|
2413
|
+
line_width 3
|
2361
2414
|
}
|
2415
|
+
image(image_object, 70, 50)
|
2362
2416
|
}
|
2363
2417
|
}.open
|
2364
2418
|
```
|
@@ -2374,6 +2428,8 @@ If you get extremely stuck, remember that you could always default to direct [SW
|
|
2374
2428
|
Example of manually doing the same things as in the above example without relying on the declarative Glimmer Shape DSL:
|
2375
2429
|
|
2376
2430
|
```ruby
|
2431
|
+
image_object = image(File.expand_path('./icons/scaffold_app.png'), width: 100)
|
2432
|
+
|
2377
2433
|
include Glimmer
|
2378
2434
|
|
2379
2435
|
shell {
|
@@ -2384,23 +2440,115 @@ shell {
|
|
2384
2440
|
background :yellow
|
2385
2441
|
|
2386
2442
|
on_paint_control { |event|
|
2387
|
-
event.gc.
|
2388
|
-
event.gc.
|
2443
|
+
event.gc.set_background(color(:red).swt_color)
|
2444
|
+
event.gc.fill_rectangle(0, 0, 220, 400)
|
2445
|
+
|
2446
|
+
event.gc.set_background(color(:magenta).swt_color)
|
2447
|
+
event.gc.fill_roundRectangle(50, 20, 300, 150, 30, 50)
|
2389
2448
|
|
2390
|
-
event.gc.
|
2391
|
-
event.gc.
|
2449
|
+
event.gc.set_background(color(:dark_magenta).swt_color)
|
2450
|
+
event.gc.fill_gradientRectangle(150, 200, 100, 70, true)
|
2392
2451
|
|
2393
|
-
event.gc.
|
2394
|
-
event.gc.
|
2452
|
+
event.gc.set_foreground(color(:dark_blue).swt_color)
|
2453
|
+
event.gc.draw_rectangle(200, 80, 108, 36)
|
2395
2454
|
|
2396
|
-
event.gc.
|
2397
|
-
event.gc.
|
2455
|
+
event.gc.set_foreground(color(:black).swt_color)
|
2456
|
+
event.gc.set_lineWidth(3)
|
2457
|
+
event.gc.draw_rectangle(200, 80, 108, 36)
|
2458
|
+
|
2459
|
+
event.gc.draw_image(image_object.swt_image, 70, 50)
|
2398
2460
|
}
|
2399
2461
|
}
|
2400
2462
|
}.open
|
2401
2463
|
```
|
2402
2464
|
|
2403
|
-
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.
|
2465
|
+
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](https://github.com/AndyObtiva/glimmer-dsl-swt/pulls).
|
2466
|
+
|
2467
|
+
#### Shapes inside a Widget
|
2468
|
+
|
2469
|
+
Keep in mind that the Shape DSL can be used inside any widget, not just `canvas`. Unlike shapes on a `canvas`, which are standalone graphics, when included in a widget, which already has its own look and feel, shapes are used as a decorative add-on that complements its look by getting painted on top of it. For example, shapes were used to decorate `composite` blocks in the [Tetris](#tetris) sample to have a more bevel look. In summary, Shapes can be used in a hybrid approach (shapes inside a widget), not just standalone in a `canvas`.
|
2470
|
+
|
2471
|
+
### Canvas Transform DSL
|
2472
|
+
|
2473
|
+
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.
|
2474
|
+
|
2475
|
+
`transform` keyword builds a `Transform` object. It optionally takes the transformation matrix elements: (m11, m12, m21, m22, dx, dy)
|
2476
|
+
|
2477
|
+
The first 2 values represent the 1st row, the second 2 values represent the 2nd row, and the last 2 values represent translation on the x and y axes
|
2478
|
+
|
2479
|
+
Additionally, Transform operation keywords may be nested within the `transform` keyword to set its properties:
|
2480
|
+
- `identity` resets transform to identity (no transformation)
|
2481
|
+
- `invert` inverts a transform
|
2482
|
+
- `multiply(&block)` multiplies by another transform (takes a block representing properties of another transform, no need for using the word transform again)
|
2483
|
+
- `rotate(angle)` rotates by angle degrees
|
2484
|
+
- `scale(x, y)` scales a shape (stretch)
|
2485
|
+
- `shear(x, y)` shear effect
|
2486
|
+
- `translate(x, y)` translate x and y coordinates (move)
|
2487
|
+
- `elements(m11, m12, m21, m22, dx, dy)` resets all values of the transform matrix (first 2 values represent the 1st row, second 2 values represent the 2nd row, the last 2 values represent translation on x and y axes)
|
2488
|
+
|
2489
|
+
Also, setting `transform` to `nil` after a previous `transform` has been set is like calling `identity`. It resets the transform.
|
2490
|
+
|
2491
|
+
Example (you may copy/paste in [`girb`](#girb-glimmer-irb-command)):
|
2492
|
+
|
2493
|
+
```ruby
|
2494
|
+
include Glimmer
|
2495
|
+
|
2496
|
+
shell {
|
2497
|
+
text 'Canvas Transform Example'
|
2498
|
+
minimum_size 330, 352
|
2499
|
+
|
2500
|
+
canvas { |canvas_proxy|
|
2501
|
+
background :white
|
2502
|
+
|
2503
|
+
text('glimmer', 0, 0) {
|
2504
|
+
foreground :red
|
2505
|
+
transform {
|
2506
|
+
translate 220, 100
|
2507
|
+
scale 2.5, 2.5
|
2508
|
+
rotate 90
|
2509
|
+
}
|
2510
|
+
}
|
2511
|
+
text('glimmer', 0, 0) {
|
2512
|
+
foreground :dark_green
|
2513
|
+
transform {
|
2514
|
+
translate 0, 0
|
2515
|
+
shear 2, 3
|
2516
|
+
scale 2, 2
|
2517
|
+
}
|
2518
|
+
}
|
2519
|
+
text('glimmer', 0, 0) {
|
2520
|
+
foreground :blue
|
2521
|
+
transform {
|
2522
|
+
translate 0, 220
|
2523
|
+
scale 3, 3
|
2524
|
+
}
|
2525
|
+
}
|
2526
|
+
}
|
2527
|
+
}.open
|
2528
|
+
```
|
2529
|
+
|
2530
|
+
![Canvas Transform Example](images/glimmer-example-canvas-transform.png)
|
2531
|
+
|
2532
|
+
#### Top-Level Transform Fluent Interface
|
2533
|
+
|
2534
|
+
When using a transform at the top-level (outside of shell), you get a fluent interface to faciliate manual constructioni and use.
|
2535
|
+
|
2536
|
+
Example:
|
2537
|
+
|
2538
|
+
```ruby
|
2539
|
+
include Glimmer # make sure it is included in your class/module before using the fluent interface
|
2540
|
+
|
2541
|
+
transform(1, 1, 4, 2, 2, 4).
|
2542
|
+
multiply(1, 2, 3, 4,3,4).
|
2543
|
+
scale(1, 2, 3, 4, 5, 6).
|
2544
|
+
rotate(45).
|
2545
|
+
scale(2, 4).
|
2546
|
+
invert.
|
2547
|
+
shear(2, 4).
|
2548
|
+
translate(3, 7)
|
2549
|
+
```
|
2550
|
+
|
2551
|
+
Learn more at the [Hello, Canvas Transform! Sample](#hello-canvas-transform).
|
2404
2552
|
|
2405
2553
|
### Canvas Animation DSL
|
2406
2554
|
|
@@ -2826,7 +2974,7 @@ Glimmer automatic table sorting supports `String`, `Integer`, and `Float` column
|
|
2826
2974
|
|
2827
2975
|
In cases where data is nil, depending on the data-type, it is automatically converted to `Float` with `to_f`, `Integer` with `to_i`, or `String` with `to_s`.
|
2828
2976
|
|
2829
|
-
Should you have a special data type that could not be compared automatically, Glimmer
|
2977
|
+
Should you have a special data type that could not be compared automatically, Glimmer s the following 3 alternatives for custom sorting:
|
2830
2978
|
- `sort_property`: this may be set to an alternative property to the one data-bound to the table column. For example, a table column called 'adult', which returns `true` or `false` may be sorted with `sort_property :dob` instead. This also support multi-property (aka multi-column) sorting (e.g. `sort_property :dob, :name`).
|
2831
2979
|
- `sort_by(&block)`: this works just like Ruby `Enumerable` `sort_by`. The block receives the table column data as argument.
|
2832
2980
|
- `sort(&comparator)`: this works just like Ruby `Enumerable` `sort`. The comparator block receives two objects from the table column data.
|
@@ -2921,7 +3069,7 @@ a text widget to the user to change the selected or passed tree item text into s
|
|
2921
3069
|
|
2922
3070
|
`date_time` represents the SWT DateTime widget.
|
2923
3071
|
|
2924
|
-
Glimmer
|
3072
|
+
Glimmer s the following alias keywords for it for convenience:
|
2925
3073
|
- `date`: `date_time(:date)`
|
2926
3074
|
- `date_drop_down`: `date_time(:date, :drop_down)`
|
2927
3075
|
- `time`: `date_time(:time)`
|
@@ -2944,7 +3092,7 @@ If you need a better widget with the ability to customize the date format patter
|
|
2944
3092
|
|
2945
3093
|
### Observer
|
2946
3094
|
|
2947
|
-
Glimmer comes with `Observer` module, which is used internally for data-binding, but can also be used externally for custom use of the Observer Pattern. It is hidden when observing widgets, and used explicitly when observing models.
|
3095
|
+
Glimmer comes with the `Observer` mixin module, which is used internally for data-binding, but can also be used externally for custom use of the Observer Pattern. It is hidden when observing widgets, and used explicitly when observing models. In bidirectional data-binding, `Observer` is automatically unregistered from models once a widget is disposed to avoid memory leaks and worrying about managing them yourself.
|
2948
3096
|
|
2949
3097
|
#### Observing Widgets
|
2950
3098
|
|
@@ -3126,7 +3274,7 @@ Approach #1 is a casual Ruby-based approach. Approach #2 is the official Glimmer
|
|
3126
3274
|
|
3127
3275
|
A developer might start with approach #1 to eliminate duplication in a view and later upgrade it to approach #2 when needing to export a custom widget to make it available in many views.
|
3128
3276
|
|
3129
|
-
Class-based Custom Widgets
|
3277
|
+
Class-based Custom Widgets a number of benefits over method-based custom widgets, such as built-in support for passing SWT style, nested block of extra widgets and properties, and `before_body`/`after_body` hooks.
|
3130
3278
|
|
3131
3279
|
#### Simple Example
|
3132
3280
|
|
@@ -3310,7 +3458,7 @@ body {
|
|
3310
3458
|
|
3311
3459
|
The `text` method invoked in the custom widget body will call the one you defined above it. To avoid this gotcha, simply name the text property above something else, like `custom_text`.
|
3312
3460
|
|
3313
|
-
#### Final Notes
|
3461
|
+
#### Custom Widget Final Notes
|
3314
3462
|
|
3315
3463
|
This [Eclipse guide](https://www.eclipse.org/articles/Article-Writing%20Your%20Own%20Widget/Writing%20Your%20Own%20Widget.htm) for how to write custom SWT widgets is also applicable to Glimmer Custom Widgets written in Ruby. I recommend reading it:
|
3316
3464
|
[https://www.eclipse.org/articles/Article-Writing%20Your%20Own%20Widget/Writing%20Your%20Own%20Widget.htm](https://www.eclipse.org/articles/Article-Writing%20Your%20Own%20Widget/Writing%20Your%20Own%20Widget.htm)
|
@@ -3384,11 +3532,13 @@ shell { |app_shell|
|
|
3384
3532
|
}.open
|
3385
3533
|
```
|
3386
3534
|
|
3535
|
+
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`)
|
3536
|
+
|
3387
3537
|
You may check out [Hello, Custom Shell!](#hello-custom-shell) for another example.
|
3388
3538
|
|
3389
3539
|
### Drag and Drop
|
3390
3540
|
|
3391
|
-
Glimmer
|
3541
|
+
Glimmer s Drag and Drop support, thanks to [SWT](https://www.eclipse.org/swt/) and Glimmer's lightweight [DSL syntax](#glimmer-dsl-syntax).
|
3392
3542
|
|
3393
3543
|
You may learn more about SWT Drag and Drop support over here: [https://www.eclipse.org/articles/Article-SWT-DND/DND-in-SWT.html](https://www.eclipse.org/articles/Article-SWT-DND/DND-in-SWT.html)
|
3394
3544
|
|
@@ -3664,6 +3814,41 @@ shell(:no_resize) {
|
|
3664
3814
|
|
3665
3815
|
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.
|
3666
3816
|
|
3817
|
+
#### Performance Profiling
|
3818
|
+
|
3819
|
+
JRuby comes with built-in support for performance profiling via the `--profile` option (with some code shown below), which can be accepted by the `glimmer` command too:
|
3820
|
+
|
3821
|
+
`glimmer --profile path_to_glimmer_app.rb`
|
3822
|
+
|
3823
|
+
Additionally, add this code to monitor Glimmer app performance around its launch method:
|
3824
|
+
|
3825
|
+
```ruby
|
3826
|
+
require 'jruby/profiler'
|
3827
|
+
profile_data = JRuby::Profiler.profile do
|
3828
|
+
SomeGlimmerApp.launch
|
3829
|
+
end
|
3830
|
+
|
3831
|
+
profile_printer = JRuby::Profiler::HtmlProfilePrinter.new(profile_data)
|
3832
|
+
ps = java.io.PrintStream.new(STDOUT.to_outputstream)
|
3833
|
+
```
|
3834
|
+
|
3835
|
+
When monitoring app startup time performance, make sure to add a hook to the top-level `shell` `on_swt_show` event that exits the app as soon as the shell shows up to end performance profiling and get the results.
|
3836
|
+
|
3837
|
+
Example:
|
3838
|
+
|
3839
|
+
```ruby
|
3840
|
+
shell {
|
3841
|
+
# some code
|
3842
|
+
on_swt_show {
|
3843
|
+
exit(0)
|
3844
|
+
}
|
3845
|
+
}
|
3846
|
+
```
|
3847
|
+
|
3848
|
+
You may run `glimmer` with the `--profile.graph` instead for a more detailed output.
|
3849
|
+
|
3850
|
+
Learn more at the [JRuby Performance Profile WIKI page](https://github.com/jruby/jruby/wiki/Profiling-JRuby).
|
3851
|
+
|
3667
3852
|
#### Checkbox Group Widget
|
3668
3853
|
|
3669
3854
|
`checkbox_group` (or alias `check_group`) is a Glimmer built-in custom widget that displays a list of `checkbox` buttons (`button(:check)`) based on its `items` property.
|
@@ -4000,8 +4185,18 @@ end
|
|
4000
4185
|
|
4001
4186
|
### log_excluded_keywords
|
4002
4187
|
|
4188
|
+
(default = false)
|
4189
|
+
|
4003
4190
|
This just tells Glimmer whether to log excluded keywords or not (at the debug level). It is off by default.
|
4004
4191
|
|
4192
|
+
### auto_sync_exec
|
4193
|
+
|
4194
|
+
(default = false)
|
4195
|
+
|
4196
|
+
This automatically uses sync_exec on GUI calls from threads other than the main GUI thread instead of requiring users to manually use sync_exec. Default value to false.
|
4197
|
+
|
4198
|
+
Keep in mind the caveat that it would force redraws on every minor changein the models instead of applying large scope changes all together, thus causing too much drawing/stutter in the GUI. As such, this is a good fit for simpler GUIs, not ones used with highly sophisticated 2D graphics. It may be mitigated in the future by introducing the idea of large-scale observation events that wrap around smaller events. Until then, keep the caveat in mind or just use sync_exec manually as usually done with Java SWT apps.
|
4199
|
+
|
4005
4200
|
## Glimmer Style Guide
|
4006
4201
|
|
4007
4202
|
- Widgets are declared with underscored lowercase versions of their SWT names minus the SWT package name.
|
@@ -4077,6 +4272,12 @@ This brings up the [Glimmer Meta-Sample (The Sample of Samples)](samples/elabora
|
|
4077
4272
|
|
4078
4273
|
You may edit the code of any sample before launching it by clicking on the "Launch" button. This helps you learn by experimenting with Glimmer GUI DSL syntax. To go back to original code, simply hit the "Reset" button.
|
4079
4274
|
|
4275
|
+
Note that if you fail to run any sample through the Glimmer Meta-Sample for whatever reason, you could always run directly by cloning the project, running `bundle`, and then this command (drop the "bin" if you install the glimmer-dsl-swt gem instead):
|
4276
|
+
|
4277
|
+
```ruby
|
4278
|
+
bin/glimmer samples/hello/hello_canvas_transform.rb
|
4279
|
+
```
|
4280
|
+
|
4080
4281
|
### Hello Samples
|
4081
4282
|
|
4082
4283
|
For hello-type simple samples, check the following.
|
@@ -4564,6 +4765,19 @@ Hello, Canvas Animation Another Frame!
|
|
4564
4765
|
|
4565
4766
|
![Hello Canvas Animation Frame 2](images/glimmer-hello-canvas-animation-frame2.png)
|
4566
4767
|
|
4768
|
+
#### Hello, Canvas Transform!
|
4769
|
+
|
4770
|
+
This sample demonstrates the use of the `transform` keyword as part of the [Transform DSL](#canvas-transform-dsl) within the [Shape DSL](#canvas-shape-dsl).
|
4771
|
+
|
4772
|
+
Code:
|
4773
|
+
|
4774
|
+
[samples/hello/hello_canvas_transform.rb](samples/hello/hello_canvas_transform.rb)
|
4775
|
+
|
4776
|
+
Hello, Canvas Transform!
|
4777
|
+
|
4778
|
+
![Hello Canvas Transform](images/glimmer-hello-canvas-transform.png)
|
4779
|
+
|
4780
|
+
|
4567
4781
|
### Elaborate Samples
|
4568
4782
|
|
4569
4783
|
For more elaborate samples, check the following:
|
@@ -4640,10 +4854,22 @@ This sample demonstrates how to build an interactive animated game with MVC arch
|
|
4640
4854
|
|
4641
4855
|
Code:
|
4642
4856
|
|
4643
|
-
[samples/elaborate/
|
4857
|
+
[samples/elaborate/tetris.rb](samples/elaborate/tetris.rb)
|
4644
4858
|
|
4645
4859
|
![Tetris](images/glimmer-tetris.png)
|
4646
4860
|
|
4861
|
+
![Tetris Game Over](images/glimmer-tetris-game-over.png)
|
4862
|
+
|
4863
|
+
![Tetris High Scores](images/glimmer-tetris-high-score-dialog.png)
|
4864
|
+
|
4865
|
+
![Tetris Game Menu](images/glimmer-tetris-game-menu.png)
|
4866
|
+
|
4867
|
+
![Tetris View Menu](images/glimmer-tetris-view-menu.png)
|
4868
|
+
|
4869
|
+
![Tetris Options Menu](images/glimmer-tetris-options-menu.png)
|
4870
|
+
|
4871
|
+
![Tetris Help Menu](images/glimmer-tetris-help-menu.png)
|
4872
|
+
|
4647
4873
|
### External Samples
|
4648
4874
|
|
4649
4875
|
#### Glimmer Calculator
|
@@ -4697,6 +4923,8 @@ If you have a Glimmer app you would like referenced here, please mention in a Pu
|
|
4697
4923
|
|
4698
4924
|
Note: this section mostly applies to Mac and Windows. On Linux, you can just run `glimmer package:gem` and after installing the gem, you get an executable matching the name of the app/custom-shell-gem you are building (e.g. `calculator` command becomes available after installing the [glimmer-cs-calculator](https://github.com/AndyObtiva/glimmer-cs-calculator) gem)
|
4699
4925
|
|
4926
|
+
Note 2: Glimmer packaging has a strong dependency on JDK8 at the moment. JDK9 & JDK10 might work, but JDK11 and onward definitely won't since they dropped javapackager, which later came back as jpackage in JDK14, but it's not ready for prime time yet. Just stick to JDK8 for now, strongly supported by Oracle for the next 6 years at least.
|
4927
|
+
|
4700
4928
|
Glimmer simplifies the process of native-executable packaging and distribution on Mac and Windows via a single `glimmer package` command:
|
4701
4929
|
|
4702
4930
|
```
|
@@ -4803,7 +5031,7 @@ Pass `-v` to javapackager in `Glimmer::RakeTask::Package.javapackager_extra_args
|
|
4803
5031
|
|
4804
5032
|
### Windows Application Packaging
|
4805
5033
|
|
4806
|
-
Windows
|
5034
|
+
Windows s two options for setup packaging:
|
4807
5035
|
- `msi` (recommended): simpler packaging option. Requires [WiX Toolset](https://wixtoolset.org/) and [.NET Framework](https://dotnet.microsoft.com/download/dotnet-framework). Simply run `glimmer package[msi]` (or `glimmer package:native[msi]` if it's not your first time) and it will give you more details on the pre-requisites you need to install (e.g. [WiX Toolset](https://wixtoolset.org/) and [.NET Framework 3.5 SP1](https://dotnet.microsoft.com/download/dotnet-framework/net35-sp1)).
|
4808
5036
|
- `exe`: more advanced packaging option. Requires [Inno Setup](https://jrsoftware.org/isinfo.php). Simply run `glimmer package[exe]` (or `glimmer package:native[exe]` if it's not your first time) and it will tell you what you need to install.
|
4809
5037
|
|