arcadia 0.9.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +8 -8
- data/conf/arcadia.conf +9 -1
- data/conf/arcadia.res.rb +45 -11
- data/conf/theme-dark.conf +2 -1
- data/conf/theme-dark.res.rb +21 -4
- data/ext/ae-editor/ae-editor.conf +18 -74
- data/ext/ae-editor/ae-editor.rb +335 -159
- data/ext/ae-editor/lib/rbeautify.rb +222 -0
- data/ext/ae-rad/ae-rad-palette.rb +1 -1
- data/ext/ae-rad/ae-rad.conf +1 -1
- data/ext/ae-ruby-debug/ae-ruby-debug.rb +21 -9
- data/lib/a-commons.rb +8 -3
- data/lib/a-contracts.rb +2 -0
- data/lib/a-core.rb +55 -272
- data/lib/a-tkcommons.rb +294 -188
- metadata +4 -3
data/README
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
= Arcadia Ide
|
2
|
-
version 0.9.
|
2
|
+
version 0.9.1
|
3
3
|
|
4
4
|
by Antonio Galeone
|
5
|
-
on
|
5
|
+
on Oct 19, 2010
|
6
6
|
|
7
7
|
|
8
8
|
== About
|
@@ -16,16 +16,16 @@ Some of Arcadia ide project features include:
|
|
16
16
|
* Working on any platform where ruby and tcl-tk work.
|
17
17
|
* Highly extensibility architecture.
|
18
18
|
|
19
|
-
== In this release 0.9.
|
19
|
+
== In this release 0.9.1
|
20
20
|
|
21
21
|
[Improvements]
|
22
22
|
commons:
|
23
|
-
-
|
24
|
-
- new default theme = dark
|
25
|
-
- auto-hide scrollbar and auto post menu
|
23
|
+
- bug-fixing
|
26
24
|
new features:
|
27
|
-
|
28
|
-
|
25
|
+
editor
|
26
|
+
- added a button for close current tab
|
27
|
+
- added menu button for quick file selection
|
28
|
+
- "Edit/Prettify Current" now works
|
29
29
|
|
30
30
|
== Dependencies
|
31
31
|
- rubygems
|
data/conf/arcadia.conf
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
#:::::::::::::::: layout ::::::::::::::::::::::<begin>
|
8
8
|
layout.splitter.length=5
|
9
|
-
layout.exchange_panel_if_no_tabbed=false
|
9
|
+
layout.exchange_panel_if_no_tabbed=false
|
10
10
|
arm::layout.splitter.length=10
|
11
11
|
#layout.split=1,2
|
12
12
|
#layout.split.1=0.0r70%
|
@@ -143,6 +143,14 @@ toolbar.=>>>panel
|
|
143
143
|
|
144
144
|
toolbarbutton.=>>>button
|
145
145
|
toolbarbutton.relief=flat
|
146
|
+
toolbarbutton.borderwidth=0
|
147
|
+
|
148
|
+
titletoolbarbutton.=>>>toolbarbutton
|
149
|
+
titletoolbarbutton.background=>>>titlelabel.background
|
150
|
+
titletoolbarbutton.foreground=>>>titlelabel.foreground
|
151
|
+
titletoolbarbutton.activebackground=>>>titlelabel.activebackground
|
152
|
+
titletoolbarbutton.activeforeground=>>>titlelabel.activeforeground
|
153
|
+
|
146
154
|
|
147
155
|
label.background=>>>background
|
148
156
|
label.foreground=>>>foreground
|
data/conf/arcadia.res.rb
CHANGED
@@ -359,16 +359,32 @@ R0lGODlhCQAJAJEAAImCejYtJE1CN////ywAAAAACQAJAAACF4yPoismAwQY
|
|
359
359
|
LUgIq5pR8+xkk8YoyBkUADs=
|
360
360
|
EOS
|
361
361
|
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
2v
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
362
|
+
CLOSE_DOCUMENT_GIF=<<EOS
|
363
|
+
R0lGODlhEAAQAPcAAPn///v//wc7h/f77fz////48gBEkAo8g/n/0f/98P/+
|
364
|
+
8vrHbPbNj/j/0fLTdv//9gJBhgE8igBChAA/ivjOePjOevj/1v3/lP/83gI9
|
365
|
+
ef//5fn88fb6mfb6m/f+//3LcvrNcPf///jPd/vId//wy//6//769/753P//
|
366
|
+
+//69fv9+Pr2kgs/eP/1o//5xfHTe/3/2v/Hd//22/36x//87fbTgf//yP//
|
367
|
+
7v/5y//+1ff1xP35yvX5i//SigU+g//rxP/Qfv7owfvQi/r90PX65P/89f//
|
368
|
+
4gQ9iv/60Pvxtv/14v/3iwA+lQZAiv784wRCj/n//ff/rQJFjP/KhP/32Pv7
|
369
|
+
s/3IePn94v/98fb+6QNBjvn7kPz/v/bTj/fNd/f/+v/2wfDZc/jNfgJCiv/z
|
370
|
+
ifnMiPXNhf/JfPjJcfT5///2/wU7gwZCfv7//f/RgwA7gfr//P3JgPb+8/3/
|
371
|
+
rQFDjf/2l/vlswVBh//Piv//8v7/9vj//QA+iP//xfnNhP/40QU/kP/xyQY9
|
372
|
+
ffn+1frhuf/53v76//3+///33vr///r/+Qk6ff/6yg48iQBHlfrcpv/7vvv+
|
373
|
+
//r/8f/6ov/3+v//sPH54QBChwY7ifr0nP331fXPev/wmvPIevXPbvj95/fJ
|
374
|
+
cQJGhf/Jb/761PjgsPz5/wY/hv30j/n51/b+//nOgAA+h//Pi/j7qv/8/wA/
|
375
|
+
ggBAi/jiuf//5gJEkP/5s/nNhgBAhv/6wP/9+v/00gJBkf//4fzUfP/+y//9
|
376
|
+
oPXQdQ02eP383vv8///xkv3+3/r+7/z26ABBgwFBmQc9eww+gwE7hP793/76
|
377
|
+
7wVAhv78sf72ofrHdP/Pe/zhtP//3Qw9ivLbqf/Pg/v7sffIdv39///7//v8
|
378
|
+
sPj6/wg9f/n13P/7rQJCmQY9j//5/wJAi/v5+vv54v/KfwAAAAAAAAAAAAAA
|
379
|
+
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
380
|
+
AAAAAAAAAAAAAAAAAAAAACH5BAAAAAAALAAAAAAQABAAAAj/AI0R6iEqmpBz
|
381
|
+
CBMi/KEklrVAhb4xM0exIsUuQa4hUfHlkBoj5QokaAZgmyREZRjkIkDuSYgs
|
382
|
+
CmQNgMNmggkZtcyQKDXmEjAAWIrlgZChCQAqfljpKKKoGrJkhgAIUHYnAI0/
|
383
|
+
ql4wQrABBaw1fJzpEnBjwC4cYvBwmWHDkh4psySYCvCJ2igXFayA6VVFkzZv
|
384
|
+
gkIdK+EEw5BbFEBga3CCwCtxAuhgOhCASB9IItxA09DGVqNlqXC9cbQoUg5w
|
385
|
+
DmpwSwMowipXg1Cl0GKAhZwkXjbNecDEx54dzyoFgxLuSCJaH6b4slCgG7FW
|
386
|
+
UVpMgiFs3BUyvEh54nShwzAOS7asG+BRJ9OpMHY8PIoBKpu0OCPOdALyC82C
|
387
|
+
aZQCAgA7
|
372
388
|
EOS
|
373
389
|
|
374
390
|
COPY_GIF=<<EOS
|
@@ -620,6 +636,24 @@ BBIqXAiAIMKFCQFIbHgQIkSKAh9exFjRokKOGj2CnEiSpMOSEw0OCPlRAMeV
|
|
620
636
|
CQPIDMDQYcyZMiPaJIAzJwGQN3Hq7Ojxp8qjAwMCADs=
|
621
637
|
EOS
|
622
638
|
|
639
|
+
DOCUMENT_COMBO_GIF=<<EOS
|
640
|
+
R0lGODlhEAAQAMZcADRUbihZhENYaDpbeTBdhy9fkDRfhzFhkDhghzVlkj1q
|
641
|
+
k41+QI1/RY2BR42CTY2CTo2CT42EVI2FVo2GWI2GXo2HX42HYI2JZY2JaI2K
|
642
|
+
Z42LbY2Lb42Mb42NdY2Ndo2Od0iZ342Pe42QfY2QgI2Rgkuc4o2ShVCh55en
|
643
|
+
soHR9//MV//OWqrX///PXv/PYP/QY//SZv/SaP/Sa//Tbv/UdP/Vc//Wdv/Y
|
644
|
+
f//ZgP/ag//cjP/djf/ekP/gmP/hmv/hnP/kpv/lpf/lqP/mqf/nrf/osP/o
|
645
|
+
sf/ps//ptP/qt//ru//svf/svv/txP/uw//uxf/vyP/wy//wzP/xz//z1v/0
|
646
|
+
2v/13f/24f/35P/45//56//78v//////////////////////////////////
|
647
|
+
////////////////////////////////////////////////////////////
|
648
|
+
/////////////////////////////////////////////////yH+EUNyZWF0
|
649
|
+
ZWQgd2l0aCBHSU1QACH5BAEKAH8ALAAAAAAQABAAAAeegH+Cg4SFhQADCIoG
|
650
|
+
AwCGgwopLCwnBY+ECSUgB5eFBAGXAqKjKCijo4ICW1pZV1ZVVFNSUE9MAqla
|
651
|
+
JiMhHRoXFBEODEm3fwJaUU1KRUE9Ojc1MMSpWCQiHhsZFRIPDQtFxQJXTkpG
|
652
|
+
QD47ODQxLUThVSIfHBgWExAzLytA4VdLR0I/eOSwIcOFCnCprhRZWATJwiFE
|
653
|
+
gOxLdariqU6XAgEAOw==
|
654
|
+
EOS
|
655
|
+
|
656
|
+
|
623
657
|
EXIT_GIF=<<EOS
|
624
658
|
R0lGODlhFAAUAOelAOlIDulLE+ldLPGUcvaxmPjKuvvk3OA5BOA6BeE+COhD
|
625
659
|
CuBCDeFDD+BHFeBIGOBLHOZSI+hWJOZYLOhcLehjN+6HZfCNa++Pb/GScfjH
|
@@ -1769,4 +1803,4 @@ owSIBIP2gGyQ5wSUKySY9PgQYgAhRIQM/dkAKEWQMCWKzDgBA8GhQw8FVSDE
|
|
1769
1803
|
YskZFVJ0uDABwI8gRH0OOShk4kkWG0R2TC7w8BAgRBkAdZGTJYaUJT9GBFhT
|
1770
1804
|
57CdBzOUnEGzpcsRGhoAyOCCGFGZKDlEeNDQYUIFChFGFQR583AQoDZorCAB
|
1771
1805
|
ouMGDyxZ3CAKCAA7
|
1772
|
-
EOS
|
1806
|
+
EOS
|
data/conf/theme-dark.conf
CHANGED
@@ -79,8 +79,9 @@ hightlight.global_variable.foreground=#db66ca
|
|
79
79
|
hightlight.constant.foreground=#bdc175
|
80
80
|
hightlight.tag.foreground=#69a8d9
|
81
81
|
hightlight.selected.background=#133e5e
|
82
|
-
hightlight.sel.background=#
|
82
|
+
hightlight.sel.background=#660000
|
83
83
|
hightlight.sel.foreground=white
|
84
|
+
hightlight.sel.borderwidth=0
|
84
85
|
hightlight.link.foreground=orange
|
85
86
|
#hightlight.sel.foreground=white
|
86
87
|
|
data/conf/theme-dark.res.rb
CHANGED
@@ -8,13 +8,30 @@
|
|
8
8
|
#EOS
|
9
9
|
|
10
10
|
W_MAX_GIF[0..-1]=<<EOS
|
11
|
-
|
12
|
-
|
11
|
+
R0lGODlhEAAQAKUlAGYAAJkAAP8TE4JPHP8qKoVSH4hVIotYJY1aJ5BdKpJf
|
12
|
+
LJRhLpZjMJhlMv9FRZlmM/9eXv95ec2bOM+fPtGiRdKmTf+UlNWqVdevX9m0
|
13
|
+
ady5c/+vr9++ff+zs+HEif+8vOTJlOfPnv/Kyv/Z2f/o6P//////////////
|
14
|
+
////////////////////////////////////////////////////////////
|
15
|
+
/////////////////////////////////yH+EUNyZWF0ZWQgd2l0aCBHSU1Q
|
16
|
+
ACH5BAEKAD8ALAAAAAAQABAAAAZiwJ9wSCwahYHA0Rj4bADLYUAUgTigy8DI
|
17
|
+
UnUQsMUAqcO1EgRgYpJqBaTD7Gv0N+2+4fb5z+0+Pv5LBgUDQg8hfw0MCwoJ
|
18
|
+
CAcGEoQ/hiAeHBoZGBcVFBORhX8PiYuNj4N6RkEAOw==
|
13
19
|
EOS
|
14
20
|
|
15
21
|
W_NORM_GIF[0..-1]=<<EOS
|
16
|
-
|
17
|
-
|
22
|
+
R0lGODlhEAAQAOYAAABHvwBFqABBpgBQvQBLsghk0whewwhUsgpcwwpZvQ5g
|
23
|
+
whBo0BNkyABZuwdfww5nzxJz3hFqyRx75BxwzgBpzwpz2hFryheA7RNqwBp1
|
24
|
+
0CZ81jCO7ne7/32+/obC/4vE/47H/4/H/5rM/6DP/6DQ/wp11gluywpy0g16
|
25
|
+
3RNxyxRyyBZ0zBx70yWD2iuH2z2U5Euq/1Cr/1Cg6WKy/267/2+4/HG7/3O9
|
26
|
+
/3m//3m694LC/4PE/4fF/47I/47J/5XL/5nN/5vO/53R/6rX/7Xb/whyzAlx
|
27
|
+
yQpyyBaD3Bx+0Cqf/y2f/yiG1yuJ2S6I10Cn/zqU4TuR3Eyg6lyz/3zD/4bI
|
28
|
+
/4bJ/4vL/5jP/6rY/w57zheI3xeE2yOi/yaP4iiK2HnG/7bi/////wAAAAAA
|
29
|
+
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
30
|
+
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAGIA
|
31
|
+
LAAAAAAQABAAAAeHgGKCg4SFhoeIhAcKDASJghNVV1RgGwCIGlYxME9LShKD
|
32
|
+
JSiCKzczUxkGDhBdAoJOQ2IqNTY0KYQXCIJJWVFNOzguhQUPgkZYQR06HCaF
|
33
|
+
AwuCRzkgHjxMDRSFCYJFMj8fIkBCYS+DEQGDXiMhPT5SLRWDFhiDW0QkUEgn
|
34
|
+
hSyEXF9aHgkc+CgQADs=
|
18
35
|
EOS
|
19
36
|
|
20
37
|
#TREE_NODE_CLASS_GIF[0..-1]=<<EOS
|
@@ -6,19 +6,19 @@ frames.names=editor,editor_outline
|
|
6
6
|
active=yes
|
7
7
|
require=ext/ae-editor/ae-editor
|
8
8
|
class=AgMultiEditor
|
9
|
-
|
10
|
-
gems=coderay,rdp-rbeautify
|
11
|
-
gems.rdp-rbeautify.repository=http://gems.github.com
|
12
|
-
gems.rdp-rbeautify.events=PrettifyTextEvent
|
9
|
+
gems=coderay
|
10
|
+
#gems=coderay,rdp-rbeautify
|
11
|
+
#gems.rdp-rbeautify.repository=http://gems.github.com
|
12
|
+
#gems.rdp-rbeautify.events=PrettifyTextEvent
|
13
13
|
tabs=0.5c left
|
14
14
|
# to use tab key set tab-replace-width-space=0
|
15
15
|
tab-replace-width-space=2
|
16
|
-
|
16
|
+
line-numbers=yes
|
17
17
|
#tabs
|
18
18
|
#tabs.font=courier 11
|
19
19
|
#freebsd::tabs.font=courier 12
|
20
20
|
#win::tabs.font={Courier New} 9
|
21
|
-
|
21
|
+
#tabs.side=bottom
|
22
22
|
tabs.side=top
|
23
23
|
complete-code=yes
|
24
24
|
close-last-if-not-modified=yes
|
@@ -45,7 +45,6 @@ max-file-open=3 #todo
|
|
45
45
|
#hightlight.goto.color.foreground=blue
|
46
46
|
#hightlight.goto.color.background=yellow
|
47
47
|
#+--------------------------------------------------
|
48
|
-
#+--------------------------------------------------
|
49
48
|
hightlight.sel.foreground=>>>hightlight.sel.foreground
|
50
49
|
hightlight.sel.background=>>>hightlight.sel.background
|
51
50
|
hightlight.sel.borderwidth=>>>hightlight.sel.borderwidth
|
@@ -66,75 +65,20 @@ hightlight.spaces.relief=>>>hightlight.4.relief
|
|
66
65
|
#hightlight.debug.relief=>>>hightlight.16.relief
|
67
66
|
|
68
67
|
|
69
|
-
#color.background=#FFFFFF
|
70
|
-
#color.foreground=#7F7F7F
|
71
|
-
#color.insertbackground=#ff8000
|
72
|
-
#hightlight.keyword.foreground=#00007F
|
73
|
-
#hightlight.keyword.style=bold
|
74
|
-
#hightlight.method_name.foreground=#007F7F
|
75
|
-
#hightlight.method_name.style=bold
|
76
|
-
#hightlight.class_name.foreground=#0000FF
|
77
|
-
#hightlight.class_name.style=bold
|
78
|
-
#hightlight.module_name.foreground=#0000FF
|
79
|
-
#hightlight.module_name.style=bold
|
80
|
-
#hightlight.instance_variable.color.foreground=#7F7F7F
|
81
|
-
#hightlight.instance_variable.style=bold
|
82
|
-
#hightlight.comment.color.foreground=#007F00
|
83
|
-
#hightlight.string.color.foreground=#7F007F
|
84
|
-
#hightlight.number.color.foreground=#007F7F
|
85
|
-
##hightlight.capitalize.color.foreground=#0000FF
|
86
|
-
#hightlight.operator.foreground=#000000
|
87
|
-
#hightlight.operator.style=bold
|
88
|
-
#hightlight.sel.foreground=black
|
89
|
-
#hightlight.sel.background=#68f914
|
90
|
-
#hightlight.sel.borderwidth=1
|
91
|
-
#hightlight.sel.relief=raised
|
92
|
-
#hightlight.debug.foreground=black
|
93
|
-
#hightlight.debug.background=#b3c1d9
|
94
|
-
#hightlight.debug.borderwidth=2
|
95
|
-
#hightlight.debug.relief=groove
|
96
|
-
##hightlight.goto.color.foreground=blue
|
97
|
-
#hightlight.selected.background=yellow
|
98
|
-
#hightlight.tabs.foreground=black
|
99
|
-
#hightlight.tabs.background=#b1cfba
|
100
|
-
#hightlight.tabs.borderwidth=1
|
101
|
-
#hightlight.tabs.relief=raised
|
102
|
-
#hightlight.spaces.foreground=black
|
103
|
-
#hightlight.spaces.background=#d9f42b
|
104
|
-
#hightlight.spaces.borderwidth=1
|
105
|
-
#hightlight.spaces.relief=raised
|
106
|
-
#+--------------------------------------------------
|
107
|
-
|
108
|
-
|
109
|
-
# line number
|
110
|
-
#line_number_panel.color.background=#6e6e6e
|
111
|
-
#line_number_panel.color.foreground=white
|
112
|
-
|
113
|
-
#line_number_panel.color.background=#e1e1e1
|
114
|
-
##line_number_panel.color.background=#FFFFFF
|
115
|
-
#line_number_panel.color.foreground=#333333
|
116
|
-
#
|
117
|
-
#
|
118
|
-
# tree explorer
|
119
|
-
#explorer_panel.tree.color.background=#ffffff
|
120
|
-
#explorer_panel.tree.color.foreground=white
|
121
|
-
##explorer_panel.tabs.side=bottom
|
122
68
|
explorer_panel.tabs.side=top
|
123
|
-
#
|
124
|
-
#explorer_panel.tree.font=courier 11
|
125
|
-
#freebsd::explorer_panel.tree.font=courier 12
|
126
|
-
#win::explorer_panel.tree.font={Courier New} 9
|
127
|
-
#explorer_panel.tree.class.color.foreground=#a42019
|
128
|
-
#explorer_panel.tree.class.font=times 10 bold
|
129
|
-
#win::explorer_panel.tree.class.font=times 10 bold
|
130
|
-
#explorer_panel.tree.def.color.foreground=blue
|
131
|
-
#explorer_panel.tree.def.font=times 10
|
132
|
-
#win::explorer_panel.tree.def.font=times 10
|
133
|
-
#explorer_panel.tree.module.color.foreground=#1b691e
|
134
|
-
#explorer_panel.tree.module.font=times 8 bold
|
135
|
-
#win::explorer_panel.tree.module.font={Courier New} 9 bold
|
136
69
|
|
137
70
|
#:::::::::::::::: Editor group ::::::::::::::::::::::<end>
|
138
71
|
popup.bind.shortcut=Button-3
|
139
72
|
arm::popup.bind.shortcut=F4
|
140
|
-
#keybinding.Control-Shift-KeyPress[Y]=ActionEvent.new(self,'action'=>close_raised)
|
73
|
+
#keybinding.Control-Shift-KeyPress[Y]=ActionEvent.new(self,'action'=>close_raised)
|
74
|
+
|
75
|
+
# menu items
|
76
|
+
user_menu.contexts=View
|
77
|
+
user_menu.View.context_path=/
|
78
|
+
user_menu.View=line_number
|
79
|
+
user_menu.View.line_number.hint=Show/Hide line numbers
|
80
|
+
user_menu.View.line_number.caption=Show/Hide line numbers
|
81
|
+
user_menu.View.line_number.underline=1
|
82
|
+
user_menu.View.line_number.action=ActionEvent.new(self,'action'=>show_hide_current_line_numbers)
|
83
|
+
|
84
|
+
#:::::::::::::::::::::::::::::::::::::::::::::::::<end>
|
data/ext/ae-editor/ae-editor.rb
CHANGED
@@ -10,6 +10,7 @@ require 'tktext'
|
|
10
10
|
require "#{Dir.pwd}/lib/a-tkcommons"
|
11
11
|
#require 'lib/a-commons'
|
12
12
|
require "#{Dir.pwd}/lib/a-core"
|
13
|
+
require "#{Dir.pwd}/ext/ae-editor/lib/rbeautify"
|
13
14
|
|
14
15
|
class TreeNode
|
15
16
|
attr_reader :sons
|
@@ -34,15 +35,99 @@ end
|
|
34
35
|
|
35
36
|
class SourceStructure
|
36
37
|
attr_reader :root
|
38
|
+
|
39
|
+
def initialize
|
40
|
+
@root = TreeNode.new(nil, 'KRoot'){|_node|
|
41
|
+
_node.rif= 'root'
|
42
|
+
_node.label=''
|
43
|
+
}
|
44
|
+
end
|
45
|
+
|
46
|
+
def node_by_line(_from_node, _line)
|
47
|
+
_found_node = nil
|
48
|
+
_begin = _from_node.rif.to_i
|
49
|
+
_end = _from_node.rif_end.to_i
|
50
|
+
if _line.to_i <= _end && _line.to_i >= _begin
|
51
|
+
_found_node = _from_node
|
52
|
+
else
|
53
|
+
_sons = _from_node.sons
|
54
|
+
for inode in 0.._sons.length - 1
|
55
|
+
_son = _sons[inode]
|
56
|
+
_found_node = node_by_line(_son, _line)
|
57
|
+
break if _found_node
|
58
|
+
end
|
59
|
+
end
|
60
|
+
return _found_node
|
61
|
+
end
|
62
|
+
|
63
|
+
def deep_node_by_line(_from_node, _line, _found_node=nil)
|
64
|
+
_begin = _from_node.rif.to_i
|
65
|
+
_end = _from_node.rif_end.to_i
|
66
|
+
if _line.to_i <= _end && _line.to_i >= _begin
|
67
|
+
_found_node = _from_node
|
68
|
+
end
|
69
|
+
_sons = _from_node.sons
|
70
|
+
for inode in 0.._sons.length - 1
|
71
|
+
_son = _sons[inode]
|
72
|
+
_found_node = deep_node_by_line(_son, _line, _found_node)
|
73
|
+
end
|
74
|
+
return _found_node
|
75
|
+
end
|
76
|
+
|
77
|
+
def class_node_by_line(_line)
|
78
|
+
line_node = node_by_line(@root, _line)
|
79
|
+
class_node = line_node
|
80
|
+
while class_node != nil && class_node.kind != "KClass"
|
81
|
+
class_node = class_node.parent
|
82
|
+
end
|
83
|
+
return class_node
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
87
|
+
|
88
|
+
class CtagsSourceStructure < SourceStructure
|
89
|
+
def initialize(_file)
|
90
|
+
super()
|
91
|
+
@file = _file
|
92
|
+
build_structure
|
93
|
+
end
|
94
|
+
|
95
|
+
def build_structure
|
96
|
+
output = ctags
|
97
|
+
output.each {|line|
|
98
|
+
p line.split("\t")
|
99
|
+
}
|
100
|
+
end
|
101
|
+
|
102
|
+
def ctags
|
103
|
+
_cmd_ = "|ctags -x -u #{@file}"
|
104
|
+
to_ret = ''
|
105
|
+
open(_cmd_, "r"){|f|
|
106
|
+
to_ret = f.readlines
|
107
|
+
}
|
108
|
+
to_ret
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
class RubySourceStructure < SourceStructure
|
37
115
|
attr_reader :injected_row
|
116
|
+
|
38
117
|
def initialize(_source)
|
118
|
+
super()
|
119
|
+
parse_source(_source)
|
120
|
+
end
|
121
|
+
|
122
|
+
|
123
|
+
def parse_source(_source)
|
39
124
|
_row = 1
|
40
125
|
_liv = 0
|
41
126
|
_livs = Array.new
|
42
|
-
@root = TreeNode.new(nil, 'KRoot'){|_node|
|
43
|
-
_node.rif= 'root'
|
44
|
-
_node.label=''
|
45
|
-
}
|
127
|
+
# @root = TreeNode.new(nil, 'KRoot'){|_node|
|
128
|
+
# _node.rif= 'root'
|
129
|
+
# _node.label=''
|
130
|
+
# }
|
46
131
|
_livs[_liv]=@root
|
47
132
|
_source.each_line{|line|
|
48
133
|
line = "\s"+line.split("#")[0]+"\s"
|
@@ -134,7 +219,8 @@ class SourceStructure
|
|
134
219
|
_row = _row +1
|
135
220
|
}
|
136
221
|
end
|
137
|
-
|
222
|
+
|
223
|
+
|
138
224
|
def scheletor_from_node(_node, _source='', _injected_source='', _injected_class='')
|
139
225
|
_hinner_source = ''
|
140
226
|
#_sons = _node.sons.sort
|
@@ -163,59 +249,17 @@ class SourceStructure
|
|
163
249
|
_source = "#{_source}end\n" if _node.kind == 'KClass' || _node.kind == 'KModule'
|
164
250
|
_source
|
165
251
|
end
|
166
|
-
|
167
|
-
|
168
252
|
|
169
|
-
|
170
|
-
_found_node = nil
|
171
|
-
_begin = _from_node.rif.to_i
|
172
|
-
_end = _from_node.rif_end.to_i
|
173
|
-
if _line.to_i <= _end && _line.to_i >= _begin
|
174
|
-
_found_node = _from_node
|
175
|
-
else
|
176
|
-
_sons = _from_node.sons
|
177
|
-
for inode in 0.._sons.length - 1
|
178
|
-
_son = _sons[inode]
|
179
|
-
_found_node = node_by_line(_son, _line)
|
180
|
-
break if _found_node
|
181
|
-
end
|
182
|
-
end
|
183
|
-
return _found_node
|
184
|
-
end
|
185
|
-
|
186
|
-
def deep_node_by_line(_from_node, _line, _found_node=nil)
|
187
|
-
_begin = _from_node.rif.to_i
|
188
|
-
_end = _from_node.rif_end.to_i
|
189
|
-
if _line.to_i <= _end && _line.to_i >= _begin
|
190
|
-
_found_node = _from_node
|
191
|
-
end
|
192
|
-
_sons = _from_node.sons
|
193
|
-
for inode in 0.._sons.length - 1
|
194
|
-
_son = _sons[inode]
|
195
|
-
_found_node = deep_node_by_line(_son, _line, _found_node)
|
196
|
-
end
|
197
|
-
return _found_node
|
198
|
-
end
|
199
|
-
|
200
|
-
def class_node_by_line(_line)
|
201
|
-
line_node = node_by_line(@root, _line)
|
202
|
-
class_node = line_node
|
203
|
-
while class_node != nil && class_node.kind != "KClass"
|
204
|
-
class_node = class_node.parent
|
205
|
-
end
|
206
|
-
return class_node
|
207
|
-
end
|
208
|
-
|
253
|
+
|
209
254
|
def classies
|
210
255
|
end
|
211
256
|
def modules
|
212
257
|
end
|
213
258
|
def class_methods(_class)
|
214
259
|
end
|
215
|
-
|
216
|
-
|
217
260
|
end
|
218
261
|
|
262
|
+
|
219
263
|
class SafeCompleteCode
|
220
264
|
attr_reader :modified_row, :modified_col
|
221
265
|
attr_reader :filter
|
@@ -224,7 +268,7 @@ class SafeCompleteCode
|
|
224
268
|
@file = _file
|
225
269
|
@row = _row.to_i
|
226
270
|
@col = _col.to_i
|
227
|
-
@ss =
|
271
|
+
@ss = RubySourceStructure.new(_source)
|
228
272
|
@filter=''
|
229
273
|
@words = Array.new
|
230
274
|
process_source
|
@@ -856,7 +900,8 @@ class AgEditorOutline
|
|
856
900
|
#(re)build tree
|
857
901
|
_txt = @editor.text.get('1.0','end')
|
858
902
|
#@root = build_tree_from_source(_txt)
|
859
|
-
|
903
|
+
#CtagsSourceStructure.new(@editor.file)
|
904
|
+
@ss = RubySourceStructure.new(_txt)
|
860
905
|
#@root = @ss.root
|
861
906
|
@selected = nil
|
862
907
|
build_tree_from_node(@ss.root, _label_sel)
|
@@ -916,12 +961,37 @@ class AgEditor
|
|
916
961
|
@loading=false
|
917
962
|
@tabs_show = false
|
918
963
|
@spaces_show = false
|
964
|
+
@line_numbers_visible = @controller.conf('line-numbers') == 'yes'
|
919
965
|
end
|
920
966
|
|
921
967
|
def modified_from_opening?
|
922
968
|
@modified_from_opening
|
923
969
|
end
|
924
970
|
|
971
|
+
def show_line_numbers
|
972
|
+
if !@line_numbers_visible
|
973
|
+
#@fm1.hide_right
|
974
|
+
@fm1.show_left
|
975
|
+
@line_numbers_visible = true
|
976
|
+
do_line_update
|
977
|
+
end
|
978
|
+
end
|
979
|
+
|
980
|
+
def hide_line_numbers
|
981
|
+
if @line_numbers_visible
|
982
|
+
@fm1.hide_left
|
983
|
+
@line_numbers_visible = false
|
984
|
+
end
|
985
|
+
end
|
986
|
+
|
987
|
+
def show_hide_line_numbers
|
988
|
+
if @line_numbers_visible
|
989
|
+
hide_line_numbers
|
990
|
+
else
|
991
|
+
show_line_numbers
|
992
|
+
end
|
993
|
+
end
|
994
|
+
|
925
995
|
def xy_insert
|
926
996
|
_index_now = @text.index('insert')
|
927
997
|
_rx, _ry, _width, _heigth = @text.bbox(_index_now);
|
@@ -946,15 +1016,24 @@ class AgEditor
|
|
946
1016
|
padx 0
|
947
1017
|
tabs $arcadia['conf']['editor.tabs']
|
948
1018
|
}
|
949
|
-
|
1019
|
+
_self_editor = self
|
950
1020
|
class << @text
|
1021
|
+
attr_accessor :editor
|
951
1022
|
def tag_adds(tag, *args)
|
952
1023
|
tk_send_without_enc('tag', 'add', _get_eval_enc_str(tag),
|
953
1024
|
*args.flatten)
|
954
1025
|
self
|
955
1026
|
end
|
1027
|
+
|
1028
|
+
def do_upper_case
|
1029
|
+
@editor.do_upper_case if @editor
|
1030
|
+
end
|
1031
|
+
|
1032
|
+
def do_lower_case
|
1033
|
+
@editor.do_lower_case if @editor
|
1034
|
+
end
|
956
1035
|
end
|
957
|
-
|
1036
|
+
@text.editor = self
|
958
1037
|
#do_tag_configure_global('debug')
|
959
1038
|
@text.tag_configure('eval','foreground' => 'yellow', 'background' =>'red','borderwidth'=>1, 'relief'=>'raised')
|
960
1039
|
@text.tag_configure('errline','borderwidth'=>1, 'relief'=>'groove')
|
@@ -1976,7 +2055,6 @@ class AgEditor
|
|
1976
2055
|
:font => "#{Arcadia.conf('menu.font')} bold",
|
1977
2056
|
:hidemargin => true
|
1978
2057
|
)
|
1979
|
-
|
1980
2058
|
|
1981
2059
|
#Arcadia.instance.main_menu.update_style(@pop_up)
|
1982
2060
|
@pop_up.insert('end',
|
@@ -2226,32 +2304,14 @@ class AgEditor
|
|
2226
2304
|
:command,
|
2227
2305
|
:label=>'Selection to uppercase',
|
2228
2306
|
:hidemargin => false,
|
2229
|
-
:command=> proc{
|
2230
|
-
_r = @text.tag_ranges('sel')
|
2231
|
-
if _r.length>0
|
2232
|
-
_text=@text.get(_r[0][0],_r[0][1])
|
2233
|
-
if _text.length > 0
|
2234
|
-
@text.delete(_r[0][0],_r[0][1])
|
2235
|
-
@text.insert(_r[0][0],_text.upcase)
|
2236
|
-
end
|
2237
|
-
end
|
2238
|
-
}
|
2307
|
+
:command=> proc{do_upper_case}
|
2239
2308
|
)
|
2240
2309
|
|
2241
2310
|
_sub_code.insert('end',
|
2242
2311
|
:command,
|
2243
2312
|
:label=>'Selection to downcase',
|
2244
2313
|
:hidemargin => false,
|
2245
|
-
:command=> proc{
|
2246
|
-
_r = @text.tag_ranges('sel')
|
2247
|
-
if _r.length>0
|
2248
|
-
_text=@text.get(_r[0][0],_r[0][1])
|
2249
|
-
if _text.length > 0
|
2250
|
-
@text.delete(_r[0][0],_r[0][1])
|
2251
|
-
@text.insert(_r[0][0],_text.downcase)
|
2252
|
-
end
|
2253
|
-
end
|
2254
|
-
}
|
2314
|
+
:command=> proc{do_lower_case}
|
2255
2315
|
)
|
2256
2316
|
|
2257
2317
|
|
@@ -2313,8 +2373,8 @@ class AgEditor
|
|
2313
2373
|
proc{|x,y|
|
2314
2374
|
_x = TkWinfo.pointerx(@text)
|
2315
2375
|
_y = TkWinfo.pointery(@text)
|
2316
|
-
|
2317
|
-
|
2376
|
+
#@pop_up.entryconfigure(1, 'label'=>File.basename(@file)) if @file
|
2377
|
+
@pop_up.entryconfigure(0, 'label'=>File.basename(@file)) if @file
|
2318
2378
|
@pop_up.popup(_x,_y)
|
2319
2379
|
},
|
2320
2380
|
"%x %y")
|
@@ -2342,7 +2402,55 @@ class AgEditor
|
|
2342
2402
|
def text_value
|
2343
2403
|
return @text.value
|
2344
2404
|
end
|
2405
|
+
|
2406
|
+
def text_selected
|
2407
|
+
_text = ''
|
2408
|
+
_r = @text.tag_ranges('sel')
|
2409
|
+
if _r.length>0
|
2410
|
+
_text=@text.get(_r[0][0],_r[0][1])
|
2411
|
+
end
|
2412
|
+
_text
|
2413
|
+
end
|
2414
|
+
|
2415
|
+
def text_replace_selected_with(_text_for_replace='')
|
2416
|
+
_r = @text.tag_ranges('sel')
|
2417
|
+
if _r.length>0
|
2418
|
+
bl = _r[0][0].split('.')[0].to_i
|
2419
|
+
@text.delete(_r[0][0],_r[0][1])
|
2420
|
+
@text.insert(_r[0][0],_text_for_replace)
|
2421
|
+
el = @text.index('insert').split('.')[0].to_i
|
2422
|
+
if highlighting
|
2423
|
+
reset_highlight(bl)
|
2424
|
+
rehighlightlines(bl,el,true)
|
2425
|
+
end
|
2426
|
+
end
|
2427
|
+
end
|
2428
|
+
|
2429
|
+
def text_replace_value_with(_text_for_replace='')
|
2430
|
+
pos_index = @text.index('insert')
|
2431
|
+
@text.delete('1.0','end')
|
2432
|
+
reset_highlight if @highlighting
|
2433
|
+
@text.insert('end',_text_for_replace)
|
2434
|
+
do_line_update
|
2435
|
+
@text.see(pos_index)
|
2436
|
+
@text.set_insert(pos_index)
|
2437
|
+
check_modify
|
2438
|
+
end
|
2439
|
+
|
2440
|
+
def do_upper_case
|
2441
|
+
_text = text_selected
|
2442
|
+
if _text.length > 0
|
2443
|
+
text_replace_selected_with(_text.upcase)
|
2444
|
+
end
|
2445
|
+
end
|
2345
2446
|
|
2447
|
+
def do_lower_case
|
2448
|
+
_text = text_selected
|
2449
|
+
if _text.length > 0
|
2450
|
+
text_replace_selected_with(_text.downcase)
|
2451
|
+
end
|
2452
|
+
end
|
2453
|
+
|
2346
2454
|
# vertical scrollbar : ON/OFF
|
2347
2455
|
def vscroll(mode)
|
2348
2456
|
st = TkGrid.info(@v_scroll)
|
@@ -2611,8 +2719,6 @@ class AgEditor
|
|
2611
2719
|
line_begin = line_begin_index.split('.')[0].to_i
|
2612
2720
|
line_end = @text.index('@0,'+TkWinfo.height(@text).to_s).split('.')[0].to_i + 1
|
2613
2721
|
wrap_on = @text.cget("wrap") != 'none'
|
2614
|
-
# breakpoint
|
2615
|
-
b = @controller.breakpoint_lines_on_file(@file)
|
2616
2722
|
if @highlighting
|
2617
2723
|
_zone_begin = ((line_begin) / @highlight_zone_length).to_i + 1
|
2618
2724
|
_zone_end = ((line_end) / @highlight_zone_length).to_i + 1
|
@@ -2628,52 +2734,55 @@ class AgEditor
|
|
2628
2734
|
@last_zone_begin = _zone_begin
|
2629
2735
|
@last_zone_end = _zone_end
|
2630
2736
|
end
|
2631
|
-
@
|
2632
|
-
|
2633
|
-
|
2634
|
-
|
2635
|
-
|
2636
|
-
|
2637
|
-
|
2638
|
-
|
2639
|
-
|
2640
|
-
end
|
2641
|
-
#@fm1
|
2642
|
-
_tags = Array.new
|
2643
|
-
for j in line_begin...real_line_end
|
2644
|
-
nline = j.to_s.rjust(line_end.to_s.length+2)
|
2645
|
-
_index = @text_line_num.index('end')
|
2646
|
-
_tags.clear
|
2647
|
-
if @highlighting && @is_line_bold[j]
|
2648
|
-
_tags << 'bold_case'
|
2737
|
+
if @line_numbers_visible
|
2738
|
+
# breakpoint
|
2739
|
+
b = @controller.breakpoint_lines_on_file(@file)
|
2740
|
+
|
2741
|
+
@text_line_num.delete('1.0','end')
|
2742
|
+
_rx, _ry, _width, _heigth = @text.bbox(line_begin_index);
|
2743
|
+
|
2744
|
+
if _ry && _ry < 0
|
2745
|
+
real_line_end = line_end + 1
|
2649
2746
|
else
|
2650
|
-
|
2747
|
+
real_line_end = line_end
|
2651
2748
|
end
|
2652
|
-
|
2653
|
-
|
2654
|
-
|
2655
|
-
|
2656
|
-
|
2657
|
-
|
2658
|
-
|
2659
|
-
|
2660
|
-
|
2661
|
-
|
2749
|
+
#@fm1
|
2750
|
+
_tags = Array.new
|
2751
|
+
for j in line_begin...real_line_end
|
2752
|
+
nline = j.to_s.rjust(line_end.to_s.length+2)
|
2753
|
+
_index = @text_line_num.index('end')
|
2754
|
+
_tags.clear
|
2755
|
+
if @highlighting && @is_line_bold[j]
|
2756
|
+
_tags << 'bold_case'
|
2757
|
+
else
|
2758
|
+
_tags << 'normal_case'
|
2759
|
+
end
|
2760
|
+
|
2761
|
+
if wrap_on
|
2762
|
+
w_rx_b, w_ry_b, w_width_b, w_heigth_b = @text.bbox("#{(j).to_s}.0");
|
2763
|
+
w_rx_e, w_ry_e, w_width_e, w_heigth_e = @text.bbox("#{(j).to_s}.0 lineend");
|
2764
|
+
if w_ry_e && w_ry_b
|
2765
|
+
delta = w_ry_e - w_ry_b
|
2766
|
+
if delta > 1
|
2767
|
+
_tag = "wrap_case_#{j}"
|
2768
|
+
@text_line_num.tag_configure(_tag, 'spacing3'=>delta)
|
2769
|
+
_tags << _tag
|
2770
|
+
end
|
2662
2771
|
end
|
2663
2772
|
end
|
2773
|
+
|
2774
|
+
@text_line_num.insert(_index, "#{nline}\n",_tags)
|
2775
|
+
if b.include?(j.to_s)
|
2776
|
+
add_tag_breakpoint(j)
|
2777
|
+
end
|
2664
2778
|
end
|
2665
|
-
|
2666
|
-
|
2667
|
-
if b.include?(j.to_s)
|
2668
|
-
add_tag_breakpoint(j)
|
2779
|
+
if _ry && _ry < 0
|
2780
|
+
@text_line_num.yview_scroll(_ry.abs+2,"pixels")
|
2669
2781
|
end
|
2670
|
-
|
2671
|
-
if _ry && _ry < 0
|
2672
|
-
@text_line_num.yview_scroll(_ry.abs+2,"pixels")
|
2782
|
+
resize_line_num
|
2673
2783
|
end
|
2674
2784
|
end
|
2675
2785
|
refresh_outline if Tk.focus==@text
|
2676
|
-
resize_line_num
|
2677
2786
|
end
|
2678
2787
|
|
2679
2788
|
def resize_line_num
|
@@ -2924,7 +3033,7 @@ class AgEditor
|
|
2924
3033
|
@text.set_insert(pos_index)
|
2925
3034
|
end
|
2926
3035
|
|
2927
|
-
def init_editing(_ext='rb'
|
3036
|
+
def init_editing(_ext='rb')
|
2928
3037
|
@is_ruby = _ext=='rb'|| _ext=='rbw'
|
2929
3038
|
@classbrowsing = @is_ruby
|
2930
3039
|
@lang_hash = @controller.languages_hash(_ext)
|
@@ -2937,7 +3046,7 @@ class AgEditor
|
|
2937
3046
|
# else
|
2938
3047
|
# @fm1 = AGTkVSplittedFrames.new(@page_frame,_w2)
|
2939
3048
|
# end
|
2940
|
-
@fm1 = AGTkVSplittedFrames.new(@page_frame,@page_frame,
|
3049
|
+
@fm1 = AGTkVSplittedFrames.new(@page_frame,@page_frame,0,5,false,false)
|
2941
3050
|
@fm1.splitter_frame.configure('relief'=>'flat')
|
2942
3051
|
initialize_text(@fm1.right_frame)
|
2943
3052
|
initialize_highlight(_ext)
|
@@ -2950,7 +3059,7 @@ class AgEditor
|
|
2950
3059
|
@outline.show
|
2951
3060
|
else
|
2952
3061
|
@outline=AgEditorOutline.new(self,@controller.frame(1).hinner_frame,@controller.outline_bar)
|
2953
|
-
|
3062
|
+
refresh
|
2954
3063
|
end
|
2955
3064
|
end
|
2956
3065
|
|
@@ -3325,8 +3434,60 @@ class AgMultiEditor < ArcadiaExt
|
|
3325
3434
|
@outline_bar = AgEditorOutlineToolbar.new(self.frame(1).hinner_frame, self)
|
3326
3435
|
create_find # this is the "find within current file" one
|
3327
3436
|
pop_up_menu
|
3328
|
-
|
3329
|
-
|
3437
|
+
@buffer_menu = frame.root.add_menu_button(self.name, 'files', DOCUMENT_COMBO_GIF, 'right', {'relief'=>:raised, 'borderwidth'=>1}).cget('menu')
|
3438
|
+
frame.root.add_sep(self.name, 1)
|
3439
|
+
frame.root.add_button(
|
3440
|
+
self.name,
|
3441
|
+
'close current',
|
3442
|
+
proc{Arcadia.process_event(CloseCurrentTabEvent.new(self))},
|
3443
|
+
CLOSE_DOCUMENT_GIF)
|
3444
|
+
end
|
3445
|
+
|
3446
|
+
def add_buffer_menu_item(_filename, is_file=true)
|
3447
|
+
index = 'end'
|
3448
|
+
i_end = @buffer_menu.index('end')
|
3449
|
+
if i_end
|
3450
|
+
0.upto(i_end){|j|
|
3451
|
+
type = @buffer_menu.menutype(j)
|
3452
|
+
if type != 'separator'
|
3453
|
+
label = @buffer_menu.entrycget(j,'label')
|
3454
|
+
if label > _filename
|
3455
|
+
index=j
|
3456
|
+
break
|
3457
|
+
end
|
3458
|
+
end
|
3459
|
+
}
|
3460
|
+
end
|
3461
|
+
|
3462
|
+
@buffer_menu.insert(index,:command,
|
3463
|
+
:label=>_filename,
|
3464
|
+
:image=> Arcadia.file_icon(_filename),
|
3465
|
+
:compound=>'left',
|
3466
|
+
:command=>proc{
|
3467
|
+
if is_file
|
3468
|
+
open_file(_filename)
|
3469
|
+
else
|
3470
|
+
open_buffer(tab_name(_filename))
|
3471
|
+
end
|
3472
|
+
},
|
3473
|
+
:hidemargin => true
|
3474
|
+
)
|
3475
|
+
end
|
3476
|
+
|
3477
|
+
def del_buffer_menu_item(_file)
|
3478
|
+
to_del = -1
|
3479
|
+
i_end = @buffer_menu.index('end')
|
3480
|
+
0.upto(i_end){|j|
|
3481
|
+
type = @buffer_menu.menutype(j)
|
3482
|
+
if type != 'separator'
|
3483
|
+
label = @buffer_menu.entrycget(j,'label')
|
3484
|
+
if label == _file
|
3485
|
+
to_del=j
|
3486
|
+
break
|
3487
|
+
end
|
3488
|
+
end
|
3489
|
+
}
|
3490
|
+
@buffer_menu.delete(to_del) if to_del != -1
|
3330
3491
|
end
|
3331
3492
|
|
3332
3493
|
def on_after_build(_event)
|
@@ -3643,11 +3804,24 @@ class AgMultiEditor < ArcadiaExt
|
|
3643
3804
|
when CloseCurrentTabEvent
|
3644
3805
|
close_raised
|
3645
3806
|
when PrettifyTextEvent
|
3646
|
-
require 'rbeautify.rb' # gem
|
3647
|
-
self.raised.save # so we can beautify it kludgely here...
|
3648
|
-
path = raised.file
|
3649
|
-
RBeautify.beautify_file(path)
|
3650
|
-
self.raised.reload
|
3807
|
+
# require 'rbeautify.rb' # gem
|
3808
|
+
# self.raised.save # so we can beautify it kludgely here...
|
3809
|
+
# path = raised.file
|
3810
|
+
# RBeautify.beautify_file(path)
|
3811
|
+
# self.raised.reload
|
3812
|
+
|
3813
|
+
rbea = RBeautify.beautify_string(raised.text_value_lines)
|
3814
|
+
if rbea && rbea.length >1 && !rbea[1]
|
3815
|
+
raised.text_replace_value_with(rbea[0])
|
3816
|
+
else
|
3817
|
+
msg = "Problems in prettify #{raised.tab_title}"
|
3818
|
+
Arcadia.dialog(self,
|
3819
|
+
'type'=>'ok',
|
3820
|
+
'title' => "(Arcadia) code prettify",
|
3821
|
+
'msg'=>msg,
|
3822
|
+
'level'=>'error')
|
3823
|
+
end
|
3824
|
+
|
3651
3825
|
when MoveBufferEvent
|
3652
3826
|
if _event.old_file && _event.new_file && editor_exist?(_event.old_file)
|
3653
3827
|
#close_file(_event.old_file)
|
@@ -3671,6 +3845,11 @@ class AgMultiEditor < ArcadiaExt
|
|
3671
3845
|
_e.find if _e
|
3672
3846
|
end
|
3673
3847
|
|
3848
|
+
def show_hide_current_line_numbers
|
3849
|
+
_e = raised
|
3850
|
+
_e.show_hide_line_numbers if _e
|
3851
|
+
end
|
3852
|
+
|
3674
3853
|
def on_finalize(_event)
|
3675
3854
|
@batch_files = true
|
3676
3855
|
_files =''
|
@@ -3856,6 +4035,10 @@ class AgMultiEditor < ArcadiaExt
|
|
3856
4035
|
@main_frame.enb.itemcget(page_name(_tab), 'text')
|
3857
4036
|
end
|
3858
4037
|
|
4038
|
+
def tab_title_by_tab_name(_tab_name)
|
4039
|
+
@main_frame.enb.itemcget(_tab_name, 'text')
|
4040
|
+
end
|
4041
|
+
|
3859
4042
|
def page_name(_page_frame)
|
3860
4043
|
TkWinfo.appname(_page_frame).sub('f','')
|
3861
4044
|
end
|
@@ -3961,7 +4144,10 @@ class AgMultiEditor < ArcadiaExt
|
|
3961
4144
|
end
|
3962
4145
|
end
|
3963
4146
|
if @arcadia.layout.headed?
|
3964
|
-
frame.
|
4147
|
+
if frame.root.title == frame.title
|
4148
|
+
frame.root.top_text(_new_caption)
|
4149
|
+
end
|
4150
|
+
frame.root.save_caption(frame.name, _new_caption)
|
3965
4151
|
#@arcadia.layout.domain(@arcadia['conf'][@name+'.frame'])['root'].top_text(_new_caption)
|
3966
4152
|
end
|
3967
4153
|
_title = @tabs_file[_name] != nil ? File.basename(@tabs_file[_name]) :_name
|
@@ -3983,7 +4169,7 @@ class AgMultiEditor < ArcadiaExt
|
|
3983
4169
|
|
3984
4170
|
def tab_name(_str="")
|
3985
4171
|
#_str = _str.downcase if is_windows?
|
3986
|
-
'ff'+_str.downcase.gsub("/","_").gsub(".","
|
4172
|
+
'ff'+_str.downcase.gsub("/","_").gsub(".","__").gsub(":","___").gsub("\\","____").gsub("*","_____")
|
3987
4173
|
end
|
3988
4174
|
|
3989
4175
|
def tab_file_name(_filename="")
|
@@ -4014,21 +4200,17 @@ class AgMultiEditor < ArcadiaExt
|
|
4014
4200
|
open_buffer(_tab_name)
|
4015
4201
|
else
|
4016
4202
|
@tabs_file[_tab_name]= _filename
|
4017
|
-
|
4018
|
-
open_buffer(_tab_name, _basefilename)
|
4019
|
-
else
|
4020
|
-
open_buffer(_tab_name, _basefilename,0)
|
4021
|
-
end
|
4203
|
+
open_buffer(_tab_name, _basefilename, _filename)
|
4022
4204
|
@tabs_editor[_tab_name].reset_highlight
|
4023
4205
|
begin
|
4024
4206
|
@tabs_editor[_tab_name].load_file(_filename)
|
4025
4207
|
rescue RuntimeError => e
|
4026
4208
|
p "RuntimeError : #{e.message}"
|
4027
|
-
close_editor(@tabs_editor[_tab_name])
|
4209
|
+
close_editor(@tabs_editor[_tab_name], true)
|
4028
4210
|
end
|
4029
4211
|
end
|
4030
4212
|
|
4031
|
-
if _text_index != nil && _text_index != '1.0'
|
4213
|
+
if _text_index != nil && _text_index != '1.0' && @tabs_editor[_tab_name]
|
4032
4214
|
@tabs_editor[_tab_name].text_see(_text_index)
|
4033
4215
|
@tabs_editor[_tab_name].mark_selected(_text_index) if _mark_selected
|
4034
4216
|
end
|
@@ -4037,11 +4219,12 @@ class AgMultiEditor < ArcadiaExt
|
|
4037
4219
|
end
|
4038
4220
|
|
4039
4221
|
|
4040
|
-
def open_buffer(_buffer_name = nil, _title = nil,
|
4222
|
+
def open_buffer(_buffer_name = nil, _title = nil, _filename=nil)
|
4041
4223
|
_index = @main_frame.enb.index(_buffer_name)
|
4042
4224
|
if _buffer_name == nil
|
4043
|
-
_buffer_name = tab_name('new')
|
4044
4225
|
_title_new = '*new'
|
4226
|
+
_buffer_name = tab_name(_title_new)
|
4227
|
+
#_buffer_name = tab_name('new')
|
4045
4228
|
end
|
4046
4229
|
|
4047
4230
|
if _index != -1
|
@@ -4051,7 +4234,8 @@ class AgMultiEditor < ArcadiaExt
|
|
4051
4234
|
_n = 1
|
4052
4235
|
while @main_frame.enb.index(_buffer_name) != -1
|
4053
4236
|
_title_new = '*new'+_n.to_s
|
4054
|
-
_buffer_name = tab_name(
|
4237
|
+
_buffer_name = tab_name(_title_new)
|
4238
|
+
#_buffer_name = tab_name('new')+_n.to_s
|
4055
4239
|
_n =_n+1
|
4056
4240
|
end
|
4057
4241
|
if _title == nil
|
@@ -4064,10 +4248,15 @@ class AgMultiEditor < ArcadiaExt
|
|
4064
4248
|
'foreground'=> Arcadia.style("tabpanel.foreground"),
|
4065
4249
|
'raisecmd'=>proc{do_buffer_raise(_buffer_name, _title)}
|
4066
4250
|
)
|
4251
|
+
if _filename
|
4252
|
+
add_buffer_menu_item(_filename)
|
4253
|
+
else
|
4254
|
+
add_buffer_menu_item(_title, false)
|
4255
|
+
end
|
4067
4256
|
_e = AgEditor.new(self, _tab)
|
4068
4257
|
ext = Arcadia.file_extension(_title)
|
4069
4258
|
ext='rb' if ext.nil?
|
4070
|
-
_e.init_editing(ext
|
4259
|
+
_e.init_editing(ext)
|
4071
4260
|
_e.text.set_focus
|
4072
4261
|
#@tabs_file[_buffer_name]= nil
|
4073
4262
|
@tabs_editor[_buffer_name]=_e
|
@@ -4132,39 +4321,26 @@ class AgMultiEditor < ArcadiaExt
|
|
4132
4321
|
def close_editor(_editor, _force=false)
|
4133
4322
|
if _force || can_close_editor?(_editor)
|
4134
4323
|
_editor.destroy_outline
|
4135
|
-
|
4324
|
+
close_buffer(_editor.page_frame)
|
4136
4325
|
else
|
4137
4326
|
return
|
4138
4327
|
end
|
4139
4328
|
end
|
4140
4329
|
|
4141
|
-
|
4142
|
-
# def close_editor(_editor, _mod=true)
|
4143
|
-
# if ((_mod)&&(_editor.modified?))
|
4144
|
-
# _message = @main_frame.enb.itemcget(page_name(_editor.page_frame), 'text')+"\n modified. Save?"
|
4145
|
-
# _r = TkDialog2.new('message'=>_message, 'buttons'=>['Ok','No','Cancel']).show()
|
4146
|
-
# if _r == 0
|
4147
|
-
# _editor.save
|
4148
|
-
# elsif _r == 1
|
4149
|
-
# close_tab(_editor.page_frame)
|
4150
|
-
# elsif _r == 2
|
4151
|
-
# return
|
4152
|
-
# end
|
4153
|
-
# else
|
4154
|
-
# close_tab(_editor.page_frame)
|
4155
|
-
# end
|
4156
|
-
# #EditorContract.instance.file_closed(self, 'file'=>_editor.file)
|
4157
|
-
# end
|
4158
|
-
|
4159
|
-
def close_tab(_page_frame)
|
4330
|
+
def close_buffer(_page_frame)
|
4160
4331
|
_name = page_name(_page_frame)
|
4332
|
+
if @tabs_editor[_name] && @tabs_editor[_name].file
|
4333
|
+
del_buffer_menu_item(@tabs_editor[_name].file)
|
4334
|
+
else
|
4335
|
+
del_buffer_menu_item(tab_title_by_tab_name(_name))
|
4336
|
+
end
|
4161
4337
|
@tabs_editor.delete(_name)
|
4162
4338
|
_index = @main_frame.enb.index(_name)
|
4163
4339
|
@main_frame.enb.delete(_name)
|
4164
4340
|
if !@main_frame.enb.pages.empty?
|
4165
4341
|
@main_frame.enb.raise(@main_frame.enb.pages[_index-1]) if TkWinfo.mapped?(@main_frame.enb)
|
4166
4342
|
else
|
4167
|
-
frame.top_text('') if TkWinfo.mapped?(frame.hinner_frame)
|
4343
|
+
frame.root.top_text('') if TkWinfo.mapped?(frame.hinner_frame)
|
4168
4344
|
end
|
4169
4345
|
end
|
4170
4346
|
|