propane 2.7.0-java → 2.7.1-java

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 28bf3672373ab332b735ada0099fb26d4d9a9eff2d2ce172dc1db2f2bf79f808
4
- data.tar.gz: 0bb915d145b7da16d736fabd32b134547b7c49e630d48741a43fe338fb888438
3
+ metadata.gz: 8e9d6379de6255f40524c6b647113c8c106e8ec2decbfe88f7adb73225a8d74d
4
+ data.tar.gz: 38454f8850e0e2ab2c4fed609bc8521188a2e98e79451f774b3b4fb17308cc11
5
5
  SHA512:
6
- metadata.gz: 447183c1fd054f4d3d93aab6ff7d78590f33db6930e2e2df77d0914700b550195349b99e98d69119385d4421ea8f333d6c1d6061b8a8d396077b05badfa8f40e
7
- data.tar.gz: 11bbb73e10240c4ec57e82868668f11d7fd303f160f409630b765cfc097e684ccdef21973be5cf34c4d5c249ba2003c61ceb7330ed22493ed4b9d45a78f3f648
6
+ metadata.gz: ab65430ac2ac3ea8877a8552b71080d878a53c27d068927253d59e93e4078f4fb6eb3661078e0454dabd4f75875ca8230196a7dbeb65be763aa3c766c4de0090
7
+ data.tar.gz: 27dca256dd36b656b10d07f8a770948441b517cccff56fd44454bf6f2e89dee90427d89086e2d2b4a7e38ab3fab55d0961c1db29defdac46454da5e808a47a7d
data/CHANGELOG.md CHANGED
@@ -1,3 +1,5 @@
1
+ **v2.7.1** Avoid calling protected method in control_panel (ready for jdk9)
2
+
1
3
  **v2.7.0** Now using custom icons, nice blue ruby image
2
4
 
3
5
  **v2.6.6** Using a modified processing-core to support jdk9 (NB FX2D and sketches with control_panel using sliders are still expected to fail with jdk9). Jdk8 users should not notice any change.
data/README.md CHANGED
@@ -10,7 +10,7 @@ adjust above for your OS/distro setup.
10
10
  - jdk8+ (jdk9 mostly works, see changelog, but is noisy)
11
11
  - jruby-9.1.16.0
12
12
  - mvn-3.5.0+
