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