glimmer-dsl-swt 4.20.14.2 → 4.20.15.0

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: 3563ef87997628bd87b78de0900279aefcde38f911e2be4a786dfd8a48d5c2f7
4
- data.tar.gz: aab8501a3e614bafa0cf6e9cbae5b326dd0d9acdeb201a41799734f7d322bbae
3
+ metadata.gz: 9add0488847621e3bd25de0e500dab2ec7f8deb149526c1687995d4daeeaae27
4
+ data.tar.gz: 255b7b6013826605faae2f00ee40aef9d814b7de415bf465f9a73cbe2113abc7
5
5
  SHA512:
6
- metadata.gz: 660347ec9199923ab6b12021b5bc920b83cacc67f76f50f883ace45b5cb3fb2523638a513b45e33bcea250fdd69376d508db26de69534662dfdcd6e5dd524a30
7
- data.tar.gz: 4f490bd3cf9035acf624e83dfd0a071385796d4cebcacb205bdd9c3113f96d7f7ca9c0e625ffaed96c8a17fa4d78b04153eb6d0bc1ef7fc269c29334bd679f52
6
+ metadata.gz: 35db3de953fc01936d8d71adec7e827bf759e5824e1f3b51eab4d074c9b0d642eafd028a168899aba826f4058fd1ed8aa19a406cb3834caaac244ff80fa6cc14
7
+ data.tar.gz: d72dd88f5914dfa8f2c698ab0f0c594c125ceb5c86c465a25d19b60c48740e1294e69510e99030f33f2ce7992acb1d52e950f05105aaff511d5d7f4eb9095686
data/CHANGELOG.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Change Log
2
2
 
3
+ ### 4.20.15.0
4
+
3
5
  ### 4.20.14.1
4
6
 
