arcadia 0.1.0 → 0.1.1

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.
@@ -0,0 +1,6 @@
1
+ name=complete_code
2
+ label=Complete code
3
+ frame=1.0
4
+ active=yes
5
+ require=ext/ae-complete-code/ae-complete-code
6
+ class=CompleteCode
@@ -0,0 +1,79 @@
1
+ #
2
+ # ae-complete-code.rb - Arcadia Ruby ide
3
+ # by Antonio Galeone <antonio-galeone@rubyforge.org>
4
+ #
5
+
6
+ require "base/a-ext"
7
+
8
+
9
+ class CompleteCode < ArcadiaExt
10
+
11
+ def before_build
12
+ end
13
+
14
+ def build
15
+ end
16
+
17
+ def after_build
18
+
19
+
20
+ @rct_complete=complete_command
21
+
22
+ if @rct_complete !=nil #system(@rct_complete+" "+__FILE__)
23
+ ArcadiaContractListener.new(self, EditorContract, :do_editor_event)
24
+ else
25
+ MsgContract.instance.out_error(self, "Extension ae-complete-code depend upon rct-complete(rcodetools) command (install it or update system path!)")
26
+ end
27
+ end
28
+
29
+ def complete_command
30
+ _ret = nil
31
+ RUBY_PLATFORM.include?('win32') ? _sep = ';':_sep=':'
32
+ ENV['PATH'].split(_sep).each{|_path|
33
+ _file = File.join(_path, 'rct-complete')
34
+ if FileTest.exist?(_file)
35
+ _ret = _file
36
+ end
37
+ }
38
+ _ret
39
+ end
40
+
41
+ def do_editor_event(_event)
42
+ case _event.signature
43
+ when EditorContract::COMPLETE_CODE
44
+ if _event.context.file
45
+ _event.context.candidates = candidates(_event.context.file, _event.context.line, _event.context.col)
46
+ _event.handled(self)
47
+ end
48
+ end
49
+ end
50
+
51
+ def candidates(_file, _line, _col)
52
+ begin
53
+ #_options = "--completion-class-info --line="+_line+" --column="+_col
54
+ _options = "--line="+_line+" --column="+_col
55
+ _cmp_s = "|ruby "+@rct_complete+" "+_options+" "+_file
56
+ _ret = nil
57
+ open(_cmp_s,"r") do
58
+ |f|
59
+ _ret = f.readlines.collect!{| line | line.chomp}
60
+ end
61
+ if _ret.length == 0
62
+ _cmp_s_d = _cmp_s+" 2>&1"
63
+ _error = nil
64
+ open(_cmp_s_d,"r") do
65
+ |f|
66
+ _error = f.readlines.collect!{| line | line.chomp}
67
+ end
68
+ if _error != nil && _error.length > 0
69
+ MsgContract.instance.out_error(self, "Syntax error in current source")
70
+ end
71
+ end
72
+ _ret
73
+ rescue Exception => e
74
+ MsgContract.instance.out_error(self, e.to_s)
75
+ end
76
+ end
77
+
78
+ end
79
+
@@ -8,7 +8,7 @@ require "observer"
8
8
  class ArcadiaDebugWrapper
9
9
  include Observable
10
10
  attr_reader :last_command
11
-
11
+ attr_reader :debugging
12
12
  def initialize
13
13
  (RUBY_PLATFORM == 'i386-mswin32')?_cmd="cmd":_cmd='sh'
14
14
  @io = IO.popen(_cmd,'w')
@@ -16,6 +16,7 @@ class ArcadiaDebugWrapper
16
16
  @stop = false
17
17
  @transfer_file=ArcadiaDebugWrapper.transfer_file
18
18
  @threads = Array.new
19
+ @debugging = false
19
20
  end
20
21
 
21
22
  def ArcadiaDebugWrapper.transfer_file
@@ -122,6 +123,7 @@ class ArcadiaDebugWrapper
122
123
 
123
124
  def command(_command)
124
125
  begin
126
+ @debugging = true
125
127
  @io.puts(_command)
126
128
  @last_command = _command
127
129
  rescue Exception => e
@@ -134,6 +136,16 @@ class ArcadiaDebugWrapper
134
136
  end
135
137
 
136
138
  def read
