arcadia 0.1.1 → 0.1.2
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.
- data/README +126 -123
- data/arcadia.rb +770 -756
- data/base/a-contracts.rb +130 -93
- data/base/a-ext.rb +280 -280
- data/base/a-libs.rb +5 -11
- data/base/a-utils.rb +235 -44
- data/conf/arcadia.conf +20 -16
- data/conf/arcadia.init.rb +0 -0
- data/conf/arcadia.res.rb +74 -0
- data/ext/ae-complete-code/ae-complete-code.conf +0 -0
- data/ext/ae-complete-code/ae-complete-code.rb +80 -79
- data/ext/ae-debug/ae-debug.conf +0 -0
- data/ext/ae-debug/ae-debug.rb +2 -6
- data/ext/ae-debug/debug1.57.rb +0 -0
- data/ext/ae-doc-code/ae-doc-code.conf +15 -0
- data/ext/ae-doc-code/ae-doc-code.rb +289 -0
- data/ext/ae-editor/ae-editor.conf +17 -8
- data/ext/ae-editor/ae-editor.rb +738 -396
- data/ext/ae-event-log/ae-event-log.conf +0 -0
- data/ext/ae-event-log/ae-event-log.rb +0 -0
- data/ext/ae-file-history/ae-file-history.conf +2 -2
- data/ext/ae-file-history/ae-file-history.rb +286 -290
- data/ext/ae-inspector/ae-inspector.conf +0 -0
- data/ext/ae-inspector/ae-inspector.rb +0 -0
- data/ext/ae-output-event/ae-output-event.conf +2 -2
- data/ext/ae-output/ae-output.conf +2 -2
- data/ext/ae-output/ae-output.rb +173 -178
- data/ext/ae-palette/ae-palette.conf +0 -0
- data/ext/ae-palette/ae-palette.rb +0 -0
- data/ext/ae-shell/ae-shell.conf +0 -0
- data/ext/ae-shell/ae-shell.rb +54 -54
- data/lib/tk/al-tk.rb +3076 -3082
- data/lib/tk/al-tk.res.rb +0 -0
- data/lib/tk/al-tkarcadia.rb +0 -0
- data/lib/tk/al-tkcustom.rb +0 -0
- data/lib/tkext/al-bwidget.rb +0 -0
- data/lib/tkext/al-iwidgets.rb +0 -0
- data/lib/tkext/al-tile.rb +0 -0
- data/lib/tkext/al-tktable.rb +0 -0
- data/tcl/BWidget-1.8.0/BWman/ArrowButton.html +276 -0
- data/tcl/BWidget-1.8.0/BWman/BWidget.html +228 -0
- data/tcl/BWidget-1.8.0/BWman/Button.html +273 -0
- data/tcl/BWidget-1.8.0/BWman/ButtonBox.html +264 -0
- data/tcl/BWidget-1.8.0/BWman/ComboBox.html +402 -0
- data/tcl/BWidget-1.8.0/BWman/Dialog.html +314 -0
- data/tcl/BWidget-1.8.0/BWman/DragSite.html +139 -0
- data/tcl/BWidget-1.8.0/BWman/DropSite.html +254 -0
- data/tcl/BWidget-1.8.0/BWman/DynamicHelp.html +248 -0
- data/tcl/BWidget-1.8.0/BWman/Entry.html +341 -0
- data/tcl/BWidget-1.8.0/BWman/Label.html +331 -0
- data/tcl/BWidget-1.8.0/BWman/LabelEntry.html +194 -0
- data/tcl/BWidget-1.8.0/BWman/LabelFrame.html +144 -0
- data/tcl/BWidget-1.8.0/BWman/ListBox.html +678 -0
- data/tcl/BWidget-1.8.0/BWman/MainFrame.html +283 -0
- data/tcl/BWidget-1.8.0/BWman/MessageDlg.html +218 -0
- data/tcl/BWidget-1.8.0/BWman/NoteBook.html +374 -0
- data/tcl/BWidget-1.8.0/BWman/PagesManager.html +180 -0
- data/tcl/BWidget-1.8.0/BWman/PanedWindow.html +142 -0
- data/tcl/BWidget-1.8.0/BWman/PanelFrame.html +153 -0
- data/tcl/BWidget-1.8.0/BWman/PasswdDlg.html +214 -0
- data/tcl/BWidget-1.8.0/BWman/ProgressBar.html +152 -0
- data/tcl/BWidget-1.8.0/BWman/ProgressDlg.html +145 -0
- data/tcl/BWidget-1.8.0/BWman/ScrollView.html +130 -0
- data/tcl/BWidget-1.8.0/BWman/ScrollableFrame.html +191 -0
- data/tcl/BWidget-1.8.0/BWman/ScrolledWindow.html +116 -0
- data/tcl/BWidget-1.8.0/BWman/SelectColor.html +164 -0
- data/tcl/BWidget-1.8.0/BWman/SelectFont.html +152 -0
- data/tcl/BWidget-1.8.0/BWman/Separator.html +77 -0
- data/tcl/BWidget-1.8.0/BWman/SpinBox.html +250 -0
- data/tcl/BWidget-1.8.0/BWman/StatusBar.html +147 -0
- data/tcl/BWidget-1.8.0/BWman/TitleFrame.html +107 -0
- data/tcl/BWidget-1.8.0/BWman/Tree.html +947 -0
- data/tcl/BWidget-1.8.0/BWman/Widget.html +502 -0
- data/tcl/BWidget-1.8.0/BWman/contents.html +84 -0
- data/tcl/BWidget-1.8.0/BWman/index.html +7 -0
- data/tcl/BWidget-1.8.0/BWman/navtree.html +41 -0
- data/tcl/BWidget-1.8.0/BWman/options.htm +458 -0
- data/tcl/BWidget-1.8.0/CHANGES.txt +266 -0
- data/tcl/BWidget-1.8.0/ChangeLog +1641 -0
- data/tcl/BWidget-1.8.0/LICENSE.txt +41 -0
- data/tcl/BWidget-1.8.0/README.txt +127 -0
- data/tcl/BWidget-1.8.0/arrow.tcl +551 -0
- data/tcl/BWidget-1.8.0/bitmap.tcl +94 -0
- data/tcl/BWidget-1.8.0/button.tcl +324 -0
- data/tcl/BWidget-1.8.0/buttonbox.tcl +403 -0
- data/tcl/BWidget-1.8.0/color.tcl +493 -0
- data/tcl/BWidget-1.8.0/combobox.tcl +809 -0
- data/tcl/BWidget-1.8.0/demo/basic.tcl +199 -0
- data/tcl/BWidget-1.8.0/demo/bwidget.xbm +46 -0
- data/tcl/BWidget-1.8.0/demo/demo.tcl +212 -0
- data/tcl/BWidget-1.8.0/demo/dnd.tcl +42 -0
- data/tcl/BWidget-1.8.0/demo/manager.tcl +141 -0
- data/tcl/BWidget-1.8.0/demo/select.tcl +59 -0
- data/tcl/BWidget-1.8.0/demo/tmpldlg.tcl +214 -0
- data/tcl/BWidget-1.8.0/demo/tree.tcl +260 -0
- data/tcl/BWidget-1.8.0/demo/x1.xbm +2258 -0
- data/tcl/BWidget-1.8.0/dialog.tcl +345 -0
- data/tcl/BWidget-1.8.0/dragsite.tcl +197 -0
- data/tcl/BWidget-1.8.0/dropsite.tcl +455 -0
- data/tcl/BWidget-1.8.0/dynhelp.tcl +625 -0
- data/tcl/BWidget-1.8.0/entry.tcl +469 -0
- data/tcl/BWidget-1.8.0/font.tcl +566 -0
- data/tcl/BWidget-1.8.0/images/bold.gif +0 -0
- data/tcl/BWidget-1.8.0/images/copy.gif +0 -0
- data/tcl/BWidget-1.8.0/images/cut.gif +0 -0
- data/tcl/BWidget-1.8.0/images/dragfile.gif +0 -0
- data/tcl/BWidget-1.8.0/images/dragicon.gif +0 -0
- data/tcl/BWidget-1.8.0/images/error.gif +0 -0
- data/tcl/BWidget-1.8.0/images/file.gif +0 -0
- data/tcl/BWidget-1.8.0/images/folder.gif +0 -0
- data/tcl/BWidget-1.8.0/images/hourglass.gif +0 -0
- data/tcl/BWidget-1.8.0/images/info.gif +0 -0
- data/tcl/BWidget-1.8.0/images/italic.gif +0 -0
- data/tcl/BWidget-1.8.0/images/minus.xbm +5 -0
- data/tcl/BWidget-1.8.0/images/new.gif +0 -0
- data/tcl/BWidget-1.8.0/images/opcopy.xbm +5 -0
- data/tcl/BWidget-1.8.0/images/open.gif +0 -0
- data/tcl/BWidget-1.8.0/images/openfold.gif +0 -0
- data/tcl/BWidget-1.8.0/images/oplink.xbm +5 -0
- data/tcl/BWidget-1.8.0/images/opmove.xbm +5 -0
- data/tcl/BWidget-1.8.0/images/overstrike.gif +0 -0
- data/tcl/BWidget-1.8.0/images/palette.gif +0 -0
- data/tcl/BWidget-1.8.0/images/passwd.gif +0 -0
- data/tcl/BWidget-1.8.0/images/paste.gif +0 -0
- data/tcl/BWidget-1.8.0/images/plus.xbm +5 -0
- data/tcl/BWidget-1.8.0/images/print.gif +0 -0
- data/tcl/BWidget-1.8.0/images/question.gif +0 -0
- data/tcl/BWidget-1.8.0/images/redo.gif +0 -0
- data/tcl/BWidget-1.8.0/images/save.gif +0 -0
- data/tcl/BWidget-1.8.0/images/target.xbm +9 -0
- data/tcl/BWidget-1.8.0/images/underline.gif +0 -0
- data/tcl/BWidget-1.8.0/images/undo.gif +0 -0
- data/tcl/BWidget-1.8.0/images/warning.gif +0 -0
- data/tcl/BWidget-1.8.0/init.tcl +40 -0
- data/tcl/BWidget-1.8.0/label.tcl +271 -0
- data/tcl/BWidget-1.8.0/labelentry.tcl +100 -0
- data/tcl/BWidget-1.8.0/labelframe.tcl +160 -0
- data/tcl/BWidget-1.8.0/lang/da.rc +52 -0
- data/tcl/BWidget-1.8.0/lang/de.rc +52 -0
- data/tcl/BWidget-1.8.0/lang/en.rc +52 -0
- data/tcl/BWidget-1.8.0/lang/es.rc +53 -0
- data/tcl/BWidget-1.8.0/lang/fr.rc +52 -0
- data/tcl/BWidget-1.8.0/listbox.tcl +1638 -0
- data/tcl/BWidget-1.8.0/mainframe.tcl +711 -0
- data/tcl/BWidget-1.8.0/messagedlg.tcl +128 -0
- data/tcl/BWidget-1.8.0/notebook.tcl +1164 -0
- data/tcl/BWidget-1.8.0/pagesmgr.tcl +294 -0
- data/tcl/BWidget-1.8.0/panedw.tcl +381 -0
- data/tcl/BWidget-1.8.0/panelframe.tcl +246 -0
- data/tcl/BWidget-1.8.0/passwddlg.tcl +178 -0
- data/tcl/BWidget-1.8.0/pkgIndex.tcl +47 -0
- data/tcl/BWidget-1.8.0/progressbar.tcl +208 -0
- data/tcl/BWidget-1.8.0/progressdlg.tcl +87 -0
- data/tcl/BWidget-1.8.0/scrollframe.tcl +226 -0
- data/tcl/BWidget-1.8.0/scrollview.tcl +254 -0
- data/tcl/BWidget-1.8.0/scrollw.tcl +280 -0
- data/tcl/BWidget-1.8.0/separator.tcl +75 -0
- data/tcl/BWidget-1.8.0/spinbox.tcl +331 -0
- data/tcl/BWidget-1.8.0/statusbar.tcl +422 -0
- data/tcl/BWidget-1.8.0/tests/entry.test +173 -0
- data/tcl/BWidget-1.8.0/titleframe.tcl +170 -0
- data/tcl/BWidget-1.8.0/tree.tcl +2228 -0
- data/tcl/BWidget-1.8.0/utils.tcl +645 -0
- data/tcl/BWidget-1.8.0/widget.tcl +1576 -0
- data/tcl/BWidget-1.8.0/wizard.tcl +1028 -0
- data/tcl/BWidget-1.8.0/xpm2image.tcl +115 -0
- metadata +141 -5
|
@@ -5,18 +5,19 @@ active=yes
|
|
|
5
5
|
require=ext/ae-editor/ae-editor
|
|
6
6
|
class=AgMultiEditor
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
tabs=0.5c left
|
|
9
|
+
# to use tab key set tab-replace-width-space=0
|
|
9
10
|
tab-replace-width-space=2
|
|
10
|
-
|
|
11
|
+
|
|
11
12
|
#tabs
|
|
12
|
-
tabs.font=courier
|
|
13
|
+
tabs.font=courier 12
|
|
13
14
|
i386-freebsd6::tabs.font=courier 12
|
|
14
15
|
i386-mswin32::tabs.font={Courier New} 9
|
|
15
16
|
#tabs.side=bottom
|
|
16
17
|
tabs.side=top
|
|
17
18
|
# editor
|
|
18
|
-
font=courier
|
|
19
|
-
font.bold=courier
|
|
19
|
+
font=courier 12
|
|
20
|
+
font.bold=courier 12 bold
|
|
20
21
|
i386-freebsd6::font=courier 12
|
|
21
22
|
i386-freebsd6::font.bold=courier 12 bold
|
|
22
23
|
i386-mswin32::font={Courier New} 9
|
|
@@ -56,12 +57,20 @@ hightlight.number.color.foreground=#007F7F
|
|
|
56
57
|
#hightlight.capitalize.color.foreground=#0000FF
|
|
57
58
|
hightlight.operator.color.foreground=#000000
|
|
58
59
|
hightlight.operator.style=bold
|
|
59
|
-
|
|
60
|
-
hightlight.sel.color.background=#
|
|
60
|
+
hightlight.sel.color.foreground=black
|
|
61
|
+
hightlight.sel.color.background=#68f914
|
|
61
62
|
hightlight.sel.borderwidth=1
|
|
62
63
|
hightlight.sel.relief=raised
|
|
63
64
|
#hightlight.goto.color.foreground=blue
|
|
64
65
|
hightlight.selected.color.background=yellow
|
|
66
|
+
hightlight.tabs.color.foreground=black
|
|
67
|
+
hightlight.tabs.color.background=#b1cfba
|
|
68
|
+
hightlight.tabs.borderwidth=1
|
|
69
|
+
hightlight.tabs.relief=raised
|
|
70
|
+
hightlight.spaces.color.foreground=black
|
|
71
|
+
hightlight.spaces.color.background=#d9f42b
|
|
72
|
+
hightlight.spaces.borderwidth=1
|
|
73
|
+
hightlight.spaces.relief=raised
|
|
65
74
|
#+--------------------------------------------------
|
|
66
75
|
|
|
67
76
|
|
|
@@ -76,7 +85,7 @@ line_number_panel.color.foreground=#333333
|
|
|
76
85
|
# tree explorer
|
|
77
86
|
explorer_panel.tree.color.background=#ffffff
|
|
78
87
|
explorer_panel.tree.color.foreground=white
|
|
79
|
-
explorer_panel.tree.font=courier
|
|
88
|
+
explorer_panel.tree.font=courier 12
|
|
80
89
|
i386-freebsd6::explorer_panel.tree.font=courier 12
|
|
81
90
|
i386-mswin32::explorer_panel.tree.font={Courier New} 9
|
|
82
91
|
explorer_panel.tree.class.color.foreground=#a42019
|
data/ext/ae-editor/ae-editor.rb
CHANGED
|
@@ -37,17 +37,10 @@ class AgEditor
|
|
|
37
37
|
@controller = _controller
|
|
38
38
|
@page_frame = _page_frame
|
|
39
39
|
@set_mod = false
|
|
40
|
-
# @fm = AGTkVSplittedFrames.new(@page_frame,150)
|
|
41
|
-
# @fm1 = AGTkVSplittedFrames.new(@fm.right_frame,60)
|
|
42
40
|
@font = @controller.conf('font')
|
|
43
41
|
@font_bold = @controller.conf('font.bold')
|
|
44
42
|
@font_metrics = TkFont.new(@font).metrics
|
|
45
43
|
@font_metrics_bold = TkFont.new(@font_bold).metrics
|
|
46
|
-
# initialize_text
|
|
47
|
-
# initialize_text_binding
|
|
48
|
-
# initialize_highlight
|
|
49
|
-
# initialize_line_number
|
|
50
|
-
# initialize_tree
|
|
51
44
|
@highlighting = false
|
|
52
45
|
@classbrowsing = false
|
|
53
46
|
@find = @controller.get_find
|
|
@@ -97,17 +90,38 @@ class AgEditor
|
|
|
97
90
|
selectcommand proc{ _tree_goto.call(self) }
|
|
98
91
|
place('relwidth' => 1,'relx' => 0,'x' => '0','y' => '0','relheight' => '1','rely' => 0,'height' => 1,'bordermode' => 'inside','width' => '50')
|
|
99
92
|
}
|
|
100
|
-
|
|
93
|
+
|
|
101
94
|
_c_explo = proc{|*args| @tree_exp.yview(*args)}
|
|
102
95
|
_s_explo = TkScrollbar.new(@nb_tab_exp){|s|
|
|
103
96
|
width 8
|
|
104
97
|
command _c_explo
|
|
105
98
|
}.pack('side'=>'right', 'fill'=>'y')
|
|
106
99
|
@tree_exp.yscrollcommand proc{|first,last| _s_explo.set first,last}
|
|
107
|
-
|
|
100
|
+
pop_up_menu_tree
|
|
108
101
|
end
|
|
109
102
|
|
|
110
|
-
|
|
103
|
+
def pop_up_menu_tree
|
|
104
|
+
@pop_up_tree = TkMenu.new(
|
|
105
|
+
:parent=>@tree_exp,
|
|
106
|
+
:title => 'Menu tree'
|
|
107
|
+
)
|
|
108
|
+
@pop_up_tree.insert('end',
|
|
109
|
+
:command,
|
|
110
|
+
:label=>'Rebuild',
|
|
111
|
+
:hidemargin => false,
|
|
112
|
+
:command=> proc{build_tree}
|
|
113
|
+
)
|
|
114
|
+
@tree_exp.bind_append("Button-3",
|
|
115
|
+
proc{|x,y|
|
|
116
|
+
_x = TkWinfo.pointerx(@tree_exp)
|
|
117
|
+
_y = TkWinfo.pointery(@tree_exp)
|
|
118
|
+
@pop_up_tree.popup(_x,_y)
|
|
119
|
+
},
|
|
120
|
+
"%x %y")
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
def initialize_text(_frame)
|
|
111
125
|
@v_scroll = TkScrollbar.new(_frame,
|
|
112
126
|
'orient'=>'vertical',
|
|
113
127
|
'relief'=>'flat'
|
|
@@ -125,7 +139,7 @@ class AgEditor
|
|
|
125
139
|
exportselection true
|
|
126
140
|
autoseparators true
|
|
127
141
|
padx 0
|
|
128
|
-
tabs $arcadia['conf']['editor.
|
|
142
|
+
tabs $arcadia['conf']['editor.tabs']
|
|
129
143
|
place(
|
|
130
144
|
'x'=>0,
|
|
131
145
|
'y'=>0,
|
|
@@ -142,9 +156,22 @@ class AgEditor
|
|
|
142
156
|
@text.tag_configure('debug', 'background' =>'#b9c6d9', 'borderwidth'=>1 ,'relief'=>'raise')
|
|
143
157
|
@buffer = text_value
|
|
144
158
|
pop_up_menu
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
def create_temp_file
|
|
162
|
+
_file = @file+'~~'
|
|
163
|
+
f = File.new(@file+'~~', "w")
|
|
164
|
+
begin
|
|
165
|
+
if f
|
|
166
|
+
f.syswrite(text_value)
|
|
167
|
+
end
|
|
168
|
+
ensure
|
|
169
|
+
f.close unless f.nil?
|
|
170
|
+
end
|
|
171
|
+
_file
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
def initialize_text_binding
|
|
148
175
|
@v_scroll.command(proc{|*args|
|
|
149
176
|
@text.yview *args
|
|
150
177
|
})
|
|
@@ -163,19 +190,8 @@ class AgEditor
|
|
|
163
190
|
case e.keysym
|
|
164
191
|
when 'space'
|
|
165
192
|
line, col = @text.index('insert').split('.')
|
|
166
|
-
_file =
|
|
167
|
-
|
|
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))
|
|
193
|
+
_file = create_temp_file
|
|
194
|
+
EditorContract.instance.complete_code(self, 'file'=>_file, 'line'=>line.to_s, 'col'=>col.to_s)
|
|
179
195
|
when 'z'
|
|
180
196
|
_b = @text.index('insert').split('.')[0].to_i
|
|
181
197
|
@text.edit_undo
|
|
@@ -217,6 +233,7 @@ class AgEditor
|
|
|
217
233
|
end
|
|
218
234
|
@find.use(self)
|
|
219
235
|
@find.e_what.focus
|
|
236
|
+
@find.show
|
|
220
237
|
when 'egrave'
|
|
221
238
|
@text.insert('insert',"{")
|
|
222
239
|
when 'plus'
|
|
@@ -230,18 +247,30 @@ class AgEditor
|
|
|
230
247
|
_r = @text.tag_ranges('sel')
|
|
231
248
|
_row_begin = _r[0][0].split('.')[0].to_i
|
|
232
249
|
_row_end = _r[_r.length - 1][1].split('.')[0].to_i
|
|
250
|
+
n_space = $arcadia['conf']['editor.tab-replace-width-space'].to_i
|
|
251
|
+
if n_space > 0
|
|
252
|
+
suf = "\s"*n_space
|
|
253
|
+
else
|
|
254
|
+
suf = "\t"
|
|
255
|
+
end
|
|
233
256
|
|
|
234
257
|
for _row in _row_begin..._row_end
|
|
235
|
-
@text.insert(_row.to_s+'.0',
|
|
258
|
+
@text.insert(_row.to_s+'.0',suf)
|
|
236
259
|
end
|
|
237
260
|
when 'U'
|
|
238
261
|
_r = @text.tag_ranges('sel')
|
|
239
262
|
_row_begin = _r[0][0].split('.')[0].to_i
|
|
240
263
|
_row_end = _r[_r.length - 1][1].split('.')[0].to_i
|
|
241
|
-
|
|
264
|
+
n_space = $arcadia['conf']['editor.tab-replace-width-space'].to_i
|
|
265
|
+
if n_space > 0
|
|
266
|
+
suf = "\s"*n_space
|
|
267
|
+
else
|
|
268
|
+
suf = "\t"
|
|
269
|
+
end
|
|
270
|
+
_l_suf = suf.length.to_s
|
|
242
271
|
for _row in _row_begin..._row_end
|
|
243
|
-
if @text.get(_row.to_s+'.0',_row.to_s+'.
|
|
244
|
-
@text.delete(_row.to_s+'.0',_row.to_s+'.
|
|
272
|
+
if @text.get(_row.to_s+'.0',_row.to_s+'.'+_l_suf) == suf
|
|
273
|
+
@text.delete(_row.to_s+'.0',_row.to_s+'.'+_l_suf)
|
|
245
274
|
end
|
|
246
275
|
end
|
|
247
276
|
when 'C'
|
|
@@ -260,6 +289,7 @@ class AgEditor
|
|
|
260
289
|
|
|
261
290
|
end
|
|
262
291
|
}
|
|
292
|
+
|
|
263
293
|
@text.bind("KeyPress"){|e|
|
|
264
294
|
case e.keysym
|
|
265
295
|
when 'Return'
|
|
@@ -276,12 +306,17 @@ class AgEditor
|
|
|
276
306
|
$arcadia['shell'].run(@file.to_s)
|
|
277
307
|
when 'F3'
|
|
278
308
|
@find.do_find_next
|
|
309
|
+
when 'F1'
|
|
310
|
+
line, col = @text.index('insert').split('.')
|
|
311
|
+
_file = create_temp_file
|
|
312
|
+
_x, _y = @controller.xy_insert
|
|
313
|
+
EditorContract.instance.doc_code(@controller, 'file'=>_file, 'line'=>line.to_s, 'col'=>col.to_s, 'xdoc'=>_x, 'ydoc'=>_y)
|
|
279
314
|
when 'Tab'
|
|
315
|
+
n_space = $arcadia['conf']['editor.tab-replace-width-space'].to_i
|
|
280
316
|
_r = @text.tag_ranges('sel')
|
|
281
317
|
if _r && _r[0]
|
|
282
318
|
_row_begin = _r[0][0].split('.')[0].to_i
|
|
283
319
|
_row_end = _r[_r.length - 1][1].split('.')[0].to_i
|
|
284
|
-
n_space = $arcadia['conf']['editor.tab-replace-width-space'].to_i
|
|
285
320
|
if n_space > 0
|
|
286
321
|
suf = "\s"*n_space
|
|
287
322
|
else
|
|
@@ -290,7 +325,10 @@ class AgEditor
|
|
|
290
325
|
for _row in _row_begin..._row_end
|
|
291
326
|
@text.insert(_row.to_s+'.0', suf)
|
|
292
327
|
end
|
|
293
|
-
|
|
328
|
+
break
|
|
329
|
+
elsif n_space > 0
|
|
330
|
+
@text.insert('insert', "\s"*n_space)
|
|
331
|
+
break
|
|
294
332
|
end
|
|
295
333
|
end
|
|
296
334
|
}
|
|
@@ -364,10 +402,8 @@ class AgEditor
|
|
|
364
402
|
end
|
|
365
403
|
end
|
|
366
404
|
}
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
end
|
|
370
|
-
|
|
405
|
+
end
|
|
406
|
+
|
|
371
407
|
def initialize_line_number(_frame)
|
|
372
408
|
@text_line_num = TkText.new(_frame){
|
|
373
409
|
wrap 'none'
|
|
@@ -426,7 +462,7 @@ class AgEditor
|
|
|
426
462
|
'__LINE__', 'begin', 'defined?', 'ensure', 'module', 'redo', 'super', 'until',
|
|
427
463
|
'BEGIN', 'break', 'do', 'false', 'next', 'rescue', 'then', 'when',
|
|
428
464
|
'END', 'case', 'else', 'for', 'nil', 'retry', 'true', 'while',
|
|
429
|
-
'alias', 'class', 'elsif', 'if', 'not', 'return', 'undef', 'yield','require']
|
|
465
|
+
'alias', 'class', 'elsif', 'if', 'not', 'return', 'undef', 'yield','require','include']
|
|
430
466
|
_re_string = ''
|
|
431
467
|
@keyword.each{|word|
|
|
432
468
|
if _re_string.length > 0
|
|
@@ -457,7 +493,8 @@ class AgEditor
|
|
|
457
493
|
do_tag_configure('sel')
|
|
458
494
|
do_tag_configure('selected')
|
|
459
495
|
do_tag_configure('operator')
|
|
460
|
-
|
|
496
|
+
do_tag_configure('tabs')
|
|
497
|
+
do_tag_configure('spaces')
|
|
461
498
|
end
|
|
462
499
|
|
|
463
500
|
def do_tag_configure(_name)
|
|
@@ -499,26 +536,30 @@ class AgEditor
|
|
|
499
536
|
:hidemargin => false,
|
|
500
537
|
:command=> proc{save}
|
|
501
538
|
)
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
539
|
+
|
|
540
|
+
@pop_up.insert('end',
|
|
541
|
+
:command,
|
|
542
|
+
:label=>'Close',
|
|
543
|
+
:hidemargin => false,
|
|
544
|
+
:command=> proc{@controller.close_editor(self)}
|
|
545
|
+
)
|
|
546
|
+
|
|
547
|
+
@pop_up.insert('end',
|
|
548
|
+
:command,
|
|
549
|
+
:label=>'Close others',
|
|
550
|
+
:hidemargin => false,
|
|
551
|
+
:command=> proc{@controller.close_others_editor(self)}
|
|
552
|
+
)
|
|
553
|
+
|
|
554
|
+
@pop_up.insert('end',
|
|
555
|
+
:command,
|
|
556
|
+
:label=>'Close all',
|
|
557
|
+
:hidemargin => false,
|
|
558
|
+
:command=> proc{@controller.close_all_editor(self)}
|
|
559
|
+
)
|
|
560
|
+
|
|
561
|
+
|
|
562
|
+
@pop_up.insert('end', :separator)
|
|
522
563
|
|
|
523
564
|
@pop_up.insert('end',
|
|
524
565
|
:command,
|
|
@@ -536,31 +577,55 @@ class AgEditor
|
|
|
536
577
|
@text.insert('insert', $arcadia['action.get.font'].call)
|
|
537
578
|
}
|
|
538
579
|
)
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
580
|
+
|
|
581
|
+
@pop_up.insert('end', :separator)
|
|
582
|
+
|
|
583
|
+
@pop_up.insert('end',
|
|
584
|
+
:command,
|
|
585
|
+
:label=>'Show tabs',
|
|
586
|
+
:hidemargin => false,
|
|
587
|
+
:command=> proc{show_tabs}
|
|
588
|
+
)
|
|
589
|
+
|
|
590
|
+
|
|
591
|
+
@pop_up.insert('end',
|
|
592
|
+
:command,
|
|
593
|
+
:label=>'Hide tabs',
|
|
594
|
+
:hidemargin => false,
|
|
595
|
+
:command=> proc{hide_tabs}
|
|
596
|
+
)
|
|
597
|
+
|
|
598
|
+
@pop_up.insert('end',
|
|
599
|
+
:command,
|
|
600
|
+
:label=>'Show spaces',
|
|
601
|
+
:hidemargin => false,
|
|
602
|
+
:command=> proc{show_spaces}
|
|
603
|
+
)
|
|
604
|
+
|
|
605
|
+
|
|
606
|
+
@pop_up.insert('end',
|
|
607
|
+
:command,
|
|
608
|
+
:label=>'Hide spaces',
|
|
609
|
+
:hidemargin => false,
|
|
610
|
+
:command=> proc{hide_spaces}
|
|
611
|
+
)
|
|
612
|
+
|
|
613
|
+
|
|
614
|
+
@pop_up.insert('end',
|
|
615
|
+
:command,
|
|
616
|
+
:label=>'Space to tabs indentation',
|
|
617
|
+
:hidemargin => false,
|
|
618
|
+
:command=> proc{indentation_space_2_tabs}
|
|
619
|
+
)
|
|
620
|
+
|
|
621
|
+
@pop_up.insert('end',
|
|
622
|
+
:command,
|
|
623
|
+
:label=>'Tabs to space indentation',
|
|
624
|
+
:hidemargin => false,
|
|
625
|
+
:command=> proc{indentation_tabs_2_space}
|
|
626
|
+
)
|
|
627
|
+
|
|
628
|
+
|
|
564
629
|
@text.bind("Button-3",
|
|
565
630
|
proc{|x,y|
|
|
566
631
|
_x = TkWinfo.pointerx(@text)
|
|
@@ -646,7 +711,6 @@ class AgEditor
|
|
|
646
711
|
# _row = _row +1
|
|
647
712
|
end
|
|
648
713
|
|
|
649
|
-
@nodes << _row.to_s
|
|
650
714
|
TreeNode.new(_parent, _kind){|_node|
|
|
651
715
|
_node.label = _label
|
|
652
716
|
_node.helptext = _helptext
|
|
@@ -669,38 +733,31 @@ class AgEditor
|
|
|
669
733
|
end
|
|
670
734
|
|
|
671
735
|
def build_tree_from_node(_node, _label_match=nil)
|
|
736
|
+
|
|
737
|
+
@image_kclass = TkPhotoImage.new('dat' => TREE_NODE_CLASS_GIF)
|
|
738
|
+
@image_kmodule = TkPhotoImage.new('dat' => TREE_NODE_MODULE_GIF)
|
|
739
|
+
@image_kdef = TkPhotoImage.new('dat' => TREE_NODE_DEF_GIF)
|
|
740
|
+
@image_kdefclass = TkPhotoImage.new('dat' => TREE_NODE_DEFCLASS_GIF)
|
|
741
|
+
|
|
672
742
|
_sorted_sons = _node.sons.sort
|
|
673
743
|
for inode in 0.._sorted_sons.length - 1
|
|
674
744
|
_son = _sorted_sons[inode]
|
|
675
745
|
if _son.kind == 'KClass'
|
|
676
|
-
|
|
677
|
-
image TkPhotoImage.new('dat' => TREE_NODE_CLASS_GIF)
|
|
678
|
-
background($arcadia['conf']['editor.explorer_panel.tree.color.background'])
|
|
679
|
-
}
|
|
746
|
+
_image = @image_kclass
|
|
680
747
|
elsif _son.kind == 'KModule'
|
|
681
|
-
|
|
682
|
-
image TkPhotoImage.new('dat' => TREE_NODE_MODULE_GIF)
|
|
683
|
-
background($arcadia['conf']['editor.explorer_panel.tree.color.background'])
|
|
684
|
-
}
|
|
748
|
+
_image = @image_kmodule
|
|
685
749
|
elsif _son.kind == 'KDef'
|
|
686
|
-
|
|
687
|
-
image TkPhotoImage.new('dat' => TREE_NODE_DEF_GIF)
|
|
688
|
-
background($arcadia['conf']['editor.explorer_panel.tree.color.background'])
|
|
689
|
-
}
|
|
750
|
+
_image = @image_kdef
|
|
690
751
|
elsif _son.kind == 'KDefClass'
|
|
691
|
-
|
|
692
|
-
image TkPhotoImage.new('dat' => TREE_NODE_DEFCLASS_GIF)
|
|
693
|
-
background($arcadia['conf']['editor.explorer_panel.tree.color.background'])
|
|
694
|
-
}
|
|
752
|
+
_image = @image_kdefclass
|
|
695
753
|
end
|
|
696
754
|
@tree_exp.insert('end', _son.parent.rif ,_son.rif, {
|
|
697
755
|
'text' => _son.label ,
|
|
698
756
|
'helptext' => _son.helptext,
|
|
699
757
|
'font'=>$arcadia['conf']['editor.explorer_panel.tree.font'],
|
|
700
|
-
'
|
|
758
|
+
'image'=> _image
|
|
701
759
|
}
|
|
702
760
|
)
|
|
703
|
-
@nodes << _son.rif
|
|
704
761
|
if (_label_match) && (_label_match.strip == _son.label.strip)
|
|
705
762
|
@selected = _son
|
|
706
763
|
end
|
|
@@ -712,9 +769,16 @@ class AgEditor
|
|
|
712
769
|
if _sel
|
|
713
770
|
_label_sel = @tree_exp.itemcget(_sel,'text')
|
|
714
771
|
end
|
|
772
|
+
|
|
715
773
|
#clear tree
|
|
716
|
-
|
|
717
|
-
|
|
774
|
+
begin
|
|
775
|
+
@tree_exp.delete(@tree_exp.nodes('root'))
|
|
776
|
+
rescue Exception
|
|
777
|
+
# workaround on windows
|
|
778
|
+
@tree_exp.delete(@tree_exp.nodes('root'))
|
|
779
|
+
end
|
|
780
|
+
|
|
781
|
+
|
|
718
782
|
#(re)build tree
|
|
719
783
|
_txt = @text.get('1.0','end')
|
|
720
784
|
@root = build_tree_from_source(_txt)
|
|
@@ -722,6 +786,8 @@ class AgEditor
|
|
|
722
786
|
build_tree_from_node(@root, _label_sel)
|
|
723
787
|
if @selected
|
|
724
788
|
@tree_exp.selection_add(@selected.rif)
|
|
789
|
+
@tree_exp.open_tree(@selected.parent.rif)
|
|
790
|
+
@tree_exp.see(@selected.rif)
|
|
725
791
|
end
|
|
726
792
|
end
|
|
727
793
|
|
|
@@ -791,16 +857,98 @@ class AgEditor
|
|
|
791
857
|
end
|
|
792
858
|
end
|
|
793
859
|
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
860
|
+
def show_spaces
|
|
861
|
+
@spaces_show = true
|
|
862
|
+
_row = 1
|
|
863
|
+
@text.value.each{|_line|
|
|
864
|
+
show_chars_line(_row, _line, /[ ^\t]\s*/, 'spaces')
|
|
865
|
+
_row = _row+1
|
|
866
|
+
}
|
|
867
|
+
end
|
|
868
|
+
|
|
869
|
+
|
|
870
|
+
def show_tabs
|
|
871
|
+
@tabs_show = true
|
|
872
|
+
_row = 1
|
|
873
|
+
@text.value.each{|_line|
|
|
874
|
+
show_chars_line(_row, _line, /\t/, 'tabs')
|
|
875
|
+
_row = _row+1
|
|
876
|
+
}
|
|
877
|
+
end
|
|
878
|
+
|
|
879
|
+
|
|
880
|
+
def show_chars_line(_row, _line, _re, _tag)
|
|
881
|
+
m = _re.match(_line)
|
|
882
|
+
_end = 0
|
|
883
|
+
while m
|
|
884
|
+
_txt = m.post_match
|
|
885
|
+
_ibegin = _row.to_s+'.'+(m.begin(0)+_end).to_s
|
|
886
|
+
_end = m.end(0) + _end
|
|
887
|
+
_iend = _row.to_s+'.'+(_end.to_s)
|
|
888
|
+
@text.tag_add(_tag,_ibegin, _iend)
|
|
889
|
+
m = _re.match(_txt)
|
|
890
|
+
end
|
|
891
|
+
end
|
|
892
|
+
|
|
893
|
+
def indentation_space_2_tabs(_n_space=2)
|
|
894
|
+
_row = 1
|
|
895
|
+
@text.value.each{|_line|
|
|
896
|
+
m = /\s*/.match(_line)
|
|
897
|
+
_end = 0
|
|
898
|
+
if m && m.begin(0)==0
|
|
899
|
+
_s = m[0]
|
|
900
|
+
if !_s.include?("\n") && !_s.include?("\t")
|
|
901
|
+
_ibegin = _row.to_s+'.0'
|
|
902
|
+
_iend = _row.to_s+'.'+m.end(0).to_s
|
|
903
|
+
_n_tab = (_s.length / _n_space).round
|
|
904
|
+
@text.delete(_ibegin, _iend)
|
|
905
|
+
@text.insert(_ibegin,"\t"*_n_tab )
|
|
906
|
+
end
|
|
907
|
+
end
|
|
908
|
+
_row = _row+1
|
|
909
|
+
}
|
|
910
|
+
if modified?
|
|
911
|
+
set_modify
|
|
912
|
+
else
|
|
913
|
+
reset_modify
|
|
914
|
+
end
|
|
915
|
+
|
|
916
|
+
end
|
|
917
|
+
|
|
918
|
+
def indentation_tabs_2_space(_n_space=2)
|
|
919
|
+
_row = 1
|
|
920
|
+
@text.value.each{|_line|
|
|
921
|
+
m = /\t*/.match(_line)
|
|
922
|
+
_end = 0
|
|
923
|
+
if m && m.begin(0)==0
|
|
924
|
+
_s = m[0]
|
|
925
|
+
if !_s.include?("\n")
|
|
926
|
+
_ibegin = _row.to_s+'.0'
|
|
927
|
+
_iend = _row.to_s+'.'+m.end(0).to_s
|
|
928
|
+
@text.delete(_ibegin, _iend)
|
|
929
|
+
@text.insert(_ibegin,"\s"*_s.length*_n_space )
|
|
930
|
+
end
|
|
931
|
+
end
|
|
932
|
+
_row = _row+1
|
|
933
|
+
}
|
|
934
|
+
if modified?
|
|
935
|
+
set_modify
|
|
936
|
+
else
|
|
937
|
+
reset_modify
|
|
938
|
+
end
|
|
939
|
+
end
|
|
940
|
+
|
|
941
|
+
|
|
942
|
+
def hide_tabs
|
|
943
|
+
@text.tag_remove('tabs','1.0', 'end')
|
|
944
|
+
@tabs_show = false
|
|
945
|
+
end
|
|
946
|
+
|
|
947
|
+
def hide_spaces
|
|
948
|
+
@text.tag_remove('spaces','1.0', 'end')
|
|
949
|
+
@spaces_show = false
|
|
950
|
+
end
|
|
951
|
+
|
|
804
952
|
|
|
805
953
|
def modified?
|
|
806
954
|
return !(@buffer === text_value)
|
|
@@ -852,6 +1000,8 @@ class AgEditor
|
|
|
852
1000
|
arem << 'operator'
|
|
853
1001
|
find_and_set_tag(@re_string, _row, _txt, 'string', arem)
|
|
854
1002
|
end
|
|
1003
|
+
find_and_set_tag(/\t/, _row, _txt, 'tabs', arem) if @tabs_show
|
|
1004
|
+
find_and_set_tag(/[ ^\t]\s*/, _row, _txt, 'spaces', arem) if @spaces_show
|
|
855
1005
|
end
|
|
856
1006
|
|
|
857
1007
|
def rehighlightline(_row)
|
|
@@ -979,60 +1129,69 @@ class AgEditor
|
|
|
979
1129
|
ensure
|
|
980
1130
|
f.close unless f.nil?
|
|
981
1131
|
end
|
|
1132
|
+
EditorContract.instance.file_saved(self,'file' =>@file)
|
|
982
1133
|
end
|
|
983
1134
|
end
|
|
984
1135
|
|
|
985
1136
|
def save_as
|
|
986
|
-
@file = Tk.getSaveFile
|
|
1137
|
+
@file = Tk.getSaveFile("filetypes"=>[["Ruby Files", [".rb", ".rbw"]]])
|
|
1138
|
+
@file = nil if @file == "" # cancelled
|
|
987
1139
|
if @file
|
|
988
1140
|
save
|
|
989
1141
|
@controller.change_file_name(@page_frame, @file)
|
|
1142
|
+
EditorContract.instance.file_created(self, 'file'=>@file)
|
|
990
1143
|
end
|
|
991
1144
|
end
|
|
992
1145
|
|
|
993
1146
|
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1147
|
+
def check_file_last_access_time
|
|
1148
|
+
if @file && @file_last_access_time
|
|
1149
|
+
|
|
1150
|
+
ftime = File.mtime(@file)
|
|
1151
|
+
if @file_last_access_time != ftime
|
|
1152
|
+
msg = 'File "'+@file+'" is changed! Reload?'
|
|
1000
1153
|
if Tk.messageBox('icon' => 'error', 'type' => 'yesno',
|
|
1001
1154
|
'title' => '(Arcadia) Libs', 'parent' => @text,
|
|
1002
1155
|
'message' => msg) == 'yes'
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1156
|
+
@text.delete('1.0','end')
|
|
1157
|
+
load_file(@file)
|
|
1158
|
+
else
|
|
1159
|
+
@file_last_access_time = ftime
|
|
1007
1160
|
end
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1161
|
+
end
|
|
1162
|
+
end
|
|
1163
|
+
end
|
|
1164
|
+
|
|
1165
|
+
def init_editing(_ext='rb')
|
|
1166
|
+
case _ext
|
|
1167
|
+
when 'rb'
|
|
1168
|
+
@fm = AGTkVSplittedFrames.new(@page_frame,150)
|
|
1169
|
+
@fm1 = AGTkVSplittedFrames.new(@fm.right_frame,60)
|
|
1017
1170
|
initialize_text(@fm1.right_frame)
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1171
|
+
initialize_text_binding
|
|
1172
|
+
initialize_highlight
|
|
1173
|
+
initialize_line_number(@fm1.left_frame)
|
|
1174
|
+
initialize_tree(@fm.left_frame)
|
|
1175
|
+
when nil
|
|
1176
|
+
@fm1 = AGTkVSplittedFrames.new(@page_frame,60)
|
|
1024
1177
|
initialize_text(@fm1.right_frame)
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1178
|
+
initialize_text_binding
|
|
1179
|
+
initialize_highlight
|
|
1180
|
+
initialize_line_number(@fm1.left_frame)
|
|
1181
|
+
else
|
|
1182
|
+
@fm1 = AGTkVSplittedFrames.new(@page_frame,60)
|
|
1183
|
+
initialize_text(@fm1.right_frame)
|
|
1184
|
+
initialize_text_binding
|
|
1185
|
+
initialize_line_number(@fm1.left_frame)
|
|
1186
|
+
end
|
|
1187
|
+
end
|
|
1188
|
+
|
|
1189
|
+
def file_extension(_filename=nil)
|
|
1190
|
+
if _filename
|
|
1191
|
+
_m = /(.*\.)(.*$)/.match(File.basename(_filename))
|
|
1192
|
+
end
|
|
1193
|
+
_ret = (_m && _m.length > 1)?_m[2]: nil
|
|
1194
|
+
end
|
|
1036
1195
|
|
|
1037
1196
|
def load_file(_filename = nil)
|
|
1038
1197
|
#if filename is nil then open a new tab
|
|
@@ -1078,21 +1237,22 @@ end
|
|
|
1078
1237
|
|
|
1079
1238
|
class AgMultiEditor < ArcadiaExt
|
|
1080
1239
|
attr_reader :breakpoints
|
|
1081
|
-
|
|
1082
|
-
|
|
1240
|
+
attr_reader :splitted_frame
|
|
1241
|
+
def before_build
|
|
1083
1242
|
ArcadiaContractListener.new(self, DebugContract, :do_debug_event)
|
|
1084
1243
|
ArcadiaContractListener.new(self, EditorContract, :do_editor_event)
|
|
1085
1244
|
ArcadiaContractListener.new(self, MainContract, :do_main_event)
|
|
1086
|
-
|
|
1245
|
+
end
|
|
1087
1246
|
|
|
1088
1247
|
def build
|
|
1089
1248
|
if @arcadia.layout.headed?
|
|
1090
|
-
|
|
1249
|
+
title_frame = @arcadia.layout.domain(conf('frame'))['root']
|
|
1091
1250
|
#@close_button = title_frame.add_button(nil,nil,TAB_CLOSE_GIF,'left')
|
|
1092
1251
|
end
|
|
1093
1252
|
|
|
1094
|
-
|
|
1095
|
-
|
|
1253
|
+
#@splitted_frame = AGTkOSplittedFrames.new(self.frame,20)
|
|
1254
|
+
#@main_frame = AgMultiEditorView.new(@splitted_frame.bottom_frame)
|
|
1255
|
+
@main_frame = AgMultiEditorView.new(self.frame)
|
|
1096
1256
|
#@close_button.bind('1',proc{close_raised})
|
|
1097
1257
|
@tabs_file =Hash.new
|
|
1098
1258
|
@tabs_editor =Hash.new
|
|
@@ -1101,9 +1261,9 @@ class AgMultiEditor < ArcadiaExt
|
|
|
1101
1261
|
pop_up_menu
|
|
1102
1262
|
end
|
|
1103
1263
|
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1264
|
+
def after_build
|
|
1265
|
+
self.open_last_files
|
|
1266
|
+
end
|
|
1107
1267
|
|
|
1108
1268
|
def pop_up_menu
|
|
1109
1269
|
@pop_up = TkMenu.new(
|
|
@@ -1115,33 +1275,47 @@ class AgMultiEditor < ArcadiaExt
|
|
|
1115
1275
|
:command,
|
|
1116
1276
|
:label=>'...',
|
|
1117
1277
|
:state=>'disabled',
|
|
1118
|
-
:background=>'
|
|
1119
|
-
:
|
|
1278
|
+
:background=>'blue',
|
|
1279
|
+
:font => conf('font.bold'),
|
|
1120
1280
|
:hidemargin => true
|
|
1121
1281
|
)
|
|
1122
1282
|
@c = @pop_up.insert('end',
|
|
1123
1283
|
:command,
|
|
1124
1284
|
:label=>'Close',
|
|
1285
|
+
:font => conf('font'),
|
|
1125
1286
|
:hidemargin => false,
|
|
1126
1287
|
:command=> proc{
|
|
1127
1288
|
if @selected_tab_name_from_popup != nil
|
|
1128
|
-
|
|
1129
|
-
|
|
1289
|
+
_e = @tabs_editor[@selected_tab_name_from_popup]
|
|
1290
|
+
self.close_editor(_e)
|
|
1130
1291
|
end
|
|
1131
1292
|
}
|
|
1132
1293
|
)
|
|
1133
1294
|
@c = @pop_up.insert('end',
|
|
1134
1295
|
:command,
|
|
1135
1296
|
:label=>'Close others',
|
|
1297
|
+
:font => conf('font'),
|
|
1136
1298
|
:hidemargin => false,
|
|
1137
1299
|
:command=> proc{
|
|
1138
1300
|
if @selected_tab_name_from_popup != nil
|
|
1139
|
-
|
|
1140
|
-
|
|
1301
|
+
_e = @tabs_editor[@selected_tab_name_from_popup]
|
|
1302
|
+
self.close_others_editor(_e)
|
|
1141
1303
|
end
|
|
1142
1304
|
}
|
|
1143
1305
|
)
|
|
1144
|
-
|
|
1306
|
+
@c = @pop_up.insert('end',
|
|
1307
|
+
:command,
|
|
1308
|
+
:label=>'Close all',
|
|
1309
|
+
:font => conf('font'),
|
|
1310
|
+
:hidemargin => false,
|
|
1311
|
+
:command=> proc{
|
|
1312
|
+
if @selected_tab_name_from_popup != nil
|
|
1313
|
+
_e = @tabs_editor[@selected_tab_name_from_popup]
|
|
1314
|
+
self.close_all_editor(_e)
|
|
1315
|
+
end
|
|
1316
|
+
}
|
|
1317
|
+
)
|
|
1318
|
+
|
|
1145
1319
|
@main_frame.enb.tabbind("Button-3",
|
|
1146
1320
|
proc{|*x|
|
|
1147
1321
|
_x = TkWinfo.pointerx(@main_frame.enb)
|
|
@@ -1153,39 +1327,60 @@ class AgMultiEditor < ArcadiaExt
|
|
|
1153
1327
|
_index = @main_frame.enb.index(@selected_tab_name_from_popup)
|
|
1154
1328
|
end
|
|
1155
1329
|
if _index != -1
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1330
|
+
_file = @main_frame.enb.itemcget(@selected_tab_name_from_popup, 'text')
|
|
1331
|
+
@pop_up.entryconfigure(0, 'label'=>_file)
|
|
1332
|
+
@pop_up.popup(_x,_y)
|
|
1159
1333
|
end
|
|
1160
1334
|
})
|
|
1161
1335
|
end
|
|
1162
1336
|
|
|
1163
1337
|
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1338
|
+
def do_debug_event(_event)
|
|
1339
|
+
#@arcadia.outln('_sender ----> '+_sender.to_s)
|
|
1340
|
+
#@arcadia.outln('_event.signature ----> '+_event.signature)
|
|
1341
|
+
case _event.signature
|
|
1342
|
+
when DebugContract::DEBUG_BEGIN
|
|
1343
|
+
self.debug_begin
|
|
1344
|
+
when DebugContract::DEBUG_END
|
|
1345
|
+
self.debug_end
|
|
1346
|
+
when DebugContract::DEBUG_STEP
|
|
1347
|
+
if _event.context.file
|
|
1348
|
+
self.open_file_in_debug(_event.context.file, _event.context.line)
|
|
1349
|
+
end
|
|
1350
|
+
end
|
|
1351
|
+
end
|
|
1352
|
+
|
|
1353
|
+
def do_editor_event(_event)
|
|
1354
|
+
case _event.signature
|
|
1355
|
+
when EditorContract::OPEN_FILE
|
|
1356
|
+
if _event.context.file
|
|
1357
|
+
if _event.context.line
|
|
1358
|
+
_index = _event.context.line.to_s+'.0'
|
|
1359
|
+
end
|
|
1360
|
+
self.open_file(_event.context.file, _index)
|
|
1361
|
+
_event.handled(self)
|
|
1362
|
+
end
|
|
1363
|
+
when EditorContract::CLOSE_FILE
|
|
1364
|
+
if _event.context.file
|
|
1365
|
+
self.close_file(_event.context.file)
|
|
1366
|
+
_event.handled(self)
|
|
1367
|
+
end
|
|
1368
|
+
when EditorContract::SAVE_FILE_RAISED
|
|
1369
|
+
self.raised.save
|
|
1370
|
+
_event.handled(self)
|
|
1371
|
+
when EditorContract::SAVE_FILE
|
|
1372
|
+
if _event.context.file
|
|
1373
|
+
self.save_file(_event.context.file)
|
|
1374
|
+
_event.handled(self)
|
|
1375
|
+
end
|
|
1376
|
+
when EditorContract::SAVE_AS_FILE_RAISED
|
|
1377
|
+
self.raised.save_as
|
|
1378
|
+
_event.handled(self)
|
|
1379
|
+
when EditorContract::SAVE_AS_FILE
|
|
1380
|
+
if _event.context.file
|
|
1381
|
+
self.save_as_file(_event.context.file)
|
|
1382
|
+
_event.handled(self)
|
|
1383
|
+
end
|
|
1189
1384
|
when EditorContract::OPEN_TEXT
|
|
1190
1385
|
if _event.context.title
|
|
1191
1386
|
_tab_name = self.tab_name(_event.context.title)
|
|
@@ -1197,126 +1392,129 @@ class AgMultiEditor < ArcadiaExt
|
|
|
1197
1392
|
add_reverse_item(_e)
|
|
1198
1393
|
_event.handled(self)
|
|
1199
1394
|
end
|
|
1200
|
-
when EditorContract::
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1395
|
+
when EditorContract::SHOW_SEARCH_DIALOG
|
|
1396
|
+
@find.show
|
|
1397
|
+
when EditorContract::SHOW_GOTO_LINE_DIALOG
|
|
1398
|
+
@find.show_go_to_line_dialog
|
|
1399
|
+
end
|
|
1400
|
+
end
|
|
1401
|
+
|
|
1402
|
+
def xy_insert
|
|
1403
|
+
_text = self.raised.text
|
|
1404
|
+
_index_now = _text.index('insert')
|
|
1405
|
+
_rx, _ry, _widht, _heigth = _text.bbox(_index_now);
|
|
1406
|
+
_x = _rx + TkWinfo.rootx(_text)
|
|
1407
|
+
_y = _ry + TkWinfo.rooty(_text) + TkFont.new(conf('font')).metrics[2][1]
|
|
1408
|
+
_xroot = _x - TkWinfo.rootx(@arcadia.layout.root)
|
|
1409
|
+
_yroot = _y - TkWinfo.rooty(@arcadia.layout.root)
|
|
1410
|
+
return _xroot, _yroot
|
|
1411
|
+
end
|
|
1412
|
+
|
|
1413
|
+
|
|
1414
|
+
|
|
1415
|
+
def raise_complete_code(_context)
|
|
1416
|
+
# delete the file used for completion
|
|
1417
|
+
if File.exist?(_context.file) && _context.file.include?('~~')
|
|
1418
|
+
File.delete(_context.file)
|
|
1419
|
+
end
|
|
1420
|
+
@raised_listbox.destroy if @raised_listbox != nil
|
|
1421
|
+
|
|
1422
|
+
_text = self.raised.text
|
|
1423
|
+
_index_call = _context.line+'.'+_context.col
|
|
1424
|
+
_index_now = _text.index('insert')
|
|
1425
|
+
if _index_call == _index_now
|
|
1426
|
+
_target = _text.get('insert - 1 chars wordstart','insert')
|
|
1427
|
+
if _target.length > 0 && _target != '.'
|
|
1428
|
+
extra_len = _target.length.+@
|
|
1429
|
+
_begin_index = _index_now<<' - '<<extra_len.to_s<<' chars'
|
|
1430
|
+
_text.tag_add('sel', _begin_index, _index_now)
|
|
1431
|
+
else
|
|
1432
|
+
_begin_index = _index_now
|
|
1433
|
+
extra_len = 0
|
|
1434
|
+
end
|
|
1435
|
+
if _context.candidates.length > 1
|
|
1436
|
+
_rx, _ry, _widht, heigth = _text.bbox(_begin_index);
|
|
1437
|
+
_x = _rx + TkWinfo.rootx(_text)
|
|
1438
|
+
_y = _ry + TkWinfo.rooty(_text) + TkFont.new(conf('font')).metrics[2][1]
|
|
1439
|
+
|
|
1440
|
+
_xroot = _x - TkWinfo.rootx(@arcadia.layout.root)
|
|
1441
|
+
_yroot = _y - TkWinfo.rooty(@arcadia.layout.root)
|
|
1442
|
+
|
|
1443
|
+
_max_height = TkWinfo.screenheight(@arcadia.layout.root) - _y - 5
|
|
1444
|
+
|
|
1445
|
+
@raised_listbox = TkListbox.new(@arcadia.layout.root,
|
|
1446
|
+
'takefocus'=>true,
|
|
1447
|
+
:background=>conf('color.background'),
|
|
1448
|
+
:foreground=>conf('color.foreground'),
|
|
1449
|
+
:selectbackground=>'yellow',
|
|
1450
|
+
:selectforeground=>'red',
|
|
1451
|
+
:activestyle=>'none',
|
|
1452
|
+
:font => conf('font'),
|
|
1453
|
+
:borderwidth=>1
|
|
1454
|
+
)
|
|
1455
|
+
_font = TkFont.new(conf('font'))
|
|
1456
|
+
_char_height = _font.metrics[2][1]
|
|
1457
|
+
_width = 0
|
|
1458
|
+
_docs_entries = Hash.new
|
|
1459
|
+
_context.candidates.each{|value|
|
|
1460
|
+
_key, _doc = value.split
|
|
1461
|
+
_docs_entries[_key]= _doc
|
|
1462
|
+
@raised_listbox.insert('end', _key)
|
|
1463
|
+
_temp_width = _font.measure(_key) + _font.measure('X')
|
|
1464
|
+
_width = _temp_width if _temp_width > _width
|
|
1465
|
+
}
|
|
1466
|
+
_height = (_context.candidates.length+1)*_char_height
|
|
1467
|
+
_height = _max_height if _height > _max_height
|
|
1468
|
+
@raised_listbox.place('x'=>_xroot,'y'=>_yroot, 'width'=>_width, 'height'=>_height)
|
|
1469
|
+
|
|
1470
|
+
@raised_listbox.focus
|
|
1471
|
+
@raised_listbox.bind_append('KeyPress'){|e|
|
|
1472
|
+
case e.keysym
|
|
1473
|
+
when 'Escape'
|
|
1474
|
+
@raised_listbox.destroy
|
|
1475
|
+
#_menu.destroy
|
|
1476
|
+
Tk.callback_break
|
|
1477
|
+
when 'Return'
|
|
1478
|
+
_value = @raised_listbox.get('active')
|
|
1479
|
+
_text.delete(_begin_index,'insert')
|
|
1480
|
+
_text.insert('insert',_value)
|
|
1481
|
+
@raised_listbox.destroy
|
|
1482
|
+
#_menu.destroy
|
|
1483
|
+
Tk.callback_break
|
|
1484
|
+
when 'F1'
|
|
1485
|
+
_key = @raised_listbox.get('active')
|
|
1486
|
+
_x, _y = xy_insert
|
|
1487
|
+
EditorContract.instance.doc_code(self, 'doc_entry'=>_docs_entries[_key], 'xdoc'=>_x, 'ydoc'=>_y)
|
|
1488
|
+
end
|
|
1489
|
+
}
|
|
1490
|
+
elsif _context.candidates.length == 1 && _context.candidates[0].length>0
|
|
1491
|
+
_text.delete(_begin_index,'insert');
|
|
1492
|
+
_text.insert('insert',_context.candidates[0].split[0])
|
|
1493
|
+
end
|
|
1494
|
+
end
|
|
1495
|
+
end
|
|
1496
|
+
|
|
1497
|
+
def do_main_event(_event)
|
|
1498
|
+
case _event.signature
|
|
1210
1499
|
when MainContract::EVENT_HANDLED
|
|
1211
1500
|
_cause = _event.context.caused_by
|
|
1212
1501
|
if _cause.signature == EditorContract::COMPLETE_CODE &&
|
|
1213
1502
|
_cause.context.sender == self.raised
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
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
|
|
1503
|
+
raise_complete_code(_cause.context)
|
|
1504
|
+
elsif _cause.signature == EditorContract::DOC_CODE && _cause.context.file != nil
|
|
1505
|
+
# delete the file used for completion
|
|
1506
|
+
if File.exist?(_cause.context.file) && _cause.context.file.include?('~~')
|
|
1507
|
+
File.delete(_cause.context.file)
|
|
1508
|
+
end
|
|
1509
|
+
end
|
|
1510
|
+
end
|
|
1511
|
+
end
|
|
1314
1512
|
|
|
1315
1513
|
def add_reverse_item(_editor)
|
|
1316
1514
|
code2form = proc{
|
|
1317
1515
|
Revparsel.new(_editor.text_value)
|
|
1318
1516
|
self.close_editor(_editor, false)
|
|
1319
|
-
InspectorContract.instance.raise_last_widget(
|
|
1517
|
+
InspectorContract.instance.raise_last_widget(self)
|
|
1320
1518
|
}
|
|
1321
1519
|
_editor.insert_popup_menu_item('end',
|
|
1322
1520
|
:command,
|
|
@@ -1326,7 +1524,7 @@ class AgMultiEditor < ArcadiaExt
|
|
|
1326
1524
|
)
|
|
1327
1525
|
|
|
1328
1526
|
end
|
|
1329
|
-
|
|
1527
|
+
|
|
1330
1528
|
# def editor_state
|
|
1331
1529
|
# r = EditorContract::SObj.new
|
|
1332
1530
|
# r.raised_file = self.raised.file
|
|
@@ -1340,7 +1538,10 @@ class AgMultiEditor < ArcadiaExt
|
|
|
1340
1538
|
|
|
1341
1539
|
def create_find
|
|
1342
1540
|
#find_frame = @arcadia.layout.register_panel(conf('find.frame'),'Find', 'Find')
|
|
1343
|
-
@find = Find.new(@splitted_frame.top_frame, self)
|
|
1541
|
+
# @find = Find.new(@splitted_frame.top_frame, self)
|
|
1542
|
+
@find = Find.new(@arcadia.layout.root, self)
|
|
1543
|
+
@find.on_close=proc{@find.hide}
|
|
1544
|
+
@find.hide
|
|
1344
1545
|
end
|
|
1345
1546
|
|
|
1346
1547
|
def finalize
|
|
@@ -1367,18 +1568,12 @@ class AgMultiEditor < ArcadiaExt
|
|
|
1367
1568
|
end
|
|
1368
1569
|
|
|
1369
1570
|
def breakpoint_add(_file,_line)
|
|
1370
|
-
|
|
1371
|
-
_tobj.file = _file
|
|
1372
|
-
_tobj.line = _line
|
|
1373
|
-
EditorContract.instance.breakpoint_created(_tobj)
|
|
1571
|
+
EditorContract.instance.breakpoint_created(self, 'file'=>_file, 'line'=>_line)
|
|
1374
1572
|
@breakpoints << {:file=>_file,:line=>_line}
|
|
1375
1573
|
end
|
|
1376
1574
|
|
|
1377
1575
|
def breakpoint_del(_file,_line)
|
|
1378
|
-
|
|
1379
|
-
_tobj.file = _file
|
|
1380
|
-
_tobj.line = _line
|
|
1381
|
-
EditorContract.instance.breakpoint_deleted(_tobj)
|
|
1576
|
+
EditorContract.instance.breakpoint_deleted(self, 'file'=>_file, 'line'=>_line)
|
|
1382
1577
|
@breakpoints.delete_if{|b| (b[:file]==_file && b[:line]==_line)}
|
|
1383
1578
|
end
|
|
1384
1579
|
|
|
@@ -1534,8 +1729,8 @@ class AgMultiEditor < ArcadiaExt
|
|
|
1534
1729
|
_e = @tabs_editor[_name]
|
|
1535
1730
|
if _e && _e.file != nil
|
|
1536
1731
|
_new_caption = _e.file
|
|
1537
|
-
|
|
1538
|
-
|
|
1732
|
+
@find.use(_e)
|
|
1733
|
+
_e.check_file_last_access_time
|
|
1539
1734
|
else
|
|
1540
1735
|
_new_caption = _title
|
|
1541
1736
|
end
|
|
@@ -1544,7 +1739,7 @@ class AgMultiEditor < ArcadiaExt
|
|
|
1544
1739
|
@arcadia.layout.domain(@arcadia['conf'][@name+'.frame'])['root'].top_text(_new_caption)
|
|
1545
1740
|
end
|
|
1546
1741
|
_title = @tabs_file[_name] != nil ? File.basename(@tabs_file[_name]) :_name
|
|
1547
|
-
EditorContract.instance.buffer_raised(
|
|
1742
|
+
EditorContract.instance.buffer_raised(self, 'title'=>_title, 'file'=>@tabs_file[_name])
|
|
1548
1743
|
end
|
|
1549
1744
|
|
|
1550
1745
|
def editor_exist?(_filename)
|
|
@@ -1584,9 +1779,7 @@ class AgMultiEditor < ArcadiaExt
|
|
|
1584
1779
|
@tabs_file[_tab_name]= _filename
|
|
1585
1780
|
@tabs_editor[_tab_name].load_file(_filename)
|
|
1586
1781
|
#do_buffer_raise(_tab_name)
|
|
1587
|
-
|
|
1588
|
-
_tobj.file= _filename
|
|
1589
|
-
EditorContract.instance.file_opened(_tobj)
|
|
1782
|
+
EditorContract.instance.file_opened(self, 'file'=>_filename)
|
|
1590
1783
|
end
|
|
1591
1784
|
|
|
1592
1785
|
if _text_index != nil && _text_index != '1.0'
|
|
@@ -1639,6 +1832,11 @@ class AgMultiEditor < ArcadiaExt
|
|
|
1639
1832
|
end
|
|
1640
1833
|
end
|
|
1641
1834
|
|
|
1835
|
+
def close_all_editor(_editor, _mod=true)
|
|
1836
|
+
@tabs_editor.values.each do |_e|
|
|
1837
|
+
close_editor(_e)
|
|
1838
|
+
end
|
|
1839
|
+
end
|
|
1642
1840
|
|
|
1643
1841
|
def close_editor(_editor, _mod=true)
|
|
1644
1842
|
if ((_mod)&&(_editor.modified?))
|
|
@@ -1654,9 +1852,7 @@ class AgMultiEditor < ArcadiaExt
|
|
|
1654
1852
|
else
|
|
1655
1853
|
close_tab(_editor.page_frame)
|
|
1656
1854
|
end
|
|
1657
|
-
|
|
1658
|
-
_tobj.file = _editor.file
|
|
1659
|
-
EditorContract.instance.file_closed(_tobj)
|
|
1855
|
+
EditorContract.instance.file_closed(self, 'file'=>_editor.file)
|
|
1660
1856
|
end
|
|
1661
1857
|
|
|
1662
1858
|
def close_tab(_page_frame)
|
|
@@ -1672,78 +1868,120 @@ class AgMultiEditor < ArcadiaExt
|
|
|
1672
1868
|
def close_file(_filename)
|
|
1673
1869
|
close_editor(@tabs_editor[tab_name(_filename)])
|
|
1674
1870
|
end
|
|
1871
|
+
|
|
1872
|
+
def save_file(_filename)
|
|
1873
|
+
@tabs_editor[tab_name(_filename)].save
|
|
1874
|
+
end
|
|
1875
|
+
|
|
1876
|
+
def save_as_file(_filename)
|
|
1877
|
+
@tabs_editor[tab_name(_filename)].save_as
|
|
1878
|
+
end
|
|
1879
|
+
|
|
1675
1880
|
end
|
|
1676
1881
|
|
|
1677
|
-
class Findview <
|
|
1882
|
+
class Findview < TkFloatTitledFrame
|
|
1678
1883
|
def initialize(_parent)
|
|
1679
1884
|
super(_parent)
|
|
1680
|
-
|
|
1681
|
-
|
|
1885
|
+
#stop_resizing
|
|
1886
|
+
y0 = 10
|
|
1887
|
+
d = 23
|
|
1888
|
+
TkLabel.new(self.frame){
|
|
1889
|
+
text 'Find what:'
|
|
1890
|
+
place('x' => 8,'y' => y0,'height' => 19)
|
|
1891
|
+
}
|
|
1892
|
+
y0 = y0 + d
|
|
1893
|
+
@e_what = Tk::BWidget::ComboBox.new(self.frame){
|
|
1894
|
+
editable true
|
|
1895
|
+
justify 'left'
|
|
1896
|
+
relief 'ridge'
|
|
1897
|
+
autocomplete 'true'
|
|
1898
|
+
#insertbackground '#FFFFFF'
|
|
1899
|
+
entrybg '#FFFFFF'
|
|
1900
|
+
expand 'tab'
|
|
1901
|
+
takefocus 'true'
|
|
1902
|
+
#pack('padx'=>10, 'fill'=>'x')
|
|
1903
|
+
place('relwidth' => 1, 'width'=>-16,'x' => 8,'y' => y0,'height' => 19)
|
|
1904
|
+
}
|
|
1905
|
+
y0 = y0 + d
|
|
1906
|
+
TkLabel.new(self.frame){
|
|
1907
|
+
text 'Replace with:'
|
|
1908
|
+
place('x' => 8,'y' => y0,'height' => 19)
|
|
1909
|
+
}
|
|
1910
|
+
y0 = y0 + d
|
|
1911
|
+
|
|
1912
|
+
@e_with = Tk::BWidget::ComboBox.new(self.frame){
|
|
1913
|
+
editable true
|
|
1914
|
+
justify 'left'
|
|
1915
|
+
relief 'ridge'
|
|
1916
|
+
autocomplete 'true'
|
|
1917
|
+
#insertbackground '#FFFFFF'
|
|
1918
|
+
entrybg '#FFFFFF'
|
|
1919
|
+
expand 'tab'
|
|
1920
|
+
takefocus 'true'
|
|
1921
|
+
#pack('padx'=>10, 'fill'=>'x')
|
|
1922
|
+
place('relwidth' => 1, 'width'=>-16,'x' => 8,'y' => y0,'height' => 19)
|
|
1923
|
+
}
|
|
1924
|
+
|
|
1925
|
+
y0 = y0 + d
|
|
1926
|
+
@cb_reg = TkCheckButton.new(self.frame){|_cb_reg|
|
|
1927
|
+
text 'Use Regular Expression'
|
|
1682
1928
|
justify 'left'
|
|
1683
1929
|
relief 'flat'
|
|
1684
|
-
pack('side'=>'left', 'anchor'=>'e')
|
|
1685
|
-
|
|
1930
|
+
#pack('side'=>'left', 'anchor'=>'e')
|
|
1931
|
+
place('x' => 8,'y' => y0,'height' => 22)
|
|
1686
1932
|
}
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
#
|
|
1693
|
-
|
|
1694
|
-
# values 'forwards backwards page'
|
|
1695
|
-
# takefocus 'true'
|
|
1696
|
-
# pack('side'=>'left', 'anchor'=>'e')
|
|
1697
|
-
# }
|
|
1698
|
-
@rb = TkRadioButton.new(self){
|
|
1699
|
-
value 'forwards'
|
|
1700
|
-
text 'forwards'
|
|
1701
|
-
select
|
|
1702
|
-
pack('side'=>'left', 'anchor'=>'e')
|
|
1703
|
-
#place('relx' => 0,'x' => 8,'y' => 64,'relheight' => 0,'rely' => 0,'height' => 23,'bordermode' => 'inside')
|
|
1933
|
+
y0 = y0 + d
|
|
1934
|
+
@cb_back = TkCheckButton.new(self.frame){|_cb_reg|
|
|
1935
|
+
text 'Search backwards'
|
|
1936
|
+
justify 'left'
|
|
1937
|
+
relief 'flat'
|
|
1938
|
+
#pack('side'=>'left', 'anchor'=>'e')
|
|
1939
|
+
place('x' => 8,'y' => y0,'height' => 22)
|
|
1704
1940
|
}
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1941
|
+
|
|
1942
|
+
y0 = y0 + d
|
|
1943
|
+
y0 = y0 + d
|
|
1944
|
+
@buttons_frame = TkFrame.new(self.frame).pack('fill'=>'x', 'side'=>'bottom')
|
|
1945
|
+
|
|
1946
|
+
@b_replace_all = TkButton.new(@buttons_frame){|_b_go|
|
|
1947
|
+
state 'disabled'
|
|
1948
|
+
default 'disabled'
|
|
1949
|
+
text 'Replace All'
|
|
1950
|
+
overrelief 'raised'
|
|
1951
|
+
justify 'center'
|
|
1952
|
+
#width 15
|
|
1953
|
+
pack('side'=>'right','ipadx'=>5, 'padx'=>5)
|
|
1954
|
+
#place('width' => 50,'x' => 0,'y' => y0,'height' => 23,'bordermode' => 'inside')
|
|
1710
1955
|
}
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1956
|
+
|
|
1957
|
+
|
|
1958
|
+
@b_replace = TkButton.new(@buttons_frame){|_b_go|
|
|
1959
|
+
state 'disabled'
|
|
1960
|
+
default 'disabled'
|
|
1961
|
+
text 'Replace'
|
|
1962
|
+
overrelief 'raised'
|
|
1963
|
+
justify 'center'
|
|
1964
|
+
#width 15
|
|
1965
|
+
pack('side'=>'right','ipadx'=>5, 'padx'=>5)
|
|
1966
|
+
#place('width' => 50,'x' => 0,'y' => y0,'height' => 23,'bordermode' => 'inside')
|
|
1716
1967
|
}
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
# }
|
|
1721
|
-
@b_go = TkButton.new(self){|_b_go|
|
|
1968
|
+
|
|
1969
|
+
|
|
1970
|
+
@b_go = TkButton.new(@buttons_frame){|_b_go|
|
|
1722
1971
|
compound 'none'
|
|
1723
1972
|
default 'disabled'
|
|
1724
|
-
text 'Find'
|
|
1973
|
+
text 'Find Next'
|
|
1725
1974
|
#background '#ffffff'
|
|
1726
|
-
image TkPhotoImage.new('dat' => FIND_GIF)
|
|
1975
|
+
#image TkPhotoImage.new('dat' => FIND_GIF)
|
|
1727
1976
|
overrelief 'raised'
|
|
1728
1977
|
justify 'center'
|
|
1729
|
-
relief 'ridge'
|
|
1730
|
-
width
|
|
1731
|
-
pack('side'=>'right','ipadx'=>
|
|
1732
|
-
#place('width' => 50,'x' => 0,'y' =>
|
|
1733
|
-
}
|
|
1734
|
-
@e_what = Tk::BWidget::ComboBox.new(self){
|
|
1735
|
-
editable true
|
|
1736
|
-
justify 'left'
|
|
1737
|
-
relief 'ridge'
|
|
1738
|
-
autocomplete 'true'
|
|
1739
|
-
#insertbackground '#FFFFFF'
|
|
1740
|
-
entrybg '#FFFFFF'
|
|
1741
|
-
expand 'tab'
|
|
1742
|
-
takefocus 'true'
|
|
1743
|
-
pack('padx'=>10, 'fill'=>'x')
|
|
1744
|
-
#place('relwidth' => 1, 'x' => 0,'y' => 41,'height' => 19)
|
|
1978
|
+
#relief 'ridge'
|
|
1979
|
+
#width 15
|
|
1980
|
+
pack('side'=>'right','ipadx'=>5, 'padx'=>5)
|
|
1981
|
+
#place('width' => 50,'x' => 0,'y' => y0,'height' => 23,'bordermode' => 'inside')
|
|
1745
1982
|
}
|
|
1746
|
-
place('x'=>0,'y'=>0,'relheight'=> 1,'relwidth'=> 1)
|
|
1983
|
+
#place('x'=>0,'y'=>0,'relheight'=> 1,'relwidth'=> 1)
|
|
1984
|
+
place('x'=>100,'y'=>100,'height'=> 220,'width'=> 300)
|
|
1747
1985
|
|
|
1748
1986
|
end
|
|
1749
1987
|
end
|
|
@@ -1757,42 +1995,98 @@ class Find < Findview
|
|
|
1757
1995
|
@controller = _controller
|
|
1758
1996
|
@forwards = true
|
|
1759
1997
|
@find_action = proc{
|
|
1760
|
-
_radio = @rb.get_value
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1998
|
+
#_radio = @rb.get_value
|
|
1999
|
+
|
|
2000
|
+
#if _radio == 'line'
|
|
2001
|
+
# go_line
|
|
2002
|
+
#else
|
|
1765
2003
|
do_find_next
|
|
1766
|
-
end
|
|
2004
|
+
#end
|
|
1767
2005
|
}
|
|
1768
2006
|
@b_go.bind('1', @find_action)
|
|
2007
|
+
|
|
2008
|
+
@b_replace.bind('1', proc{do_replace})
|
|
2009
|
+
|
|
2010
|
+
@b_replace_all.bind('1', proc{do_replace_all})
|
|
2011
|
+
|
|
1769
2012
|
e = TkWinfo.children(@e_what)[0]
|
|
1770
2013
|
e.bind_append('KeyPress'){|e|
|
|
1771
2014
|
case e.keysym
|
|
1772
2015
|
when 'Return'
|
|
1773
2016
|
@find_action.call
|
|
2017
|
+
hide
|
|
2018
|
+
@editor_caller.text.focus
|
|
1774
2019
|
Tk.callback_break
|
|
2020
|
+
else
|
|
2021
|
+
widget_state
|
|
1775
2022
|
end
|
|
1776
2023
|
}
|
|
2024
|
+
e2 = TkWinfo.children(@e_with)[0]
|
|
2025
|
+
e2.bind_append('KeyPress'){|e|
|
|
2026
|
+
widget_state
|
|
2027
|
+
}
|
|
1777
2028
|
@last_index='insert'
|
|
2029
|
+
|
|
2030
|
+
@goto_line_dialog = GoToLine.new(_frame).hide
|
|
2031
|
+
@goto_line_dialog.on_close=proc{@goto_line_dialog.hide}
|
|
2032
|
+
|
|
2033
|
+
@goto_line_dialog.b_go.bind('1',proc{go_line})
|
|
2034
|
+
end
|
|
2035
|
+
|
|
2036
|
+
def do_replace
|
|
2037
|
+
if do_find_next
|
|
2038
|
+
_message = 'Replace "'+@e_what.value+'" with "'+@e_with.value+'" ?'
|
|
2039
|
+
if TkDialog2.new('message'=>_message, 'buttons'=>['Yes','No']).show() == 0
|
|
2040
|
+
self.editor.text.delete(@idx1,@idx2)
|
|
2041
|
+
self.editor.text.insert(@idx1,@e_with.value)
|
|
2042
|
+
end
|
|
2043
|
+
end
|
|
1778
2044
|
end
|
|
1779
2045
|
|
|
1780
|
-
|
|
2046
|
+
def do_replace_all
|
|
2047
|
+
while do_find_next
|
|
2048
|
+
_message = 'Replace "'+@e_what.value+'" with "'+@e_with.value+'" ?'
|
|
2049
|
+
_rc = TkDialog2.new('message'=>_message, 'buttons'=>['Yes','No','Annulla']).show()
|
|
2050
|
+
if _rc == 0
|
|
2051
|
+
self.editor.text.delete(@idx1,@idx2)
|
|
2052
|
+
self.editor.text.insert(@idx1,@e_with.value)
|
|
2053
|
+
elsif _rc == 2
|
|
2054
|
+
break
|
|
2055
|
+
end
|
|
2056
|
+
end
|
|
2057
|
+
end
|
|
2058
|
+
|
|
2059
|
+
def widget_state
|
|
2060
|
+
if (@e_what.value.length > 0) && (@e_with.value.length > 0)
|
|
2061
|
+
@b_replace.configure('state'=>'active')
|
|
2062
|
+
@b_replace_all.configure('state'=>'active')
|
|
2063
|
+
else
|
|
2064
|
+
@b_replace.configure('state'=>'disabled')
|
|
2065
|
+
@b_replace_all.configure('state'=>'disabled')
|
|
2066
|
+
end
|
|
2067
|
+
end
|
|
2068
|
+
|
|
2069
|
+
|
|
2070
|
+
def editor
|
|
1781
2071
|
if @editor_caller == nil
|
|
1782
2072
|
@editor_caller = @controller.raised
|
|
1783
2073
|
end
|
|
1784
2074
|
return @editor_caller
|
|
1785
|
-
|
|
2075
|
+
end
|
|
1786
2076
|
|
|
2077
|
+
def show_go_to_line_dialog
|
|
2078
|
+
@goto_line_dialog.show
|
|
2079
|
+
end
|
|
1787
2080
|
|
|
1788
2081
|
def go_line
|
|
1789
|
-
if @
|
|
1790
|
-
_row = @
|
|
2082
|
+
if @goto_line_dialog.e_line.value.length > 0
|
|
2083
|
+
_row = @goto_line_dialog.e_line.value
|
|
1791
2084
|
_index = _row+'.1'
|
|
1792
2085
|
self.editor.text.see(_index)
|
|
1793
2086
|
self.editor.text.tag_add('sel', _index,_index+' lineend')
|
|
1794
2087
|
self.editor.text.set_insert(_index)
|
|
1795
2088
|
@controller.bookmark_add(self.editor.file, _index)
|
|
2089
|
+
@goto_line_dialog.hide
|
|
1796
2090
|
end
|
|
1797
2091
|
#self.hide()
|
|
1798
2092
|
end
|
|
@@ -1801,6 +2095,7 @@ class Find < Findview
|
|
|
1801
2095
|
if (_editor != @editor_caller)
|
|
1802
2096
|
@last_index='insert'
|
|
1803
2097
|
@editor_caller = _editor
|
|
2098
|
+
title(_editor.file)
|
|
1804
2099
|
end
|
|
1805
2100
|
end
|
|
1806
2101
|
|
|
@@ -1812,6 +2107,10 @@ class Find < Findview
|
|
|
1812
2107
|
end
|
|
1813
2108
|
|
|
1814
2109
|
def do_find(_istart=nil)
|
|
2110
|
+
@forwards = @cb_back.cget('onvalue') != @cb_back.cget('variable').value.to_i
|
|
2111
|
+
_found = false
|
|
2112
|
+
@idx1 = nil
|
|
2113
|
+
@idx2 = nil
|
|
1815
2114
|
if @e_what.text.length > 0
|
|
1816
2115
|
update_combo(@e_what.text)
|
|
1817
2116
|
if !_istart && self.editor.text.index('insert')!=nil
|
|
@@ -1822,15 +2121,15 @@ class Find < Findview
|
|
|
1822
2121
|
_istart = '1.0'
|
|
1823
2122
|
end
|
|
1824
2123
|
if @forwards
|
|
1825
|
-
if @cb_reg.cget('onvalue')
|
|
1826
|
-
_index = self.editor.text.
|
|
2124
|
+
if @cb_reg.cget('onvalue')==@cb_reg.cget('variable').value.to_i
|
|
2125
|
+
_index = self.editor.text.tksearch(['regexp'],@e_what.text,_istart)
|
|
1827
2126
|
else
|
|
1828
2127
|
_index = self.editor.text.search(@e_what.text,_istart)
|
|
1829
2128
|
end
|
|
1830
2129
|
else
|
|
1831
2130
|
|
|
1832
|
-
if @cb_reg.cget('onvalue')
|
|
1833
|
-
_index = self.editor.text.
|
|
2131
|
+
if @cb_reg.cget('onvalue')==@cb_reg.cget('variable').value.to_i
|
|
2132
|
+
_index = self.editor.text.tksearch(['regexp','backwards'],@e_what.text,_istart)
|
|
1834
2133
|
else
|
|
1835
2134
|
_index = self.editor.text.tksearch(['backwards'],@e_what.text,_istart)
|
|
1836
2135
|
end
|
|
@@ -1846,6 +2145,9 @@ class Find < Findview
|
|
|
1846
2145
|
end
|
|
1847
2146
|
self.editor.text.tag_add('sel', _index,_index_sel_end)
|
|
1848
2147
|
self.editor.text.set_insert(_index)
|
|
2148
|
+
@idx1 =_index
|
|
2149
|
+
@idx2 =_index_sel_end
|
|
2150
|
+
_found = true
|
|
1849
2151
|
@controller.bookmark_add(self.editor.file, _index)
|
|
1850
2152
|
else
|
|
1851
2153
|
_message = '"'+@e_what.value+'" not found'
|
|
@@ -1855,9 +2157,13 @@ class Find < Findview
|
|
|
1855
2157
|
else
|
|
1856
2158
|
self.show()
|
|
1857
2159
|
end
|
|
2160
|
+
return _found
|
|
1858
2161
|
end
|
|
1859
2162
|
|
|
1860
2163
|
def do_find_next
|
|
2164
|
+
if @idx1 != nil
|
|
2165
|
+
self.editor.text.tag_remove('sel',@idx1,@idx2)
|
|
2166
|
+
end
|
|
1861
2167
|
do_find(@last_index)
|
|
1862
2168
|
end
|
|
1863
2169
|
end
|
|
@@ -1891,3 +2197,39 @@ end
|
|
|
1891
2197
|
|
|
1892
2198
|
class CodeInsight
|
|
1893
2199
|
end
|
|
2200
|
+
|
|
2201
|
+
class GoToLine < TkFloatTitledFrame
|
|
2202
|
+
attr_reader :e_line
|
|
2203
|
+
attr_reader :b_go
|
|
2204
|
+
def initialize(_parent)
|
|
2205
|
+
super(_parent)
|
|
2206
|
+
#stop_resizing
|
|
2207
|
+
y0 = 10
|
|
2208
|
+
d = 23
|
|
2209
|
+
TkLabel.new(self.frame){
|
|
2210
|
+
text 'Go to line:'
|
|
2211
|
+
place('x' => 8,'y' => y0,'height' => 19)
|
|
2212
|
+
}
|
|
2213
|
+
y0 = y0 + d
|
|
2214
|
+
@e_line = TkEntry.new(self.frame){
|
|
2215
|
+
justify 'left'
|
|
2216
|
+
relief 'ridge'
|
|
2217
|
+
place('relwidth' => 1, 'width'=>-16,'x' => 8,'y' => y0,'height' => 19)
|
|
2218
|
+
}
|
|
2219
|
+
|
|
2220
|
+
y0 = y0 + d
|
|
2221
|
+
y0 = y0 + d
|
|
2222
|
+
@buttons_frame = TkFrame.new(self.frame).pack('fill'=>'x', 'side'=>'bottom')
|
|
2223
|
+
|
|
2224
|
+
@b_go = TkButton.new(@buttons_frame){|_b_go|
|
|
2225
|
+
compound 'none'
|
|
2226
|
+
default 'disabled'
|
|
2227
|
+
text 'Go'
|
|
2228
|
+
overrelief 'raised'
|
|
2229
|
+
justify 'center'
|
|
2230
|
+
pack('side'=>'right','ipadx'=>5, 'padx'=>5)
|
|
2231
|
+
}
|
|
2232
|
+
place('x'=>150,'y'=>150,'height'=> 120,'width'=> 100)
|
|
2233
|
+
|
|
2234
|
+
end
|
|
2235
|
+
end
|