arcadia 0.7.0 → 0.8.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 (168) hide show
  1. data/README +39 -38
  2. data/bin/arc +3 -0
  3. data/bin/arcadia +0 -1
  4. data/conf/arcadia.conf +54 -35
  5. data/conf/arcadia.init.rb +26 -3
  6. data/conf/arcadia.res.rb +56 -4
  7. data/ext/ae-breakpoints/ae-breakpoints.rb +1 -1
  8. data/ext/ae-dir-projects/ae-dir-projects.rb +113 -45
  9. data/ext/ae-editor/ae-editor.conf +6 -2
  10. data/ext/ae-editor/ae-editor.rb +1009 -616
  11. data/ext/ae-editor/langs/coderay.tokens +40 -0
  12. data/ext/ae-editor/langs/conf.lang +12 -10
  13. data/ext/ae-editor/langs/erb.lang.bind +1 -0
  14. data/ext/ae-editor/langs/java.lang +4 -0
  15. data/ext/ae-editor/langs/rb.lang +25 -55
  16. data/ext/ae-editor/langs/rhtml.lang +4 -0
  17. data/ext/ae-editor/langs/tokens.lang.bind +1 -0
  18. data/ext/ae-editor/langs/xml.lang +4 -0
  19. data/ext/ae-file-history/ae-file-history.rb +140 -32
  20. data/ext/ae-output/ae-output.rb +267 -262
  21. data/ext/ae-rad/ae-rad-inspector.rb +1 -1
  22. data/ext/ae-rad/ae-rad-libs.rb +15 -7
  23. data/ext/ae-rad/ae-rad.conf +4 -4
  24. data/ext/ae-rad/lib/tk/al-tk.rb +4 -3
  25. data/ext/ae-ruby-debug/ae-ruby-debug.conf +4 -2
  26. data/ext/ae-ruby-debug/ae-ruby-debug.rb +40 -15
  27. data/ext/ae-search-in-files/ae-search-in-files.rb +70 -14
  28. data/ext/ae-search-in-files/ext/ack-in-files/ack-in-files.conf +15 -0
  29. data/ext/ae-search-in-files/ext/ack-in-files/ack-in-files.rb +80 -0
  30. data/ext/ae-shell/ae-shell.conf +4 -1
  31. data/ext/ae-shell/ae-shell.rb +78 -43
  32. data/ext/test-shutdown-after-startup/test-shutdown-after-startup.conf +4 -0
  33. data/ext/test-shutdown-after-startup/test-shutdown-after-startup.rb +20 -0
  34. data/lib/a-commons.rb +118 -22
  35. data/lib/a-contracts.rb +46 -2
  36. data/lib/a-core.rb +970 -284
  37. data/lib/a-tkcommons.rb +16 -8
  38. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/BWman/ArrowButton.html +0 -0
  39. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/BWman/BWidget.html +0 -0
  40. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/BWman/Button.html +0 -0
  41. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/BWman/ButtonBox.html +0 -0
  42. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/BWman/ComboBox.html +0 -0
  43. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/BWman/Dialog.html +20 -0
  44. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/BWman/DragSite.html +6 -4
  45. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/BWman/DropSite.html +15 -3
  46. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/BWman/DynamicHelp.html +8 -5
  47. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/BWman/Entry.html +0 -0
  48. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/BWman/Label.html +0 -0
  49. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/BWman/LabelEntry.html +0 -0
  50. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/BWman/LabelFrame.html +0 -0
  51. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/BWman/ListBox.html +1 -1
  52. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/BWman/MainFrame.html +8 -0
  53. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/BWman/MessageDlg.html +0 -0
  54. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/BWman/NoteBook.html +0 -0
  55. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/BWman/PagesManager.html +0 -0
  56. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/BWman/PanedWindow.html +21 -5
  57. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/BWman/PanelFrame.html +0 -0
  58. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/BWman/PasswdDlg.html +0 -0
  59. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/BWman/ProgressBar.html +0 -0
  60. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/BWman/ProgressDlg.html +0 -0
  61. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/BWman/ScrollView.html +0 -0
  62. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/BWman/ScrollableFrame.html +5 -2
  63. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/BWman/ScrolledWindow.html +36 -4
  64. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/BWman/SelectColor.html +0 -0
  65. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/BWman/SelectFont.html +0 -0
  66. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/BWman/Separator.html +0 -0
  67. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/BWman/SpinBox.html +0 -0
  68. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/BWman/StatusBar.html +0 -0
  69. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/BWman/TitleFrame.html +0 -0
  70. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/BWman/Tree.html +21 -31
  71. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/BWman/Widget.html +0 -0
  72. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/BWman/contents.html +0 -0
  73. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/BWman/index.html +0 -0
  74. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/BWman/navtree.html +0 -0
  75. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/BWman/options.htm +0 -0
  76. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/CHANGES.txt +0 -0
  77. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/ChangeLog +289 -0
  78. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/LICENSE.txt +0 -0
  79. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/README.txt +2 -2
  80. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/arrow.tcl +1 -1
  81. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/bitmap.tcl +0 -0
  82. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/button.tcl +0 -0
  83. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/buttonbox.tcl +23 -12
  84. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/color.tcl +0 -0
  85. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/combobox.tcl +101 -25
  86. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/demo/basic.tcl +0 -0
  87. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/demo/bwidget.xbm +0 -0
  88. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/demo/demo.tcl +1 -1
  89. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/demo/dnd.tcl +0 -0
  90. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/demo/manager.tcl +0 -0
  91. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/demo/select.tcl +0 -0
  92. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/demo/tmpldlg.tcl +0 -0
  93. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/demo/tree.tcl +0 -0
  94. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/demo/x1.xbm +0 -0
  95. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/dialog.tcl +0 -0
  96. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/dragsite.tcl +0 -0
  97. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/dropsite.tcl +2 -1
  98. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/dynhelp.tcl +194 -33
  99. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/entry.tcl +8 -5
  100. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/font.tcl +0 -0
  101. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/images/bold.gif +0 -0
  102. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/images/copy.gif +0 -0
  103. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/images/cut.gif +0 -0
  104. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/images/dragfile.gif +0 -0
  105. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/images/dragicon.gif +0 -0
  106. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/images/error.gif +0 -0
  107. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/images/file.gif +0 -0
  108. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/images/folder.gif +0 -0
  109. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/images/hourglass.gif +0 -0
  110. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/images/info.gif +0 -0
  111. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/images/italic.gif +0 -0
  112. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/images/minus.xbm +0 -0
  113. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/images/new.gif +0 -0
  114. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/images/opcopy.xbm +0 -0
  115. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/images/open.gif +0 -0
  116. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/images/openfold.gif +0 -0
  117. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/images/oplink.xbm +0 -0
  118. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/images/opmove.xbm +0 -0
  119. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/images/overstrike.gif +0 -0
  120. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/images/palette.gif +0 -0
  121. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/images/passwd.gif +0 -0
  122. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/images/paste.gif +0 -0
  123. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/images/plus.xbm +0 -0
  124. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/images/print.gif +0 -0
  125. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/images/question.gif +0 -0
  126. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/images/redo.gif +0 -0
  127. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/images/save.gif +0 -0
  128. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/images/target.xbm +0 -0
  129. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/images/underline.gif +0 -0
  130. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/images/undo.gif +0 -0
  131. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/images/warning.gif +0 -0
  132. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/init.tcl +0 -0
  133. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/label.tcl +0 -0
  134. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/labelentry.tcl +0 -0
  135. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/labelframe.tcl +0 -0
  136. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/lang/da.rc +0 -0
  137. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/lang/de.rc +0 -0
  138. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/lang/en.rc +0 -0
  139. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/lang/es.rc +0 -0
  140. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/lang/fr.rc +0 -0
  141. data/tcl/BWidget-1.9.0/lang/hu.rc +52 -0
  142. data/tcl/BWidget-1.9.0/lang/nl.rc +52 -0
  143. data/tcl/BWidget-1.9.0/lang/no.rc +52 -0
  144. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/listbox.tcl +89 -34
  145. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/mainframe.tcl +14 -13
  146. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/messagedlg.tcl +0 -0
  147. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/notebook.tcl +3 -1
  148. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/pagesmgr.tcl +0 -0
  149. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/panedw.tcl +22 -18
  150. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/panelframe.tcl +0 -0
  151. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/passwddlg.tcl +7 -3
  152. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/pkgIndex.tcl +2 -2
  153. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/progressbar.tcl +0 -0
  154. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/progressdlg.tcl +0 -0
  155. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/scrollframe.tcl +60 -24
  156. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/scrollview.tcl +0 -0
  157. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/scrollw.tcl +13 -11
  158. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/separator.tcl +0 -0
  159. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/spinbox.tcl +0 -0
  160. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/statusbar.tcl +0 -0
  161. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/tests/entry.test +0 -0
  162. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/titleframe.tcl +0 -0
  163. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/tree.tcl +51 -41
  164. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/utils.tcl +26 -11
  165. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/widget.tcl +53 -19
  166. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/wizard.tcl +0 -0
  167. data/tcl/{BWidget-1.8.0 → BWidget-1.9.0}/xpm2image.tcl +0 -0
  168. metadata +170 -145
@@ -0,0 +1,80 @@
1
+ #
2
+ # ack-in-files.rb - Arcadia Ruby ide
3
+ # by Roger D. Pack
4
+ #
5
+
6
+ class AckInFilesService < ArcadiaExt
7
+ def on_before_build(_event)
8
+ Arcadia.attach_listener(AckInFilesListener.new(self),AckInFilesEvent)
9
+ end
10
+ end
11
+
12
+ class AckInFilesListener < SearchInFilesListener
13
+ def initialize(_service)
14
+ @service = _service
15
+ create_find 'Ack in files'
16
+ end
17
+
18
+ def on_before_ack_in_files(_event)
19
+ on_before_search_in_files(_event)
20
+ end
21
+
22
+ def do_find # overwrite
23
+ return if @find.e_what.text.strip.length == 0 || @find.e_filter.text.strip.length == 0 || @find.e_dir.text.strip.length == 0
24
+ @find.hide
25
+ if !defined?(@search_output)
26
+ @search_output = SearchOutput.new(@service)
27
+ else
28
+ @service.frame.show
29
+ end
30
+ begin
31
+ # unfortunately, it uses regex instead of glob. Oh well.
32
+ # ack -i ignore case
33
+ # -H, --with-filename Print the filename for each match
34
+ # -G REGEX Only search files that match REGEX
35
+ # ack -i -G .tcl Event
36
+ # ack -i -G .rb "Ack" "c:/dev/ruby/arcadia"
37
+ command = %!ack -i -G "#{@find.e_filter.text.gsub('*', '.*')}" "#{@find.e_what.text}" "#{@find.e_dir.text}"!
38
+
39
+ _search_title = 'ack result for : "'+@find.e_what.text+'" in :"'+@find.e_dir.text+'"'+' ['+@find.e_filter.text+'] ' + command
40
+ _filter = @find.e_dir.text+'/**/'+@find.e_filter.text
41
+ _node = @search_output.new_result(_search_title, '')
42
+ progress_stop=false
43
+ @progress_bar = TkProgressframe.new(@service.arcadia.layout.root, 2)
44
+ @progress_bar.title('Running')
45
+
46
+ answer = `#{command}`
47
+ answer_lines = answer.split("\n")
48
+ @progress_bar.destroy # destroy the old one
49
+ @progress_bar = TkProgressframe.new(@service.arcadia.layout.root, answer_lines.length)
50
+ @progress_bar.title('Parsing')
51
+ @progress_bar.on_cancel=proc{progress_stop=true}
52
+
53
+ # a now looks like
54
+ # "C:/dev/ruby/arcadia/conf/arcadia.res.rb:184:mzWCUixPU0sEqgO/8AoIsQbpkAbCQWpVeLJUpzhXd6v9eWZV1G1DosCBogAO"
55
+ # ...
56
+ answer_lines.each{|line|
57
+ # we'll assume no :number: in the path...if not it will mess us right up
58
+ line =~ /(.*):(\d+):(.*)/
59
+ _filename = $1
60
+ _lineno = $2
61
+ _text = $3
62
+ @search_output.add_result(_node, _filename, _lineno, _text)
63
+ @progress_bar.progress
64
+ break if progress_stop # early out
65
+ }
66
+ if answer_lines == []
67
+ @search_output.new_result('None found', '')
68
+ end
69
+
70
+ rescue Exception => e
71
+ Arcadia.console(self, 'msg'=>e.message + e.backtrace.inspect, 'level'=>'error')
72
+ #Arcadia.new_error_msg(self, e.message)
73
+ ensure
74
+ @progress_bar.destroy if @progress_bar
75
+ end
76
+
77
+ end
78
+
79
+
80
+ end
@@ -3,9 +3,12 @@ active=yes
3
3
  require=ext/ae-shell/ae-shell
4
4
  class=Shell
5
5
 
6
+ win32::gems=win32-process,ruby-wmi
6
7
 
7
8
  #:::::::::::::::: output ::::::::::::::::::::::<begin>
8
9
  ruby=ruby
9
10
  freebsd::ruby=ruby
10
11
  win32::ruby=ruby
11
- #:::::::::::::::: output ::::::::::::::::::::::<end>
12
+ win32::rubyw=rubyw
13
+ rubyw=rubyw
14
+ #:::::::::::::::: output ::::::::::::::::::::::<end>
@@ -16,50 +16,89 @@ class Shell < ArcadiaExt
16
16
  def on_build(_event)
17
17
  @run_threads = Array.new
18
18
  end
19
-
19
+
20
20
  def on_system_exec(_event)
21
21
  begin
22
- # _cmd_ = "|ruby #{File.dirname(__FILE__)}/sh.rb #{_event.command} 2>&1"
23
- # p _cmd_
24
- # Thread.new do
25
- # open(_cmd_,"r"){|f|
26
- # Arcadia.new_debug_msg(self, f.read)
27
- # }
28
- # end
29
- _cmd_ = "#{_event.command}"
30
- if is_windows?
31
- io = IO.popen(_cmd_)
32
- else
33
- Process.fork{
34
- open(_cmd_,"r"){|f|
35
- Arcadia.console(self,'msg'=>f.read, 'level'=>'debug')
36
- #Arcadia.new_debug_msg(self, f.read)
22
+ # _cmd_ = "|ruby #{File.dirname(__FILE__)}/sh.rb #{_event.command} 2>&1"
23
+ # p _cmd_
24
+ # Thread.new do
25
+ # open(_cmd_,"r"){|f|
26
+ # Arcadia.new_debug_msg(self, f.read)
27
+ # }
28
+ # end
29
+ _cmd_ = "#{_event.command}"
30
+ if is_windows?
31
+ io = IO.popen(_cmd_)
32
+ Arcadia.console(self,'msg'=>io.read, 'level'=>'debug')
33
+ else
34
+ Process.fork{
35
+ open(_cmd_,"r"){|f|
36
+ Arcadia.console(self,'msg'=>f.read, 'level'=>'debug')
37
+ #Arcadia.new_debug_msg(self, f.read)
38
+ }
37
39
  }
38
- }
39
- end
40
+ end
40
41
  rescue Exception => e
41
42
  Arcadia.console(self,'msg'=>e, 'level'=>'debug')
42
43
  #Arcadia.new_debug_msg(self, e)
43
44
  end
44
-
45
45
  end
46
-
46
+
47
+ @@next_number = 0
47
48
  def on_run_ruby_file(_event)
48
49
  _filename = _event.file
49
50
  _filename = @arcadia['pers']['run.file.last'] if _filename == "*LAST"
50
51
  if _filename && File.exists?(_filename)
51
52
  begin
53
+ Arcadia.console(self,'msg'=>"Running #{_filename}...", 'level'=>'debug') # info?
54
+ start_time = Time.now
52
55
  @arcadia['pers']['run.file.last']=_filename if _event.persistent
53
- _cmd_ = "|"+@arcadia['conf']['shell.ruby']+" "+_filename+" 2>&1"
54
- open(_cmd_,"r"){|f|
55
- _readed = f.read
56
- Arcadia.console(self,'msg'=>_readed, 'level'=>'debug')
57
- #Arcadia.new_debug_msg(self, _readed)
58
- _event.add_result(self, 'output'=>_readed)
59
- }
56
+ executable = @arcadia['conf']['shell.ruby']
57
+ executable = @arcadia['conf']['shell.rubyw'] if is_windows?
58
+ _cmd_ = "#{executable} -C'#{File.dirname(_filename)}' '#{_filename}'"
59
+
60
+ if is_windows?
61
+ # use win32-process gem to startup a child process [not sure if linux needs something like this, too]
62
+ require 'win32/process'
63
+ require 'ruby-wmi'
64
+ output_file_name = "out_#{@@next_number += 1}_#{Process.pid}.txt"
65
+ output = File.open(output_file_name, 'wb')
66
+ child = Process.create :command_line => _cmd_, :startup_info => {:stdout => output, :stderr => output}
67
+ timer=nil
68
+ procy = proc {
69
+ still_alive = WMI::Win32_Process.find(:first, :conditions => {:ProcessId => child.process_id})
70
+ if(!still_alive)
71
+ output.close
72
+ timer.stop
73
+ File.open(output_file_name, 'r') do |f|
74
+ _readed = f.read
75
+ _readed.strip!
76
+ _readed += "\n" + "Done with #{_filename} in #{Time.now - start_time}s"
77
+ Arcadia.console(self,'msg'=>_readed, 'level'=>'debug')
78
+ _event.add_result(self, 'output'=>_readed)
79
+ end
80
+ File.delete output_file_name
81
+ end
82
+ }
83
+
84
+ timer=TkAfter.new(1000,-1,procy) # -1 = repeating every 1000ms...
85
+ timer.start
86
+ else
87
+ _cmd_ = "|#{_cmd_} 2>&1"
88
+ Thread.new {
89
+ begin
90
+ open(_cmd_, "r"){|f|
91
+ _readed = f.read
92
+ Arcadia.console(self,'msg'=>_readed, 'level'=>'debug')
93
+ _event.add_result(self, 'output'=>_readed)
94
+ }
95
+ rescue Exception => e
96
+ Arcadia.console(self,'msg'=>e.to_s, 'level'=>'debug')
97
+ end
98
+ }
99
+ end
60
100
  rescue Exception => e
61
- Arcadia.console(self,'msg'=>e, 'level'=>'debug')
62
- #Arcadia.new_debug_msg(self, e)
101
+ Arcadia.console(self,'msg'=>e.to_s, 'level'=>'debug')
63
102
  end
64
103
  end
65
104
  end
@@ -69,17 +108,17 @@ class Shell < ArcadiaExt
69
108
  (RUBY_PLATFORM.include?('mswin32'))?_cmd="cmd":_cmd='sh'
70
109
  if is_windows?
71
110
  Thread.new{
72
- Arcadia.console(self,'msg'=>'begin', 'level'=>'debug')
111
+ Arcadia.console(self,'msg'=>'begin', 'level'=>'debug')
73
112
  #Arcadia.new_debug_msg(self, 'inizio')
74
113
  @io = IO.popen(_cmd,'r+')
75
114
  @io.puts(command)
76
115
  result = ''
77
116
  while line = @io.gets
78
- result << line
79
- end
117
+ result << line
118
+ end
80
119
  #Arcadia.new_debug_msg(self, result)
81
120
  Arcadia.console(self,'msg'=>result, 'level'=>'debug')
82
-
121
+
83
122
  }
84
123
  else
85
124
  Process.fork{
@@ -91,18 +130,14 @@ class Shell < ArcadiaExt
91
130
  end
92
131
  end
93
132
 
94
-
95
-
96
133
  def is_windows?
97
- !(RUBY_PLATFORM =~ /(win|w)32$/).nil?
98
- #RUBY_PLATFORM.include?('win')
134
+ RUBY_PLATFORM =~ /mingw|mswin/
99
135
  end
100
136
 
101
-
102
137
  def run_last
103
138
  run($arcadia['pers']['run.file.last'])
104
139
  end
105
-
140
+
106
141
  def run_current
107
142
  current_editor = $arcadia['editor'].raised
108
143
  run(current_editor.file) if current_editor
@@ -125,15 +160,15 @@ class Shell < ArcadiaExt
125
160
  _cmd_ = "|"+$arcadia['conf']['shell.ruby']+" "+_filename+" 2>&1"
126
161
  # Arcadia.new_debug_msg(self, _cmd_)
127
162
  @cmd = open(_cmd_,"r"){|f|
128
- Arcadia.console(self, 'msg'=>f.read ,'level'=>'debug')
129
- #Arcadia.new_debug_msg(self, f.read)
163
+ Arcadia.console(self, 'msg'=>f.read ,'level'=>'debug')
164
+ #Arcadia.new_debug_msg(self, f.read)
130
165
  }
131
166
  end
132
167
  rescue Exception => e
133
- Arcadia.console(self, 'msg'=>e ,'level'=>'debug')
168
+ Arcadia.console(self, 'msg'=>e ,'level'=>'debug')
134
169
  #Arcadia.new_debug_msg(self, e)
135
170
  end
136
171
  end
137
172
  end
138
173
 
139
- end
174
+ end
@@ -0,0 +1,4 @@
1
+ name=shutdown early
2
+ active=yes
3
+ require=ext/test-shutdown-after-startup/test-shutdown-after-startup.rb
4
+ class=ShutdownEarly
@@ -0,0 +1,20 @@
1
+ #
2
+ # an extension that triggers a shutdown after startup--should you want
3
+ # to profile the startup speed, for example
4
+ #
5
+
6
+ class ShutdownEarly < ArcadiaExt
7
+ def on_after_build(_event)
8
+ if File.exist? 'shutdown_immediately'
9
+ # TODO a different call like "all set up"
10
+ cancel = proc {
11
+ puts 'exit'
12
+ Arcadia.broadcast_event(QuitEvent.new(self))
13
+ }
14
+
15
+ cancel.call
16
+ timer=TkAfter.new(10,-1,proc {cancel.call}) # 10ms, loop = -1
17
+ timer.start
18
+ end
19
+ end
20
+ end
@@ -103,6 +103,18 @@ class FixedFrameWrapper < AbstractFrameWrapper
103
103
  def raised?
104
104
  Arcadia.layout.raised?(@domain, @name)
105
105
  end
106
+
107
+ def maximized?
108
+ Arcadia.layout.domain(@domain) && Arcadia.layout.domain(@domain)['root'].maximized?
109
+ end
110
+
111
+ def maximize
112
+ Arcadia.layout.domain(@domain)['root'].maximize
113
+ end
114
+
115
+ def resize
116
+ Arcadia.layout.domain(@domain)['root'].resize
117
+ end
106
118
 
107
119
  def free
108
120
  Arcadia.layout.unregister_panel(self)
@@ -178,6 +190,7 @@ class ArcadiaExt
178
190
  attr_reader :arcadia
179
191
  def initialize(_arcadia, _name=nil)
180
192
  @arcadia = _arcadia
193
+ @arcadia.register(self)
181
194
  Arcadia.attach_listener(self, BuildEvent)
182
195
  Arcadia.attach_listener(self, ExitQueryEvent)
183
196
  Arcadia.attach_listener(self, FinalizeEvent)
@@ -192,6 +205,7 @@ class ArcadiaExt
192
205
  #ObjectSpace.define_finalizer(self, self.method(:finalize).to_proc)
193
206
  end
194
207
 
208
+
195
209
  def conf_array(_name)
196
210
  res = []
197
211
  value = @arcadia['conf'][_name]
@@ -199,11 +213,20 @@ class ArcadiaExt
199
213
  res
200
214
  end
201
215
 
202
- def frame(_n=0)
203
- if @frames[_n] == nil && @frames_points[_n]
216
+ def frame_def_visible?(_n=0)
217
+ @arcadia.layout.domains.include?(@frames_points[_n])
218
+ #@frames_points[_n] != '-1.-1'
219
+ end
220
+
221
+ def frame_visible?(_n=0)
222
+ @frames[_n] != nil && @frames[_n].hinner_frame && TkWinfo.mapped?(@frames[_n].hinner_frame)
223
+ end
224
+
225
+ def frame(_n=0,create_if_not_exist=true)
226
+ if @frames[_n] == nil && @frames_points[_n] && create_if_not_exist
204
227
  (@frames_labels[_n].nil?)? _label = @name : _label = @frames_labels[_n]
205
228
  (@frames_names[_n].nil?)? _name = @name : _name = @frames_names[_n]
206
- @frames[_n] = FixedFrameWrapper.new(@name, @frames_points[_n], _name, _label)
229
+ @frames[_n] = FixedFrameWrapper.new(@name, @frames_points[_n], _name, _label)
207
230
  end
208
231
  return @frames[_n]
209
232
  end
@@ -230,6 +253,19 @@ class ArcadiaExt
230
253
  end
231
254
  end
232
255
 
256
+ def maximized?(_n=0)
257
+ ret= false
258
+ ret=@frames[_n].maximized? if @frames[_n]
259
+ ret
260
+ end
261
+
262
+ def maximize(_n=0)
263
+ @frames[_n].maximize if @frames[_n]
264
+ end
265
+
266
+ def resize(_n=0)
267
+ @frames[_n].resize if @frames[_n]
268
+ end
233
269
  end
234
270
 
235
271
 
@@ -282,6 +318,10 @@ class Event
282
318
  @results = Array.new
283
319
  end
284
320
 
321
+ def add_finalize_callback(_proc)
322
+ ObjectSpace.define_finalizer(self, _proc)
323
+ end
324
+
285
325
  def add_result(_sender, _args=nil)
286
326
  if self.class::Result
287
327
  res = self.class::Result.new(_sender, _args)
@@ -308,7 +348,7 @@ module EventBus #(or SourceEvent)
308
348
  #before fase
309
349
  event_classes.each do |_c|
310
350
  _process_fase(_c, _event, 'before')
311
- break if _event.is_breaked?
351
+ break if _event.is_breaked? # not responding to this means "you need to pass in an instance, not a class name
312
352
  end unless _event.is_breaked?
313
353
  # fase
314
354
  event_classes.each do |_c|
@@ -357,14 +397,16 @@ module EventBus #(or SourceEvent)
357
397
  sub_method_name = _method_name(_event.class, suf)
358
398
  @@listeners[_class].each do|_listener|
359
399
  if _listener.respond_to?(sub_method_name)
360
- _listener.send(sub_method_name, _event)
400
+ _listener.send(sub_method_name, _event)
361
401
  elsif _listener.respond_to?(method_name)
362
402
  _listener.send(method_name, _event)
363
403
  end
404
+ break if _event.is_breaked?
364
405
  end
365
406
  else
366
407
  @@listeners[_class].each do|_listener|
367
408
  _listener.send(method_name, _event) if _listener.respond_to?(method_name)
409
+ break if _event.is_breaked?
368
410
  end
369
411
  end
370
412
  end
@@ -418,7 +460,7 @@ module Autils
418
460
  def full_in_path_command(_command=nil)
419
461
  return nil if _command.nil?
420
462
  _ret = nil
421
- RUBY_PLATFORM.include?('win32') ? _sep = ';':_sep=':'
463
+ RUBY_PLATFORM =~ /win32|mingw/ ? _sep = ';':_sep=':'
422
464
  ENV['PATH'].split(_sep).each{|_path|
423
465
  _file = File.join(_path, _command)
424
466
  if FileTest.exist?(_file)
@@ -429,8 +471,7 @@ module Autils
429
471
  end
430
472
 
431
473
  def is_windows?
432
- !(RUBY_PLATFORM =~ /(win|w)32$/).nil?
433
- #RUBY_PLATFORM.include?('win')
474
+ RUBY_PLATFORM =~ /mingw|mswin/
434
475
  end
435
476
 
436
477
  end
@@ -455,6 +496,16 @@ module Configurable
455
496
  _line = ''
456
497
  end
457
498
  end
499
+ var_ruby_version = _line.split(':@:')
500
+ if var_ruby_version.length > 1
501
+ version = var_ruby_version[0]
502
+ if (RUBY_VERSION[0..version.length-1]==version)
503
+ _line = var_ruby_version[1]
504
+ else
505
+ _line = ''
506
+ end
507
+ end
508
+
458
509
  var = _line.split('=')
459
510
  if var.length > 1
460
511
  _value = var[1].strip
@@ -470,6 +521,8 @@ module Configurable
470
521
  f.close unless f.nil?
471
522
  end
472
523
  return r_hash
524
+ else
525
+ puts 'warning--file does not exist', _property_file
473
526
  end
474
527
  end
475
528
 
@@ -594,7 +647,7 @@ class Application
594
647
 
595
648
  def initialize(_ap=ApplicationParams.new)
596
649
  @@instance = self
597
- eval('$'+_ap.name+'=self')
650
+ eval('$'+_ap.name+'=self') # set $arcadia to this instance
598
651
  publish('applicationParams', _ap)
599
652
  publish(_ap.name,self)
600
653
  @first_run = false
@@ -602,7 +655,9 @@ class Application
602
655
  if !File.exists?(self['applicationParams'].persistent_file)
603
656
  File.new(self['applicationParams'].persistent_file, File::CREAT).close
604
657
  end
658
+ # read in the settings'
605
659
  publish('conf', properties_file2hash(self['applicationParams'].config_file)) if self['applicationParams'].config_file
660
+ publish('origin_conf', Hash.new.update(self['conf'])) if self['conf']
606
661
  publish('pers', properties_file2hash(self['applicationParams'].persistent_file)) if self['applicationParams'].persistent_file
607
662
  yield(self) if block_given?
608
663
  end
@@ -619,8 +674,8 @@ class Application
619
674
  self['conf'][_property]
620
675
  end
621
676
 
622
- def sys_info
623
- "[Platform = #{RUBY_PLATFORM}] [Ruby version = #{RUBY_VERSION}]"
677
+ def Application.sys_info
678
+ "[Platform = #{RUBY_PLATFORM}]\n[Ruby version = #{RUBY_VERSION}]"
624
679
  end
625
680
 
626
681
  def Application.conf_group(_group)
@@ -639,6 +694,18 @@ class Application
639
694
  @@conf_groups[_group]
640
695
  end
641
696
 
697
+ def Application.del_conf_group(_group)
698
+ glen=_group.length
699
+ @@instance['conf'].keys.sort.each{|k|
700
+ if k[0..glen] == "#{_group}."
701
+ @@instance['conf'].delete(k)
702
+ end
703
+ }
704
+ end
705
+
706
+ def Application.del_conf(_k)
707
+ @@instance['conf'].delete(_k)
708
+ end
642
709
 
643
710
  def prepare
644
711
  end
@@ -652,9 +719,37 @@ class Application
652
719
  end
653
720
  end
654
721
 
722
+ def local_file_config
723
+ File.join(local_dir, File.basename(self['applicationParams'].config_file))
724
+ end
725
+
726
+ def update_local_config
727
+ # local_dir is ~/arcadia
728
+ if FileTest.exist?(local_file_config)
729
+ if FileTest.writable?(local_dir)
730
+ f = File.new(local_file_config, "w")
731
+ begin
732
+ if f
733
+ p = self['conf']
734
+ if p
735
+ p.keys.sort.each{|key|
736
+ if self['origin_conf'][key] == self['conf'][key]
737
+ f.syswrite('#'+key+'='+self['conf'][key]+"\n") # write it as a comment since it isn't a real change
738
+ else
739
+ f.syswrite(key+'='+self['conf'][key]+"\n")
740
+ end
741
+ }
742
+ end
743
+ end
744
+ ensure
745
+ f.close unless f.nil?
746
+ end
747
+ end
748
+ end
749
+ end
750
+
655
751
  # this method load config file from local directory for personalizations
656
752
  def load_local_config(_create_if_not_exist=true)
657
- local_file_config = File.join(local_dir,File.basename(self['applicationParams'].config_file))
658
753
  if FileTest.exist?(local_file_config)
659
754
  self['conf'].update(self.properties_file2hash(local_file_config))
660
755
  elsif _create_if_not_exist
@@ -696,13 +791,14 @@ class Application
696
791
  end
697
792
 
698
793
  def local_dir
699
- _local_dir = File.join(ENV["HOME"],'.'+self['applicationParams'].name) if ENV["HOME"]
794
+ home = File.expand_path '~'
795
+ _local_dir = File.join(home,'.'+self['applicationParams'].name) if home
700
796
  if _local_dir && !File.exist?(_local_dir)
701
- if FileTest.exist?(ENV["HOME"])
797
+ if FileTest.exist?(home)
702
798
  Dir.mkdir(_local_dir)
703
799
  @first_run = true
704
800
  else
705
- msg = "Locad dir "+'"'+ENV["HOME"]+'"'+" must be writable!"
801
+ msg = "Local dir "+'"'+home+'"'+" must be writable!"
706
802
  Arcadia.dialog(self, 'type'=>'ok', 'title' => "(#{self['applicationParams'].name})", 'msg' => msg, 'level'=>'error')
707
803
  exit
708
804
  end
@@ -722,19 +818,19 @@ class Application
722
818
  if @objs[_name]
723
819
  return @objs[_name]
724
820
  else
725
- raise RuntimeError, "resurce '"+_name+"' unavabled ", caller
821
+ return nil
822
+ #raise RuntimeError, "resurce '"+_name+"' unavabled ", caller
726
823
  end
727
824
  end
728
825
 
729
826
  def []=(_name, _value)
730
- if @objs[_name]
731
- @objs[_name] = _value
732
- end
827
+ @objs[_name] = _value
828
+ # if @objs[_name]
829
+ # @objs[_name] = _value
830
+ # end
733
831
  end
734
832
 
735
833
 
736
834
  def run
737
835
  end
738
- end
739
-
740
-
836
+ end