arcadia 0.5.1 → 0.6.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 (170) hide show
  1. data/README +11 -8
  2. data/bin/arcadia +1 -1
  3. data/bin/arcadia.bat +0 -0
  4. data/conf/arcadia.conf +21 -4
  5. data/conf/arcadia.init.rb +0 -0
  6. data/conf/arcadia.res.rb +25 -2
  7. data/ext/ae-breakpoints/ae-breakpoints.conf +2 -1
  8. data/ext/ae-breakpoints/ae-breakpoints.rb +12 -12
  9. data/ext/ae-editor/ae-editor.conf +2 -1
  10. data/ext/ae-editor/ae-editor.rb +3841 -3813
  11. data/ext/ae-editor/langs/conf.lang +0 -0
  12. data/ext/ae-editor/langs/lang.lang.bind +0 -0
  13. data/ext/ae-editor/langs/rb.lang +0 -0
  14. data/ext/ae-editor/langs/rbw.lang.bind +0 -0
  15. data/ext/ae-file-history/ae-file-history.conf +2 -1
  16. data/ext/ae-file-history/ae-file-history.rb +1 -0
  17. data/ext/ae-output/ae-output.conf +2 -1
  18. data/ext/ae-output/ae-output.rb +0 -0
  19. data/ext/ae-rad/ae-rad-inspector.rb +4 -3
  20. data/ext/ae-rad/ae-rad-libs.rb +0 -0
  21. data/ext/ae-rad/ae-rad-palette.rb +0 -0
  22. data/ext/ae-rad/ae-rad.conf +2 -1
  23. data/ext/ae-rad/ae-rad.rb +0 -0
  24. data/ext/ae-rad/lib/tk/al-tk.rb +0 -0
  25. data/ext/ae-rad/lib/tk/al-tk.res.rb +0 -0
  26. data/ext/ae-rad/lib/tk/al-tkarcadia.rb +25 -25
  27. data/ext/ae-rad/lib/tk/al-tkcustom.rb +0 -0
  28. data/ext/ae-rad/lib/tkext/al-bwidget.rb +0 -0
  29. data/ext/ae-rad/lib/tkext/al-iwidgets.rb +0 -0
  30. data/ext/ae-rad/lib/tkext/al-tile.rb +0 -0
  31. data/ext/ae-rad/lib/tkext/al-tktable.rb +0 -0
  32. data/ext/ae-ruby-debug/ae-ruby-debug.conf +3 -2
  33. data/ext/ae-ruby-debug/ae-ruby-debug.rb +10 -6
  34. data/ext/ae-search-in-files/ae-search-in-files.conf +2 -1
  35. data/ext/ae-search-in-files/ae-search-in-files.rb +0 -0
  36. data/ext/ae-shell/ae-shell.conf +0 -0
  37. data/ext/ae-shell/ae-shell.rb +0 -0
  38. data/ext/ae-shell/sh.rb +0 -0
  39. data/lib/a-commons.rb +37 -15
  40. data/lib/a-contracts.rb +11 -0
  41. data/lib/a-core.rb +1084 -84
  42. data/lib/a-tkcommons.rb +240 -43
  43. data/tcl/BWidget-1.8.0/BWman/ArrowButton.html +0 -0
  44. data/tcl/BWidget-1.8.0/BWman/BWidget.html +0 -0
  45. data/tcl/BWidget-1.8.0/BWman/Button.html +0 -0
  46. data/tcl/BWidget-1.8.0/BWman/ButtonBox.html +0 -0
  47. data/tcl/BWidget-1.8.0/BWman/ComboBox.html +0 -0
  48. data/tcl/BWidget-1.8.0/BWman/Dialog.html +0 -0
  49. data/tcl/BWidget-1.8.0/BWman/DragSite.html +0 -0
  50. data/tcl/BWidget-1.8.0/BWman/DropSite.html +0 -0
  51. data/tcl/BWidget-1.8.0/BWman/DynamicHelp.html +0 -0
  52. data/tcl/BWidget-1.8.0/BWman/Entry.html +0 -0
  53. data/tcl/BWidget-1.8.0/BWman/Label.html +0 -0
  54. data/tcl/BWidget-1.8.0/BWman/LabelEntry.html +0 -0
  55. data/tcl/BWidget-1.8.0/BWman/LabelFrame.html +0 -0
  56. data/tcl/BWidget-1.8.0/BWman/ListBox.html +0 -0
  57. data/tcl/BWidget-1.8.0/BWman/MainFrame.html +0 -0
  58. data/tcl/BWidget-1.8.0/BWman/MessageDlg.html +0 -0
  59. data/tcl/BWidget-1.8.0/BWman/NoteBook.html +0 -0
  60. data/tcl/BWidget-1.8.0/BWman/PagesManager.html +0 -0
  61. data/tcl/BWidget-1.8.0/BWman/PanedWindow.html +0 -0
  62. data/tcl/BWidget-1.8.0/BWman/PanelFrame.html +0 -0
  63. data/tcl/BWidget-1.8.0/BWman/PasswdDlg.html +0 -0
  64. data/tcl/BWidget-1.8.0/BWman/ProgressBar.html +0 -0
  65. data/tcl/BWidget-1.8.0/BWman/ProgressDlg.html +0 -0
  66. data/tcl/BWidget-1.8.0/BWman/ScrollView.html +0 -0
  67. data/tcl/BWidget-1.8.0/BWman/ScrollableFrame.html +0 -0
  68. data/tcl/BWidget-1.8.0/BWman/ScrolledWindow.html +0 -0
  69. data/tcl/BWidget-1.8.0/BWman/SelectColor.html +0 -0
  70. data/tcl/BWidget-1.8.0/BWman/SelectFont.html +0 -0
  71. data/tcl/BWidget-1.8.0/BWman/Separator.html +0 -0
  72. data/tcl/BWidget-1.8.0/BWman/SpinBox.html +0 -0
  73. data/tcl/BWidget-1.8.0/BWman/StatusBar.html +0 -0
  74. data/tcl/BWidget-1.8.0/BWman/TitleFrame.html +0 -0
  75. data/tcl/BWidget-1.8.0/BWman/Tree.html +0 -0
  76. data/tcl/BWidget-1.8.0/BWman/Widget.html +0 -0
  77. data/tcl/BWidget-1.8.0/BWman/contents.html +0 -0
  78. data/tcl/BWidget-1.8.0/BWman/index.html +0 -0
  79. data/tcl/BWidget-1.8.0/BWman/navtree.html +0 -0
  80. data/tcl/BWidget-1.8.0/BWman/options.htm +0 -0
  81. data/tcl/BWidget-1.8.0/CHANGES.txt +0 -0
  82. data/tcl/BWidget-1.8.0/ChangeLog +0 -0
  83. data/tcl/BWidget-1.8.0/LICENSE.txt +0 -0
  84. data/tcl/BWidget-1.8.0/README.txt +0 -0
  85. data/tcl/BWidget-1.8.0/arrow.tcl +0 -0
  86. data/tcl/BWidget-1.8.0/bitmap.tcl +0 -0
  87. data/tcl/BWidget-1.8.0/button.tcl +0 -0
  88. data/tcl/BWidget-1.8.0/buttonbox.tcl +0 -0
  89. data/tcl/BWidget-1.8.0/color.tcl +0 -0
  90. data/tcl/BWidget-1.8.0/combobox.tcl +0 -0
  91. data/tcl/BWidget-1.8.0/demo/basic.tcl +0 -0
  92. data/tcl/BWidget-1.8.0/demo/bwidget.xbm +0 -0
  93. data/tcl/BWidget-1.8.0/demo/demo.tcl +0 -0
  94. data/tcl/BWidget-1.8.0/demo/dnd.tcl +0 -0
  95. data/tcl/BWidget-1.8.0/demo/manager.tcl +0 -0
  96. data/tcl/BWidget-1.8.0/demo/select.tcl +0 -0
  97. data/tcl/BWidget-1.8.0/demo/tmpldlg.tcl +0 -0
  98. data/tcl/BWidget-1.8.0/demo/tree.tcl +0 -0
  99. data/tcl/BWidget-1.8.0/demo/x1.xbm +0 -0
  100. data/tcl/BWidget-1.8.0/dialog.tcl +0 -0
  101. data/tcl/BWidget-1.8.0/dragsite.tcl +0 -0
  102. data/tcl/BWidget-1.8.0/dropsite.tcl +0 -0
  103. data/tcl/BWidget-1.8.0/dynhelp.tcl +0 -0
  104. data/tcl/BWidget-1.8.0/entry.tcl +0 -0
  105. data/tcl/BWidget-1.8.0/font.tcl +0 -0
  106. data/tcl/BWidget-1.8.0/images/bold.gif +0 -0
  107. data/tcl/BWidget-1.8.0/images/copy.gif +0 -0
  108. data/tcl/BWidget-1.8.0/images/cut.gif +0 -0
  109. data/tcl/BWidget-1.8.0/images/dragfile.gif +0 -0
  110. data/tcl/BWidget-1.8.0/images/dragicon.gif +0 -0
  111. data/tcl/BWidget-1.8.0/images/error.gif +0 -0
  112. data/tcl/BWidget-1.8.0/images/file.gif +0 -0
  113. data/tcl/BWidget-1.8.0/images/folder.gif +0 -0
  114. data/tcl/BWidget-1.8.0/images/hourglass.gif +0 -0
  115. data/tcl/BWidget-1.8.0/images/info.gif +0 -0
  116. data/tcl/BWidget-1.8.0/images/italic.gif +0 -0
  117. data/tcl/BWidget-1.8.0/images/minus.xbm +0 -0
  118. data/tcl/BWidget-1.8.0/images/new.gif +0 -0
  119. data/tcl/BWidget-1.8.0/images/opcopy.xbm +0 -0
  120. data/tcl/BWidget-1.8.0/images/open.gif +0 -0
  121. data/tcl/BWidget-1.8.0/images/openfold.gif +0 -0
  122. data/tcl/BWidget-1.8.0/images/oplink.xbm +0 -0
  123. data/tcl/BWidget-1.8.0/images/opmove.xbm +0 -0
  124. data/tcl/BWidget-1.8.0/images/overstrike.gif +0 -0
  125. data/tcl/BWidget-1.8.0/images/palette.gif +0 -0
  126. data/tcl/BWidget-1.8.0/images/passwd.gif +0 -0
  127. data/tcl/BWidget-1.8.0/images/paste.gif +0 -0
  128. data/tcl/BWidget-1.8.0/images/plus.xbm +0 -0
  129. data/tcl/BWidget-1.8.0/images/print.gif +0 -0
  130. data/tcl/BWidget-1.8.0/images/question.gif +0 -0
  131. data/tcl/BWidget-1.8.0/images/redo.gif +0 -0
  132. data/tcl/BWidget-1.8.0/images/save.gif +0 -0
  133. data/tcl/BWidget-1.8.0/images/target.xbm +0 -0
  134. data/tcl/BWidget-1.8.0/images/underline.gif +0 -0
  135. data/tcl/BWidget-1.8.0/images/undo.gif +0 -0
  136. data/tcl/BWidget-1.8.0/images/warning.gif +0 -0
  137. data/tcl/BWidget-1.8.0/init.tcl +0 -0
  138. data/tcl/BWidget-1.8.0/label.tcl +0 -0
  139. data/tcl/BWidget-1.8.0/labelentry.tcl +0 -0
  140. data/tcl/BWidget-1.8.0/labelframe.tcl +0 -0
  141. data/tcl/BWidget-1.8.0/lang/da.rc +0 -0
  142. data/tcl/BWidget-1.8.0/lang/de.rc +0 -0
  143. data/tcl/BWidget-1.8.0/lang/en.rc +0 -0
  144. data/tcl/BWidget-1.8.0/lang/es.rc +0 -0
  145. data/tcl/BWidget-1.8.0/lang/fr.rc +0 -0
  146. data/tcl/BWidget-1.8.0/listbox.tcl +0 -0
  147. data/tcl/BWidget-1.8.0/mainframe.tcl +0 -0
  148. data/tcl/BWidget-1.8.0/messagedlg.tcl +0 -0
  149. data/tcl/BWidget-1.8.0/notebook.tcl +0 -0
  150. data/tcl/BWidget-1.8.0/pagesmgr.tcl +0 -0
  151. data/tcl/BWidget-1.8.0/panedw.tcl +0 -0
  152. data/tcl/BWidget-1.8.0/panelframe.tcl +0 -0
  153. data/tcl/BWidget-1.8.0/passwddlg.tcl +0 -0
  154. data/tcl/BWidget-1.8.0/pkgIndex.tcl +0 -0
  155. data/tcl/BWidget-1.8.0/progressbar.tcl +0 -0
  156. data/tcl/BWidget-1.8.0/progressdlg.tcl +0 -0
  157. data/tcl/BWidget-1.8.0/scrollframe.tcl +0 -0
  158. data/tcl/BWidget-1.8.0/scrollview.tcl +0 -0
  159. data/tcl/BWidget-1.8.0/scrollw.tcl +0 -0
  160. data/tcl/BWidget-1.8.0/separator.tcl +0 -0
  161. data/tcl/BWidget-1.8.0/spinbox.tcl +0 -0
  162. data/tcl/BWidget-1.8.0/statusbar.tcl +0 -0
  163. data/tcl/BWidget-1.8.0/tests/entry.test +0 -0
  164. data/tcl/BWidget-1.8.0/titleframe.tcl +0 -0
  165. data/tcl/BWidget-1.8.0/tree.tcl +0 -0
  166. data/tcl/BWidget-1.8.0/utils.tcl +0 -0
  167. data/tcl/BWidget-1.8.0/widget.tcl +0 -0
  168. data/tcl/BWidget-1.8.0/wizard.tcl +0 -0
  169. data/tcl/BWidget-1.8.0/xpm2image.tcl +0 -0
  170. metadata +136 -135
File without changes
File without changes
File without changes
File without changes
@@ -1,6 +1,7 @@
1
1
  name=file_history
2
- labels=File history
3
2
  frames=0.0
3
+ frames.labels=File history
4
+ frames.names=file_history
4
5
  active=yes
5
6
  require=ext/ae-file-history/ae-file-history
6
7
  class=FilesHistrory
@@ -189,6 +189,7 @@ class FilesHistrory < ArcadiaExt
189
189
 
190
190
  def on_after_build(_event)
191
191
  Arcadia.attach_listener(self, OpenBufferEvent)
192
+ #Arcadia.attach_listener(self, BufferRaisedEvent)
192
193
  self.frame.show
193
194
  #Arcadia.attach_listener(self, CloseBufferEvent)
194
195
  end
@@ -1,6 +1,7 @@
1
1
  name=output
2
- labels=Output
3
2
  frames=1.1
3
+ frames.labels=Output
4
+ frames.names=output
4
5
  active=yes
5
6
  require=ext/ae-output/ae-output
6
7
  class=Output
File without changes
@@ -449,7 +449,7 @@ class PropLineReadOnly
449
449
  def initialize(_bodyprops, _key, _value)
450
450
  @bodyprops = _bodyprops
451
451
  @key = _key
452
- @splitted_frame = AGTkVSplittedFrames.new(@bodyprops.host, 85)
452
+ @splitted_frame = AGTkVSplittedFrames.new(@bodyprops.host,@bodyprops.host, 85)
453
453
  @propkey = TkLabel.new(@splitted_frame.left_frame, Arcadia.style('label')){
454
454
  text _key
455
455
  justify 'right'
@@ -552,7 +552,7 @@ class InspectList
552
552
  # @pwind.place('width' => -15)
553
553
  @bar = TkScrollbar.new(_host, Arcadia.style('scrollbar')).pack('side'=>'right', 'fill'=>'y')
554
554
  end
555
- @pwind = AGTkVSplittedFrames.new(_host,_left_width)
555
+ @pwind = AGTkVSplittedFrames.new(_host,_host,_left_width)
556
556
 
557
557
  background = _host.cget('background')
558
558
  common_properties = {'relief'=>'flat','state'=>'disabled', 'borderwidth'=>0, 'background'=>background}
@@ -588,6 +588,7 @@ class InspectList
588
588
  end
589
589
 
590
590
  def new_right_width
591
+ new_width = 0
591
592
  font_size = TkFont.new(@right_text.cget('font')).size
592
593
  w=TkPlace.info(@pwind.right_frame)['width']
593
594
  dw = TkPlace.info(@pwind.left_frame)['width']
@@ -1126,7 +1127,7 @@ class Obji
1126
1127
  @controller = _controller
1127
1128
  @filename = _filename
1128
1129
  @frame = _frame
1129
- @pmainwind = AGTkOSplittedFrames.new(@frame,20)
1130
+ @pmainwind = AGTkOSplittedFrames.new(@frame,@frame,20)
1130
1131
  @f_top = @pmainwind.top_frame
1131
1132
  @f_bottom = @pmainwind.bottom_frame
1132
1133
  @lb = TkMenuButtonObjBoard.new(@f_top, self)
File without changes
File without changes
@@ -1,6 +1,7 @@
1
1
  name=rad
2
- labels=Rad,Object Inspector
3
2
  frames=0.0
3
+ frames.labels=Rad,Object Inspector
4
+ frames.names=rad,rad_object_inspector
4
5
  float_frames=200x220+10+10
5
6
  float_labels=Rad
6
7
  active=yes
File without changes
File without changes
File without changes
@@ -1,25 +1,25 @@
1
- #
2
- # al-tkarcadia.rb - Arcadia Ruby ide
3
- # by Antonio Galeone <antonio-galeone@rubyforge.org>
4
- #
5
- require 'ext/ae-rad/lib/tk/al-tk'
6
- require 'lib/a-tkcommons'
7
-
8
- class WAGTkVSplittedFrames < AGTkFrame
9
- def WAGTkVSplittedFrames.class_wrapped
10
- AGTkVSplittedFrames
11
- end
12
- def new_object
13
- @obj = AGTkVSplittedFrames.new(@ag_parent.obj)
14
- end
15
-
16
- def properties
17
- super()
18
- end
19
- end
20
-
21
- class ArcadiaLibArcadiaTk < ArcadiaLib
22
- def register_classes
23
- self.add_class(WAGTkVSplittedFrames)
24
- end
25
- end
1
+ #
2
+ # al-tkarcadia.rb - Arcadia Ruby ide
3
+ # by Antonio Galeone <antonio-galeone@rubyforge.org>
4
+ #
5
+ require 'ext/ae-rad/lib/tk/al-tk'
6
+ require 'lib/a-tkcommons'
7
+
8
+ class WAGTkVSplittedFrames < AGTkFrame
9
+ def WAGTkVSplittedFrames.class_wrapped
10
+ AGTkVSplittedFrames
11
+ end
12
+ def new_object
13
+ @obj = AGTkVSplittedFrames.new(@ag_parent.obj, @ag_parent.obj)
14
+ end
15
+
16
+ def properties
17
+ super()
18
+ end
19
+ end
20
+
21
+ class ArcadiaLibArcadiaTk < ArcadiaLib
22
+ def register_classes
23
+ self.add_class(WAGTkVSplittedFrames)
24
+ end
25
+ end
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,8 +1,9 @@
1
1
  #========================================
2
2
  #========================================
3
3
  name=ruby-debug
4
- labels=Ruby Debug
5
- frames=0.0
4
+ frames=0.0,1.1
5
+ frames.labels=Debug Inspector,Debug Server
6
+ frames.names=ruby_debug_inspector,ruby_debug_server
6
7
  active=yes
7
8
  require=ext/ae-ruby-debug/ae-ruby-debug
8
9
  class=RubyDebug
@@ -9,8 +9,9 @@ class RubyDebugView
9
9
  B_STATE_ON = '+'
10
10
  B_STATE_OFF = '-'
11
11
  B_STATE_FREEZE = '='
12
- def initialize(_frame, _controller)
13
- @frame = _frame
12
+ def initialize(_controller)
13
+ @frame = _controller.frame.hinner_frame
14
+ @frame_server = _controller.frame(1).hinner_frame
14
15
  @controller = _controller
15
16
  self.build_ui
16
17
  @controller.rdc.add_listener(self)
@@ -103,13 +104,14 @@ class RubyDebugView
103
104
 
104
105
  self.build_buttons_set
105
106
 
106
- sf = AGTkOSplittedFrames.new(@debug_frame,70)
107
+ # sf = AGTkOSplittedFrames.new(@debug_frame,@debug_frame,70)
107
108
 
108
109
  #-------------------------------------------------
109
- build_process_panel(sf.top_frame)
110
+ build_process_panel(@frame_server)
111
+ # build_process_panel(sf.top_frame)
110
112
  #-------------------------------------------------
111
113
 
112
- @enb = Tk::BWidget::NoteBook.new(sf.bottom_frame, Arcadia.style('tabpanel')){
114
+ @enb = Tk::BWidget::NoteBook.new(@debug_frame, Arcadia.style('tabpanel')){
113
115
  tabbevelsize 0
114
116
  internalborderwidth 2
115
117
  place('relwidth' => 1,'relheight' => '1')
@@ -1347,6 +1349,7 @@ class RubyDebugClient
1347
1349
  def set_breakpoint(_file, _line)
1348
1350
  #_line = _line + 1
1349
1351
  text = read("break #{_file}:#{_line}")
1352
+ #p text
1350
1353
  breakpoint_no = -1
1351
1354
  #matches = text.match(/Set breakpoint ([0-9]*)?/)
1352
1355
  matches = text.downcase.match(/breakpoint ([0-9]*)?/)
@@ -1531,7 +1534,7 @@ class RubyDebug < ArcadiaExt
1531
1534
  #Arcadia.new_msg(self,@rds.to_s)
1532
1535
 
1533
1536
  @rdc = RubyDebugClient.new(self, conf('server.host'), conf('server.port'), conf('server.timeout')) if @rdc.nil?
1534
- @rdv = RubyDebugView.new(self.frame.hinner_frame, self) if @rdv.nil?
1537
+ @rdv = RubyDebugView.new(self) if @rdv.nil?
1535
1538
  self.frame.show
1536
1539
  @rdv.start_process(_filename)
1537
1540
  if @rdc.start_session
@@ -1559,6 +1562,7 @@ class RubyDebug < ArcadiaExt
1559
1562
 
1560
1563
  def debug_free
1561
1564
  self.frame.free
1565
+ self.frame(1).free
1562
1566
  @rdc = nil
1563
1567
  @rdv = nil
1564
1568
  end
@@ -1,6 +1,7 @@
1
1
  name=search_in_files
2
- labels=Search in files
3
2
  frames=1.1
3
+ frames.labels=Search in files
4
+ frames.names=search_in_files
4
5
  active=yes
5
6
  require=ext/ae-search-in-files/ae-search-in-files
6
7
  class=SearchInFilesService
File without changes
File without changes
File without changes
@@ -64,16 +64,20 @@ end
64
64
 
65
65
  class FixedFrameWrapper < AbstractFrameWrapper
66
66
  # include AbstractFrameWrapper
67
- def initialize(_arcadia, _point, _name, _title='')
68
- @arcadia = _arcadia
69
- @point =_point
67
+ attr_accessor :domain
68
+ attr_reader :name
69
+ attr_reader :title
70
+ attr_reader :extension
71
+ def initialize(_extension, _domain, _name, _title='')
72
+ @extension = _extension
73
+ @domain =_domain
70
74
  @name = _name
71
75
  @title = _title
72
76
  fixed_frame_forge
73
77
  end
74
78
 
75
79
  def fixed_frame_forge
76
- @fixed_frame = @arcadia.layout.register_panel(@point, @name, @title) if @fixed_frame.nil?
80
+ @fixed_frame = Arcadia.layout.register_panel(self) if @fixed_frame.nil?
77
81
  end
78
82
  private :fixed_frame_forge
79
83
 
@@ -82,25 +86,26 @@ class FixedFrameWrapper < AbstractFrameWrapper
82
86
  @fixed_frame
83
87
  end
84
88
 
85
- def title(_title=nil)
89
+ def top_text(_top_text=nil)
86
90
  fixed_frame_forge
87
- @arcadia.layout.domain(@point)['root'].top_text(_title)
91
+ Arcadia.layout.domain(@domain)['root'].top_text(_top_text)
92
+ #@arcadia.layout.domain_for_frame(@domain, @name)['root'].top_text(_title)
88
93
  end
89
94
 
90
95
  def show
91
96
  fixed_frame_forge
92
- @arcadia.layout.raise_panel(@point, @name)
97
+ Arcadia.layout.raise_panel(@domain, @name)
93
98
  end
94
99
 
95
100
  def hide
96
101
  end
97
102
 
98
103
  def raised?
99
- @arcadia.layout.raised?(@point, @name)
104
+ Arcadia.layout.raised?(@domain, @name)
100
105
  end
101
106
 
102
107
  def free
103
- @arcadia.layout.unregister_panel(@point, @name)
108
+ Arcadia.layout.unregister_panel(self)
104
109
  @fixed_frame = nil
105
110
  end
106
111
  end
@@ -179,7 +184,8 @@ class ArcadiaExt
179
184
  @name = _name
180
185
  @frames = Array.new
181
186
  @frames_points = conf_array("#{_name}.frames")
182
- @frames_labels = conf_array("#{_name}.labels")
187
+ @frames_labels = conf_array("#{_name}.frames.labels")
188
+ @frames_names = conf_array("#{_name}.frames.names")
183
189
  @float_frames = Array.new
184
190
  @float_geometries = conf_array("#{_name}.float_frames")
185
191
  @float_labels = conf_array("#{_name}.float_labels")
@@ -196,7 +202,8 @@ class ArcadiaExt
196
202
  def frame(_n=0)
197
203
  if @frames[_n] == nil && @frames_points[_n]
198
204
  (@frames_labels[_n].nil?)? _label = @name : _label = @frames_labels[_n]
199
- @frames[_n] = FixedFrameWrapper.new(@arcadia, @frames_points[_n], @name, _label)
205
+ (@frames_names[_n].nil?)? _name = @name : _name = @frames_names[_n]
206
+ @frames[_n] = FixedFrameWrapper.new(@name, @frames_points[_n], _name, _label)
200
207
  end
201
208
  return @frames[_n]
202
209
  end
@@ -483,25 +490,40 @@ module Configurable
483
490
  end
484
491
 
485
492
 
486
- def resolve_link(_v, _hash_source, _link_symbol='>>>')
493
+ def resolve_link(_value, _hash_source, _link_symbol='>>>', _add_symbol='+++')
494
+ if _value.length > 0
495
+ _v, _vadd = _value.split(_add_symbol)
496
+ else
497
+ _v = _value
498
+ end
487
499
  if _v.length > 3 && _v[0..2]==_link_symbol
488
500
  _v=_hash_source[_v[3..-1]] if _hash_source[_v[3..-1]]
501
+ _v=_v+_vadd if _vadd
489
502
  end
490
503
  return _v
491
504
  end
492
505
 
493
- def resolve_properties_link(_hash_target, _hash_source, _link_symbol='>>>')
506
+ def resolve_properties_link(_hash_target, _hash_source, _link_symbol='>>>', _add_symbol='+++')
494
507
  loop_level_max = 10
495
508
  # _hash_adding = Hash.new
496
509
  _keys_to_extend = Array.new
497
- _hash_target.each{|k,v|
510
+ _hash_target.each{|k,value|
498
511
  loop_level = 0
512
+ if value.length > 0
513
+ v, vadd = value.split(_add_symbol)
514
+ else
515
+ v= value
516
+ end
517
+ # p "value=#{value} class=#{value.class}"
518
+ # p "v=#{v} class=#{v.class}"
519
+ # p "vadd=#{vadd}"
499
520
  while loop_level < loop_level_max && v.length > 3 && v[0..2]==_link_symbol
500
521
  if k[-1..-1]=='.'
501
522
  _keys_to_extend << k
502
523
  break
503
524
  elsif _hash_source[v[3..-1]]
504
525
  v=_hash_source[v[3..-1]]
526
+ v=v+vadd if vadd
505
527
  else
506
528
  break
507
529
  end
@@ -547,7 +569,7 @@ module Persistable
547
569
  f = File.new(_persist_file, "w+")
548
570
  begin
549
571
  if f
550
- if _persistent_property
572
+ if _persistent_key
551
573
  f.syswrite(_persistent_key+'='+_persistent_value+"\n")
552
574
  end
553
575
  end
@@ -33,6 +33,16 @@ end
33
33
  class FinalizeEvent < ArcadiaEvent
34
34
  end
35
35
 
36
+ # +------------------------------------------+
37
+ # Generic Layout Event
38
+ #
39
+ # +------------------------------------------+
40
+ class LayoutRaisingFrameEvent < ArcadiaEvent
41
+ attr_accessor :extension_name
42
+ attr_accessor :frame_name
43
+ end
44
+
45
+
36
46
  # +---------------------------------------------+
37
47
  # Buffer event
38
48
  # +---------------------------------------------+
@@ -95,6 +105,7 @@ end
95
105
 
96
106
  class SetBreakpointEvent < DebugEvent
97
107
  attr_accessor :active
108
+ attr_accessor :line_code
98
109
  end
99
110
 
100
111
  class UnsetBreakpointEvent < DebugEvent
@@ -23,7 +23,7 @@ class Arcadia < TkApplication
23
23
  super(
24
24
  ApplicationParams.new(
25
25
  'arcadia',
26
- '0.5.1',
26
+ '0.6.0',
27
27
  'conf/arcadia.conf',
28
28
  'conf/arcadia.pers'
29
29
  )
@@ -46,7 +46,9 @@ class Arcadia < TkApplication
46
46
  }
47
47
  @on_event = Hash.new
48
48
 
49
- @main_menu_bar = TkMenubar.new('background'=> self['conf']['background']).pack('fill'=>'x')
49
+ @main_menu_bar = TkMenubar.new(
50
+ 'background'=> self['conf']['background']
51
+ ).pack('fill'=>'x')
50
52
  @mf_root = Tk::BWidget::MainFrame.new(@root,
51
53
  'background'=> self['conf']['background']
52
54
  ){
@@ -91,6 +93,7 @@ class Arcadia < TkApplication
91
93
  }
92
94
  end
93
95
  Arcadia.attach_listener(self, QuitEvent)
96
+ Arcadia.persistent("version", self['applicationParams'].version)
94
97
  end
95
98
 
96
99
  def on_quit(_event)
@@ -240,8 +243,8 @@ class Arcadia < TkApplication
240
243
  end
241
244
 
242
245
  rescue Exception
243
- msg = "Loading layout"
244
- if Arcadia.dialog(self, 'type'=>'ok_cancel', 'title' => '(Arcadia) Layout', 'msg'=>msg)=='cancel'
246
+ msg = "Loading layout: (#{$!.class.to_s} : #{$!.to_s} at : #{$@.to_s})"
247
+ if Arcadia.dialog(self, 'type'=>'ok_cancel', 'level'=>'error','title' => '(Arcadia) Layout', 'msg'=>msg)=='cancel'
245
248
  raise
246
249
  exit
247
250
  else
@@ -325,6 +328,7 @@ class Arcadia < TkApplication
325
328
  }
326
329
  load_user_control(@main_menu,"","e")
327
330
  load_user_control(@main_toolbar,"","e")
331
+ #@layout.build_invert_menu
328
332
  end
329
333
 
330
334
  def load_user_control(_user_control, _ext='', _pre='')
@@ -449,6 +453,11 @@ class Arcadia < TkApplication
449
453
  end
450
454
  end
451
455
 
456
+ def Arcadia.layout
457
+ if @@instance
458
+ return @@instance.layout
459
+ end
460
+ end
452
461
 
453
462
  # def Arcadia.res(_res)
454
463
  # theme = Arcadia.instance['conf']['theme']
@@ -870,12 +879,12 @@ class ArcadiaAboutSplash < TkToplevel
870
879
  place('width'=>-5,'relwidth' => 1,'x' => 5,'y' => 175,'height' => 19)
871
880
  }
872
881
  @tkLabel21 = TkLabel.new(self){
873
- text 'by Antonio Galeone - 2008'
882
+ text 'by Antonio Galeone - 2004/2009'
874
883
  background _bgcolor
875
884
  foreground '#ffffff'
876
885
  font Arcadia.instance['conf']['splash.credits.font']
877
886
  justify 'left'
878
- place('width' => '190','x' => 130,'y' => 146,'height' => 19)
887
+ place('width' => '210','x' => 100,'y' => 146,'height' => 19)
879
888
  }
880
889
  @progress = TkVariable.new
881
890
  reset
@@ -984,12 +993,13 @@ end
984
993
 
985
994
 
986
995
  class ArcadiaLayout
987
- include Observable
988
- ArcadiaPanelInfo = Struct.new( "ArcadiaPanelInfo",
989
- :name,
990
- :title,
991
- :frame
992
- )
996
+ # include Observable
997
+ # ArcadiaPanelInfo = Struct.new( "ArcadiaPanelInfo",
998
+ # :name,
999
+ # :title,
1000
+ # :frame,
1001
+ # :ffw
1002
+ # )
993
1003
 
994
1004
  def initialize(_arcadia, _frame, _autotab=true)
995
1005
  @arcadia = _arcadia
@@ -1005,6 +1015,7 @@ class ArcadiaLayout
1005
1015
  @panels['_domain_root_']['sons'] = Hash.new
1006
1016
  @autotab = _autotab
1007
1017
  @headed = false
1018
+ @wrappers=Hash.new
1008
1019
  #ArcadiaContractListener.new(self, MainContract, :do_main_event)
1009
1020
  end
1010
1021
 
@@ -1024,43 +1035,67 @@ class ArcadiaLayout
1024
1035
  # @panels[_domain_name]['notebook'].raise(_name) if @panels[_domain_name] && @panels[_domain_name]['notebook']
1025
1036
  # end
1026
1037
 
1027
- def raised?(_domain, _extension)
1028
- ret = false
1038
+ def raised?(_domain, _name)
1039
+ ret = true
1029
1040
  p = @panels[_domain]
1030
1041
  if p && p['notebook'] != nil
1031
- ret=p['notebook'].raise == _extension
1042
+ ret=p['notebook'].raise == _name
1043
+ end
1044
+ ret
1045
+ end
1046
+
1047
+ def raised_fixed_frame(_domain)
1048
+ ret = nil
1049
+ p = @panels[_domain]
1050
+ if p && p['notebook'] != nil
1051
+ raised_name=p['notebook'].raise
1052
+ @panels[_domain]['sons'].each{|k,v|
1053
+ if raised_name == k
1054
+ ret = v
1055
+ break
1056
+ end
1057
+ }
1058
+ elsif @panels[_domain]['sons'].length == 1
1059
+ ret = @panels[_domain]['sons'].values[0]
1032
1060
  end
1033
1061
  ret
1034
1062
  end
1035
1063
 
1036
1064
  def _prepare_rows(_row,_col, _height, _perc=false, _top_name=nil, _bottom_name=nil)
1037
1065
  if (@frames[_row][_col] != nil)
1038
- _h = AGTkOSplittedFrames.new(@frames[_row][_col],_height, @arcadia['conf']['layout.splitter.length'].to_i,_perc)
1066
+ #source_domains = all_domains(@frames[_row][_col])
1067
+ #source_domains = others_domains(@frames[_row][_col], false)
1068
+ _h = AGTkOSplittedFrames.new(self.root,@frames[_row][_col],_height, @arcadia['conf']['layout.splitter.length'].to_i,_perc)
1039
1069
  if @frames[_row + 1] == nil
1040
1070
  @frames[_row + 1] = Array.new
1041
1071
  @domains[_row + 1] = Array.new
1042
1072
  end
1043
1073
  @frames[_row][_col] = _h.top_frame
1044
- # TODO: bisogna schiftare di uno tutti i frame a partire da _row + 1
1045
- # if @frames[_row + 1][_col] != nil
1046
- # if @frames[_row + 2] == nil
1047
- # @frames[_row + 2] = Array.new
1048
- # @domains[_row + 2] = Array.new
1049
- # end
1050
- # @frames[_row + 2][_col]=@frames[_row + 1][_col]
1051
- # end
1052
- @frames[_row + 1][_col] = _h.bottom_frame
1053
-
1074
+
1054
1075
  _top_name = _row.to_s+'.'+_col.to_s if _top_name == nil
1055
1076
  @panels[_top_name] = Hash.new
1056
1077
  @panels[_top_name]['root'] = @frames[_row][_col]
1057
1078
  @panels[_top_name]['sons'] = Hash.new
1079
+ if @panels[_top_name]['root_splitted_frames'].nil?
1080
+ @panels[_top_name]['root_splitted_frames'] = _h
1081
+ end
1082
+ @panels[_top_name]['splitted_frames'] = _h
1058
1083
  @domains[_row][_col] = _top_name
1059
1084
 
1060
1085
  _bottom_name = (_row+1).to_s+'.'+_col.to_s if _bottom_name == nil
1086
+
1087
+ if !@panels[_bottom_name].nil?
1088
+ shift_bottom(_row+1, _col)
1089
+ end
1090
+
1061
1091
  @panels[_bottom_name] = Hash.new
1092
+ @frames[_row + 1][_col] = _h.bottom_frame
1062
1093
  @panels[_bottom_name]['root'] = @frames[_row + 1][_col]
1063
1094
  @panels[_bottom_name]['sons'] = Hash.new
1095
+ if @panels[_bottom_name]['root_splitted_frames'].nil?
1096
+ @panels[_bottom_name]['root_splitted_frames'] = _h
1097
+ end
1098
+ @panels[_bottom_name]['splitted_frames'] = _h
1064
1099
  @domains[_row + 1][_col] = _bottom_name
1065
1100
  end
1066
1101
  end
@@ -1074,27 +1109,186 @@ class ArcadiaLayout
1074
1109
  _prepare_rows(_row,_col, _height, true, _top_name, _bottom_name)
1075
1110
  end
1076
1111
 
1112
+ # def others_domains(_frame, _vertical=true)
1113
+ # if _vertical
1114
+ # splitter_adapter_class = AGTkVSplittedFrames
1115
+ # else
1116
+ # splitter_adapter_class = AGTkOSplittedFrames
1117
+ # end
1118
+ # splitted_adapter = find_splitted_frame(_frame)
1119
+ # consider_it = splitted_adapter.instance_of?(splitter_adapter_class) && splitted_adapter.frame1 == _frame
1120
+ # if splitted_adapter && !consider_it && splitted_adapter != _frame
1121
+ # rif_frame = splitted_adapter.frame
1122
+ # ret = others_domains(rif_frame)
1123
+ # elsif splitted_adapter && consider_it
1124
+ # ret = domains_on_frame(splitted_adapter.frame2)
1125
+ # else
1126
+ # ret = Array.new
1127
+ # end
1128
+ # ret
1129
+ # end
1130
+
1131
+ def all_domains(_frame)
1132
+ splitted_adapter = find_splitted_frame(_frame)
1133
+ consider_it = splitted_adapter.kind_of?(AGTkSplittedFrames)
1134
+ if consider_it
1135
+ ret = domains_on_frame(splitted_adapter.frame2).concat(domains_on_frame(splitted_adapter.frame1))
1136
+ else
1137
+ ret = Array.new
1138
+ end
1139
+ ret
1140
+ end
1141
+
1142
+ def all_domains_cols(_frame)
1143
+ ret = Array.new
1144
+ all_domains(_frame).each{|d|
1145
+ v = d.split('.')[1]
1146
+ ret << v if !ret.include?(v)
1147
+ }
1148
+ ret
1149
+ end
1150
+
1151
+ def all_domains_rows(_frame)
1152
+ ret = Array.new
1153
+ all_domains(_frame).each{|d|
1154
+ v = d.split('.')[0]
1155
+ ret << v if !ret.include?(v)
1156
+ }
1157
+ ret
1158
+ end
1159
+
1160
+
1077
1161
  def _prepare_cols(_row,_col, _width, _perc=false, _left_name=nil, _right_name=nil)
1078
1162
  if (@frames[_row][_col] != nil)
1079
- _w = AGTkVSplittedFrames.new(@frames[_row][_col],_width,@arcadia['conf']['layout.splitter.length'].to_i,_perc)
1163
+ #source_domains = all_domains(@frames[_row][_col])
1164
+ #source_domains = others_domains(@frames[_row][_col])
1165
+ _w = AGTkVSplittedFrames.new(self.root,@frames[_row][_col],_width,@arcadia['conf']['layout.splitter.length'].to_i,_perc)
1080
1166
  @frames[_row][_col] = _w.left_frame
1081
- @frames[_row][_col + 1] = _w.right_frame
1167
+ #@frames[_row][_col + 1] = _w.right_frame
1082
1168
 
1083
1169
  _left_name = _row.to_s+'.'+_col.to_s if _left_name == nil
1084
1170
  @panels[_left_name] = Hash.new
1085
1171
  @panels[_left_name]['root'] = @frames[_row][_col]
1086
1172
  @panels[_left_name]['sons'] = Hash.new
1173
+ if @panels[_left_name]['root_splitted_frames'].nil?
1174
+ @panels[_left_name]['root_splitted_frames'] = _w
1175
+ end
1176
+ @panels[_left_name]['splitted_frames'] = _w
1087
1177
  @domains[_row][_col] = _left_name
1088
-
1178
+
1089
1179
  _right_name = _row.to_s+'.'+(_col+1).to_s if _right_name == nil
1180
+ if !@panels[_right_name].nil?
1181
+ shift_right(_row, _col+1)
1182
+ end
1183
+
1184
+ @frames[_row][_col + 1] = _w.right_frame
1090
1185
  @panels[_right_name] = Hash.new
1091
1186
  @panels[_right_name]['root'] = @frames[_row][_col + 1]
1092
1187
  @panels[_right_name]['sons'] = Hash.new
1188
+ if @panels[_right_name]['root_splitted_frames'].nil?
1189
+ @panels[_right_name]['root_splitted_frames'] = _w
1190
+ end
1191
+ @panels[_right_name]['splitted_frames'] = _w
1093
1192
  @domains[_row][_col + 1] = _right_name
1094
1193
  end
1095
1194
  end
1096
1195
  private :_prepare_cols
1097
1196
 
1197
+
1198
+ def domain_name(_row,_col)
1199
+ _row.to_s+'.'+_col.to_s
1200
+ end
1201
+
1202
+ def shift_right(_row,_col)
1203
+ d = domain_name(_row, _col+1)
1204
+ dj = domain_name(_row, _col)
1205
+ if @panels[d] !=nil
1206
+ shift_right(_row,_col+1)
1207
+ end
1208
+ Arcadia.console(self,'msg'=>"shifto a destra #{dj} (su #{d})")
1209
+ @panels[d] = @panels[dj]
1210
+ #-------------------------------
1211
+ #@panels[d]['root'].set_domain(d)
1212
+ #-------------------------------
1213
+ @panels[d]['sons'].each{|name,ffw| ffw.domain=d}
1214
+ @frames[_row][_col+1] = @frames[_row][_col]
1215
+ @domains[_row][_col+1] = @domains[_row][_col]
1216
+
1217
+ @panels.delete(dj)
1218
+ #@panels[dj] = nil
1219
+ @frames[_row][_col] = nil
1220
+ @domains[_row][_col] = nil
1221
+ end
1222
+
1223
+ def shift_left(_row,_col)
1224
+ d = domain_name(_row, _col)
1225
+ dj = domain_name(_row, _col+1)
1226
+ if @panels[dj] !=nil
1227
+ Arcadia.console(self,'msg'=>"shifto a sinista #{dj} (su #{d})")
1228
+ @panels[d] = @panels[dj]
1229
+ #-------------------------------
1230
+ #@panels[d]['root'].set_domain(d)
1231
+ #-------------------------------
1232
+ @panels[d]['sons'].each{|name,ffw| ffw.domain=d}
1233
+ @frames[_row][_col] = @frames[_row][_col+1]
1234
+ @domains[_row][_col] = @domains[_row][_col+1]
1235
+
1236
+ @panels.delete(dj) # = nil
1237
+ @frames[_row][_col+1] = nil
1238
+ @domains[_row][_col+1] = nil
1239
+ shift_left(_row,_col+1)
1240
+ end
1241
+
1242
+ end
1243
+
1244
+ def shift_top(_row,_col)
1245
+ d = domain_name(_row, _col)
1246
+ dj = domain_name(_row+1, _col)
1247
+ if @panels[dj] !=nil
1248
+ Arcadia.console(self,'msg'=>"shifto su #{dj} (su #{d})")
1249
+ @panels[d] = @panels[dj]
1250
+ #-------------------------------
1251
+ #@panels[d]['root'].set_domain(d)
1252
+ #-------------------------------
1253
+ @panels[d]['sons'].each{|name,ffw| ffw.domain=d}
1254
+ @frames[_row][_col] = @frames[_row+1][_col]
1255
+ @domains[_row][_col] = @domains[_row+1][_col]
1256
+
1257
+ @panels.delete(dj) # = nil
1258
+ @frames[_row+1][_col] = nil
1259
+ @domains[_row+1][_col] = nil
1260
+
1261
+ shift_top(_row+1,_col)
1262
+ end
1263
+
1264
+ end
1265
+
1266
+
1267
+ def shift_bottom(_row, _col)
1268
+ d = domain_name(_row+1, _col)
1269
+ dj = domain_name(_row, _col)
1270
+ if @panels[d] !=nil
1271
+ shift_bottom(_row+1,_col)
1272
+ end
1273
+ Arcadia.console(self,'msg'=>"shifto giu #{dj} (su #{d})")
1274
+ @panels[d] = @panels[dj]
1275
+ #-------------------------------
1276
+ #@panels[d]['root'].set_domain(d)
1277
+ #-------------------------------
1278
+ @panels[d]['sons'].each{|name,ffw| ffw.domain=d}
1279
+ if @frames[_row + 1] == nil
1280
+ @frames[_row + 1] = Array.new
1281
+ @domains[_row + 1] = Array.new
1282
+ end
1283
+ @frames[_row+1][_col] = @frames[_row][_col]
1284
+ @domains[_row+1][_col] = @domains[_row][_col]
1285
+
1286
+ @panels.delete(dj)
1287
+ #@panels[dj] = nil
1288
+ @frames[_row][_col] = nil
1289
+ @domains[_row][_col] = nil
1290
+ end
1291
+
1098
1292
  def add_cols(_row,_col, _width, _left_name=nil, _right_name=nil)
1099
1293
  _prepare_cols(_row,_col, _width, false, _left_name, _right_name)
1100
1294
  end
@@ -1103,10 +1297,578 @@ class ArcadiaLayout
1103
1297
  _prepare_cols(_row,_col, _width, true, _left_name, _right_name)
1104
1298
  end
1105
1299
 
1300
+ def add_cols_runtime(_domain)
1301
+ saved_root_splitted_frames = @panels[_domain]['root_splitted_frames']
1302
+ _saved = Hash.new
1303
+ _saved.update(@panels[_domain]['sons'])
1304
+ geometry = TkWinfo.geometry(@panels[_domain]['root'])
1305
+ width = geometry.split('x')[0].to_i/2
1306
+ _saved.each{|name,ffw|
1307
+ unregister_panel(ffw, false, false)
1308
+ }
1309
+ unbuild_titled_frame(_domain)
1310
+ _row,_col = _domain.split('.')
1311
+ add_cols(_row.to_i,_col.to_i, width)
1312
+ build_titled_frame(_domain)
1313
+ build_titled_frame(domain_name(_row.to_i,_col.to_i+1))
1314
+ _saved.each{|name,ffw|
1315
+ ffw.domain = _domain
1316
+ register_panel(ffw, ffw.hinner_frame)
1317
+ }
1318
+ if saved_root_splitted_frames
1319
+ @panels[_domain]['root_splitted_frames']=saved_root_splitted_frames
1320
+ end
1321
+ build_invert_menu(true)
1322
+ end
1323
+
1324
+ def add_rows_runtime(_domain)
1325
+ saved_root_splitted_frames = @panels[_domain]['root_splitted_frames']
1326
+ _saved = Hash.new
1327
+ _saved.update(@panels[_domain]['sons'])
1328
+ geometry = TkWinfo.geometry(@panels[_domain]['root'])
1329
+ height = geometry.split('+')[0].split('x')[1].to_i/2
1330
+ _saved.each{|name,ffw|
1331
+ unregister_panel(ffw, false, false)
1332
+ }
1333
+ unbuild_titled_frame(_domain)
1334
+ _row,_col = _domain.split('.')
1335
+ add_rows(_row.to_i,_col.to_i, height)
1336
+ build_titled_frame(_domain)
1337
+ build_titled_frame(domain_name(_row.to_i+1,_col.to_i))
1338
+ _saved.each{|name,ffw|
1339
+ ffw.domain = _domain
1340
+ register_panel(ffw, ffw.hinner_frame)
1341
+ }
1342
+ if saved_root_splitted_frames
1343
+ @panels[_domain]['root_splitted_frames']=saved_root_splitted_frames
1344
+ end
1345
+
1346
+ build_invert_menu(true)
1347
+ end
1348
+
1349
+ def domains_on_frame_rows(_frame)
1350
+ ret = Array.new
1351
+ domains_on_frame(_frame).each{|d|
1352
+ v = d.split('.')[0]
1353
+ ret << v if !ret.include?(v)
1354
+ }
1355
+ ret
1356
+ end
1357
+
1358
+ def domains_rows(_domains)
1359
+ ret = Array.new
1360
+ if _domains
1361
+ _domains.each{|d|
1362
+ v = d.split('.')[0]
1363
+ ret << v if !ret.include?(v)
1364
+ }
1365
+ end
1366
+ ret
1367
+ end
1368
+
1369
+ def max_col(_domains, _row)
1370
+ ret = 0
1371
+ if _domains
1372
+ _domains.each{|d|
1373
+ r,c = d.split('.')
1374
+ if r.to_i == _row && c.to_i > ret
1375
+ ret = c.to_i
1376
+ end
1377
+ }
1378
+ end
1379
+ ret
1380
+ end
1381
+
1382
+ def max_row(_domains, _col)
1383
+ ret = 0
1384
+ if _domains
1385
+ _domains.each{|d|
1386
+ r,c = d.split('.')
1387
+ if c.to_i == _col && r.to_i > ret
1388
+ ret = r.to_i
1389
+ end
1390
+ }
1391
+ end
1392
+ ret
1393
+ end
1394
+
1395
+ def domains_cols(_domains)
1396
+ ret = Array.new
1397
+ _domains.each{|d|
1398
+ v = d.split('.')[1]
1399
+ ret << v if !ret.include?(v)
1400
+ }
1401
+ ret
1402
+ end
1403
+
1404
+
1405
+ def domains_on_frame_cols(_frame)
1406
+ ret = Array.new
1407
+ domains_on_frame(_frame).each{|d|
1408
+ v = d.split('.')[1]
1409
+ ret << v if !ret.include?(v)
1410
+ }
1411
+ ret
1412
+ end
1413
+
1414
+ def domains_on_splitter(_splitter)
1415
+ domains_on_frame(_splitter.frame1).concat(domains_on_frame(_splitter.frame2))
1416
+ end
1417
+
1418
+ def domains_on_splitter_cols(_splitter)
1419
+ ret = Array.new
1420
+ domains_on_splitter(_splitter).each{|d|
1421
+ v = d.split('.')[1]
1422
+ ret << v if !ret.include?(v)
1423
+ }
1424
+ ret
1425
+ end
1426
+
1427
+ def domains_on_splitter_rows(_splitter)
1428
+ ret = Array.new
1429
+ domains_on_splitter(_splitter).each{|d|
1430
+ v = d.split('.')[0]
1431
+ ret << v if !ret.include?(v)
1432
+ }
1433
+ ret
1434
+ end
1435
+
1436
+
1437
+ def domains_on_frame(_frame)
1438
+ ret_doms = Array.new
1439
+ frame_found = false
1440
+ @panels.keys.each{|dom|
1441
+ if dom != '_domain_root_'
1442
+ if (@panels[dom]['splitted_frames'] != nil && @panels[dom]['splitted_frames'].frame == _frame) || (@panels[dom]['root_splitted_frames'] != nil && @panels[dom]['root_splitted_frames'].frame == _frame)
1443
+ ret_doms.concat(domains_on_frame(@panels[dom]['splitted_frames'].frame1))
1444
+ ret_doms.concat(domains_on_frame(@panels[dom]['splitted_frames'].frame2))
1445
+ frame_found = true
1446
+ break
1447
+ elsif @panels[dom]['notebook'] != nil
1448
+ cfrs = TkWinfo.children(_frame)
1449
+ if cfrs && cfrs.length == 1 && cfrs[0].instance_of?(TkTitledFrame) && TkWinfo.parent(@panels[dom]['notebook'])== cfrs[0].frame
1450
+ ret_doms << dom
1451
+ frame_found = true
1452
+ end
1453
+ elsif @panels[dom]['root'].instance_of?(TkTitledFrame) && @panels[dom]['root'].parent == _frame
1454
+ ret_doms << dom
1455
+ frame_found = true
1456
+ end
1457
+ end
1458
+ }
1459
+
1460
+ if !frame_found
1461
+ cfrs = TkWinfo.children(_frame)
1462
+ if cfrs && cfrs.length == 1 && cfrs[0].instance_of?(TkTitledFrame)
1463
+ @wrappers.each{|name, ffw|
1464
+ if ffw.hinner_frame.frame == cfrs[0].frame
1465
+ ret_doms << ffw.domain
1466
+ end
1467
+ }
1468
+ end
1469
+ end
1470
+ return ret_doms
1471
+ end
1472
+
1473
+ def close_runtime_old(_domain)
1474
+ splitted_adapter = find_splitted_frame(@panels[_domain]['root'])
1475
+ splitted_adapter_frame = splitted_adapter.frame
1476
+ vertical = splitted_adapter.instance_of?(AGTkVSplittedFrames)
1477
+
1478
+ _row, _col = _domain.split('.')
1479
+
1480
+ if @frames[_row.to_i][_col.to_i] == splitted_adapter.frame1
1481
+ close_first = true
1482
+ elsif @frames[_row.to_i][_col.to_i] == splitted_adapter.frame2
1483
+ close_first = false
1484
+ end
1485
+
1486
+ return if close_first.nil?
1487
+
1488
+ #source_domains = domains_on_frame(splitted_adapter.frame1).concat(domains_on_frame(splitted_adapter.frame2))
1489
+ #Arcadia.console(self,'msg'=>"domini coinvolti = #{source_domains.to_s}")
1490
+
1491
+ @panels[_domain]['sons'].each{|name,ffw|
1492
+ unregister_panel(ffw, false, false)
1493
+ }
1494
+ unbuild_titled_frame(_domain)
1495
+ if close_first
1496
+ #left_frame
1497
+ other_ds = domains_on_frame(@panels[_domain]['splitted_frames'].frame2)
1498
+ if other_ds.length == 1
1499
+ source_domain = other_ds[0]
1500
+ elsif other_ds.length > 1
1501
+ max = other_ds.length-1
1502
+ j = 0
1503
+ while j <= max
1504
+ if source_domain.nil?
1505
+ source_domain = other_ds[j]
1506
+ else
1507
+ r,c = source_domain.split('.')
1508
+ new_r,new_c = other_ds[j].split('.')
1509
+ if new_r.to_i < r.to_i || new_r.to_i == r.to_i && new_c.to_i < c.to_i
1510
+ source_domain = other_ds[j]
1511
+ end
1512
+ end
1513
+ j = j+1
1514
+ end
1515
+ else
1516
+ if vertical
1517
+ source_domain = domain_name(_row.to_i, _col.to_i+1)
1518
+ else
1519
+ source_domain = domain_name(_row.to_i+1, _col.to_i)
1520
+ end
1521
+ end
1522
+ if vertical
1523
+ ref_source_domain = domain_name(_row.to_i, _col.to_i+1)
1524
+ else
1525
+ ref_source_domain = domain_name(_row.to_i+1, _col.to_i)
1526
+ end
1527
+
1528
+ destination_domain = _domain
1529
+
1530
+ if @panels[source_domain]['splitted_frames'] != @panels[destination_domain]['splitted_frames']
1531
+ if @panels[source_domain]['root_splitted_frames'] && @panels[source_domain]['root_splitted_frames'] != @panels[destination_domain]['splitted_frames']
1532
+ other_root_splitted_adapter = @panels[source_domain]['root_splitted_frames']
1533
+ elsif @panels[source_domain]['splitted_frames']
1534
+ other_root_splitted_adapter = @panels[source_domain]['splitted_frames']
1535
+ end
1536
+ end
1537
+
1538
+ if other_root_splitted_adapter
1539
+ p "primo quadrante"
1540
+ other_root_splitted_adapter.detach_frame
1541
+ splitted_adapter.detach_frame
1542
+ splitted_adapter.destroy
1543
+ other_root_splitted_adapter.attach_frame(splitted_adapter_frame)
1544
+ if source_domain == ref_source_domain
1545
+ if vertical
1546
+ rows = domains_on_splitter_rows(other_root_splitted_adapter)
1547
+ rows.each{|r|
1548
+ shift_left(r.to_i,_col.to_i)
1549
+ }
1550
+ else
1551
+ cols = domains_on_splitter_cols(other_root_splitted_adapter)
1552
+ cols.each{|c|
1553
+ shift_top(_row.to_i,c.to_i)
1554
+ }
1555
+ end
1556
+ else
1557
+ @panels.delete(_domain)
1558
+ @frames[_row.to_i][_col.to_i] = nil
1559
+ @domains[_row.to_i][_col.to_i] = nil
1560
+ # ref_r,ref_c = ref_source_domain.split('.')
1561
+ # real_r,real_c=source_domain.split('.')
1562
+ # gap_r = ref_r.to_i - real_r.to_i
1563
+ # gap_c = ref_c.to_i - real_c.to_i
1564
+ # if gap_r != 0 && gap_c == 0 # vertical
1565
+ # doms = domains_on_splitter(other_root_splitted_adapter)
1566
+ # doms.each{|d|
1567
+ # r,c=d.split('.')
1568
+ # cur_r = r.to_i+gap_r
1569
+ # cur_domain = "#{cur_r}.#{_col}"
1570
+ # if @panels[cur_domain] != nil
1571
+ # shift_bottom(cur_r,_col.to_i)
1572
+ # end
1573
+ # @panels[cur_domain] = @panels[d]
1574
+ # @panels[cur_domain]['root'].set_domain(cur_domain)
1575
+ # @panels[cur_domain]['sons'].each{|name,ffw| ffw.domain=cur_domain}
1576
+ # @frames[cur_r.to_i][_col.to_i] = @frames[r.to_i][c.to_i]
1577
+ # @domains[cur_r.to_i][_col.to_i] = @domains[r.to_i][c.to_i]
1578
+ #
1579
+ # @panels.delete(d)
1580
+ # @frames[r.to_i][c.to_i] = nil
1581
+ # @domains[r.to_i][c.to_i] = nil
1582
+ # }
1583
+ # elsif gap_c != 0
1584
+ # end
1585
+ end
1586
+ @panels.delete(source_domain)
1587
+ if vertical
1588
+ @frames[_row.to_i][_col.to_i+1] = nil
1589
+ @domains[_row.to_i][_col.to_i+1] = nil
1590
+ else
1591
+ @frames[_row.to_i+1][_col.to_i] = nil
1592
+ @domains[_row.to_i+1][_col.to_i] = nil
1593
+ end
1594
+ else
1595
+ p "secondo quadrante"
1596
+ source_save = Hash.new
1597
+ source_save.update(@panels[source_domain]['sons']) if @panels[source_domain]
1598
+ source_save.each{|name,ffw|
1599
+ unregister_panel(ffw, false, false)
1600
+ }
1601
+ splitted_adapter.detach_frame
1602
+ splitted_adapter.destroy
1603
+ @panels[destination_domain]['root']=splitted_adapter_frame
1604
+ @frames[_row.to_i][_col.to_i] = splitted_adapter_frame
1605
+ @domains[_row.to_i][_col.to_i] = destination_domain
1606
+ build_titled_frame(destination_domain)
1607
+ @panels.delete(source_domain)
1608
+ if vertical
1609
+ @frames[_row.to_i][_col.to_i+1] = nil
1610
+ @domains[_row.to_i][_col.to_i+1] = nil
1611
+ else
1612
+ @frames[_row.to_i+1][_col.to_i] = nil
1613
+ @domains[_row.to_i+1][_col.to_i] = nil
1614
+ end
1615
+ source_save.each{|name,ffw|
1616
+ ffw.domain = destination_domain
1617
+ register_panel(ffw, ffw.hinner_frame)
1618
+ }
1619
+ #-----
1620
+ parent_splitted_adapter = find_splitted_frame(@panels[destination_domain]['root'])
1621
+ if parent_splitted_adapter
1622
+ @panels[destination_domain]['splitted_frames']=parent_splitted_adapter
1623
+ else
1624
+ @panels[destination_domain]['splitted_frames']= nil
1625
+ end
1626
+ #-----
1627
+ source_row,source_col = source_domain.split('.')
1628
+ # shift_left(source_row.to_i,source_col.to_i)
1629
+ if vertical
1630
+ shift_left(source_row.to_i,source_col.to_i-1)
1631
+ else
1632
+ shift_top(source_row.to_i-1,source_col.to_i)
1633
+ end
1634
+ end
1635
+ else # CLOSE OTHER
1636
+ # verifichiamo se la contro parte è uno splitter_adapter
1637
+ other_ds = domains_on_frame(@panels[_domain]['splitted_frames'].frame1)
1638
+ if other_ds.length == 1
1639
+ other_dom = other_ds[0]
1640
+ else
1641
+ if vertical
1642
+ other_dom = domain_name(_row.to_i, _col.to_i-1)
1643
+ else
1644
+ other_dom = domain_name(_row.to_i-1, _col.to_i)
1645
+ end
1646
+ end
1647
+ if @panels[_domain]['splitted_frames'] != @panels[other_dom]['splitted_frames']
1648
+ if @panels[other_dom]['root_splitted_frames'] && @panels[other_dom]['root_splitted_frames'] != @panels[_domain]['splitted_frames']
1649
+ other_root_splitted_adapter = @panels[other_dom]['root_splitted_frames']
1650
+ elsif @panels[other_dom]['splitted_frames']
1651
+ other_root_splitted_adapter = @panels[other_dom]['splitted_frames']
1652
+ end
1653
+ end
1654
+
1655
+ if other_root_splitted_adapter
1656
+ p "terzo quadrante"
1657
+ other_root_splitted_adapter.detach_frame
1658
+ splitted_adapter.detach_frame
1659
+ splitted_adapter.destroy
1660
+ other_root_splitted_adapter.attach_frame(splitted_adapter_frame)
1661
+
1662
+ @frames[_row.to_i][_col.to_i] = nil
1663
+ @domains[_row.to_i][_col.to_i] = nil
1664
+ @panels.delete(_domain)
1665
+ else
1666
+ p "quarto quadrante"
1667
+ source_save = Hash.new
1668
+ source_save.update(@panels[other_dom]['sons'])
1669
+ source_save.each{|name,ffw|
1670
+ unregister_panel(ffw, false, false)
1671
+ }
1672
+ splitted_adapter.detach_frame
1673
+ splitted_adapter.destroy
1674
+ @panels[other_dom]['root']=splitted_adapter_frame
1675
+
1676
+ @frames[_row.to_i][_col.to_i] = nil
1677
+ @domains[_row.to_i][_col.to_i] = nil
1678
+ build_titled_frame(other_dom)
1679
+ @panels.delete(_domain)
1680
+
1681
+ source_save.each{|name,ffw|
1682
+ ffw.domain = other_dom
1683
+ register_panel(ffw, ffw.hinner_frame)
1684
+ }
1685
+ #-----
1686
+ parent_splitted_adapter = find_splitted_frame(@panels[other_dom]['root'])
1687
+ if parent_splitted_adapter
1688
+ @panels[other_dom]['splitted_frames']=parent_splitted_adapter
1689
+ else
1690
+ @panels[other_dom]['splitted_frames']= nil
1691
+ end
1692
+ other_row,other_col = other_dom.split('.')
1693
+ @frames[other_row.to_i][other_col.to_i] = splitted_adapter_frame
1694
+ @domains[other_row.to_i][other_col.to_i] = other_dom
1695
+ # if vertical
1696
+ # @frames[_row.to_i][_col.to_i-1] = splitted_adapter_frame
1697
+ # @domains[_row.to_i][_col.to_i-1] = other_dom
1698
+ # else
1699
+ # @frames[_row.to_i-1][_col.to_i] = splitted_adapter_frame
1700
+ # @domains[_row.to_i-1][_col.to_i] = other_dom
1701
+ # end
1702
+ end
1703
+
1704
+ if vertical
1705
+ shift_left(_row.to_i,_col.to_i)
1706
+ else
1707
+ shift_top(_row.to_i,_col.to_i)
1708
+ end
1709
+ end
1710
+ build_invert_menu(true)
1711
+ end
1712
+
1713
+ def find_splitted_frame(_start_frame)
1714
+ splitted_frame = _start_frame
1715
+ while splitted_frame != nil && !splitted_frame.kind_of?(AGTkSplittedFrames)
1716
+ splitted_frame = TkWinfo.parent(splitted_frame)
1717
+ end
1718
+ splitted_frame
1719
+ end
1720
+ #--
1721
+ def close_runtime(_domain)
1722
+ splitted_adapter = find_splitted_frame(@panels[_domain]['root'])
1723
+ splitted_adapter_frame = splitted_adapter.frame
1724
+ vertical = splitted_adapter.instance_of?(AGTkVSplittedFrames)
1725
+ _row, _col = _domain.split('.')
1726
+ if @frames[_row.to_i][_col.to_i] == splitted_adapter.frame1
1727
+ other_ds = domains_on_frame(@panels[_domain]['splitted_frames'].frame2)
1728
+ elsif @frames[_row.to_i][_col.to_i] == splitted_adapter.frame2
1729
+ other_ds = domains_on_frame(@panels[_domain]['splitted_frames'].frame1)
1730
+ end
1731
+
1732
+ return if other_ds.nil?
1733
+
1734
+
1735
+ if other_ds.length == 1
1736
+ other_domain = other_ds[0]
1737
+ elsif other_ds.length > 1
1738
+ max = other_ds.length-1
1739
+ j = 0
1740
+ while j <= max
1741
+ if other_domain.nil?
1742
+ other_domain = other_ds[j]
1743
+ else
1744
+ r,c = other_domain.split('.')
1745
+ new_r,new_c = other_ds[j].split('.')
1746
+ if new_r.to_i < r.to_i || new_r.to_i == r.to_i && new_c.to_i < c.to_i
1747
+ other_domain = other_ds[j]
1748
+ end
1749
+ end
1750
+ j = j+1
1751
+ end
1752
+ end
1753
+ _other_row, _other_col = other_domain.split('.')
1754
+ @panels[_domain]['sons'].each{|name,ffw|
1755
+ unregister_panel(ffw, false, false)
1756
+ }
1757
+ unbuild_titled_frame(_domain)
1758
+
1759
+ if @panels[other_domain]['splitted_frames'] != @panels[_domain]['splitted_frames']
1760
+ if @panels[other_domain]['root_splitted_frames'].frame == @panels[_domain]['splitted_frames'].frame1 || @panels[other_domain]['root_splitted_frames'].frame == @panels[_domain]['splitted_frames'].frame2
1761
+ other_root_splitted_adapter = @panels[other_domain]['root_splitted_frames']
1762
+ elsif @panels[other_domain]['splitted_frames']
1763
+ other_root_splitted_adapter = @panels[other_domain]['splitted_frames']
1764
+ end
1765
+ end
1766
+
1767
+ @panels.delete(_domain)
1768
+ @frames[_row.to_i][_col.to_i] = nil
1769
+ @domains[_row.to_i][_col.to_i] = nil
1770
+
1771
+ if other_root_splitted_adapter
1772
+ if other_root_splitted_adapter != @panels[other_domain]['splitted_frames']
1773
+ other_ds.each{|d|
1774
+ if @panels[d]['root_splitted_frames'] == splitted_adapter
1775
+ @panels[d]['root_splitted_frames']=other_root_splitted_adapter
1776
+ end
1777
+ }
1778
+ end
1779
+ other_root_splitted_adapter.detach_frame
1780
+ splitted_adapter.detach_frame
1781
+ splitted_adapter.destroy
1782
+ other_root_splitted_adapter.attach_frame(splitted_adapter_frame)
1783
+ else
1784
+ other_source_save = Hash.new
1785
+ other_source_save.update(@panels[other_domain]['sons']) if @panels[other_domain]
1786
+ other_source_save.each{|name,ffw|
1787
+ unregister_panel(ffw, false, false)
1788
+ }
1789
+ splitted_adapter.detach_frame
1790
+ splitted_adapter.destroy
1791
+ @panels[other_domain]['root']=splitted_adapter_frame
1792
+ @frames[_other_row.to_i][_other_col.to_i] = splitted_adapter_frame
1793
+ build_titled_frame(other_domain)
1794
+ other_source_save.each{|name,ffw|
1795
+ ffw.domain = other_domain
1796
+ register_panel(ffw, ffw.hinner_frame)
1797
+ }
1798
+ parent_splitted_adapter = find_splitted_frame(@panels[other_domain]['root'])
1799
+ if parent_splitted_adapter
1800
+ @panels[other_domain]['splitted_frames']=parent_splitted_adapter
1801
+ else
1802
+ @panels[other_domain]['splitted_frames']= nil
1803
+ end
1804
+ end
1805
+ build_invert_menu(true)
1806
+ end
1807
+
1808
+ #--
1809
+
1810
+ def unbuild_titled_frame(domain)
1811
+ if @panels[domain]
1812
+ parent = @panels[domain]['root'].parent
1813
+ @panels[domain]['root'].destroy
1814
+ @panels[domain]['root']=parent
1815
+ end
1816
+ end
1817
+
1818
+ def add_commons_menu_items(_domain, _menu)
1819
+ _menu.insert('end', :separator)
1820
+ _menu.insert('end',:command,
1821
+ :label=>"add column",
1822
+ :image=>TkPhotoImage.new('dat'=>ADD_GIF),
1823
+ :compound=>'left',
1824
+ :command=>proc{add_cols_runtime(_domain)},
1825
+ :hidemargin => true
1826
+ )
1827
+ _menu.insert('end',:command,
1828
+ :label=>"add row",
1829
+ :image=>TkPhotoImage.new('dat'=>ADD_GIF),
1830
+ :compound=>'left',
1831
+ :command=>proc{add_rows_runtime(_domain)},
1832
+ :hidemargin => true
1833
+ )
1834
+ if @panels.keys.length > 2
1835
+ _menu.insert('end',:command,
1836
+ :label=>"close",
1837
+ :image=>TkPhotoImage.new('dat'=>CLOSE_FRAME_GIF),
1838
+ :compound=>'left',
1839
+ :command=>proc{close_runtime(_domain)},
1840
+ :hidemargin => true
1841
+ )
1842
+ end
1843
+ end
1844
+
1845
+ def build_titled_frame(domain)
1846
+ if @panels[domain]
1847
+ tframe = TkTitledFrame.new(@panels[domain]['root']).place('x'=>0, 'y'=>0,'relheight'=>1, 'relwidth'=>1)
1848
+ mb = tframe.add_menu_button('ext')
1849
+ # add commons item
1850
+ menu = mb.cget('menu')
1851
+ add_commons_menu_items(domain, menu)
1852
+ @panels[domain]['root']= tframe
1853
+ #-----------------------------------
1854
+ # class << tframe
1855
+ # def set_domain(_domain)
1856
+ # if @label_domain.nil?
1857
+ # @label_domail = TkLabel.new(self.frame, 'text'=>_domain).pack
1858
+ # else
1859
+ # @label_domain.configure('text'=>_domain)
1860
+ # end
1861
+ # end
1862
+ # end
1863
+ # tframe.set_domain(domain)
1864
+ #-----------------------------------
1865
+ end
1866
+ end
1867
+
1106
1868
  def add_headers
1107
1869
  @domains.each{|row|
1108
1870
  row.each{|domain|
1109
- @panels[domain]['root']= TkTitledFrame.new(@panels[domain]['root']).place('x'=>0, 'y'=>0,'relheight'=>1, 'relwidth'=>1) if @panels[domain]
1871
+ build_titled_frame(domain)
1110
1872
  }
1111
1873
  }
1112
1874
  @headed = true
@@ -1124,89 +1886,323 @@ class ArcadiaLayout
1124
1886
  @panels[_domain_name]['sons'][_name] != nil
1125
1887
  end
1126
1888
 
1127
- def register_panel(_domain_name, _name, _title)
1128
- #p "register #{_name} ------ 1"
1129
- p = @panels[_domain_name]
1130
- if p!=nil
1131
- num = p['sons'].length
1889
+ def change_domain(_target_domain, _source_name)
1890
+ tt1= @panels[_target_domain]['root'].top_text
1891
+ source_domain = @wrappers[_source_name].domain
1892
+ source_has_domain = !source_domain.nil?
1893
+ tt2= @panels[source_domain]['root'].top_text if source_has_domain
1894
+ if source_has_domain && @panels[source_domain]['sons'].length ==1 && @panels[_target_domain]['sons'].length > 0
1895
+ # change ------
1896
+ ffw1 = raised_fixed_frame(_target_domain)
1897
+ ffw2 = @panels[source_domain]['sons'].values[0]
1898
+ unregister_panel(ffw1,false,false) if ffw1
1899
+ unregister_panel(ffw2,false,false)
1900
+ ffw1.domain = source_domain if ffw1
1901
+ ffw2.domain = _target_domain
1902
+ register_panel(ffw1, ffw1.hinner_frame) if ffw1
1903
+ register_panel(ffw2, ffw2.hinner_frame)
1904
+ @panels[_target_domain]['root'].top_text(tt2)
1905
+ @panels[source_domain]['root'].top_text(tt1)
1906
+ elsif source_has_domain && @panels[source_domain]['sons'].length >= 1
1907
+ ffw2 = @panels[source_domain]['sons'][_source_name]
1908
+ unregister_panel(ffw2, false, false)
1909
+ ffw2.domain = _target_domain
1910
+ register_panel(ffw2, ffw2.hinner_frame)
1911
+ @panels[_target_domain]['root'].top_text(tt2)
1912
+ @panels[source_domain]['root'].top_text('')
1913
+ elsif !source_has_domain
1914
+ ffw2 = @wrappers[_source_name]
1915
+ ffw2.domain = _target_domain
1916
+ register_panel(ffw2, ffw2.hinner_frame)
1917
+ @panels[_target_domain]['root'].top_text('')
1918
+ end
1919
+ # refresh -----
1920
+ build_invert_menu
1921
+ end
1922
+
1923
+
1924
+ # def change_domain_old(_dom1, _dom2, _name2)
1925
+ # tt1= @panels[_dom1]['root'].top_text
1926
+ # tt2= @panels[_dom2]['root'].top_text
1927
+ # if @panels[_dom2]['sons'].length ==1 && @panels[_dom1]['sons'].length > 0
1928
+ # # change ------
1929
+ # ffw1 = raised_fixed_frame(_dom1)
1930
+ # ffw2 = @panels[_dom2]['sons'].values[0]
1931
+ # unregister_panel(ffw1,false,false) if ffw1
1932
+ # unregister_panel(ffw2,false,false)
1933
+ # ffw1.domain = _dom2 if ffw1
1934
+ # ffw2.domain = _dom1
1935
+ # register_panel(ffw1, ffw1.hinner_frame) if ffw1
1936
+ # register_panel(ffw2, ffw2.hinner_frame)
1937
+ # @panels[_dom1]['root'].top_text(tt2)
1938
+ # @panels[_dom2]['root'].top_text(tt1)
1939
+ # elsif @panels[_dom2]['sons'].length > 1
1940
+ # ffw2 = @panels[_dom2]['sons'][_name2]
1941
+ # unregister_panel(ffw2, false, false)
1942
+ # ffw2.domain = _dom1
1943
+ # register_panel(ffw2, ffw2.hinner_frame)
1944
+ # @panels[_dom1]['root'].top_text(tt2)
1945
+ # @panels[_dom2]['root'].top_text('')
1946
+ # end
1947
+ # # refresh -----
1948
+ # build_invert_menu
1949
+ # end
1950
+
1951
+ def process_frame(_ffw)
1952
+ #def process_frame(_domain_name, _frame_name)
1953
+ #domain_root = @panels[_domain_name]['sons'][_frame_name]
1954
+ @panels.keys.each{|dom|
1955
+ if dom != '_domain_root_' && dom != _ffw.domain && @panels[dom] && @panels[dom]['root']
1956
+ menu = @panels[dom]['root'].menu_button('ext').cget('menu')
1957
+ menu.insert('0',:command,
1958
+ :label=>_ffw.title,
1959
+ :image=>TkPhotoImage.new('dat'=>ARROW_LEFT_GIF),
1960
+ :compound=>'left',
1961
+ :command=>proc{change_domain(dom, _ffw.name)},
1962
+ :hidemargin => true
1963
+ )
1964
+ end
1965
+ }
1966
+ end
1967
+
1968
+
1969
+ def build_invert_menu(refresh_commons_items=false)
1970
+ @panels.keys.each{|dom|
1971
+ if dom != '_domain_root_' && @panels[dom] && @panels[dom]['root']
1972
+ menu = @panels[dom]['root'].menu_button('ext').cget('menu')
1973
+ if refresh_commons_items
1974
+ @panels[dom]['root'].menu_button('ext').cget('menu').delete('0','end')
1975
+ add_commons_menu_items(dom, menu)
1976
+ else
1977
+ if @panels.keys.length > 2
1978
+ i=menu.index('end').to_i-4
1979
+ else
1980
+ i=menu.index('end').to_i-3
1981
+ end
1982
+ if i >= 0
1983
+ end_index = i.to_s
1984
+ @panels[dom]['root'].menu_button('ext').cget('menu').delete('0',end_index)
1985
+ end
1986
+ end
1987
+ end
1988
+ }
1989
+
1990
+ @wrappers.each{|name,ffw|
1991
+ process_frame(ffw) #if ffw.domain
1992
+ }
1993
+ end
1994
+
1995
+ # def register_panel_old(_domain_name, _name, _title)
1996
+ # p = @panels[_domain_name]
1997
+ # if p!=nil
1998
+ # num = p['sons'].length
1999
+ # if @headed
2000
+ # p['root'].title(_title)
2001
+ # if !p['root'].frame.instance_of?(TkFrameAdapter)
2002
+ # wrapper = TkFrameAdapter.new(self.root, Arcadia.style('frame'))
2003
+ # wrapper.attach_frame(p['root'].frame)
2004
+ # p['root'].frame=wrapper
2005
+ # end
2006
+ # root_frame = p['root'].frame
2007
+ # process_register_panel(_domain_name)
2008
+ # else
2009
+ # root_frame = p['root']
2010
+ # end
2011
+ # if (num == 0 && @autotab)
2012
+ # api = ArcadiaPanelInfo.new(_name,_title,nil)
2013
+ # api.frame = TkFrame.new(root_frame, Arcadia.style('panel')).place('x'=>0, 'y'=>0, 'relwidth'=>1, 'relheight'=>1)
2014
+ # p['sons'][_name] = api
2015
+ # return api.frame
2016
+ # else
2017
+ # if num == 1 && @autotab && p['notebook'] == nil
2018
+ # p['notebook'] = Tk::BWidget::NoteBook.new(root_frame, Arcadia.style('tabpanel')){
2019
+ # tabbevelsize 0
2020
+ # internalborderwidth 0
2021
+ # pack('fill'=>'both', :padx=>0, :pady=>0, :expand => 'yes')
2022
+ # }
2023
+ # api = p['sons'].values[0]
2024
+ # api_tab_frame = p['notebook'].insert('end',
2025
+ # api.name,
2026
+ # 'text'=>api.title,
2027
+ # 'raisecmd'=>proc{
2028
+ # p['root'].title(api.title)
2029
+ # p['root'].top_text('')
2030
+ # changed
2031
+ # notify_observers('RAISE', api.name)
2032
+ # }
2033
+ # )
2034
+ # api.frame.place('in'=>api_tab_frame, 'x'=>0, 'y'=>0, 'relwidth'=>1, 'relheight'=>1)
2035
+ # api.frame.raise
2036
+ # elsif (num==0 && !@autotab)
2037
+ # p['notebook'] = Tk::BWidget::NoteBook.new(root_frame){
2038
+ # tabbevelsize 0
2039
+ # internalborderwidth 0
2040
+ # pack('fill'=>'both', :padx=>0, :pady=>0, :expand => 'yes')
2041
+ # }
2042
+ # end
2043
+ # _panel = p['notebook'].insert('end',_name ,
2044
+ # 'text'=>_title,
2045
+ # 'raisecmd'=>proc{
2046
+ # p['root'].title(_title)
2047
+ # changed
2048
+ # notify_observers('RAISE', _name)
2049
+ # }
2050
+ # )
2051
+ # p['sons'][_name] = ArcadiaPanelInfo.new(_name,_title,_panel)
2052
+ # p['notebook'].raise(_name)
2053
+ # return _panel
2054
+ # end
2055
+ # else
2056
+ # Arcadia.dialog(self,
2057
+ # 'type'=>'ok',
2058
+ # 'msg'=>"domain #{_domain_name} do not exist\nfor '#{_title}'!",
2059
+ # 'level'=>'warning'
2060
+ # )
2061
+ # float_frame = new_float_frame
2062
+ # float_frame.title(_title)
2063
+ # return float_frame.frame
2064
+ # end
2065
+ # end
2066
+
2067
+ def register_panel(_ffw, _adapter=nil)
2068
+ _domain_name = _ffw.domain
2069
+ _name = _ffw.name
2070
+ _title = _ffw.title
2071
+ pan = @panels[_domain_name]
2072
+ @wrappers[_name]=_ffw
2073
+ if pan!=nil
2074
+ num = pan['sons'].length
1132
2075
  if @headed
1133
- p['root'].title(_title)
1134
- root_frame = p['root'].frame
2076
+ pan['root'].title(_title)
2077
+ if !pan['root'].frame.instance_of?(TkFrameAdapter) && num==0
2078
+ if _adapter
2079
+ adapter = _adapter
2080
+ else
2081
+ adapter = TkFrameAdapter.new(self.root, Arcadia.style('frame'))
2082
+ end
2083
+ adapter.attach_frame(pan['root'].frame)
2084
+ adapter.raise
2085
+ #@wrappers[_name]=wrapper
2086
+ end
2087
+ root_frame = pan['root'].frame
1135
2088
  else
1136
- root_frame = p['root']
2089
+ root_frame = pan['root']
1137
2090
  end
1138
2091
  if (num == 0 && @autotab)
1139
- #p "register #{_name} ------ 2"
1140
- api = ArcadiaPanelInfo.new(_name,_title,nil)
1141
- api.frame = TkFrame.new(root_frame, Arcadia.style('panel')).place('x'=>0, 'y'=>0, 'relwidth'=>1, 'relheight'=>1)
1142
- p['sons'][_name] = api
1143
- return api.frame
2092
+ #api = ArcadiaPanelInfo.new(_name,_title,wrapper,_ffw)
2093
+ pan['sons'][_name] = _ffw
2094
+ process_frame(_ffw)
2095
+ return adapter
1144
2096
  else
1145
- if num == 1 && @autotab && p['notebook'] == nil
1146
- #p "register #{_name} ------ 3"
1147
- p['notebook'] = Tk::BWidget::NoteBook.new(root_frame, Arcadia.style('tabpanel')){
2097
+ if num == 1 && @autotab && pan['notebook'] == nil
2098
+ pan['notebook'] = Tk::BWidget::NoteBook.new(root_frame, Arcadia.style('titletabpanel')){
1148
2099
  tabbevelsize 0
1149
2100
  internalborderwidth 0
1150
2101
  pack('fill'=>'both', :padx=>0, :pady=>0, :expand => 'yes')
1151
2102
  }
1152
- api = p['sons'].values[0]
1153
- api_tab_frame = p['notebook'].insert('end',
1154
- api.name,
1155
- 'text'=>api.title,
1156
- 'raisecmd'=>proc{
1157
- p['root'].title(api.title)
1158
- p['root'].top_text('')
1159
- changed
1160
- notify_observers('RAISE', api.name)
1161
- }
2103
+ api = pan['sons'].values[0]
2104
+ api_tab_frame = pan['notebook'].insert('end',
2105
+ api.name,
2106
+ 'text'=>api.title,
2107
+ 'raisecmd'=>proc{
2108
+ pan['root'].title(api.title)
2109
+ pan['root'].top_text('')
2110
+ Arcadia.process_event(LayoutRaisingFrameEvent.new(self,'extension_name'=>_ffw.extension, 'frame_name'=>_ffw.name))
2111
+
2112
+ # changed
2113
+ # notify_observers('RAISE', api.name)
2114
+ }
1162
2115
  )
1163
- api.frame.place('in'=>api_tab_frame, 'x'=>0, 'y'=>0, 'relwidth'=>1, 'relheight'=>1)
1164
- api.frame.raise
2116
+ adapter = api.hinner_frame
2117
+ adapter.detach_frame
2118
+ adapter.attach_frame(api_tab_frame)
2119
+ api.hinner_frame.raise
1165
2120
  elsif (num==0 && !@autotab)
1166
- #p "register #{_name} ------ 4"
1167
- p['notebook'] = Tk::BWidget::NoteBook.new(root_frame){
2121
+ pan['notebook'] = Tk::BWidget::NoteBook.new(root_frame, Arcadia.style('titletabpanel')){
1168
2122
  tabbevelsize 0
1169
2123
  internalborderwidth 0
1170
2124
  pack('fill'=>'both', :padx=>0, :pady=>0, :expand => 'yes')
1171
2125
  }
1172
2126
  end
1173
- # p "---- insert in notebook #{_name} "
1174
- _panel = p['notebook'].insert('end',_name ,
2127
+ _panel = pan['notebook'].insert('end',_name ,
1175
2128
  'text'=>_title,
1176
- #'background'=>_tab_bg,
1177
2129
  'raisecmd'=>proc{
1178
- p['root'].title(_title)
1179
- changed
1180
- notify_observers('RAISE', _name)
2130
+ pan['root'].title(_title)
2131
+ Arcadia.process_event(LayoutRaisingFrameEvent.new(self,'extension_name'=>_ffw.extension, 'frame_name'=>_ffw.name))
2132
+ # changed
2133
+ # notify_observers('RAISE', _name)
1181
2134
  }
1182
2135
  )
1183
- p['sons'][_name] = ArcadiaPanelInfo.new(_name,_title,_panel)
1184
- p['notebook'].raise(_name)
2136
+ if _adapter
2137
+ adapter = _adapter
2138
+ else
2139
+ adapter = TkFrameAdapter.new(self.root, Arcadia.style('frame'))
2140
+ end
2141
+ adapter.attach_frame(_panel)
2142
+ adapter.raise
2143
+ _panel=adapter
2144
+ #@wrappers[_name]=wrapper
2145
+ #p['sons'][_name] = ArcadiaPanelInfo.new(_name,_title,_panel,_ffw)
2146
+ pan['sons'][_name] = _ffw
2147
+ pan['notebook'].raise(_name)
2148
+ process_frame(_ffw)
1185
2149
  return _panel
1186
2150
  end
1187
2151
  else
1188
- Arcadia.dialog(self,
1189
- 'type'=>'ok',
1190
- 'msg'=>"domain #{_domain_name} do not exist\nfor '#{_title}'!",
1191
- 'level'=>'warning'
1192
- )
1193
- float_frame = new_float_frame
1194
- float_frame.title(_title)
1195
- return float_frame.frame
2152
+ _ffw.domain = nil
2153
+ process_frame(_ffw)
2154
+ return TkFrameAdapter.new(self.root, Arcadia.style('frame'))
2155
+
2156
+ #
2157
+ # Arcadia.dialog(self,
2158
+ # 'type'=>'ok',
2159
+ # 'msg'=>"domain #{_domain_name} do not exist\nfor '#{_title}'!",
2160
+ # 'level'=>'warning'
2161
+ # )
2162
+ # float_frame = new_float_frame
2163
+ # float_frame.title(_title)
2164
+ # return float_frame.frame
1196
2165
  end
1197
2166
  end
1198
2167
 
1199
- def unregister_panel(_domain_name, _name)
2168
+
2169
+ def unregister_panel(_ffw, delete_wrapper=true, refresh_menu=true)
1200
2170
  #p "unregister #{_name} ------> 1"
2171
+ _domain_name = _ffw.domain
2172
+ _name = _ffw.name
2173
+ @panels[_domain_name]['sons'][_name].hinner_frame.detach_frame
2174
+ if delete_wrapper
2175
+ @wrappers.delete(_name).hinner_frame.destroy
2176
+ else
2177
+ @wrappers[_name].domain=nil
2178
+ end
1201
2179
  @panels[_domain_name]['sons'].delete(_name)
1202
2180
  #p "unregister #{_name} ------> 2"
1203
- #p @panels[_domain_name]['notebook'].pages
1204
- @panels[_domain_name]['notebook'].delete(_name) if @panels[_domain_name]['notebook'].index(_name) > 0
1205
- #p "unregister #{_name} ------> 3"
1206
- new_raise_key = @panels[_domain_name]['sons'].keys[@panels[_domain_name]['sons'].length-1]
1207
- #p "unregister #{_name} ------> 4"
1208
- @panels[_domain_name]['notebook'].raise(new_raise_key)
1209
- #p "unregister #{_name} ------> 5"
2181
+ if @panels[_domain_name]['sons'].length == 1
2182
+ w = @panels[_domain_name]['sons'].values[0].hinner_frame
2183
+ t = @panels[_domain_name]['sons'].values[0].title
2184
+ w.detach_frame
2185
+ w.attach_frame(@panels[_domain_name]['root'].frame)
2186
+ @panels[_domain_name]['root'].title(t)
2187
+ @panels[_domain_name]['notebook'].destroy
2188
+ @panels[_domain_name]['notebook']=nil
2189
+ elsif @panels[_domain_name]['sons'].length > 1
2190
+ @panels[_domain_name]['notebook'].delete(_name) if @panels[_domain_name]['notebook'].index(_name) > 0
2191
+ #p "unregister #{_name} ------> 3"
2192
+ new_raise_key = @panels[_domain_name]['sons'].keys[@panels[_domain_name]['sons'].length-1]
2193
+ #p "unregister #{_name} ------> 4"
2194
+ @panels[_domain_name]['notebook'].raise(new_raise_key)
2195
+ #p "unregister #{_name} ------> 5"
2196
+ elsif @panels[_domain_name]['sons'].length == 0
2197
+ @panels[_domain_name]['root'].title('')
2198
+ end
2199
+ build_invert_menu if refresh_menu
2200
+ end
2201
+
2202
+ def view_panel
2203
+ end
2204
+
2205
+ def hide_panel
1210
2206
  end
1211
2207
 
1212
2208
  def [](_row, _col)
@@ -1217,6 +2213,10 @@ class ArcadiaLayout
1217
2213
  @panels[_domain_name]['sons'][_name].frame
1218
2214
  end
1219
2215
 
2216
+ # def domain_for_frame(_domain_name, _name)
2217
+ # domain(@panels[_domain_name]['sons'][_name].domain)
2218
+ # end
2219
+
1220
2220
  def domain(_domain_name)
1221
2221
  @panels[_domain_name]
1222
2222
  end