arcadia 0.13.1 → 1.0.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 (159) hide show
  1. checksums.yaml +4 -4
  2. data/{README → README.md} +60 -53
  3. data/conf/LC/en-UK.LANG +10 -4
  4. data/conf/arcadia.conf +221 -83
  5. data/conf/arcadia.res.rb +165 -175
  6. data/conf/theme-dark.conf +1 -1
  7. data/conf/theme-dark.res.rb +0 -123
  8. data/ext/ae-breakpoints/ae-breakpoints.rb +4 -3
  9. data/ext/ae-dir-projects/ae-dir-projects.conf +27 -1
  10. data/ext/ae-dir-projects/ae-dir-projects.rb +120 -70
  11. data/ext/ae-editor/ae-editor.conf +2 -2
  12. data/ext/ae-editor/ae-editor.rb +610 -303
  13. data/ext/ae-file-history/ae-file-history.rb +60 -39
  14. data/ext/ae-output/ae-output.rb +52 -27
  15. data/ext/ae-ruby-debug/ae-ruby-debug.conf +3 -1
  16. data/ext/ae-ruby-debug/ae-ruby-debug.rb +18 -11
  17. data/ext/ae-search-in-files/ae-search-in-files.conf +2 -2
  18. data/ext/ae-search-in-files/ae-search-in-files.rb +124 -77
  19. data/ext/ae-shell/ae-shell.conf +1 -1
  20. data/ext/ae-shell/ae-shell.rb +18 -81
  21. data/ext/ae-subprocess-inspector/ae-subprocess-inspector.rb +78 -81
  22. data/ext/ae-term/ae-term.rb +9 -7
  23. data/lib/a-commons.rb +125 -17
  24. data/lib/a-contracts.rb +6 -2
  25. data/lib/a-core.rb +441 -405
  26. data/lib/a-tkcommons.rb +1237 -45
  27. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/BWman/ArrowButton.html +0 -0
  28. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/BWman/BWidget.html +0 -0
  29. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/BWman/Button.html +0 -0
  30. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/BWman/ButtonBox.html +0 -0
  31. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/BWman/ComboBox.html +0 -0
  32. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/BWman/Dialog.html +0 -0
  33. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/BWman/DragSite.html +0 -0
  34. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/BWman/DropSite.html +0 -0
  35. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/BWman/DynamicHelp.html +0 -0
  36. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/BWman/Entry.html +0 -0
  37. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/BWman/Label.html +0 -0
  38. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/BWman/LabelEntry.html +0 -0
  39. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/BWman/LabelFrame.html +0 -0
  40. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/BWman/ListBox.html +0 -0
  41. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/BWman/MainFrame.html +0 -0
  42. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/BWman/MessageDlg.html +0 -0
  43. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/BWman/NoteBook.html +0 -0
  44. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/BWman/PagesManager.html +0 -0
  45. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/BWman/PanedWindow.html +0 -0
  46. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/BWman/PanelFrame.html +0 -0
  47. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/BWman/PasswdDlg.html +0 -0
  48. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/BWman/ProgressBar.html +0 -0
  49. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/BWman/ProgressDlg.html +0 -0
  50. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/BWman/ScrollView.html +0 -0
  51. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/BWman/ScrollableFrame.html +0 -0
  52. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/BWman/ScrolledWindow.html +0 -0
  53. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/BWman/SelectColor.html +0 -0
  54. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/BWman/SelectFont.html +0 -0
  55. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/BWman/Separator.html +0 -0
  56. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/BWman/SpinBox.html +0 -0
  57. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/BWman/StatusBar.html +0 -0
  58. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/BWman/TitleFrame.html +0 -0
  59. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/BWman/Tree.html +0 -0
  60. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/BWman/Widget.html +0 -0
  61. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/BWman/contents.html +0 -0
  62. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/BWman/index.html +0 -0
  63. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/BWman/navtree.html +0 -0
  64. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/BWman/options.htm +0 -0
  65. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/CHANGES.txt +0 -0
  66. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/ChangeLog +65 -0
  67. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/LICENSE.txt +0 -0
  68. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/README.txt +0 -0
  69. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/arrow.tcl +0 -0
  70. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/bitmap.tcl +0 -0
  71. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/button.tcl +0 -2
  72. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/buttonbox.tcl +0 -0
  73. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/color.tcl +0 -0
  74. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/combobox.tcl +40 -16
  75. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/demo/basic.tcl +0 -0
  76. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/demo/bwidget.xbm +0 -0
  77. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/demo/demo.tcl +0 -0
  78. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/demo/dnd.tcl +0 -0
  79. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/demo/manager.tcl +0 -0
  80. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/demo/select.tcl +0 -0
  81. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/demo/tmpldlg.tcl +0 -0
  82. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/demo/tree.tcl +0 -0
  83. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/demo/x1.xbm +0 -0
  84. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/dialog.tcl +0 -0
  85. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/dragsite.tcl +0 -0
  86. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/dropsite.tcl +0 -0
  87. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/dynhelp.tcl +3 -0
  88. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/entry.tcl +0 -0
  89. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/font.tcl +0 -0
  90. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/images/bold.gif +0 -0
  91. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/images/copy.gif +0 -0
  92. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/images/cut.gif +0 -0
  93. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/images/dragfile.gif +0 -0
  94. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/images/dragicon.gif +0 -0
  95. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/images/error.gif +0 -0
  96. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/images/file.gif +0 -0
  97. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/images/folder.gif +0 -0
  98. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/images/hourglass.gif +0 -0
  99. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/images/info.gif +0 -0
  100. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/images/italic.gif +0 -0
  101. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/images/minus.xbm +0 -0
  102. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/images/new.gif +0 -0
  103. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/images/opcopy.xbm +0 -0
  104. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/images/open.gif +0 -0
  105. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/images/openfold.gif +0 -0
  106. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/images/oplink.xbm +0 -0
  107. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/images/opmove.xbm +0 -0
  108. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/images/overstrike.gif +0 -0
  109. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/images/palette.gif +0 -0
  110. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/images/passwd.gif +0 -0
  111. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/images/paste.gif +0 -0
  112. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/images/plus.xbm +0 -0
  113. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/images/print.gif +0 -0
  114. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/images/question.gif +0 -0
  115. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/images/redo.gif +0 -0
  116. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/images/save.gif +0 -0
  117. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/images/target.xbm +0 -0
  118. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/images/underline.gif +0 -0
  119. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/images/undo.gif +0 -0
  120. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/images/warning.gif +0 -0
  121. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/init.tcl +0 -0
  122. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/label.tcl +0 -2
  123. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/labelentry.tcl +0 -3
  124. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/labelframe.tcl +0 -2
  125. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/lang/da.rc +1 -0
  126. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/lang/de.rc +1 -0
  127. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/lang/en.rc +1 -0
  128. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/lang/es.rc +1 -0
  129. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/lang/fr.rc +1 -0
  130. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/lang/hu.rc +1 -0
  131. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/lang/nl.rc +1 -0
  132. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/lang/no.rc +59 -58
  133. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/lang/pl.rc +0 -0
  134. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/listbox.tcl +17 -4
  135. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/mainframe.tcl +0 -0
  136. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/messagedlg.tcl +0 -0
  137. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/notebook.tcl +0 -0
  138. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/pagesmgr.tcl +0 -0
  139. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/panedw.tcl +0 -0
  140. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/panelframe.tcl +0 -0
  141. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/passwddlg.tcl +0 -0
  142. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/pkgIndex.tcl +2 -2
  143. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/progressbar.tcl +0 -0
  144. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/progressdlg.tcl +0 -0
  145. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/scrollframe.tcl +6 -6
  146. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/scrollview.tcl +0 -0
  147. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/scrollw.tcl +1 -0
  148. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/separator.tcl +0 -0
  149. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/spinbox.tcl +0 -0
  150. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/statusbar.tcl +0 -0
  151. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/tests/entry.test +2 -2
  152. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/titleframe.tcl +0 -0
  153. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/tree.tcl +0 -0
  154. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/utils.tcl +0 -0
  155. data/tcl/bwidget-1.9.8/widget-old.tcl +1651 -0
  156. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/widget.tcl +64 -36
  157. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/wizard.tcl +0 -0
  158. data/tcl/{bwidget-1.9.7 → bwidget-1.9.8}/xpm2image.tcl +0 -0
  159. metadata +196 -195
@@ -107,13 +107,14 @@ class Breakpoints < ArcadiaExt
107
107
  end
108
108
 
109
109
  def build_popup
110
- _pop_up = TkMenu.new(
110
+ #_pop_up = TkMenu.new(
111
+ _pop_up = Arcadia.wf.menu(
111
112
  :parent=>@tree_break,
112
113
  :tearoff=>0,
113
114
  :title => 'Menu'
114
115
  )
115
- _pop_up.extend(TkAutoPostMenu)
116
- _pop_up.configure(Arcadia.style('menu'))
116
+ #_pop_up.extend(TkAutoPostMenu)
117
+ #_pop_up.configure(Arcadia.style('menu'))
117
118
  _title_item = _pop_up.insert('end',
118
119
  :command,
119
120
  :label=>'...',
@@ -6,4 +6,30 @@ active=yes
6
6
  require=ext/ae-dir-projects/ae-dir-projects
7
7
  class=DirProjects
8
8
 
9
- file.name=arcadia.projects
9
+ file.name=arcadia.projects
10
+
11
+
12
+ user_toolbar.contexts=dir_project
13
+ user_toolbar.dir_project.context_path=file
14
+ user_toolbar.dir_project=newp,openp,search,xterm
15
+ #,openp,search,xterm
16
+
17
+ user_toolbar.dir_project.newp.name=newp
18
+ user_toolbar.dir_project.newp.hint=!Arcadia.text('ext.dir_projects.button.new.hint')
19
+ user_toolbar.dir_project.newp.image_data=!NEW_GIF
20
+ user_toolbar.dir_project.newp.action=ActionEvent.new(self,'action'=>do_new_project)
21
+
22
+ user_toolbar.dir_project.openp.name=openp
23
+ user_toolbar.dir_project.openp.hint=!Arcadia.text('ext.dir_projects.button.open.hint')
24
+ user_toolbar.dir_project.openp.image_data=!OPEN_PROJECT_GIF
25
+ user_toolbar.dir_project.openp.action=ActionEvent.new(self,'action'=>do_open_project)
26
+
27
+ user_toolbar.dir_project.search.name=search
28
+ user_toolbar.dir_project.search.hint=!Arcadia.text('ext.dir_projects.button.search.hint')
29
+ user_toolbar.dir_project.search.image_data=!SEARCH_FILES_GIF
30
+ user_toolbar.dir_project.search.action=ActionEvent.new(self,'action'=>do_search_files)
31
+
32
+ user_toolbar.dir_project.xterm.name=xterm
33
+ user_toolbar.dir_project.xterm.hint=!Arcadia.text('ext.dir_projects.button.term.hint')
34
+ user_toolbar.dir_project.xterm.image_data=!TERMINAL_GIF
35
+ user_toolbar.dir_project.xterm.action=ActionEvent.new(self,'action'=>do_open_term)
@@ -45,68 +45,81 @@ class DirProjects < ArcadiaExtPlus
45
45
  @h_stack = Array.new
46
46
  @opened_folder = Array.new
47
47
  #--- button_box
48
- @button_box = Tk::BWidget::ButtonBox.new(self.frame.hinner_frame){
49
- homogeneous true
50
- spacing 0
51
- padx 0
52
- pady 0
53
- background Arcadia.conf('panel.background')
54
- }.place('x'=>0)
55
- TkWinfo.parent(@button_box).configure(:background => Arcadia.conf('panel.background'))
48
+ # @button_box = Tk::BWidget::ButtonBox.new(self.frame.hinner_frame){
49
+ # homogeneous true
50
+ # spacing 0
51
+ # padx 0
52
+ # pady 0
53
+ # background Arcadia.conf('panel.background')
54
+ # }.place('x'=>0)
55
+ # TkWinfo.parent(@button_box).configure(:background => Arcadia.conf('panel.background'))
56
56
 
57
- @button_box.add(Arcadia.style('toolbarbutton').update({
58
- 'name'=>'new_proj',
59
- 'anchor' => 'center',
60
- 'command'=>proc{self.do_new_project},
61
- 'helptext'=>Arcadia.text('ext.dir_projects.button.new.hint'),
62
- 'image'=> Arcadia.image_res(NEW_GIF)})
63
- )
57
+ # @button_box.add(Arcadia.style('toolbarbutton').update({
58
+ # 'name'=>'new_proj',
59
+ # 'anchor' => 'center',
60
+ # 'command'=>proc{self.do_new_project},
61
+ # 'helptext'=>Arcadia.text('ext.dir_projects.button.new.hint'),
62
+ # 'image'=> Arcadia.image_res(NEW_GIF)})
63
+ # )
64
+
65
+
66
+
67
+ # @button_box.add(Arcadia.style('toolbarbutton').update({
68
+ # 'name'=>'open_proj',
69
+ # 'anchor' => 'center',
70
+ # 'command'=>proc{self.do_open_project},
71
+ # 'helptext'=>Arcadia.text('ext.dir_projects.button.open.hint'),
72
+ # 'image'=> Arcadia.image_res(OPEN_PROJECT_GIF)})
73
+ # )
74
+
75
+
76
+
77
+ # @button_box.add(Arcadia.style('toolbarbutton').update({
78
+ # 'name'=>'parent_folder',
79
+ # 'anchor' => 'center',
80
+ # 'command'=>proc{self.do_goto_parent_folder},
81
+ # 'helptext'=>Arcadia.text('ext.dir_projects.button.up.hint'),
82
+ # 'image'=> Arcadia.image_res(PARENTFOLDER_GIF)})
83
+ # )
64
84
 
65
- @button_box.add(Arcadia.style('toolbarbutton').update({
66
- 'name'=>'open_proj',
67
- 'anchor' => 'center',
68
- 'command'=>proc{self.do_open_project},
69
- 'helptext'=>Arcadia.text('ext.dir_projects.button.open.hint'),
70
- 'image'=> Arcadia.image_res(OPEN_PROJECT_GIF)})
71
- )
72
85
 
73
- @button_box.add(Arcadia.style('toolbarbutton').update({
74
- 'name'=>'parent_folder',
75
- 'anchor' => 'center',
76
- 'command'=>proc{self.do_goto_parent_folder},
77
- 'helptext'=>Arcadia.text('ext.dir_projects.button.up.hint'),
78
- 'image'=> Arcadia.image_res(PARENTFOLDER_GIF)})
79
- )
80
86
 
81
- @button_box.add(Arcadia.style('toolbarbutton').update({
82
- 'name'=>'search_in_files',
83
- 'anchor' => 'center',
84
- 'command'=>proc{self.do_search_files},
85
- 'helptext'=>Arcadia.text('ext.dir_projects.button.search.hint'),
86
- 'image'=> Arcadia.image_res(SEARCH_FILES_GIF)})
87
- )
87
+ # @button_box.add(Arcadia.style('toolbarbutton').update({
88
+ # 'name'=>'search_in_files',
89
+ # 'anchor' => 'center',
90
+ # 'command'=>proc{self.do_search_files},
91
+ # 'helptext'=>Arcadia.text('ext.dir_projects.button.search.hint'),
92
+ # 'image'=> Arcadia.image_res(SEARCH_FILES_GIF)})
93
+ # )
88
94
 
89
- @button_box.add(Arcadia.style('toolbarbutton').update({
90
- 'name'=>'terminal',
91
- 'anchor' => 'center',
92
- 'command'=>proc{self.do_open_term},
93
- 'helptext'=>Arcadia.text('ext.dir_projects.button.term.hint'),
94
- 'image'=> Arcadia.image_res(TERMINAL_GIF)})
95
- )
96
95
 
96
+
97
+ # @button_box.add(Arcadia.style('toolbarbutton').update({
98
+ # 'name'=>'terminal',
99
+ # 'anchor' => 'center',
100
+ # 'command'=>proc{self.do_open_term},
101
+ # 'helptext'=>Arcadia.text('ext.dir_projects.button.term.hint'),
102
+ # 'image'=> Arcadia.image_res(TERMINAL_GIF)})
103
+ # )
104
+
105
+
106
+
97
107
  #--- button_box
108
+
109
+
98
110
  @panel = self.frame.root.add_panel(self.frame.name, "sync");
99
- @cb_sync = TkCheckButton.new(@panel, Arcadia.style('checkbox').update('background'=>@panel.background)){
100
- text 'Sync'
101
- justify 'left'
102
- indicatoron 0
103
- offrelief 'flat'
111
+ # @cb_sync = TkCheckButton.new(@panel, Arcadia.style('checkbox').update('background'=>@panel.background)){
112
+
113
+ @cb_sync = Arcadia.wf.titlecontextcheckbutton(@panel){
114
+ variable TkVariable.new
104
115
  image Arcadia.image_res(SYNC_GIF)
105
116
  pack
106
117
  }
118
+
119
+ @cb_sync.hint=Arcadia.text('ext.dir_projects.button.link.hint')
107
120
 
108
- Tk::BWidget::DynamicHelp::add(@cb_sync,
109
- 'text'=>Arcadia.text('ext.dir_projects.button.link.hint'))
121
+ # Tk::BWidget::DynamicHelp::add(@cb_sync,
122
+ # 'text'=>Arcadia.text('ext.dir_projects.button.link.hint'))
110
123
 
111
124
  do_check = proc {
112
125
  if @cb_sync.cget('onvalue')==@cb_sync.cget('variable').value.to_i
@@ -139,6 +152,16 @@ class DirProjects < ArcadiaExtPlus
139
152
  shure_delete_node(_selected)
140
153
  end
141
154
  }
155
+
156
+ self.frame.root.add_button(self.frame.name, Arcadia.text('ext.dir_projects.button.up.hint'), proc{self.do_goto_parent_folder}, ARROW_UP_GIF)
157
+ # self.frame.root.add_sep(self.frame.name,1)
158
+ # self.frame.root.add_button(self.frame.name, Arcadia.text('ext.dir_projects.button.term.hint'), proc{self.do_open_term}, TERMINAL_GIF)
159
+ # self.frame.root.add_sep(self.frame.name,1)
160
+ # self.frame.root.add_button(self.frame.name, Arcadia.text('ext.dir_projects.button.search.hint'), proc{self.do_search_files}, SEARCH_FILES_GIF)
161
+ # self.frame.root.add_sep(self.frame.name,1)
162
+ # self.frame.root.add_button(self.frame.name, Arcadia.text('ext.dir_projects.button.open.hint'), proc{Tk.callback_break;self.do_open_project}, OPEN_PROJECT_GIF)
163
+ # self.frame.root.add_sep(self.frame.name,1)
164
+ # self.frame.root.add_button(self.frame.name, Arcadia.text('ext.dir_projects.button.new.hint'), proc{self.do_new_project}, NEW_GIF)
142
165
 
143
166
 
144
167
  do_open_folder_cmd = proc{|_node| do_open_folder(_node)}
@@ -152,7 +175,8 @@ class DirProjects < ArcadiaExtPlus
152
175
  crosscloseimage Arcadia.image_res(PLUS_GIF)
153
176
  crossopenimage Arcadia.image_res(MINUS_GIF)
154
177
  }
155
- @htree.extend(TkScrollableWidget).show(0,24)
178
+ # @htree.extend(TkScrollableWidget).show(0,24)
179
+ @htree.extend(TkScrollableWidget).show(0,0)
156
180
  self.pop_up_menu_tree
157
181
  @image_kdir = Arcadia.image_res(ICON_FOLDER_OPEN_GIF)
158
182
  @image_kdir_closed = Arcadia.image_res(FOLDER_GIF)
@@ -289,21 +313,23 @@ class DirProjects < ArcadiaExtPlus
289
313
  end
290
314
 
291
315
  def pop_up_menu_tree
292
- @pop_up_tree = TkMenu.new(
316
+ #@pop_up_tree = TkMenu.new(
317
+ @pop_up_tree = Arcadia.wf.menu(
293
318
  :parent=>@htree,
294
319
  :tearoff=>0,
295
320
  :title => Arcadia.text('ext.dir_projects.menu.title')
296
321
  )
297
- @pop_up_tree.extend(TkAutoPostMenu)
298
- @pop_up_tree.configure(Arcadia.style('menu'))
322
+ #@pop_up_tree.extend(TkAutoPostMenu)
323
+ #@pop_up_tree.configure(Arcadia.style('menu'))
299
324
  #----- new submenu
300
- sub_new = TkMenu.new(
325
+ #sub_new = TkMenu.new(
326
+ sub_new = Arcadia.wf.menu(
301
327
  :parent=>@pop_up_tree,
302
328
  :tearoff=>0,
303
329
  :title => Arcadia.text('ext.dir_projects.menu.new')
304
330
  )
305
- sub_new.extend(TkAutoPostMenu)
306
- sub_new.configure(Arcadia.style('menu'))
331
+ #sub_new.extend(TkAutoPostMenu)
332
+ #sub_new.configure(Arcadia.style('menu'))
307
333
  sub_new.insert('end',
308
334
  :command,
309
335
  :label=>Arcadia.text('ext.dir_projects.menu.new_dir_proj'),
@@ -343,13 +369,14 @@ class DirProjects < ArcadiaExtPlus
343
369
  )
344
370
  #-----------------
345
371
  #----- refactor submenu
346
- sub_ref = TkMenu.new(
372
+ #sub_ref = TkMenu.new(
373
+ sub_ref = Arcadia.wf.menu(
347
374
  :parent=>@pop_up_tree,
348
375
  :tearoff=>0,
349
376
  :title => Arcadia.text('ext.dir_projects.menu.refactor')
350
377
  )
351
- sub_ref.extend(TkAutoPostMenu)
352
- sub_ref.configure(Arcadia.style('menu'))
378
+ #sub_ref.extend(TkAutoPostMenu)
379
+ #sub_ref.configure(Arcadia.style('menu'))
353
380
  sub_ref.insert('end',
354
381
  :command,
355
382
  :label=>Arcadia.text('ext.dir_projects.menu.refactor.rename'),
@@ -369,7 +396,8 @@ class DirProjects < ArcadiaExtPlus
369
396
  _selected = @htree.selected
370
397
  if _selected
371
398
  _idir = File.split(_selected)[0]
372
- _dir=Tk.chooseDirectory('initialdir'=>_idir,'mustexist'=>true)
399
+ #_dir=Tk.chooseDirectory('initialdir'=>_idir,'mustexist'=>true)
400
+ _dir=Arcadia.select_dir_dialog(_idir, true)
373
401
  do_move(_selected, _dir) if _dir && File.exists?(_dir)
374
402
  end
375
403
  }
@@ -383,13 +411,14 @@ class DirProjects < ArcadiaExtPlus
383
411
 
384
412
  #-----------------
385
413
  #----- search submenu
386
- sub_ref_search = TkMenu.new(
414
+ #sub_ref_search = TkMenu.new(
415
+ sub_ref_search = Arcadia.wf.menu(
387
416
  :parent=>@pop_up_tree,
388
417
  :tearoff=>0,
389
418
  :title => Arcadia.text('ext.dir_projects.menu.search')
390
419
  )
391
- sub_ref_search.extend(TkAutoPostMenu)
392
- sub_ref_search.configure(Arcadia.style('menu'))
420
+ #sub_ref_search.extend(TkAutoPostMenu)
421
+ #sub_ref_search.configure(Arcadia.style('menu'))
393
422
  sub_ref_search.insert('end',
394
423
  :command,
395
424
  :label=>Arcadia.text('ext.dir_projects.menu.search.find'),
@@ -498,7 +527,8 @@ class DirProjects < ArcadiaExtPlus
498
527
  end
499
528
 
500
529
  def do_search_files
501
- _target = @htree.selected
530
+ active_instance.do_search_files if active_instance != self
531
+ _target = @htree.selected || MonitorLastUsedDir.get_last_dir
502
532
  if _target
503
533
  _target = File.dirname(_target) if File.ftype(_target) == 'file'
504
534
  Arcadia.process_event(SearchInFilesEvent.new(self,'dir'=>_target))
@@ -506,7 +536,8 @@ class DirProjects < ArcadiaExtPlus
506
536
  end
507
537
 
508
538
  def do_open_term
509
- _target = @htree.selected
539
+ active_instance.do_open_term if active_instance != self
540
+ _target = @htree.selected || MonitorLastUsedDir.get_last_dir
510
541
  if _target
511
542
  _target = File.dirname(_target) if File.ftype(_target) == 'file'
512
543
  TermEvent.new(self,'dir'=>_target, 'title'=>_target).go!
@@ -557,8 +588,10 @@ class DirProjects < ArcadiaExtPlus
557
588
  # end
558
589
 
559
590
  def do_new_project(_parent_folder_node=nil)
591
+ active_instance.do_new_project if active_instance != self
560
592
  if _parent_folder_node.nil?
561
- _parent_folder_node=Tk.chooseDirectory 'initialdir' => MonitorLastUsedDir.get_last_dir
593
+ #_parent_folder_node=Tk.chooseDirectory 'initialdir' => MonitorLastUsedDir.get_last_dir
594
+ _parent_folder_node=Arcadia.select_dir_dialog(MonitorLastUsedDir.get_last_dir)
562
595
  end
563
596
  if _parent_folder_node && File.exists?(node2file(_parent_folder_node)) && File.ftype(node2file(_parent_folder_node)) == 'directory'
564
597
  tmp_node_name = "#{node2file(_parent_folder_node)}#{File::SEPARATOR}_new_project_"
@@ -584,8 +617,11 @@ class DirProjects < ArcadiaExtPlus
584
617
  end
585
618
 
586
619
  def do_open_project(_proj_name=nil)
620
+ active_instance.do_open_project if active_instance != self
621
+
587
622
  if _proj_name.nil?
588
- _proj_name=Tk.chooseDirectory 'initialdir' => MonitorLastUsedDir.get_last_dir
623
+ #_proj_name=Tk.chooseDirectory 'initialdir' => MonitorLastUsedDir.get_last_dir
624
+ _proj_name=Arcadia.select_dir_dialog(MonitorLastUsedDir.get_last_dir)
589
625
  add_project(_proj_name) if _proj_name && File.exists?(_proj_name)
590
626
  end
591
627
  end
@@ -935,11 +971,26 @@ class DirProjects < ArcadiaExtPlus
935
971
  del_project_from_file(_dir)
936
972
  end
937
973
 
938
-
974
+ def sort_files_name(_files=nil)
975
+ return if _files.nil?
976
+ sorted = []
977
+ names = []
978
+ files_hash = {}
979
+ _files.each{|file|
980
+ name = File.split(file)[1]
981
+ names << name
982
+ files_hash[name]=file
983
+ }
984
+ names.sort!
985
+ names.each{|n| sorted << files_hash[n]}
986
+ sorted
987
+ end
988
+
939
989
  def load_projects
940
990
  f = File::open(projects_file,'r')
941
991
  begin
942
992
  _lines = f.readlines.collect!{| line | line.chomp}
993
+ _lines = sort_files_name(_lines)
943
994
  ensure
944
995
  f.close unless f.nil?
945
996
  end
@@ -983,7 +1034,6 @@ class DirProjects < ArcadiaExtPlus
983
1034
  begin
984
1035
  _lines.each{|_line|
985
1036
  if _line != _project
986
- p _line
987
1037
  f.syswrite(_line+"\n")
988
1038
  end
989
1039
  }
@@ -23,12 +23,12 @@ tabs.side=top
23
23
  complete-code=yes
24
24
  close-last-if-not-modified=yes
25
25
  max-file-open=3 #TODO
26
- use-tabs=yes
26
+ use-tabs=no
27
27
  explorer_panel.tabs.side=top
28
28
 
29
29
  #:::::::::::::::: Editor group ::::::::::::::::::::::<end>
30
30
  popup.bind.shortcut=Button-3
31
- arm::popup.bind.shortcut=F4
31
+ ARM::popup.bind.shortcut=F4
32
32
  #keybinding.Control-Shift-KeyPress[Y]=ActionEvent.new(self,'action'=>close_raised)
33
33
 
34
34
  # menu items
@@ -96,20 +96,12 @@ class SourceStructure
96
96
 
97
97
  end
98
98
 
99
- class CtagsSourceStructure < SourceStructure
100
- SUPPORTED_LANG = ['Ant','Asm','Asp','Awk','Basic','BETA','C','C++','C#','Cobol','DosBatch','Eiffel','Erlang','Flex','Fortran','HTML','Java','JavaScript','Lisp','Lua','Make','MatLab','OCaml','Pascal','Perl','PHP','Python','REXX','Ruby','Scheme','Sh','SLang','SML','SQL','Tcl','Tex','Vera','Verilog','VHDL','Vim','YACC']
101
- def initialize(_file, _ctags_string='ctags', _row_rif = nil, _language=nil)
99
+ class FileSourceStructure < SourceStructure
100
+ def initialize(_file, _row_rif = nil)
102
101
  super()
103
102
  @file = _file
104
- @ctags_string = _ctags_string
105
- @language = (_language.nil?)?nil:_language.capitalize
106
- @classes = Hash.new
107
- @last_root = @root
108
- @last_class_node = @root
109
- @last_node = @root
110
- @blank_rows = []
103
+ @blank_rows = []
111
104
  initialize_blank_rows(_row_rif) if !_row_rif.nil?
112
- build_structure
113
105
  end
114
106
 
115
107
  def initialize_blank_rows(_row = nil)
@@ -120,6 +112,163 @@ class CtagsSourceStructure < SourceStructure
120
112
  }
121
113
  @blank_rows << _row if _row
122
114
  end
115
+
116
+ end
117
+
118
+ module RubySourceStructureUtils
119
+ attr_reader :injected_row
120
+ def scheletor_from_node(_node, _source='', _injected_source='', _injected_class='')
121
+ _hinner_source = ''
122
+ #_sons = _node.sons.sort
123
+ _sons = _node.sons
124
+ for inode in 0.._sons.length - 1
125
+ _son = _sons[inode]
126
+ if _son.kind == 'class'
127
+ _hinner_source = "#{_hinner_source}#{_son.helptext}\n"
128
+ elsif _son.kind == 'module'
129
+ _hinner_source = "#{_hinner_source}#{_son.helptext}\n"
130
+ elsif _son.kind == 'method' && ((_son.label != 'initialize') || (_son.label == 'initialize') && _son.args)
131
+ _hinner_source = "#{_hinner_source} def #{_son.label}#{_son.args}\n"
132
+ _hinner_source = "#{_hinner_source} end\n"
133
+ elsif _son.kind == 'singleton method'
134
+ _hinner_source = "#{_hinner_source} def #{_son.label}\n"
135
+ _hinner_source = "#{_hinner_source} end\n"
136
+ end
137
+ _hinner_source= scheletor_from_node(_son, _hinner_source, _injected_source, _injected_class)
138
+ end
139
+ _source = "#{_source}#{_hinner_source}" if _hinner_source.strip.length>0
140
+ if _node.kind == 'class' && _node.label == _injected_class
141
+ _source = "#{_source} def initialize\n #{_injected_source} end\n"
142
+ @injected_row = _source.split("\n").length-2
143
+ elsif _node.kind == 'class'
144
+ _source = "#{_source} def initialize\n end\n"
145
+ end
146
+ _source = "#{_source}end\n" if _node.kind == 'class' || _node.kind == 'module'
147
+ _source
148
+ end
149
+ end
150
+
151
+ class RubyGrepFileSourceStructure < FileSourceStructure
152
+ include RubySourceStructureUtils
153
+ def initialize(_file, _row_rif = nil)
154
+ super(_file, _row_rif)
155
+ @last_class_node = @root
156
+ @last_node = @root
157
+ @last_end_node_row = 0
158
+ @last_class_node_row = 0
159
+ @last_end_indentation = 0
160
+ @last_class_indentation = 0
161
+ build_structure
162
+ end
163
+
164
+ def build_structure
165
+ output = grep
166
+ output.each {|line|
167
+ row, other = line.split(':')
168
+
169
+ indent = 0
170
+ l0 = other.length
171
+ if l0 > 0
172
+ indent = l0 - other.lstrip.length
173
+ end
174
+
175
+ other.strip! if other
176
+ key_word, other = other.split
177
+ other.strip! if other
178
+ next if !['class','module','def','end'].include?(key_word)
179
+ if key_word == 'end'
180
+ @last_end_node_row = row
181
+ @last_end_indentation = indent
182
+ next
183
+ end
184
+ # hinner class
185
+ if ['class','module','def'].include?(key_word) && @last_class_node != @root && @last_class_node.parent != @root && ((@last_class_indentation.to_i - @last_end_indentation.to_i).abs <= 1)
186
+ @last_class_node = @last_class_node.parent
187
+ @last_class_node_row = row
188
+ end
189
+ # kind
190
+ if ['class','module'].include?(key_word)
191
+ kind = key_word
192
+ if @last_end_node_row.to_i > @last_class_node_row.to_i || @last_class_node == @root
193
+ parent = @root
194
+ else
195
+ parent = @last_class_node
196
+ @last_class_indentation = indent
197
+ end
198
+ elsif ['def'].include?(key_word)
199
+ kind = 'method'
200
+ parent = @last_class_node
201
+ end
202
+ #name
203
+ name = other.split('(')[0].strip
204
+ next if name == '<<' && kind == 'class'
205
+ #helptext
206
+ helptext = line.strip
207
+ #singleton
208
+ if kind == 'method' && name.split('.')[0] == parent.label
209
+ kind = 'singleton method'
210
+ name = name.sub("#{parent.label}.",'')
211
+ end
212
+ # create node
213
+ node = SourceTreeNode.new(parent, kind)
214
+ node.label = name
215
+ node.helptext = helptext
216
+ node.args = ''
217
+ node.rif = row
218
+ ln_rif = node.rif.to_i - 1
219
+ while @blank_rows.include?(ln_rif) && ln_rif > 0
220
+ ln_rif = ln_rif - 1
221
+ end
222
+ @last_node.rif_end = ln_rif.to_s
223
+
224
+ if ['class','module'].include?(key_word)
225
+ @last_class_node = node
226
+ @last_class_node_row = row
227
+ end
228
+ node.sortable = true
229
+ @last_node = node
230
+ }
231
+ end
232
+
233
+ def grep
234
+ _cmd_ = "|grep -nE '^class\s|\sclass\s|^module\s|\smodule\s|^def\s|\sdef\s|^end\s|\send\s|^end$|\send$' #{@file}"
235
+ to_ret = ''
236
+ begin
237
+ open(_cmd_, "r"){|f|
238
+ to_ret = f.readlines
239
+ }
240
+ rescue RuntimeError => e
241
+ Arcadia.runtime_error(e)
242
+ end
243
+ to_ret
244
+ end
245
+ end
246
+
247
+
248
+ class CtagsFileSourceStructure < FileSourceStructure
249
+ SUPPORTED_LANG = ['Ant','Asm','Asp','Awk','Basic','BETA','C','C++','C#','Cobol','DosBatch','Eiffel','Erlang','Flex','Fortran','HTML','Java','JavaScript','Lisp','Lua','Make','MatLab','OCaml','Pascal','Perl','PHP','Python','REXX','Ruby','Scheme','Sh','SLang','SML','SQL','Tcl','Tex','Vera','Verilog','VHDL','Vim','YACC']
250
+ def initialize(_file, _ctags_string='ctags', _row_rif = nil, _language=nil)
251
+ super(_file, _row_rif)
252
+ #@file = _file
253
+ @ctags_string = _ctags_string
254
+ @language = (_language.nil?)?nil:_language.capitalize
255
+ @classes = Hash.new
256
+ @last_root = @root
257
+ @last_class_node = @root
258
+ @last_node = @root
259
+ #@blank_rows = []
260
+ #initialize_blank_rows(_row_rif) if !_row_rif.nil?
261
+ build_structure
262
+ end
263
+
264
+ # def initialize_blank_rows(_row = nil)
265
+ # File::open(@file,'rb'){ |file|
266
+ # file.readlines.each_with_index{| line, i |
267
+ # @blank_rows << i+1 if line.strip == ''
268
+ # }
269
+ # }
270
+ # @blank_rows << _row if _row
271
+ # end
123
272
 
124
273
  def build_structure
125
274
  output = ctags
@@ -187,47 +336,17 @@ class CtagsSourceStructure < SourceStructure
187
336
  end
188
337
  end
189
338
 
339
+ class RubyCtagsFileSourceStructure < CtagsFileSourceStructure
340
+ include RubySourceStructureUtils
190
341
 
191
- class RubyCtagsSourceStructure < CtagsSourceStructure
192
- attr_reader :injected_row
193
-
194
342
  def initialize(_file, _ctags_string='ctags', _row_rif = nil)
195
343
  super(_file, _ctags_string, _row_rif, 'Ruby')
196
344
  end
197
-
198
- def scheletor_from_node(_node, _source='', _injected_source='', _injected_class='')
199
- _hinner_source = ''
200
- #_sons = _node.sons.sort
201
- _sons = _node.sons
202
- for inode in 0.._sons.length - 1
203
- _son = _sons[inode]
204
- if _son.kind == 'class'
205
- _hinner_source = "#{_hinner_source}#{_son.helptext}\n"
206
- elsif _son.kind == 'module'
207
- _hinner_source = "#{_hinner_source}#{_son.helptext}\n"
208
- elsif _son.kind == 'method' && ((_son.label != 'initialize') || (_son.label == 'initialize') && _son.args)
209
- _hinner_source = "#{_hinner_source} def #{_son.label}#{_son.args}\n"
210
- _hinner_source = "#{_hinner_source} end\n"
211
- elsif _son.kind == 'singleton method'
212
- _hinner_source = "#{_hinner_source} def #{_son.label}\n"
213
- _hinner_source = "#{_hinner_source} end\n"
214
- end
215
- _hinner_source= scheletor_from_node(_son, _hinner_source, _injected_source, _injected_class)
216
- end
217
- _source = "#{_source}#{_hinner_source}" if _hinner_source.strip.length>0
218
- if _node.kind == 'class' && _node.label == _injected_class
219
- _source = "#{_source} def initialize\n #{_injected_source} end\n"
220
- @injected_row = _source.split("\n").length-2
221
- elsif _node.kind == 'class'
222
- _source = "#{_source} def initialize\n end\n"
223
- end
224
- _source = "#{_source}end\n" if _node.kind == 'class' || _node.kind == 'module'
225
- _source
226
- end
227
345
  end
228
346
 
229
- class RubySourceStructure < SourceStructure
230
- attr_reader :injected_row
347
+ class RubySourceStructureParser < SourceStructure
348
+ include RubySourceStructureUtils
349
+ # attr_reader :injected_row
231
350
 
232
351
  def initialize(_source)
233
352
  super()
@@ -331,45 +450,46 @@ class RubySourceStructure < SourceStructure
331
450
  end
332
451
 
333
452
 
334
- def scheletor_from_node(_node, _source='', _injected_source='', _injected_class='')
335
- _hinner_source = ''
336
- #_sons = _node.sons.sort
337
- _sons = _node.sons
338
- for inode in 0.._sons.length - 1
339
- _son = _sons[inode]
340
- if _son.kind == 'class'
341
- _hinner_source = "#{_hinner_source}class #{_son.helptext}\n"
342
- elsif _son.kind == 'module'
343
- _hinner_source = "#{_hinner_source}module #{_son.helptext}\n"
344
- elsif _son.kind == 'method' && _son.helptext != 'initialize'
345
-
346
- _hinner_source = "#{_hinner_source} def #{_son.helptext}\n"
347
- _hinner_source = "#{_hinner_source} end\n"
348
- elsif _son.kind == 'singleton method'
349
- _hinner_source = "#{_hinner_source} def #{_son.helptext}\n"
350
- _hinner_source = "#{_hinner_source} end\n"
351
- end
352
- _hinner_source= scheletor_from_node(_son, _hinner_source, _injected_source, _injected_class)
353
- end
354
- _source = "#{_source}#{_hinner_source}" if _hinner_source.strip.length>0
355
- if _node.kind == 'class' && _node.label == _injected_class
356
- _source = "#{_source} def initialize\n #{_injected_source} end\n"
357
- @injected_row = _source.split("\n").length-2
358
- end
359
- _source = "#{_source}end\n" if _node.kind == 'class' || _node.kind == 'module'
360
- _source
361
- end
362
-
363
-
364
- def classies
365
- end
366
- def modules
367
- end
368
- def class_methods(_class)
369
- end
453
+ # def scheletor_from_node(_node, _source='', _injected_source='', _injected_class='')
454
+ # _hinner_source = ''
455
+ # #_sons = _node.sons.sort
456
+ # _sons = _node.sons
457
+ # for inode in 0.._sons.length - 1
458
+ # _son = _sons[inode]
459
+ # if _son.kind == 'class'
460
+ # _hinner_source = "#{_hinner_source}class #{_son.helptext}\n"
461
+ # elsif _son.kind == 'module'
462
+ # _hinner_source = "#{_hinner_source}module #{_son.helptext}\n"
463
+ # elsif _son.kind == 'method' && _son.helptext != 'initialize'
464
+ #
465
+ # _hinner_source = "#{_hinner_source} def #{_son.helptext}\n"
466
+ # _hinner_source = "#{_hinner_source} end\n"
467
+ # elsif _son.kind == 'singleton method'
468
+ # _hinner_source = "#{_hinner_source} def #{_son.helptext}\n"
469
+ # _hinner_source = "#{_hinner_source} end\n"
470
+ # end
471
+ # _hinner_source= scheletor_from_node(_son, _hinner_source, _injected_source, _injected_class)
472
+ # end
473
+ # _source = "#{_source}#{_hinner_source}" if _hinner_source.strip.length>0
474
+ # if _node.kind == 'class' && _node.label == _injected_class
475
+ # _source = "#{_source} def initialize\n #{_injected_source} end\n"
476
+ # @injected_row = _source.split("\n").length-2
477
+ # end
478
+ # _source = "#{_source}end\n" if _node.kind == 'class' || _node.kind == 'module'
479
+ # _source
480
+ # end
481
+ #
482
+ #
483
+ # def classies
484
+ # end
485
+ # def modules
486
+ # end
487
+ # def class_methods(_class)
488
+ # end
370
489
  end
371
490
 
372
491
  class CompleteCode
492
+ LEFT_CHARS=['"','(','[','{',"'",'=','>','<',"\\","/",":","+","-"]
373
493
  attr_reader :filter
374
494
  def initialize(_editor, _row, _col)
375
495
  @editor = _editor
@@ -382,6 +502,8 @@ class CompleteCode
382
502
  end
383
503
 
384
504
  def focus_word(focus_segment)
505
+ focus_segment_parts = focus_segment.split
506
+ focus_segment = focus_segment_parts[-1] if focus_segment_parts && focus_segment_parts.length > 1
385
507
  focus_world = ''
386
508
  char = focus_segment[-1..-1]
387
509
  while [")","]","}"].include?(char)
@@ -389,7 +511,8 @@ class CompleteCode
389
511
  focus_segment = focus_segment[0..-2]
390
512
  end
391
513
  j = focus_segment.length - 1
392
- while !["\s","\t",";",",","(","[","{",">"].include?(char) && j >= 0
514
+
515
+ while !LEFT_CHARS.include?(char) && j >= 0
393
516
  focus_world = "#{char}#{focus_world}"
394
517
  j=j-1
395
518
  char = focus_segment[j..j]
@@ -433,14 +556,14 @@ class CompleteCode
433
556
 
434
557
  def refresh_words
435
558
  @words.clear
436
- _re = /[\s\t\n"'(\[\{=><]#{@filter}[a-zA-Z0-9\-_]*/
559
+ _re = /[\s\t\n"'(\[\{=><\\\/\:\+\-]#{@filter}[a-zA-Z0-9\-_]*/
437
560
  m = _re.match(@source)
438
561
  while m && (_txt=m.post_match)
439
562
  can = m[0].strip
440
563
  if can.include?(' ')
441
564
  can = can.split[1].strip
442
565
  end
443
- if ['"','(','[','{',"'",'=','>','<'].include?(can[0..0])
566
+ if LEFT_CHARS.include?(can[0..0])
444
567
  can = can[1..-1].strip
445
568
  end
446
569
  @words << can if can != @filter && !@words.include?(can)
@@ -474,15 +597,19 @@ class RubyCompleteCode < CompleteCode
474
597
  # @row = _row.to_i
475
598
  # @col = _col.to_i
476
599
  super
477
- if _editor && _editor.has_ctags?
600
+ if _editor && (_editor.has_ctags? || OS.unix?)
478
601
  tmp_file = _editor.create_temp_file
479
602
  begin
480
- @ss = RubyCtagsSourceStructure.new(tmp_file, _editor.ctags_string, _row.to_i)
603
+ if _editor.has_ctags?
604
+ @ss = RubyCtagsFileSourceStructure.new(tmp_file, _editor.ctags_string, _row.to_i)
605
+ elsif OS.unix?
606
+ @ss = RubyGrepFileSourceStructure.new(tmp_file, _row.to_i)
607
+ end
481
608
  ensure
482
609
  File.delete(tmp_file)
483
610
  end
484
611
  else
485
- @ss = RubySourceStructure.new(@source)
612
+ @ss = RubySourceStructureParser.new(@source)
486
613
  end
487
614
  # @filter=''
488
615
  # @words = Array.new
@@ -781,11 +908,12 @@ end
781
908
 
782
909
 
783
910
  class TkTextListBox < TkText
911
+ SEP = '@@@'
784
912
  def initialize(parent=nil, keys={})
785
913
  super(parent, keys)
786
914
  wrap 'none'
787
915
  tag_configure('selected','background' =>Arcadia.conf('hightlight.sel.background'),'borderwidth'=>1, 'relief'=>'raised')
788
- tag_configure('class', 'foreground' => Arcadia.conf('hightlight.sel.foreground'))
916
+ tag_configure('class', 'foreground' => Arcadia.conf('hightlight.class_variable.foreground'))
789
917
  @count = 0
790
918
  @selected = -1
791
919
  self.bind_append('KeyPress'){|e| key_press(e)}
@@ -793,20 +921,23 @@ class TkTextListBox < TkText
793
921
  self.bind_append("ButtonPress-1", proc{|x,y| button_press(x,y)}, "%x %y")
794
922
  end
795
923
 
924
+ def length
925
+ @count
926
+ end
796
927
 
797
928
  def insert(index, chars, *tags)
798
929
  super(index, chars, *tags)
799
930
  end
800
931
 
801
- def add(chars)
802
- meth_str, class_str = chars.split('-')
932
+ def add(chars, *tags)
933
+ meth_str, class_str = chars.split(TkTextListBox::SEP)
803
934
  if meth_str && meth_str.strip.length>0 && class_str
804
935
  insert('end', "#{meth_str}")
805
936
  insert('end', "-#{class_str}\n", 'class')
806
937
  elsif meth_str && meth_str.strip.length==0 && class_str
807
938
  insert('end', "-#{class_str}\n")
808
939
  else
809
- insert('end', "#{chars}\n")
940
+ insert('end', "#{chars}\n", *tags)
810
941
  end
811
942
  @count = @count+1
812
943
  end
@@ -867,16 +998,25 @@ class AgEditorOutlineToolbar
867
998
  def initialize(_controller)
868
999
  @controller = _controller
869
1000
  @panel = @controller.main_instance.frame(1).root.add_panel(@controller.main_instance.frame(1).name, "sync");
870
- @cb_sync = TkCheckButton.new(@panel, Arcadia.style('checkbox').update('background'=>@panel.background)){
871
- text 'Sync'
872
- justify 'left'
873
- indicatoron 0
874
- offrelief 'flat'
1001
+ # @cb_sync = TkCheckButton.new(@panel, Arcadia.style('checkbox').update('background'=>@panel.background)){
1002
+ # text 'Sync'
1003
+ # justify 'left'
1004
+ # indicatoron 0
1005
+ # offrelief 'flat'
1006
+ # image Arcadia.image_res(SYNC_GIF)
1007
+ # pack
1008
+ # }
1009
+ # Tk::BWidget::DynamicHelp::add(@cb_sync,
1010
+ # 'text'=> Arcadia.text('ext.editor.button.link.hint'))
1011
+
1012
+ @cb_sync = Arcadia.wf.titlecontextcheckbutton(@panel){
1013
+ variable TkVariable.new
875
1014
  image Arcadia.image_res(SYNC_GIF)
876
1015
  pack
877
- }
878
- Tk::BWidget::DynamicHelp::add(@cb_sync,
879
- 'text'=> Arcadia.text('ext.editor.button.link.hint'))
1016
+ }
1017
+
1018
+ @cb_sync.hint=Arcadia.text('ext.editor.button.link.hint')
1019
+
880
1020
 
881
1021
  do_check = proc {
882
1022
  if @cb_sync.cget('onvalue')==@cb_sync.cget('variable').value.to_i
@@ -976,6 +1116,8 @@ class AgEditorOutline
976
1116
  end
977
1117
  @tree_exp.close_tree(to_open) if _close_if_opened && to_open && !@opened
978
1118
  @tree_exp.see(_node.rif)
1119
+ rescue RuntimeError => e
1120
+ Arcadia.runtime_error(e)
979
1121
  ensure
980
1122
  @tree_exp.selectcommand(_proc)
981
1123
  @selecting_node = false
@@ -1044,6 +1186,8 @@ class AgEditorOutline
1044
1186
  crossopenimage Arcadia.image_res(ARROWDOWN_GIF)
1045
1187
  }
1046
1188
  @tree_exp.extend(TkScrollableWidget)
1189
+ @tree_exp.bind_append("Enter", proc{@tree_exp.focus})
1190
+
1047
1191
  self.show
1048
1192
  pop_up_menu_tree
1049
1193
  end
@@ -1084,13 +1228,15 @@ class AgEditorOutline
1084
1228
  elsif _son.kind == 'singleton method'
1085
1229
  _image = @image_singleton_method
1086
1230
  end
1087
- @tree_exp.insert('end', _son.parent.rif ,_son.rif, {
1088
- 'text' => _son.label ,
1089
- 'helptext' => _son.helptext,
1090
- #'font'=>$arcadia['conf']['editor.explorer_panel.tree.font'],
1091
- 'image'=> _image
1092
- }.update(Arcadia.style('treeitem'))
1231
+ if !@tree_exp.exist?(_son.rif)
1232
+ @tree_exp.insert('end', _son.parent.rif ,_son.rif, {
1233
+ 'text' => _son.label ,
1234
+ 'helptext' => _son.helptext,
1235
+ #'font'=>$arcadia['conf']['editor.explorer_panel.tree.font'],
1236
+ 'image'=> _image
1237
+ }.update(Arcadia.style('treeitem'))
1093
1238
  )
1239
+ end
1094
1240
  if (_label_match) && (_label_match.strip == _son.label.strip)
1095
1241
  @selected = _son
1096
1242
  end
@@ -1112,19 +1258,27 @@ class AgEditorOutline
1112
1258
  @tree_exp.delete(@tree_exp.nodes('root'))
1113
1259
  end
1114
1260
  _txt = @editor.text.get('1.0','end')
1115
- if @editor.has_ctags?
1261
+ if @editor.has_ctags? || (OS.unix? && @lang == 'ruby')
1116
1262
  if @editor.file && !@editor.modified?
1117
- @ss = CtagsSourceStructure.new(@editor.file, @editor.ctags_string)
1263
+ if @editor.has_ctags?
1264
+ @ss = CtagsFileSourceStructure.new(@editor.file, @editor.ctags_string)
1265
+ elsif OS.unix?
1266
+ @ss = RubyGrepFileSourceStructure.new(@editor.file)
1267
+ end
1118
1268
  else
1119
1269
  tmp_file = @editor.create_temp_file
1120
1270
  begin
1121
- @ss = CtagsSourceStructure.new(tmp_file, @editor.ctags_string, @lang)
1271
+ if @editor.has_ctags?
1272
+ @ss = CtagsFileSourceStructure.new(tmp_file, @editor.ctags_string, @lang)
1273
+ elsif OS.unix?
1274
+ @ss = RubyGrepFileSourceStructure.new(tmp_file)
1275
+ end
1122
1276
  ensure
1123
1277
  File.delete(tmp_file)
1124
1278
  end
1125
1279
  end
1126
1280
  else
1127
- @ss = RubySourceStructure.new(_txt)
1281
+ @ss = RubySourceStructureParser.new(_txt)
1128
1282
  end
1129
1283
  @selected = nil
1130
1284
  build_tree_from_node(@ss.root, _label_sel)
@@ -1136,14 +1290,15 @@ class AgEditorOutline
1136
1290
  end
1137
1291
 
1138
1292
  def pop_up_menu_tree
1139
- @pop_up_tree = TkMenu.new(
1293
+ #@pop_up_tree = TkMenu.new(
1294
+ @pop_up_tree = Arcadia.wf.menu(
1140
1295
  :parent=>@tree_exp,
1141
1296
  :tearoff=>0,
1142
1297
  :title => 'Menu tree'
1143
1298
  )
1144
- @pop_up_tree.extend(TkAutoPostMenu)
1145
- @pop_up_tree.configure(Arcadia.style('menu'))
1146
- #Arcadia.instance.main_menu.update_style(@pop_up_tree)
1299
+ # @pop_up_tree.extend(TkAutoPostMenu)
1300
+ # @pop_up_tree.configure(Arcadia.style('menu'))
1301
+
1147
1302
  @pop_up_tree.insert('end',
1148
1303
  :command,
1149
1304
  :label=> Arcadia.text('ext.editor.outline.menu.rebuild'),
@@ -1163,6 +1318,7 @@ end
1163
1318
 
1164
1319
  class AgEditor
1165
1320
  attr_accessor :file
1321
+ attr_accessor :start_index
1166
1322
  attr_accessor :line_numbers_visible
1167
1323
  attr_accessor :id
1168
1324
  attr_reader :read_only
@@ -1172,7 +1328,9 @@ class AgEditor
1172
1328
  attr_reader :last_tmp_file
1173
1329
  attr_reader :lang
1174
1330
  attr_reader :file_info
1175
- attr_reader :outline
1331
+ attr_reader :outline
1332
+ attr_reader :file_loaded
1333
+ attr_reader :edit_initialized
1176
1334
  def initialize(_controller, _page_frame)
1177
1335
  @controller = _controller
1178
1336
  @page_frame = _page_frame
@@ -1193,6 +1351,9 @@ class AgEditor
1193
1351
  @line_numbers_visible = @controller.conf('line-numbers') == 'yes'
1194
1352
  @id = -1
1195
1353
  @file_info = Hash.new
1354
+ @file_loaded = false
1355
+ @edit_initialized = false
1356
+ @start_index='1.0'
1196
1357
  end
1197
1358
 
1198
1359
  def set_controller(_controller)
@@ -1207,14 +1368,14 @@ class AgEditor
1207
1368
  !@highlighting || (@last_line_end && @last_line_end > 0)
1208
1369
  end
1209
1370
 
1210
-
1211
-
1212
1371
  def show_line_numbers
1213
1372
  if !@line_numbers_visible
1214
1373
  #@fm1.hide_right
1215
1374
  @fm1.show_left
1216
1375
  @line_numbers_visible = true
1217
1376
  do_line_update
1377
+ @need_recalc=true
1378
+ resize_line_num
1218
1379
  end
1219
1380
  end
1220
1381
 
@@ -1290,6 +1451,7 @@ class AgEditor
1290
1451
  Arcadia.runtime_error(e)
1291
1452
  #p "RuntimeError : #{e.message}"
1292
1453
  end
1454
+ @edit_initialized = true
1293
1455
  end
1294
1456
 
1295
1457
  def create_temp_file
@@ -1506,7 +1668,7 @@ class AgEditor
1506
1668
  end
1507
1669
 
1508
1670
  if _key && _class && _key.strip.length > 0 && _class.strip.length > 0
1509
- _item = "#{_key.strip} - #{_class.strip}"
1671
+ _item = "#{_key.strip} #{TkTextListBox::SEP} #{_class.strip}"
1510
1672
  elsif _key && _key.strip.length > 0
1511
1673
  _item = "#{_key.strip}"
1512
1674
  else
@@ -1538,7 +1700,12 @@ class AgEditor
1538
1700
  @raised_listbox_frame.destroy
1539
1701
  #_menu.destroy
1540
1702
  @text.focus
1541
- @text.delete("#{begin_index_for_complete} wordstart",'insert')
1703
+ if @text.get("#{begin_index_for_complete} linestart", "#{begin_index_for_complete} wordstart").strip == "" ||
1704
+ @text.get("#{begin_index_for_complete} wordstart", "#{begin_index_for_complete} wordstart + 1 chars") != " "
1705
+ @text.delete("#{begin_index_for_complete} wordstart",'insert')
1706
+ else
1707
+ @text.delete("#{begin_index_for_complete} wordstart + 1 chars",'insert')
1708
+ end
1542
1709
  # workaround for @ char
1543
1710
  _value = _value.strip
1544
1711
  if _value[0..0] !=_target[0..0] && _value[1..1] == _target[0..0]
@@ -1746,7 +1913,9 @@ class AgEditor
1746
1913
  else
1747
1914
  _dir = MonitorLastUsedDir.get_last_dir
1748
1915
  end
1749
- Arcadia.process_event(OpenBufferEvent.new(self,'file'=>Tk.getOpenFile('initialdir'=>_dir)))
1916
+ _file = Arcadia.open_file_dialog(_dir)
1917
+ Arcadia.process_event(OpenBufferEvent.new(self,'file'=>_file)) if _file
1918
+ Tk.callback_break
1750
1919
  break
1751
1920
  when 's'
1752
1921
  save
@@ -1958,7 +2127,7 @@ class AgEditor
1958
2127
  if _r.length>0
1959
2128
  _text=@text.get(_r[0][0],_r[0][1])
1960
2129
  if _text.length > 0
1961
- @controller.get_find.e_what.text(_text)
2130
+ @controller.get_find.e_what.value=_text
1962
2131
  end
1963
2132
  else
1964
2133
  end
@@ -1977,6 +2146,8 @@ class AgEditor
1977
2146
 
1978
2147
  def do_enter
1979
2148
  check_file_last_access_time
2149
+ find = @controller.get_find
2150
+ find.use(self) if find
1980
2151
  end
1981
2152
 
1982
2153
  def initialize_text_binding
@@ -2067,6 +2238,10 @@ class AgEditor
2067
2238
  },
2068
2239
  "%x %y")
2069
2240
 
2241
+ @text_line_num_resized = false
2242
+ @text_line_num.bind("Map", proc{resize_line_num if !@text_line_num_resized })
2243
+
2244
+
2070
2245
  #@text_line_num.configure('font', @font);
2071
2246
  @text_line_num.tag_configure('line_num',
2072
2247
  'foreground' => '#FFFFFF',
@@ -2076,13 +2251,14 @@ class AgEditor
2076
2251
  )
2077
2252
 
2078
2253
  #--- menu
2079
- _pop_up = TkMenu.new(
2254
+ # _pop_up = TkMenu.new(
2255
+ _pop_up = Arcadia.wf.menu(
2080
2256
  :parent=>@text_line_num,
2081
2257
  :tearoff=>0,
2082
2258
  :title => 'Menu'
2083
2259
  )
2084
- _pop_up.extend(TkAutoPostMenu)
2085
- _pop_up.configure(Arcadia.style('menu'))
2260
+ #_pop_up.extend(TkAutoPostMenu)
2261
+ #_pop_up.configure(Arcadia.style('menu'))
2086
2262
  #Arcadia.instance.main_menu.update_style(@pop_up)
2087
2263
  _title_item = _pop_up.insert('end',
2088
2264
  :command,
@@ -2129,7 +2305,7 @@ class AgEditor
2129
2305
 
2130
2306
  _pop_up.popup(_x,_y)
2131
2307
  })
2132
-
2308
+
2133
2309
  end
2134
2310
 
2135
2311
  def file_line_to_text_line_num_line(_line)
@@ -2341,13 +2517,14 @@ class AgEditor
2341
2517
  end
2342
2518
 
2343
2519
  def pop_up_menu
2344
- @pop_up = TkMenu.new(
2520
+ #@pop_up = TkMenu.new(
2521
+ @pop_up = Arcadia.wf.menu(
2345
2522
  :parent=>@text,
2346
2523
  :tearoff=>0,
2347
2524
  :title => 'Menu'
2348
2525
  )
2349
- @pop_up.extend(TkAutoPostMenu)
2350
- @pop_up.configure(Arcadia.style('menu'))
2526
+ #@pop_up.extend(TkAutoPostMenu)
2527
+ #@pop_up.configure(Arcadia.style('menu'))
2351
2528
 
2352
2529
  @pop_up.insert('end',
2353
2530
  :command,
@@ -2527,7 +2704,8 @@ class AgEditor
2527
2704
  if _r.length>0
2528
2705
  _data=@text.get(_r[0][0],_r[0][1])
2529
2706
  if _data.length > 0
2530
- file = Tk.getSaveFile("filetypes"=>[["Image", [".gif"]],["All Files", [".*"]]])
2707
+ file = Arcadia.save_file_dialog
2708
+ #Tk.getSaveFile("filetypes"=>[["Image", [".gif"]],["All Files", [".*"]]])
2531
2709
  if file
2532
2710
  require 'base64'
2533
2711
  decoded = Base64.decode64(_data)
@@ -2548,13 +2726,14 @@ class AgEditor
2548
2726
  @pop_up.insert('end', :separator)
2549
2727
 
2550
2728
  #---- debug menu
2551
- _sub_debug = TkMenu.new(
2729
+ #_sub_debug = TkMenu.new(
2730
+ _sub_debug = Arcadia.wf.menu(
2552
2731
  :parent=>@pop_up,
2553
2732
  :tearoff=>0,
2554
2733
  :title => 'Debug'
2555
2734
  )
2556
- _sub_debug.extend(TkAutoPostMenu)
2557
- _sub_debug.configure(Arcadia.style('menu'))
2735
+ #_sub_debug.extend(TkAutoPostMenu)
2736
+ #_sub_debug.configure(Arcadia.style('menu'))
2558
2737
  _sub_debug.insert('end',
2559
2738
  :command,
2560
2739
  :label=>Arcadia.text('ext.editor.text.menu.eval_selected'),
@@ -2580,13 +2759,14 @@ class AgEditor
2580
2759
 
2581
2760
 
2582
2761
  #---- code menu
2583
- _sub_code = TkMenu.new(
2762
+ #_sub_code = TkMenu.new(
2763
+ _sub_code = Arcadia.wf.menu(
2584
2764
  :parent=>@pop_up,
2585
2765
  :tearoff=>0,
2586
2766
  :title => 'Code'
2587
2767
  )
2588
- _sub_code.extend(TkAutoPostMenu)
2589
- _sub_code.configure(Arcadia.style('menu'))
2768
+ #_sub_code.extend(TkAutoPostMenu)
2769
+ #_sub_code.configure(Arcadia.style('menu'))
2590
2770
  _sub_code.insert('end',
2591
2771
  :command,
2592
2772
  :label=>Arcadia.text('ext.editor.text.menu.set_wrap'),
@@ -2959,7 +3139,7 @@ class AgEditor
2959
3139
 
2960
3140
  # modify in this instance means the (...) in the tab header of each file
2961
3141
  def modified?
2962
- return !(@buffer === text_value)
3142
+ return @text != nil && !(@buffer === text_value)
2963
3143
  end
2964
3144
 
2965
3145
  def set_modify
@@ -3014,6 +3194,21 @@ class AgEditor
3014
3194
  def zone_of_row(_row)
3015
3195
  ((_row) / @highlight_zone_length).to_i + 1
3016
3196
  end
3197
+
3198
+ def visible_line_begin
3199
+ line_begin_index = @text.index('@0,0')
3200
+ line_begin = line_begin_index.split('.')[0].to_i
3201
+ line_begin
3202
+ end
3203
+
3204
+ def visible_line_end
3205
+ line_end = @text.index('@0,'+TkWinfo.height(@text).to_s).split('.')[0].to_i + 1
3206
+ line_end
3207
+ end
3208
+
3209
+ def visible_lines
3210
+ visible_line_end - visible_line_begin
3211
+ end
3017
3212
 
3018
3213
  def do_line_update
3019
3214
  #re num in @text_line_num the portion of visibled screen of @text
@@ -3106,7 +3301,7 @@ class AgEditor
3106
3301
  @line_num_rx_e, @line_num_ry_e, @line_num_width_e, @line_num_heigth_e = @text_line_num.bbox("0.1 lineend - 1 chars");
3107
3302
  if @line_num_width_e.nil?
3108
3303
  @line_num_width_e = @font.split()[-1].strip.to_i
3109
- @need_recalc = true
3304
+ @need_recalc = true
3110
3305
  # linfo_x, linfo_y, linfo_w, linfo_h, linfo_b = @text_line_num.dlineinfo('0.1')
3111
3306
  # if linfo_w
3112
3307
  # @line_num_width_e = linfo_w.to_f/(line_end_chars+1.5)
@@ -3125,6 +3320,7 @@ class AgEditor
3125
3320
  @last_line_end_chars = -1
3126
3321
  end
3127
3322
  end
3323
+ @text_line_num_resized = true
3128
3324
  end
3129
3325
  end
3130
3326
 
@@ -3281,6 +3477,7 @@ class AgEditor
3281
3477
  save true
3282
3478
  end
3283
3479
  else
3480
+ mkdir_recursive(File.dirname(@file)) if !File.exists?(File.dirname(@file))
3284
3481
  f = File.new(@file, "wb")
3285
3482
  begin
3286
3483
  if f
@@ -3301,8 +3498,27 @@ class AgEditor
3301
3498
  end
3302
3499
  end
3303
3500
 
3501
+ def mkdir_recursive(_dir)
3502
+ dir_seg = _dir.split(File::SEPARATOR)
3503
+ incr_dir = ""
3504
+ res = ""
3505
+ 0.upto(dir_seg.length-1){|j|
3506
+ if res == File::SEPARATOR
3507
+ res=res+dir_seg[j]
3508
+ elsif res.length == 0 && dir_seg[j].length == 0
3509
+ res=File::SEPARATOR+dir_seg[j]
3510
+ elsif res.length == 0 && dir_seg[j].length > 0
3511
+ res=dir_seg[j]
3512
+ else
3513
+ res=res+File::SEPARATOR+dir_seg[j]
3514
+ end
3515
+ Dir.mkdir(res) if !File.exists?(res)
3516
+ }
3517
+ end
3518
+
3304
3519
  def save_as
3305
- file = Tk.getSaveFile("filetypes"=>[["Ruby Files", [".rb", ".rbw"]],["All Files", [".*"]]])
3520
+ file = Arcadia.save_file_dialog
3521
+ #Tk.getSaveFile("filetypes"=>[["Ruby Files", [".rb", ".rbw"]],["All Files", [".*"]]])
3306
3522
  file = nil if file == "" # cancelled
3307
3523
  if file
3308
3524
  new_file_name(file)
@@ -3370,9 +3586,8 @@ class AgEditor
3370
3586
  ftime = File.mtime(@file)
3371
3587
  if @file_info['mtime'] != ftime
3372
3588
  msg = Arcadia.text('ext.editor.text.d.file_changed.msg', [@file])
3373
- ans = Tk.messageBox('icon' => 'error', 'type' => 'yesno',
3374
- 'title' => Arcadia.text('ext.editor.text.d.file_changed.title'), 'parent' => @text,
3375
- 'message' => msg)
3589
+ title = Arcadia.text('ext.editor.text.d.file_changed.title')
3590
+ ans = Arcadia.hinner_dialog(self, 'type'=>'yes_no', 'msg'=> msg, 'title' => title, 'level' => 'error')
3376
3591
  if ans == 'yes'
3377
3592
  reload
3378
3593
  else
@@ -3381,9 +3596,8 @@ class AgEditor
3381
3596
  end
3382
3597
  elsif !file_exist
3383
3598
  msg = Arcadia.text('ext.editor.text.d.file_deleted.msg', [@file])
3384
- if Tk.messageBox('icon' => 'error', 'type' => 'yesno',
3385
- 'title' => Arcadia.text('ext.editor.text.d.file_deleted.title'), 'parent' => @text,
3386
- 'message' => msg) == 'yes'
3599
+ title = Arcadia.text('ext.editor.text.d.file_deleted.title')
3600
+ if Arcadia.hinner_dialog(self, 'type'=>'yes_no', 'msg'=> msg, 'title' => title, 'level' => 'error') == 'yes'
3387
3601
  save
3388
3602
  else
3389
3603
  @file = nil
@@ -3438,7 +3652,7 @@ class AgEditor
3438
3652
  # else
3439
3653
  # @fm1 = AGTkVSplittedFrames.new(@page_frame,_w2)
3440
3654
  # end
3441
- @fm1 = AGTkVSplittedFrames.new(@page_frame, @page_frame,0,5,false,false)
3655
+ @fm1 = AGTkVSplittedFrames.new(@page_frame, @page_frame,0,0,false,false)
3442
3656
  @fm1.splitter_frame.configure('relief'=>'flat')
3443
3657
  @fm1.bind_append("Enter", proc{@controller.activate})
3444
3658
  initialize_text(@fm1.right_frame)
@@ -3469,6 +3683,7 @@ class AgEditor
3469
3683
  def load_file(_filename = nil)
3470
3684
  #if filename is nil then open a new tab
3471
3685
  @loading=true
3686
+ initialize_editing(Arcadia.file_extension(_filename) || 'rb') if !@edit_initialized
3472
3687
  @dos_line_endings=false
3473
3688
  begin
3474
3689
  @file = _filename
@@ -3485,6 +3700,7 @@ class AgEditor
3485
3700
  @dos_line_endings=true if file.read.include?("\r\n") # pesky windows line endings
3486
3701
  }
3487
3702
  end
3703
+ @file_loaded = true
3488
3704
  set_read_only(!File.stat(_filename).writable?)
3489
3705
  reset(false)
3490
3706
  refresh
@@ -3493,6 +3709,23 @@ class AgEditor
3493
3709
  end
3494
3710
  end
3495
3711
 
3712
+ def load_file_if_not_loaded
3713
+ if @file && !@file_loaded
3714
+ load_file(@file)
3715
+ if @start_index
3716
+ vl = visible_lines
3717
+ if vl && vl > 0
3718
+ text_see("#{@start_index} + #{vl/2 -1} lines")
3719
+ else
3720
+ text_see(@start_index)
3721
+ end
3722
+ end
3723
+ do_line_update
3724
+ @need_recalc=true
3725
+ resize_line_num
3726
+ end
3727
+ end
3728
+
3496
3729
  def set_read_only(_value)
3497
3730
  if @read_only != _value
3498
3731
  @read_only = _value
@@ -3519,6 +3752,7 @@ end
3519
3752
 
3520
3753
  class AgMultiEditorView
3521
3754
  #attr_reader :enb
3755
+ attr_reader :usetabs
3522
3756
  def initialize(_parent=nil, _frame=nil, _usetabs=true)
3523
3757
  @parent = _parent
3524
3758
  @frame = _frame
@@ -3552,6 +3786,12 @@ class AgMultiEditorView
3552
3786
  @enb.bind_append("Map",refresh_after_map)
3553
3787
  end
3554
3788
 
3789
+ # def initialize_notabs
3790
+ # @frame_notabs = TkFrame.new(@frame.hinner_frame, Arcadia.style('panel')){
3791
+ # pack('fill'=>'both', :padx=>0, :pady=>0, :expand => 'yes')
3792
+ # }
3793
+ # end
3794
+
3555
3795
  def switch_2_tabs
3556
3796
  raised = raise
3557
3797
  @usetabs = true
@@ -3706,7 +3946,7 @@ class AgMultiEditorView
3706
3946
  else
3707
3947
  adapted_frame = _adapter
3708
3948
  end
3709
- adapted_frame.attach_frame(frame)
3949
+ adapted_frame.attach_frame(frame, @parent)
3710
3950
  adapted_frame.raise
3711
3951
  @pages[_name]={'frame'=>adapted_frame, 'file'=>_file, 'text'=>_title, 'image' => _image, 'raisecmd'=>_raise_proc}
3712
3952
  adapted_frame
@@ -3726,13 +3966,14 @@ class AgMultiEditorView
3726
3966
  def add_menu_button(_name, _buffer_string)
3727
3967
  @buffer_menu_button = @frame.root.add_menu_button(
3728
3968
  _name, 'files', nil, 'right',
3729
- {'relief'=>:flat,
3730
- 'borderwidth'=>1,
3969
+ {
3970
+ #'relief'=>:flat,
3971
+ # 'borderwidth'=>1,
3731
3972
  'compound'=> 'left',
3732
- 'anchor'=>'w',
3733
- 'font'=> "#{Arcadia.conf('titlelabel.font')} italic",
3734
- 'activebackground'=>Arcadia.conf('titlelabel.background'),
3735
- 'foreground' => Arcadia.conf('titlecontext.foreground'),
3973
+ # 'anchor'=>'w',
3974
+ # 'font'=> "#{Arcadia.conf('titlelabel.font')} italic",
3975
+ # 'activebackground'=>Arcadia.conf('titlelabel.background'),
3976
+ # 'foreground' => Arcadia.conf('titlecontext.foreground'),
3736
3977
  'textvariable'=> _buffer_string
3737
3978
  }
3738
3979
  )
@@ -4032,8 +4273,8 @@ class CoderayHighlightScanner < HighlightScanner
4032
4273
  elsif !([:open, :close, :begin_group,:end_group].include?(tok[0])&& tok[1].class==Symbol)
4033
4274
  toklength = tok[0].length
4034
4275
  t_begin="#{row}.#{col}"
4035
- if tok[0].include?("\n")
4036
- #if tok[0].to_s.include?("\n")
4276
+ #if tok[0].include?("\n")
4277
+ if tok[0].to_s.include?("\n")
4037
4278
  ar = tok[0].split("\n")
4038
4279
  row+=tok[0].count("\n")
4039
4280
  begin_gap = ar[-1]
@@ -4067,9 +4308,22 @@ class AgMultiEditor < ArcadiaExtPlus
4067
4308
  attr_reader :has_ctags, :ctags_string
4068
4309
  attr_reader :main_frame
4069
4310
 
4070
- def on_before_build(_event)
4311
+
4312
+ def has_ctags_exuberant?
4313
+ ret = false
4071
4314
  Arcadia.is_windows? ? @ctags_string="lib/ctags.exe" : @ctags_string='ctags'
4072
- @has_ctags = !Arcadia.which(@ctags_string).nil?
4315
+ ctags_file = Arcadia.which(@ctags_string)
4316
+ if !ctags_file.nil?
4317
+ output = ArcadiaUtils.exec("#{ctags_file} --version")
4318
+ ret = output && output.include?('Exuberant Ctags')
4319
+ end
4320
+ ret
4321
+ end
4322
+
4323
+ def on_before_build(_event)
4324
+ #Arcadia.is_windows? ? @ctags_string="lib/ctags.exe" : @ctags_string='ctags'
4325
+ #@has_ctags = !Arcadia.which(@ctags_string).nil?
4326
+ @has_ctags = has_ctags_exuberant?
4073
4327
  if !@has_ctags
4074
4328
  msg = Arcadia.text("ext.editor.e.ctags.msg")
4075
4329
  ArcadiaProblemEvent.new(self, "type"=>ArcadiaProblemEvent::DEPENDENCE_MISSING_TYPE,"title"=>Arcadia.text("ext.editor.e.ctags.title"), "detail"=>msg).go!
@@ -4090,23 +4344,41 @@ class AgMultiEditor < ArcadiaExtPlus
4090
4344
  # Arcadia.attach_listener(self, StartDebugEvent)
4091
4345
  Arcadia.attach_listener(self, FocusEvent)
4092
4346
  Arcadia.attach_listener(self, BookmarkEvent)
4347
+ Arcadia.attach_listener(self, LayoutChangedDomainEvent)
4093
4348
  end
4094
4349
 
4095
- # def on_before_run_ruby_file(_event)
4096
- # _filename = _event.file
4097
- # if _filename.nil?
4098
- # current_editor = self.raised
4099
- # if current_editor
4100
- # if current_editor.file
4101
- # _event.file = current_editor.file
4102
- # _event.persistent = true
4103
- # else
4104
- # _event.file = current_editor.create_temp_file
4105
- # end
4106
- # end
4107
- # end
4108
- # end
4350
+ def unmap_last_frame
4351
+ @last_fa = @main_frame.page_frame(@main_frame.raise)
4352
+ if @last_fa
4353
+ @last_fa.refresh_layout_manager
4354
+ @last_fa_layout_manager = @last_fa.layout_manager
4355
+ @last_fa.unmap(@last_fa_layout_manager)
4356
+ end
4357
+ end
4109
4358
 
4359
+ def on_layout_changed_domain(_event)
4360
+ # workaround for a problem in stack rendering with usetabs == false
4361
+ if @main_frame && !@main_frame.usetabs && self.frame_domain(0) == _event.old_domain
4362
+ if _event.old_domain == _event.new_domain
4363
+ if self.frame_raised?(0)
4364
+ if !@last_fa.nil?
4365
+ @last_fa.refresh_layout_manager
4366
+ @last_fa.map(@last_fa_layout_manager)
4367
+ @last_fa = nil
4368
+ end
4369
+ else
4370
+ unmap_last_frame
4371
+ end
4372
+ else
4373
+ if !@last_fa.nil?
4374
+ @last_fa.refresh_layout_manager
4375
+ @last_fa.map(@last_fa_layout_manager)
4376
+ @last_fa = nil
4377
+ end
4378
+ end
4379
+ end
4380
+ end
4381
+
4110
4382
  def on_before_run_cmd(_event)
4111
4383
  _filename = _event.file
4112
4384
  _event.persistent = true
@@ -4216,7 +4488,9 @@ class AgMultiEditor < ArcadiaExtPlus
4216
4488
  self.name,
4217
4489
  'Close current',
4218
4490
  proc{self.activate;Arcadia.process_event(CloseCurrentTabEvent.new(self))},
4219
- CLOSE_DOCUMENT_GIF)
4491
+ #CLOSE_DOCUMENT_GIF
4492
+ CLOSE_FRAME_GIF
4493
+ )
4220
4494
  frame.root.add_sep(self.name, 1)
4221
4495
  @buffer_number = TkVariable.new
4222
4496
  @buffer_string = TkVariable.new
@@ -4281,7 +4555,7 @@ class AgMultiEditor < ArcadiaExtPlus
4281
4555
  end
4282
4556
  }
4283
4557
  end
4284
- instance.move_buffer_here(raised_name)
4558
+ #instance.move_buffer_here(raised_name)
4285
4559
  instance
4286
4560
  end
4287
4561
 
@@ -4406,8 +4680,8 @@ class AgMultiEditor < ArcadiaExtPlus
4406
4680
  make_buffer_string("") if @buffer_menu.index('end').nil?
4407
4681
  if _sender == self
4408
4682
  instances.each{|i|
4409
- if i != self
4410
- i.del_buffer_menu_item(_file, self)
4683
+ if i != self || instances.count == 1
4684
+ i.del_buffer_menu_item(_file, self) if instances.count > 1
4411
4685
  i.refresh_buffer_string
4412
4686
  end
4413
4687
  }
@@ -4494,6 +4768,10 @@ class AgMultiEditor < ArcadiaExtPlus
4494
4768
  reset_status if @main_frame.pages.empty?
4495
4769
  end
4496
4770
 
4771
+ # def on_after_initialize(_event)
4772
+ # @editors.each{|e| e.resize_line_num}
4773
+ # end
4774
+
4497
4775
  def on_exit_query(_event)
4498
4776
  _event.can_exit=true
4499
4777
  return if _event.sender.instance_of?(AgMultiEditor) && _event.sender != self
@@ -4511,9 +4789,8 @@ class AgMultiEditor < ArcadiaExtPlus
4511
4789
  if [CutTextEvent, PasteTextEvent, UndoTextEvent, RedoTextEvent].include?(_event.class)
4512
4790
  if raised.highlighting
4513
4791
  raised.refresh_visible_highlighting
4514
- else
4515
- raised.check_modify
4516
4792
  end
4793
+ raised.check_modify
4517
4794
  end
4518
4795
  end
4519
4796
  end
@@ -4560,9 +4837,6 @@ class AgMultiEditor < ArcadiaExtPlus
4560
4837
  lang_exts.each{|ext|
4561
4838
  @langs_hash_by_ext[ext] = lang_props
4562
4839
  } if lang_exts
4563
-
4564
-
4565
-
4566
4840
  end
4567
4841
  }
4568
4842
  end
@@ -4611,13 +4885,14 @@ class AgMultiEditor < ArcadiaExtPlus
4611
4885
 
4612
4886
 
4613
4887
  def pop_up_menu
4614
- @pop_up = TkMenu.new(
4888
+ #@pop_up = TkMenu.new(
4889
+ @pop_up = Arcadia.wf.menu(
4615
4890
  :parent=> self.frame.hinner_frame,
4616
4891
  :tearoff=>0,
4617
4892
  :title => 'Menu'
4618
4893
  )
4619
- @pop_up.extend(TkAutoPostMenu)
4620
- @pop_up.configure(Arcadia.style('menu'))
4894
+ #@pop_up.extend(TkAutoPostMenu)
4895
+ #@pop_up.configure(Arcadia.style('menu'))
4621
4896
  #Arcadia.instance.main_menu.update_style(@pop_up)
4622
4897
 
4623
4898
 
@@ -4756,7 +5031,7 @@ class AgMultiEditor < ArcadiaExtPlus
4756
5031
  @bookmarks << {:file=>"__TMP__#{_event.id}",:from_line=>_event.from_row, :to_line=>_event.to_row}
4757
5032
  _e = @editors[_event.id]
4758
5033
  end
4759
- if _e
5034
+ if _e && _e.text
4760
5035
  index_from = "#{_event.from_row}.0"
4761
5036
  index_to = "#{_event.to_row}.0 lineend"
4762
5037
  _event.content = _e.text.get(index_from, index_to)
@@ -4882,18 +5157,18 @@ class AgMultiEditor < ArcadiaExtPlus
4882
5157
  end
4883
5158
  if _event.kind_of?(OpenBufferTransientEvent)
4884
5159
  if conf('close-last-if-not-modified')=="yes"
4885
- if defined?(@last_transient_file) && !@last_transient_file.nil? && @last_transient_file != _event.file
4886
- _e = @tabs_editor[tab_name(@last_transient_file)]
4887
- if _e && !_e.modified_from_opening?
4888
- close_editor(_e)
5160
+ if defined?(@last_transient_file) && !@last_transient_file.nil? && @last_transient_file != _event.file
5161
+ _e = @tabs_editor[tab_name(@last_transient_file)]
5162
+ if _e && !_e.modified_from_opening?
5163
+ close_editor(_e)
5164
+ end
5165
+ end
5166
+ if !editor_exist?(_event.file)
5167
+ @last_transient_file = _event.file
5168
+ else
5169
+ @last_transient_file = nil
5170
+ _event.transient = false
4889
5171
  end
4890
- end
4891
- if !editor_exist?(_event.file)
4892
- @last_transient_file = _event.file
4893
- else
4894
- @last_transient_file = nil
4895
- _event.transient = false
4896
- end
4897
5172
  else
4898
5173
  _event.transient = false
4899
5174
  end
@@ -4999,11 +5274,13 @@ class AgMultiEditor < ArcadiaExtPlus
4999
5274
  end
5000
5275
 
5001
5276
  def show_hide_current_line_numbers
5277
+ return if !self.frame_raised?(0)
5002
5278
  _e = active_instance.raised
5003
5279
  _e.show_hide_line_numbers if _e
5004
5280
  end
5005
5281
 
5006
5282
  def show_hide_tabs
5283
+ return if !self.frame_raised?(0)
5007
5284
  if active?
5008
5285
  if @usetabs
5009
5286
  @main_frame.switch_2_notabs
@@ -5027,7 +5304,7 @@ class AgMultiEditor < ArcadiaExtPlus
5027
5304
  @tabs_editor.each_value{|editor|
5028
5305
  if editor.file != nil
5029
5306
  #_insert_index = editor.text.index('insert')
5030
- _insert_index = editor.text.index('@0,0')
5307
+ _insert_index = editor.text.nil?? editor.start_index : editor.text.index('@0,0')
5031
5308
  _files=_files+'|' if _files.strip.length > 0
5032
5309
  _files=_files + "#{editor.file};#{_insert_index};#{editor.line_numbers_visible.to_s}"
5033
5310
  end
@@ -5116,10 +5393,15 @@ class AgMultiEditor < ArcadiaExtPlus
5116
5393
  end
5117
5394
 
5118
5395
  def on_layout_raising_frame(_event)
5119
- if _event.extension_name == "editor" && _event.frame_name=="editor_outline"
5396
+ if _event.extension_name && _event.extension_name == "editor" && _event.frame_name=="editor_outline"
5120
5397
  _e = raised
5121
5398
  change_outline(_e, true) if _e
5122
5399
  end
5400
+ if Arcadia.extension(_event.extension_name) && frame_domain == Arcadia.extension(_event.extension_name).frame_domain
5401
+ if @main_frame && !@main_frame.usetabs
5402
+ unmap_last_frame
5403
+ end
5404
+ end
5123
5405
  end
5124
5406
 
5125
5407
  # def update(_kind,_name)
@@ -5131,27 +5413,34 @@ class AgMultiEditor < ArcadiaExtPlus
5131
5413
 
5132
5414
  def open_last_files
5133
5415
  @batch_files = true
5416
+ last_ed = nil
5134
5417
  if Arcadia.persistent("#{@name}.files.open")
5135
5418
  _files_index =Arcadia.persistent("#{@name}.files.open").split("|")
5136
5419
  _files_index.each do |value|
5137
5420
  _file,_index,_line_numbers_visible_as_string = value.split(';')
5138
5421
  if _file && _index
5139
- ed = open_file(_file,_index,false)
5422
+ ed = open_file(_file,_index,false, false)
5140
5423
  else
5141
- ed = open_file(_file)
5424
+ ed = open_file(_file,'1.0', false, false)
5142
5425
  end
5143
5426
  if ed && _line_numbers_visible_as_string && ed.line_numbers_visible
5144
5427
  ed.line_numbers_visible = _line_numbers_visible_as_string == 'true'
5145
5428
  end
5429
+ last_ed = ed
5146
5430
  end
5147
5431
  end
5148
5432
  @batch_files = false
5433
+ change_outline(last_ed) if last_ed
5149
5434
  to_raise_file = Arcadia.persistent("#{@name}.files.last")
5150
5435
  if to_raise_file
5436
+ ed_to_raise = @tabs_editor[self.tab_file_name(to_raise_file)]
5437
+ ed_to_raise.load_file_if_not_loaded if ed_to_raise
5151
5438
  raise_file(to_raise_file,0)
5152
5439
  else
5153
5440
  _first_page = @main_frame.pages[0] if @main_frame.pages.length > 0
5154
5441
  if _first_page
5442
+ ed_to_raise = @tabs_editor[_first_page]
5443
+ ed_to_raise.load_file_if_not_loaded if ed_to_raise
5155
5444
  @main_frame.raise(_first_page) if frame_def_visible?
5156
5445
  @main_frame.see(_first_page)
5157
5446
  end
@@ -5291,7 +5580,6 @@ class AgMultiEditor < ArcadiaExtPlus
5291
5580
 
5292
5581
  def make_buffer_string(_str=nil)
5293
5582
  value = "[#{@buffer_number.value}] #{_str}"
5294
- #@buffer_menu_button.configure(:text => )
5295
5583
  @last_buffer_str = _str
5296
5584
  @buffer_string.value = value
5297
5585
  end
@@ -5330,6 +5618,7 @@ class AgMultiEditor < ArcadiaExtPlus
5330
5618
  mod_buffer_menu_item(@tabs_editor[p_name].file, _new_text, _new_file, self)
5331
5619
  else
5332
5620
  mod_buffer_menu_item(unname_modified(tab_title_by_tab_name(p_name)), _new_text, nil, self)
5621
+ @last_fa.refresh_layout_manager if @last_fa
5333
5622
  end
5334
5623
  # mod_buffer_menu_item(@main_frame.page(p_name)['file'], _new_text)
5335
5624
  @main_frame.page_title(p_name, _new_text)
@@ -5390,7 +5679,7 @@ class AgMultiEditor < ArcadiaExtPlus
5390
5679
  if _editor
5391
5680
  @last_e = raise_editor(_editor, @last_index, false, false)
5392
5681
  else
5393
- @last_e = open_file(_filename, @last_index, false, false)
5682
+ @last_e = open_file(_filename, @last_index, false)
5394
5683
  end
5395
5684
  #@last_e.hide_exp
5396
5685
  @last_e.mark_debug(@last_index) if @last_e
@@ -5407,7 +5696,7 @@ class AgMultiEditor < ArcadiaExtPlus
5407
5696
  end
5408
5697
 
5409
5698
  def change_outline(_e, _raised=false)
5410
- return if defined?(@@last_outline_e) && @@last_outline_e == _e
5699
+ return if (defined?(@@last_outline_e) && @@last_outline_e == _e)
5411
5700
  _raised = _raised || main_instance.frame(1).raised?
5412
5701
  if !@batch_files && _raised
5413
5702
  @@last_outline_e.hide_outline if defined?(@@last_outline_e)
@@ -5424,6 +5713,7 @@ class AgMultiEditor < ArcadiaExtPlus
5424
5713
  _new_caption = '...'
5425
5714
  if _index != -1
5426
5715
  _e = @tabs_editor[resolve_tab_name(_name)]
5716
+ _e.load_file_if_not_loaded if _e
5427
5717
  change_outline(_e) if _e
5428
5718
  if _e && _e.file != nil
5429
5719
  _new_caption = _e.file
@@ -5469,7 +5759,7 @@ class AgMultiEditor < ArcadiaExtPlus
5469
5759
  size_str = "#{size} b"
5470
5760
  end
5471
5761
  @@statusbar_items['file_name'].text(File.basename(raised.file))
5472
- @@statusbar_items['file_mtime'].text = raised.file_info['mtime'].localtime
5762
+ @@statusbar_items['file_mtime'].text = raised.file_info['mtime'].localtime if raised.file_info['mtime']
5473
5763
  @@statusbar_items['file_size'].text = size_str
5474
5764
  #@statusbar_item.text("#{File.basename(raised.file)} | #{raised.file_info['mtime'].localtime} | #{size_str}")
5475
5765
  else
@@ -5544,7 +5834,7 @@ class AgMultiEditor < ArcadiaExtPlus
5544
5834
  end
5545
5835
  end
5546
5836
 
5547
- def open_file(_filename = nil, _text_index='1.0', _mark_selected=true, _exp=true)
5837
+ def open_file(_filename = nil, _text_index='1.0', _mark_selected=true, _load_file=true)
5548
5838
  return if _filename == nil || !File.exist?(_filename) || File.ftype(_filename) != 'file'
5549
5839
  _basefilename = File.basename(_filename)
5550
5840
  _tab_name = self.tab_file_name(_filename)
@@ -5554,12 +5844,26 @@ class AgMultiEditor < ArcadiaExtPlus
5554
5844
  if _exist_buffer
5555
5845
  open_buffer(_tab_name)
5556
5846
  # ??? _text_index = nil
5847
+ if !@tabs_editor[_tab_name].file_loaded
5848
+ @tabs_editor[_tab_name].reset_highlight
5849
+ begin
5850
+ @tabs_editor[_tab_name].load_file_if_not_loaded
5851
+ rescue RuntimeError => e
5852
+ close_editor(@tabs_editor[_tab_name], true)
5853
+ Arcadia.runtime_error(e)
5854
+ end
5855
+ end
5557
5856
  else
5558
5857
  # @tabs_file[_tab_name]= _filename
5559
- open_buffer(_tab_name, _basefilename, _filename)
5858
+ open_buffer(_tab_name, _basefilename, _filename, nil, false)
5560
5859
  @tabs_editor[_tab_name].reset_highlight
5561
5860
  begin
5562
- @tabs_editor[_tab_name].load_file(_filename)
5861
+ if _load_file
5862
+ @tabs_editor[_tab_name].load_file(_filename)
5863
+ else
5864
+ @tabs_editor[_tab_name].file = _filename
5865
+ @tabs_editor[_tab_name].start_index = _text_index
5866
+ end
5563
5867
  rescue RuntimeError => e
5564
5868
  #Arcadia.dialog(self,'type'=>'ok', 'level'=>'error','title' => 'RuntimeError', 'msg'=>"RuntimeError : #{e.message}")
5565
5869
  #p "RuntimeError : #{e.message}"
@@ -5569,11 +5873,13 @@ class AgMultiEditor < ArcadiaExtPlus
5569
5873
  change_outline_frame_caption(File.basename(_filename)) if _filename
5570
5874
  end
5571
5875
  editor = @tabs_editor[_tab_name]
5572
- if _text_index != nil && _text_index != '1.0' && editor
5573
- editor.text_see(_text_index)
5574
- editor.mark_selected(_text_index) if _mark_selected
5876
+ if editor && _load_file
5877
+ if _text_index != nil && _text_index != '1.0' && editor
5878
+ editor.text_see(_text_index)
5879
+ editor.mark_selected(_text_index) if _mark_selected
5880
+ end
5881
+ editor.do_line_update if editor && !editor.highlighted?
5575
5882
  end
5576
- editor.do_line_update if editor && !editor.highlighted?
5577
5883
  return editor
5578
5884
  end
5579
5885
 
@@ -5582,8 +5888,11 @@ class AgMultiEditor < ArcadiaExtPlus
5582
5888
  #@raw_buffer_name[_name]=_name
5583
5889
  end
5584
5890
 
5585
- def open_buffer(_buffer_name = nil, _title = nil, _filename=nil, _lang=nil)
5891
+ def open_buffer(_buffer_name = nil, _title = nil, _filename=nil, _lang=nil, _initialize_editing=true)
5586
5892
  #_index = @main_frame.index(resolve_tab_name(_buffer_name))
5893
+ if frame_visible? && !frame_raised?
5894
+ @arcadia.layout.change_domain(frame_domain, @name)
5895
+ end
5587
5896
  if @main_frame.exist_buffer?(resolve_tab_name(_buffer_name))
5588
5897
  _tab = @main_frame.page_frame(resolve_tab_name(_buffer_name))
5589
5898
  #@main_frame.raise(resolve_tab_name(_buffer_name)) if frame_visible?
@@ -5614,7 +5923,6 @@ class AgMultiEditor < ArcadiaExtPlus
5614
5923
  _image = Arcadia.file_icon(_title)
5615
5924
  end
5616
5925
  _tab = @main_frame.add_page(_buffer_name, _filename, _title, _image, proc{do_buffer_raise(_buffer_name, _title)})
5617
- # @raw_buffer_name[_buffer_name]=_buffer_name
5618
5926
  if _filename
5619
5927
  add_buffer_menu_item(_filename)
5620
5928
  else
@@ -5622,27 +5930,17 @@ class AgMultiEditor < ArcadiaExtPlus
5622
5930
  end
5623
5931
  _e = AgEditor.new(self, _tab)
5624
5932
  register_editor(_e, _buffer_name, _filename)
5625
- # @editor_seq=@editor_seq+1
5626
- # _e.id=@editor_seq
5627
- # @editors[@editor_seq]=_e
5628
- # @tabs_editor[_buffer_name]=_e
5629
- ext = Arcadia.file_extension(_title)
5630
- ext='rb' if ext.nil?
5631
- _e.initialize_editing(ext, _lang)
5632
- _e.text.set_focus
5933
+ if _initialize_editing
5934
+ ext= Arcadia.file_extension(_title) || 'rb'
5935
+ _e.initialize_editing(ext, _lang)
5936
+ _e.text.set_focus
5937
+ end
5633
5938
  end
5634
5939
  begin
5635
5940
  if raised != @tabs_editor[resolve_tab_name(_buffer_name)]
5636
- @main_frame.raise(resolve_tab_name(_buffer_name)) if frame_visible?
5941
+ @main_frame.raise(resolve_tab_name(_buffer_name)) #if frame_visible?
5637
5942
  @main_frame.see(resolve_tab_name(_buffer_name))
5638
5943
  end
5639
- # if raised != @tabs_editor[resolve_tab_name(_buffer_name)]
5640
- # @main_frame.move(resolve_tab_name(_buffer_name), 0)
5641
- # @main_frame.raise(resolve_tab_name(_buffer_name)) if frame_visible?
5642
- # @main_frame.see(resolve_tab_name(_buffer_name))
5643
- # else
5644
- # @main_frame.move(resolve_tab_name(_buffer_name), 0)
5645
- # end
5646
5944
  rescue Exception => e
5647
5945
  Arcadia.runtime_error(e)
5648
5946
  end
@@ -5667,6 +5965,7 @@ class AgMultiEditor < ArcadiaExtPlus
5667
5965
 
5668
5966
  def raise_editor(_editor = nil, _text_index='0.0', _mark_selected=true, _exp=true)
5669
5967
  return if _editor == nil
5968
+ #_editor.load_file_if_not_loaded
5670
5969
  _tab_name = nil
5671
5970
  @tabs_editor.each{|tn,e|
5672
5971
  if e == _editor
@@ -5742,7 +6041,7 @@ class AgMultiEditor < ArcadiaExtPlus
5742
6041
  def close_editor(_editor, _force=false)
5743
6042
  if _force || can_close_editor?(_editor)
5744
6043
  file = _editor.file
5745
- index = _editor.text.index("@0,0")
6044
+ index = _editor.text.nil?? _editor.start_index : _editor.text.index("@0,0")
5746
6045
  r,c = index.split('.')
5747
6046
  _editor.destroy_outline
5748
6047
  change_outline_frame_caption('') if raised==_editor
@@ -5780,7 +6079,11 @@ class AgMultiEditor < ArcadiaExtPlus
5780
6079
  else
5781
6080
  ind = _index-1
5782
6081
  end
5783
- @main_frame.raise(@main_frame.pages[ind]) if TkWinfo.mapped?(@main_frame.root_frame)
6082
+ if TkWinfo.mapped?(@main_frame.root_frame)
6083
+ @main_frame.raise(@main_frame.pages[ind])
6084
+ editor = @tabs_editor[@main_frame.pages[ind]]
6085
+ #editor.load_file_if_not_loaded if editor
6086
+ end
5784
6087
  else
5785
6088
  frame.root.top_text_clear if TkWinfo.mapped?(frame.hinner_frame)
5786
6089
  make_buffer_string("")
@@ -5836,20 +6139,22 @@ class Findview < TkFloatTitledFrame
5836
6139
  place('x' => 8,'y' => y0,'height' => 19)
5837
6140
  }
5838
6141
  y0 = y0 + d
5839
- @e_what = Tk::BWidget::ComboBox.new(self.frame, Arcadia.style('combobox')){
5840
- editable true
6142
+ # @e_what = Tk::BWidget::ComboBox.new(self.frame, Arcadia.style('combobox')){
6143
+ @e_what = Arcadia.wf.combobox(self.frame){
6144
+ # editable true
5841
6145
  justify 'left'
5842
- #relief 'ridge'
5843
- autocomplete 'true'
5844
- expand 'tab'
5845
- takefocus 'true'
5846
- #pack('padx'=>10, 'fill'=>'x')
6146
+ # autocomplete 'true'
6147
+ # expand 'tab'
6148
+ exportselection true
6149
+ width 100
6150
+ takefocus true
5847
6151
  place('relwidth' => 1, 'width'=>-16,'x' => 8,'y' => y0,'height' => 19)
5848
6152
  }
5849
- @e_what_entry = TkWinfo.children(@e_what)[0]
5850
-
5851
- #@e_what_entry.bind_append("1",proc{Arcadia.process_event(InputEnterEvent.new(self,'receiver'=>@e_what_entry))})
5852
- @e_what_entry.extend(TkInputThrow)
6153
+
6154
+ @e_what.extend(TkInputThrow)
6155
+
6156
+ # @e_what_entry = TkWinfo.children(@e_what)[0]
6157
+ # @e_what_entry.extend(TkInputThrow)
5853
6158
 
5854
6159
 
5855
6160
  y0 = y0 + d
@@ -5859,40 +6164,45 @@ class Findview < TkFloatTitledFrame
5859
6164
  }
5860
6165
  y0 = y0 + d
5861
6166
 
5862
- @e_with = Tk::BWidget::ComboBox.new(self.frame, Arcadia.style('combobox')){
5863
- editable true
6167
+ # @e_with = Tk::BWidget::ComboBox.new(self.frame, Arcadia.style('combobox')){
6168
+ @e_with = Arcadia.wf.combobox(self.frame){
6169
+ # editable true
5864
6170
  justify 'left'
5865
- autocomplete 'true'
5866
- expand 'tab'
5867
- takefocus 'true'
5868
- #pack('padx'=>10, 'fill'=>'x')
6171
+ # autocomplete 'true'
6172
+ # expand 'tab'
6173
+ exportselection true
6174
+ width 100
6175
+ takefocus true
5869
6176
  place('relwidth' => 1, 'width'=>-16,'x' => 8,'y' => y0,'height' => 19)
5870
6177
  }
5871
- @e_with_entry = TkWinfo.children(@e_with)[0]
5872
- #@e_with_entry.bind_append("1",proc{Arcadia.process_event(InputEnterEvent.new(self,'receiver'=>@e_with_entry))})
5873
- @e_with_entry.extend(TkInputThrow)
6178
+
6179
+ @e_with.extend(TkInputThrow)
6180
+
6181
+ # @e_with_entry = TkWinfo.children(@e_with)[0]
6182
+ # @e_with_entry.extend(TkInputThrow)
6183
+
5874
6184
  y0 = y0 + d
5875
- @cb_reg = TkCheckButton.new(self.frame, Arcadia.style('checkbox')){|_cb_reg|
6185
+ # @cb_reg = TkCheckButton.new(self.frame, Arcadia.style('checkbox')){|_cb_reg|
6186
+ @cb_reg = Arcadia.wf.checkbutton(self.frame){|_cb_reg|
5876
6187
  text Arcadia.text('ext.editor.search.label.use_regexp')
5877
- justify 'left'
5878
- #relief 'flat'
5879
- #pack('side'=>'left', 'anchor'=>'e')
6188
+ # justify 'left'
6189
+ variable TkVariable.new
5880
6190
  place('x' => 8,'y' => y0,'height' => 22)
5881
6191
  }
5882
6192
  y0 = y0 + d
5883
- @cb_back = TkCheckButton.new(self.frame, Arcadia.style('checkbox')){|_cb_reg|
6193
+ #@cb_back = TkCheckButton.new(self.frame, Arcadia.style('checkbox')){|_cb_reg|
6194
+ @cb_back = Arcadia.wf.checkbutton(self.frame){|_cb_reg|
5884
6195
  text Arcadia.text('ext.editor.search.label.search_back')
5885
- justify 'left'
5886
- #relief 'flat'
5887
- #pack('side'=>'left', 'anchor'=>'e')
6196
+ variable TkVariable.new
6197
+ # justify 'left'
5888
6198
  place('x' => 8,'y' => y0,'height' => 22)
5889
6199
  }
5890
6200
  y0 = y0 + d
5891
- @cb_ignore_case = TkCheckButton.new(self.frame, Arcadia.style('checkbox')){|_cb_reg|
6201
+ #@cb_ignore_case = TkCheckButton.new(self.frame, Arcadia.style('checkbox')){|_cb_reg|
6202
+ @cb_ignore_case = Arcadia.wf.checkbutton(self.frame){|_cb_reg|
5892
6203
  text Arcadia.text('ext.editor.search.label.ignore_case')
5893
- justify 'left'
5894
- #relief 'flat'
5895
- #pack('side'=>'left', 'anchor'=>'e')
6204
+ # justify 'left'
6205
+ variable TkVariable.new
5896
6206
  place('x' => 8,'y' => y0,'height' => 22)
5897
6207
  }
5898
6208
 
@@ -5901,45 +6211,39 @@ class Findview < TkFloatTitledFrame
5901
6211
  y0 = y0 + d
5902
6212
  @buttons_frame = TkFrame.new(self.frame, Arcadia.style('panel')).pack('fill'=>'x', 'side'=>'bottom')
5903
6213
 
5904
- @b_replace_all = TkButton.new(@buttons_frame, Arcadia.style('button')){|_b_go|
6214
+ #@b_replace_all = TkButton.new(@buttons_frame, Arcadia.style('button')){|_b_go|
6215
+ @b_replace_all = Arcadia.wf.button(@buttons_frame){|_b_go|
5905
6216
  state 'disabled'
5906
- default 'disabled'
6217
+ # default 'disabled'
5907
6218
  text Arcadia.text('ext.editor.search.label.replace_all')
5908
- #overrelief 'raised'
5909
- justify 'center'
5910
- #width 15
6219
+ # justify 'center'
6220
+ width 10
5911
6221
  pack('side'=>'right','ipadx'=>5, 'padx'=>5)
5912
- #place('width' => 50,'x' => 0,'y' => y0,'height' => 23,'bordermode' => 'inside')
5913
6222
  }
5914
6223
 
5915
6224
 
5916
- @b_replace = TkButton.new(@buttons_frame, Arcadia.style('button')){|_b_go|
6225
+ # @b_replace = TkButton.new(@buttons_frame, Arcadia.style('button')){|_b_go|
6226
+ @b_replace = Arcadia.wf.button(@buttons_frame){|_b_go|
5917
6227
  state 'disabled'
5918
- default 'disabled'
6228
+ # default 'disabled'
5919
6229
  text Arcadia.text('ext.editor.search.label.replace')
5920
- #overrelief 'raised'
5921
- justify 'center'
5922
- #width 15
6230
+ # justify 'center'
6231
+ width 10
5923
6232
  pack('side'=>'right','ipadx'=>5, 'padx'=>5)
5924
- #place('width' => 50,'x' => 0,'y' => y0,'height' => 23,'bordermode' => 'inside')
5925
6233
  }
5926
6234
 
5927
6235
 
5928
- @b_go = TkButton.new(@buttons_frame, Arcadia.style('button')){|_b_go|
6236
+ # @b_go = TkButton.new(@buttons_frame, Arcadia.style('button')){|_b_go|
6237
+ @b_go = Arcadia.wf.button(@buttons_frame){|_b_go|
5929
6238
  compound 'none'
5930
- default 'disabled'
6239
+ # default 'disabled'
5931
6240
  text Arcadia.text('ext.editor.search.label.find_next')
5932
- #background '#ffffff'
5933
- #image TkPhotoImage.new('dat' => FIND_GIF)
5934
- #overrelief 'raised'
5935
- justify 'center'
5936
- #relief 'ridge'
5937
- #width 15
6241
+ # justify 'center'
6242
+ width 10
5938
6243
  pack('side'=>'right','ipadx'=>5, 'padx'=>5)
5939
- #place('width' => 50,'x' => 0,'y' => y0,'height' => 23,'bordermode' => 'inside')
5940
6244
  }
5941
6245
  #place('x'=>0,'y'=>0,'relheight'=> 1,'relwidth'=> 1)
5942
- place('x'=>100,'y'=>100,'height'=> 240,'width'=> 300)
6246
+ place('x'=>100,'y'=>100,'height'=> 240,'width'=> 310)
5943
6247
 
5944
6248
  end
5945
6249
 
@@ -5947,8 +6251,10 @@ class Findview < TkFloatTitledFrame
5947
6251
  super
5948
6252
  self.focus
5949
6253
  @e_what.focus
5950
- @e_what_entry.select_throw
5951
- @e_what_entry.selection_range(0,'end')
6254
+ @e_what.select_throw
6255
+ @e_what.selection_range(0,'end')
6256
+ # @e_what_entry.select_throw
6257
+ # @e_what_entry.selection_range(0,'end')
5952
6258
  end
5953
6259
 
5954
6260
 
@@ -5972,7 +6278,8 @@ class Finder < Findview
5972
6278
 
5973
6279
  @b_replace_all.bind('1', proc{hide; do_replace_all})
5974
6280
 
5975
- @e_what_entry.bind_append('KeyRelease'){|e|
6281
+ # @e_what_entry.bind_append('KeyRelease'){|e|
6282
+ @e_what.bind_append('KeyRelease'){|e|
5976
6283
  case e.keysym
5977
6284
  when 'Return'
5978
6285
  @find_action.call
@@ -5981,10 +6288,7 @@ class Finder < Findview
5981
6288
  widget_state
5982
6289
  end
5983
6290
  }
5984
- e2 = TkWinfo.children(@e_with)[0]
5985
- e2.bind_append('KeyPress'){|e|
5986
- widget_state
5987
- }
6291
+
5988
6292
  @last_index='insert'
5989
6293
 
5990
6294
  @goto_line_dialog = GoToLine.new(_frame).hide
@@ -6010,6 +6314,7 @@ class Finder < Findview
6010
6314
  self.editor.check_modify
6011
6315
  end
6012
6316
  end
6317
+ update_combo(@e_with) if @e_with.value.length > 0
6013
6318
  end
6014
6319
 
6015
6320
  def do_replace_all
@@ -6031,6 +6336,7 @@ class Finder < Findview
6031
6336
  break
6032
6337
  end
6033
6338
  end
6339
+ update_combo(@e_with) if @e_with.value.length > 0
6034
6340
  end
6035
6341
 
6036
6342
  def widget_state
@@ -6087,20 +6393,24 @@ class Finder < Findview
6087
6393
  use(@controller.raised)
6088
6394
  end
6089
6395
 
6090
- def update_combo(_txt)
6091
- values = @e_what.cget('values')
6092
- if (values != nil && !values.include?(_txt))
6093
- @e_what.insert('end', @e_what.value)
6396
+ def update_combo(_combobox=nil)
6397
+ return if _combobox.nil?
6398
+ values = _combobox.cget('values')
6399
+ if (values != nil && !values.include?(_combobox.value))
6400
+ values << _combobox.value
6401
+ _combobox.values=values
6402
+ # @e_what.insert('end', @e_what.value)
6094
6403
  end
6095
6404
  end
6096
6405
 
6097
6406
  def do_find(_istart=nil)
6407
+
6098
6408
  @forwards = @cb_back.cget('onvalue') != @cb_back.cget('variable').value.to_i
6099
6409
  _found = false
6100
6410
  @idx1 = nil
6101
6411
  @idx2 = nil
6102
- if @e_what.text.length > 0
6103
- update_combo(@e_what.text)
6412
+ if @e_what.value.length > 0
6413
+ update_combo(@e_what)
6104
6414
  if !_istart && self.editor.text.index('insert')!=nil
6105
6415
  _istart ='insert'
6106
6416
  elsif defined?(@last_index)
@@ -6120,12 +6430,12 @@ class Finder < Findview
6120
6430
  if @cb_ignore_case.cget('onvalue')==@cb_ignore_case.cget('variable').value.to_i
6121
6431
  options << 'nocase'
6122
6432
  end
6123
- _index = self.editor.text.tksearch(options,@e_what.text,_istart)
6433
+ _index = self.editor.text.tksearch(options,@e_what.value,_istart)
6124
6434
 
6125
6435
  if _index && _index.length>0
6126
6436
  self.editor.text.see(_index)
6127
6437
  _row, _col = _index.split('.')
6128
- _index_sel_end = _row.to_i.to_s+'.'+(_col.to_i+@e_what.text.length).to_i.to_s
6438
+ _index_sel_end = _row.to_i.to_s+'.'+(_col.to_i+@e_what.value.length).to_i.to_s
6129
6439
  if @forwards
6130
6440
  @last_index= _index_sel_end
6131
6441
  else
@@ -6134,14 +6444,11 @@ class Finder < Findview
6134
6444
  self.editor.text.tag_add('sel', _index,_index_sel_end)
6135
6445
  self.editor.text.set_insert(_index)
6136
6446
  @idx1 =_index
6137
- @idx2 =_index_sel_end
6447
+ @idx2 =_index_sel_end
6138
6448
  _found = true
6139
6449
  @controller.chrono_bookmark_add(self.editor.file, _index)
6140
6450
  else
6141
- _message = '"'+@e_what.value+'" not found'
6142
- Arcadia.hinner_dialog(self, 'type'=>'ok', 'msg'=> _message)
6143
-
6144
- # TkDialog2.new('message'=>_message, 'buttons'=>['Ok']).show()
6451
+ Arcadia.hinner_dialog(self, 'type'=>'ok', 'msg'=> Arcadia.text('ext.editor.search.notfound',[@e_what.value, self.editor.tab_title]))
6145
6452
  end
6146
6453
 
6147
6454
  else