glimmer-dsl-swt 4.18.5.3 → 4.18.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +41 -0
- data/README.md +8 -10
- data/VERSION +1 -1
- data/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md +57 -13
- data/docs/reference/GLIMMER_PACKAGING_AND_DISTRIBUTION.md +2 -0
- data/docs/reference/GLIMMER_SAMPLES.md +32 -0
- data/glimmer-dsl-swt.gemspec +10 -3
- data/lib/glimmer/swt/color_proxy.rb +1 -1
- data/lib/glimmer/swt/custom/shape.rb +319 -76
- data/lib/glimmer/swt/custom/shape/arc.rb +22 -4
- data/lib/glimmer/swt/custom/shape/cubic.rb +118 -0
- data/lib/glimmer/swt/custom/shape/image.rb +4 -4
- data/lib/glimmer/swt/custom/shape/line.rb +80 -6
- data/lib/glimmer/swt/custom/shape/oval.rb +3 -3
- data/lib/glimmer/swt/custom/shape/path.rb +227 -0
- data/lib/glimmer/swt/custom/shape/path_segment.rb +133 -0
- data/lib/glimmer/swt/custom/shape/point.rb +41 -0
- data/lib/glimmer/swt/custom/shape/polygon.rb +63 -14
- data/lib/glimmer/swt/custom/shape/polyline.rb +41 -10
- data/lib/glimmer/swt/custom/shape/quad.rb +114 -0
- data/lib/glimmer/swt/custom/shape/rectangle.rb +3 -2
- data/lib/glimmer/swt/custom/shape/text.rb +2 -4
- data/lib/glimmer/swt/dialog_proxy.rb +4 -0
- data/lib/glimmer/swt/proxy_properties.rb +1 -1
- data/samples/elaborate/mandelbrot_fractal.rb +1 -1
- data/samples/elaborate/stock_ticker.rb +220 -0
- data/samples/hello/hello_canvas.rb +38 -21
- data/samples/hello/hello_canvas_data_binding.rb +193 -0
- data/samples/hello/hello_canvas_path.rb +120 -0
- metadata +9 -2
@@ -0,0 +1,120 @@
|
|
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
|
+
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 {
|
41
|
+
@regenerate = true
|
42
|
+
@button.enabled = false
|
43
|
+
}
|
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
|
+
}
|
64
|
+
|
65
|
+
text('cubic', 15, 400) {
|
66
|
+
foreground :blue
|
67
|
+
}
|
68
|
+
@path3 = path {
|
69
|
+
antialias :on
|
70
|
+
foreground :blue
|
71
|
+
}
|
72
|
+
}
|
73
|
+
|
74
|
+
on_swt_show {
|
75
|
+
@regenerate = true
|
76
|
+
@thread = Thread.new {
|
77
|
+
loop {
|
78
|
+
if @regenerate
|
79
|
+
@regenerate = false
|
80
|
+
@path1.clear
|
81
|
+
@path2.clear
|
82
|
+
@path3.clear
|
83
|
+
y1 = y2 = y3 = 300
|
84
|
+
730.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
|
108
|
+
end
|
109
|
+
sleep(0.1)
|
110
|
+
}
|
111
|
+
|
112
|
+
}
|
113
|
+
|
114
|
+
}
|
115
|
+
|
116
|
+
on_widget_disposed {
|
117
|
+
@thread.kill # safe to kill since data is in memory only
|
118
|
+
}
|
119
|
+
|
120
|
+
}.open
|
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.18.
|
4
|
+
version: 4.18.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AndyMaleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-02
|
11
|
+
date: 2021-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -434,13 +434,17 @@ files:
|
|
434
434
|
- lib/glimmer/swt/custom/radio_group.rb
|
435
435
|
- lib/glimmer/swt/custom/shape.rb
|
436
436
|
- lib/glimmer/swt/custom/shape/arc.rb
|
437
|
+
- lib/glimmer/swt/custom/shape/cubic.rb
|
437
438
|
- lib/glimmer/swt/custom/shape/focus.rb
|
438
439
|
- lib/glimmer/swt/custom/shape/image.rb
|
439
440
|
- lib/glimmer/swt/custom/shape/line.rb
|
440
441
|
- lib/glimmer/swt/custom/shape/oval.rb
|
442
|
+
- lib/glimmer/swt/custom/shape/path.rb
|
443
|
+
- lib/glimmer/swt/custom/shape/path_segment.rb
|
441
444
|
- lib/glimmer/swt/custom/shape/point.rb
|
442
445
|
- lib/glimmer/swt/custom/shape/polygon.rb
|
443
446
|
- lib/glimmer/swt/custom/shape/polyline.rb
|
447
|
+
- lib/glimmer/swt/custom/shape/quad.rb
|
444
448
|
- lib/glimmer/swt/custom/shape/rectangle.rb
|
445
449
|
- lib/glimmer/swt/custom/shape/text.rb
|
446
450
|
- lib/glimmer/swt/date_time_proxy.rb
|
@@ -481,6 +485,7 @@ files:
|
|
481
485
|
- samples/elaborate/login.rb
|
482
486
|
- samples/elaborate/mandelbrot_fractal.rb
|
483
487
|
- samples/elaborate/meta_sample.rb
|
488
|
+
- samples/elaborate/stock_ticker.rb
|
484
489
|
- samples/elaborate/tetris.rb
|
485
490
|
- samples/elaborate/tetris/model/block.rb
|
486
491
|
- samples/elaborate/tetris/model/game.rb
|
@@ -499,6 +504,8 @@ files:
|
|
499
504
|
- samples/hello/hello_button.rb
|
500
505
|
- samples/hello/hello_canvas.rb
|
501
506
|
- samples/hello/hello_canvas_animation.rb
|
507
|
+
- samples/hello/hello_canvas_data_binding.rb
|
508
|
+
- samples/hello/hello_canvas_path.rb
|
502
509
|
- samples/hello/hello_canvas_transform.rb
|
503
510
|
- samples/hello/hello_checkbox.rb
|
504
511
|
- samples/hello/hello_checkbox_group.rb
|