jruby_art 1.4.7 → 1.4.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ac6a3c365c5e0b4fc36d08129d47204316f92a05890f1fe0a239ddee0fb67126
4
- data.tar.gz: '0397d79178b171f627abf1f0d39a09430868b41475cfdac3de5e1711bcc6069d'
3
+ metadata.gz: cf74d273a9f46d9007556910d109da34b86d88625f8a3da28cc58acf7f16188f
4
+ data.tar.gz: b79eafecff71443d75d47be949dcd7ea09d4f4373fd98509da9e27ee4c2c4a02
5
5
  SHA512:
6
- metadata.gz: 87635de1c259c5a1e4673f551db357e3824cb19b7c2260010646a3ba52a3178fdfd189e5e99aaa670b723f6ca300093cfdc2a5e774411a8b9f2db4e45a59a01b
7
- data.tar.gz: cefd4c98c57a35a536fc1d3779f3374b654a20295328f6436122d085b16cd13fe478bd8a522f363a483799c5055956c38d28a3e0e65f633feb2a9387d4a559f7
6
+ metadata.gz: 3549c14d3454169d1e7d2519f63a2759632f23cb22c1ba9b3348ca15404905712ec0c910646e10f4590d7db5137796698ba7c41d3354747f66506252d6f15d3b
7
+ data.tar.gz: 0d1f03359ab4cf3a992deb0abca8193a0c23138bb6ec6267c637d77422656479f41758fe0de4caec428a1e673362714f30cc55ee39a12c6d63e8a5914698166d
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  # A wrapper for version
3
3
  module JRubyArt
4
- VERSION = '1.4.7'.freeze
4
+ VERSION = '1.4.8'.freeze
5
5
  end
data/lib/rpextras.jar CHANGED
Binary file
@@ -1,17 +1,20 @@
1
- # frozen_string_literal: true
2
1
  # Here's a little library for quickly hooking up controls to sketches.
3
2
  # For messing with the parameters and such.
4
3
  # These controls will set instance variables on the sketches.
5
4
  # You can make sliders, checkboxes, buttons, and drop-down menus.
6
- # (optionally) pass the range and default value.
5
+ # Optionally pass range and a default value to sliders.
7
6
  module ControlPanel
7
+ def self.app_value(name, val)
8
+ Processing.app.instance_variable_set("@#{name}", val)
9
+ end
10
+
8
11
  # class used to create slider elements for control_panel
9
12
  class Slider < javax.swing.JSlider
10
- def initialize(control_panel, name, range, initial_value, proc = nil)
13
+ def initialize(control_panel, name, range, initial, proc = nil)
11
14
  min = range.begin * 100
12
- max = (
13
- (range.exclude_end? && range.begin.respond_to?(:succ)) ?
14
- range.max : range.end) * 100
15
+ mx = range.end
16
+ mx = range.max if range.exclude_end? && range.begin.respond_to?(:succ)
17
+ max = mx * 100
15
18
  super(min, max)
16
19
  set_minor_tick_spacing((max - min).abs / 10)
17
20
  set_paint_ticks true
@@ -20,11 +23,12 @@ module ControlPanel
20
23
  label = control_panel.add_element(self, name)
21
24
  add_change_listener do
22
25
  update_label(label, name, value)
23
- Processing.app.instance_variable_set("@#{name}", value) unless value.nil?
26
+ ControlPanel.app_value(name, value)
24
27
  proc.call(value) if proc
25
28
  end
26
- set_value(initial_value ? initial_value * 100 : min)
27
- fire_state_changed
29
+ val = initial.nil? ? (range.first + range.last) * 50 : initial * 100
30
+ set_value(val)
31
+ ControlPanel.app_value(name, val)
28
32
  end
29
33
 
30
34
  def value
@@ -45,7 +49,7 @@ module ControlPanel
45
49
  set_preferred_size(java.awt.Dimension.new(190, 30))
46
50
  control_panel.add_element(self, name)
47
51
  add_action_listener do
48
- Processing.app.instance_variable_set("@#{name}", value) unless value.nil?
52
+ ControlPanel.app_value(name, value) unless value.nil?
49
53
  proc.call(value) if proc
50
54
  end
51
55
  set_selected_index(initial_value ? elements.index(initial_value) : 0)
@@ -65,11 +69,12 @@ module ControlPanel
65
69
  set_horizontal_alignment javax.swing.SwingConstants::CENTER
66
70
  control_panel.add_element(self, name, false)
67
71
  add_action_listener do
68
- Processing.app.instance_variable_set("@#{name}", value) unless value.nil?
72
+ ControlPanel.app_value(name, value)
69
73
  proc.call(value) if proc
70
74
  end
71
75
  end
72
76
 
77
+ # define value as checkbox state
73
78
  def value
74
79
  is_selected
75
80
  end
@@ -82,7 +87,7 @@ module ControlPanel
82
87
  set_preferred_size(java.awt.Dimension.new(170, 64))
83
88
  control_panel.add_element(self, name, false, true)
84
89
  add_action_listener do
85
- Processing.app.send(name.to_s)
90
+ Processing.app.send(name)
86
91
  proc.call(value) if proc
87
92
  end
88
93
  end
@@ -98,11 +103,7 @@ module ControlPanel
98
103
  super()
99
104
  @elements = []
100
105
  @panel = javax.swing.JPanel.new(java.awt.FlowLayout.new(1, 0, 0))
101
- set_feel
102
- end
103
-
104
- def title(name)
105
- set_title(name)
106
+ feel
106
107
  end
107
108
 
108
109
  def display
@@ -110,7 +111,8 @@ module ControlPanel
110
111
  set_size 200, 30 + (64 * elements.size)
111
112
  set_default_close_operation javax.swing.JFrame::HIDE_ON_CLOSE
112
113
  set_resizable false
113
- set_location(Processing.app.width + 10, 0) unless Processing.app.width + 10 > Processing.app.displayWidth
114
+ xoffset = Processing.app.width + 10
115
+ set_location(xoffset, 0) unless xoffset > Processing.app.displayWidth
114
116
  panel.visible = true
115
117
  end
116
118
 
@@ -129,8 +131,12 @@ module ControlPanel
129
131
  dispose
130
132
  end
131
133
 
132
- def slider(name, range = 0..100, initial_value = nil, &block)
133
- Slider.new(self, name, range, initial_value, block || nil)
134
+ def title(name)
135
+ set_title(name)
136
+ end
137
+
138
+ def slider(name, range = 0..100, initial = nil, &block)
139
+ Slider.new(self, name, range, initial, block || nil)
134
140
  end
135
141
 
136
142
  def menu(name, elements, initial_value = nil, &block)
@@ -147,17 +153,17 @@ module ControlPanel
147
153
  end
148
154
 
149
155
  def look_feel(lf)
150
- set_feel(lf)
156
+ feel(lf)
151
157
  end
152
158
 
153
159
  private
154
160
 
155
- def set_feel(lf = 'metal')
161
+ def feel(lf = 'metal')
156
162
  lafinfo = javax.swing.UIManager.getInstalledLookAndFeels
157
- laf = lafinfo.to_ary.select do |info|
163
+ laf = lafinfo.to_ary.find do |info|
158
164
  info.name =~ Regexp.new(Regexp.escape(lf), Regexp::IGNORECASE)
159
165
  end
160
- javax.swing.UIManager.setLookAndFeel(laf[0].class_name)
166
+ javax.swing.UIManager.setLookAndFeel(laf.class_name)
161
167
  end
162
168
  end
163
169
 
@@ -168,6 +174,8 @@ module ControlPanel
168
174
  return @control_panel unless block_given?
169
175
  yield(@control_panel)
170
176
  @control_panel.display
177
+ @control_panel.set_visible true
178
+ @control_panel # for legacy compat
171
179
  end
172
180
  end
173
181
  end
data/vendors/Rakefile CHANGED
@@ -11,7 +11,7 @@ EOS
11
11
 
12
12
  JRUBYC_VERSION = '9.1.16.0'
13
13
 
14
- EXAMPLES = '2.9'
14
+ EXAMPLES = '3.0'
15
15
  HOME_DIR = ENV['HOME']
16
16
  MAC_OR_LINUX = /linux|mac|darwin/ =~ RbConfig::CONFIG['host_os']
17
17
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jruby_art
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.7
4
+ version: 1.4.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Ashkenas
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2018-03-21 00:00:00.000000000 Z
13
+ date: 2018-04-16 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake
@@ -40,11 +40,9 @@ dependencies:
40
40
  - - "~>"
41
41
  - !ruby/object:Gem::Version
42
42
  version: '5.10'
43
- description: |2
44
- JRubyArt is a ruby wrapper for the processing art framework, with enhanced
45
- functionality. Use both processing libraries and ruby gems in your sketches.
46
- Features create/run/watch/live modes. The current release features may be the
47
- last before we start supporting ruby-2.4 in sketches.
43
+ description: " JRubyArt is a ruby wrapper for the processing art framework, with
44
+ enhanced\n functionality. Use both processing libraries and ruby gems in your sketches.\n
45
+ \ Features create/run/watch/live modes. \n"
48
46
  email: mamba2928@yahoo.co.uk
49
47
  executables:
50
48
  - k9