arcadia 0.9.3 → 0.10.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 (186) hide show
  1. data/README +11 -10
  2. data/bin/arcadia +3 -0
  3. data/conf/arcadia.conf +117 -75
  4. data/conf/arcadia.res.rb +219 -58
  5. data/conf/theme-dark.conf +11 -8
  6. data/conf/theme-dark.res.rb +81 -10
  7. data/ext/ae-breakpoints/ae-breakpoints.rb +1 -1
  8. data/ext/ae-dir-projects/ae-dir-projects.conf +2 -2
  9. data/ext/ae-dir-projects/ae-dir-projects.rb +84 -47
  10. data/ext/ae-editor/ae-editor.rb +541 -190
  11. data/ext/ae-editor/langs/coderay.tokens +1 -0
  12. data/ext/ae-editor/langs/conf.lang +5 -4
  13. data/ext/ae-editor/langs/java.lang +2 -1
  14. data/ext/ae-editor/langs/python.lang +4 -0
  15. data/ext/ae-editor/langs/rhtml.lang +2 -1
  16. data/ext/ae-editor/langs/ruby.lang +45 -0
  17. data/ext/ae-editor/langs/tcl.lang +80 -2
  18. data/ext/ae-editor/langs/text.lang +2 -0
  19. data/ext/ae-editor/langs/xml.lang +1 -0
  20. data/ext/ae-file-history/ae-file-history.conf +2 -2
  21. data/ext/ae-file-history/ae-file-history.rb +66 -20
  22. data/ext/ae-output/ae-output.conf +3 -3
  23. data/ext/ae-output/ae-output.rb +37 -23
  24. data/ext/ae-rad/ae-rad-palette.rb +3 -3
  25. data/ext/ae-ruby-debug/ae-ruby-debug.conf +2 -2
  26. data/ext/ae-ruby-debug/ae-ruby-debug.rb +38 -42
  27. data/ext/ae-search-in-files/ae-search-in-files.conf +2 -2
  28. data/ext/ae-search-in-files/ae-search-in-files.rb +20 -9
  29. data/ext/ae-search-in-files/ext/ack-in-files/ack-in-files.conf +2 -2
  30. data/ext/ae-shell/ae-shell.conf +1 -1
  31. data/ext/ae-shell/ae-shell.rb +57 -46
  32. data/ext/ae-subprocess-inspector/ae-subprocess-inspector.rb +99 -46
  33. data/ext/ae-subprocess-inspector/process.res +0 -0
  34. data/lib/a-commons.rb +13 -9
  35. data/lib/a-contracts.rb +24 -1
  36. data/lib/a-core.rb +586 -196
  37. data/lib/a-tkcommons.rb +155 -55
  38. data/lib/anigif.rb +9 -0
  39. data/lib/ctags.exe +0 -0
  40. data/tcl/anigif/anigif.tcl +199 -0
  41. data/tcl/anigif/pkgIndex.tcl +3 -0
  42. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/BWman/ArrowButton.html +0 -0
  43. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/BWman/BWidget.html +0 -0
  44. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/BWman/Button.html +36 -2
  45. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/BWman/ButtonBox.html +9 -7
  46. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/BWman/ComboBox.html +0 -0
  47. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/BWman/Dialog.html +5 -11
  48. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/BWman/DragSite.html +0 -0
  49. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/BWman/DropSite.html +0 -0
  50. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/BWman/DynamicHelp.html +0 -0
  51. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/BWman/Entry.html +0 -0
  52. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/BWman/Label.html +32 -1
  53. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/BWman/LabelEntry.html +0 -0
  54. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/BWman/LabelFrame.html +0 -0
  55. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/BWman/ListBox.html +0 -0
  56. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/BWman/MainFrame.html +0 -0
  57. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/BWman/MessageDlg.html +0 -0
  58. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/BWman/NoteBook.html +0 -0
  59. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/BWman/PagesManager.html +0 -0
  60. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/BWman/PanedWindow.html +0 -0
  61. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/BWman/PanelFrame.html +0 -0
  62. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/BWman/PasswdDlg.html +0 -0
  63. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/BWman/ProgressBar.html +0 -0
  64. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/BWman/ProgressDlg.html +0 -0
  65. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/BWman/ScrollView.html +0 -0
  66. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/BWman/ScrollableFrame.html +0 -0
  67. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/BWman/ScrolledWindow.html +13 -1
  68. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/BWman/SelectColor.html +0 -0
  69. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/BWman/SelectFont.html +0 -0
  70. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/BWman/Separator.html +0 -0
  71. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/BWman/SpinBox.html +0 -0
  72. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/BWman/StatusBar.html +0 -0
  73. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/BWman/TitleFrame.html +0 -0
  74. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/BWman/Tree.html +0 -0
  75. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/BWman/Widget.html +0 -0
  76. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/BWman/contents.html +12 -1
  77. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/BWman/index.html +0 -0
  78. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/BWman/navtree.html +0 -0
  79. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/BWman/options.htm +0 -0
  80. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/CHANGES.txt +0 -0
  81. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/ChangeLog +70 -0
  82. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/LICENSE.txt +0 -0
  83. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/README.txt +0 -0
  84. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/arrow.tcl +0 -0
  85. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/bitmap.tcl +0 -0
  86. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/button.tcl +121 -53
  87. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/buttonbox.tcl +10 -5
  88. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/color.tcl +0 -0
  89. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/combobox.tcl +0 -0
  90. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/demo/basic.tcl +0 -0
  91. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/demo/bwidget.xbm +0 -0
  92. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/demo/demo.tcl +0 -0
  93. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/demo/dnd.tcl +0 -0
  94. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/demo/manager.tcl +0 -0
  95. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/demo/select.tcl +0 -0
  96. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/demo/tmpldlg.tcl +0 -0
  97. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/demo/tree.tcl +0 -0
  98. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/demo/x1.xbm +0 -0
  99. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/dialog.tcl +14 -2
  100. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/dragsite.tcl +0 -0
  101. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/dropsite.tcl +0 -0
  102. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/dynhelp.tcl +0 -0
  103. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/entry.tcl +0 -0
  104. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/font.tcl +0 -0
  105. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/images/bold.gif +0 -0
  106. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/images/copy.gif +0 -0
  107. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/images/cut.gif +0 -0
  108. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/images/dragfile.gif +0 -0
  109. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/images/dragicon.gif +0 -0
  110. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/images/error.gif +0 -0
  111. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/images/file.gif +0 -0
  112. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/images/folder.gif +0 -0
  113. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/images/hourglass.gif +0 -0
  114. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/images/info.gif +0 -0
  115. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/images/italic.gif +0 -0
  116. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/images/minus.xbm +0 -0
  117. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/images/new.gif +0 -0
  118. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/images/opcopy.xbm +0 -0
  119. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/images/open.gif +0 -0
  120. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/images/openfold.gif +0 -0
  121. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/images/oplink.xbm +0 -0
  122. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/images/opmove.xbm +0 -0
  123. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/images/overstrike.gif +0 -0
  124. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/images/palette.gif +0 -0
  125. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/images/passwd.gif +0 -0
  126. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/images/paste.gif +0 -0
  127. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/images/plus.xbm +0 -0
  128. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/images/print.gif +0 -0
  129. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/images/question.gif +0 -0
  130. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/images/redo.gif +0 -0
  131. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/images/save.gif +0 -0
  132. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/images/target.xbm +0 -0
  133. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/images/underline.gif +0 -0
  134. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/images/undo.gif +0 -0
  135. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/images/warning.gif +0 -0
  136. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/init.tcl +15 -1
  137. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/label.tcl +76 -18
  138. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/labelentry.tcl +0 -0
  139. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/labelframe.tcl +0 -0
  140. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/lang/da.rc +0 -0
  141. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/lang/de.rc +0 -0
  142. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/lang/en.rc +0 -0
  143. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/lang/es.rc +0 -0
  144. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/lang/fr.rc +0 -0
  145. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/lang/hu.rc +0 -0
  146. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/lang/nl.rc +0 -0
  147. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/lang/no.rc +0 -0
  148. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/lang/pl.rc +0 -0
  149. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/listbox.tcl +0 -0
  150. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/mainframe.tcl +3 -2
  151. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/messagedlg.tcl +0 -0
  152. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/notebook.tcl +0 -0
  153. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/pagesmgr.tcl +0 -0
  154. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/panedw.tcl +0 -0
  155. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/panelframe.tcl +0 -0
  156. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/passwddlg.tcl +0 -0
  157. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/pkgIndex.tcl +2 -2
  158. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/progressbar.tcl +0 -0
  159. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/progressdlg.tcl +0 -0
  160. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/scrollframe.tcl +0 -0
  161. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/scrollview.tcl +0 -0
  162. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/scrollw.tcl +37 -25
  163. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/separator.tcl +0 -0
  164. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/spinbox.tcl +0 -0
  165. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/statusbar.tcl +0 -0
  166. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/tests/entry.test +0 -0
  167. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/titleframe.tcl +0 -0
  168. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/tree.tcl +17 -9
  169. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/utils.tcl +0 -0
  170. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/widget.tcl +0 -0
  171. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/wizard.tcl +0 -0
  172. data/tcl/{BWidget-1.9.2 → bwidget-1.9.4}/xpm2image.tcl +0 -0
  173. data/tcl/fsdialog/de.msg +30 -0
  174. data/tcl/fsdialog/en.msg +31 -0
  175. data/tcl/fsdialog/fsdialog.tcl +1749 -0
  176. data/tcl/fsdialog/fsdlg-gif.tcl +259 -0
  177. data/tcl/fsdialog/fsdlg-png.tcl +265 -0
  178. data/tcl/fsdialog/sv.msg +32 -0
  179. data/tcl/fsdialog/tclIndex +6 -0
  180. metadata +179 -174
  181. data/ext/ae-editor/langs/erb.lang.bind +0 -1
  182. data/ext/ae-editor/langs/lang.lang.bind +0 -1
  183. data/ext/ae-editor/langs/pers.lang.bind +0 -1
  184. data/ext/ae-editor/langs/rb.lang +0 -73
  185. data/ext/ae-editor/langs/rbw.lang.bind +0 -1
  186. data/ext/ae-editor/langs/tokens.lang.bind +0 -1
@@ -1,3 +1,10 @@
1
+ #
2
+ # ae-subprocess-inspector.rb - Arcadia Ruby ide
3
+ # by Antonio Galeone <antonio-galeone@rubyforge.org>
4
+ #
5
+
6
+ require "#{Dir.pwd}/lib/anigif"
7
+
1
8
  class SubProcessInspector < ArcadiaExt
