arcadia 0.7.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -12,6 +12,7 @@
12
12
  # +------------------------------------------+
13
13
 
14
14
  class ArcadiaEvent < Event
15
+ # note--they all have attr_accessor :file, and :dir
15
16
  end
16
17
 
17
18
  class QuitEvent < ArcadiaEvent
@@ -20,12 +21,17 @@ end
20
21
  # +------------------------------------------+
21
22
  # Extention Event (raised only by Arcadia)
22
23
  # do not raise!
24
+ # Every extensions listen on these events
23
25
  # +------------------------------------------+
24
26
 
25
27
  class BuildEvent < ArcadiaEvent
26
28
  attr_accessor :name
27
29
  end
28
30
 
31
+ # ExitQueryEvent is processed by arcadia-core
32
+ # before process FinalizeEvent during quiet face.
33
+ # If listener(Extension) set can_exit property to false then
34
+ # arcadia abort the quiet face.
29
35
  class ExitQueryEvent < ArcadiaEvent
30
36
  attr_accessor :can_exit
31
37
  end
@@ -33,6 +39,19 @@ end
33
39
  class FinalizeEvent < ArcadiaEvent
34
40
  end
35
41
 
42
+
43
+ class NeedRubyGemWizardEvent < ArcadiaEvent
44
+ class Result < Result
45
+ attr_accessor :installed
46
+ end
47
+ attr_accessor :extension_name
48
+ attr_accessor :gem_name
49
+ attr_accessor :gem_repository
50
+ attr_accessor :gem_min_version
51
+ attr_accessor :gem_max_version
52
+ attr_accessor :gem_events
53
+ end
54
+
36
55
  # +------------------------------------------+
37
56
  # Generic Layout Event
38
57
  #
@@ -76,10 +95,17 @@ class MoveBufferEvent < BufferEvent
76
95
  attr_accessor :new_file
77
96
  end
78
97
 
98
+ class CloseCurrentTabEvent < BufferEvent
99
+ end
100
+
79
101
  class GoToLineBufferEvent < BufferEvent
80
102
  attr_accessor :line
81
103
  end
82
104
 
105
+ class PrettifyTextEvent < BufferEvent
106
+
107
+ end
108
+
83
109
  class SearchBufferEvent < BufferEvent
84
110
  class Result < Result
85
111
  attr_accessor :row, :col
@@ -165,6 +191,17 @@ end
165
191
  # +---------------------------------------------+
166
192
 
167
193
  class SearchInFilesEvent < ArcadiaEvent
194
+ # this message actually does before, on, after
195
+ # in the time it takes to open the dialog
196
+ # the dialog then receives its input [i.e. all the messages are done before the search is through]
197
+ class Result < SearchBufferEvent::Result
198
+ attr_accessor :file
199
+ end
200
+ attr_accessor :what, :files_filter, :dir
201
+ end
202
+
203
+ class AckInFilesEvent < ArcadiaEvent
204
+ # don't subclass SearchInFilesEvent or listeners for SearchInFiles will also get our messages
168
205
  class Result < SearchBufferEvent::Result
169
206
  attr_accessor :file
170
207
  end
@@ -197,6 +234,14 @@ class InputExitEvent < InputEvent
197
234
  attr_accessor :receiver
198
235
  end
199
236
 
237
+ # FocusEvent
238
+ # Events for executing operation on focused widget
239
+ class FocusEvent < ArcadiaEvent
240
+ attr_accessor :focus_widget
241
+ end
242
+ class CutTextEvent < FocusEvent; end
243
+ class CopyTextEvent < FocusEvent; end
244
+ class PasteTextEvent < FocusEvent; end
200
245
 
201
246
  #class VirtualKeyboardEvent < ArcadiaEvent
202
247
  #end
@@ -247,5 +292,4 @@ class ActionEvent < ArcadiaEvent
247
292
  attr_accessor :receiver
248
293
  attr_accessor :action
249
294
  attr_accessor :action_args
250
- end
251
-
295
+ end
@@ -2,13 +2,11 @@
2
2
  # a-core.rb - Arcadia Ruby ide
3
3
  # by Antonio Galeone <antonio-galeone@rubyforge.org>
4
4
  #
5
- # §require_dir_ref=..
6
- # §require_omissis=conf/arcadia.init
7
- # §require_omissis=tk
8
- # §require_omissis=tk/label
9
- # §require_omissis=tk/toplevel
10
-
11
-
5
+ # &require_dir_ref=..
6
+ # &require_omissis=conf/arcadia.init
7
+ # &require_omissis=tk
8
+ # &require_omissis=tk/label
9
+ # &require_omissis=tk/toplevel
12
10
 
13
11
  require "conf/arcadia.res"
14
12
  require 'tkextlib/bwidget'
@@ -23,7 +21,7 @@ class Arcadia < TkApplication
23
21
  super(
24
22
  ApplicationParams.new(
25
23
  'arcadia',
26
- '0.7.0',
24
+ '0.8.0',
27
25
  'conf/arcadia.conf',
28
26
  'conf/arcadia.pers'
29
27
  )
@@ -32,11 +30,14 @@ class Arcadia < TkApplication
32
30
  set_sysdefaultproperty
33
31
  ArcadiaDialogManager.new(self)
34
32
  ArcadiaActionDispatcher.new(self)
33
+ ArcadiaGemsWizard.new(self)
34
+ MonitorLastUsedDir.new
35
+ FocusEventManager.new
35
36
  #self.load_local_config(false)
36
37
  ObjectSpace.define_finalizer($arcadia, self.class.method(:finalize).to_proc)
37
38
  publish('action.on_exit', proc{do_exit})
38
39
  #_title = "Arcadia Ruby ide :: [Platform = #{RUBY_PLATFORM}] [Ruby version = #{RUBY_VERSION}] [TclTk version = #{tcltk_info.level}]"
39
- _title = "Arcadia Ruby ide :: #{sys_info}"
40
+ _title = "Arcadia ide "
40
41
  @root = TkRoot.new(
41
42
  'background'=> self['conf']['background']
42
43
  ){
@@ -52,7 +53,8 @@ class Arcadia < TkApplication
52
53
  'background'=> self['conf']['background']
53
54
  ).pack('fill'=>'x')
54
55
  @mf_root = Tk::BWidget::MainFrame.new(@root,
55
- 'background'=> self['conf']['background']
56
+ 'background'=> self['conf']['background'],
57
+ 'height'=> 0
56
58
  ){
57
59
  menu @main_menu_bar
58
60
  }.pack(
@@ -74,8 +76,17 @@ class Arcadia < TkApplication
74
76
  @splash.next_step('..prepare') if @splash
75
77
  prepare
76
78
  @splash.last_step('..load finish') if @splash
77
- geometry = (TkWinfo.screenwidth(@root)-4).to_s+'x'+
78
- (TkWinfo.screenheight(@root)-20).to_s+'+0+0'
79
+ if self['conf']['geometry']
80
+ geometry = self['conf']['geometry']
81
+ else
82
+ start_width = (TkWinfo.screenwidth(@root)-4)
83
+ start_height = (TkWinfo.screenheight(@root)-20)
84
+ if RUBY_PLATFORM =~ /mswin|mingw/ # on doze don't go below the start gar
85
+ start_height -= 50
86
+ start_width -= 20
87
+ end
88
+ geometry = start_width.to_s+'x'+start_height.to_s+'+0+0'
89
+ end
79
90
  @root.deiconify
80
91
  @root.raise
81
92
  @root.focus(true)
@@ -83,7 +94,7 @@ class Arcadia < TkApplication
83
94
  Tk.update_idletasks
84
95
  #sleep(1)
85
96
  @splash.destroy if @splash
86
- if @first_run
97
+ if @first_run # first ARCADIA ever
87
98
  Arcadia.process_event(OpenBufferEvent.new(self,'file'=>'README'))
88
99
  elsif ARGV.length > 0
89
100
  ARGV.each{|_f|
@@ -96,11 +107,15 @@ class Arcadia < TkApplication
96
107
  Arcadia.attach_listener(self, QuitEvent)
97
108
  Arcadia.persistent("version", self['applicationParams'].version)
98
109
  end
99
-
110
+
100
111
  def on_quit(_event)
101
112
  self.do_exit
102
113
  end
103
114
 
115
+ def register(_ext)
116
+ @exts_i << _ext
117
+ end
118
+
104
119
  def show_hide_toolbar
105
120
  if @is_toolbar_show
106
121
  @mf_root.show_toolbar(0,false)
@@ -122,11 +137,31 @@ class Arcadia < TkApplication
122
137
  return (self['conf'][_name+'.active'] != nil && self['conf'][_name+'.active']=='yes')||
123
138
  (self['conf'][_name+'.active'] == nil)
124
139
  end
125
-
140
+
141
+ def ext_source_must_be_loaded?(_name)
142
+ ret = ext_active?(_name)
143
+ if !ret
144
+ @exts_dip.each{|key,val|
145
+ if val == _name
146
+ ret = ret || ext_active?(key)
147
+ end
148
+ break if ret
149
+ }
150
+ end
151
+ ret
152
+ end
153
+
126
154
  def load_exts_conf
127
155
  @exts = Array.new
156
+ @exts_i = Array.new
157
+ @exts_dip = Hash.new
158
+ @exts_loaded = Array.new
159
+ load_exts_conf_from('ext')
160
+ end
161
+
162
+ def load_exts_conf_from(_dir='',_ext_root=nil)
128
163
  dirs = Array.new
129
- files = Dir['ext/*'].concat(Dir[ENV["HOME"]+'/.arcadia/ext/*']).sort
164
+ files = Dir["#{_dir}/*"].concat(Dir[ENV["HOME"]+"/.arcadia/#{_dir}/*"]).sort
130
165
  files.each{|f|
131
166
  dirs << f if File.stat(f).directory? && FileTest.exist?(f+'/'+File.basename(f)+'.conf')
132
167
  }
@@ -139,44 +174,169 @@ class Arcadia < TkApplication
139
174
  if var_plat.length > 1
140
175
  new_key = var_plat[0] + ':' + name + '.' + var_plat[1]
141
176
  else
142
- new_key = name+'.'+key
177
+ begin
178
+ new_key = name+'.'+key
179
+ rescue => e
180
+ puts 'is an extension missing a name?'
181
+ raise e
182
+ end
143
183
  end
144
184
  conf_hash2[new_key]= value
145
185
  }
146
- @exts << name
186
+ @exts << name
187
+ if _ext_root
188
+ @exts_dip[name] = _ext_root
189
+ end
147
190
  self['conf'].update(conf_hash2)
191
+ self['origin_conf'].update(conf_hash2)
192
+ load_exts_conf_from("#{ext_dir}/ext",name)
148
193
  }
149
194
  end
150
195
 
196
+ def Arcadia.gem_available?(_gem)
197
+ if Gem.respond_to?(:available?)
198
+ return Gem.available?(_gem)
199
+ else
200
+ return !Gem.source_index.find_name(_gem).empty?
201
+ end
202
+ end
203
+
204
+ def check_gems_dependences(_ext)
205
+ ret = true
206
+ gems_property = self['conf']["#{_ext}.gems"]
207
+ if gems_property
208
+ gems = gems_property.split(',').collect{| g | g.strip }
209
+ if gems && gems.length > 0
210
+ gems.each{|gem|
211
+ # consider gem only if it is not installed
212
+ if !Arcadia.gem_available?(gem)
213
+ repository_property = self['conf']["#{_ext}.gems.#{gem}.repository"]
214
+ events_property = self['conf']["#{_ext}.gems.#{gem}.events"]
215
+ args = Hash.new
216
+ args['extension_name']=_ext
217
+ args['gem_name']=gem
218
+ args['gem_repository']=repository_property if repository_property
219
+ args['gem_events']=events_property if events_property
220
+ if events_property
221
+ #EventWatcher.new
222
+ events_str = events_property.split(',')
223
+ events_str.each{|event_str|
224
+ EventWatcherForGem.new(eval(event_str),args)
225
+ }
226
+ else
227
+ _event = Arcadia.process_event(NeedRubyGemWizardEvent.new(self, args))
228
+ ret = ret && Arcadia.gem_available?(gem)
229
+ # if _event && _event.results
230
+ # ret = ret && _event.results[0].installed
231
+ # end
232
+ end
233
+ break if !ret
234
+ end
235
+ }
236
+ end
237
+ end
238
+ ret
239
+ end
240
+
151
241
  def do_build
152
-
153
242
  # create extensions
154
- @exts.each{|extension|
155
- if extension && ext_active?(extension)
156
- @splash.next_step('... creating '+extension) if @splash
157
- ext_create(extension)
243
+ Array.new.concat(@exts).each{|extension|
244
+ if extension && ext_source_must_be_loaded?(extension)
245
+ gems_installed = check_gems_dependences(extension)
246
+ if !gems_installed || !ext_load(extension)
247
+ @exts.delete(extension)
248
+ elsif !ext_active?(extension)
249
+ @exts.delete(extension)
250
+ elsif ext_active?(extension)
251
+ @splash.next_step('... creating '+extension) if @splash
252
+ @exts.delete(extension) unless
253
+ (((@exts_dip[extension] != nil && @exts_loaded.include?(@exts_dip[extension]))||@exts_dip[extension] == nil) && ext_create(extension))
254
+ end
158
255
  end
159
256
  }
160
- _build_event = Arcadia.process_event(BuildEvent.new(self))
257
+ begin
258
+ _build_event = Arcadia.process_event(BuildEvent.new(self))
259
+ rescue Exception
260
+ ret = false
261
+ msg = "During build event processing(#{$!.class.to_s}) : #{$!} at : #{$@.to_s}"
262
+ ans = Tk.messageBox('icon' => 'error', 'type' => 'abortretryignore',
263
+ 'title' => "(Arcadia) Build face", 'parent' => @root,
264
+ 'message' => msg)
265
+ if ans == 'abort'
266
+ raise
267
+ exit
268
+ elsif ans == 'retry'
269
+ retry
270
+ else
271
+ Tk.update
272
+ end
273
+ end
161
274
  end
162
-
163
- def ext_create(_extension)
275
+
276
+ def load_maximised
277
+ lm = self['conf']['layout.maximized']
278
+ if lm
279
+ ext,index=lm.split(',')
280
+ maxed = false
281
+ if ext && index
282
+ ext = ext.strip
283
+ i=index.strip.to_i
284
+ @exts_i.each{|e|
285
+ if e.conf('name')==ext && !maxed
286
+ e.maximize(i)
287
+ maxed=true
288
+ break
289
+ end
290
+ }
291
+ end
292
+ end
293
+ end
294
+
295
+ def ext_load(_extension)
296
+ ret = true
164
297
  begin
165
298
  source = self['conf'][_extension+'.require']
166
- class_name = self['conf'][_extension+'.class']
167
299
  if source.strip.length > 0
168
- #p source
169
- eval("require '#{source}'")
170
- #eval('require ' + "'" + source + "'")
300
+ require source
301
+ end
302
+ @exts_loaded << _extension
303
+ rescue Exception,LoadError
304
+ ret = false
305
+ msg = "Loading \"#{_extension}\" (#{$!.class.to_s}) : #{$!} at : #{$@.to_s}"
306
+ ans = Tk.messageBox('icon' => 'error', 'type' => 'abortretryignore',
307
+ 'title' => "(Arcadia) Extensions '#{_extension}'", 'parent' => @root,
308
+ 'message' => msg)
309
+ if ans == 'abort'
310
+ raise
311
+ exit
312
+ elsif ans == 'retry'
313
+ retry
314
+ else
315
+ Tk.update
171
316
  end
317
+ end
318
+ ret
319
+ end
320
+
321
+ def ext_create(_extension)
322
+ ret = true
323
+ begin
324
+ class_name = self['conf'][_extension+'.class']
172
325
  if class_name.strip.length > 0
173
- publish(_extension, eval(class_name).new(self, _extension))
326
+ klass = nil
327
+ begin
328
+ klass = eval(class_name)
329
+ rescue => e
330
+ puts 'does an extension class have the wrong name associated with it, in its conf file?, or is not listing the right .rb file?'
331
+ raise e
332
+ end
333
+ publish(_extension, klass.new(self, _extension))
174
334
  end
175
- rescue Exception
176
- raise
177
- msg = "Loading "+'"'+extension+'"'+" ("+$!.class.to_s+") "+" : "+$! + " at : "+$@.to_s
335
+ rescue Exception,LoadError
336
+ ret = false
337
+ msg = "Loading \"#{_extension}\" (#{$!.class.to_s}) : #{$!} at : #{$@.to_s}"
178
338
  ans = Tk.messageBox('icon' => 'error', 'type' => 'abortretryignore',
179
- 'title' => '(Arcadia) Extensions', 'parent' => @root,
339
+ 'title' => "(Arcadia) Extensions '#{_extension}'", 'parent' => @root,
180
340
  'message' => msg)
181
341
  if ans == 'abort'
182
342
  raise
@@ -187,6 +347,7 @@ class Arcadia < TkApplication
187
347
  Tk.update
188
348
  end
189
349
  end
350
+ ret
190
351
  end
191
352
 
192
353
  def ext_method(_extension, _method)
@@ -213,48 +374,51 @@ class Arcadia < TkApplication
213
374
  suf = "layout.split"
214
375
  elems = self['conf'][suf]
215
376
  return if elems.nil?
216
- groups = elems.split(',')
217
- groups.each{|group|
218
- if group
219
- suf1 = suf+'.'+group
220
- begin
221
- property = self['conf'][suf1]
222
- c = property.split('c')
223
- if c && c.length == 2
224
- pt = c[0].split('.')
225
- perc = c[1].include?('%')
226
- w = c[1].sub('%','')
227
- if perc
228
- @layout.add_cols_perc(pt[0].to_i, pt[1].to_i, w.to_i)
229
- else
230
- @layout.add_cols(pt[0].to_i, pt[1].to_i, w.to_i)
231
- end
232
- else
233
- r = property.split('r')
234
- if r && r.length == 2
235
- pt = r[0].split('.')
236
- perc = r[1].include?('%')
237
- w = r[1].sub('%','')
377
+ if elems.strip.length > 0
378
+ groups = elems.split(',')
379
+ groups.each{|group|
380
+ if group
381
+ suf1 = suf+'.'+group
382
+ begin
383
+ property = self['conf'][suf1]
384
+ c = property.split('c')
385
+ if c && c.length == 2
386
+ pt = c[0].split('.')
387
+ perc = c[1].include?('%')
388
+ w = c[1].sub('%','')
238
389
  if perc
239
- @layout.add_rows_perc(pt[0].to_i, pt[1].to_i, w.to_i)
390
+ @layout.add_cols_perc(pt[0].to_i, pt[1].to_i, w.to_i)
240
391
  else
241
- @layout.add_rows_perc(pt[0].to_i, pt[1].to_i, w.to_i)
392
+ @layout.add_cols(pt[0].to_i, pt[1].to_i, w.to_i)
393
+ end
394
+ else
395
+ r = property.split('r')
396
+ if r && r.length == 2
397
+ pt = r[0].split('.')
398
+ perc = r[1].include?('%')
399
+ w = r[1].sub('%','')
400
+ if perc
401
+ @layout.add_rows_perc(pt[0].to_i, pt[1].to_i, w.to_i)
402
+ else
403
+ @layout.add_rows(pt[0].to_i, pt[1].to_i, w.to_i)
404
+ end
242
405
  end
243
406
  end
244
- end
245
-
246
- rescue Exception
247
- msg = "Loading layout: (#{$!.class.to_s} : #{$!.to_s} at : #{$@.to_s})"
248
- if Arcadia.dialog(self, 'type'=>'ok_cancel', 'level'=>'error','title' => '(Arcadia) Layout', 'msg'=>msg)=='cancel'
249
- raise
250
- exit
251
- else
252
- Tk.update
407
+
408
+ rescue Exception
409
+ msg = "Loading layout: (#{$!.class.to_s} : #{$!.to_s} at : #{$@.to_s})"
410
+ if Arcadia.dialog(self, 'type'=>'ok_cancel', 'level'=>'error','title' => '(Arcadia) Layout', 'msg'=>msg)=='cancel'
411
+ raise
412
+ exit
413
+ else
414
+ Tk.update
415
+ end
253
416
  end
254
417
  end
255
- end
256
- }
257
-
418
+ }
419
+ else
420
+ @layout.add_mono_panel
421
+ end
258
422
  @layout.add_headers
259
423
  end
260
424
 
@@ -265,6 +429,7 @@ class Arcadia < TkApplication
265
429
  self.load_local_config
266
430
  self.load_theme(self['conf']['theme'])
267
431
  self.resolve_properties_link(self['conf'],self['conf'])
432
+ self.resolve_properties_link(self['origin_conf'],self['origin_conf'])
268
433
  end
269
434
 
270
435
  def set_sysdefaultproperty
@@ -287,13 +452,10 @@ class Arcadia < TkApplication
287
452
  publish('buffers.code.in_memory',Hash.new)
288
453
  publish('action.load_code_from_buffers', proc{TkBuffersChoise.new})
289
454
  publish('output.action.run_last', proc{$arcadia['output'].run_last})
290
- publish('main.action.open_file', proc{self['editor'].open_file(Tk.getOpenFile)})
455
+ publish('main.action.open_file', proc{self['editor'].open_file(Arcadia.open_file_dialog)})
291
456
  @splash.next_step('... load obj controller') if @splash
292
457
  @splash.next_step('... load editor') if @splash
293
458
  publish('main.action.new_file',proc{$arcadia['editor'].open_buffer()})
294
- publish('main.action.edit_cut',proc{$arcadia['editor'].raised.text.text_cut()})
295
- publish('main.action.edit_copy',proc{$arcadia['editor'].raised.text.text_copy()})
296
- publish('main.action.edit_paste',proc{$arcadia['editor'].raised.text.text_paste()})
297
459
  @splash.next_step('... load actions') if @splash
298
460
  #provvisorio
299
461
  @keytest = KeyTest.new
@@ -355,45 +517,42 @@ class Arcadia < TkApplication
355
517
  suf1 = suf+'.'+group
356
518
  begin
357
519
  context_path = self['conf']["#{suf1}.context_path"]
358
- property = proc{|_str, _suf| self['conf']["#{_suf}.#{_str}"]}
359
- property_to_eval = proc{|_str, _suf|
360
- p = self['conf']["#{_suf}.#{_str}"]
361
- _self_on_eval.instance_eval(p) if p
362
- }
520
+ context_underline = self['conf']["#{suf1}.context_underline"]
521
+ # property = proc{|_str, _suf| self['conf']["#{_suf}.#{_str}"]}
522
+ # property_to_eval = proc{|_str, _suf|
523
+ # p = self['conf']["#{_suf}.#{_str}"]
524
+ # _self_on_eval.instance_eval(p) if p
525
+ # }
363
526
  items = self['conf'][suf1].split(',')
364
527
  items.each{|item|
365
528
  suf2 = suf1+'.'+item
366
529
  disabled = !self['conf']["#{suf2}.disabled"].nil?
367
- # property = proc{|_str| self['conf']["#{suf2}.#{_str}"]}
368
- # property_to_eval = proc{|_str|
369
- # p = self['conf']["#{suf2}.#{_str}"]
370
- # _self_on_eval.instance_eval(p) if p
371
- # }
372
- name = property.call('name',suf2)
373
- caption = property.call('caption',suf2)
374
- hint = property.call('hint',suf2)
375
- event_class = property_to_eval.call('event_class',suf2)
376
-
377
- event_args = property_to_eval.call('event_args',suf2)
378
- image_data = property_to_eval.call('image_data',suf2)
379
- item_args = {
380
- 'name'=>name,
381
- 'caption'=>caption,
382
- 'hint'=>hint,
383
- 'event_class' =>event_class,
384
- 'event_args' =>event_args,
385
- 'image_data' =>image_data,
386
- 'context'=>group,
387
- 'context_path'=>context_path
530
+ iprops=Arcadia.conf_group(suf2)
531
+ item_args = Hash.new
532
+ iprops.each{|k,v|
533
+ value = v.strip
534
+ if value[0..0]=='!'
535
+ item_args[k]=_self_on_eval.instance_eval(value[1..-1])
536
+ else
537
+ item_args[k]=value
538
+ end
388
539
  }
540
+ # item_args['caption'] = item if item_args['caption'].nil?
541
+ item_args['name'] = item if item_args['name'].nil?
542
+ item_args['context'] = group
543
+ item_args['context_path'] = context_path
389
544
  item_args['context_caption'] = groups_caption[gi] if groups_caption
545
+ item_args['context_underline'] = context_underline.strip.to_i if context_underline
390
546
  i = _user_control.new_item(self, item_args)
391
547
  i.enable=false if disabled
392
-
393
548
  }
394
549
  rescue Exception
395
550
  msg = "Loading #{groups} ->#{items} (#{$!.class.to_s} : #{$!.to_s} at : #{$@.to_s})"
396
- if Arcadia.dialog(self, 'type'=>'ok_cancel', 'title' => '(Arcadia) Toolbar', 'msg'=>msg)=='cancel'
551
+ if Arcadia.dialog(self,
552
+ 'type'=>'ok_cancel',
553
+ 'title' => '(Arcadia) Toolbar',
554
+ 'msg'=>msg,
555
+ 'level'=>'error')=='cancel'
397
556
  raise
398
557
  exit
399
558
  else
@@ -420,11 +579,89 @@ class Arcadia < TkApplication
420
579
 
421
580
  def can_exit?
422
581
  _event = Arcadia.process_event(ExitQueryEvent.new(self, 'can_exit'=>true))
423
- return _event.can_exit
582
+ _event.can_exit
583
+ end
584
+
585
+ def save_layout
586
+ self['conf']['geometry']= TkWinfo.geometry(@root)
587
+ Arcadia.del_conf_group('layout')
588
+ # resizing
589
+ @exts_i.each{|e|
590
+ found = false
591
+ if e.conf('frames')
592
+ frs = e.conf('frames').split(',')
593
+ else
594
+ frs = Array.new
595
+ end
596
+ frs.each_index{|i|
597
+ if e.maximized?(i)
598
+ self['conf']['layout.maximized']="#{e.conf('name')},#{i}"
599
+ e.resize(i)
600
+ found=true
601
+ break
602
+ end
603
+ }
604
+ break if found
605
+ }
606
+ # layouts
607
+ splits,doms,r,c = @layout.dump_geometry
608
+ header = ""
609
+ splits.each_index{|i|
610
+ header << i.to_s
611
+ header << ',' if i < splits.length-1
612
+ }
613
+ self['conf']['layout.split']= header
614
+ splits.each_with_index{|sp,i|
615
+ self['conf']["layout.split.#{i}"]=sp
616
+ }
617
+ # domains
618
+ @exts_i.each{|e|
619
+ if e.conf('frames')
620
+ frs = e.conf('frames').split(',')
621
+ else
622
+ frs = Array.new
623
+ end
624
+ str_frames=''
625
+ frs.each_index{|i|
626
+ f = e.frame(i,false)
627
+ if f
628
+ ff = f.hinner_frame
629
+ frame = ff.frame if ff
630
+ if frame && TkWinfo.parent(frame).instance_of?(Tk::BWidget::NoteBook)
631
+ frame=TkWinfo.parent(TkWinfo.parent(frame))
632
+ elsif frame.nil?
633
+ if str_frames.length > 0
634
+ str_frames << ','
635
+ end
636
+ str_frames << '-1.-1'
637
+ end
638
+ if doms[frame]
639
+ if str_frames.length > 0
640
+ str_frames << ','
641
+ end
642
+ str_frames << doms[frame]
643
+ end
644
+ else
645
+ end
646
+ }
647
+ if str_frames.length > 0
648
+ self['conf']["#{e.conf('name')}.frames"]=str_frames
649
+ # p "#{e.conf('name')}.frames=#{str_frames}"
650
+ end
651
+ }
652
+ # toolbar
653
+ if @is_toolbar_show
654
+ self['conf']['user_toolbar_show']='yes'
655
+ else
656
+ self['conf']['user_toolbar_show']='no'
657
+ end
658
+
424
659
  end
425
-
660
+
426
661
  def do_finalize
662
+ self.save_layout
427
663
  _event = Arcadia.process_event(FinalizeEvent.new(self))
664
+ update_local_config
428
665
  self.override_persistent(self['applicationParams'].persistent_file, self['pers'])
429
666
  end
430
667
 
@@ -440,6 +677,10 @@ class Arcadia < TkApplication
440
677
  def Arcadia.style(_class)
441
678
  Configurable.properties_group(_class, Arcadia.instance['conf'])
442
679
  end
680
+
681
+ def Arcadia.conf_group(_path)
682
+ Configurable.properties_group(_path, Arcadia.instance['conf'])
683
+ end
443
684
 
444
685
  def Arcadia.persistent(_property, _value=nil, _immediate=false)
445
686
  if @@instance
@@ -459,6 +700,41 @@ class Arcadia < TkApplication
459
700
  return @@instance.layout
460
701
  end
461
702
  end
703
+
704
+ def Arcadia.open_file_dialog
705
+ Tk.getOpenFile 'initialdir' => MonitorLastUsedDir.get_last_dir
706
+ end
707
+
708
+ def Arcadia.is_windows?
709
+ RUBY_PLATFORM =~ /mingw|mswin/
710
+ end
711
+
712
+
713
+ def Arcadia.file_icon(_file_name)
714
+ if @@instance['file_icons'] == nil
715
+ @@instance['file_icons'] = Hash.new
716
+ @@instance['file_icons']['default']= TkPhotoImage.new('dat' => FILE_ICON_DEFAULT)
717
+ end
718
+ _base_name= File.basename(_file_name)
719
+ if _base_name.include?('.')
720
+ file_dn = _base_name.split('.')[-1]
721
+ else
722
+ file_dn = "no_ext"
723
+ end
724
+ if @@instance['file_icons'][file_dn].nil?
725
+ file_icon_name="FILE_ICON_#{file_dn.upcase}"
726
+ begin
727
+ if eval("defined?(#{file_icon_name})")
728
+ @@instance['file_icons'][file_dn]= TkPhotoImage.new('dat' => eval(file_icon_name))
729
+ else
730
+ @@instance['file_icons'][file_dn]= @@instance['file_icons']['default']
731
+ end
732
+ rescue Exception
733
+ @@instance['file_icons'][file_dn]= @@instance['file_icons']['default']
734
+ end
735
+ end
736
+ @@instance['file_icons'][file_dn]
737
+ end
462
738
 
463
739
  # def Arcadia.res(_res)
464
740
  # theme = Arcadia.instance['conf']['theme']
@@ -677,18 +953,27 @@ class ArcadiaMainMenu < ArcadiaUserControl
677
953
  SUF='user_menu'
678
954
  class UserItem < UserItem
679
955
  attr_accessor :menu
956
+ attr_accessor :underline
957
+ attr_accessor :type
680
958
  def initialize(_sender, _args)
681
959
  super(_sender, _args)
682
- _image = TkPhotoImage.new('data' => @image_data) if @image_data
683
960
  _command = proc{
684
961
  Arcadia.process_event(@event_class.new(_sender, @event_args))
685
962
  } if @event_class
686
963
  #_menu = @menu[@parent]
687
- @item_obj = @menu.insert('end', :command,
688
- 'image'=>_image,
689
- 'label'=>@caption,
690
- 'compound'=>'left',
691
- 'command'=>_command )
964
+ item_args = Hash.new
965
+ item_args['image']=TkPhotoImage.new('data' => @image_data) if @image_data
966
+ item_args['label']=@caption
967
+ item_args['underline']=@underline.to_i if @underline != nil
968
+ item_args['compound']='left'
969
+ item_args['command']=_command
970
+ if @type.nil? && _commnad.nil? && @name == '-'
971
+ @type=:separator
972
+ item_args.clear
973
+ elsif @type.nil?
974
+ @type=:command
975
+ end
976
+ @item_obj = @menu.insert('end', @type ,item_args)
692
977
  @index = @menu.index('last')
693
978
  end
694
979
 
@@ -713,7 +998,7 @@ class ArcadiaMainMenu < ArcadiaUserControl
713
998
  # menu.font(Arcadia.conf('main.mainmenu.font'))
714
999
  end
715
1000
 
716
- def get_menu_context(_menubar, _context)
1001
+ def get_menu_context(_menubar, _context, _underline=nil)
717
1002
  menubuttons = _menubar[0..-1]
718
1003
  # cerchiamo il context
719
1004
  m_i = -1
@@ -727,7 +1012,7 @@ class ArcadiaMainMenu < ArcadiaUserControl
727
1012
  if m_i > -1
728
1013
  _menubar[m_i][1]
729
1014
  else
730
- _menubar.add_menu([[_context],[]])[1].delete(0)
1015
+ _menubar.add_menu([[_context,_underline],[]])[1].delete(0)
731
1016
  end
732
1017
  end
733
1018
 
@@ -737,15 +1022,18 @@ class ArcadiaMainMenu < ArcadiaUserControl
737
1022
  i_end = menu_context.index('end')
738
1023
  if i_end
739
1024
  0.upto(i_end){|j|
740
- l = menu_context.entrycget(j,'label')
741
- if l == folder
742
- s_i = j
743
- break
1025
+ type = menu_context.menutype(j)
1026
+ if type != 'separator'
1027
+ l = menu_context.entrycget(j,'label')
1028
+ if l == folder && type == 'cascade'
1029
+ s_i = j
1030
+ break
1031
+ end
744
1032
  end
745
1033
  }
746
1034
  end
747
1035
  end
748
- if s_i > -1 && menu_context.menutype(s_i) == 'cascade'
1036
+ if s_i > -1 #&& menu_context.menutype(s_i) == 'cascade'
749
1037
  sub = menu_context.entrycget(s_i, 'menu')
750
1038
  else
751
1039
  sub = TkMenu.new(
@@ -764,8 +1052,8 @@ class ArcadiaMainMenu < ArcadiaUserControl
764
1052
  sub
765
1053
  end
766
1054
 
767
- def get_menu(_menubar, _context, context_path)
768
- context_menu = get_menu_context(_menubar, _context)
1055
+ def get_menu(_menubar, _context, context_path, context_underline=nil)
1056
+ context_menu = get_menu_context(_menubar, _context, context_underline)
769
1057
  folders = context_path.split('/')
770
1058
  sub = context_menu
771
1059
  folders.each{|folder|
@@ -782,7 +1070,7 @@ class ArcadiaMainMenu < ArcadiaUserControl
782
1070
  else
783
1071
  conte = _args['context']
784
1072
  end
785
- _args['menu']=get_menu(@menu, conte, _args['context_path'])
1073
+ _args['menu']=get_menu(@menu, conte, _args['context_path'], _args['context_underline'])
786
1074
  super(_sender, _args)
787
1075
  end
788
1076
 
@@ -790,7 +1078,7 @@ class ArcadiaMainMenu < ArcadiaUserControl
790
1078
  def build
791
1079
  menu_spec_file = [
792
1080
  ['File', 0],
793
- ['Open', proc{Arcadia.process_event(OpenBufferEvent.new(self,'file'=>Tk.getOpenFile))}, 0],
1081
+ ['Open', proc{Arcadia.process_event(OpenBufferEvent.new(self,'file'=>Arcadia.open_file_dialog))}, 0],
794
1082
  ['New', $arcadia['main.action.new_file'], 0],
795
1083
  #['Save', proc{EditorContract.instance.save_file_raised(self)},0],
796
1084
  ['Save', proc{Arcadia.process_event(SaveBufferEvent.new(self))},0],
@@ -798,16 +1086,23 @@ class ArcadiaMainMenu < ArcadiaUserControl
798
1086
  '---',
799
1087
  ['Quit', $arcadia['action.on_exit'], 0]]
800
1088
  menu_spec_edit = [['Edit', 0],
801
- ['Cut', $arcadia['main.action.edit_cut'], 2],
802
- ['Copy', $arcadia['main.action.edit_copy'], 0],
803
- ['Paste', $arcadia['main.action.edit_paste'], 0]]
1089
+ ['Cut', proc{Arcadia.process_event(CutTextEvent.new(self))}, 2],
1090
+ ['Copy', proc{Arcadia.process_event(CopyTextEvent.new(self))}, 0],
1091
+ ['Paste', proc{Arcadia.process_event(PasteTextEvent.new(self))}, 0],
1092
+ ['Prettify Current', proc{Arcadia.process_event(PrettifyTextEvent.new(self))}, 0]]
1093
+
804
1094
  menu_spec_search = [['Search', 0],
805
- ['Find ...', proc{Arcadia.process_event(SearchBufferEvent.new(self))}, 2],
1095
+ ['Find/Replace ...', proc{Arcadia.process_event(SearchBufferEvent.new(self))}, 2],
806
1096
  ['Find in files...', proc{Arcadia.process_event(SearchInFilesEvent.new(self))}, 2],
1097
+ ['Ack in files...', proc{Arcadia.process_event(AckInFilesEvent.new(self))}, 2],
807
1098
  ['Go to line ...', proc{Arcadia.process_event(GoToLineBufferEvent.new(self))}, 2]]
808
- menu_spec_view = [['View', 0],['Show/Hide Toolbar', proc{$arcadia.show_hide_toolbar}, 2]]
1099
+ menu_spec_view = [['View', 0],['Show/Hide Toolbar', proc{$arcadia.show_hide_toolbar}, 2],
1100
+ ['Close current tab', proc{Arcadia.process_event(CloseCurrentTabEvent.new(self))}, 0],
1101
+ ]
809
1102
  menu_spec_tools = [['Tools', 0],
810
- ['Keys-test', $arcadia['action.test.keys'], 2]
1103
+ ['Keys-test', $arcadia['action.test.keys'], 2],
1104
+ ['Edit prefs', proc{Arcadia.process_event(OpenBufferEvent.new(self,'file'=>$arcadia.local_file_config))}, 0],
1105
+ ['Load from edited prefs', proc{$arcadia.load_local_config}, 0]
811
1106
  ]
812
1107
  menu_spec_help = [['Help', 0],
813
1108
  ['About', $arcadia['action.show_about'], 2],]
@@ -823,14 +1118,16 @@ class ArcadiaMainMenu < ArcadiaUserControl
823
1118
  # hh = 25
824
1119
  # @last_post = nil
825
1120
  # chs.each{|ch|
826
- # ch.bind_append("Enter", proc{|x,y,rx,ry|
827
- # @last_post.unpost if @last_post
1121
+ # ch.bind_append("Enter", proc{|x,y,rx,ry|
1122
+ # @last_post.unpost if @last_post && @last_post != ch.menu
828
1123
  # ch.menu.post(x-rx,y-ry+hh)
829
1124
  # @last_post=ch.menu}, "%X %Y %x %y")
830
1125
  # ch.bind_append("Leave", proc{
831
1126
  # @last_post.unpost if @last_post
1127
+ # @last_post=nil
832
1128
  # })
833
1129
  # }
1130
+
834
1131
  #})
835
1132
  end
836
1133
 
@@ -891,8 +1188,20 @@ class ArcadiaAboutSplash < TkToplevel
891
1188
  foreground '#ffffff'
892
1189
  font Arcadia.instance['conf']['splash.credits.font']
893
1190
  justify 'left'
894
- place('width' => '210','x' => 100,'y' => 95,'height' => 19)
1191
+ anchor 'w'
1192
+ place('width' => '210','x' => 100,'y' => 95,'height' => 25)
1193
+ }
1194
+
1195
+ @tkLabelCredits = TkLabel.new(self){
1196
+ text 'Contributors: Roger D. Pack'
1197
+ background _bgcolor
1198
+ foreground '#ffffff'
1199
+ font Arcadia.instance['conf']['splash.credits.font']
1200
+ justify 'left'
1201
+ anchor 'w'
1202
+ place('width' => '210','x' => 100,'y' => 115,'height' => 25)
895
1203
  }
1204
+
896
1205
  @tkLabelStep = TkLabel.new(self){
897
1206
  text ''
898
1207
  background _bgcolor
@@ -900,19 +1209,20 @@ class ArcadiaAboutSplash < TkToplevel
900
1209
  font Arcadia.instance['conf']['splash.banner.font']
901
1210
  justify 'left'
902
1211
  anchor 'w'
903
- place('width'=>-5,'relwidth' => 1,'x' => 5,'y' => 160,'height' => 19)
1212
+ place('width'=>-5,'relwidth' => 1,'x' => 5,'y' => 160,'height' => 45)
904
1213
  }
905
1214
  @progress = TkVariable.new
906
1215
  reset
907
- _width = 340
908
- _height = 200
1216
+ _width = 380
1217
+ _height = 240
909
1218
  #_width = 0;_height = 0
910
1219
  _x = TkWinfo.screenwidth(self)/2 - _width / 2
911
1220
  _y = TkWinfo.screenheight(self)/2 - _height / 2
912
1221
  geometry = _width.to_s+'x'+_height.to_s+'+'+_x.to_s+'+'+_y.to_s
913
1222
  Tk.tk_call('wm', 'geometry', self, geometry )
1223
+ #bind("ButtonPress-1", proc{self.destroy})
914
1224
  bind("Double-Button-1", proc{self.destroy})
915
- info = "Ruby version = #{RUBY_VERSION} - TclTk version = #{Arcadia.instance.tcltk_info.level}"
1225
+ info = TkApplication.sys_info
916
1226
  set_sysinfo(info)
917
1227
  end
918
1228
 
@@ -972,6 +1282,204 @@ class ArcadiaActionDispatcher
972
1282
 
973
1283
  end
974
1284
 
1285
+ class ArcadiaSh < TkToplevel
1286
+ attr_reader :wait, :result
1287
+ def initialize
1288
+ super
1289
+ title 'ArcadiaSh'
1290
+ geometry = '800x200+10+10'
1291
+ geometry(geometry)
1292
+ @text = TkScrollText.new(self, Arcadia.style('text')){
1293
+ wrap 'none'
1294
+ undo true
1295
+ insertofftime 200
1296
+ insertontime 200
1297
+ highlightthickness 0
1298
+ insertbackground #000000
1299
+ insertwidth 6
1300
+ }
1301
+ @text.set_focus
1302
+ @text.tag_configure('error', 'foreground' => '#d93421')
1303
+ @text.tag_configure('response', 'foreground' => '#2c51d9')
1304
+ @text.show
1305
+ @text.show_v_scroll
1306
+ @text.show_h_scroll
1307
+ #@input_buffer = ''
1308
+ @wait = true
1309
+ @result = false
1310
+ prompt
1311
+ @text.bind_append("KeyPress"){|e| input(e.keysym)}
1312
+ end
1313
+
1314
+ def exec_buffer
1315
+ @text.set_insert("end")
1316
+ input_buffer = @text.get(@index_cmd_begin,"insert")
1317
+ out("\n")
1318
+ exec(input_buffer)
1319
+ end
1320
+
1321
+ def input(_char)
1322
+ case _char
1323
+ when 'Return'
1324
+ Thread.new{exec_buffer}
1325
+ Tk.callback_break
1326
+ end
1327
+ end
1328
+
1329
+ def prompt
1330
+ @b_exit = TkButton.new(@text,
1331
+ 'command'=>proc{@wait=false},
1332
+ 'text'=>'Exit',
1333
+ 'padx'=>0,
1334
+ 'pady'=>0,
1335
+ 'width'=>5,
1336
+ 'foreground' => 'white',
1337
+ 'background' => '#d92328',
1338
+ 'relief'=>'flat')
1339
+ TkTextWindow.new(@text, "end", 'window'=> @b_exit)
1340
+ @b_exec = TkButton.new(@text,
1341
+ 'command'=>proc{Thread.new{exec_buffer}},
1342
+ 'text'=>'Exec',
1343
+ 'padx'=>0,
1344
+ 'pady'=>0,
1345
+ 'width'=>5,
1346
+ 'foreground' => 'white',
1347
+ 'background' => '#1ba626',
1348
+ 'relief'=>'flat')
1349
+ TkTextWindow.new(@text, "end", 'window'=> @b_exec)
1350
+ out("\n")
1351
+ out(">>> ")
1352
+ @index_cmd_begin = @text.index('insert')
1353
+ end
1354
+
1355
+ def exec_prompt(_cmd)
1356
+ out("#{_cmd}\n")
1357
+ exec(_cmd)
1358
+ end
1359
+
1360
+ def prepare_exec(_cmd)
1361
+ #@input_buffer=_cmd
1362
+ out("#{_cmd}")
1363
+ end
1364
+
1365
+ def exec(_cmd)
1366
+ return if _cmd.nil? || _cmd.length ==0
1367
+ @b_exec.destroy if defined?(@b_exec)
1368
+ out("submitted...\n")
1369
+ case _cmd
1370
+ when 'clear'
1371
+ @text.delete('0.0','end')
1372
+ else
1373
+ begin
1374
+ if RUBY_PLATFORM =~ /mingw|mswin/
1375
+ p = IO::popen("#{_cmd} 2>&1")
1376
+ out(p.read, 'response')
1377
+ @result = true
1378
+ else
1379
+ require "open3"
1380
+ Open3.popen3("#{_cmd}"){|stdin, stdout, stderr|
1381
+ stdout.each do |line|
1382
+ out(line,'response')
1383
+ @result = true
1384
+ end
1385
+ stderr.each do |line|
1386
+ out(line,'error')
1387
+ @result = false
1388
+ end
1389
+
1390
+ }
1391
+ end
1392
+ rescue Exception => e
1393
+ out("#{e.message}\n",'error')
1394
+ @result = false
1395
+ end
1396
+ end
1397
+ @b_exit.destroy if defined?(@b_exit)
1398
+ prompt
1399
+ @text.see('end')
1400
+ end
1401
+
1402
+ def out(_str,*tags)
1403
+ @text.insert('end',_str,*tags)
1404
+ end
1405
+
1406
+ end
1407
+
1408
+ class EventWatcherForGem
1409
+ include EventBus
1410
+ def initialize(_event, _details)
1411
+ @event=_event
1412
+ @details=_details
1413
+ enhance
1414
+ Arcadia.attach_listener(self, _event)
1415
+ end
1416
+ def enhance
1417
+ implementation=%Q{
1418
+ class << self
1419
+ def #{_method_name(@event, 'before')}(_event)
1420
+ _event.break
1421
+ new_event = Arcadia.process_event(NeedRubyGemWizardEvent.new(self, @details))
1422
+ if new_event && new_event.results
1423
+ ok=new_event.results[0].installed
1424
+ _event.break if !ok
1425
+ end
1426
+ end
1427
+ end
1428
+ }
1429
+ eval(implementation)
1430
+ end
1431
+ end
1432
+
1433
+ class ArcadiaGemsWizard
1434
+ include Autils
1435
+ def initialize(_arcadia)
1436
+ @arcadia = _arcadia
1437
+ Arcadia.attach_listener(self, NeedRubyGemWizardEvent)
1438
+ end
1439
+
1440
+ def on_need_ruby_gem_wizard(_event)
1441
+ # ... todo implamentation
1442
+ msg = "Appears that gem : '#{_event.gem_name}' required by : '#{_event.extension_name}' is not installed!\n Do you want to try install it now?"
1443
+ ans = Tk.messageBox('icon' => 'error', 'type' => 'yesno',
1444
+ 'title' => "(Arcadia) Extensions '#{_event.extension_name}'",
1445
+ 'message' => msg)
1446
+ if ans == 'yes'
1447
+ _event.add_result(self, 'installed'=>try_to_install_gem(_event.gem_name,_event.gem_repository))
1448
+ else
1449
+ _event.add_result(self, 'installed'=>false)
1450
+ end
1451
+ end
1452
+
1453
+ # def try_to_install_gem(name, repository=nil, version = '>0')
1454
+ # ret = false
1455
+ # require 'rubygems/command.rb'
1456
+ # require 'rubygems/dependency_installer.rb'
1457
+ #
1458
+ # inst.install name, version
1459
+ # # TODO WIZARD
1460
+ # # TODO accept repository, too
1461
+ # end
1462
+
1463
+ def try_to_install_gem(name, repository=nil, version = '>0')
1464
+ ret = false
1465
+
1466
+ sh=ArcadiaSh.new
1467
+ cmd = "gem install #{name}"
1468
+ cmd="sudo #{cmd}" if !is_windows?
1469
+ cmd+=" --source=#{repository}" if repository
1470
+ sh.prepare_exec(cmd)
1471
+ while sh.wait
1472
+ Tk.update
1473
+ #sleep(1)
1474
+ end
1475
+ ret=sh.result
1476
+ sh.destroy
1477
+ Gem.clear_paths
1478
+ ret
1479
+ end
1480
+
1481
+ end
1482
+
975
1483
 
976
1484
  class ArcadiaDialogManager
977
1485
  def initialize(_arcadia)
@@ -985,7 +1493,11 @@ class ArcadiaDialogManager
985
1493
  type = 'ok'
986
1494
  end
987
1495
  res_array = type.split('_')
988
- icon = _event.level
1496
+ if _event.level.nil? || _event.level.length == 0
1497
+ icon = 'info'
1498
+ else
1499
+ icon = _event.level
1500
+ end
989
1501
  tktype = type.gsub('_','').downcase
990
1502
 
991
1503
  tkdialog = Tk::BWidget::MessageDlg.new(
@@ -1034,9 +1546,9 @@ class ArcadiaLayout
1034
1546
  @frames = Array.new
1035
1547
  @frames[0] = Array.new
1036
1548
  @frames[0][0] = _frame
1037
- @domains = Array.new
1038
- @domains[0] = Array.new
1039
- @domains[0][0] = '_domain_root_'
1549
+ # @domains = Array.new
1550
+ # @domains[0] = Array.new
1551
+ # @domains[0][0] = '_domain_root_'
1040
1552
  @panels = Hash.new
1041
1553
  @panels['_domain_root_']= Hash.new
1042
1554
  @panels['_domain_root_']['root']= _frame
@@ -1044,6 +1556,7 @@ class ArcadiaLayout
1044
1556
  @autotab = _autotab
1045
1557
  @headed = false
1046
1558
  @wrappers=Hash.new
1559
+ @splitters=Array.new
1047
1560
  #ArcadiaContractListener.new(self, MainContract, :do_main_event)
1048
1561
  end
1049
1562
 
@@ -1087,16 +1600,17 @@ class ArcadiaLayout
1087
1600
  ret = @panels[_domain]['sons'].values[0]
1088
1601
  end
1089
1602
  ret
1090
- end
1091
-
1603
+ end
1604
+
1092
1605
  def _prepare_rows(_row,_col, _height, _perc=false, _top_name=nil, _bottom_name=nil)
1093
1606
  if (@frames[_row][_col] != nil)
1094
1607
  #source_domains = all_domains(@frames[_row][_col])
1095
1608
  #source_domains = others_domains(@frames[_row][_col], false)
1096
1609
  _h = AGTkOSplittedFrames.new(self.root,@frames[_row][_col],_height, @arcadia['conf']['layout.splitter.length'].to_i,_perc)
1610
+ @splitters << _h
1097
1611
  if @frames[_row + 1] == nil
1098
1612
  @frames[_row + 1] = Array.new
1099
- @domains[_row + 1] = Array.new
1613
+ # @domains[_row + 1] = Array.new
1100
1614
  end
1101
1615
  @frames[_row][_col] = _h.top_frame
1102
1616
 
@@ -1108,7 +1622,7 @@ class ArcadiaLayout
1108
1622
  @panels[_top_name]['root_splitted_frames'] = _h
1109
1623
  end
1110
1624
  @panels[_top_name]['splitted_frames'] = _h
1111
- @domains[_row][_col] = _top_name
1625
+ # @domains[_row][_col] = _top_name
1112
1626
 
1113
1627
  _bottom_name = (_row+1).to_s+'.'+_col.to_s if _bottom_name == nil
1114
1628
 
@@ -1124,10 +1638,19 @@ class ArcadiaLayout
1124
1638
  @panels[_bottom_name]['root_splitted_frames'] = _h
1125
1639
  end
1126
1640
  @panels[_bottom_name]['splitted_frames'] = _h
1127
- @domains[_row + 1][_col] = _bottom_name
1641
+ # @domains[_row + 1][_col] = _bottom_name
1642
+ end
1643
+ end
1644
+ private :_prepare_rows
1645
+
1646
+ def add_mono_panel(_name=nil)
1647
+ if (@frames[0][0] != nil)
1648
+ _name = '0.0' if _name.nil?
1649
+ @panels[_name] = Hash.new
1650
+ @panels[_name]['root'] = @frames[0][0]
1651
+ @panels[_name]['sons'] = Hash.new
1128
1652
  end
1129
1653
  end
1130
- private :_prepare_rows
1131
1654
 
1132
1655
  def add_rows(_row,_col, _height, _top_name=nil, _bottom_name=nil)
1133
1656
  _prepare_rows(_row,_col, _height, false, _top_name, _bottom_name)
@@ -1157,14 +1680,14 @@ class ArcadiaLayout
1157
1680
  # end
1158
1681
 
1159
1682
  def all_domains(_frame)
1160
- splitted_adapter = find_splitted_frame(_frame)
1161
- consider_it = splitted_adapter.kind_of?(AGTkSplittedFrames)
1162
- if consider_it
1163
- ret = domains_on_frame(splitted_adapter.frame2).concat(domains_on_frame(splitted_adapter.frame1))
1164
- else
1165
- ret = Array.new
1166
- end
1167
- ret
1683
+ splitted_adapter = find_splitted_frame(_frame)
1684
+ consider_it = splitted_adapter.kind_of?(AGTkSplittedFrames)
1685
+ if consider_it
1686
+ ret = domains_on_frame(splitted_adapter.frame2).concat(domains_on_frame(splitted_adapter.frame1))
1687
+ else
1688
+ ret = Array.new
1689
+ end
1690
+ ret
1168
1691
  end
1169
1692
 
1170
1693
  def all_domains_cols(_frame)
@@ -1185,12 +1708,12 @@ class ArcadiaLayout
1185
1708
  ret
1186
1709
  end
1187
1710
 
1188
-
1189
1711
  def _prepare_cols(_row,_col, _width, _perc=false, _left_name=nil, _right_name=nil)
1190
1712
  if (@frames[_row][_col] != nil)
1191
1713
  #source_domains = all_domains(@frames[_row][_col])
1192
1714
  #source_domains = others_domains(@frames[_row][_col])
1193
1715
  _w = AGTkVSplittedFrames.new(self.root,@frames[_row][_col],_width,@arcadia['conf']['layout.splitter.length'].to_i,_perc)
1716
+ @splitters << _w
1194
1717
  @frames[_row][_col] = _w.left_frame
1195
1718
  #@frames[_row][_col + 1] = _w.right_frame
1196
1719
 
@@ -1202,7 +1725,7 @@ class ArcadiaLayout
1202
1725
  @panels[_left_name]['root_splitted_frames'] = _w
1203
1726
  end
1204
1727
  @panels[_left_name]['splitted_frames'] = _w
1205
- @domains[_row][_col] = _left_name
1728
+ # @domains[_row][_col] = _left_name
1206
1729
 
1207
1730
  _right_name = _row.to_s+'.'+(_col+1).to_s if _right_name == nil
1208
1731
  if !@panels[_right_name].nil?
@@ -1217,7 +1740,7 @@ class ArcadiaLayout
1217
1740
  @panels[_right_name]['root_splitted_frames'] = _w
1218
1741
  end
1219
1742
  @panels[_right_name]['splitted_frames'] = _w
1220
- @domains[_row][_col + 1] = _right_name
1743
+ # @domains[_row][_col + 1] = _right_name
1221
1744
  end
1222
1745
  end
1223
1746
  private :_prepare_cols
@@ -1233,37 +1756,35 @@ class ArcadiaLayout
1233
1756
  if @panels[d] !=nil
1234
1757
  shift_right(_row,_col+1)
1235
1758
  end
1236
- Arcadia.console(self,'msg'=>"shifto a destra #{dj} (su #{d})")
1237
1759
  @panels[d] = @panels[dj]
1238
1760
  #-------------------------------
1239
1761
  #@panels[d]['root'].set_domain(d)
1240
1762
  #-------------------------------
1241
1763
  @panels[d]['sons'].each{|name,ffw| ffw.domain=d}
1242
1764
  @frames[_row][_col+1] = @frames[_row][_col]
1243
- @domains[_row][_col+1] = @domains[_row][_col]
1765
+ # @domains[_row][_col+1] = @domains[_row][_col]
1244
1766
 
1245
1767
  @panels.delete(dj)
1246
1768
  #@panels[dj] = nil
1247
1769
  @frames[_row][_col] = nil
1248
- @domains[_row][_col] = nil
1770
+ # @domains[_row][_col] = nil
1249
1771
  end
1250
1772
 
1251
1773
  def shift_left(_row,_col)
1252
1774
  d = domain_name(_row, _col)
1253
1775
  dj = domain_name(_row, _col+1)
1254
1776
  if @panels[dj] !=nil
1255
- Arcadia.console(self,'msg'=>"shifto a sinista #{dj} (su #{d})")
1256
1777
  @panels[d] = @panels[dj]
1257
1778
  #-------------------------------
1258
1779
  #@panels[d]['root'].set_domain(d)
1259
1780
  #-------------------------------
1260
1781
  @panels[d]['sons'].each{|name,ffw| ffw.domain=d}
1261
1782
  @frames[_row][_col] = @frames[_row][_col+1]
1262
- @domains[_row][_col] = @domains[_row][_col+1]
1783
+ # @domains[_row][_col] = @domains[_row][_col+1]
1263
1784
 
1264
1785
  @panels.delete(dj) # = nil
1265
1786
  @frames[_row][_col+1] = nil
1266
- @domains[_row][_col+1] = nil
1787
+ # @domains[_row][_col+1] = nil
1267
1788
  shift_left(_row,_col+1)
1268
1789
  end
1269
1790
 
@@ -1273,18 +1794,17 @@ class ArcadiaLayout
1273
1794
  d = domain_name(_row, _col)
1274
1795
  dj = domain_name(_row+1, _col)
1275
1796
  if @panels[dj] !=nil
1276
- Arcadia.console(self,'msg'=>"shifto su #{dj} (su #{d})")
1277
1797
  @panels[d] = @panels[dj]
1278
1798
  #-------------------------------
1279
1799
  #@panels[d]['root'].set_domain(d)
1280
1800
  #-------------------------------
1281
1801
  @panels[d]['sons'].each{|name,ffw| ffw.domain=d}
1282
1802
  @frames[_row][_col] = @frames[_row+1][_col]
1283
- @domains[_row][_col] = @domains[_row+1][_col]
1803
+ # @domains[_row][_col] = @domains[_row+1][_col]
1284
1804
 
1285
1805
  @panels.delete(dj) # = nil
1286
1806
  @frames[_row+1][_col] = nil
1287
- @domains[_row+1][_col] = nil
1807
+ # @domains[_row+1][_col] = nil
1288
1808
 
1289
1809
  shift_top(_row+1,_col)
1290
1810
  end
@@ -1298,7 +1818,6 @@ class ArcadiaLayout
1298
1818
  if @panels[d] !=nil
1299
1819
  shift_bottom(_row+1,_col)
1300
1820
  end
1301
- Arcadia.console(self,'msg'=>"shifto giu #{dj} (su #{d})")
1302
1821
  @panels[d] = @panels[dj]
1303
1822
  #-------------------------------
1304
1823
  #@panels[d]['root'].set_domain(d)
@@ -1306,15 +1825,15 @@ class ArcadiaLayout
1306
1825
  @panels[d]['sons'].each{|name,ffw| ffw.domain=d}
1307
1826
  if @frames[_row + 1] == nil
1308
1827
  @frames[_row + 1] = Array.new
1309
- @domains[_row + 1] = Array.new
1828
+ # @domains[_row + 1] = Array.new
1310
1829
  end
1311
1830
  @frames[_row+1][_col] = @frames[_row][_col]
1312
- @domains[_row+1][_col] = @domains[_row][_col]
1831
+ # @domains[_row+1][_col] = @domains[_row][_col]
1313
1832
 
1314
1833
  @panels.delete(dj)
1315
1834
  #@panels[dj] = nil
1316
1835
  @frames[_row][_col] = nil
1317
- @domains[_row][_col] = nil
1836
+ # @domains[_row][_col] = nil
1318
1837
  end
1319
1838
 
1320
1839
  def add_cols(_row,_col, _width, _left_name=nil, _right_name=nil)
@@ -1370,7 +1889,6 @@ class ArcadiaLayout
1370
1889
  if saved_root_splitted_frames
1371
1890
  @panels[_domain]['root_splitted_frames']=saved_root_splitted_frames
1372
1891
  end
1373
-
1374
1892
  build_invert_menu(true)
1375
1893
  end
1376
1894
 
@@ -1495,7 +2013,7 @@ class ArcadiaLayout
1495
2013
  }
1496
2014
  end
1497
2015
  end
1498
- return ret_doms
2016
+ ret_doms
1499
2017
  end
1500
2018
 
1501
2019
  def close_runtime_old(_domain)
@@ -1584,7 +2102,7 @@ class ArcadiaLayout
1584
2102
  else
1585
2103
  @panels.delete(_domain)
1586
2104
  @frames[_row.to_i][_col.to_i] = nil
1587
- @domains[_row.to_i][_col.to_i] = nil
2105
+ # @domains[_row.to_i][_col.to_i] = nil
1588
2106
  # ref_r,ref_c = ref_source_domain.split('.')
1589
2107
  # real_r,real_c=source_domain.split('.')
1590
2108
  # gap_r = ref_r.to_i - real_r.to_i
@@ -1614,10 +2132,10 @@ class ArcadiaLayout
1614
2132
  @panels.delete(source_domain)
1615
2133
  if vertical
1616
2134
  @frames[_row.to_i][_col.to_i+1] = nil
1617
- @domains[_row.to_i][_col.to_i+1] = nil
2135
+ # @domains[_row.to_i][_col.to_i+1] = nil
1618
2136
  else
1619
2137
  @frames[_row.to_i+1][_col.to_i] = nil
1620
- @domains[_row.to_i+1][_col.to_i] = nil
2138
+ # @domains[_row.to_i+1][_col.to_i] = nil
1621
2139
  end
1622
2140
  else
1623
2141
  p "secondo quadrante"
@@ -1630,15 +2148,15 @@ class ArcadiaLayout
1630
2148
  splitted_adapter.destroy
1631
2149
  @panels[destination_domain]['root']=splitted_adapter_frame
1632
2150
  @frames[_row.to_i][_col.to_i] = splitted_adapter_frame
1633
- @domains[_row.to_i][_col.to_i] = destination_domain
2151
+ # @domains[_row.to_i][_col.to_i] = destination_domain
1634
2152
  build_titled_frame(destination_domain)
1635
2153
  @panels.delete(source_domain)
1636
2154
  if vertical
1637
2155
  @frames[_row.to_i][_col.to_i+1] = nil
1638
- @domains[_row.to_i][_col.to_i+1] = nil
2156
+ # @domains[_row.to_i][_col.to_i+1] = nil
1639
2157
  else
1640
2158
  @frames[_row.to_i+1][_col.to_i] = nil
1641
- @domains[_row.to_i+1][_col.to_i] = nil
2159
+ # @domains[_row.to_i+1][_col.to_i] = nil
1642
2160
  end
1643
2161
  source_save.each{|name,ffw|
1644
2162
  ffw.domain = destination_domain
@@ -1661,7 +2179,6 @@ class ArcadiaLayout
1661
2179
  end
1662
2180
  end
1663
2181
  else # CLOSE OTHER
1664
- # verifichiamo se la contro parte è uno splitter_adapter
1665
2182
  other_ds = domains_on_frame(@panels[_domain]['splitted_frames'].frame1)
1666
2183
  if other_ds.length == 1
1667
2184
  other_dom = other_ds[0]
@@ -1688,7 +2205,7 @@ class ArcadiaLayout
1688
2205
  other_root_splitted_adapter.attach_frame(splitted_adapter_frame)
1689
2206
 
1690
2207
  @frames[_row.to_i][_col.to_i] = nil
1691
- @domains[_row.to_i][_col.to_i] = nil
2208
+ # @domains[_row.to_i][_col.to_i] = nil
1692
2209
  @panels.delete(_domain)
1693
2210
  else
1694
2211
  p "quarto quadrante"
@@ -1702,7 +2219,7 @@ class ArcadiaLayout
1702
2219
  @panels[other_dom]['root']=splitted_adapter_frame
1703
2220
 
1704
2221
  @frames[_row.to_i][_col.to_i] = nil
1705
- @domains[_row.to_i][_col.to_i] = nil
2222
+ # @domains[_row.to_i][_col.to_i] = nil
1706
2223
  build_titled_frame(other_dom)
1707
2224
  @panels.delete(_domain)
1708
2225
 
@@ -1719,13 +2236,13 @@ class ArcadiaLayout
1719
2236
  end
1720
2237
  other_row,other_col = other_dom.split('.')
1721
2238
  @frames[other_row.to_i][other_col.to_i] = splitted_adapter_frame
1722
- @domains[other_row.to_i][other_col.to_i] = other_dom
2239
+ # @domains[other_row.to_i][other_col.to_i] = other_dom
1723
2240
  # if vertical
1724
2241
  # @frames[_row.to_i][_col.to_i-1] = splitted_adapter_frame
1725
- # @domains[_row.to_i][_col.to_i-1] = other_dom
2242
+ # # @domains[_row.to_i][_col.to_i-1] = other_dom
1726
2243
  # else
1727
2244
  # @frames[_row.to_i-1][_col.to_i] = splitted_adapter_frame
1728
- # @domains[_row.to_i-1][_col.to_i] = other_dom
2245
+ # # @domains[_row.to_i-1][_col.to_i] = other_dom
1729
2246
  # end
1730
2247
  end
1731
2248
 
@@ -1794,7 +2311,7 @@ class ArcadiaLayout
1794
2311
 
1795
2312
  @panels.delete(_domain)
1796
2313
  @frames[_row.to_i][_col.to_i] = nil
1797
- @domains[_row.to_i][_col.to_i] = nil
2314
+ # @domains[_row.to_i][_col.to_i] = nil
1798
2315
 
1799
2316
  if other_root_splitted_adapter
1800
2317
  if other_root_splitted_adapter != @panels[other_domain]['splitted_frames']
@@ -1806,6 +2323,7 @@ class ArcadiaLayout
1806
2323
  end
1807
2324
  other_root_splitted_adapter.detach_frame
1808
2325
  splitted_adapter.detach_frame
2326
+ @splitters.delete(splitted_adapter)
1809
2327
  splitted_adapter.destroy
1810
2328
  other_root_splitted_adapter.attach_frame(splitted_adapter_frame)
1811
2329
  else
@@ -1868,6 +2386,7 @@ class ArcadiaLayout
1868
2386
  :hidemargin => true
1869
2387
  )
1870
2388
  end
2389
+
1871
2390
  end
1872
2391
 
1873
2392
  def build_titled_frame(domain)
@@ -1893,12 +2412,28 @@ class ArcadiaLayout
1893
2412
  end
1894
2413
  end
1895
2414
 
2415
+ def domains
2416
+ ret = Array.new
2417
+ @panels.keys.each{|dom|
2418
+ if dom != '_domain_root_' && @panels[dom] && @panels[dom]['root']
2419
+ ret << dom
2420
+ end
2421
+ }
2422
+ ret
2423
+ end
2424
+
1896
2425
  def add_headers
1897
- @domains.each{|row|
1898
- row.each{|domain|
1899
- build_titled_frame(domain)
1900
- }
2426
+ @panels.keys.each{|dom|
2427
+ if dom != '_domain_root_' && @panels[dom] && @panels[dom]['root']
2428
+ build_titled_frame(dom)
2429
+ end
1901
2430
  }
2431
+
2432
+ # @domains.each{|row|
2433
+ # row.each{|domain|
2434
+ # build_titled_frame(domain)
2435
+ # }
2436
+ # }
1902
2437
  @headed = true
1903
2438
  end
1904
2439
 
@@ -1919,7 +2454,7 @@ class ArcadiaLayout
1919
2454
  source_domain = @wrappers[_source_name].domain
1920
2455
  source_has_domain = !source_domain.nil?
1921
2456
  tt2= @panels[source_domain]['root'].top_text if source_has_domain
1922
- if source_has_domain && @panels[source_domain]['sons'].length ==1 && @panels[_target_domain]['sons'].length > 0
2457
+ if @arcadia.conf('layout.exchange_panel_if_no_tabbed')=='true' && source_has_domain && @panels[source_domain]['sons'].length ==1 && @panels[_target_domain]['sons'].length > 0
1923
2458
  # change ------
1924
2459
  ffw1 = raised_fixed_frame(_target_domain)
1925
2460
  ffw2 = @panels[source_domain]['sons'].values[0]
@@ -1981,36 +2516,68 @@ class ArcadiaLayout
1981
2516
  #domain_root = @panels[_domain_name]['sons'][_frame_name]
1982
2517
  @panels.keys.each{|dom|
1983
2518
  if dom != '_domain_root_' && dom != _ffw.domain && @panels[dom] && @panels[dom]['root']
1984
- menu = @panels[dom]['root'].menu_button('ext').cget('menu')
1985
- menu.insert('0',:command,
1986
- :label=>_ffw.title,
1987
- :image=>TkPhotoImage.new('dat'=>ARROW_LEFT_GIF),
1988
- :compound=>'left',
1989
- :command=>proc{change_domain(dom, _ffw.name)},
1990
- :hidemargin => true
1991
- )
2519
+ titledFrame = @panels[dom]['root']
2520
+ if titledFrame.instance_of?(TkTitledFrame)
2521
+ menu = @panels[dom]['root'].menu_button('ext').cget('menu')
2522
+ menu.insert('0',:command,
2523
+ :label=>_ffw.title,
2524
+ :image=>TkPhotoImage.new('dat'=>ARROW_LEFT_GIF),
2525
+ :compound=>'left',
2526
+ :command=>proc{change_domain(dom, _ffw.name)},
2527
+ :hidemargin => true
2528
+ )
2529
+ end
1992
2530
  end
1993
2531
  }
2532
+ if @panels[_ffw.domain]
2533
+ titledFrame = @panels[_ffw.domain]['root']
2534
+ if titledFrame.instance_of?(TkTitledFrame)
2535
+ mymenu = titledFrame.menu_button('ext').cget('menu')
2536
+ index = mymenu.index('end').to_i
2537
+ if @panels.keys.length > 2
2538
+ i=index-3
2539
+ else
2540
+ i=index-2
2541
+ end
2542
+ if i >= 0
2543
+ index = i.to_s
2544
+ end
2545
+ mymenu.insert(index,:command,
2546
+ :label=>"close \"#{_ffw.title}\"",
2547
+ :image=>TkPhotoImage.new('dat'=>CLOSE_FRAME_GIF),
2548
+ :compound=>'left',
2549
+ :command=>proc{unregister_panel(_ffw, false, true)},
2550
+ :hidemargin => true
2551
+ )
2552
+ end
2553
+ end
2554
+
1994
2555
  end
1995
2556
 
1996
2557
 
1997
2558
  def build_invert_menu(refresh_commons_items=false)
1998
2559
  @panels.keys.each{|dom|
1999
2560
  if dom != '_domain_root_' && @panels[dom] && @panels[dom]['root']
2000
- menu = @panels[dom]['root'].menu_button('ext').cget('menu')
2001
- if refresh_commons_items
2002
- @panels[dom]['root'].menu_button('ext').cget('menu').delete('0','end')
2003
- add_commons_menu_items(dom, menu)
2004
- else
2005
- if @panels.keys.length > 2
2006
- i=menu.index('end').to_i-4
2561
+ titledFrame = @panels[dom]['root']
2562
+ if titledFrame.instance_of?(TkTitledFrame)
2563
+ menu = titledFrame.menu_button('ext').cget('menu')
2564
+ if refresh_commons_items
2565
+ @panels[dom]['root'].menu_button('ext').cget('menu').delete('0','end')
2566
+ add_commons_menu_items(dom, menu)
2007
2567
  else
2008
- i=menu.index('end').to_i-3
2009
- end
2010
- if i >= 0
2011
- end_index = i.to_s
2012
- @panels[dom]['root'].menu_button('ext').cget('menu').delete('0',end_index)
2568
+ index = menu.index('end').to_i
2569
+ if @panels.keys.length > 2
2570
+ i=index-4
2571
+ else
2572
+ i=index-3
2573
+ end
2574
+ if i >= 0
2575
+ end_index = i.to_s
2576
+ @panels[dom]['root'].menu_button('ext').cget('menu').delete('0',end_index)
2577
+ end
2013
2578
  end
2579
+ # index = menu.index('end').to_i
2580
+ # @panels[dom]['root'].menu_button('ext').cget('menu').delete('2','end') if index > 1
2014
2581
  end
2015
2582
  end
2016
2583
  }
@@ -2018,79 +2585,8 @@ class ArcadiaLayout
2018
2585
  @wrappers.each{|name,ffw|
2019
2586
  process_frame(ffw) #if ffw.domain
2020
2587
  }
2588
+
2021
2589
  end
2022
-
2023
- # def register_panel_old(_domain_name, _name, _title)
2024
- # p = @panels[_domain_name]
2025
- # if p!=nil
2026
- # num = p['sons'].length
2027
- # if @headed
2028
- # p['root'].title(_title)
2029
- # if !p['root'].frame.instance_of?(TkFrameAdapter)
2030
- # wrapper = TkFrameAdapter.new(self.root, Arcadia.style('frame'))
2031
- # wrapper.attach_frame(p['root'].frame)
2032
- # p['root'].frame=wrapper
2033
- # end
2034
- # root_frame = p['root'].frame
2035
- # process_register_panel(_domain_name)
2036
- # else
2037
- # root_frame = p['root']
2038
- # end
2039
- # if (num == 0 && @autotab)
2040
- # api = ArcadiaPanelInfo.new(_name,_title,nil)
2041
- # api.frame = TkFrame.new(root_frame, Arcadia.style('panel')).place('x'=>0, 'y'=>0, 'relwidth'=>1, 'relheight'=>1)
2042
- # p['sons'][_name] = api
2043
- # return api.frame
2044
- # else
2045
- # if num == 1 && @autotab && p['notebook'] == nil
2046
- # p['notebook'] = Tk::BWidget::NoteBook.new(root_frame, Arcadia.style('tabpanel')){
2047
- # tabbevelsize 0
2048
- # internalborderwidth 0
2049
- # pack('fill'=>'both', :padx=>0, :pady=>0, :expand => 'yes')
2050
- # }
2051
- # api = p['sons'].values[0]
2052
- # api_tab_frame = p['notebook'].insert('end',
2053
- # api.name,
2054
- # 'text'=>api.title,
2055
- # 'raisecmd'=>proc{
2056
- # p['root'].title(api.title)
2057
- # p['root'].top_text('')
2058
- # changed
2059
- # notify_observers('RAISE', api.name)
2060
- # }
2061
- # )
2062
- # api.frame.place('in'=>api_tab_frame, 'x'=>0, 'y'=>0, 'relwidth'=>1, 'relheight'=>1)
2063
- # api.frame.raise
2064
- # elsif (num==0 && !@autotab)
2065
- # p['notebook'] = Tk::BWidget::NoteBook.new(root_frame){
2066
- # tabbevelsize 0
2067
- # internalborderwidth 0
2068
- # pack('fill'=>'both', :padx=>0, :pady=>0, :expand => 'yes')
2069
- # }
2070
- # end
2071
- # _panel = p['notebook'].insert('end',_name ,
2072
- # 'text'=>_title,
2073
- # 'raisecmd'=>proc{
2074
- # p['root'].title(_title)
2075
- # changed
2076
- # notify_observers('RAISE', _name)
2077
- # }
2078
- # )
2079
- # p['sons'][_name] = ArcadiaPanelInfo.new(_name,_title,_panel)
2080
- # p['notebook'].raise(_name)
2081
- # return _panel
2082
- # end
2083
- # else
2084
- # Arcadia.dialog(self,
2085
- # 'type'=>'ok',
2086
- # 'msg'=>"domain #{_domain_name} do not exist\nfor '#{_title}'!",
2087
- # 'level'=>'warning'
2088
- # )
2089
- # float_frame = new_float_frame
2090
- # float_frame.title(_title)
2091
- # return float_frame.frame
2092
- # end
2093
- # end
2094
2590
 
2095
2591
  def register_panel(_ffw, _adapter=nil)
2096
2592
  _domain_name = _ffw.domain
@@ -2135,8 +2631,7 @@ class ArcadiaLayout
2135
2631
  'raisecmd'=>proc{
2136
2632
  pan['root'].title(api.title)
2137
2633
  pan['root'].top_text('')
2138
- Arcadia.process_event(LayoutRaisingFrameEvent.new(self,'extension_name'=>_ffw.extension, 'frame_name'=>_ffw.name))
2139
-
2634
+ Arcadia.process_event(LayoutRaisingFrameEvent.new(self,'extension_name'=>pan['sons'][api.name].extension, 'frame_name'=>pan['sons'][api.name].name))
2140
2635
  # changed
2141
2636
  # notify_observers('RAISE', api.name)
2142
2637
  }
@@ -2180,7 +2675,6 @@ class ArcadiaLayout
2180
2675
  _ffw.domain = nil
2181
2676
  process_frame(_ffw)
2182
2677
  return TkFrameAdapter.new(self.root, Arcadia.style('frame'))
2183
-
2184
2678
  #
2185
2679
  # Arcadia.dialog(self,
2186
2680
  # 'type'=>'ok',
@@ -2262,6 +2756,198 @@ class ArcadiaLayout
2262
2756
  _frame.place(_args)
2263
2757
  return _frame
2264
2758
  end
2759
+
2760
+ def dump_splitter(_splitter)
2761
+ ret = ''
2762
+ if _splitter.instance_of?(AGTkVSplittedFrames)
2763
+ w = TkWinfo.width(_splitter.frame1)
2764
+ ret = "c#{w}"
2765
+ elsif _splitter.instance_of?(AGTkOSplittedFrames)
2766
+ h = TkWinfo.height(_splitter.frame1)
2767
+ ret = "r#{h}"
2768
+ end
2769
+ ret
2770
+ end
2771
+
2772
+ def splitter_frame_on_frame(_frame)
2773
+ ret=nil
2774
+ @splitters.each{|sp|
2775
+ if sp.frame == _frame
2776
+ ret = sp
2777
+ break
2778
+ end
2779
+ }
2780
+ ret
2781
+ end
2782
+
2783
+ def get_hinner_frame(_frame)
2784
+ ret = _frame
2785
+ # child = TkWinfo.children(_frame)[0]
2786
+ TkWinfo.children(_frame).each{|child|
2787
+ if child.instance_of?(TkTitledFrame)
2788
+ ret = child.frame
2789
+ break
2790
+ end
2791
+ }
2792
+ # if child.instance_of?(TkTitledFrame)
2793
+ # ret = child.frame
2794
+ # end
2795
+ ret
2796
+ end
2797
+
2798
+ def shift_domain_column(_r,_c,_dom)
2799
+ Hash.new.update(_dom).each{|k,d|
2800
+ dr,dc=d.split('.')
2801
+ if dc.to_i >= _c && dr.to_i == _r
2802
+ #shift_domain_column(_r,dc.to_i+1,_dom)
2803
+ p "== #{d} --> #{domain_name(_r,dc.to_i+1)}"
2804
+ _dom[k]= domain_name(_r,dc.to_i+1)
2805
+ end
2806
+ }
2807
+ end
2808
+
2809
+ def shift_domain_row(_r,_c,_dom)
2810
+ Hash.new.update(_dom).each{|k,d|
2811
+ dr,dc=d.split('.')
2812
+ if dr.to_i >= _r && dc.to_i == _c
2813
+ #shift_domain_row(dr.to_i+1,_c,_dom)
2814
+ p "shift_domain_row == #{d} --> #{domain_name(dr.to_i+1,_c)}"
2815
+ _dom[k]=domain_name(dr.to_i+1,_c)
2816
+ end
2817
+ }
2818
+ end
2819
+
2820
+ def gap_domain_column(_r,_c,_dom)
2821
+ ret = _c
2822
+ Hash.new.update(_dom).each{|k,d|
2823
+ dr,dc=d.split('.')
2824
+ if dc.to_i == _c && dr.to_i == _r
2825
+ ret = gap_domain_column(_r,dc.to_i+1,_dom)
2826
+ end
2827
+ }
2828
+ ret
2829
+ end
2830
+
2831
+ def gap_domain_row(_r,_c,_dom)
2832
+ ret = _r
2833
+ Hash.new.update(_dom).each{|k,d|
2834
+ dr,dc=d.split('.')
2835
+ if dr.to_i == _r && dc.to_i == _c
2836
+ ret = gap_domain_row(dr.to_i+1,_c,_dom)
2837
+ end
2838
+ }
2839
+ ret
2840
+ end
2841
+
2842
+
2843
+ def dump_geometry(_r=0,_c=0,_frame=root)
2844
+ spl = Array.new
2845
+ dom = Hash.new
2846
+ ret = [nil,nil,nil,nil]
2847
+ sp = splitter_frame_on_frame(_frame)
2848
+ if sp
2849
+ spl << "#{domain_name(_r,_c)}#{dump_splitter(sp)}"
2850
+ dom[get_hinner_frame(sp.frame1)]=domain_name(_r,_c)
2851
+ sspl,ddom,rr,cc = dump_geometry(_r, _c, sp.frame1)
2852
+ spl.concat(sspl)
2853
+ dom.update(ddom)
2854
+ if sp.instance_of?(AGTkVSplittedFrames)
2855
+ _c=cc+1
2856
+ _c=gap_domain_column(_r,_c,dom)
2857
+ else
2858
+ _r=rr+1
2859
+ _r=gap_domain_row(_r,_c,dom)
2860
+ end
2861
+ dom[get_hinner_frame(sp.frame2)]=domain_name(_r,_c)
2862
+ sspl,ddom,rr,cc = dump_geometry(_r, _c, sp.frame2)
2863
+ spl.concat(sspl)
2864
+ dom.update(ddom)
2865
+ elsif _frame==root
2866
+ dom[get_hinner_frame(root)]=domain_name(_r,_c)
2867
+ end
2868
+ ret[0]=spl
2869
+ ret[1]=dom
2870
+ ret[2]=_r
2871
+ ret[3]=_c
2872
+ ret
2873
+ end
2874
+ end
2875
+
2876
+ #
2877
+ # receives messages and tracks the
2878
+ # by Roger D. Pack
2879
+ class MonitorLastUsedDir
2880
+
2881
+ def initialize
2882
+ for event in [SaveBufferEvent, AckInFilesEvent, SearchInFilesEvent, OpenBufferEvent] do
2883
+ Arcadia.attach_listener(self, event)
2884
+ end
2885
+ end
2886
+
2887
+ def on_after_save_as_buffer(_event)
2888
+ MonitorLastUsedDir.set_last _event.new_file
2889
+ end
2890
+
2891
+ def on_after_ack_in_files _event
2892
+ MonitorLastUsedDir.set_last _event.dir
2893
+ end
2894
+
2895
+ # we want this one...but...not at startup time...hmm.
2896
+ def on_after_open_buffer _event
2897
+ MonitorLastUsedDir.set_last _event.file
2898
+ end
2899
+
2900
+ alias :on_after_search_in_files :on_after_ack_in_files
2901
+
2902
+ def self.get_last_dir
2903
+ current = $arcadia['pers']['last.used.dir']
2904
+ if current != nil && current != ''
2905
+ current
2906
+ else
2907
+ $pwd # startup dir
2908
+ end
2909
+ end
2910
+
2911
+ def MonitorLastUsedDir.set_last to_this # TODO set as private...
2912
+ return if to_this.nil? or to_this == ''
2913
+ if(File.directory?(to_this))
2914
+ to_this_dir = to_this
2915
+ elsif File.directory? File.dirname(to_this)
2916
+ # filename,
2917
+ to_this_dir = File.dirname(to_this)
2918
+ end
2919
+ $arcadia['pers']['last.used.dir'] = File.expand_path(to_this_dir)
2920
+ end
2921
+
2265
2922
  end
2266
2923
 
2924
+ class FocusEventManager
2925
+ def initialize
2926
+ Arcadia.attach_listener(self, FocusEvent)
2927
+ end
2928
+
2929
+ def on_focus(_event)
2930
+ _event.focus_widget=Tk.focus
2931
+ case _event
2932
+ when CutTextEvent
2933
+ do_cut(_event.focus_widget)
2934
+ when CopyTextEvent
2935
+ do_copy(_event.focus_widget)
2936
+ when PasteTextEvent
2937
+ do_paste(_event.focus_widget)
2938
+ end
2939
+ end
2940
+
2941
+ def do_cut(_focused_widget)
2942
+ _focused_widget.text_cut if _focused_widget.respond_to?(:text_cut)
2943
+ end
2944
+
2945
+ def do_copy(_focused_widget)
2946
+ _focused_widget.text_copy if _focused_widget.respond_to?(:text_copy)
2947
+ end
2267
2948
 
2949
+ def do_paste(_focused_widget)
2950
+ _focused_widget.text_paste if _focused_widget.respond_to?(:text_paste)
2951
+ end
2952
+
2953
+ end