arcadia 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +90 -28
- data/conf/LC/en-UK.LANG +6 -0
- data/conf/LC/ru-RU.LANG +0 -0
- data/conf/arcadia.conf +8 -4
- data/conf/arcadia.res.rb +86 -1
- data/conf/theme-dark.conf +2 -1
- data/ext/ae-breakpoints/ae-breakpoints.rb +1 -1
- data/ext/ae-dir-projects/ae-dir-projects.rb +42 -6
- data/ext/ae-editor/ae-editor.rb +227 -120
- data/ext/ae-editor/langs/coderay.tokens +0 -0
- data/ext/ae-editor/langs/conf.lang +0 -0
- data/ext/ae-editor/langs/css.lang +0 -0
- data/ext/ae-editor/langs/html.lang +0 -0
- data/ext/ae-editor/langs/java.lang +0 -0
- data/ext/ae-editor/langs/python.lang +0 -0
- data/ext/ae-editor/langs/ruby.lang +0 -0
- data/ext/ae-editor/langs/text.lang +0 -0
- data/ext/ae-editor/langs/xml.lang +0 -0
- data/ext/ae-editor/lib/rbeautify.rb +0 -0
- data/ext/ae-file-history/ae-file-history.rb +4 -3
- data/ext/ae-output/ae-output.rb +44 -31
- data/ext/ae-ruby-debug/ae-ruby-debug.conf +3 -2
- data/ext/ae-ruby-debug/ae-ruby-debug.rb +1 -0
- data/ext/ae-search-in-files/ae-search-in-files.rb +3 -3
- data/ext/ae-search-in-files/ext/ack-in-files/ack-in-files.conf +0 -0
- data/ext/ae-search-in-files/ext/ack-in-files/ack-in-files.rb +0 -0
- data/ext/ae-shell/ae-shell.rb +37 -15
- data/ext/ae-subprocess-inspector/ae-subprocess-inspector.rb +14 -8
- data/ext/ae-subprocess-inspector/butterfly.res +0 -0
- data/ext/ae-subprocess-inspector/process.res +0 -0
- data/ext/ae-subprocess-inspector/space-invader.res +0 -0
- data/ext/ae-term/ae-term.conf +0 -0
- data/ext/ae-term/ae-term.rb +0 -0
- data/ext/test-shutdown-after-startup/test-shutdown-after-startup.conf +0 -0
- data/ext/test-shutdown-after-startup/test-shutdown-after-startup.rb +0 -0
- data/lib/a-commons.rb +1 -1
- data/lib/a-contracts.rb +13 -3
- data/lib/a-core.rb +612 -142
- data/lib/a-tkcommons.rb +661 -50
- data/lib/anigif.rb +0 -0
- data/lib/iosync.rb +71 -0
- data/tcl/anigif/anigif.tcl +0 -0
- data/tcl/anigif/pkgIndex.tcl +0 -0
- metadata +5 -2
data/ext/ae-editor/ae-editor.rb
CHANGED
@@ -916,8 +916,8 @@ class TkTextListBox < TkText
|
|
916
916
|
tag_configure('class', 'foreground' => Arcadia.conf('hightlight.class_variable.foreground'))
|
917
917
|
@count = 0
|
918
918
|
@selected = -1
|
919
|
-
self.bind_append('KeyPress'){|
|
920
|
-
self.bind_append('KeyRelease'){|
|
919
|
+
self.bind_append('KeyPress', "%K"){|_keysym| key_press(_keysym)}
|
920
|
+
self.bind_append('KeyRelease', "%K"){|_keysym| key_release(_keysym)}
|
921
921
|
self.bind_append("ButtonPress-1", proc{|x,y| button_press(x,y)}, "%x %y")
|
922
922
|
end
|
923
923
|
|
@@ -953,8 +953,8 @@ class TkTextListBox < TkText
|
|
953
953
|
self.select(_line)
|
954
954
|
end
|
955
955
|
|
956
|
-
def key_press(
|
957
|
-
case
|
956
|
+
def key_press(_keysym)
|
957
|
+
case _keysym
|
958
958
|
when 'Up'
|
959
959
|
if @selected > 0
|
960
960
|
select(@selected-1)
|
@@ -966,8 +966,8 @@ class TkTextListBox < TkText
|
|
966
966
|
end
|
967
967
|
end
|
968
968
|
|
969
|
-
def key_release(
|
970
|
-
case
|
969
|
+
def key_release(_keysym)
|
970
|
+
case _keysym
|
971
971
|
when 'Next','Prior'
|
972
972
|
index = self.index('@0,0')
|
973
973
|
line = index.split('.')[0].to_i
|
@@ -1327,7 +1327,7 @@ class AgEditor
|
|
1327
1327
|
attr_reader :highlighting
|
1328
1328
|
attr_reader :last_tmp_file
|
1329
1329
|
attr_reader :lang
|
1330
|
-
attr_reader :
|
1330
|
+
attr_reader :buffer_info
|
1331
1331
|
attr_reader :outline
|
1332
1332
|
attr_reader :file_loaded
|
1333
1333
|
attr_reader :edit_initialized
|
@@ -1350,7 +1350,7 @@ class AgEditor
|
|
1350
1350
|
@spaces_show = false
|
1351
1351
|
@line_numbers_visible = @controller.conf('line-numbers') == 'yes'
|
1352
1352
|
@id = -1
|
1353
|
-
@
|
1353
|
+
@buffer_info = Hash.new
|
1354
1354
|
@file_loaded = false
|
1355
1355
|
@edit_initialized = false
|
1356
1356
|
@start_index='1.0'
|
@@ -1765,9 +1765,9 @@ class AgEditor
|
|
1765
1765
|
@raised_listbox.select(_line)
|
1766
1766
|
_insert_selected_value.call
|
1767
1767
|
}, "%x %y")
|
1768
|
-
@raised_listbox.bind_append('Shift-KeyPress'){|
|
1768
|
+
@raised_listbox.bind_append('Shift-KeyPress', "%K"){|_keysym|
|
1769
1769
|
# todo
|
1770
|
-
case
|
1770
|
+
case _keysym
|
1771
1771
|
when 'parenleft'
|
1772
1772
|
@text.insert('insert','(')
|
1773
1773
|
_buffer = _buffer + '('
|
@@ -1778,28 +1778,28 @@ class AgEditor
|
|
1778
1778
|
end
|
1779
1779
|
Tk.callback_break
|
1780
1780
|
when 'A'..'Z','equal','greater','underscore'
|
1781
|
-
if
|
1781
|
+
if _keysym == 'equal'
|
1782
1782
|
ch = '='
|
1783
|
-
elsif
|
1783
|
+
elsif _keysym == 'greater'
|
1784
1784
|
ch = '>'
|
1785
|
-
elsif
|
1785
|
+
elsif _keysym == 'underscore'
|
1786
1786
|
ch = '_'
|
1787
1787
|
else
|
1788
|
-
ch =
|
1788
|
+
ch = _keysym
|
1789
1789
|
end
|
1790
1790
|
@text.insert('insert',ch)
|
1791
1791
|
_buffer = _buffer + ch
|
1792
1792
|
_update_list.call(_buffer)
|
1793
1793
|
Tk.callback_break
|
1794
1794
|
else
|
1795
|
-
if
|
1796
|
-
p ">#{
|
1795
|
+
if _keysym.length > 1
|
1796
|
+
p ">#{_keysym}<"
|
1797
1797
|
Tk.callback_break
|
1798
1798
|
end
|
1799
1799
|
end
|
1800
1800
|
}
|
1801
|
-
@raised_listbox.bind_append('KeyPress'){|
|
1802
|
-
case
|
1801
|
+
@raised_listbox.bind_append('KeyPress', "%K"){|_keysym|
|
1802
|
+
case _keysym
|
1803
1803
|
when 'Escape'
|
1804
1804
|
@raised_listbox.grab("release")
|
1805
1805
|
@raised_listbox_frame.destroy
|
@@ -1815,12 +1815,12 @@ class AgEditor
|
|
1815
1815
|
Arcadia.process_event(DocCodeEvent.new(self, 'doc_entry'=>_docs_entries[_key], 'xdoc'=>_x, 'ydoc'=>_y))
|
1816
1816
|
#EditorContract.instance.doc_code(self, 'doc_entry'=>_docs_entries[_key], 'xdoc'=>_x, 'ydoc'=>_y)
|
1817
1817
|
when 'a'..'z','less','space'
|
1818
|
-
if
|
1818
|
+
if _keysym == 'less'
|
1819
1819
|
ch = '<'
|
1820
|
-
elsif
|
1820
|
+
elsif _keysym == 'space'
|
1821
1821
|
ch = ''
|
1822
1822
|
else
|
1823
|
-
ch =
|
1823
|
+
ch = _keysym
|
1824
1824
|
end
|
1825
1825
|
@text.insert('insert',ch)
|
1826
1826
|
_buffer = _buffer + ch
|
@@ -1841,8 +1841,8 @@ class AgEditor
|
|
1841
1841
|
Tk.callback_break
|
1842
1842
|
end
|
1843
1843
|
}
|
1844
|
-
@raised_listbox.bind_append('KeyRelease'){|
|
1845
|
-
case
|
1844
|
+
@raised_listbox.bind_append('KeyRelease', "%K"){|_keysym|
|
1845
|
+
case _keysym
|
1846
1846
|
when 'Return'
|
1847
1847
|
_insert_selected_value.call
|
1848
1848
|
end
|
@@ -1859,8 +1859,8 @@ class AgEditor
|
|
1859
1859
|
def activate_complete_code_key_binding
|
1860
1860
|
@n_complete_task = 0
|
1861
1861
|
# key binding for complete code
|
1862
|
-
@text.bind_append("Control-KeyPress"){|
|
1863
|
-
case
|
1862
|
+
@text.bind_append("Control-KeyPress", "%K"){|_keysym|
|
1863
|
+
case _keysym
|
1864
1864
|
when 'space'
|
1865
1865
|
if @n_complete_task == 0
|
1866
1866
|
@do_complete = true
|
@@ -1869,8 +1869,8 @@ class AgEditor
|
|
1869
1869
|
end
|
1870
1870
|
}
|
1871
1871
|
|
1872
|
-
@text.bind_append("KeyPress"){|
|
1873
|
-
if
|
1872
|
+
@text.bind_append("KeyPress", "%K"){|_keysym|
|
1873
|
+
if _keysym == "Escape"
|
1874
1874
|
if @n_complete_task == 0
|
1875
1875
|
@do_complete = true
|
1876
1876
|
complete_code
|
@@ -1881,8 +1881,8 @@ class AgEditor
|
|
1881
1881
|
}
|
1882
1882
|
case @lang
|
1883
1883
|
when 'ruby'
|
1884
|
-
@text.bind_append("KeyRelease"){|
|
1885
|
-
case
|
1884
|
+
@text.bind_append("KeyRelease", "%K"){|_keysym|
|
1885
|
+
case _keysym
|
1886
1886
|
when 'period'
|
1887
1887
|
_focus_line = @text.get('insert linestart','insert')
|
1888
1888
|
if _focus_line.strip[0..0] != '#'
|
@@ -1905,15 +1905,15 @@ class AgEditor
|
|
1905
1905
|
def activate_key_binding
|
1906
1906
|
activate_complete_code_key_binding #if @is_ruby
|
1907
1907
|
|
1908
|
-
@text.bind_append("Control-KeyPress"){|
|
1909
|
-
case
|
1908
|
+
@text.bind_append("Control-KeyPress", "%K"){|_keysym|
|
1909
|
+
case _keysym
|
1910
1910
|
when 'o'
|
1911
1911
|
if @file
|
1912
1912
|
_dir = File.dirname(@file)
|
1913
1913
|
else
|
1914
1914
|
_dir = MonitorLastUsedDir.get_last_dir
|
1915
1915
|
end
|
1916
|
-
_file = Arcadia.
|
1916
|
+
_file = Arcadia.select_file_dialog(_dir)
|
1917
1917
|
Arcadia.process_event(OpenBufferEvent.new(self,'file'=>_file)) if _file
|
1918
1918
|
Tk.callback_break
|
1919
1919
|
break
|
@@ -1935,8 +1935,8 @@ class AgEditor
|
|
1935
1935
|
end
|
1936
1936
|
}
|
1937
1937
|
|
1938
|
-
@text.bind_append("Control-Shift-KeyPress"){|
|
1939
|
-
case
|
1938
|
+
@text.bind_append("Control-Shift-KeyPress", "%K"){|_keysym|
|
1939
|
+
case _keysym
|
1940
1940
|
when 'I'
|
1941
1941
|
_r = @text.tag_ranges('sel')
|
1942
1942
|
_row_begin = _r[0][0].split('.')[0].to_i
|
@@ -1972,9 +1972,9 @@ class AgEditor
|
|
1972
1972
|
end
|
1973
1973
|
}
|
1974
1974
|
|
1975
|
-
@text.bind_append("KeyPress"){|
|
1976
|
-
@last_keypress =
|
1977
|
-
case
|
1975
|
+
@text.bind_append("KeyPress", "%K"){|_keysym|
|
1976
|
+
@last_keypress = _keysym
|
1977
|
+
case _keysym
|
1978
1978
|
# when 'BackSpace'
|
1979
1979
|
# _index = @text.index('insert')
|
1980
1980
|
# _row, _col = _index.split('.')
|
@@ -2019,10 +2019,10 @@ class AgEditor
|
|
2019
2019
|
end
|
2020
2020
|
}
|
2021
2021
|
|
2022
|
-
@text.bind_append("KeyRelease"){|
|
2023
|
-
@last_keyrelease =
|
2022
|
+
@text.bind_append("KeyRelease", "%K"){|_keysym|
|
2023
|
+
@last_keyrelease = _keysym
|
2024
2024
|
#return if @last_keypress != e.keysym
|
2025
|
-
case
|
2025
|
+
case _keysym
|
2026
2026
|
# when 'Up','Down'
|
2027
2027
|
# refresh_outline
|
2028
2028
|
when 'Left', 'Right'
|
@@ -2072,13 +2072,13 @@ class AgEditor
|
|
2072
2072
|
rehighlightlines(row, row)
|
2073
2073
|
end
|
2074
2074
|
end
|
2075
|
-
check_modify if !['Shift_L','Shift_R','Control_L','Control_R','Up','Down','Left', 'Right', 'Prior', 'Next'].include?(
|
2075
|
+
check_modify if !['Shift_L','Shift_R','Control_L','Control_R','Up','Down','Left', 'Right', 'Prior', 'Next'].include?(_keysym)
|
2076
2076
|
}
|
2077
2077
|
|
2078
2078
|
|
2079
|
-
@text.bind_append("Shift-KeyPress"){|
|
2080
|
-
@last_keypress =
|
2081
|
-
case
|
2079
|
+
@text.bind_append("Shift-KeyPress", "%K"){|_keysym|
|
2080
|
+
@last_keypress = _keysym
|
2081
|
+
case _keysym
|
2082
2082
|
when 'Tab','ISO_Left_Tab'
|
2083
2083
|
_r = @text.tag_ranges('sel')
|
2084
2084
|
if _r && _r[0]
|
@@ -2101,6 +2101,7 @@ class AgEditor
|
|
2101
2101
|
end
|
2102
2102
|
end
|
2103
2103
|
}
|
2104
|
+
|
2104
2105
|
end
|
2105
2106
|
|
2106
2107
|
def decrease_indent
|
@@ -2157,7 +2158,7 @@ class AgEditor
|
|
2157
2158
|
|
2158
2159
|
@text.bind_append("Enter", proc{do_enter})
|
2159
2160
|
|
2160
|
-
@text.bind("<Modified>"){
|
2161
|
+
@text.bind("<Modified>"){
|
2161
2162
|
check_modify
|
2162
2163
|
}
|
2163
2164
|
activate_key_binding
|
@@ -2298,7 +2299,7 @@ class AgEditor
|
|
2298
2299
|
|
2299
2300
|
|
2300
2301
|
@text_line_num.bind("Button-3",
|
2301
|
-
proc{
|
2302
|
+
proc{
|
2302
2303
|
_x = TkWinfo.pointerx(@text_line_num)
|
2303
2304
|
_y = TkWinfo.pointery(@text_line_num)
|
2304
2305
|
_pop_up.entryconfigure(0,'label'=> Arcadia.text('ext.editor.text_line.menu.title', [@text_line_num_current_line]))
|
@@ -2309,6 +2310,7 @@ class AgEditor
|
|
2309
2310
|
end
|
2310
2311
|
|
2311
2312
|
def file_line_to_text_line_num_line(_line)
|
2313
|
+
return 0 if @text_line_num.nil?
|
2312
2314
|
rel_line = nil
|
2313
2315
|
line_begin = @text_line_num.get('1.0','1.end').strip.to_i
|
2314
2316
|
line_end = @text_line_num.index('end').split('.')[0].to_i+line_begin
|
@@ -2366,6 +2368,7 @@ class AgEditor
|
|
2366
2368
|
end
|
2367
2369
|
|
2368
2370
|
def remove_tag_bookmark(_line)
|
2371
|
+
return if @text_line_num.nil?
|
2369
2372
|
rel_line = file_line_to_text_line_num_line(_line)
|
2370
2373
|
if rel_line
|
2371
2374
|
i1 = "#{rel_line}.0"
|
@@ -2661,7 +2664,7 @@ class AgEditor
|
|
2661
2664
|
:label=>Arcadia.text('ext.editor.text.menu.data_from_file'),
|
2662
2665
|
:hidemargin => false,
|
2663
2666
|
:command=> proc{
|
2664
|
-
file = Arcadia.
|
2667
|
+
file = Arcadia.select_file_dialog
|
2665
2668
|
if file
|
2666
2669
|
require 'base64'
|
2667
2670
|
f = File.open(file,"rb")
|
@@ -3157,7 +3160,8 @@ class AgEditor
|
|
3157
3160
|
def reset_modify(_reset_tab=true)
|
3158
3161
|
@controller.change_tab_reset_modify(@page_frame) if _reset_tab
|
3159
3162
|
@set_mod = false
|
3160
|
-
@
|
3163
|
+
@buffer_info['mtime'] = File.mtime(@file) if @file
|
3164
|
+
@buffer_info['encoding'] = @text.value.encoding.name if @text
|
3161
3165
|
#@file_last_access_time = File.mtime(@file) if @file
|
3162
3166
|
@controller.refresh_status
|
3163
3167
|
update_toolbar
|
@@ -3523,21 +3527,21 @@ class AgEditor
|
|
3523
3527
|
if file
|
3524
3528
|
new_file_name(file)
|
3525
3529
|
save
|
3526
|
-
#@controller.change_file_name(@page_frame, file)
|
3527
3530
|
@last_tmp_file = nil if @last_tmp_file != nil
|
3531
|
+
@file_loaded = true
|
3528
3532
|
Arcadia.process_event(OpenBufferEvent.new(self,'file'=>file))
|
3529
3533
|
@controller.do_buffer_raise(@controller.page_name(@page_frame))
|
3530
|
-
#EditorContract.instance.file_created(self, 'file'=>@file)
|
3531
3534
|
end
|
3532
3535
|
end
|
3533
3536
|
|
3534
3537
|
def new_file_name(_new_file)
|
3538
|
+
@controller.change_file_name(@page_frame, _new_file)
|
3535
3539
|
@file =_new_file
|
3536
|
-
@controller.change_file_name(@page_frame, file)
|
3537
3540
|
base_name= File.basename(_new_file)
|
3538
3541
|
if base_name.include?('.')
|
3539
3542
|
self.change_highlight(base_name.split('.')[-1])
|
3540
3543
|
end
|
3544
|
+
|
3541
3545
|
end
|
3542
3546
|
|
3543
3547
|
def update_toolbar
|
@@ -3557,10 +3561,10 @@ class AgEditor
|
|
3557
3561
|
|
3558
3562
|
def modified_by_others?
|
3559
3563
|
ret = false
|
3560
|
-
if @
|
3564
|
+
if @buffer_info['mtime'] && @file
|
3561
3565
|
if File.exist?(@file)
|
3562
3566
|
ftime = File.mtime(@file)
|
3563
|
-
ret = @
|
3567
|
+
ret = @buffer_info['mtime'] != ftime
|
3564
3568
|
else
|
3565
3569
|
ret = true
|
3566
3570
|
end
|
@@ -3571,9 +3575,9 @@ class AgEditor
|
|
3571
3575
|
def reset_file_last_access_time
|
3572
3576
|
if @file
|
3573
3577
|
if File.exist?(@file)
|
3574
|
-
@
|
3578
|
+
@buffer_info['mtime'] = File.mtime(@file)
|
3575
3579
|
else
|
3576
|
-
@
|
3580
|
+
@buffer_info['mtime'] = nil
|
3577
3581
|
@file = nil
|
3578
3582
|
end
|
3579
3583
|
end
|
@@ -3582,16 +3586,16 @@ class AgEditor
|
|
3582
3586
|
def check_file_last_access_time
|
3583
3587
|
if @file
|
3584
3588
|
file_exist = File.exist?(@file)
|
3585
|
-
if @
|
3589
|
+
if @buffer_info['mtime'] && file_exist
|
3586
3590
|
ftime = File.mtime(@file)
|
3587
|
-
if @
|
3591
|
+
if @buffer_info['mtime'] != ftime
|
3588
3592
|
msg = Arcadia.text('ext.editor.text.d.file_changed.msg', [@file])
|
3589
3593
|
title = Arcadia.text('ext.editor.text.d.file_changed.title')
|
3590
3594
|
ans = Arcadia.hinner_dialog(self, 'type'=>'yes_no', 'msg'=> msg, 'title' => title, 'level' => 'error')
|
3591
3595
|
if ans == 'yes'
|
3592
3596
|
reload
|
3593
3597
|
else
|
3594
|
-
@
|
3598
|
+
@buffer_info['mtime'] = ftime
|
3595
3599
|
end
|
3596
3600
|
end
|
3597
3601
|
elsif !file_exist
|
@@ -3680,6 +3684,12 @@ class AgEditor
|
|
3680
3684
|
@outline = nil
|
3681
3685
|
end
|
3682
3686
|
|
3687
|
+
def destroy_text
|
3688
|
+
@text.destroy if @text
|
3689
|
+
@text = nil
|
3690
|
+
end
|
3691
|
+
|
3692
|
+
|
3683
3693
|
def load_file(_filename = nil)
|
3684
3694
|
#if filename is nil then open a new tab
|
3685
3695
|
@loading=true
|
@@ -3756,7 +3766,6 @@ class AgMultiEditorView
|
|
3756
3766
|
def initialize(_parent=nil, _frame=nil, _usetabs=true)
|
3757
3767
|
@parent = _parent
|
3758
3768
|
@frame = _frame
|
3759
|
-
|
3760
3769
|
@usetabs = _usetabs
|
3761
3770
|
if @usetabs
|
3762
3771
|
initialize_tabs
|
@@ -3958,9 +3967,15 @@ class AgMultiEditorView
|
|
3958
3967
|
end
|
3959
3968
|
adapter_frame = @pages.delete(_name)['frame']
|
3960
3969
|
if _delete_adapter
|
3961
|
-
|
3970
|
+
frame = adapter_frame.frame
|
3971
|
+
adapter_frame.detach_frame
|
3962
3972
|
adapter_frame.destroy
|
3963
|
-
|
3973
|
+
frame.destroy
|
3974
|
+
# adapter_frame.frame.destroy if adapter_frame.frame
|
3975
|
+
# adapter_frame.destroy
|
3976
|
+
end
|
3977
|
+
@raised_page = nil if @raised_page == _name
|
3978
|
+
Tk.update
|
3964
3979
|
end
|
3965
3980
|
|
3966
3981
|
def add_menu_button(_name, _buffer_string)
|
@@ -4011,7 +4026,7 @@ class AgMultiEditorView
|
|
4011
4026
|
}
|
4012
4027
|
res
|
4013
4028
|
end
|
4014
|
-
|
4029
|
+
|
4015
4030
|
def raise(_page=nil)
|
4016
4031
|
if @usetabs
|
4017
4032
|
if _page.nil?
|
@@ -4023,7 +4038,7 @@ class AgMultiEditorView
|
|
4023
4038
|
end
|
4024
4039
|
else
|
4025
4040
|
if _page.nil?
|
4026
|
-
@raised_page
|
4041
|
+
@raised_page
|
4027
4042
|
elsif @raised_page != _page || @raised_page_usetabs != @usetabs
|
4028
4043
|
if @raised_page
|
4029
4044
|
# @pages[@raised_page]['frame'].unpack if @pages[@raised_page]
|
@@ -4334,7 +4349,7 @@ class AgMultiEditor < ArcadiaExtPlus
|
|
4334
4349
|
@tabs_editor =Hash.new
|
4335
4350
|
@raw_buffer_name = Hash.new
|
4336
4351
|
@editor_seq=-1
|
4337
|
-
@editors =
|
4352
|
+
@editors =Hash.new
|
4338
4353
|
initialize_status
|
4339
4354
|
#@statusbar_item.pack('side'=>'left','anchor'=>'e','expand'=>'yes')
|
4340
4355
|
Arcadia.attach_listener(self, BufferEvent)
|
@@ -4379,10 +4394,21 @@ class AgMultiEditor < ArcadiaExtPlus
|
|
4379
4394
|
end
|
4380
4395
|
end
|
4381
4396
|
|
4397
|
+
def on_run_cmd(_event)
|
4398
|
+
case _event
|
4399
|
+
when RunCmdStartedEvent
|
4400
|
+
debug_begin
|
4401
|
+
when RunCmdEndedEvent
|
4402
|
+
debug_reset
|
4403
|
+
debug_end
|
4404
|
+
end
|
4405
|
+
end
|
4406
|
+
|
4382
4407
|
def on_before_run_cmd(_event)
|
4383
4408
|
_filename = _event.file
|
4384
4409
|
_event.persistent = true
|
4385
|
-
if _filename.nil? || _filename == "*CURR"
|
4410
|
+
#if _filename.nil? || _filename == "*CURR"
|
4411
|
+
if _filename == "*CURR" || (_filename.nil? && _event && _event.cmd.include?('<<FILE>>'))
|
4386
4412
|
current_editor = self.raised
|
4387
4413
|
if current_editor
|
4388
4414
|
if current_editor.file
|
@@ -4433,7 +4459,7 @@ class AgMultiEditor < ArcadiaExtPlus
|
|
4433
4459
|
_event.file = Arcadia.persistent('run.file.last')
|
4434
4460
|
_event.cmd = Arcadia.persistent('run.cmd.last')
|
4435
4461
|
else
|
4436
|
-
if _event.dir.nil?
|
4462
|
+
if _event.dir.nil? && _event.file != nil
|
4437
4463
|
_event.dir = File.dirname(_event.file)
|
4438
4464
|
end
|
4439
4465
|
|
@@ -4451,8 +4477,26 @@ class AgMultiEditor < ArcadiaExtPlus
|
|
4451
4477
|
_event.cmd = _event.file
|
4452
4478
|
end
|
4453
4479
|
end
|
4454
|
-
|
4455
|
-
|
4480
|
+
while _event.cmd.include?('<<INPUT_FILE>>')
|
4481
|
+
input_file = Arcadia.select_file_dialog(MonitorLastUsedDir.get_last_dir, "<<INPUT_FILE>> = ")
|
4482
|
+
if !input_file.nil?
|
4483
|
+
_event.cmd = _event.cmd.sub('<<INPUT_FILE>>', input_file)
|
4484
|
+
end
|
4485
|
+
end
|
4486
|
+
while _event.cmd.include?('<<INPUT_DIR>>')
|
4487
|
+
input_dir = Arcadia.select_dir_dialog(MonitorLastUsedDir.get_last_dir, nil, "<<INPUT_DIR>> = ")
|
4488
|
+
if !input_dir.nil?
|
4489
|
+
_event.cmd = _event.cmd.sub('<<INPUT_DIR>>',input_dir)
|
4490
|
+
end
|
4491
|
+
end
|
4492
|
+
while _event.cmd.include?('<<INPUT_STRING>>')
|
4493
|
+
input_string = Arcadia.open_string_dialog("<<INPUT_STRING>> = ")
|
4494
|
+
if !input_string.nil?
|
4495
|
+
_event.cmd = _event.cmd.sub('<<INPUT_STRING>>', input_string)
|
4496
|
+
end
|
4497
|
+
end
|
4498
|
+
if _event.cmd.include?('<<RUBY>>')
|
4499
|
+
_event.cmd = _event.cmd.gsub('<<RUBY>>',"#{Arcadia.ruby} -r #{Dir.pwd}/lib/iosync")
|
4456
4500
|
end
|
4457
4501
|
if _event.file && _event.cmd.include?('<<FILE>>')
|
4458
4502
|
_event.cmd = _event.cmd.gsub('<<FILE>>',_event.file)
|
@@ -4943,7 +4987,7 @@ class AgMultiEditor < ArcadiaExtPlus
|
|
4943
4987
|
)
|
4944
4988
|
|
4945
4989
|
@main_frame.page_bind("Button-3",
|
4946
|
-
proc{
|
4990
|
+
proc{
|
4947
4991
|
_x = TkWinfo.pointerx(@main_frame.root_frame)
|
4948
4992
|
_y = TkWinfo.pointery(@main_frame.root_frame)
|
4949
4993
|
if @usetabs
|
@@ -5165,6 +5209,7 @@ class AgMultiEditor < ArcadiaExtPlus
|
|
5165
5209
|
end
|
5166
5210
|
if !editor_exist?(_event.file)
|
5167
5211
|
@last_transient_file = _event.file
|
5212
|
+
open_transient_button(_event.file)
|
5168
5213
|
else
|
5169
5214
|
@last_transient_file = nil
|
5170
5215
|
_event.transient = false
|
@@ -5185,7 +5230,13 @@ class AgMultiEditor < ArcadiaExtPlus
|
|
5185
5230
|
er.mark_selected(_index) if select_index
|
5186
5231
|
end
|
5187
5232
|
else
|
5188
|
-
|
5233
|
+
if _event.debug == 'yes'
|
5234
|
+
debug_reset
|
5235
|
+
r,c = _index.split('.')
|
5236
|
+
_e = self.open_file_in_debug(_event.file, r)
|
5237
|
+
else
|
5238
|
+
_e = self.open_file(_event.file, _index, select_index)
|
5239
|
+
end
|
5189
5240
|
#_e.do_line_update
|
5190
5241
|
end
|
5191
5242
|
elsif _event.text
|
@@ -5199,7 +5250,7 @@ class AgMultiEditor < ArcadiaExtPlus
|
|
5199
5250
|
#add_reverse_item(_e)
|
5200
5251
|
end
|
5201
5252
|
else
|
5202
|
-
_event.file = Arcadia.
|
5253
|
+
_event.file = Arcadia.select_file_dialog
|
5203
5254
|
self.open_file(_event.file)
|
5204
5255
|
end
|
5205
5256
|
when CloseBufferEvent
|
@@ -5255,8 +5306,48 @@ class AgMultiEditor < ArcadiaExtPlus
|
|
5255
5306
|
#close_file(_event.old_file)
|
5256
5307
|
change_file(_event.old_file, _event.new_file)
|
5257
5308
|
end
|
5309
|
+
when DeleteFileBufferEvent
|
5310
|
+
if _event.file == nil
|
5311
|
+
er = self.raised
|
5312
|
+
_event.file = er.file if er
|
5313
|
+
end
|
5314
|
+
if _event.file
|
5315
|
+
_title = Arcadia.text("ext.editor.file.d.delete.title")
|
5316
|
+
_msg = Arcadia.text("ext.editor.file.d.delete.msg", [_event.file])
|
5317
|
+
if File.exists?(_event.file) &&
|
5318
|
+
File.ftype(_event.file) == 'file' &&
|
5319
|
+
Arcadia.dialog(self,'type'=>'yes_no', 'level'=>'warning','title' => _title, 'msg'=>_msg)=='yes'
|
5320
|
+
|
5321
|
+
Arcadia.process_event(CloseBufferEvent.new(self,'file'=>_event.file))
|
5322
|
+
begin
|
5323
|
+
File.delete(_event.file)
|
5324
|
+
_event.flag = Event::FLAG_DEFAULT
|
5325
|
+
rescue RuntimeError => e
|
5326
|
+
_event.flag = Event::FLAG_ERROR
|
5327
|
+
Arcadia.runtime_error(e)
|
5328
|
+
end
|
5329
|
+
|
5330
|
+
else
|
5331
|
+
_event.flag = Event::FLAG_ERROR
|
5332
|
+
end
|
5333
|
+
end
|
5258
5334
|
end
|
5259
5335
|
end
|
5336
|
+
|
5337
|
+
def open_transient_button(_file)
|
5338
|
+
alive_check = proc{
|
5339
|
+
e = @tabs_editor[tab_name(_file)]
|
5340
|
+
@last_transient_file == _file && e && !e.modified_from_opening?
|
5341
|
+
}
|
5342
|
+
abort_action = proc{@last_transient_file=nil}
|
5343
|
+
Arcadia.process_event(SubProcessEvent.new(self,
|
5344
|
+
'abort_dialog_yes'=>false,
|
5345
|
+
# 'anigif'=>'space-invader.res',
|
5346
|
+
'anigif'=>'butterfly.res',
|
5347
|
+
'name'=>File.basename(_file),
|
5348
|
+
'abort_action'=>abort_action,
|
5349
|
+
'alive_check'=>alive_check))
|
5350
|
+
end
|
5260
5351
|
|
5261
5352
|
def get_find
|
5262
5353
|
@find
|
@@ -5613,11 +5704,10 @@ class AgMultiEditor < ArcadiaExtPlus
|
|
5613
5704
|
def change_tab_title(_tab, _new_text, _new_file=nil)
|
5614
5705
|
p_name = page_name(_tab)
|
5615
5706
|
old_text = @main_frame.page_title(p_name)
|
5616
|
-
|
5617
5707
|
if @tabs_editor[p_name] && @tabs_editor[p_name].file
|
5618
5708
|
mod_buffer_menu_item(@tabs_editor[p_name].file, _new_text, _new_file, self)
|
5619
5709
|
else
|
5620
|
-
mod_buffer_menu_item(unname_modified(tab_title_by_tab_name(p_name)), _new_text,
|
5710
|
+
mod_buffer_menu_item(unname_modified(tab_title_by_tab_name(p_name)), _new_text, _new_file, self)
|
5621
5711
|
@last_fa.refresh_layout_manager if @last_fa
|
5622
5712
|
end
|
5623
5713
|
# mod_buffer_menu_item(@main_frame.page(p_name)['file'], _new_text)
|
@@ -5693,6 +5783,7 @@ class AgMultiEditor < ArcadiaExtPlus
|
|
5693
5783
|
else
|
5694
5784
|
p "file #{_filename} do not exist !"
|
5695
5785
|
end
|
5786
|
+
_editor
|
5696
5787
|
end
|
5697
5788
|
|
5698
5789
|
def change_outline(_e, _raised=false)
|
@@ -5739,6 +5830,7 @@ class AgMultiEditor < ArcadiaExtPlus
|
|
5739
5830
|
@@statusbar_items = Hash.new
|
5740
5831
|
@@statusbar_items['file_size'] = Arcadia.new_statusbar_item("File size")
|
5741
5832
|
@@statusbar_items['file_mtime'] = Arcadia.new_statusbar_item("File modification time")
|
5833
|
+
@@statusbar_items['buffer_encoding'] = Arcadia.new_statusbar_item("Buffer encoding")
|
5742
5834
|
@@statusbar_items['file_name'] = Arcadia.new_statusbar_item("File name")
|
5743
5835
|
end
|
5744
5836
|
end
|
@@ -5746,11 +5838,12 @@ class AgMultiEditor < ArcadiaExtPlus
|
|
5746
5838
|
def reset_status
|
5747
5839
|
@@statusbar_items['file_name'].text = '?'
|
5748
5840
|
@@statusbar_items['file_mtime'].text = '?'
|
5841
|
+
@@statusbar_items['buffer_encoding'].text = '?'
|
5749
5842
|
@@statusbar_items['file_size'].text = '?'
|
5750
5843
|
end
|
5751
5844
|
|
5752
5845
|
def refresh_status
|
5753
|
-
#@statusbar_item.text("#{_title} | #{_e.
|
5846
|
+
#@statusbar_item.text("#{_title} | #{_e.buffer_info['mtime'].strftime("%d/%m/%Y %H:%m:%S") if _e}")
|
5754
5847
|
if raised && raised.file
|
5755
5848
|
size = File.size(raised.file)
|
5756
5849
|
if size > 1024
|
@@ -5759,9 +5852,10 @@ class AgMultiEditor < ArcadiaExtPlus
|
|
5759
5852
|
size_str = "#{size} b"
|
5760
5853
|
end
|
5761
5854
|
@@statusbar_items['file_name'].text(File.basename(raised.file))
|
5762
|
-
@@statusbar_items['file_mtime'].text = raised.
|
5855
|
+
@@statusbar_items['file_mtime'].text = raised.buffer_info['mtime'].localtime if raised.buffer_info['mtime']
|
5856
|
+
@@statusbar_items['buffer_encoding'].text = raised.buffer_info['encoding'] if raised.buffer_info['encoding']
|
5763
5857
|
@@statusbar_items['file_size'].text = size_str
|
5764
|
-
#@statusbar_item.text("#{File.basename(raised.file)} | #{raised.
|
5858
|
+
#@statusbar_item.text("#{File.basename(raised.file)} | #{raised.buffer_info['mtime'].localtime} | #{size_str}")
|
5765
5859
|
else
|
5766
5860
|
reset_status
|
5767
5861
|
end
|
@@ -5769,8 +5863,8 @@ class AgMultiEditor < ArcadiaExtPlus
|
|
5769
5863
|
|
5770
5864
|
def editor_of(_filename)
|
5771
5865
|
_ret = nil
|
5772
|
-
@editors.each{|e|
|
5773
|
-
if e.file == _filename || e.last_tmp_file == _filename
|
5866
|
+
@editors.each{|id, e|
|
5867
|
+
if !e.nil? && e.file == _filename || e.last_tmp_file == _filename
|
5774
5868
|
_ret = e
|
5775
5869
|
break
|
5776
5870
|
end
|
@@ -5813,8 +5907,8 @@ class AgMultiEditor < ArcadiaExtPlus
|
|
5813
5907
|
_index = @main_frame.index(resolve_tab_name(name_read_only(_name)))
|
5814
5908
|
end
|
5815
5909
|
if _index == -1
|
5816
|
-
@editors.each{|e|
|
5817
|
-
if e.last_tmp_file == _filename
|
5910
|
+
@editors.each{|id, e|
|
5911
|
+
if !e.nil? && e.last_tmp_file == _filename
|
5818
5912
|
_index = 0
|
5819
5913
|
break
|
5820
5914
|
end
|
@@ -5836,49 +5930,59 @@ class AgMultiEditor < ArcadiaExtPlus
|
|
5836
5930
|
|
5837
5931
|
def open_file(_filename = nil, _text_index='1.0', _mark_selected=true, _load_file=true)
|
5838
5932
|
return if _filename == nil || !File.exist?(_filename) || File.ftype(_filename) != 'file'
|
5839
|
-
|
5840
|
-
|
5841
|
-
|
5842
|
-
|
5843
|
-
|
5844
|
-
|
5845
|
-
|
5846
|
-
|
5847
|
-
|
5933
|
+
if defined?(@opening_file)
|
5934
|
+
while @opening_file
|
5935
|
+
sleep(1)
|
5936
|
+
end
|
5937
|
+
end
|
5938
|
+
@opening_file = true
|
5939
|
+
begin
|
5940
|
+
_basefilename = File.basename(_filename)
|
5941
|
+
_tab_name = self.tab_file_name(_filename)
|
5942
|
+
#_index = @main_frame.enb.index(_tab_name)
|
5943
|
+
#_exist_buffer = _index != -1
|
5944
|
+
_exist_buffer = @tabs_file[_tab_name] != nil
|
5945
|
+
if _exist_buffer
|
5946
|
+
open_buffer(_tab_name)
|
5947
|
+
# ??? _text_index = nil
|
5948
|
+
if !@tabs_editor[_tab_name].file_loaded
|
5949
|
+
@tabs_editor[_tab_name].reset_highlight
|
5950
|
+
begin
|
5951
|
+
@tabs_editor[_tab_name].load_file_if_not_loaded
|
5952
|
+
rescue RuntimeError => e
|
5953
|
+
close_editor(@tabs_editor[_tab_name], true)
|
5954
|
+
Arcadia.runtime_error(e)
|
5955
|
+
end
|
5956
|
+
end
|
5957
|
+
else
|
5958
|
+
# @tabs_file[_tab_name]= _filename
|
5959
|
+
open_buffer(_tab_name, _basefilename, _filename, nil, false)
|
5848
5960
|
@tabs_editor[_tab_name].reset_highlight
|
5849
5961
|
begin
|
5850
|
-
|
5962
|
+
if _load_file
|
5963
|
+
@tabs_editor[_tab_name].load_file(_filename)
|
5964
|
+
else
|
5965
|
+
@tabs_editor[_tab_name].file = _filename
|
5966
|
+
@tabs_editor[_tab_name].start_index = _text_index
|
5967
|
+
end
|
5851
5968
|
rescue RuntimeError => e
|
5969
|
+
#Arcadia.dialog(self,'type'=>'ok', 'level'=>'error','title' => 'RuntimeError', 'msg'=>"RuntimeError : #{e.message}")
|
5970
|
+
#p "RuntimeError : #{e.message}"
|
5852
5971
|
close_editor(@tabs_editor[_tab_name], true)
|
5853
5972
|
Arcadia.runtime_error(e)
|
5854
5973
|
end
|
5974
|
+
change_outline_frame_caption(File.basename(_filename)) if _filename
|
5855
5975
|
end
|
5856
|
-
|
5857
|
-
|
5858
|
-
|
5859
|
-
|
5860
|
-
|
5861
|
-
if _load_file
|
5862
|
-
@tabs_editor[_tab_name].load_file(_filename)
|
5863
|
-
else
|
5864
|
-
@tabs_editor[_tab_name].file = _filename
|
5865
|
-
@tabs_editor[_tab_name].start_index = _text_index
|
5976
|
+
editor = @tabs_editor[_tab_name]
|
5977
|
+
if editor && _load_file
|
5978
|
+
if _text_index != nil && _text_index != '1.0' && editor
|
5979
|
+
editor.text_see(_text_index)
|
5980
|
+
editor.mark_selected(_text_index) if _mark_selected
|
5866
5981
|
end
|
5867
|
-
|
5868
|
-
#Arcadia.dialog(self,'type'=>'ok', 'level'=>'error','title' => 'RuntimeError', 'msg'=>"RuntimeError : #{e.message}")
|
5869
|
-
#p "RuntimeError : #{e.message}"
|
5870
|
-
close_editor(@tabs_editor[_tab_name], true)
|
5871
|
-
Arcadia.runtime_error(e)
|
5982
|
+
editor.do_line_update if editor && !editor.highlighted?
|
5872
5983
|
end
|
5873
|
-
|
5874
|
-
|
5875
|
-
editor = @tabs_editor[_tab_name]
|
5876
|
-
if editor && _load_file
|
5877
|
-
if _text_index != nil && _text_index != '1.0' && editor
|
5878
|
-
editor.text_see(_text_index)
|
5879
|
-
editor.mark_selected(_text_index) if _mark_selected
|
5880
|
-
end
|
5881
|
-
editor.do_line_update if editor && !editor.highlighted?
|
5984
|
+
ensure
|
5985
|
+
@opening_file = false
|
5882
5986
|
end
|
5883
5987
|
return editor
|
5884
5988
|
end
|
@@ -5960,6 +6064,9 @@ class AgMultiEditor < ArcadiaExtPlus
|
|
5960
6064
|
e = @tabs_editor.delete(_buffer_name)
|
5961
6065
|
@tabs_file.delete(_buffer_name)
|
5962
6066
|
@editors.delete(e.id)
|
6067
|
+
if e.file == @last_transient_file
|
6068
|
+
@last_transient_file = nil
|
6069
|
+
end
|
5963
6070
|
@raw_buffer_name.delete_if {|key, value| value == _buffer_name}
|
5964
6071
|
end
|
5965
6072
|
|
@@ -6044,8 +6151,10 @@ class AgMultiEditor < ArcadiaExtPlus
|
|
6044
6151
|
index = _editor.text.nil?? _editor.start_index : _editor.text.index("@0,0")
|
6045
6152
|
r,c = index.split('.')
|
6046
6153
|
_editor.destroy_outline
|
6154
|
+
#_editor.destroy_text
|
6047
6155
|
change_outline_frame_caption('') if raised==_editor
|
6048
6156
|
close_buffer_frame(_editor.page_frame)
|
6157
|
+
Tk.update
|
6049
6158
|
BufferClosedEvent.new(self,'file'=>file,'row'=>r.to_i, 'col'=>c.to_i).shot!
|
6050
6159
|
else
|
6051
6160
|
return
|
@@ -6072,7 +6181,6 @@ class AgMultiEditor < ArcadiaExtPlus
|
|
6072
6181
|
@main_frame.delete_page(_name, !_moved)
|
6073
6182
|
if is_raised
|
6074
6183
|
if !@main_frame.pages.empty? # && is_raised
|
6075
|
-
#@main_frame.raise(@main_frame.pages[_index-1]) if TkWinfo.mapped?(@main_frame.root_frame)
|
6076
6184
|
len = @main_frame.pages.length
|
6077
6185
|
if _index < len
|
6078
6186
|
ind = _index
|
@@ -6082,7 +6190,6 @@ class AgMultiEditor < ArcadiaExtPlus
|
|
6082
6190
|
if TkWinfo.mapped?(@main_frame.root_frame)
|
6083
6191
|
@main_frame.raise(@main_frame.pages[ind])
|
6084
6192
|
editor = @tabs_editor[@main_frame.pages[ind]]
|
6085
|
-
#editor.load_file_if_not_loaded if editor
|
6086
6193
|
end
|
6087
6194
|
else
|
6088
6195
|
frame.root.top_text_clear if TkWinfo.mapped?(frame.hinner_frame)
|
@@ -6279,8 +6386,8 @@ class Finder < Findview
|
|
6279
6386
|
@b_replace_all.bind('1', proc{hide; do_replace_all})
|
6280
6387
|
|
6281
6388
|
# @e_what_entry.bind_append('KeyRelease'){|e|
|
6282
|
-
@e_what.bind_append('KeyRelease'){|
|
6283
|
-
case
|
6389
|
+
@e_what.bind_append('KeyRelease', "%K"){|_keysym|
|
6390
|
+
case _keysym
|
6284
6391
|
when 'Return'
|
6285
6392
|
@find_action.call
|
6286
6393
|
Tk.callback_break
|
@@ -6295,8 +6402,8 @@ class Finder < Findview
|
|
6295
6402
|
@goto_line_dialog.on_close=proc{@goto_line_dialog.hide}
|
6296
6403
|
|
6297
6404
|
@goto_line_dialog.b_go.bind('1',proc{go_line})
|
6298
|
-
@goto_line_dialog.e_line.bind_append('KeyRelease'){|
|
6299
|
-
case
|
6405
|
+
@goto_line_dialog.e_line.bind_append('KeyRelease', "%K"){|_keysym|
|
6406
|
+
case _keysym
|
6300
6407
|
when 'Return'
|
6301
6408
|
go_line
|
6302
6409
|
Tk.callback_break
|