glimmer-dsl-swt 4.24.2.0 → 4.24.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e022ad5b5e0334818e996c918fbf384bee80a9e5a628503da14f857842ab7da0
4
- data.tar.gz: 86d06e30bbe172f7de677ecbfa9338b5874a9a92ab3d73f67f05dca975fb1500
3
+ metadata.gz: 774fc1f559ec5f11db66bdb42369c85e7df2a50f9f7f361e293a16c173ca394b
4
+ data.tar.gz: 5f45c3421a272bd377d3d8cb2457008e5ff2c5533ff3dcd0d25ae540cb549520
5
5
  SHA512:
6
- metadata.gz: bdc32f76c5467e573db93f650bd8b4eef2dd074c952926f6c92bfaa6798f240be09ae21262e3e062f916f1a86cf1cedd8e7c2f3de4d107a55bcbc950a638b9ae
7
- data.tar.gz: '097eb1e61863157609a431e16345ffc73b0d06b7db44311e56ef1ba53d5d1619782f8ee0bc6e34d441d3cbbcb909237801d68b42446d6ca7d1d8ec731f856b80'
6
+ metadata.gz: 31ad8918c664072c497d08183dfc9662dda92548cd2afe876d962219e364dbb9bde7efa75ea509e03df84fd2f91561d2d753d15d54e1f405502097b3c1036b0b
7
+ data.tar.gz: 9c14b3e9a70f70c63e95858eec0ee229ed46ff89b1217f715ac93b9388108f70ea9b428da127ad63eee0d356762e1fa7fe07c3481a819e698629703a37f3b735
data/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Change Log
2
2
 
3
+ ## 4.24.2.3
4
+
5
+ - Default `code_text` font name in Mac is changed back to `'Courier'`
6
+
7
+ ## 4.24.2.2
8
+
9
+ - Upgrade to jruby-9.3.7.0
10
+ - `code_text` can use external Rouge custom themes similar to `ext/rouge/themes/glimmer_dark`. When in Dark Mode, the specified custom theme must have the word 'dark' in its name to avoid forcing the `glimmer_dark` theme instead as per default behavior.
11
+ - Look for 'Monospace' and 'Liberation Mono' fonts on Linux if 'Courier' is not available
12
+ - Fix issue discovered in Red Hat Linux related to ImageExpression getting loaded before others and missing `require 'glimmer/dsl/parent_expression'` statement (issue does not happen in other operating systems that load classes in a different order)
13
+
14
+ ## 4.24.2.1
15
+
16
+ - Fix mistake of changing all themes to dark themes in Hello, Code Text! (not it works just like before)
17
+
3
18
  ## 4.24.2.0
4
19
 
5
20
  - Update `code_text` to support Dark Mode with `glimmer_dark` theme, which is applied by default when app is run with OS in dark mode
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.2.0
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.2.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)
@@ -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.2.0 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.
24
+ [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.24.2.3 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
 
@@ -306,9 +306,9 @@ https://www.eclipse.org/swt/faq.php
306
306
 
307
307
  ## Pre-requisites
308
308
 
309
- - JDK 18 is required / JDK 16 is the minimum except on Mac ARM64 where JDK 17 is the minimum (find at https://www.oracle.com/java/technologies/downloads / Ensure `PATH` env var includes Java bin directory for `jpackage` command to work when packaging Glimmer applications / Preferably setup `JAVA_HOME` env var too to point to JDK home directory before installing JRuby)
309
+ - JDK 18 is required / JDK 16 is minimum except on Mac ARM64 where JDK 17 is minimum (find at https://www.oracle.com/java/technologies/downloads / Ensure `PATH` env var includes Java bin directory for `jpackage` command to work when packaging Glimmer applications / Preferably setup `JAVA_HOME` env var too to point to JDK home directory before installing JRuby)
310
310
  - [RVM](http://rvm.io) on Mac & Linux (not needed on Windows)
311
- - JRuby 9.3.6.0 is required (supporting Ruby 2.6.x syntax) (get via [RVM](http://rvm.io) on Mac and Linux by running `rvm install jruby-9.3.6.0`; On Windows, find at [https://www.jruby.org/download](https://www.jruby.org/download))
311
+ - JRuby 9.3.7.0 is required / JRuby 9.3.6.0 is minimum (supporting Ruby 2.6.x syntax) (get via [RVM](http://rvm.io) on Mac and Linux by running `rvm install jruby-9.3.7.0`; On Windows, find at [https://www.jruby.org/download](https://www.jruby.org/download))
312
312
  - SWT 4.24 (already included in the [glimmer-dsl-swt](https://rubygems.org/gems/glimmer-dsl-swt) gem). Note that SWT supports ARM64/AARCH64 on Mac and Linux since version 4.20
313
313
  - Git (comes with Mac and Linux. Install on Windows: https://git-scm.com/download/win )
314
314
 
@@ -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.2.0
341
+ jgem install glimmer-dsl-swt -v 4.24.2.3
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.2.0'
369
+ gem 'glimmer-dsl-swt', '~> 4.24.2.3'
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.2.0
392
+ Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.24.2.3
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/RUBY_VERSION CHANGED
@@ -1 +1 @@
1
- jruby-9.3.6.0
1
+ jruby-9.3.7.0
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.24.2.0
1
+ 4.24.2.3
@@ -4807,32 +4807,93 @@ You may see another example at the [Hello, Radio Group!](/docs/reference/GLIMMER
4807
4807
 
4808
4808
  ##### Code Text Custom Widget
4809
4809
 
4810
- `code_text` is a Glimmer built-in custom widget that displays syntax highlighted Ruby code in a customized SWT [StyledText](https://help.eclipse.org/2020-09/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/custom/StyledText.html) widget.
4810
+ `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.
4811
4811
 
4812
- It attempts to use a monospace font if available, seeking fonts in the following order:
4813
- 1. Consolas
4814
- 2. Courier
4815
- 3. Any font that contains the word "Mono"
4816
- 4. Default system font (if no other font is found)
4812
+ 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.
4813
+
4814
+ `code_text` attempts to use a monospace font if available, seeking font names in the following order (specified in `Glimmer::SWT::Custom::CodeText::FONT_NAMES_PREFERRED`):
4815
+ 1. `'Consolas'`
4816
+ 2. `'Courier'`
4817
+ 3. `'Monospace'`
4818
+ 4. `'Liberation Mono'`
4819
+ 5. First available font that contains the word `mono` (case-insensitive)
4820
+ 6. Default system font (if no other font in the list is found)
4817
4821
 
4818
4822
  It is used in the [Glimmer Meta-Sample (The Sample of Samples)](#samples):
4819
4823
 
4820
4824
  ![Glimmer Meta-Sample](/images/glimmer-meta-sample.png)
4821
4825
 
4822
- Glimmer Meta-Sample Code Example:
4826
+ Dark Mode:
4827
+
4828
+ ![Glimmer Meta-Sample](/images/glimmer-meta-sample-dark-mode.png)
4829
+
4830
+ Code Text Simple Example (default language is Ruby):
4823
4831
 
4824
4832
  ```ruby
4825
- # ...
4826
- @code_text = code_text {
4833
+ code_text {
4827
4834
  text bind(SampleDirectory, 'selected_sample.code', read_only: true)
4828
4835
  editable bind(SampleDirectory, 'selected_sample.editable')
4829
4836
  }
4830
- # ...
4831
4837
  ```
4832
4838
 
4833
- To use, simply use `code_text` in place of the `text` or `styled_text` widget. If you set its `text` value to Ruby code, it automatically styles it with syntax highlighting.
4839
+ Code Text Specified Language Example:
4840
+
4841
+ ```ruby
4842
+ code_text(language: 'html') {
4843
+ text bind(SampleDirectory, 'selected_sample.code', read_only: true)
4844
+ editable bind(SampleDirectory, 'selected_sample.editable')
4845
+ }
4846
+ ```
4847
+
4848
+ Code Text Lines and Margins Example:
4849
+
4850
+ ```ruby
4851
+ code_text(lines: true) {
4852
+ text <=> [SampleDirectory, 'selected_sample.code']
4853
+ editable <= [SampleDirectory, 'selected_sample.editable']
4854
+ left_margin 7
4855
+ right_margin 7
4856
+ }
4857
+ ```
4858
+
4859
+ Code Text Customized Lines Width and Background Example:
4860
+
4861
+ ```ruby
4862
+ code_text(lines: {width: 3}) {
4863
+ line_numbers {
4864
+ background Display.system_dark_theme? ? :black : :white
4865
+ }
4866
+ text <=> [SampleDirectory, 'selected_sample.code']
4867
+ editable <= [SampleDirectory, 'selected_sample.editable']
4868
+ left_margin 7
4869
+ right_margin 7
4870
+ }
4871
+ ```
4872
+
4873
+ Code Text Customized Root Composite Margins/Spacing Background Example:
4834
4874
 
4835
- ###### Options
4875
+ ```ruby
4876
+ code_text(lines: true) {
4877
+ root {
4878
+ grid_layout(2, false) {
4879
+ horizontal_spacing 0
4880
+ margin_left 0
4881
+ margin_right 0
4882
+ margin_top 0
4883
+ margin_bottom 0
4884
+ }
4885
+ }
4886
+ line_numbers {
4887
+ background Display.system_dark_theme? ? :black : :white
4888
+ }
4889
+ text <=> [SampleDirectory, 'selected_sample.code']
4890
+ editable <= [SampleDirectory, 'selected_sample.editable']
4891
+ left_margin 7
4892
+ right_margin 7
4893
+ }
4894
+ ```
4895
+
4896
+ ###### Code Text Options
4836
4897
 
4837
4898
  **lines**
4838
4899
  (default: `false`)
@@ -4847,10 +4908,12 @@ Keep in mind that if the text grows and required a wider line numbers area, it g
4847
4908
  (default: `'glimmer'`)
4848
4909
 
4849
4910
  Changes syntax color highlighting theme. Can be one of the following:
4850
- - glimmer
4851
- - glimmer_dark (always applied when OS is in dark mode)
4852
- - github
4853
- - pastie
4911
+ - `'glimmer'`
4912
+ - `'glimmer_dark'` (always applied when OS is in Dark Mode unless you set another custom theme that has the word `dark` in its name, see more details below)
4913
+ - `'github'`
4914
+ - `'pastie'`
4915
+
4916
+ Or you can simply implement a new [Rouge](https://github.com/rouge-ruby/rouge) **custom theme** just like the [github](https://github.com/rouge-ruby/rouge/blob/master/lib/rouge/themes/github.rb) theme or the glimmer theme: [lib/ext/rouge/themes/glimmer.rb](/lib/ext/rouge/themes/glimmer.rb)
4854
4917
 
4855
4918
  **language**
4856
4919
  (default: `'ruby'`)
@@ -810,7 +810,7 @@ Hello, Dialog! Open Dialog
810
810
 
811
811
  #### Hello, Code Text!
812
812
 
813
- This sample demonstrates the Glimmer Built-In [Code Text Custom Widget](#code-text-custom-widget).
813
+ This sample demonstrates the Glimmer Built-In [Code Text Custom Widget](/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md#code-text-custom-widget).
814
814
 
815
815
  Code:
816
816
 
Binary file
@@ -19,9 +19,9 @@
19
19
  # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
20
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
21
 
22
- require 'glimmer/dsl/static_expression'
23
- require 'glimmer/dsl/parent_expression'
22
+ require 'glimmer/dsl/expression'
24
23
  require 'glimmer/dsl/top_level_expression'
24
+ require 'glimmer/dsl/parent_expression'
25
25
  require 'glimmer/swt/shell_proxy'
26
26
  require 'glimmer/swt/dialog_proxy'
27
27
 
@@ -20,8 +20,8 @@
20
20
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
21
 
22
22
  require 'glimmer/dsl/static_expression'
23
- require 'glimmer/dsl/parent_expression'
24
23
  require 'glimmer/dsl/top_level_expression'
24
+ require 'glimmer/dsl/parent_expression'
25
25
  require 'glimmer/swt/display_proxy'
26
26
 
27
27
  module Glimmer
@@ -21,6 +21,7 @@
21
21
 
22
22
  require 'glimmer/dsl/expression'
23
23
  require 'glimmer/dsl/top_level_expression'
24
+ require 'glimmer/dsl/parent_expression'
24
25
  require 'glimmer/swt/image_proxy'
25
26
  require 'glimmer/swt/widget_proxy'
26
27
 
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2007-2022 Andy Maleh
2
- #
2
+ #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
5
5
  # "Software"), to deal in the Software without restriction, including
@@ -7,10 +7,10 @@
7
7
  # distribute, sublicense, and/or sell copies of the Software, and to
8
8
  # permit persons to whom the Software is furnished to do so, subject to
9
9
  # the following conditions:
10
- #
10
+ #
11
11
  # The above copyright notice and this permission notice shall be
12
12
  # included in all copies or substantial portions of the Software.
13
- #
13
+ #
14
14
  # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
15
  # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
16
  # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -20,8 +20,8 @@
20
20
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
21
 
22
22
  require 'glimmer/dsl/static_expression'
23
- require 'glimmer/dsl/parent_expression'
24
23
  require 'glimmer/dsl/top_level_expression'
24
+ require 'glimmer/dsl/parent_expression'
25
25
  require 'glimmer/swt/shell_proxy'
26
26
  require 'glimmer/swt/message_box_proxy'
27
27
  require 'glimmer/swt/swt_proxy'
@@ -38,7 +38,7 @@ module Glimmer
38
38
  def interpret(parent, keyword, *args, &block)
39
39
  potential_parent = args.first
40
40
  potential_parent = potential_parent.swt_widget if potential_parent.respond_to?(:swt_widget)
41
- parent = nil
41
+ parent = nil
42
42
  if potential_parent.is_a?(Shell)
43
43
  args.shift
44
44
  parent = potential_parent
@@ -20,8 +20,8 @@
20
20
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
21
 
22
22
  require 'glimmer/dsl/static_expression'
23
- require 'glimmer/dsl/parent_expression'
24
23
  require 'glimmer/dsl/top_level_expression'
24
+ require 'glimmer/dsl/parent_expression'
25
25
  require 'glimmer/swt/shell_proxy'
26
26
 
27
27
  module Glimmer
@@ -41,6 +41,7 @@ module Glimmer
41
41
  end
42
42
 
43
43
  REGEX_COLOR_HEX6 = /^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/
44
+ FONT_NAMES_PREFERRED = ['Consolas', 'Courier', 'Monospace', 'Liberation Mono']
44
45
 
45
46
  # TODO support auto language detection
46
47
 
@@ -126,7 +127,7 @@ module Glimmer
126
127
  require 'ext/rouge/themes/glimmer'
127
128
  require 'ext/rouge/themes/glimmer_dark'
128
129
  @dark_mode = Java::OrgEclipseSwtWidgets::Display.system_dark_theme?
129
- self.theme = 'glimmer_dark' if @dark_mode
130
+ self.theme = 'glimmer_dark' if @dark_mode && !theme.downcase.include?('dark')
130
131
  @dark_theme = theme.include?('dark')
131
132
  @swt_style = swt_style == 0 ? [:border, :multi, :v_scroll, :h_scroll] : swt_style
132
133
  select_best_font
@@ -325,8 +326,10 @@ module Glimmer
325
326
 
326
327
  def select_best_font_name
327
328
  all_font_names = display.get_font_list(nil, true).map(&:name)
328
- @font_name ||= 'Consolas' if all_font_names.include?('Consolas')
329
- @font_name ||= 'Courier' if all_font_names.include?('Courier')
329
+ @font_name = 'Courier' if OS.mac?
330
+ FONT_NAMES_PREFERRED.each do |font_name|
331
+ @font_name ||= font_name if all_font_names.include?(font_name)
332
+ end
330
333
  @font_name ||= all_font_names.find {|font_name| font_name.downcase.include?('mono')}
331
334
  @font_name
332
335
  end
@@ -87,7 +87,7 @@ class HelloCodeText
87
87
  text 'Ruby (glimmer theme)'
88
88
 
89
89
  # Note: code_text theme is currently ignored in dark mode
90
- code_text(language: 'ruby', theme: 'glimmer_dark', lines: true) { # theme is currently ignored in dark mode
90
+ code_text(language: 'ruby', theme: 'glimmer', lines: true) { # theme is currently ignored in dark mode
91
91
  text <=> [self, :ruby_code]
92
92
  }
93
93
  }
@@ -98,7 +98,7 @@ class HelloCodeText
98
98
  text 'JavaScript (pastie theme)'
99
99
 
100
100
  # Note: code_text theme is currently ignored in dark mode
101
- code_text(:multi, :h_scroll, :v_scroll, language: 'javascript', theme: 'glimmer_dark', lines: {width: 2}) {
101
+ code_text(:multi, :h_scroll, :v_scroll, language: 'javascript', theme: 'pastie', lines: {width: 2}) {
102
102
  root {
103
103
  grid_layout(2, false) {
104
104
  margin_width 2
@@ -121,7 +121,7 @@ class HelloCodeText
121
121
  text 'HTML (github theme)'
122
122
 
123
123
  # Note: code_text theme is currently ignored in dark mode
124
- code_text(language: 'html', theme: 'glimmer_dark') { # default is lines: false
124
+ code_text(language: 'html', theme: 'github') { # default is lines: false
125
125
  text <=> [self, :html_code]
126
126
  }
127
127
  }
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.2.0
4
+ version: 4.24.2.3
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-21 00:00:00.000000000 Z
11
+ date: 2022-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement