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