139
+ # t_i = 0
140
+ # t_out = 5
141
+ # while !File.exist?(@transfer_file) && t_i < t_out
142
+ # sleep(t_i)
143
+ # t_i = t_i + 1
144
+ # end
145
+ # if !File.exist?(@transfer_file)
146
+ # return
147
+ # end
148
+
137
149
  begin
138
150
  while !File.exist?(@transfer_file)
139
151
  end
@@ -143,81 +155,22 @@ class ArcadiaDebugWrapper
143
155
  File.open(@transfer_file) do |f|
144
156
  $ppp = Marshal.load(f)
145
157
  end
146
- while !File.stat(@transfer_file).writable?
158
+ while !File.stat(@transfer_file).writable?
147
159
  end
148
160
  File.delete(@transfer_file) if File.exist?(@transfer_file)
149
161
  changed
150
162
  notify_observers($ppp)
151
163
  end
152
164
  rescue Exception => e
153
- MsgContract.instance.out_debug(self, "\n"+'Error on : '+" read >>> "+@transfer_file+" : "+e.to_s )
154
- #$arcadia.outln("\n read >>> "+@transfer_file+" � andato in errore :"+e.to_s ) if $arcadia
165
+ MsgContract.instance.out_debug(self, "\n"+'Error on : '+" reading >>> "+@transfer_file+" : "+e.to_s )
166
+ ensure
167
+ @debugging = false
155
168
  end
156
169
  end
157
170
  end
158
171
 
159
172
  class ArcadiaDebug < ArcadiaExt
160
173
 
161
- def before_build
162
- ArcadiaContractListener.new(self, EditorContract, :do_editor_event)
163
- @breakpoints = Hash.new
164
- @static_breakpoints = Array.new
165
- end
166
-
167
- def build
168
- end
169
-
170
- def debug_state
171
- end
172
-
173
- def breakpoint_suf(_file,_line)
174
- return _line.to_s + "-" + _file.to_s
175
- end
176
-
177
- def breakpoint_add(_file,_line)
178
- if @adw
179
- @breakpoints[breakpoint_suf(_file,_line)] = @adw.breakpoint_set(_line, _file)
180
- else
181
- @static_breakpoints << {:file=>_file,:line=>_line}
182
- end
183
- end
184
-
185
- def breakpoint_del(_file,_line)
186
- if @adw
187
- @adw.breakpoint_del(@breakpoints.delete(breakpoint_suf(_file,_line)))
188
- end
189
- @static_breakpoints.delete_if{|b| (b[:file]==_file && b[:line]==_line)}
190
- end
191
-
192
- def do_editor_event(_event)
193
- #@arcadia.outln('in debug _sender ----> '+_sender.to_s)
194
- #@arcadia.outln('in debug _event.signature ----> '+_event.signature)
195
- case _event.signature
196
- when EditorContract::BREAKPOINT_AFTER_CREATE
197
- self.breakpoint_add(_event.context.file, _event.context.line)
198
- when EditorContract::BREAKPOINT_AFTER_DELETE
199
- self.breakpoint_del(_event.context.file, _event.context.line)
200
- when EditorContract::BUFFER_AFTER_RAISE
201
- @raised_file=_event.context.file
202
- end
203
- end
204
-
205
- def can_exit_query
206
- if @adw
207
- query = (Tk.messageBox('icon' => 'question', 'type' => 'yesno',
208
- 'title' => '(Arcadia) Debug',
209
- 'message' => "Debug in course, do you want to exit?")=='yes')
210
- if query
211
- debug_quit
212
- return true
213
- else
214
- return false
215
- end
216
- else
217
- return true
218
- end
219
- end
220
-
221
174
  class VariablesViewText < TkTitledFrame
222
175
  attr_reader :text
223
176
 
@@ -384,6 +337,68 @@ class ArcadiaDebug < ArcadiaExt
384
337
  end
385
338
 
386
339
 
340
+ def before_build
341
+ ArcadiaContractListener.new(self, EditorContract, :do_editor_event)
342
+ @breakpoints = Hash.new
343
+ @static_breakpoints = Array.new
344
+ end
345
+
346
+ def build
347
+ end
348
+
349
+ def debug_state
350
+ end
351
+
352
+ def breakpoint_suf(_file,_line)
353
+ return _line.to_s + "-" + _file.to_s
354
+ end
355
+
356
+ def breakpoint_add(_file,_line)
357
+ if @adw
358
+ @breakpoints[breakpoint_suf(_file,_line)] = @adw.breakpoint_set(_line, _file)
359
+ else
360
+ @static_breakpoints << {:file=>_file,:line=>_line}
361
+ end
362
+ end
363
+
364
+ def breakpoint_del(_file,_line)
365
+ if @adw
366
+ @adw.breakpoint_del(@breakpoints.delete(breakpoint_suf(_file,_line)))
367
+ end
368
+ @static_breakpoints.delete_if{|b| (b[:file]==_file && b[:line]==_line)}
369
+ end
370
+
371
+ def do_editor_event(_event)
372
+ #@arcadia.outln('in debug _sender ----> '+_sender.to_s)
373
+ #@arcadia.outln('in debug _event.signature ----> '+_event.signature)
374
+ case _event.signature
375
+ when EditorContract::BREAKPOINT_AFTER_CREATE
376
+ self.breakpoint_add(_event.context.file, _event.context.line)
377
+ when EditorContract::BREAKPOINT_AFTER_DELETE
378
+ self.breakpoint_del(_event.context.file, _event.context.line)
379
+ when EditorContract::BUFFER_AFTER_RAISE
380
+ @raised_file=_event.context.file
381
+ end
382
+ end
383
+
384
+ def can_exit_query
385
+ if @adw
386
+ query = (Tk.messageBox('icon' => 'question', 'type' => 'yesno',
387
+ 'title' => '(Arcadia) Debug',
388
+ 'message' => "Debug in course, do you want to exit?")=='yes')
389
+ if query
390
+ debug_quit
391
+ return true
392
+ else
393
+ return false
394
+ end
395
+ else
396
+ return true
397
+ end
398
+ end
399
+
400
+
401
+
387
402
  def debug_begin
388
403
  @breakpoints.clear
389
404
  DebugContract.instance.debug_begin(DebugContract::TDebugObj.new(self))
@@ -500,20 +515,28 @@ class ArcadiaDebug < ArcadiaExt
500
515
  end
501
516
 
502
517
  def debug_quit
503
-
504
- if @adw
505
- begin
506
- self.frame_free
507
- #self.debug_end
508
- @adw.quit_debug
509
- @adw = nil
510
- #$arcadia['editor'].debug_end
511
- MsgContract.instance.out_debug(self, "\n<end debug>")
512
-
513
- #@arcadia['shell'].outln("\n<end debug>")
514
- rescue Exception => e
515
- MsgContract.instance.out_debug(self, "debug_quit:---> "+e.to_s)
516
- #@arcadia['shell'].outln("debug_quit:---> "+e.to_s )
518
+ if @adw
519
+ if @adw.debugging
520
+ Thread.new{
521
+ Tk.messageBox('icon' => 'info',
522
+ 'type' => 'ok',
523
+ 'title' => '(Arcadia) Debug',
524
+ 'message' => "Debug in course, wait next step to exit")
525
+ }
526
+ else
527
+ begin
528
+ self.frame_free
529
+ #self.debug_end
530
+ @adw.quit_debug
531
+ @adw = nil
532
+ #$arcadia['editor'].debug_end
533
+ MsgContract.instance.out_debug(self, "\n<end debug>")
534
+
535
+ #@arcadia['shell'].outln("\n<end debug>")
536
+ rescue Exception => e
537
+ MsgContract.instance.out_debug(self, "debug_quit:---> "+e.to_s)
538
+ #@arcadia['shell'].outln("debug_quit:---> "+e.to_s )
539
+ end
517
540
  end
518
541
  end
519
542
  end
@@ -10,17 +10,17 @@ tab-replace-width-space=2
10
10
  find.frame=0.0
11
11
  #tabs
12
12
  tabs.font=courier 9
13
- i386-freebsd6:tabs.font=courier 12
14
- i386-mswin32:tabs.font={Courier New} 9
13
+ i386-freebsd6::tabs.font=courier 12
14
+ i386-mswin32::tabs.font={Courier New} 9
15
15
  #tabs.side=bottom
16
16
  tabs.side=top
17
17
  # editor
18
18
  font=courier 9
19
19
  font.bold=courier 9 bold
20
- i386-freebsd6:font=courier 12
21
- i386-freebsd6:font.bold=courier 12 bold
22
- i386-mswin32:font={Courier New} 9
23
- i386-mswin32:font.bold={Courier New} 9 bold
20
+ i386-freebsd6::font=courier 12
21
+ i386-freebsd6::font.bold=courier 12 bold
22
+ i386-mswin32::font={Courier New} 9
23
+ i386-mswin32::font.bold={Courier New} 9 bold
24
24
  #+--------------------------------------------------
