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.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/bin/shoes-swt +1 -0
  3. data/lib/shoes/swt.rb +3 -1
  4. data/lib/shoes/swt/animation.rb +1 -0
  5. data/lib/shoes/swt/app.rb +12 -11
  6. data/lib/shoes/swt/arc.rb +1 -0
  7. data/lib/shoes/swt/arc_painter.rb +4 -3
  8. data/lib/shoes/swt/arrow.rb +1 -0
  9. data/lib/shoes/swt/arrow_painter.rb +10 -5
  10. data/lib/shoes/swt/background.rb +1 -0
  11. data/lib/shoes/swt/border.rb +1 -0
  12. data/lib/shoes/swt/button.rb +1 -0
  13. data/lib/shoes/swt/check.rb +1 -0
  14. data/lib/shoes/swt/check_button.rb +1 -0
  15. data/lib/shoes/swt/click_listener.rb +1 -0
  16. data/lib/shoes/swt/color.rb +1 -0
  17. data/lib/shoes/swt/color_factory.rb +1 -0
  18. data/lib/shoes/swt/common/clickable.rb +1 -0
  19. data/lib/shoes/swt/common/container.rb +1 -0
  20. data/lib/shoes/swt/common/fill.rb +2 -1
  21. data/lib/shoes/swt/common/focus.rb +5 -0
  22. data/lib/shoes/swt/common/image_handling.rb +11 -5
  23. data/lib/shoes/swt/common/painter.rb +21 -1
  24. data/lib/shoes/swt/common/painter_updates_position.rb +1 -0
  25. data/lib/shoes/swt/common/remove.rb +16 -3
  26. data/lib/shoes/swt/common/resource.rb +1 -0
  27. data/lib/shoes/swt/common/selection_listener.rb +1 -0
  28. data/lib/shoes/swt/common/stroke.rb +1 -0
  29. data/lib/shoes/swt/common/translate.rb +1 -0
  30. data/lib/shoes/swt/common/update_position.rb +1 -0
  31. data/lib/shoes/swt/common/visibility.rb +7 -2
  32. data/lib/shoes/swt/dialog.rb +1 -0
  33. data/lib/shoes/swt/disposed_protection.rb +1 -0
  34. data/lib/shoes/swt/download.rb +1 -0
  35. data/lib/shoes/swt/font.rb +1 -0
  36. data/lib/shoes/swt/generate_backend.rb +10 -10
  37. data/lib/shoes/swt/gradient.rb +24 -6
  38. data/lib/shoes/swt/image.rb +6 -10
  39. data/lib/shoes/swt/image_painter.rb +26 -0
  40. data/lib/shoes/swt/image_pattern.rb +1 -0
  41. data/lib/shoes/swt/input_box.rb +1 -0
  42. data/lib/shoes/swt/key_listener.rb +6 -5
  43. data/lib/shoes/swt/line.rb +1 -0
  44. data/lib/shoes/swt/line_painter.rb +3 -2
  45. data/lib/shoes/swt/link.rb +1 -0
  46. data/lib/shoes/swt/link_segment.rb +1 -0
  47. data/lib/shoes/swt/list_box.rb +1 -0
  48. data/lib/shoes/swt/mouse_move_listener.rb +1 -0
  49. data/lib/shoes/swt/oval.rb +1 -0
  50. data/lib/shoes/swt/oval_painter.rb +4 -3
  51. data/lib/shoes/swt/packager.rb +1 -0
  52. data/lib/shoes/swt/progress.rb +1 -0
  53. data/lib/shoes/swt/radio.rb +4 -3
  54. data/lib/shoes/swt/radio_group.rb +1 -0
  55. data/lib/shoes/swt/rect.rb +1 -2
  56. data/lib/shoes/swt/rect_painter.rb +3 -2
  57. data/lib/shoes/swt/redrawing_aspect.rb +16 -12
  58. data/lib/shoes/swt/shape.rb +5 -3
  59. data/lib/shoes/swt/shape_painter.rb +12 -0
  60. data/lib/shoes/swt/shoes_layout.rb +1 -0
  61. data/lib/shoes/swt/slot.rb +24 -13
  62. data/lib/shoes/swt/sound.rb +1 -1
  63. data/lib/shoes/swt/star.rb +1 -0
  64. data/lib/shoes/swt/star_painter.rb +2 -1
  65. data/lib/shoes/swt/swt_button.rb +1 -0
  66. data/lib/shoes/swt/text_block.rb +1 -0
  67. data/lib/shoes/swt/text_block/centered_text_segment.rb +1 -0
  68. data/lib/shoes/swt/text_block/cursor_painter.rb +1 -0
  69. data/lib/shoes/swt/text_block/fitter.rb +1 -0
  70. data/lib/shoes/swt/text_block/painter.rb +1 -0
  71. data/lib/shoes/swt/text_block/text_font_factory.rb +2 -0
  72. data/lib/shoes/swt/text_block/text_segment.rb +1 -0
  73. data/lib/shoes/swt/text_block/text_segment_collection.rb +1 -0
  74. data/lib/shoes/swt/text_block/text_style_factory.rb +1 -0
  75. data/lib/shoes/swt/timer.rb +1 -0
  76. data/lib/shoes/swt/tooling/leak_hunter.rb +1 -0
  77. data/lib/shoes/swt/version.rb +1 -1
  78. metadata +7 -6
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  class Shoes
3
4
  module Swt
4
5
  class Shape
@@ -20,7 +21,9 @@ class Shoes
20
21
  @app = app
21
22
  @element = ::Swt::Path.new(::Swt.display)
22
23
  @painter = ShapePainter.new(self)
24
+ @transform = nil
23
25
  @app.add_paint_listener @painter
26
+ @scroll_top_applied = nil
24
27
  end
25
28
 
26
29
  def dispose
@@ -28,9 +31,8 @@ class Shoes
28
31
  @element.dispose unless @element.nil? || @element.disposed?
29
32
  end
30
33
 
31
- attr_reader :dsl, :app
32
- attr_reader :element, :transform
33
- attr_reader :painter
34
+ attr_reader :dsl, :app, :element, :painter
35
+ attr_accessor :scroll_top_applied
34
36
 
35
37
  def redraw_target
36
38
  @dsl
@@ -1,7 +1,19 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  class Shoes
3
4
  module Swt
4
5
  class ShapePainter < Common::Painter
6
+ def before_painted
7
+ if @obj.scroll_top_applied != @obj.dsl.parent.scroll_top
8
+ # Put back what we've already done
9
+ @obj.transform.translate(0, @obj.scroll_top_applied) if @obj.scroll_top_applied
10
+
11
+ # Move it!
12
+ @obj.transform.translate(0, -@obj.dsl.parent.scroll_top)
13
+ @obj.scroll_top_applied = @obj.dsl.parent.scroll_top
14
+ end
15
+ end
16
+
5
17
  def fill(gc)
6
18
  gc.fill_path(@obj.element)
7
19
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  class Shoes
3
4
  module Swt
4
5
  class ShoesLayout < ::Swt::Widgets::Layout
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  class Shoes
3
4
  module Swt
4
5
  class Slot
@@ -14,27 +15,37 @@ class Shoes
14
15
  @real = parent.real
15
16
 
16
17
  @app = @parent.app
18
+
19
+ @scroll = ::Swt::Widgets::Slider.new(@app.real, ::Swt::SWT::VERTICAL)
20
+ @scroll.add_selection_listener do |_event|
21
+ update_scroll
22
+ end
17
23
  end
18
24
 
19
25
  # needed by Layouter code, but slots are no physical elements so they
20
26
  def update_position
21
27
  end
22
28
 
23
- # This is more like a temporary work around until slots have a real
24
- # backend representations that can just hide their contents all together
25
- # I decided to put this logic in the backend since the hiding is a backend
26
- # responsibility, although this is more DSL code
27
- # #904 #905
28
- def update_visibility
29
- # Only alter contents on a visibility change
30
- return if @last_hidden_state == dsl.hidden?
29
+ def update_scroll
30
+ @dsl.scroll_top = @scroll.selection
31
+ end
32
+
33
+ # This is more than the scrollbar is expected to be on any OS
34
+ SCROLLBAR_MAX_WIDTH = 20
31
35
 
32
- @last_hidden_state = dsl.hidden?
36
+ # For some reason, if we set max to match, you can't get past last 10!
37
+ SCROLLBAR_PADDING = 10
38
+
39
+ def update_visibility
40
+ @scroll.set_visible(@dsl.scroll && @dsl.scroll_max.positive?)
33
41
 
34
- if @last_hidden_state
35
- dsl.contents.each(&:hide)
36
- else
37
- dsl.contents.each(&:show)
42
+ if @dsl.scroll
43
+ @scroll.selection = @dsl.scroll_top
44
+ @scroll.maximum = @dsl.scroll_max + SCROLLBAR_PADDING
45
+ @scroll.set_bounds @dsl.element_right - SCROLLBAR_MAX_WIDTH + 1,
46
+ @dsl.element_top,
47
+ SCROLLBAR_MAX_WIDTH,
48
+ @dsl.element_height
38
49
  end
