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
@@ -1,15 +1,26 @@
|
|
1
|
-
classes=key,value,operator,comment
|
1
|
+
classes=key,value,operator,comment,link
|
2
2
|
re.key=(.*)\=
|
3
3
|
re.value=\=(.*)
|
4
4
|
re.operator=\=
|
5
5
|
re.comment=#
|
6
|
+
re.link=>>>
|
6
7
|
re_op.to_line_end=comment
|
7
8
|
re_op.only_first=operator
|
8
9
|
|
9
|
-
hightlight.comment.
|
10
|
-
hightlight.key.
|
10
|
+
#hightlight.comment.foreground=#007F00
|
11
|
+
#hightlight.key.foreground=#9c342c
|
12
|
+
#hightlight.key.style=bold
|
13
|
+
#hightlight.value.foreground=#69a0b6
|
14
|
+
#hightlight.value.style=bold
|
15
|
+
#hightlight.operator.foreground=red
|
16
|
+
#hightlight.operator.style=bold
|
17
|
+
|
18
|
+
hightlight.comment.foreground=>>>hightlight.11.foreground
|
19
|
+
hightlight.key.foreground=>>>hightlight.5.foreground
|
11
20
|
hightlight.key.style=bold
|
12
|
-
hightlight.value.
|
21
|
+
hightlight.value.foreground=>>>hightlight.6.foreground
|
13
22
|
hightlight.value.style=bold
|
14
|
-
hightlight.operator.
|
23
|
+
hightlight.operator.foreground=>>>hightlight.14.foreground
|
15
24
|
hightlight.operator.style=bold
|
25
|
+
hightlight.link.foreground=>>>hightlight.12.foreground
|
26
|
+
hightlight.link.style=bold
|
@@ -1 +1 @@
|
|
1
|
-
bind=conf
|
1
|
+
bind=conf
|
data/ext/ae-editor/langs/rb.lang
CHANGED
@@ -13,55 +13,91 @@ re.symbol=[^:](:)[A-Za-z0-9_]*
|
|
13
13
|
re.comment=#
|
14
14
|
re_op.to_line_end=comment
|
15
15
|
|
16
|
-
# override global
|
17
|
-
hightlight.sel.
|
18
|
-
hightlight.sel.
|
19
|
-
hightlight.sel.borderwidth
|
20
|
-
hightlight.sel.relief
|
21
|
-
hightlight.selected.
|
22
|
-
hightlight.tabs.
|
23
|
-
hightlight.tabs.
|
24
|
-
hightlight.tabs.borderwidth
|
25
|
-
hightlight.tabs.relief
|
26
|
-
hightlight.spaces.
|
27
|
-
hightlight.spaces.
|
28
|
-
hightlight.spaces.borderwidth
|
29
|
-
hightlight.spaces.relief
|
30
|
-
#+--------------------------------------------------
|
16
|
+
# override global classes
|
17
|
+
hightlight.sel.foreground=>>>hightlight.1.foreground
|
18
|
+
hightlight.sel.background=>>>hightlight.1.background
|
19
|
+
hightlight.sel.borderwidth=>>>hightlight.1.borderwidth
|
20
|
+
hightlight.sel.relief=>>>hightlight.1.relief
|
21
|
+
hightlight.selected.background=>>>hightlight.2.background
|
22
|
+
hightlight.tabs.foreground=>>>hightlight.3.foreground
|
23
|
+
hightlight.tabs.background=>>>hightlight.3.background
|
24
|
+
hightlight.tabs.borderwidth=>>>hightlight.3.borderwidth
|
25
|
+
hightlight.tabs.relief=>>>hightlight.3.relief
|
26
|
+
hightlight.spaces.foreground=>>>hightlight.4.foreground
|
27
|
+
hightlight.spaces.background=>>>hightlight.4.background
|
28
|
+
hightlight.spaces.borderwidth=>>>hightlight.4.borderwidth
|
29
|
+
hightlight.spaces.relief=>>>hightlight.4.relief
|
31
30
|
|
32
31
|
|
32
|
+
# override global
|
33
|
+
#hightlight.sel.color.foreground=black
|
34
|
+
#hightlight.sel.color.background=#68f914
|
35
|
+
#hightlight.sel.borderwidth=1
|
36
|
+
#hightlight.sel.relief=raised
|
37
|
+
#hightlight.selected.color.background=yellow
|
38
|
+
#hightlight.tabs.color.foreground=black
|
39
|
+
#hightlight.tabs.color.background=#b1cfba
|
40
|
+
#hightlight.tabs.borderwidth=1
|
41
|
+
#hightlight.tabs.relief=raised
|
42
|
+
#hightlight.spaces.color.foreground=black
|
43
|
+
#hightlight.spaces.color.background=#d9f42b
|
44
|
+
#hightlight.spaces.borderwidth=1
|
45
|
+
#hightlight.spaces.relief=raised
|
46
|
+
#+--------------------------------------------------
|
33
47
|
|
34
|
-
|
48
|
+
# custom classes
|
49
|
+
hightlight.keyword.foreground=>>>hightlight.5.foreground
|
35
50
|
hightlight.keyword.style=bold
|
36
|
-
hightlight.method_name.
|
51
|
+
hightlight.method_name.foreground=>>>hightlight.6.foreground
|
37
52
|
hightlight.method_name.style=bold
|
38
|
-
hightlight.class_name.
|
53
|
+
hightlight.class_name.foreground=>>>hightlight.7.foreground
|
39
54
|
hightlight.class_name.style=bold
|
40
|
-
hightlight.module_name.
|
55
|
+
hightlight.module_name.foreground=>>>hightlight.8.foreground
|
41
56
|
hightlight.module_name.style=bold
|
42
|
-
hightlight.instance_variable.
|
43
|
-
hightlight.global_variable.style=bold
|
44
|
-
hightlight.global_variable.color.foreground=#db66ca
|
57
|
+
hightlight.instance_variable.foreground=>>>hightlight.9.foreground
|
45
58
|
hightlight.instance_variable.style=bold
|
46
|
-
hightlight.
|
47
|
-
hightlight.
|
48
|
-
hightlight.
|
49
|
-
|
50
|
-
hightlight.
|
59
|
+
hightlight.global_variable.foreground=>>>hightlight.10.foreground
|
60
|
+
hightlight.global_variable.style=bold
|
61
|
+
hightlight.comment.foreground=>>>hightlight.11.foreground
|
62
|
+
hightlight.string.foreground=>>>hightlight.12.foreground
|
63
|
+
hightlight.number.foreground=>>>hightlight.13.foreground
|
64
|
+
hightlight.operator.foreground=>>>hightlight.14.foreground
|
51
65
|
hightlight.operator.style=bold
|
52
|
-
hightlight.symbol.
|
66
|
+
hightlight.symbol.foreground=>>>hightlight.15.foreground
|
53
67
|
hightlight.symbol.style=bold
|
54
|
-
|
55
|
-
|
56
|
-
hightlight.
|
57
|
-
hightlight.
|
68
|
+
|
69
|
+
|
70
|
+
#hightlight.keyword.color.foreground=#00007F
|
71
|
+
#hightlight.keyword.style=bold
|
72
|
+
#hightlight.method_name.color.foreground=#007F7F
|
73
|
+
#hightlight.method_name.style=bold
|
74
|
+
#hightlight.class_name.color.foreground=#0000FF
|
75
|
+
#hightlight.class_name.style=bold
|
76
|
+
#hightlight.module_name.color.foreground=#0000FF
|
77
|
+
#hightlight.module_name.style=bold
|
78
|
+
#hightlight.instance_variable.color.foreground=#7F7F7F
|
79
|
+
#hightlight.instance_variable.style=bold
|
80
|
+
#hightlight.global_variable.style=bold
|
81
|
+
#hightlight.global_variable.color.foreground=#db66ca
|
82
|
+
#hightlight.comment.color.foreground=#007F00
|
83
|
+
#hightlight.string.color.foreground=#7F007F
|
84
|
+
#hightlight.number.color.foreground=#007F7F
|
85
|
+
#hightlight.capitalize.color.foreground=#0000FF
|
86
|
+
#hightlight.operator.color.foreground=#000000
|
87
|
+
#hightlight.operator.style=bold
|
88
|
+
#hightlight.symbol.color.foreground=#bdc175
|
89
|
+
#hightlight.symbol.style=bold
|
90
|
+
#hightlight.sel.color.foreground=black
|
91
|
+
#hightlight.sel.color.background=#68f914
|
92
|
+
#hightlight.sel.borderwidth=1
|
93
|
+
#hightlight.sel.relief=raised
|
58
94
|
#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
|
95
|
+
#hightlight.selected.color.background=yellow
|
96
|
+
#hightlight.tabs.color.foreground=black
|
97
|
+
#hightlight.tabs.color.background=#b1cfba
|
98
|
+
#hightlight.tabs.borderwidth=1
|
99
|
+
#hightlight.tabs.relief=raised
|
100
|
+
#hightlight.spaces.color.foreground=black
|
101
|
+
#hightlight.spaces.color.background=#d9f42b
|
102
|
+
#hightlight.spaces.borderwidth=1
|
103
|
+
#hightlight.spaces.relief=raised
|
@@ -1 +1 @@
|
|
1
|
-
bind=rb
|
1
|
+
bind=rb
|
@@ -1,45 +1,46 @@
|
|
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.
|
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
|
-
|
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.console(self, 'msg'=>message, 'channel'=>'CH1')
|
17
|
+
#Arcadia.new_msg(self, message, 'CH1')
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
def event_message(_event, _ind="")
|
23
|
+
message = _ind
|
24
|
+
if _event.is_action?
|
25
|
+
message = message + 'ACTION::'
|
26
|
+
end
|
27
|
+
message = message +_event.signature+" :\n"
|
28
|
+
if _event.context
|
29
|
+
_event.context.instance_variables.sort.each do |key|
|
30
|
+
_obj_value = _event.context.send(key.gsub('@',''))
|
31
|
+
_value = _obj_value
|
32
|
+
if _value == nil
|
33
|
+
_value = 'nil'
|
34
|
+
else !_value.instance_of?(String)
|
35
|
+
_value = _value.to_s
|
36
|
+
end
|
37
|
+
message = message + _ind + "\s"*2 + key+' = '+_value+"\n"
|
38
|
+
if _obj_value != nil && _obj_value.kind_of?(ArcadiaContract::ContractEvent)
|
39
|
+
message = message + event_message(_obj_value, _ind+"\s"*4)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
return message
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
@@ -1,298 +1,373 @@
|
|
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
|
62
|
-
include Autils
|
63
|
-
attr_reader :htree
|
64
|
-
|
65
|
-
def
|
66
|
-
@
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
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
|
-
#
|
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
|
-
|
211
|
-
|
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
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
end
|
297
|
-
|
298
|
-
end
|
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 FilesHistrory < ArcadiaExt
|
62
|
+
include Autils
|
63
|
+
attr_reader :htree
|
64
|
+
|
65
|
+
def sync_on
|
66
|
+
@sync = true
|
67
|
+
select_file_without_event(@last_file) if @last_file
|
68
|
+
|
69
|
+
#Arcadia.attach_listener(self, BufferRaisedEvent)
|
70
|
+
end
|
71
|
+
|
72
|
+
def sync_off
|
73
|
+
@sync = false
|
74
|
+
#Arcadia.detach_listener(self, BufferRaisedEvent)
|
75
|
+
end
|
76
|
+
|
77
|
+
def on_before_build(_event)
|
78
|
+
Arcadia.attach_listener(self, BufferRaisedEvent)
|
79
|
+
end
|
80
|
+
|
81
|
+
def on_build(_event)
|
82
|
+
@h_stack = Array.new
|
83
|
+
@cb_sync = TkCheckButton.new(self.frame.hinner_frame, Arcadia.style('checkbox')){
|
84
|
+
text 'Sync'
|
85
|
+
justify 'left'
|
86
|
+
variable 1
|
87
|
+
#command do_check
|
88
|
+
place('x' => 0,'y' => 0,'height' => 22)
|
89
|
+
}
|
90
|
+
|
91
|
+
do_check = proc {
|
92
|
+
if @cb_sync.cget('onvalue')==@cb_sync.cget('variable').value.to_i
|
93
|
+
sync_on
|
94
|
+
else
|
95
|
+
sync_off
|
96
|
+
end
|
97
|
+
}
|
98
|
+
@sync = false
|
99
|
+
@cb_sync.command(do_check)
|
100
|
+
|
101
|
+
do_select_item = proc{|_self|
|
102
|
+
if _self.selection_get[0].length >0
|
103
|
+
_selected = ""
|
104
|
+
_self.selection_get[0].each{|_block|
|
105
|
+
_selected = _selected + _block.to_s + "\s"
|
106
|
+
}
|
107
|
+
_selected = _selected.strip
|
108
|
+
else
|
109
|
+
_selected = _self.selection_get[0]
|
110
|
+
end
|
111
|
+
_dir, _file = _selected.split('@@@')
|
112
|
+
if _file
|
113
|
+
_file = File.expand_path( _file , _dir )
|
114
|
+
else
|
115
|
+
_file = Tk.getOpenFile('initialdir'=>_dir)
|
116
|
+
end
|
117
|
+
if _file
|
118
|
+
Arcadia.process_event(OpenBufferEvent.new(self,'file'=>_file))
|
119
|
+
#EditorContract.instance.open_file(self,'file'=>_file)
|
120
|
+
end
|
121
|
+
}
|
122
|
+
# _background = conf('color.background')
|
123
|
+
# _foreground = conf('color.foreground')
|
124
|
+
@font = Arcadia.conf('treeitem.font')
|
125
|
+
@font_b = "#{Arcadia.conf('treeitem.font')} bold"
|
126
|
+
|
127
|
+
@htree = Tk::BWidget::Tree.new(self.frame.hinner_frame, Arcadia.style('treepanel')){
|
128
|
+
#relief 'flat'
|
129
|
+
showlines false
|
130
|
+
deltay 18
|
131
|
+
#background _background
|
132
|
+
#crossfill _foreground
|
133
|
+
#dragenabled true
|
134
|
+
selectcommand proc{ do_select_item.call(self) }
|
135
|
+
place('relwidth' => 1,'relheight' => '1', 'x' => '0','y' => '22', 'height' => -22)
|
136
|
+
}
|
137
|
+
_scrollcommand = proc{|*args| @htree.yview(*args)}
|
138
|
+
_scrollbar = TkScrollbar.new(self.frame.hinner_frame, Arcadia.style('scrollbar')){|s|
|
139
|
+
width 8
|
140
|
+
command _scrollcommand
|
141
|
+
}.pack('side'=>'right', 'fill'=>'y')
|
142
|
+
@htree.yscrollcommand proc{|first,last| _scrollbar.set(first,last)}
|
143
|
+
|
144
|
+
self.build_tree
|
145
|
+
end
|
146
|
+
|
147
|
+
def on_after_build(_event)
|
148
|
+
#ArcadiaContractListener.new(self, EditorContract, :do_editor_event)
|
149
|
+
Arcadia.attach_listener(self, OpenBufferEvent)
|
150
|
+
end
|
151
|
+
|
152
|
+
def history_file
|
153
|
+
if !defined?(@arcadia_history_file)
|
154
|
+
@arcadia_history_file = @arcadia.local_dir+'/'+conf('file.name')
|
155
|
+
end
|
156
|
+
return @arcadia_history_file
|
157
|
+
end
|
158
|
+
|
159
|
+
def on_after_open_buffer(_event)
|
160
|
+
#Arcadia.new_error_msg(self, "on_after_open_buffer _event.file=#{_event.file}")
|
161
|
+
|
162
|
+
if _event.file
|
163
|
+
self.add2history(_event.file)
|
164
|
+
add_to_tree(_event.file)
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
def select_file_without_event(_file)
|
169
|
+
_d, _f = File.split(File.expand_path(_file))
|
170
|
+
_d = _d.downcase if is_windows?
|
171
|
+
_f = _f.downcase if is_windows?
|
172
|
+
_file_node_rif = _d+'@@@'+_f
|
173
|
+
if @htree.exist?(_file_node_rif)
|
174
|
+
_proc = @htree.selectcommand
|
175
|
+
@htree.selectcommand(proc{nil})
|
176
|
+
begin
|
177
|
+
parent = root.dir(_d)
|
178
|
+
@htree.selection_clear
|
179
|
+
@htree.selection_add(_file_node_rif)
|
180
|
+
#@htree.close_tree('root')
|
181
|
+
while !parent.nil? && parent.rif != 'root'
|
182
|
+
@htree.open_tree(parent.rif, false)
|
183
|
+
parent = parent.parent
|
184
|
+
end
|
185
|
+
@htree.see(_file_node_rif)
|
186
|
+
ensure
|
187
|
+
@htree.selectcommand(_proc)
|
188
|
+
end
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
def on_buffer_raised(_event)
|
193
|
+
return if _event.file.nil?
|
194
|
+
@last_file = _event.file
|
195
|
+
if @sync
|
196
|
+
select_file_without_event(_event.file)
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
# def do_editor_event(_event)
|
201
|
+
# case _event.signature
|
202
|
+
# when EditorContract::FILE_AFTER_OPEN
|
203
|
+
# if _event.context.file
|
204
|
+
# self.add2history(_event.context.file)
|
205
|
+
# add_to_tree(_event.context.file)
|
206
|
+
# end
|
207
|
+
# when EditorContract::FILE_AFTER_CLOSE
|
208
|
+
# if _event.context.file
|
209
|
+
# end
|
210
|
+
# end
|
211
|
+
# end
|
212
|
+
|
213
|
+
def root
|
214
|
+
if !defined?(@root)
|
215
|
+
@root = TreeNode.new(nil, 'KRoot'){|_node|
|
216
|
+
_node.rif= 'root'
|
217
|
+
_node.label=''
|
218
|
+
}
|
219
|
+
end
|
220
|
+
return @root
|
221
|
+
end
|
222
|
+
|
223
|
+
def build_tree
|
224
|
+
file_dir = Hash.new
|
225
|
+
nodes = Array.new
|
226
|
+
if File.exist?(history_file)
|
227
|
+
f = File::open(history_file,'r')
|
228
|
+
f_open = $arcadia['pers']['editor.files.open'].split("|") if $arcadia['pers']['editor.files.open']
|
229
|
+
begin
|
230
|
+
_lines = f.readlines.collect!{| line | line.chomp+"\n" }.to_s
|
231
|
+
_lines.sort.each{|_line|
|
232
|
+
_file = _line.split(';')[0]
|
233
|
+
if FileTest::exist?(_file)
|
234
|
+
dir,fil =File.split(File.expand_path(_file))
|
235
|
+
dir = dir.downcase if is_windows?
|
236
|
+
fil = fil.downcase if is_windows?
|
237
|
+
file_dir[dir] = Array.new if file_dir[dir] == nil
|
238
|
+
file_dir[dir] << fil if !file_dir[dir].include?(fil)
|
239
|
+
end
|
240
|
+
}
|
241
|
+
ensure
|
242
|
+
f.close unless f.nil?
|
243
|
+
end
|
244
|
+
end
|
245
|
+
|
246
|
+
file_dir.keys.sort.each{|_dir|
|
247
|
+
node = root.dir(_dir)
|
248
|
+
file_dir[_dir].each{|file|
|
249
|
+
TreeNode.new(node, 'KFile'){|_node|
|
250
|
+
_node.rif= _dir+'@@@'+file
|
251
|
+
_node.label=file
|
252
|
+
}
|
253
|
+
}
|
254
|
+
}
|
255
|
+
|
256
|
+
@image_kdir = TkPhotoImage.new('dat' => BOOK_GIF)
|
257
|
+
@image_kfile_rb = TkPhotoImage.new('dat' => RUBY_DOCUMENT_GIF)
|
258
|
+
@image_kfile = TkPhotoImage.new('dat' => DOCUMENT_GIF)
|
259
|
+
|
260
|
+
build_tree_from_node(root)
|
261
|
+
end
|
262
|
+
|
263
|
+
def add_to_tree(_file)
|
264
|
+
_d, _f = File.split(File.expand_path(_file))
|
265
|
+
#Arcadia.new_error_msg(self, "add_to_tree _file=#{_file}")
|
266
|
+
#Arcadia.new_error_msg(self, "add_to_tree _d=#{_d}")
|
267
|
+
#Arcadia.new_error_msg(self, "add_to_tree _f=#{_f}")
|
268
|
+
_d = _d.downcase if is_windows?
|
269
|
+
_f = _f.downcase if is_windows?
|
270
|
+
#_foreground = conf('color.foreground')
|
271
|
+
node = root.dir(_d)
|
272
|
+
if !@htree.exist?(node.rif)
|
273
|
+
#Arcadia.new_error_msg(self, "add_to_tree node.parent.rif=#{node.parent.rif}")
|
274
|
+
#Arcadia.new_error_msg(self, "add_to_tree node.rif=#{node.rif}")
|
275
|
+
@htree.insert('end', node.parent.rif ,node.rif, {
|
276
|
+
'text' => node.label,
|
277
|
+
'helptext' => node.rif,
|
278
|
+
'deltax'=>-1,
|
279
|
+
# 'fill' => _foreground,
|
280
|
+
# 'font'=>@font,
|
281
|
+
'image'=> image('KDir')
|
282
|
+
}.update(Arcadia.style('treeitem'))
|
283
|
+
)
|
284
|
+
end
|
285
|
+
_file_node_rif = _d+'@@@'+_f
|
286
|
+
if !@htree.exist?(_file_node_rif)
|
287
|
+
@htree.insert('end', node.rif ,_file_node_rif, {
|
288
|
+
'text' => _f ,
|
289
|
+
'helptext' => _f,
|
290
|
+
'deltax'=>-1,
|
291
|
+
#'fill' => _foreground,
|
292
|
+
#'font'=>@font_b,
|
293
|
+
'image'=> image('KFile',_f)
|
294
|
+
}.update(Arcadia.style('treeitem'))
|
295
|
+
)
|
296
|
+
end
|
297
|
+
|
298
|
+
end
|
299
|
+
|
300
|
+
def image(_kind, _label='.rb')
|
301
|
+
if _kind == 'KDir'
|
302
|
+
return @image_kdir
|
303
|
+
elsif _kind == 'KFile' && _label.include?('.rb')
|
304
|
+
return @image_kfile_rb
|
305
|
+
else
|
306
|
+
return @image_kfile
|
307
|
+
end
|
308
|
+
end
|
309
|
+
|
310
|
+
def build_tree_from_node(_node)
|
311
|
+
#_foreground = conf('color.foreground')
|
312
|
+
_sorted_sons = _node.sons.sort
|
313
|
+
for inode in 0.._sorted_sons.length - 1
|
314
|
+
_son = _sorted_sons[inode]
|
315
|
+
@htree.insert('end', _son.parent.rif ,_son.rif, {
|
316
|
+
'text' => _son.label ,
|
317
|
+
# 'fill' => _foreground,
|
318
|
+
'helptext' => _son.helptext,
|
319
|
+
'deltax'=>-1,
|
320
|
+
# 'font'=>@font,
|
321
|
+
'image'=> image(_son.kind, _son.label)
|
322
|
+
}.update(Arcadia.style('treeitem'))
|
323
|
+
)
|
324
|
+
build_tree_from_node(_son)
|
325
|
+
end
|
326
|
+
end
|
327
|
+
|
328
|
+
|
329
|
+
def add2history(_filename, _text_index='1.0')
|
330
|
+
if _filename
|
331
|
+
_filename = _filename.sub(Dir::pwd+'/',"")
|
332
|
+
_filename = File.expand_path(_filename)
|
333
|
+
_filename_index = _filename+";"+_text_index
|
334
|
+
#Arcadia.new_error_msg(self, "add2history _filename=#{_filename}")
|
335
|
+
#Arcadia.new_error_msg(self, "add2history history_file=#{history_file}")
|
336
|
+
|
337
|
+
if File.exist?(history_file)
|
338
|
+
f = File::open(history_file,'r')
|
339
|
+
begin
|
340
|
+
_lines = f.readlines.collect!{| line | line.chomp}
|
341
|
+
ensure
|
342
|
+
f.close unless f.nil?
|
343
|
+
end
|
344
|
+
f = File.new(history_file, "w")
|
345
|
+
begin
|
346
|
+
if f
|
347
|
+
_l= conf('length').to_i
|
348
|
+
f.syswrite(_filename_index+"\n")
|
349
|
+
_lines[0.._l-2].each{|_line|
|
350
|
+
_lfile = _line.split(';')
|
351
|
+
if _lfile
|
352
|
+
f.syswrite(_line+"\n") if (_lfile[0] != _filename)&&(_line.length > 0)
|
353
|
+
end
|
354
|
+
}
|
355
|
+
end
|
356
|
+
ensure
|
357
|
+
f.close unless f.nil?
|
358
|
+
end
|
359
|
+
else
|
360
|
+
dir,fil =File.split(File.expand_path(history_file))
|
361
|
+
if !File.exist?(dir)
|
362
|
+
Dir.mkdir(dir)
|
363
|
+
end
|
364
|
+
f = File.new(history_file, "w+")
|
365
|
+
begin
|
366
|
+
f.syswrite(_filename+"\n") if f
|
367
|
+
ensure
|
368
|
+
f.close unless f.nil?
|
369
|
+
end
|
370
|
+
end
|
371
|
+
end
|
372
|
+
end
|
373
|
+
end
|