author | Claus Gittinger <cg@exept.de> |
Fri, 26 Apr 2013 14:53:56 +0200 | |
changeset 4572 | e3099486ba5a |
parent 4571 | 71dcd3c025bc |
child 4579 | 3a5a72358a0a |
permissions | -rw-r--r-- |
0 | 1 |
" |
5 | 2 |
COPYRIGHT (c) 1989 by Claus Gittinger |
4500 | 3 |
All Rights Reserved |
0 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
2191 | 12 |
"{ Package: 'stx:libwidg' }" |
13 |
||
0 | 14 |
ListView subclass:#TextView |
3394 | 15 |
instanceVariableNames:'selectionStartLine selectionStartCol selectionEndLine |
16 |
selectionEndCol clickPos clickStartLine clickStartCol clickLine |
|
17 |
clickCol clickCount expandingTop wordStartCol wordStartLine |
|
18 |
wordEndCol wordEndLine selectionFgColor selectionBgColor |
|
19 |
selectStyle directoryForFileDialog defaultFileNameForFileDialog |
|
20 |
externalEncoding contentsWasSaved searchAction lastSearchPattern |
|
3964 | 21 |
lastSearchWasMatch lastSearchIgnoredCase lastSearchDirection |
4399 | 22 |
lastSearchWasVariableSearch parenthesisSpecification dropSource |
23 |
dragIsActive saveAction st80SelectMode searchBarActionBlock' |
|
3394 | 24 |
classVariableNames:'DefaultViewBackground DefaultSelectionForegroundColor |
25 |
DefaultSelectionBackgroundColor |
|
26 |
DefaultAlternativeSelectionForegroundColor |
|
27 |
DefaultAlternativeSelectionBackgroundColor MatchDelayTime |
|
28 |
WordSelectCatchesBlanks LastSearchPatterns |
|
29 |
NumRememberedSearchPatterns LastSearchIgnoredCase |
|
3577 | 30 |
LastSearchWasMatch DefaultParenthesisSpecification' |
3394 | 31 |
poolDictionaries:'' |
32 |
category:'Views-Text' |
|
0 | 33 |
! |
34 |
||
844
03e45d817dce
fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
35 |
!TextView class methodsFor:'documentation'! |
0 | 36 |
|
38 | 37 |
copyright |
38 |
" |
|
39 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
4500 | 40 |
All Rights Reserved |
38 | 41 |
|
42 |
This software is furnished under a license and may be used |
|
43 |
only in accordance with the terms of that license and with the |
|
44 |
inclusion of the above copyright notice. This software may not |
|
45 |
be provided or otherwise made available to, or used by, any |
|
46 |
other person. No title to or ownership of the software is |
|
47 |
hereby transferred. |
|
48 |
" |
|
49 |
! |
|
50 |
||
22 | 51 |
documentation |
0 | 52 |
" |
120 | 53 |
a view for readOnly text - this class adds selections to a simple list. |
38 | 54 |
The text is not editable and there is no cursor. |
120 | 55 |
Use TextViews for readonly text, EditTextView for editable text. |
0 | 56 |
|
309
b5c9d68e95e1
new tabbing scheme (asking via #canTab); new focus change (passing explicit to showFocus/noFocus);
Claus Gittinger <cg@exept.de>
parents:
292
diff
changeset
|
57 |
Please read the historic notice in the ListView class. |
b5c9d68e95e1
new tabbing scheme (asking via #canTab); new focus change (passing explicit to showFocus/noFocus);
Claus Gittinger <cg@exept.de>
parents:
292
diff
changeset
|
58 |
|
586 | 59 |
[Instance variables:] |
0 | 60 |
|
120 | 61 |
selectionStartLine <Number> the line of the selection start (or nil) |
62 |
selectionStartCol <Number> the col of the selection start |
|
63 |
selectionEndLine <Number> the line of the selection end |
|
64 |
selectionEndCol <Number> the col of the selection end |
|
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
65 |
|
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
66 |
clickStartLine <Number> temporary - remember where select operation started |
120 | 67 |
clickStartCol <Number> temporary |
68 |
clickLine <Number> temporary |
|
69 |
clickCol <Number> temporary |
|
70 |
clickCount <Number> temporary |
|
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
71 |
expandingTop <Boolean> temporary - for expandSelection |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
72 |
|
120 | 73 |
selectionFgColor <Color> color used to draw selections |
74 |
selectionBgColor <Color> color used to draw selections |
|
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
75 |
|
120 | 76 |
selectStyle <Symbol> how words are selected |
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
77 |
|
120 | 78 |
directoryForFileDialog <nil|pathName> directory where save dialog should start |
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
79 |
|
120 | 80 |
contentsWasSaved <Boolean> set to true, whenever saved in a file |
77 | 81 |
|
1322
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
82 |
externalEncoding <Symbol|nil> external encoding, used when text is saved to |
4500 | 83 |
a file. Usually something like |
84 |
#jis7, #euc, #sjis etc. |
|
85 |
(currently only passed down from the |
|
86 |
fileBrowser) |
|
2588 | 87 |
|
88 |
dropSource <DropSource> drag operation descriptor or nil (dragging disabled) |
|
4500 | 89 |
dragIsActive <Boolean> true, drag operation is activated |
90 |
||
91 |
searchAction <Block> an autosearch action; typically set by the browser. |
|
92 |
Will be used as default when searchFwd/searchBwd is |
|
93 |
pressed. If the searchPattern is changed, no autosearch |
|
94 |
action will be executed. |
|
3981 | 95 |
|
96 |
searchBarActionBlock <Block> search action block for embedded search |
|
4500 | 97 |
panel. Used as second chance for searchFwd/bwd |
1322
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
98 |
|
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
99 |
[class variables:] |
4500 | 100 |
ST80Selections <Boolean> enables ST80 style doubleclick behavior |
101 |
(right after opening parenthesis, right before |
|
102 |
closing parenthesis, at begin of a line |
|
103 |
at begin of text) |
|
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
104 |
|
586 | 105 |
[StyleSheet parameters:] |
77 | 106 |
|
2600 | 107 |
textView.background defaults to viewBackground |
108 |
textView.ViewFont defaults to textFont |
|
109 |
||
110 |
text.st80Selections st80 behavior (click on char after parent or quote) |
|
111 |
||
112 |
text.selectionForegroundColor defaults to textBackgroundColor |
|
113 |
text.selectionBackgroundColor defaults to textForegroundColor |
|
114 |
||
115 |
text.alternativeSelectionForegroundColor pasted text (i.e. paste will not replace) |
|
4500 | 116 |
defaults to selectionForegroundColor |
2600 | 117 |
text.alternativeSelectionBackgroundColor pasted text (i.e. paste will not replace) |
4500 | 118 |
defaults to selectionBackgroundColor |
586 | 119 |
[author:] |
4500 | 120 |
Claus Gittinger |
586 | 121 |
|
122 |
[see also:] |
|
4500 | 123 |
EditTextView CodeView Workspace |
0 | 124 |
" |
1014
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
125 |
! |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
126 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
127 |
examples |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
128 |
" |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
129 |
although textViews (and instances of subclasses) are mostly used |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
130 |
as components (in the fileBrowser, the browser, the launcher etc.), |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
131 |
they may also be opened as a textEditor; |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
132 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
133 |
open a (readonly) textView on some information text: |
4500 | 134 |
[exBegin] |
135 |
TextView |
|
136 |
openWith:'read this' |
|
137 |
title:'demonstration' |
|
138 |
[exEnd] |
|
1014
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
139 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
140 |
the same, but open it modal: |
4500 | 141 |
[exBegin] |
142 |
TextView |
|
143 |
openModalWith:'read this first' |
|
144 |
title:'demonstration' |
|
145 |
[exEnd] |
|
1014
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
146 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
147 |
|
1016 | 148 |
open it modal (but editable) on some text: |
149 |
(must accept before closing) |
|
150 |
This is somewhat kludgy - when closed, the view has already |
|
151 |
nilled its link to the model. Therefore, the accept must be |
|
152 |
done 'manually' below. |
|
153 |
However, usually an applicationModel is installed as the |
|
154 |
editor-topViews application. This would get a closeRequest, |
|
155 |
where it could handle things. |
|
4500 | 156 |
[exBegin] |
157 |
|m textView| |
|
158 |
||
159 |
m := 'read this first' asValue. |
|
160 |
textView := EditTextView openModalOnModel:m. |
|
161 |
textView modified ifTrue:[ |
|
162 |
(self confirm:'text was not accepted - do it now ?') |
|
163 |
ifTrue:[ |
|
164 |
m value:textView contents |
|
165 |
] |
|
166 |
]. |
|
167 |
||
168 |
Transcript showCR:m value. |
|
169 |
[exEnd] |
|
1014
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
170 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
171 |
|
1016 | 172 |
open a textEditor on some file: |
4500 | 173 |
[exBegin] |
174 |
EditTextView openOn:'Makefile' |
|
175 |
[exEnd] |
|
1014
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
176 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
177 |
" |
1016 | 178 |
|
0 | 179 |
! ! |
180 |
||
844
03e45d817dce
fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
181 |
!TextView class methodsFor:'instance creation'! |
119 | 182 |
|
183 |
on:aModel aspect:aspect change:change menu:menu initialSelection:initial |
|
184 |
"for ST-80 compatibility" |
|
185 |
||
4500 | 186 |
^ (self new) |
187 |
on:aModel |
|
188 |
aspect:aspect |
|
189 |
list:aspect |
|
190 |
change:change |
|
191 |
menu:menu |
|
192 |
initialSelection:initial |
|
3280 | 193 |
! |
194 |
||
195 |
with:someText |
|
4500 | 196 |
^ (self new) |
197 |
contents:someText |
|
119 | 198 |
! ! |
199 |
||
2553
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
200 |
!TextView class methodsFor:'class initialization'! |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
201 |
|
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
202 |
initialize |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
203 |
DefaultParenthesisSpecification isNil ifTrue:[ |
4500 | 204 |
DefaultParenthesisSpecification := IdentityDictionary new. |
205 |
DefaultParenthesisSpecification at:#open put:#( $( $[ ${ "$> $<") . |
|
206 |
DefaultParenthesisSpecification at:#close put:#( $) $] $} "$> $<"). |
|
207 |
DefaultParenthesisSpecification at:#ignore put:#( $' $" '$[' '$]' '${' '$)' ). |
|
208 |
DefaultParenthesisSpecification at:#eolComment put:'"/'. "/ sigh - must be 2 characters |
|
2553
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
209 |
]. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
210 |
! ! |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
211 |
|
844
03e45d817dce
fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
212 |
!TextView class methodsFor:'defaults'! |
38 | 213 |
|
896 | 214 |
defaultIcon |
1195 | 215 |
"return the default icon if started as a topView" |
216 |
||
3496 | 217 |
<resource: #programImage> |
1195 | 218 |
<resource: #style (#ICON #ICON_FILE)> |
219 |
||
220 |
|nm i| |
|
1143 | 221 |
|
1146 | 222 |
i := self classResources at:'ICON' default:nil. |
1143 | 223 |
i isNil ifTrue:[ |
4500 | 224 |
nm := ClassResources at:'ICON_FILE' default:'Editor.xbm'. |
225 |
i := Smalltalk imageFromFileNamed:nm forClass:self. |
|
1195 | 226 |
]. |
227 |
i notNil ifTrue:[ |
|
4500 | 228 |
i := i onDevice:Display |
1143 | 229 |
]. |
230 |
^ i |
|
231 |
||
3496 | 232 |
"Modified: / 17-09-2007 / 11:36:29 / cg" |
896 | 233 |
! |
234 |
||
910
0446030ce647
Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents:
906
diff
changeset
|
235 |
defaultMenuMessage |
0446030ce647
Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents:
906
diff
changeset
|
236 |
"This message is the default yo be sent to the menuHolder to get a menu" |
0446030ce647
Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents:
906
diff
changeset
|
237 |
|
0446030ce647
Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents:
906
diff
changeset
|
238 |
^ #editMenu |
0446030ce647
Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents:
906
diff
changeset
|
239 |
|
0446030ce647
Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents:
906
diff
changeset
|
240 |
"Created: 3.1.1997 / 01:52:21 / stefan" |
0446030ce647
Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents:
906
diff
changeset
|
241 |
! |
0446030ce647
Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents:
906
diff
changeset
|
242 |
|
4254
eaf0560ba269
added: #defaultParenthesisSpecification
Claus Gittinger <cg@exept.de>
parents:
4234
diff
changeset
|
243 |
defaultParenthesisSpecification |
eaf0560ba269
added: #defaultParenthesisSpecification
Claus Gittinger <cg@exept.de>
parents:
4234
diff
changeset
|
244 |
^ DefaultParenthesisSpecification |
eaf0560ba269
added: #defaultParenthesisSpecification
Claus Gittinger <cg@exept.de>
parents:
4234
diff
changeset
|
245 |
|
eaf0560ba269
added: #defaultParenthesisSpecification
Claus Gittinger <cg@exept.de>
parents:
4234
diff
changeset
|
246 |
"Created: / 14-06-2011 / 14:00:59 / cg" |
eaf0560ba269
added: #defaultParenthesisSpecification
Claus Gittinger <cg@exept.de>
parents:
4234
diff
changeset
|
247 |
! |
eaf0560ba269
added: #defaultParenthesisSpecification
Claus Gittinger <cg@exept.de>
parents:
4234
diff
changeset
|
248 |
|
2306 | 249 |
defaultSelectionBackgroundColor |
250 |
"return the default selection background color" |
|
251 |
||
252 |
^DefaultSelectionBackgroundColor |
|
253 |
! |
|
254 |
||
255 |
defaultSelectionForegroundColor |
|
256 |
"return the default selection foreground color" |
|
257 |
||
258 |
^DefaultSelectionForegroundColor |
|
259 |
! |
|
260 |
||
1477
2d4b6115e2c5
redefine #defaultViewBackgroundColor for the spec class
tz
parents:
1476
diff
changeset
|
261 |
defaultViewBackgroundColor |
2d4b6115e2c5
redefine #defaultViewBackgroundColor for the spec class
tz
parents:
1476
diff
changeset
|
262 |
"return the default view background" |
2d4b6115e2c5
redefine #defaultViewBackgroundColor for the spec class
tz
parents:
1476
diff
changeset
|
263 |
|
2d4b6115e2c5
redefine #defaultViewBackgroundColor for the spec class
tz
parents:
1476
diff
changeset
|
264 |
^DefaultViewBackground |
2d4b6115e2c5
redefine #defaultViewBackgroundColor for the spec class
tz
parents:
1476
diff
changeset
|
265 |
! |
2d4b6115e2c5
redefine #defaultViewBackgroundColor for the spec class
tz
parents:
1476
diff
changeset
|
266 |
|
3226 | 267 |
lastSearchIgnoredCase |
268 |
^ LastSearchIgnoredCase |
|
269 |
! |
|
270 |
||
3577 | 271 |
lastSearchWasMatch |
272 |
^ LastSearchWasMatch |
|
273 |
! |
|
274 |
||
1729 | 275 |
st80SelectMode |
3308 | 276 |
^ UserPreferences current st80SelectMode |
277 |
||
278 |
"Modified: / 03-07-2006 / 16:26:44 / cg" |
|
1729 | 279 |
! |
280 |
||
281 |
st80SelectMode:aBoolean |
|
3308 | 282 |
UserPreferences current st80SelectMode:aBoolean |
283 |
||
284 |
"Created: / 07-01-1999 / 13:35:24 / cg" |
|
285 |
"Modified: / 03-07-2006 / 16:27:01 / cg" |
|
1729 | 286 |
! |
287 |
||
59 | 288 |
updateStyleCache |
441
e170bca66a78
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
428
diff
changeset
|
289 |
"extract values from the styleSheet and cache them in class variables" |
e170bca66a78
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
428
diff
changeset
|
290 |
|
1353 | 291 |
<resource: #style (#'textView.background' |
4500 | 292 |
#'text.selectionForegroundColor' |
293 |
#'text.selectionBackgroundColor' |
|
294 |
#'text.alternativeSelectionForegroundColor' |
|
295 |
#'text.alternativeSelectionBackgroundColor' |
|
296 |
#'textView.font' |
|
297 |
#'text.wordSelectCatchesBlanks' |
|
298 |
#'text.st80Selections')> |
|
441
e170bca66a78
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
428
diff
changeset
|
299 |
|
1353 | 300 |
DefaultViewBackground := StyleSheet colorAt:'textView.background' default:White. |
1380 | 301 |
DefaultSelectionForegroundColor := StyleSheet colorAt:'text.selectionForegroundColor'. |
302 |
DefaultSelectionBackgroundColor := StyleSheet colorAt:'text.selectionBackgroundColor'. |
|
2630
f3c95e73f862
for now: do not use alternative selection color
Claus Gittinger <cg@exept.de>
parents:
2604
diff
changeset
|
303 |
"/ DefaultAlternativeSelectionForegroundColor := StyleSheet colorAt:'text.alternativeSelectionForegroundColor' default:DefaultSelectionForegroundColor. |
f3c95e73f862
for now: do not use alternative selection color
Claus Gittinger <cg@exept.de>
parents:
2604
diff
changeset
|
304 |
"/ DefaultAlternativeSelectionBackgroundColor := StyleSheet colorAt:'text.alternativeSelectionBackgroundColor' default:DefaultSelectionBackgroundColor. |
f3c95e73f862
for now: do not use alternative selection color
Claus Gittinger <cg@exept.de>
parents:
2604
diff
changeset
|
305 |
DefaultAlternativeSelectionForegroundColor := DefaultSelectionForegroundColor. |
f3c95e73f862
for now: do not use alternative selection color
Claus Gittinger <cg@exept.de>
parents:
2604
diff
changeset
|
306 |
DefaultAlternativeSelectionBackgroundColor := DefaultSelectionBackgroundColor. |
1353 | 307 |
DefaultFont := StyleSheet fontAt:'textView.font'. |
504 | 308 |
MatchDelayTime := 0.6. |
1380 | 309 |
WordSelectCatchesBlanks := StyleSheet at:'text.wordSelectCatchesBlanks' default:false. |
3308 | 310 |
|
311 |
"Modified: / 03-07-2006 / 16:29:42 / cg" |
|
0 | 312 |
! ! |
313 |
||
4462
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
314 |
!TextView class methodsFor:'help specs'! |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
315 |
|
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
316 |
flyByHelpSpec |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
317 |
"This resource specification was automatically generated |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
318 |
by the UIHelpTool of ST/X." |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
319 |
|
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
320 |
"Do not manually edit this!! If it is corrupted, |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
321 |
the UIHelpTool may not be able to read the specification." |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
322 |
|
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
323 |
" |
4500 | 324 |
UIHelpTool openOnClass:TextView |
4462
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
325 |
" |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
326 |
|
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
327 |
<resource: #help> |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
328 |
|
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
329 |
^ Dictionary new addPairsFrom:#( |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
330 |
|
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
331 |
#matchSearch |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
332 |
'Search for a pattern (glob) as opposed to a direct string search' |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
333 |
|
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
334 |
#searchCaseSensitive |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
335 |
'Care for case differences' |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
336 |
|
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
337 |
#searchFullWord |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
338 |
'Search only for full words (ignore occurrences as substring)' |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
339 |
|
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
340 |
#searchPattern |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
341 |
'String or match-pattern to be searched' |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
342 |
|
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
343 |
#searchVariable |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
344 |
'Search only for that variable name (ignore occurrences in other contexts)' |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
345 |
|
4485 | 346 |
#replaceText |
347 |
'If checked, matching text is replaced by this (everywhere)' |
|
348 |
||
349 |
#selectLines |
|
350 |
'If checked, lines containing the matched string are selected.' |
|
351 |
||
4462
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
352 |
) |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
353 |
! ! |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
354 |
|
2201
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
355 |
!TextView class methodsFor:'interface specs'! |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
356 |
|
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
357 |
searchDialogSpec |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
358 |
"This resource specification was automatically generated |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
359 |
by the UIPainter of ST/X." |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
360 |
|
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
361 |
"Do not manually edit this!! If it is corrupted, |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
362 |
the UIPainter may not be able to read the specification." |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
363 |
|
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
364 |
" |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
365 |
UIPainter new openOnClass:TextView andSelector:#searchDialogSpec |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
366 |
" |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
367 |
|
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
368 |
<resource: #canvas> |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
369 |
|
4500 | 370 |
^ |
3577 | 371 |
#(FullSpec |
4500 | 372 |
name: searchDialogSpec |
373 |
window: |
|
3577 | 374 |
(WindowSpec |
4500 | 375 |
label: 'String search' |
376 |
name: 'String search' |
|
377 |
min: (Point 10 10) |
|
378 |
max: (Point 1280 1024) |
|
379 |
bounds: (Rectangle 0 0 302 242) |
|
380 |
) |
|
381 |
component: |
|
3577 | 382 |
(SpecCollection |
4500 | 383 |
collection: ( |
384 |
(LabelSpec |
|
385 |
label: 'SearchPattern:' |
|
386 |
name: 'label' |
|
387 |
layout: (LayoutFrame 1 0.0 3 0 -1 1.0 20 0) |
|
388 |
level: 0 |
|
389 |
translateLabel: true |
|
390 |
adjust: left |
|
391 |
) |
|
392 |
(ComboBoxSpec |
|
393 |
name: 'patternComboBox' |
|
394 |
layout: (LayoutFrame 2 0.0 26 0 -2 1.0 48 0) |
|
395 |
activeHelpKey: searchPattern |
|
396 |
tabable: true |
|
397 |
model: searchPattern |
|
398 |
immediateAccept: false |
|
399 |
acceptOnLeave: true |
|
400 |
acceptOnReturn: true |
|
401 |
acceptOnTab: true |
|
402 |
acceptOnLostFocus: true |
|
403 |
acceptOnPointerLeave: false |
|
404 |
autoSelectInitialText: true |
|
405 |
comboList: patternList |
|
406 |
) |
|
407 |
(VerticalPanelViewSpec |
|
408 |
name: 'VerticalPanel1' |
|
409 |
layout: (LayoutFrame 0 0.0 52 0 0 1.0 -30 1) |
|
410 |
horizontalLayout: fit |
|
411 |
verticalLayout: top |
|
412 |
component: |
|
413 |
(SpecCollection |
|
414 |
collection: ( |
|
415 |
(CheckBoxSpec |
|
416 |
label: 'Case Sensitive' |
|
417 |
name: 'ignoreCaseCheckBox' |
|
418 |
activeHelpKey: searchCaseSensitive |
|
419 |
level: 0 |
|
420 |
tabable: true |
|
421 |
model: caseSensitive |
|
422 |
translateLabel: true |
|
423 |
extent: (Point 302 24) |
|
424 |
) |
|
425 |
(CheckBoxSpec |
|
426 |
label: 'Match (forward only)' |
|
427 |
name: 'matchCheckBox' |
|
428 |
activeHelpKey: matchSearch |
|
429 |
level: 0 |
|
430 |
tabable: true |
|
431 |
model: match |
|
432 |
translateLabel: true |
|
433 |
extent: (Point 302 24) |
|
434 |
) |
|
435 |
(CheckBoxSpec |
|
436 |
label: 'Search Full Words' |
|
437 |
name: 'CheckBox2' |
|
438 |
activeHelpKey: searchFullWord |
|
439 |
level: 0 |
|
440 |
enableChannel: searchFullWordEnabled |
|
441 |
tabable: true |
|
442 |
model: searchFullWord |
|
443 |
translateLabel: true |
|
444 |
extent: (Point 302 24) |
|
445 |
) |
|
446 |
(CheckBoxSpec |
|
447 |
label: 'Variable Only' |
|
448 |
name: 'CheckBox1' |
|
449 |
activeHelpKey: searchVariable |
|
450 |
level: 0 |
|
451 |
visibilityChannel: searchVariableVisible |
|
452 |
enableChannel: searchVariableEnabled |
|
453 |
tabable: true |
|
454 |
model: searchVariable |
|
455 |
translateLabel: true |
|
456 |
labelChannel: stringWithVariableUnderCursorHolder |
|
457 |
extent: (Point 302 24) |
|
458 |
) |
|
459 |
(CheckBoxSpec |
|
460 |
label: 'Select Lines' |
|
461 |
name: 'CheckBox3' |
|
462 |
activeHelpKey: selectLines |
|
463 |
level: 0 |
|
464 |
initiallyInvisible: true |
|
465 |
tabable: true |
|
466 |
model: selectLines |
|
467 |
translateLabel: true |
|
468 |
extent: (Point 302 24) |
|
469 |
) |
|
470 |
(ViewSpec |
|
471 |
name: 'Box1' |
|
472 |
component: |
|
473 |
(SpecCollection |
|
474 |
collection: ( |
|
475 |
(CheckBoxSpec |
|
476 |
label: 'Global Replace With:' |
|
477 |
name: 'CheckBox4' |
|
478 |
layout: (LayoutFrame 0 0 0 0 149 0 23 0) |
|
479 |
activeHelpKey: replaceText |
|
480 |
level: 0 |
|
481 |
enableChannel: replaceEnabled |
|
482 |
tabable: true |
|
483 |
model: replaceBoolean |
|
484 |
translateLabel: true |
|
485 |
) |
|
486 |
(InputFieldSpec |
|
487 |
name: 'EntryField1' |
|
488 |
layout: (LayoutFrame 150 0 0 0 -2 1 22 0) |
|
489 |
activeHelpKey: replaceText |
|
490 |
visibilityChannel: replaceBoolean |
|
491 |
enableChannel: replaceBoolean |
|
492 |
model: replaceTextHolder |
|
493 |
acceptOnReturn: true |
|
494 |
acceptOnTab: true |
|
495 |
acceptOnPointerLeave: true |
|
496 |
) |
|
497 |
) |
|
498 |
||
499 |
) |
|
500 |
extent: (Point 302 24) |
|
501 |
) |
|
502 |
) |
|
503 |
||
504 |
) |
|
505 |
) |
|
506 |
(HorizontalPanelViewSpec |
|
507 |
name: 'horizontalPanelView' |
|
508 |
layout: (LayoutFrame 0 0.0 -28 1.0 0 1.0 0 1.0) |
|
509 |
level: 0 |
|
510 |
horizontalLayout: fitSpace |
|
511 |
verticalLayout: center |
|
512 |
horizontalSpace: 3 |
|
513 |
verticalSpace: 3 |
|
514 |
ignoreInvisibleComponents: true |
|
515 |
reverseOrderIfOKAtLeft: true |
|
516 |
component: |
|
517 |
(SpecCollection |
|
518 |
collection: ( |
|
519 |
(ActionButtonSpec |
|
520 |
label: 'Cancel' |
|
521 |
name: 'cancelButton' |
|
522 |
level: 2 |
|
523 |
translateLabel: true |
|
524 |
tabable: true |
|
525 |
model: cancel |
|
526 |
extent: (Point 96 21) |
|
527 |
) |
|
528 |
(ActionButtonSpec |
|
529 |
label: 'Prev' |
|
530 |
name: 'prevButton' |
|
531 |
level: 2 |
|
532 |
translateLabel: true |
|
533 |
tabable: true |
|
534 |
model: prevAction |
|
535 |
extent: (Point 96 21) |
|
536 |
) |
|
537 |
(ActionButtonSpec |
|
538 |
label: 'Next' |
|
539 |
name: 'nextButton' |
|
540 |
level: 2 |
|
541 |
borderWidth: 1 |
|
542 |
translateLabel: true |
|
543 |
tabable: true |
|
544 |
model: nextAction |
|
545 |
isDefault: true |
|
546 |
extent: (Point 96 21) |
|
547 |
) |
|
548 |
) |
|
549 |
||
550 |
) |
|
551 |
keepSpaceForOSXResizeHandleH: true |
|
552 |
) |
|
553 |
) |
|
554 |
||
555 |
) |
|
2201
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
556 |
) |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
557 |
! ! |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
558 |
|
844
03e45d817dce
fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
559 |
!TextView class methodsFor:'startup'! |
121 | 560 |
|
248 | 561 |
open |
562 |
"start an empty TextView" |
|
563 |
||
564 |
^ self openWith:nil |
|
0 | 565 |
! |
566 |
||
1014
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
567 |
openModalOnModel:aModel |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
568 |
"start a textView on a model; return the textView" |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
569 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
570 |
|textView| |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
571 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
572 |
textView := self setupForModel:aModel. |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
573 |
textView topView openModal. |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
574 |
^ textView |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
575 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
576 |
"Created: 14.2.1997 / 15:24:12 / cg" |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
577 |
! |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
578 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
579 |
openModalWith:aString |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
580 |
"start a textView with aString as initial contents" |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
581 |
|
4500 | 582 |
^ self openModalWith:aString title:nil |
1014
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
583 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
584 |
" |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
585 |
TextView openModalWith:'some text' |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
586 |
EditTextView openModalWith:'some text' |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
587 |
" |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
588 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
589 |
"Created: 14.2.1997 / 15:19:04 / cg" |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
590 |
! |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
591 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
592 |
openModalWith:aString title:aTitle |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
593 |
"start a textView with aString as initial contents. Return the textView." |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
594 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
595 |
|textView| |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
596 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
597 |
textView := self setupWith:aString title:aTitle. |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
598 |
textView topView openModal. |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
599 |
^ textView |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
600 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
601 |
" |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
602 |
TextView openModalWith:'some text' title:'testing' |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
603 |
EditTextView openModalWith:'some text' title:'testing' |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
604 |
" |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
605 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
606 |
"Modified: 9.9.1996 / 19:32:29 / cg" |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
607 |
"Created: 14.2.1997 / 15:19:18 / cg" |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
608 |
! |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
609 |
|
248 | 610 |
openOn:aFileName |
830
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
611 |
"start a textView on a file; return the textView" |
0 | 612 |
|
830
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
613 |
|textView| |
248 | 614 |
|
1014
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
615 |
textView := self setupForFile:aFileName. |
830
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
616 |
textView topView open. |
248 | 617 |
^ textView |
618 |
||
619 |
" |
|
830
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
620 |
TextView openOn:'../../doc/overview.doc' |
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
621 |
EditTextView openOn:'../../doc/overview.doc' |
248 | 622 |
" |
830
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
623 |
|
1014
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
624 |
"Modified: 14.2.1997 / 15:21:51 / cg" |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
625 |
! |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
626 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
627 |
openOnModel:aModel |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
628 |
"start a textView on a model; return the textView" |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
629 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
630 |
|textView| |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
631 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
632 |
textView := self setupForModel:aModel. |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
633 |
textView topView open. |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
634 |
^ textView |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
635 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
636 |
"Created: 14.2.1997 / 15:23:36 / cg" |
0 | 637 |
! |
638 |
||
1100 | 639 |
openWith:aStringOrStringCollection |
640 |
"start a textView with aStringOrStringCollection as initial contents" |
|
641 |
||
4500 | 642 |
^ self openWith:aStringOrStringCollection selected:false |
0 | 643 |
|
248 | 644 |
" |
645 |
TextView openWith:'some text' |
|
646 |
EditTextView openWith:'some text' |
|
2794 | 647 |
Workspace openWith:'some text' |
248 | 648 |
" |
119 | 649 |
|
248 | 650 |
"Created: 10.12.1995 / 17:41:32 / cg" |
1100 | 651 |
"Modified: 5.3.1997 / 15:37:19 / cg" |
126 | 652 |
! |
653 |
||
2793 | 654 |
openWith:aStringOrStringCollection selected:selectedBoolean |
4500 | 655 |
"start a textView with aStringOrStringCollection as initial (optionally selected) contents. |
2793 | 656 |
Return the textView." |
657 |
||
658 |
|textView| |
|
659 |
||
660 |
textView := self setupEmpty. |
|
661 |
textView contents:aStringOrStringCollection selected:selectedBoolean. |
|
662 |
textView topView open. |
|
663 |
^ textView |
|
664 |
||
665 |
" |
|
666 |
TextView openWith:'some text' selected:true |
|
667 |
EditTextView openWith:'some text' selected:false |
|
668 |
" |
|
669 |
! |
|
670 |
||
1100 | 671 |
openWith:aStringOrStringCollection title:aTitle |
672 |
"start a textView with aStringOrStringCollection as initial contents. Return the textView." |
|
248 | 673 |
|
830
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
674 |
|textView| |
248 | 675 |
|
1100 | 676 |
textView := self setupWith:aStringOrStringCollection title:aTitle. |
830
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
677 |
textView topView open. |
248 | 678 |
^ textView |
679 |
||
680 |
" |
|
681 |
TextView openWith:'some text' title:'testing' |
|
682 |
EditTextView openWith:'some text' title:'testing' |
|
683 |
" |
|
126 | 684 |
|
248 | 685 |
"Created: 10.12.1995 / 17:40:02 / cg" |
1100 | 686 |
"Modified: 5.3.1997 / 15:37:26 / cg" |
248 | 687 |
! |
688 |
||
689 |
setupEmpty |
|
690 |
"create a textview in a topview, with horizontal and |
|
691 |
vertical scrollbars - a helper for #startWith: and #startOn:" |
|
692 |
||
693 |
|top frame label| |
|
694 |
||
695 |
label := 'unnamed'. |
|
896 | 696 |
top := StandardSystemView label:label icon:self defaultIcon. |
248 | 697 |
|
4500 | 698 |
frame := HVScrollableView |
699 |
for:self |
|
700 |
miniScrollerH:true miniScrollerV:false |
|
701 |
in:top. |
|
248 | 702 |
frame origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
703 |
^ frame scrolledView |
|
896 | 704 |
|
705 |
"Modified: 23.5.1965 / 14:12:32 / cg" |
|
830
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
706 |
! |
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
707 |
|
1014
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
708 |
setupForFile:aFileName |
830
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
709 |
"setup a textView on a file; return the textView" |
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
710 |
|
3417 | 711 |
|textView f| |
830
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
712 |
|
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
713 |
textView := self setupEmpty. |
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
714 |
aFileName notNil ifTrue:[ |
4500 | 715 |
textView setupForFile:aFileName. |
830
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
716 |
]. |
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
717 |
|
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
718 |
^ textView |
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
719 |
|
3417 | 720 |
"Created: / 14-02-1997 / 15:21:43 / cg" |
721 |
"Modified: / 25-10-2006 / 14:46:54 / cg" |
|
1014
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
722 |
! |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
723 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
724 |
setupForModel:aModel |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
725 |
"setup a textView on a model; return the textView" |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
726 |
|
2793 | 727 |
|textView| |
1014
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
728 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
729 |
textView := self setupEmpty. |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
730 |
textView model:aModel. |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
731 |
^ textView |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
732 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
733 |
"Created: 14.2.1997 / 15:22:42 / cg" |
830
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
734 |
! |
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
735 |
|
1100 | 736 |
setupWith:aStringOrStringCollection title:aTitle |
737 |
"setup a textView with aStringOrStringCollection as initial contents in a topView" |
|
830
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
738 |
|
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
739 |
|top textView| |
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
740 |
|
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
741 |
textView := self setupEmpty. |
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
742 |
top := textView topView. |
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
743 |
aTitle notNil ifTrue:[top label:aTitle]. |
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
744 |
|
1100 | 745 |
aStringOrStringCollection notNil ifTrue:[ |
4500 | 746 |
textView contents:aStringOrStringCollection |
830
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
747 |
]. |
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
748 |
|
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
749 |
^ textView |
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
750 |
|
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
751 |
"Created: 9.9.1996 / 19:31:22 / cg" |
1100 | 752 |
"Modified: 5.3.1997 / 15:37:37 / cg" |
119 | 753 |
! ! |
754 |
||
2744 | 755 |
!TextView methodsFor:'Compatibility-ST80'! |
1584
9f3875dc341e
added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents:
1545
diff
changeset
|
756 |
|
2291 | 757 |
displaySelection:aBoolean |
758 |
"ST-80 compatibility: ignored here." |
|
759 |
||
760 |
! |
|
761 |
||
2118
f9d8bfb35b03
added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2109
diff
changeset
|
762 |
editText:someText |
f9d8bfb35b03
added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2109
diff
changeset
|
763 |
"ST-80 compatibility: set the edited text." |
f9d8bfb35b03
added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2109
diff
changeset
|
764 |
|
f9d8bfb35b03
added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2109
diff
changeset
|
765 |
self contents:someText |
f9d8bfb35b03
added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2109
diff
changeset
|
766 |
|
f9d8bfb35b03
added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2109
diff
changeset
|
767 |
"Created: / 5.2.2000 / 17:06:18 / cg" |
f9d8bfb35b03
added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2109
diff
changeset
|
768 |
! |
f9d8bfb35b03
added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2109
diff
changeset
|
769 |
|
2291 | 770 |
selectAndScroll |
771 |
"ST-80 compatibility: ignored here." |
|
772 |
||
773 |
! |
|
774 |
||
4554 | 775 |
selectFrom:startPos to:endPos |
776 |
"change the selection given two character positions." |
|
777 |
||
778 |
self selectFromCharacterPosition:startPos to:endPos |
|
779 |
! |
|
780 |
||
1584
9f3875dc341e
added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents:
1545
diff
changeset
|
781 |
selectionStartIndex |
9f3875dc341e
added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents:
1545
diff
changeset
|
782 |
"ST-80 compatibility: return the selections start character position." |
9f3875dc341e
added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents:
1545
diff
changeset
|
783 |
|
9f3875dc341e
added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents:
1545
diff
changeset
|
784 |
^ self characterPositionOfSelection |
9f3875dc341e
added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents:
1545
diff
changeset
|
785 |
|
9f3875dc341e
added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents:
1545
diff
changeset
|
786 |
"Created: / 19.6.1998 / 00:21:44 / cg" |
9f3875dc341e
added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents:
1545
diff
changeset
|
787 |
! |
9f3875dc341e
added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents:
1545
diff
changeset
|
788 |
|
9f3875dc341e
added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents:
1545
diff
changeset
|
789 |
selectionStopIndex |
2052 | 790 |
"ST-80 compatibility: return the character position of |
791 |
the character right after the selection." |
|
792 |
||
2109
ccad6daad477
selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents:
2100
diff
changeset
|
793 |
|idx| |
ccad6daad477
selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents:
2100
diff
changeset
|
794 |
|
ccad6daad477
selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents:
2100
diff
changeset
|
795 |
idx := self characterPositionOfSelectionEnd. |
ccad6daad477
selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents:
2100
diff
changeset
|
796 |
idx == 0 ifTrue:[^ 0]. |
ccad6daad477
selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents:
2100
diff
changeset
|
797 |
^ idx + 1 |
1584
9f3875dc341e
added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents:
1545
diff
changeset
|
798 |
|
9f3875dc341e
added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents:
1545
diff
changeset
|
799 |
"Created: / 19.6.1998 / 00:22:08 / cg" |
9f3875dc341e
added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents:
1545
diff
changeset
|
800 |
! ! |
9f3875dc341e
added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents:
1545
diff
changeset
|
801 |
|
0 | 802 |
!TextView methodsFor:'accessing'! |
803 |
||
2916 | 804 |
characterEncoding:encodingArg |
2856
bc6bb86d4d2e
character encodings - first attempt
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
805 |
"define how the contents is encoded internally. |
2916 | 806 |
This should normally never be required, as ST/X now assumes |
807 |
unicode (of which iso8859-1 is a subset) encoding. |
|
808 |
The possibility to change the characterEncoding is provided as |
|
809 |
a backward compatibility hook for programs which want to use |
|
810 |
another encoding internally." |
|
811 |
||
812 |
|encodingSymOrNil| |
|
813 |
||
4500 | 814 |
encodingSymOrNil := encodingArg isNil |
815 |
ifTrue:[#'iso10646-1'] |
|
816 |
ifFalse:[encodingArg asSymbol]. |
|
2916 | 817 |
|
818 |
characterEncoding ~~ encodingSymOrNil ifTrue:[ |
|
4500 | 819 |
"/ TODO: reencode contents if required. |
820 |
(list size ~~ 0 |
|
821 |
and:[ list contains:[:line | line size > 0]]) ifTrue:[ |
|
822 |
(self confirm:'Your text may need to be re-coded - this is not yet supported.\\Proceed ?') |
|
823 |
ifFalse:[^ self]. |
|
824 |
]. |
|
825 |
characterEncoding := encodingSymOrNil. |
|
2916 | 826 |
]. |
4361
646cd7c5513e
comment/format in: #characterEncoding:
Claus Gittinger <cg@exept.de>
parents:
4321
diff
changeset
|
827 |
|
646cd7c5513e
comment/format in: #characterEncoding:
Claus Gittinger <cg@exept.de>
parents:
4321
diff
changeset
|
828 |
"Modified (format): / 25-01-2012 / 00:28:27 / cg" |
2856
bc6bb86d4d2e
character encodings - first attempt
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
829 |
! |
bc6bb86d4d2e
character encodings - first attempt
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
830 |
|
0 | 831 |
characterPositionOfSelection |
1303 | 832 |
"return the character index of the first character in the selection. |
833 |
Returns 0 if there is no selection." |
|
834 |
||
835 |
selectionStartLine isNil ifTrue:[^ 0]. |
|
0 | 836 |
^ self characterPositionOfLine:selectionStartLine |
4500 | 837 |
col:selectionStartCol |
1303 | 838 |
|
839 |
"Modified: 14.8.1997 / 16:35:37 / cg" |
|
840 |
! |
|
841 |
||
842 |
characterPositionOfSelectionEnd |
|
843 |
"return the character index of the last character in the selection. |
|
844 |
Returns 0 if there is no selection." |
|
845 |
||
846 |
selectionStartLine isNil ifTrue:[^ 0]. |
|
847 |
^ self characterPositionOfLine:selectionEndLine |
|
4500 | 848 |
col:selectionEndCol |
1303 | 849 |
|
850 |
"Created: 14.8.1997 / 16:35:24 / cg" |
|
851 |
"Modified: 14.8.1997 / 16:35:45 / cg" |
|
0 | 852 |
! |
853 |
||
854 |
contentsWasSaved |
|
855 |
"return true, if the contents was saved (by a save action), |
|
856 |
false if not (or was modified again after the last save)." |
|
857 |
||
858 |
^ contentsWasSaved |
|
859 |
! |
|
860 |
||
3214 | 861 |
contentsWasSaved:aBoolean |
862 |
contentsWasSaved := aBoolean |
|
863 |
! |
|
864 |
||
3212
c14cadfd6752
remember last-saved fileName
Claus Gittinger <cg@exept.de>
parents:
3202
diff
changeset
|
865 |
defaultFileNameForFileDialog |
c14cadfd6752
remember last-saved fileName
Claus Gittinger <cg@exept.de>
parents:
3202
diff
changeset
|
866 |
"return the default fileName to use for the save-box" |
c14cadfd6752
remember last-saved fileName
Claus Gittinger <cg@exept.de>
parents:
3202
diff
changeset
|
867 |
|
4500 | 868 |
^ defaultFileNameForFileDialog |
3212
c14cadfd6752
remember last-saved fileName
Claus Gittinger <cg@exept.de>
parents:
3202
diff
changeset
|
869 |
! |
c14cadfd6752
remember last-saved fileName
Claus Gittinger <cg@exept.de>
parents:
3202
diff
changeset
|
870 |
|
1003
b1affa654489
added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents:
997
diff
changeset
|
871 |
defaultFileNameForFileDialog:aBaseName |
b1affa654489
added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents:
997
diff
changeset
|
872 |
"define the default fileName to use for the save-box" |
b1affa654489
added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents:
997
diff
changeset
|
873 |
|
b1affa654489
added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents:
997
diff
changeset
|
874 |
defaultFileNameForFileDialog := aBaseName |
b1affa654489
added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents:
997
diff
changeset
|
875 |
|
b1affa654489
added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents:
997
diff
changeset
|
876 |
"Created: 13.2.1997 / 18:29:53 / cg" |
b1affa654489
added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents:
997
diff
changeset
|
877 |
! |
b1affa654489
added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents:
997
diff
changeset
|
878 |
|
248 | 879 |
directoryForFileDialog:aDirectory |
1003
b1affa654489
added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents:
997
diff
changeset
|
880 |
"define the default directory to use for save-box" |
248 | 881 |
|
882 |
directoryForFileDialog := aDirectory |
|
1003
b1affa654489
added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents:
997
diff
changeset
|
883 |
|
b1affa654489
added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents:
997
diff
changeset
|
884 |
"Modified: 13.2.1997 / 18:30:01 / cg" |
1255
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
885 |
! |
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
886 |
|
2941 | 887 |
externalEncoding |
888 |
"return the encoding used when the contents is saved via the 'save / save as' dialog. |
|
889 |
This is (currently only) passed down from the fileBrowser, |
|
890 |
and required when utf8/japanese/chinese/korean text is edited. |
|
891 |
(encoding is something like #utf8 #'iso8859-5' #euc, #sjis, #jis7, #gb, #big5 or #ksc). |
|
892 |
Notice: this only affects the external representation of the text." |
|
893 |
||
894 |
^ externalEncoding |
|
895 |
! |
|
896 |
||
1255
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
897 |
externalEncoding:encodingSymOrNil |
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
898 |
"define how the contents should be encoded when saved |
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
899 |
via the 'save / save as' dialog. |
2916 | 900 |
This is (currently only) passed down from the fileBrowser, |
901 |
and required when utf8/japanese/chinese/korean text is edited. |
|
902 |
(encoding is something like #utf8 #'iso8859-5' #euc, #sjis, #jis7, #gb, #big5 or #ksc). |
|
903 |
Notice: this only affects the external representation of the text." |
|
1255
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
904 |
|
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
905 |
externalEncoding := encodingSymOrNil |
2553
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
906 |
! |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
907 |
|
2581 | 908 |
parenthesisSpecification |
909 |
"return the value of the instance variable 'parenthesisSpecification' (automatically generated)" |
|
910 |
||
911 |
^ parenthesisSpecification |
|
912 |
! |
|
913 |
||
2553
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
914 |
parenthesisSpecification:aDictionary |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
915 |
"set the dictionary which specifies which characters are opening, which are closing |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
916 |
and which are ignored characters w.r.t. parenthesis matching. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
917 |
See the classes initialize method for a useful value." |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
918 |
|
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
919 |
parenthesisSpecification := aDictionary |
2836
de07d386cfe8
allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents:
2835
diff
changeset
|
920 |
! |
de07d386cfe8
allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents:
2835
diff
changeset
|
921 |
|
de07d386cfe8
allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents:
2835
diff
changeset
|
922 |
saveAction:something |
de07d386cfe8
allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents:
2835
diff
changeset
|
923 |
saveAction := something. |
3581 | 924 |
! |
925 |
||
3981 | 926 |
searchBarActionBlock |
927 |
^ searchBarActionBlock |
|
3581 | 928 |
! |
929 |
||
3981 | 930 |
searchBarActionBlock:something |
931 |
searchBarActionBlock := something. |
|
599
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
932 |
! ! |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
933 |
|
3787 | 934 |
!TextView methodsFor:'accessing-behavior'! |
935 |
||
4485 | 936 |
isReadOnly |
937 |
^ true |
|
938 |
! |
|
939 |
||
3787 | 940 |
readOnly:aBoolean |
941 |
"for protocol compatibility with editTextViews, |
|
942 |
but actually ignored" |
|
943 |
! ! |
|
944 |
||
599
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
945 |
!TextView methodsFor:'accessing-contents'! |
248 | 946 |
|
2791 | 947 |
contents:newContents selected:selectedBoolean |
948 |
self contents:newContents. |
|
949 |
selectedBoolean ifTrue:[ |
|
4500 | 950 |
list size == 1 ifTrue:[ |
951 |
self selectFromLine:1 col:1 toLine:1 col:(list at:1) size |
|
952 |
] ifFalse:[ |
|
953 |
self selectAll |
|
954 |
] |
|
2791 | 955 |
] |
956 |
||
957 |
" |
|
958 |
|w| |
|
959 |
||
960 |
w := Workspace new open. |
|
961 |
w contents:'Hello world' selected:true. |
|
962 |
" |
|
963 |
! |
|
964 |
||
0 | 965 |
fromFile:aFileName |
966 |
"take contents from a named file" |
|
3724 | 967 |
<resource: #obsolete> |
0 | 968 |
|
3417 | 969 |
self obsoleteMethodWarning. |
970 |
^ self loadTextFile:aFileName. |
|
971 |
||
972 |
"Modified: / 25-10-2006 / 14:47:35 / cg" |
|
0 | 973 |
! |
974 |
||
248 | 975 |
list:something |
976 |
"set the displayed contents (a collection of strings) |
|
977 |
with redraw. |
|
599
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
978 |
Redefined since changing the contents implies deselect" |
0 | 979 |
|
980 |
self unselect. |
|
248 | 981 |
super list:something |
0 | 982 |
|
599
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
983 |
"Modified: 29.4.1996 / 12:13:24 / cg" |
0 | 984 |
! |
985 |
||
3417 | 986 |
loadTextFile:aFileName |
987 |
"take contents from a named file" |
|
988 |
||
989 |
|f| |
|
990 |
||
991 |
f := aFileName asFilename. |
|
992 |
self directoryForFileDialog:(f directoryName). |
|
993 |
self contents:(f contents) |
|
994 |
||
995 |
"Created: / 25-10-2006 / 14:44:01 / cg" |
|
996 |
! |
|
997 |
||
1476
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
998 |
setContents:something |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
999 |
"set the contents (either a string or a Collection of strings) |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
1000 |
dont change the position (i.e. do not scroll) or the selection." |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
1001 |
|
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
1002 |
|selStartLine selStartCol selEndLine selEndCol selStyle| |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
1003 |
|
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
1004 |
selStartLine := selectionStartLine. |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
1005 |
selStartCol := selectionStartCol. |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
1006 |
selEndLine := selectionEndLine. |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
1007 |
selEndCol := selectionEndCol. |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
1008 |
selStyle := selectStyle. |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
1009 |
|
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
1010 |
super setContents:something. |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
1011 |
|
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
1012 |
selStartLine notNil ifTrue:[ |
4500 | 1013 |
self |
1014 |
selectFromLine:selStartLine col:selStartCol |
|
1015 |
toLine:selEndLine col:selEndCol. |
|
1016 |
selectStyle := selStyle |
|
1476
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
1017 |
]. |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
1018 |
|
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
1019 |
|
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
1020 |
"Modified: / 31.3.1998 / 23:33:21 / cg" |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
1021 |
! |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
1022 |
|
248 | 1023 |
setList:something |
1024 |
"set the displayed contents (a collection of strings) |
|
1025 |
without redraw. |
|
1026 |
Redefined since changing contents implies deselect" |
|
0 | 1027 |
|
248 | 1028 |
self unselect. |
1029 |
super setList:something |
|
599
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
1030 |
! |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
1031 |
|
3417 | 1032 |
setupForFile:aFileName |
1033 |
"take contents from a named file" |
|
1034 |
||
1035 |
|baseName| |
|
1036 |
||
1037 |
self loadTextFile:aFileName. |
|
1038 |
aFileName notNil ifTrue:[ |
|
4500 | 1039 |
baseName := aFileName asFilename baseName. |
1040 |
self topView label:baseName. |
|
1041 |
self defaultFileNameForFileDialog:baseName. |
|
3417 | 1042 |
]. |
1043 |
||
1044 |
"Created: / 25-10-2006 / 14:47:13 / cg" |
|
1045 |
! |
|
1046 |
||
1487
4a9bfda28991
added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1477
diff
changeset
|
1047 |
text |
4a9bfda28991
added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1477
diff
changeset
|
1048 |
"for ST80 compatibility" |
4a9bfda28991
added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1477
diff
changeset
|
1049 |
|
4a9bfda28991
added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1477
diff
changeset
|
1050 |
^ self contents |
4a9bfda28991
added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1477
diff
changeset
|
1051 |
|
4a9bfda28991
added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1477
diff
changeset
|
1052 |
"Created: / 19.4.1998 / 12:53:10 / cg" |
4a9bfda28991
added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1477
diff
changeset
|
1053 |
! |
4a9bfda28991
added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1477
diff
changeset
|
1054 |
|
599
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
1055 |
wordAtLine:selectLine col:selectCol do:aFiveArgBlock |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
1056 |
"find word boundaries, evaluate the block argument with those. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
1057 |
A helper for nextWord and selectWord functions." |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
1058 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
1059 |
|beginCol endCol endLine thisCharacter flag| |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
1060 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
1061 |
flag := #word. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
1062 |
beginCol := selectCol. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
1063 |
endCol := selectCol. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
1064 |
endLine := selectLine. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
1065 |
thisCharacter := self characterAtLine:selectLine col:beginCol. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
1066 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
1067 |
beginCol := self findBeginOfWordAtLine:selectLine col:selectCol. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
1068 |
endCol := self findEndOfWordAtLine:selectLine col:selectCol. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
1069 |
endCol == 0 ifTrue:[ |
4500 | 1070 |
endLine := selectLine + 1 |
599
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
1071 |
]. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
1072 |
|
1750 | 1073 |
"is the initial character within a word ?" |
599
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
1074 |
(wordCheck value:thisCharacter) ifTrue:[ |
4500 | 1075 |
" |
1076 |
try to catch a blank ... |
|
1077 |
" |
|
1078 |
||
1079 |
WordSelectCatchesBlanks ifTrue:[ |
|
1080 |
((beginCol == 1) |
|
1081 |
or:[(self characterAtLine:selectLine col:(beginCol - 1)) |
|
1082 |
~~ Character space]) ifTrue:[ |
|
1083 |
((self characterAtLine:selectLine col:(endCol + 1)) |
|
1084 |
== Character space) ifTrue:[ |
|
1085 |
endCol := endCol + 1. |
|
1086 |
flag := #wordRight |
|
1087 |
] |
|
1088 |
] ifFalse:[ |
|
1089 |
beginCol := beginCol - 1. |
|
1090 |
flag := #wordLeft |
|
1091 |
]. |
|
1092 |
]. |
|
599
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
1093 |
]. |
4500 | 1094 |
aFiveArgBlock value:selectLine |
1095 |
value:beginCol |
|
1096 |
value:endLine |
|
1097 |
value:endCol |
|
1098 |
value:flag |
|
599
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
1099 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
1100 |
"Modified: 18.3.1996 / 17:31:04 / cg" |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
1101 |
! ! |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
1102 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
1103 |
!TextView methodsFor:'accessing-look'! |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
1104 |
|
2027
0bde8408361a
accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
1105 |
selectionBackgroundColor |
0bde8408361a
accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
1106 |
"return the selection-background color." |
0bde8408361a
accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
1107 |
|
0bde8408361a
accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
1108 |
^ selectionBgColor |
0bde8408361a
accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
1109 |
! |
0bde8408361a
accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
1110 |
|
0bde8408361a
accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
1111 |
selectionForegroundColor |
0bde8408361a
accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
1112 |
"return the selection-foreground color." |
0bde8408361a
accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
1113 |
|
0bde8408361a
accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
1114 |
^ selectionFgColor |
0bde8408361a
accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
1115 |
! |
0bde8408361a
accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
1116 |
|
599
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
1117 |
selectionForegroundColor:color1 backgroundColor:color2 |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
1118 |
"set both the selection-foreground and cursor background colors. |
4500 | 1119 |
The default is defined by the styleSheet; |
599
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
1120 |
typically black-on-green for color displays and white-on-black for b&w displays." |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
1121 |
|
1987 | 1122 |
selectionFgColor := color1 onDevice:device. |
1123 |
selectionBgColor := color2 onDevice:device. |
|
2913
bdf4fb09cfc0
invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents:
2900
diff
changeset
|
1124 |
self hasSelection ifTrue:[ |
4500 | 1125 |
self invalidate |
599
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
1126 |
] |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
1127 |
|
722
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
715
diff
changeset
|
1128 |
"Modified: 29.5.1996 / 16:22:15 / cg" |
0 | 1129 |
! ! |
1130 |
||
248 | 1131 |
!TextView methodsFor:'accessing-mvc'! |
0 | 1132 |
|
248 | 1133 |
on:aModel aspect:aspectSym list:listSym change:changeSym menu:menuSym initialSelection:initial |
599
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
1134 |
"set all of model, aspect, listMessage, changeSymbol, menySymbol |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
1135 |
and selection. Added for ST-80 compatibility" |
0 | 1136 |
|
4500 | 1137 |
aspectSym notNil ifTrue:[aspectMsg := aspectSym. |
1138 |
listMsg isNil ifTrue:[listMsg := aspectSym]]. |
|
248 | 1139 |
changeSym notNil ifTrue:[changeMsg := changeSym]. |
1140 |
listSym notNil ifTrue:[listMsg := listSym]. |
|
1141 |
menuSym notNil ifTrue:[menuMsg := menuSym]. |
|
1142 |
"/ initial notNil ifTrue:[initialSelectionMsg := initial]. |
|
1143 |
self model:aModel. |
|
0 | 1144 |
|
824
f62922fcfa5d
Send #getListFromModel when setting #model:
Stefan Vogel <sv@exept.de>
parents:
813
diff
changeset
|
1145 |
"Modified: 15.8.1996 / 12:52:54 / stefan" |
906 | 1146 |
"Modified: 2.1.1997 / 16:11:28 / cg" |
0 | 1147 |
! ! |
1148 |
||
2588 | 1149 |
!TextView methodsFor:'drag & drop'! |
1150 |
||
1151 |
allowDrag:aBoolean |
|
1152 |
"enable/disable dragging support |
|
1153 |
" |
|
1154 |
aBoolean ifFalse:[ |
|
4500 | 1155 |
dropSource := nil. |
2588 | 1156 |
] ifTrue:[ |
4500 | 1157 |
dropSource isNil ifTrue:[ |
1158 |
dropSource := DropSource |
|
1159 |
receiver:self |
|
1160 |
argument:nil |
|
1161 |
dropObjectSelector:#collectionOfDragObjects |
|
1162 |
displayObjectSelector:nil |
|
1163 |
] |
|
2588 | 1164 |
]. |
1165 |
! |
|
1166 |
||
1167 |
canDrag |
|
4368 | 1168 |
"returns true if dragging is enabled" |
1169 |
||
1170 |
^ dropSource notNil and:[ self hasSelection ] |
|
1171 |
||
1172 |
"Modified (comment): / 12-02-2012 / 08:37:21 / cg" |
|
2588 | 1173 |
! |
1174 |
||
1175 |
collectionOfDragObjects |
|
1176 |
"returns collection of dragable objects assigned to selection |
|
1177 |
Here, by default, a collection of text-dragObjects is generated; |
|
1178 |
however, if a dragObjectConverter is defined, that one gets a chance |
|
1179 |
to convert as appropriate. |
|
1180 |
" |
|
1181 |
|selection| |
|
1182 |
||
1183 |
selection := self selection. |
|
1184 |
||
1185 |
selection size == 0 ifTrue:[^ nil]. |
|
1186 |
^ Array with:(DropObject newText:selection). |
|
1187 |
! |
|
1188 |
||
1189 |
dropSource |
|
3245 | 1190 |
"returns the dropSource or nil" |
4500 | 1191 |
|
2588 | 1192 |
^ dropSource |
1193 |
! |
|
1194 |
||
4500 | 1195 |
dropSource:aDropSourceOrNil |
3245 | 1196 |
"set the dropSource or nil" |
4500 | 1197 |
|
2588 | 1198 |
dropSource := aDropSourceOrNil. |
1199 |
! ! |
|
1200 |
||
2881 | 1201 |
!TextView methodsFor:'encoding'! |
1202 |
||
1203 |
validateFontEncodingFor:newEncoding ask:ask |
|
1204 |
"if required, query user if he/she wants to change to another font, |
|
1205 |
which is able to display text encoded as specified by newEncoding" |
|
1206 |
||
4500 | 1207 |
|fontsEncoding msg filter f defaultFont pref matchingFonts |
2881 | 1208 |
matchingFamilyFonts matchingFamilyFaceFonts matchingFamilyFaceStyleFonts |
1209 |
matchingFamilyFaceStyleSizeFonts| |
|
1210 |
||
1211 |
fontsEncoding := font encoding. |
|
1212 |
||
1213 |
pref := FontDescription preferredFontEncodingFor:newEncoding. |
|
1214 |
||
1215 |
(pref match:fontsEncoding) ifTrue:[ |
|
4500 | 1216 |
^ self |
2881 | 1217 |
]. |
1218 |
(CharacterEncoder isEncoding:pref subSetOf:fontsEncoding) ifTrue:[ |
|
4500 | 1219 |
^ self |
2881 | 1220 |
]. |
1221 |
||
1222 |
filter := [:f | |coding| |
|
4500 | 1223 |
(coding := f encoding) notNil |
1224 |
and:[pref match:coding]]. |
|
2881 | 1225 |
|
1226 |
device flushListOfAvailableFonts. |
|
1227 |
matchingFonts := device listOfAvailableFonts select:filter. |
|
1228 |
matchingFamilyFonts := matchingFonts select:[:f | f family = font family]. |
|
1229 |
matchingFamilyFaceFonts := matchingFamilyFonts select:[:f | f face = font face]. |
|
1230 |
matchingFamilyFaceStyleFonts := matchingFamilyFaceFonts select:[:f | f style = font style]. |
|
1231 |
matchingFamilyFaceStyleSizeFonts := matchingFamilyFaceStyleFonts select:[:f | f size = font size]. |
|
1232 |
matchingFamilyFaceStyleSizeFonts size > 0 ifTrue:[ |
|
4500 | 1233 |
defaultFont := matchingFamilyFaceStyleSizeFonts first |
2881 | 1234 |
] ifFalse:[ |
4500 | 1235 |
matchingFamilyFaceStyleFonts size > 0 ifTrue:[ |
1236 |
defaultFont := matchingFamilyFaceStyleFonts first |
|
1237 |
] ifFalse:[ |
|
1238 |
matchingFamilyFaceFonts size > 0 ifTrue:[ |
|
1239 |
defaultFont := matchingFamilyFaceFonts first |
|
1240 |
] ifFalse:[ |
|
1241 |
matchingFamilyFonts size > 0 ifTrue:[ |
|
1242 |
defaultFont := matchingFamilyFonts first |
|
1243 |
] ifFalse:[ |
|
1244 |
matchingFonts size > 0 ifTrue:[ |
|
1245 |
defaultFont := matchingFonts first |
|
1246 |
]. |
|
1247 |
]. |
|
1248 |
]. |
|
1249 |
]. |
|
2881 | 1250 |
]. |
1251 |
||
1252 |
defaultFont isNil ifTrue:[ |
|
4500 | 1253 |
defaultFont isNil ifTrue:[ |
1254 |
self warn:'Your display does not seem to provide any ' , newEncoding allBold , ' encoded font.\\Please select an appropriate font (iso10646-Unicode recommended)'. |
|
1255 |
pref := #'iso10646-1'. |
|
1256 |
] |
|
2881 | 1257 |
]. |
1258 |
||
2916 | 1259 |
msg := 'Switch to a %1 encoded font ?'. |
3189 | 1260 |
(ask not or:[self confirm:(resources stringWithCRs:msg with:pref)]) |
2881 | 1261 |
ifTrue:[ |
4500 | 1262 |
self withWaitCursorDo:[ |
1263 |
f := FontPanel |
|
1264 |
fontFromUserInitial:defaultFont |
|
1265 |
title:(resources string:'Font selection') |
|
1266 |
filter:filter |
|
1267 |
encoding:pref. |
|
1268 |
||
1269 |
f notNil ifTrue:[ |
|
1270 |
self font:f. |
|
1271 |
] |
|
1272 |
] |
|
2881 | 1273 |
] |
1274 |
||
1275 |
"Created: 26.10.1996 / 12:06:54 / cg" |
|
1276 |
"Modified: 30.6.1997 / 17:46:46 / cg" |
|
1277 |
! ! |
|
1278 |
||
2752 | 1279 |
!TextView methodsFor:'event handling'! |
0 | 1280 |
|
3040
f5e9092f3312
buttonState handling sensor bug workaround
Claus Gittinger <cg@exept.de>
parents:
3001
diff
changeset
|
1281 |
buttonMotion:buttonState x:x y:y |
0 | 1282 |
"mouse-move while button was pressed - handle selection changes" |
1283 |
||
3219
e8c7679a8a94
buttonrelease behavior, when released in another view
Claus Gittinger <cg@exept.de>
parents:
3214
diff
changeset
|
1284 |
(clickLine isNil or:[clickPos isNil]) ifTrue:[ |
4500 | 1285 |
dragIsActive := false. |
1286 |
^ self |
|
2588 | 1287 |
]. |
1288 |
||
1289 |
dragIsActive ifTrue:[ |
|
4500 | 1290 |
(clickPos dist:(x@y)) >= 5.0 ifTrue:[ |
1291 |
dragIsActive := false. |
|
1292 |
||
1293 |
self hasSelection ifTrue:[ |
|
1294 |
dropSource startDragIn:self at:(x@y) |
|
1295 |
] |
|
1296 |
]. |
|
1297 |
^ self |
|
2588 | 1298 |
]. |
0 | 1299 |
|
63 | 1300 |
"is it the select or 1-button ?" |
3040
f5e9092f3312
buttonState handling sensor bug workaround
Claus Gittinger <cg@exept.de>
parents:
3001
diff
changeset
|
1301 |
buttonState == 0 ifTrue:[^ self]. |
1619
f600c27c2c47
ignore motion event if not for left button.
Claus Gittinger <cg@exept.de>
parents:
1584
diff
changeset
|
1302 |
self sensor leftButtonPressed ifFalse:[^ self]. |
3040
f5e9092f3312
buttonState handling sensor bug workaround
Claus Gittinger <cg@exept.de>
parents:
3001
diff
changeset
|
1303 |
"/ (device buttonMotionMask:buttonState includesButton:#select) ifFalse:[ |
f5e9092f3312
buttonState handling sensor bug workaround
Claus Gittinger <cg@exept.de>
parents:
3001
diff
changeset
|
1304 |
"/ (device buttonMotionMask:buttonState includesButton:1) ifFalse:[ |
1619
f600c27c2c47
ignore motion event if not for left button.
Claus Gittinger <cg@exept.de>
parents:
1584
diff
changeset
|
1305 |
"/ ^ self |
f600c27c2c47
ignore motion event if not for left button.
Claus Gittinger <cg@exept.de>
parents:
1584
diff
changeset
|
1306 |
"/ ]. |
f600c27c2c47
ignore motion event if not for left button.
Claus Gittinger <cg@exept.de>
parents:
1584
diff
changeset
|
1307 |
"/ ]. |
53 | 1308 |
|
0 | 1309 |
"if moved outside of view, start autoscroll" |
3202
8217b0acc9f2
select from beginning (in editField
Claus Gittinger <cg@exept.de>
parents:
3201
diff
changeset
|
1310 |
|
4160 | 1311 |
((y < 0) and:[firstLineShown ~~ 0]) ifTrue:[ |
4500 | 1312 |
self compressMotionEvents:false. |
1313 |
self startAutoScrollUp:y negated. |
|
1314 |
^ self |
|
0 | 1315 |
]. |
1316 |
(y > height) ifTrue:[ |
|
4500 | 1317 |
self compressMotionEvents:false. |
1318 |
self startAutoScrollDown:(y - height). |
|
1319 |
^ self |
|
59 | 1320 |
]. |
2429
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2421
diff
changeset
|
1321 |
((x < 0) and:[viewOrigin x ~~ 0]) ifTrue:[ |
4500 | 1322 |
self compressMotionEvents:false. |
1323 |
self startAutoScrollLeft:x. |
|
1324 |
^ self |
|
59 | 1325 |
]. |
1326 |
(x > width) ifTrue:[ |
|
4500 | 1327 |
self compressMotionEvents:false. |
1328 |
self startAutoScrollRight:(x - width). |
|
1329 |
^ self |
|
0 | 1330 |
]. |
1331 |
||
1332 |
"move inside - stop autoscroll if any" |
|
1333 |
autoScrollBlock notNil ifTrue:[ |
|
4500 | 1334 |
self stopScrollSelect |
0 | 1335 |
]. |
3220 | 1336 |
|
3251
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1337 |
self extendSelectionToX:x y:y. |
1619
f600c27c2c47
ignore motion event if not for left button.
Claus Gittinger <cg@exept.de>
parents:
1584
diff
changeset
|
1338 |
|
4160 | 1339 |
"Modified: / 08-08-2010 / 11:20:54 / cg" |
0 | 1340 |
! |
1341 |
||
248 | 1342 |
buttonMultiPress:button x:x y:y |
1343 |
"multi-mouse-click - select word under pointer" |
|
1344 |
||
3914
ceb85ec53629
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3909
diff
changeset
|
1345 |
(button == 1) ifTrue:[ |
4500 | 1346 |
clickPos := x @ y. |
1347 |
||
1348 |
"/ The searchAction is mantained until a cut/replace or a search with a user selection is done |
|
4063 | 1349 |
"/ self clearSearchAction. |
2814
881a1a20eace
clear searchAction whenever the selection is changed.
Claus Gittinger <cg@exept.de>
parents:
2813
diff
changeset
|
1350 |
|
4500 | 1351 |
clickCount notNil ifTrue:[ |
1352 |
clickCount := clickCount + 1. |
|
1353 |
(clickCount == 2) ifTrue:[ |
|
1354 |
self doubleClickX:x y:y |
|
1355 |
] ifFalse:[ |
|
1356 |
(clickCount == 3) ifTrue:[ |
|
1357 |
self tripleClickX:x y:y |
|
1358 |
] ifFalse:[ |
|
1359 |
(clickCount == 4) ifTrue:[ |
|
1360 |
self quadClickX:x y:y |
|
1361 |
] |
|
1362 |
] |
|
1363 |
] |
|
1364 |
] |
|
248 | 1365 |
] ifFalse:[ |
4500 | 1366 |
super buttonMultiPress:button x:x y:y |
248 | 1367 |
] |
1368 |
||
1322
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1369 |
"Modified: 11.9.1997 / 04:15:35 / cg" |
248 | 1370 |
! |
1371 |
||
1372 |
buttonPress:button x:x y:y |
|
1373 |
"mouse-click - prepare for selection change" |
|
1374 |
||
1308 | 1375 |
|sensor clickVisibleLine| |
1376 |
||
2588 | 1377 |
dragIsActive := false. |
1378 |
sensor := self sensor. |
|
1379 |
||
3914
ceb85ec53629
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3909
diff
changeset
|
1380 |
(button == 1) ifTrue:[ |
4500 | 1381 |
sensor shiftDown ifTrue:[ |
1382 |
"mouse-click with shift - adding to selection" |
|
1383 |
self extendSelectionToX:x y:y. |
|
1384 |
^ self |
|
1385 |
]. |
|
1386 |
||
1387 |
clickVisibleLine := self visibleLineOfY:y. |
|
1388 |
clickPos := x @ y. |
|
1389 |
clickCol := self colOfX:x inVisibleLine:clickVisibleLine. |
|
1390 |
clickLine := self visibleLineToAbsoluteLine:clickVisibleLine. |
|
1391 |
clickStartLine := clickLine. |
|
1392 |
clickStartCol := clickCol. |
|
1393 |
||
1394 |
(self canDrag |
|
1395 |
and:[(self isInSelection:clickLine col:clickCol) |
|
1396 |
and:[UserPreferences current startTextDragWithControl not |
|
1397 |
or:[sensor ctrlDown]]]) ifTrue:[ |
|
1398 |
dragIsActive := true |
|
1399 |
] ifFalse:[ |
|
1400 |
self unselect. |
|
1401 |
]. |
|
1402 |
clickCount := 1 |
|
248 | 1403 |
] ifFalse:[ |
4500 | 1404 |
super buttonPress:button x:x y:y |
248 | 1405 |
] |
813
7168eda47e3b
Display no longer sends buttonShiftPress messages
Claus Gittinger <cg@exept.de>
parents:
770
diff
changeset
|
1406 |
|
1909 | 1407 |
"Modified: / 20.5.1999 / 17:02:45 / cg" |
248 | 1408 |
! |
1409 |
||
0 | 1410 |
buttonRelease:button x:x y:y |
1411 |
"mouse- button release - turn off autoScroll if any" |
|
1412 |
||
3914
ceb85ec53629
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3909
diff
changeset
|
1413 |
(button == 1) ifTrue:[ |
4500 | 1414 |
autoScrollBlock notNil ifTrue:[ |
1415 |
self stopScrollSelect |
|
1416 |
]. |
|
1417 |
dragIsActive ifTrue:[ |
|
1418 |
self unselect |
|
1419 |
]. |
|
1420 |
clickPos := nil. |
|
0 | 1421 |
] ifFalse:[ |
4500 | 1422 |
super buttonRelease:button x:x y:y |
1909 | 1423 |
]. |
2588 | 1424 |
dragIsActive := false. |
1425 |
||
1909 | 1426 |
"/ clickPos := clickLine := clickCol := nil. |
1427 |
||
1428 |
"Modified: / 20.5.1999 / 17:14:23 / cg" |
|
824
f62922fcfa5d
Send #getListFromModel when setting #model:
Stefan Vogel <sv@exept.de>
parents:
813
diff
changeset
|
1429 |
! |
248 | 1430 |
|
1322
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1431 |
doubleClickX:x y:y |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1432 |
"double-click - select word under pointer" |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1433 |
|
3588
a70267e5b501
st80 behavior: also scan for matching single quote
Claus Gittinger <cg@exept.de>
parents:
3587
diff
changeset
|
1434 |
|sel ch scanCh matchCol scanCol fwdScan fwdSelect| |
1322
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1435 |
|
3587
8685721a709f
doubleClickX:y: + ctrl: st80 behavior
Claus Gittinger <cg@exept.de>
parents:
3581
diff
changeset
|
1436 |
(self st80SelectMode or:[ self sensor ctrlDown]) ifTrue:[ |
4500 | 1437 |
"/ st80 selects: |
1438 |
"/ if clicked right after a parenthesis -> select to matching parenthesis |
|
1439 |
"/ if clicked right after a quote -> select to matching quote (unless escaped ;-) |
|
1440 |
"/ if clicked at beginning of the line -> select that line |
|
1441 |
"/ if clicked at the top of the text -> select all |
|
1442 |
"/ |
|
1443 |
clickCol == 1 ifTrue:[ |
|
1444 |
clickLine == 1 ifTrue:[ |
|
1445 |
self selectAll. |
|
1446 |
^ self. |
|
1447 |
]. |
|
1448 |
self selectLineAtY:y. |
|
1449 |
selectStyle := #line. |
|
1450 |
^ self |
|
1451 |
]. |
|
1452 |
||
1453 |
matchCol := nil. |
|
1454 |
"/ see what is to the left of that character ... |
|
1455 |
clickCol > 1 ifTrue:[ |
|
1456 |
ch := self characterAtLine:clickLine col:clickCol-1. |
|
1457 |
(self isOpeningParenthesis:ch) ifTrue:[ |
|
1458 |
matchCol := clickCol - 1 |
|
1459 |
] ifFalse:[ |
|
1460 |
('"''|' includes:ch) ifTrue:[ |
|
1461 |
scanCol := clickCol - 1. |
|
1462 |
fwdScan := true. |
|
1463 |
scanCh := ch. |
|
1464 |
] |
|
1465 |
] |
|
1466 |
]. |
|
1467 |
fwdSelect := true. |
|
1468 |
(matchCol isNil and:[scanCol isNil]) ifTrue:[ |
|
1469 |
clickCol < (self listAt:clickLine) size ifTrue:[ |
|
1470 |
ch := self characterAtLine:clickLine col:clickCol+1. |
|
1471 |
(self isClosingParenthesis:ch) ifTrue:[ |
|
1472 |
matchCol := clickCol + 1. |
|
1473 |
fwdSelect := false. |
|
1474 |
] ifFalse:[ |
|
1475 |
('"''|' includes:ch) ifTrue:[ |
|
1476 |
scanCol := clickCol + 1. |
|
1477 |
fwdScan := false. |
|
1478 |
scanCh := ch. |
|
1479 |
] |
|
1480 |
] |
|
1481 |
]. |
|
1482 |
]. |
|
1483 |
matchCol notNil ifTrue:[ |
|
1484 |
self |
|
1485 |
searchForMatchingParenthesisFromLine:clickLine col:matchCol |
|
1486 |
ifFound:[:line :col | |
|
1487 |
self selectFromLine:clickLine col:matchCol+(fwdSelect ifTrue:1 ifFalse:-1) |
|
1488 |
toLine:line col:col-(fwdSelect ifTrue:1 ifFalse:-1)] |
|
1489 |
ifNotFound:[self showNotFound] |
|
1490 |
onError:[self beep] |
|
1491 |
openingCharacters:((parenthesisSpecification at:#open) , '([{') |
|
1492 |
closingCharacters:((parenthesisSpecification at:#close) , ')]}'). |
|
1493 |
^ self |
|
1494 |
]. |
|
1495 |
scanCol notNil ifTrue:[ |
|
1496 |
"/ if its an EOL comment, do it differently |
|
1497 |
ch := self characterAtLine:clickLine col:clickCol. |
|
1498 |
ch == $/ ifTrue:[ |
|
1499 |
self selectFromLine:clickLine col:clickCol+1 toLine:clickLine+1 col:0. |
|
1500 |
^ self |
|
1501 |
]. |
|
1502 |
||
1503 |
self |
|
1504 |
scanFor:scanCh fromLine:clickLine col:scanCol forward:fwdScan |
|
1505 |
ifFound:[:line :col | |
|
1506 |
|selStart selEnd| |
|
1507 |
||
1508 |
fwdScan ifTrue:[ |
|
1509 |
selStart := scanCol+1. |
|
1510 |
selEnd := col-1. |
|
1511 |
] ifFalse:[ |
|
1512 |
selStart := scanCol-1. |
|
1513 |
selEnd := col+1. |
|
1514 |
]. |
|
1515 |
self selectFromLine:clickLine col:selStart |
|
1516 |
toLine:line col:selEnd. |
|
1517 |
^ self |
|
1518 |
] |
|
1519 |
ifNotFound:[self showNotFound]. |
|
1520 |
^ self |
|
1521 |
] |
|
1322
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1522 |
]. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1523 |
|
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1524 |
self selectWordAtX:x y:y. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1525 |
|
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1526 |
" |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1527 |
special - if clicked on a parenthesis, select to matching |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1528 |
" |
4500 | 1529 |
((sel := self selection) size == 1 |
1322
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1530 |
and:[(sel := sel at:1) size == 1]) ifTrue:[ |
4500 | 1531 |
ch := sel at:1. |
1532 |
||
1533 |
((self isOpeningParenthesis:ch) |
|
1534 |
or:[ (self isClosingParenthesis:ch) ]) ifTrue:[ |
|
1535 |
self |
|
1536 |
searchForMatchingParenthesisFromLine:selectionStartLine col:selectionStartCol |
|
1537 |
ifFound:[:line :col | |
|
1538 |
|prevLine prevCol moveBack pos1| |
|
1539 |
||
1540 |
prevLine := firstLineShown. |
|
1541 |
prevCol := viewOrigin x. |
|
1542 |
self selectFromLine:selectionStartLine col:selectionStartCol |
|
1543 |
toLine:line col:col. |
|
1544 |
||
1545 |
self sensor ctrlDown ifFalse:[ |
|
1546 |
"/ undo scroll operation ... |
|
1547 |
self withCursor:Cursor eye do:[ |
|
1548 |
|delayCount| |
|
1549 |
||
1550 |
moveBack := false. |
|
1551 |
(self isClosingParenthesis:ch) ifTrue:[ |
|
1552 |
(firstLineShown ~~ prevLine or:[prevCol ~~ viewOrigin x]) ifTrue:[ |
|
1553 |
moveBack := true |
|
1554 |
] |
|
1555 |
] ifFalse:[ |
|
1556 |
selectionEndLine > (firstLineShown + nFullLinesShown) ifTrue:[ |
|
1557 |
self makeLineVisible:selectionEndLine. |
|
1558 |
moveBack := true |
|
1559 |
] |
|
1560 |
]. |
|
1561 |
moveBack ifTrue:[ |
|
1562 |
delayCount := 0. |
|
1563 |
pos1 := x@y. |
|
1564 |
self invalidateRepairNow:true. |
|
1565 |
Delay waitForSeconds:MatchDelayTime. |
|
1566 |
delayCount := delayCount + MatchDelayTime. |
|
1567 |
[self sensor hasUserEventFor:self] whileFalse:[ |
|
1568 |
Delay waitForSeconds:MatchDelayTime / 2. |
|
1569 |
delayCount := delayCount + (MatchDelayTime / 2). |
|
1570 |
delayCount > 2 ifTrue:[ |
|
1571 |
self cursor:Cursor eyeClosed. |
|
1572 |
]. |
|
1573 |
delayCount >= 2.3 ifTrue:[ |
|
1574 |
self cursor:Cursor eye. |
|
1575 |
delayCount := 0. |
|
1576 |
] |
|
1577 |
]. |
|
1578 |
self scrollToLine:prevLine; scrollToCol:prevCol. |
|
1579 |
]. |
|
1580 |
] |
|
1581 |
] |
|
1582 |
] |
|
1583 |
ifNotFound:[self showNotFound] |
|
1584 |
onError:[self beep] |
|
1585 |
openingCharacters:((parenthesisSpecification at:#open) ", '([{'") |
|
1586 |
closingCharacters:((parenthesisSpecification at:#close) ", ')]}'"). |
|
1587 |
selectStyle := nil |
|
1588 |
] |
|
1322
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1589 |
]. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1590 |
|
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1591 |
" |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1592 |
remember words position in case of a drag following |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1593 |
" |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1594 |
wordStartLine := selectionStartLine. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1595 |
wordEndLine := selectionEndLine. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1596 |
selectStyle == #wordLeft ifTrue:[ |
4500 | 1597 |
wordStartCol := selectionStartCol + 1 |
1322
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1598 |
] ifFalse:[ |
4500 | 1599 |
wordStartCol := selectionStartCol. |
1322
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1600 |
]. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1601 |
selectStyle == #wordRight ifTrue:[ |
4500 | 1602 |
wordEndCol := selectionEndCol - 1 |
1322
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1603 |
] ifFalse:[ |
4500 | 1604 |
wordEndCol := selectionEndCol |
1322
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1605 |
] |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1606 |
|
3308 | 1607 |
"Created: / 11-09-1997 / 04:12:55 / cg" |
4255 | 1608 |
"Modified: / 14-06-2011 / 14:04:59 / cg" |
1322
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1609 |
! |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1610 |
|
3251
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1611 |
extendSelectionToX:x y:y |
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1612 |
"mouse-move while button was pressed - handle selection changes" |
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1613 |
|
4500 | 1614 |
|movedVisibleLine movedLine movedCol |
1615 |
movedUp |
|
3251
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1616 |
oldStartLine oldEndLine oldStartCol oldEndCol| |
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1617 |
|
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1618 |
movedVisibleLine := self visibleLineOfY:y. |
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1619 |
movedLine := self visibleLineToAbsoluteLine:movedVisibleLine. |
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1620 |
|
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1621 |
(x < leftMargin) ifTrue:[ |
4500 | 1622 |
movedCol := 0 |
3251
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1623 |
] ifFalse:[ |
4500 | 1624 |
movedCol := self colOfX:x inVisibleLine:movedVisibleLine |
3251
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1625 |
]. |
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1626 |
y < 0 ifTrue:[ |
4500 | 1627 |
movedCol := 0 |
3251
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1628 |
]. |
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1629 |
((movedLine == clickLine) and:[movedCol == clickCol]) ifTrue:[ |
4500 | 1630 |
selectionStartLine notNil ifTrue:[ |
1631 |
^ self |
|
1632 |
]. |
|
1633 |
(clickPos isNil |
|
1634 |
or:[(clickPos x - x) abs < 3 |
|
1635 |
and:[(clickPos y - y) abs < 3]]) ifTrue:[ |
|
1636 |
^ self |
|
1637 |
]. |
|
1638 |
selectionStartLine := clickLine. |
|
1639 |
selectionStartCol := clickCol. |
|
1640 |
selectionEndLine := selectionStartLine. |
|
1641 |
selectionEndCol := selectionStartCol. |
|
1642 |
||
1643 |
oldStartLine := selectionStartLine. |
|
1644 |
oldEndLine := selectionEndLine. |
|
1645 |
oldStartCol := selectionStartCol. |
|
1646 |
oldEndCol := selectionEndCol-1. |
|
3251
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1647 |
] ifFalse:[ |
4500 | 1648 |
selectionStartLine isNil ifTrue:[ |
1649 |
selectionStartLine := selectionEndLine := clickLine. |
|
1650 |
selectionStartCol := selectionEndCol := clickCol. |
|
1651 |
]. |
|
1652 |
oldStartLine := selectionStartLine. |
|
1653 |
oldEndLine := selectionEndLine. |
|
1654 |
oldStartCol := selectionStartCol. |
|
1655 |
oldEndCol := selectionEndCol. |
|
3251
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1656 |
]. |
3692 | 1657 |
oldEndLine isNil ifTrue:[ |
4500 | 1658 |
oldEndLine := selectionEndLine ? clickLine ? movedLine. |
3692 | 1659 |
]. |
1660 |
oldEndCol isNil ifTrue:[ |
|
4500 | 1661 |
oldEndCol := selectionEndCol ? clickCol. |
3692 | 1662 |
]. |
3251
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1663 |
|
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1664 |
"find out if we are before or after initial click" |
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1665 |
movedUp := false. |
3443
09a7671630a9
changed #extendSelectionToX:y:
Claus Gittinger <cg@exept.de>
parents:
3438
diff
changeset
|
1666 |
clickStartLine isNil ifTrue:[ |
4500 | 1667 |
clickStartLine := movedLine. |
3443
09a7671630a9
changed #extendSelectionToX:y:
Claus Gittinger <cg@exept.de>
parents:
3438
diff
changeset
|
1668 |
]. |
3505 | 1669 |
clickStartCol isNil ifTrue:[ |
4500 | 1670 |
clickStartCol := movedCol. |
3505 | 1671 |
]. |
3443
09a7671630a9
changed #extendSelectionToX:y:
Claus Gittinger <cg@exept.de>
parents:
3438
diff
changeset
|
1672 |
|
3251
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1673 |
(movedLine < clickStartLine) ifTrue:[ |
4500 | 1674 |
movedUp := true |
3251
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1675 |
] ifFalse:[ |
4500 | 1676 |
(movedLine == clickStartLine) ifTrue:[ |
1677 |
(movedCol < clickStartCol) ifTrue:[ |
|
1678 |
movedUp := true |
|
1679 |
] |
|
1680 |
] |
|
3251
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1681 |
]. |
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1682 |
|
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1683 |
movedUp ifTrue:[ |
4500 | 1684 |
"change selectionStart" |
1685 |
selectionStartCol := movedCol. |
|
1686 |
selectionStartLine := movedLine. |
|
1687 |
selectionEndCol := clickStartCol. |
|
1688 |
selectionEndLine := clickStartLine. |
|
1689 |
selectStyle notNil ifTrue:[ |
|
1690 |
selectionEndCol := wordEndCol. |
|
1691 |
selectionEndLine := wordEndLine. |
|
1692 |
] |
|
3251
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1693 |
] ifFalse:[ |
4500 | 1694 |
"change selectionEnd" |
1695 |
selectionEndCol := movedCol. |
|
1696 |
selectionEndLine := movedLine. |
|
1697 |
selectionStartCol := clickStartCol. |
|
1698 |
selectionStartLine := clickStartLine. |
|
1699 |
selectStyle notNil ifTrue:[ |
|
1700 |
selectionStartCol := wordStartCol. |
|
1701 |
selectionStartLine := wordStartLine. |
|
1702 |
] |
|
3251
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1703 |
]. |
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1704 |
|
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1705 |
selectionStartLine isNil ifTrue:[^ self]. |
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1706 |
|
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1707 |
(selectionStartCol == 0) ifTrue:[ |
4500 | 1708 |
selectionStartCol := 1 |
3251
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1709 |
]. |
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1710 |
|
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1711 |
" |
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1712 |
if in word-select, just catch the rest of the word |
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1713 |
" |
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1714 |
(selectStyle notNil and:[selectStyle startsWith:'word']) ifTrue:[ |
4500 | 1715 |
movedUp ifTrue:[ |
1716 |
selectionStartCol := self findBeginOfWordAtLine:selectionStartLine col:selectionStartCol |
|
1717 |
] ifFalse:[ |
|
1718 |
selectionEndCol := self findEndOfWordAtLine:selectionEndLine col:selectionEndCol. |
|
1719 |
selectionEndCol == 0 ifTrue:[ |
|
1720 |
selectionEndLine := selectionEndLine + 1 |
|
1721 |
] |
|
1722 |
]. |
|
3251
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1723 |
]. |
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1724 |
|
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1725 |
selectStyle == #line ifTrue:[ |
4500 | 1726 |
movedUp ifTrue:[ |
1727 |
selectionStartCol := 1. |
|
1728 |
] ifFalse:[ |
|
1729 |
selectionEndCol := 0. |
|
1730 |
selectionEndLine := selectionEndLine + 1 |
|
1731 |
] |
|
3251
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1732 |
]. |
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1733 |
|
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1734 |
self validateNewSelection. |
4419
a7436b36c0a0
added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4409
diff
changeset
|
1735 |
self setPrimarySelection. |
4101 | 1736 |
self selectionChanged. |
3251
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1737 |
|
4063 | 1738 |
"/ The searchAction is mantained until a cut/replace or a search with a user selection is done |
1739 |
"/ self clearSearchAction. |
|
3251
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1740 |
|
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1741 |
(oldStartLine == selectionStartLine) ifTrue:[ |
4500 | 1742 |
(oldStartCol ~~ selectionStartCol) ifTrue:[ |
1743 |
self redrawLine:oldStartLine |
|
1744 |
from:((selectionStartCol min:oldStartCol) max:1) |
|
1745 |
to:((selectionStartCol max:oldStartCol) max:1) |
|
1746 |
] |
|
3251
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1747 |
] ifFalse:[ |
4500 | 1748 |
self redrawFromLine:(oldStartLine?selectionStartLine min:selectionStartLine) |
1749 |
to:(oldStartLine?selectionStartLine max:selectionStartLine) |
|
3251
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1750 |
]. |
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1751 |
|
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1752 |
(oldEndLine == selectionEndLine) ifTrue:[ |
4500 | 1753 |
(oldEndCol notNil and:[oldEndCol ~~ selectionEndCol]) ifTrue:[ |
1754 |
self redrawLine:oldEndLine |
|
1755 |
from:((selectionEndCol min:oldEndCol) max:1) |
|
1756 |
to:((selectionEndCol max:oldEndCol) max:1) |
|
1757 |
] |
|
3251
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1758 |
] ifFalse:[ |
4500 | 1759 |
selectionEndLine isNil ifTrue:[ |
1760 |
selectionStartLine := nil. |
|
1761 |
self redraw. |
|
1762 |
] ifFalse:[ |
|
1763 |
(selectionStartLine notNil) ifTrue:[ |
|
1764 |
self redrawFromLine:(oldEndLine min:selectionEndLine) |
|
1765 |
to:(oldEndLine max:selectionEndLine) |
|
1766 |
] |
|
1767 |
] |
|
3251
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1768 |
]. |
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1769 |
clickLine := movedLine. |
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1770 |
clickCol := movedCol |
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1771 |
|
4234
65f202270d2c
changed: #extendSelectionToX:y:
Claus Gittinger <cg@exept.de>
parents:
4178
diff
changeset
|
1772 |
"Modified: / 05-04-2011 / 17:13:35 / cg" |
4419
a7436b36c0a0
added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4409
diff
changeset
|
1773 |
"Modified: / 17-04-2012 / 21:00:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
3251
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1774 |
! |
156d3ee6a6c1
fix: selection extension via shift-click
Claus Gittinger <cg@exept.de>
parents:
3245
diff
changeset
|
1775 |
|
248 | 1776 |
keyPress:key x:x y:y |
1777 |
"handle some keyboard input (there is not much to be done here)" |
|
1778 |
||
1893
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1779 |
<resource: #keyboard (#Find #Copy #FindNext #FindPrev #FindAgain |
4500 | 1780 |
#GotoLine #SelectAll #SaveAs #Print |
1781 |
#'F*' #'f*' #ZoomIn #ZoomOut)> |
|
248 | 1782 |
|
1783 |
(key == #Find) ifTrue:[self search. ^self]. |
|
1784 |
(key == #Copy) ifTrue:[self copySelection. ^self]. |
|
447
ed41e1bbd9a1
also support goto-default (use selection if any)
Claus Gittinger <cg@exept.de>
parents:
441
diff
changeset
|
1785 |
(key == #GotoLine) ifTrue:[self gotoLine. ^self]. |
248 | 1786 |
|
1787 |
(key == #FindNext) ifTrue:[self searchFwd. ^self]. |
|
1788 |
(key == #FindPrev) ifTrue:[self searchBwd. ^self]. |
|
1893
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1789 |
(key == #FindAgain) ifTrue:[self searchAgainInSameDirection. ^self]. |
248 | 1790 |
|
1791 |
(key == #SelectAll) ifTrue:[self selectAll. ^self]. |
|
1792 |
||
614 | 1793 |
(key == #SaveAs) ifTrue:[self save. ^self]. |
1794 |
(key == #Print) ifTrue:[self doPrint. ^self]. |
|
428
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
411
diff
changeset
|
1795 |
|
4409 | 1796 |
(key == #ZoomIn or:[key == #ZoomOut]) ifTrue:[ self fontLargerOrSmaller:(key == #ZoomIn) ]. |
1797 |
||
248 | 1798 |
" |
4500 | 1799 |
shift-Fn defines a key-sequence |
248 | 1800 |
Fn pastes that sequence |
1801 |
cmd-Fn performs a 'doIt' on the sequence (Workspaces only) |
|
1802 |
||
1803 |
(see EditTextView>>keyPress:x:y and Workspace>>keyPress:x:y) |
|
1804 |
" |
|
1193
811135bbd017
Do not crash when typing simple keys.
Stefan Vogel <sv@exept.de>
parents:
1188
diff
changeset
|
1805 |
(key size > 1 and:[(key at:1) asLowercase == $f]) ifTrue:[ |
4500 | 1806 |
(('[fF][0-9]' match:key) |
1807 |
or:['[fF][0-9][0-9]' match:key]) ifTrue:[ |
|
1808 |
self sensor shiftDown ifTrue:[ |
|
1809 |
UserPreferences current functionKeySequences |
|
1810 |
at:key put:(self selection) |
|
1811 |
]. |
|
1812 |
^ self |
|
1813 |
]. |
|
248 | 1814 |
]. |
1815 |
||
1816 |
super keyPress:key x:x y:y |
|
326
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
309
diff
changeset
|
1817 |
|
4409 | 1818 |
"Modified: / 18-04-1997 / 12:12:27 / stefan" |
1819 |
"Modified: / 10-03-2012 / 09:40:01 / cg" |
|
248 | 1820 |
! |
1821 |
||
4500 | 1822 |
mapped |
248 | 1823 |
super mapped. |
1987 | 1824 |
selectionFgColor := selectionFgColor onDevice:device. |
1825 |
selectionBgColor := selectionBgColor onDevice:device. |
|
1322
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1826 |
! |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1827 |
|
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1828 |
quadClickX:x y:y |
1476
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
1829 |
"quadrupleClick-click - select all" |
1322
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1830 |
|
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1831 |
self selectAll |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1832 |
|
1476
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
1833 |
"Created: / 11.9.1997 / 04:15:24 / cg" |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
1834 |
"Modified: / 31.3.1998 / 14:21:13 / cg" |
1322
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1835 |
! |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1836 |
|
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1837 |
tripleClickX:x y:y |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1838 |
"triple-click - select line under pointer" |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1839 |
|
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1840 |
self selectLineAtY:y. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1841 |
selectStyle := #line |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1842 |
|
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1843 |
"Created: 11.9.1997 / 04:13:37 / cg" |
0 | 1844 |
! ! |
248 | 1845 |
|
2120 | 1846 |
!TextView methodsFor:'initialization & release'! |
248 | 1847 |
|
941 | 1848 |
fetchDeviceResources |
1849 |
"fetch device colors, to avoid reallocation at redraw time" |
|
1850 |
||
1851 |
super fetchDeviceResources. |
|
1852 |
||
1987 | 1853 |
selectionFgColor notNil ifTrue:[selectionFgColor := selectionFgColor onDevice:device]. |
1854 |
selectionBgColor notNil ifTrue:[selectionBgColor := selectionBgColor onDevice:device]. |
|
941 | 1855 |
|
1856 |
"Created: 14.1.1997 / 00:14:33 / cg" |
|
1857 |
! |
|
1858 |
||
248 | 1859 |
initStyle |
966 | 1860 |
"setup viewStyle specifics" |
1861 |
||
248 | 1862 |
super initStyle. |
1863 |
||
1864 |
viewBackground := DefaultViewBackground. |
|
1865 |
selectionFgColor := DefaultSelectionForegroundColor. |
|
1866 |
selectionFgColor isNil ifTrue:[selectionFgColor := bgColor]. |
|
1867 |
selectionBgColor := DefaultSelectionBackgroundColor. |
|
1868 |
selectionBgColor isNil ifTrue:[ |
|
4500 | 1869 |
device hasColors ifTrue:[ |
1870 |
DefaultSelectionForegroundColor isNil ifTrue:[ |
|
1871 |
selectionFgColor := fgColor |
|
1872 |
]. |
|
1873 |
selectionBgColor := Color green |
|
1874 |
] ifFalse:[ |
|
1875 |
device hasGrayscales ifTrue:[ |
|
1876 |
DefaultSelectionForegroundColor isNil ifTrue:[ |
|
1877 |
selectionFgColor := fgColor |
|
1878 |
]. |
|
1879 |
selectionBgColor := Color grey |
|
1880 |
] ifFalse:[ |
|
1881 |
selectionBgColor := fgColor |
|
1882 |
] |
|
1883 |
] |
|
248 | 1884 |
]. |
708 | 1885 |
|
4321 | 1886 |
"Modified: / 22-01-1997 / 11:57:53 / cg" |
1887 |
"Modified (comment): / 05-10-2011 / 15:50:45 / az" |
|
248 | 1888 |
! |
1889 |
||
1890 |
initialize |
|
1891 |
super initialize. |
|
2836
de07d386cfe8
allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents:
2835
diff
changeset
|
1892 |
self initializeSaveAction. |
248 | 1893 |
contentsWasSaved := false. |
2588 | 1894 |
dragIsActive := false. |
248 | 1895 |
|
2553
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
1896 |
parenthesisSpecification isNil ifTrue:[ |
4500 | 1897 |
parenthesisSpecification := DefaultParenthesisSpecification. |
2553
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
1898 |
]. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
1899 |
|
911 | 1900 |
"I handle menus myself" |
1901 |
menuHolder := menuPerformer := self. |
|
1902 |
||
2588 | 1903 |
"/ on default allow drag |
1904 |
self allowDrag:true. |
|
2836
de07d386cfe8
allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents:
2835
diff
changeset
|
1905 |
! |
de07d386cfe8
allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents:
2835
diff
changeset
|
1906 |
|
de07d386cfe8
allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents:
2835
diff
changeset
|
1907 |
initializeSaveAction |
de07d386cfe8
allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents:
2835
diff
changeset
|
1908 |
saveAction := [ self openSaveDialog ] |
248 | 1909 |
! ! |
1910 |
||
4450 | 1911 |
!TextView methodsFor:'menu & menu actions'! |
248 | 1912 |
|
2701
b77cc7cf3818
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
2695
diff
changeset
|
1913 |
appendTo:aFileName |
248 | 1914 |
"append contents to a file named fileName" |
1915 |
||
2701
b77cc7cf3818
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
2695
diff
changeset
|
1916 |
|aStream msg filename| |
b77cc7cf3818
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
2695
diff
changeset
|
1917 |
|
b77cc7cf3818
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
2695
diff
changeset
|
1918 |
filename := aFileName asFilename. |
b77cc7cf3818
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
2695
diff
changeset
|
1919 |
|
b77cc7cf3818
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
2695
diff
changeset
|
1920 |
(FileStream userInitiatedFileSaveQuerySignal queryWith:filename) ifFalse:[ |
4500 | 1921 |
msg := resources string:'Refused to append to file ''%1'' !!' with:filename name. |
1922 |
self warn:(msg , '\\(ST/X internal permission check)' ) withCRs. |
|
1923 |
^ self |
|
2036
83ac940a9fc6
allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents:
2027
diff
changeset
|
1924 |
]. |
83ac940a9fc6
allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents:
2027
diff
changeset
|
1925 |
|
2701
b77cc7cf3818
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
2695
diff
changeset
|
1926 |
[ |
4500 | 1927 |
aStream := filename appendingWriteStream. |
1928 |
[ |
|
1929 |
self fileOutContentsOn:aStream compressTabs:true encoding:externalEncoding. |
|
1930 |
] ensure:[ |
|
1931 |
aStream close. |
|
1932 |
]. |
|
1933 |
contentsWasSaved := true |
|
2701
b77cc7cf3818
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
2695
diff
changeset
|
1934 |
] on:FileStream openErrorSignal do:[:ex| |
4500 | 1935 |
msg := resources string:'cannot append to file %1 !!' with:filename name. |
1936 |
self warn:(msg , '\\(' , FileStream lastErrorString , ')' ) withCRs |
|
248 | 1937 |
] |
4437 | 1938 |
|
1939 |
"Modified: / 27-07-2012 / 09:41:18 / cg" |
|
248 | 1940 |
! |
1941 |
||
1942 |
changeFont |
|
1943 |
"pop up a fontPanel to change font" |
|
1944 |
||
411 | 1945 |
|newFont| |
248 | 1946 |
|
411 | 1947 |
newFont := FontPanel fontFromUserInitial:font. |
1948 |
newFont notNil ifTrue:[ |
|
4500 | 1949 |
self font:newFont. |
411 | 1950 |
] |
1951 |
||
1952 |
"Modified: 27.2.1996 / 00:53:51 / cg" |
|
248 | 1953 |
! |
1954 |
||
1955 |
copySelection |
|
1956 |
"copy contents into smalltalk copybuffer" |
|
1957 |
||
863 | 1958 |
|text| |
248 | 1959 |
|
1960 |
text := self selection. |
|
1961 |
text notNil ifTrue:[ |
|
4500 | 1962 |
self unselect. |
1963 |
||
1964 |
"/ forget any emphasis ... |
|
1965 |
text := text collect:[:l | l isNil ifTrue:[l] ifFalse:[l string]]. |
|
1966 |
self setClipboardText:text. |
|
248 | 1967 |
] |
649
097c69ce9599
forget emphasis in copySelection
Claus Gittinger <cg@exept.de>
parents:
633
diff
changeset
|
1968 |
|
097c69ce9599
forget emphasis in copySelection
Claus Gittinger <cg@exept.de>
parents:
633
diff
changeset
|
1969 |
"Modified: 17.5.1996 / 08:57:54 / cg" |
248 | 1970 |
! |
1971 |
||
1972 |
defaultForGotoLine |
|
1973 |
"return a default value to show in the gotoLine box" |
|
1974 |
||
447
ed41e1bbd9a1
also support goto-default (use selection if any)
Claus Gittinger <cg@exept.de>
parents:
441
diff
changeset
|
1975 |
^ selectionStartLine |
ed41e1bbd9a1
also support goto-default (use selection if any)
Claus Gittinger <cg@exept.de>
parents:
441
diff
changeset
|
1976 |
|
ed41e1bbd9a1
also support goto-default (use selection if any)
Claus Gittinger <cg@exept.de>
parents:
441
diff
changeset
|
1977 |
"Modified: 1.3.1996 / 18:44:36 / cg" |
248 | 1978 |
! |
1979 |
||
614 | 1980 |
doPrint |
1981 |
"print the contents on the printer" |
|
1982 |
||
1983 |
|printStream| |
|
1984 |
||
1985 |
list isNil ifTrue:[^ self]. |
|
1986 |
||
829
fd15ef9c598a
show wait cursor while printing
Claus Gittinger <cg@exept.de>
parents:
824
diff
changeset
|
1987 |
self withWaitCursorDo:[ |
4500 | 1988 |
printStream := Printer new. |
1989 |
printStream supportsContext ifTrue:[ |
|
1990 |
printStream printerContext font:(self font). |
|
1991 |
]. |
|
1992 |
||
1993 |
Printer writeErrorSignal handle:[:ex | |
|
1994 |
self warn:('error while printing:\\' |
|
1995 |
, ex description |
|
1996 |
, '\\(printing with: ' , (Printer printCommand) , ')') withCRs |
|
1997 |
] do:[ |
|
1998 |
self fileOutContentsOn:printStream. |
|
1999 |
]. |
|
2000 |
printStream close |
|
829
fd15ef9c598a
show wait cursor while printing
Claus Gittinger <cg@exept.de>
parents:
824
diff
changeset
|
2001 |
]. |
fd15ef9c598a
show wait cursor while printing
Claus Gittinger <cg@exept.de>
parents:
824
diff
changeset
|
2002 |
|
4363 | 2003 |
"Created: / 06-05-1996 / 16:11:26 / cg" |
2004 |
"Modified: / 31-01-2012 / 18:16:39 / cg" |
|
614 | 2005 |
! |
2006 |
||
248 | 2007 |
editMenu |
1109 | 2008 |
"return my popUpMenu" |
2009 |
||
489 | 2010 |
<resource: #keyboard (#Copy #Find #GotoLine #SaveAs #Print)> |
1262
d69149b5be1f
resource flag: #menu -> #programMenu
Claus Gittinger <cg@exept.de>
parents:
1255
diff
changeset
|
2011 |
<resource: #programMenu> |
489 | 2012 |
|
1545 | 2013 |
|items m| |
2014 |
||
2015 |
items := #( |
|
4500 | 2016 |
('Copy' copySelection Copy) |
2017 |
('-' nil ) |
|
2018 |
('Search...' search Find) |
|
2019 |
('Goto Line...' gotoLine GotoLine) |
|
2020 |
('-' nil ) |
|
2021 |
('Font...' changeFont ) |
|
2022 |
('-' nil ) |
|
2023 |
('Save As...' save SaveAs) |
|
2024 |
('Print' doPrint Print) |
|
2025 |
). |
|
248 | 2026 |
|
1545 | 2027 |
m := PopUpMenu itemList:items resources:resources. |
248 | 2028 |
|
2350
c09d3dd534e3
do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents:
2336
diff
changeset
|
2029 |
self hasSelectionForCopy ifFalse:[ |
4500 | 2030 |
m disable:#copySelection. |
248 | 2031 |
]. |
2032 |
^ m |
|
428
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
411
diff
changeset
|
2033 |
|
2458 | 2034 |
"Modified: / 12.11.2001 / 13:43:56 / cg" |
248 | 2035 |
! |
2036 |
||
1288
19eee9e48131
added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
2037 |
find |
19eee9e48131
added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
2038 |
"same as search - for VW compatibility" |
19eee9e48131
added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
2039 |
|
19eee9e48131
added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
2040 |
self search |
19eee9e48131
added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
2041 |
|
19eee9e48131
added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
2042 |
"Created: 31.7.1997 / 19:13:58 / cg" |
19eee9e48131
added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
2043 |
! |
19eee9e48131
added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
2044 |
|
4409 | 2045 |
fontLargerOrSmaller:largerBoolean |
2046 |
|newFont| |
|
2047 |
||
4500 | 2048 |
newFont := font size:(largerBoolean |
2049 |
ifTrue:[font size + 1] |
|
2050 |
ifFalse:[(font size-1) max:4]). |
|
4409 | 2051 |
self font:newFont. |
2052 |
||
2053 |
"Modified: / 27-02-1996 / 00:53:51 / cg" |
|
2054 |
"Created: / 10-03-2012 / 09:38:32 / cg" |
|
2055 |
! |
|
2056 |
||
248 | 2057 |
gotoLine |
1524
60582bfee9ce
allow relative gotos (+delta / -delta) in goto-line dialog.
Claus Gittinger <cg@exept.de>
parents:
1496
diff
changeset
|
2058 |
"show a box to enter lineNumber for positioning; |
4500 | 2059 |
The entered number may be prefixed by a + or -; |
1926 | 2060 |
in this case, the linenumber is taken relative to the current position." |
2061 |
||
2062 |
|l lineNumberBox input lineToGo relative| |
|
248 | 2063 |
|
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2064 |
lineNumberBox := |
4500 | 2065 |
EnterBox |
2066 |
title:(resources string:'Line number (or +/- relativeNr):') |
|
2067 |
okText:(resources string:'Goto') |
|
2068 |
abortText:(resources string:'Cancel') |
|
2069 |
action:[:l | input := l]. |
|
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2070 |
|
248 | 2071 |
l := self defaultForGotoLine. |
2072 |
l notNil ifTrue:[ |
|
4500 | 2073 |
l := l printString |
248 | 2074 |
]. |
2075 |
lineNumberBox initialText:l . |
|
3394 | 2076 |
lineNumberBox label:(resources string:'Goto Line'). |
1380 | 2077 |
lineNumberBox showAtPointer. |
2078 |
||
1524
60582bfee9ce
allow relative gotos (+delta / -delta) in goto-line dialog.
Claus Gittinger <cg@exept.de>
parents:
1496
diff
changeset
|
2079 |
input size > 0 ifTrue:[ |
4500 | 2080 |
input := input withoutSpaces. |
2081 |
input size > 0 ifTrue:[ |
|
2082 |
(input startsWith:$+) ifTrue:[ |
|
2083 |
relative := 1. |
|
2084 |
] ifFalse:[ |
|
2085 |
(input startsWith:$-) ifTrue:[ |
|
2086 |
relative := -1. |
|
2087 |
]. |
|
2088 |
]. |
|
2089 |
relative notNil ifTrue:[ |
|
2090 |
input := input copyFrom:2. |
|
2091 |
]. |
|
2092 |
lineToGo := Integer readFromString:input onError:nil. |
|
2093 |
lineToGo notNil ifTrue:[ |
|
2094 |
relative notNil ifTrue:[ |
|
2095 |
lineToGo := self currentLine + (lineToGo * relative) |
|
2096 |
]. |
|
2097 |
self gotoLine:lineToGo |
|
2098 |
] |
|
2099 |
] |
|
1380 | 2100 |
]. |
2101 |
||
1524
60582bfee9ce
allow relative gotos (+delta / -delta) in goto-line dialog.
Claus Gittinger <cg@exept.de>
parents:
1496
diff
changeset
|
2102 |
"Modified: / 17.5.1998 / 20:07:59 / cg" |
248 | 2103 |
! |
2104 |
||
2836
de07d386cfe8
allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents:
2835
diff
changeset
|
2105 |
openSaveDialog |
de07d386cfe8
allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents:
2835
diff
changeset
|
2106 |
"Ask user for filename using a fileSelectionBox |
de07d386cfe8
allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents:
2835
diff
changeset
|
2107 |
and save contents into that file." |
248 | 2108 |
|
2695
7e13db2802df
better save file dialog (use new dialog vs. use old dialog)
Claus Gittinger <cg@exept.de>
parents:
2693
diff
changeset
|
2109 |
Dialog |
4500 | 2110 |
requestSaveFileName:(resources string:'Save contents in:') |
2111 |
default:defaultFileNameForFileDialog |
|
2112 |
fromDirectory:directoryForFileDialog |
|
2113 |
action:[:fileName | self saveAs:fileName] |
|
2114 |
appendAction:[:fileName | self appendTo:fileName] |
|
2836
de07d386cfe8
allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents:
2835
diff
changeset
|
2115 |
! |
de07d386cfe8
allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents:
2835
diff
changeset
|
2116 |
|
4399 | 2117 |
openSearchBoxAndSearch |
4500 | 2118 |
"search for a string - show a box to enter searchpattern |
4399 | 2119 |
- currently no regular expressions are handled." |
2120 |
||
2121 |
" |
|
2122 |
Q: is it a good idea to preserve the last searchstring between views ? |
|
2123 |
" |
|
2124 |
|searchBox patternHolder caseHolder matchHolder fwd ign match initialString |
|
4485 | 2125 |
bindings bldr doSearch modal searchVariableHolder selectedVariable searchFullWordHolder |
2126 |
replaceBooleanEnabledHolder replaceBooleanHolder replaceTextHolder| |
|
4399 | 2127 |
|
2128 |
searchBarActionBlock notNil ifTrue:[ |
|
4500 | 2129 |
self resetVariablesBeforeNewSearch. |
2130 |
searchBarActionBlock value:#search value:self. |
|
2131 |
^ self |
|
4399 | 2132 |
]. |
2133 |
||
2134 |
modal := (UserPreferences current searchDialogIsModal). "/ thats experimental |
|
2135 |
||
2136 |
ign := lastSearchIgnoredCase ? LastSearchIgnoredCase ? true. |
|
2137 |
caseHolder := ign not asValue. |
|
2138 |
||
2139 |
match := lastSearchWasMatch ? LastSearchWasMatch ? false. |
|
2140 |
matchHolder := match asValue. |
|
2141 |
searchVariableHolder := (lastSearchWasVariableSearch ? false) asValue. |
|
4462
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
2142 |
searchFullWordHolder := false asValue. |
4485 | 2143 |
replaceBooleanHolder := false asValue. |
2144 |
replaceTextHolder := '' asValue. |
|
2145 |
replaceBooleanEnabledHolder := self isReadOnly not asValue. |
|
4399 | 2146 |
|
2147 |
patternHolder := '' asValue. |
|
2148 |
||
2149 |
self setSearchPatternWithMatchEscapes: match. |
|
2150 |
||
2151 |
lastSearchPattern notNil ifTrue:[ |
|
4500 | 2152 |
initialString := lastSearchPattern. |
4399 | 2153 |
]. |
2154 |
"/ No longer force the current selection to be the initialString |
|
2155 |
"/ self hasSelectionWithinSingleLine ifTrue:[ |
|
2156 |
"/ initialString := self selection asString. |
|
2157 |
"/ ]. |
|
2158 |
initialString isNil ifTrue:[ |
|
4500 | 2159 |
LastSearchPatterns size > 0 ifTrue:[ |
2160 |
initialString := LastSearchPatterns first. |
|
2161 |
] |
|
4399 | 2162 |
]. |
2163 |
||
2164 |
initialString notNil ifTrue:[ |
|
4500 | 2165 |
patternHolder value:initialString. |
4399 | 2166 |
]. |
2167 |
||
4500 | 2168 |
fwd := true. |
4399 | 2169 |
|
2170 |
doSearch := [:fwd | |
|
4500 | 2171 |
|isVariableSearch pattern searchAction| |
2172 |
||
2173 |
self resetVariablesBeforeNewSearch. |
|
2174 |
||
2175 |
isVariableSearch := self searchVariableVisible |
|
2176 |
and:[searchVariableHolder value |
|
2177 |
and:[selectedVariable notNil]]. |
|
2178 |
||
2179 |
isVariableSearch ifTrue:[ |
|
2180 |
searchAction := [self searchVariableWithSyntaxElement:selectedVariable forward:fwd]. |
|
2181 |
] ifFalse:[ |
|
2182 |
lastSearchWasVariableSearch := false. |
|
2183 |
LastSearchIgnoredCase := lastSearchIgnoredCase := (caseHolder value not). |
|
2184 |
LastSearchWasMatch := lastSearchWasMatch := matchHolder value. |
|
2185 |
pattern := patternHolder value. |
|
2186 |
pattern notEmptyOrNil ifTrue:[ |
|
2187 |
searchAction := [ |
|
2188 |
self searchUsingSpec:( |
|
2189 |
ListView::SearchSpec new |
|
2190 |
pattern:pattern |
|
2191 |
ignoreCase:lastSearchIgnoredCase |
|
2192 |
match: lastSearchWasMatch |
|
2193 |
variable: searchVariableHolder value |
|
2194 |
fullWord: searchFullWordHolder value |
|
2195 |
forward:fwd). |
|
2196 |
] |
|
2197 |
] |
|
2198 |
]. |
|
2199 |
||
2200 |
replaceBooleanHolder value ifTrue:[ |
|
2201 |
|selStart| |
|
2202 |
||
2203 |
isVariableSearch ifTrue:[ |
|
2204 |
"/ must replace from the end towards beginning, |
|
2205 |
"/ because syntax-elements do not update their position, when |
|
2206 |
"/ the text is changed (in replace). |
|
2207 |
||
2208 |
selectedVariable := selectedVariable lastElementInChain. |
|
2209 |
self selectFromCharacterPosition:selectedVariable start to:selectedVariable stop. |
|
2210 |
searchAction := [selectedVariable := selectedVariable previousElement. |
|
2211 |
selectedVariable notNil ifTrue:[ |
|
2212 |
self selectFromCharacterPosition:selectedVariable start to:selectedVariable stop. |
|
2213 |
]. |
|
2214 |
"/ self searchVariableWithSyntaxElement:selectedVariable forward:false |
|
2215 |
]. |
|
2216 |
]. |
|
2217 |
||
2218 |
selStart := self characterPositionOfSelection. |
|
2219 |
self replace:(replaceTextHolder value). |
|
2220 |
||
2221 |
searchAction value. |
|
2222 |
[self characterPositionOfSelection ~= selStart] whileTrue:[ |
|
2223 |
selStart := self characterPositionOfSelection. |
|
2224 |
self replace:(replaceTextHolder value). |
|
2225 |
searchAction value. |
|
2226 |
] |
|
2227 |
] ifFalse:[ |
|
2228 |
searchAction value. |
|
2229 |
]. |
|
4399 | 2230 |
]. |
2231 |
||
2232 |
bindings := IdentityDictionary new. |
|
2233 |
bindings at:#searchPattern put:patternHolder. |
|
2234 |
modal ifTrue:[ |
|
4500 | 2235 |
bindings at:#nextAction put:[searchBox doAccept.]. |
2236 |
bindings at:#prevAction put:[fwd := false. searchBox doAccept.]. |
|
4399 | 2237 |
] ifFalse:[ |
4500 | 2238 |
bindings at:#nextAction put:[doSearch value:true. "searchBox doAccept."]. |
2239 |
bindings at:#prevAction put:[doSearch value:false. "fwd := false. searchBox doAccept."]. |
|
4399 | 2240 |
]. |
2241 |
bindings at:#caseSensitive put:caseHolder. |
|
2242 |
bindings at:#match put:matchHolder. |
|
2243 |
bindings at:#patternList put:LastSearchPatterns. |
|
2244 |
||
4462
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
2245 |
self supportsSyntaxElements ifFalse:[ |
4500 | 2246 |
bindings at:#searchVariableVisible put:false. |
4462
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
2247 |
] ifTrue:[ |
4500 | 2248 |
bindings at:#searchVariableVisible put:true. |
2249 |
selectedVariable := self syntaxElementForSelectedVariable. |
|
2250 |
bindings at:#searchVariableEnabled put:(selectedVariable notNil). |
|
2251 |
selectedVariable notNil ifTrue:[ |
|
2252 |
bindings |
|
2253 |
at:#stringWithVariableUnderCursorHolder |
|
2254 |
put:('Variable ("%1")' bindWith:selectedVariable value). |
|
2255 |
searchVariableHolder value:true. |
|
2256 |
] ifFalse:[ |
|
2257 |
bindings |
|
2258 |
at:#stringWithVariableUnderCursorHolder |
|
2259 |
put:('Variable (none selected)'). |
|
2260 |
]. |
|
4399 | 2261 |
]. |
2262 |
bindings at:#searchVariable put:searchVariableHolder. |
|
4485 | 2263 |
|
4462
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
2264 |
bindings at:#searchFullWord put:searchFullWordHolder. |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
2265 |
bindings at:#searchFullWordEnabled put:true. |
4399 | 2266 |
|
4485 | 2267 |
bindings at:#replaceEnabled put:replaceBooleanEnabledHolder. |
2268 |
bindings at:#replaceBoolean put:replaceBooleanHolder. |
|
2269 |
bindings at:#replaceTextHolder put:replaceTextHolder. |
|
2270 |
||
4399 | 2271 |
modal ifTrue:[ |
4500 | 2272 |
searchBox := SimpleDialog new. |
4399 | 2273 |
] ifFalse:[ |
4500 | 2274 |
searchBox := ApplicationModel new. |
2275 |
searchBox createBuilder. |
|
4399 | 2276 |
]. |
2277 |
searchBox resources:(self resources). |
|
2278 |
||
2279 |
bldr := searchBox builder. |
|
2280 |
bldr addBindings:bindings. |
|
4462
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
2281 |
bldr aspectAt:#flyByHelpSpec put:(self class flyByHelpSpec). |
4399 | 2282 |
searchBox allButOpenFrom:(self class searchDialogSpec). |
2283 |
||
2284 |
(bldr componentAt:#nextButton) cursor:(Cursor thumbsUp). |
|
2285 |
(bldr componentAt:#prevButton) cursor:(Cursor thumbsUp). |
|
2286 |
(bldr componentAt:#cancelButton) cursor:(Cursor thumbsDown). |
|
2287 |
||
2288 |
modal ifTrue:[ |
|
4500 | 2289 |
searchBox openDialog. |
2290 |
searchBox accepted ifTrue:[ doSearch value:fwd ]. |
|
4399 | 2291 |
] ifFalse:[ |
4500 | 2292 |
(bldr componentAt:#nextButton) isReturnButton:false. |
2293 |
(bldr componentAt:#cancelButton) |
|
2294 |
label:(resources string:'Close'); |
|
2295 |
action:[searchBox closeRequest]. |
|
2296 |
"/ searchBox masterApplication:self application. |
|
2297 |
self topView beMaster. |
|
2298 |
searchBox window |
|
2299 |
beSlave; |
|
2300 |
openInGroup:(self windowGroup). |
|
2301 |
||
2302 |
"/ searchBox window open. |
|
2303 |
searchBox window assignKeyboardFocusToFirstInputField. |
|
4399 | 2304 |
] |
2305 |
||
2306 |
"Modified: / 11-07-2006 / 11:18:38 / fm" |
|
2307 |
"Created: / 08-03-2012 / 14:02:59 / cg" |
|
2308 |
! |
|
2309 |
||
2836
de07d386cfe8
allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents:
2835
diff
changeset
|
2310 |
save |
4500 | 2311 |
"save contents into a file |
2836
de07d386cfe8
allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents:
2835
diff
changeset
|
2312 |
- ask user for filename using a fileSelectionBox." |
de07d386cfe8
allow save-action to be configured
Claus Gittinger <cg@exept.de>
parents:
2835
diff
changeset
|
2313 |
|
3201 | 2314 |
saveAction value |
248 | 2315 |
! |
2316 |
||
2317 |
saveAs:fileName |
|
916
4201c9c2a4f0
show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
2318 |
"save the contents into a file named fileName" |
4500 | 2319 |
|
2488 | 2320 |
^ self saveAs:fileName doAppend:false |
2321 |
! |
|
2322 |
||
2701
b77cc7cf3818
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
2695
diff
changeset
|
2323 |
saveAs:aFilename doAppend:doAppend |
2488 | 2324 |
"save the contents into a file named fileName; |
2325 |
if doAppend is true, the views contents is appended to the existing |
|
2834 | 2326 |
contents - otherwise, it overwrites any previous file contents. |
2327 |
on error return false otherwise return true" |
|
2701
b77cc7cf3818
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
2695
diff
changeset
|
2328 |
|
4534 | 2329 |
^ self saveAs:aFilename doAppend:doAppend compressTabs:true |
2330 |
! |
|
2331 |
||
2332 |
saveAs:aFilename doAppend:doAppend compressTabs:compressTabs |
|
2333 |
"save the contents into a file named fileName; |
|
2334 |
if doAppend is true, the views contents is appended to the existing |
|
2335 |
contents - otherwise, it overwrites any previous file contents. |
|
2336 |
on error return false otherwise return true" |
|
2337 |
||
3426 | 2338 |
|filename msg| |
2701
b77cc7cf3818
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
2695
diff
changeset
|
2339 |
|
b77cc7cf3818
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
2695
diff
changeset
|
2340 |
filename := aFilename asFilename. |
b77cc7cf3818
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
2695
diff
changeset
|
2341 |
|
4437 | 2342 |
self withWriteCursorDo:[ |
4534 | 2343 |
|aStream| |
2344 |
||
2345 |
(FileStream userInitiatedFileSaveQuerySignal queryWith:filename) ifFalse:[ |
|
2346 |
msg := resources |
|
2347 |
stringWithCRs:'Refused to write file ''%1'' !!\(ST/X internal permission check)' |
|
2348 |
with:filename name. |
|
2349 |
] ifTrue:[ |
|
2350 |
[ |
|
2351 |
doAppend ifTrue:[ |
|
2352 |
aStream := filename appendingWriteStream. |
|
2353 |
] ifFalse:[ |
|
2354 |
aStream := filename newReadWriteStream. |
|
2355 |
]. |
|
2356 |
self fileOutContentsOn:aStream compressTabs:compressTabs encoding:externalEncoding. |
|
2357 |
aStream close. |
|
2358 |
contentsWasSaved := true. |
|
2359 |
defaultFileNameForFileDialog := filename. |
|
2360 |
] on:FileStream openErrorSignal do:[:ex| |
|
2361 |
msg := resources stringWithCRs:'Cannot write file ''%1'' !!\(%2)' |
|
2362 |
with:filename name |
|
2363 |
with:FileStream lastErrorString. |
|
2364 |
]. |
|
2365 |
]. |
|
2834 | 2366 |
]. |
3426 | 2367 |
|
2368 |
msg notNil ifTrue:[ |
|
4534 | 2369 |
Dialog warn:msg. |
2370 |
^ false |
|
3426 | 2371 |
]. |
2834 | 2372 |
^ true |
916
4201c9c2a4f0
show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
2373 |
|
4437 | 2374 |
"Modified: / 27-07-2012 / 09:45:13 / cg" |
1288
19eee9e48131
added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
2375 |
! |
19eee9e48131
added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
2376 |
|
19eee9e48131
added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
2377 |
search |
4500 | 2378 |
"search for a string - show a box to enter searchpattern |
1288
19eee9e48131
added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
2379 |
- currently no regular expressions are handled." |
19eee9e48131
added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
2380 |
|
4399 | 2381 |
self openSearchBoxAndSearch |
3318 | 2382 |
|
2383 |
"Modified: / 11-07-2006 / 11:18:38 / fm" |
|
4399 | 2384 |
"Modified: / 08-03-2012 / 14:03:10 / cg" |
3318 | 2385 |
! |
2386 |
||
4500 | 2387 |
search:patternArg ignoreCase:ign forward:fwd |
3577 | 2388 |
"search for a string without matching" |
2389 |
||
4500 | 2390 |
self search:patternArg ignoreCase:ign match: false forward:fwd |
3577 | 2391 |
! |
2392 |
||
4500 | 2393 |
search:patternArg ignoreCase:ign match: match forward:fwd |
3318 | 2394 |
|pattern| |
2395 |
||
2396 |
pattern := patternArg string. |
|
2397 |
pattern notEmpty ifTrue:[ |
|
4500 | 2398 |
self rememberSearchPattern:pattern. |
2399 |
"/ LastSearchIgnoredCase := lastSearchIgnoredCase := ign. |
|
2400 |
"/ LastSearchWasMatch := match. |
|
2401 |
fwd ifFalse:[ |
|
2402 |
lastSearchDirection := #backward. |
|
2403 |
self searchBwd:pattern ignoreCase:ign match: match. " backward search with match is not yet available " |
|
2404 |
] ifTrue:[ |
|
2405 |
lastSearchDirection := #forward. |
|
2406 |
self searchFwd:pattern ignoreCase:ign match: match. |
|
2407 |
] |
|
3318 | 2408 |
] |
2409 |
||
2410 |
"Created: / 11-07-2006 / 11:18:04 / fm" |
|
4408 | 2411 |
"Modified: / 23-03-2012 / 12:12:07 / cg" |
4399 | 2412 |
! |
2413 |
||
4462
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
2414 |
searchUsingSpec:aSearchSpec |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
2415 |
self rememberSearchPattern:(aSearchSpec pattern). |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
2416 |
"/ LastSearchIgnoredCase := lastSearchIgnoredCase := ign. |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
2417 |
"/ LastSearchWasMatch := match. |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
2418 |
aSearchSpec forward ifFalse:[ |
4500 | 2419 |
lastSearchDirection := #backward. |
2420 |
self searchBwdUsingSpec:aSearchSpec |
|
4462
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
2421 |
] ifTrue:[ |
4500 | 2422 |
lastSearchDirection := #forward. |
2423 |
self searchFwdUsingSpec:aSearchSpec |
|
4462
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
2424 |
] |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
2425 |
|
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
2426 |
"Created: / 11-07-2006 / 11:18:04 / fm" |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
2427 |
"Modified: / 23-03-2012 / 12:12:07 / cg" |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
2428 |
! |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
2429 |
|
4399 | 2430 |
searchVariableVisible |
2431 |
"search variable option in searchbox visible? |
|
2432 |
(only true for codeview2's textview)" |
|
2433 |
||
2434 |
^ false |
|
2435 |
||
2436 |
"Created: / 08-03-2012 / 14:01:24 / cg" |
|
2437 |
! |
|
2438 |
||
2439 |
searchVariableWithSyntaxElement:syntaxElementForVariable forward:fwd |
|
4485 | 2440 |
"this only works for CodeView2::TextView, which supports syntaxElements. |
2441 |
Finds the next occurrence of a syntax element (typically, a variable)" |
|
4462
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
2442 |
|
4409 | 2443 |
|el el2| |
4399 | 2444 |
|
2445 |
lastSearchWasVariableSearch := true. |
|
4500 | 2446 |
el := fwd |
2447 |
ifTrue:[syntaxElementForVariable nextElement] |
|
2448 |
ifFalse:[syntaxElementForVariable previousElement]. |
|
4399 | 2449 |
|
2450 |
el notNil ifTrue:[ |
|
4500 | 2451 |
"bug workaround" |
2452 |
(el start = syntaxElementForVariable start) ifTrue:[ |
|
2453 |
el2 := fwd |
|
2454 |
ifTrue:[el nextElement] |
|
2455 |
ifFalse:[el previousElement]. |
|
2456 |
el2 notNil ifTrue:[ |
|
2457 |
el := el2 |
|
2458 |
] |
|
2459 |
]. |
|
4399 | 2460 |
]. |
2461 |
el notNil ifTrue:[ |
|
4500 | 2462 |
self selectFromCharacterPosition:el start to:el stop. |
2463 |
self makeLineVisible:(self lineOfCharacterPosition:el start). |
|
4399 | 2464 |
] ifFalse:[ |
4500 | 2465 |
self showNotFound |
4399 | 2466 |
]. |
2467 |
||
2468 |
"Created: / 08-03-2012 / 14:08:20 / cg" |
|
2469 |
! |
|
2470 |
||
2471 |
syntaxElementForSelectedVariable |
|
2472 |
"for a better search; ignored here, but redefined in CodeView2" |
|
2473 |
||
2474 |
^ nil |
|
2475 |
||
2476 |
"Created: / 08-03-2012 / 14:20:27 / cg" |
|
2477 |
! |
|
2478 |
||
2479 |
syntaxElementForVariableUnderCursor |
|
2480 |
"for a better search; ignored here, but redefined in CodeView2" |
|
2481 |
||
2482 |
^ nil |
|
2483 |
||
2484 |
"Created: / 08-03-2012 / 12:45:26 / cg" |
|
248 | 2485 |
! ! |
2486 |
||
2487 |
!TextView methodsFor:'private'! |
|
2488 |
||
2596 | 2489 |
currentSelectionBgColor |
2490 |
^ selectionBgColor |
|
2491 |
! |
|
2492 |
||
2493 |
currentSelectionFgColor |
|
2494 |
^ selectionFgColor |
|
2495 |
! |
|
2496 |
||
248 | 2497 |
fileOutContentsOn:aStream |
2498 |
"save contents on a stream, replacing leading spaces by tab-characters." |
|
2499 |
||
4500 | 2500 |
self |
2501 |
fileOutContentsOn:aStream |
|
2502 |
compressTabs:true |
|
248 | 2503 |
! |
2504 |
||
2505 |
fileOutContentsOn:aStream compressTabs:compressTabs |
|
2506 |
"save contents on a stream. If compressTabs is true, |
|
2507 |
leading spaces will be replaced by tab-characters in the output." |
|
2508 |
||
4500 | 2509 |
self |
2510 |
fileOutContentsOn:aStream |
|
2511 |
compressTabs:compressTabs |
|
2512 |
encoding:nil |
|
1255
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
2513 |
! |
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
2514 |
|
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
2515 |
fileOutContentsOn:aStream compressTabs:compressTabs encoding:encodingSymOrNil |
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
2516 |
"save contents on a stream. If compressTabs is true, |
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
2517 |
leading spaces will be replaced by tab-characters in the output." |
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
2518 |
|
2877 | 2519 |
|startNr nLines string encoder| |
2520 |
||
2945
5c4f000c7f17
remvoe trailing whiteSpace when saving
Claus Gittinger <cg@exept.de>
parents:
2944
diff
changeset
|
2521 |
self removeTrailingWhitespace. |
5c4f000c7f17
remvoe trailing whiteSpace when saving
Claus Gittinger <cg@exept.de>
parents:
2944
diff
changeset
|
2522 |
|
2877 | 2523 |
encoder := CharacterEncoder encoderToEncodeFrom:characterEncoding into:encodingSymOrNil. |
4455
febe97112d50
changed: #fileOutContentsOn:compressTabs:encoding:
Claus Gittinger <cg@exept.de>
parents:
4450
diff
changeset
|
2524 |
encoder isNullEncoder ifTrue:[ |
4534 | 2525 |
(list contains:[:lineOrNil| |
2526 |
|s| |
|
2527 |
lineOrNil notNil |
|
2528 |
and:[(s := lineOrNil string string) isWideString |
|
2529 |
and:[s asSingleByteStringIfPossible isWideString]] |
|
2530 |
] |
|
2531 |
) ifTrue:[ |
|
2532 |
(Dialog confirm:'The text contains non-8bit characters. Encode as UTF8?') ifFalse:[ |
|
2533 |
^ self |
|
2534 |
] |
|
2535 |
]. |
|
2536 |
encoder := CharacterEncoder encoderToEncodeFrom:#unicode into:#utf8 |
|
4455
febe97112d50
changed: #fileOutContentsOn:compressTabs:encoding:
Claus Gittinger <cg@exept.de>
parents:
4450
diff
changeset
|
2537 |
]. |
2916 | 2538 |
|
758 | 2539 |
aStream isFileStream ifTrue:[ |
4534 | 2540 |
"on some systems, writing linewise is very slow (via NFS) |
2541 |
therefore we convert to a string and write it in big chunks. |
|
2542 |
To avoid creating huge strings, we do it in blocks of 1000 lines, |
|
2543 |
limiting temporary string creation to about 50-80k. |
|
2544 |
" |
|
2545 |
startNr := 1. |
|
2546 |
nLines := list size. |
|
2547 |
[startNr <= nLines] whileTrue:[ |
|
2548 |
string := list |
|
2549 |
asStringWithCRsFrom:startNr |
|
2550 |
to:((startNr + 1000) min:nLines) |
|
2551 |
compressTabs:compressTabs. |
|
2552 |
aStream nextPutAll:(encoder encodeString:string string). |
|
2553 |
startNr := startNr + 1000 + 1. |
|
2554 |
]. |
|
758 | 2555 |
] ifFalse:[ |
4534 | 2556 |
list do:[:aLine | |
2557 |
aLine notNil ifTrue:[ |
|
2558 |
aStream nextPutLine:(encoder encodeString:aLine). |
|
2559 |
] ifFalse:[ |
|
2560 |
aStream cr. |
|
2561 |
] |
|
2562 |
] |
|
758 | 2563 |
] |
248 | 2564 |
|
758 | 2565 |
"Modified: 8.6.1996 / 11:50:46 / cg" |
248 | 2566 |
! |
2567 |
||
668
729295eb37fc
use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
2568 |
getFontParameters |
729295eb37fc
use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
2569 |
"get some info of the used font. They are cached since we use them often .. |
729295eb37fc
use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
2570 |
This is redefined here, to use the fonts maxHeight/maxAscent for |
729295eb37fc
use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
2571 |
line separation. This is required, to allow for proper handling of |
729295eb37fc
use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
2572 |
national characters, such as A-dieresis ..." |
729295eb37fc
use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
2573 |
|
4569 | 2574 |
|italicFont boldFont fA iA bA| |
3258
0a07b6fdd85d
fix: must care for the case where the italic font is higher than
Claus Gittinger <cg@exept.de>
parents:
3251
diff
changeset
|
2575 |
|
1987 | 2576 |
font := font onDevice:device. |
3258
0a07b6fdd85d
fix: must care for the case where the italic font is higher than
Claus Gittinger <cg@exept.de>
parents:
3251
diff
changeset
|
2577 |
italicFont := font asItalic onDevice:device. |
3304
bd0991615b04
When computing font parameters, now consider the bold font, too.
Stefan Vogel <sv@exept.de>
parents:
3298
diff
changeset
|
2578 |
boldFont := font asBold onDevice:device. |
3258
0a07b6fdd85d
fix: must care for the case where the italic font is higher than
Claus Gittinger <cg@exept.de>
parents:
3251
diff
changeset
|
2579 |
|
668
729295eb37fc
use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
2580 |
includesNonStrings == true ifTrue:[ |
4569 | 2581 |
"/ for now, we do not support variable height entries ... |
2582 |
fontHeight := list first heightOn:self |
|
668
729295eb37fc
use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
2583 |
] ifFalse:[ |
4569 | 2584 |
fontHeight := font maxHeight max:(italicFont maxHeight max:(boldFont maxHeight)). |
2585 |
"/ fontHeight := font height "maxHeight" max:(italicFont height "maxHeight" max:(boldFont height "maxHeight")). |
|
668
729295eb37fc
use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
2586 |
]. |
4572 | 2587 |
"/ fontHeight := fontHeight + lineSpacing. |
4569 | 2588 |
"/ fontAscent := font ascent "maxAscent" max:(italicFont ascent "maxAscent" max:(boldFont ascent "maxAscent")). |
4572 | 2589 |
"/ fA := font ascent. |
2590 |
fA := font maxAscent. |
|
2591 |
"/ fA := (font maxAscent + font ascent) // 2. |
|
2592 |
"/ iA := italicFont ascent. |
|
2593 |
iA := italicFont maxAscent. |
|
2594 |
"/ iA := (italicFont maxAscent + italicFont ascent) // 2. |
|
2595 |
"/ bA := boldFont ascent. |
|
2596 |
bA := boldFont maxAscent. |
|
2597 |
"/ bA := (boldFont maxAscent + boldFont ascent) // 2. |
|
4569 | 2598 |
fontAscent := fA max:(iA max:bA). |
668
729295eb37fc
use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
2599 |
fontWidth := font width. |
3258
0a07b6fdd85d
fix: must care for the case where the italic font is higher than
Claus Gittinger <cg@exept.de>
parents:
3251
diff
changeset
|
2600 |
fontIsFixedWidth := font isFixedWidth and:[ italicFont isFixedWidth and:[ boldFont isFixedWidth ]]. |
668
729295eb37fc
use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
2601 |
|
729295eb37fc
use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
2602 |
"Modified: 22.5.1996 / 12:02:47 / cg" |
729295eb37fc
use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
2603 |
"Created: 22.5.1996 / 12:18:34 / cg" |
729295eb37fc
use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
2604 |
! |
729295eb37fc
use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
2605 |
|
3605 | 2606 |
isClosingParenthesis:ch |
2607 |
((parenthesisSpecification at:#close) includes:ch) ifTrue:[^ true]. |
|
4368 | 2608 |
^ ')]}' includes:ch |
2609 |
||
2610 |
"Modified: / 12-02-2012 / 08:37:01 / cg" |
|
3605 | 2611 |
! |
2612 |
||
2613 |
isOpeningParenthesis:ch |
|
2614 |
((parenthesisSpecification at:#open) includes:ch) ifTrue:[^ true]. |
|
4368 | 2615 |
^ '([{' includes:ch |
2616 |
||
2617 |
"Modified: / 12-02-2012 / 08:37:11 / cg" |
|
3605 | 2618 |
! |
2619 |
||
2201
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
2620 |
rememberSearchPattern:pattern |
2691 | 2621 |
|nRemembered patternString| |
2622 |
||
2814
881a1a20eace
clear searchAction whenever the selection is changed.
Claus Gittinger <cg@exept.de>
parents:
2813
diff
changeset
|
2623 |
self clearSearchAction. |
2813
ec8e83691849
forget searchAction, when a new pattern-search is done
Claus Gittinger <cg@exept.de>
parents:
2811
diff
changeset
|
2624 |
|
2691 | 2625 |
patternString := pattern string. |
2201
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
2626 |
|
3270
e3ed37e15f9d
oops - last-searchpatterns handling removed the wrong one.
Claus Gittinger <cg@exept.de>
parents:
3258
diff
changeset
|
2627 |
nRemembered := NumRememberedSearchPatterns ? 20. |
2201
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
2628 |
|
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
2629 |
LastSearchPatterns isNil ifTrue:[ |
4500 | 2630 |
LastSearchPatterns := OrderedCollection new. |
2201
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
2631 |
]. |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
2632 |
"/ move to top or addFirst |
4409 | 2633 |
(LastSearchPatterns includes:patternString) ifTrue:[ |
4500 | 2634 |
LastSearchPatterns remove:patternString. |
2201
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
2635 |
] ifFalse:[ |
4500 | 2636 |
LastSearchPatterns size > nRemembered ifTrue:[ |
2637 |
LastSearchPatterns removeLast |
|
2638 |
] |
|
2201
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
2639 |
]. |
4409 | 2640 |
LastSearchPatterns addFirst:patternString. |
2641 |
||
2642 |
"Modified: / 23-03-2012 / 13:59:09 / cg" |
|
2201
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
2643 |
! |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
2644 |
|
2945
5c4f000c7f17
remvoe trailing whiteSpace when saving
Claus Gittinger <cg@exept.de>
parents:
2944
diff
changeset
|
2645 |
removeTrailingWhitespace |
3001 | 2646 |
list isNil ifTrue:[^self]. |
2945
5c4f000c7f17
remvoe trailing whiteSpace when saving
Claus Gittinger <cg@exept.de>
parents:
2944
diff
changeset
|
2647 |
list keysAndValuesDo:[:lineNR :line | |
4500 | 2648 |
|l| |
2649 |
||
2650 |
line notNil ifTrue:[ |
|
2651 |
l := line withoutTrailingSeparators. |
|
2652 |
list at:lineNR put:l. |
|
2653 |
] |
|
2945
5c4f000c7f17
remvoe trailing whiteSpace when saving
Claus Gittinger <cg@exept.de>
parents:
2944
diff
changeset
|
2654 |
]. |
5c4f000c7f17
remvoe trailing whiteSpace when saving
Claus Gittinger <cg@exept.de>
parents:
2944
diff
changeset
|
2655 |
! |
5c4f000c7f17
remvoe trailing whiteSpace when saving
Claus Gittinger <cg@exept.de>
parents:
2944
diff
changeset
|
2656 |
|
4009 | 2657 |
resetVariablesBeforeNewSearch |
2658 |
"clear the autosearch action, when the first pattern is searched for" |
|
2659 |
||
2660 |
searchAction := nil. |
|
2661 |
! |
|
2662 |
||
248 | 2663 |
scrollSelectDown |
2664 |
"auto scroll action; scroll and reinstall timed-block" |
|
2665 |
||
2666 |
|prevEndLine| |
|
2667 |
||
2668 |
"just to make certain ..." |
|
2669 |
selectionEndLine isNil ifTrue:[^ self]. |
|
2670 |
||
2671 |
self scrollDown. |
|
2672 |
||
2673 |
"make new selection immediately visible" |
|
2674 |
prevEndLine := selectionEndLine. |
|
2675 |
selectionEndLine := firstLineShown + nFullLinesShown. |
|
2676 |
selectionEndCol := 0. |
|
2677 |
prevEndLine to:selectionEndLine do:[:lineNr | |
|
4500 | 2678 |
self redrawLine:lineNr |
248 | 2679 |
]. |
2680 |
Processor addTimedBlock:autoScrollBlock afterSeconds:autoScrollDeltaT. |
|
4101 | 2681 |
self selectionChanged. |
248 | 2682 |
! |
2683 |
||
2684 |
scrollSelectLeft |
|
2685 |
"auto scroll action; scroll and reinstall timed-block" |
|
2686 |
||
2687 |
|prevStartLine| |
|
2688 |
||
2689 |
"just to make certain ..." |
|
2690 |
selectionStartLine isNil ifTrue:[^ self]. |
|
2691 |
selectionStartCol isNil ifTrue:[^ self]. |
|
2692 |
||
2693 |
"make new selection immediately visible" |
|
2694 |
prevStartLine := selectionStartLine. |
|
2695 |
selectionStartCol := selectionStartCol - 1 max:1. |
|
2696 |
self scrollLeft. |
|
2697 |
||
2698 |
Processor addTimedBlock:autoScrollBlock afterSeconds:autoScrollDeltaT. |
|
4101 | 2699 |
self selectionChanged. |
248 | 2700 |
! |
2701 |
||
2702 |
scrollSelectRight |
|
2703 |
"auto scroll action; scroll and reinstall timed-block" |
|
2704 |
||
4156 | 2705 |
|prevEndCol firstVisibleCol endLine| |
248 | 2706 |
|
2707 |
"just to make certain ..." |
|
2708 |
selectionEndCol isNil ifTrue:[^ self]. |
|
4169 | 2709 |
selectionEndLine isNil ifTrue:[^ self]. |
248 | 2710 |
|
2711 |
prevEndCol := selectionEndCol. |
|
4156 | 2712 |
selectionEndCol := (selectionEndCol + 1) min:(self listAt:selectionEndLine) size. |
2713 |
||
2714 |
endLine := self listLineToVisibleLine:selectionEndLine. |
|
2715 |
endLine notNil ifTrue:[ |
|
4500 | 2716 |
firstVisibleCol := self colOfX:1 inVisibleLine:endLine. |
2717 |
selectionEndCol < firstVisibleCol ifTrue:[ |
|
2718 |
"/ scrolling faster than selection advances... |
|
2719 |
selectionEndCol := firstVisibleCol |
|
2720 |
]. |
|
4156 | 2721 |
]. |
2722 |
||
2723 |
self selectionChanged. |
|
248 | 2724 |
self scrollRight. |
4156 | 2725 |
"/ self repairDamage. |
248 | 2726 |
|
2727 |
Processor addTimedBlock:autoScrollBlock afterSeconds:autoScrollDeltaT. |
|
4156 | 2728 |
|
2729 |
"Modified: / 05-08-2010 / 21:25:56 / cg" |
|
248 | 2730 |
! |
2731 |
||
2732 |
scrollSelectUp |
|
2733 |
"auto scroll action; scroll and reinstall timed-block" |
|
2734 |
||
2735 |
|prevStartLine| |
|
2736 |
||
2737 |
"just to make certain ..." |
|
2738 |
selectionStartLine isNil ifTrue:[^ self]. |
|
2739 |
||
2740 |
self scrollUp. |
|
2741 |
||
2742 |
"make new selection immediately visible" |
|
2743 |
prevStartLine := selectionStartLine. |
|
2744 |
selectionStartLine := firstLineShown. |
|
2745 |
selectionStartCol := 1. |
|
2746 |
selectionStartLine to:prevStartLine do:[:lineNr | |
|
4500 | 2747 |
self redrawLine:lineNr |
248 | 2748 |
]. |
2749 |
Processor addTimedBlock:autoScrollBlock afterSeconds:autoScrollDeltaT. |
|
4101 | 2750 |
self selectionChanged. |
248 | 2751 |
! |
2752 |
||
2753 |
stopScrollSelect |
|
2754 |
"stop auto scroll; deinstall timed-block" |
|
2755 |
||
2756 |
autoScrollBlock notNil ifTrue:[ |
|
4500 | 2757 |
Processor removeTimedBlock:autoScrollBlock. |
2758 |
self compressMotionEvents:true. |
|
2759 |
autoScrollBlock := nil. |
|
2760 |
autoScrollDeltaT := nil |
|
248 | 2761 |
] |
2762 |
! |
|
2763 |
||
2764 |
widthForScrollBetween:firstLine and:lastLine |
|
2765 |
"return the width in pixels for a scroll between firstLine and lastLine" |
|
2766 |
||
2767 |
selectionStartLine notNil ifTrue:[ |
|
4500 | 2768 |
"/ if there is a selection which covers multiple lines, |
2769 |
"/ we have to scroll the whole width (to include the selection-rectangle) |
|
2770 |
||
2771 |
(lastLine < selectionStartLine) ifFalse:[ |
|
2772 |
(firstLine > selectionEndLine) ifFalse:[ |
|
2773 |
^ width |
|
2774 |
] |
|
2775 |
]. |
|
248 | 2776 |
]. |
2777 |
^ super widthForScrollBetween:firstLine and:lastLine |
|
2778 |
! ! |
|
2779 |
||
997 | 2780 |
!TextView methodsFor:'queries'! |
2781 |
||
4063 | 2782 |
hasSearchActionSelection |
2783 |
"Here we fake the use of typeOfSelection which is really in EditTextView" |
|
2784 |
||
2785 |
^ false |
|
2786 |
! |
|
2787 |
||
997 | 2788 |
specClass |
1380 | 2789 |
"redefined, since the name of my specClass is nonStandard (i.e. not TextViewSpec)" |
2790 |
||
997 | 2791 |
self class == TextView ifTrue:[^ TextEditorSpec]. |
1046 | 2792 |
^ super specClass |
997 | 2793 |
|
1380 | 2794 |
"Modified: / 31.10.1997 / 19:48:35 / cg" |
997 | 2795 |
! ! |
2796 |
||
248 | 2797 |
!TextView methodsFor:'redrawing'! |
2798 |
||
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2799 |
clearMarginOfVisibleLine:visLine with:color |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2800 |
"if there is a margin, clear it - a helper for selection drawing" |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2801 |
|
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2802 |
(leftMargin ~~ 0) ifTrue:[ |
4500 | 2803 |
self paint:color. |
2804 |
self fillRectangleX:margin |
|
2805 |
y:(self yOfVisibleLine:visLine) |
|
2806 |
width:leftMargin |
|
2807 |
height:fontHeight |
|
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2808 |
] |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2809 |
|
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2810 |
"Created: 6.3.1996 / 14:22:55 / cg" |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2811 |
! |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2812 |
|
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2813 |
drawSelectedFromVisibleLine:startVisLineNr to:endVisLineNr |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2814 |
startVisLineNr to:endVisLineNr do:[:visLine | |
4500 | 2815 |
self drawVisibleLineSelected:visLine |
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2816 |
] |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2817 |
! |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2818 |
|
4500 | 2819 |
drawVisibleLineSelected:visLineNr |
2820 |
self |
|
2821 |
drawLine:(self withoutAnyColorEmphasis:(self visibleAt:visLineNr)) |
|
2822 |
inVisible:visLineNr |
|
2823 |
with:self currentSelectionFgColor and:self currentSelectionBgColor |
|
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2824 |
! |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2825 |
|
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2826 |
drawVisibleLineSelected:visLineNr col:col |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2827 |
self |
4500 | 2828 |
drawLine:(self withoutAnyColorEmphasis:(self visibleAt:visLineNr)) |
2829 |
inVisible:visLineNr |
|
2830 |
col:col |
|
2831 |
with:self currentSelectionFgColor and:self currentSelectionBgColor |
|
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2832 |
! |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2833 |
|
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2834 |
drawVisibleLineSelected:visLineNr from:selectionStartCol |
4500 | 2835 |
self |
2836 |
drawLine:(self withoutAnyColorEmphasis:(self visibleAt:visLineNr)) |
|
2837 |
inVisible:visLineNr |
|
2838 |
from:selectionStartCol |
|
2839 |
with:self currentSelectionFgColor and:self currentSelectionBgColor. |
|
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2840 |
! |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2841 |
|
2558
4c10bec1117d
more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents:
2557
diff
changeset
|
2842 |
drawVisibleLineSelected:visLineNr from:startCol to:endCol |
4500 | 2843 |
self |
2844 |
drawLine:(self withoutAnyColorEmphasis:(self visibleAt:visLineNr)) |
|
2845 |
inVisible:visLineNr |
|
2846 |
from:startCol to:endCol |
|
2847 |
with:self currentSelectionFgColor and:self currentSelectionBgColor. |
|
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2848 |
! |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2849 |
|
248 | 2850 |
redrawFromVisibleLine:startVisLineNr to:endVisLineNr |
2851 |
"redraw a visible line range" |
|
2852 |
||
2853 |
|startLine endLine specialCare end selVisStart line1 line2| |
|
2854 |
||
2855 |
shown ifFalse:[^ self]. |
|
2856 |
||
2857 |
end := endVisLineNr. |
|
2858 |
(end > nLinesShown) ifTrue:[ |
|
4500 | 2859 |
end := nLinesShown |
248 | 2860 |
]. |
2861 |
||
2740
892dfb6b0da1
kludge workaround selectionEndLine bug
Claus Gittinger <cg@exept.de>
parents:
2735
diff
changeset
|
2862 |
selectionEndLine isNil ifTrue:[ |
4500 | 2863 |
selectionStartLine := nil |
2740
892dfb6b0da1
kludge workaround selectionEndLine bug
Claus Gittinger <cg@exept.de>
parents:
2735
diff
changeset
|
2864 |
]. |
2735 | 2865 |
|
248 | 2866 |
selectionStartLine isNil ifTrue:[ |
4500 | 2867 |
specialCare := false |
248 | 2868 |
] ifFalse:[ |
4500 | 2869 |
startLine := self visibleLineToAbsoluteLine:startVisLineNr. |
2870 |
(startLine > selectionEndLine) ifTrue:[ |
|
2871 |
specialCare := false |
|
2872 |
] ifFalse:[ |
|
2873 |
endLine := self visibleLineToAbsoluteLine:end. |
|
2874 |
(endLine < selectionStartLine) ifTrue:[ |
|
2875 |
specialCare := false |
|
2876 |
] ifFalse:[ |
|
2877 |
specialCare := true |
|
2878 |
] |
|
2879 |
] |
|
248 | 2880 |
]. |
2881 |
||
2882 |
"easy: nothing is selected" |
|
2883 |
specialCare ifFalse:[ |
|
4500 | 2884 |
super redrawFromVisibleLine:startVisLineNr to:end. |
2885 |
^ self |
|
248 | 2886 |
]. |
2887 |
||
2888 |
"easy: all is selected" |
|
2889 |
((selectionStartLine < startLine) and:[selectionEndLine > endLine]) ifTrue:[ |
|
4500 | 2890 |
self drawSelectedFromVisibleLine:startVisLineNr to:end. |
2891 |
^ self |
|
248 | 2892 |
]. |
2893 |
||
2894 |
(selectionStartLine >= firstLineShown) ifTrue:[ |
|
4500 | 2895 |
"draw unselected top part" |
2896 |
||
2897 |
selVisStart := self listLineToVisibleLine:selectionStartLine. |
|
2898 |
super redrawFromVisibleLine:startVisLineNr to:(selVisStart - 1). |
|
2899 |
||
2900 |
"and first partial selected line" |
|
2901 |
self redrawVisibleLine:selVisStart. |
|
2902 |
||
2903 |
"rest starts after this one" |
|
2904 |
line1 := selVisStart + 1 |
|
248 | 2905 |
] ifFalse:[ |
4500 | 2906 |
line1 := 1 |
248 | 2907 |
]. |
2908 |
||
2909 |
(line1 > end) ifTrue:[^ self]. |
|
2910 |
(line1 < startVisLineNr) ifTrue:[ |
|
4500 | 2911 |
line1 := startVisLineNr |
248 | 2912 |
]. |
2913 |
||
2914 |
"draw middle part of selection" |
|
2915 |
||
2916 |
(selectionEndLine >= (firstLineShown + nLinesShown)) ifTrue:[ |
|
4500 | 2917 |
line2 := nLinesShown |
248 | 2918 |
] ifFalse:[ |
4500 | 2919 |
line2 := (self listLineToVisibleLine:selectionEndLine) - 1 |
248 | 2920 |
]. |
2921 |
(line2 > end) ifTrue:[ |
|
4500 | 2922 |
line2 := end |
248 | 2923 |
]. |
2924 |
||
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2925 |
self drawSelectedFromVisibleLine:line1 to:line2. |
248 | 2926 |
|
2927 |
(line2 >= end) ifTrue:[^ self]. |
|
2928 |
||
2929 |
"last line of selection" |
|
2930 |
self redrawVisibleLine:(line2 + 1). |
|
2931 |
||
2932 |
((line2 + 2) <= end) ifTrue:[ |
|
4500 | 2933 |
super redrawFromVisibleLine:(line2 + 2) to:end |
248 | 2934 |
] |
2935 |
! |
|
2936 |
||
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2937 |
redrawMarginOfVisibleLine:visLine |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2938 |
"draw margin - a helper for selection drawing" |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2939 |
|
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2940 |
|
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2941 |
(leftMargin ~~ 0) ifTrue:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2942 |
] |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2943 |
|
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2944 |
"Created: 6.3.1996 / 14:21:48 / cg" |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2945 |
! |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2946 |
|
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2947 |
redrawVisibleLine:visLineNr |
248 | 2948 |
"redraw visible line lineNr" |
2949 |
||
2558
4c10bec1117d
more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents:
2557
diff
changeset
|
2950 |
|line| |
248 | 2951 |
|
4528 | 2952 |
(selectionStartLine notNil and:[selectionEndLine notNil |
2953 |
and:[ selectionStartCol notNil and:[selectionEndCol notNil]]]) ifTrue:[ |
|
2954 |
line := self visibleLineToAbsoluteLine:visLineNr. |
|
2955 |
(line between:selectionStartLine and:selectionEndLine) ifTrue:[ |
|
2956 |
(line == selectionStartLine) ifTrue:[ |
|
2957 |
(line == selectionEndLine) ifTrue:[ |
|
2958 |
"it's part-of-single-line selection" |
|
2959 |
self clearMarginOfVisibleLine:visLineNr with:bgColor. |
|
2960 |
(selectionStartCol > 1) ifTrue:[ |
|
2961 |
super redrawVisibleLine:visLineNr from:1 to:(selectionStartCol - 1) |
|
2962 |
]. |
|
2963 |
self drawVisibleLineSelected:visLineNr from:selectionStartCol to:selectionEndCol. |
|
2964 |
super redrawVisibleLine:visLineNr from:(selectionEndCol + 1). |
|
2965 |
^ self |
|
2966 |
]. |
|
2967 |
||
2968 |
"it's the first line of a multi-line selection" |
|
2969 |
(selectionStartCol ~~ 1) ifTrue:[ |
|
2970 |
self clearMarginOfVisibleLine:visLineNr with:bgColor. |
|
2971 |
super redrawVisibleLine:visLineNr from:1 to:(selectionStartCol - 1) |
|
2972 |
] ifFalse:[ |
|
2973 |
viewOrigin x == 0 ifTrue:[ |
|
2974 |
self clearMarginOfVisibleLine:visLineNr with:self currentSelectionBgColor. |
|
2975 |
] |
|
2976 |
]. |
|
2977 |
self drawVisibleLineSelected:visLineNr from:selectionStartCol. |
|
2978 |
^ self |
|
2979 |
]. |
|
2980 |
||
2981 |
(line == selectionEndLine) ifTrue:[ |
|
2982 |
"it's the last line of a multi-line selection" |
|
2983 |
(selectionEndCol == 0) ifTrue:[ |
|
2984 |
^ super redrawVisibleLine:visLineNr |
|
2985 |
]. |
|
2986 |
||
2987 |
self clearMarginOfVisibleLine:visLineNr with:self currentSelectionBgColor. |
|
2988 |
self drawVisibleLineSelected:visLineNr from:1 to:selectionEndCol. |
|
2989 |
super redrawVisibleLine:visLineNr from:(selectionEndCol + 1). |
|
2990 |
^ self |
|
2991 |
]. |
|
2992 |
||
2993 |
"it's a full line in a multi-line selection" |
|
2994 |
self clearMarginOfVisibleLine:visLineNr with:self currentSelectionBgColor. |
|
2995 |
self drawVisibleLineSelected:visLineNr. |
|
2996 |
^ self |
|
2997 |
] |
|
248 | 2998 |
]. |
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2999 |
super redrawVisibleLine:visLineNr |
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
3000 |
|
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
3001 |
"Modified: 6.3.1996 / 14:22:19 / cg" |
248 | 3002 |
! |
3003 |
||
3004 |
redrawVisibleLine:visLine col:col |
|
633 | 3005 |
"redraw single character at col in visible line lineNr." |
248 | 3006 |
|
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
3007 |
|line| |
633 | 3008 |
|
3009 |
"/ |
|
3010 |
"/ care for selection |
|
3011 |
"/ |
|
4528 | 3012 |
(selectionStartLine notNil and:[selectionEndLine notNil |
3013 |
and:[ selectionStartCol notNil and:[selectionEndCol notNil]]]) ifTrue:[ |
|
3014 |
line := self visibleLineToAbsoluteLine:visLine. |
|
3015 |
(line between:selectionStartLine and:selectionEndLine) ifTrue:[ |
|
3016 |
((line == selectionStartLine) |
|
3017 |
and: [col < selectionStartCol]) ifFalse:[ |
|
3018 |
((line == selectionEndLine) |
|
3019 |
and: [col > selectionEndCol]) ifFalse:[ |
|
3020 |
"its in the selection" |
|
3021 |
self drawVisibleLineSelected:visLine col:col. |
|
3022 |
^ self. |
|
3023 |
] |
|
3024 |
] |
|
3025 |
] |
|
248 | 3026 |
]. |
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
3027 |
self drawVisibleLine:visLine col:col with:fgColor and:bgColor |
1496 | 3028 |
|
3029 |
"Modified: / 22.4.1998 / 08:53:05 / cg" |
|
248 | 3030 |
! |
3031 |
||
3032 |
redrawVisibleLine:visLine from:startCol |
|
3033 |
"redraw visible line lineNr from startCol to end of line" |
|
3034 |
||
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
3035 |
|col line| |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
3036 |
|
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
3037 |
col := startCol. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
3038 |
col == 0 ifTrue:[ |
4500 | 3039 |
col := 1. |
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
3040 |
]. |
248 | 3041 |
|
2778
223915a2d6a4
kludge workaround selectionEndLine is sometimes nil
Claus Gittinger <cg@exept.de>
parents:
2772
diff
changeset
|
3042 |
(selectionStartLine notNil and:[selectionEndLine notNil]) ifTrue:[ |
4500 | 3043 |
line := self visibleLineToAbsoluteLine:visLine. |
3044 |
(line between:selectionStartLine and:selectionEndLine) ifTrue:[ |
|
3045 |
((line == selectionStartLine) |
|
3046 |
or:[line == selectionEndLine]) ifTrue:[ |
|
3047 |
"since I'm lazy, redraw full line" |
|
3048 |
self redrawVisibleLine:visLine. |
|
3049 |
^ self |
|
3050 |
]. |
|
3051 |
"the line is fully within the selection" |
|
3052 |
self drawVisibleLineSelected:visLine from:col. |
|
3053 |
^ self |
|
3054 |
] |
|
248 | 3055 |
]. |
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
3056 |
super redrawVisibleLine:visLine from:col |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
3057 |
|
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
3058 |
"Modified: 6.3.1996 / 14:19:38 / cg" |
248 | 3059 |
! |
3060 |
||
3061 |
redrawVisibleLine:visLine from:startCol to:endCol |
|
3062 |
"redraw visible line lineNr from startCol to endCol" |
|
3063 |
||
3064 |
|line allOut allIn leftCol rightCol| |
|
3065 |
||
3066 |
line := self visibleLineToAbsoluteLine:visLine. |
|
3067 |
||
3068 |
allIn := false. |
|
3069 |
allOut := false. |
|
4528 | 3070 |
(selectionStartLine isNil or:[selectionEndLine isNil |
3071 |
or:[selectionStartCol isNil or:[selectionEndCol isNil]]]) ifTrue:[ |
|
3072 |
allOut := true |
|
248 | 3073 |
] ifFalse:[ |
4528 | 3074 |
(line between:selectionStartLine and:selectionEndLine) ifFalse:[ |
3075 |
allOut := true |
|
3076 |
] ifTrue:[ |
|
3077 |
(selectionStartLine == selectionEndLine) ifTrue:[ |
|
3078 |
((endCol < selectionStartCol) |
|
3079 |
or:[startCol > selectionEndCol]) ifTrue:[ |
|
3080 |
allOut := true |
|
3081 |
] ifFalse:[ |
|
3082 |
((startCol >= selectionStartCol) |
|
3083 |
and:[endCol <= selectionEndCol]) ifTrue:[ |
|
3084 |
allIn := true |
|
3085 |
] |
|
3086 |
] |
|
3087 |
] ifFalse:[ |
|
3088 |
(line == selectionStartLine) ifTrue:[ |
|
3089 |
(endCol < selectionStartCol) ifTrue:[ |
|
3090 |
allOut := true |
|
3091 |
] ifFalse:[ |
|
3092 |
(startCol >= selectionStartCol) ifTrue:[ |
|
3093 |
allIn := true |
|
3094 |
] |
|
3095 |
] |
|
3096 |
] ifFalse:[ |
|
3097 |
(line == selectionEndLine) ifTrue:[ |
|
3098 |
(startCol > selectionEndCol) ifTrue:[ |
|
3099 |
allOut := true |
|
3100 |
] ifFalse:[ |
|
3101 |
(endCol <= selectionEndCol) ifTrue:[ |
|
3102 |
allIn := true |
|
3103 |
] |
|
3104 |
] |
|
3105 |
] ifFalse:[ |
|
3106 |
allIn := true |
|
3107 |
] |
|
3108 |
] |
|
3109 |
] |
|
3110 |
] |
|
248 | 3111 |
]. |
3112 |
allOut ifTrue:[ |
|
4528 | 3113 |
super redrawVisibleLine:visLine from:startCol to:endCol. |
3114 |
^ self |
|
248 | 3115 |
]. |
3116 |
||
3117 |
allIn ifTrue:[ |
|
4528 | 3118 |
self drawVisibleLineSelected:visLine from:startCol to:endCol |
248 | 3119 |
] ifFalse:[ |
4528 | 3120 |
"redraw part before selection" |
3121 |
((line == selectionStartLine) |
|
3122 |
and:[startCol <= selectionStartCol]) ifTrue:[ |
|
3123 |
super redrawVisibleLine:visLine from:startCol |
|
3124 |
to:(selectionStartCol - 1). |
|
3125 |
leftCol := selectionStartCol |
|
3126 |
] ifFalse:[ |
|
3127 |
leftCol := startCol |
|
3128 |
]. |
|
3129 |
"redraw selected part" |
|
3130 |
(selectionEndLine > line) ifTrue:[ |
|
3131 |
rightCol := endCol |
|
3132 |
] ifFalse:[ |
|
3133 |
rightCol := selectionEndCol min:endCol |
|
3134 |
]. |
|
3135 |
self drawVisibleLineSelected:visLine from:leftCol to:rightCol. |
|
3136 |
||
3137 |
"redraw part after selection" |
|
3138 |
(rightCol < endCol) ifTrue:[ |
|
3139 |
super redrawVisibleLine:visLine from:(rightCol + 1) to:endCol |
|
3140 |
] |
|
248 | 3141 |
]. |
3142 |
||
3143 |
"special care for first and last line of selection: |
|
3144 |
must handle margin also" |
|
3145 |
||
3146 |
((line == selectionEndLine) |
|
3147 |
and:[(startCol == 1) |
|
3148 |
and:[selectionStartLine < selectionEndLine]]) |
|
3149 |
ifTrue:[ |
|
4528 | 3150 |
self clearMarginOfVisibleLine:visLine with:self currentSelectionBgColor. |
248 | 3151 |
]. |
3152 |
||
3153 |
((line == selectionStartLine) |
|
3154 |
and:[(startCol == 1) |
|
3155 |
and:[selectionStartLine < selectionEndLine]]) |
|
3156 |
ifTrue:[ |
|
4528 | 3157 |
self clearMarginOfVisibleLine:visLine with:bgColor. |
248 | 3158 |
] |
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
3159 |
|
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
3160 |
"Modified: 6.3.1996 / 14:23:26 / cg" |
248 | 3161 |
! ! |
3162 |
||
3163 |
!TextView methodsFor:'searching'! |
|
3164 |
||
2814
881a1a20eace
clear searchAction whenever the selection is changed.
Claus Gittinger <cg@exept.de>
parents:
2813
diff
changeset
|
3165 |
clearSearchAction |
881a1a20eace
clear searchAction whenever the selection is changed.
Claus Gittinger <cg@exept.de>
parents:
2813
diff
changeset
|
3166 |
searchAction := nil. |
881a1a20eace
clear searchAction whenever the selection is changed.
Claus Gittinger <cg@exept.de>
parents:
2813
diff
changeset
|
3167 |
! |
881a1a20eace
clear searchAction whenever the selection is changed.
Claus Gittinger <cg@exept.de>
parents:
2813
diff
changeset
|
3168 |
|
1322
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
3169 |
scanFor:aCharacter fromLine:startLine col:startCol forward:forward |
4500 | 3170 |
ifFound:foundBlock |
3171 |
ifNotFound:notFoundBlock |
|
3172 |
"search for a character in the direction given by forward. |
|
1322
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
3173 |
Performs foundBlock with line/col as argument if found, notFoundBlock if not." |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
3174 |
|
4500 | 3175 |
|lineString |
1322
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
3176 |
line "{ Class: SmallInteger }" |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
3177 |
col "{ Class: SmallInteger }" |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
3178 |
delta "{ Class: SmallInteger }" |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
3179 |
endCol "{ Class: SmallInteger }" |
4500 | 3180 |
cc |
1322
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
3181 |
maxLine "{ Class: SmallInteger }" |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
3182 |
| |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
3183 |
|
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
3184 |
col := startCol. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
3185 |
line := startLine. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
3186 |
forward ifTrue:[ |
4500 | 3187 |
delta := 1. |
1322
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
3188 |
] ifFalse:[ |
4500 | 3189 |
delta := -1. |
1322
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
3190 |
]. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
3191 |
|
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
3192 |
lineString := list at:line. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
3193 |
maxLine := list size. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
3194 |
|
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
3195 |
col := col + delta. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
3196 |
[true] whileTrue:[ |
4500 | 3197 |
lineString notNil ifTrue:[ |
3198 |
forward ifTrue:[ |
|
3199 |
endCol := lineString size. |
|
3200 |
] ifFalse:[ |
|
3201 |
endCol := 1 |
|
3202 |
]. |
|
3203 |
||
3204 |
col to:endCol by:delta do:[:rCol | |
|
3205 |
cc := lineString at:rCol. |
|
3206 |
cc == aCharacter ifTrue:[ |
|
3207 |
^ foundBlock value:line value:rCol. |
|
3208 |
] |
|
3209 |
]. |
|
3210 |
]. |
|
3211 |
line := line + delta. |
|
3212 |
(line < 1 or:[line > maxLine]) ifTrue:[ |
|
3213 |
^ notFoundBlock value |
|
3214 |
]. |
|
3215 |
lineString := list at:line. |
|
3216 |
forward ifTrue:[ |
|
3217 |
col := 1 |
|
3218 |
] ifFalse:[ |
|
3219 |
col := lineString size |
|
3220 |
] |
|
1322
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
3221 |
]. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
3222 |
"not reached" |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
3223 |
|
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
3224 |
"Modified: 15.10.1996 / 12:22:30 / cg" |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
3225 |
"Created: 11.9.1997 / 04:36:29 / cg" |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
3226 |
! |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
3227 |
|
3802 | 3228 |
searchAction |
3229 |
^ searchAction |
|
3230 |
! |
|
3231 |
||
2807 | 3232 |
searchAction:aSearcherOrSearchBlock |
3233 |
searchAction := aSearcherOrSearchBlock |
|
3234 |
! |
|
3235 |
||
1893
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
3236 |
searchAgainInSameDirection |
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
3237 |
"search again in the same direction and -if found- position cursor" |
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
3238 |
|
3577 | 3239 |
|ign match| |
1893
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
3240 |
|
3981 | 3241 |
searchBarActionBlock notNil ifTrue:[ |
4500 | 3242 |
searchBarActionBlock value:#forward value:self. |
3243 |
^ self |
|
3581 | 3244 |
]. |
3245 |
||
3399
c350a2e3efee
dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
3246 |
ign := lastSearchIgnoredCase ? LastSearchIgnoredCase ? true. |
3577 | 3247 |
match := lastSearchWasMatch ? LastSearchWasMatch ? false. |
3248 |
||
3249 |
self setSearchPatternWithMatchEscapes: match. |
|
1893
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
3250 |
lastSearchPattern notNil ifTrue:[ |
4500 | 3251 |
lastSearchDirection == #backward ifTrue:[ |
3252 |
self |
|
3253 |
searchBwd:lastSearchPattern |
|
3254 |
ignoreCase:ign |
|
3255 |
match: match |
|
3256 |
] ifFalse:[ |
|
3257 |
self |
|
3258 |
searchFwd:lastSearchPattern |
|
3259 |
ignoreCase:ign |
|
3260 |
match: match |
|
3261 |
] |
|
1893
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
3262 |
] |
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
3263 |
|
3399
c350a2e3efee
dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
3264 |
"Created: / 03-05-1999 / 15:02:16 / cg" |
c350a2e3efee
dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
3265 |
"Modified: / 21-09-2006 / 16:47:57 / cg" |
1893
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
3266 |
! |
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
3267 |
|
248 | 3268 |
searchBwd |
4462
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
3269 |
"search backward (for the same thing again) |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
3270 |
If found, position cursor" |
248 | 3271 |
|
4399 | 3272 |
|ign selectedVariable| |
1353 | 3273 |
|
2811 | 3274 |
searchAction notNil ifTrue:[ |
4500 | 3275 |
"/autosearch is cleared whenever there is search with user selection |
3276 |
(self hasSelection and:[self hasSearchActionSelection not]) ifTrue: [self clearSearchAction]. |
|
4178 | 3277 |
]. |
3278 |
||
3279 |
searchAction notNil ifTrue:[ |
|
4500 | 3280 |
"/confusing: this is for autosearch of variables (browse variable uses, for example) |
3281 |
self searchUsingSearchAction:#backward. |
|
3282 |
^ self. |
|
2807 | 3283 |
]. |
3981 | 3284 |
searchBarActionBlock notNil ifTrue:[ |
4500 | 3285 |
searchBarActionBlock value:#backward value:self. |
3286 |
^ self |
|
3581 | 3287 |
]. |
4399 | 3288 |
lastSearchWasVariableSearch ifTrue:[ |
4500 | 3289 |
selectedVariable := self syntaxElementForSelectedVariable. |
3290 |
selectedVariable notNil ifTrue:[ |
|
3291 |
self searchVariableWithSyntaxElement:selectedVariable forward:false. |
|
3292 |
^ self. |
|
3293 |
]. |
|
3294 |
lastSearchWasVariableSearch := false. |
|
4399 | 3295 |
]. |
2807 | 3296 |
|
3399
c350a2e3efee
dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
3297 |
ign := lastSearchIgnoredCase ? LastSearchIgnoredCase ? true. |
1353 | 3298 |
|
3577 | 3299 |
self setSearchPatternWithMatchEscapes: false. |
2414
ec98bcbd4c61
if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents:
2413
diff
changeset
|
3300 |
lastSearchPattern isNil ifTrue:[ |
4500 | 3301 |
LastSearchPatterns size > 0 ifTrue:[ |
3302 |
lastSearchPattern := LastSearchPatterns first |
|
3303 |
] |
|
2414
ec98bcbd4c61
if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents:
2413
diff
changeset
|
3304 |
]. |
ec98bcbd4c61
if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents:
2413
diff
changeset
|
3305 |
|
1326 | 3306 |
lastSearchPattern notNil ifTrue:[ |
4500 | 3307 |
lastSearchDirection := #backward. |
3308 |
self rememberSearchPattern:lastSearchPattern. |
|
3309 |
self |
|
3310 |
searchBwd:lastSearchPattern |
|
3311 |
ignoreCase:ign |
|
248 | 3312 |
] |
1326 | 3313 |
|
4399 | 3314 |
"Modified: / 08-03-2012 / 14:26:25 / cg" |
248 | 3315 |
! |
3316 |
||
3317 |
searchBwd:pattern |
|
3318 |
"do a backward search" |
|
3319 |
||
3320 |
self searchBwd:pattern ifAbsent:[self showNotFound]. |
|
3399
c350a2e3efee
dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
3321 |
"/ lastSearchIgnoredCase := false. |
1769
5e272292723b
remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents:
1766
diff
changeset
|
3322 |
lastSearchPattern := pattern string |
5e272292723b
remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents:
1766
diff
changeset
|
3323 |
|
3399
c350a2e3efee
dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
3324 |
"Modified: / 21-09-2006 / 16:48:29 / cg" |
248 | 3325 |
! |
3326 |
||
3327 |
searchBwd:pattern ifAbsent:aBlock |
|
3328 |
"do a backward search" |
|
3329 |
||
4500 | 3330 |
self |
3331 |
searchBwdUsingSpec:(ListView::SearchSpec new |
|
3332 |
pattern:pattern) |
|
3333 |
ifAbsent:aBlock |
|
1326 | 3334 |
|
3335 |
"Modified: 13.9.1997 / 01:05:49 / cg" |
|
3336 |
! |
|
3337 |
||
3338 |
searchBwd:pattern ignoreCase:ign |
|
3339 |
"do a backward search" |
|
3340 |
||
4462
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
3341 |
self |
4500 | 3342 |
searchBwd:pattern |
3343 |
ignoreCase:ign |
|
3344 |
ifAbsent:[ |
|
3345 |
self sensor compressKeyPressEventsWithKey:#FindPrev. |
|
3346 |
self showNotFound |
|
3347 |
]. |
|
4408 | 3348 |
"/ lastSearchIgnoredCase := ign. |
1769
5e272292723b
remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents:
1766
diff
changeset
|
3349 |
lastSearchPattern := pattern string |
5e272292723b
remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents:
1766
diff
changeset
|
3350 |
|
4408 | 3351 |
"Created: / 13-09-1997 / 06:18:00 / cg" |
3352 |
"Modified: / 23-03-2012 / 12:10:25 / cg" |
|
1326 | 3353 |
! |
3354 |
||
3355 |
searchBwd:pattern ignoreCase:ign ifAbsent:aBlock |
|
3356 |
"do a backward search" |
|
3357 |
||
4500 | 3358 |
self |
3359 |
searchBwdUsingSpec:(ListView::SearchSpec new |
|
3360 |
pattern:pattern |
|
3361 |
ignoreCase:ign) |
|
3362 |
ifAbsent:aBlock |
|
1326 | 3363 |
|
3364 |
"Modified: 13.9.1997 / 01:05:49 / cg" |
|
3365 |
"Created: 13.9.1997 / 06:18:41 / cg" |
|
248 | 3366 |
! |
3367 |
||
3577 | 3368 |
searchBwd:pattern ignoreCase:ign match: match |
3369 |
"do a backward search. |
|
3370 |
match pattern functionality is not yet available for backward search" |
|
3371 |
||
4408 | 3372 |
"/ lastSearchWasMatch := match. |
3577 | 3373 |
self searchBwd:pattern ignoreCase:ign. |
4408 | 3374 |
|
3375 |
"Modified: / 23-03-2012 / 12:12:44 / cg" |
|
3577 | 3376 |
! |
3377 |
||
4462
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
3378 |
searchBwdUsingSpec:searchSpec |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
3379 |
"do a backward search" |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
3380 |
|
4500 | 3381 |
self |
3382 |
searchBwdUsingSpec:searchSpec |
|
3383 |
ifAbsent:[self showNotFound]. |
|
4462
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
3384 |
|
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
3385 |
"/ lastSearchIgnoredCase := false. |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
3386 |
lastSearchPattern := searchSpec pattern string |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
3387 |
|
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
3388 |
"Modified: / 21-09-2006 / 16:48:29 / cg" |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
3389 |
! |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
3390 |
|
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
3391 |
searchBwdUsingSpec:searchSpec ifAbsent:aBlock |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
3392 |
"do a backward search" |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
3393 |
|
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
3394 |
|pos startLine startCol| |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
3395 |
|
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
3396 |
pos := self startPositionForSearchBackward. |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
3397 |
startLine := pos y. |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
3398 |
startCol := pos x. |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
3399 |
|
4500 | 3400 |
self |
3401 |
searchBackwardUsingSpec:searchSpec |
|
3402 |
startingAtLine:startLine col:startCol |
|
3403 |
ifFound:[:line :col | self showMatch:searchSpec pattern isMatch:searchSpec match atLine:line col:col] |
|
3404 |
ifAbsent:aBlock |
|
4462
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
3405 |
! |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
3406 |
|
2553
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3407 |
searchForAndSelectMatchingParenthesisFromLine:startLine col:startCol |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3408 |
"select characters enclosed by matching parenthesis if one is under startLine/Col" |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3409 |
|
4500 | 3410 |
self |
3411 |
searchForMatchingParenthesisFromLine:startLine col:startCol |
|
3412 |
ifFound:[:line :col | |
|
3413 |
self selectFromLine:startLine col:startCol |
|
3414 |
toLine:line col:col] |
|
3415 |
ifNotFound:[self showNotFound] |
|
3416 |
onError:[self beep] |
|
2553
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3417 |
|
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3418 |
"Modified: 9.10.1997 / 12:57:34 / cg" |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3419 |
! |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3420 |
|
248 | 3421 |
searchForMatchingParenthesisFromLine:startLine col:startCol |
4500 | 3422 |
ifFound:foundBlock |
3423 |
ifNotFound:notFoundBlock |
|
3424 |
onError:failBlock |
|
2553
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3425 |
|
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3426 |
"search for a matching parenthesis; start search with character at startLine/startCol. |
248 | 3427 |
Search for the corresponding character is done forward if its an opening, |
3428 |
backwards if its a closing parenthesis. |
|
2553
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3429 |
Evaluate foundBlock with line/col as argument if found, notFoundBlock if not. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3430 |
If there is a nesting error, evaluate failBlock." |
248 | 3431 |
|
3432 |
^ self |
|
4500 | 3433 |
searchForMatchingParenthesisFromLine:startLine col:startCol |
3434 |
ifFound:foundBlock |
|
3435 |
ifNotFound:notFoundBlock |
|
3436 |
onError:failBlock |
|
3437 |
ignoring:(parenthesisSpecification at:#ignore ifAbsent:#()) "/ #( $' $" '$[' '$]' '${' '$)' ) |
|
3478 | 3438 |
|
3439 |
"Modified: / 12-04-2007 / 11:24:24 / cg" |
|
248 | 3440 |
! |
3441 |
||
3442 |
searchForMatchingParenthesisFromLine:startLine col:startCol |
|
4500 | 3443 |
ifFound:foundBlock |
3444 |
ifNotFound:notFoundBlock |
|
3445 |
onError:failBlock |
|
3446 |
ignoring:ignoreSet |
|
2553
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3447 |
|
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3448 |
"search for a matching parenthesis; start search with character at startLine/startCol. |
248 | 3449 |
Search for the corresponding character is done forward if its an opening, |
3450 |
backwards if its a closing parenthesis. |
|
2553
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3451 |
Evaluate foundBlock with line/col as argument if found, notFoundBlock if not. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3452 |
If there is a nesting error, evaluate failBlock." |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3453 |
|
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3454 |
^ self |
4500 | 3455 |
searchForMatchingParenthesisFromLine:startLine col:startCol |
3456 |
ifFound:foundBlock |
|
3457 |
ifNotFound:notFoundBlock |
|
3458 |
onError:failBlock |
|
3459 |
openingCharacters: (parenthesisSpecification at:#open) "/ #( $( $[ ${ "$> $<") |
|
3460 |
closingCharacters: (parenthesisSpecification at:#close) "/ #( $) $] $} "$> $<") |
|
3461 |
ignoredCharacters: ignoreSet |
|
3462 |
specialEOLComment: (parenthesisSpecification at:#eolComment ifAbsent:#()) "/ |
|
3463 |
||
3464 |
"/ |i direction lineString |
|
3465 |
"/ parChar charSet closingChar |
|
3466 |
"/ ignoring |
|
2553
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3467 |
"/ line "{ Class: SmallInteger }" |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3468 |
"/ col "{ Class: SmallInteger }" |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3469 |
"/ delta "{ Class: SmallInteger }" |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3470 |
"/ endCol "{ Class: SmallInteger }" |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3471 |
"/ runCol "{ Class: SmallInteger }" |
4500 | 3472 |
"/ cc prevCC nextCC incSet decSet |
2553
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3473 |
"/ nesting "{ Class: SmallInteger }" |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3474 |
"/ maxLine "{ Class: SmallInteger }" |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3475 |
"/ ign skip anySet| |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3476 |
"/ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3477 |
"/ charSet := #( $( $) $[ $] ${ $} " $< $> " ). |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3478 |
"/ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3479 |
"/ parChar := self characterAtLine:startLine col:startCol. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3480 |
"/ i := charSet indexOf:parChar. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3481 |
"/ i == 0 ifTrue:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3482 |
"/ ^ failBlock value "not a parenthesis" |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3483 |
"/ ]. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3484 |
"/ direction := #( fwd bwd fwd bwd fwd bwd fwd bwd) at:i. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3485 |
"/ closingChar := #( $) $( $] $[ $} ${ "$> $<") at:i. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3486 |
"/ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3487 |
"/ col := startCol. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3488 |
"/ line := startLine. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3489 |
"/ direction == #fwd ifTrue:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3490 |
"/ delta := 1. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3491 |
"/ incSet := #( $( $[ ${ "$<" ). |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3492 |
"/ decSet := #( $) $] $} "$>" ). |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3493 |
"/ ] ifFalse:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3494 |
"/ delta := -1. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3495 |
"/ incSet := #( $) $] $} "$>" ). |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3496 |
"/ decSet := #( $( $[ ${ "$<" ). |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3497 |
"/ ]. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3498 |
"/ anySet := Set new. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3499 |
"/ anySet addAll:incSet; addAll:decSet; addAll:ignoreSet. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3500 |
"/ anySet := (anySet select:[:c | c isCharacter]) asString. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3501 |
"/ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3502 |
"/ nesting := 1. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3503 |
"/ ignoring := false. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3504 |
"/ lineString := list at:line. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3505 |
"/ maxLine := list size. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3506 |
"/ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3507 |
"/ col := col + delta. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3508 |
"/ [nesting ~~ 0] whileTrue:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3509 |
"/ (lineString notNil |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3510 |
"/ and:[lineString includesAny:anySet]) ifTrue:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3511 |
"/ direction == #fwd ifTrue:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3512 |
"/ endCol := lineString size. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3513 |
"/ ] ifFalse:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3514 |
"/ endCol := 1 |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3515 |
"/ ]. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3516 |
"/ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3517 |
"/ col to:endCol by:delta do:[:rCol | |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3518 |
"/ runCol := rCol. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3519 |
"/ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3520 |
"/ cc := lineString at:runCol. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3521 |
"/ runCol < lineString size ifTrue:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3522 |
"/ nextCC := lineString at:runCol+1 |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3523 |
"/ ] ifFalse:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3524 |
"/ nextCC := nil |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3525 |
"/ ]. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3526 |
"/ runCol > 1 ifTrue:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3527 |
"/ prevCC := lineString at:runCol-1 |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3528 |
"/ ] ifFalse:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3529 |
"/ prevCC := nil |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3530 |
"/ ]. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3531 |
"/ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3532 |
"/ ign := skip := false. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3533 |
"/ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3534 |
"/ "/ check for comments. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3535 |
"/ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3536 |
"/ ((cc == $" and:[nextCC == $/]) |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3537 |
"/ or:[prevCC == $$ ]) ifTrue:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3538 |
"/ "/ do nothing |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3539 |
"/ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3540 |
"/ skip := true. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3541 |
"/ ] ifFalse:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3542 |
"/ ignoreSet do:[:ignore | |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3543 |
"/ ignore == cc ifTrue:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3544 |
"/ ign := true |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3545 |
"/ ] ifFalse:[ |
4500 | 3546 |
"/ ignore isString ifTrue:[ |
2553
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3547 |
"/ cc == (ignore at:2) ifTrue:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3548 |
"/ runCol > 1 ifTrue:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3549 |
"/ (lineString at:(runCol-1)) == (ignore at:1) ifTrue:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3550 |
"/ skip := true |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3551 |
"/ ] |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3552 |
"/ ] |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3553 |
"/ ] ifFalse:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3554 |
"/ cc == (ignore at:1) ifTrue:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3555 |
"/ runCol < lineString size ifTrue:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3556 |
"/ (lineString at:(runCol+1)) == (ignore at:2) ifTrue:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3557 |
"/ skip := true |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3558 |
"/ ] |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3559 |
"/ ] |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3560 |
"/ ] |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3561 |
"/ ] |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3562 |
"/ ] |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3563 |
"/ ] |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3564 |
"/ ] |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3565 |
"/ ]. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3566 |
"/ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3567 |
"/ ign ifTrue:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3568 |
"/ ignoring := ignoring not |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3569 |
"/ ]. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3570 |
"/ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3571 |
"/ ignoring ifFalse:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3572 |
"/ skip ifFalse:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3573 |
"/ (incSet includes:cc) ifTrue:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3574 |
"/ nesting := nesting + 1 |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3575 |
"/ ] ifFalse:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3576 |
"/ (decSet includes:cc) ifTrue:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3577 |
"/ nesting := nesting - 1 |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3578 |
"/ ] |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3579 |
"/ ] |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3580 |
"/ ] |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3581 |
"/ ]. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3582 |
"/ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3583 |
"/ nesting == 0 ifTrue:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3584 |
"/ "check if legal" |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3585 |
"/ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3586 |
"/ skip ifFalse:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3587 |
"/ cc == closingChar ifFalse:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3588 |
"/ ^ failBlock value |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3589 |
"/ ]. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3590 |
"/ ^ foundBlock value:line value:runCol. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3591 |
"/ ] |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3592 |
"/ ] |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3593 |
"/ ]. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3594 |
"/ ]. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3595 |
"/ line := line + delta. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3596 |
"/ (line < 1 or:[line > maxLine]) ifTrue:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3597 |
"/ ^ failBlock value |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3598 |
"/ ]. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3599 |
"/ lineString := list at:line. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3600 |
"/ direction == #fwd ifTrue:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3601 |
"/ col := 1 |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3602 |
"/ ] ifFalse:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3603 |
"/ col := lineString size |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3604 |
"/ ] |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3605 |
"/ ]. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3606 |
"/ ^ notFoundBlock value |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3607 |
|
3478 | 3608 |
"Modified: / 12-04-2007 / 11:25:36 / cg" |
2553
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3609 |
! |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3610 |
|
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3611 |
searchForMatchingParenthesisFromLine:startLine col:startCol |
4500 | 3612 |
ifFound:foundBlock |
3613 |
ifNotFound:notFoundBlock |
|
3614 |
onError:failBlock |
|
3615 |
openingCharacters:openingCharacters |
|
3616 |
closingCharacters:closingCharacters |
|
3605 | 3617 |
|
3618 |
"search for a matching parenthesis; start search with character at startLine/startCol. |
|
3619 |
Search for the corresponding character is done forward if its an opening, |
|
3620 |
backwards if its a closing parenthesis. |
|
3621 |
Evaluate foundBlock with line/col as argument if found, notFoundBlock if not. |
|
3622 |
If there is a nesting error, evaluate failBlock." |
|
3623 |
||
3624 |
^ self |
|
4500 | 3625 |
searchForMatchingParenthesisFromLine:startLine col:startCol |
3626 |
ifFound:foundBlock |
|
3627 |
ifNotFound:notFoundBlock |
|
3628 |
onError:failBlock |
|
3629 |
openingCharacters: openingCharacters |
|
3630 |
closingCharacters: closingCharacters |
|
3631 |
ignoredCharacters: (parenthesisSpecification at:#ignore ifAbsent:#()) |
|
3632 |
specialEOLComment: (parenthesisSpecification at:#eolComment ifAbsent:#()) "/ |
|
3633 |
||
3634 |
"/ |i direction lineString |
|
3635 |
"/ parChar charSet closingChar |
|
3636 |
"/ ignoring |
|
3605 | 3637 |
"/ line "{ Class: SmallInteger }" |
3638 |
"/ col "{ Class: SmallInteger }" |
|
3639 |
"/ delta "{ Class: SmallInteger }" |
|
3640 |
"/ endCol "{ Class: SmallInteger }" |
|
3641 |
"/ runCol "{ Class: SmallInteger }" |
|
4500 | 3642 |
"/ cc prevCC nextCC incSet decSet |
3605 | 3643 |
"/ nesting "{ Class: SmallInteger }" |
3644 |
"/ maxLine "{ Class: SmallInteger }" |
|
3645 |
"/ ign skip anySet| |
|
3646 |
"/ |
|
3647 |
"/ charSet := #( $( $) $[ $] ${ $} " $< $> " ). |
|
3648 |
"/ |
|
3649 |
"/ parChar := self characterAtLine:startLine col:startCol. |
|
3650 |
"/ i := charSet indexOf:parChar. |
|
3651 |
"/ i == 0 ifTrue:[ |
|
3652 |
"/ ^ failBlock value "not a parenthesis" |
|
3653 |
"/ ]. |
|
3654 |
"/ direction := #( fwd bwd fwd bwd fwd bwd fwd bwd) at:i. |
|
3655 |
"/ closingChar := #( $) $( $] $[ $} ${ "$> $<") at:i. |
|
3656 |
"/ |
|
3657 |
"/ col := startCol. |
|
3658 |
"/ line := startLine. |
|
3659 |
"/ direction == #fwd ifTrue:[ |
|
3660 |
"/ delta := 1. |
|
3661 |
"/ incSet := #( $( $[ ${ "$<" ). |
|
3662 |
"/ decSet := #( $) $] $} "$>" ). |
|
3663 |
"/ ] ifFalse:[ |
|
3664 |
"/ delta := -1. |
|
3665 |
"/ incSet := #( $) $] $} "$>" ). |
|
3666 |
"/ decSet := #( $( $[ ${ "$<" ). |
|
3667 |
"/ ]. |
|
3668 |
"/ anySet := Set new. |
|
3669 |
"/ anySet addAll:incSet; addAll:decSet; addAll:ignoreSet. |
|
3670 |
"/ anySet := (anySet select:[:c | c isCharacter]) asString. |
|
3671 |
"/ |
|
3672 |
"/ nesting := 1. |
|
3673 |
"/ ignoring := false. |
|
3674 |
"/ lineString := list at:line. |
|
3675 |
"/ maxLine := list size. |
|
3676 |
"/ |
|
3677 |
"/ col := col + delta. |
|
3678 |
"/ [nesting ~~ 0] whileTrue:[ |
|
3679 |
"/ (lineString notNil |
|
3680 |
"/ and:[lineString includesAny:anySet]) ifTrue:[ |
|
3681 |
"/ direction == #fwd ifTrue:[ |
|
3682 |
"/ endCol := lineString size. |
|
3683 |
"/ ] ifFalse:[ |
|
3684 |
"/ endCol := 1 |
|
3685 |
"/ ]. |
|
3686 |
"/ |
|
3687 |
"/ col to:endCol by:delta do:[:rCol | |
|
3688 |
"/ runCol := rCol. |
|
3689 |
"/ |
|
3690 |
"/ cc := lineString at:runCol. |
|
3691 |
"/ runCol < lineString size ifTrue:[ |
|
3692 |
"/ nextCC := lineString at:runCol+1 |
|
3693 |
"/ ] ifFalse:[ |
|
3694 |
"/ nextCC := nil |
|
3695 |
"/ ]. |
|
3696 |
"/ runCol > 1 ifTrue:[ |
|
3697 |
"/ prevCC := lineString at:runCol-1 |
|
3698 |
"/ ] ifFalse:[ |
|
3699 |
"/ prevCC := nil |
|
3700 |
"/ ]. |
|
3701 |
"/ |
|
3702 |
"/ ign := skip := false. |
|
3703 |
"/ |
|
3704 |
"/ "/ check for comments. |
|
3705 |
"/ |
|
3706 |
"/ ((cc == $" and:[nextCC == $/]) |
|
3707 |
"/ or:[prevCC == $$ ]) ifTrue:[ |
|
3708 |
"/ "/ do nothing |
|
3709 |
"/ |
|
3710 |
"/ skip := true. |
|
3711 |
"/ ] ifFalse:[ |
|
3712 |
"/ ignoreSet do:[:ignore | |
|
3713 |
"/ ignore == cc ifTrue:[ |
|
3714 |
"/ ign := true |
|
3715 |
"/ ] ifFalse:[ |
|
4500 | 3716 |
"/ ignore isString ifTrue:[ |
3605 | 3717 |
"/ cc == (ignore at:2) ifTrue:[ |
3718 |
"/ runCol > 1 ifTrue:[ |
|
3719 |
"/ (lineString at:(runCol-1)) == (ignore at:1) ifTrue:[ |
|
3720 |
"/ skip := true |
|
3721 |
"/ ] |
|
3722 |
"/ ] |
|
3723 |
"/ ] ifFalse:[ |
|
3724 |
"/ cc == (ignore at:1) ifTrue:[ |
|
3725 |
"/ runCol < lineString size ifTrue:[ |
|
3726 |
"/ (lineString at:(runCol+1)) == (ignore at:2) ifTrue:[ |
|
3727 |
"/ skip := true |
|
3728 |
"/ ] |
|
3729 |
"/ ] |
|
3730 |
"/ ] |
|
3731 |
"/ ] |
|
3732 |
"/ ] |
|
3733 |
"/ ] |
|
3734 |
"/ ] |
|
3735 |
"/ ]. |
|
3736 |
"/ |
|
3737 |
"/ ign ifTrue:[ |
|
3738 |
"/ ignoring := ignoring not |
|
3739 |
"/ ]. |
|
3740 |
"/ |
|
3741 |
"/ ignoring ifFalse:[ |
|
3742 |
"/ skip ifFalse:[ |
|
3743 |
"/ (incSet includes:cc) ifTrue:[ |
|
3744 |
"/ nesting := nesting + 1 |
|
3745 |
"/ ] ifFalse:[ |
|
3746 |
"/ (decSet includes:cc) ifTrue:[ |
|
3747 |
"/ nesting := nesting - 1 |
|
3748 |
"/ ] |
|
3749 |
"/ ] |
|
3750 |
"/ ] |
|
3751 |
"/ ]. |
|
3752 |
"/ |
|
3753 |
"/ nesting == 0 ifTrue:[ |
|
3754 |
"/ "check if legal" |
|
3755 |
"/ |
|
3756 |
"/ skip ifFalse:[ |
|
3757 |
"/ cc == closingChar ifFalse:[ |
|
3758 |
"/ ^ failBlock value |
|
3759 |
"/ ]. |
|
3760 |
"/ ^ foundBlock value:line value:runCol. |
|
3761 |
"/ ] |
|
3762 |
"/ ] |
|
3763 |
"/ ]. |
|
3764 |
"/ ]. |
|
3765 |
"/ line := line + delta. |
|
3766 |
"/ (line < 1 or:[line > maxLine]) ifTrue:[ |
|
3767 |
"/ ^ failBlock value |
|
3768 |
"/ ]. |
|
3769 |
"/ lineString := list at:line. |
|
3770 |
"/ direction == #fwd ifTrue:[ |
|
3771 |
"/ col := 1 |
|
3772 |
"/ ] ifFalse:[ |
|
3773 |
"/ col := lineString size |
|
3774 |
"/ ] |
|
3775 |
"/ ]. |
|
3776 |
"/ ^ notFoundBlock value |
|
3777 |
||
3778 |
"Modified: / 12-04-2007 / 11:25:36 / cg" |
|
3779 |
! |
|
3780 |
||
3781 |
searchForMatchingParenthesisFromLine:startLine col:startCol |
|
4500 | 3782 |
ifFound:foundBlock |
3783 |
ifNotFound:notFoundBlock |
|
3784 |
onError:failBlock |
|
3785 |
openingCharacters:openingCharacters |
|
3786 |
closingCharacters:closingCharacters |
|
3787 |
ignoredCharacters:ignoreSet |
|
3788 |
specialEOLComment:eolCommentSequence |
|
2553
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3789 |
|
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3790 |
"search for a matching parenthesis; start search with character at startLine/startCol. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3791 |
Search for the corresponding character is done forward if its an opening, |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3792 |
backwards if its a closing parenthesis. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3793 |
Evaluate foundBlock with line/col as argument if found, notFoundBlock if not. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3794 |
If there is a nesting error, evaluate failBlock." |
248 | 3795 |
|
4500 | 3796 |
|i direction lineString |
3797 |
parChar charSet closingChar |
|
3798 |
ignoring |
|
770
a41466e3dfaa
use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents:
758
diff
changeset
|
3799 |
line "{ Class: SmallInteger }" |
a41466e3dfaa
use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents:
758
diff
changeset
|
3800 |
col "{ Class: SmallInteger }" |
a41466e3dfaa
use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents:
758
diff
changeset
|
3801 |
delta "{ Class: SmallInteger }" |
a41466e3dfaa
use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents:
758
diff
changeset
|
3802 |
endCol "{ Class: SmallInteger }" |
a41466e3dfaa
use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents:
758
diff
changeset
|
3803 |
runCol "{ Class: SmallInteger }" |
4500 | 3804 |
cc prevCC nextCC incSet decSet |
770
a41466e3dfaa
use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents:
758
diff
changeset
|
3805 |
nesting "{ Class: SmallInteger }" |
a41466e3dfaa
use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents:
758
diff
changeset
|
3806 |
maxLine "{ Class: SmallInteger }" |
2553
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3807 |
ign skip anySet |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3808 |
eol1 eol2| |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3809 |
|
2772
4e04a3bf399f
check for a valid parenthsisSpec.
Claus Gittinger <cg@exept.de>
parents:
2756
diff
changeset
|
3810 |
self assert:(openingCharacters size == closingCharacters size). |
4e04a3bf399f
check for a valid parenthsisSpec.
Claus Gittinger <cg@exept.de>
parents:
2756
diff
changeset
|
3811 |
|
2553
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3812 |
charSet := openingCharacters , closingCharacters. |
248 | 3813 |
|
3814 |
parChar := self characterAtLine:startLine col:startCol. |
|
3815 |
i := charSet indexOf:parChar. |
|
3816 |
i == 0 ifTrue:[ |
|
4500 | 3817 |
^ failBlock value "not a parenthesis" |
248 | 3818 |
]. |
2553
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3819 |
|
3858 | 3820 |
direction := (i <= openingCharacters size) ifTrue:[#fwd] ifFalse:[#bwd]. |
2553
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3821 |
closingChar := (closingCharacters , openingCharacters) at:i. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3822 |
|
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3823 |
eol1 := eolCommentSequence at:1 ifAbsent:nil. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3824 |
eol2 := eolCommentSequence at:2 ifAbsent:nil. |
248 | 3825 |
|
3826 |
col := startCol. |
|
3827 |
line := startLine. |
|
3828 |
direction == #fwd ifTrue:[ |
|
4500 | 3829 |
delta := 1. |
3830 |
incSet := openingCharacters. |
|
3831 |
decSet := closingCharacters. |
|
248 | 3832 |
] ifFalse:[ |
4500 | 3833 |
delta := -1. |
3834 |
incSet := closingCharacters. |
|
3835 |
decSet := openingCharacters. |
|
248 | 3836 |
]. |
1454 | 3837 |
anySet := Set new. |
3838 |
anySet addAll:incSet; addAll:decSet; addAll:ignoreSet. |
|
3839 |
anySet := (anySet select:[:c | c isCharacter]) asString. |
|
248 | 3840 |
|
3841 |
nesting := 1. |
|
3842 |
ignoring := false. |
|
3843 |
lineString := list at:line. |
|
3844 |
maxLine := list size. |
|
3845 |
||
3846 |
col := col + delta. |
|
3847 |
[nesting ~~ 0] whileTrue:[ |
|
4500 | 3848 |
(lineString notNil |
3849 |
and:[lineString includesAny:anySet]) ifTrue:[ |
|
3850 |
direction == #fwd ifTrue:[ |
|
3851 |
endCol := lineString size. |
|
3852 |
] ifFalse:[ |
|
3853 |
endCol := 1 |
|
3854 |
]. |
|
3855 |
||
3856 |
col to:endCol by:delta do:[:rCol | |
|
3857 |
runCol := rCol. |
|
3858 |
||
3859 |
cc := lineString at:runCol. |
|
3860 |
runCol < lineString size ifTrue:[ |
|
3861 |
nextCC := lineString at:runCol+1 |
|
3862 |
] ifFalse:[ |
|
3863 |
nextCC := nil |
|
3864 |
]. |
|
3865 |
runCol > 1 ifTrue:[ |
|
3866 |
prevCC := lineString at:runCol-1 |
|
3867 |
] ifFalse:[ |
|
3868 |
prevCC := nil |
|
3869 |
]. |
|
3870 |
||
3871 |
ign := skip := false. |
|
3872 |
||
3873 |
"/ check for comments. |
|
3874 |
||
3875 |
((cc == eol1 and:[nextCC == eol2]) |
|
3876 |
or:[prevCC == $$ ]) ifTrue:[ |
|
3877 |
"/ do nothing |
|
3878 |
||
3879 |
skip := true. |
|
3880 |
] ifFalse:[ |
|
3881 |
ignoreSet do:[:ignore | |
|
3882 |
ignore == cc ifTrue:[ |
|
3883 |
ign := true |
|
3884 |
] ifFalse:[ |
|
3885 |
ignore isString ifTrue:[ |
|
3886 |
cc == (ignore at:2) ifTrue:[ |
|
3887 |
runCol > 1 ifTrue:[ |
|
3888 |
(lineString at:(runCol-1)) == (ignore at:1) ifTrue:[ |
|
3889 |
skip := true |
|
3890 |
] |
|
3891 |
] |
|
3892 |
] ifFalse:[ |
|
3893 |
cc == (ignore at:1) ifTrue:[ |
|
3894 |
runCol < lineString size ifTrue:[ |
|
3895 |
(lineString at:(runCol+1)) == (ignore at:2) ifTrue:[ |
|
3896 |
skip := true |
|
3897 |
] |
|
3898 |
] |
|
3899 |
] |
|
3900 |
] |
|
3901 |
] |
|
3902 |
] |
|
3903 |
] |
|
3904 |
]. |
|
3905 |
||
3906 |
ign ifTrue:[ |
|
3907 |
ignoring := ignoring not |
|
3908 |
]. |
|
3909 |
||
3910 |
ignoring ifFalse:[ |
|
3911 |
skip ifFalse:[ |
|
3912 |
(incSet includes:cc) ifTrue:[ |
|
3913 |
nesting := nesting + 1 |
|
3914 |
] ifFalse:[ |
|
3915 |
(decSet includes:cc) ifTrue:[ |
|
3916 |
nesting := nesting - 1 |
|
3917 |
] |
|
3918 |
] |
|
3919 |
] |
|
3920 |
]. |
|
3921 |
||
3922 |
nesting == 0 ifTrue:[ |
|
3923 |
"check if legal" |
|
3924 |
skip ifFalse:[ |
|
3925 |
cc == closingChar ifFalse:[ |
|
3926 |
^ failBlock value |
|
3927 |
]. |
|
3928 |
^ foundBlock value:line value:runCol. |
|
3929 |
] |
|
3930 |
] |
|
3931 |
]. |
|
3932 |
]. |
|
3933 |
line := line + delta. |
|
3934 |
(line < 1 or:[line > maxLine]) ifTrue:[ |
|
3935 |
^ failBlock value |
|
3936 |
]. |
|
3937 |
lineString := list at:line. |
|
3938 |
direction == #fwd ifTrue:[ |
|
3939 |
col := 1 |
|
3940 |
] ifFalse:[ |
|
3941 |
col := lineString size |
|
3942 |
] |
|
248 | 3943 |
]. |
3944 |
^ notFoundBlock value |
|
3945 |
||
844
03e45d817dce
fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
3946 |
"Modified: 15.10.1996 / 12:22:30 / cg" |
248 | 3947 |
! |
3948 |
||
3949 |
searchFwd |
|
4462
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
3950 |
"search forward for the same pattern or selection again" |
248 | 3951 |
|
4399 | 3952 |
|ign match variable| |
1353 | 3953 |
|
2811 | 3954 |
searchAction notNil ifTrue:[ |
4500 | 3955 |
"/ autosearch is cleared whenever there is search with user selection |
3956 |
(self hasSelection and:[self hasSearchActionSelection not]) ifTrue: [self clearSearchAction]. |
|
4177 | 3957 |
]. |
3958 |
||
3959 |
searchAction notNil ifTrue:[ |
|
4500 | 3960 |
"/ confusing: this is for autosearch of variables (browse variable uses, for example) |
3961 |
self searchUsingSearchAction:#forward. |
|
3962 |
^ self. |
|
2807 | 3963 |
]. |
3981 | 3964 |
searchBarActionBlock notNil ifTrue:[ |
4500 | 3965 |
searchBarActionBlock value:#forward value:self. |
3966 |
^ self |
|
3581 | 3967 |
]. |
4399 | 3968 |
lastSearchWasVariableSearch ifTrue:[ |
4500 | 3969 |
variable := self syntaxElementForSelectedVariable. |
3970 |
variable notNil ifTrue:[ |
|
3971 |
self searchVariableWithSyntaxElement:variable forward:true. |
|
3972 |
^ self. |
|
3973 |
]. |
|
3974 |
lastSearchWasVariableSearch := false. |
|
4399 | 3975 |
]. |
3581 | 3976 |
|
3399
c350a2e3efee
dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
3977 |
ign := lastSearchIgnoredCase ? LastSearchIgnoredCase ? true. |
3577 | 3978 |
match := lastSearchWasMatch ? LastSearchWasMatch ? false. |
1353 | 3979 |
|
248 | 3980 |
selectStyle == #wordLeft ifTrue:[ |
4500 | 3981 |
" |
3982 |
remove the space from the selection |
|
3983 |
" |
|
3984 |
selectionStartCol := selectionStartCol + 1. |
|
3985 |
super redrawLine:selectionStartLine from:selectionStartCol-1 to:selectionStartCol-1. |
|
3986 |
selectStyle := #word. |
|
3987 |
self selectionChanged. |
|
248 | 3988 |
]. |
3577 | 3989 |
self setSearchPatternWithMatchEscapes: match. |
2414
ec98bcbd4c61
if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents:
2413
diff
changeset
|
3990 |
|
ec98bcbd4c61
if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents:
2413
diff
changeset
|
3991 |
lastSearchPattern isNil ifTrue:[ |
4500 | 3992 |
LastSearchPatterns size > 0 ifTrue:[ |
3993 |
lastSearchPattern := LastSearchPatterns first |
|
3994 |
] |
|
2414
ec98bcbd4c61
if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents:
2413
diff
changeset
|
3995 |
]. |
ec98bcbd4c61
if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents:
2413
diff
changeset
|
3996 |
|
1326 | 3997 |
lastSearchPattern notNil ifTrue:[ |
4500 | 3998 |
self rememberSearchPattern:lastSearchPattern. |
3999 |
lastSearchDirection := #forward. |
|
4000 |
self |
|
4001 |
searchFwd:lastSearchPattern |
|
4002 |
ignoreCase:ign |
|
4003 |
match: match |
|
248 | 4004 |
] |
1326 | 4005 |
|
4399 | 4006 |
"Modified: / 08-03-2012 / 14:25:42 / cg" |
248 | 4007 |
! |
4008 |
||
4009 |
searchFwd:pattern |
|
4010 |
"do a forward search" |
|
4011 |
||
4012 |
self searchFwd:pattern ifAbsent:[self showNotFound]. |
|
3399
c350a2e3efee
dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
4013 |
"/ lastSearchIgnoredCase := false. |
1769
5e272292723b
remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents:
1766
diff
changeset
|
4014 |
lastSearchPattern := pattern string |
5e272292723b
remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents:
1766
diff
changeset
|
4015 |
|
3399
c350a2e3efee
dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
4016 |
"Modified: / 21-09-2006 / 16:52:04 / cg" |
248 | 4017 |
! |
4018 |
||
4019 |
searchFwd:pattern ifAbsent:aBlock |
|
4020 |
"do a forward search" |
|
4021 |
||
4462
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
4022 |
self |
4500 | 4023 |
searchFwdUsingSpec:(ListView::SearchSpec new |
4024 |
pattern:pattern) |
|
4025 |
ifAbsent:aBlock |
|
1326 | 4026 |
|
3399
c350a2e3efee
dont loose the lastSearchIgnoredCase flag
Claus Gittinger <cg@exept.de>
parents:
3394
diff
changeset
|
4027 |
"Modified: / 21-09-2006 / 16:51:28 / cg" |
1326 | 4028 |
! |
4029 |
||
4030 |
searchFwd:pattern ignoreCase:ign |
|
4031 |
"do a forward search" |
|
4032 |
||
4462
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
4033 |
self |
4500 | 4034 |
searchFwdUsingSpec:(ListView::SearchSpec new |
4035 |
pattern:pattern |
|
4036 |
ignoreCase:ign) |
|
4037 |
ifAbsent:[ |
|
4038 |
self sensor compressKeyPressEventsWithKey:#FindNext. |
|
4039 |
self showNotFound |
|
4040 |
]. |
|
4408 | 4041 |
"/ lastSearchIgnoredCase := ign. |
1769
5e272292723b
remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents:
1766
diff
changeset
|
4042 |
lastSearchPattern := pattern string |
5e272292723b
remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents:
1766
diff
changeset
|
4043 |
|
4408 | 4044 |
"Created: / 13-09-1997 / 06:18:13 / cg" |
4045 |
"Modified: / 23-03-2012 / 12:09:59 / cg" |
|
1326 | 4046 |
! |
4047 |
||
4048 |
searchFwd:pattern ignoreCase:ign ifAbsent:aBlock |
|
4049 |
"do a forward search" |
|
4050 |
||
4462
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
4051 |
self |
4500 | 4052 |
searchFwdUsingSpec:(ListView::SearchSpec new |
4053 |
pattern:pattern |
|
4054 |
ignoreCase:ign) |
|
4055 |
ifAbsent:aBlock |
|
1326 | 4056 |
|
4057 |
"Modified: 13.9.1997 / 01:05:35 / cg" |
|
4058 |
"Created: 13.9.1997 / 06:18:27 / cg" |
|
248 | 4059 |
! |
4060 |
||
3577 | 4061 |
searchFwd:pattern ignoreCase:ign match: match |
4062 |
"do a forward search" |
|
4063 |
||
4462
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
4064 |
self |
4500 | 4065 |
searchFwdUsingSpec:(ListView::SearchSpec new |
4066 |
pattern:pattern |
|
4067 |
ignoreCase:ign |
|
4068 |
match:match) |
|
4069 |
ifAbsent:[ |
|
4070 |
self sensor compressKeyPressEventsWithKey:#FindNext. |
|
4071 |
self showNotFound |
|
4072 |
]. |
|
4408 | 4073 |
"/ lastSearchIgnoredCase := ign. |
4074 |
"/ lastSearchWasMatch := match. |
|
3577 | 4075 |
lastSearchPattern := pattern string |
4076 |
||
4408 | 4077 |
"Created: / 13-09-1997 / 06:18:13 / cg" |
4078 |
"Modified: / 23-03-2012 / 12:12:47 / cg" |
|
3577 | 4079 |
! |
4080 |
||
4081 |
searchFwd:pattern ignoreCase:ign match: match ifAbsent:aBlock |
|
4082 |
"do a forward search" |
|
4083 |
||
4500 | 4084 |
self |
4085 |
searchFwdUsingSpec:(ListView::SearchSpec new |
|
4086 |
pattern:pattern |
|
4087 |
ignoreCase:ign |
|
4088 |
match:match) |
|
4089 |
ifAbsent:aBlock |
|
3581 | 4090 |
|
4091 |
"Modified: 13.9.1997 / 01:05:35 / cg" |
|
4092 |
"Created: 13.9.1997 / 06:18:27 / cg" |
|
4093 |
! |
|
4094 |
||
4095 |
searchFwd:pattern ignoreCase:ign match: match startingAtLine:startLine col:startCol ifAbsent:aBlock |
|
4096 |
"do a forward search" |
|
4097 |
||
4500 | 4098 |
self |
4099 |
searchFwdUsingSpec:(ListView::SearchSpec new |
|
4100 |
pattern:pattern |
|
4101 |
ignoreCase:ign |
|
4102 |
match:match) |
|
4103 |
startingAtLine:startLine col:startCol |
|
4104 |
ifAbsent:aBlock |
|
4462
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
4105 |
! |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
4106 |
|
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
4107 |
searchFwdUsingSpec:searchSpec |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
4108 |
"do a forward search" |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
4109 |
|
4500 | 4110 |
self |
4111 |
searchFwdUsingSpec:searchSpec |
|
4112 |
ifAbsent:[self showNotFound]. |
|
4462
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
4113 |
|
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
4114 |
"/ lastSearchIgnoredCase := false. |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
4115 |
lastSearchPattern := searchSpec pattern string |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
4116 |
|
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
4117 |
"Modified: / 21-09-2006 / 16:52:04 / cg" |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
4118 |
! |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
4119 |
|
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
4120 |
searchFwdUsingSpec:searchSpec ifAbsent:aBlock |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
4121 |
"do a forward search" |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
4122 |
|
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
4123 |
|pos startLine startCol| |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
4124 |
|
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
4125 |
pos := self startPositionForSearchForward. |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
4126 |
startLine := pos y. |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
4127 |
startCol := pos x. |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
4128 |
|
4500 | 4129 |
self |
4130 |
searchFwdUsingSpec:searchSpec |
|
4131 |
startingAtLine:startLine col:startCol |
|
4132 |
ifAbsent:aBlock |
|
4462
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
4133 |
|
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
4134 |
"Modified: 13.9.1997 / 01:05:35 / cg" |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
4135 |
"Created: 13.9.1997 / 06:18:27 / cg" |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
4136 |
! |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
4137 |
|
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
4138 |
searchFwdUsingSpec:searchSpec startingAtLine:startLine col:startCol ifAbsent:aBlock |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
4139 |
"do a forward search" |
e7580f29c467
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4457
diff
changeset
|
4140 |
|
4500 | 4141 |
self |
4142 |
searchForwardUsingSpec:searchSpec |
|
4143 |
startingAtLine:startLine col:startCol |
|
4144 |
ifFound:[:line :col | self showMatch:searchSpec pattern isMatch:searchSpec match atLine:line col:col] |
|
4145 |
ifAbsent:aBlock |
|
3577 | 4146 |
! |
4147 |
||
248 | 4148 |
searchPattern |
4149 |
"return the last search pattern" |
|
4150 |
||
1326 | 4151 |
^ lastSearchPattern |
248 | 4152 |
! |
4153 |
||
2807 | 4154 |
searchUsingSearchAction:direction |
4500 | 4155 |
self |
4156 |
searchUsingSearchAction:direction |
|
4157 |
ifAbsent:[ |
|
4158 |
self sensor compressKeyPressEventsWithKey:#FindNext. |
|
4159 |
self showNotFound |
|
4160 |
] |
|
2816 | 4161 |
! |
4162 |
||
4163 |
searchUsingSearchAction:direction ifAbsent:notFoundAction |
|
2807 | 4164 |
|pos startLine startCol| |
4165 |
||
4500 | 4166 |
pos := direction == #backward |
4167 |
ifTrue:[self startPositionForSearchBackward] |
|
4168 |
ifFalse:[self startPositionForSearchForward]. |
|
2807 | 4169 |
startLine := pos y. |
4170 |
startCol := pos x. |
|
4171 |
||
4172 |
searchAction notNil ifTrue:[ |
|
4500 | 4173 |
searchAction |
4174 |
value:direction |
|
4175 |
value:startLine |
|
4176 |
value:startCol |
|
4177 |
value:[:line :col | self selectFromLine:line toLine:line] |
|
4178 |
value:notFoundAction. |
|
4179 |
self hasSelection ifTrue: [ |
|
4180 |
self changeTypeOfSelectionTo: #searchAction. |
|
4181 |
]. |
|
2807 | 4182 |
]. |
4183 |
! |
|
4184 |
||
248 | 4185 |
setSearchPattern |
4186 |
"set the searchpattern from the selection if there is one" |
|
4187 |
||
3577 | 4188 |
self setSearchPatternWithMatchEscapes: false. |
248 | 4189 |
! |
4190 |
||
3904
dd4c2dace4f5
changed #setSearchPattern: comment
Stefan Vogel <sv@exept.de>
parents:
3892
diff
changeset
|
4191 |
setSearchPattern:aStringOrNil |
248 | 4192 |
"set the searchpattern for future searches" |
4193 |
||
3904
dd4c2dace4f5
changed #setSearchPattern: comment
Stefan Vogel <sv@exept.de>
parents:
3892
diff
changeset
|
4194 |
aStringOrNil isEmptyOrNil ifTrue:[ |
4500 | 4195 |
lastSearchPattern := nil. |
248 | 4196 |
] ifFalse:[ |
4500 | 4197 |
lastSearchPattern := aStringOrNil asString withoutSeparators string. |
1769
5e272292723b
remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents:
1766
diff
changeset
|
4198 |
]. |
5e272292723b
remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents:
1766
diff
changeset
|
4199 |
|
5e272292723b
remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents:
1766
diff
changeset
|
4200 |
"Modified: / 6.3.1999 / 23:47:36 / cg" |
248 | 4201 |
! |
4202 |
||
2200 | 4203 |
setSearchPattern:aString ignoreCase:aBoolean |
4204 |
"set the searchpattern and caseIgnore for future searches" |
|
4205 |
||
4206 |
self setSearchPattern:aString. |
|
4207 |
lastSearchIgnoredCase := aBoolean. |
|
4208 |
! |
|
4209 |
||
3577 | 4210 |
setSearchPatternWithMatchEscapes: match |
4211 |
"set the searchpattern from the selection if there is one" |
|
4212 |
||
4213 |
|sel searchPattern | |
|
4214 |
||
4215 |
"/ clickPos isNil ifTrue:[^ self]. |
|
4216 |
||
4217 |
sel := self selection. |
|
4218 |
sel notNil ifTrue:[ |
|
4500 | 4219 |
searchPattern := sel asString. |
4220 |
match ifTrue:[searchPattern := searchPattern withMatchEscapes]. |
|
4221 |
self setSearchPattern:searchPattern. |
|
3577 | 4222 |
] |
4223 |
||
4224 |
"Modified: / 6.3.1999 / 23:48:04 / cg" |
|
4225 |
! |
|
4226 |
||
248 | 4227 |
showMatch:pattern atLine:line col:col |
4228 |
"after a search, highlight the matched pattern. |
|
4229 |
The code below needs a rewrite to take care of match-characters |
|
4230 |
(for now, it only highlights simple patterns and '*string*' correctly)" |
|
4231 |
||
4120 | 4232 |
self showMatch:pattern isMatch:true atLine:line col:col |
4233 |
! |
|
4234 |
||
4235 |
showMatch:pattern isMatch:isMatch atLine:line col:col |
|
4236 |
"after a search, highlight the matched pattern. |
|
4237 |
The code below needs a rewrite to take care of match-characters |
|
4238 |
(for now, it only highlights simple patterns and '*string*' correctly)" |
|
4239 |
||
248 | 4240 |
|realPattern| |
4241 |
||
4242 |
realPattern := pattern. |
|
4120 | 4243 |
|
4244 |
isMatch ifTrue: [ |
|
4567
33be833bfcbf
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4554
diff
changeset
|
4245 |
(realPattern startsWith:$*) ifTrue:[ |
33be833bfcbf
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4554
diff
changeset
|
4246 |
realPattern := realPattern copyFrom:2 |
33be833bfcbf
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4554
diff
changeset
|
4247 |
]. |
33be833bfcbf
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4554
diff
changeset
|
4248 |
(realPattern endsWith:$*) ifTrue:[ |
33be833bfcbf
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4554
diff
changeset
|
4249 |
realPattern := realPattern copyButLast:1 |
33be833bfcbf
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4554
diff
changeset
|
4250 |
]. |
248 | 4251 |
]. |
4252 |
||
4253 |
self selectFromLine:line col:col |
|
4567
33be833bfcbf
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
4554
diff
changeset
|
4254 |
toLine:line col:(col + realPattern size - 1). |
248 | 4255 |
self makeLineVisible:line |
4256 |
! |
|
4257 |
||
4258 |
showNotFound |
|
4259 |
"search not found - tell user by beeping and changing |
|
4260 |
cursor for a while (sometimes I work with a headset :-) |
|
4261 |
(used to be: tell user by changing cursor for a while)" |
|
4262 |
||
4263 |
|savedCursor| |
|
4264 |
||
4265 |
savedCursor := cursor. |
|
1028 | 4266 |
[ |
4500 | 4267 |
self cursor:(Cursor cross). |
4268 |
self beep. |
|
4269 |
Processor activeProcess millisecondDelay:300. |
|
2520
aed8069b4477
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
2488
diff
changeset
|
4270 |
] ensure:[ |
4500 | 4271 |
self cursor:savedCursor |
1028 | 4272 |
] |
4273 |
||
4274 |
"Modified: 20.2.1997 / 12:49:27 / cg" |
|
2756
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4275 |
! |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4276 |
|
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4277 |
startPositionForSearchBackward |
2822 | 4278 |
^ self startPositionForSearchBackwardBasedOnSelection |
4279 |
! |
|
4280 |
||
4281 |
startPositionForSearchBackwardBasedOnSelection |
|
2756
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4282 |
|startLine startCol| |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4283 |
|
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4284 |
selectionStartLine notNil ifTrue:[ |
4500 | 4285 |
startLine := selectionStartLine. |
4286 |
startCol := selectionStartCol |
|
2756
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4287 |
] ifFalse:[ |
4500 | 4288 |
startLine := 1. |
4289 |
startCol := 1 |
|
2756
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4290 |
]. |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4291 |
|
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4292 |
^ startCol @ startLine |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4293 |
! |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4294 |
|
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4295 |
startPositionForSearchForward |
2822 | 4296 |
^ self startPositionForSearchForwardBasedOnSelection |
4297 |
! |
|
4298 |
||
4299 |
startPositionForSearchForwardBasedOnSelection |
|
2756
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4300 |
|startLine startCol| |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4301 |
|
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4302 |
selectionStartLine notNil ifTrue:[ |
4500 | 4303 |
startLine := selectionStartLine. |
4304 |
startCol := selectionStartCol |
|
2756
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4305 |
] ifFalse:[ |
4500 | 4306 |
startLine := 1. |
4307 |
startCol := 1 |
|
2756
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4308 |
]. |
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4309 |
|
2bdd7ceaf05c
initial searchPosition extracted into separate method
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4310 |
^ startCol @ startLine |
248 | 4311 |
! ! |
4312 |
||
4313 |
!TextView methodsFor:'selections'! |
|
4314 |
||
2604
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
4315 |
changeTypeOfSelectionTo:newType |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
4316 |
"ignored here - but redefined in subclasses which |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
4317 |
differentiate between pasted- and user-selections" |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
4318 |
! |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
4319 |
|
458 | 4320 |
expandSelectionDown |
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
4321 |
|l t| |
458 | 4322 |
|
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
4323 |
selectionStartLine notNil ifTrue:[ |
4500 | 4324 |
expandingTop == true ifTrue:[ |
4325 |
l := selectionStartLine. |
|
4326 |
selectionStartLine := selectionStartLine + 1. |
|
4327 |
(selectionStartLine > clickLine |
|
4328 |
or:[selectionStartLine == clickLine and:[selectionStartCol > clickCol]]) |
|
4329 |
ifTrue:[ |
|
4330 |
t := selectionStartLine. |
|
4331 |
selectionStartLine := selectionEndLine. |
|
4332 |
selectionEndLine := t. |
|
4333 |
t := selectionStartCol. |
|
4334 |
selectionStartCol := selectionEndCol. |
|
4335 |
selectionEndCol := t. |
|
4336 |
expandingTop := false |
|
4337 |
]. |
|
4338 |
] ifFalse:[ |
|
4339 |
l := selectionEndLine. |
|
4340 |
selectionEndLine := selectionEndLine + 1. |
|
4341 |
]. |
|
4342 |
"/ self redrawLine:l. |
|
2442 | 4343 |
"/ self redrawLine:l+1. |
4500 | 4344 |
self validateNewSelection. |
4345 |
self setPrimarySelection. |
|
4346 |
self redrawFromLine:l to:l+1. |
|
4347 |
self makeSelectionVisible. |
|
458 | 4348 |
]. |
4349 |
||
4419
a7436b36c0a0
added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4409
diff
changeset
|
4350 |
"Created: / 01-03-1996 / 23:35:08 / cg" |
a7436b36c0a0
added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4409
diff
changeset
|
4351 |
"Modified: / 18-03-1996 / 17:18:15 / cg" |
a7436b36c0a0
added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4409
diff
changeset
|
4352 |
"Modified: / 17-04-2012 / 21:01:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
458 | 4353 |
! |
4354 |
||
4355 |
expandSelectionLeft |
|
502 | 4356 |
|c l t c1 c2| |
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
4357 |
|
458 | 4358 |
selectionStartLine notNil ifTrue:[ |
4500 | 4359 |
expandingTop == true ifTrue:[ |
4360 |
selectionStartCol == 0 ifTrue:[^ self]. |
|
4361 |
l := selectionStartLine. |
|
4362 |
selectionStartCol := (selectionStartCol - 1) max:1. |
|
4363 |
c := selectionStartCol. |
|
4364 |
] ifFalse:[ |
|
4365 |
l := selectionEndLine. |
|
4366 |
selectionEndCol := (selectionEndCol - 1) max:0. |
|
4367 |
c := selectionEndCol. |
|
4368 |
selectionEndLine == selectionStartLine ifTrue:[ |
|
4369 |
selectionEndCol <= selectionStartCol ifTrue:[ |
|
4370 |
t := selectionStartCol. selectionStartCol := selectionEndCol. |
|
4371 |
selectionEndCol := t. |
|
4372 |
expandingTop := true. |
|
4373 |
c := selectionStartCol. |
|
4374 |
] |
|
4375 |
]. |
|
4376 |
]. |
|
4377 |
c1 := c. |
|
4378 |
c2 := c1 + 1. |
|
4379 |
c1 == 0 ifTrue:[ |
|
4380 |
c1 := 1 |
|
4381 |
]. |
|
4382 |
self validateNewSelection. |
|
4383 |
self setPrimarySelection. |
|
4384 |
self redrawLine:l from:c1 to:c2. |
|
4385 |
self makeSelectionVisible. |
|
458 | 4386 |
]. |
4387 |
||
4419
a7436b36c0a0
added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4409
diff
changeset
|
4388 |
"Modified: / 18-03-1996 / 17:05:46 / cg" |
a7436b36c0a0
added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4409
diff
changeset
|
4389 |
"Modified: / 17-04-2012 / 21:01:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
458 | 4390 |
! |
4391 |
||
4392 |
expandSelectionRight |
|
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
4393 |
|l c t| |
458 | 4394 |
|
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
4395 |
selectionStartLine notNil ifTrue:[ |
4500 | 4396 |
expandingTop == true ifTrue:[ |
4397 |
l := selectionStartLine. |
|
4398 |
c := selectionStartCol. |
|
4399 |
selectionStartCol := selectionStartCol + 1. |
|
4400 |
l == selectionEndLine ifTrue:[ |
|
4401 |
c >= selectionEndCol ifTrue:[ |
|
4402 |
expandingTop := false. |
|
4403 |
t := selectionStartCol. selectionStartCol := selectionEndCol. |
|
4404 |
selectionEndCol := t. |
|
4405 |
c := selectionStartCol. |
|
4406 |
] |
|
4407 |
] |
|
4408 |
] ifFalse:[ |
|
4409 |
l := selectionEndLine. |
|
4410 |
c := selectionEndCol. |
|
4411 |
selectionEndCol := selectionEndCol + 1. |
|
4412 |
]. |
|
4413 |
||
4414 |
self validateNewSelection. |
|
4415 |
self setPrimarySelection. |
|
4416 |
self redrawLine:l from:c to:c+1. |
|
4417 |
self makeSelectionVisible. |
|
458 | 4418 |
]. |
4419 |
||
4419
a7436b36c0a0
added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4409
diff
changeset
|
4420 |
"Created: / 01-03-1996 / 23:33:17 / cg" |
a7436b36c0a0
added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4409
diff
changeset
|
4421 |
"Modified: / 06-03-1996 / 13:54:10 / cg" |
a7436b36c0a0
added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4409
diff
changeset
|
4422 |
"Modified: / 17-04-2012 / 21:01:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
458 | 4423 |
! |
4424 |
||
4425 |
expandSelectionUp |
|
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
4426 |
|l t| |
458 | 4427 |
|
4428 |
selectionStartLine notNil ifTrue:[ |
|
4500 | 4429 |
expandingTop == true ifTrue:[ |
4430 |
selectionStartLine := (selectionStartLine - 1) max:1. |
|
4431 |
l := selectionStartLine. |
|
4432 |
] ifFalse:[ |
|
4433 |
selectionEndLine := (selectionEndLine - 1) max:0. |
|
4434 |
||
4435 |
l := selectionEndLine. |
|
4436 |
(selectionEndLine < clickLine |
|
4437 |
or:[(selectionEndLine == clickLine and:[selectionEndCol < clickCol])]) |
|
4438 |
ifTrue:[ |
|
4439 |
t := selectionStartLine. |
|
4440 |
selectionStartLine := selectionEndLine. |
|
4441 |
selectionEndLine := t. |
|
4442 |
t := selectionStartCol. |
|
4443 |
selectionStartCol := selectionEndCol. |
|
4444 |
selectionEndCol := t. |
|
4445 |
l := selectionStartLine. |
|
4446 |
expandingTop := true |
|
4447 |
]. |
|
4448 |
]. |
|
4449 |
self validateNewSelection. |
|
4450 |
self setPrimarySelection. |
|
4451 |
"/ self redrawLine:l. |
|
4452 |
"/ self redrawLine:l+1. |
|
4453 |
self redrawFromLine:l to:l+1. |
|
4454 |
self makeSelectionVisible. |
|
458 | 4455 |
]. |
4456 |
||
4419
a7436b36c0a0
added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4409
diff
changeset
|
4457 |
"Modified: / 06-03-1996 / 14:12:06 / cg" |
a7436b36c0a0
added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4409
diff
changeset
|
4458 |
"Modified: / 17-04-2012 / 21:01:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
458 | 4459 |
! |
4460 |
||
248 | 4461 |
hasSelection |
4462 |
"return true, if there is a selection" |
|
4463 |
||
4464 |
^ selectionStartLine notNil |
|
4465 |
! |
|
4466 |
||
2350
c09d3dd534e3
do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents:
2336
diff
changeset
|
4467 |
hasSelectionForCopy |
c09d3dd534e3
do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents:
2336
diff
changeset
|
4468 |
"return true, if there is a selection which can be copyied |
c09d3dd534e3
do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents:
2336
diff
changeset
|
4469 |
(the same as #hasSelection, except for editfields in password-mode)" |
c09d3dd534e3
do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents:
2336
diff
changeset
|
4470 |
|
c09d3dd534e3
do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents:
2336
diff
changeset
|
4471 |
^ self hasSelection |
c09d3dd534e3
do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents:
2336
diff
changeset
|
4472 |
! |
c09d3dd534e3
do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents:
2336
diff
changeset
|
4473 |
|
2530
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
4474 |
hasSelectionWithinSingleLine |
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
4475 |
"return true, if there is a selection and it is within a line" |
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
4476 |
|
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
4477 |
^ selectionStartLine notNil |
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
4478 |
and:[ selectionStartLine == selectionEndLine ] |
3315 | 4479 |
|
4480 |
"Modified: / 04-07-2006 / 18:42:59 / fm" |
|
2530
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
4481 |
! |
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
4482 |
|
2588 | 4483 |
isInSelection:line col:aColNr |
4484 |
"returns true, if the line, and column is in the selection |
|
4485 |
" |
|
3438 | 4486 |
selectionStartLine isNil ifTrue:[^ false]. |
4487 |
selectionEndLine isNil ifTrue:[^ false]. |
|
2588 | 4488 |
|
4489 |
(line between:selectionStartLine and:selectionEndLine) ifFalse:[ |
|
4500 | 4490 |
^ false |
2588 | 4491 |
]. |
4492 |
||
4493 |
line == selectionStartLine ifTrue:[ |
|
4500 | 4494 |
aColNr < selectionStartCol ifTrue:[^ false] |
2588 | 4495 |
]. |
4496 |
||
4497 |
line == selectionEndLine ifTrue:[ |
|
4500 | 4498 |
(selectionEndCol ~~ 0 and:[selectionEndCol < aColNr]) ifTrue:[^ false] |
2588 | 4499 |
]. |
4500 |
^ true |
|
4501 |
! |
|
4502 |
||
248 | 4503 |
makeSelectionVisible |
4504 |
"scroll to make the selection visible" |
|
4505 |
||
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
4506 |
|line col| |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
4507 |
|
248 | 4508 |
selectionStartLine notNil ifTrue:[ |
4500 | 4509 |
expandingTop == true ifTrue:[ |
4510 |
line := selectionStartLine. |
|
4511 |
col := selectionStartCol. |
|
4512 |
] ifFalse:[ |
|
4513 |
line := selectionEndLine. |
|
4514 |
col := selectionEndCol. |
|
4515 |
]. |
|
4516 |
self makeLineVisible:line. |
|
4517 |
self makeColVisible:col inLine:line. |
|
248 | 4518 |
] |
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
4519 |
|
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
4520 |
"Modified: 6.3.1996 / 13:53:45 / cg" |
248 | 4521 |
! |
4522 |
||
4523 |
selectAll |
|
4524 |
"select the whole text" |
|
4525 |
||
4526 |
self selectFromLine:1 col:1 toLine:(list size + 1) col:0 |
|
4527 |
! |
|
4528 |
||
4140
435dc4fec8fb
added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
4120
diff
changeset
|
4529 |
selectFromCharacterPosition:pos1 |
435dc4fec8fb
added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
4120
diff
changeset
|
4530 |
"compute line/col from the character position and select the text up to the end" |
435dc4fec8fb
added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
4120
diff
changeset
|
4531 |
|
435dc4fec8fb
added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
4120
diff
changeset
|
4532 |
|line1 col1 line2 col2| |
435dc4fec8fb
added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
4120
diff
changeset
|
4533 |
|
435dc4fec8fb
added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
4120
diff
changeset
|
4534 |
line1 := self lineOfCharacterPosition:pos1. |
435dc4fec8fb
added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
4120
diff
changeset
|
4535 |
col1 := pos1 - (self characterPositionOfLine:line1 col:1) + 1. |
435dc4fec8fb
added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
4120
diff
changeset
|
4536 |
|
435dc4fec8fb
added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
4120
diff
changeset
|
4537 |
line2 := (list size + 1). |
435dc4fec8fb
added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
4120
diff
changeset
|
4538 |
col2 := 0. |
435dc4fec8fb
added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
4120
diff
changeset
|
4539 |
self selectFromLine:line1 col:col1 toLine:line2 col:col2 |
435dc4fec8fb
added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
4120
diff
changeset
|
4540 |
! |
435dc4fec8fb
added: #selectFromCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
4120
diff
changeset
|
4541 |
|
248 | 4542 |
selectFromCharacterPosition:pos1 to:pos2 |
4543 |
"compute line/col from character positions and select the text" |
|
4544 |
||
4545 |
|line1 col1 line2 col2| |
|
4546 |
||
4554 | 4547 |
pos1 > pos2 ifTrue:[ |
4548 |
^ self unselect |
|
4549 |
]. |
|
248 | 4550 |
line1 := self lineOfCharacterPosition:pos1. |
4551 |
col1 := pos1 - (self characterPositionOfLine:line1 col:1) + 1. |
|
4554 | 4552 |
col1 < 1 ifTrue:[ col1 := 1 ]. |
4553 |
||
248 | 4554 |
line2 := self lineOfCharacterPosition:pos2. |
4555 |
col2 := pos2 - (self characterPositionOfLine:line2 col:1) + 1. |
|
4554 | 4556 |
col2 < 1 ifTrue:[ col2 := 1 ]. |
248 | 4557 |
self selectFromLine:line1 col:col1 toLine:line2 col:col2 |
4558 |
! |
|
4559 |
||
4560 |
selectFromLine:startLine col:startCol toLine:endLine col:endCol |
|
4561 |
"select a piece of text and redraw that area" |
|
4562 |
||
4563 |
self unselect. |
|
4564 |
startLine notNil ifTrue:[ |
|
4500 | 4565 |
"new:" |
4566 |
endLine < startLine ifTrue:[ |
|
4567 |
^ self selectFromLine:endLine col:endCol toLine:startLine col:startCol |
|
4568 |
]. |
|
4569 |
(endLine == startLine and:[endCol < startCol]) ifTrue:[ |
|
4570 |
endCol ~~ 0 ifTrue:[ |
|
4571 |
self selectFromLine:endLine col:endCol toLine:startLine col:startCol. |
|
4572 |
]. |
|
4573 |
^ self |
|
4574 |
]. |
|
248 | 4575 |
|
4576 |
" old: |
|
4500 | 4577 |
endLine < startLine ifTrue:[^ self]. |
4578 |
(startLine == endLine and:[endCol < startCol]) ifTrue:[^ self]. |
|
248 | 4579 |
" |
4500 | 4580 |
selectionStartLine := startLine. |
4581 |
selectionStartCol := startCol. |
|
4582 |
selectionEndLine := endLine. |
|
4583 |
selectionEndCol := endCol. |
|
4584 |
self validateNewSelection. |
|
4585 |
self setPrimarySelection. |
|
4586 |
||
4587 |
(selectionStartLine == selectionEndLine) ifTrue:[ |
|
4588 |
self redrawLine:selectionStartLine from:selectionStartCol to:selectionEndCol |
|
4589 |
] ifFalse:[ |
|
4590 |
selectionStartLine to:selectionEndLine do:[:lineNr | |
|
4591 |
self redrawLine:lineNr |
|
4592 |
] |
|
4593 |
]. |
|
4594 |
selectStyle := nil. |
|
248 | 4595 |
] |
599
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
4596 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
4597 |
" |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
4598 |
|v| |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
4599 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
4600 |
v := TextView extent:300@300. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
4601 |
v contents:('smalltalk.rc' asFilename contentsOfEntireFile). |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
4602 |
v openAndWait. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
4603 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
4604 |
Delay waitForSeconds:1. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
4605 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
4606 |
v selectFromLine:2 col:2 toLine:10 col:15 |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
4607 |
" |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
4608 |
|
4419
a7436b36c0a0
added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4409
diff
changeset
|
4609 |
"Modified: / 02-01-1997 / 13:32:25 / cg" |
a7436b36c0a0
added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4409
diff
changeset
|
4610 |
"Modified: / 17-04-2012 / 21:00:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
599
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
4611 |
! |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
4612 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
4613 |
selectFromLine:startLine toLine:endLine |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
4614 |
"select a piece of text and redraw that area" |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
4615 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
4616 |
self selectFromLine:startLine col:1 toLine:endLine+1 col:0 |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
4617 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
4618 |
" |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
4619 |
|v| |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
4620 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
4621 |
v := TextView extent:300@300. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
4622 |
v contents:('smalltalk.rc' asFilename contentsOfEntireFile). |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
4623 |
v openAndWait. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
4624 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
4625 |
Delay waitForSeconds:1. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
4626 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
4627 |
v selectFromLine:2 toLine:10 |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
4628 |
" |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
4629 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
4630 |
"Modified: 29.4.1996 / 12:23:46 / cg" |
248 | 4631 |
! |
4632 |
||
4633 |
selectLine:selectLine |
|
4634 |
"select one line and redraw it" |
|
4635 |
||
4636 |
self selectFromLine:selectLine col:1 toLine:(selectLine + 1) col:0. |
|
4637 |
wordStartCol := selectionStartCol. |
|
4638 |
wordEndCol := selectionEndCol. |
|
4639 |
wordStartLine := selectionStartLine. |
|
4640 |
wordEndLine := selectionEndLine. |
|
4641 |
selectStyle := #line |
|
4642 |
! |
|
4643 |
||
4644 |
selectLineAtY:y |
|
4645 |
"select the line at given y-(view-)coordinate" |
|
4646 |
||
2413 | 4647 |
|selectLine| |
4648 |
||
4649 |
selectLine := self lineAtY:y. "/ self visibleLineToListLine:(self visibleLineOfY:y). |
|
248 | 4650 |
selectLine notNil ifTrue:[ |
4500 | 4651 |
self selectLine:selectLine |
248 | 4652 |
] |
4653 |
! |
|
4654 |
||
4655 |
selectLineWhereCharacterPosition:pos |
|
4656 |
"select the line, where characterPosition pos is living. |
|
4657 |
The argument pos starts at 1 from the start of the text |
|
4500 | 4658 |
and counts characters (i.e. can be used to convert from |
248 | 4659 |
character position within a string to line-position in view)." |
4660 |
||
4661 |
self selectLine:(self lineOfCharacterPosition:pos) |
|
4662 |
! |
|
4663 |
||
4664 |
selectWordAtLine:line col:col |
|
4665 |
"select the word at given line/col" |
|
4666 |
||
4500 | 4667 |
self |
4668 |
wordAtLine:line col:col do:[ |
|
4669 |
:beginLine :beginCol :endLine :endCol :style | |
|
4670 |
||
4671 |
self selectFromLine:beginLine col:beginCol toLine:endLine col:endCol. |
|
4672 |
selectStyle := style |
|
4673 |
] |
|
504 | 4674 |
|
4675 |
"Modified: 18.3.1996 / 17:30:38 / cg" |
|
248 | 4676 |
! |
4677 |
||
4678 |
selectWordAtX:x y:y |
|
4679 |
"select the word at given x/y-(view-)coordinate" |
|
4680 |
||
4681 |
|selectVisibleLine selectLine selectCol| |
|
4682 |
||
4683 |
selectStyle := nil. |
|
4684 |
selectVisibleLine := self visibleLineOfY:y. |
|
4685 |
selectLine := self visibleLineToListLine:selectVisibleLine. |
|
4686 |
selectLine notNil ifTrue:[ |
|
4500 | 4687 |
selectCol := self colOfX:x inVisibleLine:selectVisibleLine. |
4688 |
self selectWordAtLine:selectLine col:selectCol |
|
248 | 4689 |
] |
1661
bf446f457d95
fixed selectWordAtX:y for variable fonts.
Claus Gittinger <cg@exept.de>
parents:
1619
diff
changeset
|
4690 |
|
bf446f457d95
fixed selectWordAtX:y for variable fonts.
Claus Gittinger <cg@exept.de>
parents:
1619
diff
changeset
|
4691 |
"Modified: / 8.9.1998 / 21:22:46 / cg" |
248 | 4692 |
! |
4693 |
||
3528 | 4694 |
selectedInterval |
4695 |
"return the selection-boundaries as interval" |
|
4696 |
||
4697 |
^ self selectionStartIndex to:(self selectionStopIndex - 1) |
|
4698 |
! |
|
4699 |
||
248 | 4700 |
selection |
4701 |
"return the selection as a collection of (line-)strings. |
|
4702 |
If the selection ends in a full line, the last entry in the returned |
|
4703 |
collection will be an empty string." |
|
4704 |
||
2856
bc6bb86d4d2e
character encodings - first attempt
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4705 |
|sel| |
bc6bb86d4d2e
character encodings - first attempt
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4706 |
|
248 | 4707 |
selectionStartLine isNil ifTrue:[^ nil]. |
4466 | 4708 |
sel := self textFromLine:selectionStartLine col:(selectionStartCol max:1) toLine:selectionEndLine col:selectionEndCol. |
3298 | 4709 |
sel notNil ifTrue:[ |
4500 | 4710 |
(characterEncoding ? #'iso10646-1' "eg unicode") ~~ #'iso10646-1' ifTrue:[ |
4711 |
sel := sel encodeFrom:characterEncoding into:#'iso10646-1' |
|
4712 |
]. |
|
2856
bc6bb86d4d2e
character encodings - first attempt
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4713 |
]. |
bc6bb86d4d2e
character encodings - first attempt
Claus Gittinger <cg@exept.de>
parents:
2854
diff
changeset
|
4714 |
^ sel |
2158
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2120
diff
changeset
|
4715 |
|
4361
646cd7c5513e
comment/format in: #characterEncoding:
Claus Gittinger <cg@exept.de>
parents:
4321
diff
changeset
|
4716 |
"Modified (comment): / 25-01-2012 / 00:29:09 / cg" |
248 | 4717 |
! |
4718 |
||
2217 | 4719 |
selectionAsString |
4720 |
"return the selection as a String (i.e. without emphasis)" |
|
4721 |
||
2693 | 4722 |
|sel| |
2217 | 4723 |
|
4724 |
(sel := self selection) isNil ifTrue:[^ nil]. |
|
2419 | 4725 |
sel := sel collect:[:each| each isNil ifTrue:[nil] ifFalse:[each string]]. |
2217 | 4726 |
^ (sel asStringWithCRsFrom:1 to:(sel size) compressTabs:false withCR:false) string |
4727 |
! |
|
4728 |
||
4101 | 4729 |
selectionChanged |
4730 |
"can be redefined for notification or special actions" |
|
4419
a7436b36c0a0
added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4409
diff
changeset
|
4731 |
|
a7436b36c0a0
added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4409
diff
changeset
|
4732 |
"Modified: / 17-04-2012 / 20:59:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
4101 | 4733 |
! |
4734 |
||
248 | 4735 |
selectionEndCol |
4736 |
^ selectionEndCol |
|
4737 |
! |
|
4738 |
||
4739 |
selectionEndLine |
|
4740 |
^ selectionEndLine |
|
4741 |
! |
|
4742 |
||
4743 |
selectionStartCol |
|
4744 |
^ selectionStartCol |
|
4745 |
! |
|
4746 |
||
4747 |
selectionStartLine |
|
4748 |
^ selectionStartLine |
|
4749 |
! |
|
4750 |
||
4419
a7436b36c0a0
added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4409
diff
changeset
|
4751 |
setPrimarySelection |
a7436b36c0a0
added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4409
diff
changeset
|
4752 |
"can be redefined for notification or special actions" |
a7436b36c0a0
added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4409
diff
changeset
|
4753 |
|
a7436b36c0a0
added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4409
diff
changeset
|
4754 |
device notNil ifTrue:[ |
4500 | 4755 |
"On X11, be nice and set the PRIMARY selection. |
4756 |
(#setPrimaryText:ownerView: is void in DeviceWorkstation)" |
|
4757 |
device setPrimaryText: self selectionAsString ownerView: self. |
|
4419
a7436b36c0a0
added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4409
diff
changeset
|
4758 |
]. |
a7436b36c0a0
added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4409
diff
changeset
|
4759 |
|
a7436b36c0a0
added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4409
diff
changeset
|
4760 |
"Created: / 17-04-2012 / 20:59:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
a7436b36c0a0
added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4409
diff
changeset
|
4761 |
! |
a7436b36c0a0
added: #setPrimarySelection
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
4409
diff
changeset
|
4762 |
|
3308 | 4763 |
st80SelectMode |
3459 | 4764 |
st80SelectMode notNil ifTrue:[^ st80SelectMode]. |
4765 |
^ self class st80SelectMode |
|
3308 | 4766 |
|
4767 |
"Created: / 03-07-2006 / 16:30:59 / cg" |
|
4768 |
! |
|
4769 |
||
3459 | 4770 |
st80SelectMode:aBoolean |
4771 |
st80SelectMode := aBoolean |
|
4772 |
! |
|
4773 |
||
248 | 4774 |
unselect |
4775 |
"unselect - if there was a selection redraw that area" |
|
4776 |
||
4777 |
|startLine endLine startVisLine endVisLine| |
|
4778 |
||
4779 |
selectionStartLine notNil ifTrue:[ |
|
4500 | 4780 |
startLine := selectionStartLine. |
4781 |
endLine := selectionEndLine. |
|
4782 |
||
4783 |
self unselectWithoutRedraw. |
|
4784 |
||
4785 |
"/ if the selection is not visible, we are done |
|
4786 |
||
4787 |
startLine >= (firstLineShown + nLinesShown) ifTrue:[^ self]. |
|
4788 |
endLine < firstLineShown ifTrue:[^ self]. |
|
4789 |
||
4790 |
startLine < firstLineShown ifTrue:[ |
|
4791 |
startVisLine := 1 |
|
4792 |
] ifFalse:[ |
|
4793 |
startVisLine := self listLineToVisibleLine:startLine |
|
4794 |
]. |
|
4795 |
endLine >= (firstLineShown + nLinesShown) ifTrue:[ |
|
4796 |
endVisLine := nLinesShown |
|
4797 |
] ifFalse:[ |
|
4798 |
endVisLine := self listLineToVisibleLine:endLine |
|
4799 |
]. |
|
4800 |
||
4801 |
"/ if its only part of a line, just redraw what has to be |
|
4802 |
||
4803 |
(startLine == endLine) ifTrue:[ |
|
4804 |
super redrawVisibleLine:startVisLine from:selectionStartCol to:selectionEndCol |
|
4805 |
] ifFalse:[ |
|
4806 |
self redrawFromVisibleLine:startVisLine to:endVisLine |
|
4807 |
]. |
|
248 | 4808 |
]. |
4809 |
selectStyle := nil |
|
503 | 4810 |
|
715 | 4811 |
"Modified: 29.5.1996 / 14:54:11 / cg" |
248 | 4812 |
! |
4813 |
||
4814 |
unselectWithoutRedraw |
|
4815 |
"forget selection but do not redraw the selection area |
|
4816 |
- can be done when the selected area is redrawn anyway or |
|
599
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
4817 |
known to be invisible (however, redraw knows about that anyway)." |
248 | 4818 |
|
2735 | 4819 |
selectionStartLine := selectionEndLine := nil. |
4101 | 4820 |
self selectionChanged. |
248 | 4821 |
! |
4822 |
||
4823 |
validateNewSelection |
|
599
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
4824 |
"make certain that the selection is valid. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
4825 |
This is a dummy here, but subclasses (like single-line editFields) |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
4826 |
may redefine it to limit the selection to a single line, or whatever." |
248 | 4827 |
|
599
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
4828 |
^ self |
504 | 4829 |
|
599
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
4830 |
"Modified: 29.4.1996 / 12:32:08 / cg" |
248 | 4831 |
! ! |
4832 |
||
4310 | 4833 |
!TextView methodsFor:'testing'! |
4834 |
||
4835 |
isTextView |
|
4836 |
"I am showing text" |
|
4837 |
||
4838 |
^ true |
|
4839 |
! ! |
|
4840 |
||
844
03e45d817dce
fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
4841 |
!TextView class methodsFor:'documentation'! |
248 | 4842 |
|
4843 |
version |
|
4572 | 4844 |
^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.353 2013-04-26 12:53:56 cg Exp $' |
3964 | 4845 |
! |
4846 |
||
4847 |
version_CVS |
|
4572 | 4848 |
^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.353 2013-04-26 12:53:56 cg Exp $' |
248 | 4849 |
! ! |
2630
f3c95e73f862
for now: do not use alternative selection color
Claus Gittinger <cg@exept.de>
parents:
2604
diff
changeset
|
4850 |
|
4485 | 4851 |
|
2553
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
4852 |
TextView initialize! |