13
- - processing-core.jar (_build only_) not generally available
13
+ - processing-core.jar (_build only_) see [propane-core](https://github.com/ruby-processing/processing-core)
14
14
 
15
15
  ## Building and testing
16
16
 
@@ -82,4 +82,3 @@ propane --install samples
82
82
  [building]:http://ruby-processing.github.io/building/building/
83
83
  [gh-pages]:https://ruby-processing.github.io/propane/
84
84
  [processing-core]:https://github.com/ruby-processing/processing-core
85
-
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Propane
3
- VERSION = '2.7.0'.freeze
3
+ VERSION = '2.7.1'.freeze
4
4
  end
@@ -1,18 +1,20 @@
1
1
  # Here's a little library for quickly hooking up controls to sketches.
2
2
  # For messing with the parameters and such.
3
3
  # These controls will set instance variables on the sketches.
4
-
5
4
  # You can make sliders, checkboxes, buttons, and drop-down menus.
6
- # (optionally) pass the range and default value.
7
-
5
+ # Optionally pass range and a default value to sliders.
8
6
  module ControlPanel
7
+ def self.app_value(name, val)
8
+ Propane.app.instance_variable_set("@#{name}", val)
9
+ end
10
+
9
11
  # class used to create slider elements for control_panel
10
12
  class Slider < javax.swing.JSlider
11
- def initialize(control_panel, name, range, initial_value, proc = nil)
13
+ def initialize(control_panel, name, range, initial, proc = nil)
12
14
  min = range.begin * 100
13
- max = (
14
- (range.exclude_end? && range.begin.respond_to?(:succ)) ?
15
- 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
16
18
  super(min, max)
17
19
  set_minor_tick_spacing((max - min).abs / 10)
18
20
  set_paint_ticks true
@@ -21,11 +23,12 @@ module ControlPanel
21
23
  label = control_panel.add_element(self, name)
22
24
  add_change_listener do
23
25
  update_label(label, name, value)
24
- Propane.app.instance_variable_set("@#{name}", value) unless value.nil?
26
+ ControlPanel.app_value(name, value)
25
27
  proc.call(value) if proc
26
28
  end
27
- set_value(initial_value ? initial_value * 100 : min)
28
- fire_state_changed
29
+ val = initial.nil? ? (range.first + range.last) * 50 : initial * 100
30
+ set_value(val)
31
+ ControlPanel.app_value(name, val)
29
32
  end
30
33
 
31
34
  def value
@@ -46,7 +49,7 @@ module ControlPanel
46
49
  set_preferred_size(java.awt.Dimension.new(190, 30))
47
50
  control_panel.add_element(self, name)
48
51
  add_action_listener do
49
- Propane.app.instance_variable_set("@#{name}", value) unless value.nil?
52
+ ControlPanel.app_value(name, value) unless value.nil?
50
53
  proc.call(value) if proc
51
54
  end
52
55
  set_selected_index(initial_value ? elements.index(initial_value) : 0)
@@ -66,10 +69,11 @@ module ControlPanel
66
69
  set_horizontal_alignment javax.swing.SwingConstants::CENTER
67
70
  control_panel.add_element(self, name, false)
68
71
  add_action_listener do
69
- Propane.app.instance_variable_set("@#{name}", value)
72
+ ControlPanel.app_value(name, value)
70
73
  proc.call(value) if proc
71
74
  end
72
75
  end
76
+
73
77
  # define value as checkbox state
74
78
  def value
75
79
  is_selected
@@ -99,7 +103,7 @@ module ControlPanel
99
103
  super()
100
104
  @elements = []
101
105
  @panel = javax.swing.JPanel.new(java.awt.FlowLayout.new(1, 0, 0))
102
- set_feel
106
+ feel
103
107
  end
104
108
 
105
109
  def display
@@ -107,7 +111,8 @@ module ControlPanel
107
111
  set_size 200, 30 + (64 * elements.size)
108
112
  set_default_close_operation javax.swing.JFrame::HIDE_ON_CLOSE
109
113
  set_resizable false
110
- set_location(Propane.app.width + 10, 0) unless Propane.app.width + 10 > Propane.app.displayWidth
114
+ xoffset = Propane.app.width + 10
115
+ set_location(xoffset, 0) unless xoffset > Propane.app.displayWidth
111
116
  panel.visible = true
112
117
  end
113
118
 
@@ -130,8 +135,8 @@ module ControlPanel
130
135
  set_title(name)
131
136
  end
132
137
 
133
- def slider(name, range = 0..100, initial_value = nil, &block)
134
- Slider.new(self, name, range, initial_value, block || nil)
138
+ def slider(name, range = 0..100, initial = nil, &block)
139
+ Slider.new(self, name, range, initial, block || nil)
135
140
  end
136
141
 
137
142
  def menu(name, elements, initial_value = nil, &block)
@@ -148,17 +153,17 @@ module ControlPanel
148
153
  end
149
154
 
150
155
  def look_feel(lf)
151
- set_feel(lf)
156
+ feel(lf)
152
157
  end
153
158
 
154
159
  private
155
160
 
156
- def set_feel(lf = 'metal')
161
+ def feel(lf = 'metal')
157
162
  lafinfo = javax.swing.UIManager.getInstalledLookAndFeels
158
- laf = lafinfo.to_ary.select do |info|
163
+ laf = lafinfo.to_ary.find do |info|
159
164
  info.name =~ Regexp.new(Regexp.escape(lf), Regexp::IGNORECASE)
160
165
  end
161
- javax.swing.UIManager.setLookAndFeel(laf[0].class_name)
166
+ javax.swing.UIManager.setLookAndFeel(laf.class_name)
162
167
  end
163
168
  end
164
169
 
@@ -169,6 +174,8 @@ module ControlPanel
169
174
  return @control_panel unless block_given?
170
175
  yield(@control_panel)
171
176
  @control_panel.display
177
+ @control_panel.set_visible true
178
+ @control_panel # for legacy compat
172
179
  end
173
180
  end
174
181
  end
data/pom.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'fileutils'
2
2
  project 'rp5extras', 'https://github.com/monkstone/propane' do
3
3
  model_version '4.0.0'
4
- id 'propane:propane', '2.7.0'
4
+ id 'propane:propane', '2.7.1'
5
5
  packaging 'jar'
6
6
  description 'rp5extras for propane'
7
7
  organization 'ruby-processing', 'https://ruby-processing.github.io'
data/pom.xml CHANGED
@@ -11,7 +11,7 @@ DO NOT MODIFIY - GENERATED CODE
11
11
  <modelVersion>4.0.0</modelVersion>
12
12
  <groupId>propane</groupId>
13
13
  <artifactId>propane</artifactId>
14
- <version>2.7.0</version>
14
+ <version>2.7.1</version>
15
15
  <name>rp5extras</name>
16
16
  <description>rp5extras for propane</description>
17
17
  <url>https://github.com/monkstone/propane</url>
@@ -44,15 +44,15 @@ DO NOT MODIFIY - GENERATED CODE
44
44
  <url>https://github.com/ruby-processing/propane/issues</url>
45
45
  </issueManagement>
46
46
  <properties>
47
- <propane.basedir>${project.basedir}</propane.basedir>
47
+ <jogl.version>2.3.2</jogl.version>
48
+ <jruby.api>http://jruby.org/apidocs/</jruby.api>
49
+ <source.directory>src</source.directory>
48
50
  <maven.compiler.target>1.8</maven.compiler.target>
49
51
  <processing.api>http://processing.github.io/processing-javadocs/core/</processing.api>
50
- <source.directory>src</source.directory>
51
- <maven.compiler.source>1.8</maven.compiler.source>
52
- <polyglot.dump.pom>pom.xml</polyglot.dump.pom>
52
+ <propane.basedir>${project.basedir}</propane.basedir>
53
53
  <project.build.sourceEncoding>utf-8</project.build.sourceEncoding>
54
- <jogl.version>2.3.2</jogl.version>
55
- <jruby.api>http://jruby.org/apidocs/</jruby.api>
54
+ <polyglot.dump.pom>pom.xml</polyglot.dump.pom>
55
+ <maven.compiler.source>1.8</maven.compiler.source>
56
56
  </properties>
57
57
  <dependencies>
58
58
  <dependency>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: propane
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.0
4
+ version: 2.7.1
5
5
  platform: java
6
6
  authors:
7
7
  - monkstone
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-30 00:00:00.000000000 Z
11
+ date: 2018-04-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake