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