arcadia 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README +132 -134
- data/bin/arcadia +13 -0
- data/conf/arcadia.conf +196 -3
- data/conf/arcadia.init.rb +27 -6
- data/conf/arcadia.res.rb +10 -0
- data/ext/ae-complete-code/ae-complete-code.rb +76 -82
- data/ext/ae-doc-code/ae-doc-code.rb +295 -291
- data/ext/ae-editor/ae-editor.conf +88 -67
- data/ext/ae-editor/ae-editor.rb +400 -202
- data/ext/ae-editor/langs/conf.lang +16 -5
- data/ext/ae-editor/langs/lang.lang.bind +1 -1
- data/ext/ae-editor/langs/rb.lang +77 -41
- data/ext/ae-editor/langs/rbw.lang.bind +1 -1
- data/ext/ae-event-log/ae-event-log.rb +46 -45
- data/ext/ae-file-history/ae-file-history.conf +1 -1
- data/ext/ae-file-history/ae-file-history.rb +373 -298
- data/ext/ae-output/ae-output.conf +2 -0
- data/ext/ae-output/ae-output.rb +200 -202
- data/ext/ae-rad/ae-rad-inspector.rb +64 -70
- data/ext/ae-rad/ae-rad-palette.rb +14 -14
- data/ext/ae-rad/ae-rad.conf +2 -0
- data/ext/ae-rad/lib/tk/al-tk.rb +2991 -2987
- data/ext/ae-rad/lib/tk/al-tkarcadia.rb +26 -26
- data/ext/ae-ruby-debug/ae-ruby-debug.conf +8 -8
- data/ext/ae-ruby-debug/ae-ruby-debug.rb +1566 -1465
- data/ext/ae-search-in-files/ae-search-in-files.rb +294 -284
- data/ext/ae-shell/ae-shell.rb +20 -11
- data/{base → lib}/a-commons.rb +291 -80
- data/{base → lib}/a-contracts.rb +40 -18
- data/{arcadia.rb → lib/a-core.rb} +238 -148
- data/{base → lib}/a-tkcommons.rb +81 -63
- metadata +64 -65
- data/ext/ae-action-dispatcher/ae-action-dispatcher.conf +0 -6
- data/ext/ae-action-dispatcher/ae-action-dispatcher.rb +0 -22
- data/ext/ae-inspector/ae-inspector.conf +0 -7
- data/ext/ae-inspector/ae-inspector.rb +0 -1519
- data/ext/ae-palette/ae-palette.conf +0 -7
- data/ext/ae-palette/ae-palette.rb +0 -265
data/conf/arcadia.init.rb
CHANGED
@@ -2,12 +2,33 @@
|
|
2
2
|
|
3
3
|
begin
|
4
4
|
require 'tk'
|
5
|
-
rescue LoadError
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
5
|
+
rescue LoadError => e
|
6
|
+
print <<EOL
|
7
|
+
+--------------------------------------------+
|
8
|
+
| Arcadia require ruby-tk extension |
|
9
|
+
| and tcl/tk run-time |
|
10
|
+
| you must install before run ... |
|
11
|
+
+--------------------------------------------+
|
12
|
+
EOL
|
13
|
+
i=30
|
14
|
+
l=i
|
15
|
+
msg=e.message
|
16
|
+
while l < msg.length
|
17
|
+
while l < msg.length-1 && msg[l..l]!="\s"
|
18
|
+
l=l+1
|
19
|
+
end
|
20
|
+
msg = msg[0..l]+"\n"+"\s"*4+msg[l+1..-1]
|
21
|
+
l=l+i
|
22
|
+
end
|
23
|
+
print <<EOL
|
24
|
+
---Tk LoadError Details-----------------------
|
25
|
+
Platform : "#{RUBY_PLATFORM}"
|
26
|
+
Ruby version : "#{RUBY_VERSION}"
|
27
|
+
Message :
|
28
|
+
"#{msg}"
|
29
|
+
----------------------------------------------
|
30
|
+
EOL
|
31
|
+
exit
|
11
32
|
end
|
12
33
|
|
13
34
|
Tk.tk_call "eval","set auto_path [concat $::auto_path tcl]"
|
data/conf/arcadia.res.rb
CHANGED
@@ -1330,3 +1330,13 @@ R0lGODlhEAAQAIABAPEoAP///yH+FUNyZWF0ZWQgd2l0aCBUaGUgR0lNUAAh
|
|
1330
1330
|
+QQBCgABACwAAAAAEAAQAAACIoyPqcutAKN8DFAJg012m35poHeMY1hqF6Zy
|
1331
1331
|
1YNNzkzXSAEAOw==
|
1332
1332
|
EOS
|
1333
|
+
|
1334
|
+
KEYBOARD_GIF=<<EOS
|
1335
|
+
R0lGODlhGgAVAOMOAAAAAJmZmWZmZj8/P8zMzB8fH7+/v09PT4+Pj9/f339/
|
1336
|
+
fw8PD2ZmZjMzM////////yH+FUNyZWF0ZWQgd2l0aCBUaGUgR0lNUAAh+QQB
|
1337
|
+
FAAPACwAAAAAGgAVAAAEtfDJSes7yeotA8gclRhGRSxHOCUC4AKDoghLA6rN
|
1338
|
+
ghiBMLgFxS3kIaiOB8ExRDA0BKSodDqVIBqyrHbLnRUIg+GyEkAMOoqHQfgI
|
1339
|
+
pBMKA7ykCEjW58fvoQCU9gYAcYIPMHcKeU0xBj4BBgNQM3gGRmqIFIQ/JYaX
|
1340
|
+
fRR4Ent9fwBqgoFphpZ5Pm0DRq1gAbJ6SqsVa11ZJZ+XFH0vwS9pvXkrVFNi
|
1341
|
+
awKVYxYIsw0D09TV1tcNGBEAOw==
|
1342
|
+
EOS
|
@@ -1,82 +1,76 @@
|
|
1
|
-
#
|
2
|
-
# ae-complete-code.rb - Arcadia Ruby ide
|
3
|
-
# by Antonio Galeone <antonio-galeone@rubyforge.org>
|
4
|
-
#
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
class CompleteCode < ArcadiaExt
|
9
|
-
|
10
|
-
def on_after_build(_event)
|
11
|
-
@complete_command=full_command('rct-complete')
|
12
|
-
@doc_command=full_command('rct-doc')
|
13
|
-
@ri_command="ri -T -f plain"
|
14
|
-
@finder_command="rct-meth-args -n"
|
15
|
-
if @complete_command !=nil #system(@rct_complete+" "+__FILE__)
|
16
|
-
Arcadia.
|
17
|
-
|
18
|
-
|
19
|
-
Arcadia.new_error_msg(self, "Warning: Extension ae-complete-code depend upon rct-complete(rcodetools) command (install it or update system path!)")
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def full_command(_command='rct-complete')
|
24
|
-
_ret = nil
|
25
|
-
RUBY_PLATFORM.include?('win32') ? _sep = ';':_sep=':'
|
26
|
-
ENV['PATH'].split(_sep).each{|_path|
|
27
|
-
_file = File.join(_path, _command)
|
28
|
-
if FileTest.exist?(_file)
|
29
|
-
_ret = _file
|
30
|
-
end
|
31
|
-
}
|
32
|
-
_ret
|
33
|
-
end
|
34
|
-
|
35
|
-
def on_complete_code(_event)
|
36
|
-
if _event.file
|
37
|
-
_event.add_result(self,'candidates'=>candidates(_event.file, _event.row, _event.col))
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
#
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
Arcadia.new_error_msg(self, e.to_s)
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
end
|
82
|
-
|
1
|
+
#
|
2
|
+
# ae-complete-code.rb - Arcadia Ruby ide
|
3
|
+
# by Antonio Galeone <antonio-galeone@rubyforge.org>
|
4
|
+
#
|
5
|
+
|
6
|
+
|
7
|
+
|
8
|
+
class CompleteCode < ArcadiaExt
|
9
|
+
|
10
|
+
def on_after_build(_event)
|
11
|
+
@complete_command=full_command('rct-complete')
|
12
|
+
@doc_command=full_command('rct-doc')
|
13
|
+
@ri_command="ri -T -f plain"
|
14
|
+
@finder_command="rct-meth-args -n"
|
15
|
+
if @complete_command !=nil #system(@rct_complete+" "+__FILE__)
|
16
|
+
Arcadia.attach_listener(self, CompleteCodeEvent)
|
17
|
+
else
|
18
|
+
Arcadia.console(self, 'msg'=>"Warning: Extension ae-complete-code depend upon rct-complete(rcodetools) command (install it or update system path!)", 'level'=>'error')
|
19
|
+
#Arcadia.new_error_msg(self, "Warning: Extension ae-complete-code depend upon rct-complete(rcodetools) command (install it or update system path!)")
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def full_command(_command='rct-complete')
|
24
|
+
_ret = nil
|
25
|
+
RUBY_PLATFORM.include?('win32') ? _sep = ';':_sep=':'
|
26
|
+
ENV['PATH'].split(_sep).each{|_path|
|
27
|
+
_file = File.join(_path, _command)
|
28
|
+
if FileTest.exist?(_file)
|
29
|
+
_ret = _file
|
30
|
+
end
|
31
|
+
}
|
32
|
+
_ret
|
33
|
+
end
|
34
|
+
|
35
|
+
def on_complete_code(_event)
|
36
|
+
if _event.file
|
37
|
+
_event.add_result(self,'candidates'=>candidates(_event.file, _event.row, _event.col))
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def enance(_file, line)
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
def candidates(_file, _line, _col)
|
46
|
+
begin
|
47
|
+
_options = "--completion-class-info --dev --fork --line="+_line+" --column="+_col
|
48
|
+
#_options = "--line="+_line+" --column="+_col
|
49
|
+
_cmp_s = "|ruby "+@complete_command+" "+_options+" "+_file
|
50
|
+
_ret = nil
|
51
|
+
open(_cmp_s,"r") do
|
52
|
+
|f|
|
53
|
+
_ret = f.readlines.collect!{| line | line.chomp}
|
54
|
+
#p _ret
|
55
|
+
end
|
56
|
+
if _ret.length == 0
|
57
|
+
_cmp_s_d = _cmp_s+" 2>&1"
|
58
|
+
_error = nil
|
59
|
+
open(_cmp_s_d,"r") do
|
60
|
+
|f|
|
61
|
+
_error = f.readlines.collect!{| line | line.chomp}
|
62
|
+
end
|
63
|
+
if _error != nil && _error.length > 0
|
64
|
+
Arcadia.console(self, 'msg'=>"Syntax error in current source", 'level'=>'error')
|
65
|
+
#Arcadia.new_error_msg(self, "Syntax error in current source")
|
66
|
+
end
|
67
|
+
end
|
68
|
+
_ret
|
69
|
+
rescue Exception => e
|
70
|
+
Arcadia.console(self, 'msg'=>e.to_s, 'level'=>'error')
|
71
|
+
#Arcadia.new_error_msg(self, e.to_s)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
|
@@ -1,291 +1,295 @@
|
|
1
|
-
#
|
2
|
-
# ae-doc-code.rb - Arcadia Ruby ide
|
3
|
-
# by Antonio Galeone <antonio-galeone@rubyforge.org>
|
4
|
-
#
|
5
|
-
|
6
|
-
|
7
|
-
class DocCode < ArcadiaExt
|
8
|
-
def on_after_build(_event)
|
9
|
-
@doc_command=full_command('rct-doc')
|
10
|
-
@doc_command=full_command('RCT-DOC') if @doc_command == nil
|
11
|
-
@ri_command=full_command('ri')
|
12
|
-
if @ri_command !=nil #system(@rct_complete+" "+__FILE__)
|
13
|
-
Arcadia.
|
14
|
-
#ArcadiaContractListener.new(self, EditorContract, :do_editor_event)
|
15
|
-
else
|
16
|
-
Arcadia.
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
_x =
|
62
|
-
_y =
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
@docFrame.tkText.
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
#
|
129
|
-
#
|
130
|
-
#
|
131
|
-
#
|
132
|
-
#
|
133
|
-
# _event.context.doc
|
134
|
-
#
|
135
|
-
#
|
136
|
-
#
|
137
|
-
#
|
138
|
-
#
|
139
|
-
#
|
140
|
-
#
|
141
|
-
#
|
142
|
-
#
|
143
|
-
#
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
@
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
@
|
185
|
-
@
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
end
|
211
|
-
|
212
|
-
def
|
213
|
-
|
214
|
-
end
|
215
|
-
|
216
|
-
def
|
217
|
-
return
|
218
|
-
end
|
219
|
-
|
220
|
-
def
|
221
|
-
#
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
_sep = '
|
234
|
-
_value = _full_value[
|
235
|
-
_parent_found = true
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
_parent_rif =
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
_image = @
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
)
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
1
|
+
#
|
2
|
+
# ae-doc-code.rb - Arcadia Ruby ide
|
3
|
+
# by Antonio Galeone <antonio-galeone@rubyforge.org>
|
4
|
+
#
|
5
|
+
|
6
|
+
|
7
|
+
class DocCode < ArcadiaExt
|
8
|
+
def on_after_build(_event)
|
9
|
+
@doc_command=full_command('rct-doc')
|
10
|
+
@doc_command=full_command('RCT-DOC') if @doc_command == nil
|
11
|
+
@ri_command=full_command('ri')
|
12
|
+
if @ri_command !=nil #system(@rct_complete+" "+__FILE__)
|
13
|
+
Arcadia.attach_listener(self, DocCodeEvent)
|
14
|
+
#ArcadiaContractListener.new(self, EditorContract, :do_editor_event)
|
15
|
+
else
|
16
|
+
Arcadia.console(self, 'msg'=>"Warning: Extension ae-doc-code depend upon ri command!", 'level'=>'error')
|
17
|
+
#Arcadia.new_error_msg(self, "Warning: Extension ae-doc-code depend upon ri command!")
|
18
|
+
end
|
19
|
+
if @doc_command == nil #system(@rct_complete+" "+__FILE__)
|
20
|
+
Arcadia.console(self, 'msg'=>"Warning: Extension ae-doc-code depend upon rct-doc command!", 'level'=>'error')
|
21
|
+
#Arcadia.new_error_msg(self, "Warning: Extension ae-doc-code depend upon rct-doc command!")
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def full_command(_command='ri')
|
26
|
+
_ret = nil
|
27
|
+
RUBY_PLATFORM.include?('win32') ? _sep = ';':_sep=':'
|
28
|
+
ENV['PATH'].split(_sep).each{|_path|
|
29
|
+
_file = File.join(_path, _command)
|
30
|
+
if FileTest.exist?(_file)
|
31
|
+
_ret = _file
|
32
|
+
end
|
33
|
+
}
|
34
|
+
_ret
|
35
|
+
end
|
36
|
+
|
37
|
+
def on_doc_code(_event)
|
38
|
+
if _event.file && @doc_command != nil
|
39
|
+
res = _event.add_result(self)
|
40
|
+
res.doc = doc(_event)
|
41
|
+
elsif _event.doc_entry
|
42
|
+
_event.add_result(self, 'doc'=>doc_entry(_event.doc_entry),'title'=>_event.doc_entry)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def on_after_doc_code(_event)
|
47
|
+
res = _event.results[0]
|
48
|
+
if res !=nil && res.doc != nil && res.doc.length >0
|
49
|
+
raise_doc_code(_event)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def raise_doc_code(_context)
|
54
|
+
if @docFrame
|
55
|
+
@docFrame.tkText.delete('1.0','end')
|
56
|
+
else
|
57
|
+
_height = 140
|
58
|
+
_width = 550
|
59
|
+
_context.xdoc = TkWinfo.screenwidth(@arcadia.layout.root)/2 if !_context.xdoc
|
60
|
+
_context.ydoc = TkWinfo.screenheight(@arcadia.layout.root)/2 if !_context.ydoc
|
61
|
+
_x = _context.xdoc - _width/2
|
62
|
+
_y = _context.ydoc - _height -20
|
63
|
+
_x = 0 if _x < 0
|
64
|
+
_y = 0 if _y < 0
|
65
|
+
@docFrame = TkDocframe.new(@arcadia.layout.root).place('x'=>_x, 'y'=>_y, 'width'=>_width, 'height'=>_height)
|
66
|
+
do_close = proc{
|
67
|
+
@docFrame.destroy
|
68
|
+
@docFrame = nil
|
69
|
+
Tk.callback_break
|
70
|
+
}
|
71
|
+
@docFrame.on_close = do_close
|
72
|
+
@docFrame.tkText.bind_append('KeyPress'){|e|
|
73
|
+
case e.keysym
|
74
|
+
when 'Escape'
|
75
|
+
do_close.call
|
76
|
+
end
|
77
|
+
}
|
78
|
+
@docFrame.tkText.font(conf('font'))
|
79
|
+
@docFrame.tkText.foreground(conf('color.foreground'))
|
80
|
+
@docFrame.tkText.background(conf('color.background'))
|
81
|
+
end
|
82
|
+
res = _context.results[0]
|
83
|
+
if res.doc
|
84
|
+
@docFrame.tkText.insert('end', res.doc.to_s)
|
85
|
+
@docFrame.title(res.title) if res.title
|
86
|
+
else
|
87
|
+
Arcadia.console(self,'msg'=>'???')
|
88
|
+
#Arcadia.new_msg(self, 'nulla di dire !')
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def doc_entry(_entry=nil)
|
93
|
+
_ret = nil
|
94
|
+
if _entry
|
95
|
+
_cmp_doc = "|ruby "+@ri_command+" -T -f plain "+_entry
|
96
|
+
open (_cmp_doc) do |f|
|
97
|
+
_ret = f.readlines
|
98
|
+
end
|
99
|
+
end
|
100
|
+
_ret
|
101
|
+
end
|
102
|
+
|
103
|
+
def doc(_context)
|
104
|
+
begin
|
105
|
+
_options = "--line="+_context.row+" --column="+_context.col
|
106
|
+
_cmp_s = "|ruby " + @doc_command +" --use-method-analyzer "+_options +" " +_context.file
|
107
|
+
_ret = nil
|
108
|
+
_doc = nil
|
109
|
+
open(_cmp_s,"r") do
|
110
|
+
|f|
|
111
|
+
_doc = f.readlines.collect!{| line | line.chomp}.to_s.strip
|
112
|
+
end
|
113
|
+
if _doc.length > 0
|
114
|
+
_context.results[0].title = _doc.to_s if _context.results[0]
|
115
|
+
_ret = doc_entry(_context.results[0].title)
|
116
|
+
end
|
117
|
+
_ret
|
118
|
+
|
119
|
+
rescue Exception => e
|
120
|
+
_msg = e.to_s + "\n"
|
121
|
+
e.backtrace.each{|line| _msg = _msg + line + "\n"}
|
122
|
+
Arcadia.console(self, 'msg'=>_msg, 'level'=>'error')
|
123
|
+
#Arcadia.new_error_msg(self, _msg)
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
|
128
|
+
# def do_editor_event(_event)
|
129
|
+
# case _event.signature
|
130
|
+
# when EditorContract::DOC_CODE
|
131
|
+
# if _event.context.file && @doc_command != nil
|
132
|
+
# _event.context.doc = doc(_event.context)
|
133
|
+
# if _event.context.doc != nil && _event.context.doc.length >0
|
134
|
+
# raise_doc_code(_event.context)
|
135
|
+
# end
|
136
|
+
# elsif _event.context.doc_entry
|
137
|
+
# _event.context.doc = doc_entry(_event.context.doc_entry)
|
138
|
+
# _event.context.text = _event.context.doc_entry
|
139
|
+
# if _event.context.doc != nil && _event.context.doc.length >0
|
140
|
+
# raise_doc_code(_event.context)
|
141
|
+
# end
|
142
|
+
# end
|
143
|
+
# _event.handled(self)
|
144
|
+
# when EditorContract::BUILD_DOC_TREE
|
145
|
+
# build_doc_tree
|
146
|
+
# end
|
147
|
+
# end
|
148
|
+
|
149
|
+
def build_doc_tree
|
150
|
+
if !@doc_tree
|
151
|
+
@image_class = TkPhotoImage.new('dat' => ARROW_RIGHT_GIF)
|
152
|
+
@image_def = TkPhotoImage.new('dat' => TREE_NODE_DEF_GIF)
|
153
|
+
@image_def_class = TkPhotoImage.new('dat' => TREE_NODE_DEFCLASS_GIF)
|
154
|
+
do_select_item = proc{|_self|
|
155
|
+
if _self.selection_get[0].length >0
|
156
|
+
_selected = rif_2_node(_self.selection_get[0])
|
157
|
+
end
|
158
|
+
if _selected
|
159
|
+
EditorContract.instance.doc_code(self, 'doc_entry'=>_selected)
|
160
|
+
end
|
161
|
+
}
|
162
|
+
_background = conf('color.background')
|
163
|
+
_foreground = conf('color.foreground')
|
164
|
+
@doc_tree = Tk::BWidget::Tree.new(self.frame){
|
165
|
+
relief 'flat'
|
166
|
+
showlines false
|
167
|
+
deltay 18
|
168
|
+
background _background
|
169
|
+
crossfill _foreground
|
170
|
+
selectcommand proc{ do_select_item.call(self) }
|
171
|
+
place('relwidth' => 1,'relx' => 0,'x' => '0','y' => '0','relheight' => '1')
|
172
|
+
}
|
173
|
+
|
174
|
+
_scrollcommand = proc{|*args| @doc_tree.yview(*args)}
|
175
|
+
_scrollbar = TkScrollbar.new(self.frame, Arcadia.style('scrollbar')){|s|
|
176
|
+
width 8
|
177
|
+
command _scrollcommand
|
178
|
+
}.pack('side'=>'right', 'fill'=>'y')
|
179
|
+
@doc_tree.yscrollcommand proc{|first,last| _scrollbar.set(first,last)}
|
180
|
+
|
181
|
+
names = doc_entry('--list-names')
|
182
|
+
|
183
|
+
@progress_bar = TkProgressframe.new(@arcadia.layout.root, names.length)
|
184
|
+
@progress_bar.title('Building doc')
|
185
|
+
@cancell=false
|
186
|
+
@progress_bar.on_cancel=proc{cancel}
|
187
|
+
#@hash_rif = Hash.new
|
188
|
+
@level = 0
|
189
|
+
@last_nodes = Array.new
|
190
|
+
Thread.new do
|
191
|
+
_last_value = ''
|
192
|
+
#p 'n�='+ names.length.to_s
|
193
|
+
names.sort.each do |value|
|
194
|
+
_value = value.chomp.strip
|
195
|
+
if _value != _last_value
|
196
|
+
node(_value)
|
197
|
+
@progress_bar.title(_value)
|
198
|
+
_last_value = _value
|
199
|
+
end
|
200
|
+
@progress_bar.progress
|
201
|
+
if @cancell
|
202
|
+
@progress_bar.destroy
|
203
|
+
@progress_bar = nil
|
204
|
+
break
|
205
|
+
end
|
206
|
+
end
|
207
|
+
progress_bar.destroy if @progress_bar != nil
|
208
|
+
end
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
def cancel
|
213
|
+
@cancell=true
|
214
|
+
end
|
215
|
+
|
216
|
+
def node_2_rif(_path)
|
217
|
+
return _path.gsub('#','@M@').gsub('::','@C@').gsub('|','@P@').gsub('^','@U@')
|
218
|
+
end
|
219
|
+
|
220
|
+
def rif_2_node(_rif)
|
221
|
+
return _rif.gsub('@M@','#').gsub('@C@', '::').gsub('@P@', '|').gsub('@U@', '^')
|
222
|
+
end
|
223
|
+
|
224
|
+
def node(_path)
|
225
|
+
# _rif = @hash_rif.length
|
226
|
+
_rif = node_2_rif(_path)
|
227
|
+
_parent_found = false
|
228
|
+
while !_parent_found && @level > 0 do
|
229
|
+
@level = @level - 1
|
230
|
+
if (@last_nodes[@level] != nil) && _path.include?(@last_nodes[@level])
|
231
|
+
_full_value = _path.sub(@last_nodes[@level],'')
|
232
|
+
if _full_value[0..1].include?('#')
|
233
|
+
_sep = '#'
|
234
|
+
_value = _full_value[1.._full_value.length-1]
|
235
|
+
_parent_found = true
|
236
|
+
elsif _full_value[0..2].include?('::')
|
237
|
+
_sep = '::'
|
238
|
+
_value = _full_value[2.._full_value.length-1]
|
239
|
+
_parent_found = true
|
240
|
+
else
|
241
|
+
_parent_found = false
|
242
|
+
end
|
243
|
+
end
|
244
|
+
end
|
245
|
+
if _parent_found
|
246
|
+
_parent_path = @last_nodes[@level]
|
247
|
+
#_parent_rif = @hash_rif[_parent_path]
|
248
|
+
_parent_rif = node_2_rif(_parent_path)
|
249
|
+
@level = @level + 1
|
250
|
+
else
|
251
|
+
_parent_rif = 'root'
|
252
|
+
_sep = ''
|
253
|
+
_value = _path
|
254
|
+
end
|
255
|
+
|
256
|
+
#@hash_rif[_path]= _rif
|
257
|
+
@last_nodes[@level] = _path
|
258
|
+
_background = conf('color.background')
|
259
|
+
|
260
|
+
if _sep.length == 0
|
261
|
+
_image = @image_class
|
262
|
+
elsif _sep.include?('#')
|
263
|
+
_image = @image_def
|
264
|
+
elsif _sep.include?('::')
|
265
|
+
_image = @image_def_class
|
266
|
+
end
|
267
|
+
|
268
|
+
@doc_tree.insert('end', _parent_rif ,_rif, {
|
269
|
+
'text' => _value ,
|
270
|
+
'helptext' => _path,
|
271
|
+
'deltax'=>-1,
|
272
|
+
'image'=>_image
|
273
|
+
}
|
274
|
+
)
|
275
|
+
@level = @level + 1
|
276
|
+
end
|
277
|
+
end
|
278
|
+
|
279
|
+
class TkDocframe < TkFloatTitledFrame
|
280
|
+
attr_reader :tkText
|
281
|
+
def initialize(parent=nil, *args)
|
282
|
+
super(parent)
|
283
|
+
@tkText = TkText.new(self.frame,
|
284
|
+
'wrap'=>'none',
|
285
|
+
'relief'=>'groove'
|
286
|
+
){|j|
|
287
|
+
TkScrollbar.new(j, Arcadia.style('scrollbar')){|s|
|
288
|
+
width 8
|
289
|
+
command proc{|*args| j.yview(*args)}
|
290
|
+
j.yscrollcommand proc{|first,last| s.set first,last}
|
291
|
+
}.pack('side'=>'right', 'fill'=>'y')
|
292
|
+
}.place('x'=>0, 'y'=>0, 'relheight'=> 1, 'relwidth'=> 1)
|
293
|
+
|
294
|
+
end
|
295
|
+
end
|