glimmer-dsl-swt 4.22.0.0 → 4.22.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +207 -169
- data/README.md +10 -10
- data/RUBY_VERSION +1 -1
- data/VERSION +1 -1
- data/docs/reference/GLIMMER_COMMAND.md +21 -7
- data/docs/reference/GLIMMER_CONFIGURATION.md +14 -3
- data/docs/reference/GLIMMER_GIRB.md +1 -1
- data/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md +743 -113
- data/docs/reference/GLIMMER_SAMPLES.md +22 -8
- data/glimmer-dsl-swt.gemspec +0 -0
- data/lib/ext/glimmer/config.rb +41 -24
- data/lib/glimmer/data_binding/observable_widget.rb +6 -6
- data/lib/glimmer/data_binding/widget_binding.rb +2 -1
- data/lib/glimmer/dsl/swt/dsl.rb +1 -1
- data/lib/glimmer/dsl/swt/observe_expression.rb +2 -1
- data/lib/glimmer/dsl/swt/shape_expression.rb +1 -0
- data/lib/glimmer/dsl/swt/shine_data_binding_expression.rb +3 -8
- data/lib/glimmer/dsl/swt/transform_expression.rb +1 -1
- data/lib/glimmer/launcher.rb +16 -15
- data/lib/glimmer/rake_task/scaffold.rb +5 -16
- data/lib/glimmer/swt/color_proxy.rb +5 -5
- data/lib/glimmer/swt/custom/drawable.rb +4 -0
- data/lib/glimmer/swt/custom/shape/line.rb +0 -1
- data/lib/glimmer/swt/custom/shape/path.rb +2 -2
- data/lib/glimmer/swt/custom/shape/path_segment.rb +2 -2
- data/lib/glimmer/swt/custom/shape/point.rb +8 -1
- data/lib/glimmer/swt/custom/shape.rb +171 -69
- data/lib/glimmer/swt/display_proxy.rb +15 -10
- data/lib/glimmer/swt/image_proxy.rb +5 -5
- data/lib/glimmer/swt/message_box_proxy.rb +5 -5
- data/lib/glimmer/swt/shape_listener_proxy.rb +55 -0
- data/lib/glimmer/swt/shell_proxy.rb +1 -0
- data/lib/glimmer/swt/transform_proxy.rb +3 -3
- data/lib/glimmer/swt/tray_proxy.rb +4 -4
- data/lib/glimmer/swt/widget_proxy.rb +5 -7
- data/lib/glimmer/ui/custom_shape.rb +34 -10
- data/lib/glimmer/ui/custom_widget.rb +3 -8
- data/lib/glimmer-dsl-swt.rb +6 -2
- data/samples/elaborate/klondike_solitaire/model/column_pile.rb +0 -1
- data/samples/elaborate/klondike_solitaire/view/column_pile.rb +3 -16
- data/samples/elaborate/klondike_solitaire/view/dealing_pile.rb +1 -1
- data/samples/elaborate/klondike_solitaire/view/dealt_pile.rb +12 -5
- data/samples/elaborate/klondike_solitaire/view/empty_playing_card.rb +2 -1
- data/samples/elaborate/klondike_solitaire/view/foundation_pile.rb +2 -2
- data/samples/elaborate/klondike_solitaire/view/hidden_playing_card.rb +2 -2
- data/samples/elaborate/klondike_solitaire/view/klondike_solitaire_menu_bar.rb +60 -0
- data/samples/elaborate/klondike_solitaire/view/playing_card.rb +3 -2
- data/samples/elaborate/klondike_solitaire.rb +13 -55
- data/samples/elaborate/mandelbrot_fractal.rb +3 -1
- data/samples/elaborate/quarto/model/game.rb +124 -0
- data/samples/elaborate/quarto/model/piece/cube.rb +31 -0
- data/samples/elaborate/quarto/model/piece/cylinder.rb +31 -0
- data/samples/elaborate/quarto/model/piece.rb +70 -0
- data/samples/elaborate/quarto/view/available_pieces_area.rb +72 -0
- data/samples/elaborate/quarto/view/board.rb +65 -0
- data/samples/elaborate/quarto/view/cell.rb +85 -0
- data/samples/elaborate/quarto/view/cube.rb +73 -0
- data/samples/elaborate/quarto/view/cylinder.rb +72 -0
- data/samples/elaborate/quarto/view/message_box_panel.rb +114 -0
- data/samples/elaborate/quarto/view/piece.rb +56 -0
- data/samples/elaborate/quarto/view/selected_piece_area.rb +69 -0
- data/samples/elaborate/quarto.rb +188 -0
- data/samples/hello/hello_canvas_data_binding.rb +7 -7
- data/samples/hello/hello_custom_widget.rb +23 -5
- metadata +35 -40
- data/bin/glimmer_runner.rb +0 -4
@@ -78,11 +78,13 @@
|
|
78
78
|
- [Stock Ticker](#stock-ticker)
|
79
79
|
- [Metronome](#metronome)
|
80
80
|
- [Weather](#weather)
|
81
|
+
- [Quarto](#quarto)
|
81
82
|
- [External Samples](#external-samples)
|
82
83
|
- [Glimmer Calculator](#glimmer-calculator)
|
83
84
|
- [Gladiator](#gladiator)
|
84
85
|
- [Timer](#timer)
|
85
86
|
- [Glimmer Klondike Solitaire](#glimmer-klondike-solitaire)
|
87
|
+
- [Glimmer Metronome](#glimmer-metronome)
|
86
88
|
- [License](#license)
|
87
89
|
|
88
90
|
## Samples
|
@@ -1053,14 +1055,6 @@ Hello, Tool Bar!
|
|
1053
1055
|
|
1054
1056
|
![Hello Tool Bar](/images/glimmer-hello-tool-bar.png)
|
1055
1057
|
|
1056
|
-
![Hello Tool Bar Cut](/images/glimmer-hello-tool-bar-cut.png)
|
1057
|
-
|
1058
|
-
![Hello Tool Bar Copy](/images/glimmer-hello-tool-bar-copy.png)
|
1059
|
-
|
1060
|
-
![Hello Tool Bar Paste](/images/glimmer-hello-tool-bar-paste.png)
|
1061
|
-
|
1062
|
-
![Hello Tool Bar Font Size](/images/glimmer-hello-tool-bar-font-size.png)
|
1063
|
-
|
1064
1058
|
#### Hello, Cool Bar!
|
1065
1059
|
|
1066
1060
|
This sample demonstrates the use of `cool_bar` that can contain multiple reorganizable `tool_bar` widgets
|
@@ -1369,6 +1363,18 @@ Atlanta - Fahrenheit
|
|
1369
1363
|
|
1370
1364
|
![Atlanta F](/images/glimmer-weather-atlanta-fahrenheit.png)
|
1371
1365
|
|
1366
|
+
#### Quarto
|
1367
|
+
|
1368
|
+
This sample is a classic game called [Quarto](https://en.gigamic.com/game/quarto-classic), which demonstrates Canvas Drag and Drop and Custom Shapes (`cylinder`, `cube`, and `message_box_panel`) in an MVC application.
|
1369
|
+
|
1370
|
+
Code:
|
1371
|
+
|
1372
|
+
[samples/elaborate/quarto.rb](/samples/elaborate/quarto.rb)
|
1373
|
+
|
1374
|
+
Quarto
|
1375
|
+
|
1376
|
+
![Quarto](/images/glimmer-quarto.png)
|
1377
|
+
|
1372
1378
|
### External Samples
|
1373
1379
|
|
1374
1380
|
#### Glimmer Calculator
|
@@ -1408,6 +1414,14 @@ This is a souped up version of the Klondike Solitaire elaborate sample, which is
|
|
1408
1414
|
|
1409
1415
|
![Glimmer Klondike Solitaire](https://raw.githubusercontent.com/AndyObtiva/glimmer_klondike_solitaire/master/images/glimmer-klondike-solitaire.png)
|
1410
1416
|
|
1417
|
+
#### Glimmer Metronome
|
1418
|
+
|
1419
|
+
This is an external enhanced version of [Metronome](#metronome) that can be packaged as an independent native executable.
|
1420
|
+
|
1421
|
+
[<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer_metronome/master/icons/linux/Glimmer%20Metronome.png" height=40 /> Glimmer Metronome](https://github.com/AndyObtiva/glimmer_metronome)
|
1422
|
+
|
1423
|
+
![Metronome](https://raw.githubusercontent.com/AndyObtiva/glimmer_metronome/master/screenshots/glimmer-metronome.png)
|
1424
|
+
|
1411
1425
|
## License
|
1412
1426
|
|
1413
1427
|
[MIT](LICENSE.txt)
|
data/glimmer-dsl-swt.gemspec
CHANGED
Binary file
|
data/lib/ext/glimmer/config.rb
CHANGED
@@ -59,6 +59,20 @@ module Glimmer
|
|
59
59
|
end
|
60
60
|
alias auto_sync_exec? auto_sync_exec
|
61
61
|
|
62
|
+
# allowed logger types are :logger (default) and :logging (logging gem supporting async logging)
|
63
|
+
# updating logger type value resets logger
|
64
|
+
def logger_type=(logger_type_class)
|
65
|
+
@@logger_type = logger_type_class
|
66
|
+
reset_logger!
|
67
|
+
end
|
68
|
+
|
69
|
+
def logger_type
|
70
|
+
unless defined? @@logger_type
|
71
|
+
@@logger_type = :logger
|
72
|
+
end
|
73
|
+
@@logger_type
|
74
|
+
end
|
75
|
+
|
62
76
|
# Returns Logging Devices. Default is [:stdout, :syslog]
|
63
77
|
def logging_devices
|
64
78
|
unless defined? @@logging_devices
|
@@ -112,39 +126,42 @@ module Glimmer
|
|
112
126
|
reset_logger!
|
113
127
|
end
|
114
128
|
|
129
|
+
alias reset_logger_without_glimmer_dsl_swt! reset_logger!
|
115
130
|
def reset_logger!
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
appenders << Logging.appenders.
|
131
|
+
if logger_type == :logger
|
132
|
+
reset_logger_without_glimmer_dsl_swt!
|
133
|
+
else
|
134
|
+
require 'logging'
|
135
|
+
@first_time = !defined?(@@logger)
|
136
|
+
old_level = logger.level unless @first_time
|
137
|
+
self.logger = Logging.logger['glimmer'].tap do |logger|
|
138
|
+
logger.level = old_level || :error
|
139
|
+
appenders = []
|
140
|
+
appenders << Logging.appenders.stdout(logging_appender_options) if logging_devices.include?(:stdout)
|
141
|
+
appenders << Logging.appenders.stderr(logging_appender_options) if logging_devices.include?(:stderr)
|
142
|
+
if logging_devices.include?(:file)
|
143
|
+
require 'fileutils'
|
144
|
+
FileUtils.mkdir_p('log')
|
145
|
+
appenders << Logging.appenders.rolling_file('log/glimmer.log', logging_appender_options.merge(logging_device_file_options)) if logging_devices.include?(:file)
|
146
|
+
end
|
147
|
+
if Object.const_defined?(:Syslog) && logging_devices.include?(:syslog)
|
148
|
+
Syslog.close if Syslog.opened?
|
149
|
+
appenders << Logging.appenders.syslog('glimmer', logging_appender_options)
|
150
|
+
end
|
151
|
+
logger.appenders = appenders
|
127
152
|
end
|
128
|
-
if Object.const_defined?(:Syslog) && logging_devices.include?(:syslog)
|
129
|
-
Syslog.close if Syslog.opened?
|
130
|
-
appenders << Logging.appenders.syslog('glimmer', logging_appender_options)
|
131
|
-
end
|
132
|
-
logger.appenders = appenders
|
133
153
|
end
|
134
|
-
|
135
154
|
end
|
136
|
-
|
137
155
|
end
|
138
|
-
|
139
156
|
end
|
140
|
-
|
141
157
|
end
|
142
158
|
|
143
|
-
Glimmer::Config.reset_logger! unless ENV['GLIMMER_LOGGER_ENABLED'].to_s.downcase == 'false'
|
144
159
|
if ENV['GLIMMER_LOGGER_LEVEL']
|
145
|
-
|
146
|
-
|
147
|
-
|
160
|
+
if Glimmer::Config.logger_type == :logging
|
161
|
+
# if glimmer log level is being overridden for debugging purposes, then disable async logging making logging immediate
|
162
|
+
Glimmer::Config.logging_appender_options = Glimmer::Config.logging_appender_options.merge(async: false, auto_flushing: 1, immediate_at: [:unknown, :debug, :info, :error, :fatal])
|
163
|
+
Glimmer::Config.logging_devices = [:stdout]
|
164
|
+
end
|
148
165
|
begin
|
149
166
|
puts "Adjusting Glimmer logging level to #{ENV['GLIMMER_LOGGER_LEVEL']}"
|
150
167
|
Glimmer::Config.logger.level = ENV['GLIMMER_LOGGER_LEVEL'].strip
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# Copyright (c) 2007-2021 Andy Maleh
|
2
|
-
#
|
2
|
+
#
|
3
3
|
# Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
# a copy of this software and associated documentation files (the
|
5
5
|
# "Software"), to deal in the Software without restriction, including
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
# permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
# the following conditions:
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# The above copyright notice and this permission notice shall be
|
12
12
|
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -25,9 +25,9 @@ module Glimmer
|
|
25
25
|
# TODO see if it is worth it to eliminate duplication of method_missing
|
26
26
|
# from WidgetProxy using a module
|
27
27
|
|
28
|
-
def method_missing(
|
29
|
-
method_name =
|
30
|
-
if can_handle_observation_request?(method_name)
|
28
|
+
def method_missing(method_name, *args, &block)
|
29
|
+
method_name = method_name.to_s
|
30
|
+
if block && can_handle_observation_request?(method_name)
|
31
31
|
handle_observation_request(method_name, &block)
|
32
32
|
else
|
33
33
|
super
|
@@ -38,11 +38,12 @@ module Glimmer
|
|
38
38
|
@sync_exec = sync_exec
|
39
39
|
@async_exec = async_exec
|
40
40
|
SWT::DisplayProxy.instance.auto_exec(override_sync_exec: @sync_exec, override_async_exec: @async_exec) do
|
41
|
-
if @widget.respond_to?(:on_widget_disposed)
|
41
|
+
if @widget.is_a?(Glimmer::SWT::WidgetProxy) && @widget.respond_to?(:on_widget_disposed)
|
42
42
|
@widget.on_widget_disposed do |dispose_event|
|
43
43
|
deregister_all_observables unless @widget.shell_proxy.last_shell_closing?
|
44
44
|
end
|
45
45
|
end
|
46
|
+
# TODO look into hooking on_shape_disposed without slowing down shapes in samples like Tetris
|
46
47
|
end
|
47
48
|
end
|
48
49
|
|
data/lib/glimmer/dsl/swt/dsl.rb
CHANGED
@@ -20,7 +20,7 @@
|
|
20
20
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
21
|
|
22
22
|
require 'glimmer/launcher'
|
23
|
-
require ENV['SWT_JAR_FILE_PATH'] || "#{Glimmer::Launcher.swt_jar_file}
|
23
|
+
require ENV['SWT_JAR_FILE_PATH'] || "#{Glimmer::Launcher.swt_jar_file}"
|
24
24
|
require 'glimmer/dsl/engine'
|
25
25
|
Dir[File.expand_path('../*_expression.rb', __FILE__)].each {|f| require f}
|
26
26
|
|
@@ -23,6 +23,7 @@ require 'glimmer/dsl/static_expression'
|
|
23
23
|
require 'glimmer/dsl/top_level_expression'
|
24
24
|
require 'glimmer/dsl/observe_expression'
|
25
25
|
require 'glimmer/ui/custom_widget'
|
26
|
+
require 'glimmer/swt/display_proxy'
|
26
27
|
|
27
28
|
module Glimmer
|
28
29
|
module DSL
|
@@ -33,7 +34,7 @@ module Glimmer
|
|
33
34
|
|
34
35
|
def interpret(parent, keyword, *args, &block)
|
35
36
|
observer_registration = super
|
36
|
-
Glimmer::
|
37
|
+
Glimmer::SWT::DisplayProxy.current_custom_widgets_and_shapes.last&.observer_registrations&.push(observer_registration)
|
37
38
|
observer_registration
|
38
39
|
end
|
39
40
|
end
|
@@ -32,6 +32,7 @@ module Glimmer
|
|
32
32
|
include ParentExpression
|
33
33
|
|
34
34
|
def can_interpret?(parent, keyword, *args, &block)
|
35
|
+
# TODO support CustomShape parent as well
|
35
36
|
(parent.is_a?(Glimmer::SWT::Custom::Drawable) or parent.is_a?(Glimmer::SWT::Custom::Shape)) and
|
36
37
|
Glimmer::SWT::Custom::Shape.valid?(parent, keyword, *args, &block)
|
37
38
|
end
|
@@ -19,7 +19,7 @@
|
|
19
19
|
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
20
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
21
|
|
22
|
-
require 'glimmer/dsl/
|
22
|
+
require 'glimmer/dsl/shine_data_binding_expression'
|
23
23
|
require 'glimmer/data_binding/model_binding'
|
24
24
|
require 'glimmer/data_binding/widget_binding'
|
25
25
|
require 'glimmer/swt/display_proxy'
|
@@ -28,22 +28,17 @@ require 'glimmer/data_binding/shine'
|
|
28
28
|
module Glimmer
|
29
29
|
module DSL
|
30
30
|
module SWT
|
31
|
-
class ShineDataBindingExpression <
|
31
|
+
class ShineDataBindingExpression < Glimmer::DSL::ShineDataBindingExpression
|
32
32
|
include_package 'org.eclipse.swt.widgets'
|
33
33
|
|
34
34
|
def can_interpret?(parent, keyword, *args, &block)
|
35
|
-
|
36
|
-
block.nil? and
|
35
|
+
super and
|
37
36
|
(
|
38
37
|
(parent.respond_to?(:has_attribute?) and parent.has_attribute?(keyword)) or
|
39
38
|
(parent.respond_to?(:swt_widget) and (parent.swt_widget.is_a?(Table) or parent.swt_widget.is_a?(Tree)))
|
40
39
|
) and
|
41
40
|
!(parent.respond_to?(:swt_widget) && parent.swt_widget.class == org.eclipse.swt.widgets.Canvas && keyword == 'image')
|
42
41
|
end
|
43
|
-
|
44
|
-
def interpret(parent, keyword, *args, &block)
|
45
|
-
Glimmer::DataBinding::Shine.new(parent, keyword)
|
46
|
-
end
|
47
42
|
end
|
48
43
|
end
|
49
44
|
end
|
@@ -34,7 +34,7 @@ module Glimmer
|
|
34
34
|
|
35
35
|
def can_interpret?(parent, keyword, *args, &block)
|
36
36
|
super and
|
37
|
-
(parent.nil? or parent.is_a?(Glimmer::SWT::Custom::Shape))
|
37
|
+
(parent.nil? or parent.is_a?(Glimmer::SWT::Custom::Shape) or parent.is_a?(Glimmer::UI::CustomShape))
|
38
38
|
end
|
39
39
|
|
40
40
|
def interpret(parent, keyword, *args, &block)
|
data/lib/glimmer/launcher.rb
CHANGED
@@ -79,7 +79,7 @@ module Glimmer
|
|
79
79
|
end
|
80
80
|
|
81
81
|
def swt_jar_file
|
82
|
-
@swt_jar_file ||= File.expand_path(File.join(__FILE__, '..', '..', '..', 'vendor', 'swt', platform_os, 'swt.jar'))
|
82
|
+
@swt_jar_file ||= File.expand_path(File.join(__FILE__, '..', '..', '..', 'vendor', 'swt', platform_os + special_cpu_architecture_suffix, 'swt.jar'))
|
83
83
|
end
|
84
84
|
|
85
85
|
def jruby_os_specific_options
|
@@ -89,8 +89,7 @@ module Glimmer
|
|
89
89
|
def glimmer_lib
|
90
90
|
unless @glimmer_lib
|
91
91
|
@glimmer_lib = GLIMMER_LIB_GEM
|
92
|
-
|
93
|
-
if !glimmer_gem_listing.include?(GLIMMER_LIB_GEM) && File.exists?(GLIMMER_LIB_LOCAL)
|
92
|
+
if File.exists?(GLIMMER_LIB_LOCAL)
|
94
93
|
@glimmer_lib = GLIMMER_LIB_LOCAL
|
95
94
|
puts "[DEVELOPMENT MODE] (detected #{@glimmer_lib})"
|
96
95
|
end
|
@@ -121,18 +120,21 @@ module Glimmer
|
|
121
120
|
ENV[k] = v
|
122
121
|
end
|
123
122
|
the_glimmer_lib = glimmer_lib
|
124
|
-
if the_glimmer_lib == GLIMMER_LIB_LOCAL
|
125
|
-
|
123
|
+
require 'puts_debuggerer' if the_glimmer_lib == GLIMMER_LIB_LOCAL
|
124
|
+
is_rake_task = !application.end_with?('.rb')
|
125
|
+
rake_tasks = []
|
126
|
+
if is_rake_task
|
127
|
+
load File.expand_path('./Rakefile') if File.exist?(File.expand_path('./Rakefile')) && caller.join("\n").include?('/bin/glimmer:')
|
128
|
+
require_relative 'rake_task'
|
129
|
+
rake_tasks = Rake.application.tasks.map(&:to_s).map {|t| t.sub('glimmer:', '')}
|
130
|
+
|
131
|
+
# handle a bash quirk with calling package[msi] while there is a "packages" directory locally (it passes package[msi] as packages)
|
132
|
+
application = 'package[msi]' if application == 'packages'
|
133
|
+
|
134
|
+
potential_rake_task_parts = application.match(REGEX_RAKE_TASK_WITH_ARGS)
|
135
|
+
application = potential_rake_task_parts[1]
|
136
|
+
rake_task_args = potential_rake_task_parts[2].split(',')
|
126
137
|
end
|
127
|
-
require_relative 'rake_task'
|
128
|
-
rake_tasks = Rake.application.tasks.map(&:to_s).map {|t| t.sub('glimmer:', '')}
|
129
|
-
|
130
|
-
# handle a bash quirk with calling package[msi] while there is a "packages" directory locally (it passes package[msi] as packages)
|
131
|
-
application = 'package[msi]' if application == 'packages'
|
132
|
-
|
133
|
-
potential_rake_task_parts = application.match(REGEX_RAKE_TASK_WITH_ARGS)
|
134
|
-
application = potential_rake_task_parts[1]
|
135
|
-
rake_task_args = potential_rake_task_parts[2].split(',')
|
136
138
|
if rake_tasks.include?(application)
|
137
139
|
load_env_vars(glimmer_option_env_vars(glimmer_options))
|
138
140
|
rake_task = "glimmer:#{application}"
|
@@ -171,7 +173,6 @@ module Glimmer
|
|
171
173
|
private
|
172
174
|
|
173
175
|
def launch_application
|
174
|
-
load File.expand_path('./Rakefile') if File.exist?(File.expand_path('./Rakefile')) && caller.join("\n").include?('/bin/glimmer_runner.rb:')
|
175
176
|
self.class.launch(
|
176
177
|
@application_path,
|
177
178
|
jruby_options: @jruby_options,
|
@@ -99,6 +99,7 @@ module Glimmer
|
|
99
99
|
|
100
100
|
# Gladiator (Glimmer Editor)
|
101
101
|
.gladiator
|
102
|
+
.gladiator-scratchpad
|
102
103
|
|
103
104
|
# Glimmer
|
104
105
|
/dist/
|
@@ -116,12 +117,12 @@ module Glimmer
|
|
116
117
|
GEMFILE_APP_MIDFIX = <<~MULTI_LINE_STRING
|
117
118
|
|
118
119
|
gem 'glimmer-dsl-swt', '~> #{VERSION}'
|
119
|
-
gem 'psych', '3.3.2' # Fixed temporarily because installing latest on JDK16 was causing issues
|
120
|
+
gem 'psych', '3.3.2' # Fixed temporarily because installing latest on JDK16+ was causing issues
|
120
121
|
MULTI_LINE_STRING
|
121
122
|
GEMFILE_GEM_MIDFIX = <<~MULTI_LINE_STRING
|
122
123
|
|
123
124
|
gem 'glimmer-dsl-swt', '~> #{VERSION.split('.')[0...2].join('.')}'
|
124
|
-
gem 'psych', '3.3.2' # Fixed temporarily because installing latest on JDK16 was causing issues
|
125
|
+
gem 'psych', '3.3.2' # Fixed temporarily because installing latest on JDK16+ was causing issues
|
125
126
|
MULTI_LINE_STRING
|
126
127
|
GEMFILE_SUFFIX = <<~MULTI_LINE_STRING
|
127
128
|
|
@@ -429,19 +430,7 @@ module Glimmer
|
|
429
430
|
end
|
430
431
|
|
431
432
|
def gemfile(shell_type)
|
432
|
-
|
433
|
-
lines = APP_GEMFILE.split("\n")
|
434
|
-
require_glimmer_dsl_swt_index = lines.index(lines.detect {|l| l.include?("gem 'glimmer-dsl-swt'") })
|
435
|
-
lines[(require_glimmer_dsl_swt_index + 1)..(require_glimmer_dsl_swt_index + 1)] = [
|
436
|
-
"",
|
437
|
-
"# Enable Chromium Browser Glimmer Custom Widget gem if needed (e.g. Linux needs it to support HTML5 Video), and use `browser(:chromium)` in GUI.",
|
438
|
-
"# gem 'glimmer-cw-browser-chromium', '>= 0'",
|
439
|
-
"",
|
440
|
-
]
|
441
|
-
lines.join("\n")
|
442
|
-
else
|
443
|
-
APP_GEMFILE
|
444
|
-
end
|
433
|
+
APP_GEMFILE
|
445
434
|
end
|
446
435
|
|
447
436
|
def app_main_file(app_name)
|
@@ -643,7 +632,7 @@ module Glimmer
|
|
643
632
|
minimum_size #{shell_type == :desktopify ? '768, 432' : '420, 240'}
|
644
633
|
image File.join(APP_ROOT, 'icons', 'windows', "#{human_name(shell_type == :gem ? custom_shell_name : current_dir_name)}.ico") if OS.windows?
|
645
634
|
image File.join(APP_ROOT, 'icons', 'linux', "#{human_name(shell_type == :gem ? custom_shell_name : current_dir_name)}.png") unless OS.windows?
|
646
|
-
text "#{human_name(namespace)} -
|
635
|
+
text "#{human_name(namespace)}#{' - ' + human_name(custom_shell_name) if shell_type != :desktopify}"
|
647
636
|
|
648
637
|
MULTI_LINE_STRING
|
649
638
|
|
@@ -83,15 +83,15 @@ module Glimmer
|
|
83
83
|
@swt_color
|
84
84
|
end
|
85
85
|
|
86
|
-
def method_missing(
|
87
|
-
swt_color.send(
|
86
|
+
def method_missing(method_name, *args, &block)
|
87
|
+
swt_color.send(method_name, *args, &block)
|
88
88
|
rescue => e
|
89
|
-
Glimmer::Config.logger.debug {"Neither ColorProxy nor #{swt_color.class.name} can handle the method ##{
|
89
|
+
Glimmer::Config.logger.debug {"Neither ColorProxy nor #{swt_color.class.name} can handle the method ##{method_name}"}
|
90
90
|
super
|
91
91
|
end
|
92
92
|
|
93
|
-
def respond_to?(
|
94
|
-
super || swt_color.respond_to?(
|
93
|
+
def respond_to?(method_name, *args, &block)
|
94
|
+
super || swt_color.respond_to?(method_name, *args, &block)
|
95
95
|
end
|
96
96
|
|
97
97
|
private
|
@@ -44,6 +44,10 @@ module Glimmer
|
|
44
44
|
@image_buffered_shapes ||= []
|
45
45
|
end
|
46
46
|
|
47
|
+
def drop_shapes
|
48
|
+
@drop_shapes ||= []
|
49
|
+
end
|
50
|
+
|
47
51
|
# TODO add a method like shapes that specifies drawable_properties to be able to adjust properties like transform in between shapes
|
48
52
|
|
49
53
|
def shape_at_location(x, y)
|
@@ -101,10 +101,10 @@ module Glimmer
|
|
101
101
|
end
|
102
102
|
end
|
103
103
|
|
104
|
-
def dispose(redraw: true)
|
104
|
+
def dispose(dispose_images: true, dispose_patterns: true, redraw: true)
|
105
105
|
Glimmer::SWT::DisplayProxy.instance.auto_exec do
|
106
106
|
clear if self.class == Path
|
107
|
-
super(redraw: redraw) if (parent.is_a?(Shape) && (!parent.is_a?(PathSegment) || !parent.part_of_path?)) || parent.is_a?(Drawable)
|
107
|
+
super(dispose_images: dispose_images, dispose_patterns: dispose_patterns, redraw: redraw) if (parent.is_a?(Shape) && (!parent.is_a?(PathSegment) || !parent.part_of_path?)) || parent.is_a?(Drawable)
|
108
108
|
end
|
109
109
|
end
|
110
110
|
|
@@ -75,7 +75,7 @@ module Glimmer
|
|
75
75
|
true
|
76
76
|
end
|
77
77
|
|
78
|
-
def dispose(redraw: true)
|
78
|
+
def dispose(dispose_images: true, dispose_patterns: true, redraw: true)
|
79
79
|
Glimmer::SWT::DisplayProxy.instance.auto_exec do
|
80
80
|
# including classes could override to dispose of resources first
|
81
81
|
# afterwards, parent removes from its path segments with post_dispose_content
|
@@ -83,7 +83,7 @@ module Glimmer
|
|
83
83
|
if part_of_path?
|
84
84
|
drawable.redraw if redraw && !drawable.is_a?(ImageProxy)
|
85
85
|
else
|
86
|
-
super(redraw: redraw)
|
86
|
+
super(dispose_images: dispose_images, dispose_patterns: dispose_patterns, redraw: redraw)
|
87
87
|
end
|
88
88
|
end
|
89
89
|
end
|
@@ -53,7 +53,14 @@ module Glimmer
|
|
53
53
|
# give it some fuzz (helps makes mouse clicking easier)
|
54
54
|
x.to_i.between?(self.absolute_x.to_i - 2, self.absolute_x.to_i + 2) && y.to_i.between?(self.absolute_y.to_i - 2, self.absolute_y.to_i + 2)
|
55
55
|
end
|
56
|
-
|
56
|
+
|
57
|
+
def contain?(x, y)
|
58
|
+
include?(x, y)
|
59
|
+
end
|
60
|
+
|
61
|
+
def bounds_contain?(x, y)
|
62
|
+
include?(x, y)
|
63
|
+
end
|
57
64
|
|
58
65
|
def path_segment_method_name
|
59
66
|
'addRectangle'
|