glimmer-dsl-swt 4.18.4.10 → 4.18.5.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +71 -0
  3. data/README.md +14 -5
  4. data/VERSION +1 -1
  5. data/bin/glimmer +3 -3
  6. data/docs/reference/GLIMMER_CONFIGURATION.md +7 -3
  7. data/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md +451 -112
  8. data/docs/reference/GLIMMER_SAMPLES.md +76 -3
  9. data/glimmer-dsl-swt.gemspec +23 -13
  10. data/lib/ext/glimmer/config.rb +3 -7
  11. data/lib/glimmer/data_binding/list_selection_binding.rb +13 -7
  12. data/lib/glimmer/data_binding/table_items_binding.rb +22 -17
  13. data/lib/glimmer/data_binding/tree_items_binding.rb +19 -15
  14. data/lib/glimmer/data_binding/widget_binding.rb +12 -27
  15. data/lib/glimmer/dsl/swt/{file_dialog_expression.rb → auto_exec_expression.rb} +6 -18
  16. data/lib/glimmer/dsl/swt/checkbox_group_selection_data_binding_expression.rb +9 -6
  17. data/lib/glimmer/dsl/swt/color_expression.rb +1 -1
  18. data/lib/glimmer/dsl/swt/combo_selection_data_binding_expression.rb +16 -14
  19. data/lib/glimmer/dsl/swt/custom_widget_expression.rb +4 -1
  20. data/lib/glimmer/dsl/swt/data_binding_expression.rb +1 -2
  21. data/lib/glimmer/dsl/swt/dialog_expression.rb +18 -9
  22. data/lib/glimmer/dsl/swt/dsl.rb +1 -0
  23. data/lib/glimmer/dsl/swt/exec_expression.rb +1 -1
  24. data/lib/glimmer/dsl/swt/font_expression.rb +1 -1
  25. data/lib/glimmer/dsl/swt/image_expression.rb +16 -2
  26. data/lib/glimmer/dsl/swt/list_selection_data_binding_expression.rb +11 -8
  27. data/lib/glimmer/dsl/swt/pixel_expression.rb +1 -1
  28. data/lib/glimmer/dsl/swt/radio_group_selection_data_binding_expression.rb +8 -5
  29. data/lib/glimmer/dsl/swt/shape_expression.rb +2 -2
  30. data/lib/glimmer/dsl/swt/shell_expression.rb +1 -1
  31. data/lib/glimmer/dsl/swt/widget_expression.rb +8 -4
  32. data/lib/glimmer/launcher.rb +3 -0
  33. data/lib/glimmer/rake_task/scaffold.rb +3 -0
  34. data/lib/glimmer/swt/color_proxy.rb +1 -1
  35. data/lib/glimmer/swt/custom/code_text.rb +33 -11
  36. data/lib/glimmer/swt/custom/drawable.rb +57 -1
  37. data/lib/glimmer/swt/custom/shape.rb +332 -48
  38. data/lib/glimmer/swt/custom/shape/arc.rb +60 -0
  39. data/lib/glimmer/{dsl/swt/directory_dialog_expression.rb → swt/custom/shape/focus.rb} +15 -20
  40. data/lib/glimmer/swt/custom/shape/image.rb +112 -0
  41. data/lib/glimmer/swt/custom/shape/line.rb +111 -0
  42. data/lib/glimmer/swt/custom/shape/oval.rb +61 -0
  43. data/lib/glimmer/swt/custom/shape/point.rb +49 -0
  44. data/lib/glimmer/swt/custom/shape/polygon.rb +114 -0
  45. data/lib/glimmer/swt/custom/shape/polyline.rb +115 -0
  46. data/lib/glimmer/swt/custom/shape/rectangle.rb +105 -0
  47. data/lib/glimmer/swt/custom/shape/text.rb +85 -0
  48. data/lib/glimmer/swt/date_time_proxy.rb +9 -3
  49. data/lib/glimmer/swt/dialog_proxy.rb +92 -0
  50. data/lib/glimmer/swt/display_proxy.rb +62 -2
  51. data/lib/glimmer/swt/expand_item_proxy.rb +18 -12
  52. data/lib/glimmer/swt/font_proxy.rb +13 -7
  53. data/lib/glimmer/swt/image_proxy.rb +15 -4
  54. data/lib/glimmer/swt/layout_data_proxy.rb +21 -15
  55. data/lib/glimmer/swt/layout_proxy.rb +19 -15
  56. data/lib/glimmer/swt/menu_proxy.rb +2 -2
  57. data/lib/glimmer/swt/message_box_proxy.rb +21 -7
  58. data/lib/glimmer/swt/properties.rb +3 -0
  59. data/lib/glimmer/swt/proxy_properties.rb +145 -0
  60. data/lib/glimmer/swt/scrolled_composite_proxy.rb +6 -2
  61. data/lib/glimmer/swt/shell_proxy.rb +94 -80
  62. data/lib/glimmer/swt/swt_proxy.rb +16 -0
  63. data/lib/glimmer/swt/tab_item_proxy.rb +5 -3
  64. data/lib/glimmer/swt/table_proxy.rb +32 -11
  65. data/lib/glimmer/swt/transform_proxy.rb +39 -35
  66. data/lib/glimmer/swt/tree_proxy.rb +11 -16
  67. data/lib/glimmer/swt/widget_listener_proxy.rb +6 -2
  68. data/lib/glimmer/swt/widget_proxy.rb +193 -138
  69. data/lib/glimmer/ui.rb +5 -0
  70. data/lib/glimmer/ui/custom_shell.rb +11 -5
  71. data/lib/glimmer/ui/custom_widget.rb +4 -5
  72. data/samples/elaborate/contact_manager.rb +9 -7
  73. data/samples/elaborate/login.rb +27 -21
  74. data/samples/elaborate/mandelbrot_fractal.rb +20 -25
  75. data/samples/elaborate/meta_sample.rb +2 -1
  76. data/samples/elaborate/tetris.rb +3 -1
  77. data/samples/elaborate/tic_tac_toe.rb +18 -14
  78. data/samples/elaborate/tic_tac_toe/board.rb +5 -5
  79. data/samples/elaborate/tic_tac_toe/cell.rb +5 -5
  80. data/samples/elaborate/user_profile.rb +10 -8
  81. data/samples/hello/hello_browser.rb +2 -0
  82. data/samples/hello/hello_button.rb +9 -7
  83. data/samples/hello/hello_canvas.rb +144 -40
  84. data/samples/hello/hello_canvas_animation.rb +2 -0
  85. data/samples/hello/hello_canvas_transform.rb +2 -0
  86. data/samples/hello/hello_checkbox.rb +18 -14
  87. data/samples/hello/hello_checkbox_group.rb +13 -9
  88. data/samples/hello/hello_code_text.rb +2 -0
  89. data/samples/hello/hello_color_dialog.rb +68 -0
  90. data/samples/hello/hello_combo.rb +16 -12
  91. data/samples/hello/hello_computed.rb +9 -7
  92. data/samples/hello/hello_cursor.rb +4 -1
  93. data/samples/hello/hello_custom_shell.rb +18 -21
  94. data/samples/hello/hello_custom_widget.rb +6 -6
  95. data/samples/hello/hello_date_time.rb +16 -12
  96. data/samples/hello/hello_dialog.rb +2 -0
  97. data/samples/hello/hello_directory_dialog.rb +9 -7
  98. data/samples/hello/hello_drag_and_drop.rb +5 -3
  99. data/samples/hello/hello_expand_bar.rb +10 -8
  100. data/samples/hello/hello_file_dialog.rb +9 -7
  101. data/samples/hello/hello_font_dialog.rb +84 -0
  102. data/samples/hello/hello_group.rb +20 -16
  103. data/samples/hello/hello_link.rb +2 -0
  104. data/samples/hello/hello_list_multi_selection.rb +15 -11
  105. data/samples/hello/hello_list_single_selection.rb +15 -11
  106. data/samples/hello/hello_menu_bar.rb +2 -0
  107. data/samples/hello/hello_message_box.rb +2 -0
  108. data/samples/hello/hello_pop_up_context_menu.rb +2 -0
  109. data/samples/hello/hello_progress_bar.rb +5 -5
  110. data/samples/hello/hello_radio.rb +20 -16
  111. data/samples/hello/hello_radio_group.rb +16 -12
  112. data/samples/hello/hello_sash_form.rb +2 -0
  113. data/samples/hello/hello_spinner.rb +9 -7
  114. data/samples/hello/hello_styled_text.rb +19 -17
  115. data/samples/hello/hello_tab.rb +7 -5
  116. data/samples/hello/hello_table.rb +12 -5
  117. data/samples/hello/hello_tree.rb +485 -0
  118. data/samples/hello/hello_world.rb +2 -0
  119. metadata +21 -22
  120. data/lib/glimmer/swt/directory_dialog_proxy.rb +0 -65
  121. data/lib/glimmer/swt/file_dialog_proxy.rb +0 -66
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f06f3cbda7f10f81702dcdff893c91f4b7e381d5e7309c34786993e7000d8fc0
4
- data.tar.gz: d08c04bababf1eb91a6a137ca725a082d66ec2479c71e0ef3f093dd472c68616
3
+ metadata.gz: acf07c3a7c6f534f4082330369a0bacac2593675506da814ec68e70446ec02b9
4
+ data.tar.gz: ff2983c28283b30b4f7f9e6bdf9cc0bad3768331014ef281ff5397726851b39d
5
5
  SHA512:
6
- metadata.gz: 95fbd9e1be14bf90eb36fd92b6e0d86c3a4a3848c1451f1b17234a8fb3521e544c0893d423c04f32bf750c538b6972969407a8ab6fa84e6a3d9ff0181c3fb144
7
- data.tar.gz: 32ddd1acf980524c63fef1722ad1f006cf84d08bd1496b387cd0e6a180dd517b920fc458df34c58b2ac489f2c9b48b6a430a1891a21d9789219e965dc86c8f2b
6
+ metadata.gz: d89da48eb352e555e861032de5b5fee9c1e1ad3e7796c920e354b61b5fb1e2522fa1eafd89e363259ee9c3961ab4207a51ea483ef670e072c869fb1671fecccb
7
+ data.tar.gz: d267615568ac7e20ef8b5778df77cfe36f3de061ab9dd5c4e227b2ef08d5323a27bc6742f07728a84b0760a11f64bdad822c4468f1cf24049ac536919816548e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,76 @@
1
1
  # Change Log
2
2
 
3
+ ### 4.18.5.3
4
+
5
+ - Support nesting shapes within shapes, with relative positioning (meaning x, y coordinates are assumed relative to parent's x, y in nested shapes)
6
+ - Support passing x, y coordinates as :default (or nil or not passed in if they are the last args) in all shapes, meaning they are centered within parent taking their width and height into account
7
+ - Support default_x_delta, y_delta attributes, which add/subtract from defaults used for shape
8
+
9
+ ### 4.18.5.2
10
+
11
+ - Support checking if an `arc` shape accurately includes a point x,y coordinates within pie region only
12
+ - Support checking if an `oval` shape includes a point x,y coordinates in oval region only (not its rectangular region)
13
+ - Support checking if a `focus` shape includes a point x,y coordinates
14
+ - Support checking point inclusion differently in drawed vs filled Rectangle (only check the drawn border when not filled)
15
+ - Support checking point inclusion differently in drawed vs filled Oval (only check the drawn border when not filled)
16
+ - Support checking point inclusion differently in drawed vs filled Arc (only check the drawn border when not filled)
17
+ - Support `#include?(x, y)` and `#contain?(x, y)` methods in `text` shape
18
+ - Fix point inclusion check for polyline
19
+ - Fix issue with `polygon` check if it includes a point x,y coordinates (replace with available `java.awt` robust geometry algorithms)
20
+ - Fix issue with transforms not working after the latest changes
21
+
22
+ ### 4.18.5.1
23
+
24
+ - Hello, Color Dialog! Sample
25
+ - Hello, Font Dialog! Sample
26
+ - Handle SWT RGB color data objects when setting colors on widgets (e.g. background)
27
+ - Enhance Hello, Canvas! with Color selector via right-click menu
28
+ - Fixed issue with tree multi selection throwing an exception
29
+
30
+ ### 4.18.5.0
31
+
32
+ - Automatic `sync_exec` usage from threads other than the GUI thread, thus absolving software engineers from the need to use `sync_exec` explicitly anymore.
33
+ - `auto_exec` keyword to automatically use `sync_exec` with SWT code when needed (running from a thread other than GUI thread)
34
+ - Implement `sync_exec:` option in `bind` keyword with table, tree, combo, and list data-binding (other data-binding types than the standard)
35
+ - Add `async_exec` option to `bind` keyword (covering `data_binding_expression.rb` with `async_exec` properly)
36
+ - Support tree multi-selection data-binding
37
+ - Hello, Tree! sample
38
+ - Enhance Hello, Canvas! with Shape Movement
39
+ - Add Jars.lock to scaffold .gitignore file
40
+ - Add Glimmer::GUI alias for Glimmer::UI module, thus permitting inclusion of Glimmer::GUI::CustomWidget, Glimmer::GUI::CustomShell, and Glimmer::GUI::CustomWindow
41
+ - Provide a quick method for grabbing all available cursor/color options off of SWTProxy (SWTProxy.cursor_options, SWTProxy.cursor_styles, SWTProxy.color_options, SWTProxy.color_styles)
42
+ - Remove explicit git gem dependency given that it is installed via juwelier during scaffolding and is not needed otherwise
43
+ - Support partial image shape drawing by passing source and destination dimensions to `image` shape [documented in docs]
44
+ - Support alternate Canvas Shape DSL syntax for `image` by passing nested properties
45
+ - Canvas Shape DSL argument data-binding support for `image`
46
+ - Support alternate Canvas Shape DSL syntax for `rectangle` by passing nested properties
47
+ - Canvas Shape DSL argument data-binding support for `rectangle(x, y, width, height, fill: false)` standard rectangle, which can be optionally filled
48
+ - Canvas Shape DSL argument data-binding support for `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
49
+ - Canvas Shape DSL argument data-binding support for `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
50
+ - Canvas Shape DSL argument data-binding support for `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)
51
+ - Canvas Shape DSL argument data-binding support for `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)
52
+ - Canvas Shape DSL argument data-binding support for `line(x1, y1, x2, y2)` line
53
+ - Canvas Shape DSL argument data-binding support for `oval(x, y, width, height, fill: false)` oval if width does not match heigh and circle if width matches height. Can be optionally filled.
54
+ - Canvas Shape DSL argument data-binding support for `point(x, y)` point
55
+ - Canvas Shape DSL argument data-binding support for `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)
56
+ - Canvas Shape DSL argument data-binding support for `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)
57
+ - Canvas Shape DSL argument data-binding support for `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))
58
+ - Update Hello, Button!, Hello, Table! sample, Hello, Checkbox Group! sample, Hello, Radio Group! sample, Hello, Combo! sample, Hello, List Single Selection! sample, Hello, List Multi Selection! sample to utilize a CustomShell
59
+ - Refactor all samples to rely on Glimmer::UI::CustomShell given its new class launch method for productive app declaration
60
+ - Fix issue with logging remaining async in debug mode
61
+ - Fix issue with combo, list, radio group, and checkbox group not supporting nested data-binding
62
+
63
+ ### 4.18.4.11
64
+
65
+ - Support creating images pixel by pixel with `image(width, height) {|x,y| [r, g, b]}` keyword, which takes a block with x, y coordinates based on the image width and height and returns a pixel foreground color per point
66
+ - Add proper indentation in code_text upon hitting ENTER
67
+ - Reset Canvas Shape DSL alpha value to 255 when not explicitly set on a shape (Apply in Hello, Canvas! Sample)
68
+ - Provide terse syntax for building canvas objects (autodetecting its width and height)
69
+ - Provide terse syntax for building `:image_double_buffered` canvas objects (autodetecting its width and height):
70
+ - Center mandelbrot where mouse is clicked upon zoom
71
+ - Fix issue with Mandelbrot sample off by one error on Cores selected via Menu
72
+ - Fix use of on_events in code_text widget with lines mode true
73
+
3
74
  ### 4.18.4.10
4
75
 
5
76
  - Hello, Progress Bar!
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.4.10
1
+ # [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for SWT 4.18.5.3
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)
@@ -342,7 +342,7 @@ jgem install glimmer-dsl-swt
342
342
 
343
343
  Or this command if you want a specific version:
344
344
  ```
345
- jgem install glimmer-dsl-swt -v 4.18.4.10
345
+ jgem install glimmer-dsl-swt -v 4.18.5.3
346
346
  ```
347
347
 
348
348
  `jgem` is JRuby's version of `gem` command.
@@ -360,7 +360,7 @@ Note: if you're using activerecord or activesupport, keep in mind that Glimmer u
360
360
 
361
361
  Add the following to `Gemfile`:
362
362
  ```
