rwdmovies 0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/Readme.txt +57 -0
- data/bin/rwdmovies +19 -0
- data/code/ag1core/aa0begin.rb +18 -0
- data/code/ag1core/rwdtinkerversion.rb +15 -0
- data/code/eo1rwdmovies/attachtmpmoviepicture.rb +24 -0
- data/code/eo1rwdmovies/deletemovierecord.rb +24 -0
- data/code/eo1rwdmovies/eo2viewmoviephoto.rb +4 -0
- data/code/eo1rwdmovies/gl7clearscreendisplay.rb +15 -0
- data/code/eo1rwdmovies/listmoviefiles.rb +15 -0
- data/code/eo1rwdmovies/loadeventrecord.rb +30 -0
- data/code/eo1rwdmovies/openmoviedata.rb +27 -0
- data/code/eo1rwdmovies/renamemovie.rb +13 -0
- data/code/eo1rwdmovies/rwdmovieshelpabout.rb +14 -0
- data/code/eo1rwdmovies/savemoviechanges.rb +19 -0
- data/code/eo1rwdmovies/viewrwdmoviesconfiguration.rb +21 -0
- data/code/eo1rwdmovies/viewtmppictures.rb +12 -0
- data/code/gh9calendar/gh9calendar.rb +16 -0
- data/code/xa5rwdtinkercallable/callable.rb +13 -0
- data/code/xb1rwdtinkerbackwindow/05listinstalledfiles.rb +11 -0
- data/code/xb1rwdtinkerbackwindow/diagnostictab.rb +21 -0
- data/code/xb1rwdtinkerbackwindow/ll1openname.rb +18 -0
- data/code/xb1rwdtinkerbackwindow/ll5listzips.rb +14 -0
- data/code/xb1rwdtinkerbackwindow/lm1installapplet.rb +20 -0
- data/code/xb1rwdtinkerbackwindow/mm1removeapplet.rb +28 -0
- data/code/xb1rwdtinkerbackwindow/rwdtinkerwin2version.rb +14 -0
- data/code/zz0applicationend/zz0end.rb +4 -0
- data/configuration/aa0rwdframework.cnf +14 -0
- data/configuration/ab1tinkerwin2.cnf +4 -0
- data/configuration/rwdmovies.cnf +4 -0
- data/ev/browser.rb +109 -0
- data/ev/ftools.rb +170 -0
- data/ev/net.rb +750 -0
- data/ev/ruby.rb +819 -0
- data/ev/rwd.rb +1848 -0
- data/ev/sgml.rb +236 -0
- data/ev/thread.rb +63 -0
- data/ev/tree.rb +343 -0
- data/ev/xml.rb +4 -0
- data/gui/aa2core/aa0rwdtop.rwd +4 -0
- data/gui/ee1rwdmovies/1openmoviedata.rwd +18 -0
- data/gui/ee1rwdmovies/2openmoviephoto.rwd +8 -0
- data/gui/ee1rwdmovies/3listmoviegfiles.rwd +12 -0
- data/gui/ee1rwdmovies/6editrecord.rwd +35 -0
- data/gui/ee1rwdmovies/movieutilities.rwd +33 -0
- data/gui/ee1rwdmovies/viewconfiguration.rwd +16 -0
- data/gui/ll1selectiontabbegin/selectiontabbegin.rwd +16 -0
- data/gui/ll5rwdtinkerwin2selectiontab/rwdwin2selectiontab.rwd +12 -0
- data/gui/lz1selectiontabend/endselectiontab.rwd +3 -0
- data/gui/tt0documentsbegin/tt0documentbegin.rwd +6 -0
- data/gui/uu5rwddocuments/uu5documents.rwd +15 -0
- data/gui/uu6rwdtinkerwin2documents/uu5documents.rwd +6 -0
- data/gui/uv7rwdmovies/uv7docmovies.rwd +4 -0
- data/gui/ww0documentsend/ww0documentend.rwd +7 -0
- data/gui/wz6finaltabs/xx0rwdfirsttab.rwd +6 -0
- data/gui/xa1versionwindow/1appname.rwd +19 -0
- data/gui/xa5rwdtinkercallablewindow/1appname.rwd +17 -0
- data/gui/xa5rwdtinkercallablewindow/9end.rwd +4 -0
- data/gui/xb1rwdtinkerbackwindow/1appname.rwd +5 -0
- data/gui/xb1rwdtinkerbackwindow/2tab1.rwd +11 -0
- data/gui/xb1rwdtinkerbackwindow/3arwddiagnostics.rwd +33 -0
- data/gui/xb1rwdtinkerbackwindow/4arwdlistapplets.rwd +44 -0
- data/gui/xb1rwdtinkerbackwindow/4arwdlistzips.rwd +35 -0
- data/gui/xb1rwdtinkerbackwindow/9backend.rwd +6 -0
- data/gui/xx8rwdmoviespicture/xx8moviephotoview.rwd +5 -0
- data/gui/ya1helpaboutbegin/ya0helpscreenstart.rwd +3 -0
- data/gui/yg5rwdhelpabout/1appname.rwd +4 -0
- data/gui/yg5rwdhelpabout/3copyright.rwd +3 -0
- data/gui/yg5rwdhelpabout/5version.rwd +10 -0
- data/gui/yg6rwdwin2helpabout/1appname.rwd +4 -0
- data/gui/yg6rwdwin2helpabout/3copyright.rwd +3 -0
- data/gui/yg6rwdwin2helpabout/5version.rwd +10 -0
- data/gui/yl2rwdmovieshelpabout/1movies.rwd +4 -0
- data/gui/yl2rwdmovieshelpabout/2movies.rwd +3 -0
- data/gui/yl2rwdmovieshelpabout/5version.rwd +9 -0
- data/gui/yy5helpaboutend/helpscreenend.rwd +3 -0
- data/gui/za1applicationend/yy9rwdend.rwd +4 -0
- data/init.rb +233 -0
- data/installed/rubyslippers-0.94.inf +9 -0
- data/installed/rwdcalendar-0.5.inf +8 -0
- data/installed/rwdmovies-0.5.inf +9 -0
- data/installed/rwdmoviesdata1.inf +8 -0
- data/installed/rwdtinkerwin2-0.5.inf +8 -0
- data/lang/alanguagehashbegin.rb +4 -0
- data/lang/en/rwdcalendar/calendar-nl.rb +6 -0
- data/lang/en/rwdcore/languagefile.rb +16 -0
- data/lang/es/rwdcalendar/calendar-nl.rb +6 -0
- data/lang/es/rwdcore/languagefile-es.rb +14 -0
- data/lang/languagehash.rb +4 -0
- data/lang/nl/rwdcalendar/calendar-nl.rb +6 -0
- data/lang/nl/rwdcore/languagefile-nl.rb +4 -0
- data/lang/templangfile.rb +22 -0
- data/lang/vlanguagehashend.rb +6 -0
- data/lang/wlocallangstart.rb +5 -0
- data/lang/xlocallangfile.rb +10 -0
- data/lang/zlocallangend.rb +2 -0
- data/lib/temp.rb +1 -0
- data/movies/Cold Mountain.jpg +0 -0
- data/movies/Cold Mountain.nam +8 -0
- data/movies/Last Of The Mohicans.jpg +0 -0
- data/movies/Last Of The Mohicans.nam +9 -0
- data/movies/Zulu.jpg +0 -0
- data/movies/Zulu.nam +8 -0
- data/movies/nophoto.jpg +0 -0
- data/rwd_files/HowTo_Movies.txt +72 -0
- data/rwd_files/HowTo_Tinker.txt +276 -0
- data/rwd_files/HowTo_TinkerWin2.txt +202 -0
- data/rwd_files/Readme.txt +57 -0
- data/rwd_files/favicon.ico +0 -0
- data/rwd_files/moviestmp.jpg +0 -0
- data/rwd_files/rdoc-style.css +175 -0
- data/rwd_files/rwdapplications.html +54 -0
- data/rwd_files/rwdindex.html +6 -0
- data/tests/totranslate.lang +93 -0
- data/zips/rwdacalendar-0.5.zip +0 -0
- data/zips/rwdhelloworld-0.3.zip +0 -0
- data/zips/rwdwshell-0.91.zip +0 -0
- data/zips/wrubyslippers-0.93.zip +0 -0
- metadata +157 -0
data/ev/sgml.rb
ADDED
@@ -0,0 +1,236 @@
|
|
1
|
+
require "ev/tree"
|
2
|
+
|
3
|
+
class SGMLObject < TreeObject
|
4
|
+
def to_s
|
5
|
+
res = ""
|
6
|
+
|
7
|
+
parsetree("prechildren_to_s", "postchildren_to_s", res)
|
8
|
+
|
9
|
+
res
|
10
|
+
end
|
11
|
+
|
12
|
+
def to_h
|
13
|
+
res = ""
|
14
|
+
|
15
|
+
parsetree("prechildren_to_sgml", "postchildren_to_sgml", res)
|
16
|
+
|
17
|
+
res
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
class Text < SGMLObject
|
22
|
+
def initialize(text)
|
23
|
+
super()
|
24
|
+
@text = text
|
25
|
+
end
|
26
|
+
|
27
|
+
def prechildren_to_s(res)
|
28
|
+
#res << "#{CGI.unescapeHTML(@text)} "
|
29
|
+
res << @text
|
30
|
+
end
|
31
|
+
|
32
|
+
def prechildren_to_sgml(res)
|
33
|
+
#res << "#{CGI.unescapeHTML(@text)}"
|
34
|
+
res << @text
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
class Comment < SGMLObject
|
39
|
+
def initialize(text)
|
40
|
+
super()
|
41
|
+
@text = text
|
42
|
+
end
|
43
|
+
|
44
|
+
def prechildren_to_sgml(res)
|
45
|
+
res << "#{@text}"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
class Special < SGMLObject
|
50
|
+
def initialize(text)
|
51
|
+
super()
|
52
|
+
@text = text
|
53
|
+
end
|
54
|
+
|
55
|
+
def prechildren_to_sgml(res)
|
56
|
+
res << "#{@text}"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
class Instruction < SGMLObject
|
61
|
+
def initialize(text)
|
62
|
+
super()
|
63
|
+
@text = text
|
64
|
+
end
|
65
|
+
|
66
|
+
def prechildren_to_sgml(res)
|
67
|
+
res << "#{@text}"
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
class Tag < SGMLObject
|
72
|
+
attr_reader :args
|
73
|
+
attr_writer :args
|
74
|
+
|
75
|
+
def initialize(subtype, args={})
|
76
|
+
super(subtype)
|
77
|
+
@args = args
|
78
|
+
@text = ""
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
class OpenTag < Tag
|
83
|
+
def initialize(*args)
|
84
|
+
super
|
85
|
+
@upordown = Down
|
86
|
+
end
|
87
|
+
|
88
|
+
def prechildren_to_sgml(res)
|
89
|
+
a = [@subtype]
|
90
|
+
|
91
|
+
@args.each do |k, v|
|
92
|
+
if not v.include?("'")
|
93
|
+
a << "#{k}='#{v}'"
|
94
|
+
else
|
95
|
+
if not v.include?('"')
|
96
|
+
a << "#{k}=\"#{v}\""
|
97
|
+
else
|
98
|
+
a << "#{k}='#{v.gsub(/\'/, '"')}'"
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
res << "<#{a.join(" ")}>" + @text
|
104
|
+
end
|
105
|
+
|
106
|
+
def postchildren_to_sgml(res)
|
107
|
+
res << "</#{@subtype}>" if @closed
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
class CloseTag < Tag
|
112
|
+
def initialize(*args)
|
113
|
+
super
|
114
|
+
@upordown = Dummy
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
class SGML < Tree
|
119
|
+
def initialize(*args)
|
120
|
+
@tagcache = {}
|
121
|
+
|
122
|
+
super
|
123
|
+
end
|
124
|
+
|
125
|
+
def buildobjects(string)
|
126
|
+
@objects = []
|
127
|
+
|
128
|
+
verwerk3 =
|
129
|
+
lambda do |string|
|
130
|
+
a = []
|
131
|
+
|
132
|
+
string[1..-2].splitblocks(["'", "'"], ['"', '"']).collect do |type, s|
|
133
|
+
case type
|
134
|
+
when 0
|
135
|
+
if self.class.to_s == "HTML"
|
136
|
+
s.splitwords.each do |w|
|
137
|
+
d = w.split("=", 2)
|
138
|
+
|
139
|
+
if d.length == 1
|
140
|
+
a << d[0]
|
141
|
+
else
|
142
|
+
a << d[0] if not d[0].nil? and not d[0].empty?
|
143
|
+
a << "="
|
144
|
+
a << d[1] if not d[1].nil? and not d[1].empty?
|
145
|
+
end
|
146
|
+
end
|
147
|
+
else
|
148
|
+
a.concat s.splitwords(["/", "="])
|
149
|
+
end
|
150
|
+
when 1, 2 then a << s
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
open = false
|
155
|
+
close = false
|
156
|
+
|
157
|
+
a = a[0].splitwords("/") + a[1..-1]
|
158
|
+
|
159
|
+
if a[0] == "/"
|
160
|
+
close = true
|
161
|
+
a.shift
|
162
|
+
else
|
163
|
+
open = true
|
164
|
+
end
|
165
|
+
|
166
|
+
if a[-1] == "/"
|
167
|
+
close = true
|
168
|
+
a.pop
|
169
|
+
end
|
170
|
+
|
171
|
+
tag = a.shift.downcase
|
172
|
+
args = {}
|
173
|
+
|
174
|
+
while not a.length.zero?
|
175
|
+
if a.length >= 3 and a[1] == "="
|
176
|
+
key = a.shift.downcase
|
177
|
+
dummy = a.shift
|
178
|
+
value = a.shift.noquotes
|
179
|
+
args[key] = value
|
180
|
+
else
|
181
|
+
key = a.shift.downcase
|
182
|
+
args[key] = ""
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
[tag, args, open, close]
|
187
|
+
end
|
188
|
+
|
189
|
+
verwerk2 =
|
190
|
+
lambda do |string|
|
191
|
+
if @tagcache.include? string
|
192
|
+
res = @tagcache[string]
|
193
|
+
else
|
194
|
+
res = verwerk3.call(string)
|
195
|
+
|
196
|
+
@tagcache[string] = res
|
197
|
+
end
|
198
|
+
|
199
|
+
res
|
200
|
+
end
|
201
|
+
|
202
|
+
verwerk1 =
|
203
|
+
lambda do |string|
|
204
|
+
tag, args, open, close = verwerk2.call(string)
|
205
|
+
|
206
|
+
@objects << OpenTag.new(tag.dup, args.dup) if open
|
207
|
+
@objects << CloseTag.new(tag.dup, args.dup) if close
|
208
|
+
end
|
209
|
+
|
210
|
+
string.splitblocks(["<!--", "-->"], ["<!", ">"], ["<?", "?>"], ["<", ">"]).each do |type, s|
|
211
|
+
case type
|
212
|
+
when 0 then @objects << Text.new(s)
|
213
|
+
when 1 then @objects << Comment.new(s)
|
214
|
+
when 2 then @objects << Special.new(s)
|
215
|
+
when 3 then @objects << Instruction.new(s)
|
216
|
+
when 4 then verwerk1.call(s)
|
217
|
+
end
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
def to_s
|
222
|
+
res = ""
|
223
|
+
|
224
|
+
parsetree("prechildren_to_s", "postchildren_to_s", res)
|
225
|
+
|
226
|
+
res
|
227
|
+
end
|
228
|
+
|
229
|
+
def to_h
|
230
|
+
res = ""
|
231
|
+
|
232
|
+
parsetree("prechildren_to_sgml", "postchildren_to_sgml", res)
|
233
|
+
|
234
|
+
res
|
235
|
+
end
|
236
|
+
end
|
data/ev/thread.rb
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
require "ev/ruby"
|
2
|
+
require "thread"
|
3
|
+
|
4
|
+
class FakeThread
|
5
|
+
def initialize(*args)
|
6
|
+
yield(*args)
|
7
|
+
end
|
8
|
+
|
9
|
+
def join
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class ThreadLimiter
|
14
|
+
def initialize(limit)
|
15
|
+
@limit = limit
|
16
|
+
@count = 0
|
17
|
+
@threads = []
|
18
|
+
@mutex = Mutex.new
|
19
|
+
@cv = ConditionVariable.new
|
20
|
+
|
21
|
+
every(1) do
|
22
|
+
@mutex.synchronize do
|
23
|
+
@threads.dup.each do |t|
|
24
|
+
unless t.alive?
|
25
|
+
$stderr.puts "Found dead thread."
|
26
|
+
|
27
|
+
@threads.delete(t)
|
28
|
+
|
29
|
+
@count -= 1
|
30
|
+
|
31
|
+
@cv.signal
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def wait
|
39
|
+
if block_given?
|
40
|
+
self.wait
|
41
|
+
yield
|
42
|
+
self.signal
|
43
|
+
else
|
44
|
+
@mutex.synchronize do
|
45
|
+
@threads << Thread.current
|
46
|
+
|
47
|
+
@count += 1
|
48
|
+
|
49
|
+
@cv.wait(@mutex) if @count > @limit
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def signal
|
55
|
+
@mutex.synchronize do
|
56
|
+
@threads.delete(Thread.current)
|
57
|
+
|
58
|
+
@count -= 1
|
59
|
+
|
60
|
+
@cv.signal
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
data/ev/tree.rb
ADDED
@@ -0,0 +1,343 @@
|
|
1
|
+
require "ev/ruby"
|
2
|
+
require "ev/net"
|
3
|
+
require "md5"
|
4
|
+
require "thread"
|
5
|
+
|
6
|
+
Same = 0
|
7
|
+
Down = 1
|
8
|
+
Up = 2
|
9
|
+
Dummy = 3
|
10
|
+
|
11
|
+
module TextArray
|
12
|
+
def textarray
|
13
|
+
@children.collect do |obj|
|
14
|
+
[obj.text] << obj.textarray
|
15
|
+
end.flatten.compact
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
module ParseTree
|
21
|
+
def parsetree(premethod="prechildren", postmethod="postchildren", *args)
|
22
|
+
if @visible
|
23
|
+
method(premethod).call(*args) if respond_to?(premethod)
|
24
|
+
|
25
|
+
@children.each do |obj|
|
26
|
+
obj.parsetree(premethod, postmethod, *args)
|
27
|
+
end
|
28
|
+
|
29
|
+
method(postmethod).call(*args) if respond_to?(postmethod)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
#def parsetree(premethod="prechildren", postmethod="postchildren", *args)
|
34
|
+
# stack = [self]
|
35
|
+
# done = []
|
36
|
+
#
|
37
|
+
# while not stack.empty?
|
38
|
+
# obj = stack.pop
|
39
|
+
#
|
40
|
+
# if not done.include?(obj)
|
41
|
+
# obj.method(premethod).call(*args) if obj.respond_to?(premethod)
|
42
|
+
#
|
43
|
+
# stack.push(obj)
|
44
|
+
# done.push(obj)
|
45
|
+
#
|
46
|
+
# stack.concat obj.children.reverse
|
47
|
+
# #obj.children.reverse.each do |cobj|
|
48
|
+
# #stack.push(cobj)
|
49
|
+
# #end
|
50
|
+
# else
|
51
|
+
# obj.method(postmethod).call(*args) if obj.respond_to?(postmethod)
|
52
|
+
# end
|
53
|
+
# end
|
54
|
+
#end
|
55
|
+
end
|
56
|
+
|
57
|
+
class TreeObject
|
58
|
+
attr_reader :subtype
|
59
|
+
attr_writer :subtype
|
60
|
+
attr_reader :upordown
|
61
|
+
attr_writer :upordown
|
62
|
+
attr_reader :level
|
63
|
+
attr_writer :level
|
64
|
+
attr_reader :parent
|
65
|
+
attr_writer :parent
|
66
|
+
attr_reader :children
|
67
|
+
attr_writer :children
|
68
|
+
attr_reader :closed
|
69
|
+
attr_writer :closed
|
70
|
+
attr_reader :text
|
71
|
+
attr_writer :text
|
72
|
+
attr_reader :visible
|
73
|
+
attr_writer :visible
|
74
|
+
|
75
|
+
include TextArray
|
76
|
+
include ParseTree
|
77
|
+
|
78
|
+
def initialize(subtype=nil)
|
79
|
+
@subtype = subtype
|
80
|
+
@upordown = Same
|
81
|
+
@level = nil
|
82
|
+
@parent = nil
|
83
|
+
@children = []
|
84
|
+
@closed = nil
|
85
|
+
@visible = true
|
86
|
+
end
|
87
|
+
|
88
|
+
def inspect
|
89
|
+
parent, children = @parent, @children
|
90
|
+
|
91
|
+
@parent, @children = parent.id, children.collect{|obj| obj.id}
|
92
|
+
|
93
|
+
res = " " * (level-1) + "#{self.class}(#{@subtype}) #{super}"
|
94
|
+
|
95
|
+
@parent, @children = parent, children
|
96
|
+
|
97
|
+
res
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
class Tree
|
102
|
+
@@versie = 1
|
103
|
+
@@mutex = Mutex.new
|
104
|
+
|
105
|
+
attr_reader :data
|
106
|
+
attr_writer :data
|
107
|
+
attr_reader :parent
|
108
|
+
attr_writer :parent
|
109
|
+
attr_reader :children
|
110
|
+
attr_writer :children
|
111
|
+
attr_reader :visible
|
112
|
+
attr_writer :visible
|
113
|
+
|
114
|
+
include TextArray
|
115
|
+
include ParseTree
|
116
|
+
|
117
|
+
def initialize(string)
|
118
|
+
string = string.join("") if string.kind_of?(Array)
|
119
|
+
|
120
|
+
@data = string
|
121
|
+
@parent = nil
|
122
|
+
@children = []
|
123
|
+
@objects = []
|
124
|
+
@visible = true
|
125
|
+
@checkvisibility = false
|
126
|
+
|
127
|
+
buildobjects(string)
|
128
|
+
buildparents
|
129
|
+
buildchildren
|
130
|
+
markclosed
|
131
|
+
deletedummies
|
132
|
+
|
133
|
+
@checkvisibility = true
|
134
|
+
end
|
135
|
+
|
136
|
+
def self.file(file)
|
137
|
+
new(File.new(file).readlines)
|
138
|
+
end
|
139
|
+
|
140
|
+
def self.location(url, form=Hash.new)
|
141
|
+
s = HTTPClient.get(url, form)
|
142
|
+
s = "" if s.nil?
|
143
|
+
new(s)
|
144
|
+
end
|
145
|
+
|
146
|
+
def self.new_from_cache2(data)
|
147
|
+
new(data)
|
148
|
+
end
|
149
|
+
|
150
|
+
def self.new_from_cache(data)
|
151
|
+
hash = MD5.new("#{@@versie} #{data}")
|
152
|
+
|
153
|
+
dir = "#{temp}/evcache.#{user}/tree.new"
|
154
|
+
file = "#{dir}/#{hash}"
|
155
|
+
|
156
|
+
tree = nil
|
157
|
+
|
158
|
+
Dir.mkdirrec(dir)
|
159
|
+
|
160
|
+
if File.file?(file)
|
161
|
+
@@mutex.synchronize do
|
162
|
+
tree = Marshal.restore(File.new(file, "rb"))
|
163
|
+
end
|
164
|
+
else
|
165
|
+
tree = new(data)
|
166
|
+
|
167
|
+
if not tree.nil?
|
168
|
+
@@mutex.synchronize do
|
169
|
+
File.open(file, "wb") {|f| Marshal.dump(tree, f)}
|
170
|
+
end
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
return tree
|
175
|
+
end
|
176
|
+
|
177
|
+
def inspect
|
178
|
+
@objects.collect do |obj|
|
179
|
+
obj.inspect
|
180
|
+
end.join("\n")
|
181
|
+
end
|
182
|
+
|
183
|
+
def buildobjects(string)
|
184
|
+
raise "Has to be defined in the subclass."
|
185
|
+
end
|
186
|
+
|
187
|
+
def buildparents
|
188
|
+
level = 1
|
189
|
+
levels = Hash.new
|
190
|
+
levels[0] = nil
|
191
|
+
parse do |type, obj|
|
192
|
+
case obj.upordown
|
193
|
+
when Down
|
194
|
+
obj.level = level
|
195
|
+
obj.parent = levels[level-1]
|
196
|
+
levels[level] = obj
|
197
|
+
level += 1
|
198
|
+
when Up, Dummy
|
199
|
+
pl = level
|
200
|
+
1.upto(level-1) do |l|
|
201
|
+
po = levels[l]
|
202
|
+
pl = l if po.subtype == obj.subtype
|
203
|
+
end
|
204
|
+
level = pl
|
205
|
+
obj.level = level
|
206
|
+
obj.parent = levels[level-1]
|
207
|
+
when Same
|
208
|
+
obj.level = level
|
209
|
+
obj.parent = levels[level-1]
|
210
|
+
end
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
214
|
+
def buildchildren
|
215
|
+
@objects.each do |obj|
|
216
|
+
obj.children = []
|
217
|
+
end
|
218
|
+
|
219
|
+
parse do |type, obj|
|
220
|
+
if not obj.parent.nil?
|
221
|
+
po = obj.parent
|
222
|
+
po.children << obj
|
223
|
+
else
|
224
|
+
@children << obj
|
225
|
+
end
|
226
|
+
end
|
227
|
+
end
|
228
|
+
|
229
|
+
def markclosed
|
230
|
+
([self].concat @objects).each do |obj|
|
231
|
+
obj.children.each_index do |i|
|
232
|
+
co1 = obj.children[i]
|
233
|
+
co2 = obj.children[i+1]
|
234
|
+
|
235
|
+
co1.closed = (not co2.nil? and co1.upordown == Down and (co2.upordown == Up or co2.upordown == Dummy) and co1.subtype == co2.subtype)
|
236
|
+
end
|
237
|
+
end
|
238
|
+
end
|
239
|
+
|
240
|
+
def deletedummies
|
241
|
+
([self].concat @objects).each do |obj|
|
242
|
+
obj.children.delete_if do |obj2|
|
243
|
+
obj2.upordown == Dummy
|
244
|
+
end
|
245
|
+
end
|
246
|
+
|
247
|
+
@objects.delete_if do |obj|
|
248
|
+
obj.upordown == Dummy
|
249
|
+
end
|
250
|
+
end
|
251
|
+
|
252
|
+
def parse(types=[], subtypes=[], once=false)
|
253
|
+
types = [types] if types.class == Class
|
254
|
+
subtypes = [subtypes] if subtypes.class == String
|
255
|
+
hidelevel = nil
|
256
|
+
|
257
|
+
catch :once do
|
258
|
+
@objects.each do |obj|
|
259
|
+
if (@checkvisibility and hidelevel.nil? and (not obj.visible))
|
260
|
+
hidelevel = obj.level
|
261
|
+
else
|
262
|
+
if (@checkvisibility and (not hidelevel.nil?) and obj.visible and obj.level <= hidelevel)
|
263
|
+
hidelevel = nil
|
264
|
+
end
|
265
|
+
end
|
266
|
+
|
267
|
+
if hidelevel.nil?
|
268
|
+
ok = false
|
269
|
+
catch :stop do
|
270
|
+
if types.empty?
|
271
|
+
if subtypes.empty?
|
272
|
+
ok = true
|
273
|
+
throw :stop
|
274
|
+
else
|
275
|
+
subtypes.each do |st|
|
276
|
+
if obj.subtype == st
|
277
|
+
ok = true
|
278
|
+
throw :stop
|
279
|
+
end
|
280
|
+
end
|
281
|
+
end
|
282
|
+
else
|
283
|
+
if subtypes.empty?
|
284
|
+
types.each do |t|
|
285
|
+
if obj.kind_of?(t)
|
286
|
+
ok = true
|
287
|
+
throw :stop
|
288
|
+
end
|
289
|
+
end
|
290
|
+
else
|
291
|
+
types.each do |t|
|
292
|
+
subtypes.each do |st|
|
293
|
+
if obj.kind_of?(t) and obj.subtype == st
|
294
|
+
ok = true
|
295
|
+
throw :stop
|
296
|
+
end
|
297
|
+
end
|
298
|
+
end
|
299
|
+
end
|
300
|
+
end
|
301
|
+
end
|
302
|
+
|
303
|
+
if ok
|
304
|
+
yield(obj.class.to_s, obj)
|
305
|
+
|
306
|
+
throw :once if once
|
307
|
+
end
|
308
|
+
end
|
309
|
+
end
|
310
|
+
end
|
311
|
+
end
|
312
|
+
|
313
|
+
def path(pad)
|
314
|
+
p1 = self
|
315
|
+
|
316
|
+
unless pad.nil?
|
317
|
+
pad.split(/\//).each do |deel|
|
318
|
+
tag, voorkomen = deel.split(/:/)
|
319
|
+
|
320
|
+
if (not tag.nil?) and (not p1.nil?)
|
321
|
+
voorkomen = 1 if voorkomen.nil?
|
322
|
+
voorkomen = voorkomen.to_i
|
323
|
+
|
324
|
+
teller = 0
|
325
|
+
p2 = nil
|
326
|
+
p1.children.each_index do |i|
|
327
|
+
#if p1.children[i].upordown == Down
|
328
|
+
unless p1.children[i].subtype.nil?
|
329
|
+
if p1.children[i].subtype.noquotes == tag.noquotes
|
330
|
+
teller += 1
|
331
|
+
p2 = p1.children[i] if teller == voorkomen
|
332
|
+
end
|
333
|
+
end
|
334
|
+
#end
|
335
|
+
end
|
336
|
+
p1 = p2
|
337
|
+
end
|
338
|
+
end
|
339
|
+
end
|
340
|
+
|
341
|
+
p1
|
342
|
+
end
|
343
|
+
end
|
data/ev/xml.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
$rwdguivar=
|
2
|
+
"
|
3
|
+
|
4
|
+
<tab name=\"viewrwdmovielist\" caption=\"View Movie\">
|
5
|
+
<row> <p align=\"right\">Click on List Movies to see your Movies</row>
|
6
|
+
<row><p></row>
|
7
|
+
<table>
|
8
|
+
<row> <p align=\"right\">Movie Name:</p> <text name=\"a_moviedisplay\"/> </row>
|
9
|
+
|
10
|
+
</table>
|
11
|
+
|
12
|
+
<horizontal>
|
13
|
+
<button caption=\"Open\" action=\"openmoviedata\"/>
|
14
|
+
<button caption=\"Cancel\" action=\"main\"/>
|
15
|
+
|
16
|
+
</horizontal>"
|
17
|
+
|
18
|
+
|