jruby_art 1.4.7 → 1.4.8
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/lib/jruby_art/version.rb +1 -1
- data/lib/rpextras.jar +0 -0
- data/library/control_panel/control_panel.rb +32 -24
- data/vendors/Rakefile +1 -1
- metadata +5 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf74d273a9f46d9007556910d109da34b86d88625f8a3da28cc58acf7f16188f
|
4
|
+
data.tar.gz: b79eafecff71443d75d47be949dcd7ea09d4f4373fd98509da9e27ee4c2c4a02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3549c14d3454169d1e7d2519f63a2759632f23cb22c1ba9b3348ca15404905712ec0c910646e10f4590d7db5137796698ba7c41d3354747f66506252d6f15d3b
|
7
|
+
data.tar.gz: 0d1f03359ab4cf3a992deb0abca8193a0c23138bb6ec6267c637d77422656479f41758fe0de4caec428a1e673362714f30cc55ee39a12c6d63e8a5914698166d
|
data/lib/jruby_art/version.rb
CHANGED
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
|
-
#
|
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,
|
13
|
+
def initialize(control_panel, name, range, initial, proc = nil)
|
11
14
|
min = range.begin * 100
|
12
|
-
|
13
|
-
|
14
|
-
|
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
|
-
|
26
|
+
ControlPanel.app_value(name, value)
|
24
27
|
proc.call(value) if proc
|
25
28
|
end
|
26
|
-
|
27
|
-
|
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
|
-
|
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
|
-
|
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
|
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
|
-
|
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
|
-
|
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
|
133
|
-
|
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
|
-
|
156
|
+
feel(lf)
|
151
157
|
end
|
152
158
|
|
153
159
|
private
|
154
160
|
|
155
|
-
def
|
161
|
+
def feel(lf = 'metal')
|
156
162
|
lafinfo = javax.swing.UIManager.getInstalledLookAndFeels
|
157
|
-
laf = lafinfo.to_ary.
|
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
|
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
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.
|
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-
|
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:
|
44
|
-
|
45
|
-
|
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
|