39
50
  end
40
51
 
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  # JavaZOOM Sound-API Projects
3
4
  # - Shared lib
4
5
  require 'shoes/swt/support/tritonus_share.jar'
@@ -43,7 +44,6 @@ class Shoes
43
44
  # Play now.
44
45
  rawplay(decoded_audio_format, decoded_audio_input_stream)
45
46
  audio_input_stream.close
46
-
47
47
  rescue UnsupportedAudioFileException => uafex
48
48
  puts uafex.inspect, uafex.backtrace
49
49
  rescue IOException => ioex
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  class Shoes
3
4
  module Swt
4
5
  class Star
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  class Shoes
3
4
  module Swt
4
5
  class StarPainter < Common::Painter
@@ -15,7 +16,7 @@ class Shoes
15
16
  inner = obj.inner
16
17
  points = obj.points
17
18
  left = obj.translate_left + obj.element_left
18
- top = obj.translate_top + obj.element_top
19
+ top = obj.translate_top + drawing_top
19
20
  @polygon = []
20
21
  add_edge(left, top + outer)
21
22
  (1..points * 2).each do |i|
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  class Shoes
3
4
  module Swt
4
5
  class SwtButton
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  class Shoes
3
4
  module Swt
4
5
  class TextBlock
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  class Shoes
3
4
  module Swt
4
5
  class TextBlock
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  class Shoes
3
4
  module Swt
4
5
  class TextBlock
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  class Shoes
3
4
  module Swt
4
5
  class TextBlock
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  class Shoes
3
4
  module Swt
4
5
  class TextBlock
@@ -1,9 +1,11 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  class Shoes
3
4
  module Swt
4
5
  class TextFontFactory
5
6
  def initialize
6
7
  @fonts = []
8
+ @display = nil
7
9
  end
8
10
 
9
11
  def create_font(font_style)
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  class Shoes
3
4
  module Swt
4
5
  class TextBlock
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  class Shoes
3
4
  module Swt
4
5
  class TextBlock
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  class Shoes
3
4
  module Swt
4
5
  class TextStyleFactory
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  class Shoes
3
4
  module Swt
4
5
  class Timer
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'swt'
3
4
  require 'shoes/swt'
4
5
  # Interested what hometown is and what it does?
@@ -2,6 +2,6 @@
2
2
 
3
3
  class Shoes
4
4
  module Swt
5
- VERSION = "4.0.0.pre12"
5
+ VERSION = "4.0.0.rc1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shoes-swt
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0.pre12
4
+ version: 4.0.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Team Shoes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-02 00:00:00.000000000 Z
11
+ date: 2017-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -43,7 +43,7 @@ dependencies:
43
43
  requirements:
44
44
  - - '='
45
45
  - !ruby/object:Gem::Version
46
- version: 4.0.0.pre12
46
+ version: 4.0.0.rc1
47
47
  name: shoes-core
48
48
  prerelease: false
49
49
  type: :runtime
@@ -51,13 +51,13 @@ dependencies:
51
51
  requirements:
52
52
  - - '='
53
53
  - !ruby/object:Gem::Version
54
- version: 4.0.0.pre12
54
+ version: 4.0.0.rc1
55
55
  - !ruby/object:Gem::Dependency
56
56
  requirement: !ruby/object:Gem::Requirement
57
57
  requirements:
58
58
  - - '='
59
59
  - !ruby/object:Gem::Version
60
- version: 4.0.0.pre12
60
+ version: 4.0.0.rc1
61
61
  name: shoes-package
62
62
  prerelease: false
63
63
  type: :runtime
@@ -65,7 +65,7 @@ dependencies:
65
65
  requirements:
66
66
  - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: 4.0.0.pre12
68
+ version: 4.0.0.rc1
69
69
  description: A JRuby and Swt backend for Shoes, the best little GUI toolkit for Ruby.
70
70
  Shoes makes building for Mac, Windows, and Linux super simple.
71
71
  email:
@@ -114,6 +114,7 @@ files:
114
114
  - lib/shoes/swt/generate_backend.rb
115
115
  - lib/shoes/swt/gradient.rb
116
116
  - lib/shoes/swt/image.rb
117
+ - lib/shoes/swt/image_painter.rb
117
118
  - lib/shoes/swt/image_pattern.rb
118
119
  - lib/shoes/swt/input_box.rb
119
120
  - lib/shoes/swt/key_listener.rb