arcadia 0.1.3 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. data/README +69 -77
  2. data/arcadia.rb +1097 -770
  3. data/base/a-commons.rb +480 -0
  4. data/base/a-contracts.rb +207 -322
  5. data/base/{a-utils.rb → a-tkcommons.rb} +933 -993
  6. data/conf/arcadia.conf +130 -203
  7. data/conf/arcadia.res.rb +1332 -1325
  8. data/ext/ae-action-dispatcher/ae-action-dispatcher.conf +6 -0
  9. data/ext/ae-action-dispatcher/ae-action-dispatcher.rb +22 -0
  10. data/ext/ae-complete-code/ae-complete-code.conf +2 -2
  11. data/ext/ae-complete-code/ae-complete-code.rb +82 -80
  12. data/ext/ae-doc-code/ae-doc-code.conf +2 -2
  13. data/ext/ae-doc-code/ae-doc-code.rb +114 -111
  14. data/ext/ae-editor/ae-editor.conf +110 -105
  15. data/ext/ae-editor/ae-editor.rb +2501 -2287
  16. data/ext/ae-editor/langs/conf.lang +15 -0
  17. data/ext/ae-editor/langs/lang.lang.bind +1 -0
  18. data/ext/ae-editor/langs/rb.lang +67 -0
  19. data/ext/ae-editor/langs/rbw.lang.bind +1 -0
  20. data/ext/ae-event-log/ae-event-log.rb +45 -52
  21. data/ext/ae-file-history/ae-file-history.conf +4 -4
  22. data/ext/ae-file-history/ae-file-history.rb +298 -286
  23. data/ext/ae-flag/ae-flag.conf +6 -6
  24. data/ext/ae-flag/ae-flag.rb +12 -12
  25. data/ext/ae-inspector/ae-inspector.conf +3 -3
  26. data/ext/ae-inspector/ae-inspector.rb +2 -2
  27. data/ext/ae-output-event/ae-output-event.conf +15 -15
  28. data/ext/ae-output/ae-output.conf +5 -3
  29. data/ext/ae-output/ae-output.rb +62 -33
  30. data/ext/ae-palette/ae-palette.conf +3 -3
  31. data/ext/ae-palette/ae-palette.rb +265 -306
  32. data/ext/ae-rad/ae-rad-inspector.rb +1534 -0
  33. data/{base/a-libs.rb → ext/ae-rad/ae-rad-libs.rb} +1118 -846
  34. data/ext/ae-rad/ae-rad-palette.rb +273 -0
  35. data/ext/ae-rad/ae-rad.conf +71 -0
  36. data/ext/ae-rad/ae-rad.rb +56 -0
  37. data/{lib → ext/ae-rad/lib}/tk/al-tk.rb +21 -110
  38. data/{lib → ext/ae-rad/lib}/tk/al-tk.res.rb +0 -0
  39. data/{lib → ext/ae-rad/lib}/tk/al-tkarcadia.rb +26 -26
  40. data/{lib → ext/ae-rad/lib}/tk/al-tkcustom.rb +70 -70
  41. data/{lib → ext/ae-rad/lib}/tkext/al-bwidget.rb +194 -194
  42. data/{lib → ext/ae-rad/lib}/tkext/al-iwidgets.rb +25 -25
  43. data/{lib → ext/ae-rad/lib}/tkext/al-tile.rb +173 -173
  44. data/{lib → ext/ae-rad/lib}/tkext/al-tktable.rb +0 -0
  45. data/ext/ae-ruby-debug/ae-ruby-debug.conf +7 -4
  46. data/ext/ae-ruby-debug/ae-ruby-debug.rb +278 -142
  47. data/ext/ae-search-in-files/ae-search-in-files.conf +15 -0
  48. data/ext/ae-search-in-files/ae-search-in-files.rb +284 -0
  49. data/ext/ae-shell/ae-shell.rb +88 -8
  50. data/ext/ae-shell/sh.rb +7 -0
  51. metadata +93 -79
  52. data/base/a-contracts-work.rb +0 -219
  53. data/base/a-ext.rb +0 -280
  54. data/ext/ae-debug/ae-debug.conf +0 -7
  55. data/ext/ae-debug/ae-debug.rb +0 -601
  56. data/ext/ae-debug/debug1.57.rb +0 -998
@@ -0,0 +1,6 @@
1
+ name=action_dispatcher
2
+ labels=Action dispatcher
3
+ #frames=1.1
4
+ active=yes
5
+ require=ext/ae-action-dispatcher/ae-action-dispatcher
6
+ class=ActionDispatcher
@@ -0,0 +1,22 @@
1
+ #
2
+ # ae-action-dispatcher.rb - Arcadia Ruby ide
3
+ # by Antonio Galeone <antonio-galeone@rubyforge.org>
4
+ #
5
+
6
+ class ActionDispatcher < ArcadiaExt
7
+
8
+ def on_before_build(_event)
9
+ Arcadia.add_listener(self, ActionEvent)
10
+ end
11
+
12
+ def on_action(_event)
13
+ if _event.receiver != nil && _event.receiver.respond_to?(_event.action)
14
+ if _event.action_args.nil?
15
+ _event.receiver.send(_event.action)
16
+ else
17
+ _event.receiver.send(_event.action, _event.action_args)
18
+ end
19
+ end
20
+ end
21
+
22
+ end
@@ -1,6 +1,6 @@
1
1
  name=complete_code
2
- label=Complete code
3
- frame=1.0
2
+ labels=Complete code
3
+ frames=1.0
4
4
  active=yes
5
5
  require=ext/ae-complete-code/ae-complete-code
6
6
  class=CompleteCode
@@ -1,80 +1,82 @@
1
- #
2
- # ae-complete-code.rb - Arcadia Ruby ide
3
- # by Antonio Galeone <antonio-galeone@rubyforge.org>
4
- #
5
-
6
- require "base/a-ext"
7
-
8
-
9
- class CompleteCode < ArcadiaExt
10
-
11
- def before_build
12
- end
13
-
14
- def build
15
- end
16
-
17
- def after_build
18
- @complete_command=full_command('rct-complete')
19
- @doc_command=full_command('rct-doc')
20
- @ri_command="ri -T -f plain"
21
- @finder_command="rct-meth-args -n" # ./a-libs.rb:741:AG#publish (_family, args = nil)
22
- if @complete_command !=nil #system(@rct_complete+" "+__FILE__)
23
- ArcadiaContractListener.new(self, EditorContract, :do_editor_event)
24
- else
25
- MsgContract.instance.out_error(self, "Warning: Extension ae-complete-code depend upon rct-complete(rcodetools) command (install it or update system path!)")
26
- end
27
- end
28
-
29
- def full_command(_command='rct-complete')
30
- _ret = nil
31
- RUBY_PLATFORM.include?('win32') ? _sep = ';':_sep=':'
32
- ENV['PATH'].split(_sep).each{|_path|
33
- _file = File.join(_path, _command)
34
- if FileTest.exist?(_file)
35
- _ret = _file
36
- end
37
- }
38
- _ret
39
- end
40
-
41
- def do_editor_event(_event)
42
- case _event.signature
43
- when EditorContract::COMPLETE_CODE
44
- if _event.context.file
45
- _event.context.candidates = candidates(_event.context.file, _event.context.line, _event.context.col)
46
- _event.handled(self)
47
- end
48
- end
49
- end
50
-
51
- def candidates(_file, _line, _col)
52
- begin
53
- _options = "--completion-class-info --line="+_line+" --column="+_col
54
- #_options = "--line="+_line+" --column="+_col
55
- _cmp_s = "|ruby "+@complete_command+" "+_options+" "+_file
56
- _ret = nil
57
- open(_cmp_s,"r") do
58
- |f|
59
- _ret = f.readlines.collect!{| line | line.chomp}
60
- #p _ret
61
- end
62
- if _ret.length == 0
63
- _cmp_s_d = _cmp_s+" 2>&1"
64
- _error = nil
65
- open(_cmp_s_d,"r") do
66
- |f|
67
- _error = f.readlines.collect!{| line | line.chomp}
68
- end
69
- if _error != nil && _error.length > 0
70
- MsgContract.instance.out_error(self, "Syntax error in current source")
71
- end
72
- end
73
- _ret
74
- rescue Exception => e
75
- MsgContract.instance.out_error(self, e.to_s)
76
- end
77
- end
78
-
79
- end
80
-
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.add_listener(self, CompleteCodeEvent)
17
+ #ArcadiaContractListener.new(self, EditorContract, :do_editor_event)
18
+ else
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
+ # _event.results << CompleteCodeEvent::CompleteCodeResult.new(self)
39
+ # _event.results[0].candidates = candidates(_event.file, _event.row, _event.col)
40
+ end
41
+ end
42
+
43
+ # def do_editor_event(_event)
44
+ # case _event.signature
45
+ # when EditorContract::COMPLETE_CODE
46
+ # if _event.context.file
47
+ # _event.context.candidates = candidates(_event.context.file, _event.context.line, _event.context.col)
48
+ # _event.handled(self)
49
+ # end
50
+ # end
51
+ # end
52
+
53
+ def candidates(_file, _line, _col)
54
+ begin
55
+ _options = "--completion-class-info --line="+_line+" --column="+_col
56
+ #_options = "--line="+_line+" --column="+_col
57
+ _cmp_s = "|ruby "+@complete_command+" "+_options+" "+_file
58
+ _ret = nil
59
+ open(_cmp_s,"r") do
60
+ |f|
61
+ _ret = f.readlines.collect!{| line | line.chomp}
62
+ #p _ret
63
+ end
64
+ if _ret.length == 0
65
+ _cmp_s_d = _cmp_s+" 2>&1"
66
+ _error = nil
67
+ open(_cmp_s_d,"r") do
68
+ |f|
69
+ _error = f.readlines.collect!{| line | line.chomp}
70
+ end
71
+ if _error != nil && _error.length > 0
72
+ Arcadia.new_error_msg(self, "Syntax error in current source")
73
+ end
74
+ end
75
+ _ret
76
+ rescue Exception => e
77
+ Arcadia.new_error_msg(self, e.to_s)
78
+ end
79
+ end
80
+
81
+ end
82
+
@@ -1,6 +1,6 @@
1
1
  name=doc_code
2
- label=Doc
3
- frame=1.0
2
+ labels=Doc
3
+ frames=1.0
4
4
  active=yes
5
5
  require=ext/ae-doc-code/ae-doc-code
6
6
  class=DocCode
@@ -3,27 +3,20 @@
3
3
  # by Antonio Galeone <antonio-galeone@rubyforge.org>
4
4
  #
5
5
 
6
- require "base/a-ext"
7
6
 
8
7
  class DocCode < ArcadiaExt
9
-
10
- def before_build
11
- end
12
-
13
- def build
14
- end
15
-
16
- def after_build
8
+ def on_after_build(_event)
17
9
  @doc_command=full_command('rct-doc')
18
10
  @doc_command=full_command('RCT-DOC') if @doc_command == nil
19
11
  @ri_command=full_command('ri')
20
12
  if @ri_command !=nil #system(@rct_complete+" "+__FILE__)
21
- ArcadiaContractListener.new(self, EditorContract, :do_editor_event)
13
+ Arcadia.add_listener(self, DocCodeEvent)
14
+ #ArcadiaContractListener.new(self, EditorContract, :do_editor_event)
22
15
  else
23
- MsgContract.instance.out_error(self, "Extension ae-doc-code depend upon ri command!")
16
+ Arcadia.new_error_msg(self, "Extension ae-doc-code depend upon ri command!")
24
17
  end
25
18
  if @doc_command == nil #system(@rct_complete+" "+__FILE__)
26
- MsgContract.instance.out_error(self, "Warning: Extension ae-doc-code depend upon rct-doc command!")
19
+ Arcadia.new_error_msg(self, "Warning: Extension ae-doc-code depend upon rct-doc command!")
27
20
  end
28
21
  end
29
22
 
@@ -38,34 +31,117 @@ class DocCode < ArcadiaExt
38
31
  }
39
32
  _ret
40
33
  end
41
-
42
- def do_editor_event(_event)
43
- case _event.signature
44
- when EditorContract::DOC_CODE
45
- if _event.context.file && @doc_command != nil
46
- _event.context.doc = doc(_event.context)
47
- if _event.context.doc != nil && _event.context.doc.length >0
48
- raise_doc_code(_event.context)
49
- # else
50
- # build_doc_tree
51
- end
52
- elsif _event.context.doc_entry
53
- _event.context.doc = doc_entry(_event.context.doc_entry)
54
- _event.context.text = _event.context.doc_entry
55
- if _event.context.doc != nil && _event.context.doc.length >0
56
- raise_doc_code(_event.context)
57
- # else
58
- # build_doc_tree
59
- end
60
- # elsif _event.context.file && @doc_command == nil
61
- # build_doc_tree
62
- end
63
- _event.handled(self)
64
- when EditorContract::BUILD_DOC_TREE
65
- build_doc_tree
66
- end
34
+
35
+ def on_doc_code(_event)
36
+ if _event.file && @doc_command != nil
37
+ res = _event.add_result(self)
38
+ res.doc = doc(_event)
39
+ elsif _event.doc_entry
40
+ _event.add_result(self, 'doc'=>doc_entry(_event.doc_entry),'title'=>_event.doc_entry)
41
+ end
42
+ end
43
+
44
+ def on_after_doc_code(_event)
45
+ res = _event.results[0]
46
+ if res !=nil && res.doc != nil && res.doc.length >0
47
+ raise_doc_code(_event)
48
+ end
49
+ end
50
+
51
+ def raise_doc_code(_context)
52
+ if @docFrame
53
+ @docFrame.tkText.delete('1.0','end')
54
+ else
55
+ _height = 140
56
+ _width = 550
57
+ _context.xdoc = TkWinfo.screenwidth(@arcadia.layout.root)/2 if !_context.xdoc
58
+ _context.ydoc = TkWinfo.screenheight(@arcadia.layout.root)/2 if !_context.ydoc
59
+ _x = _context.xdoc - _width/2
60
+ _y = _context.ydoc - _height -20
61
+ _x = 0 if _x < 0
62
+ _y = 0 if _y < 0
63
+ @docFrame = TkDocframe.new(@arcadia.layout.root).place('x'=>_x, 'y'=>_y, 'width'=>_width, 'height'=>_height)
64
+ do_close = proc{
65
+ @docFrame.destroy
66
+ @docFrame = nil
67
+ Tk.callback_break
68
+ }
69
+ @docFrame.on_close = do_close
70
+ @docFrame.tkText.bind_append('KeyPress'){|e|
71
+ case e.keysym
72
+ when 'Escape'
73
+ do_close.call
74
+ end
75
+ }
76
+ @docFrame.tkText.font(conf('font'))
77
+ @docFrame.tkText.foreground(conf('color.foreground'))
78
+ @docFrame.tkText.background(conf('color.background'))
79
+ end
80
+ res = _context.results[0]
81
+ if res.doc
82
+ @docFrame.tkText.insert('end', res.doc.to_s)
83
+ @docFrame.title(res.title) if res.title
84
+ else
85
+ Arcadia.new_msg(self, 'nulla di dire !')
86
+ end
67
87
  end
68
88
 
89
+ def doc_entry(_entry=nil)
90
+ _ret = nil
91
+ if _entry
92
+ _cmp_doc = "|ruby "+@ri_command+" -T -f plain "+_entry
93
+ open (_cmp_doc) do |f|
94
+ _ret = f.readlines
95
+ end
96
+ end
97
+ _ret
98
+ end
99
+
100
+ def doc(_context)
101
+ begin
102
+ _options = "--line="+_context.row+" --column="+_context.col
103
+ _cmp_s = "|ruby " + @doc_command +" --use-method-analyzer "+_options +" " +_context.file
104
+ _ret = nil
105
+ _doc = nil
106
+ open(_cmp_s,"r") do
107
+ |f|
108
+ _doc = f.readlines.collect!{| line | line.chomp}.to_s.strip
109
+ end
110
+ if _doc.length > 0
111
+ _context.results[0].title = _doc.to_s if _context.results[0]
112
+ _ret = doc_entry(_context.results[0].title)
113
+ end
114
+ _ret
115
+
116
+ rescue Exception => e
117
+ _msg = e.to_s + "\n"
118
+ e.backtrace.each{|line| _msg = _msg + line + "\n"}
119
+ Arcadia.new_error_msg(self, _msg)
120
+ end
121
+ end
122
+
123
+
124
+ # def do_editor_event(_event)
125
+ # case _event.signature
126
+ # when EditorContract::DOC_CODE
127
+ # if _event.context.file && @doc_command != nil
128
+ # _event.context.doc = doc(_event.context)
129
+ # if _event.context.doc != nil && _event.context.doc.length >0
130
+ # raise_doc_code(_event.context)
131
+ # end
132
+ # elsif _event.context.doc_entry
133
+ # _event.context.doc = doc_entry(_event.context.doc_entry)
134
+ # _event.context.text = _event.context.doc_entry
135
+ # if _event.context.doc != nil && _event.context.doc.length >0
136
+ # raise_doc_code(_event.context)
137
+ # end
138
+ # end
139
+ # _event.handled(self)
140
+ # when EditorContract::BUILD_DOC_TREE
141
+ # build_doc_tree
142
+ # end
143
+ # end
144
+
69
145
  def build_doc_tree
70
146
  if !@doc_tree
71
147
  @image_class = TkPhotoImage.new('dat' => ARROW_RIGHT_GIF)
@@ -194,79 +270,6 @@ class DocCode < ArcadiaExt
194
270
  )
195
271
  @level = @level + 1
196
272
  end
197
-
198
- def raise_doc_code(_context)
199
- if @docFrame
200
- @docFrame.tkText.delete('1.0','end')
201
- else
202
- _height = 140
203
- _width = 550
204
- _context.xdoc = TkWinfo.screenwidth(@arcadia.layout.root)/2 if !_context.xdoc
205
- _context.ydoc = TkWinfo.screenheight(@arcadia.layout.root)/2 if !_context.ydoc
206
- _x = _context.xdoc - _width/2
207
- _y = _context.ydoc - _height -20
208
- @docFrame = TkDocframe.new(@arcadia.layout.root).place('x'=>_x, 'y'=>_y, 'width'=>_width, 'height'=>_height)
209
- do_close = proc{
210
- @docFrame.destroy
211
- @docFrame = nil
212
- Tk.callback_break
213
- }
214
- @docFrame.on_close = do_close
215
- @docFrame.tkText.bind_append('KeyPress'){|e|
216
- case e.keysym
217
- when 'Escape'
218
- do_close.call
219
- end
220
- }
221
- @docFrame.tkText.font(conf('font'))
222
- @docFrame.tkText.foreground(conf('color.foreground'))
223
- @docFrame.tkText.background(conf('color.background'))
224
- end
225
-
226
- if _context.doc
227
- @docFrame.tkText.insert('end', _context.doc.to_s)
228
- @docFrame.title(_context.text) if _context.text
229
- else
230
- MsgContract.instance.out_simple(self, 'nulla di dire !')
231
- end
232
- end
233
-
234
-
235
-
236
- def doc_entry(_entry=nil)
237
- _ret = nil
238
- if _entry
239
- _cmp_doc = "|ruby "+@ri_command+" -T -f plain "+_entry
240
- open (_cmp_doc) do |f|
241
- _ret = f.readlines
242
- end
243
- end
244
- _ret
245
- end
246
-
247
- def doc(_context)
248
- begin
249
- _options = "--line="+_context.line+" --column="+_context.col
250
- _cmp_s = "|ruby " + @doc_command +" --use-method-analyzer "+_options +" " +_context.file
251
- _ret = nil
252
- _doc = nil
253
- open(_cmp_s,"r") do
254
- |f|
255
- _doc = f.readlines.collect!{| line | line.chomp}.to_s.strip
256
- end
257
- if _doc.length > 0
258
- _context.text = _doc.to_s
259
- _ret = doc_entry(_context.text)
260
- end
261
- _ret
262
-
263
- rescue Exception => e
264
- _msg = e.to_s + "\n"
265
- e.backtrace.each{|line| _msg = _msg + line + "\n"}
266
- MsgContract.instance.out_error(self, _msg)
267
- end
268
- end
269
-
270
273
  end
271
274
 
272
275
  class TkDocframe < TkFloatTitledFrame