363
- gem 'glimmer-dsl-swt', '~> 4.18.4.10'
363
+ gem 'glimmer-dsl-swt', '~> 4.18.5.3'
364
364
  ```
365
365
 
366
366
  And, then run:
@@ -404,10 +404,19 @@ Glimmer configuration may be done via the `Glimmer::Config` module.
404
404
 
405
405
  ## Samples
406
406
 
407
- Check the [samples](samples) directory in [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt) for examples on how to write Glimmer applications. To run a sample, make sure to install the `glimmer` gem first and then use the `glimmer samples` command to run it (alternatively, you may clone the repo, follow [CONTRIBUTING.md](CONTRIBUTING.md) instructions, and run samples locally with development glimmer command: `bin/glimmer`).
407
+ See a listing of samples over here, including screenshots and explanations of what each sample demonstrates:
408
408
 
409
409
  [docs/reference/GLIMMER_SAMPLES.md](docs/reference/GLIMMER_SAMPLES.md)
410
410
 
411
+ Check the [samples](samples) directory in [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt) for examples on how to write Glimmer applications. To run a sample, make sure to install the `glimmer-dsl-swt` gem first and then run:
412
+ ```
413
+ glimmer samples
414
+ ```
415
+
416
+ (alternatively, you may clone the repo, follow [CONTRIBUTING.md](CONTRIBUTING.md) instructions, and run samples locally with development glimmer command: `bin/glimmer`)
417
+
418
+ ![Glimmer Meta-Sample](/images/glimmer-meta-sample.png)
419
+
411
420
  ## In Production
412
421
 
413
422
  The following production apps have been built with Glimmer.
@@ -432,7 +441,7 @@ If you have a Glimmer app you would like referenced here, please mention in a Pu
432
441
 
433
442
  ### Connector
434
443
 
435
- [<img alt="Connector Logo" src="https://raw.githubusercontent.com/AndyObtiva/connector/master/package/linux/Connector.png" height=40 /> Connector](https://github.com/AndyObtiva/connector): A minimalist open-source web browser
444
+ [<img alt="Connector Logo" src="https://raw.githubusercontent.com/AndyObtiva/connector/master/package/linux/Connector.png" height=40 /> Connector](https://github.com/AndyObtiva/connector): A minimalist open-source multi-engine web browser
436
445
 
437
446
  ## Packaging & Distribution
438
447
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.18.4.10
1
+ 4.18.5.3
data/bin/glimmer CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env jruby
2
2
 
3
3
  # Copyright (c) 2007-2021 Andy Maleh
4
- #
4
+ #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining
6
6
  # a copy of this software and associated documentation files (the
7
7
  # "Software"), to deal in the Software without restriction, including
@@ -9,10 +9,10 @@
9
9
  # distribute, sublicense, and/or sell copies of the Software, and to
10
10
  # permit persons to whom the Software is furnished to do so, subject to
11
11
  # the following conditions:
12
- #
12
+ #
13
13
  # The above copyright notice and this permission notice shall be
14
14
  # included in all copies or substantial portions of the Software.
15
- #
15
+ #
16
16
  # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
17
  # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
18
  # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -170,11 +170,15 @@ This just tells Glimmer whether to log excluded keywords or not (at the debug le
170
170
 
171
171
  ### auto_sync_exec
172
172
 
173
- (default = false)
173
+ (default = true)
174
+
175
+ 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.
174
176
 
175
- 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.
177
+ Keep in mind that this could cause redraws on every minor change in the models instead of applying large scope changes together.
178
+ In rare cases where you need to avoid causing stutter in the GUI as a result, you can wrap large-scale GUI updates in `auto_exec` manually.
176
179
 
177
- 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.
180
+ As such, this saves developers a lot of headache by not requiring wrapping every bit of GUI update in other threads with `sync_exec`, yet only
181
+ large scale updates in the rare cases where optimization is needed.
178
182
 
179
183
  ## License
180
184
 
@@ -1,7 +1,96 @@
1
- ## Glimmer GUI DSL Syntax
2
-
3
1
  This guide should help you get started with Glimmer DSL for SWT. For more advanced SWT details, please refer to the [SWT Reference](/README.md#swt-reference).
4
2
 
3
+ - [Glimmer GUI DSL Syntax](#glimmer-gui-dsl-syntax)
4
+ - [DSL Auto-Expansion](#dsl-auto-expansion)
5
+ - [Widgets](#widgets)
6
+ - [Glimmer GUI DSL Keywords](#glimmer-gui-dsl-keywords)
7
+ - [SWT Proxies](#swt-proxies)
8
+ - [swt_widget](#swt_widget)
9
+ - [Shell widget proxy methods](#shell-widget-proxy-methods)
10
+ - [Widget Content Block](#widget-content-block)
11
+ - [Shell Icon](#shell-icon)
12
+ - [Shell Icon Tip for Packaging on Windows](#shell-icon-tip-for-packaging-on-windows)
13
+ - [Dialog](#dialog)
14
+ - [message_box](#message_box)
15
+ - [Display](#display)
16
+ - [Multi-Threading](#multi-threading)
17
+ - [async_exec](#async_exec)
18
+ - [sync_exec](#sync_exec)
19
+ - [timer_exec](#timer_exec)
20
+ - [Menus](#menus)
21
+ - [ScrolledComposite](#scrolledcomposite)
22
+ - [Sash Form Widget](#sash-form-widget)
23
+ - [Browser Widget](#browser-widget)
24
+ - [Widget Styles](#widget-styles)
25
+ - [Explicit SWT Style Bit](#explicit-swt-style-bit)
26
+ - [Negative SWT Style Bits](#negative-swt-style-bits)
27
+ - [Extra SWT Styles](#extra-swt-styles)
28
+ - [Non-resizable Window](#non-resizable-window)
29
+ - [Widget Properties](#widget-properties)
30
+ - [Color](#color)
31
+ - [`#swt_color`](#swt_color)
32
+ - [Font](#font)
33
+ - [Image](#image)
34
+ - [Image Options](#image-options)
35
+ - [Cursor](#cursor)
36
+ - [Layouts](#layouts)
37
+ - [Layout Data](#layout-data)
38
+ - [Canvas Shape DSL](#canvas-shape-dsl)
39
+ - [Shapes inside a Widget](#shapes-inside-a-widget)
40
+ - [Shapes inside an Image](#shapes-inside-an-image)
41
+ - [Canvas Shape API](#canvas-shape-api)
42
+ - [Pixel Graphics](#pixel-graphics)
43
+ - [Canvas Transform DSL](#canvas-transform-dsl)
44
+ - [Top-Level Transform Fluent Interface](#top-level-transform-fluent-interface)
45
+ - [Canvas Animation DSL](#canvas-animation-dsl)
46
+ - [Animation via Data-Binding](#animation-via-data-binding)
47
+ - [Data-Binding](#data-binding)
48
+ - [General Examples](#general-examples)
49
+ - [Combo](#combo)
50
+ - [List](#list)
51
+ - [Table](#table)
52
+ - [Table Selection](#table-selection)
53
+ - [Table Editing](#table-editing)
54
+ - [Table Sorting](#table-sorting)
55
+ - [Tree](#tree)
56
+ - [DateTime](#datetime)
57
+ - [Observer](#observer)
58
+ - [Observing Widgets](#observing-widgets)
59
+ - [Alternative Syntax](#alternative-syntax)
60
+ - [Observing Models](#observing-models)
61
+ - [Custom Widgets](#custom-widgets)
62
+ - [Simple Example](#simple-example)
63
+ - [Method-Based Custom Widget Example](#method-based-custom-widget-example)
64
+ - [Class-Based Custom Widget Example](#class-based-custom-widget-example)
65
+ - [Custom Widget Lifecycle Hooks](#custom-widget-lifecycle-hooks)
66
+ - [Lifecycle Hooks Example](#lifecycle-hooks-example)
67
+ - [Custom Widget API](#custom-widget-api)
68
+ - [Content/Options Example](#contentoptions-example)
69
+ - [Custom Widget Gotchas](#custom-widget-gotchas)
70
+ - [Built-In Custom Widgets](#built-in-custom-widgets)
71
+ - [Checkbox Group Custom Widget](#checkbox-group-custom-widget)
72
+ - [Radio Group Custom Widget](#radio-group-custom-widget)
73
+ - [Code Text Custom Widget](#code-text-custom-widget)
74
+ - [Options](#options)
75
+ - [Video Custom Custom Widget](#video-custom-custom-widget)
76
+ - [Custom Widget Final Notes](#custom-widget-final-notes)
77
+ - [Custom Shells](#custom-shells)
78
+ - [Drag and Drop](#drag-and-drop)
79
+ - [Miscellaneous](#miscellaneous)
80
+ - [Multi-DSL Support](#multi-dsl-support)
81
+ - [SWT](#swt)
82
+ - [Opal](#opal)
83
+ - [XML](#xml)
84
+ - [CSS](#css)
85
+ - [Listing / Enabling / Disabling DSLs](#listing--enabling--disabling-dsls)
86
+ - [Application Menu Items (About/Preferences)](#application-menu-items-aboutpreferences)
87
+ - [App Name and Version](#app-name-and-version)
88
+ - [Performance Profiling](#performance-profiling)
89
+ - [SWT Browser Style Options](#swt-browser-style-options)
90
+ - [License](#license)
91
+
92
+ ## Glimmer GUI DSL Syntax
93
+
5
94
  Glimmer's core is a GUI DSL with a lightweight visual syntax that makes it easy to visualize the nesting of widgets in the GUI hierarchy tree.
6
95
 
7
96
  It is available through mixing in the `Glimmer` module, which makes [Glimmer GUI DSL Keywords](#glimmer-gui-dsl-keywords) available to both the instance scope and class scope:
@@ -257,6 +346,7 @@ This is not an exaustive list, but should give you a good start in learning Glim
257
346
  - `async_exec`: featured in [Hello, Custom Widget!](GLIMMER_SAMPLES.md#hello-custom-widget) / [Hello, Custom Shell!](GLIMMER_SAMPLES.md#hello-custom-shell)
258
347
  - `sync_exec`: executes a block on the event loop synchronously (usually from another thread)
259
348
  - `timer_exec`: executes a block after a delay of time has passed
349
+ - `auto_exec`: executes a block on the event loop synchronously only when needed (when running from a thread other than GUI thread)
260
350
 
261
351
  #### SWT Proxies
262
352
 
@@ -342,7 +432,7 @@ Dialog is a variation on Shell. It is basically a shell that is modal (blocks wh
342
432
 
343
433
  Glimmer facilitates building dialogs by using the `dialog` keyword, which automatically adds the SWT.DIALOG_TRIM and SWT.APPLICATION_MODAL [widget styles](#widget-styles) needed for a dialog.
344
434
 
345
- Check out [Hello, Dialog!](#hello-dialog) sample to learn more.
435
+ Check out [Hello, Dialog!](GLIMMER_SAMPLES.md#hello-dialog) sample to learn more.
346
436
 
347
437
  ##### message_box
348
438
 
@@ -411,6 +501,15 @@ Although SWT Display is not technically a widget, it has similar APIs and DSL su
411
501
 
412
502
  [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.
413
503
 
504
+ Most of the time, you simply get away with Ruby [Threads](https://ruby-doc.org/core-2.5.7/Thread.html) and [Mutexes](https://ruby-doc.org/core-2.5.7/Mutex.html).
505
+
506
+ Otherwise, if you need more advanced concurrency, Glimmer includes the [concurrent-ruby gem](https://rubygems.org/gems/concurrent-ruby), which supports many helpful concurrency techniques such as [Thread Pools](http://ruby-concurrency.github.io/concurrent-ruby/master/file.thread_pools.html) (used in the [Mandelbrot Fractal](GLIMMER_SAMPLES.md#mandelbrot-fractal) sample).
507
+
508
+ One thing Glimmer DSL for SWT innovates over plain old SWT is not requiring developers to explicitly use `Display.syncExec` from threads other than the GUI threads.
509
+ Glimmer automatically detects if you're running in a different thread and uses `Display.syncExec` automatically using its own enhanced `auto_exec`
510
+
511
+ In any case, Glimmer still allows developers to manually use `sync_exec`, `async_exec`, `timer_exec`, and `auto_exec` when needed. M
512
+
414
513
  ##### async_exec
415
514
 
416
515
  `async_exec {}` is a Glimmer DSL keyword in addition to being a method on `display`. It accepts a block and when invoked, adds the block to the end of a queue of GUI events scheduled to run on the SWT event loop, executing asynchronously.
@@ -441,7 +540,11 @@ Thread.new {
441
540
 
442
541
  ##### sync_exec
443
542
 
444
- `sync_exec {}` works just like `async_exec` except it executes the block synchronously at the earliest opportunity possible, waiting for the block to be finished.
543
+ `sync_exec {}` is required by SWT when running GUI update from a thread other than the GUI thread. In Glimmer, it is automatically invoked for you so that you wouldn't have to worry about it. It works just like `async_exec` except it executes the block synchronously at the earliest opportunity possible, waiting for the block to be finished.
544
+
545
+ ##### auto_exec
546
+
547
+ `auto_exec(override_sync_exec:, override_async_exec) {}` only executes code block with `sync_exec` when necessary (running from a thread other than the GUI thread). It is used automatically all over the Glimmer DSL for SWT codebase, so you wouldn't need it unless you grab a direct handle on `swt_widget` from a widget proxy.
445
548
 
446
549
  ##### timer_exec
447
550
 
@@ -792,7 +895,7 @@ shell {
792
895
  }.open
793
896
  ```
794
897
 
795
- You may check out a more full-fledged example in [Hello, Sash Form!](#hello-sash-form)
898
+ You may check out a more full-fledged example in [Hello, Sash Form!](GLIMMER_SAMPLES.md#hello-sash-form)
796
899
 
797
900
  ![Hello Sash Form](/images/glimmer-hello-sash-form.png)
798
901
 
@@ -1282,16 +1385,15 @@ https://help.eclipse.org/2019-12/nftopic/org.eclipse.platform.doc.isv/reference/
1282
1385
 
1283
1386
  **(ALPHA FEATURE)**
1284
1387
 
1285
- Glimmer supports drawing graphics directly on a `canvas` widget via SWT (or any widget for that matter though `canvas` is recommended for drawing).
1388
+ While other GUI toolkits only offer a way to draw graphics imperatively (e.g. fill_rectangle, draw_point, 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.
1286
1389
 
1287
- `canvas` has the `:double_buffered` SWT style by default to ensure flicker-free rendering. If you need to disable it for whatever reason, just pass the `:none` SWT style instead (e.g. `canvas(:none)`)
1288
-
1289
- 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.
1390
+ `canvas` has the `:double_buffered` SWT style by default on platforms that need it (Windows & Linux) to ensure flicker-free rendering. If you need to disable it for whatever reason, just pass the `:none` SWT style instead (e.g. `canvas(:none)`)
1290
1391
 
1291
1392
  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):
1292
1393
  - `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)
1293
1394
  - `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)
1294
1395
  - `image(image, x = 0, y = 0)` sets [image](#image), which could be an [org.eclipse.swt.graphics.Image](https://help.eclipse.org/2020-12/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/graphics/Image.html) object or just a file path string
1396
+ - `image(image, source_x, source_y, source_width, source_height, destination_x, destination_y, destination_width, destination_height)` sets part of an [image](#image) and scales it to fit destination dimensions on parent canvas/widget
1295
1397
  - `line(x1, y1, x2, y2)` line
1296
1398
  - `oval(x, y, width, height, fill: false)` oval if width does not match heigh and circle if width matches height. Can be optionally filled.
1297
1399
  - `point(x, y)` point
@@ -1300,9 +1402,10 @@ Shape keywords and their args (including defaults) are listed below (they basica
1300
1402
  - `rectangle(x, y, width, height, fill: false)` standard rectangle, which can be optionally filled
1301
1403
  - `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
1302
1404
  - `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
1303
- - `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))
1405
+ - `text(string, x, y, is_transparent = true)` text with optional is_transparent to indicate if background is transparent (default is true)
1406
+ - `text(string, x, y, flags)` 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))
1304
1407
 
1305
- Shape keywords that can be filled with color can take an keyword argument `fill: true`. Defaults to false when not specified unless background is set with no foreground (or foreground is set with no background), in which case a smart default is applied.
1408
+ Shape keywords that can be filled with color can take a keyword argument `fill: true`. Defaults to false when not specified unless background is set with no foreground (or foreground is set with no background), in which case a smart default is applied.
1306
1409
  Smart defaults can be applied to automatically infer `gradient: true` (rectangle with both foreground and background) and `round: true` (rectangle with more than 4 args, the extra args are numeric) as well.
1307
1410
 
1308
1411
  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.
@@ -1369,7 +1472,115 @@ Screenshot:
1369
1472
 
1370
1473
  ![Canvas Animation Example](/images/glimmer-example-canvas.png)
1371
1474
 
1372
- Learn more at the [Hello, Canvas! Sample](#hello-canvas).
1475
+ If you specify the x and y coordinates as `:default`, `nil`, or leave them out, they get calculated automatically by centering the shape within its parent `canvas`.
1476
+
1477
+ Note that you could shift a shape off its centered position within its parent `canvas` by using `x_delta` and `y_delta` instead of `x` and `y`
1478
+
1479
+ The round and gradient options could be dropped since Glimmer DSL for SWT supports auto-inference of them based on shape parameters.
1480
+
1481
+ Example (you may copy/paste in [`girb`](GLIMMER_GIRB.md)):
1482
+
1483
+ ```ruby
1484
+ include Glimmer
1485
+
1486
+ # image object has to be declared outside the canvas and shell to avoid confusing with canvas image property
1487
+ image_object = image(File.expand_path('./icons/scaffold_app.png'), width: 100)
1488
+
1489
+ shell {
1490
+ text 'Canvas Example'
1491
+ minimum_size 320, 400
1492
+
1493
+ canvas {
1494
+ background :dark_yellow
1495
+ rectangle(0, 0, 220, 400) {
1496
+ background :dark_red
1497
+ }
1498
+ rectangle(50, 20, 300, 150, 30, 50) {
1499
+ background :yellow
1500
+ }
1501
+ rectangle(150, 200, 100, 70, true) {
1502
+ background :dark_red
1503
+ foreground :yellow
1504
+ }
1505
+ text('Glimmer', 208, 83) {
1506
+ font height: 25, style: :bold
1507
+ }
1508
+ rectangle(200, 80, 108, 36) {
1509
+ foreground :black
1510
+ line_width 3
1511
+ }
1512
+ image(image_object, 70, 50)
1513
+ }
1514
+ }.open
1515
+ ```
1516
+
1517
+ Notice how the shape declaration parameters perfectly match the method parameters in the [SWT org.eclipse.swt.graphics.GC API](https://help.eclipse.org/2020-12/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/graphics/GC.html). This is useful for developers coming to Glimmer DSL for SWT from SWT.
1518
+
1519
+ Of course, Glimmer DSL for SWT still supports an alternative syntax that is more declarative and consistent with the rest of the Glimmer GUI DSL syntax. This syntax in fact offers the extra-benefit of data-binding for shape parameter values (meaning you could use `bind(...)` syntax with them instead of setting values directly)
1520
+
1521
+ Example (you may copy/paste in [`girb`](GLIMMER_GIRB.md)):
1522
+
1523
+ ```ruby
1524
+ include Glimmer
1525
+
1526
+ # image object has to be declared outside the canvas and shell to avoid confusing with canvas image property
1527
+ image_object = image(File.expand_path('./icons/scaffold_app.png'), width: 100)
1528
+
1529
+ shell {
1530
+ text 'Canvas Example'
1531
+ minimum_size 320, 400
1532
+
1533
+ canvas {
1534
+ background :dark_yellow
1535
+ rectangle {
1536
+ x 0
1537
+ y 0
1538
+ width 220
1539
+ height 400
1540
+ background :dark_red
1541
+ }
1542
+ rectangle {
1543
+ x 50
1544
+ x 20
1545
+ width 300
1546
+ height 150
1547
+ arc_width 30
1548
+ arc_height 50
1549
+ background :yellow
1550
+ }
1551
+ rectangle {
1552
+ x 150
1553
+ y 200
1554
+ width 100
1555
+ height 70
1556
+ vertical true
1557
+ background :dark_red
1558
+ foreground :yellow
1559
+ }
1560
+ text {
1561
+ string 'Glimmer'
1562
+ x 208
1563
+ y 83
1564
+ font height: 25, style: :bold
1565
+ }
1566
+ rectangle {
1567
+ x 200
1568
+ y 80
1569
+ width 108
1570
+ height 36
1571
+ foreground :black
1572
+ line_width 3
1573
+ }
1574
+ image {
1575
+ image image_object
1576
+ x 70
1577
+ y 50
1578
+ }
1579
+ }
1580
+ }.open
1581
+ ```
1582
+
1583
+ Learn more at the [Hello, Canvas! Sample](GLIMMER_SAMPLES.md#hello-canvas).
1373
1584
 
1374
1585
  If you ever have special needs or optimizations, you could always default to direct SWT painting via [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) instead. 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).
1375
1586
 
@@ -1411,6 +1622,149 @@ shell {
1411
1622
  }.open
1412
1623
  ```
1413
1624
 
1625
+ #### Shapes inside a Shape
1626
+
1627
+ Shapes can be nested within each other. If you nest a shape within another, its coordinates are assumed to be relative to its parent.
1628
+
1629
+ As such, if you move the parent, it moves all its children with it.
1630
+
1631
+ If you specify the x and y coordinates as `:default`, `nil`, or leave them out, they get calculated automatically by centering the shape within its parent shape relatively.
1632
+
1633
+ Note that you could shift a shape off its centered position within its parent shape by using `x_delta` and `y_delta` instead of `x` and `y`
1634
+
1635
+ Check [Hello, Canvas!](GLIMMER_SAMPLES.md#hello-canvas) for an example that nests lines, points, a polyline, and an image within a drawn rectangle parent:
1636
+
1637
+ ```ruby
1638
+ rectangle(205, 50, 88, 96) {
1639
+ foreground :yellow
1640
+ 3.times { |n|
1641
+ line(45, 70 + n*10, 65 + n*10, 30 + n*10) {
1642
+ foreground :yellow
1643
+ }
1644
+ }
1645
+ 10.times {|n|
1646
+ point(15 + n*5, 50 + n*5) {
1647
+ foreground :yellow
1648
+ }
1649
+ }
1650
+ polyline(45, 60, 55, 20, 65, 60, 85, 80, 45, 60)
1651
+ image(@image_object, 0, 5)
1652
+ }
1653
+ ```
1654
+
1655
+ #### Shapes inside a Widget
1656
+
1657
+ 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](GLIMMER_SAMPLES.md#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`.
1658
+
1659
+ #### Shapes inside an Image
1660
+
1661
+ You can build an image using the Canvas Shape DSL (including setting the icon of the application).
1662
+
1663
+ Example (you may copy/paste in [`girb`](GLIMMER_GIRB.md)):
1664
+
1665
+ ```
1666
+ include Glimmer
1667
+
1668
+ shell {
1669
+ text 'Image Shape DSL Example'
1670
+ label {
1671
+ bevel_constant = 20
1672
+ icon_block_size = 64
1673
+ icon_bevel_size = icon_block_size.to_f / 25.to_f
1674
+ icon_bevel_pixel_size = 0.16*icon_block_size.to_f
1675
+ icon_size = 8
1676
+ icon_pixel_size = icon_block_size * icon_size
1677
+ image(icon_pixel_size, icon_pixel_size) {
1678
+ icon_size.times { |row|
1679
+ icon_size.times { |column|
1680
+ colored = row >= 1 && column.between?(1, 6)
1681
+ color = colored ? color([:white, :red, :blue, :green, :yellow, :magenta, :cyan, :dark_blue].sample) : color(:white)
1682
+ x = column * icon_block_size
1683
+ y = row * icon_block_size
1684
+ rectangle(x, y, icon_block_size, icon_block_size) {
1685
+ background color
1686
+ }
1687
+ polygon(x, y, x + icon_block_size, y, x + icon_block_size - icon_bevel_pixel_size, y + icon_bevel_pixel_size, x + icon_bevel_pixel_size, y + icon_bevel_pixel_size) {
1688
+ background rgb(color.red + 4*bevel_constant, color.green + 4*bevel_constant, color.blue + 4*bevel_constant)
1689
+ }
1690
+ polygon(x + icon_block_size, y, x + icon_block_size - icon_bevel_pixel_size, y + icon_bevel_pixel_size, x + icon_block_size - icon_bevel_pixel_size, y + icon_block_size - icon_bevel_pixel_size, x + icon_block_size, y + icon_block_size) {
1691
+ background rgb(color.red - bevel_constant, color.green - bevel_constant, color.blue - bevel_constant)
1692
+ }
1693
+ polygon(x + icon_block_size, y + icon_block_size, x, y + icon_block_size, x + icon_bevel_pixel_size, y + icon_block_size - icon_bevel_pixel_size, x + icon_block_size - icon_bevel_pixel_size, y + icon_block_size - icon_bevel_pixel_size) {
1694
+ background rgb(color.red - 2*bevel_constant, color.green - 2*bevel_constant, color.blue - 2*bevel_constant)
1695
+ }
1696
+ polygon(x, y, x, y + icon_block_size, x + icon_bevel_pixel_size, y + icon_block_size - icon_bevel_pixel_size, x + icon_bevel_pixel_size, y + icon_bevel_pixel_size) {
1697
+ background rgb(color.red - bevel_constant, color.green - bevel_constant, color.blue - bevel_constant)
1698
+ }
1699
+ }
1700
+ }
1701
+ }
1702
+ }
1703
+ }.open
1704
+ ```
1705
+
1706
+ ![Image Shape DSL](/images/glimmer-example-image-shape-dsl.png)
1707
+
1708
+ Example setting the icon of the application (you may copy/paste in [`girb`](GLIMMER_GIRB.md)):
1709
+
1710
+ ```
1711
+ include Glimmer
1712
+
1713
+ shell {
1714
+ text 'Image Shape DSL Example'
1715
+ label {
1716
+ text 'Image Shape DSL Example'
1717
+ font height: 30
1718
+ }
1719
+ bevel_constant = 20
1720
+ icon_block_size = 64
1721
+ icon_bevel_size = icon_block_size.to_f / 25.to_f
1722
+ icon_bevel_pixel_size = 0.16*icon_block_size.to_f
1723
+ icon_size = 8
1724
+ icon_pixel_size = icon_block_size * icon_size
1725
+ image(icon_pixel_size, icon_pixel_size) {
1726
+ icon_size.times { |row|
1727
+ icon_size.times { |column|
1728
+ colored = row >= 1 && column.between?(1, 6)
1729
+ color = colored ? color([:white, :red, :blue, :green, :yellow, :magenta, :cyan, :dark_blue].sample) : color(:white)
1730
+ x = column * icon_block_size
1731
+ y = row * icon_block_size
1732
+ rectangle(x, y, icon_block_size, icon_block_size) {
1733
+ background color
1734
+ }
1735
+ polygon(x, y, x + icon_block_size, y, x + icon_block_size - icon_bevel_pixel_size, y + icon_bevel_pixel_size, x + icon_bevel_pixel_size, y + icon_bevel_pixel_size) {
1736
+ background rgb(color.red + 4*bevel_constant, color.green + 4*bevel_constant, color.blue + 4*bevel_constant)
1737
+ }
1738
+ polygon(x + icon_block_size, y, x + icon_block_size - icon_bevel_pixel_size, y + icon_bevel_pixel_size, x + icon_block_size - icon_bevel_pixel_size, y + icon_block_size - icon_bevel_pixel_size, x + icon_block_size, y + icon_block_size) {
1739
+ background rgb(color.red - bevel_constant, color.green - bevel_constant, color.blue - bevel_constant)
1740
+ }
1741
+ polygon(x + icon_block_size, y + icon_block_size, x, y + icon_block_size, x + icon_bevel_pixel_size, y + icon_block_size - icon_bevel_pixel_size, x + icon_block_size - icon_bevel_pixel_size, y + icon_block_size - icon_bevel_pixel_size) {
1742
+ background rgb(color.red - 2*bevel_constant, color.green - 2*bevel_constant, color.blue - 2*bevel_constant)
1743
+ }
1744
+ polygon(x, y, x, y + icon_block_size, x + icon_bevel_pixel_size, y + icon_block_size - icon_bevel_pixel_size, x + icon_bevel_pixel_size, y + icon_bevel_pixel_size) {
1745
+ background rgb(color.red - bevel_constant, color.green - bevel_constant, color.blue - bevel_constant)
1746
+ }
1747
+ }
1748
+ }
1749
+ }
1750
+ }.open
1751
+ ```
1752
+
1753
+ ![Image Shape DSL](/images/glimmer-example-image-shape-dsl-app-switcher-icon.png)
1754
+
1755
+ #### Canvas Shape API
1756
+
1757
+ These Canvas Shape API methods help with manipulating shapes upon user interaction, such as mouse clicking a specific shape.
1758
+
1759
+ They are implemented with the help of the highly robust Java built-in shape geometry algorithms.
1760
+
1761
+ - `WidgetProxy#shape_at_location(x, y)` : returns shape object at x, y location from a widget proxy like canvas
1762
+ - `Shape#contain?(x, y)` : indicates if shape contains x, y point
1763
+ - `Shape#include?(x, y)` : indicates if shape includes x, y point on the edge if drawn or inside if filled (include uses contain for filled shapes)
1764
+ - `Shape#move_by(x_delta, y_delta)` : moves shape object at x, y location
1765
+
1766
+ Check [Hello, Canvas!](GLIMMER_SAMPLES.md#hello-canvas) for an example.
1767
+
1414
1768
  #### Pixel Graphics
1415
1769
 
1416
1770
  **(Early Alpha Feature)**
@@ -1440,6 +1794,21 @@ Result:
1440
1794
 
1441
1795
  ![glimmer example pixel graphics](/images/glimmer-example-pixel-graphics.png)
1442
1796
 
1797
+ If you are strictly dealing with pixels (no other shapes), you could even avoid the `pixel` keyword altogether and just provide direct foreground colors by passing a block that receives x, y coordinates:
1798
+
1799
+ ```ruby
1800
+ include Glimmer
1801
+
1802
+ shell {
1803
+ minimum_size 250, 265
1804
+ text 'Pixel Graphics Example'
1805
+
1806
+ canvas { |x, y|
1807
+ [y%255, x%255, (x+y)%255]
1808
+ }
1809
+ }.open
1810
+ ```
1811
+
1443
1812
  Remember that you could always default to direct SWT painting via [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) too for even faster performance when needed in rare circumstances. 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).
1444
1813
 
1445
1814
  Example of manually doing the same things as in the previous example without relying on the declarative Glimmer Shape DSL (you may copy/paste in [`girb`](GLIMMER_GIRB.md)):
@@ -1465,6 +1834,8 @@ shell {
1465
1834
  }.open
1466
1835
  ```
1467
1836
 
1837
+ (the code could be optimized further if you are repeating colors by simply reusing `Color` objects instead of re-constructing them)
1838
+
1468
1839
  The only downside with the approach above is that it repaints all pixels on repaints to the window (e.g. during window resize). To get around that, we can rely on a technique called **Image Double-Buffering**. That is to buffer the graphics on an Image first and then set it on the Canvas so that resizes of the shell dont cause a repaint of all the pixels. Additionally, this gives us the added benefit of being able to use the image as a Shell icon via its `image` property.
1469
1840
 
1470
1841
  Example (you may copy/paste in [`girb`](GLIMMER_GIRB.md)):
@@ -1501,127 +1872,80 @@ If you need a transparent background for the image, replace the image constructi
1501
1872
 
1502
1873
  That way, wherever you don't draw a point, you get transparency (seeing what is behind the image).
1503
1874
 
1504
- If you don't need a `shell` image icon and `pixel` performance is enough, you can automatically apply **Image Double-Buffering** with the `:image_double_buffered` SWT style (custom Glimmer style not available in SWT itself)
1505
-
1506
- Example (you may copy/paste in [`girb`](GLIMMER_GIRB.md)):
1875
+ Alternatively, with a very minor performance penalty, Glimmer enables you to build the image pixel by pixel with a friendly Ruby syntax by passing a block that takes the x and y coordinates and returns a foreground color rgb array or Color/ColorProxy object.
1507
1876
 
1508
1877
  ```ruby
1509
1878
  include Glimmer
1510
1879
 
1880
+ @the_image = image(250, 250) {|x, y|
1881
+ [y%255, x%255, (x+y)%255]
1882
+ }
1883
+
1511
1884
  shell {
1512
1885
  minimum_size 250, 265
1513
1886
  text 'Pixel Graphics Example'
1887
+ image @the_image
1514
1888
 
1515
- canvas(:image_double_buffered) {
1516
- 250.times {|y|
1517
- 250.times {|x|
1518
- pixel(x, y, foreground: [y%255, x%255, (x+y)%255])
1519
- }
1520
- }
1889
+ canvas {
1890
+ image @the_image
1521
1891
  }
1522
1892
  }.open
1523
1893
  ```
1524
1894
 
1525
- #### Shapes inside a Widget
1895
+ If you don't need a `shell` image (icon), you can nest the image directly under the canvas by passing in the `top_level` keyword to treat `image` as a top-level keyword (pretending it is built outside the shell).
1526
1896
 
1527
- 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`.
1897
+ ```ruby
1898
+ include Glimmer
1528
1899
 
1529
- #### Shapes inside an Image
1900
+ shell {
1901
+ minimum_size 250, 265
1902
+ text 'Pixel Graphics Example'
1903
+
1904
+ canvas {
1905
+ image image(250, 250, top_level: true) {|x, y|
1906
+ [y%255, x%255, (x+y)%255]
1907
+ }
1908
+ }
1909
+ }.open
1910
+ ```
1530
1911
 
1531
- You can build an image using the Canvas Shape DSL (including setting the icon of the application).
1912
+ If you don't need a `shell` image (icon) and `pixel` performance is enough, you can automatically apply **Image Double-Buffering** with the `:image_double_buffered` SWT style (custom Glimmer style not available in SWT itself)
1532
1913
 
1533
1914
  Example (you may copy/paste in [`girb`](GLIMMER_GIRB.md)):
1534
1915
 
1535
- ```
1916
+ ```ruby
1536
1917
  include Glimmer
1537
1918
 
1538
1919
  shell {
1539
- text 'Image Shape DSL Example'
1540
- label {
1541
- bevel_constant = 20
1542
- icon_block_size = 64
1543
- icon_bevel_size = icon_block_size.to_f / 25.to_f
1544
- icon_bevel_pixel_size = 0.16*icon_block_size.to_f
1545
- icon_size = 8
1546
- icon_pixel_size = icon_block_size * icon_size
1547
- image(icon_pixel_size, icon_pixel_size) {
1548
- icon_size.times { |row|
1549
- icon_size.times { |column|
1550
- colored = row >= 1 && column.between?(1, 6)
1551
- color = colored ? color([:white, :red, :blue, :green, :yellow, :magenta, :cyan, :dark_blue].sample) : color(:white)
1552
- x = column * icon_block_size
1553
- y = row * icon_block_size
1554
- rectangle(x, y, icon_block_size, icon_block_size) {
1555
- background color
1556
- }
1557
- polygon(x, y, x + icon_block_size, y, x + icon_block_size - icon_bevel_pixel_size, y + icon_bevel_pixel_size, x + icon_bevel_pixel_size, y + icon_bevel_pixel_size) {
1558
- background rgb(color.red + 4*bevel_constant, color.green + 4*bevel_constant, color.blue + 4*bevel_constant)
1559
- }
1560
- polygon(x + icon_block_size, y, x + icon_block_size - icon_bevel_pixel_size, y + icon_bevel_pixel_size, x + icon_block_size - icon_bevel_pixel_size, y + icon_block_size - icon_bevel_pixel_size, x + icon_block_size, y + icon_block_size) {
1561
- background rgb(color.red - bevel_constant, color.green - bevel_constant, color.blue - bevel_constant)
1562
- }
1563
- polygon(x + icon_block_size, y + icon_block_size, x, y + icon_block_size, x + icon_bevel_pixel_size, y + icon_block_size - icon_bevel_pixel_size, x + icon_block_size - icon_bevel_pixel_size, y + icon_block_size - icon_bevel_pixel_size) {
1564
- background rgb(color.red - 2*bevel_constant, color.green - 2*bevel_constant, color.blue - 2*bevel_constant)
1565
- }
1566
- polygon(x, y, x, y + icon_block_size, x + icon_bevel_pixel_size, y + icon_block_size - icon_bevel_pixel_size, x + icon_bevel_pixel_size, y + icon_bevel_pixel_size) {
1567
- background rgb(color.red - bevel_constant, color.green - bevel_constant, color.blue - bevel_constant)
1568
- }
1569
- }
1920
+ minimum_size 250, 265
1921
+ text 'Pixel Graphics Example'
1922
+
1923
+ canvas(:image_double_buffered) {
1924
+ 250.times {|y|
1925
+ 250.times {|x|
1926
+ pixel(x, y, foreground: [y%255, x%255, (x+y)%255])
1570
1927
  }
1571
1928
  }
1572
1929
  }
1573
1930
  }.open
1574
1931
  ```
1575
1932
 
1576
- ![Image Shape DSL](/images/glimmer-example-image-shape-dsl.png)
1933
+ Of course, you could also take advantage of the pixel-less terser syntax:
1577
1934
 
1578
- Example setting the icon of the application (you may copy/paste in [`girb`](GLIMMER_GIRB.md)):
1579
-
1580
- ```
1935
+ ```ruby
1581
1936
  include Glimmer
1582
1937
 
1583
1938
  shell {
1584
- text 'Image Shape DSL Example'
1585
- label {
1586
- text 'Image Shape DSL Example'
1587
- font height: 30
1588
- }
1589
- bevel_constant = 20
1590
- icon_block_size = 64
1591
- icon_bevel_size = icon_block_size.to_f / 25.to_f
1592
- icon_bevel_pixel_size = 0.16*icon_block_size.to_f
1593
- icon_size = 8
1594
- icon_pixel_size = icon_block_size * icon_size
1595
- image(icon_pixel_size, icon_pixel_size) {
1596
- icon_size.times { |row|
1597
- icon_size.times { |column|
1598
- colored = row >= 1 && column.between?(1, 6)
1599
- color = colored ? color([:white, :red, :blue, :green, :yellow, :magenta, :cyan, :dark_blue].sample) : color(:white)
1600
- x = column * icon_block_size
1601
- y = row * icon_block_size
1602
- rectangle(x, y, icon_block_size, icon_block_size) {
1603
- background color
1604
- }
1605
- polygon(x, y, x + icon_block_size, y, x + icon_block_size - icon_bevel_pixel_size, y + icon_bevel_pixel_size, x + icon_bevel_pixel_size, y + icon_bevel_pixel_size) {
1606
- background rgb(color.red + 4*bevel_constant, color.green + 4*bevel_constant, color.blue + 4*bevel_constant)
1607
- }
1608
- polygon(x + icon_block_size, y, x + icon_block_size - icon_bevel_pixel_size, y + icon_bevel_pixel_size, x + icon_block_size - icon_bevel_pixel_size, y + icon_block_size - icon_bevel_pixel_size, x + icon_block_size, y + icon_block_size) {
1609
- background rgb(color.red - bevel_constant, color.green - bevel_constant, color.blue - bevel_constant)
1610
- }
1611
- polygon(x + icon_block_size, y + icon_block_size, x, y + icon_block_size, x + icon_bevel_pixel_size, y + icon_block_size - icon_bevel_pixel_size, x + icon_block_size - icon_bevel_pixel_size, y + icon_block_size - icon_bevel_pixel_size) {
1612
- background rgb(color.red - 2*bevel_constant, color.green - 2*bevel_constant, color.blue - 2*bevel_constant)
1613
- }
1614
- polygon(x, y, x, y + icon_block_size, x + icon_bevel_pixel_size, y + icon_block_size - icon_bevel_pixel_size, x + icon_bevel_pixel_size, y + icon_bevel_pixel_size) {
1615
- background rgb(color.red - bevel_constant, color.green - bevel_constant, color.blue - bevel_constant)
1616
- }
1617
- }
1618
- }
1939
+ minimum_size 250, 265
1940
+ text 'Pixel Graphics Example'
1941
+
1942
+ canvas(:image_double_buffered) { |x, y|
1943
+ [y%255, x%255, (x+y)%255]
1619
1944
  }
1620
1945
  }.open
1621
1946
  ```
1622
1947
 
1623
- ![Image Shape DSL](/images/glimmer-example-image-shape-dsl-app-switcher-icon.png)
1624
-
1948
+ As they say, there are many ways to skin a cat! This is in line with the Ruby way of providing more ways than one. Pick and choose the right tool for the job just like true software engineers.
1625
1949
 
1626
1950
  ### Canvas Transform DSL
1627
1951
 
@@ -1705,7 +2029,7 @@ transform(1, 1, 4, 2, 2, 4).
1705
2029
  translate(3, 7)
1706
2030
  ```
1707
2031
 
1708
- Learn more at the [Hello, Canvas Transform! Sample](#hello-canvas-transform).
2032
+ Learn more at the [Hello, Canvas Transform! Sample](GLIMMER_SAMPLES.md#hello-canvas-transform).
1709
2033
 
1710
2034
  ### Canvas Animation DSL
1711
2035
 
@@ -1771,7 +2095,7 @@ API of Animation Object (returned from `animation` keyword):
1771
2095
  - `#cycle_limited?` returns true if `cycle_count` is specified
1772
2096
  - `#duration_limited?` returns true if `duration_limit` is specified
1773
2097
 
1774
- Learn more at the [Hello, Canvas Animation! Sample](#hello-canvas-animation).
2098
+ Learn more at the [Hello, Canvas Animation! Sample](GLIMMER_SAMPLES.md#hello-canvas-animation).
1775
2099
 
1776
2100
  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.
1777
2101
 
@@ -1779,7 +2103,7 @@ If there is anything missing you would like added to the Glimmer Animation DSL t
1779
2103
 
1780
2104
  Animation could be alternatively implemented without the `animation` keyword through a loop that invokes model methods inside `sync_exec {}` (or `async_exec {}`), which indirectly cause updates to the GUI via data-binding.
1781
2105
 
1782
- The [Glimmer Tetris](#glimmer-tetris) sample provides a good example of that.
2106
+ The [Glimmer Tetris](GLIMMER_SAMPLES.md#tetris) sample provides a good example of that.
1783
2107
 
1784
2108
  ### Data-Binding
1785
2109
 
@@ -1802,11 +2126,15 @@ This example adds on the one above it by specifying converters on read and write
1802
2126
 
1803
2127
  `text bind(contact, 'address.street', sync_exec: true)`
1804
2128
 
1805
- This example adds does GUI updates via [sync_exec](#sync_exec) assuming they are coming from another thread (different from the GUI thread)
2129
+ **(ALPHA FEATURE)**
2130
+
2131
+ This example forces GUI updates via [sync_exec](#sync_exec) assuming they are coming from another thread (different from the GUI thread)
1806
2132
 
1807
2133
  `text bind(contact, 'address.street', async_exec: true)`
1808
2134
 
1809
- This example adds does GUI updates via [async_exec](#async_exec) assuming they are coming from another thread (different from the GUI thread)
2135
+ **(ALPHA FEATURE)**
2136
+
2137
+ This example forces GUI updates via [async_exec](#async_exec) assuming they are coming from another thread (different from the GUI thread)
1810
2138
 
1811
2139
  `text bind(contact, 'address.street', on_read: lambda { |s| s[0..10] })`
1812
2140
 
@@ -2136,7 +2464,7 @@ shell {
2136
2464
  }
2137
2465
  ```
2138
2466
 
2139
- Check out [Hello, Table!](#hello-table) for an actual example including table editors.
2467
+ Check out [Hello, Table!](GLIMMER_SAMPLES.md#hello-table) for an actual example including table editors.
2140
2468
 
2141
2469
  [Are We There Yet?](#are-we-there-yet) is an actual production Glimmer application that takes full advantage of table capabilities, storing model data in a database via ActiveRecord. As such, it's an excellent demonstration of how to use Glimmer DSL for SWT with a database.
2142
2470
 
@@ -2144,7 +2472,7 @@ Check out [Hello, Table!](#hello-table) for an actual example including table ed
2144
2472
 
2145
2473
  Glimmer automatically adds sorting support to the SWT `Table` widget.
2146
2474
 
2147
- Check out the [Contact Manager](#contact-manager) sample for an example.
2475
+ Check out the [Contact Manager](GLIMMER_SAMPLES.md#contact-manager) sample for an example.
2148
2476
  You may click on any column and it will sort by ascending order first and descending if you click again.
2149
2477
 
2150
2478
  Glimmer automatic table sorting supports `String`, `Integer`, and `Float` columns out of the box as well as any column data that is comparable.
@@ -2243,6 +2571,8 @@ This finds the root node. The array is a Java array. This enables easy passing o
2243
2571
  To edit a tree, you must invoke `TreeProxy#edit_selected_tree_item` or `TreeProxy#edit_tree_item`. This automatically leverages the SWT TreeEditor custom class behind the scenes, displaying
2244
2572
  a text widget to the user to change the selected or passed tree item text into something else. It automatically persists the change to `items` data-bound model on ENTER/FOCUS-OUT or cancels on ESC/NO-CHANGE.
2245
2573
 
2574
+ Learn more at the [Hello, Tree!](GLIMMER_SAMPLES.md#hello-tree) and [Gladiator](GLIMMER_SAMPLES.md#gladiator) samples.
2575
+
2246
2576
  #### DateTime
2247
2577
 
2248
2578
  `date_time` represents the SWT DateTime widget.
@@ -2264,7 +2594,7 @@ You can data-bind any of these properties:
2264
2594
  - `minutes bind(model, :property)`: produces an integer
2265
2595
  - `seconds bind(model, :property)`: produces an integer
2266
2596
 
2267
- Learn more at the [Hello, Date Time!](#hello-date-time) sample.
2597
+ Learn more at the [Hello, Date Time!](GLIMMER_SAMPLES.md#hello-date-time) sample.
2268
2598
 
2269
2599
  If you need a better widget with the ability to customize the date format pattern, check out the [Nebula CDateTime Glimmer Custom Widget](https://github.com/AndyObtiva/glimmer-cw-cdatetime-nebula)
2270
2600
 
@@ -2650,7 +2980,7 @@ The `checkboxes` property returns the list of nested `checkbox` widgets.
2650
2980
 
2651
2981
  When data-binding `selection`, the model property should have a matching property with `_options` suffix (e.g. `activities_options` for `activities`) to provide an `Array` of `String` objects for `checkbox` buttons.
2652
2982
 
2653
- You may see an example at the [Hello, Checkbox Group!](#hello-checkbox-group) sample.
2983
+ You may see an example at the [Hello, Checkbox Group!](GLIMMER_SAMPLES.md#hello-checkbox-group) sample.
2654
2984
 
2655
2985
  ![Hello Checkbox Group](/images/glimmer-hello-checkbox-group.png)
2656
2986
 
@@ -2685,7 +3015,7 @@ radio_group { |radio_group_proxy|
2685
3015
  # ...
2686
3016
  ```
2687
3017
 
2688
- You may see another example at the [Hello, Radio Group!](#hello-radio-group) sample.
3018
+ You may see another example at the [Hello, Radio Group!](GLIMMER_SAMPLES.md#hello-radio-group) sample.
2689
3019
 
2690
3020
  ##### Code Text Custom Widget
2691
3021
 
@@ -2715,6 +3045,8 @@ To use, simply use `code_text` in place of the `text` or `styled_text` widget. I
2715
3045
  **lines**
2716
3046
  (default: `false`)
2717
3047
 
3048
+ **(BETA FEATURE)**
3049
+
2718
3050
  Shows line numbers when set to true.
2719
3051
 
2720
3052
  If set to a hash like `{width: 4}`, it sets the initial width of the line numbers lane in character count (default: 4)
@@ -2724,6 +3056,8 @@ Keep in mind that if the text grows and required a wider line numbers area, it g
2724
3056
  **theme**
2725
3057
  (default: `'glimmer'`)
2726
3058
 
3059
+ **(BETA FEATURE)**
3060
+
2727
3061
  Changes syntax color highlighting theme. Can be one of the following:
2728
3062
  - glimmer
2729
3063
  - github
@@ -2732,6 +3066,8 @@ Changes syntax color highlighting theme. Can be one of the following:
2732
3066
  **language**
2733
3067
  (default: `'ruby'`)
2734
3068
 
3069
+ **(BETA FEATURE)**
3070
+
2735
3071
  Sets the code language, which can be one of the following [rouge gem](#https://rubygems.org/gems/rouge) supported languages:
2736
3072
  - abap
2737
3073
  - actionscript
@@ -2941,14 +3277,17 @@ Sets the code language, which can be one of the following [rouge gem](#https://r
2941
3277
  **default_behavior**
2942
3278
  (default: true)
2943
3279
 
3280
+ **(BETA FEATURE)**
3281
+
2944
3282
  This adds some default keyboard shortcuts:
2945
3283
  - CMD+A (CTRL+A on Windows/Linux) to select all
2946
3284
  - CTRL+A on Mac to jump to beginning of line
2947
3285
  - CTRL+E on Mac to jump to end of line
3286
+ - Attempts to add proper indentation upon adding a new line when hitting ENTER (currently supporting Ruby only)
2948
3287
 
2949
3288
  If you prefer it to be vanilla with no default key event listeners, then pass the `default_behavior: false` option.
2950
3289
 
2951
- Learn more at [Hello, Code Text!](#hello-code-text)
3290
+ Learn more at [Hello, Code Text!](GLIMMER_SAMPLES.md#hello-code-text)
2952
3291
 
2953
3292
  ##### Video Custom Custom Widget
2954
3293
 
@@ -2963,7 +3302,7 @@ Simply install the [glimmer-cw-video](https://rubygems.org/gems/glimmer-cw-video
2963
3302
  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:
2964
3303
  [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)
2965
3304
 
2966
- Also, you may check out [Hello, Custom Widget!](#hello-custom-widget) for another example.
3305
+ Also, you may check out [Hello, Custom Widget!](GLIMMER_SAMPLES.md#hello-custom-widget) for another example.
2967
3306
 
2968
3307
  ### Custom Shells
2969
3308
 
@@ -3034,7 +3373,7 @@ shell { |app_shell|
3034
3373
 
3035
3374
  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`)
3036
3375
 
3037
- You may check out [Hello, Custom Shell!](#hello-custom-shell) for another example.
3376
+ You may check out [Hello, Custom Shell!](GLIMMER_SAMPLES.md#hello-custom-shell) for another example.
3038
3377
 
3039
3378
  ### Drag and Drop
3040
3379
 
@@ -3048,7 +3387,7 @@ To get started, simply follow these steps:
3048
3387
  1. On the drop target widget, add `on_drop` [DropTargetListener](https://help.eclipse.org/2020-03/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/dnd/DropTargetListener.html) event handler block at minimum (you may also add `on_drag_enter` [must set [`event.detail`](https://help.eclipse.org/2020-06/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/dnd/DropTargetEvent.html#detail) if added], `on_drag_over`, `on_drag_leave`, `on_drag_operation_changed` and `on_drop_accept` if needed)
3049
3388
  1. Read `event.data` and consume it (e.g. change widget text) inside the `on_drop` event handler block.
3050
3389
 
3051
- Example (taken from [samples/hello/hello_drag_and_drop.rb](#hello-drag-and-drop) / you may copy/paste in [`girb`](GLIMMER_GIRB.md)):
3390
+ Example (taken from [samples/hello/hello_drag_and_drop.rb](GLIMMER_SAMPLES.md#hello-drag-and-drop) / you may copy/paste in [`girb`](GLIMMER_GIRB.md)):
3052
3391
 
3053
3392
  ```ruby
3054
3393
  class Location