glimmer-dsl-swt 4.24.3.0 → 4.24.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +5 -5
- data/VERSION +1 -1
- data/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md +10 -7
- data/docs/reference/GLIMMER_SAMPLES.md +17 -5
- data/glimmer-dsl-swt.gemspec +0 -0
- data/lib/glimmer/swt/custom/code_text.rb +39 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 44c7406f9588caef592b17f889b509db88771e545300a916f44ea1a928a89937
|
4
|
+
data.tar.gz: 2933dfdf3e5e1479849793cec5bbfdf3558768bb34b4c828847339c95559242a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d13f0eaa866f47c449caa5ce3e3ae652025940769b8f419c0b4b66df0e1e67b3a4e3494ab539cb81d21de79ac44d81e3982f59083c9bd0453201e1231073ee0
|
7
|
+
data.tar.gz: 53fe039d009a4d3476bbc2a5d96f11ca3ab4fdb442b790bafd0b9bc920943bb4cc6bc475522f1f040d355da8029cd693a76179d4e247fa9e4bd59fcd2637fe80
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 4.24.3.1
|
4
|
+
|
5
|
+
- `code_text` default behavior support of zoom in (CMD+= on Mac, CTRL+= on Win/Linux), zoom out (CMD+- on Mac, CTRL+- on Win/Linux), and restore original font height (CMD+0 on Mac, CTRL+0 on Win/Linux).
|
6
|
+
|
3
7
|
## 4.24.3.0
|
4
8
|
|
5
9
|
- Support `table` `items` data-binding of table row cell `background`, `foreground`, `font`, `image` to model attributes by convention based on specified `column_properties` (e.g. for `column_properties` model `name` attribute, automatically assume model `name_background` provides `[r, g, b]` array of color)
|
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.24.3.
|
1
|
+
# [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for SWT 4.24.3.1
|
2
2
|
## JRuby Desktop Development GUI Framework
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/glimmer-dsl-swt.svg)](http://badge.fury.io/rb/glimmer-dsl-swt)
|
4
4
|
[![Travis CI](https://travis-ci.com/AndyObtiva/glimmer-dsl-swt.svg?branch=master)](https://travis-ci.com/github/AndyObtiva/glimmer-dsl-swt)
|
@@ -21,7 +21,7 @@ Featured in JRuby Cookbook](http://shop.oreilly.com/product/9780596519650.do) an
|
|
21
21
|
|
22
22
|
![Eclipse SWT RCP NASA Mars Rover](/images/glimmer-eclipse-swt-rcp-nasa-mars-rover.png)
|
23
23
|
|
24
|
-
[Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.24.3.
|
24
|
+
[Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.24.3.1 includes [SWT 4.24](https://download.eclipse.org/eclipse/downloads/drops4/R-4.24-202206070700/), which was released on June 7, 2022. Gem version numbers are in sync with the SWT library versions. The first two digits represent the SWT version number. The last two digits represent the minor and patch versions of Glimmer DSL for SWT.
|
25
25
|
|
26
26
|
**Starting in version 4.20.0.0, [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) comes with the new [***Shine***](/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#shine) syntax** for highly intuitive and visually expressive View/Model Attribute Mapping, relying on `<=>` for bidirectional (two-way) data-binding and `<=` for unidirectional (one-way) data-binding, providing an alternative to the `bind` keyword. That was [originally conceived back in 2007](https://andymaleh.blogspot.com/2007/12/data-shining-in-glimmer.html).
|
27
27
|
|
@@ -338,7 +338,7 @@ jgem install glimmer-dsl-swt
|
|
338
338
|
|
339
339
|
Or this command if you want a specific version:
|
340
340
|
```
|
341
|
-
jgem install glimmer-dsl-swt -v 4.24.3.
|
341
|
+
jgem install glimmer-dsl-swt -v 4.24.3.1
|
342
342
|
```
|
343
343
|
|
344
344
|
`jgem` is JRuby's version of `gem` command.
|
@@ -366,7 +366,7 @@ Note: if you're using activerecord or activesupport, keep in mind that Glimmer u
|
|
366
366
|
|
367
367
|
Add the following to `Gemfile`:
|
368
368
|
```
|
369
|
-
gem 'glimmer-dsl-swt', '~> 4.24.3.
|
369
|
+
gem 'glimmer-dsl-swt', '~> 4.24.3.1'
|
370
370
|
```
|
371
371
|
|
372
372
|
And, then run:
|
@@ -389,7 +389,7 @@ glimmer
|
|
389
389
|
```
|
390
390
|
|
391
391
|
```
|
392
|
-
Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.24.3.
|
392
|
+
Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.24.3.1
|
393
393
|
|
394
394
|
Usage: glimmer [--bundler] [--pd] [--quiet] [--debug] [--log-level=VALUE] [[ENV_VAR=VALUE]...] [[-jruby-option]...] (application.rb or task[task_args]) [[application2.rb]...]
|
395
395
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
4.24.3.
|
1
|
+
4.24.3.1
|
@@ -3998,9 +3998,9 @@ The SWT Tree widget renders a multi-column data table, such as a contact listing
|
|
3998
3998
|
|
3999
3999
|
To data-bind a Table, you need the main model, the collection property, and the text display attribute for each table column.
|
4000
4000
|
|
4001
|
-
This involves using the
|
4001
|
+
This involves using the `<=>` operator in addition to a special `column_properties` kwarg that takes an array that maps table columns to model attributes.
|
4002
4002
|
|
4003
|
-
It assumes you have defined
|
4003
|
+
It assumes you have already defined table columns via the `table_column` `table`-nested widget.
|
4004
4004
|
|
4005
4005
|
Example:
|
4006
4006
|
|
@@ -4029,11 +4029,11 @@ shell {
|
|
4029
4029
|
```
|
4030
4030
|
|
4031
4031
|
The code above includes two data-bindings:
|
4032
|
-
- Table `items`, which first
|
4033
|
-
- Table `selection`, which binds the single table item selected by the user to the attribute denoted by
|
4032
|
+
- Table `items`, which first data-binds to the model collection property (group.people), and then maps each column property (name, age, adult) for displaying each table item column.
|
4033
|
+
- Table `selection`, which data-binds the single table item (row) selected by the user to the model attribute denoted by `<=>` (or data-binds multiple table items to a model attribute array value for a table with `:multi` SWT style)
|
4034
4034
|
- The `on_mouse_up` event handler invokes `@table.edit_table_item(event.table_item, event.column_index)` to start edit mode on the clicked table item cell, and then saves or cancel depending on whether the user hits ENTER or ESC once done editing (or focus-out after either making a change or not making any changes.)
|
4035
4035
|
|
4036
|
-
Additionally, Table `items` data-binding automatically stores each
|
4036
|
+
Additionally, Table `items` data-binding automatically stores each row model in the [SWT `TableItem`](https://help.eclipse.org/latest/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/widgets/TableItem.html) object representing it, by using the `set_data` method. This enables things like searchability.
|
4037
4037
|
|
4038
4038
|
The table widget in Glimmer is represented by a subclass of `WidgetProxy` called `TableProxy`.
|
4039
4039
|
TableProxy includes a `search` method that takes a block to look for a table item.
|
@@ -4044,7 +4044,7 @@ Example:
|
|
4044
4044
|
found_array = @table.search { |table_item| table_item.getData == company.owner }
|
4045
4045
|
```
|
4046
4046
|
|
4047
|
-
This finds a person. The array is a Java array. This enables easy passing of it to SWT `Table#setSelection` method, which expects a Java array of `TableItem` objects.
|
4047
|
+
This finds a person. The array is a Java array. This enables easy passing of it to SWT `Table#setSelection` method, which expects a Java array of [`TableItem`](https://help.eclipse.org/latest/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/widgets/TableItem.html) objects.
|
4048
4048
|
|
4049
4049
|
To edit a table, you must invoke `TableProxy#edit_selected_table_item(column_index, before_write: nil, after_write: nil, after_cancel: nil)` or `TableProxy#edit_table_item(table_item, column_index, before_write: nil, after_write: nil, after_cancel: nil)`.
|
4050
4050
|
This automatically leverages the SWT TableEditor custom class behind the scenes, displaying a text widget to the user to change the selected or
|
@@ -4825,7 +4825,7 @@ You may see another example at the [Hello, Radio Group!](/docs/reference/GLIMMER
|
|
4825
4825
|
|
4826
4826
|
##### Code Text Custom Widget
|
4827
4827
|
|
4828
|
-
`code_text` is a Glimmer built-in custom widget that displays syntax highlighted code (e.g. Ruby/JavaScript/HTML code) for 204 languages (see [options](#code-text-options) for the full list) by automating customizations for the SWT [StyledText](https://help.eclipse.org/2020-09/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/custom/StyledText.html) widget.
|
4828
|
+
`code_text` is a Glimmer built-in custom widget that displays syntax highlighted code (e.g. Ruby/JavaScript/HTML code) for 204 languages (see [options](#code-text-options) for the full list) by automating customizations for the SWT [StyledText](https://help.eclipse.org/2020-09/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/custom/StyledText.html) widget, including ability to zoom font in and out, or restore original font height (more details below).
|
4829
4829
|
|
4830
4830
|
To utilize, simply use `code_text` in place of the multi-line `text` and `styled_text` widgets. If you set the `code_text` `text` property value to multi-line code content (e.g. Ruby/JavaScript/HTML code), it automatically styles it with syntax highlighting.
|
4831
4831
|
|
@@ -5151,6 +5151,9 @@ This adds some default keyboard shortcuts:
|
|
5151
5151
|
- CMD+A (CTRL+A on Windows/Linux) to select all
|
5152
5152
|
- CTRL+A on Mac to jump to beginning of line
|
5153
5153
|
- CTRL+E on Mac to jump to end of line
|
5154
|
+
- CMD+= (CTRL+= on Windows/Linux) to zoom in (bump font height up by 1)
|
5155
|
+
- CMD+- (CTRL+- on Windows/Linux) to zoom out (bump font height down by 1)
|
5156
|
+
- CMD+0 (CTRL+0 on Windows/Linux) to restore to original font height
|
5154
5157
|
- Attempts to add proper indentation upon adding a new line when hitting ENTER (currently supporting Ruby only)
|
5155
5158
|
|
5156
5159
|
If you prefer it to be vanilla with no default key event listeners, then pass the `default_behavior: false` option.
|
@@ -730,7 +730,7 @@ Hello, Spinner!
|
|
730
730
|
|
731
731
|
#### Hello, Table!
|
732
732
|
|
733
|
-
This sample demonstrates the use of [table](#table) widget in Glimmer, including data-binding, multi-type editing, sorting, and filtering.
|
733
|
+
This sample demonstrates the use of [table](/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#table) widget in Glimmer, including data-binding, multi-type editing, sorting, and filtering.
|
734
734
|
|
735
735
|
Code:
|
736
736
|
|
@@ -820,17 +820,29 @@ Code:
|
|
820
820
|
|
821
821
|
[samples/hello/hello_code_text.rb](/samples/hello/hello_code_text.rb)
|
822
822
|
|
823
|
-
Hello, Code Text!
|
823
|
+
Hello, Code Text! HTML Language / GitHub Theme / No Line Numbers
|
824
824
|
|
825
|
-
![Hello Code Text
|
825
|
+
![Hello Code Text HTML](/images/glimmer-hello-code-text-html.png)
|
826
826
|
|
827
827
|
Hello, Code Text! JavaScript Language / Pastie Theme / Show Line Numbers (custom width of 2)
|
828
828
|
|
829
829
|
![Hello Code Text JavaScript](/images/glimmer-hello-code-text-javascript.png)
|
830
830
|
|
831
|
-
Hello, Code Text!
|
831
|
+
Hello, Code Text! Ruby Language / Glimmer Theme / Show Line Numbers (default width of 4)
|
832
832
|
|
833
|
-
![Hello Code Text
|
833
|
+
![Hello Code Text Ruby](/images/glimmer-hello-code-text-ruby.png)
|
834
|
+
|
835
|
+
Hello, Code Text! Zoom In (via keyboard shortcut CMD+= on Mac, CTRL+= on Win/Linux)
|
836
|
+
|
837
|
+
![Hello Code Text Zoom In](/images/glimmer-hello-code-text-zoom-in.png)
|
838
|
+
|
839
|
+
Hello, Code Text! Zoom Out (via keyboard shortcut CMD+- on Mac, CTRL+- on Win/Linux)
|
840
|
+
|
841
|
+
![Hello Code Text Zoom Out](/images/glimmer-hello-code-text-zoom-out.png)
|
842
|
+
|
843
|
+
Hello, Code Text! Restore Original Font Height (via keyboard shortcut CMD+0 on Mac, CTRL+0 on Win/Linux)
|
844
|
+
|
845
|
+
![Hello Code Text Restore Original Font Height](/images/glimmer-hello-code-text-ruby.png)
|
834
846
|
|
835
847
|
#### Hello, Canvas!
|
836
848
|
|
data/glimmer-dsl-swt.gemspec
CHANGED
Binary file
|
@@ -42,6 +42,7 @@ module Glimmer
|
|
42
42
|
|
43
43
|
REGEX_COLOR_HEX6 = /^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/
|
44
44
|
FONT_NAMES_PREFERRED = ['Consolas', 'Courier', 'Monospace', 'Liberation Mono']
|
45
|
+
SHORTCUT_KEY_COMMAND = OS.mac? ? :command : :ctrl
|
45
46
|
|
46
47
|
# TODO support auto language detection
|
47
48
|
|
@@ -145,7 +146,7 @@ module Glimmer
|
|
145
146
|
|
146
147
|
body {
|
147
148
|
if lines
|
148
|
-
composite {
|
149
|
+
@composite = composite {
|
149
150
|
grid_layout(2, false)
|
150
151
|
|
151
152
|
@line_numbers_styled_text_proxy = styled_text(swt(swt(swt_style), :h_scroll!, :v_scroll!)) {
|
@@ -204,12 +205,18 @@ module Glimmer
|
|
204
205
|
on_key_pressed { |event|
|
205
206
|
character = event.keyCode.chr rescue nil
|
206
207
|
case [event.stateMask, character]
|
207
|
-
when [
|
208
|
+
when [swt(SHORTCUT_KEY_COMMAND), 'a']
|
208
209
|
@styled_text_proxy.selectAll
|
209
210
|
when [(swt(:ctrl) if OS.mac?), 'a']
|
210
211
|
jump_to_beginning_of_line
|
211
212
|
when [(swt(:ctrl) if OS.mac?), 'e']
|
212
213
|
jump_to_end_of_line
|
214
|
+
when [swt(SHORTCUT_KEY_COMMAND), '=']
|
215
|
+
bump_font_height_up
|
216
|
+
when [swt(SHORTCUT_KEY_COMMAND), '-']
|
217
|
+
bump_font_height_down
|
218
|
+
when [swt(SHORTCUT_KEY_COMMAND), '0']
|
219
|
+
restore_font_height
|
213
220
|
end
|
214
221
|
}
|
215
222
|
on_verify_text { |verify_event|
|
@@ -333,6 +340,36 @@ module Glimmer
|
|
333
340
|
@font_name ||= all_font_names.find {|font_name| font_name.downcase.include?('mono')}
|
334
341
|
@font_name
|
335
342
|
end
|
343
|
+
|
344
|
+
def bump_font_height_up
|
345
|
+
@original_font_height ||= font_datum.height
|
346
|
+
new_font_height = font_datum.height + 1
|
347
|
+
update_font_height(new_font_height)
|
348
|
+
end
|
349
|
+
|
350
|
+
def bump_font_height_down
|
351
|
+
@original_font_height ||= font_datum.height
|
352
|
+
new_font_height = font_datum.height - 1
|
353
|
+
update_font_height(new_font_height)
|
354
|
+
end
|
355
|
+
|
356
|
+
def restore_font_height
|
357
|
+
return if @original_font_height.nil?
|
358
|
+
update_font_height(@original_font_height)
|
359
|
+
@original_font_height = nil
|
360
|
+
end
|
361
|
+
|
362
|
+
def update_font_height(new_font_height)
|
363
|
+
return if new_font_height.nil?
|
364
|
+
@styled_text_proxy.font = {name: font_datum.name, height: new_font_height, style: font_datum.style}
|
365
|
+
@line_numbers_styled_text_proxy&.font = {name: font_datum.name, height: new_font_height, style: font_datum.style}
|
366
|
+
@body_root.shell_proxy.layout(true, true)
|
367
|
+
@body_root.shell_proxy.pack_same_size
|
368
|
+
end
|
369
|
+
|
370
|
+
def font_datum
|
371
|
+
@styled_text_proxy.font.font_data.first
|
372
|
+
end
|
336
373
|
end
|
337
374
|
end
|
338
375
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glimmer-dsl-swt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.24.3.
|
4
|
+
version: 4.24.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Maleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-08-
|
11
|
+
date: 2022-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|