glimmer-dsl-swt 4.18.3.2 → 4.18.4.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +52 -0
- data/README.md +674 -323
- data/VERSION +1 -1
- data/glimmer-dsl-swt.gemspec +7 -3
- data/lib/ext/rouge/themes/glimmer.rb +29 -0
- data/lib/glimmer-dsl-swt.rb +0 -1
- data/lib/glimmer/data_binding/table_items_binding.rb +8 -5
- data/lib/glimmer/data_binding/widget_binding.rb +9 -1
- data/lib/glimmer/dsl/swt/image_expression.rb +14 -6
- data/lib/glimmer/dsl/swt/layout_data_expression.rb +4 -4
- data/lib/glimmer/dsl/swt/layout_expression.rb +5 -3
- data/lib/glimmer/swt/custom/code_text.rb +196 -51
- data/lib/glimmer/swt/custom/drawable.rb +4 -6
- data/lib/glimmer/swt/custom/shape.rb +69 -12
- data/lib/glimmer/swt/date_time_proxy.rb +1 -3
- data/lib/glimmer/swt/display_proxy.rb +12 -1
- data/lib/glimmer/swt/font_proxy.rb +1 -0
- data/lib/glimmer/swt/image_proxy.rb +79 -1
- data/lib/glimmer/swt/layout_proxy.rb +4 -1
- data/lib/glimmer/swt/shell_proxy.rb +10 -1
- data/lib/glimmer/swt/table_proxy.rb +27 -14
- data/lib/glimmer/swt/widget_proxy.rb +12 -2
- data/lib/glimmer/ui/custom_widget.rb +6 -2
- data/samples/elaborate/meta_sample.rb +5 -2
- data/samples/elaborate/meta_sample/meta_sample_logo.png +0 -0
- data/samples/elaborate/tetris.rb +60 -7
- data/samples/elaborate/tetris/model/game.rb +36 -7
- data/samples/elaborate/tetris/model/past_game.rb +14 -1
- data/samples/elaborate/tetris/model/tetromino.rb +18 -5
- data/samples/elaborate/tetris/view/block.rb +8 -13
- data/samples/elaborate/tetris/view/high_score_dialog.rb +23 -6
- data/samples/elaborate/tetris/view/playfield.rb +1 -1
- data/samples/elaborate/tetris/view/tetris_menu_bar.rb +22 -6
- data/samples/hello/hello_canvas.rb +10 -9
- data/samples/hello/hello_canvas_animation.rb +5 -5
- data/samples/hello/hello_code_text.rb +104 -0
- data/samples/hello/hello_table.rb +6 -4
- data/samples/hello/hello_table/baseball_park.png +0 -0
- metadata +6 -2
@@ -43,7 +43,8 @@ class Tetris
|
|
43
43
|
menu_item(:check) {
|
44
44
|
text '&Pause'
|
45
45
|
accelerator :command, :p
|
46
|
-
enabled bind(game, :game_over, on_read: :!)
|
46
|
+
enabled bind(game, :game_over, on_read: :!) {|value| value && !game.show_high_scores}
|
47
|
+
enabled bind(game, :show_high_scores, on_read: :!) {|value| value && !game.game_over}
|
47
48
|
selection bind(game, :paused)
|
48
49
|
}
|
49
50
|
menu_item {
|
@@ -70,13 +71,10 @@ class Tetris
|
|
70
71
|
|
71
72
|
menu {
|
72
73
|
text '&High Scores'
|
73
|
-
menu_item {
|
74
|
+
menu_item(:check) {
|
74
75
|
text '&Show'
|
75
76
|
accelerator :command, :shift, :h
|
76
|
-
|
77
|
-
on_widget_selected {
|
78
|
-
parent_custom_shell&.show_high_score_dialog
|
79
|
-
}
|
77
|
+
selection bind(game, :show_high_scores)
|
80
78
|
}
|
81
79
|
menu_item {
|
82
80
|
text '&Clear'
|
@@ -96,6 +94,24 @@ class Tetris
|
|
96
94
|
accelerator :command, :b
|
97
95
|
selection bind(game, :beeping)
|
98
96
|
}
|
97
|
+
menu {
|
98
|
+
text 'Up Arrow'
|
99
|
+
menu_item(:radio) {
|
100
|
+
text '&Instant Down'
|
101
|
+
accelerator :command, :shift, :i
|
102
|
+
selection bind(game, :instant_down_on_up, computed_by: :up_arrow_action)
|
103
|
+
}
|
104
|
+
menu_item(:radio) {
|
105
|
+
text 'Rotate &Right'
|
106
|
+
accelerator :command, :shift, :r
|
107
|
+
selection bind(game, :rotate_right_on_up, computed_by: :up_arrow_action)
|
108
|
+
}
|
109
|
+
menu_item(:radio) {
|
110
|
+
text 'Rotate &Left'
|
111
|
+
accelerator :command, :shift, :l
|
112
|
+
selection bind(game, :rotate_left_on_up, computed_by: :up_arrow_action)
|
113
|
+
}
|
114
|
+
}
|
99
115
|
} # end of menu
|
100
116
|
|
101
117
|
menu {
|
@@ -22,22 +22,22 @@
|
|
22
22
|
include Glimmer
|
23
23
|
|
24
24
|
shell {
|
25
|
-
text 'Hello, Canvas!'
|
25
|
+
text 'Hello, Canvas Image Icon!'
|
26
26
|
minimum_size 320, 400
|
27
27
|
|
28
28
|
canvas {
|
29
29
|
background :yellow
|
30
|
-
rectangle(0, 0, 220, 400
|
30
|
+
rectangle(0, 0, 220, 400) {
|
31
31
|
background :red
|
32
32
|
}
|
33
|
-
rectangle(50, 20, 300, 150, 30, 50
|
33
|
+
rectangle(50, 20, 300, 150, 30, 50) {
|
34
34
|
background :magenta
|
35
35
|
}
|
36
|
-
rectangle(150, 200, 100, 70, true
|
36
|
+
rectangle(150, 200, 100, 70, true) {
|
37
37
|
background :dark_magenta
|
38
38
|
foreground :yellow
|
39
39
|
}
|
40
|
-
rectangle(50, 200, 30, 70, false
|
40
|
+
rectangle(50, 200, 30, 70, false) {
|
41
41
|
background :magenta
|
42
42
|
foreground :dark_blue
|
43
43
|
}
|
@@ -49,13 +49,14 @@ shell {
|
|
49
49
|
foreground :dark_magenta
|
50
50
|
font name: 'Courier', height: 30
|
51
51
|
}
|
52
|
-
oval(110, 310, 100, 100
|
53
|
-
|
52
|
+
oval(110, 310, 100, 100) {
|
53
|
+
# patterns provide a differnet way to make gradients
|
54
|
+
background_pattern 0, 0, 105, 0, :yellow, rgb(128, 138, 248)
|
54
55
|
}
|
55
|
-
arc(210, 210, 100, 100, 30, -77
|
56
|
+
arc(210, 210, 100, 100, 30, -77) {
|
56
57
|
background :red
|
57
58
|
}
|
58
|
-
polygon(250, 210, 260, 170, 270, 210, 290, 230
|
59
|
+
polygon(250, 210, 260, 170, 270, 210, 290, 230) {
|
59
60
|
background :dark_yellow
|
60
61
|
}
|
61
62
|
polyline(250, 110, 260, 70, 270, 110, 290, 130, 250, 110)
|
@@ -35,7 +35,7 @@ shell {
|
|
35
35
|
oval(0, 0, 400, 400) { # x, y, width, height
|
36
36
|
foreground :black # sets oval background color
|
37
37
|
}
|
38
|
-
arc(0, 0, 400, 400, -1.4*index%360, 10
|
38
|
+
arc(0, 0, 400, 400, -1.4*index%360, 10) { # x, y, width, height, start angle, arc angle
|
39
39
|
background rgb(200, 200, 50) # sets arc background color
|
40
40
|
}
|
41
41
|
}
|
@@ -51,13 +51,13 @@ shell {
|
|
51
51
|
frame { |index, color| # frame block loops indefinitely (unless frame_count or cycle_count is set to an integer)
|
52
52
|
outside_color = colors[index % 2]
|
53
53
|
inside_color = colors[(index + 1) % 2]
|
54
|
-
|
54
|
+
|
55
55
|
background outside_color # sets canvas background color
|
56
|
-
|
57
|
-
rectangle(0, 0, 200, 200
|
56
|
+
|
57
|
+
rectangle(0, 0, 200, 200) {
|
58
58
|
background inside_color # sets rectangle background color
|
59
59
|
}
|
60
|
-
rectangle(200, 200, 200, 200
|
60
|
+
rectangle(200, 200, 200, 200) {
|
61
61
|
background inside_color # sets rectangle background color
|
62
62
|
}
|
63
63
|
}
|
@@ -0,0 +1,104 @@
|
|
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
|
+
include Glimmer
|
23
|
+
|
24
|
+
shell {
|
25
|
+
minimum_size 640, 480
|
26
|
+
text 'Hello, Code Text!'
|
27
|
+
|
28
|
+
tab_folder {
|
29
|
+
tab_item {
|
30
|
+
fill_layout
|
31
|
+
text 'Ruby (glimmer theme)'
|
32
|
+
code_text(language: 'ruby', theme: 'glimmer', lines: true) {
|
33
|
+
text <<~CODE
|
34
|
+
greeting = 'Hello, World!'
|
35
|
+
|
36
|
+
include Glimmer
|
37
|
+
|
38
|
+
shell {
|
39
|
+
text 'Glimmer'
|
40
|
+
|
41
|
+
label {
|
42
|
+
text greeting
|
43
|
+
font height: 30, style: :bold
|
44
|
+
}
|
45
|
+
}.open
|
46
|
+
CODE
|
47
|
+
}
|
48
|
+
}
|
49
|
+
tab_item {
|
50
|
+
fill_layout
|
51
|
+
text 'JavaScript (pastie theme)'
|
52
|
+
# No border (SWT styles are passed explicitly)
|
53
|
+
code_text(:multi, :h_scroll, :v_scroll, language: 'javascript', theme: 'pastie', lines: {width: 2}) {
|
54
|
+
# With lines, the custom widget has a root composite, which can be configured separately
|
55
|
+
root {
|
56
|
+
grid_layout(2, false) {
|
57
|
+
margin_width 2
|
58
|
+
}
|
59
|
+
background :white
|
60
|
+
}
|
61
|
+
# With lines, the line numbers widget can be configured separately
|
62
|
+
line_numbers {
|
63
|
+
background :white
|
64
|
+
}
|
65
|
+
text <<~CODE
|
66
|
+
function greet(greeting) {
|
67
|
+
alert(greeting);
|
68
|
+
}
|
69
|
+
|
70
|
+
var greetingString = 'Hello, World!';
|
71
|
+
|
72
|
+
greet(greetingString);
|
73
|
+
|
74
|
+
var moreGreetings = ['Howdy!', 'Aloha!', 'Hey!']
|
75
|
+
|
76
|
+
for(var greeting of moreGreetings) {
|
77
|
+
greet(greeting)
|
78
|
+
}
|
79
|
+
CODE
|
80
|
+
}
|
81
|
+
}
|
82
|
+
tab_item {
|
83
|
+
fill_layout
|
84
|
+
text 'HTML (github theme)'
|
85
|
+
code_text(language: 'html', theme: 'github') {
|
86
|
+
text <<~CODE
|
87
|
+
<html>
|
88
|
+
<body>
|
89
|
+
<section class="accordion">
|
90
|
+
<form method="post" id="name">
|
91
|
+
<label for="name">
|
92
|
+
Name
|
93
|
+
</label>
|
94
|
+
<input name="name" type="text" />
|
95
|
+
<input type="submit" />
|
96
|
+
</form>
|
97
|
+
</section>
|
98
|
+
</body>
|
99
|
+
</html>
|
100
|
+
CODE
|
101
|
+
}
|
102
|
+
}
|
103
|
+
}
|
104
|
+
}.open
|
@@ -186,18 +186,20 @@ class HelloTable
|
|
186
186
|
grid_layout
|
187
187
|
|
188
188
|
text 'Hello, Table!'
|
189
|
+
background_image File.expand_path('hello_table/baseball_park.png', __dir__)
|
189
190
|
|
190
191
|
label {
|
191
192
|
layout_data :center, :center, true, false
|
192
193
|
|
193
|
-
text '
|
194
|
-
|
194
|
+
text 'BASEBALL PLAYOFF SCHEDULE'
|
195
|
+
foreground rgb(94, 107, 103)
|
196
|
+
font name: 'Optima', height: 38, style: :bold
|
195
197
|
}
|
196
198
|
|
197
199
|
combo(:read_only) {
|
198
200
|
layout_data :center, :center, true, false
|
199
201
|
selection bind(BaseballGame, :playoff_type)
|
200
|
-
font height:
|
202
|
+
font height: 14
|
201
203
|
}
|
202
204
|
|
203
205
|
table(:editable) { |table_proxy|
|
@@ -262,7 +264,7 @@ class HelloTable
|
|
262
264
|
button {
|
263
265
|
text 'Book Selected Game'
|
264
266
|
layout_data :center, :center, true, false
|
265
|
-
font height:
|
267
|
+
font height: 14
|
266
268
|
enabled bind(BaseballGame, :selected_game)
|
267
269
|
|
268
270
|
on_widget_selected {
|
Binary file
|
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.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: 2021-
|
11
|
+
date: 2021-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -367,6 +367,7 @@ files:
|
|
367
367
|
- icons/scaffold_app.png
|
368
368
|
- lib/ext/glimmer.rb
|
369
369
|
- lib/ext/glimmer/config.rb
|
370
|
+
- lib/ext/rouge/themes/glimmer.rb
|
370
371
|
- lib/glimmer-dsl-swt.rb
|
371
372
|
- lib/glimmer/Rakefile
|
372
373
|
- lib/glimmer/data_binding/list_selection_binding.rb
|
@@ -468,6 +469,7 @@ files:
|
|
468
469
|
- samples/elaborate/contact_manager/contact_repository.rb
|
469
470
|
- samples/elaborate/login.rb
|
470
471
|
- samples/elaborate/meta_sample.rb
|
472
|
+
- samples/elaborate/meta_sample/meta_sample_logo.png
|
471
473
|
- samples/elaborate/tetris.rb
|
472
474
|
- samples/elaborate/tetris/model/block.rb
|
473
475
|
- samples/elaborate/tetris/model/game.rb
|
@@ -489,6 +491,7 @@ files:
|
|
489
491
|
- samples/hello/hello_canvas_transform.rb
|
490
492
|
- samples/hello/hello_checkbox.rb
|
491
493
|
- samples/hello/hello_checkbox_group.rb
|
494
|
+
- samples/hello/hello_code_text.rb
|
492
495
|
- samples/hello/hello_combo.rb
|
493
496
|
- samples/hello/hello_computed.rb
|
494
497
|
- samples/hello/hello_computed/contact.rb
|
@@ -514,6 +517,7 @@ files:
|
|
514
517
|
- samples/hello/hello_styled_text.rb
|
515
518
|
- samples/hello/hello_tab.rb
|
516
519
|
- samples/hello/hello_table.rb
|
520
|
+
- samples/hello/hello_table/baseball_park.png
|
517
521
|
- samples/hello/hello_world.rb
|
518
522
|
- vendor/swt/linux/swt.jar
|
519
523
|
- vendor/swt/mac/swt.jar
|