5
7
  - Upgrade to Glimmer 2.1.1
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.20.14.2
1
+ # [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for SWT 4.20.15.0
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)
@@ -15,7 +15,7 @@
15
15
  [<img src="https://covers.oreillystatic.com/images/9780596519650/lrg.jpg" width=105 /><br />
16
16
  Featured in JRuby Cookbook](http://shop.oreilly.com/product/9780596519650.do) and [Chalmers/Gothenburg University Software Engineering Master's Lecture Material](http://www.cse.chalmers.se/~bergert/slides/guest_lecture_DSLs.pdf)
17
17
 
18
- [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.20.14.2 includes [SWT 4.20](https://download.eclipse.org/eclipse/downloads/drops4/R-4.20-202106111600/), which was released on June 11, 2021. 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. Note that SWT now supports AARCH64 on Mac and Linux, but it is not fully tested in Glimmer DSL for SWT yet, so deem its support experimental for the time being without guarantees for functionality until declared otherwise (please report any issues you may encounter).
18
+ [Glimmer DSL for SWT](https://rubygems.org/gems/glimmer-dsl-swt) 4.20.15.0 includes [SWT 4.20](https://download.eclipse.org/eclipse/downloads/drops4/R-4.20-202106111600/), which was released on June 11, 2021. 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. Note that SWT now supports AARCH64 on Mac and Linux, but it is not fully tested in Glimmer DSL for SWT yet, so deem its support experimental for the time being without guarantees for functionality until declared otherwise (please report any issues you may encounter).
19
19
 
20
20
  **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 (keep in mind that it is still a beta, so default back to `bind` whenever needed).
21
21
 
@@ -321,7 +321,7 @@ jgem install glimmer-dsl-swt
321
321
 
322
322
  Or this command if you want a specific version:
323
323
  ```
324
- jgem install glimmer-dsl-swt -v 4.20.14.2
324
+ jgem install glimmer-dsl-swt -v 4.20.15.0
325
325
  ```
326
326
 
327
327
  `jgem` is JRuby's version of `gem` command.
@@ -349,7 +349,7 @@ Note: if you're using activerecord or activesupport, keep in mind that Glimmer u
349
349
 
350
350
  Add the following to `Gemfile`:
351
351
  ```
352
- gem 'glimmer-dsl-swt', '~> 4.20.14.2'
352
+ gem 'glimmer-dsl-swt', '~> 4.20.15.0'
353
353
  ```
354
354
 
355
355
  And, then run:
@@ -370,7 +370,7 @@ glimmer
370
370
  ```
371
371
 
372
372
  ```
373
- Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.20.14.2
373
+ Glimmer (JRuby Desktop Development GUI Framework) - JRuby Gem: glimmer-dsl-swt v4.20.15.0
374
374
 
375
375
  Usage: glimmer [--bundler] [--pd] [--quiet] [--debug] [--log-level=VALUE] [[ENV_VAR=VALUE]...] [[-jruby-option]...] (application.rb or task[task_args]) [[application2.rb]...]
376
376
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.20.14.2
1
+ 4.20.15.0
@@ -33,6 +33,8 @@
33
33
  - [Hello, Checkbox Group!](#hello-checkbox-group)
34
34
  - [Hello, Directory Dialog!](#hello-directory-dialog)
35
35
  - [Hello, File Dialog!](#hello-file-dialog)
36
+ - [Hello, Print Dialog!](#hello-print-dialog)
37
+ - [Hello, Print!](#hello-print)
36
38
  - [Hello, Date Time!](#hello-date-time)
37
39
  - [Hello, Scale!](#hello-scale)
38
40
  - [Hello, Slider!](#hello-slider)
@@ -613,7 +615,7 @@ Hello, Directory Dialog! Selected Directory
613
615
 
614
616
  #### Hello, File Dialog!
615
617
 
616
- This sample demonstrates the use of a `file_dialog` in Glimmer.
618
+ This sample demonstrates the use of `file_dialog` in Glimmer.
617
619
 
618
620
  Code:
619
621
 
@@ -631,6 +633,30 @@ Hello, File Dialog! Selected File
631
633
 
632
634
  ![Hello File Dialog](/images/glimmer-hello-file-dialog-selected-file.png)
633
635
 
636
+ #### Hello, Print Dialog!
637
+
638
+ This sample demonstrates the use of `print_dialog` in Glimmer.
639
+
640
+ Code:
641
+
642
+ [samples/hello/hello_print_dialog.rb](/samples/hello/hello_print_dialog.rb)
643
+
644
+ Hello, Print Dialog!
645
+
646
+ ![Hello Print Dialog](/images/glimmer-hello-print-dialog.png)
647
+
648
+ #### Hello, Print!
649
+
650
+ This sample demonstrates the use of `widget#print`, which automates work from Hello, Print Dialog! assuming a single page
651
+
652
+ Code:
653
+
654
+ [samples/hello/hello_print.rb](/samples/hello/hello_print.rb)
655
+
656
+ Hello, Print!
657
+
658
+ ![Hello Print](/images/glimmer-hello-print.png)
659
+
634
660
  #### Hello, Date Time!
635
661
 
636
662
  This sample demonstrates the use of [date_time](#datetime) widget keywords in Glimmer: `date`, `date_drop_down`, `time`, and `calendar`
Binary file
@@ -31,6 +31,7 @@ module Glimmer
31
31
  'org.eclipse.swt.browser',
32
32
  'org.eclipse.swt.custom',
33
33
  'org.eclipse.swt.dnd',
34
+ 'org.eclipse.swt.printing',
34
35
  ]
35
36
  DEFAULT_AUTO_SYNC_EXEC = true
36
37
 
@@ -610,6 +610,38 @@ module Glimmer
610
610
  (@swt_widget.style & comparison) == comparison
611
611
  end
612
612
  end
613
+
614
+ def print(gc=nil, job_name: nil)
615
+ if gc.is_a?(org.eclipse.swt.graphics.GC)
616
+ @swt_widget.print(gc)
617
+ else
618
+ image = Image.new(DisplayProxy.instance.swt_display, bounds)
619
+ gc = org.eclipse.swt.graphics.GC.new(image)
620
+ success = print(gc)
621
+ if success
622
+ printer_data = DialogProxy.new('print_dialog', shell.get_data('proxy')).open
623
+ printer = Printer.new(printer_data)
624
+ job_name ||= 'Glimmer'
625
+ if printer.start_job(job_name)
626
+ printer_gc = org.eclipse.swt.graphics.GC.new(printer)
627
+ if printer.start_page
628
+ printer_gc.drawImage(image, 0, 0)
629
+ printer.end_page
630
+ else
631
+ success = false
632
+ end
633
+ printer_gc.dispose
634
+ printer.end_job
635
+ else
636
+ success = false
637
+ end
638
+ printer.dispose
639
+ gc.dispose
640
+ image.dispose
641
+ end
642
+ success
643
+ end
644
+ end
613
645
 
614
646
  def dispose
615
647
  auto_exec do
@@ -0,0 +1,60 @@
1
+ # Copyright (c) 2007-2021 Andy Maleh
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining
4
+ # a copy of this software and associated documentation files (the
5
+ # "Software"), to deal in the Software without restriction, including
6
+ # without limitation the rights to use, copy, modify, merge, publish,
7
+ # distribute, sublicense, and/or sell copies of the Software, and to
8
+ # permit persons to whom the Software is furnished to do so, subject to
9
+ # the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be
12
+ # included in all copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
22
+ require 'glimmer-dsl-swt'
23
+
24
+ class HelloPrint
25
+ include Glimmer::UI::CustomShell
26
+
27
+ body {
28
+ shell {
29
+ text 'Hello, Print!'
30
+ @composite = composite {
31
+ row_layout(:vertical) {
32
+ fill true
33
+ center true
34
+ }
35
+
36
+ label(:center) {
37
+ text "Whatever you see inside the app composite\nwill get printed when clicking the Print button."
38
+ font height: 16
39
+ }
40
+
41
+ button {
42
+ text 'Print'
43
+
44
+ on_widget_selected do
45
+ # The widget#print method automates all the work seen in Hello, Print Dialog!
46
+ # the caveat is it assumes everything fits on one page
47
+ unless @composite.print
48
+ message_box {
49
+ text 'Unable To Print'
50
+ message 'Sorry! Printing is not supported on this platform!'
51
+ }.open
52
+ end
53
+ end
54
+ }
55
+ }
56
+ }
57
+ }
58
+ end
59
+
60
+ HelloPrint.launch
@@ -0,0 +1,87 @@
1
+ # Copyright (c) 2007-2021 Andy Maleh
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining
4
+ # a copy of this software and associated documentation files (the
5
+ # "Software"), to deal in the Software without restriction, including
6
+ # without limitation the rights to use, copy, modify, merge, publish,
7
+ # distribute, sublicense, and/or sell copies of the Software, and to
8
+ # permit persons to whom the Software is furnished to do so, subject to
9
+ # the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be
12
+ # included in all copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
22
+ require 'glimmer-dsl-swt'
23
+
24
+ class HelloPrintDialog
25
+ include Glimmer::UI::CustomShell
26
+
27
+ body {
28
+ shell {
29
+ text 'Hello, Print Dialog!'
30
+ @composite = composite {
31
+ row_layout(:vertical) {
32
+ fill true
33
+ center true
34
+ }
35
+
36
+ label(:center) {
37
+ text "Whatever you see inside the app composite\nwill get printed when clicking the Print button."
38
+ font height: 16
39
+ }
40
+
41
+ button {
42
+ text 'Print'
43
+
44
+ on_widget_selected do
45
+ # note: you may check out Hello, Print! for a simpler version that automates the work below
46
+ image = Image.new(display.swt_display, @composite.bounds)
47
+ gc = org.eclipse.swt.graphics.GC.new(image)
48
+ success = @composite.print(gc)
49
+ if success
50
+ printer_data = print_dialog.open
51
+ printer = Printer.new(printer_data)
52
+ if printer.start_job('Glimmer')
53
+ printer_gc = org.eclipse.swt.graphics.GC.new(printer)
54
+ if printer.start_page
55
+ printer_gc.drawImage(image, 0, 0)
56
+ printer.end_page
57
+ else
58
+ message_box {
59
+ text 'Unable To Print'
60
+ message 'Sorry! Cannot start printer page!'
61
+ }.open
62
+ end
63
+ printer_gc.dispose
64
+ printer.end_job
65
+ else
66
+ message_box {
67
+ text 'Unable To Print'
68
+ message 'Sorry! Cannot start printer job!'
69
+ }.open
70
+ end
71
+ printer.dispose
72
+ gc.dispose
73
+ image.dispose
74
+ else
75
+ message_box {
76
+ text 'Unable To Print'
77
+ message 'Sorry! Printing is not supported on this platform!'
78
+ }.open
79
+ end
80
+ end
81
+ }
82
+ }
83
+ }
84
+ }
85
+ end
86
+
87
+ HelloPrintDialog.launch
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glimmer-dsl-swt
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.20.14.2
4
+ version: 4.20.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Maleh
@@ -646,6 +646,8 @@ files:
646
646
  - samples/hello/hello_menu_bar.rb
647
647
  - samples/hello/hello_message_box.rb
648
648
  - samples/hello/hello_pop_up_context_menu.rb
649
+ - samples/hello/hello_print.rb
650
+ - samples/hello/hello_print_dialog.rb
649
651
  - samples/hello/hello_progress_bar.rb
650
652
  - samples/hello/hello_radio.rb
651
653
  - samples/hello/hello_radio_group.rb