glimmer-dsl-swt 4.21.2.4 → 4.22.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +208 -167
- data/README.md +18 -11
- data/VERSION +1 -1
- data/docs/reference/GLIMMER_COMMAND.md +2 -2
- data/docs/reference/GLIMMER_CONFIGURATION.md +14 -3
- data/docs/reference/GLIMMER_GUI_DSL_SYNTAX.md +277 -112
- data/docs/reference/GLIMMER_SAMPLES.md +26 -0
- 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 +4 -3
- data/lib/glimmer/dsl/swt/observe_expression.rb +2 -1
- data/lib/glimmer/dsl/swt/sync_call_expression.rb +38 -0
- data/lib/glimmer/dsl/swt/transform_expression.rb +1 -1
- data/lib/glimmer/launcher.rb +15 -14
- data/lib/glimmer/rake_task/package.rb +5 -3
- data/lib/glimmer/rake_task/scaffold.rb +2 -14
- data/lib/glimmer/swt/color_proxy.rb +5 -5
- data/lib/glimmer/swt/custom/drawable.rb +8 -2
- 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 +170 -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 -1
- 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 +14 -10
- data/lib/glimmer/ui/custom_shape.rb +34 -10
- data/lib/glimmer/ui/custom_widget.rb +7 -10
- data/lib/glimmer-dsl-swt.rb +6 -2
- data/samples/elaborate/battleship/view/cell.rb +10 -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 +190 -0
- data/samples/hello/hello_custom_widget.rb +23 -5
- data/samples/hello/hello_scrolled_composite.rb +95 -0
- data/samples/hello/hello_world.rb +1 -0
- data/vendor/swt/linux/swt.jar +0 -0
- data/vendor/swt/linux_aarch64/swt.jar +0 -0
- data/vendor/swt/mac/swt.jar +0 -0
- data/vendor/swt/mac_aarch64/swt.jar +0 -0
- data/vendor/swt/windows/swt.jar +0 -0
- metadata +21 -25
- data/bin/glimmer_runner.rb +0 -4
@@ -5,6 +5,7 @@
|
|
5
5
|
- [Hello, Label!](#hello-label)
|
6
6
|
- [Hello, Text!](#hello-text)
|
7
7
|
- [Hello, Composite!](#hello-composite)
|
8
|
+
- [Hello, Scrolled Composite!](#hello-scrolled-composite)
|
8
9
|
- [Hello, Layout!](#hello-layout)
|
9
10
|
- [Hello, Shell!](#hello-shell)
|
10
11
|
- [Hello, Tab!](#hello-tab)
|
@@ -77,6 +78,7 @@
|
|
77
78
|
- [Stock Ticker](#stock-ticker)
|
78
79
|
- [Metronome](#metronome)
|
79
80
|
- [Weather](#weather)
|
81
|
+
- [Quarto](#quarto)
|
80
82
|
- [External Samples](#external-samples)
|
81
83
|
- [Glimmer Calculator](#glimmer-calculator)
|
82
84
|
- [Gladiator](#gladiator)
|
@@ -178,6 +180,18 @@ Code:
|
|
178
180
|
|
179
181
|

|
180
182
|
|
183
|
+
#### Hello, Scrolled Composite!
|
184
|
+
|
185
|
+
This sample demonstrates the `scrolled_composite` widget, which is used to add scrollbars around content that exceeds the size of the window.
|
186
|
+
|
187
|
+
Code:
|
188
|
+
|
189
|
+
[samples/hello/hello_scrolled_composite.rb](/samples/hello/hello_scrolled_composite.rb)
|
190
|
+
|
191
|
+

|
192
|
+
|
193
|
+

|
194
|
+
|
181
195
|
#### Hello, Layout!
|
182
196
|
|
183
197
|
This sample demonstrates the standard 3 layouts in SWT (though one can write their own for very advanced applications): `fill_layout`, `row_layout`, and `grid_layout`
|
@@ -1356,6 +1370,18 @@ Atlanta - Fahrenheit
|
|
1356
1370
|
|
1357
1371
|

|
1358
1372
|
|
1373
|
+
#### Quarto
|
1374
|
+
|
1375
|
+
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.
|
1376
|
+
|
1377
|
+
Code:
|
1378
|
+
|
1379
|
+
[samples/elaborate/quarto.rb](/samples/elaborate/quarto.rb)
|
1380
|
+
|
1381
|
+
Quarto
|
1382
|
+
|
1383
|
+

|
1384
|
+
|
1359
1385
|
### External Samples
|
1360
1386
|
|
1361
1387
|
#### Glimmer Calculator
|
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,18 +38,19 @@ 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
|
|
49
50
|
def call(value)
|
50
51
|
SWT::DisplayProxy.instance.auto_exec(override_sync_exec: @sync_exec, override_async_exec: @async_exec) do
|
51
52
|
if @widget.respond_to?(:disposed?) && @widget.disposed?
|
52
|
-
deregister_all_observables
|
53
|
+
deregister_all_observables unless @widget.shell_proxy.last_shell_closing?
|
53
54
|
return
|
54
55
|
end
|
55
56
|
# need the rescue false for a scenario with tree items not being equal to model objects raising an exception
|
@@ -61,7 +62,7 @@ module Glimmer
|
|
61
62
|
|
62
63
|
def evaluate_property
|
63
64
|
if @widget.respond_to?(:disposed?) && @widget.disposed?
|
64
|
-
deregister_all_observables
|
65
|
+
deregister_all_observables unless @widget.shell_proxy.last_shell_closing?
|
65
66
|
return
|
66
67
|
end
|
67
68
|
@widget.get_attribute(@property)
|
@@ -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
|
@@ -0,0 +1,38 @@
|
|
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/static_expression'
|
23
|
+
require 'glimmer/dsl/swt/exec_expression'
|
24
|
+
|
25
|
+
module Glimmer
|
26
|
+
module DSL
|
27
|
+
module SWT
|
28
|
+
# Synchronously executes code block against the SWT Event Loop
|
29
|
+
# to manipulate SWT UI objects on the UI thread safely with
|
30
|
+
# immediate priority when needed.
|
31
|
+
#
|
32
|
+
# Returns the value produced by evaluating the expression.
|
33
|
+
class SyncCallExpression < StaticExpression
|
34
|
+
include ExecExpression
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
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
@@ -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,
|
@@ -25,6 +25,8 @@ require 'os'
|
|
25
25
|
module Glimmer
|
26
26
|
module RakeTask
|
27
27
|
module Package
|
28
|
+
JDK_VERSION = '17.0.1'
|
29
|
+
|
28
30
|
class << self
|
29
31
|
attr_accessor :jpackage_extra_args
|
30
32
|
|
@@ -90,10 +92,10 @@ module Glimmer
|
|
90
92
|
def native(native_type=nil, native_extra_args)
|
91
93
|
puts "Generating native executable with jpackage..."
|
92
94
|
java_version = `jruby -v`
|
93
|
-
if java_version.include?(
|
94
|
-
puts "Java Version
|
95
|
+
if java_version.include?(JDK_VERSION)
|
96
|
+
puts "Java Version #{JDK_VERSION} Detected!"
|
95
97
|
else
|
96
|
-
puts "WARNING! Glimmer Packaging Pre-Requisite Java Version
|
98
|
+
puts "WARNING! Glimmer Packaging Pre-Requisite Java Version #{JDK_VERSION} Is Not Found!"
|
97
99
|
end
|
98
100
|
require 'facets/string/titlecase'
|
99
101
|
require 'facets/string/underscore'
|
@@ -429,19 +429,7 @@ module Glimmer
|
|
429
429
|
end
|
430
430
|
|
431
431
|
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
|
432
|
+
APP_GEMFILE
|
445
433
|
end
|
446
434
|
|
447
435
|
def app_main_file(app_name)
|
@@ -643,7 +631,7 @@ module Glimmer
|
|
643
631
|
minimum_size #{shell_type == :desktopify ? '768, 432' : '420, 240'}
|
644
632
|
image File.join(APP_ROOT, 'icons', 'windows', "#{human_name(shell_type == :gem ? custom_shell_name : current_dir_name)}.ico") if OS.windows?
|
645
633
|
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)} -
|
634
|
+
text "#{human_name(namespace)}#{' - ' + human_name(custom_shell_name) if shell_type != :desktopify}"
|
647
635
|
|
648
636
|
MULTI_LINE_STRING
|
649
637
|
|
@@ -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)
|
@@ -109,8 +113,10 @@ module Glimmer
|
|
109
113
|
end
|
110
114
|
|
111
115
|
def deregister_shape_painting
|
112
|
-
|
113
|
-
|
116
|
+
unless shell_proxy.last_shell_closing?
|
117
|
+
@paint_listener_proxy&.deregister
|
118
|
+
@resize_listener_proxy&.deregister
|
119
|
+
end
|
114
120
|
end
|
115
121
|
|
116
122
|
def setup_shape_painting
|
@@ -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'
|