arcadia 0.12.2 → 0.13.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 (57) hide show
  1. data/README +25 -14
  2. data/conf/LC/en-UK.LANG +3 -1
  3. data/conf/arcadia.conf +10 -0
  4. data/conf/arcadia.res.rb +29 -1
  5. data/ext/ae-editor/ae-editor.rb +239 -48
  6. data/ext/ae-file-history/ae-file-history.conf +11 -1
  7. data/ext/ae-file-history/ae-file-history.rb +120 -2
  8. data/ext/ae-ruby-debug/ae-ruby-debug.rb +6 -5
  9. data/ext/ae-subprocess-inspector/ae-subprocess-inspector.rb +7 -3
  10. data/ext/ae-term/ae-term.rb +1 -1
  11. data/lib/a-commons.rb +72 -56
  12. data/lib/a-contracts.rb +23 -1
  13. data/lib/a-core.rb +136 -41
  14. data/lib/a-tkcommons.rb +127 -36
  15. data/tcl/fsdialog/fsdialog.tcl +2 -2
  16. data/tcl/ptwidgets-1.1.0/COPYRIGHT +10 -0
  17. data/tcl/ptwidgets-1.1.0/ChangeLog +194 -0
  18. data/tcl/ptwidgets-1.1.0/README +50 -0
  19. data/tcl/ptwidgets-1.1.0/common/stacktrace.tcl +29 -0
  20. data/tcl/ptwidgets-1.1.0/common/tokenframe.tcl +200 -0
  21. data/tcl/ptwidgets-1.1.0/doc/img/toggleswitch_off.png +0 -0
  22. data/tcl/ptwidgets-1.1.0/doc/img/toggleswitch_on.png +0 -0
  23. data/tcl/ptwidgets-1.1.0/doc/img/tokenentry.png +0 -0
  24. data/tcl/ptwidgets-1.1.0/doc/img/tokensearch_popup_example.png +0 -0
  25. data/tcl/ptwidgets-1.1.0/doc/img/tokensearch_popup_example2.png +0 -0
  26. data/tcl/ptwidgets-1.1.0/doc/img/wmarkentry.png +0 -0
  27. data/tcl/ptwidgets-1.1.0/doc/toggleswitch.html +402 -0
  28. data/tcl/ptwidgets-1.1.0/doc/tokenentry.html +1366 -0
  29. data/tcl/ptwidgets-1.1.0/doc/tokensearch.html +1549 -0
  30. data/tcl/ptwidgets-1.1.0/doc/wmarkentry.html +634 -0
  31. data/tcl/ptwidgets-1.1.0/library/toggleswitch.tcl +432 -0
  32. data/tcl/ptwidgets-1.1.0/library/tokenentry.tcl +2208 -0
  33. data/tcl/ptwidgets-1.1.0/library/tokensearch.tcl +2488 -0
  34. data/tcl/ptwidgets-1.1.0/library/wmarkentry.tcl +630 -0
  35. data/tcl/ptwidgets-1.1.0/pkgIndex.tcl +10 -0
  36. data/tcl/ptwidgets-1.1.0/test/Makefile +3 -0
  37. data/tcl/ptwidgets-1.1.0/test/run.tcl +3 -0
  38. data/tcl/ptwidgets-1.1.0/test/test.tcl +89 -0
  39. data/tcl/ptwidgets-1.1.0/test/toggleswitch.test +562 -0
  40. data/tcl/ptwidgets-1.1.0/test/tokenentry.test +1023 -0
  41. data/tcl/ptwidgets-1.1.0/test/tokensearch.test +1023 -0
  42. data/tcl/ptwidgets-1.1.0/test/wmarkentry.test +1325 -0
  43. data/tcl/themes/altTheme.tcl +101 -0
  44. data/tcl/themes/aquaTheme.tcl +59 -0
  45. data/tcl/themes/clamTheme.tcl +140 -0
  46. data/tcl/themes/classicTheme.tcl +108 -0
  47. data/tcl/themes/pkgIndex.tcl +3 -0
  48. data/tcl/themes/ttk.tcl +176 -0
  49. data/tcl/themes/vistaTheme.tcl +224 -0
  50. data/tcl/themes/winTheme.tcl +80 -0
  51. data/tcl/themes/xpTheme.tcl +65 -0
  52. data/tcl/tkfbox/folder.gif +0 -0
  53. data/tcl/tkfbox/textfile.gif +0 -0
  54. data/tcl/tkfbox/tkfbox.tcl +1 -0
  55. data/tcl/tkfbox/tkfbox.tcl~ +1 -0
  56. data/tcl/tkfbox/updir.xbm +1 -0
  57. metadata +43 -2
data/README CHANGED
@@ -1,24 +1,30 @@
1
1
  = Arcadia Ide
2
- version 0.12.2
2
+ version 0.13.0
3
3
 
4
4
  by Antonio Galeone
5
- on Apr 28, 2013
5
+ on Jul 24, 2013
6
6
 
7
7
 
8
8
  == About
9
9
 
10
- Arcadia is a Light Integrated Development Environment (IDE) for Ruby language
10
+ Arcadia is a light Integrated Development Environment (IDE) for Ruby language
11
11
  written in Ruby using the classic tcl/tk GUI toolkit.
12
12
 
13
13
  Some of Arcadia ide project features include:
14
14
  * Editor with source browsing, syntax highlighting, code completion
15
15
  * Working on any platform where ruby and tcl-tk work.
16
16
  * Debugging support
17
- * Highly extensibility architecture.
17
+ * Highly estensibile architecture.
18
18
 
19
19
 
20
20
  == News
21
21
 
22
+ [0.13.0]
23
+ This realease:
24
+ - improves file-history introducing bookmarks management
25
+ - improves layout
26
+ - fixes bugs
27
+
22
28
  [0.12.2]
23
29
  - this release adds support to debugger gem and fixes minor bugs
24
30
 
@@ -35,27 +41,31 @@ Some of Arcadia ide project features include:
35
41
  locale is settable in ~/.arcadia/arcadia.conf overriding default (locale=en-UK)
36
42
  ... collaborations in translations are welcome!
37
43
  - added possibility to interact with running application typing input in output's console
38
- - introduced in file-history a new kind of view (list view) activable by button on toolbar
44
+ - introduced in file-history a new kind of view (list view) activable by button on toolbar
39
45
  - bugs fixed and optimizations
40
46
 
41
47
  == Dependencies
42
48
 
43
49
  - rubygems
44
50
  - ruby-tk
45
- - tcl/tk
51
+ - tcl/tk (ruby-tk supports fully tcl/tk runtime <= 8.5 )
46
52
  - tk-tile (if tcl/tk < 8.5)
47
- - ctags
53
+ - ctags (linux)
48
54
  - xterm (linux, optional)
49
55
  - xdotool (linux, optional)
50
56
  - ack (optional)
51
57
  - gem coderay (> 1.0)
52
- - gem ruby-debug (debugger on ruby 1.9)
58
+ - gem debugger (ruby-debug on ruby < 1.9)
53
59
  - gem win32-process (only on windows)
54
60
  - gem ruby-wmi (only on windows)
55
61
 
56
62
  == How to install
57
63
  * exec on command line "gem install arcadia"
58
64
 
65
+ NOTE: on some linux distributions like archlinux the default tcl/tk runtime at this time is on versions >= 8.6
66
+ on the other hand ruby-tk supports fully only versions <= 8.5.x.y so to make arcadia working a choice
67
+ can be install ActiveTcl 8.5 and use ruby via rvm.
68
+
59
69
  == How to run
60
70
  * exec on command line "arcadia"
61
71
 
@@ -63,7 +73,7 @@ Some of Arcadia ide project features include:
63
73
  == Short User guide
64
74
  Application layout is splitted in vertical and horizontal resizable frames.
65
75
  On vertical and horizontal splitter appear two button for left or right
66
- one shot frame close.
76
+ one shot frame closing.
67
77
  Every frame has a title, a button to expand or resizing it and a menu-button
68
78
  for dynamic layout functions (like add row, add column, close or for move a frame).
69
79
 
@@ -114,33 +124,34 @@ It is a navigational tree:
114
124
  - open terminal from selected dir
115
125
 
116
126
  ==== File history
117
- The last used files are organizing in tree so you can reopen them or there
127
+ The last used files are organizing in tree so you can reopen them or their
118
128
  directory by clicking on the tree node.
119
129
 
120
130
  ==== Debug
121
- Require ruby-debug gem.
131
+ Require debugger gem.
122
132
  It is created when a debug session init.
123
133
  The debug button are: Step Next, Step Into, Step Over, Resume and quit.
124
134
  The debug frame show the local, instance and global variables for each
125
135
  step.
126
136
 
137
+ NOTE: at this moment debugger doesn't seem to work with ruby >= 2.0
138
+
127
139
  ==== Configuration
128
140
  Same Arcadia properties are locally configurabled by editing the file arcadia.conf
129
141
  under ~/.arcadia directory. The format of property definition are:
130
142
  <OPERATING SYSTEM IDENTIFY::>PROPERTY_NAME=PROPERTY_VALUE
131
143
 
132
144
 
133
- I have tested arcadia with ruby 1.8.4, 1.8.5, 1.8.6, 1.8.7, 1.9.1, 1.9.2 on
145
+ I have tested arcadia with ruby 1.8, 1.9, 2.0 on
134
146
 
135
147
  * Archlinux
136
- * Ubuntu
148
+ * Ubuntu/Mint
137
149
  * Fedora
138
150
  * FreeBsd6.x, FreeBsd7.x,
139
151
  * Vector linux 5.*,
140
152
  * Windows 2000/XP/7,
141
153
  * Cygwin (note: same page fault error on dll under cygwin may be solved in this way:
142
154
  by ash.exe exec "/bin/rebaseall").
143
- If you will test arcadia on other operating system sends me an e-mail.
144
155
 
145
156
  ==Developers e general information
146
157
  Released on arcadia web site (http://arcadia.rubyforge.org)
@@ -99,6 +99,7 @@ main.ps.runtime_errors=Runtime errors
99
99
  ext.editor.menu.view.show_hide_line_number=Show/Hide editor line numbers
100
100
  ext.editor.menu.view.show_hide_tabs=Show/Hide editor tabs
101
101
  ext.editor.button.link.hint=Link open editors with content in the Navigator
102
+ ext.editor.button.up.hint=View parent
102
103
  ext.editor.outline.rebuild_tree=.... rebuild tree
103
104
  ext.editor.outline.menu.rebuild=Rebuild
104
105
  ext.editor.text_line.menu.title=line $0
@@ -198,6 +199,7 @@ ext.file_history.button.show_as_list.hint=Show as list
198
199
  ext.file_history.menu.search_from_here=Search from here
199
200
  ext.file_history.menu.find_in_files=Find in files...
200
201
  ext.file_history.menu.act_in_files=Act in files...
202
+ ext.file_history.toggle_bookmark=Toggle boomark
201
203
  #output
202
204
  ext.output.menu.output=Output
203
205
  ext.output.menu.save=Save
@@ -230,7 +232,7 @@ ext.ruby_debug.client.e.socket_session.2=Error on socket session : $0:$1
230
232
  ext.ruby_debug.client.e.close_session=Error on close session : $0:$1
231
233
  ext.ruby_debug.client.e.start_session=Error on start_session : $0:$1 $2
232
234
  ext.ruby_debug.client.e.stop_session=Error on stop_session : $0:$1
233
- ext.ruby_debug.client.e.abort_session=Debugger has finished executing: $0:$1
235
+ ext.ruby_debug.client.e.abort_session=Debugger has finished executing on command $0: $1:$2
234
236
  ext.ruby_debug.client.e.raise.on_read.1=Debugged has finished executing
235
237
  ext.ruby_debug.client.e.raise.on_read.2=Error: on command '$0' => $1 : $2
236
238
  ext.ruby_debug.e.rdebug=Warning: Extension ae-ruby-debug depend upon rdebug command (install it or update system path!)
@@ -103,6 +103,16 @@ titlemenu.tearoff=0
103
103
  titlemenu.borderwidth=1
104
104
  titlemenu.relief=flat
105
105
 
106
+ titlebutton.=>>>button
107
+ titlebutton.background=>>>titlelabel.background
108
+ titlebutton.foreground=>>>titlelabel.foreground
109
+ titlebutton.activebackground=>>>titlelabel.activebackground
110
+ titlebutton.activeforeground=>>>titlelabel.activeforeground
111
+ titlebutton.borderwidth=1
112
+ titlebutton.relief=flat
113
+ titlebutton.direction=above
114
+ titlebutton.font>>>titlelabel.font
115
+
106
116
 
107
117
  splitter.background=>>>background
108
118
  splitter.highlightbackground=>>>foreground
@@ -272,6 +272,28 @@ R0lGODlhCQAJAPIAAP///8ziw4qyRHelIG2eDWaZAP///wAAACH5BAEAAAYA
272
272
  LAAAAAAJAAkAAAMdaCFUJEGNQulYFVRWi3YeIIpUk5XCSUFTdyncEyUAOw==
273
273
  EOS
274
274
 
275
+ ARROW_UP_GIF=<<EOS
276
+ R0lGODlhEAAQAIQYAAIsYxc7ZSZRhUhumUxvnU9yn1F0ok93pFR3pFZ7qVh7
277
+ qVqEsWePvoKYsXOdzX6p2o+u0Ym15pe225K98aDA5KjK7q7Q97fa////////
278
+ /////////////////////////yH+EUNyZWF0ZWQgd2l0aCBHSU1QACH5BAEK
279
+ AB8ALAAAAAAQABAAAAVd4CeOHwCQKAkoypmqyXUl7gsg1jRZSK0alYgwUjH4
280
+ SgXKY8mkFGoAgsRBrVIlhBNgAGF4v2DIwGQSLM7os4A8Ahze8PexRK6bXnib
281
+ vZ4CNP6Af3MAAYWGhYN7bCIhADs=
282
+ EOS
283
+
284
+
285
+ STAR_EMPTY_GIF=<<EOS
286
+ R0lGODlhEAAQAKU3AGRkZHt7e3x8fJKSkpWVlZaWlpqampubm5ycnKmpqaqq
287
+ qqurq6ysrK2tra6urrCwsLGxsbKysrOzs7S0tLW1tba2tre3t8TExMXFxcbG
288
+ xsfHx9TU1NXV1djY2NnZ2dvb2+Dg4OHh4eLi4ujo6Ovr6+zs7O3t7e7u7u/v
289
+ 7/Hx8fLy8vPz8/T09PX19fb29vf39/j4+Pn5+fr6+vv7+/z8/P39/f7+/v//
290
+ /////////////////////////////////yH+EUNyZWF0ZWQgd2l0aCBHSU1Q
291
+ ACH5BAEKAD8ALAAAAAAQABAAAAZpwJ9wSCwaj8ghJJIsajRNoscTFUpGI8nR
292
+ 4JhMKh2VqmPxOg7DR4dkWrlerVOpAykmNiuYbBZrcRJHBx4yNTY0HwhIBCB7
293
+ NDQiBUgMKygXGCksDUgYIApCCyEZRwEUA0QDFQJGAEisVUZBADs=
294
+ EOS
295
+
296
+
275
297
  ADD_GIF=<<EOS
276
298
  R0lGODlhEAAQAMQAADRlpH2m14Oq2LbM5n+o14at2ZCz2pK02pS225++4LXM
277
299
  5rbN5sDT6JW327TM5bfO5rvR57zR5////wAAAAAAAAAAAAAAAAAAAAAAAAAA
@@ -1330,6 +1352,12 @@ JgtCBMCTbQcibiFQVqcLIIc3lmdqqRSscTaQiGQK/Dqf0M1nlDldElrvcjkR
1330
1352
  eqrNtPhBLrRLK8ELJorJ12VRg0TI1EWXcT5/SWRUSwQAOw==
1331
1353
  EOS
1332
1354
 
1355
+ BOOKMARK_GIF=<<EOS
1356
+ R0lGODlhEAAQAKECADNmAEC/AP///////yH5BAEKAAIALAAAAAAQABAAAAIw
1357
+ lB0ZxxwAwWrnMUkNQHPn/WAetXllJpzp+rEq6bKwKTfqa8djvu9XqrCgNJGh
1358
+ 8VAAADs=
1359
+ EOS
1360
+
1333
1361
  FOLDER_GIF=<<EOS
1334
1362
  R0lGODlhEgASAMIGAAAAAISCAISChK2qre/Tpffjtf///////yH+EUNyZWF0
1335
1363
  ZWQgd2l0aCBHSU1QACH5BAEAAAcALAAAAAASABIAAANSeLrcPsPJA42BCstx
@@ -2030,4 +2058,4 @@ EOS
2030
2058
  TREE_VIEW_GIF=<<EOS
2031
2059
  R0lGODlhDgAOAIABAP///////yH5BAEAAAEALAAAAAAOAA4AQAIbjI9poO0P
2032
2060
  gWRxhkkPvlbnt0WI1HyhNn7OCR0FADs=
2033
- EOS
2061
+ EOS
@@ -45,7 +45,11 @@ class SourceStructure
45
45
  attr_reader :root
46
46
 
47
47
  def initialize
48
- @root = SourceTreeNode.new(nil, 'root'){|_node|
48
+ @root = SourceStructure.root
49
+ end
50
+
51
+ def SourceStructure.root
52
+ SourceTreeNode.new(nil, 'root'){|_node|
49
53
  _node.rif= 'root'
50
54
  _node.label=''
51
55
  }
@@ -797,6 +801,31 @@ class AgEditorOutlineToolbar
797
801
  }
798
802
  @sync = false
799
803
  @cb_sync.command(do_check)
804
+
805
+ #----
806
+ go_to_parent = proc{
807
+ e = @controller.active_instance.raised
808
+ if e
809
+ no = e.outline.last_opened
810
+ if no
811
+ e.outline.tree_exp.see(no)
812
+ else
813
+ _selected = e.outline.tree_exp.selected
814
+ if _selected && e.outline.tree_exp.exist?(_selected)
815
+ _parent = e.outline.tree_exp.parent(_selected)
816
+ if _parent && _parent != 'root'
817
+ e.outline.tree_exp.see(_parent)
818
+ else
819
+ e.outline.tree_exp.see(_selected)
820
+ end
821
+ end
822
+ end
823
+ end
824
+
825
+ }
826
+
827
+ @b_goto_p = @controller.main_instance.frame(1).root.add_button(@controller.main_instance.frame(1).name, Arcadia.text("ext.editor.button.up.hint"), go_to_parent, ARROW_UP_GIF)
828
+ #----
800
829
  end
801
830
 
802
831
  def sync_on
@@ -822,6 +851,7 @@ class AgEditorOutline
822
851
  attr_reader :last_row
823
852
  attr_reader :tree_exp
824
853
  attr_reader :ss
854
+ attr_reader :last_opened
825
855
  def initialize(_editor, _frame, _bar, _lang=nil)
826
856
  @editor = _editor
827
857
  @frame = _frame
@@ -838,7 +868,7 @@ class AgEditorOutline
838
868
  end
839
869
 
840
870
  # I think this is "if synced expand out the outline for the current selection"
841
- def shure_select_node(_node)
871
+ def shure_select_node(_node, _close_if_opened = true)
842
872
  return if @selecting_node
843
873
  #return if @tree_exp.exist?(_node.rif)
844
874
  @selecting_node = true
@@ -856,7 +886,7 @@ class AgEditorOutline
856
886
  @last_open_node=parent.rif
857
887
  parent = parent.parent
858
888
  end
859
- @tree_exp.close_tree(to_open) if to_open && !@opened
889
+ @tree_exp.close_tree(to_open) if _close_if_opened && to_open && !@opened
860
890
  @tree_exp.see(_node.rif)
861
891
  ensure
862
892
  @tree_exp.selectcommand(_proc)
@@ -865,6 +895,15 @@ class AgEditorOutline
865
895
  @tree_exp.call_after_next_show_h_scroll(proc{Tk.update;@tree_exp.see(_node.rif)})
866
896
  end
867
897
 
898
+ def shure_select_line(_line, _close_if_opened = true)
899
+ if @ss && _line
900
+ node = @ss.node_by_line(@ss.root, _line)
901
+ else
902
+ node = SourceStructure.root
903
+ end
904
+ shure_select_node(node, _close_if_opened)
905
+ end
906
+
868
907
  def select_without_event(_line)
869
908
  if @ss
870
909
  _node=@ss.deep_node_by_line(@ss.root, _line)
@@ -904,11 +943,15 @@ class AgEditorOutline
904
943
  @bar.sync = sync_val
905
944
  end
906
945
  }
946
+ do_open_command = proc{|no|
947
+ @last_opened = no
948
+ }
907
949
  @tree_exp = BWidgetTreePatched.new(_frame, Arcadia.style('treepanel')){
908
950
  showlines false
909
951
  deltay 18
910
952
  dragenabled true
911
953
  selectcommand proc{ _tree_goto.call(self) }
954
+ opencmd do_open_command
912
955
  crosscloseimage Arcadia.image_res(ARROWRIGHT_GIF)
913
956
  crossopenimage Arcadia.image_res(ARROWDOWN_GIF)
914
957
  }
@@ -1056,7 +1099,7 @@ class AgEditor
1056
1099
  @highlighting = false
1057
1100
  @classbrowsing = false
1058
1101
  @codeinsight = false
1059
- @find = @controller.get_find
1102
+ #@find = @controller.get_find
1060
1103
  @read_only=false
1061
1104
  @loading=false
1062
1105
  @tabs_show = false
@@ -1677,7 +1720,7 @@ class AgEditor
1677
1720
  when 'F5'
1678
1721
  run_buffer
1679
1722
  when 'F3'
1680
- @find.do_find_next
1723
+ @controller.get_find.do_find_next
1681
1724
  when 'F1'
1682
1725
  line, col = @text.index('insert').split('.')
1683
1726
  _x, _y = xy_insert
@@ -1811,20 +1854,20 @@ class AgEditor
1811
1854
  end
1812
1855
  end
1813
1856
  end
1814
-
1857
+
1815
1858
  # show the "find in file" dialog
1816
1859
  def find
1817
1860
  _r = @text.tag_ranges('sel')
1818
1861
  if _r.length>0
1819
1862
  _text=@text.get(_r[0][0],_r[0][1])
1820
1863
  if _text.length > 0
1821
- @find.e_what.text(_text)
1864
+ @controller.get_find.e_what.text(_text)
1822
1865
  end
1823
1866
  else
1824
1867
  end
1825
- @find.use(self)
1826
- @find.e_what.focus
1827
- @find.show
1868
+ @controller.get_find.use(self)
1869
+ @controller.get_find.e_what.focus
1870
+ @controller.get_find.show
1828
1871
  end
1829
1872
 
1830
1873
  def disactivate_key_binding
@@ -1901,6 +1944,8 @@ class AgEditor
1901
1944
  @text_line_num.tag_configure('normal_case', 'justify'=>'right')
1902
1945
  @text_line_num.tag_configure('bold_case', 'spacing3'=>delta, 'justify'=>'right')
1903
1946
  @text_line_num.tag_configure('breakpoint', 'background'=>'red','foreground'=>'yellow','borderwidth'=>1, 'relief'=>'raised')
1947
+ # @text_line_num.tag_configure('bookmark', 'background'=>'blue','foreground'=>'yellow','borderwidth'=>1, 'relief'=>'raised')
1948
+ @text_line_num.tag_configure('bookmark', 'background'=>'white','foreground'=>'red','borderwidth'=>1, 'relief'=>'raised')
1904
1949
  @text_line_num.tag_configure('current',
1905
1950
  'background'=>Arcadia.conf("activebackground"),
1906
1951
  'foreground'=>Arcadia.conf("activeforeground"),
@@ -1961,6 +2006,24 @@ class AgEditor
1961
2006
  }
1962
2007
  )
1963
2008
 
