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