glimmer-dsl-swt 4.17.4.0 → 4.17.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0d8d95c12f301621467ded0dd2abb7b1c055ce22594e5a93e744d4bcfe84e1d4
4
- data.tar.gz: 7458a6dec1a2700e9005c11eddf7e42c9585b54bb10a18efbd8273a969c2906a
3
+ metadata.gz: 6cddf113bb01ca3a0023665a0005d6ae1b78745ee877178c19b8e55c53ff31ce
4
+ data.tar.gz: 147ec77329bcda0e0ff86b6a0443a4cdcc9b63f87b2cf29ccae2bc05bb5dd2db
5
5
  SHA512:
6
- metadata.gz: c1595178259263a3d6127035a0917f4e350316f4dd7af6cdc8def67cb0e5f39ed63da8ed3b76a978db6a1b95fe88da413640ed96117f69b55d5596b3f8031b42
7
- data.tar.gz: e42731662e6757942c3eb7db9ca33e6f45c6990eb37b170dc851c3773a2b7bce8aa9a2a42b52cf961be8937682663104ce6f5298852b263fd0f367025df4dc31
6
+ metadata.gz: 9d4b03838352129fb30d8ee1e5652bc0e41f9524613e2cdb03ec11acf3e5552804472c09aa33efffeef02279b6f92f7cad1b465046bb74e9f5d1a24087251dd3
7
+ data.tar.gz: 5b8c69a4ab87b47b1e024b764329e946da803949243f841bf62970c19153740298bc46628eec89da516958d4df5584a1120342ef4d515fbe00656961fea198be
@@ -1,5 +1,10 @@
1
1
  # Change Log
2
2
 
3
+ ### 4.17.4.1
4
+
5
+ - Optimize code_text line style listener algorithm or avoid setting code_text style via listener for performance reasons
6
+ - Optimize code_text syntax highlighting by not lexing except when content changes (e.g. during scrolling, do not lex)
7
+
3
8
  ### 4.17.4.0
4
9
 
5
10
  - Glimmer sample app to launch samples (sample of samples meta-sample)
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for SWT 4.17.4.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.17.4.1
2
2
  ## JRuby Desktop Development GUI Library
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)
@@ -10,7 +10,7 @@
10
10
 
11
11
  (The Original Glimmer Library Since 2007. Beware of Imitators!)
12
12
 
13
- [**Glimmer**](https://rubygems.org/gems/glimmer) is a native-GUI cross-platform desktop development library written in [JRuby](https://www.jruby.org/), an OS-threaded faster version of [Ruby](https://www.ruby-lang.org/en/). [Glimmer](https://rubygems.org/gems/glimmer)'s main innovation is a declarative [Ruby DSL](#glimmer-dsl-syntax) that enables productive and efficient authoring of desktop application user-interfaces while relying on the robust [Eclipse SWT library](https://www.eclipse.org/swt/). [Glimmer](https://rubygems.org/gems/glimmer) additionally innovates by having built-in [data-binding](#data-binding) support, which greatly facilitates synchronizing the GUI with domain models, thus achieving true decoupling of object oriented components and enabling developers to solve business problems (test-first) without worrying about GUI concerns. To get started quickly, [Glimmer](https://rubygems.org/gems/glimmer) offers [scaffolding](#scaffolding) options for [Apps](#in-production), [Gems](#custom-shell-gem), and [Custom Widgets](#custom-widgets). [Glimmer](https://rubygems.org/gems/glimmer) also includes native-executable [packaging](#packaging--distribution) support, sorely lacking in other libraries, thus enabling the delivery of desktop apps written in [Ruby](https://www.ruby-lang.org/en/) as truly native DMG/PKG/APP files on the [Mac](https://www.apple.com/ca/macos) + [App Store](https://developer.apple.com/macos/distribution/), MSI/EXE files on [Windows](https://www.microsoft.com/en-ca/windows), and [Gem Packaged Shell Scripts](#custom-shell-gem) on [Linux](https://www.linux.org/).
13
+ [**Glimmer**](https://github.com/AndyObtiva/glimmer) is a native-GUI cross-platform desktop development library written in [JRuby](https://www.jruby.org/), an OS-threaded faster version of [Ruby](https://www.ruby-lang.org/en/). [Glimmer](https://rubygems.org/gems/glimmer)'s main innovation is a declarative [Ruby DSL](#glimmer-dsl-syntax) that enables productive and efficient authoring of desktop application user-interfaces while relying on the robust [Eclipse SWT library](https://www.eclipse.org/swt/). [Glimmer](https://rubygems.org/gems/glimmer) additionally innovates by having built-in [data-binding](#data-binding) support, which greatly facilitates synchronizing the GUI with domain models, thus achieving true decoupling of object oriented components and enabling developers to solve business problems (test-first) without worrying about GUI concerns. To get started quickly, [Glimmer](https://rubygems.org/gems/glimmer) offers [scaffolding](#scaffolding) options for [Apps](#in-production), [Gems](#custom-shell-gem), and [Custom Widgets](#custom-widgets). [Glimmer](https://rubygems.org/gems/glimmer) also includes native-executable [packaging](#packaging--distribution) support, sorely lacking in other libraries, thus enabling the delivery of desktop apps written in [Ruby](https://www.ruby-lang.org/en/) as truly native DMG/PKG/APP files on the [Mac](https://www.apple.com/ca/macos) + [App Store](https://developer.apple.com/macos/distribution/), MSI/EXE files on [Windows](https://www.microsoft.com/en-ca/windows), and [Gem Packaged Shell Scripts](#custom-shell-gem) on [Linux](https://www.linux.org/).
14
14
 
15
15
  [Glimmer receives two updates per month](https://rubygems.org/gems/glimmer-dsl-swt/versions). You can trust [Glimmer](https://rubygems.org/gems/glimmer) with your Ruby desktop GUI development needs. Please make [Glimmer](https://rubygems.org/gems/glimmer) even better by providing feedback and [contributing](#contributing) when possible.
16
16
 
@@ -433,7 +433,7 @@ jgem install glimmer-dsl-swt
433
433
 
434
434
  Or this command if you want a specific version:
435
435
  ```
436
- jgem install glimmer-dsl-swt -v 4.17.4.0
436
+ jgem install glimmer-dsl-swt -v 4.17.4.1
437
437
  ```
438
438
 
439
439
  Note: 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.
@@ -511,7 +511,7 @@ bin/glimmer samples
511
511
  Below are the full usage instructions that come up when running `glimmer` without args.
512
512
 
513
513
  ```
514
- Glimmer (Ruby Desktop Development GUI Library) - JRuby Gem: glimmer-dsl-swt v4.17.4.0
514
+ Glimmer (Ruby Desktop Development GUI Library) - JRuby Gem: glimmer-dsl-swt v4.17.4.1
515
515
 
516
516
  Usage: glimmer [--bundler] [--pd] [--quiet] [--debug] [--log-level=VALUE] [[ENV_VAR=VALUE]...] [[-jruby-option]...] (application.rb or task[task_args]) [[application2.rb]...]
517
517
 
@@ -988,7 +988,7 @@ Output:
988
988
 
989
989
  Css glimmer-dsl-css 1.1.0 AndyMaleh Glimmer DSL for CSS
990
990
  Opal glimmer-dsl-opal 0.4.0 AndyMaleh Glimmer DSL for Opal
991
- Swt glimmer-dsl-swt 4.17.4.0 AndyMaleh Glimmer DSL for SWT
991
+ Swt glimmer-dsl-swt 4.17.4.1 AndyMaleh Glimmer DSL for SWT
992
992
  Tk glimmer-dsl-tk 0.0.6 AndyMaleh Glimmer DSL for Tk
993
993
  Xml glimmer-dsl-xml 1.1.0 AndyMaleh Glimmer DSL for XML
994
994
  ```
@@ -3089,6 +3089,8 @@ You may obtain via `glimmer-cw-video` gem.
3089
3089
 
3090
3090
  It can be customized with the `weights` attribute by setting initial weights to size the panes at first display.
3091
3091
 
3092
+ One noteworthy thing about the Glimmer implementation is that, unlike behavior in SWT, it allows declaring `weights` before the content of the `sash_form`, thus providing more natural and convenient syntax (Glimmer automatically takes care of sending that declaration to SWT at the end of declaring `sash_form` content as per the SWT requirements)
3093
+
3092
3094
  Example (you may copy/paste in [`girb`](#girb-glimmer-irb-command)):
3093
3095
 
3094
3096
  ```ruby
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.17.4.0
1
+ 4.17.4.1
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: glimmer-dsl-swt 4.17.4.0 ruby lib
5
+ # stub: glimmer-dsl-swt 4.17.4.1 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "glimmer-dsl-swt".freeze
9
- s.version = "4.17.4.0"
9
+ s.version = "4.17.4.1"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
13
13
  s.authors = ["AndyMaleh".freeze]
14
- s.date = "2020-10-21"
14
+ s.date = "2020-10-22"
15
15
  s.description = "Glimmer DSL for SWT (JRuby Desktop Development GUI Library)".freeze
16
16
  s.email = "andy.am@gmail.com".freeze
17
17
  s.executables = ["glimmer".freeze, "girb".freeze]
@@ -38,9 +38,11 @@ module Glimmer
38
38
  swt_widget&.text
39
39
  end
40
40
 
41
- def syntax_highlighting
41
+ def syntax_highlighting
42
42
  return [] if text.to_s.strip.empty?
43
43
  code = text
44
+ return @syntax_highlighting if @last_code == code
45
+ @last_code = code
44
46
  lexer = Rouge::Lexer.find_fancy('ruby', code)
45
47
  lex = lexer.lex(code).to_a
46
48
  code_size = 0
@@ -50,7 +52,15 @@ module Glimmer
50
52
  hash[:token_index] = code_size
51
53
  code_size += hash[:token_text].size
52
54
  end
53
- # TODO consider grouping by line to optimize performance for line get style listener
55
+ code_lines = code.split("\n")
56
+ line_index = 0
57
+ @syntax_highlighting = code_lines_map = code_lines.reduce({}) do |hash, line|
58
+ line_hashes = []
59
+ line_hashes << lex_hashes.shift while lex_hashes.any? && lex_hashes.first[:token_index].between?(line_index, line_index + line.size)
60
+ hash.merge(line_index => line_hashes).tap do
61
+ line_index += line.size + 1
62
+ end
63
+ end
54
64
  end
55
65
 
56
66
  before_body {
@@ -68,15 +78,12 @@ module Glimmer
68
78
 
69
79
  on_line_get_style { |line_style_event|
70
80
  styles = []
71
- line_style_event.lineOffset
72
- syntax_highlighting.each do |token_hash|
73
- if token_hash[:token_index] >= line_style_event.lineOffset && token_hash[:token_index] < (line_style_event.lineOffset + line_style_event.lineText.size)
74
- start_index = token_hash[:token_index]
75
- size = token_hash[:token_text].size
76
- token_color = SYNTAX_COLOR_MAP[token_hash[:token_type].name] || [:black]
77
- token_color = color(*token_color).swt_color
78
- styles << StyleRange.new(start_index, size, token_color, nil)
79
- end
81
+ syntax_highlighting[line_style_event.lineOffset].to_a.each do |token_hash|
82
+ start_index = token_hash[:token_index]
83
+ size = token_hash[:token_text].size
84
+ token_color = SYNTAX_COLOR_MAP[token_hash[:token_type].name] || [:black]
85
+ token_color = color(*token_color).swt_color
86
+ styles << StyleRange.new(start_index, size, token_color, nil)
80
87
  end
81
88
  line_style_event.styles = styles.to_java(StyleRange) unless styles.empty?
82
89
  }
@@ -329,6 +329,57 @@ module Glimmer
329
329
  observer.call(@swt_widget.getText)
330
330
  }
331
331
  end,
332
+ :caret_position => lambda do |observer|
333
+ on_swt_keydown { |event|
334
+ observer.call(@swt_widget.getCaretPosition)
335
+ }
336
+ on_swt_keyup { |event|
337
+ observer.call(@swt_widget.getCaretPosition)
338
+ }
339
+ on_swt_mousedown { |event|
340
+ observer.call(@swt_widget.getCaretPosition)
341
+ }
342
+ on_swt_mouseup { |event|
343
+ observer.call(@swt_widget.getCaretPosition)
344
+ }
345
+ end,
346
+ :selection => lambda do |observer|
347
+ on_swt_keydown { |event|
348
+ observer.call(@swt_widget.getSelection)
349
+ }
350
+ on_swt_keyup { |event|
351
+ observer.call(@swt_widget.getSelection)
352
+ }
353
+ on_swt_mousedown { |event|
354
+ observer.call(@swt_widget.getSelection)
355
+ }
356
+ on_swt_mouseup { |event|
357
+ observer.call(@swt_widget.getSelection)
358
+ }
359
+ end,
360
+ :selection_count => lambda do |observer|
361
+ on_swt_keydown { |event|
362
+ observer.call(@swt_widget.getSelectionCount)
363
+ }
364
+ on_swt_keyup { |event|
365
+ observer.call(@swt_widget.getSelectionCount)
366
+ }
367
+ on_swt_mousedown { |event|
368
+ observer.call(@swt_widget.getSelectionCount)
369
+ }
370
+ on_swt_mouseup { |event|
371
+ observer.call(@swt_widget.getSelectionCount)
372
+ }
373
+ end,
374
+ :top_index => lambda do |observer|
375
+ @last_top_index = @swt_widget.getTopIndex
376
+ on_paint_control { |event|
377
+ if @swt_widget.getTopIndex != @last_top_index
378
+ @last_top_index = @swt_widget.getTopIndex
379
+ observer.call(@last_top_index)
380
+ end
381
+ }
382
+ end,
332
383
  },
333
384
  Java::OrgEclipseSwtWidgets::Button => {
334
385
  :selection => lambda do |observer|
@@ -620,7 +671,11 @@ module Glimmer
620
671
  },
621
672
  'selection_count' => {
622
673
  getter: {name: 'getSelectionCount'},
623
- setter: {name: 'setSelection', invoker: lambda { |widget, args| @swt_widget.setSelection(@swt_widget.getCaretPosition, @swt_widget.getCaretPosition + args.first) if args.first }},
674
+ setter: {name: 'setSelection', invoker: lambda { |widget, args|
675
+ # TODO consider the idea of aliasing getCaretPosition in StyledText
676
+ caret_position = @swt_widget.getCaretPosition rescue @swt_widget.getCaretOffset
677
+ @swt_widget.setSelection(caret_position, caret_position + args.first) if args.first
678
+ }},
624
679
  },
625
680
  }
626
681
  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.17.4.0
4
+ version: 4.17.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - AndyMaleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-21 00:00:00.000000000 Z
11
+ date: 2020-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement