arcadia 0.3.1 → 0.4.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 (179) hide show
  1. data/README +9 -5
  2. data/bin/arcadia +13 -13
  3. data/bin/arcadia.bat +1 -0
  4. data/conf/arcadia.conf +6 -5
  5. data/conf/arcadia.init.rb +34 -34
  6. data/conf/arcadia.res.rb +6 -0
  7. data/ext/ae-breakpoints/ae-breakpoints.conf +10 -0
  8. data/ext/ae-breakpoints/ae-breakpoints.rb +349 -0
  9. data/ext/ae-complete-code/ae-complete-code.conf +0 -0
  10. data/ext/ae-complete-code/ae-complete-code.rb +74 -76
  11. data/ext/ae-doc-code/ae-doc-code.conf +15 -15
  12. data/ext/ae-doc-code/ae-doc-code.rb +300 -295
  13. data/ext/ae-editor/ae-editor.conf +4 -4
  14. data/ext/ae-editor/ae-editor.rb +450 -140
  15. data/ext/ae-editor/langs/conf.lang +0 -0
  16. data/ext/ae-editor/langs/lang.lang.bind +0 -0
  17. data/ext/ae-editor/langs/rb.lang +0 -0
  18. data/ext/ae-editor/langs/rbw.lang.bind +0 -0
  19. data/ext/ae-event-log/ae-event-log.conf +0 -0
  20. data/ext/ae-event-log/ae-event-log.rb +0 -0
  21. data/ext/ae-file-history/ae-file-history.conf +0 -0
  22. data/ext/ae-file-history/ae-file-history.rb +437 -373
  23. data/ext/ae-flag/ae-flag.conf +0 -0
  24. data/ext/ae-flag/ae-flag.rb +0 -0
  25. data/ext/ae-output-event/ae-output-event.conf +0 -0
  26. data/ext/ae-output/ae-output.conf +0 -0
  27. data/ext/ae-output/ae-output.rb +0 -0
  28. data/ext/ae-rad/ae-rad-inspector.rb +0 -0
  29. data/ext/ae-rad/ae-rad-libs.rb +0 -0
  30. data/ext/ae-rad/ae-rad-palette.rb +0 -0
  31. data/ext/ae-rad/ae-rad.conf +0 -0
  32. data/ext/ae-rad/ae-rad.rb +0 -0
  33. data/ext/ae-rad/lib/tk/al-tk.rb +4 -4
  34. data/ext/ae-rad/lib/tk/al-tk.res.rb +0 -0
  35. data/ext/ae-rad/lib/tk/al-tkarcadia.rb +25 -26
  36. data/ext/ae-rad/lib/tk/al-tkcustom.rb +0 -0
  37. data/ext/ae-rad/lib/tkext/al-bwidget.rb +0 -0
  38. data/ext/ae-rad/lib/tkext/al-iwidgets.rb +0 -0
  39. data/ext/ae-rad/lib/tkext/al-tile.rb +0 -0
  40. data/ext/ae-rad/lib/tkext/al-tktable.rb +0 -0
  41. data/ext/ae-ruby-debug/ae-ruby-debug.conf +0 -0
  42. data/ext/ae-ruby-debug/ae-ruby-debug.rb +1589 -1566
  43. data/ext/ae-search-in-files/ae-search-in-files.conf +0 -0
  44. data/ext/ae-search-in-files/ae-search-in-files.rb +0 -0
  45. data/ext/ae-shell/ae-shell.conf +0 -0
  46. data/ext/ae-shell/ae-shell.rb +0 -0
  47. data/ext/ae-shell/sh.rb +0 -0
  48. data/lib/a-commons.rb +27 -8
  49. data/lib/a-contracts.rb +3 -1
  50. data/lib/a-core.rb +33 -12
  51. data/lib/a-tkcommons.rb +17 -1
  52. data/tcl/BWidget-1.8.0/BWman/ArrowButton.html +0 -0
  53. data/tcl/BWidget-1.8.0/BWman/BWidget.html +0 -0
  54. data/tcl/BWidget-1.8.0/BWman/Button.html +0 -0
  55. data/tcl/BWidget-1.8.0/BWman/ButtonBox.html +0 -0
  56. data/tcl/BWidget-1.8.0/BWman/ComboBox.html +0 -0
  57. data/tcl/BWidget-1.8.0/BWman/Dialog.html +0 -0
  58. data/tcl/BWidget-1.8.0/BWman/DragSite.html +0 -0
  59. data/tcl/BWidget-1.8.0/BWman/DropSite.html +0 -0
  60. data/tcl/BWidget-1.8.0/BWman/DynamicHelp.html +0 -0
  61. data/tcl/BWidget-1.8.0/BWman/Entry.html +0 -0
  62. data/tcl/BWidget-1.8.0/BWman/Label.html +0 -0
  63. data/tcl/BWidget-1.8.0/BWman/LabelEntry.html +0 -0
  64. data/tcl/BWidget-1.8.0/BWman/LabelFrame.html +0 -0
  65. data/tcl/BWidget-1.8.0/BWman/ListBox.html +0 -0
  66. data/tcl/BWidget-1.8.0/BWman/MainFrame.html +0 -0
  67. data/tcl/BWidget-1.8.0/BWman/MessageDlg.html +0 -0
  68. data/tcl/BWidget-1.8.0/BWman/NoteBook.html +0 -0
  69. data/tcl/BWidget-1.8.0/BWman/PagesManager.html +0 -0
  70. data/tcl/BWidget-1.8.0/BWman/PanedWindow.html +0 -0
  71. data/tcl/BWidget-1.8.0/BWman/PanelFrame.html +0 -0
  72. data/tcl/BWidget-1.8.0/BWman/PasswdDlg.html +0 -0
  73. data/tcl/BWidget-1.8.0/BWman/ProgressBar.html +0 -0
  74. data/tcl/BWidget-1.8.0/BWman/ProgressDlg.html +0 -0
  75. data/tcl/BWidget-1.8.0/BWman/ScrollView.html +0 -0
  76. data/tcl/BWidget-1.8.0/BWman/ScrollableFrame.html +0 -0
  77. data/tcl/BWidget-1.8.0/BWman/ScrolledWindow.html +0 -0
  78. data/tcl/BWidget-1.8.0/BWman/SelectColor.html +0 -0
  79. data/tcl/BWidget-1.8.0/BWman/SelectFont.html +0 -0
  80. data/tcl/BWidget-1.8.0/BWman/Separator.html +0 -0
  81. data/tcl/BWidget-1.8.0/BWman/SpinBox.html +0 -0
  82. data/tcl/BWidget-1.8.0/BWman/StatusBar.html +0 -0
  83. data/tcl/BWidget-1.8.0/BWman/TitleFrame.html +0 -0
  84. data/tcl/BWidget-1.8.0/BWman/Tree.html +0 -0
  85. data/tcl/BWidget-1.8.0/BWman/Widget.html +0 -0
  86. data/tcl/BWidget-1.8.0/BWman/contents.html +0 -0
  87. data/tcl/BWidget-1.8.0/BWman/index.html +0 -0
  88. data/tcl/BWidget-1.8.0/BWman/navtree.html +0 -0
  89. data/tcl/BWidget-1.8.0/BWman/options.htm +0 -0
  90. data/tcl/BWidget-1.8.0/CHANGES.txt +0 -0
  91. data/tcl/BWidget-1.8.0/ChangeLog +0 -0
  92. data/tcl/BWidget-1.8.0/LICENSE.txt +0 -0
  93. data/tcl/BWidget-1.8.0/README.txt +0 -0
  94. data/tcl/BWidget-1.8.0/arrow.tcl +0 -0
  95. data/tcl/BWidget-1.8.0/bitmap.tcl +0 -0
  96. data/tcl/BWidget-1.8.0/button.tcl +0 -0
  97. data/tcl/BWidget-1.8.0/buttonbox.tcl +0 -0
  98. data/tcl/BWidget-1.8.0/color.tcl +0 -0
  99. data/tcl/BWidget-1.8.0/combobox.tcl +0 -0
  100. data/tcl/BWidget-1.8.0/demo/basic.tcl +0 -0
  101. data/tcl/BWidget-1.8.0/demo/bwidget.xbm +0 -0
  102. data/tcl/BWidget-1.8.0/demo/demo.tcl +0 -0
  103. data/tcl/BWidget-1.8.0/demo/dnd.tcl +0 -0
  104. data/tcl/BWidget-1.8.0/demo/manager.tcl +0 -0
  105. data/tcl/BWidget-1.8.0/demo/select.tcl +0 -0
  106. data/tcl/BWidget-1.8.0/demo/tmpldlg.tcl +0 -0
  107. data/tcl/BWidget-1.8.0/demo/tree.tcl +0 -0
  108. data/tcl/BWidget-1.8.0/demo/x1.xbm +0 -0
  109. data/tcl/BWidget-1.8.0/dialog.tcl +0 -0
  110. data/tcl/BWidget-1.8.0/dragsite.tcl +0 -0
  111. data/tcl/BWidget-1.8.0/dropsite.tcl +0 -0
  112. data/tcl/BWidget-1.8.0/dynhelp.tcl +0 -0
  113. data/tcl/BWidget-1.8.0/entry.tcl +0 -0
  114. data/tcl/BWidget-1.8.0/font.tcl +0 -0
  115. data/tcl/BWidget-1.8.0/images/bold.gif +0 -0
  116. data/tcl/BWidget-1.8.0/images/copy.gif +0 -0
  117. data/tcl/BWidget-1.8.0/images/cut.gif +0 -0
  118. data/tcl/BWidget-1.8.0/images/dragfile.gif +0 -0
  119. data/tcl/BWidget-1.8.0/images/dragicon.gif +0 -0
  120. data/tcl/BWidget-1.8.0/images/error.gif +0 -0
  121. data/tcl/BWidget-1.8.0/images/file.gif +0 -0
  122. data/tcl/BWidget-1.8.0/images/folder.gif +0 -0
  123. data/tcl/BWidget-1.8.0/images/hourglass.gif +0 -0
  124. data/tcl/BWidget-1.8.0/images/info.gif +0 -0
  125. data/tcl/BWidget-1.8.0/images/italic.gif +0 -0
  126. data/tcl/BWidget-1.8.0/images/minus.xbm +0 -0
  127. data/tcl/BWidget-1.8.0/images/new.gif +0 -0
  128. data/tcl/BWidget-1.8.0/images/opcopy.xbm +0 -0
  129. data/tcl/BWidget-1.8.0/images/open.gif +0 -0
  130. data/tcl/BWidget-1.8.0/images/openfold.gif +0 -0
  131. data/tcl/BWidget-1.8.0/images/oplink.xbm +0 -0
  132. data/tcl/BWidget-1.8.0/images/opmove.xbm +0 -0
  133. data/tcl/BWidget-1.8.0/images/overstrike.gif +0 -0
  134. data/tcl/BWidget-1.8.0/images/palette.gif +0 -0
  135. data/tcl/BWidget-1.8.0/images/passwd.gif +0 -0
  136. data/tcl/BWidget-1.8.0/images/paste.gif +0 -0
  137. data/tcl/BWidget-1.8.0/images/plus.xbm +0 -0
  138. data/tcl/BWidget-1.8.0/images/print.gif +0 -0
  139. data/tcl/BWidget-1.8.0/images/question.gif +0 -0
  140. data/tcl/BWidget-1.8.0/images/redo.gif +0 -0
  141. data/tcl/BWidget-1.8.0/images/save.gif +0 -0
  142. data/tcl/BWidget-1.8.0/images/target.xbm +0 -0
  143. data/tcl/BWidget-1.8.0/images/underline.gif +0 -0
  144. data/tcl/BWidget-1.8.0/images/undo.gif +0 -0
  145. data/tcl/BWidget-1.8.0/images/warning.gif +0 -0
  146. data/tcl/BWidget-1.8.0/init.tcl +0 -0
  147. data/tcl/BWidget-1.8.0/label.tcl +0 -0
  148. data/tcl/BWidget-1.8.0/labelentry.tcl +0 -0
  149. data/tcl/BWidget-1.8.0/labelframe.tcl +0 -0
  150. data/tcl/BWidget-1.8.0/lang/da.rc +0 -0
  151. data/tcl/BWidget-1.8.0/lang/de.rc +0 -0
  152. data/tcl/BWidget-1.8.0/lang/en.rc +0 -0
  153. data/tcl/BWidget-1.8.0/lang/es.rc +0 -0
  154. data/tcl/BWidget-1.8.0/lang/fr.rc +0 -0
  155. data/tcl/BWidget-1.8.0/listbox.tcl +0 -0
  156. data/tcl/BWidget-1.8.0/mainframe.tcl +0 -0
  157. data/tcl/BWidget-1.8.0/messagedlg.tcl +0 -0
  158. data/tcl/BWidget-1.8.0/notebook.tcl +0 -0
  159. data/tcl/BWidget-1.8.0/pagesmgr.tcl +0 -0
  160. data/tcl/BWidget-1.8.0/panedw.tcl +0 -0
  161. data/tcl/BWidget-1.8.0/panelframe.tcl +0 -0
  162. data/tcl/BWidget-1.8.0/passwddlg.tcl +0 -0
  163. data/tcl/BWidget-1.8.0/pkgIndex.tcl +0 -0
  164. data/tcl/BWidget-1.8.0/progressbar.tcl +0 -0
  165. data/tcl/BWidget-1.8.0/progressdlg.tcl +0 -0
  166. data/tcl/BWidget-1.8.0/scrollframe.tcl +0 -0
  167. data/tcl/BWidget-1.8.0/scrollview.tcl +0 -0
  168. data/tcl/BWidget-1.8.0/scrollw.tcl +0 -0
  169. data/tcl/BWidget-1.8.0/separator.tcl +0 -0
  170. data/tcl/BWidget-1.8.0/spinbox.tcl +0 -0
  171. data/tcl/BWidget-1.8.0/statusbar.tcl +0 -0
  172. data/tcl/BWidget-1.8.0/tests/entry.test +0 -0
  173. data/tcl/BWidget-1.8.0/titleframe.tcl +0 -0
  174. data/tcl/BWidget-1.8.0/tree.tcl +0 -0
  175. data/tcl/BWidget-1.8.0/utils.tcl +0 -0
  176. data/tcl/BWidget-1.8.0/widget.tcl +0 -0
  177. data/tcl/BWidget-1.8.0/wizard.tcl +0 -0
  178. data/tcl/BWidget-1.8.0/xpm2image.tcl +0 -0
  179. metadata +158 -154
@@ -1,76 +1,74 @@
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
+ #
2
+ # ae-complete-code.rb - Arcadia Ruby ide
3
+ # by Antonio Galeone <antonio-galeone@rubyforge.org>
4
+ #
5
+
6
+
7
+ class CompleteCode < ArcadiaExt
8
+ def on_after_build(_event)
9
+ @complete_command=full_command('rct-complete')
10
+ @doc_command=full_command('rct-doc')
11
+ @ri_command="ri -T -f plain"
12
+ @finder_command="rct-meth-args -n"
13
+ if @complete_command !=nil #system(@rct_complete+" "+__FILE__)
14
+ Arcadia.attach_listener(self, CompleteCodeEvent)
15
+ else
16
+ Arcadia.console(self, 'msg'=>"Warning: Extension ae-complete-code depend upon rct-complete(rcodetools) command (install it or update system path!)", 'level'=>'error')
17
+ #Arcadia.new_error_msg(self, "Warning: Extension ae-complete-code depend upon rct-complete(rcodetools) command (install it or update system path!)")
18
+ end
19
+ end
20
+
21
+ def full_command(_command='rct-complete')
22
+ _ret = nil
23
+ RUBY_PLATFORM.include?('win32') ? _sep = ';':_sep=':'
24
+ ENV['PATH'].split(_sep).each{|_path|
25
+ _file = File.join(_path, _command)
26
+ if FileTest.exist?(_file)
27
+ _ret = _file
28
+ end
29
+ }
30
+ _ret
31
+ end
32
+
33
+ def on_complete_code(_event)
34
+ if _event.file
35
+ _event.add_result(self,'candidates'=>candidates(_event.file, _event.row, _event.col))
36
+ end
37
+ end
38
+
39
+ def enance(_file, line)
40
+
41
+ end
42
+
43
+ def candidates(_file, _line, _col)
44
+ begin
45
+ _options = "--completion-class-info --dev --fork --line="+_line+" --column="+_col
46
+ #_options = "--line="+_line+" --column="+_col
47
+ _cmp_s = "|ruby "+@complete_command+" "+_options+" "+_file
48
+ _ret = nil
49
+ open(_cmp_s,"r") do
50
+ |f|
51
+ _ret = f.readlines.collect!{| line | line.chomp}
52
+ #p _ret
53
+ end
54
+ if _ret.length == 0
55
+ _cmp_s_d = _cmp_s+" 2>&1"
56
+ _error = nil
57
+ open(_cmp_s_d,"r") do
58
+ |f|
59
+ _error = f.readlines.collect!{| line | line.chomp}
60
+ end
61
+ if _error != nil && _error.length > 0
62
+ Arcadia.console(self, 'msg'=>"Syntax error in current source", 'level'=>'error')
63
+ #Arcadia.new_error_msg(self, "Syntax error in current source")
64
+ end
65
+ end
66
+ _ret
67
+ rescue Exception => e
68
+ Arcadia.console(self, 'msg'=>e.to_s, 'level'=>'error')
69
+ #Arcadia.new_error_msg(self, e.to_s)
70
+ end
71
+ end
72
+
73
+ end
74
+
@@ -1,15 +1,15 @@
1
- name=doc_code
2
- labels=Doc
3
- frames=1.0
4
- active=yes
5
- require=ext/ae-doc-code/ae-doc-code
6
- class=DocCode
7
-
8
- font=courier 12
9
- font.bold=courier 12 bold
10
- freebsd::font=courier 12
11
- freebsd::font.bold=courier 12 bold
12
- win::font={Courier New} 9
13
- win::font.bold={Courier New} 9 bold
14
- color.background=#ffffc1
15
- color.foreground=#408080
1
+ name=doc_code
2
+ labels=Doc
3
+ frames=1.1
4
+ active=yes
5
+ require=ext/ae-doc-code/ae-doc-code
6
+ class=DocCode
7
+
8
+ font=courier 12
9
+ font.bold=courier 12 bold
10
+ freebsd::font=courier 12
11
+ freebsd::font.bold=courier 12 bold
12
+ win::font={Courier New} 9
13
+ win::font.bold={Courier New} 9 bold
14
+ color.background=#ffffc1
15
+ color.foreground=#408080
@@ -1,295 +1,300 @@
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
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
+
67
+ @docFrame = TkDocframe.new(self.frame)
68
+ # do_close = proc{
69
+ # @docFrame.tframe.destroy
70
+ # @docFrame = nil
71
+ # Tk.callback_break
72
+ # }
73
+ # @docFrame.tframe.on_close = do_close
74
+
75
+ @docFrame.tkText.bind_append('KeyPress'){|e|
76
+ case e.keysym
77
+ when 'Escape'
78
+ do_close.call
79
+ end
80
+ }
81
+ @docFrame.tkText.font(conf('font'))
82
+ @docFrame.tkText.foreground(conf('color.foreground'))
83
+ @docFrame.tkText.background(conf('color.background'))
84
+ end
85
+ res = _context.results[0]
86
+ if res.doc
87
+ @docFrame.tkText.insert('end', res.doc.to_s)
88
+ @docFrame.tframe.title(res.title) if res.title
89
+ else
90
+ Arcadia.console(self,'msg'=>'???')
91
+ #Arcadia.new_msg(self, 'nulla di dire !')
92
+ end
93
+ end
94
+
95
+ def doc_entry(_entry=nil)
96
+ _ret = nil
97
+ if _entry
98
+ _cmp_doc = "|ruby #{@ri_command} -T -f plain #{_entry}"
99
+ _cmp_doc = "|ruby "+@ri_command+" -T -f plain "+_entry
100
+ open (_cmp_doc) do |f|
101
+ _ret = f.readlines
102
+ end
103
+ end
104
+ _ret
105
+ end
106
+
107
+ def doc(_context)
108
+ begin
109
+ _options = "--line="+_context.row+" --column="+_context.col
110
+ _cmp_s = "|ruby " + @doc_command +" --use-method-analyzer "+_options +" " +_context.file
111
+ _ret = nil
112
+ _doc = nil
113
+ open(_cmp_s,"r") do
114
+ |f|
115
+ _doc = f.readlines.collect!{| line | line.chomp}.to_s.strip
116
+ end
117
+ if _doc.length > 0
118
+ _context.results[0].title = _doc.to_s if _context.results[0]
119
+ _ret = doc_entry(_context.results[0].title)
120
+ end
121
+ _ret
122
+
123
+ rescue Exception => e
124
+ _msg = e.to_s + "\n"
125
+ e.backtrace.each{|line| _msg = _msg + line + "\n"}
126
+ Arcadia.console(self, 'msg'=>_msg, 'level'=>'error')
127
+ #Arcadia.new_error_msg(self, _msg)
128
+ end
129
+ end
130
+
131
+
132
+ # def do_editor_event(_event)
133
+ # case _event.signature
134
+ # when EditorContract::DOC_CODE
135
+ # if _event.context.file && @doc_command != nil
136
+ # _event.context.doc = doc(_event.context)
137
+ # if _event.context.doc != nil && _event.context.doc.length >0
138
+ # raise_doc_code(_event.context)
139
+ # end
140
+ # elsif _event.context.doc_entry
141
+ # _event.context.doc = doc_entry(_event.context.doc_entry)
142
+ # _event.context.text = _event.context.doc_entry
143
+ # if _event.context.doc != nil && _event.context.doc.length >0
144
+ # raise_doc_code(_event.context)
145
+ # end
146
+ # end
147
+ # _event.handled(self)
148
+ # when EditorContract::BUILD_DOC_TREE
149
+ # build_doc_tree
150
+ # end
151
+ # end
152
+
153
+ def build_doc_tree
154
+ if !@doc_tree
155
+ @image_class = TkPhotoImage.new('dat' => ARROW_RIGHT_GIF)
156
+ @image_def = TkPhotoImage.new('dat' => TREE_NODE_DEF_GIF)
157
+ @image_def_class = TkPhotoImage.new('dat' => TREE_NODE_DEFCLASS_GIF)
158
+ do_select_item = proc{|_self|
159
+ if _self.selection_get[0].length >0
160
+ _selected = rif_2_node(_self.selection_get[0])
161
+ end
162
+ if _selected
163
+ EditorContract.instance.doc_code(self, 'doc_entry'=>_selected)
164
+ end
165
+ }
166
+ _background = conf('color.background')
167
+ _foreground = conf('color.foreground')
168
+ @doc_tree = Tk::BWidget::Tree.new(self.frame){
169
+ relief 'flat'
170
+ showlines false
171
+ deltay 18
172
+ background _background
173
+ crossfill _foreground
174
+ selectcommand proc{ do_select_item.call(self) }
175
+ place('relwidth' => 1,'relx' => 0,'x' => '0','y' => '0','relheight' => '1')
176
+ }
177
+
178
+ _scrollcommand = proc{|*args| @doc_tree.yview(*args)}
179
+ _scrollbar = TkScrollbar.new(self.frame, Arcadia.style('scrollbar')){|s|
180
+ width 8
181
+ command _scrollcommand
182
+ }.pack('side'=>'right', 'fill'=>'y')
183
+ @doc_tree.yscrollcommand proc{|first,last| _scrollbar.set(first,last)}
184
+
185
+ names = doc_entry('--list-names')
186
+
187
+ @progress_bar = TkProgressframe.new(@arcadia.layout.root, names.length)
188
+ @progress_bar.title('Building doc')
189
+ @cancell=false
190
+ @progress_bar.on_cancel=proc{cancel}
191
+ #@hash_rif = Hash.new
192
+ @level = 0
193
+ @last_nodes = Array.new
194
+ Thread.new do
195
+ _last_value = ''
196
+ #p 'n�='+ names.length.to_s
197
+ names.sort.each do |value|
198
+ _value = value.chomp.strip
199
+ if _value != _last_value
200
+ node(_value)
201
+ @progress_bar.title(_value)
202
+ _last_value = _value
203
+ end
204
+ @progress_bar.progress
205
+ if @cancell
206
+ @progress_bar.destroy
207
+ @progress_bar = nil
208
+ break
209
+ end
210
+ end
211
+ progress_bar.destroy if @progress_bar != nil
212
+ end
213
+ end
214
+ end
215
+
216
+ def cancel
217
+ @cancell=true
218
+ end
219
+
220
+ def node_2_rif(_path)
221
+ return _path.gsub('#','@M@').gsub('::','@C@').gsub('|','@P@').gsub('^','@U@')
222
+ end
223
+
224
+ def rif_2_node(_rif)
225
+ return _rif.gsub('@M@','#').gsub('@C@', '::').gsub('@P@', '|').gsub('@U@', '^')
226
+ end
227
+
228
+ def node(_path)
229
+ # _rif = @hash_rif.length
230
+ _rif = node_2_rif(_path)
231
+ _parent_found = false
232
+ while !_parent_found && @level > 0 do
233
+ @level = @level - 1
234
+ if (@last_nodes[@level] != nil) && _path.include?(@last_nodes[@level])
235
+ _full_value = _path.sub(@last_nodes[@level],'')
236
+ if _full_value[0..1].include?('#')
237
+ _sep = '#'
238
+ _value = _full_value[1.._full_value.length-1]
239
+ _parent_found = true
240
+ elsif _full_value[0..2].include?('::')
241
+ _sep = '::'
242
+ _value = _full_value[2.._full_value.length-1]
243
+ _parent_found = true
244
+ else
245
+ _parent_found = false
246
+ end
247
+ end
248
+ end
249
+ if _parent_found
250
+ _parent_path = @last_nodes[@level]
251
+ #_parent_rif = @hash_rif[_parent_path]
252
+ _parent_rif = node_2_rif(_parent_path)
253
+ @level = @level + 1
254
+ else
255
+ _parent_rif = 'root'
256
+ _sep = ''
257
+ _value = _path
258
+ end
259
+
260
+ #@hash_rif[_path]= _rif
261
+ @last_nodes[@level] = _path
262
+ _background = conf('color.background')
263
+
264
+ if _sep.length == 0
265
+ _image = @image_class
266
+ elsif _sep.include?('#')
267
+ _image = @image_def
268
+ elsif _sep.include?('::')
269
+ _image = @image_def_class
270
+ end
271
+
272
+ @doc_tree.insert('end', _parent_rif ,_rif, {
273
+ 'text' => _value ,
274
+ 'helptext' => _path,
275
+ 'deltax'=>-1,
276
+ 'image'=>_image
277
+ }
278
+ )
279
+ @level = @level + 1
280
+ end
281
+ end
282
+
283
+ class TkDocframe
284
+ attr_reader :tkText
285
+ attr_reader :tframe
286
+ def initialize(_tframe)
287
+ @tframe = _tframe
288
+ @tkText = TkText.new(_tframe.hinner_frame,
289
+ 'wrap'=>'none',
290
+ 'relief'=>'groove'
291
+ ){|j|
292
+ TkScrollbar.new(j, Arcadia.style('scrollbar')){|s|
293
+ width 8
294
+ command proc{|*args| j.yview(*args)}
295
+ j.yscrollcommand proc{|first,last| s.set first,last}
296
+ }.pack('side'=>'right', 'fill'=>'y')
297
+ }.place('x'=>0, 'y'=>0, 'relheight'=> 1, 'relwidth'=> 1)
298
+
299
+ end
300
+ end