2
9
  attr_reader :processs
3
10
  def on_before_build(_event)
@@ -6,7 +13,7 @@ class SubProcessInspector < ArcadiaExt
6
13
  end
7
14
 
8
15
  def on_sub_process(_event)
9
- self.frame.show_anyway
16
+ #self.frame.show_anyway
10
17
  @processs << SubProcessWidget.new(self, _event)
11
18
  end
12
19
 
@@ -38,62 +45,37 @@ class SubProcessInspector < ArcadiaExt
38
45
  def do_delete_process(_process)
39
46
  @processs.delete(_process)
40
47
  if @processs.length == 0
41
- self.frame.free
48
+ #self.frame.free
42
49
  end
43
50
  end
44
51
 
45
52
  end
46
53
 
47
- class SubProcessWidget < TkFrame
54
+ class SubProcessWidget < Tk::BWidget::Button
48
55
  attr_reader :event
49
56
  def initialize(_parent=nil, _event=nil, *args)
50
- super(_parent.frame.hinner_frame, Arcadia.style('panel'))
57
+ super(Arcadia['toolbar'].frame, Arcadia.style('button').update("background"=>'black',"activebackground"=>'black', 'relief'=>'groove'))
51
58
  @parent = _parent
52
59
  @event = _event
53
- @progress = TkVariable.new
54
- @pb = Tk::BWidget::ProgressBar.new(
55
- self, Arcadia.style('progress').update({
56
- :variable=>@progress,
57
- :type=>'infinite',
58
- :maximum=>500})).place('width'=>-30,'relwidth' => '1','x' => 0,'y' => 2,'height' => 18)
59
- #.pack('side' =>'left','fill'=>'x')
60
-
61
- icon_button = TkButton.new(@pb){
62
- background Arcadia.style('panel')['background']
63
- relief 'flat'
64
- image Arcadia.file_icon(_event.name)
65
- }.pack
66
-
67
- b_command = proc{
68
- message = "Really kill pid #{_event.pid} #{_event.name} ?"
69
- r=Arcadia.dialog(self,
70
- 'type'=>'yes_no',
71
- 'level'=>'warning',
72
- 'title'=> 'Confirm kill',
73
- 'msg'=>message)
74
- if r=="yes"
75
- _event.abort_action.call
76
- end
77
- }
78
-
79
-
80
- _b = Tk::BWidget::Button.new(self,
81
- #_b = TkButton.new(self,
82
- 'command'=>b_command,
83
- 'borderwidth'=>0,
84
- 'background'=>Arcadia.conf('background'),
85
- 'helptext'=>"#{_event.name} [pid #{_event.pid}]",
86
- 'image'=> TkPhotoImage.new('data' => PROCESS_KILL_GIF),
87
- 'relief'=>'flat').pack('side' =>'right','padx'=>0)
88
- #.pack('side' =>'left','padx'=>5)
89
- #.place('x' => 2, 'width'=>20)
90
- pack('side' =>'top','anchor'=>'nw','fill'=>'x','padx'=>5, 'pady'=>5)
91
- #place('relwidth' => '1')
60
+ b_command = proc{
61
+ message = "Really kill pid #{_event.pid} #{_event.name} ?"
62
+ r=Arcadia.dialog(self,
63
+ 'type'=>'yes_no',
64
+ 'level'=>'warning',
65
+ 'title'=> 'Confirm kill',
66
+ 'msg'=>message)
67
+ if r=="yes"
68
+ _event.abort_action.call
69
+ end
70
+ }
71
+ command b_command
72
+ helptext "#{_event.name} [pid #{_event.pid}]"
73
+ pack('side' =>'left', :padx=>2, :pady=>0)
74
+ Tk::Anigif.image(self, "#{Dir.pwd}/ext/ae-subprocess-inspector/process.res")
92
75
  start_check
93
76
  end
94
77
 
95
78
  def start_check
96
- @progress.numeric=0
97
79
  if @event.timecheck
98
80
  timecheck = @event.timecheck
99
81
  else
@@ -108,9 +90,80 @@ class SubProcessWidget < TkFrame
108
90
  @parent.do_delete_process(self)
109
91
  self.destroy
110
92
  end
111
- @progress.numeric += 1
112
93
  }
113
94
  @timer.set_procs(timecheck,-1,proc_check)
114
95
  @timer.start
115
96
  end
116
- end
97
+ end
98
+
99
+
100
+ #class SubProcessWidget < TkFrame
101
+ # attr_reader :event
102
+ # def initialize(_parent=nil, _event=nil, *args)
103
+ # super(_parent.frame.hinner_frame, Arcadia.style('panel'))
104
+ # @parent = _parent
105
+ # @event = _event
106
+ # @progress = TkVariable.new
107
+ # @pb = Tk::BWidget::ProgressBar.new(
108
+ # self, Arcadia.style('progress').update({
109
+ # :variable=>@progress,
110
+ # :type=>'infinite',
111
+ # :maximum=>500})).place('width'=>-30,'relwidth' => '1','x' => 0,'y' => 2,'height' => 18)
112
+ # #.pack('side' =>'left','fill'=>'x')
113
+ #
114
+ # icon_button = TkButton.new(@pb){
115
+ # background Arcadia.style('panel')['background']
116
+ # relief 'flat'
117
+ # image Arcadia.file_icon(_event.name)
118
+ # }.pack
119
+ #
120
+ # b_command = proc{
121
+ # message = "Really kill pid #{_event.pid} #{_event.name} ?"
122
+ # r=Arcadia.dialog(self,
123
+ # 'type'=>'yes_no',
124
+ # 'level'=>'warning',
125
+ # 'title'=> 'Confirm kill',
126
+ # 'msg'=>message)
127
+ # if r=="yes"
128
+ # _event.abort_action.call
129
+ # end
130
+ # }
131
+ #
132
+ #
133
+ # _b = Tk::BWidget::Button.new(self,
134
+ # #_b = TkButton.new(self,
135
+ # 'command'=>b_command,
136
+ # 'borderwidth'=>0,
137
+ # 'background'=>Arcadia.conf('background'),
138
+ # 'helptext'=>"#{_event.name} [pid #{_event.pid}]",
139
+ # 'image'=> TkPhotoImage.new('data' => PROCESS_KILL_GIF),
140
+ # 'relief'=>'flat').pack('side' =>'right','padx'=>0)
141
+ # #.pack('side' =>'left','padx'=>5)
142
+ # #.place('x' => 2, 'width'=>20)
143
+ # pack('side' =>'top','anchor'=>'nw','fill'=>'x','padx'=>5, 'pady'=>5)
144
+ # #place('relwidth' => '1')
145
+ # start_check
146
+ # end
147
+ #
148
+ # def start_check
149
+ # @progress.numeric=0
150
+ # if @event.timecheck
151
+ # timecheck = @event.timecheck
152
+ # else
153
+ # timecheck = 1000
154
+ # end
155
+ # @timer = TkAfter.new
156
+ # proc_check = proc{
157
+ # alive = @event.alive_check.call
158
+ # #p "ALIVE=#{alive}"
159
+ # if !alive
160
+ # @timer.stop
161
+ # @parent.do_delete_process(self)
162
+ # self.destroy
163
+ # end
164
+ # @progress.numeric += 1
165
+ # }
166
+ # @timer.set_procs(timecheck,-1,proc_check)
167
+ # @timer.start
168
+ # end
169
+ #end
data/lib/a-commons.rb CHANGED
@@ -210,6 +210,7 @@ class ArcadiaExt
210
210
  @arcadia = _arcadia
211
211
  @arcadia.register(self)
212
212
  Arcadia.attach_listener(self, BuildEvent)
213
+ Arcadia.attach_listener(self, InitializeEvent)
213
214
  Arcadia.attach_listener(self, ExitQueryEvent)
214
215
  Arcadia.attach_listener(self, FinalizeEvent)
215
216
  @name = _name
@@ -393,6 +394,7 @@ class Event
393
394
  def break
394
395
  @breaked = true
395
396
  end
397
+
396
398
  end
397
399
 
398
400
  module EventBus #(or SourceEvent)
@@ -537,7 +539,9 @@ module Cacheble
537
539
  end
538
540
 
539
541
  module Configurable
540
-
542
+ LINK_SYMBOL='>>>'
543
+ ADD_SYMBOL='+++'
544
+ FONT_TYPE_SYMBOL='$$font:::'
541
545
  def properties_file2hash(_property_file, _link_hash=nil)
542
546
  r_hash = Hash.new
543
547
  if _property_file && FileTest::exist?(_property_file)
@@ -549,7 +553,7 @@ module Configurable
549
553
  if (_strip_line.length > 0)&&(_strip_line[0,1]!='#')
550
554
  var_plat = _line.split('::')
551
555
  if var_plat.length > 1
552
- if (RUBY_PLATFORM.include?(var_plat[0]))
556
+ if (RUBY_PLATFORM =~ Regexp::new(var_plat[0]))
553
557
  _line = var_plat[1]
554
558
  var_plat[2..-1].collect{|x| _line=_line+'::'+x} if var_plat.length > 2
555
559
  else
@@ -571,7 +575,7 @@ module Configurable
571
575
  _value = var[1].strip
572
576
  var[2..-1].collect{|x| _value=_value+'='+x} if var.length > 2
573
577
  if _link_hash
574
- _value = resolve_link(_value, _link_hash)
578
+ _value = resolve_value(_value, _link_hash)
575
579
  end
576
580
  r_hash[var[0].strip]=_value
577
581
  end
@@ -610,34 +614,34 @@ module Configurable
610
614
  Hash.new.update(@@conf_groups[group_key])
611
615
  end
612
616
 
613
- def resolve_link(_value, _hash_source, _link_symbol='>>>', _add_symbol='+++')
617
+ def resolve_value(_value, _hash_source)
614
618
  if _value.length > 0
615
- _v, _vadd = _value.split(_add_symbol)
619
+ _v, _vadd = _value.split(ADD_SYMBOL)
616
620
  else
617
621
  _v = _value
618
622
  end
619
- if _v.length > 3 && _v[0..2]==_link_symbol
623
+ if _v.length > 3 && _v[0..2]==LINK_SYMBOL
620
624
  _v=_hash_source[_v[3..-1]] if _hash_source[_v[3..-1]]
621
625
  _v=_v+_vadd if _vadd
622
626
  end
623
627
  return _v
624
628
  end
625
629
 
626
- def resolve_properties_link(_hash_target, _hash_source, _link_symbol='>>>', _add_symbol='+++')
630
+ def resolve_properties_link(_hash_target, _hash_source)
627
631
  loop_level_max = 10
628
632
  # _hash_adding = Hash.new
629
633
  _keys_to_extend = Array.new
630
634
  _hash_target.each{|k,value|
631
635
  loop_level = 0
632
636
  if value.length > 0
633
- v, vadd = value.split(_add_symbol)
637
+ v, vadd = value.split(ADD_SYMBOL)
634
638
  else
635
639
  v= value
636
640
  end
637
641
  # p "value=#{value} class=#{value.class}"
638
642
  # p "v=#{v} class=#{v.class}"
639
643
  # p "vadd=#{vadd}"
640
- while loop_level < loop_level_max && v.length > 3 && v[0..2]==_link_symbol
644
+ while loop_level < loop_level_max && v.length > 3 && v[0..2]==LINK_SYMBOL
641
645
  if k[-1..-1]=='.'
642
646
  _keys_to_extend << k
643
647
  break
data/lib/a-contracts.rb CHANGED
@@ -13,6 +13,14 @@
13
13
 
14
14
  class ArcadiaEvent < Event
15
15
  # note--they all have attr_accessor :file, and :dir
16
+ def go!
17
+ Arcadia.process_event(self)
18
+ end
19
+
20
+ def shot!
21
+ Arcadia.broadcast_event(self)
22
+ end
23
+
16
24
  end
17
25
 
18
26
  class QuitEvent < ArcadiaEvent
@@ -28,6 +36,10 @@ class BuildEvent < ArcadiaEvent
28
36
  attr_accessor :name
29
37
  end
30
38
 
39
+ class InitializeEvent < ArcadiaEvent
40
+ end
41
+
42
+
31
43
  # ExitQueryEvent is processed by arcadia-core
32
44
  # before process FinalizeEvent during quiet face.
33
45
  # If listener(Extension) set can_exit property to false then
@@ -52,6 +64,13 @@ class NeedRubyGemWizardEvent < ArcadiaEvent
52
64
  attr_accessor :gem_events
53
65
  end
54
66
 
67
+ class ArcadiaProblemEvent < ArcadiaEvent
68
+ DEPENDENCE_MISSING_TYPE = "DEPENDENCE_MISSING_TYPE"
69
+ RUNTIME_ERROR_TYPE = "RUNTIME_ERROR_TYPE"
70
+ attr_accessor :type, :level, :title, :detail
71
+ end
72
+
73
+
55
74
  # +------------------------------------------+
56
75
  # Generic Layout Event
57
76
  #
@@ -69,7 +88,7 @@ end
69
88
  # +---------------------------------------------+
70
89
 
71
90
  class BufferEvent < ArcadiaEvent # Abstract
72
- attr_accessor :file, :title, :text, :row, :col
91
+ attr_accessor :file, :title, :text, :row, :col, :lang
73
92
  # if file==nil && title==nil buffer=current buffer
74
93
  end
75
94
 
@@ -77,6 +96,7 @@ class NewBufferEvent < BufferEvent
77
96
  end
78
97
 
79
98
  class OpenBufferEvent < BufferEvent
99
+ attr_accessor :select_index
80
100
  end
81
101
 
82
102
  class OpenBufferTransientEvent < OpenBufferEvent
@@ -137,6 +157,8 @@ end
137
157
  class OneBufferExistEvent < BufferEvent
138
158
  end
139
159
 
160
+ class BufferClosedEvent < BufferEvent
161
+ end
140
162
  # +---------------------------------------------+
141
163
  # Debug event
142
164
  # +---------------------------------------------+
@@ -245,6 +267,7 @@ class RunCmdEvent < ArcadiaEvent
245
267
  attr_accessor :title
246
268
  attr_accessor :persistent
247
269
  attr_accessor :runner_name
270
+ attr_accessor :lang
248
271
  end
249
272
 
250
273
  class InputEvent < ArcadiaEvent
data/lib/a-core.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  # by Antonio Galeone <antonio-galeone@rubyforge.org>
4
4
  #
5
5
  # &require_dir_ref=..
6
- # &require_omissis=conf/arcadia.init
6
+ # &require_omissis=#{Dir.pwd}/conf/arcadia.init
7
7
  # &require_omissis=tk
8
8
  # &require_omissis=tk/label
9
9
  # &require_omissis=tk/toplevel
@@ -18,11 +18,12 @@ class Arcadia < TkApplication
18
18
  include Observable
19
19
  attr_reader :layout
20
20
  attr_reader :wf
21
+ attr_reader :mf_root
21
22
  def initialize
22
23
  super(
23
24
  ApplicationParams.new(
24
25
  'arcadia',
25
- '0.9.3',
26
+ '0.10.0',
26
27
  'conf/arcadia.conf',
27
28
  'conf/arcadia.pers'
28
29
  )
@@ -37,6 +38,7 @@ class Arcadia < TkApplication
37
38
  # @splash.deiconify if @splash
38
39
  # Tk.update
39
40
  @wf = TkWidgetFactory.new
41
+ ArcadiaProblemsShower.new(self)
40
42
  ArcadiaDialogManager.new(self)
41
43
  ArcadiaActionDispatcher.new(self)
42
44
  ArcadiaGemsWizard.new(self)
@@ -44,16 +46,15 @@ class Arcadia < TkApplication
44
46
  FocusEventManager.new
45
47
  #self.load_local_config(false)
46
48
  ObjectSpace.define_finalizer($arcadia, self.class.method(:finalize).to_proc)
47
- publish('action.on_exit', proc{do_exit})
48
49
  #_title = "Arcadia Ruby ide :: [Platform = #{RUBY_PLATFORM}] [Ruby version = #{RUBY_VERSION}] [TclTk version = #{tcltk_info.level}]"
49
- _title = "Arcadia ide "
50
+ _title = "Arcadia"
50
51
  @root = TkRoot.new(
51
52
  'background'=> self['conf']['background']
52
53
  ){
53
54
  title _title
54
55
  withdraw
55
- protocol( "WM_DELETE_WINDOW", $arcadia['action.on_exit'])
56
- iconphoto(TkPhotoImage.new('dat'=>ARCADIA_RING_GIF))
56
+ protocol( "WM_DELETE_WINDOW", proc{Arcadia.process_event(QuitEvent.new(self))})
57
+ iconphoto(Arcadia.image_res(ARCADIA_RING_GIF))
57
58
  }
58
59
  @on_event = Hash.new
59
60
 
@@ -71,9 +72,12 @@ class Arcadia < TkApplication
71
72
  'expand'=> 1
72
73
  )
73
74
  #.place('x'=>0,'y'=>0,'relwidth'=>1,'relheight'=>1)
74
- @mf_root.show_statusbar('none')
75
- #@toolbar = @mf_root.add_toolbar
76
- @main_toolbar = ArcadiaMainToolbar.new(self, @mf_root.add_toolbar)
75
+
76
+
77
+
78
+ @mf_root.show_statusbar('status')
79
+ Arcadia.new_statusbar_item("Platform").text=RUBY_PLATFORM
80
+ self['toolbar']= ArcadiaMainToolbar.new(self, @mf_root.add_toolbar)
77
81
  @is_toolbar_show=self['conf']['user_toolbar_show']=='yes'
78
82
  @mf_root.show_toolbar(0,@is_toolbar_show)
79
83
  @use_splash = self['conf']['splash.show']=='yes'
@@ -81,24 +85,67 @@ class Arcadia < TkApplication
81
85
  @splash.set_progress(50) if @splash
82
86
  @splash.deiconify if @splash
83
87
  Tk.update
84
- @splash.next_step('..prepare') if @splash
85
- prepare
86
- @splash.last_step('..load finish') if @splash
88
+ @screenwidth=TkWinfo.screenwidth(@root)
89
+ @screenheight=TkWinfo.screenheight(@root)
90
+ @need_resize=false
91
+ @x_scale=1
92
+ @y_scale=1
87
93
  if self['conf']['geometry']
88
- geometry = self['conf']['geometry']
94
+ w0,h0,x0,y0= geometry_to_a(self['conf']['geometry'])
95
+ g_array = []
96
+ if @screenwidth > 0 && w0.to_i > @screenwidth
97
+ g_array << (@screenwidth - x0.to_i).to_s
98
+ @need_resize = true
99
+ @x_scale = @screenwidth.to_f/w0.to_f
100
+ else
101
+ g_array << w0
102
+ end
103
+ if @screenheight > 0 && h0.to_i > @screenheight
104
+ g_array << (@screenheight - y0.to_i).to_s
105
+ @need_resize = true
106
+ @y_scale = @screenheight.to_f/h0.to_f
107
+ else
108
+ g_array << h0
109
+ end
110
+ g_array << x0
111
+ g_array << y0
112
+ geometry = geometry_from_a(g_array)
89
113
  else
90
- start_width = (TkWinfo.screenwidth(@root)-4)
91
- start_height = (TkWinfo.screenheight(@root)-20)
114
+ start_width = (@screenwidth-4)
115
+ start_height = (@screenheight-20)
92
116
  if RUBY_PLATFORM =~ /mswin|mingw/ # on doze don't go below the start gar
93
117
  start_height -= 50
94
118
  start_width -= 20
95
119
  end
96
120
  geometry = start_width.to_s+'x'+start_height.to_s+'+0+0'
97
121
  end
98
- @root.deiconify
99
- @root.focus(true)
100
- @root.geometry(geometry)
101
- @root.raise
122
+ @splash.next_step('..prepare') if @splash
123
+ prepare
124
+ @splash.last_step('..load finish') if @splash
125
+ begin
126
+ @root.deiconify
127
+ rescue RuntimeError => e
128
+ #p "RuntimeError : #{e.message}"
129
+ Arcadia.runtime_error(e)
130
+ end
131
+ begin
132
+ @root.focus(true)
133
+ rescue RuntimeError => e
134
+ #p "RuntimeError : #{e.message}"
135
+ Arcadia.runtime_error(e)
136
+ end
137
+ begin
138
+ @root.geometry(geometry)
139
+ rescue RuntimeError => e
140
+ #p "RuntimeError : #{e.message}"
141
+ Arcadia.runtime_error(e)
142
+ end
143
+ begin
144
+ @root.raise
145
+ rescue RuntimeError => e
146
+ #p "RuntimeError : #{e.message}"
147
+ Arcadia.runtime_error(e)
148
+ end
102
149
  Tk.update_idletasks
103
150
  if self['conf']['geometry.state'] == 'zoomed'
104
151
  if Arcadia.is_windows?
@@ -290,6 +337,10 @@ class Arcadia < TkApplication
290
337
  end
291
338
  end
292
339
  end
340
+
341
+ def do_initialize
342
+ _build_event = Arcadia.process_event(InitializeEvent.new(self))
343
+ end
293
344
 
294
345
  def load_maximized
295
346
  lm = self['conf']['layout.maximized']
@@ -387,7 +438,7 @@ class Arcadia < TkApplication
387
438
  end
388
439
  end
389
440
 
390
- def init_layout
441
+ def initialize_layout
391
442
  @layout = ArcadiaLayout.new(self, @mf_root.get_frame)
392
443
  suf = "layout.split"
393
444
  elems = self['conf'][suf]
@@ -408,7 +459,12 @@ class Arcadia < TkApplication
408
459
  if perc
409
460
  @layout.add_cols_perc(pt[0].to_i, pt[1].to_i, w.to_i)
410
461
  else
411
- @layout.add_cols(pt[0].to_i, pt[1].to_i, w.to_i)
462
+ if @need_resize
463
+ w_c = (w.to_i*@x_scale).to_i
464
+ else
465
+ w_c = w.to_i
466
+ end
467
+ @layout.add_cols(pt[0].to_i, pt[1].to_i, w_c)
412
468
  end
413
469
  else
414
470
  r = property.split('r')
@@ -419,7 +475,12 @@ class Arcadia < TkApplication
419
475
  if perc
420
476
  @layout.add_rows_perc(pt[0].to_i, pt[1].to_i, w.to_i)
421
477
  else
422
- @layout.add_rows(pt[0].to_i, pt[1].to_i, w.to_i)
478
+ if @need_resize
479
+ w_c = (w.to_i*@y_scale).to_i
480
+ else
481
+ w_c = w.to_i
482
+ end
483
+ @layout.add_rows(pt[0].to_i, pt[1].to_i, w_c)
423
484
  end
424
485
  end
425
486
  end
@@ -452,18 +513,25 @@ class Arcadia < TkApplication
452
513
  self.load_sysdefaultproperty
453
514
  end
454
515
 
455
- def load_sysdefaultproperty
456
- # colors = Hash.new
457
- # colors['background']=self['conf']['background']
458
- # colors['foreground']=self['conf']['foreground']
459
- #
460
- # TkPalette.set(colors)
461
-
462
- Tk.tk_call "eval","option add *background #{self['conf']['background']}"
463
- Tk.tk_call "eval","option add *foreground #{self['conf']['foreground']}"
464
- #Tk.tk_call "eval","option add *font #{self['conf']['font']}"
465
- Tk.tk_call "eval","option add *activebackground #{self['conf']['activebackground']}"
466
- Tk.tk_call "eval","option add *activeforeground #{self['conf']['activeforeground']}"
516
+ def load_sysdefaultproperty
517
+ # Tk.tk_call "eval","option add *background #{self['conf']['background']}"
518
+ # Tk.tk_call "eval","option add *foreground #{self['conf']['foreground']}"
519
+ # Tk.tk_call "eval","option add *activebackground #{self['conf']['activebackground']}"
520
+ # Tk.tk_call "eval","option add *activeforeground #{self['conf']['activeforeground']}"
521
+ # Tk.tk_call "eval","option add *highlightcolor #{self['conf']['background']}"
522
+ # Tk.tk_call "eval","option add *relief #{self['conf']['relief']}"
523
+
524
+ if !Arcadia.is_windows? && File.basename(Arcadia.ruby) != 'ruby'
525
+ begin
526
+ if !FileTest.exist?("#{local_dir}/bin")
527
+ Dir.mkdir("#{local_dir}/bin")
528
+ end
529
+ system("ln -s #{Arcadia.ruby} #{local_dir}/bin/ruby") if !File.exist?("#{local_dir}/bin/ruby")
530
+ rescue Exception => e
531
+ Arcadia.runtime_error(e)
532
+ end
533
+ end
534
+
467
535
  end
468
536
 
469
537
  def prepare
@@ -474,14 +542,10 @@ class Arcadia < TkApplication
474
542
  @splash.next_step if @splash
475
543
  @splash.next_step('... load extensions') if @splash
476
544
  #load_config
477
- init_layout
545
+ initialize_layout
478
546
  publish('buffers.code.in_memory',Hash.new)
479
- publish('action.load_code_from_buffers', proc{TkBuffersChoise.new})
480
- publish('output.action.run_last', proc{$arcadia['output'].run_last})
481
- publish('main.action.open_file', proc{self['editor'].open_file(Arcadia.open_file_dialog)})
482
547
  @splash.next_step('... load obj controller') if @splash
483
548
  @splash.next_step('... load editor') if @splash
484
- publish('main.action.new_file',proc{$arcadia['editor'].open_buffer()})
485
549
  @splash.next_step('... load actions') if @splash
486
550
  #provvisorio
487
551
  @keytest = KeyTest.new
@@ -492,40 +556,37 @@ class Arcadia < TkApplication
492
556
  publish('action.get.font', proc{Tk::BWidget::SelectFont::Dialog.new.create})
493
557
  @splash.next_step if @splash
494
558
  publish('action.show_about', proc{ArcadiaAboutSplash.new.deiconify})
495
- # publish('main.menu', @main_menu)
496
- @main_menu = ArcadiaMainMenu.new(@main_menu_bar)
559
+ self['menubar'] = ArcadiaMainMenu.new(@main_menu_bar)
497
560
  self.do_build
498
- #publish('main.menu', ArcadiaMainMenu.new(@main_menu))
499
561
  @splash.next_step if @splash
500
562
  publish('objic.action.raise_active_obj',
501
563
  proc{
502
564
  InspectorContract.instance.raise_active_toplevel(self)
503
565
  }
504
566
  )
505
- @splash.next_step('... toolbar buttons ') if @splash
506
- #@main_toolbar.load_toolbar_buttons
507
-
508
- #load user controls
567
+ @splash.next_step('... toolbar buttons ') if @splash
509
568
  #Arcadia control
510
- load_user_control(@main_toolbar)
511
- load_user_control(@main_menu)
569
+ load_user_control(self['toolbar'])
570
+ load_user_control(self['menubar'])
512
571
  #Extension control
513
572
  load_key_binding
514
573
  @exts.each{|ext|
515
574
  @splash.next_step("... load #{ext} user controls ") if @splash
516
- load_user_control(@main_menu, ext)
517
- load_user_control(@main_toolbar, ext)
575
+ load_user_control(self['toolbar'], ext)
576
+ load_user_control(self['menubar'], ext)
518
577
  load_key_binding(ext)
519
578
  }
520
- load_user_control(@main_menu,"","e")
521
- load_user_control(@main_toolbar,"","e")
579
+ load_user_control(self['toolbar'],"","e")
580
+ load_user_control(self['menubar'],"","e")
522
581
  load_runners
582
+ do_initialize
523
583
  #@layout.build_invert_menu
524
584
  end
525
585
 
526
586
  def load_runners
527
587
  self['runners'] = Hash.new
528
588
  self['runners_by_ext'] = Hash.new
589
+ self['runners_by_lang'] = Hash.new
529
590
  mr = Arcadia.menu_root('runcurr')
530
591
  return if mr.nil?
531
592
 
@@ -535,6 +596,9 @@ class Arcadia < TkApplication
535
596
  self['runners_by_ext'][ext.strip.sub('.','')]=run
536
597
  }
537
598
  end
599
+ if run[:lang]
600
+ self['runners_by_lang'][run[:lang]]=run
601
+ end
538
602
  if run[:runner] && self['runners'][run[:runner]]
539
603
  run = Hash.new.update(self['runners'][run[:runner]]).update(run)
540
604
  #self['runners'][name]=run
@@ -551,6 +615,7 @@ class Arcadia < TkApplication
551
615
  :command ,{
552
616
  :image => Arcadia.file_icon(run[:file_exts]),
553
617
  :label => _run_title,
618
+ :font => Arcadia.conf('menu.font'),
554
619
  :compound => 'left',
555
620
  :command => _command
556
621
  }
@@ -566,14 +631,15 @@ class Arcadia < TkApplication
566
631
  run[:title] = nil
567
632
  run[:runner_name] = name
568
633
  _command = proc{
569
- _event = Arcadia.process_event(
570
- RunCmdEvent.new(self, run)
571
- )
634
+ _event = Arcadia.process_event(
635
+ RunCmdEvent.new(self, run)
636
+ )
572
637
  }
573
638
  mr.insert('0',
574
639
  :command ,{
575
640
  :image => Arcadia.file_icon(run[:file_exts]),
576
641
  :label => _run_title,
642
+ :font => Arcadia.conf('menu.font'),
577
643
  :compound => 'left',
578
644
  :command => _command
579
645
  }
@@ -737,7 +803,7 @@ class Arcadia < TkApplication
737
803
  begin
738
804
  a = geometry_to_a(_geometry)
739
805
  toolbar_height = @root.winfo_height-@root.winfo_screenheight
740
- a[3] = (a[3].to_i - toolbar_height).to_s
806
+ a[3] = (a[3].to_i - toolbar_height.abs).abs.to_s
741
807
  geometry_from_a(a)
742
808
  rescue
743
809
  return _geometry
@@ -869,6 +935,12 @@ class Arcadia < TkApplication
869
935
  end
870
936
  end
871
937
 
938
+ def Arcadia.runner_for_lang(_lang=nil)
939
+ if @@instance
940
+ return @@instance['runners_by_lang'][_lang]
941
+ end
942
+ end
943
+
872
944
  def Arcadia.runner(_name=nil)
873
945
  if @@instance
874
946
  return @@instance['runners'][_name]
@@ -893,11 +965,6 @@ class Arcadia < TkApplication
893
965
  Configurable.properties_group(_path, Arcadia.instance['conf'], 'conf', _refresh)
894
966
  end
895
967
 
896
- def Arcadia.runner(_name)
897
- @@instance['runners'][_name] if @@instance
898
- end
899
-
900
-
901
968
  def Arcadia.persistent(_property, _value=nil, _immediate=false)
902
969
  if @@instance
903
970
  if _value.nil?
@@ -940,18 +1007,74 @@ class Arcadia < TkApplication
940
1007
  RUBY_PLATFORM =~ /mingw|mswin/
941
1008
  end
942
1009
 
1010
+ def Arcadia.ruby
1011
+ @ruby_interpreter=Gem.ruby if !defined?(@ruby_interpreter)
1012
+ @ruby_interpreter
1013
+ end
1014
+
943
1015
  def Arcadia.which(_command=nil)
944
1016
  return nil if _command.nil?
945
1017
  _ret = nil
946
- ENV['PATH'].split(File::PATH_SEPARATOR).each{|_path|
947
- _file = File.join(_path, _command)
1018
+ _file = _command
1019
+ # command check
1020
+ if FileTest.exist?(_file)
1021
+ _ret = _file
1022
+ end
1023
+ # current dir check
1024
+ if _ret.nil?
1025
+ _file = File.join(Dir.pwd, _command)
1026
+ if FileTest.exist?(_file)
1027
+ _ret = _file
1028
+ end
1029
+ end
1030
+ # $PATH check
1031
+ if _ret.nil?
1032
+ ENV['PATH'].split(File::PATH_SEPARATOR).each{|_path|
1033
+ _file = File.join(_path, _command)
1034
+ if FileTest.exist?(_file)
1035
+ _ret = _file
1036
+ break
1037
+ end
1038
+ }
1039
+ end
1040
+ # gem path check
1041
+ gem_path = Gem.path
1042
+ gem_path.each{|_path|
1043
+ _file = File.join(_path,'bin',_command)
948
1044
  if FileTest.exist?(_file)
949
1045
  _ret = _file
950
1046
  break
1047
+ end
1048
+ } if gem_path && gem_path.kind_of?(Array)
1049
+ # gem specific bin check
1050
+ if _ret.nil?
1051
+ begin
1052
+ _ret = Gem.bin_path(_command)
1053
+ rescue
1054
+ _ret = nil
951
1055
  end
952
- }
1056
+ end
953
1057
  _ret
954
1058
  end
1059
+
1060
+ def Arcadia.[](_name)
1061
+ @@instance[_name]
1062
+ end
1063
+
1064
+ def Arcadia.new_statusbar_item(_help=nil)
1065
+ _other = @@last_status_item if defined?(@@last_status_item)
1066
+ @@last_status_item=@@instance.mf_root.add_indicator()
1067
+ @@last_status_item.configure(:background=>Arcadia.conf("background"))
1068
+ @@last_status_item.configure(:foreground=>Arcadia.conf("foreground"))
1069
+ @@last_status_item.configure(:font=>Arcadia.conf("font"))
1070
+ if _other
1071
+ @@last_status_item.pack('before'=>_other)
1072
+ end
1073
+ if _help
1074
+ Tk::BWidget::DynamicHelp::add(@@last_status_item, 'text'=>_help)
1075
+ end
1076
+ @@last_status_item
1077
+ end
955
1078
 
956
1079
  def Arcadia.menu_root(_menu_root_name, _menu_root=nil)
957
1080
  if @@instance['menu_roots'] == nil
@@ -963,12 +1086,31 @@ class Arcadia < TkApplication
963
1086
  @@instance['menu_roots'][_menu_root_name]
964
1087
  end
965
1088
 
966
-
1089
+ def Arcadia.image_res(_name)
1090
+ if @@instance['image_res'] == nil
1091
+ @@instance['image_res'] = Hash.new
1092
+ end
1093
+ if @@instance['image_res'][_name].nil?
1094
+ @@instance['image_res'][_name] = TkPhotoImage.new('data' => _name)
1095
+ end
1096
+ @@instance['image_res'][_name]
1097
+ end
1098
+
1099
+ def Arcadia.lang_icon(_lang=nil)
1100
+ icon = "FILE_ICON_#{_lang.upcase if _lang}"
1101
+ if _lang && eval("defined?(#{icon})")
1102
+ image_res(eval(icon))
1103
+ else
1104
+ image_res(FILE_ICON_DEFAULT)
1105
+ end
1106
+ end
1107
+
967
1108
  def Arcadia.file_icon(_file_name)
968
1109
  _file_name = '' if _file_name.nil?
969
1110
  if @@instance['file_icons'] == nil
970
1111
  @@instance['file_icons'] = Hash.new
971
- @@instance['file_icons']['default']= TkPhotoImage.new('dat' => FILE_ICON_DEFAULT)
1112
+ @@instance['file_icons']['default']= image_res(FILE_ICON_DEFAULT)
1113
+ #TkPhotoImage.new('dat' => FILE_ICON_DEFAULT)
972
1114
  end
973
1115
  _base_name= File.basename(_file_name)
974
1116
  if _base_name.include?('.')
@@ -980,7 +1122,8 @@ class Arcadia < TkApplication
980
1122
  file_icon_name="FILE_ICON_#{file_dn.upcase}"
981
1123
  begin
982
1124
  if eval("defined?(#{file_icon_name})")
983
- @@instance['file_icons'][file_dn]= TkPhotoImage.new('dat' => eval(file_icon_name))
1125
+ @@instance['file_icons'][file_dn]=image_res(eval(file_icon_name))
1126
+ #TkPhotoImage.new('dat' => eval(file_icon_name))
984
1127
  else
985
1128
  @@instance['file_icons'][file_dn]= @@instance['file_icons']['default']
986
1129
  end
@@ -1000,6 +1143,22 @@ class Arcadia < TkApplication
1000
1143
  # return ret
1001
1144
  # end
1002
1145
 
1146
+ def Arcadia.menubar_item(_name=nil)
1147
+ if _name && @@instance && @@instance['menubar']
1148
+ return @@instance['menubar'].items(_name)
1149
+ end
1150
+ end
1151
+
1152
+ def Arcadia.toolbar_item(_name=nil)
1153
+ if _name && @@instance && @@instance['toolbar']
1154
+ #@@instance['toolbar'].items.each{|k, v | p k}
1155
+ return @@instance['toolbar'].items[_name]
1156
+ end
1157
+ end
1158
+
1159
+ def Arcadia.runtime_error(_e, _title="Runtime Error")
1160
+ ArcadiaProblemEvent.new(self, "type"=>ArcadiaProblemEvent::RUNTIME_ERROR_TYPE,"title"=>"#{_title}:#{_e.message}", "detail"=>_e.backtrace).go!
1161
+ end
1003
1162
 
1004
1163
  end
1005
1164
 
@@ -1066,12 +1225,13 @@ end
1066
1225
 
1067
1226
  class ArcadiaMainToolbar < ArcadiaUserControl
1068
1227
  SUF='user_toolbar'
1228
+ attr_reader :frame
1069
1229
  class UserItem < UserItem
1070
1230
  attr_accessor :frame
1071
1231
  attr_accessor :menu_button
1072
1232
  def initialize(_sender, _args)
1073
1233
  super(_sender, _args)
1074
- _image = TkPhotoImage.new('data' => @image_data) if @image_data
1234
+ _image = Arcadia.image_res(@image_data) if @image_data
1075
1235
  _command = @command #proc{Arcadia.process_event(@event_class.new(_sender, @event_args))} if @event_class
1076
1236
  _hint = @hint
1077
1237
  _font = @font
@@ -1092,8 +1252,8 @@ class ArcadiaMainToolbar < ArcadiaUserControl
1092
1252
  if _args['menu_button'] && _args['menu_button'] == 'yes'
1093
1253
  @menu_button = TkMenuButton.new(_args['frame'], Arcadia.style('toolbarbutton')){|mb|
1094
1254
  indicatoron false
1095
- menu TkMenu.new(mb, Arcadia.style('titlemenu'))
1096
- image TkPhotoImage.new('dat' => MENUBUTTON_ARROW_DOWN_GIF)
1255
+ menu TkMenu.new(mb, Arcadia.style('menu'))
1256
+ image Arcadia.image_res(MENUBUTTON_ARROW_DOWN_GIF)
1097
1257
  padx 0
1098
1258
  pady 0
1099
1259
  pack('side'=> 'left','anchor'=> 's','pady'=>3)
@@ -1103,9 +1263,9 @@ class ArcadiaMainToolbar < ArcadiaUserControl
1103
1263
  #Tk::BWidget::Separator.new(@frame, :orient=>'vertical').pack('side' =>'left', :padx=>2, :pady=>2, :fill=>'y',:anchor=> 'w')
1104
1264
  end
1105
1265
 
1106
- def enabled=(_value)
1266
+ def enable=(_value)
1107
1267
  if _value
1108
- @item_obj.state='enable'
1268
+ @item_obj.state='normal'
1109
1269
  else
1110
1270
  @item_obj.state='disable'
1111
1271
  end
@@ -1152,69 +1312,7 @@ class ArcadiaMainToolbar < ArcadiaUserControl
1152
1312
  :orient=>'vertical',
1153
1313
  :background=>Arcadia.conf('button.highlightbackground')
1154
1314
  ).pack('side' =>'left', :padx=>2, :pady=>2, :fill=>'y',:anchor=> 'w')
1155
- end
1156
-
1157
- # def load_toolbar_buttons
1158
- # suf = 'toolbar_buttons'
1159
- # return if @arcadia['conf'][suf].nil?
1160
- # @buttons = Hash.new
1161
- # toolbar_buttons = @arcadia['conf'][suf].split(',')
1162
- # toolbar_buttons.each{|groups|
1163
- # if groups
1164
- # suf1 = suf+'.'+groups
1165
- # begin
1166
- # buttons = @arcadia['conf'][suf1].split(',')
1167
- # buttons.each{|button|
1168
- # suf2 = suf1+'.'+button
1169
- # name = @arcadia['conf'][suf2+'.name']
1170
- # text = @arcadia['conf'][suf2+'.text']
1171
- # image = @arcadia['conf'][suf2+'.image']
1172
- # font = @arcadia['conf'][suf2+'.font']
1173
- # background = @arcadia['conf'][suf2+'.background']
1174
- # foreground = @arcadia['conf'][suf2+'.foreground']
1175
- # hint = @arcadia['conf'][suf2+'.hint']
1176
- # action = @arcadia['conf'][suf2+'.action']
1177
- # actions = action.split('->') if action
1178
- # if actions && actions.length>1
1179
- # _command = proc{
1180
- # action_obj = $arcadia[actions[0]]
1181
- # 1.upto(actions.length-2) do |x|
1182
- # action_obj = action_obj.send(actions[x])
1183
- # end
1184
- # action_obj.send(actions[actions.length-1])
1185
- # }
1186
- # elsif action
1187
- # _command = proc{$arcadia[action].call}
1188
- # end
1189
- # @buttons[name] = Tk::BWidget::Button.new(@frame){
1190
- # image TkPhotoImage.new('data' => eval(image)) if image
1191
- # borderwidth 1
1192
- # font font if font
1193
- # background background if background
1194
- # foreground foreground if foreground
1195
- # command _command if action
1196
- # relief 'flat'
1197
- # helptext hint if hint
1198
- # text text if text
1199
- # pack('side' =>'left', :padx=>2, :pady=>0)
1200
- # }
1201
- # }
1202
- # rescue Exception
1203
- # msg = 'Loading '+groups+'" -> '+buttons.to_s+ '" (' + $!.class.to_s + ") : " + $!.to_s + " at : "+$@.to_s
1204
- # if Tk.messageBox('icon' => 'error', 'type' => 'okcancel',
1205
- # 'title' => '(Arcadia) Toolbar', 'parent' => @frame,
1206
- # 'message' => msg) == 'cancel'
1207
- # raise
1208
- # exit
1209
- # else
1210
- # Tk.update
1211
- # end
1212
- # end
1213
- # end
1214
- # Tk::BWidget::Separator.new(@frame, :orient=>'vertical').pack('side' =>'left', :padx=>2, :pady=>2, :fill=>'y',:anchor=> 'w')
1215
- # }
1216
- # end
1217
-
1315
+ end
1218
1316
 
1219
1317
  end
1220
1318
 
@@ -1226,27 +1324,26 @@ class ArcadiaMainMenu < ArcadiaUserControl
1226
1324
  attr_accessor :type
1227
1325
  def initialize(_sender, _args)
1228
1326
  super(_sender, _args)
1229
- _command = @command #proc{ Arcadia.process_event(@event_class.new(_sender, @event_args)) } if @event_class
1230
- #_menu = @menu[@parent]
1231
1327
  item_args = Hash.new
1232
- item_args['image']=TkPhotoImage.new('data' => @image_data) if @image_data
1233
- item_args['label']=@caption
1234
- item_args['underline']=@underline.to_i if @underline != nil
1235
- item_args['compound']='left'
1236
- item_args['command']=_command
1237
- if @type.nil? && _commnad.nil? && @name == '-'
1328
+ item_args[:image]=Arcadia.image_res(@image_data) if @image_data
1329
+ item_args[:label]=@caption
1330
+ item_args[:font]=Arcadia.conf('menu.font')
1331
+ item_args[:underline]=@underline.to_i if @underline != nil
1332
+ item_args[:compound]='left'
1333
+ item_args[:command]=@command
1334
+ if @type.nil? && @commnad.nil? && @name == '-'
1238
1335
  @type=:separator
1239
1336
  item_args.clear
1240
1337
  elsif @type.nil?
1241
1338
  @type=:command
1242
1339
  end
1243
- @item_obj = @menu.insert('end', @type ,item_args)
1340
+ @item_obj = @menu.insert('end', @type ,item_args)
1244
1341
  @index = @menu.index('last')
1245
1342
  end
1246
1343
 
1247
- def enabled=(_value)
1344
+ def enable=(_value)
1248
1345
  if _value
1249
- @item_obj.entryconfigure(@index, 'state'=>'enable')
1346
+ @item_obj.entryconfigure(@index,'state'=>'normal')
1250
1347
  else
1251
1348
  @item_obj.entryconfigure(@index,'state'=>'disable')
1252
1349
  end
@@ -1257,7 +1354,12 @@ class ArcadiaMainMenu < ArcadiaUserControl
1257
1354
  # create main menu
1258
1355
  @menu = menu
1259
1356
  build
1260
- @menu.configure(Arcadia.style('menu'))
1357
+ begin
1358
+ @menu.configure(Arcadia.style('menu'))
1359
+ rescue RuntimeError => e
1360
+ #p "RuntimeError : #{e.message}"
1361
+ Arcadia.runtime_error(e)
1362
+ end
1261
1363
  end
1262
1364
 
1263
1365
  def get_menu_context(_menubar, _context, _underline=nil)
@@ -1360,12 +1462,12 @@ class ArcadiaMainMenu < ArcadiaUserControl
1360
1462
  menu_spec_file = [
1361
1463
  ['File', 0],
1362
1464
  ['Open', proc{Arcadia.process_event(OpenBufferEvent.new(self,'file'=>Arcadia.open_file_dialog))}, 0],
1363
- ['New', $arcadia['main.action.new_file'], 0],
1465
+ ['New', proc{Arcadia.process_event(NewBufferEvent.new(self))}, 0],
1364
1466
  #['Save', proc{EditorContract.instance.save_file_raised(self)},0],
1365
1467
  ['Save', proc{Arcadia.process_event(SaveBufferEvent.new(self))},0],
1366
1468
  ['Save as ...', proc{Arcadia.process_event(SaveAsBufferEvent.new(self))},0],
1367
1469
  '---',
1368
- ['Quit', $arcadia['action.on_exit'], 0]]
1470
+ ['Quit', proc{Arcadia.process_event(QuitEvent.new(self))}, 0]]
1369
1471
  menu_spec_edit = [['Edit', 0],
1370
1472
  ['Cut', proc{Arcadia.process_event(CutTextEvent.new(self))}, 2],
1371
1473
  ['Copy', proc{Arcadia.process_event(CopyTextEvent.new(self))}, 0],
@@ -1393,13 +1495,17 @@ class ArcadiaMainMenu < ArcadiaUserControl
1393
1495
  ]
