glimmer-dsl-swt 4.24.0.1 → 4.24.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -20,101 +20,106 @@
20
20
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
21
 
22
22
  require 'glimmer-dsl-swt'
23
-
24
- include Glimmer
25
-
26
- shell {
27
- grid_layout {
28
- margin_width 0
29
- margin_height 0
30
- margin_top 5
31
- }
32
- text 'Hello, Canvas Path!'
33
- minimum_size 800, 700
34
-
35
- @button = button {
36
- layout_data :center, :center, true, false
37
- text 'Regenerate'
38
- enabled false
39
-
40
- on_widget_selected do
41
- @regenerate = true
42
- @button.enabled = false
43
- end
44
- }
45
- canvas {
46
- layout_data :fill, :fill, true, true
47
- background :white
48
-
49
- text('line', 15, 200) {
50
- foreground :red
51
- }
52
- @path1 = path {
53
- antialias :on
54
- foreground :red
55
- }
56
-
57
- text('quad', 15, 300) {
58
- foreground :dark_green
59
- }
60
- @path2 = path {
61
- antialias :on
62
- foreground :dark_green
63
- }
23
+
24
+ class HelloCanvasPath
25
+ include Glimmer::UI::Application
64
26
 
65
- text('cubic', 15, 400) {
66
- foreground :blue
67
- }
68
- @path3 = path {
69
- antialias :on
70
- foreground :blue
27
+ after_body do
28
+ regenerate
29
+ end
30
+
31
+ body {
32
+ shell {
33
+ grid_layout {
34
+ margin_width 0
35
+ margin_height 0
36
+ margin_top 5
37
+ }
38
+
39
+ text 'Hello, Canvas Path!'
40
+ minimum_size 800, 700
41
+
42
+ @button = button {
43
+ layout_data :center, :center, true, false
44
+
45
+ text 'Regenerate'
46
+ enabled false
47
+
48
+ on_widget_selected do
49
+ regenerate
50
+ end
51
+ }
52
+
53
+ canvas {
54
+ layout_data :fill, :fill, true, true
55
+
56
+ background :white
57
+
58
+ text('line', 15, 200) {
59
+ foreground :red
60
+ }
61
+ @path1 = path {
62
+ antialias :on
63
+ foreground :red
64
+ }
65
+
66
+ text('quad', 15, 300) {
67
+ foreground :dark_green
68
+ }
69
+ @path2 = path {
70
+ antialias :on
71
+ foreground :dark_green
72
+ }
73
+
74
+ text('cubic', 15, 400) {
75
+ foreground :blue
76
+ }
77
+ @path3 = path {
78
+ antialias :on
79
+ foreground :blue
80
+ }
81
+ }
82
+
83
+ on_widget_disposed do
84
+ # safe to kill thread as data is in memory only, so no risk of data loss
85
+ @thread.kill
86
+ end
71
87
  }
72
88
  }
73
89
 
74
- on_swt_show do
75
- @regenerate = true
90
+ def regenerate
76
91
  @thread = Thread.new do
77
- loop do
78
- if @regenerate
79
- @regenerate = false
80
- @path1.clear
81
- @path2.clear
82
- @path3.clear
83
- y1 = y2 = y3 = 300
84
- 700.times.each do |x|
85
- x += 55
86
- x1 = x - 2
87
- x2 = x - 1
88
- x3 = x
89
- y1 = y3
90
- y2 = y1
91
- y3 = [[y3 + (rand*24 - 12), 0].max, 700].min
92
- @path1.content {
93
- line(x1, y1 - 100)
94
- }
95
- if x % 2 == 0
96
- @path2.content {
97
- quad(x1, y1, x2, y2)
98
- }
99
- end
100
- if x % 3 == 0
101
- @path3.content {
102
- cubic(x1, y1 + 100, x2, y2 + 100, x3, y3 + 100)
103
- }
104
- end
105
- sleep(0.01)
106
- end
107
- @button.enabled = true
92
+ @button.enabled = false
93
+ @path1.clear
94
+ @path2.clear
95
+ @path3.clear
96
+ y1 = y2 = y3 = 300
97
+ 700.times.each do |x|
98
+ x += 55
99
+ x1 = x - 2
100
+ x2 = x - 1
101
+ x3 = x
102
+ y1 = y3
103
+ y2 = y1
104
+ y3 = [[y3 + (rand*24 - 12), 0].max, 700].min
105
+ @path1.content {
106
+ line(x1, y1 - 100)
107
+ }
108
+ if x % 2 == 0
109
+ @path2.content {
110
+ quad(x1, y1, x2, y2)
111
+ }
108
112
  end
109
- sleep(0.1)
113
+ if x % 3 == 0
114
+ @path3.content {
115
+ cubic(x1, y1 + 100, x2, y2 + 100, x3, y3 + 100)
116
+ }
117
+ end
118
+ sleep(0.01)
110
119
  end
111
-
120
+ @button.enabled = true
112
121
  end
113
-
114
122
  end
115
-
116
- on_widget_disposed do
117
- @thread.kill # safe to kill since data is in memory only
118
- end
119
-
120
- }.open
123
+ end
124
+
125
+ HelloCanvasPath.launch
@@ -19,12 +19,14 @@ shell {
19
19
  # also supports inversion, identity, shear, and multiplication {transform properties}
20
20
  }
21
21
  }
22
+
22
23
  image(glimmer_logo, 0, 0) {
23
24
  transform {
24
25
  translation 110, 220
25
26
  scale 0.21, 0.21
26
27
  }
27
28
  }
29
+
28
30
  image(glimmer_logo, 0, 0) {
29
31
  transform {
30
32
  translation 220, 220
@@ -32,6 +34,7 @@ shell {
32
34
  scale 0.21, 0.21
33
35
  }
34
36
  }
37
+
35
38
  image(glimmer_logo, 0, 0) {
36
39
  transform {
37
40
  translation 220, 110
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.0.1
4
+ version: 4.24.1.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-07-08 00:00:00.000000000 Z
11
+ date: 2022-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement