arcadia 0.10.0 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -1,27 +1,35 @@
1
1
  = Arcadia Ide
2
- version 0.10.0
2
+ version 0.11.0
3
3
 
4
4
  by Antonio Galeone
5
- on Jun 03, 2011
5
+ on Nov 04, 2011
6
6
 
7
7
 
8
8
  == About
9
9
 
10
10
  Arcadia is a Light Integrated Development Environment (IDE) for Ruby language
11
- written in classic Ruby using the classic tcl/tk GUI toolkit.
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
- * Debugging support
16
15
  * Working on any platform where ruby and tcl-tk work.
16
+ * Debugging support
17
17
  * Highly extensibility architecture.
18
18
 
19
- == In this release 0.10.0
19
+ == In this release 0.11.0
20
20
 
21
21
  [Improvements]
22
- - bugs fixed
23
- - added initial basic support for other languages (python,java)
24
-
22
+ added some new features:
23
+ - now you can open more than one instance of "Editor" and "Dir Project"
24
+ by clicking on button with "plus" icon on the left side of title bar.
25
+ This can be usefull if you want see 2 buffers at the same time.
26
+ - now you can hide the tabs in Editor (for optimizing space) by menu item :
27
+ "View->Show/Hide Editor Tabs" and recall a buffer by menubutton on right side
28
+ of title bar
29
+ - porting to new version of coderay
30
+
31
+ A lot of bugs fixed !!!
32
+
25
33
  == Dependencies
26
34
  - rubygems
27
35
  - ruby-tk
@@ -29,15 +37,13 @@ Some of Arcadia ide project features include:
29
37
  - tk-tile (if tcl/tk < 8.5)
30
38
  - ctags
31
39
  - ack (optional)
32
- - gem coderay
40
+ - gem coderay (> 1.0)
33
41
  - gem ruby-debug (ruby-debug19 on ruby 1.9)
34
42
  - gem win32-process (only on windows)
35
43
  - gem ruby-wmi (only on windows)
36
44
 
37
45
  == How to install
38
- There are two way:
39
- 1. exec as root on command line "gem install arcadia"
40
- or as user "sudo gem install arcadia"
46
+ * exec on command line "gem install arcadia"
41
47
 
42
48
  == How to run
43
49
  * exec on command line "arcadia"
@@ -48,7 +54,7 @@ Application layout is splitted in vertical and horizontal resizable frames.
48
54
  On vertical and horizontal splitter appear two button for left or right
49
55
  one shot frame close.
50
56
  Every frame has a title, a button to expand or resizing it and a menu-button
51
- for the dynamic layout functions.
57
+ for dynamic layout functions (like add row, add column, close or for move a frame).
52
58
 
53
59
  ==== Main Toolbar
54
60
  The toolbar button are in order:
@@ -63,7 +69,7 @@ The toolbar button are in order:
63
69
  - quit (to exit from arcadia)
64
70
 
65
71
  ==== Editor
66
- Editor use the notebook metaphor. Same command are on the popup menu
72
+ Editor can use the notebook metaphor. Same command are on the popup menu
67
73
  that is raised on "Button-3" click event fundamentally for closing the tab
68
74
  under the mouse pointer.
69
75
  These are same editor short-cut:
data/conf/arcadia.conf CHANGED
@@ -79,9 +79,10 @@ scrollbar.elementborderwidth=1
79
79
  scrollbar.width=15
80
80
 
81
81
  titlelabel.background=#303b50
82
- titlelabel.foreground=#e8e651
82
+ titlelabel.foreground=#cbec21
83
83
  titlelabel.activebackground=#6679f1
84
- titlelabel.activeforeground=#cbec21
84
+ titlelabel.activeforeground=#e8e651
85
+ titlelabel.disabledforeground=#266626662666
85
86
  titlelabel.highlightbackground=white
86
87
  titlelabel.relief=flat
87
88
  titlelabel.borderwidth=0
@@ -284,6 +285,7 @@ hightlight.method.foreground=#007F7F
284
285
  hightlight.number.foreground=#007F7F
285
286
  hightlight.instance_variable.foreground=#7F7F7F
286
287
  hightlight.global_variable.foreground=#db66ca
288
+ hightlight.class_variable.foreground=#db66ca
287
289
  hightlight.constant.foreground=#bdc175
288
290
  hightlight.tag.foreground=#69a8d9
289
291
  hightlight.sel.foreground=black
@@ -293,7 +295,7 @@ hightlight.sel.relief=raised
293
295
  #hightlight.selected.foreground=red
294
296
  hightlight.selected.background=yellow
295
297
  hightlight.link.foreground=red
296
-
298
+ hightlight.exception.foreground=red
297
299
  hightlight.debug.foreground=#d95ed9
298
300
  hightlight.debug.background=#b3c1d9
299
301
  hightlight.debug.borderwidth=2
data/conf/arcadia.init.rb CHANGED
@@ -55,3 +55,4 @@ EOL
55
55
  exit
56
56
  end
57
57
  Tk.tk_call "eval","set auto_path [concat $::auto_path tcl]"
58
+ #Tk.tk_call "eval","set tk_strictMotif true"
data/conf/arcadia.res.rb CHANGED
@@ -1640,6 +1640,22 @@ CBMeFKiwYQCGCSEilLgQgEKKDy1G1FhwYMWKHT9uvKhxYkmRJkk6VLnSZMeX
1640
1640
  AQEAOw==
1641
1641
  EOS
1642
1642
 
1643
+ PLUS_EX_GIF=<<EOS
1644
+ R0lGODlhEAAQAMZBAABtAABwAAByAAB1AAB4AAB6AAB9AACBAACDAACFAACH
1645
+ AACJAACLAACNAACPAACRAACTAJubm56enqKioqOjo3fdRHjeRXvhSMjIyMrK
1646
+ yobsU87Ozs/Pz9DQ0NHR0dLS0o3zWtTU1NbW1pH3XtfX19nZ2dzc3N3d3d/f
1647
+ 3+Dg4OPj4+bm5ufn5+np6erq6uzs7O3t7e7u7vDw8PHx8fLy8vPz8/T09PX1
1648
+ 9fb29vf39/j4+Pn5+fr6+vv7+/z8/P39/f7+/v//////////////////////
1649
+ ////////////////////////////////////////////////////////////
1650
+ ////////////////////////////////////////////////////////////
1651
+ ////////////////////////////////////////////////////////////
1652
+ /////////////////////////////////////////////////yH+EUNyZWF0
1653
+ ZWQgd2l0aCBHSU1QACwAAAAAEAAQAAAHtIAZFBKEhYYSERSCPD4/Po+OPz9B
1654
+ QT48gz0bHB0eHyEkJSYoKiwuhD6bnSEioSmkLjGEP5yeoCaupTEyp6qsEA8N
1655
+ pTAyNLK1oQ4jCy7DNDaynyXADCAIBwbOOLKgJw0jIBoXFgQ2ODqyrQoJBxcF
1656
+ AwHmPLInrisuBhUCNfE9p7guL94B4PfjlIoVLV7EmFHjho4dPX4AkYVQIcMb
1657
+ OSBKDCJhAo+ECxtmjAiE0gQMEw6p7IghEAA7
1658
+ EOS
1643
1659
 
1644
1660
 
1645
1661
  #MINUS_GIF=<<EOS
@@ -1676,6 +1692,17 @@ AAAAAAAAAAAAAAAAAAAAACH5BAAAAAAALAAAAAAOAA4AAAgzAAEIHEiwYICD
1676
1692
  CBMeFKiwYQCGDhNCjLgQAEWEEAsOrFhRI8eLDy2CnEiRZESTDjWqFBgQADs=
1677
1693
  EOS
1678
1694
 
1695
+ MINUS_EX_GIF=<<EOS
1696
+ R0lGODlhEAAQAKU8AHAxAHUzAHg0AHo1AH02AIE4AIM5AIU6AIc7AIs8AI09
1697
+ AJE/AN5VReFYSOxjU/NqWvduXpubm56enqKioqOjo8jIyMrKys7Ozs/Pz9DQ
1698
+ 0NHR0dLS0tTU1NbW1tfX19nZ2dzc3N3d3d/f3+Dg4OPj4+bm5ufn5+np6erq
1699
+ 6uzs7O3t7e7u7u/v7/Dw8PHx8fLy8vPz8/T09PX19fb29vf39/j4+Pn5+fr6
1700
+ +vv7+/z8/P39/f7+/v///////////////yH+EUNyZWF0ZWQgd2l0aCBHSU1Q
1701
+ ACwAAAAAEAAQAAAGoUALRUIsGiURivCW0+WeTp2Ox8vdhrgLJqPZcDwfkIhk
1702
+ QhFz2y6nEx6RUSuijusFg9zlVeusZt/fKi0vcnVtgIIxcl8fCwoJCQYFBC8x
1703
+ M3JgIQoQDw4NDAKVNXJtCAcFAwMBADM1N3IhbiUoKSwuMKw3OGd4s7W3rTg6
1704
+ ZyQlJykrtjI1NsE7csXHyTTMOjs8EhM3xsgwMtPNVBMVE0fl2BVBADs=
1705
+ EOS
1679
1706
 
1680
1707
 
1681
1708
  FILE_ICON_DEFAULT=DOCUMENT_GIF
data/conf/theme-dark.conf CHANGED
@@ -70,15 +70,18 @@ progress.relief=groove
70
70
 
71
71
  hightlight.reserved.foreground=#60f856
72
72
  #hightlight.comment.foreground=#21a648
73
- hightlight.comment.foreground=#000058520000
73
+ #hightlight.comment.foreground=#000058520000
74
+ hightlight.comment.foreground=#009999
74
75
  hightlight.string.foreground=#ec6bfc
75
76
  hightlight.symbol.foreground=#bdc175
76
77
  hightlight.operator.foreground=#d9feff
77
78
  hightlight.class.foreground=#f69e2e
78
- hightlight.method.foreground=#007F7F
79
+ #hightlight.method.foreground=#007F7F
80
+ hightlight.method.foreground=#b332b3330000
79
81
  hightlight.number.foreground=#007F7F
80
82
  hightlight.instance_variable.foreground=#7F7F7F
81
83
  hightlight.global_variable.foreground=#db66ca
84
+ hightlight.class_variable.foreground=#9ae19ae10000
82
85
  hightlight.constant.foreground=#bdc175
83
86
  hightlight.tag.foreground=#69a8d9
84
87
  hightlight.selected.background=#133e5e
@@ -21,7 +21,7 @@ class Project
21
21
  end
22
22
  end
23
23
 
24
- class DirProjects < ArcadiaExt
24
+ class DirProjects < ArcadiaExtPlus
25
25
  attr_reader :htree
26
26
 
27
27
  def sync_on
@@ -918,6 +918,7 @@ class DirProjects < ArcadiaExt
918
918
  def projects_file
919
919
  if !defined?(@arcadia_projects_file)
920
920
  @arcadia_projects_file = @arcadia.local_dir+'/'+conf('file.name')
921
+ @arcadia_projects_file = "#{@arcadia_projects_file}#{instance_index}" if instance_index > 0
921
922
  if !File.exist?(@arcadia_projects_file)
922
923
  dir,fil =File.split(File.expand_path(@arcadia_projects_file))
923
924
  if !File.exist?(dir)
@@ -930,7 +931,6 @@ class DirProjects < ArcadiaExt
930
931
  f.close unless f.nil?
931
932
  end
932
933
  end
933
-
934
934
  end
935
935
  return @arcadia_projects_file
936
936
  end
@@ -980,6 +980,12 @@ class DirProjects < ArcadiaExt
980
980
  end
981
981
  end
982
982
 
983
+ def on_clear_cache_instance(_event)
984
+ if File.exist?(@arcadia_projects_file)
985
+ File.delete(@arcadia_projects_file)
986
+ end
987
+ end
988
+
983
989
  def image(_kind, _label='.rb')
984
990
  if _kind == 'directory'
985
991
  return @image_kdir
@@ -22,49 +22,8 @@ line-numbers=yes
22
22
  tabs.side=top
23
23
  complete-code=yes
24
24
  close-last-if-not-modified=yes
25
- max-file-open=3 #todo
26
- # editor
27
- #font=courier 11
28
- #font.bold=courier 11 bold
29
- #freebsd::font=courier 12
30
- #freebsd::font.bold=courier 12 bold
31
- #win::font={Courier New} 9
32
- #win::font.bold={Courier New} 9 bold
33
- #+--------------------------------------------------
34
- #color.background=#000000
35
- #color.foreground=white
36
- #color.insertbackground=#ff8000
37
- #hightlight.keyword.color.foreground=#800000
38
- #hightlight.variable.color.foreground=#f9c6f8
39
- #hightlight.comment.color.foreground=#4aff4a
40
- #hightlight.string.color.foreground=#8080ff
41
- #hightlight.number.color.foreground=red
42
- #hightlight.capitalize.color.foreground=#ffff00
43
- #hightlight.select.color.foreground=yellow
44
- #hightlight.select.color.background=blue
45
- #hightlight.goto.color.foreground=blue
46
- #hightlight.goto.color.background=yellow
47
- #+--------------------------------------------------
48
- hightlight.sel.foreground=>>>hightlight.sel.foreground
49
- hightlight.sel.background=>>>hightlight.sel.background
50
- hightlight.sel.borderwidth=>>>hightlight.sel.borderwidth
51
- hightlight.sel.relief=>>>hightlight.sel.relief
52
- hightlight.selected.background=>>>hightlight.selected.background
53
- #hightlight.selected.foreground=>>>hightlight.selected.foreground
54
- hightlight.tabs.foreground=>>>hightlight.3.foreground
55
- hightlight.tabs.background=>>>hightlight.3.background
56
- hightlight.tabs.borderwidth=>>>hightlight.3.borderwidth
57
- hightlight.tabs.relief=>>>hightlight.3.relief
58
- hightlight.spaces.foreground=>>>hightlight.4.foreground
59
- hightlight.spaces.background=>>>hightlight.4.background
60
- hightlight.spaces.borderwidth=>>>hightlight.4.borderwidth
61
- hightlight.spaces.relief=>>>hightlight.4.relief
62
- #hightlight.debug.foreground=>>>hightlight.16.foreground
63
- #hightlight.debug.background=>>>hightlight.16.background
64
- #hightlight.debug.borderwidth=>>>hightlight.16.borderwidth
65
- #hightlight.debug.relief=>>>hightlight.16.relief
66
-
67
-
25
+ max-file-open=3 #TODO
26
+ use-tabs=yes
68
27
  explorer_panel.tabs.side=top
69
28
 
70
29
  #:::::::::::::::: Editor group ::::::::::::::::::::::<end>
@@ -75,10 +34,15 @@ arm::popup.bind.shortcut=F4
75
34
  # menu items
76
35
  user_menu.contexts=View
77
36
  user_menu.View.context_path=/
78
- user_menu.View=line_number
37
+ user_menu.View=line_number,tabs
79
38
  user_menu.View.line_number.hint=Show/Hide line numbers
80
- user_menu.View.line_number.caption=Show/Hide line numbers
39
+ user_menu.View.line_number.caption=Show/Hide editor line numbers
81
40
  user_menu.View.line_number.underline=1
82
41
  user_menu.View.line_number.action=ActionEvent.new(self,'action'=>show_hide_current_line_numbers)
83
42
 
43
+ user_menu.View.tabs.hint=Show/Hide line numbers
44
+ user_menu.View.tabs.caption=Show/Hide editor tabs
45
+ user_menu.View.tabs.underline=1
46
+ user_menu.View.tabs.action=ActionEvent.new(self,'action'=>show_hide_tabs)
47
+
84
48
  #:::::::::::::::::::::::::::::::::::::::::::::::::<end>
@@ -491,6 +491,19 @@ class SafeCompleteCode
491
491
  #---------------------------------
492
492
  focus_line = source_array[@row-1]
493
493
  focus_line = focus_line[0..@col] if focus_line
494
+ #-----
495
+ # if ["\s",'(','{','['].include?(focus_line[-1..-1])
496
+ # p "focus_line[-1..-1] e uguale a #{focus_line[-1..-1]}"
497
+ # focus_line = ''
498
+ # else
499
+ # focus_line_split = focus_line.split
500
+ # if focus_line_split && focus_line_split.length >0
501
+ # old_focus_line_length = focus_line.length
502
+ # focus_line = focus_line_split[-1]
503
+ # @col = @col - (old_focus_line_length = focus_line.length)
504
+ # end
505
+ # end
506
+ #---
494
507
  focus_line = '' if focus_line.nil?
495
508
  focus_world = ''
496
509
  if focus_line && focus_line.strip.length > 0
@@ -515,6 +528,7 @@ class SafeCompleteCode
515
528
  focus_world= focus_word(focus_segment)
516
529
  end
517
530
  @class_node = @ss.class_node_by_line(@row)
531
+ focus_line_to_evaluate = focus_line
518
532
  #---------------------------------
519
533
  @modified_source = "#{@modified_source}Dir.chdir('#{File.dirname(@editor.file)}')\n" if @editor.file
520
534
  @modified_row = @modified_row+1
@@ -546,7 +560,7 @@ class SafeCompleteCode
546
560
  #Arcadia.console(self, 'msg'=>"per require @modified_row=#{@modified_row}")
547
561
  # 2) includiano la riga da evaluare con un $SAFE 3
548
562
  elsif j.to_i == @row-1
549
- focus_line = line
563
+ focus_line_to_evaluate = line
550
564
  break
551
565
  # 3) eliminiamo la riga
552
566
  else
@@ -554,7 +568,7 @@ class SafeCompleteCode
554
568
  end
555
569
  break if j.to_i >= @row - 1
556
570
  }
557
- if focus_line
571
+ if focus_line_to_evaluate
558
572
  # ricerchiamo una eventuale dichiarazione
559
573
  if focus_world && focus_world.strip.length > 0
560
574
  begin
@@ -598,7 +612,7 @@ class SafeCompleteCode
598
612
  ss_source = @ss.scheletor_from_node(@ss.root,'',to_iniect, to_iniect_class)
599
613
  ss_source_array = ss_source.split("\n")
600
614
  ss_len = ss_source_array.length
601
- if ss_len>0 && ss_source_array[0].strip != focus_line.strip
615
+ if ss_len>0 && ss_source_array[0].strip != focus_line_to_evaluate.strip
602
616
  @modified_source = "#{@modified_source}#{ss_source}"
603
617
  if @class_node
604
618
  @modified_source = "#{@modified_source}#{@class_node.label.downcase} = #{@class_node.label}.new\n"
@@ -629,7 +643,6 @@ class SafeCompleteCode
629
643
  end
630
644
  end
631
645
  if @filter.strip.length > 0 && !is_dot?
632
- # refresh_words(source_array)
633
646
  refresh_words
634
647
  end
635
648
 
@@ -803,7 +816,7 @@ class AgEditorOutlineToolbar
803
816
  attr_accessor :sync
804
817
  def initialize(_controller)
805
818
  @controller = _controller
806
- @panel = @controller.frame(1).root.add_panel(@controller.frame(1).name, "sync");
819
+ @panel = @controller.main_instance.frame(1).root.add_panel(@controller.main_instance.frame(1).name, "sync");
807
820
  @cb_sync = TkCheckButton.new(@panel, Arcadia.style('checkbox').update('background'=>@panel.background)){
808
821
  text 'Sync'
809
822
  justify 'left'
@@ -828,7 +841,7 @@ class AgEditorOutlineToolbar
828
841
 
829
842
  def sync_on
830
843
  @sync = true
831
- e = @controller.raised
844
+ e = @controller.active_instance.raised
832
845
  if e
833
846
  e.outline.select_without_event(e.outline.last_row) if e.outline.last_row
834
847
  end
@@ -949,7 +962,9 @@ class AgEditorOutline
949
962
 
950
963
  def destroy
951
964
  #@tree_scroll_wrapper.destroy
965
+ @tree_exp.hide
952
966
  @tree_exp.destroy
967
+ Tk.update
953
968
  end
954
969
 
955
970
  def show
@@ -1067,11 +1082,11 @@ class AgEditor
1067
1082
  attr_reader :read_only
1068
1083
  attr_reader :page_frame
1069
1084
  attr_reader :text, :root
1070
- attr_reader :outline
1071
1085
  attr_reader :highlighting
1072
1086
  attr_reader :last_tmp_file
1073
1087
  attr_reader :lang
1074
1088
  attr_reader :file_info
1089
+ attr_reader :outline
1075
1090
  def initialize(_controller, _page_frame)
1076
1091
  @controller = _controller
1077
1092
  @page_frame = _page_frame
@@ -1093,7 +1108,7 @@ class AgEditor
1093
1108
  @id = -1
1094
1109
  @file_info = Hash.new
1095
1110
  end
1096
-
1111
+
1097
1112
  def modified_from_opening?
1098
1113
  @modified_from_opening
1099
1114
  end
@@ -1308,7 +1323,7 @@ class AgEditor
1308
1323
  end
1309
1324
 
1310
1325
 
1311
- def raise_complete_code(_candidates, _row, _col, _filter='')
1326
+ def raise_complete_code(_candidates, _row, _col, _filter='')
1312
1327
  @raised_listbox_frame.destroy if @raised_listbox_frame != nil
1313
1328
  _index_call = _row+'.'+_col
1314
1329
  _index_now = @text.index('insert')
@@ -1322,13 +1337,14 @@ class AgEditor
1322
1337
  if !ei.nil?
1323
1338
  j=1
1324
1339
  pre_target = ''
1325
- while ei-j>=0 && _line[ei-j..ei-j]!="\s"
1340
+ while ei-j>=0 && !["\s",'(','[','{'].include?(_line[ei-j..ei-j])
1326
1341
  pre_target = _line[ei-j..ei-j] + pre_target
1327
1342
  j+=1
1328
1343
  end
1329
1344
  _target= pre_target + _target
1330
1345
  end
1331
1346
  end
1347
+
1332
1348
  if _target.strip.length > 0 && _target != '.'
1333
1349
  extra_len = _target.length.+@
1334
1350
  _begin_index = _index_now<<' - '<<extra_len.to_s<<' chars'
@@ -1337,6 +1353,19 @@ class AgEditor
1337
1353
  _begin_index = _index_now
1338
1354
  extra_len = 0
1339
1355
  end
1356
+ if _filter.length > 0
1357
+ begin_index_for_delete = "insert - #{_filter.length}chars"
1358
+ else
1359
+ for_delete = @text.get(_begin_index,"insert")
1360
+ if for_delete && ['.','(','[','{','=','<','!','>'].include?(for_delete.strip[-1..-1])
1361
+ begin_index_for_delete = "insert"
1362
+ elsif for_delete && for_delete.include?('.')
1363
+ begin_index_for_delete = "insert - #{for_delete.split('.')[-1].length}chars"
1364
+ else
1365
+ begin_index_for_delete = _begin_index
1366
+ end
1367
+ end
1368
+
1340
1369
  if _candidates.length >= 1
1341
1370
  _rx, _ry, _width, heigth = @text.bbox(_begin_index);
1342
1371
  _x = _rx + TkWinfo.rootx(@text)
@@ -1399,6 +1428,7 @@ class AgEditor
1399
1428
 
1400
1429
  Tk.event_generate(@raised_listbox, "1") if TkWinfo.mapped?(@raised_listbox)
1401
1430
  }
1431
+
1402
1432
 
1403
1433
  _insert_selected_value = proc{
1404
1434
  #_value = @raised_listbox.get('active').split('-')[0].strip
@@ -1408,7 +1438,7 @@ class AgEditor
1408
1438
  @raised_listbox_frame.destroy
1409
1439
  #_menu.destroy
1410
1440
  @text.focus
1411
- @text.delete(_begin_index,'insert')
1441
+ @text.delete(begin_index_for_delete,'insert')
1412
1442
 
1413
1443
  # workaround for @ char
1414
1444
  _value = _value.strip
@@ -1547,7 +1577,7 @@ class AgEditor
1547
1577
  end
1548
1578
  }
1549
1579
  elsif _candidates.length == 1 && _candidates[0].length>0
1550
- @text.delete(_begin_index,'insert');
1580
+ @text.delete(begin_index_for_delete,'insert');
1551
1581
  @text.insert('insert',_candidates[0].split[0])
1552
1582
  complete_code_end
1553
1583
  end
@@ -1605,32 +1635,6 @@ class AgEditor
1605
1635
 
1606
1636
  @text.bind_append("Control-KeyPress"){|e|
1607
1637
  case e.keysym
1608
- # when 'z'
1609
- # begin
1610
- # @text.edit_undo
1611
- # rescue RuntimeError => e
1612
- # throw e unless e.to_s.include? "nothing to undo" # this is ok--we've done undo back to the beginning
1613
- # break
1614
- # end
1615
- # if @highlighting
1616
- # _b = @text.index('@0,0').split('.')[0].to_i
1617
- # _e = @text.index('@0,'+TkWinfo.height(@text).to_s).split('.')[0].to_i + 1
1618
- # rehighlightlines(_b,_e)
1619
- # end
1620
- # break
1621
- # when 'r'
1622
- # begin
1623
- # @text.edit_redo
1624
- # rescue RuntimeError => e
1625
- # throw e unless e.to_s.include? "nothing to redo" # this is ok--we've done redo back to the beginning
1626
- # break
1627
- # end
1628
- # if @highlighting
1629
- # _b = @text.index('@0,0').split('.')[0].to_i
1630
- # _e = @text.index('@0,'+TkWinfo.height(@text).to_s).split('.')[0].to_i + 1
1631
- # rehighlightlines(_b,_e)
1632
- # end
1633
- # break
1634
1638
  when 'o'
1635
1639
  if @file
1636
1640
  _dir = File.dirname(@file)
@@ -1639,24 +1643,9 @@ class AgEditor
1639
1643
  end
1640
1644
  Arcadia.process_event(OpenBufferEvent.new(self,'file'=>Tk.getOpenFile('initialdir'=>_dir)))
1641
1645
  break
1642
- # when 'c'
1643
- # @text.text_copy
1644
- # break
1645
- # when 'x'
1646
- # @text.text_cut
1647
- # break
1648
- # when 'v'
1649
- # _b = @text.index('insert').split('.')[0].to_i
1650
- # @text.text_paste
1651
- # _e = @text.index('insert').split('.')[0].to_i
1652
- # if @highlighting
1653
- # rehighlightlines(_b,_e)
1654
- # end
1655
- # break
1656
- end
1657
- case e.keysym
1658
1646
  when 's'
1659
1647
  save
1648
+ #Tk.callback_break
1660
1649
  when 'f'
1661
1650
  find
1662
1651
  when 'egrave'
@@ -1690,21 +1679,6 @@ class AgEditor
1690
1679
  end
1691
1680
  when 'U'
1692
1681
  decrease_indent
1693
- # _r = @text.tag_ranges('sel')
1694
- # _row_begin = _r[0][0].split('.')[0].to_i
1695
- # _row_end = _r[_r.length - 1][1].split('.')[0].to_i
1696
- # n_space = $arcadia['conf']['editor.tab-replace-width-space'].to_i
1697
- # if n_space > 0
1698
- # suf = "\s"*n_space
1699
- # else
1700
- # suf = "\t"
1701
- # end
1702
- # _l_suf = suf.length.to_s
1703
- # for _row in _row_begin..._row_end
1704
- # if @text.get(_row.to_s+'.0',_row.to_s+'.'+_l_suf) == suf
1705
- # @text.delete(_row.to_s+'.0',_row.to_s+'.'+_l_suf)
1706
- # end
1707
- # end
1708
1682
  when 'C'
1709
1683
  _r = @text.tag_ranges('sel')
1710
1684
  _row_begin = _r[0][0].split('.')[0].to_i
@@ -1725,19 +1699,16 @@ class AgEditor
1725
1699
  }
1726
1700
 
1727
1701
  @text.bind_append("KeyPress"){|e|
1728
- #@do_complete = false
1702
+ @last_keypress = e.keysym
1729
1703
  case e.keysym
1730
- #when 'Return'
1731
- when 'BackSpace'
1732
- _index = @text.index('insert')
1733
- _row, _col = _index.split('.')
1734
- rehighlightlines(_row.to_i,_row.to_i) if @highlighting
1735
- # rehighlightline(_row.to_i) if @highlighting
1736
- when 'Delete'
1737
- _index = @text.index('insert')
1738
- _row, _col = _index.split('.')
1739
- rehighlightlines(_row.to_i, _row.to_i) if @highlighting
1740
- # rehighlightline(_row.to_i) if @highlighting
1704
+ # when 'BackSpace'
1705
+ # _index = @text.index('insert')
1706
+ # _row, _col = _index.split('.')
1707
+ # rehighlightlines(_row.to_i,_row.to_i) if @highlighting
1708
+ # when 'Delete'
1709
+ # _index = @text.index('insert')
1710
+ # _row, _col = _index.split('.')
1711
+ # rehighlightlines(_row.to_i, _row.to_i) if @highlighting
1741
1712
  when 'F5'
1742
1713
  run_buffer
1743
1714
  when 'F3'
@@ -1775,11 +1746,15 @@ class AgEditor
1775
1746
  }
1776
1747
 
1777
1748
  @text.bind_append("KeyRelease"){|e|
1749
+ @last_keyrelease = e.keysym
1750
+ #return if @last_keypress != e.keysym
1778
1751
  case e.keysym
1779
- when 'Up','Down'
1780
- refresh_outline
1752
+ # when 'Up','Down'
1753
+ # refresh_outline
1781
1754
  when 'Left', 'Right'
1782
-
1755
+ if Arcadia.instance.last_focused_text_widget != @text
1756
+ @text.select_throw
1757
+ end
1783
1758
  when 'Return' #,'Control_L', 'Control_V', 'BackSpace', 'Delete'
1784
1759
  _index = @text.index('insert')
1785
1760
  _row, _col = _index.split('.')
@@ -1797,20 +1772,26 @@ class AgEditor
1797
1772
  if _row.to_i + 1 == @text.index('end').split('.')[0].to_i
1798
1773
  do_line_update
1799
1774
  end
1800
- else
1801
- if ['Control_L', 'Control_V', 'BackSpace', 'Delete'].include?(e.keysym)
1802
- do_line_update
1775
+ if @highlighting
1776
+ rehighlightlines(_row.to_i, _row.to_i)
1803
1777
  end
1778
+ when 'Shift_L','Shift_R','Control_L','Control_R' ,'Prior', 'Next', 'Up','Down'
1779
+ # do nothing because od do_line_update
1780
+ else
1781
+ # if ['BackSpace', 'Delete'].include?(e.keysym)
1782
+ # do_line_update
1783
+ # end
1804
1784
  if @highlighting
1805
1785
  row = @text.index('insert').split('.')[0].to_i
1806
1786
  rehighlightlines(row, row)
1807
1787
  end
1808
1788
  end
1809
- check_modify
1789
+ check_modify if !['Shift_L','Shift_R','Control_L','Control_R','Up','Down','Left', 'Right', 'Prior', 'Next'].include?(e.keysym)
1810
1790
  }
1811
1791
 
1812
1792
 
1813
1793
  @text.bind_append("Shift-KeyPress"){|e|
1794
+ @last_keypress = e.keysym
1814
1795
  case e.keysym
1815
1796
  when 'Tab','ISO_Left_Tab'
1816
1797
  _r = @text.tag_ranges('sel')
@@ -1899,8 +1880,8 @@ class AgEditor
1899
1880
  end
1900
1881
 
1901
1882
  def refresh_outline
1902
- if @outline
1903
- Tk.after(1,proc{ @outline.update_row(self.row)})
1883
+ if defined?(@outline)
1884
+ Tk.after(1,proc{@outline.update_row(self.row)})
1904
1885
  end
1905
1886
  end
1906
1887
 
@@ -2081,9 +2062,11 @@ class AgEditor
2081
2062
  if _from_row && @highlighting
2082
2063
  invalidated_begin_zone= zone_of_row(_from_row)
2083
2064
  @is_line_bold.delete_if {|key, value| key >= invalidated_begin_zone }
2065
+ @is_line_comment.delete_if {|key, value| key >= invalidated_begin_zone }
2084
2066
  @highlight_zone.delete_if {|key, value| key >= invalidated_begin_zone }
2085
2067
  elsif @highlighting
2086
2068
  @is_line_bold.clear
2069
+ @is_line_comment.clear
2087
2070
  @highlight_zone.clear
2088
2071
  end
2089
2072
  @last_line_begin=0
@@ -2116,6 +2099,7 @@ class AgEditor
2116
2099
  def initialize_highlight(_ext)
2117
2100
  @highlight_scanner = @controller.highlight_scanner(_ext)
2118
2101
  @is_line_bold = Hash.new
2102
+ @is_line_comment = Hash.new
2119
2103
  @is_tag_bold = Hash.new
2120
2104
  do_tag_configure_global('debug')
2121
2105
  if @lang_hash.nil? || @highlight_scanner.nil?
@@ -2998,10 +2982,39 @@ class AgEditor
2998
2982
  end
2999
2983
  end
3000
2984
 
2985
+ def refresh_visible_highlighting
2986
+ line_begin_index = @text.index('@0,0')
2987
+ line_begin = line_begin_index.split('.')[0].to_i
2988
+ line_begin = @comment_line_begin if !@comment_line_begin.nil? && @comment_line_begin < line_begin
2989
+ line_end = @text.index('@0,'+TkWinfo.height(@text).to_s).split('.')[0].to_i + 1
2990
+ reset_highlight(line_begin)
2991
+ zone_begin = zone_of_row(line_begin)
2992
+ zone_end = zone_of_row(line_end)
2993
+ zone_begin.upto(zone_end){|z| highlight_zone(z)}
2994
+ highlight_zone(zone_of_row(line_end+1)) if @is_line_comment[line_end]
2995
+
2996
+ #rehighlightlines(line_begin,line_end,true)
2997
+ if @is_line_comment[line_end]
2998
+ line_end.downto(line_begin){|l|
2999
+ @comment_line_begin = l if @is_line_comment[l]
3000
+ }
3001
+ else
3002
+ @comment_line_begin = nil
3003
+ end
3004
+ end
3005
+
3006
+
3001
3007
  def highlightlines(_row_begin, _row_end, _check_mod = false)
3002
3008
  if _check_mod
3003
3009
  check_modify
3004
3010
  end
3011
+ is_comment = _row_begin == _row_end
3012
+ if _row_begin == _row_end && (@is_line_comment[_row_end-1] || @is_line_comment[_row_end+1])
3013
+ if !['apostrophe','quotedbl'].include?(@last_keypress)
3014
+ refresh_visible_highlighting
3015
+ return
3016
+ end
3017
+ end
3005
3018
  #_row_begin = _row_begin+1
3006
3019
  _ibegin = _row_begin.to_s+'.0'
3007
3020
  _iend = (_row_end+1).to_s+'.0'
@@ -3009,28 +3022,39 @@ class AgEditor
3009
3022
  _lines = @text.get(_ibegin, _iend)
3010
3023
  tags_map = @highlight_scanner.highlight_tags(_row_begin,_lines)
3011
3024
  tags_map.each do |key,value|
3025
+ is_comment = is_comment && key == :comment
3026
+ break if is_comment
3012
3027
  to_tag = Array.new
3013
3028
  value.each{|ite|
3014
3029
  to_tag.concat(ite)
3015
- if @is_tag_bold[key.to_s]
3016
- if ite.length==2
3017
- row_begin = ite[0].split('.')[0].to_i
3018
- row_end = ite[1].split('.')[0].to_i
3019
- for row in row_begin..row_end
3020
- @is_line_bold[row]=true
3021
- end
3030
+ if ite.length==2
3031
+ row_begin = ite[0].split('.')[0].to_i
3032
+ row_end = ite[1].split('.')[0].to_i
3033
+ for row in row_begin..row_end
3034
+ @is_line_bold[row] = @is_tag_bold[key.to_s]
3035
+ @is_line_comment[row] = key == :comment
3022
3036
  end
3023
- # ite.each{|p|
3024
- # row_begin = p[0].split('.')[0].to_i
3025
- # row_end = p[1].split('.')[0].to_i
3026
- # for row in row_begin...row_end
3027
- # @is_line_bold[row]=true
3028
- # end
3029
- # }
3030
3037
  end
3031
3038
  }
3039
+ # to_tag.each{|p|
3040
+ # if @i.nil?
3041
+ # @one = p
3042
+ # @i = 1
3043
+ # next
3044
+ # else
3045
+ # @two = p
3046
+ # @i = nil
3047
+ # end
3048
+ # row_begin = @one.split('.')[0].to_i
3049
+ # row_end = @two.split('.')[0].to_i
3050
+ # for row in row_begin...row_end
3051
+ # @is_line_comment[row] = key == :comment
3052
+ # end
3053
+ # }
3032
3054
  @text.tag_adds(key.to_s,to_tag)
3033
3055
  end
3056
+ refresh_visible_highlighting if is_comment
3057
+
3034
3058
  if @tabs_show || @spaces_show
3035
3059
  if !defined?(@rescanner)
3036
3060
  if @lang_hash['scanner']!='re'
@@ -3047,7 +3071,8 @@ class AgEditor
3047
3071
  def highlight_zone(_zone, _force_highlight=false)
3048
3072
  if !@highlight_zone[_zone] || _force_highlight
3049
3073
  _b = @highlight_zone_length*(_zone - 1) +1
3050
- _e = @highlight_zone_length*(_zone) #+ 1
3074
+ _e = @highlight_zone_length*(_zone) #+ 1
3075
+ _b -=1 while @is_line_comment[_b-1]
3051
3076
  rehighlightlines(_b,_e)
3052
3077
  @highlight_zone[_zone] = true
3053
3078
  end
@@ -3193,6 +3218,7 @@ class AgEditor
3193
3218
  end
3194
3219
 
3195
3220
  def check_file_last_access_time
3221
+ #@controller.activate
3196
3222
  if @file
3197
3223
  file_exist = File.exist?(@file)
3198
3224
  if @file_info['mtime'] && file_exist
@@ -3276,15 +3302,16 @@ class AgEditor
3276
3302
  end
3277
3303
 
3278
3304
  def show_outline
3279
- if @outline
3305
+ if defined?(@outline)
3280
3306
  @outline.show
3281
3307
  else
3282
- @outline=AgEditorOutline.new(self, @controller.frame(1).hinner_frame, @controller.outline_bar, @lang)
3308
+ @outline=AgEditorOutline.new(self, @controller.main_instance.frame(1).hinner_frame, @controller.outline_bar, @lang)
3283
3309
  refresh
3284
3310
  end
3285
3311
  end
3286
3312
 
3287
3313
  def hide_outline
3314
+ #@outline.hide if defined?(@outline)
3288
3315
  @outline.hide if @outline
3289
3316
  end
3290
3317
 
@@ -3336,20 +3363,27 @@ class AgEditor
3336
3363
  end
3337
3364
 
3338
3365
  def refresh
3339
- @outline.build_tree if @outline && @classbrowsing #&& !is_exp_hide?
3366
+ @outline.build_tree if defined?(@outline) && @classbrowsing #&& !is_exp_hide?
3340
3367
  end
3341
3368
  end
3342
3369
 
3343
3370
  class AgMultiEditorView
3344
- attr_reader :enb
3345
- def initialize(parent=nil)
3346
- @enb = Tk::BWidget::NoteBook.new(parent,Arcadia.style('tabpanel')){
3371
+ #attr_reader :enb
3372
+ def initialize(parent=nil, _usetabs=true)
3373
+ @parent = parent
3374
+ @usetabs = _usetabs
3375
+ if @usetabs
3376
+ initialize_tabs
3377
+ end
3378
+ @pages = {}
3379
+ @page_binds = {}
3380
+ @raised_page=nil
3381
+ end
3382
+
3383
+ def initialize_tabs
3384
+ @enb = Tk::BWidget::NoteBook.new(@parent.hinner_frame, Arcadia.style('tabpanel')){
3347
3385
  tabbevelsize 0
3348
3386
  internalborderwidth 2
3349
- # arcradius 4
3350
- # activeforeground 'red'
3351
- # activebackground 'yellow'
3352
- #borderwidth 1
3353
3387
  side Arcadia.conf('editor.tabs.side')
3354
3388
  font Arcadia.conf('editor.tabs.font')
3355
3389
  pack('fill'=>'both', :padx=>0, :pady=>0, :expand => 'yes')
@@ -3358,13 +3392,204 @@ class AgMultiEditorView
3358
3392
  if !@enb.pages.empty?
3359
3393
  if @enb.raise.nil? || @enb.raise.strip.length == 0
3360
3394
  @enb.raise(@enb.pages[0])
3361
- @enb.see(@enb.pages[0])
3395
+ @enb.see(@enb.pages[0])
3362
3396
  end
3363
3397
  end
3364
3398
  }
3365
3399
  @enb.bind_append("Map",refresh_after_map)
3366
3400
  end
3367
3401
 
3402
+ def switch_2_tabs
3403
+ raised = raise
3404
+ @usetabs = true
3405
+ initialize_tabs
3406
+ @pages.each{|name, value|
3407
+ oldframe = value['frame'].frame
3408
+ value['frame'].detach_frame
3409
+ oldframe.destroy
3410
+ add_page(name, value['file'], value['text'], value['image'], value['raisecmd'], value['frame'])
3411
+ }
3412
+ raise(raised)
3413
+ @page_binds.each{|event, proc| page_bind(event, proc)}
3414
+ end
3415
+
3416
+ def switch_2_notabs
3417
+ raised = raise
3418
+ @usetabs = false
3419
+ @pages.each{|name, value|
3420
+ value['frame'].detach_frame
3421
+ add_page(name, value['file'], value['text'], value['image'], value['raisecmd'], value['frame'])
3422
+ }
3423
+ @enb.destroy
3424
+ raise(raised)
3425
+ @page_binds.each{|event, proc|
3426
+ page_bind(event, proc)
3427
+ }
3428
+ end
3429
+
3430
+ def root_frame
3431
+ if @usetabs
3432
+ @enb
3433
+ else
3434
+ @parent.hinner_frame
3435
+ end
3436
+ end
3437
+
3438
+ def exist_buffer?(_name)
3439
+ if @usetabs
3440
+ @enb.index(_name) != -1
3441
+ else
3442
+ @pages.include?(_name)
3443
+ end
3444
+ end
3445
+
3446
+ def index(_name)
3447
+ if @usetabs
3448
+ @enb.index(_name)
3449
+ else
3450
+ _index = @pages.values.index(@pages[_name])
3451
+ _index = -1 if _index.nil?
3452
+ _index
3453
+ end
3454
+ end
3455
+
3456
+ def pages
3457
+ if @usetabs
3458
+ @enb.pages
3459
+ else
3460
+ @pages.keys
3461
+ end
3462
+ end
3463
+
3464
+ def page_title(_name, _title=nil, _image=nil)
3465
+ @pages[_name]['text'] = _title if _title != nil
3466
+ @pages[_name]['image'] = _image if _image != nil
3467
+ title = _title
3468
+ if @usetabs
3469
+ if _title.nil? && _image.nil?
3470
+ title = @enb.itemcget(_name, 'text')
3471
+ else
3472
+ args = {}
3473
+ if _title != nil
3474
+ args['text']=_title
3475
+ end
3476
+ if _image != nil
3477
+ args['image']=_image
3478
+ end
3479
+ @enb.itemconfigure(_name, args)
3480
+ end
3481
+ else
3482
+ if _title.nil? && _image.nil?
3483
+ title = @pages[_name]['text'] if @pages[_name]
3484
+ end
3485
+ end
3486
+ @parent.root.top_text(page(_name)['text'], page(_name)['image']) if page(_name) && raised?(_name)
3487
+ title
3488
+ end
3489
+
3490
+ def add_page(_name, _file, _title, _image, _raise_proc, _adapter=nil)
3491
+ if @usetabs
3492
+ frame = @enb.insert('end', _name ,
3493
+ 'text'=> _title,
3494
+ 'image'=> _image,
3495
+ 'background'=> Arcadia.style("tabpanel")["background"],
3496
+ 'foreground'=> Arcadia.style("tabpanel")["foreground"],
3497
+ 'raisecmd'=>_raise_proc
3498
+ )
3499
+ else
3500
+ frame = TkFrame.new(@parent.hinner_frame) #.pack('fill'=>'both', :padx=>0, :pady=>0, :expand => 'yes')
3501
+ end
3502
+ if _adapter.nil?
3503
+ adapted_frame = TkFrameAdapter.new(@parent.hinner_frame)
3504
+ else
3505
+ adapted_frame = _adapter
3506
+ end
3507
+ adapted_frame.attach_frame(frame)
3508
+ adapted_frame.raise
3509
+ @pages[_name]={'frame'=>adapted_frame, 'file'=>_file, 'text'=>_title, 'image' => _image, 'raisecmd'=>_raise_proc}
3510
+ adapted_frame
3511
+ end
3512
+
3513
+ def delete_page(_name)
3514
+ if @usetabs
3515
+ @enb.delete(_name)
3516
+ end
3517
+ adapter_frame = @pages.delete(_name)['frame']
3518
+ adapter_frame.frame.destroy if adapter_frame.frame
3519
+ adapter_frame.destroy
3520
+ end
3521
+
3522
+ def page_bind(_event, _proc)
3523
+ @page_binds[_event] = _proc
3524
+ if @usetabs
3525
+ @enb.tabbind_append("Button-3",_proc)
3526
+ @parent.root.top_text_bind_remove("Button-3")
3527
+ else
3528
+ @parent.root.top_text_bind_append("Button-3", _proc)
3529
+ end
3530
+ end
3531
+
3532
+ def page(_name)
3533
+ @pages[_name]
3534
+ end
3535
+
3536
+ def page_frame(_name)
3537
+ if @usetabs
3538
+ @enb.get_frame(_name)
3539
+ else
3540
+ @pages[_name]['frame'] if @pages[_name]
3541
+ end
3542
+ end
3543
+
3544
+ def page_name(_frame)
3545
+ res = nil
3546
+ @pages.each{|k,v|
3547
+ res = k if v['frame'] == _frame
3548
+ break if !res.nil?
3549
+ }
3550
+ res
3551
+ end
3552
+
3553
+ def raise(_page=nil)
3554
+ if @usetabs
3555
+ if _page.nil?
3556
+ @raised_page = @enb.raise
3557
+ else
3558
+ @enb.raise(_page)
3559
+ end
3560
+ else
3561
+ if _page.nil?
3562
+ @raised_page
3563
+ else
3564
+ if @raised_page
3565
+ @pages[@raised_page]['frame'].unpack if @pages[@raised_page]
3566
+ end
3567
+ @raised_page = _page
3568
+ @pages[_page]['frame'].pack('fill'=>'both', :padx=>0, :pady=>0, :expand => 'yes')
3569
+ @pages[_page]['raisecmd'].call
3570
+ end
3571
+ end
3572
+ @raised_page
3573
+ end
3574
+
3575
+ def raised?(_name)
3576
+ @raised_page==_name
3577
+ end
3578
+
3579
+ def see(_page)
3580
+ if @usetabs
3581
+ @enb.see(_page)
3582
+ else
3583
+ end
3584
+ end
3585
+
3586
+ def move(_name, _pos)
3587
+ if @usetabs
3588
+ @enb.move(_name,_pos) if _pos
3589
+ else
3590
+ end
3591
+ end
3592
+
3368
3593
  end
3369
3594
 
3370
3595
  class HighlightScanner
@@ -3487,7 +3712,7 @@ class ReHighlightScanner < HighlightScanner
3487
3712
  end
3488
3713
  end
3489
3714
 
3490
- class CoderayHighlightScanner < HighlightScanner
3715
+ class CoderayHighlightScannerOld < HighlightScanner
3491
3716
  def initialize(_langs_conf)
3492
3717
  super(_langs_conf)
3493
3718
  require 'coderay'
@@ -3544,12 +3769,76 @@ class CoderayHighlightScanner < HighlightScanner
3544
3769
  end
3545
3770
  end
3546
3771
 
3772
+ class CoderayHighlightScanner < HighlightScanner
3773
+
3774
+ def initialize(_langs_conf)
3775
+ super(_langs_conf)
3776
+ require 'coderay'
3777
+ end
3778
+
3779
+ def highlight_tags(_row_begin,_code)
3780
+ super(_row_begin,_code)
3781
+ c_scanner = CodeRay::Scanners[@lang].new _code
3782
+ row=_row_begin
3783
+ col=0
3784
+ tags_map = Hash.new
3785
+ c_scanner.tokens.each{|t|
3786
+ #p tok
3787
+ if @i.nil?
3788
+ @tok = []
3789
+ @tok << t
3790
+ @i = 1
3791
+ next
3792
+ else
3793
+ @tok << t
3794
+ @i = nil
3795
+ end
3796
+ tok = @tok
3797
+
3798
+ #p tok
3799
+
3800
+ if tok[1]==:space && tok[0].include?("\n")
3801
+ row+=tok[0].count("\n")
3802
+ begin_gap = tok[0].split("\n")[-1]
3803
+ if begin_gap && tok[0][-1..-1]!="\n"
3804
+ col = begin_gap.length
3805
+ else
3806
+ col = 0
3807
+ end
3808
+ elsif !([:open, :close, :begin_group,:end_group].include?(tok[0])&& tok[1].class==Symbol)
3809
+ toklength = tok[0].length
3810
+ t_begin="#{row}.#{col}"
3811
+ if tok[0].include?("\n")
3812
+ ar = tok[0].split("\n")
3813
+ row+=tok[0].count("\n")
3814
+ begin_gap = ar[-1]
3815
+ if begin_gap && tok[0][-1..-1]!="\n"
3816
+ col = begin_gap.length
3817
+ else
3818
+ col = 0
3819
+ end
3820
+ else
3821
+ col+=toklength
3822
+ end
3823
+ t_end="#{row}.#{col}"
3824
+ if tok[1]!=:space
3825
+ tags_map[tok[1]] = [] if tags_map[tok[1]].nil?
3826
+ tags_map[tok[1]] << [t_begin,t_end]
3827
+ #Arcadia.console(self, 'msg'=>"#{tok[1]}=#{[t_begin,t_end]}", 'level'=>'error')
3828
+ #p [t_begin,t_end]
3829
+ end
3830
+ end
3831
+ }
3832
+ tags_map
3833
+ end
3834
+ end
3835
+
3547
3836
 
3548
- class AgMultiEditor < ArcadiaExt
3837
+ class AgMultiEditor < ArcadiaExtPlus
3549
3838
  include Configurable
3550
3839
  # attr_reader :breakpoints
3551
3840
  attr_reader :splitted_frame
3552
- attr_reader :outline_bar
3841
+ # attr_reader :outline_bar
3553
3842
  attr_reader :has_ctags, :ctags_string
3554
3843
  def on_before_build(_event)
3555
3844
  Arcadia.is_windows? ? @ctags_string="lib/ctags.exe" : @ctags_string='ctags'
@@ -3689,21 +3978,44 @@ class AgMultiEditor < ArcadiaExt
3689
3978
  # end
3690
3979
 
3691
3980
  def on_build(_event)
3692
- @main_frame = AgMultiEditorView.new(self.frame.hinner_frame)
3693
- @outline_bar = AgEditorOutlineToolbar.new(self)
3981
+ # self.frame.hinner_frame.bind_append("Enter", proc{activate})
3982
+ @usetabs = conf('use-tabs')=='yes'
3983
+ @main_frame = AgMultiEditorView.new(self.frame, @usetabs)
3984
+ @@outline_bar = AgEditorOutlineToolbar.new(self) if !defined?(@@outline_bar)
3694
3985
  create_find # this is the "find within current file" one
3695
- pop_up_menu
3986
+ begin
3987
+ pop_up_menu
3988
+ rescue RuntimeError => e
3989
+ Arcadia.runtime_error(e)
3990
+ end
3696
3991
  frame.root.add_button(
3697
3992
  self.name,
3698
- 'close current',
3699
- proc{Arcadia.process_event(CloseCurrentTabEvent.new(self))},
3993
+ 'Close current',
3994
+ proc{self.activate;Arcadia.process_event(CloseCurrentTabEvent.new(self))},
3700
3995
  CLOSE_DOCUMENT_GIF)
3701
3996
  frame.root.add_sep(self.name, 1)
3702
- @buffer_menu = frame.root.add_menu_button(self.name, 'files', DOCUMENT_COMBO_GIF, 'right', {'relief'=>:raised, 'borderwidth'=>1}).cget('menu')
3997
+ @buffer_number = TkVariable.new
3998
+ @buffer_number.value = 0
3999
+ @buffer_menu = frame.root.add_menu_button(
4000
+ self.name, 'files', DOCUMENT_COMBO_GIF, 'right',
4001
+ {'relief'=>:raised, 'borderwidth'=>1, 'compound'=> 'left','anchor'=>'w', 'textvariable'=> @buffer_number, 'width'=>40}).cget('menu')
3703
4002
  load_languages_hash
3704
4003
  end
3705
4004
 
4005
+ def on_activate_instance(_event)
4006
+ if _event.name == @name
4007
+ refresh_status
4008
+ _e = raised
4009
+ change_outline(_e, true) if _e
4010
+ end
4011
+ end
4012
+
4013
+ def outline_bar
4014
+ @@outline_bar
4015
+ end
4016
+
3706
4017
  def add_buffer_menu_item(_filename, is_file=true)
4018
+ @buffer_number.numeric += 1
3707
4019
  index = 'end'
3708
4020
  i_end = @buffer_menu.index('end')
3709
4021
  if i_end
@@ -3723,7 +4035,6 @@ class AgMultiEditor < ArcadiaExt
3723
4035
 
3724
4036
  @buffer_menu.insert(index,:radio,
3725
4037
  :label=>File.basename(_filename),
3726
- # :variable=>TkVariable.new(_filename),
3727
4038
  :value=>_filename,
3728
4039
  :image=> Arcadia.file_icon(_filename),
3729
4040
  :compound=>'left',
@@ -3739,6 +4050,7 @@ class AgMultiEditor < ArcadiaExt
3739
4050
  end
3740
4051
 
3741
4052
  def del_buffer_menu_item(_file)
4053
+ @buffer_number.numeric -= 1
3742
4054
  to_del = -1
3743
4055
  i_end = @buffer_menu.index('end')
3744
4056
  0.upto(i_end){|j|
@@ -3756,9 +4068,60 @@ class AgMultiEditor < ArcadiaExt
3756
4068
  @buffer_menu.delete(to_del) if to_del != -1
3757
4069
  end
3758
4070
 
4071
+ def mod_buffer_menu_item(_file, _newtext, _newvalue = nil)
4072
+ to_mod = -1
4073
+ i_end = @buffer_menu.index('end')
4074
+ 0.upto(i_end){|j|
4075
+ type = @buffer_menu.menutype(j)
4076
+ if type != 'separator'
4077
+ value = @buffer_menu.entrycget(j,'value')
4078
+ if value == _file
4079
+ to_mod=j
4080
+ break
4081
+ end
4082
+ end
4083
+ }
4084
+ @buffer_menu.entryconfigure(to_mod, 'label'=>_newtext) if to_mod != -1
4085
+ if to_mod != -1 && _newvalue != nil
4086
+ is_file = File.exists?(_newvalue)
4087
+ @buffer_menu.entryconfigure(to_mod,
4088
+ :value => _newvalue,
4089
+ :image=> Arcadia.file_icon(_newvalue),
4090
+ :command=>proc{
4091
+ if is_file
4092
+ open_file(_newvalue)
4093
+ else
4094
+ open_buffer(tab_name(_newvalue))
4095
+ end
4096
+ }
4097
+ )
4098
+ end
4099
+ end
4100
+
4101
+ def refresh_selected_buffer_menu_item
4102
+ i_end = @buffer_menu.index('end')
4103
+ p_name = @main_frame.raise
4104
+ if @tabs_editor[p_name] && @tabs_editor[p_name].file
4105
+ to_select = @tabs_editor[p_name].file
4106
+ else
4107
+ to_select = unname_modified(tab_title_by_tab_name(p_name))
4108
+ end
4109
+ 0.upto(i_end){|j|
4110
+ type = @buffer_menu.menutype(j)
4111
+ if type != 'separator'
4112
+ value = @buffer_menu.entrycget(j,'value')
4113
+ if value == to_select
4114
+ @buffer_menu.entryconfigure(j, 'state'=>'disabled')
4115
+ else
4116
+ @buffer_menu.entryconfigure(j, 'state'=>'normal')
4117
+ end
4118
+ end
4119
+ }
4120
+ end
4121
+
3759
4122
  def on_initialize(_event)
3760
4123
  self.open_last_files
3761
- reset_status if @main_frame.enb.pages.empty?
4124
+ reset_status if @main_frame.pages.empty?
3762
4125
  end
3763
4126
 
3764
4127
  def on_exit_query(_event)
@@ -3776,18 +4139,14 @@ class AgMultiEditor < ArcadiaExt
3776
4139
  if raised && _event.focus_widget == raised.text
3777
4140
  if [CutTextEvent, PasteTextEvent, UndoTextEvent, RedoTextEvent].include?(_event.class)
3778
4141
  if raised.highlighting
3779
- line_begin_index = raised.text.index('@0,0')
3780
- line_begin = line_begin_index.split('.')[0].to_i
3781
- line_end = raised.text.index('@0,'+TkWinfo.height(raised.text).to_s).split('.')[0].to_i + 1
3782
- raised.reset_highlight(line_begin)
3783
- raised.rehighlightlines(line_begin,line_end,true)
4142
+ raised.refresh_visible_highlighting
3784
4143
  else
3785
4144
  raised.check_modify
3786
4145
  end
3787
4146
  end
3788
4147
  end
3789
4148
  end
3790
-
4149
+
3791
4150
  def highlight_scanner(_ext=nil)
3792
4151
  return nil if _ext.nil?
3793
4152
  scanner = nil
@@ -3882,7 +4241,7 @@ class AgMultiEditor < ArcadiaExt
3882
4241
 
3883
4242
  def pop_up_menu
3884
4243
  @pop_up = TkMenu.new(
3885
- :parent=>@main_frame.enb,
4244
+ :parent=> self.frame.hinner_frame,
3886
4245
  :tearoff=>0,
3887
4246
  :title => 'Menu'
3888
4247
  )
@@ -3937,15 +4296,19 @@ class AgMultiEditor < ArcadiaExt
3937
4296
  :hidemargin => false
3938
4297
  )
3939
4298
 
3940
- @main_frame.enb.tabbind("Button-3",
4299
+ @main_frame.page_bind("Button-3",
3941
4300
  proc{|*x|
3942
- _x = TkWinfo.pointerx(@main_frame.enb)
3943
- _y = TkWinfo.pointery(@main_frame.enb)
3944
- @selected_tab_name_from_popup = x[0].split(':')[0]
3945
- _index = @main_frame.enb.index(@selected_tab_name_from_popup)
4301
+ _x = TkWinfo.pointerx(@main_frame.root_frame)
4302
+ _y = TkWinfo.pointery(@main_frame.root_frame)
4303
+ if @usetabs
4304
+ @selected_tab_name_from_popup = x[0].split(':')[0]
4305
+ else
4306
+ @selected_tab_name_from_popup = @main_frame.raise
4307
+ end
4308
+ _index = @main_frame.index(@selected_tab_name_from_popup)
3946
4309
  if _index == -1
3947
4310
  @selected_tab_name_from_popup = 'ff'+@selected_tab_name_from_popup
3948
- _index = @main_frame.enb.index(@selected_tab_name_from_popup)
4311
+ _index = @main_frame.index(@selected_tab_name_from_popup)
3949
4312
  end
3950
4313
 
3951
4314
  if _index != -1
@@ -4183,15 +4546,31 @@ class AgMultiEditor < ArcadiaExt
4183
4546
  end
4184
4547
 
4185
4548
  def show_hide_current_line_numbers
4186
- _e = raised
4549
+ _e = active_instance.raised
4187
4550
  _e.show_hide_line_numbers if _e
4188
4551
  end
4189
4552
 
4553
+ def show_hide_tabs
4554
+ if active?
4555
+ if @usetabs
4556
+ @main_frame.switch_2_notabs
4557
+ @usetabs = false
4558
+ Arcadia['conf']["#{@name}.use-tabs"]='no'
4559
+ else
4560
+ @main_frame.switch_2_tabs
4561
+ @usetabs = true
4562
+ Arcadia['conf']["#{@name}.use-tabs"]='yes'
4563
+ end
4564
+ else
4565
+ active_instance.show_hide_tabs
4566
+ end
4567
+ end
4568
+
4190
4569
  def on_finalize(_event)
4191
4570
  @batch_files = true
4192
4571
  _files =''
4193
4572
  _raised = self.raised
4194
- Arcadia.persistent('editor.files.last', _raised.file) if _raised
4573
+ Arcadia.persistent("#{@name}.files.last", _raised.file) if _raised
4195
4574
  @tabs_editor.each_value{|editor|
4196
4575
  if editor.file != nil
4197
4576
  #_insert_index = editor.text.index('insert')
@@ -4202,7 +4581,7 @@ class AgMultiEditor < ArcadiaExt
4202
4581
  #p editor.text.dump_tag('0.1',editor.text.index('end'))
4203
4582
  close_editor(editor,true)
4204
4583
  }
4205
- Arcadia.persistent('editor.files.open', _files)
4584
+ Arcadia.persistent("#{@name}.files.open", _files)
4206
4585
  clear_temp_files
4207
4586
  # _breakpoints = '';
4208
4587
  # @breakpoints.each{|point|
@@ -4231,12 +4610,16 @@ class AgMultiEditor < ArcadiaExt
4231
4610
  end
4232
4611
 
4233
4612
  def raised
4234
- _page = @main_frame.enb.raise
4235
- return @tabs_editor[resolve_tab_name(_page)]
4613
+ if @main_frame
4614
+ _page = @main_frame.raise
4615
+ return @tabs_editor[resolve_tab_name(_page)]
4616
+ else
4617
+ nil
4618
+ end
4236
4619
  end
4237
4620
 
4238
4621
  def close_raised
4239
- _e = @tabs_editor[resolve_tab_name(@main_frame.enb.raise)]
4622
+ _e = @tabs_editor[resolve_tab_name(@main_frame.raise)]
4240
4623
  close_editor(_e) if _e
4241
4624
  end
4242
4625
 
@@ -4274,8 +4657,8 @@ class AgMultiEditor < ArcadiaExt
4274
4657
 
4275
4658
  def open_last_files
4276
4659
  @batch_files = true
4277
- if Arcadia.persistent('editor.files.open')
4278
- _files_index =Arcadia.persistent('editor.files.open').split("|")
4660
+ if Arcadia.persistent("#{@name}.files.open")
4661
+ _files_index =Arcadia.persistent("#{@name}.files.open").split("|")
4279
4662
  _files_index.each do |value|
4280
4663
  _file,_index,_line_numbers_visible_as_string = value.split(';')
4281
4664
  if _file && _index
@@ -4289,18 +4672,17 @@ class AgMultiEditor < ArcadiaExt
4289
4672
  end
4290
4673
  end
4291
4674
  @batch_files = false
4292
- to_raise_file = Arcadia.persistent('editor.files.last')
4675
+ to_raise_file = Arcadia.persistent("#{@name}.files.last")
4293
4676
  if to_raise_file
4294
4677
  raise_file(to_raise_file,0)
4295
4678
  else
4296
- _first_page = @main_frame.enb.pages(0) if @main_frame.enb.pages.length > 0
4679
+ _first_page = @main_frame.pages[0] if @main_frame.pages.length > 0
4297
4680
  if _first_page
4298
- @main_frame.enb.raise(_first_page) if frame_def_visible?
4299
- @main_frame.enb.see(_first_page)
4681
+ @main_frame.raise(_first_page) if frame_def_visible?
4682
+ @main_frame.see(_first_page)
4300
4683
  end
4301
4684
  end
4302
- frame(1)
4303
- #@arcadia.layout.add_observer(self)
4685
+ main_instance.frame(1)
4304
4686
  Arcadia.attach_listener(self, LayoutRaisingFrameEvent)
4305
4687
  self
4306
4688
  end
@@ -4348,18 +4730,9 @@ class AgMultiEditor < ArcadiaExt
4348
4730
  end
4349
4731
 
4350
4732
 
4351
- def get_tab_from_name(_name=nil)
4352
- return @main_frame.enb.get_frame(_name)
4353
- # if _name
4354
- # @tabs_name.each{
4355
- # |key,value|
4356
- # if value.to_s==_name.to_s
4357
- # return key
4358
- # end
4359
- # }
4360
- # return nil
4361
- # end
4362
- end
4733
+ # def get_tab_from_name(_name=nil)
4734
+ # return @main_frame.enb.get_frame(_name)
4735
+ # end
4363
4736
 
4364
4737
  def name_read_only(_name)
4365
4738
  '[READ-ONLY] '+_name
@@ -4368,14 +4741,23 @@ class AgMultiEditor < ArcadiaExt
4368
4741
  def unname_read_only(_name)
4369
4742
  return _name.gsub("[READ-ONLY] ",'')
4370
4743
  end
4744
+
4745
+ def name_modified(_name)
4746
+ '(...)'+_name
4747
+ end
4748
+
4749
+ def unname_modified(_name)
4750
+ return _name.gsub("(...)",'')
4751
+ end
4752
+
4371
4753
 
4372
4754
  def change_tab_set_read_only(_tab)
4373
- _new_name = name_read_only(@main_frame.enb.itemcget(page_name(_tab), 'text'))
4755
+ _new_name = name_read_only(@main_frame.page_title(page_name(_tab)))
4374
4756
  change_tab_title(_tab, _new_name)
4375
4757
  end
4376
4758
 
4377
4759
  def change_tab_reset_read_only(_tab)
4378
- _new_name = unname_read_only(@main_frame.enb.itemcget(page_name(_tab), 'text'))
4760
+ _new_name = unname_read_only(@main_frame.page_title(page_name(_tab)))
4379
4761
  if _new_name
4380
4762
  change_tab_title(_tab, _new_name)
4381
4763
  end
@@ -4383,16 +4765,15 @@ class AgMultiEditor < ArcadiaExt
4383
4765
 
4384
4766
 
4385
4767
  def change_tab_set_modify(_tab)
4386
- _new_name = '(...)'+@main_frame.enb.itemcget(page_name(_tab), 'text')
4387
- change_tab_title(_tab, _new_name)
4768
+ change_tab_title(_tab, name_modified(@main_frame.page_title(page_name(_tab))))
4388
4769
  end
4389
4770
 
4390
4771
  def tab_title(_tab)
4391
- @main_frame.enb.itemcget(page_name(_tab), 'text')
4772
+ @main_frame.page_title(page_name(_tab))
4392
4773
  end
4393
4774
 
4394
4775
  def tab_title_by_tab_name(_tab_name)
4395
- @main_frame.enb.itemcget(resolve_tab_name(_tab_name), 'text')
4776
+ @main_frame.page_title(resolve_tab_name(_tab_name))
4396
4777
  end
4397
4778
 
4398
4779
  def tab_name(_str="")
@@ -4407,8 +4788,9 @@ class AgMultiEditor < ArcadiaExt
4407
4788
  end
4408
4789
 
4409
4790
  def page_name(_page_frame)
4410
- pn = TkWinfo.appname(_page_frame).sub('f','')
4411
- resolve_tab_name(pn)
4791
+ @main_frame.page_name(_page_frame)
4792
+ # pn = TkWinfo.appname(_page_frame).sub('f','')
4793
+ # resolve_tab_name(pn)
4412
4794
  end
4413
4795
 
4414
4796
  def resolve_tab_name(_tab_name)
@@ -4421,44 +4803,64 @@ class AgMultiEditor < ArcadiaExt
4421
4803
 
4422
4804
  def change_tab_reset_modify(_tab)
4423
4805
  #_new_name = @main_frame.enb.itemcget(@tabs_name[_tab], 'text').gsub!("(...)",'')
4424
- if @main_frame.enb.index(page_name(_tab))
4425
- _new_name = @main_frame.enb.itemcget(page_name(_tab), 'text').gsub!("(...)",'')
4806
+ if @main_frame.index(@main_frame.page_name(_tab))
4807
+ _new_name = unname_modified(@main_frame.page_title(page_name(_tab)))
4426
4808
  if _new_name
4427
4809
  change_tab_title(_tab, _new_name)
4428
4810
  end
4429
4811
  end
4430
4812
  end
4431
-
4432
- def change_frame_caption(_new_caption)
4813
+
4814
+ def change_frame_caption(_name, _new_caption)
4433
4815
  if @arcadia.layout.headed?
4434
4816
  if frame.root.title == frame.title
4435
- frame.root.top_text(_new_caption)
4817
+ frame.root.top_text(@main_frame.page(_name)['text'], @main_frame.page(_name)['image']) if @main_frame.page(_name)
4818
+ frame.root.top_text_hint(_new_caption)
4819
+ end
4820
+ frame.root.save_caption(frame.name, @main_frame.page(_name)['text'], @main_frame.page(_name)['image'])
4821
+ end
4822
+ end
4823
+
4824
+
4825
+ def change_outline_frame_caption(_new_caption)
4826
+ if @arcadia.layout.headed?
4827
+ if main_instance.frame(1).root.title == main_instance.frame(1).title
4828
+ main_instance.frame(1).root.top_text(_new_caption)
4436
4829
  end
4437
- frame.root.save_caption(frame.name, _new_caption)
4830
+ main_instance.frame(1).root.save_caption(frame.name, _new_caption)
4438
4831
  end
4439
4832
  end
4440
4833
 
4441
- def change_tab_title(_tab, _new_text)
4442
- @main_frame.enb.itemconfigure(page_name(_tab), 'text'=> _new_text)
4834
+ def change_tab_title(_tab, _new_text, _new_file=nil)
4835
+ p_name = page_name(_tab)
4836
+ old_text = @main_frame.page_title(p_name)
4837
+
4838
+ if @tabs_editor[p_name] && @tabs_editor[p_name].file
4839
+ mod_buffer_menu_item(@tabs_editor[p_name].file, _new_text, _new_file)
4840
+ else
4841
+ mod_buffer_menu_item(unname_modified(tab_title_by_tab_name(p_name)), _new_text)
4842
+ end
4843
+ # mod_buffer_menu_item(@main_frame.page(p_name)['file'], _new_text)
4844
+ @main_frame.page_title(p_name, _new_text)
4443
4845
  end
4444
4846
 
4445
4847
  def change_tab_icon(_tab, _new_text)
4446
- @main_frame.enb.itemconfigure(page_name(_tab), 'image'=> Arcadia.file_icon(_new_text))
4848
+ @main_frame.page_title(page_name(_tab), nil, Arcadia.file_icon(_new_text))
4447
4849
  end
4448
4850
 
4449
4851
  def change_file(_old_file, _new_file)
4450
4852
  _tab_name=tab_file_name(_old_file)
4451
- _tab = @main_frame.enb.get_frame(_tab_name)
4853
+ _tab = @main_frame.page_frame(_tab_name)
4452
4854
  e = @tabs_editor[_tab_name]
4453
- e.new_file_name(_new_file) if e
4454
4855
  change_file_name(_tab, _new_file)
4856
+ e.new_file_name(_new_file) if e
4455
4857
  end
4456
4858
 
4457
4859
  def change_file_name(_tab, _new_file)
4458
4860
  @tabs_file[page_name(_tab)] = _new_file
4459
4861
  @raw_buffer_name[tab_file_name(_new_file)]=page_name(_tab)
4460
4862
  _new_label = File.basename(_new_file)
4461
- change_tab_title(_tab, _new_label)
4863
+ change_tab_title(_tab, _new_label, _new_file)
4462
4864
  change_tab_icon(_tab, _new_label)
4463
4865
  #change_frame_caption(_new_file)
4464
4866
  #@tabs_editor[tab_file_name(_new_file)]=@tabs_editor[page_name(_tab)]
@@ -4515,21 +4917,22 @@ class AgMultiEditor < ArcadiaExt
4515
4917
  end
4516
4918
 
4517
4919
  def change_outline(_e, _raised=false)
4518
- _raised = _raised || frame(1).raised?
4920
+ return if defined?(@@last_outline_e) && @@last_outline_e == _e
4921
+ _raised = _raised || main_instance.frame(1).raised?
4519
4922
  if !@batch_files && _raised
4520
- @last_outline_e.hide_outline if @last_outline_e
4923
+ @@last_outline_e.hide_outline if defined?(@@last_outline_e)
4924
+ if _e && _e.file
4925
+ change_outline_frame_caption(File.basename(_e.file))
4926
+ end
4521
4927
  _e.show_outline
4522
- @last_outline_e = _e
4928
+ @@last_outline_e = _e
4523
4929
  end
4524
4930
  end
4525
4931
 
4526
4932
  def do_buffer_raise(_name, _title='...')
4527
- _index = @main_frame.enb.index(resolve_tab_name(_name))
4933
+ _index = @main_frame.index(resolve_tab_name(_name))
4528
4934
  _new_caption = '...'
4529
4935
  if _index != -1
4530
- #_name = @main_frame.enb.pages(_index)
4531
- #_tab = get_tab_from_name(_name)
4532
- #@main_frame.enb.raise(_name)
4533
4936
  _e = @tabs_editor[resolve_tab_name(_name)]
4534
4937
  change_outline(_e) if _e
4535
4938
  if _e && _e.file != nil
@@ -4542,28 +4945,28 @@ class AgMultiEditor < ArcadiaExt
4542
4945
  _lang = _e.lang
4543
4946
  _e.update_toolbar
4544
4947
  end
4545
- change_frame_caption(_new_caption)
4948
+ change_frame_caption(_name, _new_caption)
4546
4949
  refresh_status
4547
4950
  _title = @tabs_file[_name] != nil ? File.basename(@tabs_file[_name]) :_name
4548
4951
  Arcadia.broadcast_event(BufferRaisedEvent.new(self, 'title'=>_title, 'file'=>@tabs_file[_name], 'lang'=>_lang ))
4549
4952
  Arcadia.process_event(InputEnterEvent.new(self,'receiver'=>_e.text)) if _e
4550
-
4953
+ refresh_selected_buffer_menu_item
4551
4954
  #EditorContract.instance.buffer_raised(self, 'title'=>_title, 'file'=>@tabs_file[_name])
4552
4955
  end
4553
4956
 
4554
4957
  def initialize_status
4555
- @statusbar_items = Hash.new
4556
- @statusbar_items['file_size'] = Arcadia.new_statusbar_item("File size")
4557
- @statusbar_items['file_mtime'] = Arcadia.new_statusbar_item("File modification time")
4558
- @statusbar_items['file_name'] = Arcadia.new_statusbar_item("File name")
4559
- # @statusbar_item = Arcadia.new_statusbar_item
4560
- # @statusbar_item.relief('flat')
4958
+ if !defined?(@@statusbar_items)
4959
+ @@statusbar_items = Hash.new
4960
+ @@statusbar_items['file_size'] = Arcadia.new_statusbar_item("File size")
4961
+ @@statusbar_items['file_mtime'] = Arcadia.new_statusbar_item("File modification time")
4962
+ @@statusbar_items['file_name'] = Arcadia.new_statusbar_item("File name")
4963
+ end
4561
4964
  end
4562
4965
 
4563
4966
  def reset_status
4564
- @statusbar_items['file_name'].text = '?'
4565
- @statusbar_items['file_mtime'].text = '?'
4566
- @statusbar_items['file_size'].text = '?'
4967
+ @@statusbar_items['file_name'].text = '?'
4968
+ @@statusbar_items['file_mtime'].text = '?'
4969
+ @@statusbar_items['file_size'].text = '?'
4567
4970
  end
4568
4971
 
4569
4972
  def refresh_status
@@ -4575,10 +4978,12 @@ class AgMultiEditor < ArcadiaExt
4575
4978
  else
4576
4979
  size_str = "#{size} b"
4577
4980
  end
4578
- @statusbar_items['file_name'].text(File.basename(raised.file))
4579
- @statusbar_items['file_mtime'].text = raised.file_info['mtime'].localtime
4580
- @statusbar_items['file_size'].text = size_str
4981
+ @@statusbar_items['file_name'].text(File.basename(raised.file))
4982
+ @@statusbar_items['file_mtime'].text = raised.file_info['mtime'].localtime
4983
+ @@statusbar_items['file_size'].text = size_str
4581
4984
  #@statusbar_item.text("#{File.basename(raised.file)} | #{raised.file_info['mtime'].localtime} | #{size_str}")
4985
+ else
4986
+ reset_status
4582
4987
  end
4583
4988
  end
4584
4989
 
@@ -4593,10 +4998,10 @@ class AgMultiEditor < ArcadiaExt
4593
4998
  if _ret.nil?
4594
4999
  _basefilename = File.basename(_filename)
4595
5000
  _name = self.tab_file_name(_filename)
4596
- _index = @main_frame.enb.index(resolve_tab_name(_name))
5001
+ _index = @main_frame.index(resolve_tab_name(_name))
4597
5002
  if _index == -1
4598
5003
  _name = name_read_only(_name)
4599
- _index = @main_frame.enb.index(resolve_tab_name(_name))
5004
+ _index = @main_frame.index(resolve_tab_name(_name))
4600
5005
  end
4601
5006
  if _index != -1
4602
5007
  _ret = @tabs_editor[resolve_tab_name(_name)]
@@ -4610,9 +5015,9 @@ class AgMultiEditor < ArcadiaExt
4610
5015
  #_basename = _basefilename.split('.')[0]+'_'+_basefilename.split('.')[1]
4611
5016
 
4612
5017
  _name = self.tab_file_name(_filename)
4613
- _index = @main_frame.enb.index(resolve_tab_name(_name))
5018
+ _index = @main_frame.index(resolve_tab_name(_name))
4614
5019
  if _index == -1
4615
- _index = @main_frame.enb.index(resolve_tab_name(name_read_only(_name)))
5020
+ _index = @main_frame.index(resolve_tab_name(name_read_only(_name)))
4616
5021
  end
4617
5022
  if _index == -1
4618
5023
  @editors.each{|e|
@@ -4628,10 +5033,10 @@ class AgMultiEditor < ArcadiaExt
4628
5033
  def raise_file(_filename=nil, _pos=nil)
4629
5034
  if _filename && frame_def_visible?
4630
5035
  tab_name=self.tab_file_name(_filename)
4631
- if @main_frame.enb.index(tab_name) != -1
4632
- @main_frame.enb.move(tab_name,_pos) if _pos
4633
- @main_frame.enb.raise(tab_name)
4634
- @main_frame.enb.see(tab_name)
5036
+ if @main_frame.index(tab_name) != -1
5037
+ @main_frame.move(tab_name,_pos) if _pos
5038
+ @main_frame.raise(tab_name)
5039
+ @main_frame.see(tab_name)
4635
5040
  end
4636
5041
  end
4637
5042
  end
@@ -4657,6 +5062,7 @@ class AgMultiEditor < ArcadiaExt
4657
5062
  close_editor(@tabs_editor[_tab_name], true)
4658
5063
  Arcadia.runtime_error(e)
4659
5064
  end
5065
+ change_outline_frame_caption(File.basename(_filename)) if _filename
4660
5066
  end
4661
5067
  editor = @tabs_editor[_tab_name]
4662
5068
  if _text_index != nil && _text_index != '1.0' && editor
@@ -4669,7 +5075,7 @@ class AgMultiEditor < ArcadiaExt
4669
5075
 
4670
5076
 
4671
5077
  def open_buffer(_buffer_name = nil, _title = nil, _filename=nil, _lang=nil)
4672
- _index = @main_frame.enb.index(resolve_tab_name(_buffer_name))
5078
+ _index = @main_frame.index(resolve_tab_name(_buffer_name))
4673
5079
  if _buffer_name == nil
4674
5080
  _title_new = '*new'
4675
5081
  tmp_buffer_num = 0
@@ -4678,11 +5084,11 @@ class AgMultiEditor < ArcadiaExt
4678
5084
  end
4679
5085
 
4680
5086
  if _index != -1
4681
- _tab = @main_frame.enb.get_frame(resolve_tab_name(_buffer_name))
4682
- @main_frame.enb.raise(resolve_tab_name(_buffer_name)) if frame_visible?
5087
+ _tab = @main_frame.page_frame(resolve_tab_name(_buffer_name))
5088
+ @main_frame.raise(resolve_tab_name(_buffer_name)) if frame_visible?
4683
5089
  else
4684
5090
  _n = 1
4685
- while @main_frame.enb.index(_buffer_name) != -1
5091
+ while @main_frame.index(_buffer_name) != -1
4686
5092
  _title_new = '*new'+_n.to_s
4687
5093
  tmp_buffer_num = _n
4688
5094
  _buffer_name = tab_name(_title_new)
@@ -4700,14 +5106,15 @@ class AgMultiEditor < ArcadiaExt
4700
5106
  else
4701
5107
  _image = Arcadia.file_icon(_title)
4702
5108
  end
4703
- _tab = @main_frame.enb.insert('end', _buffer_name ,
4704
- 'text'=> _title,
4705
- 'image'=> _image,
4706
- # 'image'=> Arcadia.file_icon(lang_sign),
4707
- 'background'=> Arcadia.style("tabpanel")["background"],
4708
- 'foreground'=> Arcadia.style("tabpanel")["foreground"],
4709
- 'raisecmd'=>proc{do_buffer_raise(_buffer_name, _title)}
4710
- )
5109
+ _tab = @main_frame.add_page(_buffer_name, _filename, _title, _image, proc{do_buffer_raise(_buffer_name, _title)})
5110
+ # _tab = @main_frame.enb.insert('end', _buffer_name ,
5111
+ # 'text'=> _title,
5112
+ # 'image'=> _image,
5113
+ # # 'image'=> Arcadia.file_icon(lang_sign),
5114
+ # 'background'=> Arcadia.style("tabpanel")["background"],
5115
+ # 'foreground'=> Arcadia.style("tabpanel")["foreground"],
5116
+ # 'raisecmd'=>proc{do_buffer_raise(_buffer_name, _title)}
5117
+ # )
4711
5118
  @raw_buffer_name[_buffer_name]=_buffer_name
4712
5119
  if _filename
4713
5120
  add_buffer_menu_item(_filename)
@@ -4727,11 +5134,11 @@ class AgMultiEditor < ArcadiaExt
4727
5134
  end
4728
5135
  begin
4729
5136
  if raised != @tabs_editor[resolve_tab_name(_buffer_name)]
4730
- @main_frame.enb.move(resolve_tab_name(_buffer_name), 0)
4731
- @main_frame.enb.raise(resolve_tab_name(_buffer_name)) if frame_visible?
4732
- @main_frame.enb.see(resolve_tab_name(_buffer_name))
5137
+ @main_frame.move(resolve_tab_name(_buffer_name), 0)
5138
+ @main_frame.raise(resolve_tab_name(_buffer_name)) if frame_visible?
5139
+ @main_frame.see(resolve_tab_name(_buffer_name))
4733
5140
  else
4734
- @main_frame.enb.move(resolve_tab_name(_buffer_name), 0)
5141
+ @main_frame.move(resolve_tab_name(_buffer_name), 0)
4735
5142
  end
4736
5143
  rescue Exception => e
4737
5144
  Arcadia.runtime_error(e)
@@ -4748,7 +5155,7 @@ class AgMultiEditor < ArcadiaExt
4748
5155
  end
4749
5156
  }
4750
5157
  if _tab_name
4751
- _index = @main_frame.enb.index(resolve_tab_name(_tab_name))
5158
+ _index = @main_frame.index(resolve_tab_name(_tab_name))
4752
5159
  _exist_buffer = _index != -1
4753
5160
  if _exist_buffer
4754
5161
  open_buffer(_tab_name)
@@ -4781,7 +5188,7 @@ class AgMultiEditor < ArcadiaExt
4781
5188
  ret = true
4782
5189
  if _editor.modified?
4783
5190
  filename = page_name(_editor.page_frame)
4784
- message = @main_frame.enb.itemcget(filename, 'text')+"\n modified. Save?"
5191
+ message = @main_frame.page_title(filename)+"\n modified. Save?"
4785
5192
  r=Arcadia.dialog(self,
4786
5193
  'type'=>'yes_no_cancel',
4787
5194
  'level'=>'warning',
@@ -4795,7 +5202,7 @@ class AgMultiEditor < ArcadiaExt
4795
5202
  end
4796
5203
  elsif _editor.modified_by_others?
4797
5204
  filename = page_name(_editor.page_frame)
4798
- message = @main_frame.enb.itemcget(filename, 'text')+"\n modified by other process. Continue closing?"
5205
+ message = @main_frame.page_title(filename)+"\n modified by other process. Continue closing?"
4799
5206
  r=Arcadia.dialog(self,
4800
5207
  'type'=>'yes_no',
4801
5208
  'level'=>'warning',
@@ -4819,6 +5226,7 @@ class AgMultiEditor < ArcadiaExt
4819
5226
  index = _editor.text.index("@0,0")
4820
5227
  r,c = index.split('.')
4821
5228
  _editor.destroy_outline
5229
+ change_outline_frame_caption('') if raised==_editor
4822
5230
  close_buffer(_editor.page_frame)
4823
5231
  BufferClosedEvent.new(self,'file'=>file,'row'=>r.to_i, 'col'=>c.to_i).shot!
4824
5232
  else
@@ -4831,18 +5239,18 @@ class AgMultiEditor < ArcadiaExt
4831
5239
  if @tabs_editor[_name] && @tabs_editor[_name].file
4832
5240
  del_buffer_menu_item(@tabs_editor[_name].file)
4833
5241
  else
4834
- del_buffer_menu_item(tab_title_by_tab_name(_name))
5242
+ del_buffer_menu_item(unname_modified(tab_title_by_tab_name(_name)))
4835
5243
  end
4836
5244
  @tabs_editor.delete(_name)
4837
5245
  @tabs_file.delete(_name)
4838
5246
  @raw_buffer_name.delete_if {|key, value| value == _name }
4839
5247
 
4840
- _index = @main_frame.enb.index(_name)
4841
- @main_frame.enb.delete(_name)
4842
- if !@main_frame.enb.pages.empty?
4843
- @main_frame.enb.raise(@main_frame.enb.pages[_index-1]) if TkWinfo.mapped?(@main_frame.enb)
5248
+ _index = @main_frame.index(_name)
5249
+ @main_frame.delete_page(_name)
5250
+ if !@main_frame.pages.empty?
5251
+ @main_frame.raise(@main_frame.pages[_index-1]) if TkWinfo.mapped?(@main_frame.root_frame)
4844
5252
  else
4845
- frame.root.top_text('') if TkWinfo.mapped?(frame.hinner_frame)
5253
+ frame.root.top_text_clear if TkWinfo.mapped?(frame.hinner_frame)
4846
5254
  reset_status
4847
5255
  end
4848
5256
  end
@@ -5005,6 +5413,7 @@ class Findview < TkFloatTitledFrame
5005
5413
  super
5006
5414
  self.focus
5007
5415
  @e_what.focus
5416
+ @e_what_entry.select_throw
5008
5417
  @e_what_entry.selection_range(0,'end')
5009
5418
  end
5010
5419
 
@@ -5253,6 +5662,7 @@ class GoToLine < TkFloatTitledFrame
5253
5662
  super
5254
5663
  self.focus
5255
5664
  @e_line.focus
5665
+ @e_line.select_throw
5256
5666
  @e_line.selection_range(0,'end')
5257
5667
  end
5258
5668
  end