1394
1496
  menu_spec_help = [['Help', 0],
1395
1497
  ['About', $arcadia['action.show_about'], 2],]
1396
- @menu.add_menu(menu_spec_file)
1397
- @menu.add_menu(menu_spec_edit)
1398
- @menu.add_menu(menu_spec_search)
1399
- @menu.add_menu(menu_spec_view)
1400
- @menu.add_menu(menu_spec_tools)
1401
- @menu.add_menu(menu_spec_help)
1402
-
1498
+ begin
1499
+ @menu.add_menu(menu_spec_file)
1500
+ @menu.add_menu(menu_spec_edit)
1501
+ @menu.add_menu(menu_spec_search)
1502
+ @menu.add_menu(menu_spec_view)
1503
+ @menu.add_menu(menu_spec_tools)
1504
+ @menu.add_menu(menu_spec_help)
1505
+ rescue RuntimeError => e
1506
+ #p "RuntimeError : #{e.message}"
1507
+ Arcadia.runtime_error(e)
1508
+ end
1403
1509
  # #@menu.bind_append("1", proc{
1404
1510
  # chs = TkWinfo.children(@menu)
1405
1511
  # hh = 25
@@ -1450,6 +1556,7 @@ class ArcadiaMainMenu < ArcadiaUserControl
1450
1556
  # @last_post=nil
1451
1557
  # end
1452
1558
  # })
1559
+
1453
1560
  @menu.extend(TkAutoPostMenu)
1454
1561
  @menu.event_posting_on
1455
1562
  end
@@ -1501,7 +1608,7 @@ class RunnerManager < TkFloatTitledFrame
1501
1608
  'command'=>_close_command,
1502
1609
  'helptext'=>@runner_hash[:file],
1503
1610
  'background'=>'white',
1504
- 'image'=> TkPhotoImage.new('data' => TRASH_GIF),
1611
+ 'image'=> Arcadia.image_res(TRASH_GIF),
1505
1612
  'relief'=>'flat').pack('side' =>'right','padx'=>0)
1506
1613
  pack('side' =>'top','anchor'=>'nw','fill'=>'x','padx'=>5, 'pady'=>5)
1507
1614
  end
@@ -1550,7 +1657,7 @@ class ArcadiaAboutSplash < TkToplevel
1550
1657
  overrideredirect(true)
1551
1658
 
1552
1659
  @tkLabel3 = TkLabel.new(self){
1553
- image TkPhotoImage.new('format'=>'GIF','data' =>A_LOGO_GIF)
1660
+ image Arcadia.image_res(A_LOGO_GIF)
1554
1661
  background _bgcolor
1555
1662
  place('x'=> 20,'y' => 20)
1556
1663
  }
@@ -1566,14 +1673,14 @@ class ArcadiaAboutSplash < TkToplevel
1566
1673
  # }
1567
1674
 
1568
1675
  @tkLabel1 = TkLabel.new(self){
1569
- image TkPhotoImage.new('format'=>'GIF','data' =>ARCADIA_JAP_GIF)
1676
+ image Arcadia.image_res(ARCADIA_JAP_GIF)
1570
1677
  background _bgcolor
1571
1678
  justify 'left'
1572
1679
  place('x' => 90,'y' => 10)
1573
1680
  }
1574
1681
 
1575
1682
  @tkLabelRuby = TkLabel.new(self){
1576
- image TkPhotoImage.new('data' =>RUBY_DOCUMENT_GIF)
1683
+ image Arcadia.image_res(RUBY_DOCUMENT_GIF)
1577
1684
  background _bgcolor
1578
1685
  place('x'=> 210,'y' => 12)
1579
1686
  }
@@ -1636,6 +1743,35 @@ class ArcadiaAboutSplash < TkToplevel
1636
1743
  bind("Double-Button-1", proc{self.destroy})
1637
1744
  info = TkApplication.sys_info
1638
1745
  set_sysinfo(info)
1746
+ Arcadia.attach_listener(self, ArcadiaProblemEvent)
1747
+ end
1748
+
1749
+ def problem_str
1750
+ @problems_nums > 1 ? "#{@problems_nums} problems found!" : "#{@problems_nums} problem found!"
1751
+ end
1752
+
1753
+ def on_arcadia_problem(_event)
1754
+ if !defined?(@problems_nums)
1755
+ @problems_nums=0
1756
+ #@problem_str = proc{@problems_nums > 1 ? "#{@problems_nums} problems found!" : "#{@problem_nums} problem found!"}
1757
+ @tkAlert = TkLabel.new(self){
1758
+ image Arcadia.image_res(ALERT_GIF)
1759
+ background 'black'
1760
+ place('x'=> 10,'y' => 150)
1761
+ }
1762
+
1763
+ @tkLabelProblems = TkLabel.new(self){
1764
+ text ''
1765
+ background 'black'
1766
+ foreground 'red'
1767
+ font Arcadia.instance['conf']['splash.problems.font']
1768
+ justify 'left'
1769
+ anchor 'w'
1770
+ place('width' => '210','x' => 28,'y' => 150,'height' => 25)
1771
+ }
1772
+ end
1773
+ @problems_nums=@problems_nums+1
1774
+ @tkLabelProblems.text=problem_str if @tkLabelProblems
1639
1775
  end
1640
1776
 
1641
1777
  def set_sysinfo(_info)
@@ -1647,11 +1783,11 @@ class ArcadiaAboutSplash < TkToplevel
1647
1783
  Tk::BWidget::ProgressBar.new(self, :width=>150, :height=>10,
1648
1784
  :background=>'#000000',
1649
1785
  :troughcolor=>'#000000',
1650
- :foreground=>'#a11934',
1786
+ :foreground=>'#666666',
1651
1787
  :variable=>@progress,
1652
1788
  :borderwidth=>0,
1653
1789
  :relief=>'flat',
1654
- :maximum=>_max).place('relwidth' => '1','y' => 146,'height' => 2)
1790
+ :maximum=>_max).place('relwidth' => '1','y' => 144,'height' => 6)
1655
1791
  end
1656
1792
 
1657
1793
  def reset
@@ -1671,7 +1807,213 @@ class ArcadiaAboutSplash < TkToplevel
1671
1807
  def last_step(_txt = nil)
1672
1808
  @progress.numeric = @max
1673
1809
  labelStep(_txt) if _txt
1810
+ Arcadia.detach_listener(self, ArcadiaProblemEvent)
1811
+ end
1812
+ end
1813
+
1814
+ class ArcadiaProblemsShower
1815
+ def initialize(_arcadia)
1816
+ @arcadia = _arcadia
1817
+ @showed = false
1818
+ @initialized = false
1819
+ #@visible = false
1820
+ @problems = Array.new
1821
+ @seq = 0
1822
+ @dmc=0
1823
+ @rec=0
1824
+ Arcadia.attach_listener(self, ArcadiaProblemEvent)
1825
+ Arcadia.attach_listener(self, InitializeEvent)
1826
+ end
1827
+
1828
+ def on_arcadia_problem(_event)
1829
+ @problems << _event
1830
+ if @initialized
1831
+ if !@showed
1832
+ show_problems
1833
+ else
1834
+ append_problem(_event)
1835
+ @b_err.configure('text'=> button_text)
1836
+ end
1837
+ end
1838
+ end
1839
+
1840
+ def on_after_initialize(_event)
1841
+ @initialized = true
1842
+ if @problems.count > 0
1843
+ show_problems
1844
+ end
1845
+ end
1846
+
1847
+ def show_problems
1848
+ begin
1849
+ initialize_gui
1850
+ @problems.each{|e|
1851
+ append_problem(e)
1852
+ }
1853
+ if @tree.exist?('dependences_missing_node')
1854
+ @tree.open_tree('dependences_missing_node', true)
1855
+ end
1856
+ if @tree.exist?('runtime_error_node')
1857
+ @tree.open_tree('runtime_error_node', true)
1858
+ end
1859
+ @showed=true
1860
+ rescue RuntimeError => e
1861
+ Arcadia.detach_listener(self, ArcadiaProblemEvent)
1862
+ Arcadia.detach_listener(self, InitializeEvent)
1863
+ end
1864
+ end
1865
+
1866
+ def button_text
1867
+ @problems.count > 1 ? "#{@problems.count} problems" : "#{@problems.count} problem"
1868
+ end
1869
+
1870
+
1871
+ def initialize_gui
1872
+ # float_frame
1873
+ args = {'width'=>600, 'height'=>300, 'x'=>400, 'y'=>100}
1874
+ @ff = @arcadia.layout.new_float_frame(args).hide
1875
+ @ff.title("Arcadia problems")
1876
+
1877
+ #tree
1878
+ @tree = BWidgetTreePatched.new(@ff.frame, Arcadia.style('treepanel')){
1879
+ showlines false
1880
+ deltay 22
1881
+ # opencmd do_open_folder_cmd
1882
+ # closecmd do_close_folder_cmd
1883
+ # selectcommand do_select_item
1884
+ # crosscloseimage TkPhotoImage.new('dat' => PLUS_GIF)
1885
+ # crossopenimage TkPhotoImage.new('dat' => MINUS_GIF)
1886
+ }
1887
+ @tree.extend(TkScrollableWidget).show(0,0)
1888
+
1889
+ do_double_click = proc{
1890
+ _selected = @tree.selected
1891
+ _selected_text = @tree.itemcget(_selected, 'text')
1892
+ if _selected_text
1893
+ _file, _row, _other = _selected_text.split(':')
1894
+ if File.exist?(_file)
1895
+ begin
1896
+ r = _row.strip.to_i
1897
+ integer = true
1898
+ rescue Exception => e
1899
+ integer = false
1900
+ end
1901
+ if integer
1902
+ OpenBufferTransientEvent.new(self,'file'=>_file, 'row'=>r).go!
1903
+ end
1904
+ end
1905
+ end
1906
+ }
1907
+ @tree.textbind_append('Double-1',do_double_click)
1908
+
1909
+
1910
+ # call button
1911
+ command = proc{
1912
+ if @ff.visible?
1913
+ @ff.hide
1914
+ #@visible = false
1915
+ else
1916
+ @ff.show
1917
+ #@visible = true
1918
+ end
1919
+ }
1920
+
1921
+ b_style = Arcadia.style('toolbarbutton')
1922
+ b_style["relief"]='groove'
1923
+ # b_style["borderwidth"]=2
1924
+ b_style["highlightbackground"]='red'
1925
+
1926
+ b_text = button_text
1927
+
1928
+ @b_err = Tk::BWidget::Button.new(@arcadia['toolbar'].frame, b_style){
1929
+ image Arcadia.image_res(ALERT_GIF)
1930
+ compound 'left'
1931
+ padx 2
1932
+ command command if command
1933
+ #width 100
1934
+ #height 20
1935
+ #helptext _hint if _hint
1936
+ text b_text
1937
+ }.pack('side' =>'left','before'=>@arcadia['toolbar'].items.values[0].item_obj, :padx=>2, :pady=>0)
1938
+
1939
+ end
1940
+
1941
+
1942
+ def new_sequence_value
1943
+ @seq+=1
1674
1944
  end
1945
+
1946
+ def append_problem(e)
1947
+ parent_node='root'
1948
+ case e.type
1949
+ when ArcadiaProblemEvent::DEPENDENCE_MISSING_TYPE
1950
+ parent_node='dependences_missing_node'
1951
+ text = "Dependences missings"
1952
+ if !@tree.exist?(parent_node)
1953
+ @tree.insert('end', 'root' ,parent_node, {
1954
+ 'text' => text ,
1955
+ 'helptext' => text,
1956
+ 'drawcross'=>'auto',
1957
+ 'deltax'=>-1,
1958
+ 'image'=> Arcadia.image_res(BROKEN_GIF)
1959
+ }.update(Arcadia.style('treeitem')) #.update({'fill'=>Arcadia.conf('inactiveforeground')}))
1960
+ )
1961
+
1962
+ end
1963
+ @dmc+=1
1964
+ @tree.itemconfigure('dependences_missing_node','text'=>"#{text} (#{@dmc})" )
1965
+ when ArcadiaProblemEvent::RUNTIME_ERROR_TYPE
1966
+ parent_node='runtime_error_node'
1967
+ text = "Runtime errors"
1968
+ if !@tree.exist?(parent_node)
1969
+ @tree.insert('end', 'root' ,parent_node, {
1970
+ 'text' => text ,
1971
+ 'helptext' => text,
1972
+ 'drawcross'=>'auto',
1973
+ 'deltax'=>-1,
1974
+ 'image'=> Arcadia.image_res(ERROR_GIF)
1975
+ }.update(Arcadia.style('treeitem')) #.update({'fill'=>Arcadia.conf('inactiveforeground')}))
1976
+ )
1977
+ end
1978
+ @rec+=1
1979
+ @tree.itemconfigure('runtime_error_node','text'=>"#{text} (#{@rec})" )
1980
+ end
1981
+ title_node="node_#{new_sequence_value}"
1982
+ detail_node="detail_of_#{title_node}"
1983
+
1984
+ @tree.insert('end', parent_node ,title_node, {
1985
+ 'text' => e.title ,
1986
+ 'helptext' => e.title,
1987
+ 'drawcross'=>'auto',
1988
+ 'deltax'=>-1,
1989
+ 'image'=> Arcadia.image_res(ITEM_GIF)
1990
+ }.update(Arcadia.style('treeitem')) #.update({'fill'=>Arcadia.conf('inactiveforeground')}))
1991
+ )
1992
+ if e.detail.kind_of?(Array)
1993
+ e.detail.each_with_index{|line,i|
1994
+ @tree.insert('end', title_node , "#{detail_node}_#{i}" , {
1995
+ 'text' => line ,
1996
+ 'helptext' => i.to_s,
1997
+ 'drawcross'=>'auto',
1998
+ 'deltax'=>-1,
1999
+ 'image'=> Arcadia.image_res(ITEM_DETAIL_GIF)
2000
+ }.update(Arcadia.style('treeitem')) #.update({'fill'=>Arcadia.conf('inactiveforeground')}))
2001
+ )
2002
+
2003
+ }
2004
+ else
2005
+ @tree.insert('end', title_node , detail_node , {
2006
+ 'text' => e.detail ,
2007
+ 'helptext' => e.title,
2008
+ 'drawcross'=>'auto',
2009
+ 'deltax'=>-1,
2010
+ 'image'=> Arcadia.image_res(ITEM_DETAIL_GIF)
2011
+ }.update(Arcadia.style('treeitem')) #.update({'fill'=>Arcadia.conf('inactiveforeground')}))
2012
+ )
2013
+ end
2014
+
2015
+
2016
+ end
1675
2017
  end
1676
2018
 
1677
2019
  class ArcadiaActionDispatcher
@@ -1698,7 +2040,7 @@ class ArcadiaSh < TkToplevel
1698
2040
  def initialize
1699
2041
  super
1700
2042
  title 'ArcadiaSh'
1701
- iconphoto(TkPhotoImage.new('dat'=>ARCADIA_RING_GIF))
2043
+ iconphoto(Arcadia.image_res(ARCADIA_RING_GIF))
1702
2044
  geometry = '800x200+10+10'
1703
2045
  geometry(geometry)
1704
2046
  @text = TkText.new(self, Arcadia.style('text')){
@@ -1845,30 +2187,28 @@ class ArcadiaGemsWizard
1845
2187
  @arcadia = _arcadia
1846
2188
  Arcadia.attach_listener(self, NeedRubyGemWizardEvent)
1847
2189
  end
1848
-
2190
+
1849
2191
  def on_need_ruby_gem_wizard(_event)
1850
- # ... todo implamentation
1851
- msg = "Appears that gem : '#{_event.gem_name}' required by : '#{_event.extension_name}' is not installed!\n Do you want to try install it now?"
1852
- ans = Tk.messageBox('icon' => 'error', 'type' => 'yesno',
1853
- 'title' => "(Arcadia) Extensions '#{_event.extension_name}'",
1854
- 'message' => msg)
1855
- if ans == 'yes'
1856
- _event.add_result(self, 'installed'=>try_to_install_gem(_event.gem_name,_event.gem_repository))
1857
- else
1858
- _event.add_result(self, 'installed'=>false)
1859
- end
2192
+ msg = "Appears that gem : '#{_event.gem_name}' required by : '#{_event.extension_name}' is not installed!\n Install it from gem?"
2193
+
2194
+ ArcadiaProblemEvent.new(self, "type"=>ArcadiaProblemEvent::DEPENDENCE_MISSING_TYPE,"title"=>"Gem '#{_event.gem_name}' missing!", "detail"=>msg).go!
2195
+
2196
+ # Arcadia.process_event(ArcadiaProblemEvent.new(self, "type"=>ArcadiaProblemEvent::DEPENDENCE_MISSING_TYPE,"title"=>"Gem '#{_event.gem_name}' missing!", "detail"=>msg))
1860
2197
  end
2198
+
1861
2199
 
1862
- # def try_to_install_gem(name, repository=nil, version = '>0')
1863
- # ret = false
1864
- # require 'rubygems/command.rb'
1865
- # require 'rubygems/dependency_installer.rb'
1866
- #
1867
- # inst.install name, version
1868
- # # TODO WIZARD
1869
- # # TODO accept repository, too
2200
+ # def on_need_ruby_gem_wizard(_event)
2201
+ # msg = "Appears that gem : '#{_event.gem_name}' required by : '#{_event.extension_name}' is not installed!\n Do you want to try install it now?"
2202
+ # ans = Tk.messageBox('icon' => 'error', 'type' => 'yesno',
2203
+ # 'title' => "(Arcadia) Extensions '#{_event.extension_name}'",
2204
+ # 'message' => msg)
2205
+ # if ans == 'yes'
2206
+ # _event.add_result(self, 'installed'=>try_to_install_gem(_event.gem_name,_event.gem_repository))
2207
+ # else
2208
+ # _event.add_result(self, 'installed'=>false)
2209
+ # end
1870
2210
  # end
1871
-
2211
+
1872
2212
  def try_to_install_gem(name, repository=nil, version = '>0')
1873
2213
  ret = false
1874
2214
 
@@ -2536,14 +2876,14 @@ class ArcadiaLayout
2536
2876
  _menu.insert('end', :separator)
2537
2877
  _menu.insert('end',:command,
2538
2878
  :label=>"add column",
2539
- :image=>TkPhotoImage.new('dat'=>ADD_GIF),
2879
+ :image=>Arcadia.image_res(ADD_GIF),
2540
2880
  :compound=>'left',
2541
2881
  :command=>proc{add_cols_runtime(_domain)},
2542
2882
  :hidemargin => true
2543
2883
  )
2544
2884
  _menu.insert('end',:command,
2545
2885
  :label=>"add row",
2546
- :image=>TkPhotoImage.new('dat'=>ADD_GIF),
2886
+ :image=>Arcadia.image_res(ADD_GIF),
2547
2887
  :compound=>'left',
2548
2888
  :command=>proc{add_rows_runtime(_domain)},
2549
2889
  :hidemargin => true
@@ -2551,7 +2891,7 @@ class ArcadiaLayout
2551
2891
  if @panels.keys.length > 2
2552
2892
  _menu.insert('end',:command,
2553
2893
  :label=>"close",
2554
- :image=>TkPhotoImage.new('dat'=>CLOSE_FRAME_GIF),
2894
+ :image=>Arcadia.image_res(CLOSE_FRAME_GIF),
2555
2895
  :compound=>'left',
2556
2896
  :command=>proc{close_runtime(_domain)},
2557
2897
  :hidemargin => true
@@ -2701,7 +3041,7 @@ class ArcadiaLayout
2701
3041
  menu = @panels[dom]['root'].menu_button('ext').cget('menu')
2702
3042
  menu.insert('0',:command,
2703
3043
  :label=>_ffw.title,
2704
- :image=>TkPhotoImage.new('dat'=>ARROW_LEFT_GIF),
3044
+ :image=>Arcadia.image_res(ARROW_LEFT_GIF),
2705
3045
  :compound=>'left',
2706
3046
  :command=>proc{change_domain(dom, _ffw.name)},
2707
3047
  :hidemargin => true
@@ -2724,7 +3064,7 @@ class ArcadiaLayout
2724
3064
  end
2725
3065
  mymenu.insert(index,:command,
2726
3066
  :label=>"close \"#{_ffw.title}\"",
2727
- :image=>TkPhotoImage.new('dat'=>CLOSE_FRAME_GIF),
3067
+ :image=>Arcadia.image_res(CLOSE_FRAME_GIF),
2728
3068
  :compound=>'left',
2729
3069
  :command=>proc{unregister_panel(_ffw, false, true)},
2730
3070
  :hidemargin => true
@@ -2789,7 +3129,7 @@ class ArcadiaLayout
2789
3129
  if _adapter
2790
3130
  adapter = _adapter
2791
3131
  else
2792
- adapter = TkFrameAdapter.new(self.root, Arcadia.style('frame'))
3132
+ adapter = TkFrameAdapter.new(self.root)
2793
3133
  end
2794
3134
  adapter.attach_frame(root_frame)
2795
3135
  adapter.raise
@@ -2846,7 +3186,7 @@ class ArcadiaLayout
2846
3186
  if _adapter
2847
3187
  adapter = _adapter
2848
3188
  else
2849
- adapter = TkFrameAdapter.new(self.root, Arcadia.style('frame'))
3189
+ adapter = TkFrameAdapter.new(self.root)
2850
3190
  end
2851
3191
  adapter.attach_frame(_panel)
2852
3192
  adapter.raise
@@ -2861,7 +3201,7 @@ class ArcadiaLayout
2861
3201
  else
2862
3202
  _ffw.domain = nil
2863
3203
  process_frame(_ffw)
2864
- return TkFrameAdapter.new(self.root, Arcadia.style('frame'))
3204
+ return TkFrameAdapter.new(self.root)
2865
3205
  #
2866
3206
  # Arcadia.dialog(self,
2867
3207
  # 'type'=>'ok',
@@ -3113,13 +3453,29 @@ class MonitorLastUsedDir
3113
3453
 
3114
3454
  end
3115
3455
 
3456
+ require 'tk/clipboard'
3457
+
3116
3458
  class FocusEventManager
3117
3459
  def initialize
3118
3460
  Arcadia.attach_listener(self, FocusEvent)
3461
+ Arcadia.attach_listener(self, InputEvent)
3462
+ end
3463
+
3464
+ def on_input(_event)
3465
+ case _event
3466
+ when InputEnterEvent
3467
+ @last_focus_widget = _event.receiver
3468
+ when InputExitEvent
3469
+ @last_focus_widget = nil
3470
+ end
3119
3471
  end
3120
3472
 
3121
3473
  def on_focus(_event)
3122
- _event.focus_widget=Tk.focus
3474
+ if @last_focus_widget
3475
+ _event.focus_widget = @last_focus_widget
3476
+ else
3477
+ _event.focus_widget=Tk.focus
3478
+ end
3123
3479
  case _event
3124
3480
  when CutTextEvent
3125
3481
  do_cut(_event.focus_widget)
@@ -3143,15 +3499,36 @@ class FocusEventManager
3143
3499
  end
3144
3500
 
3145
3501
  def do_cut(_focused_widget)
3146
- _focused_widget.text_cut if _focused_widget.respond_to?(:text_cut)
3502
+ if _focused_widget.respond_to?(:text_cut)
3503
+ _focused_widget.text_cut
3504
+ elsif _focused_widget.kind_of?(Tk::Entry)
3505
+ if _focused_widget.selection_present
3506
+ i1= _focused_widget.index("sel.first")
3507
+ i2= _focused_widget.index("sel.last")
3508
+ TkClipboard::set(_focused_widget.value[i1.to_i..i2.to_i-1])
3509
+ _focused_widget.delete(i1,i2)
3510
+ end
3511
+ end
3147
3512
  end
3148
3513
 
3149
3514
  def do_copy(_focused_widget)
3150
- _focused_widget.text_copy if _focused_widget.respond_to?(:text_copy)
3515
+ if _focused_widget.respond_to?(:text_copy)
3516
+ _focused_widget.text_copy
3517
+ elsif _focused_widget.kind_of?(Tk::Entry)
3518
+ if _focused_widget.selection_present
3519
+ i1= _focused_widget.index("sel.first")
3520
+ i2= _focused_widget.index("sel.last")
3521
+ TkClipboard::set(_focused_widget.value[i1.to_i..i2.to_i-1])
3522
+ end
3523
+ end
3151
3524
  end
3152
3525
 
3153
3526
  def do_paste(_focused_widget)
3154
- _focused_widget.text_paste if _focused_widget.respond_to?(:text_paste)
3527
+ if _focused_widget.respond_to?(:text_paste)
3528
+ _focused_widget.text_paste
3529
+ elsif _focused_widget.kind_of?(Tk::Entry)
3530
+ _focused_widget.insert(_focused_widget.index("insert"), TkClipboard::get)
3531
+ end
3155
3532
  end
3156
3533
 
3157
3534
  def do_undo(_focused_widget)
@@ -3171,7 +3548,12 @@ class FocusEventManager
3171
3548
  end
3172
3549
 
3173
3550
  def do_select_all(_focused_widget)
3174
- _focused_widget.tag_add('sel','1.0','end') if _focused_widget.respond_to?(:tag_add)
3551
+ if _focused_widget.respond_to?(:tag_add)
3552
+ _focused_widget.tag_add('sel','1.0','end')
3553
+ elsif _focused_widget.kind_of?(Tk::Entry)
3554
+ _focused_widget.selection_from('0')
3555
+ _focused_widget.selection_to('end')
3556
+ end
3175
3557
  end
3176
3558
 
3177
3559
  def do_invert_selection(_focused_widget)
@@ -3208,6 +3590,14 @@ class FocusEventManager
3208
3590
  _focused_widget.insert(r[0][0],target_text.send(_method))
3209
3591
  end
3210
3592
  end
3593
+ elsif _focused_widget.kind_of?(Tk::Entry)
3594
+ if _focused_widget.selection_present
3595
+ i1= _focused_widget.index("sel.first")
3596
+ i2= _focused_widget.index("sel.last")
3597
+ target_text = _focused_widget.value[i1.to_i..i2.to_i-1]
3598
+ _focused_widget.delete(i1,i2)
3599
+ _focused_widget.insert(i1,target_text.send(_method))
3600
+ end
3211
3601
  end
3212
3602
  end
3213
3603
  end