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