shoes-swt 4.0.0.pre12 → 4.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/shoes-swt +1 -0
- data/lib/shoes/swt.rb +3 -1
- data/lib/shoes/swt/animation.rb +1 -0
- data/lib/shoes/swt/app.rb +12 -11
- data/lib/shoes/swt/arc.rb +1 -0
- data/lib/shoes/swt/arc_painter.rb +4 -3
- data/lib/shoes/swt/arrow.rb +1 -0
- data/lib/shoes/swt/arrow_painter.rb +10 -5
- data/lib/shoes/swt/background.rb +1 -0
- data/lib/shoes/swt/border.rb +1 -0
- data/lib/shoes/swt/button.rb +1 -0
- data/lib/shoes/swt/check.rb +1 -0
- data/lib/shoes/swt/check_button.rb +1 -0
- data/lib/shoes/swt/click_listener.rb +1 -0
- data/lib/shoes/swt/color.rb +1 -0
- data/lib/shoes/swt/color_factory.rb +1 -0
- data/lib/shoes/swt/common/clickable.rb +1 -0
- data/lib/shoes/swt/common/container.rb +1 -0
- data/lib/shoes/swt/common/fill.rb +2 -1
- data/lib/shoes/swt/common/focus.rb +5 -0
- data/lib/shoes/swt/common/image_handling.rb +11 -5
- data/lib/shoes/swt/common/painter.rb +21 -1
- data/lib/shoes/swt/common/painter_updates_position.rb +1 -0
- data/lib/shoes/swt/common/remove.rb +16 -3
- data/lib/shoes/swt/common/resource.rb +1 -0
- data/lib/shoes/swt/common/selection_listener.rb +1 -0
- data/lib/shoes/swt/common/stroke.rb +1 -0
- data/lib/shoes/swt/common/translate.rb +1 -0
- data/lib/shoes/swt/common/update_position.rb +1 -0
- data/lib/shoes/swt/common/visibility.rb +7 -2
- data/lib/shoes/swt/dialog.rb +1 -0
- data/lib/shoes/swt/disposed_protection.rb +1 -0
- data/lib/shoes/swt/download.rb +1 -0
- data/lib/shoes/swt/font.rb +1 -0
- data/lib/shoes/swt/generate_backend.rb +10 -10
- data/lib/shoes/swt/gradient.rb +24 -6
- data/lib/shoes/swt/image.rb +6 -10
- data/lib/shoes/swt/image_painter.rb +26 -0
- data/lib/shoes/swt/image_pattern.rb +1 -0
- data/lib/shoes/swt/input_box.rb +1 -0
- data/lib/shoes/swt/key_listener.rb +6 -5
- data/lib/shoes/swt/line.rb +1 -0
- data/lib/shoes/swt/line_painter.rb +3 -2
- data/lib/shoes/swt/link.rb +1 -0
- data/lib/shoes/swt/link_segment.rb +1 -0
- data/lib/shoes/swt/list_box.rb +1 -0
- data/lib/shoes/swt/mouse_move_listener.rb +1 -0
- data/lib/shoes/swt/oval.rb +1 -0
- data/lib/shoes/swt/oval_painter.rb +4 -3
- data/lib/shoes/swt/packager.rb +1 -0
- data/lib/shoes/swt/progress.rb +1 -0
- data/lib/shoes/swt/radio.rb +4 -3
- data/lib/shoes/swt/radio_group.rb +1 -0
- data/lib/shoes/swt/rect.rb +1 -2
- data/lib/shoes/swt/rect_painter.rb +3 -2
- data/lib/shoes/swt/redrawing_aspect.rb +16 -12
- data/lib/shoes/swt/shape.rb +5 -3
- data/lib/shoes/swt/shape_painter.rb +12 -0
- data/lib/shoes/swt/shoes_layout.rb +1 -0
- data/lib/shoes/swt/slot.rb +24 -13
- data/lib/shoes/swt/sound.rb +1 -1
- data/lib/shoes/swt/star.rb +1 -0
- data/lib/shoes/swt/star_painter.rb +2 -1
- data/lib/shoes/swt/swt_button.rb +1 -0
- data/lib/shoes/swt/text_block.rb +1 -0
- data/lib/shoes/swt/text_block/centered_text_segment.rb +1 -0
- data/lib/shoes/swt/text_block/cursor_painter.rb +1 -0
- data/lib/shoes/swt/text_block/fitter.rb +1 -0
- data/lib/shoes/swt/text_block/painter.rb +1 -0
- data/lib/shoes/swt/text_block/text_font_factory.rb +2 -0
- data/lib/shoes/swt/text_block/text_segment.rb +1 -0
- data/lib/shoes/swt/text_block/text_segment_collection.rb +1 -0
- data/lib/shoes/swt/text_block/text_style_factory.rb +1 -0
- data/lib/shoes/swt/timer.rb +1 -0
- data/lib/shoes/swt/tooling/leak_hunter.rb +1 -0
- data/lib/shoes/swt/version.rb +1 -1
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a0f5dce653d4fa2b8da0cc28e07058dfaeba20463a5aa2849a456f6088564af
|
4
|
+
data.tar.gz: df51d16aa4e78f78e5818e79cd99fb77d230140c7184d7055aa01ab3bcc61690
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f90a0299888757c83b667b2f429265a5e4749327b8e43dbefbb9db419dc8d7e8932099115ae0015d54332aa2416fcee95e9bdbf5da6181dc22f9002f1e842ff
|
7
|
+
data.tar.gz: 212cd8cc7260e7a9b709b6ef9c38b91632dade5d11c29e591906412036567df2fa4066c6d403c33733a29c8d89a93f5a456b4073bf882a0294bde6c4884c66a8
|
data/bin/shoes-swt
CHANGED
data/lib/shoes/swt.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require 'java'
|
3
4
|
require 'swt/minimal'
|
4
5
|
require 'swt/core'
|
@@ -46,7 +47,7 @@ class Shoes
|
|
46
47
|
end
|
47
48
|
|
48
49
|
def self.initialize_backend
|
49
|
-
return if @initialized
|
50
|
+
return if defined?(@initialized) && @initialized
|
50
51
|
@initialized = true
|
51
52
|
|
52
53
|
::Shoes.configuration.backend = :swt
|
@@ -96,6 +97,7 @@ class Shoes
|
|
96
97
|
require 'shoes/swt/font'
|
97
98
|
require 'shoes/swt/gradient'
|
98
99
|
require 'shoes/swt/image'
|
100
|
+
require 'shoes/swt/image_painter'
|
99
101
|
require 'shoes/swt/image_pattern'
|
100
102
|
require 'shoes/swt/key_listener'
|
101
103
|
require 'shoes/swt/line'
|
data/lib/shoes/swt/animation.rb
CHANGED
data/lib/shoes/swt/app.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
class Shoes
|
3
4
|
module Swt
|
4
5
|
shoes_icon = ::Shoes::ICON
|
@@ -24,16 +25,16 @@ class Shoes
|
|
24
25
|
|
25
26
|
def initialize(dsl)
|
26
27
|
if self.class.main_app_closed?
|
27
|
-
Shoes.logger.error
|
28
|
-
Sorry! You can't start another Shoes.app at after the main one has already
|
29
|
-
finished like that! If you need multiple windows, try it more like this:
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
28
|
+
Shoes.logger.error <<~EOS
|
29
|
+
Sorry! You can't start another Shoes.app at after the main one has already
|
30
|
+
finished like that! If you need multiple windows, try it more like this:
|
31
|
+
|
32
|
+
Shoes.app do
|
33
|
+
para "first!"
|
34
|
+
Shoes.app do
|
35
|
+
para "second!"
|
36
|
+
end
|
37
|
+
end
|
37
38
|
EOS
|
38
39
|
exit 1
|
39
40
|
end
|
@@ -197,7 +198,7 @@ EOS
|
|
197
198
|
# Because SWT shutdown is hard to reverse, we only let you do it once
|
198
199
|
# and warn you if you try to run again afterward.
|
199
200
|
def self.main_app_closed?
|
200
|
-
@main_app_closed
|
201
|
+
@main_app_closed ||= false
|
201
202
|
end
|
202
203
|
|
203
204
|
def self.mark_main_app_closed
|
data/lib/shoes/swt/arc.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
class Shoes
|
3
4
|
module Swt
|
4
5
|
class ArcPainter < Common::Painter
|
@@ -7,14 +8,14 @@ class Shoes
|
|
7
8
|
def fill(graphics_context)
|
8
9
|
if @obj.wedge?
|
9
10
|
graphics_context.fill_arc(@obj.translate_left + @obj.element_left,
|
10
|
-
@obj.translate_top +
|
11
|
+
@obj.translate_top + drawing_top,
|
11
12
|
@obj.element_width,
|
12
13
|
@obj.element_height,
|
13
14
|
start_angle, sweep)
|
14
15
|
else
|
15
16
|
path = ::Swt::Path.new(::Swt.display)
|
16
17
|
path.add_arc(@obj.translate_left + @obj.element_left,
|
17
|
-
@obj.translate_top +
|
18
|
+
@obj.translate_top + drawing_top,
|
18
19
|
@obj.element_width,
|
19
20
|
@obj.element_height,
|
20
21
|
start_angle, sweep)
|
@@ -26,7 +27,7 @@ class Shoes
|
|
26
27
|
line_width = graphics_context.get_line_width
|
27
28
|
if @obj.element_left && @obj.element_top && @obj.element_width && @obj.element_height
|
28
29
|
graphics_context.draw_arc(@obj.translate_left + @obj.element_left + line_width / 2,
|
29
|
-
@obj.translate_top +
|
30
|
+
@obj.translate_top + drawing_top + line_width / 2,
|
30
31
|
@obj.element_width - line_width,
|
31
32
|
@obj.element_height - line_width,
|
32
33
|
start_angle, sweep)
|
data/lib/shoes/swt/arrow.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
class Shoes
|
3
4
|
module Swt
|
4
5
|
class ArrowPainter < Common::Painter
|
@@ -28,14 +29,14 @@ class Shoes
|
|
28
29
|
|
29
30
|
body_left = @obj.translate_left + @obj.left - @obj.width * 0.5
|
30
31
|
body_right = @obj.translate_left + @obj.left + @obj.width * 0.1
|
31
|
-
body_top = @obj.translate_top +
|
32
|
-
body_bottom = @obj.translate_top +
|
32
|
+
body_top = @obj.translate_top + drawing_top - @obj.width * 0.2
|
33
|
+
body_bottom = @obj.translate_top + drawing_top + @obj.width * 0.2
|
33
34
|
|
34
|
-
middle = @obj.translate_top +
|
35
|
+
middle = @obj.translate_top + drawing_top
|
35
36
|
|
36
37
|
head_right = @obj.translate_left + @obj.left + @obj.width * 0.5
|
37
|
-
head_top = @obj.translate_top +
|
38
|
-
head_bottom = @obj.translate_top +
|
38
|
+
head_top = @obj.translate_top + drawing_top - @obj.width * 0.4
|
39
|
+
head_bottom = @obj.translate_top + drawing_top + @obj.width * 0.4
|
39
40
|
|
40
41
|
path = ::Swt::Path.new(::Swt.display)
|
41
42
|
path.move_to(body_left, middle)
|
@@ -56,6 +57,10 @@ class Shoes
|
|
56
57
|
clear_path
|
57
58
|
end
|
58
59
|
|
60
|
+
def after_painted
|
61
|
+
clear_path
|
62
|
+
end
|
63
|
+
|
59
64
|
def clear_path
|
60
65
|
@path.dispose unless @path.nil? || @path.disposed?
|
61
66
|
@path = nil
|
data/lib/shoes/swt/background.rb
CHANGED
data/lib/shoes/swt/border.rb
CHANGED
data/lib/shoes/swt/button.rb
CHANGED
data/lib/shoes/swt/check.rb
CHANGED
data/lib/shoes/swt/color.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
class Shoes
|
3
4
|
module Swt
|
4
5
|
module Common
|
@@ -25,7 +26,7 @@ class Shoes
|
|
25
26
|
|
26
27
|
# @return [Integer] the angle to use when filling with a pattern
|
27
28
|
def angle
|
28
|
-
|
29
|
+
dsl.angle || 0
|
29
30
|
end
|
30
31
|
|
31
32
|
# Just clear it out and let next paint recreate and save our SWT color
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
class Shoes
|
3
4
|
module Swt
|
4
5
|
module Common
|
@@ -13,22 +14,27 @@ class Shoes
|
|
13
14
|
tmpname = File.join(Dir.tmpdir, "__shoes4_#{Time.now.to_i}_#{File.basename(name)}")
|
14
15
|
FileUtils.cp(name, tmpname)
|
15
16
|
|
16
|
-
|
17
|
-
@cleanup_files << tmpname
|
17
|
+
cleanup_files << tmpname
|
18
18
|
tmpname
|
19
19
|
end
|
20
20
|
|
21
21
|
def cleanup_temporary_files
|
22
|
-
return unless
|
22
|
+
return unless cleanup_files.any?
|
23
23
|
|
24
|
-
|
24
|
+
cleanup_files.each do |file|
|
25
25
|
begin
|
26
26
|
FileUtils.rm(file)
|
27
27
|
rescue => e
|
28
28
|
Shoes.logger.debug("Error during image temp file cleanup.\n#{e.class}: #{e.message}")
|
29
29
|
end
|
30
30
|
end
|
31
|
-
|
31
|
+
cleanup_files.clear
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def cleanup_files
|
37
|
+
@cleanup_files ||= []
|
32
38
|
end
|
33
39
|
end
|
34
40
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
class Shoes
|
3
4
|
module Swt
|
4
5
|
module Common
|
@@ -17,6 +18,7 @@ class Shoes
|
|
17
18
|
end
|
18
19
|
|
19
20
|
def paint_control(event)
|
21
|
+
before_painted
|
20
22
|
graphics_context = event.gc
|
21
23
|
reset_graphics_context graphics_context
|
22
24
|
if @obj.dsl.visible? && @obj.dsl.positioned?
|
@@ -30,6 +32,8 @@ class Shoes
|
|
30
32
|
#
|
31
33
|
puts "SWALLOWED PAINT EXCEPTION ON #{@obj} - go take care of it: " + e.to_s
|
32
34
|
puts 'Unfortunately we have to swallow it because it causes odd failures :('
|
35
|
+
ensure
|
36
|
+
after_painted
|
33
37
|
end
|
34
38
|
|
35
39
|
def paint_object(graphics_context)
|
@@ -42,7 +46,7 @@ class Shoes
|
|
42
46
|
if obj.needs_rotate?
|
43
47
|
set_rotate graphics_context, obj.rotate,
|
44
48
|
obj.element_left + obj.element_width / 2.0,
|
45
|
-
|
49
|
+
drawing_top + obj.element_height / 2.0 do
|
46
50
|
fill_and_draw(graphics_context)
|
47
51
|
end
|
48
52
|
else
|
@@ -101,6 +105,22 @@ class Shoes
|
|
101
105
|
transform.translate(-left, -top)
|
102
106
|
graphics_context.set_transform transform
|
103
107
|
end
|
108
|
+
|
109
|
+
def drawing_top
|
110
|
+
dsl = @obj.dsl
|
111
|
+
dsl.element_top - dsl.parent.scroll_top
|
112
|
+
end
|
113
|
+
|
114
|
+
def drawing_bottom
|
115
|
+
dsl = @obj.dsl
|
116
|
+
dsl.element_bottom - dsl.parent.scroll_top
|
117
|
+
end
|
118
|
+
|
119
|
+
def before_painted
|
120
|
+
end
|
121
|
+
|
122
|
+
def after_painted
|
123
|
+
end
|
104
124
|
end
|
105
125
|
end
|
106
126
|
end
|
@@ -1,18 +1,19 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
class Shoes
|
3
4
|
module Swt
|
4
5
|
module Common
|
5
6
|
module Remove
|
6
7
|
def remove
|
7
|
-
app.remove_paint_listener
|
8
|
+
app.remove_paint_listener(painter)
|
8
9
|
remove_click_listeners
|
9
|
-
|
10
|
+
real&.dispose unless real&.disposed?
|
10
11
|
dispose_held_resources
|
11
12
|
dispose
|
12
13
|
end
|
13
14
|
|
14
15
|
def dispose_held_resources
|
15
|
-
|
16
|
+
color_factory&.dispose
|
16
17
|
end
|
17
18
|
|
18
19
|
# Classes should override to dispose of any Swt resources they create
|
@@ -21,6 +22,18 @@ class Shoes
|
|
21
22
|
|
22
23
|
private
|
23
24
|
|
25
|
+
def color_factory
|
26
|
+
@color_factory ||= nil
|
27
|
+
end
|
28
|
+
|
29
|
+
def painter
|
30
|
+
@painter ||= nil
|
31
|
+
end
|
32
|
+
|
33
|
+
def real
|
34
|
+
@real ||= nil
|
35
|
+
end
|
36
|
+
|
24
37
|
def remove_click_listeners
|
25
38
|
app.click_listener.remove_listeners_for(dsl)
|
26
39
|
end
|