25
25
  #color.background=#000040
26
26
  #color.foreground=white
@@ -77,16 +77,16 @@ line_number_panel.color.foreground=#333333
77
77
  explorer_panel.tree.color.background=#ffffff
78
78
  explorer_panel.tree.color.foreground=white
79
79
  explorer_panel.tree.font=courier 9
80
- i386-freebsd6:explorer_panel.tree.font=courier 12
81
- i386-mswin32:explorer_panel.tree.font={Courier New} 9
80
+ i386-freebsd6::explorer_panel.tree.font=courier 12
81
+ i386-mswin32::explorer_panel.tree.font={Courier New} 9
82
82
  explorer_panel.tree.class.color.foreground=#a42019
83
83
  explorer_panel.tree.class.font=times 10 bold
84
- i386-mswin32:explorer_panel.tree.class.font=times 10 bold
84
+ i386-mswin32::explorer_panel.tree.class.font=times 10 bold
85
85
  explorer_panel.tree.def.color.foreground=blue
86
86
  explorer_panel.tree.def.font=times 10
87
- i386-mswin32:explorer_panel.tree.def.font=times 10
87
+ i386-mswin32::explorer_panel.tree.def.font=times 10
88
88
  explorer_panel.tree.module.color.foreground=#1b691e
89
89
  explorer_panel.tree.module.font=times 8 bold
90
- i386-mswin32:explorer_panel.tree.module.font={Courier New} 9 bold
90
+ i386-mswin32::explorer_panel.tree.module.font={Courier New} 9 bold
91
91
 
92
92
  #:::::::::::::::: Editor group ::::::::::::::::::::::<end>
@@ -65,7 +65,7 @@ class AgEditor
65
65
  font $arcadia['conf']['editor.tabs.font']
66
66
  pack('fill'=>'both', :padx=>0, :pady=>0, :expand => 'yes')
67
67
  }
68
- @nb_tab_exp = @nb.insert('end','exp' ,'text'=>'Class Tree' )
68
+ @nb_tab_exp = @nb.insert('end','exp' ,'text'=>'Source Tree' )
69
69
  @nb.raise('exp')
