arcadia 0.8.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -1,8 +1,8 @@
1
1
  = Arcadia Ruby Ide
2
- version 0.8.0
2
+ version 0.8.1
3
3
 
4
4
  by Antonio Galeone
5
- on Dec 11, 2009
5
+ on Apr 10, 2010
6
6
 
7
7
 
8
8
  == About
@@ -16,23 +16,18 @@ Some of Arcadia ruby ide project features include:
16
16
  * Working on any platform where ruby and tcl-tk work.
17
17
  * Highly extensibility architecture.
18
18
 
19
- == In this release 0.8.0
20
- [New extensions]
21
- ack in files:
22
- - similar to "search in files" using ack utility
23
-
19
+ == In this release 0.8.1
20
+
24
21
  [Improvements]
25
22
  commons:
26
- - porting ruby 1.9
27
23
  - bug-fixing
28
- core:
29
- - remenber window size/position, show/hide toolbar preferences and layout from previous run
24
+ - hide splash on gems wizard
25
+ - added keybinding configurazion support
26
+ - added new event : RedoTextEvent, SelectAllTextEvent, InvertSelectionTextEvent, UpperCaseTextEvent, LowerCaseTextEvent
27
+ and Edit menu items : 'Redo','Select all','Invert selection','Uppercase', 'Lowercase'
28
+
30
29
  editor:
31
- - remember the last file your were editing, with editing location, on startup
32
- - added new hightlight engine based on coderay, others kind of file are now supported (erb,rhtml,java)
33
- - added auto completion of current word based on words within the current window
34
- also; then added escape key short cut.
35
- - added outline syncronization
30
+ - added dynamic resizing of line numbers frame
36
31
 
37
32
  == Dependencies
38
33
  - rubygems
data/conf/arcadia.conf CHANGED
@@ -27,6 +27,7 @@ layout.split.4=0.0r60%
27
27
  #:::::::::::::::: layout ::::::::::::::::::::::<end>
28
28
  confirm-on-exit=no
29
29
  #:::::::::::::::::::::::::::::::::::::::::::::::::<begin>
30
+ encoding=utf-8
30
31
  font.h1=
31
32
  font.h2=
32
33
  font.h3=courier 10
@@ -63,6 +64,8 @@ panel.borderwidth=0
63
64
 
64
65
  scrollbar.background=>>>background
65
66
  scrollbar.highlightbackground=>>>background
67
+ scrollbar.activebackground=>>>activebackground
68
+ #scrollbar.troughcolor=red
66
69
  scrollbar.relief=flat
67
70
  scrollbar.borderwidth=1
68
71
  scrollbar.elementborderwidth=1
@@ -349,6 +352,22 @@ e.user_toolbar.sys.exit.event_class=!QuitEvent
349
352
 
350
353
  user_toolbar_show=yes
351
354
  #:::::::::::::::: toolbar ::::::::::::::::::::::<end>
355
+ #:::::::::::::::: keybinding ::::::::::::::::::::::<begin>
356
+ #keybinding.Control-Shift-KeyPress[X]=OpenBufferEvent.new(self,'file'=>Arcadia.open_file_dialog)
357
+ #keybinding.Control-KeyPress[o]=OpenBufferEvent.new(self)
358
+ #keybinding.Control-Shift-KeyPress[Y]=ActionEvent.new(self,'action'=>Arcadia.open_file_dialog)
359
+ keybinding.Control-KeyPress[q]=QuitEvent.new(self)
360
+
361
+ keybinding.Control-KeyPress[x]=CutTextEvent.new(self)
362
+ keybinding.Control-KeyPress[c]=CopyTextEvent.new(self)
363
+ keybinding.Control-KeyPress[v]=PasteTextEvent.new(self)
364
+ keybinding.Control-KeyPress[z]=UndoTextEvent.new(self)
365
+ keybinding.Control-KeyPress[r]=RedoTextEvent.new(self)
366
+ keybinding.Control-Shift-KeyPress[A]=SelectAllTextEvent.new(self)
367
+ keybinding.Control-Shift-KeyPress[I]=InvertSelectionTextEvent.new(self)
368
+ keybinding.Control-Shift-KeyPress[U]=UpperCaseTextEvent.new(self)
369
+ keybinding.Control-Shift-KeyPress[L]=LowerCaseTextEvent.new(self)
370
+ #:::::::::::::::: keybinding ::::::::::::::::::::::<end>
352
371
 
353
372
  #:::::::::::::::: splash group ::::::::::::::::::::::<begin>
354
373
  splash.show=yes
@@ -455,6 +455,7 @@ class DirProjects < ArcadiaExt
455
455
  end
456
456
  }
457
457
  )
458
+
458
459
  @htree.areabind_append("Button-3",
459
460
  proc{|x,y|
460
461
  _x = TkWinfo.pointerx(@htree)
@@ -729,7 +730,8 @@ class DirProjects < ArcadiaExt
729
730
  def add_node(_parent, _node, _kind)
730
731
  return if @htree.exist?(_node)
731
732
  @node_parent[_node] = _parent
732
- _name = _node.split(File::SEPARATOR)[-1]
733
+ # _name = _node.split(File::SEPARATOR)[-1]
734
+ _name = File.basename(_node)
733
735
  _drawcross = 'auto'
734
736
  if _kind == "project" || _kind == "directory"
735
737
  num = Dir.entries(_node).length-2
@@ -135,4 +135,5 @@ explorer_panel.tabs.side=top
135
135
 
136
136
  #:::::::::::::::: Editor group ::::::::::::::::::::::<end>
137
137
  popup.bind.shortcut=Button-3
138
- arm::popup.bind.shortcut=F4
138
+ arm::popup.bind.shortcut=F4
139
+ #keybinding.Control-Shift-KeyPress[Y]=ActionEvent.new(self,'action'=>close_raised)
@@ -370,6 +370,9 @@ class SafeCompleteCode
370
370
  # 1) includiano i require
371
371
  elsif line.strip.length>7 && (line.strip[0..7]=="require " || line.strip[0..7]=="require(")
372
372
  @modified_source = "#{@modified_source}#{line}\n"
373
+ if line.strip[8..-1].include?("tk")
374
+ @modified_source = "#{@modified_source}Tk.root.destroy if Tk && Tk.root\n"
375
+ end
373
376
  #@modified_row = @modified_row+1
374
377
  #Arcadia.console(self, 'msg'=>"per require @modified_row=#{@modified_row}")
375
378
  # 2) includiano la riga da evaluare con un $SAFE 3
@@ -836,7 +839,7 @@ class AgEditorOutline
836
839
  build_tree_from_node(@ss.root, _label_sel)
837
840
  if @selected
838
841
  @tree_exp.selection_add(@selected.rif)
839
- @tree_exp.open_tree(@selected.parent.rif)
842
+ @tree_exp.open_tree(@selected.parent.rif) if @selected.parent.rif != 'root'
840
843
  @tree_exp.see(@selected.rif)
841
844
  end
842
845
  end
@@ -896,7 +899,7 @@ class AgEditor
896
899
 
897
900
  def xy_insert
898
901
  _index_now = @text.index('insert')
899
- _rx, _ry, _widht, _heigth = @text.bbox(_index_now);
902
+ _rx, _ry, _width, _heigth = @text.bbox(_index_now);
900
903
  _x = _rx + TkWinfo.rootx(@text)
901
904
  _y = _ry + TkWinfo.rooty(@text) + @font_metrics[2][1]
902
905
  _xroot = _x - TkWinfo.rootx(Arcadia.instance.layout.root)
@@ -906,7 +909,7 @@ class AgEditor
906
909
 
907
910
 
908
911
  def initialize_text(_frame)
909
- @text = TkScrollText.new(_frame, Arcadia.style('text')){|j|
912
+ @text = TkArcadiaText.new(_frame, Arcadia.style('text')){|j|
910
913
  wrap 'none'
911
914
  undo true
912
915
  # insertofftime 200
@@ -1060,7 +1063,7 @@ class AgEditor
1060
1063
  extra_len = 0
1061
1064
  end
1062
1065
  if _candidates.length >= 1
1063
- _rx, _ry, _widht, heigth = @text.bbox(_begin_index);
1066
+ _rx, _ry, _width, heigth = @text.bbox(_begin_index);
1064
1067
  _x = _rx + TkWinfo.rootx(@text)
1065
1068
  _y = _ry + TkWinfo.rooty(@text) + @font_metrics[2][1]
1066
1069
  _xroot = _x - TkWinfo.rootx(Arcadia.instance.layout.root)
@@ -1328,26 +1331,35 @@ class AgEditor
1328
1331
  #
1329
1332
  def activate_key_binding
1330
1333
  activate_complete_code_key_binding if @is_ruby
1334
+
1331
1335
  @text.bind_append("Control-KeyPress"){|e|
1332
1336
  case e.keysym
1333
- # when 'space'
1334
- # @do_complete = true
1335
- # complete_code.call
1336
- when 'z'
1337
- #_b = @text.index('insert').split('.')[0].to_i
1338
- begin
1339
- @text.edit_undo
1340
- rescue RuntimeError => e
1341
- throw e unless e.to_s.include? "nothing to undo" # this is ok--we've done undo back to the beginning
1342
- break
1343
- end
1344
- #_e = @text.index('insert').split('.')[0].to_i
1345
- if @highlighting
1346
- _b = @text.index('@0,0').split('.')[0].to_i
1347
- _e = @text.index('@0,'+TkWinfo.height(@text).to_s).split('.')[0].to_i + 1
1348
- rehighlightlines(_b,_e)
1349
- end
1350
- break
1337
+ # when 'z'
1338
+ # begin
1339
+ # @text.edit_undo
1340
+ # rescue RuntimeError => e
1341
+ # throw e unless e.to_s.include? "nothing to undo" # this is ok--we've done undo back to the beginning
1342
+ # break
1343
+ # end
1344
+ # if @highlighting
1345
+ # _b = @text.index('@0,0').split('.')[0].to_i
1346
+ # _e = @text.index('@0,'+TkWinfo.height(@text).to_s).split('.')[0].to_i + 1
1347
+ # rehighlightlines(_b,_e)
1348
+ # end
1349
+ # break
1350
+ # when 'r'
1351
+ # begin
1352
+ # @text.edit_redo
1353
+ # rescue RuntimeError => e
1354
+ # throw e unless e.to_s.include? "nothing to redo" # this is ok--we've done redo back to the beginning
1355
+ # break
1356
+ # end
1357
+ # if @highlighting
1358
+ # _b = @text.index('@0,0').split('.')[0].to_i
1359
+ # _e = @text.index('@0,'+TkWinfo.height(@text).to_s).split('.')[0].to_i + 1
1360
+ # rehighlightlines(_b,_e)
1361
+ # end
1362
+ # break
1351
1363
  when 'o'
1352
1364
  if @file
1353
1365
  _dir = File.dirname(@file)
@@ -1356,23 +1368,20 @@ class AgEditor
1356
1368
  end
1357
1369
  Arcadia.process_event(OpenBufferEvent.new(self,'file'=>Tk.getOpenFile('initialdir'=>_dir)))
1358
1370
  break
1359
- when 'c'
1360
- @text.text_copy
1361
- break
1362
- when 'x'
1363
- @text.text_cut
1364
- break
1365
- when 'v'
1366
- _b = @text.index('insert').split('.')[0].to_i
1367
- @text.text_paste
1368
- _e = @text.index('insert').split('.')[0].to_i
1369
- if @highlighting
1370
- rehighlightlines(_b,_e)
1371
- # for j in _b..._e
1372
- # rehighlightline(j)
1373
- # end
1374
- end
1375
- break
1371
+ # when 'c'
1372
+ # @text.text_copy
1373
+ # break
1374
+ # when 'x'
1375
+ # @text.text_cut
1376
+ # break
1377
+ # when 'v'
1378
+ # _b = @text.index('insert').split('.')[0].to_i
1379
+ # @text.text_paste
1380
+ # _e = @text.index('insert').split('.')[0].to_i
1381
+ # if @highlighting
1382
+ # rehighlightlines(_b,_e)
1383
+ # end
1384
+ # break
1376
1385
  end
1377
1386
  case e.keysym
1378
1387
  when 's'
@@ -1577,7 +1586,6 @@ class AgEditor
1577
1586
  @text.bind_remove('Control-KeyPress')
1578
1587
  @text.bind_remove('Control-Shift-KeyPress')
1579
1588
  @text.bind_remove('Shift-KeyPress')
1580
-
1581
1589
  end
1582
1590
 
1583
1591
  def do_enter
@@ -1886,7 +1894,7 @@ class AgEditor
1886
1894
  def pop_up_menu
1887
1895
  @pop_up = TkMenu.new(
1888
1896
  :parent=>@text,
1889
- :tearoff=>0,
1897
+ :tearoff=>1,
1890
1898
  :title => 'Menu'
1891
1899
  )
1892
1900
  @pop_up.configure(Arcadia.style('menu'))
@@ -1992,6 +2000,26 @@ class AgEditor
1992
2000
  @text.insert('insert',Tk.chooseColor)
1993
2001
  }
1994
2002
  )
2003
+
2004
+ @pop_up.insert('end',
2005
+ :command,
2006
+ :label=>'View color from data',
2007
+ :hidemargin => false,
2008
+ :command=> proc{
2009
+ _r = @text.tag_ranges('sel')
2010
+ if _r.length>0
2011
+ _data=@text.get(_r[0][0],_r[0][1])
2012
+ if _data.length > 0
2013
+ _b = TkButton.new(@text,
2014
+ 'command'=>proc{_b.destroy},
2015
+ 'bg'=>_data,
2016
+ 'relief'=>'groove')
2017
+ TkTextWindow.new(@text, _r[0][1], 'window'=> _b)
2018
+ end
2019
+ end
2020
+ }
2021
+ )
2022
+
1995
2023
  @pop_up.insert('end',
1996
2024
  :command,
1997
2025
  :label=>'Font',
@@ -2003,7 +2031,7 @@ class AgEditor
2003
2031
 
2004
2032
  @pop_up.insert('end',
2005
2033
  :command,
2006
- :label=>'Data image from file',
2034
+ :label=>'Data from file',
2007
2035
  :hidemargin => false,
2008
2036
  :command=> proc{
2009
2037
  file = Arcadia.open_file_dialog
@@ -2039,6 +2067,7 @@ class AgEditor
2039
2067
  }
2040
2068
  )
2041
2069
 
2070
+
2042
2071
  @pop_up.insert('end',
2043
2072
  :command,
2044
2073
  :label=>'Data image to file',
@@ -2211,7 +2240,8 @@ class AgEditor
2211
2240
  proc{|x,y|
2212
2241
  _x = TkWinfo.pointerx(@text)
2213
2242
  _y = TkWinfo.pointery(@text)
2214
- @pop_up.entryconfigure(0, 'label'=>File.basename(@file)) if @file
2243
+ @pop_up.entryconfigure(1, 'label'=>File.basename(@file)) if @file
2244
+ #@pop_up.entryconfigure(0, 'label'=>File.basename(@file)) if @file
2215
2245
  @pop_up.popup(_x,_y)
2216
2246
  },
2217
2247
  "%x %y")
@@ -2524,14 +2554,14 @@ class AgEditor
2524
2554
  @text_line_num.delete('1.0','end')
2525
2555
 
2526
2556
 
2527
- _rx, _ry, _widht, _heigth = @text.bbox(line_begin_index);
2557
+ _rx, _ry, _width, _heigth = @text.bbox(line_begin_index);
2528
2558
 
2529
2559
  if _ry && _ry < 0
2530
2560
  real_line_end = line_end + 1
2531
2561
  else
2532
2562
  real_line_end = line_end
2533
2563
  end
2534
-
2564
+ #@fm1
2535
2565
  _tags = Array.new
2536
2566
  for j in line_begin...real_line_end
2537
2567
  nline = j.to_s.rjust(line_end.to_s.length+2)
@@ -2542,10 +2572,9 @@ class AgEditor
2542
2572
  else
2543
2573
  _tags << 'normal_case'
2544
2574
  end
2545
-
2546
2575
  if wrap_on
2547
- w_rx_b, w_ry_b, w_widht_b, w_heigth_b = @text.bbox("#{(j).to_s}.0");
2548
- w_rx_e, w_ry_e, w_widht_e, w_heigth_e = @text.bbox("#{(j).to_s}.0 lineend");
2576
+ w_rx_b, w_ry_b, w_width_b, w_heigth_b = @text.bbox("#{(j).to_s}.0");
2577
+ w_rx_e, w_ry_e, w_width_e, w_heigth_e = @text.bbox("#{(j).to_s}.0 lineend");
2549
2578
  if w_ry_e && w_ry_b
2550
2579
  delta = w_ry_e - w_ry_b
2551
2580
  if delta > 1
@@ -2555,7 +2584,6 @@ class AgEditor
2555
2584
  end
2556
2585
  end
2557
2586
  end
2558
-
2559
2587
  @text_line_num.insert(_index, "#{nline}\n",_tags)
2560
2588
  if b.include?(j.to_s)
2561
2589
  add_tag_breakpoint(j)
@@ -2566,11 +2594,28 @@ class AgEditor
2566
2594
  end
2567
2595
  end
2568
2596
  refresh_outline if Tk.focus==@text
2569
- # if TkWinfo.mapped?(@text_line_num)
2570
- # x,y,w,h = @text.bbox("#{(line_end).to_s}.3");
2571
- # @fm1.splitter_frame.go(w,0)
2572
- # @fm1.do_resize
2573
- # end
2597
+ resize_line_num(line_end)
2598
+ end
2599
+
2600
+ def resize_line_num(_line_end=nil)
2601
+ if TkWinfo.mapped?(@text_line_num)
2602
+ _line_end=@text.index('@0,'+TkWinfo.height(@text).to_s).split('.')[0].to_i + 1 if _line_end.nil?
2603
+ line_end_chars = _line_end.to_s.length
2604
+ if @last_line_end_chars != line_end_chars
2605
+ if @line_num_rx_e.nil?
2606
+ @line_num_rx_e, @line_num_ry_e, @line_num_width_e, @line_num_heigth_e = @text_line_num.bbox("0.1 lineend - 1chars");
2607
+ end
2608
+ if @line_num_rx_e && @line_num_width_e && line_end_chars >0
2609
+ actual_width = @line_num_rx_e + @line_num_width_e
2610
+ need_width = (line_end_chars+1)*@line_num_width_e
2611
+ delta = actual_width - need_width
2612
+ @fm1.resize_left(need_width)
2613
+ @last_line_end_chars = line_end_chars
2614
+ else
2615
+ @last_line_end_chars = -1
2616
+ end
2617
+ end
2618
+ end
2574
2619
  end
2575
2620
 
2576
2621
  def highlightlines(_row_begin, _row_end, _check_mod = false)
@@ -2733,6 +2778,30 @@ class AgEditor
2733
2778
  end
2734
2779
  end
2735
2780
 
2781
+ def modified_by_others?
2782
+ ret = false
2783
+ if @file_last_access_time && @file
2784
+ if File.exist?(@file)
2785
+ ftime = File.mtime(@file)
2786
+ ret = @file_last_access_time != ftime
2787
+ else
2788
+ ret = true
2789
+ end
2790
+ end
2791
+ ret
2792
+ end
2793
+
2794
+ def reset_file_last_access_time
2795
+ if @file
2796
+ if File.exist?(@file)
2797
+ @file_last_access_time = File.mtime(@file)
2798
+ else
2799
+ @file_last_access_time = nil
2800
+ @file = nil
2801
+ end
2802
+ end
2803
+ end
2804
+
2736
2805
  def check_file_last_access_time
2737
2806
  if @file
2738
2807
  file_exist = File.exist?(@file)
@@ -2740,11 +2809,11 @@ class AgEditor
2740
2809
  ftime = File.mtime(@file)
2741
2810
  if @file_last_access_time != ftime
2742
2811
  msg = 'File "'+@file+'" is changed! Reload?'
2743
- if Tk.messageBox('icon' => 'error', 'type' => 'yesno',
2812
+ ans = Tk.messageBox('icon' => 'error', 'type' => 'yesno',
2744
2813
  'title' => '(Arcadia) Libs', 'parent' => @text,
2745
- 'message' => msg) == 'yes'
2814
+ 'message' => msg)
2815
+ if ans == 'yes'
2746
2816
  reload
2747
-
2748
2817
  else
2749
2818
  @file_last_access_time = ftime
2750
2819
  end
@@ -3115,7 +3184,7 @@ class AgMultiEditor < ArcadiaExt
3115
3184
 
3116
3185
  def on_after_focus(_event)
3117
3186
  if raised && _event.focus_widget == raised.text
3118
- if [CutTextEvent, PasteTextEvent].include?(_event.class)
3187
+ if [CutTextEvent, PasteTextEvent, UndoTextEvent, RedoTextEvent].include?(_event.class)
3119
3188
  if raised.highlighting
3120
3189
  line_begin_index = raised.text.index('@0,0')
3121
3190
  line_begin = line_begin_index.split('.')[0].to_i
@@ -3473,11 +3542,6 @@ class AgMultiEditor < ArcadiaExt
3473
3542
  def close_raised
3474
3543
  _e = @tabs_editor[@main_frame.enb.raise]
3475
3544
  close_editor(_e) if _e
3476
-
3477
- #_page = @main_frame.enb.raise
3478
- #_editor = @tabs_editor[_page]
3479
- #_row = _editor.text_insert_index.split('.')[0].strip.to_i
3480
- #close_editor(_editor)
3481
3545
  end
3482
3546
 
3483
3547
  def breakpoint_add(_file,_line)
@@ -3867,6 +3931,21 @@ class AgMultiEditor < ArcadiaExt
3867
3931
  elsif r=="cancel"
3868
3932
  ret = false
3869
3933
  end
3934
+ elsif _editor.modified_by_others?
3935
+ filename = page_name(_editor.page_frame)
3936
+ message = @main_frame.enb.itemcget(filename, 'text')+"\n modified by other process. Continue closing?"
3937
+ r=Arcadia.dialog(self,
3938
+ 'type'=>'yes_no',
3939
+ 'level'=>'warning',
3940
+ 'title'=> 'Continue closing',
3941
+ 'msg'=>message)
3942
+ if r=="yes"
3943
+ _editor.reset_file_last_access_time
3944
+ ret = !_editor.modified_by_others?
3945
+ else
3946
+ ret = false
3947
+ #raise_file(filename)
3948
+ end
3870
3949
  end
3871
3950
  ret
3872
3951
  end