purple_shoes 0.6.153 → 0.7.166
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +6 -0
- data/VERSION +1 -1
- data/lib/plugins/video.rb +68 -49
- data/lib/shoes/app.rb +54 -4
- data/lib/shoes/basic.rb +27 -1
- data/lib/shoes/download.rb +1 -1
- data/lib/shoes/main.rb +3 -0
- data/lib/shoes/text.rb +9 -0
- data/samples/sample51.rb +23 -0
- data/samples/sample58-1.rb +21 -0
- data/samples/sample58.rb +19 -16
- data/samples/shell.png +0 -0
- data/snapshots/sample51.png +0 -0
- data/snapshots/sample58-1.png +0 -0
- data/snapshots/sample58.png +0 -0
- data/static/man-ele-video.png +0 -0
- data/static/manual-en.txt +16 -32
- metadata +9 -4
data/README.md
CHANGED
@@ -56,3 +56,9 @@ jruby --1.9 -S pshoes -m
|
|
56
56
|
```
|
57
57
|
|
58
58
|
![snapshot](https://github.com/ashbb/purple_shoes/raw/master/manual.png)
|
59
|
+
|
60
|
+
|
61
|
+
Embed MPEG-1 video format
|
62
|
+
---------------------------------
|
63
|
+
|
64
|
+
**Note**: Need to install [JMF](http://www.oracle.com/technetwork/java/javase/download-142937.html) (Java Media Framework API)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.7.166
|
data/lib/plugins/video.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# Original code was written by pjfitzgibbons (Peter Fitzgibbons) in Brown Shoes
|
2
|
-
#
|
2
|
+
# Revised for Purple Shoes by ashbb
|
3
3
|
|
4
4
|
require File.join(DIR, '../static/sound_jars/tritonus_share.jar')
|
5
5
|
require File.join(DIR, '../static/sound_jars/mp3spi1.9.5.jar')
|
@@ -10,79 +10,98 @@ require File.join(DIR, '../static/sound_jars/vorbisspi1.0.3.jar')
|
|
10
10
|
|
11
11
|
class Shoes
|
12
12
|
class Video
|
13
|
+
include_package 'org.eclipse.swt.awt'
|
13
14
|
JFile = java.io.File
|
14
15
|
import java.io.BufferedInputStream
|
15
|
-
import javax.sound.sampled
|
16
16
|
import java.io.IOException
|
17
|
+
import javax.sound.sampled
|
18
|
+
import javax.media
|
19
|
+
import javax.media.protocol
|
17
20
|
|
18
|
-
|
19
|
-
|
20
|
-
def initialize args
|
21
|
-
@initials = args
|
21
|
+
def initialize path, args
|
22
22
|
args.each do |k, v|
|
23
23
|
instance_variable_set "@#{k}", v
|
24
24
|
end
|
25
25
|
Video.class_eval do
|
26
26
|
attr_accessor *args.keys
|
27
27
|
end
|
28
|
+
|
29
|
+
if path =~ /^(http|https):\/\//
|
30
|
+
@save ||= File.basename path
|
31
|
+
app.download(path, save: @save){init @save}
|
32
|
+
else
|
33
|
+
init path
|
34
|
+
end
|
28
35
|
end
|
29
36
|
|
30
|
-
def
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
37
|
+
def init file
|
38
|
+
if File.extname(file) == '.mpg'
|
39
|
+
cs = Swt::Composite.new @app.cs, Swt::SWT::EMBEDDED
|
40
|
+
cs.setSize @width, @height
|
41
|
+
cs.setLocation Swt::Point.new(@left, @top)
|
42
|
+
locator = MediaLocator.new JFile.new(file).toURL
|
43
|
+
source = Manager.createDataSource locator
|
44
|
+
player = Manager.createRealizedPlayer source
|
45
|
+
frame = SWT_AWT.new_Frame cs
|
46
|
+
frame.add player.getControlPanelComponent
|
47
|
+
frame.add player.getVisualComponent
|
48
|
+
frame.pack
|
49
|
+
else
|
50
|
+
audio = AudioSystem.getAudioInputStream JFile.new file
|
51
|
+
format = audio.getFormat
|
52
|
+
af = AudioFormat.new AudioFormat::Encoding::PCM_SIGNED, format.getSampleRate, 16,
|
53
|
+
format.getChannels, format.getChannels * 2, format.getSampleRate, false
|
54
|
+
as = AudioSystem.getAudioInputStream af, audio
|
55
|
+
@line = AudioSystem.getLine DataLine::Info.new(Clip.java_class, af)
|
56
|
+
@line.open as
|
36
57
|
end
|
37
58
|
end
|
38
59
|
|
39
|
-
def
|
40
|
-
|
41
|
-
|
42
|
-
decoded_format = AudioFormat.new(AudioFormat::Encoding::PCM_SIGNED, audio_format.getSampleRate(), 16,
|
43
|
-
audio_format.getChannels(), audio_format.getChannels() * 2, audio_format.getSampleRate(), false)
|
44
|
-
decoded_audio_input_stream = AudioSystem.getAudioInputStream(decoded_format, audio_input_stream)
|
45
|
-
return decoded_format, decoded_audio_input_stream
|
46
|
-
else
|
47
|
-
return audio_format, audio_input_stream
|
48
|
-
end
|
60
|
+
def play
|
61
|
+
self.time = 0
|
62
|
+
start
|
49
63
|
end
|
50
64
|
|
51
|
-
def
|
52
|
-
|
53
|
-
line = getLine(decoded_audio_format)
|
54
|
-
if line != nil
|
55
|
-
line.start()
|
56
|
-
bytes_read = 0, bytes_written = 0
|
57
|
-
while bytes_read != -1
|
58
|
-
bytes_read = decoded_audio_input_stream.read(sampled_data, 0, sampled_data.length)
|
59
|
-
if bytes_read != -1
|
60
|
-
bytes_written = line.write(sampled_data, 0, bytes_read)
|
61
|
-
end
|
62
|
-
end
|
63
|
-
line.drain()
|
64
|
-
line.stop()
|
65
|
-
line.close()
|
66
|
-
decoded_audio_input_stream.close()
|
67
|
-
end
|
65
|
+
def stop
|
66
|
+
@line.stop if @line
|
68
67
|
end
|
68
|
+
alias :pause :stop
|
69
69
|
|
70
|
-
def
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
70
|
+
def start
|
71
|
+
@line.start if @line
|
72
|
+
end
|
73
|
+
|
74
|
+
def length
|
75
|
+
@line.getMicrosecondLength / 1000 if @line
|
76
|
+
end
|
77
|
+
|
78
|
+
def time
|
79
|
+
@line.getMicrosecondPosition / 1000 if @line
|
80
|
+
end
|
81
|
+
|
82
|
+
def time=(n)
|
83
|
+
@line.setMicrosecondPosition n * 1000 if @line
|
84
|
+
end
|
85
|
+
|
86
|
+
def position
|
87
|
+
time / length.to_f if @line
|
88
|
+
end
|
89
|
+
|
90
|
+
def position=(f)
|
91
|
+
self.time = length * f if @line
|
92
|
+
end
|
93
|
+
|
94
|
+
def playing?
|
95
|
+
@line.isRunning if @line
|
76
96
|
end
|
77
97
|
end
|
78
98
|
end
|
79
99
|
|
80
100
|
class Shoes
|
81
101
|
class App
|
82
|
-
def video
|
83
|
-
args = {}
|
84
|
-
|
85
|
-
Video.new args
|
102
|
+
def video path, args={}
|
103
|
+
args = {left: 0, top: 0, width: 320, height: 240, app: self}.merge args
|
104
|
+
Video.new path, args
|
86
105
|
end
|
87
106
|
end
|
88
107
|
end
|
data/lib/shoes/app.rb
CHANGED
@@ -23,7 +23,7 @@ class Shoes
|
|
23
23
|
Shoes.APPS << self
|
24
24
|
end
|
25
25
|
|
26
|
-
attr_accessor :cslot, :top_slot, :contents, :mmcs, :mhcs, :mscs, :order, :mouse_pos, :hided
|
26
|
+
attr_accessor :cslot, :top_slot, :contents, :mmcs, :mhcs, :mscs, :order, :mouse_pos, :hided, :focus_ele
|
27
27
|
attr_writer :mouse_button
|
28
28
|
attr_reader :owner, :location
|
29
29
|
|
@@ -76,6 +76,7 @@ class Shoes
|
|
76
76
|
args = msg.last.class == Hash ? msg.pop : {}
|
77
77
|
args = eval("#{klass.to_s[7..-1].upcase}_DEFAULT").merge args
|
78
78
|
args = basic_attributes args
|
79
|
+
args[:contents] = msg
|
79
80
|
args[:markup] = msg.map(&:to_s).join
|
80
81
|
|
81
82
|
styles = get_styles msg
|
@@ -98,6 +99,7 @@ class Shoes
|
|
98
99
|
|
99
100
|
klass.new(args).tap do |s|
|
100
101
|
unless s.real and layout_control
|
102
|
+
s.contents.each{|e| e.parent = s if e.is_a?(Text)}
|
101
103
|
tl = Swt::TextLayout.new Shoes.display
|
102
104
|
s.real = tl
|
103
105
|
pl = Swt::PaintListener.new
|
@@ -108,12 +110,22 @@ class Shoes
|
|
108
110
|
gc = e.gc
|
109
111
|
Shoes.dps_reset s.dps, gc
|
110
112
|
tl.setText s.markup
|
111
|
-
s.app.set_styles s, args
|
113
|
+
s.app.set_styles s, s.args
|
112
114
|
tl.setWidth s.width if s.width > 0
|
113
115
|
unless s.hided
|
114
116
|
Shoes.set_rotate gc, *s.rotate do
|
115
117
|
tl.draw gc, s.left, s.top
|
116
118
|
end
|
119
|
+
if s.cursor
|
120
|
+
h = s.real.getLineBounds(0).height
|
121
|
+
s.textcursor ||= s.app.line(0, 0, 0, h, strokewidth: 1, stroke: s.app.black, hidden: true)
|
122
|
+
n = s.cursor == -1 ? s.text.length - 1 : s.cursor
|
123
|
+
n = 0 if n < 0
|
124
|
+
pos = s.real.getLocation n, true
|
125
|
+
s.textcursor.move(s.left + pos.x, s.top + pos.y).show
|
126
|
+
else
|
127
|
+
(s.textcursor.clear; s.textcursor = nil) if s.textcursor
|
128
|
+
end
|
117
129
|
end
|
118
130
|
end
|
119
131
|
end
|
@@ -138,7 +150,7 @@ class Shoes
|
|
138
150
|
url, name = name, File.join(DIR, '../static/downloading.png')
|
139
151
|
end
|
140
152
|
img = Swt::Image.new Shoes.display, name
|
141
|
-
args[:full_width], args[:full_height] =
|
153
|
+
args[:full_width], args[:full_height] = imagesize(name)
|
142
154
|
args[:real], args[:app] = img, self
|
143
155
|
|
144
156
|
Image.new(args).tap do |s|
|
@@ -177,6 +189,11 @@ class Shoes
|
|
177
189
|
end
|
178
190
|
end
|
179
191
|
|
192
|
+
def imagesize name
|
193
|
+
img = Swt::Image.new Shoes.display, name
|
194
|
+
return img.getImageData.width, img.getImageData.height
|
195
|
+
end
|
196
|
+
|
180
197
|
def buttonbase klass, name, args, &blk
|
181
198
|
args = basic_attributes args
|
182
199
|
args[:block] = blk
|
@@ -237,7 +254,24 @@ class Shoes
|
|
237
254
|
end
|
238
255
|
|
239
256
|
def edit_box *attrs, &blk
|
240
|
-
|
257
|
+
app = self
|
258
|
+
edit_text([EditBox, 200, 100, Swt::SWT::MULTI | Swt::SWT::WRAP, blk, attrs]).tap do |s|
|
259
|
+
unless s.args[:accepts_tab]
|
260
|
+
kl = Swt::KeyListener.new
|
261
|
+
class << kl; self end.
|
262
|
+
instance_eval do
|
263
|
+
define_method :keyPressed do |e|
|
264
|
+
if e.character == Swt::SWT::TAB
|
265
|
+
e.doit = false
|
266
|
+
list = app.cs.getTabList.to_a
|
267
|
+
list[(list.index(s.real) + 1) % list.length].setFocus
|
268
|
+
end
|
269
|
+
end
|
270
|
+
define_method(:keyReleased){|e|}
|
271
|
+
end
|
272
|
+
s.real.addKeyListener kl
|
273
|
+
end
|
274
|
+
end
|
241
275
|
end
|
242
276
|
|
243
277
|
def list_box args={}
|
@@ -585,6 +619,22 @@ class Shoes
|
|
585
619
|
end
|
586
620
|
end
|
587
621
|
|
622
|
+
def arrow *attrs
|
623
|
+
args = attrs.last.class == Hash ? attrs.pop : {}
|
624
|
+
w = attrs[2]
|
625
|
+
args.merge!({left: attrs[0], top: attrs[1], width: w, height: w})
|
626
|
+
shape args do
|
627
|
+
move_to 0, w*0.5*0.6
|
628
|
+
line_to w*0.58, w*0.5*0.6
|
629
|
+
line_to w*0.58, w*0.5*0.2
|
630
|
+
line_to w, w*0.5
|
631
|
+
line_to w*0.58, w*(1-0.5*0.2)
|
632
|
+
line_to w*0.58, w*(1-0.5*0.6)
|
633
|
+
line_to 0, w*(1-0.5*0.6)
|
634
|
+
line_to 0, w*0.5*0.6
|
635
|
+
end
|
636
|
+
end
|
637
|
+
|
588
638
|
def rgb r, g, b, l=1.0
|
589
639
|
(r <= 1 and g <= 1 and b <= 1) ? [r*255, g*255, b*255, l] : [r, g, b, l]
|
590
640
|
end
|
data/lib/shoes/basic.rb
CHANGED
@@ -169,7 +169,14 @@ class Shoes
|
|
169
169
|
super
|
170
170
|
end
|
171
171
|
end
|
172
|
-
class Line < ShapeBase
|
172
|
+
class Line < ShapeBase
|
173
|
+
def move x, y
|
174
|
+
dx, dy = x - @left, y - @top
|
175
|
+
@sx += dx; @ex += dx
|
176
|
+
@sy += dy; @ey += dy
|
177
|
+
super
|
178
|
+
end
|
179
|
+
end
|
173
180
|
class Star < ShapeBase
|
174
181
|
def move3 x, y
|
175
182
|
unless @app.cs.isDisposed
|
@@ -205,6 +212,7 @@ class Shoes
|
|
205
212
|
super
|
206
213
|
end
|
207
214
|
attr_reader :links
|
215
|
+
attr_accessor :cursor, :textcursor
|
208
216
|
def text
|
209
217
|
@args[:markup]
|
210
218
|
end
|
@@ -225,6 +233,16 @@ class Shoes
|
|
225
233
|
@links.clear
|
226
234
|
super
|
227
235
|
end
|
236
|
+
def hit x, y
|
237
|
+
x -= @left; y -= @top
|
238
|
+
h = @real.getLineBounds(0).height
|
239
|
+
text.length.times do |n|
|
240
|
+
s = @real.getLocation n, false
|
241
|
+
e = @real.getLocation n, true
|
242
|
+
return n if (s.x..e.x).include?(x) and (s.y..(e.y+h)).include?(y)
|
243
|
+
end
|
244
|
+
return nil
|
245
|
+
end
|
228
246
|
end
|
229
247
|
class Banner < TextBlock; end
|
230
248
|
class Title < TextBlock; end
|
@@ -235,6 +253,10 @@ class Shoes
|
|
235
253
|
class Inscription < TextBlock; end
|
236
254
|
|
237
255
|
class Native < Basic
|
256
|
+
def initialize args
|
257
|
+
super
|
258
|
+
@app.cs.setTabList @app.cs.getTabList.to_a.push(@real)
|
259
|
+
end
|
238
260
|
def text
|
239
261
|
@real.getText unless @real.isDisposed
|
240
262
|
end
|
@@ -258,6 +280,10 @@ class Shoes
|
|
258
280
|
@real.setVisible !@hided unless @real.isDisposed
|
259
281
|
self
|
260
282
|
end
|
283
|
+
def focus
|
284
|
+
@real.setFocus
|
285
|
+
@app.focus_ele = self
|
286
|
+
end
|
261
287
|
end
|
262
288
|
|
263
289
|
class Button < Native
|
data/lib/shoes/download.rb
CHANGED
data/lib/shoes/main.rb
CHANGED
@@ -28,6 +28,7 @@ class Shoes
|
|
28
28
|
|
29
29
|
cs = Swt::Composite.new shell, Swt::SWT::TRANSPARENT
|
30
30
|
cs.setSize args[:width], args[:height]
|
31
|
+
cs.setTabList []
|
31
32
|
|
32
33
|
args[:shell], args[:cs] = shell, cs
|
33
34
|
app = App.new args
|
@@ -44,6 +45,7 @@ class Shoes
|
|
44
45
|
|
45
46
|
shell.open
|
46
47
|
call_back_procs app
|
48
|
+
app.focus_ele.real.setFocus if app.focus_ele
|
47
49
|
app.aflush
|
48
50
|
|
49
51
|
cl = Swt::ControlListener.new
|
@@ -98,6 +100,7 @@ class Shoes
|
|
98
100
|
@display.sleep unless @display.readAndDispatch
|
99
101
|
end
|
100
102
|
@display.dispose
|
103
|
+
exit
|
101
104
|
end
|
102
105
|
app
|
103
106
|
end
|
data/lib/shoes/text.rb
CHANGED
@@ -28,6 +28,15 @@ class Shoes
|
|
28
28
|
@to_s = str.map(&:to_s).join
|
29
29
|
end
|
30
30
|
attr_reader :to_s, :style, :str, :color
|
31
|
+
attr_accessor :parent
|
32
|
+
|
33
|
+
def replace *str
|
34
|
+
@str = str
|
35
|
+
@to_s = str.map(&:to_s).join
|
36
|
+
@parent.args[:markup] = @parent.markup = @parent.contents.map(&:to_s).join
|
37
|
+
@parent.args[:styles] = @parent.styles = @parent.app.get_styles @parent.contents
|
38
|
+
@parent.style markup: @parent.markup
|
39
|
+
end
|
31
40
|
end
|
32
41
|
|
33
42
|
class Link < Text
|
data/samples/sample51.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'purple_shoes'
|
2
|
+
|
3
|
+
Shoes.app width: 200, height: 200 do
|
4
|
+
background mintcream
|
5
|
+
flow margin: 5 do
|
6
|
+
flow height: 190 do
|
7
|
+
background File.join(DIR, '../samples/shell.png'), curve: 5
|
8
|
+
@line = para strong(' ' * 300), stroke: white
|
9
|
+
@line.text = ''
|
10
|
+
@line.cursor = -1
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
keypress do |k|
|
15
|
+
msg = case k
|
16
|
+
when "\b"; @line.text[0..-2]
|
17
|
+
else
|
18
|
+
k.length == 1 ? @line.text + k : nil
|
19
|
+
end
|
20
|
+
@line.text = msg if msg
|
21
|
+
flush
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'purple_shoes'
|
2
|
+
|
3
|
+
Shoes.app do
|
4
|
+
title 'Sample Sounds', align: 'center', margin: 50
|
5
|
+
|
6
|
+
button "Boing WAV (740ms)" do
|
7
|
+
video(File.join DIR, "../samples/sounds/61847__simon-rue__boink-v3.wav").play
|
8
|
+
end
|
9
|
+
|
10
|
+
button "Fog Horn AIFF (18.667s)" do
|
11
|
+
video(File.join DIR, "../samples/sounds/145622__andybrannan__train-fog-horn-long-wyomming.aiff").play
|
12
|
+
end
|
13
|
+
|
14
|
+
button "Explosion MP3 (4.800s)" do
|
15
|
+
video(File.join DIR, "../samples/sounds/102719__sarge4267__explosion.mp3").play
|
16
|
+
end
|
17
|
+
|
18
|
+
button "Shields UP! OGG (2.473s)" do
|
19
|
+
video(File.join DIR, "../samples/sounds/46492__phreaksaccount__shields1.ogg").play
|
20
|
+
end
|
21
|
+
end
|
data/samples/sample58.rb
CHANGED
@@ -1,21 +1,24 @@
|
|
1
1
|
require 'purple_shoes'
|
2
2
|
|
3
|
-
Shoes.app do
|
4
|
-
|
3
|
+
Shoes.app width: 300, height: 100, title: 'Teeny-weeny Audio player' do
|
4
|
+
space = ' '
|
5
|
+
background gold..cyan, angle: 30
|
6
|
+
song = para 'song.ogg', stroke: firebrick, left: 0, top: 70
|
7
|
+
file = 'http://www.rin-shun.com/shoes/song.ogg'
|
8
|
+
v = video file
|
5
9
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
video(File.join DIR, "../samples/sounds/46492__phreaksaccount__shields1.ogg").play
|
10
|
+
para link('select'){
|
11
|
+
unless v.playing?
|
12
|
+
f = ask_open_file
|
13
|
+
file = f if f
|
14
|
+
v = video file
|
15
|
+
song.text = file
|
16
|
+
end
|
17
|
+
}, space, link('play'){v.play}, space, link('start'){v.start}, space, link('stop'){v.stop}
|
18
|
+
|
19
|
+
img = image File.join(DIR, '../samples/loogink.png')
|
20
|
+
n = 0
|
21
|
+
animate 5 do
|
22
|
+
img.move (n+=1) % 300 , 40 - rand(10) if file && v.playing?
|
20
23
|
end
|
21
24
|
end
|
data/samples/shell.png
ADDED
Binary file
|
Binary file
|
Binary file
|
data/snapshots/sample58.png
CHANGED
Binary file
|
data/static/man-ele-video.png
CHANGED
Binary file
|
data/static/manual-en.txt
CHANGED
@@ -2246,12 +2246,15 @@ any other radio buttons in the same slot.)
|
|
2246
2246
|
Creates a Span text fragment, unstyled by default.
|
2247
2247
|
|
2248
2248
|
{{{
|
2249
|
+
# Not yet available
|
2249
2250
|
Shoes.app do
|
2250
2251
|
tagline "\n", 'hello ' * 5,
|
2251
2252
|
span(em('Purple Shoes'), size: 8, rise: 15)
|
2252
2253
|
end
|
2253
2254
|
}}}
|
2254
2255
|
|
2256
|
+
'''Note:''' Purple Shoes doesn't support `span` method.
|
2257
|
+
|
2255
2258
|
=== stack(styles) { ... } » Shoes::Stack ===
|
2256
2259
|
|
2257
2260
|
Creates a new stack. A stack is a type of slot. (See the main [[Slots]] page
|
@@ -3633,15 +3636,11 @@ Creation]] page.
|
|
3633
3636
|
|
3634
3637
|
Lists all of the strings and styled text objects inside this block.
|
3635
3638
|
|
3636
|
-
'''Note:''' Purple Shoes doesn't support `contents` method.
|
3637
|
-
|
3638
3639
|
=== cursor() » an index ===
|
3639
3640
|
|
3640
3641
|
Return a text cursor position. That is an index of the text which is a string
|
3641
3642
|
of all of the characters in this text box.
|
3642
3643
|
|
3643
|
-
'''Note:''' Purple Shoes doesn't support `cursor` method.
|
3644
|
-
|
3645
3644
|
=== cursor = an index or nil ===
|
3646
3645
|
|
3647
3646
|
Shows or hides the text cursor.
|
@@ -3650,14 +3649,13 @@ Using `cursor = -1` shows the text cursor at the end of the text.
|
|
3650
3649
|
Using `cursor = nil` hides the text cursor.
|
3651
3650
|
|
3652
3651
|
{{{
|
3653
|
-
# Not yet available
|
3654
3652
|
Shoes.app do
|
3655
3653
|
msg = para 'hello ' * 20
|
3656
3654
|
msg.cursor = -1
|
3657
3655
|
keypress do |k|
|
3658
3656
|
n = case k
|
3659
|
-
when '
|
3660
|
-
when '
|
3657
|
+
when 'ARROW_LEFT'; -1
|
3658
|
+
when 'ARROW_RIGHT'; 1
|
3661
3659
|
else
|
3662
3660
|
next
|
3663
3661
|
end
|
@@ -3670,8 +3668,6 @@ Using `cursor = nil` hides the text cursor.
|
|
3670
3668
|
end
|
3671
3669
|
}}}
|
3672
3670
|
|
3673
|
-
'''Note:''' Purple Shoes doesn't support `cursor=` method.
|
3674
|
-
|
3675
3671
|
=== highlight() » an array ===
|
3676
3672
|
|
3677
3673
|
Return an array which includes a text marker start position and highlighted length.
|
@@ -3682,19 +3678,16 @@ Return an index of the text at which the mouse cursor points on.
|
|
3682
3678
|
The `left` and `top` are the mouse coordinates.
|
3683
3679
|
|
3684
3680
|
{{{
|
3685
|
-
# Not yet available
|
3686
3681
|
Shoes.app do
|
3687
3682
|
para 'index: ', width: 50
|
3688
3683
|
index = para '', width: 20
|
3689
3684
|
msg = title 'hello ' * 5
|
3690
3685
|
click do |b, x, y|
|
3691
|
-
index.text = msg.hit
|
3686
|
+
index.text = msg.hit(x, y).to_s
|
3692
3687
|
end
|
3693
3688
|
end
|
3694
3689
|
}}}
|
3695
3690
|
|
3696
|
-
'''Note:''' Purple Shoes doesn't support `hit` method.
|
3697
|
-
|
3698
3691
|
=== marker() » an index ===
|
3699
3692
|
|
3700
3693
|
Return a text marker start position.
|
@@ -3780,27 +3773,18 @@ already running, it is stopped.
|
|
3780
3773
|
|
3781
3774
|
== Video ==
|
3782
3775
|
|
3783
|
-
Purple Shoes supports embedding of
|
3784
|
-
This is all thanks to
|
3776
|
+
Purple Shoes supports embedding of MPEG-1 video format.
|
3777
|
+
This is all thanks to JMF (Java Media Framework). Use the `video` method to setup a
|
3778
|
+
Shoes::Video object. !{:margin_left => 30}man-ele-video.png!
|
3785
3779
|
|
3786
3780
|
{{{
|
3787
|
-
|
3788
|
-
|
3789
|
-
|
3790
|
-
|
3791
|
-
|
3792
|
-
|
3793
|
-
|
3794
|
-
space, link('pause'){v.pause},
|
3795
|
-
space, link('-1sec'){v.time -= 1000},
|
3796
|
-
space, link('+1sec'){v.time += 1000},
|
3797
|
-
top: 250
|
3798
|
-
msg = para left: 250, top: 300
|
3799
|
-
every do
|
3800
|
-
msg.text = fg("#{(v.position*100).to_i}% " +
|
3801
|
-
"(#{v.time/1000}/#{v.length.to_i/1000}sec)",
|
3802
|
-
darkcyan)
|
3803
|
-
end
|
3781
|
+
Shoes.app width: 400, height: 350 do
|
3782
|
+
background purple
|
3783
|
+
tagline 'Adventure Time with Finn and Jake',
|
3784
|
+
stroke: white, align: 'center'
|
3785
|
+
video 'http://is.gd/b1xRdO',
|
3786
|
+
save: 'AdventureTimewithFinnandJake.mpg',
|
3787
|
+
top: 30, width: 400, height: 300
|
3804
3788
|
end
|
3805
3789
|
}}}
|
3806
3790
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: purple_shoes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.166
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-05-
|
12
|
+
date: 2012-05-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: swt
|
16
|
-
requirement: &
|
16
|
+
requirement: &14783256 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *14783256
|
25
25
|
description: Purple Shoes is one of colorful Shoes, written in JRuby and SWT.
|
26
26
|
email: ashbbb@gmail.com
|
27
27
|
executables:
|
@@ -157,13 +157,16 @@ files:
|
|
157
157
|
- samples/sample49.rb
|
158
158
|
- samples/sample5.rb
|
159
159
|
- samples/sample50.rb
|
160
|
+
- samples/sample51.rb
|
160
161
|
- samples/sample52.rb
|
162
|
+
- samples/sample58-1.rb
|
161
163
|
- samples/sample58.rb
|
162
164
|
- samples/sample6.rb
|
163
165
|
- samples/sample7.rb
|
164
166
|
- samples/sample8.rb
|
165
167
|
- samples/sample9.rb
|
166
168
|
- samples/sample99.rb
|
169
|
+
- samples/shell.png
|
167
170
|
- samples/sounds/102719__sarge4267__explosion.mp3
|
168
171
|
- samples/sounds/145622__andybrannan__train-fog-horn-long-wyomming.aiff
|
169
172
|
- samples/sounds/46492__phreaksaccount__shields1.ogg
|
@@ -212,7 +215,9 @@ files:
|
|
212
215
|
- snapshots/sample49.png
|
213
216
|
- snapshots/sample5.png
|
214
217
|
- snapshots/sample50.png
|
218
|
+
- snapshots/sample51.png
|
215
219
|
- snapshots/sample52.png
|
220
|
+
- snapshots/sample58-1.png
|
216
221
|
- snapshots/sample58.png
|
217
222
|
- snapshots/sample6.png
|
218
223
|
- snapshots/sample7.png
|