70
70
  _tree_goto = proc{|_self|
71
71
  _line = _self.selection_get[0]
@@ -161,6 +161,21 @@ class AgEditor
161
161
 
162
162
  @text.bind("Control-KeyPress"){|e|
163
163
  case e.keysym
164
+ when 'space'
165
+ line, col = @text.index('insert').split('.')
166
+ _file = @file+'~~'
167
+ f = File.new(@file+'~~', "w")
168
+ begin
169
+ if f
170
+ f.syswrite(text_value)
171
+ end
172
+ ensure
173
+ f.close unless f.nil?
174
+ end
175
+
176
+
177
+
178
+ EditorContract.instance.complete_code(EditorContract::TEditorObj.new(self, 'file'=>_file, 'line'=>line.to_s, 'col'=>col.to_s))
164
179
  when 'z'
165
180
  _b = @text.index('insert').split('.')[0].to_i
166
181
  @text.edit_undo
@@ -247,6 +262,7 @@ class AgEditor
247
262
  }
248
263
  @text.bind("KeyPress"){|e|
249
264
  case e.keysym
265
+ when 'Return'
250
266
  when 'BackSpace'
251
267
  _index = @text.index('insert')
252
268
  _row, _col = _index.split('.')
@@ -657,22 +673,22 @@ class AgEditor
657
673
  for inode in 0.._sorted_sons.length - 1
658
674
  _son = _sorted_sons[inode]
659
675
  if _son.kind == 'KClass'
660
- _window = TkLabel.new(@tree_exp){
676
+ _window = TkLabel.new(@fm.left_frame){
661
677
  image TkPhotoImage.new('dat' => TREE_NODE_CLASS_GIF)
662
678
  background($arcadia['conf']['editor.explorer_panel.tree.color.background'])
663
679
  }
664
680
  elsif _son.kind == 'KModule'
665
- _window = TkLabel.new(@tree_exp){
681
+ _window = TkLabel.new(@fm.left_frame){
666
682
  image TkPhotoImage.new('dat' => TREE_NODE_MODULE_GIF)
667
683
  background($arcadia['conf']['editor.explorer_panel.tree.color.background'])
668
684
  }
669
685
  elsif _son.kind == 'KDef'
670
- _window = TkLabel.new(@tree_exp){
686
+ _window = TkLabel.new(@fm.left_frame){
671
687
  image TkPhotoImage.new('dat' => TREE_NODE_DEF_GIF)
672
688
  background($arcadia['conf']['editor.explorer_panel.tree.color.background'])
673
689
  }
674
690
  elsif _son.kind == 'KDefClass'
675
- _window = TkLabel.new(@tree_exp){
691
+ _window = TkLabel.new(@fm.left_frame){
676
692
  image TkPhotoImage.new('dat' => TREE_NODE_DEFCLASS_GIF)
677
693
  background($arcadia['conf']['editor.explorer_panel.tree.color.background'])
678
694
  }
@@ -1027,9 +1043,17 @@ class AgEditor
1027
1043
  @text.insert('end',file.readlines.collect!{| line | line.chomp+"\n" }.to_s)
1028
1044
  }
1029
1045
  end
1046
+ reset
1047
+ refresh
1048
+ end
1049
+
1050
+ def reset
1030
1051
  @buffer = text_value
1031
1052
  reset_modify
1032
1053
  @text.edit_reset
1054
+ end
1055
+
1056
+ def refresh
1033
1057
  build_tree if @classbrowsing
1034
1058
  end
1035
1059
  end
@@ -1058,6 +1082,7 @@ class AgMultiEditor < ArcadiaExt
1058
1082
  def before_build
1059
1083
  ArcadiaContractListener.new(self, DebugContract, :do_debug_event)
1060
1084
  ArcadiaContractListener.new(self, EditorContract, :do_editor_event)
1085
+ ArcadiaContractListener.new(self, MainContract, :do_main_event)
1061
1086
  end
1062
1087
 
1063
1088
  def build
@@ -1118,14 +1143,20 @@ class AgMultiEditor < ArcadiaExt
1118
1143
  )
1119
1144
 
1120
1145
  @main_frame.enb.tabbind("Button-3",
1121
- proc{|x|
1122
- #p x
1146
+ proc{|*x|
1123
1147
  _x = TkWinfo.pointerx(@main_frame.enb)
1124
1148
  _y = TkWinfo.pointery(@main_frame.enb)
1125
- @selected_tab_name_from_popup = 'ff'+x[0].split(':')[0]
1126
- _file = @main_frame.enb.itemcget(@selected_tab_name_from_popup, 'text')
1127
- @pop_up.entryconfigure(0, 'label'=>_file)
1128
- @pop_up.popup(_x,_y)
1149
+ @selected_tab_name_from_popup = x[0].split(':')[0]
1150
+ _index = @main_frame.enb.index(@selected_tab_name_from_popup)
1151
+ if _index == -1
1152
+ @selected_tab_name_from_popup = 'ff'+@selected_tab_name_from_popup
1153
+ _index = @main_frame.enb.index(@selected_tab_name_from_popup)
1154
+ end
1155
+ if _index != -1
1156
+ _file = @main_frame.enb.itemcget(@selected_tab_name_from_popup, 'text')
1157
+ @pop_up.entryconfigure(0, 'label'=>_file)
1158
+ @pop_up.popup(_x,_y)
1159
+ end
1129
1160
  })
1130
1161
  end
1131
1162
 
@@ -1157,9 +1188,12 @@ class AgMultiEditor < ArcadiaExt
1157
1188
  end
1158
1189
  when EditorContract::OPEN_TEXT
1159
1190
  if _event.context.title
1160
- self.open_buffer(_event.context.title)
1161
- _e = @tabs_editor[_event.context.title]
1191
+ _tab_name = self.tab_name(_event.context.title)
1192
+ self.open_buffer(_tab_name, _event.context.title)
1193
+ _e = @tabs_editor[_tab_name]
1162
1194
  _e.text_insert('end',_event.context.text) if _event.context.text
1195
+ _e.reset
1196
+ _e.refresh
1163
1197
  add_reverse_item(_e)
1164
1198
  _event.handled(self)
1165
1199
  end
@@ -1170,12 +1204,119 @@ class AgMultiEditor < ArcadiaExt
1170
1204
  end
1171
1205
  end
1172
1206
  end
1207
+
1208
+ def do_main_event(_event)
1209
+ case _event.signature
1210
+ when MainContract::EVENT_HANDLED
1211
+ _cause = _event.context.caused_by
1212
+ if _cause.signature == EditorContract::COMPLETE_CODE &&
1213
+ _cause.context.sender == self.raised
1214
+ # delete the file used for completion
1215
+ if File.exist?(_cause.context.file) && _cause.context.file.include?('~~')
1216
+ File.delete(_cause.context.file)
1217
+ end
1218
+
1219
+ _text = self.raised.text
1220
+ _index_call = _cause.context.line+'.'+_cause.context.col
1221
+ _index_now = _text.index('insert')
1222
+ if _index_call == _index_now
1223
+ _target = _text.get('insert - 1 chars wordstart','insert')
1224
+ if _target.length > 0 && _target != '.'
1225
+ extra_len = _target.length.+@
1226
+ _begin_index = _index_now<<' - '<<extra_len.to_s<<' chars'
1227
+ _text.tag_add('sel', _begin_index, _index_now)
1228
+ else
1229
+ _begin_index = _index_now
1230
+ extra_len = 0
1231
+ end
1232
+ if _cause.context.candidates.length > 1
1233
+ _rx, _ry, _widht, heigth = _text.bbox(_begin_index);
1234
+ _menu = TkMenu.new(
1235
+ :parent=>_text,
1236
+ :tearoff=>0,
1237
+ :relief=>'solid',
1238
+ :borderwidth=>1,
1239
+ :background=>conf('color.background'),
1240
+ :foreground=>conf('color.foreground'),
1241
+ :font => conf('font')
1242
+ )
1243
+ _cause.context.candidates.each{|item|
1244
+ _value, _hint = item.split
1245
+ if _hint
1246
+ _menu.insert('end',
1247
+ :command,
1248
+ :accelerator=>_hint.split('#')[0],
1249
+ :command=> proc{_text.delete(_begin_index,'insert'); _text.insert('insert',_value)},
1250
+ :label=>_value,
1251
+ :activebackground=>'yellow',
1252
+ :hidemargin => true
1253
+ )
1254
+ else
1255
+ _menu.insert('end',
1256
+ :command,
1257
+ :command=> proc{_text.delete(_begin_index,'insert'); _text.insert('insert',_value)},
1258
+ :label=>_value,
1259
+ :activebackground=>'yellow',
1260
+ :hidemargin => true
1261
+ )
1262
+ end
1263
+ }
1264
+
1265
+ _x = _rx + TkWinfo.rootx(_text)
1266
+ _y = _ry + TkWinfo.rooty(_text) + TkFont.new(conf('font')).metrics[2][1]
1267
+ _menu.popup(_x,_y)
1268
+
1269
+ _old_g = TkWinfo.geometry(_menu)
1270
+ _w,_h = _old_g.split('+')[0].split('x')
1271
+ _yy = TkWinfo.screenheight(_menu) - _y - 5
1272
+ if _h.to_i > _yy
1273
+ _h = _yy.to_s
1274
+ _w = (_w.to_i+5).to_s
1275
+ _new_g = _w+'x'+_h+'+'+_x.to_s+'+'+_y.to_s
1276
+ Tk.tk_call('wm', 'geometry', _menu, _new_g )
1277
+ _listbox = TkListbox.new(_menu,
1278
+ 'takefocus'=>true,
1279
+ :background=>conf('color.background'),
1280
+ :foreground=>conf('color.foreground'),
1281
+ :selectbackground=>'yellow',
1282
+ :activestyle=>'none',
1283
+ :font => conf('font'),
1284
+ :borderwidth=>1
1285
+ ).place('x'=>0,'y'=>0, 'relwidth'=>1, 'relheight'=>1)
1286
+ _listbox.focus
1287
+ _listbox.bind_append('KeyPress'){|e|
1288
+ case e.keysym
1289
+ when 'Escape'
1290
+ _listbox.destroy
1291
+ _menu.destroy
1292
+ Tk.callback_break
1293
+ when 'Return'
1294
+ _value = _listbox.get('active')
1295
+ _text.delete(_begin_index,'insert')
1296
+ _text.insert('insert',_value)
1297
+ _listbox.destroy
1298
+ _menu.destroy
1299
+ Tk.callback_break
1300
+ end
1301
+ }
1302
+ _cause.context.candidates.each{|value|
1303
+ _listbox.insert('end', value)
1304
+ }
1305
+ end
1306
+ elsif _cause.context.candidates.length == 1 && _cause.context.candidates[0].length>0
1307
+ _text.delete(_begin_index,'insert');
1308
+ _text.insert('insert',_cause.context.candidates[0].split[0])
1309
+ end
1310
+ end
1311
+ end
1312
+ end
1313
+ end
1173
1314
 
1174
1315
  def add_reverse_item(_editor)
1175
1316
  code2form = proc{
1176
1317
  Revparsel.new(_editor.text_value)
1177
1318
  self.close_editor(_editor, false)
1178
- # $arcadia['objic'].active.select_last
1319
+ InspectorContract.instance.raise_last_widget(InspectorContract::TInspectorObj.new(self))
1179
1320
  }
1180
1321
  _editor.insert_popup_menu_item('end',
1181
1322
  :command,
@@ -1415,14 +1556,20 @@ class AgMultiEditor < ArcadiaExt
1415
1556
  return _index != -1
1416
1557
  end
1417
1558
 
1418
- def tab_name(_filename="")
1419
- 'ff'+File.expand_path(_filename).gsub("/","_").gsub(".","_")
1559
+ def tab_name(_str="")
1560
+ 'ff'+_str.gsub("/","_").gsub(".","_").gsub(":","_").gsub("\\","_")
1561
+ end
1562
+
1563
+ def tab_file_name(_filename="")
1564
+ _fstr = File.expand_path(_filename)
1565
+ _fstr = _filename if _fstr == nil
1566
+ tab_name(_fstr)
1420
1567
  end
1421
1568
 
1422
1569
  def open_file(_filename = nil, _text_index='1.0')
1423
1570
  return if _filename == nil || !File.exist?(_filename)
1424
1571
  _basefilename = File.basename(_filename)
1425
- _tab_name = self.tab_name(_filename)
1572
+ _tab_name = self.tab_file_name(_filename)
1426
1573
  _index = @main_frame.enb.index(_tab_name)
1427
1574
  _exist_buffer = _index != -1
1428
1575
 
@@ -1444,7 +1591,7 @@ class AgMultiEditor < ArcadiaExt
1444
1591
 
1445
1592
  if _text_index != nil && _text_index != '1.0'
1446
1593
  @tabs_editor[_tab_name].text_see(_text_index)
1447
- #@tabs_editor[_tab_name].mark_selected(_text_index)
1594
+ @tabs_editor[_tab_name].mark_selected(_text_index)
1448
1595
  end
1449
1596
 
1450
1597
  return @tabs_editor[_tab_name]
@@ -1453,18 +1600,23 @@ class AgMultiEditor < ArcadiaExt
1453
1600
 
1454
1601
  def open_buffer(_buffer_name = nil, _title = nil)
1455
1602
  _index = @main_frame.enb.index(_buffer_name)
1456
- _buffer_name = 'new' if _buffer_name == nil
1603
+ if _buffer_name == nil
1604
+ _buffer_name = tab_name('new')
1605
+ _title_new = '*new'
1606
+ end
1607
+
1457
1608
  if _index != -1
1458
1609
  _tab = @main_frame.enb.get_frame(_buffer_name)
1459
1610
  @main_frame.enb.raise(_buffer_name)
1460
1611
  else
1461
1612
  _n = 1
1462
1613
  while @main_frame.enb.index(_buffer_name) != -1
1463
- _buffer_name = 'new'+_n.to_s
1614
+ _title_new = '*new'+_n.to_s
1615
+ _buffer_name = tab_name('new')+_n.to_s
1464
1616
  _n =_n+1
1465
1617
  end
1466
1618
  if _title == nil
1467
- _title = '*'+_buffer_name
1619
+ _title = _title_new
1468
1620
  end
1469
1621
  _tab = @main_frame.enb.insert('end', _buffer_name ,
1470
1622
  'text'=> _title,
@@ -1619,7 +1771,7 @@ class Find < Findview
1619
1771
  case e.keysym
1620
1772
  when 'Return'
1621
1773
  @find_action.call
1622
- break
1774
+ Tk.callback_break
1623
1775
  end
1624
1776
  }
1625
1777
  @last_index='insert'
@@ -1737,8 +1889,5 @@ class KetTest
1737
1889
  end
1738
1890
  end
1739
1891
 
1740
- class AgTkEditor < AgEditor
1741
- end
1742
-
1743
- class AgTkMultiEditor < AgMultiEditor
1892
+ class CodeInsight
1744
1893
  end