glimmer-dsl-swt 4.24.0.0 → 4.24.1.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -0
- data/README.md +51 -12
- data/RUBY_VERSION +1 -1
- data/VERSION +1 -1
- data/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md +704 -43
- data/docs/reference/GLIMMER_SAMPLES.md +2 -22
- data/glimmer-dsl-swt.gemspec +0 -0
- data/lib/glimmer/rake_task/scaffold.rb +10 -18
- data/lib/glimmer/swt/custom/shape/path_segment.rb +1 -0
- data/lib/glimmer/swt/custom/shape.rb +5 -2
- data/samples/elaborate/game_of_life.rb +2 -2
- data/samples/elaborate/meta_sample/tutorials.yml +4 -0
- data/samples/hello/hello_canvas_data_binding.rb +695 -38
- data/samples/hello/hello_canvas_drag_and_drop.rb +31 -2
- data/samples/hello/hello_canvas_path.rb +93 -89
- metadata +16 -2
@@ -1,3 +1,24 @@
|
|
1
|
+
# Copyright (c) 2007-2022 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
|
+
|
1
22
|
require 'glimmer-dsl-swt'
|
2
23
|
|
3
24
|
class HelloCanvasDragAndDrop
|
@@ -27,7 +48,9 @@ class HelloCanvasDragAndDrop
|
|
27
48
|
background :white
|
28
49
|
|
29
50
|
10.times do |n|
|
30
|
-
|
51
|
+
value = rand(10)
|
52
|
+
oval((rand*300).to_i, (rand*200).to_i, 50, 50) {
|
53
|
+
data 'value', value
|
31
54
|
background rgb(255, 165, 0)
|
32
55
|
|
33
56
|
# declare shape as a drag source, which unlike `drag_and_move true`, it means the shape now
|
@@ -38,6 +61,12 @@ class HelloCanvasDragAndDrop
|
|
38
61
|
oval(0, 0) {
|
39
62
|
foreground :black
|
40
63
|
}
|
64
|
+
|
65
|
+
text {
|
66
|
+
x :default
|
67
|
+
y :default
|
68
|
+
string value.to_s
|
69
|
+
}
|
41
70
|
}
|
42
71
|
end
|
43
72
|
|
@@ -70,7 +99,7 @@ class HelloCanvasDragAndDrop
|
|
70
99
|
@number_shape = text {
|
71
100
|
x :default
|
72
101
|
y :default
|
73
|
-
string (ball_count +
|
102
|
+
string (ball_count + drop_event.dragged_shape.get_data('value')).to_s
|
74
103
|
}
|
75
104
|
}
|
76
105
|
drop_event.dragged_shape.dispose
|
@@ -20,101 +20,105 @@
|
|
20
20
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
21
|
|
22
22
|
require 'glimmer-dsl-swt'
|
23
|
-
|
24
|
-
|
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
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
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
|
+
background :white
|
56
|
+
|
57
|
+
text('line', 15, 200) {
|
58
|
+
foreground :red
|
59
|
+
}
|
60
|
+
@path1 = path {
|
61
|
+
antialias :on
|
62
|
+
foreground :red
|
63
|
+
}
|
64
|
+
|
65
|
+
text('quad', 15, 300) {
|
66
|
+
foreground :dark_green
|
67
|
+
}
|
68
|
+
@path2 = path {
|
69
|
+
antialias :on
|
70
|
+
foreground :dark_green
|
71
|
+
}
|
72
|
+
|
73
|
+
text('cubic', 15, 400) {
|
74
|
+
foreground :blue
|
75
|
+
}
|
76
|
+
@path3 = path {
|
77
|
+
antialias :on
|
78
|
+
foreground :blue
|
79
|
+
}
|
80
|
+
}
|
81
|
+
|
82
|
+
on_widget_disposed do
|
83
|
+
# safe to kill thread as data is in memory only, so no risk of data loss
|
84
|
+
@thread.kill
|
85
|
+
end
|
71
86
|
}
|
72
87
|
}
|
73
88
|
|
74
|
-
|
75
|
-
@regenerate = true
|
89
|
+
def regenerate
|
76
90
|
@thread = Thread.new do
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
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
|
91
|
+
@button.enabled = false
|
92
|
+
@path1.clear
|
93
|
+
@path2.clear
|
94
|
+
@path3.clear
|
95
|
+
y1 = y2 = y3 = 300
|
96
|
+
700.times.each do |x|
|
97
|
+
x += 55
|
98
|
+
x1 = x - 2
|
99
|
+
x2 = x - 1
|
100
|
+
x3 = x
|
101
|
+
y1 = y3
|
102
|
+
y2 = y1
|
103
|
+
y3 = [[y3 + (rand*24 - 12), 0].max, 700].min
|
104
|
+
@path1.content {
|
105
|
+
line(x1, y1 - 100)
|
106
|
+
}
|
107
|
+
if x % 2 == 0
|
108
|
+
@path2.content {
|
109
|
+
quad(x1, y1, x2, y2)
|
110
|
+
}
|
108
111
|
end
|
109
|
-
|
112
|
+
if x % 3 == 0
|
113
|
+
@path3.content {
|
114
|
+
cubic(x1, y1 + 100, x2, y2 + 100, x3, y3 + 100)
|
115
|
+
}
|
116
|
+
end
|
117
|
+
sleep(0.01)
|
110
118
|
end
|
111
|
-
|
119
|
+
@button.enabled = true
|
112
120
|
end
|
113
|
-
|
114
121
|
end
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
end
|
119
|
-
|
120
|
-
}.open
|
122
|
+
end
|
123
|
+
|
124
|
+
HelloCanvasPath.launch
|
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.
|
4
|
+
version: 4.24.1.0
|
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-
|
11
|
+
date: 2022-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -328,6 +328,20 @@ dependencies:
|
|
328
328
|
- - "~>"
|
329
329
|
- !ruby/object:Gem::Version
|
330
330
|
version: 0.7.0
|
331
|
+
- !ruby/object:Gem::Dependency
|
332
|
+
requirement: !ruby/object:Gem::Requirement
|
333
|
+
requirements:
|
334
|
+
- - ">="
|
335
|
+
- !ruby/object:Gem::Version
|
336
|
+
version: 0.14.1.cr2
|
337
|
+
name: jruby-openssl
|
338
|
+
prerelease: false
|
339
|
+
type: :development
|
340
|
+
version_requirements: !ruby/object:Gem::Requirement
|
341
|
+
requirements:
|
342
|
+
- - ">="
|
343
|
+
- !ruby/object:Gem::Version
|
344
|
+
version: 0.14.1.cr2
|
331
345
|
description: Glimmer DSL for SWT (JRuby Desktop Development GUI Framework) is a native-GUI
|
332
346
|
cross-platform desktop development library written in JRuby, an OS-threaded faster
|
333
347
|
JVM version of Ruby. It includes SWT 4.22 (released November 24, 2021). Glimmer's
|