author | Claus Gittinger <cg@exept.de> |
Tue, 25 Feb 2003 15:43:24 +0100 | |
changeset 2695 | 7e13db2802df |
parent 2693 | 9e7da8ff444d |
child 2701 | b77cc7cf3818 |
permissions | -rw-r--r-- |
0 | 1 |
" |
5 | 2 |
COPYRIGHT (c) 1989 by Claus Gittinger |
59 | 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 |
" |
|
12 |
||
2191 | 13 |
"{ Package: 'stx:libwidg' }" |
14 |
||
0 | 15 |
ListView subclass:#TextView |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
248
diff
changeset
|
16 |
instanceVariableNames:'selectionStartLine selectionStartCol selectionEndLine |
1841 | 17 |
selectionEndCol clickPos clickStartLine clickStartCol clickLine |
18 |
clickCol clickCount expandingTop wordStartCol wordStartLine |
|
19 |
wordEndCol wordEndLine selectionFgColor selectionBgColor |
|
20 |
selectStyle directoryForFileDialog defaultFileNameForFileDialog |
|
1729 | 21 |
externalEncoding contentsWasSaved lastSearchPattern |
2553
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
22 |
lastSearchIgnoredCase lastSearchDirection |
2588 | 23 |
parenthesisSpecification dropSource dragIsActive' |
392
81343306d796
eliminated all DefaultFont classVars (are now classINSTvars)
Claus Gittinger <cg@exept.de>
parents:
326
diff
changeset
|
24 |
classVariableNames:'DefaultViewBackground DefaultSelectionForegroundColor |
2596 | 25 |
DefaultSelectionBackgroundColor |
26 |
DefaultAlternativeSelectionForegroundColor |
|
27 |
DefaultAlternativeSelectionBackgroundColor MatchDelayTime |
|
2201
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
28 |
WordSelectCatchesBlanks ST80Selections LastSearchPatterns |
2553
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
29 |
NumRememberedSearchPatterns LastSearchIgnoredCase |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
30 |
DefaultParenthesisSpecification' |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
248
diff
changeset
|
31 |
poolDictionaries:'' |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
248
diff
changeset
|
32 |
category:'Views-Text' |
0 | 33 |
! |
34 |
||
844
03e45d817dce
fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
35 |
!TextView class methodsFor:'documentation'! |
0 | 36 |
|
38 | 37 |
copyright |
38 |
" |
|
39 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
59 | 40 |
All Rights Reserved |
38 | 41 |
|
42 |
This software is furnished under a license and may be used |
|
43 |
only in accordance with the terms of that license and with the |
|
44 |
inclusion of the above copyright notice. This software may not |
|
45 |
be provided or otherwise made available to, or used by, any |
|
46 |
other person. No title to or ownership of the software is |
|
47 |
hereby transferred. |
|
48 |
" |
|
49 |
! |
|
50 |
||
22 | 51 |
documentation |
0 | 52 |
" |
120 | 53 |
a view for readOnly text - this class adds selections to a simple list. |
38 | 54 |
The text is not editable and there is no cursor. |
120 | 55 |
Use TextViews for readonly text, EditTextView for editable text. |
0 | 56 |
|
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
|
57 |
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
|
58 |
|
586 | 59 |
[Instance variables:] |
0 | 60 |
|
120 | 61 |
selectionStartLine <Number> the line of the selection start (or nil) |
62 |
selectionStartCol <Number> the col of the selection start |
|
63 |
selectionEndLine <Number> the line of the selection end |
|
64 |
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
|
65 |
|
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
66 |
clickStartLine <Number> temporary - remember where select operation started |
120 | 67 |
clickStartCol <Number> temporary |
68 |
clickLine <Number> temporary |
|
69 |
clickCol <Number> temporary |
|
70 |
clickCount <Number> temporary |
|
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
71 |
expandingTop <Boolean> temporary - for expandSelection |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
72 |
|
120 | 73 |
selectionFgColor <Color> color used to draw selections |
74 |
selectionBgColor <Color> color used to draw selections |
|
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
75 |
|
120 | 76 |
selectStyle <Symbol> how words are selected |
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
77 |
|
120 | 78 |
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
|
79 |
|
120 | 80 |
contentsWasSaved <Boolean> set to true, whenever saved in a file |
77 | 81 |
|
1322
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
82 |
externalEncoding <Symbol|nil> external encoding, used when text is saved to |
2588 | 83 |
a file. Usually something like |
84 |
#jis7, #euc, #sjis etc. |
|
85 |
(currently only passed down from the |
|
86 |
fileBrowser) |
|
87 |
||
88 |
dropSource <DropSource> drag operation descriptor or nil (dragging disabled) |
|
89 |
dragIsActive <Boolean> true, drag operation is activated |
|
90 |
||
1322
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
91 |
|
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
92 |
[class variables:] |
2588 | 93 |
ST80Selections <Boolean> enables ST80 style doubleclick behavior |
94 |
(right after opening parenthesis, right before |
|
95 |
closing parenthesis, at begin of a line |
|
96 |
at begin of text) |
|
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
97 |
|
586 | 98 |
[StyleSheet parameters:] |
77 | 99 |
|
2600 | 100 |
textView.background defaults to viewBackground |
101 |
textView.ViewFont defaults to textFont |
|
102 |
||
103 |
text.st80Selections st80 behavior (click on char after parent or quote) |
|
104 |
||
105 |
text.selectionForegroundColor defaults to textBackgroundColor |
|
106 |
text.selectionBackgroundColor defaults to textForegroundColor |
|
107 |
||
108 |
text.alternativeSelectionForegroundColor pasted text (i.e. paste will not replace) |
|
109 |
defaults to selectionForegroundColor |
|
110 |
text.alternativeSelectionBackgroundColor pasted text (i.e. paste will not replace) |
|
111 |
defaults to selectionBackgroundColor |
|
586 | 112 |
|
113 |
[author:] |
|
2588 | 114 |
Claus Gittinger |
586 | 115 |
|
116 |
[see also:] |
|
2588 | 117 |
EditTextView CodeView Workspace |
0 | 118 |
" |
1014
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
119 |
! |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
120 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
121 |
examples |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
122 |
" |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
123 |
although textViews (and instances of subclasses) are mostly used |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
124 |
as components (in the fileBrowser, the browser, the launcher etc.), |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
125 |
they may also be opened as a textEditor; |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
126 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
127 |
open a (readonly) textView on some information text: |
1728
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
128 |
[exBegin] |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
129 |
TextView |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
130 |
openWith:'read this' |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
131 |
title:'demonstration' |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
132 |
[exEnd] |
1014
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
133 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
134 |
the same, but open it modal: |
1728
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
135 |
[exBegin] |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
136 |
TextView |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
137 |
openModalWith:'read this first' |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
138 |
title:'demonstration' |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
139 |
[exEnd] |
1014
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
140 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
141 |
|
1016 | 142 |
open it modal (but editable) on some text: |
143 |
(must accept before closing) |
|
144 |
This is somewhat kludgy - when closed, the view has already |
|
145 |
nilled its link to the model. Therefore, the accept must be |
|
146 |
done 'manually' below. |
|
147 |
However, usually an applicationModel is installed as the |
|
148 |
editor-topViews application. This would get a closeRequest, |
|
149 |
where it could handle things. |
|
1728
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
150 |
[exBegin] |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
151 |
|m textView| |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
152 |
|
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
153 |
m := 'read this first' asValue. |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
154 |
textView := EditTextView openModalOnModel:m. |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
155 |
textView modified ifTrue:[ |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
156 |
(self confirm:'text was not accepted - do it now ?') |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
157 |
ifTrue:[ |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
158 |
m value:textView contents |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
159 |
] |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
160 |
]. |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
161 |
|
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
162 |
Transcript showCR:m value. |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
163 |
[exEnd] |
1014
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
164 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
165 |
|
1016 | 166 |
open a textEditor on some file: |
1728
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
167 |
[exBegin] |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
168 |
EditTextView openOn:'Makefile' |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
169 |
[exEnd] |
1014
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
170 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
171 |
" |
1016 | 172 |
|
0 | 173 |
! ! |
174 |
||
844
03e45d817dce
fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
175 |
!TextView class methodsFor:'instance creation'! |
119 | 176 |
|
177 |
on:aModel aspect:aspect change:change menu:menu initialSelection:initial |
|
178 |
"for ST-80 compatibility" |
|
179 |
||
120 | 180 |
^ (self new) |
181 |
on:aModel |
|
182 |
aspect:aspect |
|
183 |
list:aspect |
|
184 |
change:change |
|
185 |
menu:menu |
|
186 |
initialSelection:initial |
|
119 | 187 |
! ! |
188 |
||
2553
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
189 |
!TextView class methodsFor:'class initialization'! |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
190 |
|
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
191 |
initialize |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
192 |
DefaultParenthesisSpecification isNil ifTrue:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
193 |
DefaultParenthesisSpecification := IdentityDictionary new. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
194 |
DefaultParenthesisSpecification at:#open put:#( $( $[ ${ "$> $<") . |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
195 |
DefaultParenthesisSpecification at:#close put:#( $) $] $} "$> $<"). |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
196 |
DefaultParenthesisSpecification at:#ignore put:#( $' $" '$[' '$]' '${' '$)' ). |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
197 |
DefaultParenthesisSpecification at:#eolComment put:'"/'. "/ sigh - must be 2 characters |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
198 |
]. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
199 |
! ! |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
200 |
|
844
03e45d817dce
fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
201 |
!TextView class methodsFor:'defaults'! |
38 | 202 |
|
896 | 203 |
defaultIcon |
1195 | 204 |
"return the default icon if started as a topView" |
205 |
||
206 |
<resource: #style (#ICON #ICON_FILE)> |
|
207 |
||
208 |
|nm i| |
|
1143 | 209 |
|
1146 | 210 |
i := self classResources at:'ICON' default:nil. |
1143 | 211 |
i isNil ifTrue:[ |
1987 | 212 |
nm := ClassResources at:'ICON_FILE' default:'Editor.xbm'. |
2074 | 213 |
i := Smalltalk imageFromFileNamed:nm forClass:self. |
1195 | 214 |
]. |
215 |
i notNil ifTrue:[ |
|
1987 | 216 |
i := i onDevice:Display |
1143 | 217 |
]. |
218 |
^ i |
|
219 |
||
1195 | 220 |
"Modified: 18.4.1997 / 15:18:06 / cg" |
896 | 221 |
! |
222 |
||
910
0446030ce647
Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents:
906
diff
changeset
|
223 |
defaultMenuMessage |
0446030ce647
Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents:
906
diff
changeset
|
224 |
"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
|
225 |
|
0446030ce647
Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents:
906
diff
changeset
|
226 |
^ #editMenu |
0446030ce647
Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents:
906
diff
changeset
|
227 |
|
0446030ce647
Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents:
906
diff
changeset
|
228 |
"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
|
229 |
! |
0446030ce647
Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents:
906
diff
changeset
|
230 |
|
2306 | 231 |
defaultSelectionBackgroundColor |
232 |
"return the default selection background color" |
|
233 |
||
234 |
^DefaultSelectionBackgroundColor |
|
235 |
! |
|
236 |
||
237 |
defaultSelectionForegroundColor |
|
238 |
"return the default selection foreground color" |
|
239 |
||
240 |
^DefaultSelectionForegroundColor |
|
241 |
! |
|
242 |
||
1477
2d4b6115e2c5
redefine #defaultViewBackgroundColor for the spec class
tz
parents:
1476
diff
changeset
|
243 |
defaultViewBackgroundColor |
2d4b6115e2c5
redefine #defaultViewBackgroundColor for the spec class
tz
parents:
1476
diff
changeset
|
244 |
"return the default view background" |
2d4b6115e2c5
redefine #defaultViewBackgroundColor for the spec class
tz
parents:
1476
diff
changeset
|
245 |
|
2d4b6115e2c5
redefine #defaultViewBackgroundColor for the spec class
tz
parents:
1476
diff
changeset
|
246 |
^DefaultViewBackground |
2d4b6115e2c5
redefine #defaultViewBackgroundColor for the spec class
tz
parents:
1476
diff
changeset
|
247 |
! |
2d4b6115e2c5
redefine #defaultViewBackgroundColor for the spec class
tz
parents:
1476
diff
changeset
|
248 |
|
1729 | 249 |
st80SelectMode |
250 |
^ ST80Selections |
|
251 |
||
252 |
"Modified: / 6.1.1999 / 14:19:26 / cg" |
|
253 |
! |
|
254 |
||
255 |
st80SelectMode:aBoolean |
|
256 |
ST80Selections := aBoolean |
|
257 |
||
258 |
"Created: / 7.1.1999 / 13:35:24 / cg" |
|
259 |
! |
|
260 |
||
59 | 261 |
updateStyleCache |
441
e170bca66a78
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
428
diff
changeset
|
262 |
"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
|
263 |
|
1353 | 264 |
<resource: #style (#'textView.background' |
2596 | 265 |
#'text.selectionForegroundColor' #'text.selectionBackgroundColor' |
266 |
#'text.alternativeSelectionForegroundColor' #'text.alternativeSelectionBackgroundColor' |
|
267 |
#'textView.font' #'text.wordSelectCatchesBlanks' |
|
268 |
#'text.st80Selections')> |
|
441
e170bca66a78
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
428
diff
changeset
|
269 |
|
1353 | 270 |
DefaultViewBackground := StyleSheet colorAt:'textView.background' default:White. |
1380 | 271 |
DefaultSelectionForegroundColor := StyleSheet colorAt:'text.selectionForegroundColor'. |
272 |
DefaultSelectionBackgroundColor := StyleSheet colorAt:'text.selectionBackgroundColor'. |
|
2630
f3c95e73f862
for now: do not use alternative selection color
Claus Gittinger <cg@exept.de>
parents:
2604
diff
changeset
|
273 |
"/ 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
|
274 |
"/ 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
|
275 |
DefaultAlternativeSelectionForegroundColor := DefaultSelectionForegroundColor. |
f3c95e73f862
for now: do not use alternative selection color
Claus Gittinger <cg@exept.de>
parents:
2604
diff
changeset
|
276 |
DefaultAlternativeSelectionBackgroundColor := DefaultSelectionBackgroundColor. |
1353 | 277 |
DefaultFont := StyleSheet fontAt:'textView.font'. |
504 | 278 |
MatchDelayTime := 0.6. |
1380 | 279 |
WordSelectCatchesBlanks := StyleSheet at:'text.wordSelectCatchesBlanks' default:false. |
280 |
ST80Selections := StyleSheet at:'text.st80Selections' default:false. |
|
281 |
||
282 |
"Modified: / 31.10.1997 / 13:17:16 / cg" |
|
0 | 283 |
! ! |
284 |
||
2201
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
285 |
!TextView class methodsFor:'interface specs'! |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
286 |
|
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
287 |
searchDialogSpec |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
288 |
"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
|
289 |
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
|
290 |
|
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
291 |
"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
|
292 |
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
|
293 |
|
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
294 |
" |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
295 |
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
|
296 |
" |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
297 |
|
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
298 |
<resource: #canvas> |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
299 |
|
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
300 |
^ |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
301 |
#(#FullSpec |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
302 |
#name: #searchDialogSpec |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
303 |
#window: |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
304 |
#(#WindowSpec |
2421 | 305 |
#label: 'String search' |
306 |
#name: 'String search' |
|
2201
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
307 |
#min: #(#Point 10 10) |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
308 |
#max: #(#Point 1280 1024) |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
309 |
#bounds: #(#Rectangle 12 22 311 138) |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
310 |
) |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
311 |
#component: |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
312 |
#(#SpecCollection |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
313 |
#collection: #( |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
314 |
#(#HorizontalPanelViewSpec |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
315 |
#name: 'horizontalPanelView' |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
316 |
#layout: #(#LayoutFrame 0 0.0 -26 1.0 0 1.0 0 1.0) |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
317 |
#level: 0 |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
318 |
#horizontalLayout: #fitSpace |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
319 |
#verticalLayout: #center |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
320 |
#horizontalSpace: 3 |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
321 |
#verticalSpace: 3 |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
322 |
#ignoreInvisibleComponents: true |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
323 |
#reverseOrderIfOKAtLeft: true |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
324 |
#component: |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
325 |
#(#SpecCollection |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
326 |
#collection: #( |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
327 |
#(#ActionButtonSpec |
2415 | 328 |
#label: 'Cancel' |
2201
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
329 |
#name: 'cancelButton' |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
330 |
#level: 2 |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
331 |
#translateLabel: true |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
332 |
#tabable: true |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
333 |
#model: #cancel |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
334 |
#extent: #(#Point 95 21) |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
335 |
) |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
336 |
#(#ActionButtonSpec |
2415 | 337 |
#label: 'Prev' |
2201
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
338 |
#name: 'prevButton' |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
339 |
#level: 2 |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
340 |
#translateLabel: true |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
341 |
#tabable: true |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
342 |
#model: #prevAction |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
343 |
#extent: #(#Point 95 21) |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
344 |
) |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
345 |
#(#ActionButtonSpec |
2415 | 346 |
#label: 'Next' |
2201
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
347 |
#name: 'nextButton' |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
348 |
#level: 2 |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
349 |
#borderWidth: 1 |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
350 |
#translateLabel: true |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
351 |
#tabable: true |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
352 |
#model: #nextAction |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
353 |
#isDefault: true |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
354 |
#extent: #(#Point 95 21) |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
355 |
) |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
356 |
) |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
357 |
|
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
358 |
) |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
359 |
) |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
360 |
#(#LabelSpec |
2421 | 361 |
#label: 'SearchPattern:' |
2201
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
362 |
#name: 'label' |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
363 |
#layout: #(#LayoutFrame 1 0.0 3 0 -1 1.0 20 0) |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
364 |
#level: 0 |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
365 |
#translateLabel: true |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
366 |
#adjust: #left |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
367 |
) |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
368 |
#(#ComboBoxSpec |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
369 |
#name: 'patternComboBox' |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
370 |
#layout: #(#LayoutFrame 3 0.0 26 0 -3 1.0 48 0) |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
371 |
#tabable: true |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
372 |
#model: #searchPattern |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
373 |
#immediateAccept: false |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
374 |
#acceptOnLeave: true |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
375 |
#acceptOnReturn: true |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
376 |
#acceptOnTab: true |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
377 |
#acceptOnLostFocus: true |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
378 |
#acceptOnPointerLeave: false |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
379 |
#autoSelectInitialText: true |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
380 |
#comboList: #patternList |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
381 |
) |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
382 |
#(#CheckBoxSpec |
2421 | 383 |
#label: 'Ignore case' |
2201
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
384 |
#name: 'ignoreCaseCheckBox' |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
385 |
#layout: #(#LayoutFrame 3 0.0 54 0 -3 1.0 77 0) |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
386 |
#level: 0 |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
387 |
#tabable: true |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
388 |
#model: #ignoreCase |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
389 |
#translateLabel: true |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
390 |
) |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
391 |
) |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
392 |
|
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 |
) |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
395 |
! ! |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
396 |
|
844
03e45d817dce
fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
397 |
!TextView class methodsFor:'startup'! |
121 | 398 |
|
248 | 399 |
open |
400 |
"start an empty TextView" |
|
401 |
||
402 |
^ self openWith:nil |
|
0 | 403 |
! |
404 |
||
1014
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
405 |
openModalOnModel:aModel |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
406 |
"start a textView on a model; return the textView" |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
407 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
408 |
|textView| |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
409 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
410 |
textView := self setupForModel:aModel. |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
411 |
textView topView openModal. |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
412 |
^ textView |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
413 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
414 |
"Created: 14.2.1997 / 15:24:12 / cg" |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
415 |
! |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
416 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
417 |
openModalWith:aString |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
418 |
"start a textView with aString as initial contents" |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
419 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
420 |
^ self openModalWith:aString title:nil |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
421 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
422 |
" |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
423 |
TextView openModalWith:'some text' |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
424 |
EditTextView openModalWith:'some text' |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
425 |
" |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
426 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
427 |
"Created: 14.2.1997 / 15:19:04 / cg" |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
428 |
! |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
429 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
430 |
openModalWith:aString title:aTitle |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
431 |
"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
|
432 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
433 |
|textView| |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
434 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
435 |
textView := self setupWith:aString title:aTitle. |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
436 |
textView topView openModal. |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
437 |
^ textView |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
438 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
439 |
" |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
440 |
TextView openModalWith:'some text' title:'testing' |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
441 |
EditTextView openModalWith:'some text' title:'testing' |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
442 |
" |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
443 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
444 |
"Modified: 9.9.1996 / 19:32:29 / cg" |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
445 |
"Created: 14.2.1997 / 15:19:18 / cg" |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
446 |
! |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
447 |
|
248 | 448 |
openOn:aFileName |
830
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
449 |
"start a textView on a file; return the textView" |
0 | 450 |
|
830
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
451 |
|textView| |
248 | 452 |
|
1014
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
453 |
textView := self setupForFile:aFileName. |
830
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
454 |
textView topView open. |
248 | 455 |
^ textView |
456 |
||
457 |
" |
|
830
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
458 |
TextView openOn:'../../doc/overview.doc' |
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
459 |
EditTextView openOn:'../../doc/overview.doc' |
248 | 460 |
" |
830
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
461 |
|
1014
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
462 |
"Modified: 14.2.1997 / 15:21:51 / cg" |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
463 |
! |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
464 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
465 |
openOnModel:aModel |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
466 |
"start a textView on a model; return the textView" |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
467 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
468 |
|textView| |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
469 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
470 |
textView := self setupForModel:aModel. |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
471 |
textView topView open. |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
472 |
^ textView |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
473 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
474 |
"Created: 14.2.1997 / 15:23:36 / cg" |
0 | 475 |
! |
476 |
||
1100 | 477 |
openWith:aStringOrStringCollection |
478 |
"start a textView with aStringOrStringCollection as initial contents" |
|
479 |
||
480 |
^ self openWith:aStringOrStringCollection title:nil |
|
0 | 481 |
|
248 | 482 |
" |
483 |
TextView openWith:'some text' |
|
484 |
EditTextView openWith:'some text' |
|
485 |
" |
|
119 | 486 |
|
248 | 487 |
"Created: 10.12.1995 / 17:41:32 / cg" |
1100 | 488 |
"Modified: 5.3.1997 / 15:37:19 / cg" |
126 | 489 |
! |
490 |
||
1100 | 491 |
openWith:aStringOrStringCollection title:aTitle |
492 |
"start a textView with aStringOrStringCollection as initial contents. Return the textView." |
|
248 | 493 |
|
830
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
494 |
|textView| |
248 | 495 |
|
1100 | 496 |
textView := self setupWith:aStringOrStringCollection title:aTitle. |
830
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
497 |
textView topView open. |
248 | 498 |
^ textView |
499 |
||
500 |
" |
|
501 |
TextView openWith:'some text' title:'testing' |
|
502 |
EditTextView openWith:'some text' title:'testing' |
|
503 |
" |
|
126 | 504 |
|
248 | 505 |
"Created: 10.12.1995 / 17:40:02 / cg" |
1100 | 506 |
"Modified: 5.3.1997 / 15:37:26 / cg" |
248 | 507 |
! |
508 |
||
509 |
setupEmpty |
|
510 |
"create a textview in a topview, with horizontal and |
|
511 |
vertical scrollbars - a helper for #startWith: and #startOn:" |
|
512 |
||
513 |
|top frame label| |
|
514 |
||
515 |
label := 'unnamed'. |
|
896 | 516 |
top := StandardSystemView label:label icon:self defaultIcon. |
248 | 517 |
|
518 |
frame := HVScrollableView |
|
1728
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
519 |
for:self |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
520 |
miniScrollerH:true miniScrollerV:false |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
521 |
in:top. |
248 | 522 |
frame origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
523 |
^ frame scrolledView |
|
896 | 524 |
|
525 |
"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
|
526 |
! |
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
527 |
|
1014
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
528 |
setupForFile:aFileName |
830
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
529 |
"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
|
530 |
|
1326 | 531 |
|top textView f| |
830
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
532 |
|
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
533 |
textView := self setupEmpty. |
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
534 |
top := textView topView. |
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
535 |
aFileName notNil ifTrue:[ |
1326 | 536 |
f := aFileName asFilename. |
1728
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
537 |
top label:(f baseName). |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
538 |
textView contents:(f contents). |
830
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
539 |
]. |
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
540 |
|
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
541 |
^ textView |
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
542 |
|
1014
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
543 |
"Created: 14.2.1997 / 15:21:43 / cg" |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
544 |
! |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
545 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
546 |
setupForModel:aModel |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
547 |
"setup a textView on a model; return the textView" |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
548 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
549 |
|top textView| |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
550 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
551 |
textView := self setupEmpty. |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
552 |
textView model:aModel. |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
553 |
top := textView topView. |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
554 |
^ textView |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
555 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
556 |
"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
|
557 |
! |
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
558 |
|
1100 | 559 |
setupWith:aStringOrStringCollection title:aTitle |
560 |
"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
|
561 |
|
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
562 |
|top textView| |
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
563 |
|
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
564 |
textView := self setupEmpty. |
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
565 |
top := textView topView. |
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
566 |
aTitle notNil ifTrue:[top label:aTitle]. |
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
567 |
|
1100 | 568 |
aStringOrStringCollection notNil ifTrue:[ |
1728
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
569 |
textView contents:aStringOrStringCollection |
830
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
570 |
]. |
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
571 |
|
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
572 |
^ textView |
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
573 |
|
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
574 |
"Created: 9.9.1996 / 19:31:22 / cg" |
1100 | 575 |
"Modified: 5.3.1997 / 15:37:37 / cg" |
119 | 576 |
! ! |
577 |
||
2100 | 578 |
!TextView methodsFor:'Compatibility - ST80'! |
1584
9f3875dc341e
added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents:
1545
diff
changeset
|
579 |
|
2291 | 580 |
displaySelection:aBoolean |
581 |
"ST-80 compatibility: ignored here." |
|
582 |
||
583 |
! |
|
584 |
||
2118
f9d8bfb35b03
added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2109
diff
changeset
|
585 |
editText:someText |
f9d8bfb35b03
added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2109
diff
changeset
|
586 |
"ST-80 compatibility: set the edited text." |
f9d8bfb35b03
added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2109
diff
changeset
|
587 |
|
f9d8bfb35b03
added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2109
diff
changeset
|
588 |
self contents:someText |
f9d8bfb35b03
added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2109
diff
changeset
|
589 |
|
f9d8bfb35b03
added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2109
diff
changeset
|
590 |
"Created: / 5.2.2000 / 17:06:18 / cg" |
f9d8bfb35b03
added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2109
diff
changeset
|
591 |
! |
f9d8bfb35b03
added #editText: for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2109
diff
changeset
|
592 |
|
2291 | 593 |
selectAndScroll |
594 |
"ST-80 compatibility: ignored here." |
|
595 |
||
596 |
! |
|
597 |
||
1584
9f3875dc341e
added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents:
1545
diff
changeset
|
598 |
selectionStartIndex |
9f3875dc341e
added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents:
1545
diff
changeset
|
599 |
"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
|
600 |
|
9f3875dc341e
added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents:
1545
diff
changeset
|
601 |
^ self characterPositionOfSelection |
9f3875dc341e
added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents:
1545
diff
changeset
|
602 |
|
9f3875dc341e
added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents:
1545
diff
changeset
|
603 |
"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
|
604 |
! |
9f3875dc341e
added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents:
1545
diff
changeset
|
605 |
|
9f3875dc341e
added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents:
1545
diff
changeset
|
606 |
selectionStopIndex |
2052 | 607 |
"ST-80 compatibility: return the character position of |
608 |
the character right after the selection." |
|
609 |
||
2109
ccad6daad477
selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents:
2100
diff
changeset
|
610 |
|idx| |
ccad6daad477
selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents:
2100
diff
changeset
|
611 |
|
ccad6daad477
selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents:
2100
diff
changeset
|
612 |
idx := self characterPositionOfSelectionEnd. |
ccad6daad477
selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents:
2100
diff
changeset
|
613 |
idx == 0 ifTrue:[^ 0]. |
ccad6daad477
selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents:
2100
diff
changeset
|
614 |
^ idx + 1 |
1584
9f3875dc341e
added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents:
1545
diff
changeset
|
615 |
|
9f3875dc341e
added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents:
1545
diff
changeset
|
616 |
"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
|
617 |
! ! |
9f3875dc341e
added selectionStartIndex and selectionStopIndex (for ST80-controller compatibility)
Claus Gittinger <cg@exept.de>
parents:
1545
diff
changeset
|
618 |
|
0 | 619 |
!TextView methodsFor:'accessing'! |
620 |
||
621 |
characterPositionOfSelection |
|
1303 | 622 |
"return the character index of the first character in the selection. |
623 |
Returns 0 if there is no selection." |
|
624 |
||
625 |
selectionStartLine isNil ifTrue:[^ 0]. |
|
0 | 626 |
^ self characterPositionOfLine:selectionStartLine |
1728
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
627 |
col:selectionStartCol |
1303 | 628 |
|
629 |
"Modified: 14.8.1997 / 16:35:37 / cg" |
|
630 |
! |
|
631 |
||
632 |
characterPositionOfSelectionEnd |
|
633 |
"return the character index of the last character in the selection. |
|
634 |
Returns 0 if there is no selection." |
|
635 |
||
636 |
selectionStartLine isNil ifTrue:[^ 0]. |
|
637 |
^ self characterPositionOfLine:selectionEndLine |
|
2109
ccad6daad477
selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents:
2100
diff
changeset
|
638 |
col:selectionEndCol |
1303 | 639 |
|
640 |
"Created: 14.8.1997 / 16:35:24 / cg" |
|
641 |
"Modified: 14.8.1997 / 16:35:45 / cg" |
|
0 | 642 |
! |
643 |
||
644 |
contentsWasSaved |
|
645 |
"return true, if the contents was saved (by a save action), |
|
646 |
false if not (or was modified again after the last save)." |
|
647 |
||
648 |
^ contentsWasSaved |
|
649 |
! |
|
650 |
||
1003
b1affa654489
added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents:
997
diff
changeset
|
651 |
defaultFileNameForFileDialog:aBaseName |
b1affa654489
added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents:
997
diff
changeset
|
652 |
"define the default fileName to use for the save-box" |
b1affa654489
added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents:
997
diff
changeset
|
653 |
|
b1affa654489
added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents:
997
diff
changeset
|
654 |
defaultFileNameForFileDialog := aBaseName |
b1affa654489
added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents:
997
diff
changeset
|
655 |
|
b1affa654489
added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents:
997
diff
changeset
|
656 |
"Created: 13.2.1997 / 18:29:53 / cg" |
b1affa654489
added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents:
997
diff
changeset
|
657 |
! |
b1affa654489
added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents:
997
diff
changeset
|
658 |
|
248 | 659 |
directoryForFileDialog:aDirectory |
1003
b1affa654489
added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents:
997
diff
changeset
|
660 |
"define the default directory to use for save-box" |
248 | 661 |
|
662 |
directoryForFileDialog := aDirectory |
|
1003
b1affa654489
added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents:
997
diff
changeset
|
663 |
|
b1affa654489
added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents:
997
diff
changeset
|
664 |
"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
|
665 |
! |
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
666 |
|
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
667 |
externalEncoding:encodingSymOrNil |
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
668 |
"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
|
669 |
via the 'save / save as' dialog. |
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
670 |
This is (currently) only passed down from the fileBrowser, |
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
671 |
and required when japanese/chines/korean text is edited. |
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
672 |
(encoding is one of #euc, #sjis, #jis7, #gb, #big5 or #ksc)" |
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
673 |
|
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
674 |
externalEncoding := encodingSymOrNil |
2553
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
675 |
! |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
676 |
|
2581 | 677 |
parenthesisSpecification |
678 |
"return the value of the instance variable 'parenthesisSpecification' (automatically generated)" |
|
679 |
||
680 |
^ parenthesisSpecification |
|
681 |
! |
|
682 |
||
2553
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
683 |
parenthesisSpecification:aDictionary |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
684 |
"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
|
685 |
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
|
686 |
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
|
687 |
|
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
688 |
parenthesisSpecification := aDictionary |
599
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
689 |
! ! |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
690 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
691 |
!TextView methodsFor:'accessing-contents'! |
248 | 692 |
|
0 | 693 |
fromFile:aFileName |
694 |
"take contents from a named file" |
|
695 |
||
1326 | 696 |
|f| |
697 |
||
698 |
f := aFileName asFilename. |
|
699 |
self directoryForFileDialog:(f directoryName). |
|
700 |
self contents:(f contents) |
|
0 | 701 |
! |
702 |
||
248 | 703 |
list:something |
704 |
"set the displayed contents (a collection of strings) |
|
705 |
with redraw. |
|
599
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
706 |
Redefined since changing the contents implies deselect" |
0 | 707 |
|
708 |
self unselect. |
|
248 | 709 |
super list:something |
0 | 710 |
|
599
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
711 |
"Modified: 29.4.1996 / 12:13:24 / cg" |
0 | 712 |
! |
713 |
||
1476
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
714 |
setContents:something |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
715 |
"set the contents (either a string or a Collection of strings) |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
716 |
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
|
717 |
|
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
718 |
|selStartLine selStartCol selEndLine selEndCol selStyle| |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
719 |
|
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
720 |
selStartLine := selectionStartLine. |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
721 |
selStartCol := selectionStartCol. |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
722 |
selEndLine := selectionEndLine. |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
723 |
selEndCol := selectionEndCol. |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
724 |
selStyle := selectStyle. |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
725 |
|
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
726 |
super setContents:something. |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
727 |
|
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
728 |
selStartLine notNil ifTrue:[ |
1728
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
729 |
self |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
730 |
selectFromLine:selStartLine col:selStartCol |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
731 |
toLine:selEndLine col:selEndCol. |
1476
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
732 |
]. |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
733 |
|
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
734 |
selectStyle := selStyle |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
735 |
|
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
736 |
"Modified: / 31.3.1998 / 23:33:21 / cg" |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
737 |
! |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
738 |
|
248 | 739 |
setList:something |
740 |
"set the displayed contents (a collection of strings) |
|
741 |
without redraw. |
|
742 |
Redefined since changing contents implies deselect" |
|
0 | 743 |
|
248 | 744 |
self unselect. |
745 |
super setList:something |
|
599
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
746 |
! |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
747 |
|
1487
4a9bfda28991
added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1477
diff
changeset
|
748 |
text |
4a9bfda28991
added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1477
diff
changeset
|
749 |
"for ST80 compatibility" |
4a9bfda28991
added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1477
diff
changeset
|
750 |
|
4a9bfda28991
added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1477
diff
changeset
|
751 |
^ self contents |
4a9bfda28991
added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1477
diff
changeset
|
752 |
|
4a9bfda28991
added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1477
diff
changeset
|
753 |
"Created: / 19.4.1998 / 12:53:10 / cg" |
4a9bfda28991
added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1477
diff
changeset
|
754 |
! |
4a9bfda28991
added #text for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
1477
diff
changeset
|
755 |
|
599
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
756 |
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
|
757 |
"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
|
758 |
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
|
759 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
760 |
|beginCol endCol endLine thisCharacter flag| |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
761 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
762 |
flag := #word. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
763 |
beginCol := selectCol. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
764 |
endCol := selectCol. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
765 |
endLine := selectLine. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
766 |
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
|
767 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
768 |
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
|
769 |
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
|
770 |
endCol == 0 ifTrue:[ |
1784
e45846a6af7a
remember clickPosition (for single character selection)
Claus Gittinger <cg@exept.de>
parents:
1769
diff
changeset
|
771 |
endLine := selectLine + 1 |
599
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
772 |
]. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
773 |
|
1750 | 774 |
"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
|
775 |
(wordCheck value:thisCharacter) ifTrue:[ |
1784
e45846a6af7a
remember clickPosition (for single character selection)
Claus Gittinger <cg@exept.de>
parents:
1769
diff
changeset
|
776 |
" |
e45846a6af7a
remember clickPosition (for single character selection)
Claus Gittinger <cg@exept.de>
parents:
1769
diff
changeset
|
777 |
try to catch a blank ... |
e45846a6af7a
remember clickPosition (for single character selection)
Claus Gittinger <cg@exept.de>
parents:
1769
diff
changeset
|
778 |
" |
e45846a6af7a
remember clickPosition (for single character selection)
Claus Gittinger <cg@exept.de>
parents:
1769
diff
changeset
|
779 |
|
e45846a6af7a
remember clickPosition (for single character selection)
Claus Gittinger <cg@exept.de>
parents:
1769
diff
changeset
|
780 |
WordSelectCatchesBlanks ifTrue:[ |
e45846a6af7a
remember clickPosition (for single character selection)
Claus Gittinger <cg@exept.de>
parents:
1769
diff
changeset
|
781 |
((beginCol == 1) |
e45846a6af7a
remember clickPosition (for single character selection)
Claus Gittinger <cg@exept.de>
parents:
1769
diff
changeset
|
782 |
or:[(self characterAtLine:selectLine col:(beginCol - 1)) |
e45846a6af7a
remember clickPosition (for single character selection)
Claus Gittinger <cg@exept.de>
parents:
1769
diff
changeset
|
783 |
~~ Character space]) ifTrue:[ |
e45846a6af7a
remember clickPosition (for single character selection)
Claus Gittinger <cg@exept.de>
parents:
1769
diff
changeset
|
784 |
((self characterAtLine:selectLine col:(endCol + 1)) |
e45846a6af7a
remember clickPosition (for single character selection)
Claus Gittinger <cg@exept.de>
parents:
1769
diff
changeset
|
785 |
== Character space) ifTrue:[ |
e45846a6af7a
remember clickPosition (for single character selection)
Claus Gittinger <cg@exept.de>
parents:
1769
diff
changeset
|
786 |
endCol := endCol + 1. |
e45846a6af7a
remember clickPosition (for single character selection)
Claus Gittinger <cg@exept.de>
parents:
1769
diff
changeset
|
787 |
flag := #wordRight |
e45846a6af7a
remember clickPosition (for single character selection)
Claus Gittinger <cg@exept.de>
parents:
1769
diff
changeset
|
788 |
] |
e45846a6af7a
remember clickPosition (for single character selection)
Claus Gittinger <cg@exept.de>
parents:
1769
diff
changeset
|
789 |
] ifFalse:[ |
e45846a6af7a
remember clickPosition (for single character selection)
Claus Gittinger <cg@exept.de>
parents:
1769
diff
changeset
|
790 |
beginCol := beginCol - 1. |
e45846a6af7a
remember clickPosition (for single character selection)
Claus Gittinger <cg@exept.de>
parents:
1769
diff
changeset
|
791 |
flag := #wordLeft |
e45846a6af7a
remember clickPosition (for single character selection)
Claus Gittinger <cg@exept.de>
parents:
1769
diff
changeset
|
792 |
]. |
e45846a6af7a
remember clickPosition (for single character selection)
Claus Gittinger <cg@exept.de>
parents:
1769
diff
changeset
|
793 |
]. |
599
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
794 |
]. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
795 |
aFiveArgBlock value:selectLine |
1784
e45846a6af7a
remember clickPosition (for single character selection)
Claus Gittinger <cg@exept.de>
parents:
1769
diff
changeset
|
796 |
value:beginCol |
e45846a6af7a
remember clickPosition (for single character selection)
Claus Gittinger <cg@exept.de>
parents:
1769
diff
changeset
|
797 |
value:endLine |
e45846a6af7a
remember clickPosition (for single character selection)
Claus Gittinger <cg@exept.de>
parents:
1769
diff
changeset
|
798 |
value:endCol |
e45846a6af7a
remember clickPosition (for single character selection)
Claus Gittinger <cg@exept.de>
parents:
1769
diff
changeset
|
799 |
value:flag |
599
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
800 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
801 |
"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
|
802 |
! ! |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
803 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
804 |
!TextView methodsFor:'accessing-look'! |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
805 |
|
2027
0bde8408361a
accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
806 |
selectionBackgroundColor |
0bde8408361a
accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
807 |
"return the selection-background color." |
0bde8408361a
accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
808 |
|
0bde8408361a
accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
809 |
^ selectionBgColor |
0bde8408361a
accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
810 |
! |
0bde8408361a
accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
811 |
|
0bde8408361a
accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
812 |
selectionForegroundColor |
0bde8408361a
accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
813 |
"return the selection-foreground color." |
0bde8408361a
accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
814 |
|
0bde8408361a
accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
815 |
^ selectionFgColor |
0bde8408361a
accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
816 |
! |
0bde8408361a
accessors for selection fg/bg color
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
817 |
|
599
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
818 |
selectionForegroundColor:color1 backgroundColor:color2 |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
819 |
"set both the selection-foreground and cursor background colors. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
820 |
The default is defined by the styleSheet; |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
821 |
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
|
822 |
|
1987 | 823 |
selectionFgColor := color1 onDevice:device. |
824 |
selectionBgColor := color2 onDevice:device. |
|
599
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
825 |
shown ifTrue:[ |
1987 | 826 |
self hasSelection ifTrue:[ |
827 |
self invalidate |
|
828 |
] |
|
599
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
829 |
] |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
830 |
|
722
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
715
diff
changeset
|
831 |
"Modified: 29.5.1996 / 16:22:15 / cg" |
0 | 832 |
! ! |
833 |
||
248 | 834 |
!TextView methodsFor:'accessing-mvc'! |
0 | 835 |
|
248 | 836 |
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
|
837 |
"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
|
838 |
and selection. Added for ST-80 compatibility" |
0 | 839 |
|
906 | 840 |
aspectSym notNil ifTrue:[aspectMsg := aspectSym. |
1728
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
841 |
listMsg isNil ifTrue:[listMsg := aspectSym]]. |
248 | 842 |
changeSym notNil ifTrue:[changeMsg := changeSym]. |
843 |
listSym notNil ifTrue:[listMsg := listSym]. |
|
844 |
menuSym notNil ifTrue:[menuMsg := menuSym]. |
|
845 |
"/ initial notNil ifTrue:[initialSelectionMsg := initial]. |
|
846 |
self model:aModel. |
|
0 | 847 |
|
824
f62922fcfa5d
Send #getListFromModel when setting #model:
Stefan Vogel <sv@exept.de>
parents:
813
diff
changeset
|
848 |
"Modified: 15.8.1996 / 12:52:54 / stefan" |
906 | 849 |
"Modified: 2.1.1997 / 16:11:28 / cg" |
0 | 850 |
! ! |
851 |
||
2588 | 852 |
!TextView methodsFor:'drag & drop'! |
853 |
||
854 |
allowDrag:aBoolean |
|
855 |
"enable/disable dragging support |
|
856 |
" |
|
857 |
aBoolean ifFalse:[ |
|
858 |
dropSource := nil. |
|
859 |
] ifTrue:[ |
|
860 |
dropSource ifNil:[ |
|
861 |
dropSource := DropSource receiver:self |
|
862 |
argument:nil |
|
863 |
dropObjectSelector:#collectionOfDragObjects |
|
864 |
displayObjectSelector:nil |
|
865 |
feedBackSelector:nil |
|
866 |
] |
|
867 |
]. |
|
868 |
! |
|
869 |
||
870 |
canDrag |
|
871 |
"returns true if dragging is enabled |
|
872 |
" |
|
873 |
dropSource notNil ifTrue:[ |
|
874 |
^ self hasSelection |
|
875 |
]. |
|
876 |
^ false |
|
877 |
! |
|
878 |
||
879 |
collectionOfDragObjects |
|
880 |
"returns collection of dragable objects assigned to selection |
|
881 |
Here, by default, a collection of text-dragObjects is generated; |
|
882 |
however, if a dragObjectConverter is defined, that one gets a chance |
|
883 |
to convert as appropriate. |
|
884 |
" |
|
885 |
|selection| |
|
886 |
||
887 |
selection := self selection. |
|
888 |
||
889 |
selection size == 0 ifTrue:[^ nil]. |
|
890 |
^ Array with:(DropObject newText:selection). |
|
891 |
! |
|
892 |
||
893 |
dropSource |
|
894 |
"returns the dropSource or nil |
|
895 |
" |
|
896 |
^ dropSource |
|
897 |
! |
|
898 |
||
899 |
dropSource:aDropSourceOrNil |
|
900 |
"set the dropSource or nil |
|
901 |
" |
|
902 |
dropSource := aDropSourceOrNil. |
|
903 |
! ! |
|
904 |
||
0 | 905 |
!TextView methodsFor:'event processing'! |
906 |
||
53 | 907 |
buttonMotion:buttonMask x:x y:y |
0 | 908 |
"mouse-move while button was pressed - handle selection changes" |
909 |
||
910 |
|movedVisibleLine movedLine movedCol |
|
911 |
movedUp |
|
912 |
oldStartLine oldEndLine oldStartCol oldEndCol| |
|
913 |
||
2588 | 914 |
clickLine isNil ifTrue:[ |
915 |
dragIsActive := false. |
|
916 |
^ self |
|
917 |
]. |
|
918 |
||
919 |
dragIsActive ifTrue:[ |
|
920 |
clickPos ifNil:[ |
|
921 |
dragIsActive := false. |
|
922 |
^ self |
|
923 |
]. |
|
924 |
(clickPos dist:(x@y)) >= 5.0 ifTrue:[ |
|
925 |
dragIsActive := false. |
|
926 |
||
927 |
self hasSelection ifTrue:[ |
|
928 |
dropSource startDragIn:self at:(x@y) |
|
929 |
] |
|
930 |
]. |
|
931 |
^ self |
|
932 |
]. |
|
0 | 933 |
|
63 | 934 |
"is it the select or 1-button ?" |
1619
f600c27c2c47
ignore motion event if not for left button.
Claus Gittinger <cg@exept.de>
parents:
1584
diff
changeset
|
935 |
self sensor leftButtonPressed ifFalse:[^ self]. |
f600c27c2c47
ignore motion event if not for left button.
Claus Gittinger <cg@exept.de>
parents:
1584
diff
changeset
|
936 |
"/ (device buttonMotionMask:buttonMask includesButton:#select) ifFalse:[ |
f600c27c2c47
ignore motion event if not for left button.
Claus Gittinger <cg@exept.de>
parents:
1584
diff
changeset
|
937 |
"/ (device buttonMotionMask:buttonMask includesButton:1) ifFalse:[ |
f600c27c2c47
ignore motion event if not for left button.
Claus Gittinger <cg@exept.de>
parents:
1584
diff
changeset
|
938 |
"/ ^ self |
f600c27c2c47
ignore motion event if not for left button.
Claus Gittinger <cg@exept.de>
parents:
1584
diff
changeset
|
939 |
"/ ]. |
f600c27c2c47
ignore motion event if not for left button.
Claus Gittinger <cg@exept.de>
parents:
1584
diff
changeset
|
940 |
"/ ]. |
53 | 941 |
|
0 | 942 |
"if moved outside of view, start autoscroll" |
943 |
(y < 0) ifTrue:[ |
|
1922
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
944 |
self compressMotionEvents:false. |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
945 |
self startAutoScrollUp:y. |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
946 |
^ self |
0 | 947 |
]. |
948 |
(y > height) ifTrue:[ |
|
1922
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
949 |
self compressMotionEvents:false. |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
950 |
self startAutoScrollDown:(y - height). |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
951 |
^ self |
59 | 952 |
]. |
2429
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2421
diff
changeset
|
953 |
((x < 0) and:[viewOrigin x ~~ 0]) ifTrue:[ |
1922
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
954 |
self compressMotionEvents:false. |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
955 |
self startAutoScrollLeft:x. |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
956 |
^ self |
59 | 957 |
]. |
958 |
(x > width) ifTrue:[ |
|
1922
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
959 |
self compressMotionEvents:false. |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
960 |
self startAutoScrollRight:(x - width). |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
961 |
^ self |
0 | 962 |
]. |
963 |
||
964 |
"move inside - stop autoscroll if any" |
|
965 |
autoScrollBlock notNil ifTrue:[ |
|
1922
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
966 |
self stopScrollSelect |
0 | 967 |
]. |
968 |
||
969 |
movedVisibleLine := self visibleLineOfY:y. |
|
970 |
movedLine := self visibleLineToAbsoluteLine:movedVisibleLine. |
|
971 |
(x < leftMargin) ifTrue:[ |
|
1922
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
972 |
movedCol := 0 |
0 | 973 |
] ifFalse:[ |
1922
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
974 |
movedCol := self colOfX:x inVisibleLine:movedVisibleLine |
0 | 975 |
]. |
1755
ab3c4ee45498
allow selection of a single character
Claus Gittinger <cg@exept.de>
parents:
1750
diff
changeset
|
976 |
((movedLine == clickLine) and:[movedCol == clickCol]) ifTrue:[ |
1922
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
977 |
selectionStartLine notNil ifTrue:[ |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
978 |
^ self |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
979 |
]. |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
980 |
(clickPos isNil |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
981 |
or:[(clickPos x - x) abs < 3 |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
982 |
and:[(clickPos y - y) abs < 3]]) ifTrue:[ |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
983 |
^ self |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
984 |
]. |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
985 |
selectionStartLine := clickLine. |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
986 |
selectionStartCol := clickCol. |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
987 |
selectionEndLine := selectionStartLine. |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
988 |
selectionEndCol := selectionStartCol. |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
989 |
|
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
990 |
oldStartLine := selectionStartLine. |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
991 |
oldEndLine := selectionEndLine. |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
992 |
oldStartCol := selectionStartCol. |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
993 |
oldEndCol := selectionEndCol-1. |
1755
ab3c4ee45498
allow selection of a single character
Claus Gittinger <cg@exept.de>
parents:
1750
diff
changeset
|
994 |
] ifFalse:[ |
1922
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
995 |
selectionStartLine isNil ifTrue:[ |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
996 |
selectionStartLine := clickLine. |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
997 |
selectionStartCol := clickCol. |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
998 |
selectionEndLine := selectionStartLine. |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
999 |
selectionEndCol := selectionStartCol |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1000 |
]. |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1001 |
oldStartLine := selectionStartLine. |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1002 |
oldEndLine := selectionEndLine. |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1003 |
oldStartCol := selectionStartCol. |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1004 |
oldEndCol := selectionEndCol. |
0 | 1005 |
]. |
1006 |
||
1007 |
"find out if we are before or after initial click" |
|
1008 |
movedUp := false. |
|
1009 |
(movedLine < clickStartLine) ifTrue:[ |
|
1922
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1010 |
movedUp := true |
0 | 1011 |
] ifFalse:[ |
1922
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1012 |
(movedLine == clickStartLine) ifTrue:[ |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1013 |
(movedCol < clickStartCol) ifTrue:[ |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1014 |
movedUp := true |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1015 |
] |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1016 |
] |
0 | 1017 |
]. |
1018 |
||
1019 |
movedUp ifTrue:[ |
|
1922
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1020 |
"change selectionStart" |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1021 |
selectionStartCol := movedCol. |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1022 |
selectionStartLine := movedLine. |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1023 |
selectionEndCol := clickStartCol. |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1024 |
selectionEndLine := clickStartLine. |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1025 |
selectStyle notNil ifTrue:[ |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1026 |
selectionEndCol := wordEndCol. |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1027 |
selectionEndLine := wordEndLine. |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1028 |
] |
0 | 1029 |
] ifFalse:[ |
1922
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1030 |
"change selectionEnd" |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1031 |
selectionEndCol := movedCol. |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1032 |
selectionEndLine := movedLine. |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1033 |
selectionStartCol := clickStartCol. |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1034 |
selectionStartLine := clickStartLine. |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1035 |
selectStyle notNil ifTrue:[ |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1036 |
selectionStartCol := wordStartCol. |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1037 |
selectionStartLine := wordStartLine. |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1038 |
] |
0 | 1039 |
]. |
1040 |
||
164 | 1041 |
selectionStartLine isNil ifTrue:[^ self]. |
1042 |
||
0 | 1043 |
(selectionStartCol == 0) ifTrue:[ |
1922
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1044 |
selectionStartCol := 1 |
0 | 1045 |
]. |
1046 |
||
38 | 1047 |
" |
1048 |
if in word-select, just catch the rest of the word |
|
1049 |
" |
|
1050 |
(selectStyle notNil and:[selectStyle startsWith:'word']) ifTrue:[ |
|
1922
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1051 |
movedUp ifTrue:[ |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1052 |
selectionStartCol := self findBeginOfWordAtLine:selectionStartLine col:selectionStartCol |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1053 |
] ifFalse:[ |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1054 |
selectionEndCol := self findEndOfWordAtLine:selectionEndLine col:selectionEndCol. |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1055 |
selectionEndCol == 0 ifTrue:[ |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1056 |
selectionEndLine := selectionEndLine + 1 |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1057 |
] |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1058 |
]. |
38 | 1059 |
]. |
1060 |
||
1061 |
selectStyle == #line ifTrue:[ |
|
1922
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1062 |
movedUp ifTrue:[ |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1063 |
selectionStartCol := 1. |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1064 |
] ifFalse:[ |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1065 |
selectionEndCol := 0. |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1066 |
selectionEndLine := selectionEndLine + 1 |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1067 |
] |
38 | 1068 |
]. |
1069 |
||
209
7a6db7fac566
dont allow multiline selections in EditField
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
1070 |
self validateNewSelection. |
7a6db7fac566
dont allow multiline selections in EditField
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
1071 |
|
0 | 1072 |
(oldStartLine == selectionStartLine) ifTrue:[ |
1922
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1073 |
(oldStartCol ~~ selectionStartCol) ifTrue:[ |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1074 |
self redrawLine:oldStartLine |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1075 |
from:((selectionStartCol min:oldStartCol) max:1) |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1076 |
to:((selectionStartCol max:oldStartCol) max:1) |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1077 |
] |
0 | 1078 |
] ifFalse:[ |
1922
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1079 |
self redrawFromLine:(oldStartLine min:selectionStartLine) |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1080 |
to:(oldStartLine max:selectionStartLine) |
0 | 1081 |
]. |
1082 |
||
1083 |
(oldEndLine == selectionEndLine) ifTrue:[ |
|
1922
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1084 |
(oldEndCol ~~ selectionEndCol) ifTrue:[ |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1085 |
self redrawLine:oldEndLine |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1086 |
from:((selectionEndCol min:oldEndCol) max:1) |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1087 |
to:((selectionEndCol max:oldEndCol) max:1) |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1088 |
] |
0 | 1089 |
] ifFalse:[ |
1922
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1090 |
self redrawFromLine:(oldEndLine min:selectionEndLine) |
87222b5b9e32
oops - care for clickPos being nil.
Claus Gittinger <cg@exept.de>
parents:
1909
diff
changeset
|
1091 |
to:(oldEndLine max:selectionEndLine) |
0 | 1092 |
]. |
1093 |
clickLine := movedLine. |
|
1094 |
clickCol := movedCol |
|
1619
f600c27c2c47
ignore motion event if not for left button.
Claus Gittinger <cg@exept.de>
parents:
1584
diff
changeset
|
1095 |
|
f600c27c2c47
ignore motion event if not for left button.
Claus Gittinger <cg@exept.de>
parents:
1584
diff
changeset
|
1096 |
"Modified: / 28.7.1998 / 16:02:18 / cg" |
0 | 1097 |
! |
1098 |
||
248 | 1099 |
buttonMultiPress:button x:x y:y |
1100 |
"multi-mouse-click - select word under pointer" |
|
1101 |
||
1102 |
((button == 1) or:[button == #select]) ifTrue:[ |
|
1728
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
1103 |
clickCount notNil ifTrue:[ |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
1104 |
clickCount := clickCount + 1. |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
1105 |
(clickCount == 2) ifTrue:[ |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
1106 |
self doubleClickX:x y:y |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
1107 |
] ifFalse:[ |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
1108 |
(clickCount == 3) ifTrue:[ |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
1109 |
self tripleClickX:x y:y |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
1110 |
] ifFalse:[ |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
1111 |
(clickCount == 4) ifTrue:[ |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
1112 |
self quadClickX:x y:y |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
1113 |
] |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
1114 |
] |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
1115 |
] |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
1116 |
] |
248 | 1117 |
] ifFalse:[ |
1728
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
1118 |
super buttonMultiPress:button x:x y:y |
248 | 1119 |
] |
1120 |
||
1322
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1121 |
"Modified: 11.9.1997 / 04:15:35 / cg" |
248 | 1122 |
! |
1123 |
||
1124 |
buttonPress:button x:x y:y |
|
1125 |
"mouse-click - prepare for selection change" |
|
1126 |
||
1308 | 1127 |
|sensor clickVisibleLine| |
1128 |
||
2588 | 1129 |
dragIsActive := false. |
1130 |
sensor := self sensor. |
|
1131 |
||
1909 | 1132 |
(sensor notNil and:[sensor shiftDown]) ifTrue:[ |
1133 |
"mouse-click with shift - adding to selection" |
|
1134 |
||
1135 |
"very simple - just simulate a move" |
|
1136 |
^ self buttonMotion:(device button1MotionMask) x:x y:y |
|
813
7168eda47e3b
Display no longer sends buttonShiftPress messages
Claus Gittinger <cg@exept.de>
parents:
770
diff
changeset
|
1137 |
]. |
7168eda47e3b
Display no longer sends buttonShiftPress messages
Claus Gittinger <cg@exept.de>
parents:
770
diff
changeset
|
1138 |
|
248 | 1139 |
((button == 1) or:[button == #select]) ifTrue:[ |
1909 | 1140 |
clickVisibleLine := self visibleLineOfY:y. |
1141 |
clickPos := x @ y. |
|
1142 |
clickCol := self colOfX:x inVisibleLine:clickVisibleLine. |
|
1143 |
clickLine := self visibleLineToAbsoluteLine:clickVisibleLine. |
|
1144 |
clickStartLine := clickLine. |
|
1145 |
clickStartCol := clickCol. |
|
2588 | 1146 |
|
2593
6f1cdd5dafaa
textDrag start with CTRL (optional)
Claus Gittinger <cg@exept.de>
parents:
2588
diff
changeset
|
1147 |
(self canDrag |
6f1cdd5dafaa
textDrag start with CTRL (optional)
Claus Gittinger <cg@exept.de>
parents:
2588
diff
changeset
|
1148 |
and:[(self isInSelection:clickLine col:clickCol) |
6f1cdd5dafaa
textDrag start with CTRL (optional)
Claus Gittinger <cg@exept.de>
parents:
2588
diff
changeset
|
1149 |
and:[UserPreferences current startTextDragWithControl not |
6f1cdd5dafaa
textDrag start with CTRL (optional)
Claus Gittinger <cg@exept.de>
parents:
2588
diff
changeset
|
1150 |
or:[sensor ctrlDown]]]) ifTrue:[ |
2588 | 1151 |
dragIsActive := true |
1152 |
] ifFalse:[ |
|
1153 |
self unselect. |
|
1154 |
]. |
|
1909 | 1155 |
clickCount := 1 |
248 | 1156 |
] ifFalse:[ |
1909 | 1157 |
super buttonPress:button x:x y:y |
248 | 1158 |
] |
813
7168eda47e3b
Display no longer sends buttonShiftPress messages
Claus Gittinger <cg@exept.de>
parents:
770
diff
changeset
|
1159 |
|
1909 | 1160 |
"Modified: / 20.5.1999 / 17:02:45 / cg" |
248 | 1161 |
! |
1162 |
||
0 | 1163 |
buttonRelease:button x:x y:y |
1164 |
"mouse- button release - turn off autoScroll if any" |
|
1165 |
||
38 | 1166 |
((button == 1) or:[button == #select]) ifTrue:[ |
1909 | 1167 |
autoScrollBlock notNil ifTrue:[ |
1168 |
self stopScrollSelect |
|
1169 |
]. |
|
2588 | 1170 |
dragIsActive ifTrue:[ |
1171 |
self unselect |
|
1172 |
]. |
|
1909 | 1173 |
clickPos := nil. |
2588 | 1174 |
|
0 | 1175 |
] ifFalse:[ |
1909 | 1176 |
super buttonRelease:button x:x y:y |
1177 |
]. |
|
2588 | 1178 |
dragIsActive := false. |
1179 |
||
1909 | 1180 |
"/ clickPos := clickLine := clickCol := nil. |
1181 |
||
1182 |
"Modified: / 20.5.1999 / 17:14:23 / cg" |
|
824
f62922fcfa5d
Send #getListFromModel when setting #model:
Stefan Vogel <sv@exept.de>
parents:
813
diff
changeset
|
1183 |
! |
248 | 1184 |
|
1322
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1185 |
doubleClickX:x y:y |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1186 |
"double-click - select word under pointer" |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1187 |
|
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1188 |
|sel ch matchCol scanCol fwdScan| |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1189 |
|
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1190 |
ST80Selections == true ifTrue:[ |
1851 | 1191 |
"/ st80 selects: |
1192 |
"/ if clicked right after a parenthesis -> select to matching parenthesis |
|
1193 |
"/ if clicked at beginning of the line -> select that line |
|
1194 |
"/ if clicked at the top of the text -> select all |
|
1195 |
"/ |
|
1196 |
clickCol == 1 ifTrue:[ |
|
1197 |
clickLine == 1 ifTrue:[ |
|
1198 |
self selectAll. |
|
1199 |
^ self. |
|
1200 |
]. |
|
1201 |
self selectLineAtY:y. |
|
1202 |
selectStyle := #line. |
|
1203 |
^ self |
|
1204 |
]. |
|
1205 |
||
1206 |
matchCol := nil. |
|
1207 |
"/ see what is to the left of that character ... |
|
1208 |
clickCol > 1 ifTrue:[ |
|
1209 |
ch := self characterAtLine:clickLine col:clickCol-1. |
|
1210 |
('([{<' includes:ch) ifTrue:[ |
|
1211 |
matchCol := clickCol - 1 |
|
1212 |
] ifFalse:[ |
|
1213 |
('"' includes:ch) ifTrue:[ |
|
1214 |
scanCol := clickCol - 1. |
|
1215 |
fwdScan := true |
|
1216 |
] |
|
1217 |
] |
|
1218 |
]. |
|
1219 |
clickCol < (self listAt:clickLine) size ifTrue:[ |
|
1220 |
ch := self characterAtLine:clickLine col:clickCol+1. |
|
1221 |
(')]}>' includes:ch) ifTrue:[ |
|
1222 |
matchCol := clickCol + 1. |
|
1223 |
] ifFalse:[ |
|
1224 |
('"' includes:ch) ifTrue:[ |
|
1225 |
scanCol := clickCol + 1. |
|
1226 |
fwdScan := false |
|
1227 |
] |
|
1228 |
] |
|
1229 |
]. |
|
1230 |
matchCol notNil ifTrue:[ |
|
2553
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
1231 |
self searchForAndSelectMatchingParenthesisFromLine:clickLine col:matchCol. |
1851 | 1232 |
^ self |
1233 |
]. |
|
1234 |
scanCol notNil ifTrue:[ |
|
1235 |
"/ if its an EOL comment, do it differently |
|
1236 |
ch := self characterAtLine:clickLine col:clickCol. |
|
1237 |
ch == $/ ifTrue:[ |
|
1238 |
self selectFromLine:clickLine col:clickCol+1 toLine:clickLine+1 col:0. |
|
1239 |
^ self |
|
1240 |
]. |
|
1241 |
||
2553
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
1242 |
self |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
1243 |
scanFor:$" fromLine:clickLine col:scanCol forward:fwdScan |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
1244 |
ifFound:[:line :col | |
1851 | 1245 |
|selStart selEnd| |
1246 |
||
1247 |
fwdScan ifTrue:[ |
|
1248 |
selStart := scanCol+1. |
|
1249 |
selEnd := col-1. |
|
1250 |
] ifFalse:[ |
|
1251 |
selStart := scanCol-1. |
|
1252 |
selEnd := col+1. |
|
1253 |
]. |
|
1254 |
self selectFromLine:clickLine col:selStart |
|
1255 |
toLine:line col:selEnd. |
|
1256 |
^ self |
|
1257 |
] |
|
2553
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
1258 |
ifNotFound:[self showNotFound]. |
1851 | 1259 |
^ self |
1260 |
] |
|
1322
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1261 |
]. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1262 |
|
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1263 |
self selectWordAtX:x y:y. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1264 |
|
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1265 |
" |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1266 |
special - if clicked on a parenthesis, select to matching |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1267 |
" |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1268 |
((sel := self selection) size == 1 |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1269 |
and:[(sel := sel at:1) size == 1]) ifTrue:[ |
1851 | 1270 |
ch := sel at:1. |
2324 | 1271 |
|
1851 | 1272 |
('()[]{}<>' includes:ch) ifTrue:[ |
2553
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
1273 |
self |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
1274 |
searchForMatchingParenthesisFromLine:selectionStartLine col:selectionStartCol |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
1275 |
ifFound:[:line :col | |
1851 | 1276 |
|prevLine prevCol moveBack pos1| |
1277 |
||
1278 |
prevLine := firstLineShown. |
|
2429
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2421
diff
changeset
|
1279 |
prevCol := viewOrigin x. |
1851 | 1280 |
self selectFromLine:selectionStartLine col:selectionStartCol |
1281 |
toLine:line col:col. |
|
1282 |
||
1283 |
self sensor ctrlDown ifFalse:[ |
|
1284 |
"/ undo scroll operation ... |
|
2191 | 1285 |
self withCursor:Cursor eye do:[ |
1286 |
|delayCount| |
|
1287 |
||
1851 | 1288 |
moveBack := false. |
1289 |
(')]}>' includes:ch) ifTrue:[ |
|
2429
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2421
diff
changeset
|
1290 |
(firstLineShown ~~ prevLine or:[prevCol ~~ viewOrigin x]) ifTrue:[ |
1851 | 1291 |
moveBack := true |
1292 |
] |
|
1293 |
] ifFalse:[ |
|
1294 |
selectionEndLine > (firstLineShown + nFullLinesShown) ifTrue:[ |
|
1295 |
self makeLineVisible:selectionEndLine. |
|
1296 |
moveBack := true |
|
1297 |
] |
|
1298 |
]. |
|
1299 |
moveBack ifTrue:[ |
|
2191 | 1300 |
delayCount := 0. |
1851 | 1301 |
pos1 := x@y. |
1302 |
self invalidateRepairNow:true. |
|
1303 |
Delay waitForSeconds:MatchDelayTime. |
|
2191 | 1304 |
delayCount := delayCount + MatchDelayTime. |
1851 | 1305 |
[self sensor hasUserEventFor:self] whileFalse:[ |
1306 |
Delay waitForSeconds:MatchDelayTime / 2. |
|
2191 | 1307 |
delayCount := delayCount + (MatchDelayTime / 2). |
1308 |
delayCount > 2 ifTrue:[ |
|
1309 |
self cursor:Cursor eyeClosed. |
|
1310 |
]. |
|
1311 |
delayCount >= 2.3 ifTrue:[ |
|
1312 |
self cursor:Cursor eye. |
|
1313 |
delayCount := 0. |
|
1314 |
] |
|
1851 | 1315 |
]. |
1316 |
self scrollToLine:prevLine; scrollToCol:prevCol. |
|
1317 |
]. |
|
1318 |
] |
|
1319 |
] |
|
1320 |
] |
|
2553
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
1321 |
ifNotFound:[self showNotFound] |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
1322 |
onError:[self beep]. |
1851 | 1323 |
selectStyle := nil |
1324 |
] |
|
1322
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1325 |
]. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1326 |
|
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1327 |
" |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1328 |
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
|
1329 |
" |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1330 |
wordStartLine := selectionStartLine. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1331 |
wordEndLine := selectionEndLine. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1332 |
selectStyle == #wordLeft ifTrue:[ |
1851 | 1333 |
wordStartCol := selectionStartCol + 1 |
1322
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1334 |
] ifFalse:[ |
1851 | 1335 |
wordStartCol := selectionStartCol. |
1322
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1336 |
]. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1337 |
selectStyle == #wordRight ifTrue:[ |
1851 | 1338 |
wordEndCol := selectionEndCol - 1 |
1322
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1339 |
] ifFalse:[ |
1851 | 1340 |
wordEndCol := selectionEndCol |
1322
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1341 |
] |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1342 |
|
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1343 |
"Created: 11.9.1997 / 04:12:55 / cg" |
1332 | 1344 |
"Modified: 19.9.1997 / 06:43:10 / cg" |
1322
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1345 |
! |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1346 |
|
248 | 1347 |
keyPress:key x:x y:y |
1348 |
"handle some keyboard input (there is not much to be done here)" |
|
1349 |
||
1893
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1350 |
<resource: #keyboard (#Find #Copy #FindNext #FindPrev #FindAgain |
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1351 |
#GotoLine #SelectAll #SaveAs #Print |
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1352 |
#'F*' #'f*' )> |
248 | 1353 |
|
1354 |
(key == #Find) ifTrue:[self search. ^self]. |
|
1355 |
(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
|
1356 |
(key == #GotoLine) ifTrue:[self gotoLine. ^self]. |
248 | 1357 |
|
1358 |
(key == #FindNext) ifTrue:[self searchFwd. ^self]. |
|
1359 |
(key == #FindPrev) ifTrue:[self searchBwd. ^self]. |
|
1893
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1360 |
(key == #FindAgain) ifTrue:[self searchAgainInSameDirection. ^self]. |
248 | 1361 |
|
1362 |
(key == #SelectAll) ifTrue:[self selectAll. ^self]. |
|
1363 |
||
614 | 1364 |
(key == #SaveAs) ifTrue:[self save. ^self]. |
1365 |
(key == #Print) ifTrue:[self doPrint. ^self]. |
|
428
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
411
diff
changeset
|
1366 |
|
248 | 1367 |
" |
1368 |
shift-Fn defines a key-sequence |
|
1369 |
Fn pastes that sequence |
|
1370 |
cmd-Fn performs a 'doIt' on the sequence (Workspaces only) |
|
1371 |
||
1372 |
(see EditTextView>>keyPress:x:y and Workspace>>keyPress:x:y) |
|
1373 |
" |
|
1193
811135bbd017
Do not crash when typing simple keys.
Stefan Vogel <sv@exept.de>
parents:
1188
diff
changeset
|
1374 |
(key size > 1 and:[(key at:1) asLowercase == $f]) ifTrue:[ |
1893
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1375 |
(('[fF][0-9]' match:key) |
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1376 |
or:['[fF][0-9][0-9]' match:key]) ifTrue:[ |
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1377 |
self sensor shiftDown ifTrue:[ |
1967
273caf76b2ea
ask UserPrefs for functionKeySequences (no need for a global)
Claus Gittinger <cg@exept.de>
parents:
1926
diff
changeset
|
1378 |
UserPreferences current functionKeySequences |
273caf76b2ea
ask UserPrefs for functionKeySequences (no need for a global)
Claus Gittinger <cg@exept.de>
parents:
1926
diff
changeset
|
1379 |
at:key put:(self selection) |
1893
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1380 |
]. |
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1381 |
^ self |
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1382 |
]. |
248 | 1383 |
]. |
1384 |
||
1385 |
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
|
1386 |
|
1893
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1387 |
"Modified: / 18.4.1997 / 12:12:27 / stefan" |
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1388 |
"Modified: / 3.5.1999 / 15:03:16 / cg" |
248 | 1389 |
! |
1390 |
||
1391 |
mapped |
|
1392 |
super mapped. |
|
1987 | 1393 |
selectionFgColor := selectionFgColor onDevice:device. |
1394 |
selectionBgColor := selectionBgColor onDevice:device. |
|
1322
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1395 |
! |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1396 |
|
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1397 |
quadClickX:x y:y |
1476
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
1398 |
"quadrupleClick-click - select all" |
1322
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1399 |
|
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1400 |
self selectAll |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1401 |
|
1476
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
1402 |
"Created: / 11.9.1997 / 04:15:24 / cg" |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
1403 |
"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
|
1404 |
! |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1405 |
|
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1406 |
tripleClickX:x y:y |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1407 |
"triple-click - select line under pointer" |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1408 |
|
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1409 |
self selectLineAtY:y. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1410 |
selectStyle := #line |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1411 |
|
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1412 |
"Created: 11.9.1997 / 04:13:37 / cg" |
0 | 1413 |
! ! |
248 | 1414 |
|
2120 | 1415 |
!TextView methodsFor:'initialization & release'! |
248 | 1416 |
|
941 | 1417 |
fetchDeviceResources |
1418 |
"fetch device colors, to avoid reallocation at redraw time" |
|
1419 |
||
1420 |
super fetchDeviceResources. |
|
1421 |
||
1987 | 1422 |
selectionFgColor notNil ifTrue:[selectionFgColor := selectionFgColor onDevice:device]. |
1423 |
selectionBgColor notNil ifTrue:[selectionBgColor := selectionBgColor onDevice:device]. |
|
941 | 1424 |
|
1425 |
"Created: 14.1.1997 / 00:14:33 / cg" |
|
1426 |
! |
|
1427 |
||
248 | 1428 |
initStyle |
966 | 1429 |
"setup viewStyle specifics" |
1430 |
||
248 | 1431 |
super initStyle. |
1432 |
||
392
81343306d796
eliminated all DefaultFont classVars (are now classINSTvars)
Claus Gittinger <cg@exept.de>
parents:
326
diff
changeset
|
1433 |
"/ DefaultFont notNil ifTrue:[font := DefaultFont on:device]. |
81343306d796
eliminated all DefaultFont classVars (are now classINSTvars)
Claus Gittinger <cg@exept.de>
parents:
326
diff
changeset
|
1434 |
|
248 | 1435 |
viewBackground := DefaultViewBackground. |
1436 |
selectionFgColor := DefaultSelectionForegroundColor. |
|
1437 |
selectionFgColor isNil ifTrue:[selectionFgColor := bgColor]. |
|
1438 |
selectionBgColor := DefaultSelectionBackgroundColor. |
|
1439 |
selectionBgColor isNil ifTrue:[ |
|
1728
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
1440 |
device hasColors ifTrue:[ |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
1441 |
DefaultSelectionForegroundColor isNil ifTrue:[ |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
1442 |
selectionFgColor := fgColor |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
1443 |
]. |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
1444 |
selectionBgColor := Color green |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
1445 |
] ifFalse:[ |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
1446 |
device hasGrayscales ifTrue:[ |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
1447 |
DefaultSelectionForegroundColor isNil ifTrue:[ |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
1448 |
selectionFgColor := fgColor |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
1449 |
]. |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
1450 |
selectionBgColor := Color grey |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
1451 |
] ifFalse:[ |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
1452 |
selectionBgColor := fgColor |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
1453 |
] |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
1454 |
] |
248 | 1455 |
]. |
708 | 1456 |
|
966 | 1457 |
"Modified: 22.1.1997 / 11:57:53 / cg" |
248 | 1458 |
! |
1459 |
||
1460 |
initialize |
|
1461 |
super initialize. |
|
1462 |
contentsWasSaved := false. |
|
2588 | 1463 |
dragIsActive := false. |
248 | 1464 |
|
2553
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
1465 |
parenthesisSpecification isNil ifTrue:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
1466 |
parenthesisSpecification := DefaultParenthesisSpecification. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
1467 |
]. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
1468 |
|
911 | 1469 |
"I handle menus myself" |
1470 |
menuHolder := menuPerformer := self. |
|
1471 |
||
2588 | 1472 |
"/ on default allow drag |
1473 |
self allowDrag:true. |
|
248 | 1474 |
! ! |
1475 |
||
1476 |
!TextView methodsFor:'menu actions'! |
|
1477 |
||
1478 |
appendTo:fileName |
|
1479 |
"append contents to a file named fileName" |
|
1480 |
||
1481 |
|aStream msg| |
|
1482 |
||
2036
83ac940a9fc6
allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents:
2027
diff
changeset
|
1483 |
(FileStream userInitiatedFileSaveQuerySignal queryWith:fileName asFilename) ifFalse:[ |
83ac940a9fc6
allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents:
2027
diff
changeset
|
1484 |
msg := resources string:'Refused to append to file ''%1'' !!' with:fileName. |
83ac940a9fc6
allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents:
2027
diff
changeset
|
1485 |
self warn:(msg , '\\(ST/X internal permission check)' ) withCRs. |
83ac940a9fc6
allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents:
2027
diff
changeset
|
1486 |
^ self |
83ac940a9fc6
allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents:
2027
diff
changeset
|
1487 |
]. |
83ac940a9fc6
allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents:
2027
diff
changeset
|
1488 |
|
248 | 1489 |
aStream := FileStream appendingOldFileNamed:fileName. |
1490 |
aStream isNil ifTrue:[ |
|
2036
83ac940a9fc6
allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents:
2027
diff
changeset
|
1491 |
msg := resources string:'cannot append to file %1 !!' with:fileName. |
83ac940a9fc6
allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents:
2027
diff
changeset
|
1492 |
self warn:(msg , '\\(' , FileStream lastErrorString , ')' ) withCRs |
248 | 1493 |
] ifFalse:[ |
2036
83ac940a9fc6
allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents:
2027
diff
changeset
|
1494 |
self |
83ac940a9fc6
allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents:
2027
diff
changeset
|
1495 |
fileOutContentsOn:aStream |
83ac940a9fc6
allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents:
2027
diff
changeset
|
1496 |
compressTabs:true |
83ac940a9fc6
allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents:
2027
diff
changeset
|
1497 |
encoding:externalEncoding. |
83ac940a9fc6
allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents:
2027
diff
changeset
|
1498 |
aStream close. |
83ac940a9fc6
allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents:
2027
diff
changeset
|
1499 |
contentsWasSaved := true |
248 | 1500 |
] |
1501 |
! |
|
1502 |
||
1503 |
changeFont |
|
1504 |
"pop up a fontPanel to change font" |
|
1505 |
||
411 | 1506 |
|newFont| |
248 | 1507 |
|
411 | 1508 |
newFont := FontPanel fontFromUserInitial:font. |
1509 |
newFont notNil ifTrue:[ |
|
1728
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
1510 |
self font:newFont. |
411 | 1511 |
] |
1512 |
||
1513 |
"Modified: 27.2.1996 / 00:53:51 / cg" |
|
248 | 1514 |
! |
1515 |
||
1516 |
copySelection |
|
1517 |
"copy contents into smalltalk copybuffer" |
|
1518 |
||
863 | 1519 |
|text| |
248 | 1520 |
|
1521 |
text := self selection. |
|
1522 |
text notNil ifTrue:[ |
|
1728
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
1523 |
self unselect. |
649
097c69ce9599
forget emphasis in copySelection
Claus Gittinger <cg@exept.de>
parents:
633
diff
changeset
|
1524 |
|
863 | 1525 |
"/ forget any emphasis ... |
1728
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
1526 |
text := text collect:[:l | l isNil ifTrue:[l] ifFalse:[l string]]. |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
1527 |
self setTextSelection:text. |
248 | 1528 |
] |
649
097c69ce9599
forget emphasis in copySelection
Claus Gittinger <cg@exept.de>
parents:
633
diff
changeset
|
1529 |
|
097c69ce9599
forget emphasis in copySelection
Claus Gittinger <cg@exept.de>
parents:
633
diff
changeset
|
1530 |
"Modified: 17.5.1996 / 08:57:54 / cg" |
248 | 1531 |
! |
1532 |
||
1533 |
defaultForGotoLine |
|
1534 |
"return a default value to show in the gotoLine box" |
|
1535 |
||
447
ed41e1bbd9a1
also support goto-default (use selection if any)
Claus Gittinger <cg@exept.de>
parents:
441
diff
changeset
|
1536 |
^ selectionStartLine |
ed41e1bbd9a1
also support goto-default (use selection if any)
Claus Gittinger <cg@exept.de>
parents:
441
diff
changeset
|
1537 |
|
ed41e1bbd9a1
also support goto-default (use selection if any)
Claus Gittinger <cg@exept.de>
parents:
441
diff
changeset
|
1538 |
"Modified: 1.3.1996 / 18:44:36 / cg" |
248 | 1539 |
! |
1540 |
||
614 | 1541 |
doPrint |
1542 |
"print the contents on the printer" |
|
1543 |
||
1544 |
|printStream| |
|
1545 |
||
1546 |
list isNil ifTrue:[^ self]. |
|
1547 |
||
829
fd15ef9c598a
show wait cursor while printing
Claus Gittinger <cg@exept.de>
parents:
824
diff
changeset
|
1548 |
self withWaitCursorDo:[ |
1728
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
1549 |
printStream := Printer new. |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
1550 |
printStream notNil ifTrue:[ |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
1551 |
Printer writeErrorSignal handle:[:ex | |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
1552 |
self warn:('error while printing:\\' |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
1553 |
, ex errorString |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
1554 |
, '\\(printing with: ' , (Printer printCommand) , ')') withCRs |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
1555 |
] do:[ |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
1556 |
self fileOutContentsOn:printStream. |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
1557 |
]. |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
1558 |
printStream close |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
1559 |
] |
829
fd15ef9c598a
show wait cursor while printing
Claus Gittinger <cg@exept.de>
parents:
824
diff
changeset
|
1560 |
]. |
fd15ef9c598a
show wait cursor while printing
Claus Gittinger <cg@exept.de>
parents:
824
diff
changeset
|
1561 |
|
614 | 1562 |
"Created: 6.5.1996 / 16:11:26 / cg" |
829
fd15ef9c598a
show wait cursor while printing
Claus Gittinger <cg@exept.de>
parents:
824
diff
changeset
|
1563 |
"Modified: 5.9.1996 / 19:18:30 / cg" |
614 | 1564 |
! |
1565 |
||
248 | 1566 |
editMenu |
1109 | 1567 |
"return my popUpMenu" |
1568 |
||
489 | 1569 |
<resource: #keyboard (#Copy #Find #GotoLine #SaveAs #Print)> |
1262
d69149b5be1f
resource flag: #menu -> #programMenu
Claus Gittinger <cg@exept.de>
parents:
1255
diff
changeset
|
1570 |
<resource: #programMenu> |
489 | 1571 |
|
1545 | 1572 |
|items m| |
1573 |
||
1574 |
items := #( |
|
2458 | 1575 |
('Copy' copySelection Copy) |
1576 |
('-' nil ) |
|
1577 |
('Search...' search Find) |
|
1578 |
('Goto...' gotoLine GotoLine) |
|
1579 |
('-' nil ) |
|
1580 |
('Font...' changeFont ) |
|
1581 |
('-' nil ) |
|
1582 |
('Save As...' save SaveAs) |
|
1583 |
('Print' doPrint Print) |
|
1584 |
). |
|
248 | 1585 |
|
1545 | 1586 |
m := PopUpMenu itemList:items resources:resources. |
248 | 1587 |
|
2350
c09d3dd534e3
do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents:
2336
diff
changeset
|
1588 |
self hasSelectionForCopy ifFalse:[ |
2458 | 1589 |
m disable:#copySelection. |
248 | 1590 |
]. |
1591 |
^ m |
|
428
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
411
diff
changeset
|
1592 |
|
2458 | 1593 |
"Modified: / 12.11.2001 / 13:43:56 / cg" |
248 | 1594 |
! |
1595 |
||
1288
19eee9e48131
added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
1596 |
find |
19eee9e48131
added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
1597 |
"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
|
1598 |
|
19eee9e48131
added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
1599 |
self search |
19eee9e48131
added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
1600 |
|
19eee9e48131
added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
1601 |
"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
|
1602 |
! |
19eee9e48131
added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
1603 |
|
248 | 1604 |
gotoLine |
1524
60582bfee9ce
allow relative gotos (+delta / -delta) in goto-line dialog.
Claus Gittinger <cg@exept.de>
parents:
1496
diff
changeset
|
1605 |
"show a box to enter lineNumber for positioning; |
1926 | 1606 |
The entered number may be prefixed by a + or -; |
1607 |
in this case, the linenumber is taken relative to the current position." |
|
1608 |
||
1609 |
|l lineNumberBox input lineToGo relative| |
|
248 | 1610 |
|
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1611 |
lineNumberBox := |
1926 | 1612 |
EnterBox |
2415 | 1613 |
title:(resources string:'Line number (or +/- relativeNr):') |
1614 |
okText:(resources string:'Goto') |
|
1615 |
abortText:(resources string:'Cancel') |
|
1926 | 1616 |
action:[:l | input := l]. |
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1617 |
|
248 | 1618 |
l := self defaultForGotoLine. |
1619 |
l notNil ifTrue:[ |
|
1926 | 1620 |
l := l printString |
248 | 1621 |
]. |
1622 |
lineNumberBox initialText:l . |
|
1380 | 1623 |
lineNumberBox showAtPointer. |
1624 |
||
1524
60582bfee9ce
allow relative gotos (+delta / -delta) in goto-line dialog.
Claus Gittinger <cg@exept.de>
parents:
1496
diff
changeset
|
1625 |
input size > 0 ifTrue:[ |
1926 | 1626 |
input := input withoutSpaces. |
1627 |
input size > 0 ifTrue:[ |
|
1628 |
(input startsWith:$+) ifTrue:[ |
|
1629 |
relative := 1. |
|
1630 |
] ifFalse:[ |
|
1631 |
(input startsWith:$-) ifTrue:[ |
|
1632 |
relative := -1. |
|
1633 |
]. |
|
1634 |
]. |
|
1635 |
relative notNil ifTrue:[ |
|
1636 |
input := input copyFrom:2. |
|
1637 |
]. |
|
1638 |
lineToGo := Integer readFromString:input onError:nil. |
|
1639 |
lineToGo notNil ifTrue:[ |
|
1640 |
relative notNil ifTrue:[ |
|
1641 |
lineToGo := self currentLine + (lineToGo * relative) |
|
1642 |
]. |
|
1643 |
self gotoLine:lineToGo |
|
1644 |
] |
|
1645 |
] |
|
1380 | 1646 |
]. |
1647 |
||
1524
60582bfee9ce
allow relative gotos (+delta / -delta) in goto-line dialog.
Claus Gittinger <cg@exept.de>
parents:
1496
diff
changeset
|
1648 |
"Modified: / 17.5.1998 / 20:07:59 / cg" |
248 | 1649 |
! |
1650 |
||
1651 |
save |
|
1652 |
"save contents into a file |
|
1653 |
- ask user for filename using a fileSelectionBox." |
|
1654 |
||
2695
7e13db2802df
better save file dialog (use new dialog vs. use old dialog)
Claus Gittinger <cg@exept.de>
parents:
2693
diff
changeset
|
1655 |
Dialog |
7e13db2802df
better save file dialog (use new dialog vs. use old dialog)
Claus Gittinger <cg@exept.de>
parents:
2693
diff
changeset
|
1656 |
requestSaveFileName:(resources string:'Save contents in:') |
7e13db2802df
better save file dialog (use new dialog vs. use old dialog)
Claus Gittinger <cg@exept.de>
parents:
2693
diff
changeset
|
1657 |
default:defaultFileNameForFileDialog |
7e13db2802df
better save file dialog (use new dialog vs. use old dialog)
Claus Gittinger <cg@exept.de>
parents:
2693
diff
changeset
|
1658 |
fromDirectory:directoryForFileDialog |
7e13db2802df
better save file dialog (use new dialog vs. use old dialog)
Claus Gittinger <cg@exept.de>
parents:
2693
diff
changeset
|
1659 |
action:[:fileName | self saveAs:fileName] |
7e13db2802df
better save file dialog (use new dialog vs. use old dialog)
Claus Gittinger <cg@exept.de>
parents:
2693
diff
changeset
|
1660 |
appendAction:[:fileName | self appendTo:fileName] |
7e13db2802df
better save file dialog (use new dialog vs. use old dialog)
Claus Gittinger <cg@exept.de>
parents:
2693
diff
changeset
|
1661 |
|
7e13db2802df
better save file dialog (use new dialog vs. use old dialog)
Claus Gittinger <cg@exept.de>
parents:
2693
diff
changeset
|
1662 |
"/ |fileBox fileName| |
7e13db2802df
better save file dialog (use new dialog vs. use old dialog)
Claus Gittinger <cg@exept.de>
parents:
2693
diff
changeset
|
1663 |
"/ |
7e13db2802df
better save file dialog (use new dialog vs. use old dialog)
Claus Gittinger <cg@exept.de>
parents:
2693
diff
changeset
|
1664 |
"/true ifTrue:[ |
7e13db2802df
better save file dialog (use new dialog vs. use old dialog)
Claus Gittinger <cg@exept.de>
parents:
2693
diff
changeset
|
1665 |
"/ fileName := FileDialog |
7e13db2802df
better save file dialog (use new dialog vs. use old dialog)
Claus Gittinger <cg@exept.de>
parents:
2693
diff
changeset
|
1666 |
"/ requestFileName:(resources string:'Save contents in:') |
7e13db2802df
better save file dialog (use new dialog vs. use old dialog)
Claus Gittinger <cg@exept.de>
parents:
2693
diff
changeset
|
1667 |
"/ default:(defaultFileNameForFileDialog ifNotNil:[defaultFileNameForFileDialog asString]) |
7e13db2802df
better save file dialog (use new dialog vs. use old dialog)
Claus Gittinger <cg@exept.de>
parents:
2693
diff
changeset
|
1668 |
"/ ok:(resources string:'Save') |
7e13db2802df
better save file dialog (use new dialog vs. use old dialog)
Claus Gittinger <cg@exept.de>
parents:
2693
diff
changeset
|
1669 |
"/ abort:nil |
7e13db2802df
better save file dialog (use new dialog vs. use old dialog)
Claus Gittinger <cg@exept.de>
parents:
2693
diff
changeset
|
1670 |
"/ version:nil |
7e13db2802df
better save file dialog (use new dialog vs. use old dialog)
Claus Gittinger <cg@exept.de>
parents:
2693
diff
changeset
|
1671 |
"/ ifFail:nil |
7e13db2802df
better save file dialog (use new dialog vs. use old dialog)
Claus Gittinger <cg@exept.de>
parents:
2693
diff
changeset
|
1672 |
"/ pattern:nil |
7e13db2802df
better save file dialog (use new dialog vs. use old dialog)
Claus Gittinger <cg@exept.de>
parents:
2693
diff
changeset
|
1673 |
"/ fromDirectory:directoryForFileDialog |
7e13db2802df
better save file dialog (use new dialog vs. use old dialog)
Claus Gittinger <cg@exept.de>
parents:
2693
diff
changeset
|
1674 |
"/ whenBoxCreatedEvaluate:[:dialog | dialog appendButtonVisibleHolder value:true]. |
7e13db2802df
better save file dialog (use new dialog vs. use old dialog)
Claus Gittinger <cg@exept.de>
parents:
2693
diff
changeset
|
1675 |
"/ |
7e13db2802df
better save file dialog (use new dialog vs. use old dialog)
Claus Gittinger <cg@exept.de>
parents:
2693
diff
changeset
|
1676 |
"/ fileName size > 0 ifTrue:[ |
7e13db2802df
better save file dialog (use new dialog vs. use old dialog)
Claus Gittinger <cg@exept.de>
parents:
2693
diff
changeset
|
1677 |
"/self halt. |
7e13db2802df
better save file dialog (use new dialog vs. use old dialog)
Claus Gittinger <cg@exept.de>
parents:
2693
diff
changeset
|
1678 |
"/ self saveAs:fileName. |
7e13db2802df
better save file dialog (use new dialog vs. use old dialog)
Claus Gittinger <cg@exept.de>
parents:
2693
diff
changeset
|
1679 |
"/ ]. |
7e13db2802df
better save file dialog (use new dialog vs. use old dialog)
Claus Gittinger <cg@exept.de>
parents:
2693
diff
changeset
|
1680 |
"/ ^ self. |
7e13db2802df
better save file dialog (use new dialog vs. use old dialog)
Claus Gittinger <cg@exept.de>
parents:
2693
diff
changeset
|
1681 |
"/]. |
7e13db2802df
better save file dialog (use new dialog vs. use old dialog)
Claus Gittinger <cg@exept.de>
parents:
2693
diff
changeset
|
1682 |
"/ fileBox := FileSaveBox |
7e13db2802df
better save file dialog (use new dialog vs. use old dialog)
Claus Gittinger <cg@exept.de>
parents:
2693
diff
changeset
|
1683 |
"/ title:(resources string:'Save contents in:') |
7e13db2802df
better save file dialog (use new dialog vs. use old dialog)
Claus Gittinger <cg@exept.de>
parents:
2693
diff
changeset
|
1684 |
"/ okText:(resources string:'Save') |
7e13db2802df
better save file dialog (use new dialog vs. use old dialog)
Claus Gittinger <cg@exept.de>
parents:
2693
diff
changeset
|
1685 |
"/ abortText:(resources string:'Cancel') |
7e13db2802df
better save file dialog (use new dialog vs. use old dialog)
Claus Gittinger <cg@exept.de>
parents:
2693
diff
changeset
|
1686 |
"/ action:[:fileName | self saveAs:fileName]. |
7e13db2802df
better save file dialog (use new dialog vs. use old dialog)
Claus Gittinger <cg@exept.de>
parents:
2693
diff
changeset
|
1687 |
"/ fileBox appendAction:[:fileName | self appendTo:fileName]. |
7e13db2802df
better save file dialog (use new dialog vs. use old dialog)
Claus Gittinger <cg@exept.de>
parents:
2693
diff
changeset
|
1688 |
"/ directoryForFileDialog notNil ifTrue:[ |
7e13db2802df
better save file dialog (use new dialog vs. use old dialog)
Claus Gittinger <cg@exept.de>
parents:
2693
diff
changeset
|
1689 |
"/ fileBox directory:directoryForFileDialog |
7e13db2802df
better save file dialog (use new dialog vs. use old dialog)
Claus Gittinger <cg@exept.de>
parents:
2693
diff
changeset
|
1690 |
"/ ]. |
7e13db2802df
better save file dialog (use new dialog vs. use old dialog)
Claus Gittinger <cg@exept.de>
parents:
2693
diff
changeset
|
1691 |
"/ defaultFileNameForFileDialog notNil ifTrue:[ |
7e13db2802df
better save file dialog (use new dialog vs. use old dialog)
Claus Gittinger <cg@exept.de>
parents:
2693
diff
changeset
|
1692 |
"/ fileBox initialText:defaultFileNameForFileDialog asString |
7e13db2802df
better save file dialog (use new dialog vs. use old dialog)
Claus Gittinger <cg@exept.de>
parents:
2693
diff
changeset
|
1693 |
"/ ]. |
7e13db2802df
better save file dialog (use new dialog vs. use old dialog)
Claus Gittinger <cg@exept.de>
parents:
2693
diff
changeset
|
1694 |
"/ fileBox showAtPointer. |
7e13db2802df
better save file dialog (use new dialog vs. use old dialog)
Claus Gittinger <cg@exept.de>
parents:
2693
diff
changeset
|
1695 |
"/ |
7e13db2802df
better save file dialog (use new dialog vs. use old dialog)
Claus Gittinger <cg@exept.de>
parents:
2693
diff
changeset
|
1696 |
"/ directoryForFileDialog := fileBox directory. "/ remember for next time |
7e13db2802df
better save file dialog (use new dialog vs. use old dialog)
Claus Gittinger <cg@exept.de>
parents:
2693
diff
changeset
|
1697 |
"/ |
7e13db2802df
better save file dialog (use new dialog vs. use old dialog)
Claus Gittinger <cg@exept.de>
parents:
2693
diff
changeset
|
1698 |
"/ fileBox destroy. |
7e13db2802df
better save file dialog (use new dialog vs. use old dialog)
Claus Gittinger <cg@exept.de>
parents:
2693
diff
changeset
|
1699 |
"/ |
7e13db2802df
better save file dialog (use new dialog vs. use old dialog)
Claus Gittinger <cg@exept.de>
parents:
2693
diff
changeset
|
1700 |
"/ "Modified: 16.4.1997 / 20:49:26 / cg" |
248 | 1701 |
! |
1702 |
||
1703 |
saveAs:fileName |
|
916
4201c9c2a4f0
show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
1704 |
"save the contents into a file named fileName" |
248 | 1705 |
|
2488 | 1706 |
^ self saveAs:fileName doAppend:false |
1707 |
! |
|
1708 |
||
1709 |
saveAs:fileName doAppend:doAppend |
|
1710 |
"save the contents into a file named fileName; |
|
1711 |
if doAppend is true, the views contents is appended to the existing |
|
1712 |
contents - otherwise, it overwrites any previous file contents." |
|
1713 |
||
916
4201c9c2a4f0
show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
1714 |
self withCursor:Cursor write do:[ |
2036
83ac940a9fc6
allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents:
2027
diff
changeset
|
1715 |
|aStream msg| |
83ac940a9fc6
allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents:
2027
diff
changeset
|
1716 |
|
83ac940a9fc6
allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents:
2027
diff
changeset
|
1717 |
(FileStream userInitiatedFileSaveQuerySignal queryWith:fileName asFilename) ifFalse:[ |
83ac940a9fc6
allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents:
2027
diff
changeset
|
1718 |
msg := resources string:'Refused to write file ''%1'' !!' with:fileName. |
83ac940a9fc6
allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents:
2027
diff
changeset
|
1719 |
self warn:(msg , '\\(ST/X internal permission check)' ) withCRs. |
83ac940a9fc6
allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents:
2027
diff
changeset
|
1720 |
^ self |
83ac940a9fc6
allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents:
2027
diff
changeset
|
1721 |
]. |
83ac940a9fc6
allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents:
2027
diff
changeset
|
1722 |
|
83ac940a9fc6
allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents:
2027
diff
changeset
|
1723 |
FileStream openErrorSignal catch:[ |
2488 | 1724 |
doAppend ifTrue:[ |
1725 |
aStream := FileStream appendingOldFileNamed:fileName |
|
1726 |
] ifFalse:[ |
|
1727 |
aStream := FileStream newFileNamed:fileName. |
|
1728 |
] |
|
2036
83ac940a9fc6
allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents:
2027
diff
changeset
|
1729 |
]. |
83ac940a9fc6
allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents:
2027
diff
changeset
|
1730 |
aStream isNil ifTrue:[ |
83ac940a9fc6
allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents:
2027
diff
changeset
|
1731 |
msg := resources string:'cannot write file ''%1'' !!' with:fileName. |
83ac940a9fc6
allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents:
2027
diff
changeset
|
1732 |
self warn:(msg , '\\(' , FileStream lastErrorString , ')' ) withCRs |
83ac940a9fc6
allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents:
2027
diff
changeset
|
1733 |
] ifFalse:[ |
83ac940a9fc6
allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents:
2027
diff
changeset
|
1734 |
self |
83ac940a9fc6
allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents:
2027
diff
changeset
|
1735 |
fileOutContentsOn:aStream |
83ac940a9fc6
allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents:
2027
diff
changeset
|
1736 |
compressTabs:true |
83ac940a9fc6
allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents:
2027
diff
changeset
|
1737 |
encoding:externalEncoding. |
83ac940a9fc6
allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents:
2027
diff
changeset
|
1738 |
aStream close. |
83ac940a9fc6
allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents:
2027
diff
changeset
|
1739 |
contentsWasSaved := true |
83ac940a9fc6
allow for interception of fileSave/fileAppend
Claus Gittinger <cg@exept.de>
parents:
2027
diff
changeset
|
1740 |
] |
248 | 1741 |
] |
916
4201c9c2a4f0
show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
1742 |
|
1359 | 1743 |
"Modified: 22.10.1997 / 12:32:51 / cg" |
1288
19eee9e48131
added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
1744 |
! |
19eee9e48131
added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
1745 |
|
19eee9e48131
added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
1746 |
search |
19eee9e48131
added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
1747 |
"search for a string - show a box to enter searchpattern |
19eee9e48131
added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
1748 |
- 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
|
1749 |
|
19eee9e48131
added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
1750 |
" |
2530
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
1751 |
Q: is it a good idea to preserve the last searchstring between views ? |
1288
19eee9e48131
added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
1752 |
" |
19eee9e48131
added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
1753 |
|
2530
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
1754 |
|searchBox patternHolder caseHolder |
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
1755 |
pattern fwd ign initialString |
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
1756 |
bindings bldr searchAction modal| |
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
1757 |
|
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
1758 |
modal := (UserPreferences current searchDialogIsModal). |
1326 | 1759 |
|
2411
66f0c8bb1f87
remember last ignore-case flag setting
Claus Gittinger <cg@exept.de>
parents:
2403
diff
changeset
|
1760 |
ign := lastSearchIgnoredCase ? LastSearchIgnoredCase ? false. |
2201
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
1761 |
caseHolder := ign asValue. |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
1762 |
|
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
1763 |
patternHolder := '' asValue. |
1326 | 1764 |
|
1765 |
lastSearchPattern notNil ifTrue:[ |
|
2109
ccad6daad477
selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents:
2100
diff
changeset
|
1766 |
initialString := lastSearchPattern |
1288
19eee9e48131
added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
1767 |
]. |
2530
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
1768 |
self hasSelectionWithinSingleLine ifTrue:[ |
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
1769 |
initialString := self selection |
1326 | 1770 |
]. |
2109
ccad6daad477
selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents:
2100
diff
changeset
|
1771 |
initialString isNil ifTrue:[ |
ccad6daad477
selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents:
2100
diff
changeset
|
1772 |
LastSearchPatterns size > 0 ifTrue:[ |
ccad6daad477
selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents:
2100
diff
changeset
|
1773 |
initialString := LastSearchPatterns first |
ccad6daad477
selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents:
2100
diff
changeset
|
1774 |
] |
ccad6daad477
selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents:
2100
diff
changeset
|
1775 |
]. |
ccad6daad477
selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents:
2100
diff
changeset
|
1776 |
|
ccad6daad477
selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents:
2100
diff
changeset
|
1777 |
initialString notNil ifTrue:[ |
2201
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
1778 |
patternHolder value:initialString. |
2109
ccad6daad477
selectionStopIndex, if there is no selection (for RB)
Claus Gittinger <cg@exept.de>
parents:
2100
diff
changeset
|
1779 |
]. |
2201
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
1780 |
|
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
1781 |
fwd := true. |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
1782 |
|
2530
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
1783 |
searchAction := [:fwd | |
2201
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
1784 |
pattern := patternHolder value. |
1893
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1785 |
pattern := pattern string withoutSeparators. "/ is that a good idea ? |
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1786 |
pattern notEmpty ifTrue:[ |
2201
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
1787 |
self rememberSearchPattern:pattern. |
1893
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1788 |
|
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1789 |
ign := caseHolder value. |
2411
66f0c8bb1f87
remember last ignore-case flag setting
Claus Gittinger <cg@exept.de>
parents:
2403
diff
changeset
|
1790 |
LastSearchIgnoredCase := ign. |
66f0c8bb1f87
remember last ignore-case flag setting
Claus Gittinger <cg@exept.de>
parents:
2403
diff
changeset
|
1791 |
|
1893
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1792 |
fwd ifFalse:[ |
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1793 |
lastSearchDirection := #backward. |
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1794 |
self searchBwd:pattern ignoreCase:ign. |
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1795 |
] ifTrue:[ |
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1796 |
lastSearchDirection := #forward. |
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1797 |
self searchFwd:pattern ignoreCase:ign. |
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1798 |
] |
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
1799 |
] |
1288
19eee9e48131
added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
1800 |
]. |
1326 | 1801 |
|
2530
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
1802 |
bindings := IdentityDictionary new. |
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
1803 |
bindings at:#searchPattern put:patternHolder. |
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
1804 |
modal ifTrue:[ |
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
1805 |
bindings at:#nextAction put:[searchBox doAccept.]. |
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
1806 |
bindings at:#prevAction put:[fwd := false. searchBox doAccept.]. |
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
1807 |
] ifFalse:[ |
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
1808 |
bindings at:#nextAction put:[searchAction value:true. "searchBox doAccept."]. |
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
1809 |
bindings at:#prevAction put:[searchAction value:false. "fwd := false. searchBox doAccept."]. |
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
1810 |
]. |
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
1811 |
bindings at:#ignoreCase put:caseHolder. |
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
1812 |
bindings at:#patternList put:LastSearchPatterns. |
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
1813 |
|
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
1814 |
modal ifTrue:[ |
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
1815 |
searchBox := SimpleDialog new. |
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
1816 |
] ifFalse:[ |
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
1817 |
searchBox := ApplicationModel new. |
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
1818 |
searchBox createBuilder. |
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
1819 |
]. |
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
1820 |
searchBox resources:(self resources). |
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
1821 |
|
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
1822 |
bldr := searchBox builder. |
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
1823 |
bldr addBindings:bindings. |
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
1824 |
searchBox allButOpenFrom:(self class searchDialogSpec). |
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
1825 |
|
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
1826 |
(bldr componentAt:#nextButton) cursor:(Cursor thumbsUp). |
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
1827 |
(bldr componentAt:#prevButton) cursor:(Cursor thumbsUp). |
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
1828 |
(bldr componentAt:#cancelButton) cursor:(Cursor thumbsDown). |
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
1829 |
|
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
1830 |
modal ifTrue:[ |
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
1831 |
searchBox openDialog. |
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
1832 |
searchBox accepted ifTrue:[ searchAction value:fwd ]. |
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
1833 |
] ifFalse:[ |
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
1834 |
(bldr componentAt:#nextButton) isReturnButton:false. |
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
1835 |
(bldr componentAt:#cancelButton) label:(resources string:'Close'). |
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
1836 |
(bldr componentAt:#cancelButton) action:[searchBox closeRequest]. |
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
1837 |
"/ searchBox masterApplication:self application. |
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
1838 |
self topView beMaster. |
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
1839 |
searchBox window beSlave. |
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
1840 |
searchBox window openInGroup:(self windowGroup). |
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
1841 |
"/ searchBox window open. |
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
1842 |
] |
248 | 1843 |
! ! |
1844 |
||
1845 |
!TextView methodsFor:'private'! |
|
1846 |
||
2596 | 1847 |
currentSelectionBgColor |
1848 |
^ selectionBgColor |
|
1849 |
! |
|
1850 |
||
1851 |
currentSelectionFgColor |
|
1852 |
^ selectionFgColor |
|
1853 |
! |
|
1854 |
||
248 | 1855 |
fileOutContentsOn:aStream |
1856 |
"save contents on a stream, replacing leading spaces by tab-characters." |
|
1857 |
||
1255
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
1858 |
self |
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
1859 |
fileOutContentsOn:aStream |
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
1860 |
compressTabs:true |
248 | 1861 |
! |
1862 |
||
1863 |
fileOutContentsOn:aStream compressTabs:compressTabs |
|
1864 |
"save contents on a stream. If compressTabs is true, |
|
1865 |
leading spaces will be replaced by tab-characters in the output." |
|
1866 |
||
1255
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
1867 |
self |
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
1868 |
fileOutContentsOn:aStream |
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
1869 |
compressTabs:compressTabs |
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
1870 |
encoding:nil |
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
1871 |
! |
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
1872 |
|
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
1873 |
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
|
1874 |
"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
|
1875 |
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
|
1876 |
|
248 | 1877 |
|startNr nLines string| |
1878 |
||
758 | 1879 |
aStream isFileStream ifTrue:[ |
2000 | 1880 |
"on some systems, writing linewise is very slow (via NFS) |
1881 |
therefore we convert to a string and write it in big chunks. |
|
1882 |
To avoid creating huge strings, we do it in blocks of 1000 lines, |
|
1883 |
limiting temporary string creation to about 50-80k. |
|
1884 |
" |
|
1885 |
startNr := 1. |
|
1886 |
nLines := list size. |
|
1887 |
[startNr <= nLines] whileTrue:[ |
|
1888 |
string := list asStringWithCRsFrom:startNr |
|
1889 |
to:((startNr + 1000) min:nLines) |
|
1890 |
compressTabs:compressTabs. |
|
1891 |
encodingSymOrNil notNil ifTrue:[ |
|
1892 |
string := string encodeInto:encodingSymOrNil |
|
1893 |
]. |
|
1894 |
aStream nextPutAll:string. |
|
1895 |
startNr := startNr + 1000 + 1. |
|
1896 |
]. |
|
758 | 1897 |
] ifFalse:[ |
2000 | 1898 |
list do:[:aLine | |
1899 |
aLine notNil ifTrue:[ |
|
1900 |
encodingSymOrNil notNil ifTrue:[ |
|
1901 |
aStream nextPutLine:(aLine encodeInto:encodingSymOrNil) |
|
1902 |
] ifFalse:[ |
|
1903 |
aStream nextPutLine:aLine. |
|
1904 |
] |
|
1905 |
] ifFalse:[ |
|
1906 |
aStream cr. |
|
1907 |
] |
|
1908 |
] |
|
758 | 1909 |
] |
248 | 1910 |
|
758 | 1911 |
"Modified: 8.6.1996 / 11:50:46 / cg" |
248 | 1912 |
! |
1913 |
||
668
729295eb37fc
use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1914 |
getFontParameters |
729295eb37fc
use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1915 |
"get some info of the used font. They are cached since we use them often .. |
729295eb37fc
use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1916 |
This is redefined here, to use the fonts maxHeight/maxAscent for |
729295eb37fc
use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1917 |
line separation. This is required, to allow for proper handling of |
729295eb37fc
use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1918 |
national characters, such as A-dieresis ..." |
729295eb37fc
use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1919 |
|
1987 | 1920 |
font := font onDevice:device. |
668
729295eb37fc
use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1921 |
includesNonStrings == true ifTrue:[ |
1987 | 1922 |
"/ for now, we do not support variable height entries ... |
1923 |
fontHeight := 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
|
1924 |
] ifFalse:[ |
1987 | 1925 |
fontHeight := font maxHeight. |
668
729295eb37fc
use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1926 |
]. |
729295eb37fc
use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1927 |
fontHeight := fontHeight + lineSpacing. |
729295eb37fc
use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1928 |
fontAscent := font maxAscent. |
729295eb37fc
use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1929 |
fontWidth := font width. |
729295eb37fc
use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1930 |
fontIsFixedWidth := font isFixedWidth. |
729295eb37fc
use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1931 |
|
729295eb37fc
use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1932 |
"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
|
1933 |
"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
|
1934 |
! |
729295eb37fc
use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1935 |
|
2201
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
1936 |
rememberSearchPattern:pattern |
2691 | 1937 |
|nRemembered patternString| |
1938 |
||
1939 |
patternString := pattern string. |
|
2201
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
1940 |
|
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
1941 |
nRemembered := NumRememberedSearchPatterns ? 15. |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
1942 |
|
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
1943 |
LastSearchPatterns isNil ifTrue:[ |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
1944 |
LastSearchPatterns := OrderedCollection new. |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
1945 |
]. |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
1946 |
"/ move to top or addFirst |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
1947 |
(LastSearchPatterns includes:pattern) ifTrue:[ |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
1948 |
LastSearchPatterns remove:pattern. |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
1949 |
] ifFalse:[ |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
1950 |
LastSearchPatterns size > nRemembered ifTrue:[ |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
1951 |
LastSearchPatterns removeFirst |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
1952 |
] |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
1953 |
]. |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
1954 |
LastSearchPatterns addFirst:pattern. |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
1955 |
! |
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
1956 |
|
248 | 1957 |
scrollSelectDown |
1958 |
"auto scroll action; scroll and reinstall timed-block" |
|
1959 |
||
1960 |
|prevEndLine| |
|
1961 |
||
1962 |
"just to make certain ..." |
|
1963 |
selectionEndLine isNil ifTrue:[^ self]. |
|
1964 |
||
1965 |
self scrollDown. |
|
1966 |
||
1967 |
"make new selection immediately visible" |
|
1968 |
prevEndLine := selectionEndLine. |
|
1969 |
selectionEndLine := firstLineShown + nFullLinesShown. |
|
1970 |
selectionEndCol := 0. |
|
1971 |
prevEndLine to:selectionEndLine do:[:lineNr | |
|
1972 |
self redrawLine:lineNr |
|
1973 |
]. |
|
1974 |
Processor addTimedBlock:autoScrollBlock afterSeconds:autoScrollDeltaT. |
|
1975 |
! |
|
1976 |
||
1977 |
scrollSelectLeft |
|
1978 |
"auto scroll action; scroll and reinstall timed-block" |
|
1979 |
||
1980 |
|prevStartLine| |
|
1981 |
||
1982 |
"just to make certain ..." |
|
1983 |
selectionStartLine isNil ifTrue:[^ self]. |
|
1984 |
selectionStartCol isNil ifTrue:[^ self]. |
|
1985 |
||
1986 |
"make new selection immediately visible" |
|
1987 |
prevStartLine := selectionStartLine. |
|
1988 |
selectionStartCol := selectionStartCol - 1 max:1. |
|
1989 |
self scrollLeft. |
|
1990 |
||
1991 |
Processor addTimedBlock:autoScrollBlock afterSeconds:autoScrollDeltaT. |
|
1992 |
! |
|
1993 |
||
1994 |
scrollSelectRight |
|
1995 |
"auto scroll action; scroll and reinstall timed-block" |
|
1996 |
||
1997 |
|prevEndCol| |
|
1998 |
||
1999 |
"just to make certain ..." |
|
2000 |
selectionEndCol isNil ifTrue:[^ self]. |
|
2001 |
||
2002 |
prevEndCol := selectionEndCol. |
|
2003 |
selectionEndCol := selectionEndCol + 1. |
|
2004 |
self scrollRight. |
|
2005 |
||
2006 |
Processor addTimedBlock:autoScrollBlock afterSeconds:autoScrollDeltaT. |
|
2007 |
! |
|
2008 |
||
2009 |
scrollSelectUp |
|
2010 |
"auto scroll action; scroll and reinstall timed-block" |
|
2011 |
||
2012 |
|prevStartLine| |
|
2013 |
||
2014 |
"just to make certain ..." |
|
2015 |
selectionStartLine isNil ifTrue:[^ self]. |
|
2016 |
||
2017 |
self scrollUp. |
|
2018 |
||
2019 |
"make new selection immediately visible" |
|
2020 |
prevStartLine := selectionStartLine. |
|
2021 |
selectionStartLine := firstLineShown. |
|
2022 |
selectionStartCol := 1. |
|
2023 |
selectionStartLine to:prevStartLine do:[:lineNr | |
|
2024 |
self redrawLine:lineNr |
|
2025 |
]. |
|
2026 |
Processor addTimedBlock:autoScrollBlock afterSeconds:autoScrollDeltaT. |
|
2027 |
! |
|
2028 |
||
2029 |
stopScrollSelect |
|
2030 |
"stop auto scroll; deinstall timed-block" |
|
2031 |
||
2032 |
autoScrollBlock notNil ifTrue:[ |
|
2033 |
Processor removeTimedBlock:autoScrollBlock. |
|
2034 |
self compressMotionEvents:true. |
|
2035 |
autoScrollBlock := nil. |
|
2036 |
autoScrollDeltaT := nil |
|
2037 |
] |
|
2038 |
! |
|
2039 |
||
2040 |
widthForScrollBetween:firstLine and:lastLine |
|
2041 |
"return the width in pixels for a scroll between firstLine and lastLine" |
|
2042 |
||
2043 |
selectionStartLine notNil ifTrue:[ |
|
2044 |
(lastLine < selectionStartLine) ifFalse:[ |
|
2045 |
(firstLine > selectionEndLine) ifFalse:[ |
|
2046 |
^ width |
|
2047 |
] |
|
2048 |
] |
|
2049 |
]. |
|
2050 |
^ super widthForScrollBetween:firstLine and:lastLine |
|
2051 |
! ! |
|
2052 |
||
997 | 2053 |
!TextView methodsFor:'queries'! |
2054 |
||
2455 | 2055 |
isTextView |
2056 |
"I am showing text" |
|
2057 |
||
2058 |
^ true |
|
2059 |
! |
|
2060 |
||
997 | 2061 |
specClass |
1380 | 2062 |
"redefined, since the name of my specClass is nonStandard (i.e. not TextViewSpec)" |
2063 |
||
997 | 2064 |
self class == TextView ifTrue:[^ TextEditorSpec]. |
1046 | 2065 |
^ super specClass |
997 | 2066 |
|
1380 | 2067 |
"Modified: / 31.10.1997 / 19:48:35 / cg" |
997 | 2068 |
! ! |
2069 |
||
248 | 2070 |
!TextView methodsFor:'redrawing'! |
2071 |
||
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2072 |
clearMarginOfVisibleLine:visLine with:color |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2073 |
"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
|
2074 |
|
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2075 |
(leftMargin ~~ 0) ifTrue:[ |
1728
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
2076 |
self paint:color. |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
2077 |
self fillRectangleX:margin |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
2078 |
y:(self yOfVisibleLine:visLine) |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
2079 |
width:leftMargin |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
2080 |
height:fontHeight |
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2081 |
] |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2082 |
|
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2083 |
"Created: 6.3.1996 / 14:22:55 / cg" |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2084 |
! |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2085 |
|
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2086 |
drawSelectedFromVisibleLine:startVisLineNr to:endVisLineNr |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2087 |
startVisLineNr to:endVisLineNr do:[:visLine | |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2088 |
self drawVisibleLineSelected:visLine |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2089 |
] |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2090 |
! |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2091 |
|
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2092 |
drawVisibleLineSelected:visLineNr |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2093 |
self |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2094 |
drawLine:(self withoutAnyColorEmphasis:(self visibleAt:visLineNr)) |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2095 |
inVisible:visLineNr |
2596 | 2096 |
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
|
2097 |
! |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2098 |
|
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2099 |
drawVisibleLineSelected:visLineNr col:col |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2100 |
self |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2101 |
drawLine:(self withoutAnyColorEmphasis:(self visibleAt:visLineNr)) |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2102 |
inVisible:visLineNr |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2103 |
col:col |
2596 | 2104 |
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
|
2105 |
! |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2106 |
|
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2107 |
drawVisibleLineSelected:visLineNr from:selectionStartCol |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2108 |
self |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2109 |
drawLine:(self withoutAnyColorEmphasis:(self visibleAt:visLineNr)) |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2110 |
inVisible:visLineNr |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2111 |
from:selectionStartCol |
2596 | 2112 |
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
|
2113 |
! |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2114 |
|
2558
4c10bec1117d
more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents:
2557
diff
changeset
|
2115 |
drawVisibleLineSelected:visLineNr from:startCol to:endCol |
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2116 |
self |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2117 |
drawLine:(self withoutAnyColorEmphasis:(self visibleAt:visLineNr)) |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2118 |
inVisible:visLineNr |
2558
4c10bec1117d
more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents:
2557
diff
changeset
|
2119 |
from:startCol to:endCol |
2596 | 2120 |
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
|
2121 |
! |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2122 |
|
248 | 2123 |
redrawFromVisibleLine:startVisLineNr to:endVisLineNr |
2124 |
"redraw a visible line range" |
|
2125 |
||
2126 |
|startLine endLine specialCare end selVisStart line1 line2| |
|
2127 |
||
2128 |
shown ifFalse:[^ self]. |
|
2129 |
||
2130 |
end := endVisLineNr. |
|
2131 |
(end > nLinesShown) ifTrue:[ |
|
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2132 |
end := nLinesShown |
248 | 2133 |
]. |
2134 |
||
2135 |
selectionStartLine isNil ifTrue:[ |
|
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2136 |
specialCare := false |
248 | 2137 |
] ifFalse:[ |
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2138 |
startLine := self visibleLineToAbsoluteLine:startVisLineNr. |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2139 |
(startLine > selectionEndLine) ifTrue:[ |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2140 |
specialCare := false |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2141 |
] ifFalse:[ |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2142 |
endLine := self visibleLineToAbsoluteLine:end. |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2143 |
(endLine < selectionStartLine) ifTrue:[ |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2144 |
specialCare := false |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2145 |
] ifFalse:[ |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2146 |
specialCare := true |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2147 |
] |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2148 |
] |
248 | 2149 |
]. |
2150 |
||
2151 |
"easy: nothing is selected" |
|
2152 |
specialCare ifFalse:[ |
|
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2153 |
super redrawFromVisibleLine:startVisLineNr to:end. |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2154 |
^ self |
248 | 2155 |
]. |
2156 |
||
2157 |
"easy: all is selected" |
|
2158 |
((selectionStartLine < startLine) and:[selectionEndLine > endLine]) ifTrue:[ |
|
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2159 |
self drawSelectedFromVisibleLine:startVisLineNr to:end. |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2160 |
^ self |
248 | 2161 |
]. |
2162 |
||
2163 |
(selectionStartLine >= firstLineShown) ifTrue:[ |
|
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2164 |
"draw unselected top part" |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2165 |
|
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2166 |
selVisStart := self listLineToVisibleLine:selectionStartLine. |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2167 |
super redrawFromVisibleLine:startVisLineNr to:(selVisStart - 1). |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2168 |
|
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2169 |
"and first partial selected line" |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2170 |
self redrawVisibleLine:selVisStart. |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2171 |
|
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2172 |
"rest starts after this one" |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2173 |
line1 := selVisStart + 1 |
248 | 2174 |
] ifFalse:[ |
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2175 |
line1 := 1 |
248 | 2176 |
]. |
2177 |
||
2178 |
(line1 > end) ifTrue:[^ self]. |
|
2179 |
(line1 < startVisLineNr) ifTrue:[ |
|
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2180 |
line1 := startVisLineNr |
248 | 2181 |
]. |
2182 |
||
2183 |
"draw middle part of selection" |
|
2184 |
||
2185 |
(selectionEndLine >= (firstLineShown + nLinesShown)) ifTrue:[ |
|
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2186 |
line2 := nLinesShown |
248 | 2187 |
] ifFalse:[ |
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2188 |
line2 := (self listLineToVisibleLine:selectionEndLine) - 1 |
248 | 2189 |
]. |
2190 |
(line2 > end) ifTrue:[ |
|
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2191 |
line2 := end |
248 | 2192 |
]. |
2193 |
||
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2194 |
self drawSelectedFromVisibleLine:line1 to:line2. |
248 | 2195 |
|
2196 |
(line2 >= end) ifTrue:[^ self]. |
|
2197 |
||
2198 |
"last line of selection" |
|
2199 |
self redrawVisibleLine:(line2 + 1). |
|
2200 |
||
2201 |
((line2 + 2) <= end) ifTrue:[ |
|
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2202 |
super redrawFromVisibleLine:(line2 + 2) to:end |
248 | 2203 |
] |
2204 |
! |
|
2205 |
||
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2206 |
redrawMarginOfVisibleLine:visLine |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2207 |
"draw margin - a helper for selection drawing" |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2208 |
|
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2209 |
|
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2210 |
(leftMargin ~~ 0) ifTrue:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2211 |
] |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2212 |
|
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2213 |
"Created: 6.3.1996 / 14:21:48 / cg" |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2214 |
! |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2215 |
|
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2216 |
redrawVisibleLine:visLineNr |
248 | 2217 |
"redraw visible line lineNr" |
2218 |
||
2558
4c10bec1117d
more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents:
2557
diff
changeset
|
2219 |
|line| |
248 | 2220 |
|
2221 |
selectionStartLine notNil ifTrue:[ |
|
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2222 |
line := self visibleLineToAbsoluteLine:visLineNr. |
2429
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2421
diff
changeset
|
2223 |
(line between:selectionStartLine and:selectionEndLine) ifTrue:[ |
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2421
diff
changeset
|
2224 |
(line == selectionStartLine) ifTrue:[ |
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2421
diff
changeset
|
2225 |
(line == selectionEndLine) ifTrue:[ |
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2421
diff
changeset
|
2226 |
"its part-of-single-line selection" |
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2227 |
self clearMarginOfVisibleLine:visLineNr with:bgColor. |
2429
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2421
diff
changeset
|
2228 |
(selectionStartCol > 1) ifTrue:[ |
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2229 |
super redrawVisibleLine:visLineNr from:1 to:(selectionStartCol - 1) |
2429
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2421
diff
changeset
|
2230 |
]. |
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2231 |
self drawVisibleLineSelected:visLineNr from:selectionStartCol to:selectionEndCol. |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2232 |
super redrawVisibleLine:visLineNr from:(selectionEndCol + 1). |
2429
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2421
diff
changeset
|
2233 |
^ self |
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2421
diff
changeset
|
2234 |
]. |
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2421
diff
changeset
|
2235 |
|
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2421
diff
changeset
|
2236 |
"its the first line of a multi-line selection" |
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2421
diff
changeset
|
2237 |
(selectionStartCol ~~ 1) ifTrue:[ |
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2238 |
self clearMarginOfVisibleLine:visLineNr with:bgColor. |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2239 |
super redrawVisibleLine:visLineNr from:1 to:(selectionStartCol - 1) |
2429
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2421
diff
changeset
|
2240 |
] ifFalse:[ |
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2421
diff
changeset
|
2241 |
viewOrigin x == 0 ifTrue:[ |
2596 | 2242 |
self clearMarginOfVisibleLine:visLineNr with:self currentSelectionBgColor. |
2429
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2421
diff
changeset
|
2243 |
] |
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2421
diff
changeset
|
2244 |
]. |
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2245 |
self drawVisibleLineSelected:visLineNr from:selectionStartCol. |
2429
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2421
diff
changeset
|
2246 |
^ self |
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2421
diff
changeset
|
2247 |
]. |
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2421
diff
changeset
|
2248 |
|
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2421
diff
changeset
|
2249 |
(line == selectionEndLine) ifTrue:[ |
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2421
diff
changeset
|
2250 |
"its the last line of a multi-line selection" |
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2421
diff
changeset
|
2251 |
(selectionEndCol == 0) ifTrue:[ |
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2252 |
^ super redrawVisibleLine:visLineNr |
2429
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2421
diff
changeset
|
2253 |
]. |
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2421
diff
changeset
|
2254 |
|
2596 | 2255 |
self clearMarginOfVisibleLine:visLineNr with:self currentSelectionBgColor. |
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2256 |
self drawVisibleLineSelected:visLineNr from:1 to:selectionEndCol. |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2257 |
super redrawVisibleLine:visLineNr from:(selectionEndCol + 1). |
2429
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2421
diff
changeset
|
2258 |
^ self |
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2421
diff
changeset
|
2259 |
]. |
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2421
diff
changeset
|
2260 |
|
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2421
diff
changeset
|
2261 |
"its a full line in a multi-line selection" |
2596 | 2262 |
self clearMarginOfVisibleLine:visLineNr with:self currentSelectionBgColor. |
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2263 |
self drawVisibleLineSelected:visLineNr. |
2429
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2421
diff
changeset
|
2264 |
^ self |
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2421
diff
changeset
|
2265 |
] |
248 | 2266 |
]. |
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2267 |
super redrawVisibleLine:visLineNr |
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2268 |
|
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2269 |
"Modified: 6.3.1996 / 14:22:19 / cg" |
248 | 2270 |
! |
2271 |
||
2272 |
redrawVisibleLine:visLine col:col |
|
633 | 2273 |
"redraw single character at col in visible line lineNr." |
248 | 2274 |
|
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2275 |
|line| |
633 | 2276 |
|
2277 |
"/ |
|
2278 |
"/ care for selection |
|
2279 |
"/ |
|
248 | 2280 |
selectionStartLine notNil ifTrue:[ |
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2281 |
line := self visibleLineToAbsoluteLine:visLine. |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2282 |
(line between:selectionStartLine and:selectionEndLine) ifTrue:[ |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2283 |
((line == selectionStartLine) |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2284 |
and: [col < selectionStartCol]) ifFalse:[ |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2285 |
((line == selectionEndLine) |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2286 |
and: [col > selectionEndCol]) ifFalse:[ |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2287 |
"its in the selection" |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2288 |
self drawVisibleLineSelected:visLine col:col. |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2289 |
^ self. |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2290 |
] |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2291 |
] |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2292 |
] |
248 | 2293 |
]. |
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2294 |
self drawVisibleLine:visLine col:col with:fgColor and:bgColor |
1496 | 2295 |
|
2296 |
"Modified: / 22.4.1998 / 08:53:05 / cg" |
|
248 | 2297 |
! |
2298 |
||
2299 |
redrawVisibleLine:visLine from:startCol |
|
2300 |
"redraw visible line lineNr from startCol to end of line" |
|
2301 |
||
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2302 |
|col line| |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2303 |
|
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2304 |
col := startCol. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2305 |
col == 0 ifTrue:[ |
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2306 |
col := 1. |
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2307 |
]. |
248 | 2308 |
|
2309 |
selectionStartLine notNil ifTrue:[ |
|
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2310 |
line := self visibleLineToAbsoluteLine:visLine. |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2311 |
(line between:selectionStartLine and:selectionEndLine) ifTrue:[ |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2312 |
((line == selectionStartLine) |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2313 |
or:[line == selectionEndLine]) ifTrue:[ |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2314 |
"since I'm lazy, redraw full line" |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2315 |
self redrawVisibleLine:visLine. |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2316 |
^ self |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2317 |
]. |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2318 |
"the line is fully within the selection" |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2319 |
self drawVisibleLineSelected:visLine from:col. |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2320 |
^ self |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2321 |
] |
248 | 2322 |
]. |
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2323 |
super redrawVisibleLine:visLine from:col |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2324 |
|
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2325 |
"Modified: 6.3.1996 / 14:19:38 / cg" |
248 | 2326 |
! |
2327 |
||
2328 |
redrawVisibleLine:visLine from:startCol to:endCol |
|
2329 |
"redraw visible line lineNr from startCol to endCol" |
|
2330 |
||
2331 |
|line allOut allIn leftCol rightCol| |
|
2332 |
||
2333 |
line := self visibleLineToAbsoluteLine:visLine. |
|
2334 |
||
2335 |
allIn := false. |
|
2336 |
allOut := false. |
|
2337 |
selectionStartLine isNil ifTrue:[ |
|
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2338 |
allOut := true |
248 | 2339 |
] ifFalse:[ |
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2340 |
(line between:selectionStartLine and:selectionEndLine) ifFalse:[ |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2341 |
allOut := true |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2342 |
] ifTrue:[ |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2343 |
(selectionStartLine == selectionEndLine) ifTrue:[ |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2344 |
((endCol < selectionStartCol) |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2345 |
or:[startCol > selectionEndCol]) ifTrue:[ |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2346 |
allOut := true |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2347 |
] ifFalse:[ |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2348 |
((startCol >= selectionStartCol) |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2349 |
and:[endCol <= selectionEndCol]) ifTrue:[ |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2350 |
allIn := true |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2351 |
] |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2352 |
] |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2353 |
] ifFalse:[ |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2354 |
(line == selectionStartLine) ifTrue:[ |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2355 |
(endCol < selectionStartCol) ifTrue:[ |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2356 |
allOut := true |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2357 |
] ifFalse:[ |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2358 |
(startCol >= selectionStartCol) ifTrue:[ |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2359 |
allIn := true |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2360 |
] |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2361 |
] |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2362 |
] ifFalse:[ |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2363 |
(line == selectionEndLine) ifTrue:[ |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2364 |
(startCol > selectionEndCol) ifTrue:[ |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2365 |
allOut := true |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2366 |
] ifFalse:[ |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2367 |
(endCol <= selectionEndCol) ifTrue:[ |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2368 |
allIn := true |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2369 |
] |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2370 |
] |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2371 |
] ifFalse:[ |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2372 |
allIn := true |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2373 |
] |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2374 |
] |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2375 |
] |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2376 |
] |
248 | 2377 |
]. |
2378 |
allOut ifTrue:[ |
|
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2379 |
super redrawVisibleLine:visLine from:startCol to:endCol. |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2380 |
^ self |
248 | 2381 |
]. |
2382 |
||
2383 |
allIn ifTrue:[ |
|
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2384 |
self drawVisibleLineSelected:visLine from:startCol to:endCol |
248 | 2385 |
] ifFalse:[ |
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2386 |
"redraw part before selection" |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2387 |
((line == selectionStartLine) |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2388 |
and:[startCol <= selectionStartCol]) ifTrue:[ |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2389 |
super redrawVisibleLine:visLine from:startCol |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2390 |
to:(selectionStartCol - 1). |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2391 |
leftCol := selectionStartCol |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2392 |
] ifFalse:[ |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2393 |
leftCol := startCol |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2394 |
]. |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2395 |
"redraw selected part" |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2396 |
(selectionEndLine > line) ifTrue:[ |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2397 |
rightCol := endCol |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2398 |
] ifFalse:[ |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2399 |
rightCol := selectionEndCol min:endCol |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2400 |
]. |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2401 |
self drawVisibleLineSelected:visLine from:leftCol to:rightCol. |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2402 |
|
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2403 |
"redraw part after selection" |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2404 |
(rightCol < endCol) ifTrue:[ |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2405 |
super redrawVisibleLine:visLine from:(rightCol + 1) to:endCol |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2406 |
] |
248 | 2407 |
]. |
2408 |
||
2409 |
"special care for first and last line of selection: |
|
2410 |
must handle margin also" |
|
2411 |
||
2412 |
((line == selectionEndLine) |
|
2413 |
and:[(startCol == 1) |
|
2414 |
and:[selectionStartLine < selectionEndLine]]) |
|
2415 |
ifTrue:[ |
|
2596 | 2416 |
self clearMarginOfVisibleLine:visLine with:self currentSelectionBgColor. |
248 | 2417 |
]. |
2418 |
||
2419 |
((line == selectionStartLine) |
|
2420 |
and:[(startCol == 1) |
|
2421 |
and:[selectionStartLine < selectionEndLine]]) |
|
2422 |
ifTrue:[ |
|
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2553
diff
changeset
|
2423 |
self clearMarginOfVisibleLine:visLine with:bgColor. |
248 | 2424 |
] |
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2425 |
|
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2426 |
"Modified: 6.3.1996 / 14:23:26 / cg" |
248 | 2427 |
! ! |
2428 |
||
2429 |
!TextView methodsFor:'searching'! |
|
2430 |
||
1322
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
2431 |
scanFor:aCharacter fromLine:startLine col:startCol forward:forward |
2693 | 2432 |
ifFound:foundBlock |
2433 |
ifNotFound:notFoundBlock |
|
1322
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
2434 |
"search for a character in the direction given by forward. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
2435 |
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
|
2436 |
|
2693 | 2437 |
|lineString |
1322
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
2438 |
line "{ Class: SmallInteger }" |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
2439 |
col "{ Class: SmallInteger }" |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
2440 |
delta "{ Class: SmallInteger }" |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
2441 |
endCol "{ Class: SmallInteger }" |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
2442 |
cc |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
2443 |
maxLine "{ Class: SmallInteger }" |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
2444 |
| |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
2445 |
|
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
2446 |
col := startCol. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
2447 |
line := startLine. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
2448 |
forward ifTrue:[ |
2693 | 2449 |
delta := 1. |
1322
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
2450 |
] ifFalse:[ |
2693 | 2451 |
delta := -1. |
1322
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
2452 |
]. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
2453 |
|
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
2454 |
lineString := list at:line. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
2455 |
maxLine := list size. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
2456 |
|
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
2457 |
col := col + delta. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
2458 |
[true] whileTrue:[ |
2693 | 2459 |
lineString notNil ifTrue:[ |
2460 |
forward ifTrue:[ |
|
2461 |
endCol := lineString size. |
|
2462 |
] ifFalse:[ |
|
2463 |
endCol := 1 |
|
2464 |
]. |
|
2465 |
||
2466 |
col to:endCol by:delta do:[:rCol | |
|
2467 |
cc := lineString at:rCol. |
|
2468 |
cc == aCharacter ifTrue:[ |
|
2469 |
^ foundBlock value:line value:rCol. |
|
2470 |
] |
|
2471 |
]. |
|
2472 |
]. |
|
2473 |
line := line + delta. |
|
2474 |
(line < 1 or:[line > maxLine]) ifTrue:[ |
|
2475 |
^ notFoundBlock value |
|
2476 |
]. |
|
2477 |
lineString := list at:line. |
|
2478 |
forward ifTrue:[ |
|
2479 |
col := 1 |
|
2480 |
] ifFalse:[ |
|
2481 |
col := lineString size |
|
2482 |
] |
|
1322
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
2483 |
]. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
2484 |
"not reached" |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
2485 |
|
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
2486 |
"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
|
2487 |
"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
|
2488 |
! |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
2489 |
|
1893
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
2490 |
searchAgainInSameDirection |
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
2491 |
"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
|
2492 |
|
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
2493 |
|ign| |
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
2494 |
|
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
2495 |
ign := lastSearchIgnoredCase ? false. |
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
2496 |
|
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
2497 |
self setSearchPattern. |
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
2498 |
lastSearchPattern notNil ifTrue:[ |
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
2499 |
lastSearchDirection == #backward ifTrue:[ |
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
2500 |
self |
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
2501 |
searchBwd:lastSearchPattern |
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
2502 |
ignoreCase:ign |
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
2503 |
] ifFalse:[ |
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
2504 |
self |
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
2505 |
searchFwd:lastSearchPattern |
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
2506 |
ignoreCase:ign |
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
2507 |
] |
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
2508 |
] |
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
2509 |
|
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
2510 |
"Modified: / 3.5.1999 / 15:00:28 / cg" |
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
2511 |
"Created: / 3.5.1999 / 15:02:16 / cg" |
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
2512 |
! |
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
2513 |
|
248 | 2514 |
searchBwd |
2515 |
"search backward and -if found- position cursor" |
|
2516 |
||
1353 | 2517 |
|ign| |
2518 |
||
2519 |
ign := lastSearchIgnoredCase ? false. |
|
2520 |
||
248 | 2521 |
self setSearchPattern. |
2414
ec98bcbd4c61
if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents:
2413
diff
changeset
|
2522 |
lastSearchPattern isNil ifTrue:[ |
ec98bcbd4c61
if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents:
2413
diff
changeset
|
2523 |
LastSearchPatterns size > 0 ifTrue:[ |
ec98bcbd4c61
if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents:
2413
diff
changeset
|
2524 |
lastSearchPattern := LastSearchPatterns first |
ec98bcbd4c61
if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents:
2413
diff
changeset
|
2525 |
] |
ec98bcbd4c61
if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents:
2413
diff
changeset
|
2526 |
]. |
ec98bcbd4c61
if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents:
2413
diff
changeset
|
2527 |
|
1326 | 2528 |
lastSearchPattern notNil ifTrue:[ |
1893
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
2529 |
lastSearchDirection := #backward. |
2201
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
2530 |
self rememberSearchPattern:lastSearchPattern. |
1893
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
2531 |
self |
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
2532 |
searchBwd:lastSearchPattern |
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
2533 |
ignoreCase:ign |
248 | 2534 |
] |
1326 | 2535 |
|
1893
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
2536 |
"Modified: / 3.5.1999 / 15:00:28 / cg" |
248 | 2537 |
! |
2538 |
||
2539 |
searchBwd:pattern |
|
2540 |
"do a backward search" |
|
2541 |
||
2542 |
self searchBwd:pattern ifAbsent:[self showNotFound]. |
|
1326 | 2543 |
lastSearchIgnoredCase := false. |
1769
5e272292723b
remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents:
1766
diff
changeset
|
2544 |
lastSearchPattern := pattern string |
5e272292723b
remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents:
1766
diff
changeset
|
2545 |
|
5e272292723b
remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents:
1766
diff
changeset
|
2546 |
"Modified: / 6.3.1999 / 23:46:40 / cg" |
248 | 2547 |
! |
2548 |
||
2549 |
searchBwd:pattern ifAbsent:aBlock |
|
2550 |
"do a backward search" |
|
2551 |
||
2552 |
|startLine startCol| |
|
2553 |
||
2554 |
selectionStartLine notNil ifTrue:[ |
|
1728
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
2555 |
startLine := selectionStartLine. |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
2556 |
startCol := selectionStartCol |
248 | 2557 |
] ifFalse:[ |
1728
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
2558 |
startLine := 1. |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
2559 |
startCol := 1 |
248 | 2560 |
]. |
1326 | 2561 |
self |
1728
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
2562 |
searchBackwardFor:pattern startingAtLine:startLine col:startCol |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
2563 |
ifFound:[:line :col | self showMatch:pattern atLine:line col:col] |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
2564 |
ifAbsent:aBlock |
1326 | 2565 |
|
2566 |
"Modified: 13.9.1997 / 01:05:49 / cg" |
|
2567 |
! |
|
2568 |
||
2569 |
searchBwd:pattern ignoreCase:ign |
|
2570 |
"do a backward search" |
|
2571 |
||
2372
74102d251f55
avoid annoying beeps in search-fwd/bwd
Claus Gittinger <cg@exept.de>
parents:
2350
diff
changeset
|
2572 |
self searchBwd:pattern |
74102d251f55
avoid annoying beeps in search-fwd/bwd
Claus Gittinger <cg@exept.de>
parents:
2350
diff
changeset
|
2573 |
ignoreCase:ign |
74102d251f55
avoid annoying beeps in search-fwd/bwd
Claus Gittinger <cg@exept.de>
parents:
2350
diff
changeset
|
2574 |
ifAbsent:[ |
74102d251f55
avoid annoying beeps in search-fwd/bwd
Claus Gittinger <cg@exept.de>
parents:
2350
diff
changeset
|
2575 |
|sensor| |
74102d251f55
avoid annoying beeps in search-fwd/bwd
Claus Gittinger <cg@exept.de>
parents:
2350
diff
changeset
|
2576 |
|
74102d251f55
avoid annoying beeps in search-fwd/bwd
Claus Gittinger <cg@exept.de>
parents:
2350
diff
changeset
|
2577 |
(sensor := self sensor) notNil ifTrue:[ |
74102d251f55
avoid annoying beeps in search-fwd/bwd
Claus Gittinger <cg@exept.de>
parents:
2350
diff
changeset
|
2578 |
sensor compressKeyPressEventsWithKey:#FindPrev. |
74102d251f55
avoid annoying beeps in search-fwd/bwd
Claus Gittinger <cg@exept.de>
parents:
2350
diff
changeset
|
2579 |
]. |
74102d251f55
avoid annoying beeps in search-fwd/bwd
Claus Gittinger <cg@exept.de>
parents:
2350
diff
changeset
|
2580 |
self showNotFound |
74102d251f55
avoid annoying beeps in search-fwd/bwd
Claus Gittinger <cg@exept.de>
parents:
2350
diff
changeset
|
2581 |
]. |
1326 | 2582 |
lastSearchIgnoredCase := ign. |
1769
5e272292723b
remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents:
1766
diff
changeset
|
2583 |
lastSearchPattern := pattern string |
5e272292723b
remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents:
1766
diff
changeset
|
2584 |
|
5e272292723b
remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents:
1766
diff
changeset
|
2585 |
"Created: / 13.9.1997 / 06:18:00 / cg" |
5e272292723b
remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents:
1766
diff
changeset
|
2586 |
"Modified: / 6.3.1999 / 23:46:47 / cg" |
1326 | 2587 |
! |
2588 |
||
2589 |
searchBwd:pattern ignoreCase:ign ifAbsent:aBlock |
|
2590 |
"do a backward search" |
|
2591 |
||
2592 |
|startLine startCol| |
|
2593 |
||
2594 |
selectionStartLine notNil ifTrue:[ |
|
1728
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
2595 |
startLine := selectionStartLine. |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
2596 |
startCol := selectionStartCol |
1326 | 2597 |
] ifFalse:[ |
1728
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
2598 |
startLine := 1. |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
2599 |
startCol := 1 |
1326 | 2600 |
]. |
2601 |
self |
|
1728
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
2602 |
searchBackwardFor:pattern |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
2603 |
ignoreCase:ign |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
2604 |
startingAtLine:startLine col:startCol |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
2605 |
ifFound:[:line :col | self showMatch:pattern atLine:line col:col] |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
2606 |
ifAbsent:aBlock |
1326 | 2607 |
|
2608 |
"Modified: 13.9.1997 / 01:05:49 / cg" |
|
2609 |
"Created: 13.9.1997 / 06:18:41 / cg" |
|
248 | 2610 |
! |
2611 |
||
2553
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2612 |
searchForAndSelectMatchingParenthesisFromLine:startLine col:startCol |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2613 |
"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
|
2614 |
|
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2615 |
self |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2616 |
searchForMatchingParenthesisFromLine:startLine col:startCol |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2617 |
ifFound:[:line :col | |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2618 |
self selectFromLine:startLine col:startCol |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2619 |
toLine:line col:col] |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2620 |
ifNotFound:[self showNotFound] |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2621 |
onError:[self beep] |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2622 |
|
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2623 |
"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
|
2624 |
! |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2625 |
|
248 | 2626 |
searchForMatchingParenthesisFromLine:startLine col:startCol |
2553
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2627 |
ifFound:foundBlock |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2628 |
ifNotFound:notFoundBlock |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2629 |
onError:failBlock |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2630 |
|
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2631 |
"search for a matching parenthesis; start search with character at startLine/startCol. |
248 | 2632 |
Search for the corresponding character is done forward if its an opening, |
2633 |
backwards if its a closing parenthesis. |
|
2553
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2634 |
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
|
2635 |
If there is a nesting error, evaluate failBlock." |
248 | 2636 |
|
2637 |
^ self |
|
2553
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2638 |
searchForMatchingParenthesisFromLine:startLine col:startCol |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2639 |
ifFound:foundBlock |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2640 |
ifNotFound:notFoundBlock |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2641 |
onError:failBlock |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2642 |
ignoring:(parenthesisSpecification at:#ignore) "/ #( $' $" '$[' '$]' '${' '$)' ) |
248 | 2643 |
|
651
1e7153e21b36
skip character consts in match parent
Claus Gittinger <cg@exept.de>
parents:
649
diff
changeset
|
2644 |
"Modified: 18.5.1996 / 11:05:57 / cg" |
248 | 2645 |
! |
2646 |
||
2647 |
searchForMatchingParenthesisFromLine:startLine col:startCol |
|
2324 | 2648 |
ifFound:foundBlock |
2649 |
ifNotFound:notFoundBlock |
|
2650 |
onError:failBlock |
|
2651 |
ignoring:ignoreSet |
|
2553
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2652 |
|
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2653 |
"search for a matching parenthesis; start search with character at startLine/startCol. |
248 | 2654 |
Search for the corresponding character is done forward if its an opening, |
2655 |
backwards if its a closing parenthesis. |
|
2553
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2656 |
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
|
2657 |
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
|
2658 |
|
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2659 |
^ self |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2660 |
searchForMatchingParenthesisFromLine:startLine col:startCol |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2661 |
ifFound:foundBlock |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2662 |
ifNotFound:notFoundBlock |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2663 |
onError:failBlock |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2664 |
openingCharacters: (parenthesisSpecification at:#open) "/ #( $( $[ ${ "$> $<") |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2665 |
closingCharacters: (parenthesisSpecification at:#close) "/ #( $) $] $} "$> $<") |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2666 |
ignoredCharacters: ignoreSet |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2667 |
specialEOLComment: (parenthesisSpecification at:#eolComment) "/ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2668 |
|
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2669 |
"/ |i direction lineString |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2670 |
"/ parChar charSet closingChar |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2671 |
"/ ignoring |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2672 |
"/ line "{ Class: SmallInteger }" |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2673 |
"/ col "{ Class: SmallInteger }" |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2674 |
"/ delta "{ Class: SmallInteger }" |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2675 |
"/ endCol "{ Class: SmallInteger }" |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2676 |
"/ runCol "{ Class: SmallInteger }" |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2677 |
"/ cc prevCC nextCC incSet decSet |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2678 |
"/ nesting "{ Class: SmallInteger }" |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2679 |
"/ maxLine "{ Class: SmallInteger }" |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2680 |
"/ ign skip anySet| |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2681 |
"/ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2682 |
"/ charSet := #( $( $) $[ $] ${ $} " $< $> " ). |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2683 |
"/ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2684 |
"/ parChar := self characterAtLine:startLine col:startCol. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2685 |
"/ i := charSet indexOf:parChar. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2686 |
"/ i == 0 ifTrue:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2687 |
"/ ^ failBlock value "not a parenthesis" |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2688 |
"/ ]. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2689 |
"/ 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
|
2690 |
"/ closingChar := #( $) $( $] $[ $} ${ "$> $<") at:i. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2691 |
"/ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2692 |
"/ col := startCol. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2693 |
"/ line := startLine. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2694 |
"/ direction == #fwd ifTrue:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2695 |
"/ delta := 1. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2696 |
"/ incSet := #( $( $[ ${ "$<" ). |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2697 |
"/ decSet := #( $) $] $} "$>" ). |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2698 |
"/ ] ifFalse:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2699 |
"/ delta := -1. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2700 |
"/ incSet := #( $) $] $} "$>" ). |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2701 |
"/ decSet := #( $( $[ ${ "$<" ). |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2702 |
"/ ]. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2703 |
"/ anySet := Set new. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2704 |
"/ anySet addAll:incSet; addAll:decSet; addAll:ignoreSet. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2705 |
"/ anySet := (anySet select:[:c | c isCharacter]) asString. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2706 |
"/ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2707 |
"/ nesting := 1. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2708 |
"/ ignoring := false. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2709 |
"/ lineString := list at:line. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2710 |
"/ maxLine := list size. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2711 |
"/ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2712 |
"/ col := col + delta. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2713 |
"/ [nesting ~~ 0] whileTrue:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2714 |
"/ (lineString notNil |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2715 |
"/ and:[lineString includesAny:anySet]) ifTrue:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2716 |
"/ direction == #fwd ifTrue:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2717 |
"/ endCol := lineString size. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2718 |
"/ ] ifFalse:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2719 |
"/ endCol := 1 |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2720 |
"/ ]. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2721 |
"/ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2722 |
"/ col to:endCol by:delta do:[:rCol | |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2723 |
"/ runCol := rCol. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2724 |
"/ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2725 |
"/ cc := lineString at:runCol. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2726 |
"/ runCol < lineString size ifTrue:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2727 |
"/ nextCC := lineString at:runCol+1 |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2728 |
"/ ] ifFalse:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2729 |
"/ nextCC := nil |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2730 |
"/ ]. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2731 |
"/ runCol > 1 ifTrue:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2732 |
"/ prevCC := lineString at:runCol-1 |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2733 |
"/ ] ifFalse:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2734 |
"/ prevCC := nil |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2735 |
"/ ]. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2736 |
"/ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2737 |
"/ ign := skip := false. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2738 |
"/ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2739 |
"/ "/ check for comments. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2740 |
"/ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2741 |
"/ ((cc == $" and:[nextCC == $/]) |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2742 |
"/ or:[prevCC == $$ ]) ifTrue:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2743 |
"/ "/ do nothing |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2744 |
"/ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2745 |
"/ skip := true. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2746 |
"/ ] ifFalse:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2747 |
"/ ignoreSet do:[:ignore | |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2748 |
"/ ignore == cc ifTrue:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2749 |
"/ ign := true |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2750 |
"/ ] ifFalse:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2751 |
"/ ignore isString ifTrue:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2752 |
"/ cc == (ignore at:2) ifTrue:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2753 |
"/ runCol > 1 ifTrue:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2754 |
"/ (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
|
2755 |
"/ skip := true |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2756 |
"/ ] |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2757 |
"/ ] |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2758 |
"/ ] ifFalse:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2759 |
"/ cc == (ignore at:1) ifTrue:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2760 |
"/ runCol < lineString size ifTrue:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2761 |
"/ (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
|
2762 |
"/ skip := true |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2763 |
"/ ] |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2764 |
"/ ] |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2765 |
"/ ] |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2766 |
"/ ] |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2767 |
"/ ] |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2768 |
"/ ] |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2769 |
"/ ] |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2770 |
"/ ]. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2771 |
"/ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2772 |
"/ ign ifTrue:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2773 |
"/ ignoring := ignoring not |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2774 |
"/ ]. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2775 |
"/ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2776 |
"/ ignoring ifFalse:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2777 |
"/ skip ifFalse:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2778 |
"/ (incSet includes:cc) ifTrue:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2779 |
"/ nesting := nesting + 1 |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2780 |
"/ ] ifFalse:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2781 |
"/ (decSet includes:cc) ifTrue:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2782 |
"/ nesting := nesting - 1 |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2783 |
"/ ] |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2784 |
"/ ] |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2785 |
"/ ] |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2786 |
"/ ]. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2787 |
"/ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2788 |
"/ nesting == 0 ifTrue:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2789 |
"/ "check if legal" |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2790 |
"/ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2791 |
"/ skip ifFalse:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2792 |
"/ cc == closingChar ifFalse:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2793 |
"/ ^ failBlock value |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2794 |
"/ ]. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2795 |
"/ ^ foundBlock value:line value:runCol. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2796 |
"/ ] |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2797 |
"/ ] |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2798 |
"/ ]. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2799 |
"/ ]. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2800 |
"/ line := line + delta. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2801 |
"/ (line < 1 or:[line > maxLine]) ifTrue:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2802 |
"/ ^ failBlock value |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2803 |
"/ ]. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2804 |
"/ lineString := list at:line. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2805 |
"/ direction == #fwd ifTrue:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2806 |
"/ col := 1 |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2807 |
"/ ] ifFalse:[ |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2808 |
"/ col := lineString size |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2809 |
"/ ] |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2810 |
"/ ]. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2811 |
"/ ^ notFoundBlock value |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2812 |
|
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2813 |
"Modified: 15.10.1996 / 12:22:30 / cg" |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2814 |
! |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2815 |
|
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2816 |
searchForMatchingParenthesisFromLine:startLine col:startCol |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2817 |
ifFound:foundBlock |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2818 |
ifNotFound:notFoundBlock |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2819 |
onError:failBlock |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2820 |
openingCharacters:openingCharacters |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2821 |
closingCharacters:closingCharacters |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2822 |
ignoredCharacters:ignoreSet |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2823 |
specialEOLComment:eolCommentSequence |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2824 |
|
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2825 |
"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
|
2826 |
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
|
2827 |
backwards if its a closing parenthesis. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2828 |
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
|
2829 |
If there is a nesting error, evaluate failBlock." |
248 | 2830 |
|
770
a41466e3dfaa
use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents:
758
diff
changeset
|
2831 |
|i direction lineString |
a41466e3dfaa
use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents:
758
diff
changeset
|
2832 |
parChar charSet closingChar |
a41466e3dfaa
use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents:
758
diff
changeset
|
2833 |
ignoring |
a41466e3dfaa
use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents:
758
diff
changeset
|
2834 |
line "{ Class: SmallInteger }" |
a41466e3dfaa
use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents:
758
diff
changeset
|
2835 |
col "{ Class: SmallInteger }" |
a41466e3dfaa
use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents:
758
diff
changeset
|
2836 |
delta "{ Class: SmallInteger }" |
a41466e3dfaa
use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents:
758
diff
changeset
|
2837 |
endCol "{ Class: SmallInteger }" |
a41466e3dfaa
use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents:
758
diff
changeset
|
2838 |
runCol "{ Class: SmallInteger }" |
844
03e45d817dce
fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2839 |
cc prevCC nextCC incSet decSet |
770
a41466e3dfaa
use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents:
758
diff
changeset
|
2840 |
nesting "{ Class: SmallInteger }" |
a41466e3dfaa
use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents:
758
diff
changeset
|
2841 |
maxLine "{ Class: SmallInteger }" |
2553
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2842 |
ign skip anySet |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2843 |
eol1 eol2| |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2844 |
|
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2845 |
charSet := openingCharacters , closingCharacters. |
248 | 2846 |
|
2847 |
parChar := self characterAtLine:startLine col:startCol. |
|
2848 |
i := charSet indexOf:parChar. |
|
2849 |
i == 0 ifTrue:[ |
|
2324 | 2850 |
^ failBlock value "not a parenthesis" |
248 | 2851 |
]. |
2553
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2852 |
|
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2853 |
direction := ((openingCharacters collect:[:c | #fwd]) , (closingCharacters collect:[:c | #bwd])) at:i. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2854 |
closingChar := (closingCharacters , openingCharacters) at:i. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2855 |
|
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2856 |
eol1 := eolCommentSequence at:1 ifAbsent:nil. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2857 |
eol2 := eolCommentSequence at:2 ifAbsent:nil. |
248 | 2858 |
|
2859 |
col := startCol. |
|
2860 |
line := startLine. |
|
2861 |
direction == #fwd ifTrue:[ |
|
2324 | 2862 |
delta := 1. |
2553
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2863 |
incSet := openingCharacters. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2864 |
decSet := closingCharacters. |
248 | 2865 |
] ifFalse:[ |
2324 | 2866 |
delta := -1. |
2553
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2867 |
incSet := closingCharacters. |
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2868 |
decSet := openingCharacters. |
248 | 2869 |
]. |
1454 | 2870 |
anySet := Set new. |
2871 |
anySet addAll:incSet; addAll:decSet; addAll:ignoreSet. |
|
2872 |
anySet := (anySet select:[:c | c isCharacter]) asString. |
|
248 | 2873 |
|
2874 |
nesting := 1. |
|
2875 |
ignoring := false. |
|
2876 |
lineString := list at:line. |
|
2877 |
maxLine := list size. |
|
2878 |
||
2879 |
col := col + delta. |
|
2880 |
[nesting ~~ 0] whileTrue:[ |
|
2324 | 2881 |
(lineString notNil |
2882 |
and:[lineString includesAny:anySet]) ifTrue:[ |
|
2883 |
direction == #fwd ifTrue:[ |
|
2884 |
endCol := lineString size. |
|
2885 |
] ifFalse:[ |
|
2886 |
endCol := 1 |
|
2887 |
]. |
|
2888 |
||
2889 |
col to:endCol by:delta do:[:rCol | |
|
2890 |
runCol := rCol. |
|
2891 |
||
2892 |
cc := lineString at:runCol. |
|
2893 |
runCol < lineString size ifTrue:[ |
|
2894 |
nextCC := lineString at:runCol+1 |
|
2895 |
] ifFalse:[ |
|
2896 |
nextCC := nil |
|
2897 |
]. |
|
2898 |
runCol > 1 ifTrue:[ |
|
2899 |
prevCC := lineString at:runCol-1 |
|
2900 |
] ifFalse:[ |
|
2901 |
prevCC := nil |
|
2902 |
]. |
|
2903 |
||
2904 |
ign := skip := false. |
|
2905 |
||
2906 |
"/ check for comments. |
|
2907 |
||
2553
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
2908 |
((cc == eol1 and:[nextCC == eol2]) |
2324 | 2909 |
or:[prevCC == $$ ]) ifTrue:[ |
2910 |
"/ do nothing |
|
2911 |
||
2912 |
skip := true. |
|
2913 |
] ifFalse:[ |
|
2914 |
ignoreSet do:[:ignore | |
|
2915 |
ignore == cc ifTrue:[ |
|
2916 |
ign := true |
|
2917 |
] ifFalse:[ |
|
2918 |
ignore isString ifTrue:[ |
|
2919 |
cc == (ignore at:2) ifTrue:[ |
|
2920 |
runCol > 1 ifTrue:[ |
|
2921 |
(lineString at:(runCol-1)) == (ignore at:1) ifTrue:[ |
|
2922 |
skip := true |
|
2923 |
] |
|
2924 |
] |
|
2925 |
] ifFalse:[ |
|
2926 |
cc == (ignore at:1) ifTrue:[ |
|
2927 |
runCol < lineString size ifTrue:[ |
|
2928 |
(lineString at:(runCol+1)) == (ignore at:2) ifTrue:[ |
|
2929 |
skip := true |
|
2930 |
] |
|
2931 |
] |
|
2932 |
] |
|
2933 |
] |
|
2934 |
] |
|
2935 |
] |
|
2936 |
] |
|
2937 |
]. |
|
2938 |
||
2939 |
ign ifTrue:[ |
|
2940 |
ignoring := ignoring not |
|
2941 |
]. |
|
2942 |
||
2943 |
ignoring ifFalse:[ |
|
2944 |
skip ifFalse:[ |
|
2945 |
(incSet includes:cc) ifTrue:[ |
|
2946 |
nesting := nesting + 1 |
|
2947 |
] ifFalse:[ |
|
2948 |
(decSet includes:cc) ifTrue:[ |
|
2949 |
nesting := nesting - 1 |
|
2950 |
] |
|
2951 |
] |
|
2952 |
] |
|
2953 |
]. |
|
2954 |
||
2955 |
nesting == 0 ifTrue:[ |
|
2956 |
"check if legal" |
|
2957 |
||
2958 |
skip ifFalse:[ |
|
2959 |
cc == closingChar ifFalse:[ |
|
2960 |
^ failBlock value |
|
2961 |
]. |
|
2962 |
^ foundBlock value:line value:runCol. |
|
2963 |
] |
|
2964 |
] |
|
2965 |
]. |
|
2966 |
]. |
|
2967 |
line := line + delta. |
|
2968 |
(line < 1 or:[line > maxLine]) ifTrue:[ |
|
2969 |
^ failBlock value |
|
2970 |
]. |
|
2971 |
lineString := list at:line. |
|
2972 |
direction == #fwd ifTrue:[ |
|
2973 |
col := 1 |
|
2974 |
] ifFalse:[ |
|
2975 |
col := lineString size |
|
2976 |
] |
|
248 | 2977 |
]. |
2978 |
^ notFoundBlock value |
|
2979 |
||
844
03e45d817dce
fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2980 |
"Modified: 15.10.1996 / 12:22:30 / cg" |
248 | 2981 |
! |
2982 |
||
2983 |
searchFwd |
|
2984 |
"search forward for pattern or selection" |
|
2985 |
||
1353 | 2986 |
|ign| |
2987 |
||
2988 |
ign := lastSearchIgnoredCase ? false. |
|
2989 |
||
248 | 2990 |
selectStyle == #wordLeft ifTrue:[ |
1893
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
2991 |
" |
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
2992 |
remove the space from the selection |
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
2993 |
" |
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
2994 |
selectionStartCol := selectionStartCol + 1. |
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
2995 |
super redrawLine:selectionStartLine from:selectionStartCol-1 to:selectionStartCol-1. |
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
2996 |
selectStyle := #word. |
248 | 2997 |
]. |
2998 |
self setSearchPattern. |
|
2414
ec98bcbd4c61
if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents:
2413
diff
changeset
|
2999 |
|
ec98bcbd4c61
if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents:
2413
diff
changeset
|
3000 |
lastSearchPattern isNil ifTrue:[ |
ec98bcbd4c61
if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents:
2413
diff
changeset
|
3001 |
LastSearchPatterns size > 0 ifTrue:[ |
ec98bcbd4c61
if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents:
2413
diff
changeset
|
3002 |
lastSearchPattern := LastSearchPatterns first |
ec98bcbd4c61
if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents:
2413
diff
changeset
|
3003 |
] |
ec98bcbd4c61
if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents:
2413
diff
changeset
|
3004 |
]. |
ec98bcbd4c61
if there is no lastSearchPattern, take from history (srchFwd / srchBwd)
Claus Gittinger <cg@exept.de>
parents:
2413
diff
changeset
|
3005 |
|
1326 | 3006 |
lastSearchPattern notNil ifTrue:[ |
2201
ee684354d1d6
search-dialog is now done using a GUI-spec
Claus Gittinger <cg@exept.de>
parents:
2200
diff
changeset
|
3007 |
self rememberSearchPattern:lastSearchPattern. |
1893
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
3008 |
lastSearchDirection := #forward. |
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
3009 |
self |
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
3010 |
searchFwd:lastSearchPattern |
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
3011 |
ignoreCase:ign |
248 | 3012 |
] |
1326 | 3013 |
|
1893
bce50b364466
added FindAgain function (F3 on win32)
Claus Gittinger <cg@exept.de>
parents:
1851
diff
changeset
|
3014 |
"Modified: / 3.5.1999 / 15:00:40 / cg" |
248 | 3015 |
! |
3016 |
||
3017 |
searchFwd:pattern |
|
3018 |
"do a forward search" |
|
3019 |
||
3020 |
self searchFwd:pattern ifAbsent:[self showNotFound]. |
|
1326 | 3021 |
lastSearchIgnoredCase := false. |
1769
5e272292723b
remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents:
1766
diff
changeset
|
3022 |
lastSearchPattern := pattern string |
5e272292723b
remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents:
1766
diff
changeset
|
3023 |
|
5e272292723b
remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents:
1766
diff
changeset
|
3024 |
"Modified: / 6.3.1999 / 23:46:53 / cg" |
248 | 3025 |
! |
3026 |
||
3027 |
searchFwd:pattern ifAbsent:aBlock |
|
3028 |
"do a forward search" |
|
3029 |
||
3030 |
|startLine startCol| |
|
3031 |
||
3032 |
selectionStartLine notNil ifTrue:[ |
|
1728
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3033 |
startLine := selectionStartLine. |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3034 |
startCol := selectionStartCol |
248 | 3035 |
] ifFalse:[ |
1728
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3036 |
startLine := 1. |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3037 |
startCol := 1 |
248 | 3038 |
]. |
1326 | 3039 |
self |
1728
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3040 |
searchForwardFor:pattern startingAtLine:startLine col:startCol |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3041 |
ifFound:[:line :col | self showMatch:pattern atLine:line col:col] |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3042 |
ifAbsent:aBlock |
1326 | 3043 |
|
3044 |
"Modified: 13.9.1997 / 01:05:35 / cg" |
|
3045 |
! |
|
3046 |
||
3047 |
searchFwd:pattern ignoreCase:ign |
|
3048 |
"do a forward search" |
|
3049 |
||
2372
74102d251f55
avoid annoying beeps in search-fwd/bwd
Claus Gittinger <cg@exept.de>
parents:
2350
diff
changeset
|
3050 |
self |
74102d251f55
avoid annoying beeps in search-fwd/bwd
Claus Gittinger <cg@exept.de>
parents:
2350
diff
changeset
|
3051 |
searchFwd:pattern |
74102d251f55
avoid annoying beeps in search-fwd/bwd
Claus Gittinger <cg@exept.de>
parents:
2350
diff
changeset
|
3052 |
ignoreCase:ign |
74102d251f55
avoid annoying beeps in search-fwd/bwd
Claus Gittinger <cg@exept.de>
parents:
2350
diff
changeset
|
3053 |
ifAbsent:[ |
74102d251f55
avoid annoying beeps in search-fwd/bwd
Claus Gittinger <cg@exept.de>
parents:
2350
diff
changeset
|
3054 |
|sensor| |
74102d251f55
avoid annoying beeps in search-fwd/bwd
Claus Gittinger <cg@exept.de>
parents:
2350
diff
changeset
|
3055 |
|
74102d251f55
avoid annoying beeps in search-fwd/bwd
Claus Gittinger <cg@exept.de>
parents:
2350
diff
changeset
|
3056 |
(sensor := self sensor) notNil ifTrue:[ |
74102d251f55
avoid annoying beeps in search-fwd/bwd
Claus Gittinger <cg@exept.de>
parents:
2350
diff
changeset
|
3057 |
sensor compressKeyPressEventsWithKey:#FindNext. |
74102d251f55
avoid annoying beeps in search-fwd/bwd
Claus Gittinger <cg@exept.de>
parents:
2350
diff
changeset
|
3058 |
]. |
74102d251f55
avoid annoying beeps in search-fwd/bwd
Claus Gittinger <cg@exept.de>
parents:
2350
diff
changeset
|
3059 |
self showNotFound |
74102d251f55
avoid annoying beeps in search-fwd/bwd
Claus Gittinger <cg@exept.de>
parents:
2350
diff
changeset
|
3060 |
]. |
1326 | 3061 |
lastSearchIgnoredCase := ign. |
1769
5e272292723b
remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents:
1766
diff
changeset
|
3062 |
lastSearchPattern := pattern string |
5e272292723b
remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents:
1766
diff
changeset
|
3063 |
|
5e272292723b
remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents:
1766
diff
changeset
|
3064 |
"Created: / 13.9.1997 / 06:18:13 / cg" |
5e272292723b
remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents:
1766
diff
changeset
|
3065 |
"Modified: / 6.3.1999 / 23:46:58 / cg" |
1326 | 3066 |
! |
3067 |
||
3068 |
searchFwd:pattern ignoreCase:ign ifAbsent:aBlock |
|
3069 |
"do a forward search" |
|
3070 |
||
3071 |
|startLine startCol| |
|
3072 |
||
3073 |
selectionStartLine notNil ifTrue:[ |
|
1728
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3074 |
startLine := selectionStartLine. |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3075 |
startCol := selectionStartCol |
1326 | 3076 |
] ifFalse:[ |
1728
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3077 |
startLine := 1. |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3078 |
startCol := 1 |
1326 | 3079 |
]. |
3080 |
self |
|
1728
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3081 |
searchForwardFor:pattern |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3082 |
ignoreCase:ign |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3083 |
startingAtLine:startLine col:startCol |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3084 |
ifFound:[:line :col | self showMatch:pattern atLine:line col:col] |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3085 |
ifAbsent:aBlock |
1326 | 3086 |
|
3087 |
"Modified: 13.9.1997 / 01:05:35 / cg" |
|
3088 |
"Created: 13.9.1997 / 06:18:27 / cg" |
|
248 | 3089 |
! |
3090 |
||
3091 |
searchPattern |
|
3092 |
"return the last search pattern" |
|
3093 |
||
1326 | 3094 |
^ lastSearchPattern |
248 | 3095 |
! |
3096 |
||
3097 |
setSearchPattern |
|
3098 |
"set the searchpattern from the selection if there is one" |
|
3099 |
||
3100 |
|sel| |
|
3101 |
||
2206
d62d1bf91de2
searchPattern, if from selection (escape meta characters)
Claus Gittinger <cg@exept.de>
parents:
2201
diff
changeset
|
3102 |
"/ clickPos isNil ifTrue:[^ self]. |
d62d1bf91de2
searchPattern, if from selection (escape meta characters)
Claus Gittinger <cg@exept.de>
parents:
2201
diff
changeset
|
3103 |
|
248 | 3104 |
sel := self selection. |
3105 |
sel notNil ifTrue:[ |
|
2206
d62d1bf91de2
searchPattern, if from selection (escape meta characters)
Claus Gittinger <cg@exept.de>
parents:
2201
diff
changeset
|
3106 |
self setSearchPattern:sel asString withMatchEscapes |
248 | 3107 |
] |
1769
5e272292723b
remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents:
1766
diff
changeset
|
3108 |
|
5e272292723b
remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents:
1766
diff
changeset
|
3109 |
"Modified: / 6.3.1999 / 23:48:04 / cg" |
248 | 3110 |
! |
3111 |
||
3112 |
setSearchPattern:aString |
|
3113 |
"set the searchpattern for future searches" |
|
3114 |
||
3115 |
aString isNil ifTrue:[ |
|
1841 | 3116 |
lastSearchPattern := aString |
248 | 3117 |
] ifFalse:[ |
1841 | 3118 |
lastSearchPattern := aString asString withoutSeparators string |
1769
5e272292723b
remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents:
1766
diff
changeset
|
3119 |
]. |
5e272292723b
remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents:
1766
diff
changeset
|
3120 |
|
5e272292723b
remove text-attributes in lastSearchPattern
Claus Gittinger <cg@exept.de>
parents:
1766
diff
changeset
|
3121 |
"Modified: / 6.3.1999 / 23:47:36 / cg" |
248 | 3122 |
! |
3123 |
||
2200 | 3124 |
setSearchPattern:aString ignoreCase:aBoolean |
3125 |
"set the searchpattern and caseIgnore for future searches" |
|
3126 |
||
3127 |
self setSearchPattern:aString. |
|
3128 |
lastSearchIgnoredCase := aBoolean. |
|
3129 |
! |
|
3130 |
||
248 | 3131 |
showMatch:pattern atLine:line col:col |
3132 |
"after a search, highlight the matched pattern. |
|
3133 |
The code below needs a rewrite to take care of match-characters |
|
3134 |
(for now, it only highlights simple patterns and '*string*' correctly)" |
|
3135 |
||
3136 |
|realPattern| |
|
3137 |
||
3138 |
realPattern := pattern. |
|
3139 |
(realPattern startsWith:$*) ifTrue:[ |
|
3140 |
realPattern := realPattern copyFrom:2 |
|
3141 |
]. |
|
3142 |
(realPattern endsWith:$*) ifTrue:[ |
|
3143 |
realPattern := realPattern copyWithoutLast:1 |
|
3144 |
]. |
|
3145 |
||
3146 |
self selectFromLine:line col:col |
|
3147 |
toLine:line col:(col + realPattern size - 1). |
|
3148 |
self makeLineVisible:line |
|
3149 |
! |
|
3150 |
||
3151 |
showNotFound |
|
3152 |
"search not found - tell user by beeping and changing |
|
3153 |
cursor for a while (sometimes I work with a headset :-) |
|
3154 |
(used to be: tell user by changing cursor for a while)" |
|
3155 |
||
3156 |
|savedCursor| |
|
3157 |
||
3158 |
savedCursor := cursor. |
|
1028 | 3159 |
[ |
2372
74102d251f55
avoid annoying beeps in search-fwd/bwd
Claus Gittinger <cg@exept.de>
parents:
2350
diff
changeset
|
3160 |
self cursor:(Cursor cross). |
74102d251f55
avoid annoying beeps in search-fwd/bwd
Claus Gittinger <cg@exept.de>
parents:
2350
diff
changeset
|
3161 |
self beep. |
74102d251f55
avoid annoying beeps in search-fwd/bwd
Claus Gittinger <cg@exept.de>
parents:
2350
diff
changeset
|
3162 |
Processor activeProcess millisecondDelay:300. |
2520
aed8069b4477
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
2488
diff
changeset
|
3163 |
] ensure:[ |
2372
74102d251f55
avoid annoying beeps in search-fwd/bwd
Claus Gittinger <cg@exept.de>
parents:
2350
diff
changeset
|
3164 |
self cursor:savedCursor |
1028 | 3165 |
] |
3166 |
||
3167 |
"Modified: 20.2.1997 / 12:49:27 / cg" |
|
248 | 3168 |
! ! |
3169 |
||
3170 |
!TextView methodsFor:'selections'! |
|
3171 |
||
2604
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3172 |
changeTypeOfSelectionTo:newType |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3173 |
"ignored here - but redefined in subclasses which |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3174 |
differentiate between pasted- and user-selections" |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3175 |
! |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3176 |
|
458 | 3177 |
expandSelectionDown |
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
3178 |
|l t| |
458 | 3179 |
|
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
3180 |
selectionStartLine notNil ifTrue:[ |
2604
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3181 |
expandingTop == true ifTrue:[ |
2442 | 3182 |
l := selectionStartLine. |
3183 |
selectionStartLine := selectionStartLine + 1. |
|
3184 |
(selectionStartLine > clickLine |
|
3185 |
or:[selectionStartLine == clickLine and:[selectionStartCol > clickCol]]) |
|
3186 |
ifTrue:[ |
|
3187 |
t := selectionStartLine. |
|
3188 |
selectionStartLine := selectionEndLine. |
|
3189 |
selectionEndLine := t. |
|
3190 |
t := selectionStartCol. |
|
3191 |
selectionStartCol := selectionEndCol. |
|
3192 |
selectionEndCol := t. |
|
3193 |
expandingTop := false |
|
3194 |
]. |
|
3195 |
] ifFalse:[ |
|
3196 |
l := selectionEndLine. |
|
3197 |
selectionEndLine := selectionEndLine + 1. |
|
3198 |
]. |
|
3199 |
"/ self redrawLine:l. |
|
3200 |
"/ self redrawLine:l+1. |
|
2660
1352e7b3ac67
always validate selection (SHIFT-cursor-keys)
Claus Gittinger <cg@exept.de>
parents:
2630
diff
changeset
|
3201 |
self validateNewSelection. |
2442 | 3202 |
self redrawFromLine:l to:l+1. |
3203 |
self makeSelectionVisible. |
|
458 | 3204 |
]. |
3205 |
||
3206 |
"Created: 1.3.1996 / 23:35:08 / cg" |
|
502 | 3207 |
"Modified: 18.3.1996 / 17:18:15 / cg" |
458 | 3208 |
! |
3209 |
||
3210 |
expandSelectionLeft |
|
502 | 3211 |
|c l t c1 c2| |
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
3212 |
|
458 | 3213 |
selectionStartLine notNil ifTrue:[ |
2604
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3214 |
expandingTop == true ifTrue:[ |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3215 |
selectionStartCol == 0 ifTrue:[^ self]. |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3216 |
l := selectionStartLine. |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3217 |
selectionStartCol := (selectionStartCol - 1) max:1. |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3218 |
c := selectionStartCol. |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3219 |
] ifFalse:[ |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3220 |
l := selectionEndLine. |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3221 |
selectionEndCol := (selectionEndCol - 1) max:0. |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3222 |
c := selectionEndCol. |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3223 |
selectionEndLine == selectionStartLine ifTrue:[ |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3224 |
selectionEndCol <= selectionStartCol ifTrue:[ |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3225 |
t := selectionStartCol. selectionStartCol := selectionEndCol. |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3226 |
selectionEndCol := t. |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3227 |
expandingTop := true. |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3228 |
c := selectionStartCol. |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3229 |
] |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3230 |
]. |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3231 |
]. |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3232 |
c1 := c. |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3233 |
c2 := c1 + 1. |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3234 |
c1 == 0 ifTrue:[ |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3235 |
c1 := 1 |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3236 |
]. |
2660
1352e7b3ac67
always validate selection (SHIFT-cursor-keys)
Claus Gittinger <cg@exept.de>
parents:
2630
diff
changeset
|
3237 |
self validateNewSelection. |
2604
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3238 |
self redrawLine:l from:c1 to:c2. |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3239 |
self makeSelectionVisible. |
458 | 3240 |
]. |
3241 |
||
502 | 3242 |
"Modified: 18.3.1996 / 17:05:46 / cg" |
458 | 3243 |
! |
3244 |
||
3245 |
expandSelectionRight |
|
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
3246 |
|l c t| |
458 | 3247 |
|
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
3248 |
selectionStartLine notNil ifTrue:[ |
2604
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3249 |
expandingTop == true ifTrue:[ |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3250 |
l := selectionStartLine. |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3251 |
c := selectionStartCol. |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3252 |
selectionStartCol := selectionStartCol + 1. |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3253 |
l == selectionEndLine ifTrue:[ |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3254 |
c >= selectionEndCol ifTrue:[ |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3255 |
expandingTop := false. |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3256 |
t := selectionStartCol. selectionStartCol := selectionEndCol. |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3257 |
selectionEndCol := t. |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3258 |
c := selectionStartCol. |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3259 |
] |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3260 |
] |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3261 |
] ifFalse:[ |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3262 |
l := selectionEndLine. |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3263 |
c := selectionEndCol. |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3264 |
selectionEndCol := selectionEndCol + 1. |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3265 |
]. |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3266 |
|
2660
1352e7b3ac67
always validate selection (SHIFT-cursor-keys)
Claus Gittinger <cg@exept.de>
parents:
2630
diff
changeset
|
3267 |
self validateNewSelection. |
2604
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3268 |
self redrawLine:l from:c to:c+1. |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3269 |
self makeSelectionVisible. |
458 | 3270 |
]. |
3271 |
||
3272 |
"Created: 1.3.1996 / 23:33:17 / cg" |
|
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
3273 |
"Modified: 6.3.1996 / 13:54:10 / cg" |
458 | 3274 |
! |
3275 |
||
3276 |
expandSelectionUp |
|
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
3277 |
|l t| |
458 | 3278 |
|
3279 |
selectionStartLine notNil ifTrue:[ |
|
2604
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3280 |
expandingTop == true ifTrue:[ |
2442 | 3281 |
selectionStartLine := (selectionStartLine - 1) max:1. |
3282 |
l := selectionStartLine. |
|
3283 |
] ifFalse:[ |
|
3284 |
selectionEndLine := (selectionEndLine - 1) max:0. |
|
3285 |
||
3286 |
l := selectionEndLine. |
|
3287 |
(selectionEndLine < clickLine |
|
3288 |
or:[(selectionEndLine == clickLine and:[selectionEndCol < clickCol])]) |
|
3289 |
ifTrue:[ |
|
3290 |
t := selectionStartLine. |
|
3291 |
selectionStartLine := selectionEndLine. |
|
3292 |
selectionEndLine := t. |
|
3293 |
t := selectionStartCol. |
|
3294 |
selectionStartCol := selectionEndCol. |
|
3295 |
selectionEndCol := t. |
|
3296 |
l := selectionStartLine. |
|
3297 |
expandingTop := true |
|
3298 |
]. |
|
3299 |
]. |
|
2660
1352e7b3ac67
always validate selection (SHIFT-cursor-keys)
Claus Gittinger <cg@exept.de>
parents:
2630
diff
changeset
|
3300 |
self validateNewSelection. |
2442 | 3301 |
"/ self redrawLine:l. |
3302 |
"/ self redrawLine:l+1. |
|
3303 |
self redrawFromLine:l to:l+1. |
|
3304 |
self makeSelectionVisible. |
|
458 | 3305 |
]. |
3306 |
||
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
3307 |
"Modified: 6.3.1996 / 14:12:06 / cg" |
458 | 3308 |
! |
3309 |
||
248 | 3310 |
hasSelection |
3311 |
"return true, if there is a selection" |
|
3312 |
||
3313 |
^ selectionStartLine notNil |
|
3314 |
! |
|
3315 |
||
2350
c09d3dd534e3
do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents:
2336
diff
changeset
|
3316 |
hasSelectionForCopy |
c09d3dd534e3
do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents:
2336
diff
changeset
|
3317 |
"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
|
3318 |
(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
|
3319 |
|
c09d3dd534e3
do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents:
2336
diff
changeset
|
3320 |
^ self hasSelection |
c09d3dd534e3
do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents:
2336
diff
changeset
|
3321 |
! |
c09d3dd534e3
do not allow copy of password-characters out of an editfield.
Claus Gittinger <cg@exept.de>
parents:
2336
diff
changeset
|
3322 |
|
2530
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
3323 |
hasSelectionWithinSingleLine |
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
3324 |
"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
|
3325 |
|
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
3326 |
^ selectionStartLine notNil |
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
3327 |
and:[ selectionStartLine == selectionEndLine ] |
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
3328 |
! |
83e7b4b71496
searchDialog is optionally non-modal
Claus Gittinger <cg@exept.de>
parents:
2520
diff
changeset
|
3329 |
|
2588 | 3330 |
isInSelection:line col:aColNr |
3331 |
"returns true, if the line, and column is in the selection |
|
3332 |
" |
|
3333 |
selectionStartLine ifNil:[^ false]. |
|
3334 |
selectionEndLine ifNil:[^ false]. |
|
3335 |
||
3336 |
(line between:selectionStartLine and:selectionEndLine) ifFalse:[ |
|
3337 |
^ false |
|
3338 |
]. |
|
3339 |
||
3340 |
line == selectionStartLine ifTrue:[ |
|
3341 |
aColNr < selectionStartCol ifTrue:[^ false] |
|
3342 |
]. |
|
3343 |
||
3344 |
line == selectionEndLine ifTrue:[ |
|
3345 |
(selectionEndCol ~~ 0 and:[selectionEndCol < aColNr]) ifTrue:[^ false] |
|
3346 |
]. |
|
3347 |
^ true |
|
3348 |
! |
|
3349 |
||
248 | 3350 |
makeSelectionVisible |
3351 |
"scroll to make the selection visible" |
|
3352 |
||
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
3353 |
|line col| |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
3354 |
|
248 | 3355 |
selectionStartLine notNil ifTrue:[ |
2604
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3356 |
expandingTop == true ifTrue:[ |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3357 |
line := selectionStartLine. |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3358 |
col := selectionStartCol. |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3359 |
] ifFalse:[ |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3360 |
line := selectionEndLine. |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3361 |
col := selectionEndCol. |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3362 |
]. |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3363 |
self makeLineVisible:line. |
2031eca912aa
selections changing the typeOfSelection
Claus Gittinger <cg@exept.de>
parents:
2600
diff
changeset
|
3364 |
self makeColVisible:col inLine:line. |
248 | 3365 |
] |
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
3366 |
|
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
3367 |
"Modified: 6.3.1996 / 13:53:45 / cg" |
248 | 3368 |
! |
3369 |
||
3370 |
selectAll |
|
3371 |
"select the whole text" |
|
3372 |
||
3373 |
self selectFromLine:1 col:1 toLine:(list size + 1) col:0 |
|
3374 |
! |
|
3375 |
||
3376 |
selectFromCharacterPosition:pos1 to:pos2 |
|
3377 |
"compute line/col from character positions and select the text" |
|
3378 |
||
3379 |
|line1 col1 line2 col2| |
|
3380 |
||
3381 |
line1 := self lineOfCharacterPosition:pos1. |
|
3382 |
col1 := pos1 - (self characterPositionOfLine:line1 col:1) + 1. |
|
3383 |
line2 := self lineOfCharacterPosition:pos2. |
|
3384 |
col2 := pos2 - (self characterPositionOfLine:line2 col:1) + 1. |
|
3385 |
self selectFromLine:line1 col:col1 toLine:line2 col:col2 |
|
3386 |
! |
|
3387 |
||
3388 |
selectFromLine:startLine col:startCol toLine:endLine col:endCol |
|
3389 |
"select a piece of text and redraw that area" |
|
3390 |
||
3391 |
self unselect. |
|
3392 |
startLine notNil ifTrue:[ |
|
1728
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3393 |
"new:" |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3394 |
endLine < startLine ifTrue:[ |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3395 |
^ self selectFromLine:endLine col:endCol toLine:startLine col:startCol |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3396 |
]. |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3397 |
(endLine == startLine and:[endCol < startCol]) ifTrue:[ |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3398 |
endCol ~~ 0 ifTrue:[ |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3399 |
self selectFromLine:endLine col:endCol toLine:startLine col:startCol. |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3400 |
]. |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3401 |
^ self |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3402 |
]. |
248 | 3403 |
|
3404 |
" old: |
|
1728
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3405 |
endLine < startLine ifTrue:[^ self]. |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3406 |
(startLine == endLine and:[endCol < startCol]) ifTrue:[^ self]. |
248 | 3407 |
" |
1728
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3408 |
selectionStartLine := startLine. |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3409 |
selectionStartCol := startCol. |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3410 |
selectionEndLine := endLine. |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3411 |
selectionEndCol := endCol. |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3412 |
self validateNewSelection. |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3413 |
|
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3414 |
(selectionStartLine == selectionEndLine) ifTrue:[ |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3415 |
self redrawLine:selectionStartLine from:selectionStartCol to:selectionEndCol |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3416 |
] ifFalse:[ |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3417 |
selectionStartLine to:selectionEndLine do:[:lineNr | |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3418 |
self redrawLine:lineNr |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3419 |
] |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3420 |
]. |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3421 |
selectStyle := nil. |
248 | 3422 |
] |
599
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3423 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3424 |
" |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3425 |
|v| |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3426 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3427 |
v := TextView extent:300@300. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3428 |
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
|
3429 |
v openAndWait. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3430 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3431 |
Delay waitForSeconds:1. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3432 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3433 |
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
|
3434 |
" |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3435 |
|
904
597bf5cfe653
care for changed selection from #validateNewSelection
Claus Gittinger <cg@exept.de>
parents:
896
diff
changeset
|
3436 |
"Modified: 2.1.1997 / 13:32:25 / cg" |
599
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3437 |
! |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3438 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3439 |
selectFromLine:startLine toLine:endLine |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3440 |
"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
|
3441 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3442 |
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
|
3443 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3444 |
" |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3445 |
|v| |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3446 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3447 |
v := TextView extent:300@300. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3448 |
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
|
3449 |
v openAndWait. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3450 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3451 |
Delay waitForSeconds:1. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3452 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3453 |
v selectFromLine:2 toLine:10 |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3454 |
" |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3455 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3456 |
"Modified: 29.4.1996 / 12:23:46 / cg" |
248 | 3457 |
! |
3458 |
||
3459 |
selectLine:selectLine |
|
3460 |
"select one line and redraw it" |
|
3461 |
||
3462 |
self selectFromLine:selectLine col:1 toLine:(selectLine + 1) col:0. |
|
3463 |
wordStartCol := selectionStartCol. |
|
3464 |
wordEndCol := selectionEndCol. |
|
3465 |
wordStartLine := selectionStartLine. |
|
3466 |
wordEndLine := selectionEndLine. |
|
3467 |
selectStyle := #line |
|
3468 |
! |
|
3469 |
||
3470 |
selectLineAtY:y |
|
3471 |
"select the line at given y-(view-)coordinate" |
|
3472 |
||
2413 | 3473 |
|selectLine| |
3474 |
||
3475 |
selectLine := self lineAtY:y. "/ self visibleLineToListLine:(self visibleLineOfY:y). |
|
248 | 3476 |
selectLine notNil ifTrue:[ |
2413 | 3477 |
self selectLine:selectLine |
248 | 3478 |
] |
3479 |
! |
|
3480 |
||
3481 |
selectLineWhereCharacterPosition:pos |
|
3482 |
"select the line, where characterPosition pos is living. |
|
3483 |
The argument pos starts at 1 from the start of the text |
|
3484 |
and counts characters (i.e. can be used to convert from |
|
3485 |
character position within a string to line-position in view)." |
|
3486 |
||
3487 |
self selectLine:(self lineOfCharacterPosition:pos) |
|
3488 |
! |
|
3489 |
||
3490 |
selectWordAtLine:line col:col |
|
3491 |
"select the word at given line/col" |
|
3492 |
||
3493 |
self wordAtLine:line col:col do:[ |
|
1728
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3494 |
:beginLine :beginCol :endLine :endCol :style | |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3495 |
|
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3496 |
self selectFromLine:beginLine col:beginCol toLine:endLine col:endCol. |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3497 |
selectStyle := style |
248 | 3498 |
] |
504 | 3499 |
|
3500 |
"Modified: 18.3.1996 / 17:30:38 / cg" |
|
248 | 3501 |
! |
3502 |
||
3503 |
selectWordAtX:x y:y |
|
3504 |
"select the word at given x/y-(view-)coordinate" |
|
3505 |
||
3506 |
|selectVisibleLine selectLine selectCol| |
|
3507 |
||
3508 |
selectStyle := nil. |
|
3509 |
selectVisibleLine := self visibleLineOfY:y. |
|
3510 |
selectLine := self visibleLineToListLine:selectVisibleLine. |
|
3511 |
selectLine notNil ifTrue:[ |
|
1728
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3512 |
selectCol := self colOfX:x inVisibleLine:selectVisibleLine. |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3513 |
self selectWordAtLine:selectLine col:selectCol |
248 | 3514 |
] |
1661
bf446f457d95
fixed selectWordAtX:y for variable fonts.
Claus Gittinger <cg@exept.de>
parents:
1619
diff
changeset
|
3515 |
|
bf446f457d95
fixed selectWordAtX:y for variable fonts.
Claus Gittinger <cg@exept.de>
parents:
1619
diff
changeset
|
3516 |
"Modified: / 8.9.1998 / 21:22:46 / cg" |
248 | 3517 |
! |
3518 |
||
3519 |
selection |
|
3520 |
"return the selection as a collection of (line-)strings. |
|
3521 |
If the selection ends in a full line, the last entry in the returned |
|
3522 |
collection will be an empty string." |
|
3523 |
||
3524 |
selectionStartLine isNil ifTrue:[^ nil]. |
|
2158
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2120
diff
changeset
|
3525 |
^ self textFromLine:selectionStartLine col:selectionStartCol toLine:selectionEndLine col:selectionEndCol |
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2120
diff
changeset
|
3526 |
|
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2120
diff
changeset
|
3527 |
"Modified: / 22.2.2000 / 23:54:54 / cg" |
248 | 3528 |
! |
3529 |
||
2217 | 3530 |
selectionAsString |
3531 |
"return the selection as a String (i.e. without emphasis)" |
|
3532 |
||
2693 | 3533 |
|sel| |
2217 | 3534 |
|
3535 |
(sel := self selection) isNil ifTrue:[^ nil]. |
|
2419 | 3536 |
sel := sel collect:[:each| each isNil ifTrue:[nil] ifFalse:[each string]]. |
2217 | 3537 |
^ (sel asStringWithCRsFrom:1 to:(sel size) compressTabs:false withCR:false) string |
3538 |
! |
|
3539 |
||
248 | 3540 |
selectionEndCol |
3541 |
^ selectionEndCol |
|
3542 |
! |
|
3543 |
||
3544 |
selectionEndLine |
|
3545 |
^ selectionEndLine |
|
3546 |
! |
|
3547 |
||
3548 |
selectionStartCol |
|
3549 |
^ selectionStartCol |
|
3550 |
! |
|
3551 |
||
3552 |
selectionStartLine |
|
3553 |
^ selectionStartLine |
|
3554 |
! |
|
3555 |
||
3556 |
unselect |
|
3557 |
"unselect - if there was a selection redraw that area" |
|
3558 |
||
3559 |
|startLine endLine startVisLine endVisLine| |
|
3560 |
||
3561 |
selectionStartLine notNil ifTrue:[ |
|
1728
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3562 |
startLine := selectionStartLine. |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3563 |
endLine := selectionEndLine. |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3564 |
|
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3565 |
self unselectWithoutRedraw. |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3566 |
|
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3567 |
"/ if the selection is not visible, we are done |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3568 |
|
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3569 |
startLine >= (firstLineShown + nLinesShown) ifTrue:[^ self]. |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3570 |
endLine < firstLineShown ifTrue:[^ self]. |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3571 |
|
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3572 |
startLine < firstLineShown ifTrue:[ |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3573 |
startVisLine := 1 |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3574 |
] ifFalse:[ |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3575 |
startVisLine := self listLineToVisibleLine:startLine |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3576 |
]. |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3577 |
endLine >= (firstLineShown + nLinesShown) ifTrue:[ |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3578 |
endVisLine := nLinesShown |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3579 |
] ifFalse:[ |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3580 |
endVisLine := self listLineToVisibleLine:endLine |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3581 |
]. |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3582 |
|
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3583 |
"/ if its only part of a line, just redraw what has to be |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3584 |
|
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3585 |
(startLine == endLine) ifTrue:[ |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3586 |
super redrawVisibleLine:startVisLine from:selectionStartCol to:selectionEndCol |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3587 |
] ifFalse:[ |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3588 |
self redrawFromVisibleLine:startVisLine to:endVisLine |
516cb89919f1
moved lastSearchPattern to TextView
Claus Gittinger <cg@exept.de>
parents:
1677
diff
changeset
|
3589 |
]. |
248 | 3590 |
]. |
3591 |
selectStyle := nil |
|
503 | 3592 |
|
715 | 3593 |
"Modified: 29.5.1996 / 14:54:11 / cg" |
248 | 3594 |
! |
3595 |
||
3596 |
unselectWithoutRedraw |
|
3597 |
"forget selection but do not redraw the selection area |
|
3598 |
- 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
|
3599 |
known to be invisible (however, redraw knows about that anyway)." |
248 | 3600 |
|
3601 |
selectionStartLine := nil. |
|
599
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3602 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3603 |
"Modified: 29.4.1996 / 12:33:28 / cg" |
248 | 3604 |
! |
3605 |
||
3606 |
validateNewSelection |
|
599
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3607 |
"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
|
3608 |
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
|
3609 |
may redefine it to limit the selection to a single line, or whatever." |
248 | 3610 |
|
599
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3611 |
^ self |
504 | 3612 |
|
599
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3613 |
"Modified: 29.4.1996 / 12:32:08 / cg" |
248 | 3614 |
! ! |
3615 |
||
844
03e45d817dce
fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
3616 |
!TextView class methodsFor:'documentation'! |
248 | 3617 |
|
3618 |
version |
|
2695
7e13db2802df
better save file dialog (use new dialog vs. use old dialog)
Claus Gittinger <cg@exept.de>
parents:
2693
diff
changeset
|
3619 |
^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.193 2003-02-25 14:43:24 cg Exp $' |
248 | 3620 |
! ! |
2630
f3c95e73f862
for now: do not use alternative selection color
Claus Gittinger <cg@exept.de>
parents:
2604
diff
changeset
|
3621 |
|
2553
9838f1097a2f
allow for parenthesis matcher to be configured
Claus Gittinger <cg@exept.de>
parents:
2547
diff
changeset
|
3622 |
TextView initialize! |