2009
+ _pop_up.insert('end',
2010
+ :command,
2011
+ :label=> Arcadia.text('ext.file_history.toggle_bookmark'),
2012
+ :hidemargin => false,
2013
+ :command=> proc{
2014
+ if defined?(@text_line_num_current_index)
2015
+ row = @text_line_num.get(@text_line_num_current_index+' linestart',@text_line_num_current_index+' lineend').strip
2016
+ ToggleBookmarkEvent.new(self,
2017
+ 'file'=>@file,
2018
+ 'from_row'=>row,
2019
+ 'to_row'=>row,
2020
+ 'persistent'=>File.exists?(@file),
2021
+ 'id'=>@id).go!
2022
+ end
2023
+ }
2024
+ )
2025
+
2026
+
1964
2027
  @text_line_num.bind("Button-3",
1965
2028
  proc{|*x|
1966
2029
  _x = TkWinfo.pointerx(@text_line_num)
@@ -2020,6 +2083,24 @@ class AgEditor
2020
2083
  end
2021
2084
  end
2022
2085
 
2086
+ def add_tag_bookmark(_line)
2087
+ rel_line = file_line_to_text_line_num_line(_line)
2088
+ if rel_line
2089
+ i1 = "#{rel_line}.2"
2090
+ i2 = i1+' lineend'
2091
+ @text_line_num.tag_add('bookmark',i1,i2)
2092
+ end
2093
+ end
2094
+
2095
+ def remove_tag_bookmark(_line)
2096
+ rel_line = file_line_to_text_line_num_line(_line)
2097
+ if rel_line
2098
+ i1 = "#{rel_line}.0"
2099
+ i2 = i1+' lineend'
2100
+ @text_line_num.tag_remove('bookmark',i1,i2)
2101
+ end
2102
+ end
2103
+
2023
2104
  def reset_highlight(_from_row=nil)
2024
2105
  if _from_row && @highlighting
2025
2106
  invalidated_begin_zone= zone_of_row(_from_row)
@@ -2863,6 +2944,8 @@ class AgEditor
2863
2944
  if @line_numbers_visible
2864
2945
  # breakpoint
2865
2946
  b = @controller.breakpoint_lines_on_file(@file)
2947
+ # bookmark
2948
+ bm = @controller.bookmark_lines_on_file(@file)
2866
2949
 
2867
2950
  @text_line_num.delete('1.0','end')
2868
2951
  _rx, _ry, _width, _heigth = @text.bbox(line_begin_index);
@@ -2901,6 +2984,9 @@ class AgEditor
2901
2984
  if b.include?(j.to_s)
2902
2985
  add_tag_breakpoint(j)
2903
2986
  end
2987
+ if bm.include?(j.to_s)
2988
+ add_tag_bookmark(j)
2989
+ end
2904
2990
  end
2905
2991
  if _ry && _ry < 0
2906
2992
  @text_line_num.yview_scroll(_ry.abs+2,"pixels")
@@ -3474,6 +3560,7 @@ class AgMultiEditorView
3474
3560
  end
3475
3561
 
3476
3562
  def page_title(_name, _title=nil, _image=nil)
3563
+ return nil if _name.nil? or _name.strip.length == 0
3477
3564
  @pages[_name]['text'] = _title if _title != nil
3478
3565
  @pages[_name]['image'] = _image if _image != nil
3479
3566
  title = _title
@@ -3819,9 +3906,6 @@ class CoderayHighlightScanner < HighlightScanner
3819
3906
  @i = nil
3820
3907
  end
3821
3908
  tok = @tok
3822
-
3823
- #p tok
3824
-
3825
3909
  if tok[1]==:space && tok[0].include?("\n")
3826
3910
  row+=tok[0].count("\n")
3827
3911
  begin_gap = tok[0].split("\n")[-1]
@@ -3834,6 +3918,7 @@ class CoderayHighlightScanner < HighlightScanner
3834
3918
  toklength = tok[0].length
3835
3919
  t_begin="#{row}.#{col}"
3836
3920
  if tok[0].include?("\n")
3921
+ #if tok[0].to_s.include?("\n")
3837
3922
  ar = tok[0].split("\n")
3838
3923
  row+=tok[0].count("\n")
3839
3924
  begin_gap = ar[-1]
@@ -3875,6 +3960,7 @@ class AgMultiEditor < ArcadiaExtPlus
3875
3960
  ArcadiaProblemEvent.new(self, "type"=>ArcadiaProblemEvent::DEPENDENCE_MISSING_TYPE,"title"=>Arcadia.text("ext.editor.e.ctags.title"), "detail"=>msg).go!
3876
3961
  end
3877
3962
  @breakpoints =Array.new
3963
+ @bookmarks =Array.new
3878
3964
  @tabs_file =Hash.new
3879
3965
  @tabs_editor =Hash.new
3880
3966
  @raw_buffer_name = Hash.new
@@ -3888,6 +3974,7 @@ class AgMultiEditor < ArcadiaExtPlus
3888
3974
  Arcadia.attach_listener(self, RunCmdEvent)
3889
3975
  # Arcadia.attach_listener(self, StartDebugEvent)
3890
3976
  Arcadia.attach_listener(self, FocusEvent)
3977
+ Arcadia.attach_listener(self, BookmarkEvent)
3891
3978
  end
3892
3979
 
3893
3980
  # def on_before_run_ruby_file(_event)
@@ -4056,9 +4143,16 @@ class AgMultiEditor < ArcadiaExtPlus
4056
4143
  end
4057
4144
  @last_active_instance_name = _event.name if _event.name == @name || exist_name?(_event.name)
4058
4145
  end
4146
+
4147
+ def deduplicate
4148
+ @main_frame.pages.each{|page|
4149
+ main_instance.move_buffer_here(page)
4150
+ }
4151
+ super
4152
+ end
4059
4153
 
4060
- def duplicate(_name=new_name)
4061
- instance = super(_name)
4154
+ def duplicate(_name, _dom)
4155
+ instance = super(_name, _dom, false)
4062
4156
  i_end = @buffer_menu.index('end')
4063
4157
  if i_end
4064
4158
  0.upto(i_end){|j|
@@ -4497,6 +4591,80 @@ class AgMultiEditor < ArcadiaExtPlus
4497
4591
  # end
4498
4592
  # end
4499
4593
 
4594
+ def on_before_bookmark(_event)
4595
+ _filename = _event.file
4596
+ if _filename.nil? || _filename == "*CURR"
4597
+ current_editor = self.raised
4598
+ _event.persistent=true
4599
+ if current_editor
4600
+ if current_editor.file
4601
+ _event.file=current_editor.file
4602
+ else
4603
+ _event.file=current_editor.create_temp_file
4604
+ _event.id=current_editor.id
4605
+ _event.persistent=false
4606
+ end
4607
+ end
4608
+ else
4609
+ current_editor = editor_of(_filename)
4610
+ end
4611
+
4612
+ if _event.from_row != nil && _event.to_row == nil
4613
+ _event.to_row = _event.from_row
4614
+ elsif _event.from_row == nil && _event.to_row == nil && _event.row != nil
4615
+ _event.from_row = _event.row
4616
+ _event.to_row = _event.row
4617
+ end
4618
+
4619
+ if _event.range == nil
4620
+ _event.range=0
4621
+ end
4622
+
4623
+ if _event.from_row == nil && current_editor != nil
4624
+ r_sel = current_editor.text.tag_ranges('sel')
4625
+ if !r_sel.empty?
4626
+ _event.from_row = r_sel[0][0].split('.')[0].to_i
4627
+ _event.to_row = r_sel[r_sel.length - 1][1].split('.')[0].to_i
4628
+ else
4629
+ _event.from_row = current_editor.text.index('insert').split('.')[0].to_i
4630
+ _event.to_row = _event.from_row
4631
+ end
4632
+ end
4633
+
4634
+ case _event
4635
+ when SetBookmarkEvent
4636
+ #set
4637
+ if _event.persistent
4638
+ @bookmarks << {:file=>_event.file,:from_line=>_event.from_row, :to_line=>_event.to_row}
4639
+ _e = @tabs_editor[tab_file_name(_event.file)]
4640
+ else
4641
+ @bookmarks << {:file=>"__TMP__#{_event.id}",:from_line=>_event.from_row, :to_line=>_event.to_row}
4642
+ _e = @editors[_event.id]
4643
+ end
4644
+ if _e
4645
+ index_from = "#{_event.from_row}.0"
4646
+ index_to = "#{_event.to_row}.0 lineend"
4647
+ _event.content = _e.text.get(index_from, index_to)
4648
+ _event.from_row.upto(_event.to_row) do |row|
4649
+ _e.add_tag_bookmark(row)
4650
+ end
4651
+ end
4652
+ when UnsetBookmarkEvent
4653
+ #unset
4654
+ @bookmarks.delete_if{|b| (b[:file]==_event.file && b[:from_line]==_event.from_row)}
4655
+ if _event.file && File.exists?(_event.file)
4656
+ _e = @tabs_editor[tab_file_name(_event.file)]
4657
+ elsif _event.id
4658
+ _e = @editors[_event.id]
4659
+ end
4660
+ _event.from_row.upto(_event.to_row) do |row|
4661
+ _e.remove_tag_bookmark(row) if _e
4662
+ end
4663
+ end
4664
+ end
4665
+
4666
+
4667
+
4500
4668
  def on_before_step_debug(_event)
4501
4669
  debug_reset
4502
4670
  end
@@ -4597,7 +4765,8 @@ class AgMultiEditor < ArcadiaExtPlus
4597
4765
  elsif !editor_exist?(_event.file) && _event.last_row
4598
4766
  _index = _event.last_row.to_s+'.0'
4599
4767
  end
4600
- if _event.kind_of?(OpenBufferTransientEvent) && conf('close-last-if-not-modified')=="yes"
4768
+ if _event.kind_of?(OpenBufferTransientEvent)
4769
+ if conf('close-last-if-not-modified')=="yes"
4601
4770
  if defined?(@last_transient_file) && !@last_transient_file.nil? && @last_transient_file != _event.file
4602
4771
  _e = @tabs_editor[tab_name(@last_transient_file)]
4603
4772
  if _e && !_e.modified_from_opening?
@@ -4608,6 +4777,10 @@ class AgMultiEditor < ArcadiaExtPlus
4608
4777
  @last_transient_file = _event.file
4609
4778
  else
4610
4779
  @last_transient_file = nil
4780
+ _event.transient = false
4781
+ end
4782
+ else
4783
+ _event.transient = false
4611
4784
  end
4612
4785
  end
4613
4786
  if _event.select_index.nil?
@@ -4814,6 +4987,18 @@ class AgMultiEditor < ArcadiaExtPlus
4814
4987
  }
4815
4988
  return result
4816
4989
  end
4990
+
4991
+ def bookmark_lines_on_file(_file)
4992
+ result = Array.new
4993
+ @bookmarks.each{|value|
4994
+ if value[:file]==_file
4995
+ value[:from_line].upto(value[:to_line]) do |i|
4996
+ result << i.to_s
4997
+ end
4998
+ end
4999
+ }
5000
+ return result
5001
+ end
4817
5002
 
4818
5003
  def on_layout_raising_frame(_event)
4819
5004
  if _event.extension_name == "editor" && _event.frame_name=="editor_outline"
@@ -4861,46 +5046,46 @@ class AgMultiEditor < ArcadiaExtPlus
4861
5046
  self
4862
5047
  end
4863
5048
 
4864
- def bookmark_add(_file, _index)
4865
- if @bookmarks == nil
4866
- @bookmarks = Array.new
4867
- @bookmarks_index = - 1
5049
+ def chrono_bookmark_add(_file, _index)
5050
+ if @chrono_bookmarks == nil
5051
+ @chrono_bookmarks = Array.new
5052
+ @chrono_bookmarks_index = - 1
4868
5053
  else
4869
- _cur_file, _cur_index = @bookmarks[@bookmarks_index]
5054
+ _cur_file, _cur_index = @chrono_bookmarks[@chrono_bookmarks_index]
4870
5055
  if _cur_file == _file && _cur_index == _index
4871
5056
  #@arcadia.outln('uguale ----> '+_file+':'+_index)
4872
5057
  return
4873
5058
  end
4874
- @bookmarks = @bookmarks[0..@bookmarks_index]
5059
+ @chrono_bookmarks = @chrono_bookmarks[0..@chrono_bookmarks_index]
4875
5060
  end
4876
- @bookmarks << [_file, _index]
4877
- @bookmarks_index = @bookmarks.length - 1
5061
+ @chrono_bookmarks << [_file, _index]
5062
+ @chrono_bookmarks_index = @chrono_bookmarks.length - 1
4878
5063
  #@arcadia.outln('add ----> '+_file+':'+_index)
4879
5064
  end
4880
5065
 
4881
- def bookmark_clear
4882
- @bookmarks.clear
4883
- @bookmarks_index = - 1
5066
+ def chrono_bookmark_clear
5067
+ @chrono_bookmarks.clear
5068
+ @chrono_bookmarks_index = - 1
4884
5069
  end
4885
5070
 
4886
- def bookmark_next
4887
- return if @bookmarks == nil || @bookmarks_index >= @bookmarks.length - 1
4888
- bookmark_move(+1)
5071
+ def chrono_bookmark_next
5072
+ return if @chrono_bookmarks == nil || @chrono_bookmarks_index >= @chrono_bookmarks.length - 1
5073
+ chrono_bookmark_move(+1)
4889
5074
  end
4890
5075
 
4891
- def bookmark_move(_n=0)
4892
- @bookmarks_index = @bookmarks_index + _n
5076
+ def chrono_bookmark_move(_n=0)
5077
+ @chrono_bookmarks_index = @chrono_bookmarks_index + _n
4893
5078
  #Tk.messageBox('message'=>@bookmarks_index.to_s)
4894
- _file, _index = @bookmarks[@bookmarks_index]
5079
+ _file, _index = @chrono_bookmarks[@chrono_bookmarks_index]
4895
5080
  _line, _col = _index.split('.') if _index
4896
5081
  open_file(_file, _index)
4897
5082
  #openfile(@bookmarks[@bookmarks_index])
4898
5083
  end
4899
5084
 
4900
5085
 
4901
- def bookmark_prev
4902
- return if @bookmarks == nil || @bookmarks_index <= 0
4903
- bookmark_move(-1)
5086
+ def chrono_bookmark_prev
5087
+ return if @chrono_bookmarks == nil || @chrono_bookmarks_index <= 0
5088
+ chrono_bookmark_move(-1)
4904
5089
  end
4905
5090
 
4906
5091
 
@@ -4921,7 +5106,7 @@ class AgMultiEditor < ArcadiaExtPlus
4921
5106
  end
4922
5107
 
4923
5108
  def unname_modified(_name)
4924
- return _name.gsub("(...)",'')
5109
+ return (_name && _name.strip.length > 0) ? _name.gsub("(...)",'') : nil
4925
5110
  end
4926
5111
 
4927
5112
 
@@ -5005,13 +5190,10 @@ class AgMultiEditor < ArcadiaExtPlus
5005
5190
  if @arcadia.layout.headed?
5006
5191
  if frame.root.title == frame.title || @last_frame_caption != _new_caption
5007
5192
  make_buffer_string(@main_frame.page(_name)['text']) if @main_frame.page(_name)
5008
- #@buffer_menu_button.configure('image'=>@main_frame.page(_name)['image']) if @main_frame.page(_name)
5009
- # frame.root.top_text(@main_frame.page(_name)['text'], @main_frame.page(_name)['image']) if @main_frame.page(_name)
5010
5193
  frame.root.top_text(top_text_string, @main_frame.page(_name)['image']) if @main_frame.page(_name)
5011
5194
  frame.root.top_text_hint(_new_caption)
5012
5195
  @last_frame_caption = _new_caption
5013
5196
  end
5014
- # frame.root.save_caption(frame.name, @main_frame.page(_name)['text'], @main_frame.page(_name)['image'])
5015
5197
  end
5016
5198
  end
5017
5199
 
@@ -5474,12 +5656,21 @@ class AgMultiEditor < ArcadiaExtPlus
5474
5656
  # @raw_buffer_name.delete_if {|key, value| value == _name }
5475
5657
  _index = @main_frame.index(_name)
5476
5658
  @main_frame.delete_page(_name, !_moved)
5477
- if !@main_frame.pages.empty? && is_raised
5478
- @main_frame.raise(@main_frame.pages[_index-1]) if TkWinfo.mapped?(@main_frame.root_frame)
5479
- else
5480
- frame.root.top_text_clear if TkWinfo.mapped?(frame.hinner_frame)
5481
- make_buffer_string("")
5482
- reset_status
5659
+ if is_raised
5660
+ if !@main_frame.pages.empty? # && is_raised
5661
+ #@main_frame.raise(@main_frame.pages[_index-1]) if TkWinfo.mapped?(@main_frame.root_frame)
5662
+ len = @main_frame.pages.length
5663
+ if _index < len
5664
+ ind = _index
5665
+ else
5666
+ ind = _index-1
5667
+ end
5668
+ @main_frame.raise(@main_frame.pages[ind]) if TkWinfo.mapped?(@main_frame.root_frame)
5669
+ else
5670
+ frame.root.top_text_clear if TkWinfo.mapped?(frame.hinner_frame)
5671
+ make_buffer_string("")
5672
+ reset_status
5673
+ end
5483
5674
  end
5484
5675
  end
5485
5676
 
@@ -5752,7 +5943,7 @@ class Finder < Findview
5752
5943
  self.editor.text.tag_add('selected',_index,_index+' lineend')
5753
5944
  #self.editor.text.tag_add('sel', _index,_index+' lineend')
5754
5945
  self.editor.text.set_insert(_index)
5755
- @controller.bookmark_add(self.editor.file, _index)
5946
+ @controller.chrono_bookmark_add(self.editor.file, _index)
5756
5947
  @goto_line_dialog.hide
5757
5948
  end
5758
5949
  #self.hide()
@@ -5823,7 +6014,7 @@ class Finder < Findview
5823
6014
  @idx1 =_index
5824
6015
  @idx2 =_index_sel_end
5825
6016
  _found = true
5826
- @controller.bookmark_add(self.editor.file, _index)
6017
+ @controller.chrono_bookmark_add(self.editor.file, _index)
5827
6018
  else
5828
6019
  _message = '"'+@e_what.value+'" not found'
5829
6020
  TkDialog2.new('message'=>_message, 'buttons'=>['Ok']).show()