arcadia 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README +69 -77
- data/arcadia.rb +1097 -770
- data/base/a-commons.rb +480 -0
- data/base/a-contracts.rb +207 -322
- data/base/{a-utils.rb → a-tkcommons.rb} +933 -993
- data/conf/arcadia.conf +130 -203
- data/conf/arcadia.res.rb +1332 -1325
- data/ext/ae-action-dispatcher/ae-action-dispatcher.conf +6 -0
- data/ext/ae-action-dispatcher/ae-action-dispatcher.rb +22 -0
- data/ext/ae-complete-code/ae-complete-code.conf +2 -2
- data/ext/ae-complete-code/ae-complete-code.rb +82 -80
- data/ext/ae-doc-code/ae-doc-code.conf +2 -2
- data/ext/ae-doc-code/ae-doc-code.rb +114 -111
- data/ext/ae-editor/ae-editor.conf +110 -105
- data/ext/ae-editor/ae-editor.rb +2501 -2287
- data/ext/ae-editor/langs/conf.lang +15 -0
- data/ext/ae-editor/langs/lang.lang.bind +1 -0
- data/ext/ae-editor/langs/rb.lang +67 -0
- data/ext/ae-editor/langs/rbw.lang.bind +1 -0
- data/ext/ae-event-log/ae-event-log.rb +45 -52
- data/ext/ae-file-history/ae-file-history.conf +4 -4
- data/ext/ae-file-history/ae-file-history.rb +298 -286
- data/ext/ae-flag/ae-flag.conf +6 -6
- data/ext/ae-flag/ae-flag.rb +12 -12
- data/ext/ae-inspector/ae-inspector.conf +3 -3
- data/ext/ae-inspector/ae-inspector.rb +2 -2
- data/ext/ae-output-event/ae-output-event.conf +15 -15
- data/ext/ae-output/ae-output.conf +5 -3
- data/ext/ae-output/ae-output.rb +62 -33
- data/ext/ae-palette/ae-palette.conf +3 -3
- data/ext/ae-palette/ae-palette.rb +265 -306
- data/ext/ae-rad/ae-rad-inspector.rb +1534 -0
- data/{base/a-libs.rb → ext/ae-rad/ae-rad-libs.rb} +1118 -846
- data/ext/ae-rad/ae-rad-palette.rb +273 -0
- data/ext/ae-rad/ae-rad.conf +71 -0
- data/ext/ae-rad/ae-rad.rb +56 -0
- data/{lib → ext/ae-rad/lib}/tk/al-tk.rb +21 -110
- data/{lib → ext/ae-rad/lib}/tk/al-tk.res.rb +0 -0
- data/{lib → ext/ae-rad/lib}/tk/al-tkarcadia.rb +26 -26
- data/{lib → ext/ae-rad/lib}/tk/al-tkcustom.rb +70 -70
- data/{lib → ext/ae-rad/lib}/tkext/al-bwidget.rb +194 -194
- data/{lib → ext/ae-rad/lib}/tkext/al-iwidgets.rb +25 -25
- data/{lib → ext/ae-rad/lib}/tkext/al-tile.rb +173 -173
- data/{lib → ext/ae-rad/lib}/tkext/al-tktable.rb +0 -0
- data/ext/ae-ruby-debug/ae-ruby-debug.conf +7 -4
- data/ext/ae-ruby-debug/ae-ruby-debug.rb +278 -142
- data/ext/ae-search-in-files/ae-search-in-files.conf +15 -0
- data/ext/ae-search-in-files/ae-search-in-files.rb +284 -0
- data/ext/ae-shell/ae-shell.rb +88 -8
- data/ext/ae-shell/sh.rb +7 -0
- metadata +93 -79
- data/base/a-contracts-work.rb +0 -219
- data/base/a-ext.rb +0 -280
- data/ext/ae-debug/ae-debug.conf +0 -7
- data/ext/ae-debug/ae-debug.rb +0 -601
- data/ext/ae-debug/debug1.57.rb +0 -998
@@ -0,0 +1,15 @@
|
|
1
|
+
classes=key,value,operator,comment
|
2
|
+
re.key=(.*)\=
|
3
|
+
re.value=\=(.*)
|
4
|
+
re.operator=\=
|
5
|
+
re.comment=#
|
6
|
+
re_op.to_line_end=comment
|
7
|
+
re_op.only_first=operator
|
8
|
+
|
9
|
+
hightlight.comment.color.foreground=#007F00
|
10
|
+
hightlight.key.color.foreground=#9c342c
|
11
|
+
hightlight.key.style=bold
|
12
|
+
hightlight.value.color.foreground=#69a0b6
|
13
|
+
hightlight.value.style=bold
|
14
|
+
hightlight.operator.color.foreground=red
|
15
|
+
hightlight.operator.style=bold
|
@@ -0,0 +1 @@
|
|
1
|
+
bind=conf.lang
|
@@ -0,0 +1,67 @@
|
|
1
|
+
classes=number,method_name,class_name,module_name,keyword,instance_variable,global_variable,symbol,operator,string,comment
|
2
|
+
re.keyword=\b(and|or|unless|end|in|begin|defined?|ensure|redo|super|until|BEGIN|break|do|false|next|rescue|then|when|END|case|else|for|nil|retry|true|while|alias|elsif|if|not|return|undef|yield|require|include)([\(\s\n])|\b(self)([.,+\(\s])|__LINE__|__FILE__|[\s]*def[\s]|[\s]*module[\s]|[\s]*class[\s]
|
3
|
+
re.method_name=(def[\s][\s]*)[A-Za-z0-9_]*
|
4
|
+
re.instance_variable=([\s]*@)[A-Za-z0-9_]*
|
5
|
+
re.global_variable=([\s]*\$)[A-Za-z0-9_]*
|
6
|
+
re.class_name=(class[\s][\s]*)[A-Za-z0-9_]*
|
7
|
+
re.module_name=(module[\s][\s]*)[A-Za-z0-9_]*
|
8
|
+
re.string='(.*)'|"(.*)"
|
9
|
+
re.number=\d
|
10
|
+
re.operator=[\(\)\[\]\(\)\{\}.:;,\=><\|]
|
11
|
+
#re.symbol=(\s|,)(:)[A-Za-z0-9_]*
|
12
|
+
re.symbol=[^:](:)[A-Za-z0-9_]*
|
13
|
+
re.comment=#
|
14
|
+
re_op.to_line_end=comment
|
15
|
+
|
16
|
+
# override global
|
17
|
+
hightlight.sel.color.foreground=black
|
18
|
+
hightlight.sel.color.background=#68f914
|
19
|
+
hightlight.sel.borderwidth=1
|
20
|
+
hightlight.sel.relief=raised
|
21
|
+
hightlight.selected.color.background=yellow
|
22
|
+
hightlight.tabs.color.foreground=black
|
23
|
+
hightlight.tabs.color.background=#b1cfba
|
24
|
+
hightlight.tabs.borderwidth=1
|
25
|
+
hightlight.tabs.relief=raised
|
26
|
+
hightlight.spaces.color.foreground=black
|
27
|
+
hightlight.spaces.color.background=#d9f42b
|
28
|
+
hightlight.spaces.borderwidth=1
|
29
|
+
hightlight.spaces.relief=raised
|
30
|
+
#+--------------------------------------------------
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
hightlight.keyword.color.foreground=#00007F
|
35
|
+
hightlight.keyword.style=bold
|
36
|
+
hightlight.method_name.color.foreground=#007F7F
|
37
|
+
hightlight.method_name.style=bold
|
38
|
+
hightlight.class_name.color.foreground=#0000FF
|
39
|
+
hightlight.class_name.style=bold
|
40
|
+
hightlight.module_name.color.foreground=#0000FF
|
41
|
+
hightlight.module_name.style=bold
|
42
|
+
hightlight.instance_variable.color.foreground=#7F7F7F
|
43
|
+
hightlight.global_variable.style=bold
|
44
|
+
hightlight.global_variable.color.foreground=#db66ca
|
45
|
+
hightlight.instance_variable.style=bold
|
46
|
+
hightlight.comment.color.foreground=#007F00
|
47
|
+
hightlight.string.color.foreground=#7F007F
|
48
|
+
hightlight.number.color.foreground=#007F7F
|
49
|
+
#hightlight.capitalize.color.foreground=#0000FF
|
50
|
+
hightlight.operator.color.foreground=#000000
|
51
|
+
hightlight.operator.style=bold
|
52
|
+
hightlight.symbol.color.foreground=#bdc175
|
53
|
+
hightlight.symbol.style=bold
|
54
|
+
hightlight.sel.color.foreground=black
|
55
|
+
hightlight.sel.color.background=#68f914
|
56
|
+
hightlight.sel.borderwidth=1
|
57
|
+
hightlight.sel.relief=raised
|
58
|
+
#hightlight.goto.color.foreground=blue
|
59
|
+
hightlight.selected.color.background=yellow
|
60
|
+
hightlight.tabs.color.foreground=black
|
61
|
+
hightlight.tabs.color.background=#b1cfba
|
62
|
+
hightlight.tabs.borderwidth=1
|
63
|
+
hightlight.tabs.relief=raised
|
64
|
+
hightlight.spaces.color.foreground=black
|
65
|
+
hightlight.spaces.color.background=#d9f42b
|
66
|
+
hightlight.spaces.borderwidth=1
|
67
|
+
hightlight.spaces.relief=raised
|
@@ -0,0 +1 @@
|
|
1
|
+
bind=rb.lang
|
@@ -1,52 +1,45 @@
|
|
1
|
-
#
|
2
|
-
# ae-event-log.rb - Arcadia Ruby ide
|
3
|
-
# by Antonio Galeone <antonio-galeone@rubyforge.org>
|
4
|
-
#
|
5
|
-
|
6
|
-
|
7
|
-
class EventLog < ArcadiaExt
|
8
|
-
|
9
|
-
def
|
10
|
-
ArcadiaContractListener.new(self, ArcadiaContract, :do_event)
|
11
|
-
end
|
12
|
-
|
13
|
-
def
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
end
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
message =
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
return message
|
50
|
-
end
|
51
|
-
|
52
|
-
end
|
1
|
+
#
|
2
|
+
# ae-event-log.rb - Arcadia Ruby ide
|
3
|
+
# by Antonio Galeone <antonio-galeone@rubyforge.org>
|
4
|
+
#
|
5
|
+
|
6
|
+
|
7
|
+
class EventLog < ArcadiaExt
|
8
|
+
|
9
|
+
def on_before_build(_event)
|
10
|
+
ArcadiaContractListener.new(self, ArcadiaContract, :do_event)
|
11
|
+
end
|
12
|
+
|
13
|
+
def do_event(_event)
|
14
|
+
if _event.context.sender!=self
|
15
|
+
message = event_message(_event)
|
16
|
+
Arcadia.new_msg(self, message, 'CH1')
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
def event_message(_event, _ind="")
|
22
|
+
message = _ind
|
23
|
+
if _event.is_action?
|
24
|
+
message = message + 'ACTION::'
|
25
|
+
end
|
26
|
+
message = message +_event.signature+" :\n"
|
27
|
+
if _event.context
|
28
|
+
_event.context.instance_variables.sort.each do |key|
|
29
|
+
_obj_value = _event.context.send(key.gsub('@',''))
|
30
|
+
_value = _obj_value
|
31
|
+
if _value == nil
|
32
|
+
_value = 'nil'
|
33
|
+
else !_value.instance_of?(String)
|
34
|
+
_value = _value.to_s
|
35
|
+
end
|
36
|
+
message = message + _ind + "\s"*2 + key+' = '+_value+"\n"
|
37
|
+
if _obj_value != nil && _obj_value.kind_of?(ArcadiaContract::ContractEvent)
|
38
|
+
message = message + event_message(_obj_value, _ind+"\s"*4)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
return message
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
@@ -1,14 +1,14 @@
|
|
1
1
|
name=file_history
|
2
|
-
|
3
|
-
|
2
|
+
labels=File history
|
3
|
+
frames=0.0
|
4
4
|
active=yes
|
5
5
|
require=ext/ae-file-history/ae-file-history
|
6
6
|
class=FileH
|
7
7
|
|
8
8
|
file.name=arcadia.history
|
9
9
|
length=34
|
10
|
-
font=courier
|
11
|
-
font.bold=courier
|
10
|
+
font=courier 11
|
11
|
+
font.bold=courier 11 bold
|
12
12
|
color.background=#ffffff
|
13
13
|
color.foreground=#000000
|
14
14
|
freebsd::font=courier 12 italic
|
@@ -1,286 +1,298 @@
|
|
1
|
-
#
|
2
|
-
# ae-file-history.rb - Arcadia Ruby ide
|
3
|
-
# by Antonio Galeone <antonio-galeone@rubyforge.org>
|
4
|
-
#
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
attr_reader :
|
10
|
-
attr_reader :
|
11
|
-
attr_reader :
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
@
|
16
|
-
@
|
17
|
-
@
|
18
|
-
@
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
sons.each{|_tree|
|
40
|
-
if _path[0.._tree.label.length-1] == _tree.label
|
41
|
-
res = _path[_tree.label.length.._path.length-1]
|
42
|
-
if ["\\","/"].include?(res[0,1])
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
_node.
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
end
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
EditorContract.instance.open_file(self,'file'=>_file)
|
86
|
-
end
|
87
|
-
}
|
88
|
-
_background = conf('color.background')
|
89
|
-
_foreground = conf('color.foreground')
|
90
|
-
@font = conf('font')
|
91
|
-
@font_b = conf('font.bold')
|
92
|
-
|
93
|
-
@htree = Tk::BWidget::Tree.new(self.frame){
|
94
|
-
relief 'flat'
|
95
|
-
showlines false
|
96
|
-
deltay 18
|
97
|
-
background _background
|
98
|
-
crossfill _foreground
|
99
|
-
#dragenabled true
|
100
|
-
selectcommand proc{ do_select_item.call(self) }
|
101
|
-
place('relwidth' => 1,'relx' => 0,'x' => '0','y' => '0','relheight' => '1')
|
102
|
-
}
|
103
|
-
_scrollcommand = proc{|*args| @htree.yview(*args)}
|
104
|
-
_scrollbar = TkScrollbar.new(self.frame){|s|
|
105
|
-
width 8
|
106
|
-
command _scrollcommand
|
107
|
-
}.pack('side'=>'right', 'fill'=>'y')
|
108
|
-
@htree.yscrollcommand proc{|first,last| _scrollbar.set(first,last)}
|
109
|
-
|
110
|
-
self.build_tree
|
111
|
-
end
|
112
|
-
|
113
|
-
def
|
114
|
-
ArcadiaContractListener.new(self, EditorContract, :do_editor_event)
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
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
|
-
if !@htree.exist?(
|
202
|
-
@htree.insert('end', node.rif ,
|
203
|
-
'text' =>
|
204
|
-
'helptext' =>
|
205
|
-
'deltax'=>-1,
|
206
|
-
'fill' => _foreground,
|
207
|
-
'font'=>@
|
208
|
-
'image'=> image('
|
209
|
-
}
|
210
|
-
)
|
211
|
-
end
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
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
|
-
|
1
|
+
#
|
2
|
+
# ae-file-history.rb - Arcadia Ruby ide
|
3
|
+
# by Antonio Galeone <antonio-galeone@rubyforge.org>
|
4
|
+
#
|
5
|
+
|
6
|
+
|
7
|
+
class TreeNode
|
8
|
+
attr_reader :sons
|
9
|
+
attr_reader :parent
|
10
|
+
attr_reader :kind
|
11
|
+
attr_reader :rif, :label, :helptext
|
12
|
+
attr_writer :rif, :label, :helptext
|
13
|
+
def initialize(parent=nil, kind='KClass')
|
14
|
+
@sons = Array.new
|
15
|
+
@parent = parent
|
16
|
+
@kind = kind
|
17
|
+
@label = ''
|
18
|
+
if @parent !=nil
|
19
|
+
@parent.sons << self
|
20
|
+
end
|
21
|
+
yield(self) if block_given?
|
22
|
+
end
|
23
|
+
|
24
|
+
def <=> (other)
|
25
|
+
self.label.strip <=> other.label.strip
|
26
|
+
end
|
27
|
+
|
28
|
+
def path
|
29
|
+
_path = @label
|
30
|
+
if @parent != nil
|
31
|
+
_path = @parent.path+_path
|
32
|
+
end
|
33
|
+
return _path
|
34
|
+
end
|
35
|
+
|
36
|
+
def dir(_path)
|
37
|
+
node = nil
|
38
|
+
parent = self
|
39
|
+
sons.each{|_tree|
|
40
|
+
if _path[0.._tree.label.length-1] == _tree.label
|
41
|
+
res = _path[_tree.label.length.._path.length-1]
|
42
|
+
if ["\\","/"].include?(res[0,1])
|
43
|
+
parent = _tree
|
44
|
+
node= _tree.dir(res)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
break if node != nil
|
48
|
+
}
|
49
|
+
if node == nil
|
50
|
+
node = TreeNode.new(parent,'KDir') do |_node|
|
51
|
+
_node.label=_path
|
52
|
+
_node.rif= parent.path+_path
|
53
|
+
end
|
54
|
+
end
|
55
|
+
return node
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
class FileH < ArcadiaExt
|
62
|
+
include Autils
|
63
|
+
attr_reader :htree
|
64
|
+
|
65
|
+
def on_build(_event)
|
66
|
+
@h_stack = Array.new
|
67
|
+
do_select_item = proc{|_self|
|
68
|
+
if _self.selection_get[0].length >0
|
69
|
+
_selected = ""
|
70
|
+
_self.selection_get[0].each{|_block|
|
71
|
+
_selected = _selected + _block.to_s + "\s"
|
72
|
+
}
|
73
|
+
_selected = _selected.strip
|
74
|
+
else
|
75
|
+
_selected = _self.selection_get[0]
|
76
|
+
end
|
77
|
+
_dir, _file = _selected.split('@@@')
|
78
|
+
if _file
|
79
|
+
_file = File.expand_path( _file , _dir )
|
80
|
+
else
|
81
|
+
_file = Tk.getOpenFile('initialdir'=>_dir)
|
82
|
+
end
|
83
|
+
if _file
|
84
|
+
Arcadia.process_event(OpenBufferEvent.new(self,'file'=>_file))
|
85
|
+
#EditorContract.instance.open_file(self,'file'=>_file)
|
86
|
+
end
|
87
|
+
}
|
88
|
+
_background = conf('color.background')
|
89
|
+
_foreground = conf('color.foreground')
|
90
|
+
@font = conf('font')
|
91
|
+
@font_b = conf('font.bold')
|
92
|
+
|
93
|
+
@htree = Tk::BWidget::Tree.new(self.frame){
|
94
|
+
relief 'flat'
|
95
|
+
showlines false
|
96
|
+
deltay 18
|
97
|
+
background _background
|
98
|
+
crossfill _foreground
|
99
|
+
#dragenabled true
|
100
|
+
selectcommand proc{ do_select_item.call(self) }
|
101
|
+
place('relwidth' => 1,'relx' => 0,'x' => '0','y' => '0','relheight' => '1')
|
102
|
+
}
|
103
|
+
_scrollcommand = proc{|*args| @htree.yview(*args)}
|
104
|
+
_scrollbar = TkScrollbar.new(self.frame){|s|
|
105
|
+
width 8
|
106
|
+
command _scrollcommand
|
107
|
+
}.pack('side'=>'right', 'fill'=>'y')
|
108
|
+
@htree.yscrollcommand proc{|first,last| _scrollbar.set(first,last)}
|
109
|
+
|
110
|
+
self.build_tree
|
111
|
+
end
|
112
|
+
|
113
|
+
def on_after_build(_event)
|
114
|
+
#ArcadiaContractListener.new(self, EditorContract, :do_editor_event)
|
115
|
+
Arcadia.add_listener(self, OpenBufferEvent)
|
116
|
+
end
|
117
|
+
|
118
|
+
def history_file
|
119
|
+
if !defined?(@arcadia_history_file)
|
120
|
+
@arcadia_history_file = @arcadia.local_dir+'/'+conf('file.name')
|
121
|
+
end
|
122
|
+
return @arcadia_history_file
|
123
|
+
end
|
124
|
+
|
125
|
+
def on_after_open_buffer(_event)
|
126
|
+
if _event.file
|
127
|
+
self.add2history(_event.file)
|
128
|
+
add_to_tree(_event.file)
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
# def do_editor_event(_event)
|
133
|
+
# case _event.signature
|
134
|
+
# when EditorContract::FILE_AFTER_OPEN
|
135
|
+
# if _event.context.file
|
136
|
+
# self.add2history(_event.context.file)
|
137
|
+
# add_to_tree(_event.context.file)
|
138
|
+
# end
|
139
|
+
# when EditorContract::FILE_AFTER_CLOSE
|
140
|
+
# if _event.context.file
|
141
|
+
# end
|
142
|
+
# end
|
143
|
+
# end
|
144
|
+
|
145
|
+
def root
|
146
|
+
if !defined?(@root)
|
147
|
+
@root = TreeNode.new(nil, 'KRoot'){|_node|
|
148
|
+
_node.rif= 'root'
|
149
|
+
_node.label=''
|
150
|
+
}
|
151
|
+
end
|
152
|
+
return @root
|
153
|
+
end
|
154
|
+
|
155
|
+
def build_tree
|
156
|
+
file_dir = Hash.new
|
157
|
+
nodes = Array.new
|
158
|
+
if File.exist?(history_file)
|
159
|
+
f = File::open(history_file,'r')
|
160
|
+
f_open = $arcadia['pers']['editor.files.open'].split("|") if $arcadia['pers']['editor.files.open']
|
161
|
+
begin
|
162
|
+
_lines = f.readlines.collect!{| line | line.chomp+"\n" }.to_s
|
163
|
+
_lines.sort.each{|_line|
|
164
|
+
_file = _line.split(';')[0]
|
165
|
+
if FileTest::exist?(_file)
|
166
|
+
dir,fil =File.split(File.expand_path(_file))
|
167
|
+
dir = dir.downcase if is_windows?
|
168
|
+
fil = fil.downcase if is_windows?
|
169
|
+
file_dir[dir] = Array.new if file_dir[dir] == nil
|
170
|
+
file_dir[dir] << fil if !file_dir[dir].include?(fil)
|
171
|
+
end
|
172
|
+
}
|
173
|
+
ensure
|
174
|
+
f.close unless f.nil?
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
file_dir.keys.sort.each{|_dir|
|
179
|
+
node = root.dir(_dir)
|
180
|
+
file_dir[_dir].each{|file|
|
181
|
+
TreeNode.new(node, 'KFile'){|_node|
|
182
|
+
_node.rif= _dir+'@@@'+file
|
183
|
+
_node.label=file
|
184
|
+
}
|
185
|
+
}
|
186
|
+
}
|
187
|
+
|
188
|
+
@image_kdir = TkPhotoImage.new('dat' => BOOK_GIF)
|
189
|
+
@image_kfile_rb = TkPhotoImage.new('dat' => RUBY_DOCUMENT_GIF)
|
190
|
+
@image_kfile = TkPhotoImage.new('dat' => DOCUMENT_GIF)
|
191
|
+
|
192
|
+
build_tree_from_node(root)
|
193
|
+
end
|
194
|
+
|
195
|
+
def add_to_tree(_file)
|
196
|
+
_d, _f = File.split(File.expand_path(_file))
|
197
|
+
_d = _d.downcase if is_windows?
|
198
|
+
_f = _f.downcase if is_windows?
|
199
|
+
_foreground = conf('color.foreground')
|
200
|
+
node = root.dir(_d)
|
201
|
+
if !@htree.exist?(node.rif)
|
202
|
+
@htree.insert('end', node.parent.rif ,node.rif, {
|
203
|
+
'text' => node.rif ,
|
204
|
+
'helptext' => node.rif,
|
205
|
+
'deltax'=>-1,
|
206
|
+
'fill' => _foreground,
|
207
|
+
'font'=>@font,
|
208
|
+
'image'=> image('KDir')
|
209
|
+
}
|
210
|
+
)
|
211
|
+
end
|
212
|
+
_file_node_rif = _d+'@@@'+_f
|
213
|
+
if !@htree.exist?(_file_node_rif)
|
214
|
+
@htree.insert('end', node.rif ,_file_node_rif, {
|
215
|
+
'text' => _f ,
|
216
|
+
'helptext' => _f,
|
217
|
+
'deltax'=>-1,
|
218
|
+
'fill' => _foreground,
|
219
|
+
'font'=>@font_b,
|
220
|
+
'image'=> image('KFile',_f)
|
221
|
+
}
|
222
|
+
)
|
223
|
+
end
|
224
|
+
|
225
|
+
end
|
226
|
+
|
227
|
+
def image(_kind, _label='.rb')
|
228
|
+
if _kind == 'KDir'
|
229
|
+
return @image_kdir
|
230
|
+
elsif _kind == 'KFile' && _label.include?('.rb')
|
231
|
+
return @image_kfile_rb
|
232
|
+
else
|
233
|
+
return @image_kfile
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
def build_tree_from_node(_node)
|
238
|
+
_foreground = conf('color.foreground')
|
239
|
+
_sorted_sons = _node.sons.sort
|
240
|
+
for inode in 0.._sorted_sons.length - 1
|
241
|
+
_son = _sorted_sons[inode]
|
242
|
+
@htree.insert('end', _son.parent.rif ,_son.rif, {
|
243
|
+
'text' => _son.label ,
|
244
|
+
'fill' => _foreground,
|
245
|
+
'helptext' => _son.helptext,
|
246
|
+
'deltax'=>-1,
|
247
|
+
'font'=>@font,
|
248
|
+
'image'=> image(_son.kind, _son.label)
|
249
|
+
}
|
250
|
+
)
|
251
|
+
build_tree_from_node(_son)
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
255
|
+
|
256
|
+
def add2history(_filename, _text_index='1.0')
|
257
|
+
if _filename
|
258
|
+
_filename = _filename.sub(Dir::pwd+'/',"")
|
259
|
+
_filename = File.expand_path(_filename)
|
260
|
+
_filename_index = _filename+";"+_text_index
|
261
|
+
|
262
|
+
if File.exist?(history_file)
|
263
|
+
f = File::open(history_file,'r')
|
264
|
+
begin
|
265
|
+
_lines = f.readlines.collect!{| line | line.chomp}
|
266
|
+
ensure
|
267
|
+
f.close unless f.nil?
|
268
|
+
end
|
269
|
+
f = File.new(history_file, "w")
|
270
|
+
begin
|
271
|
+
if f
|
272
|
+
_l= conf('length').to_i
|
273
|
+
f.syswrite(_filename_index+"\n")
|
274
|
+
_lines[0.._l-2].each{|_line|
|
275
|
+
_lfile = _line.split(';')
|
276
|
+
if _lfile
|
277
|
+
f.syswrite(_line+"\n") if (_lfile[0] != _filename)&&(_line.length > 0)
|
278
|
+
end
|
279
|
+
}
|
280
|
+
end
|
281
|
+
ensure
|
282
|
+
f.close unless f.nil?
|
283
|
+
end
|
284
|
+
else
|
285
|
+
dir,fil =File.split(File.expand_path(history_file))
|
286
|
+
if !File.exist?(dir)
|
287
|
+
Dir.mkdir(dir)
|
288
|
+
end
|
289
|
+
f = File.new(history_file, "w+")
|
290
|
+
begin
|
291
|
+
f.syswrite(_filename+"\n") if f
|
292
|
+
ensure
|
293
|
+
f.close unless f.nil?
|
294
|
+
end
|
295
|
+
end
|
296
|
+
end
|
297
|
+
end
|
298
|
+
end
|