author | Claus Gittinger <cg@exept.de> |
Thu, 09 Apr 1998 13:32:29 +0200 | |
changeset 1483 | e0fb580b5131 |
parent 1477 | 2d4b6115e2c5 |
child 1487 | 4a9bfda28991 |
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 |
||
13 |
ListView subclass:#TextView |
|
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
248
diff
changeset
|
14 |
instanceVariableNames:'selectionStartLine selectionStartCol selectionEndLine |
248 | 15 |
selectionEndCol clickStartLine clickStartCol clickLine clickCol |
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
16 |
clickCount expandingTop wordStartCol wordStartLine wordEndCol |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
17 |
wordEndLine selectionFgColor selectionBgColor selectStyle |
1003
b1affa654489
added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents:
997
diff
changeset
|
18 |
directoryForFileDialog defaultFileNameForFileDialog |
1255
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
19 |
externalEncoding contentsWasSaved' |
392
81343306d796
eliminated all DefaultFont classVars (are now classINSTvars)
Claus Gittinger <cg@exept.de>
parents:
326
diff
changeset
|
20 |
classVariableNames:'DefaultViewBackground DefaultSelectionForegroundColor |
504 | 21 |
DefaultSelectionBackgroundColor MatchDelayTime |
1322
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
22 |
WordSelectCatchesBlanks ST80Selections' |
259
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
248
diff
changeset
|
23 |
poolDictionaries:'' |
837ccdc138ea
use non-blocking millisecondDelay
Claus Gittinger <cg@exept.de>
parents:
248
diff
changeset
|
24 |
category:'Views-Text' |
0 | 25 |
! |
26 |
||
844
03e45d817dce
fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
27 |
!TextView class methodsFor:'documentation'! |
0 | 28 |
|
38 | 29 |
copyright |
30 |
" |
|
31 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
59 | 32 |
All Rights Reserved |
38 | 33 |
|
34 |
This software is furnished under a license and may be used |
|
35 |
only in accordance with the terms of that license and with the |
|
36 |
inclusion of the above copyright notice. This software may not |
|
37 |
be provided or otherwise made available to, or used by, any |
|
38 |
other person. No title to or ownership of the software is |
|
39 |
hereby transferred. |
|
40 |
" |
|
41 |
! |
|
42 |
||
22 | 43 |
documentation |
0 | 44 |
" |
120 | 45 |
a view for readOnly text - this class adds selections to a simple list. |
38 | 46 |
The text is not editable and there is no cursor. |
120 | 47 |
Use TextViews for readonly text, EditTextView for editable text. |
0 | 48 |
|
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
|
49 |
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
|
50 |
|
586 | 51 |
[Instance variables:] |
0 | 52 |
|
120 | 53 |
selectionStartLine <Number> the line of the selection start (or nil) |
54 |
selectionStartCol <Number> the col of the selection start |
|
55 |
selectionEndLine <Number> the line of the selection end |
|
56 |
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
|
57 |
|
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
58 |
clickStartLine <Number> temporary - remember where select operation started |
120 | 59 |
clickStartCol <Number> temporary |
60 |
clickLine <Number> temporary |
|
61 |
clickCol <Number> temporary |
|
62 |
clickCount <Number> temporary |
|
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
63 |
expandingTop <Boolean> temporary - for expandSelection |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
64 |
|
120 | 65 |
selectionFgColor <Color> color used to draw selections |
66 |
selectionBgColor <Color> color used to draw selections |
|
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
67 |
|
120 | 68 |
selectStyle <Symbol> how words are selected |
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
69 |
|
120 | 70 |
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
|
71 |
|
120 | 72 |
contentsWasSaved <Boolean> set to true, whenever saved in a file |
77 | 73 |
|
1322
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
74 |
externalEncoding <Symbol|nil> external encoding, used when text is saved to |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
75 |
a file. Usually something like |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
76 |
#jis7, #euc, #sjis etc. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
77 |
(currently only passed down from the |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
78 |
fileBrowser) |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
79 |
|
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
80 |
[class variables:] |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
81 |
ST80Selections <Boolean> enables ST80 style doubleclick behavior |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
82 |
(right after opening parenthesis, right before |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
83 |
closing parenthesis, at begin of a line |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
84 |
at begin of text) |
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
85 |
|
586 | 86 |
[StyleSheet parameters:] |
77 | 87 |
|
120 | 88 |
textViewBackground defaults to viewBackground |
89 |
textSelectionForegroundColor defaults to textBackgroundColor |
|
90 |
textSelectionBackgroundColor defaults to textForegroundColor |
|
91 |
textViewFont defaults to textFont |
|
586 | 92 |
|
93 |
||
94 |
[author:] |
|
95 |
Claus Gittinger |
|
96 |
||
97 |
[see also:] |
|
98 |
EditTextView CodeView Workspace |
|
0 | 99 |
" |
1014
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
100 |
! |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
101 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
102 |
examples |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
103 |
" |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
104 |
although textViews (and instances of subclasses) are mostly used |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
105 |
as components (in the fileBrowser, the browser, the launcher etc.), |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
106 |
they may also be opened as a textEditor; |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
107 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
108 |
open a (readonly) textView on some information text: |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
109 |
[exBegin] |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
110 |
TextView |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
111 |
openWith:'read this' |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
112 |
title:'demonstration' |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
113 |
[exEnd] |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
114 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
115 |
the same, but open it modal: |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
116 |
[exBegin] |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
117 |
TextView |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
118 |
openModalWith:'read this first' |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
119 |
title:'demonstration' |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
120 |
[exEnd] |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
121 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
122 |
|
1016 | 123 |
open it modal (but editable) on some text: |
124 |
(must accept before closing) |
|
125 |
This is somewhat kludgy - when closed, the view has already |
|
126 |
nilled its link to the model. Therefore, the accept must be |
|
127 |
done 'manually' below. |
|
128 |
However, usually an applicationModel is installed as the |
|
129 |
editor-topViews application. This would get a closeRequest, |
|
130 |
where it could handle things. |
|
1014
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
131 |
[exBegin] |
1016 | 132 |
|m textView| |
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 |
m := 'read this first' asValue. |
1016 | 135 |
textView := EditTextView openModalOnModel:m. |
136 |
textView modified ifTrue:[ |
|
137 |
(self confirm:'text was not accepted - do it now ?') |
|
138 |
ifTrue:[ |
|
139 |
m value:textView contents |
|
140 |
] |
|
141 |
]. |
|
142 |
||
1014
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
143 |
Transcript showCR:m value. |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
144 |
[exEnd] |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
145 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
146 |
|
1016 | 147 |
open a textEditor on some file: |
1014
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
148 |
[exBegin] |
1016 | 149 |
EditTextView openOn:'Makefile' |
1014
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
150 |
[exEnd] |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
151 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
152 |
" |
1016 | 153 |
|
0 | 154 |
! ! |
155 |
||
844
03e45d817dce
fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
156 |
!TextView class methodsFor:'instance creation'! |
119 | 157 |
|
158 |
on:aModel aspect:aspect change:change menu:menu initialSelection:initial |
|
159 |
"for ST-80 compatibility" |
|
160 |
||
120 | 161 |
^ (self new) |
162 |
on:aModel |
|
163 |
aspect:aspect |
|
164 |
list:aspect |
|
165 |
change:change |
|
166 |
menu:menu |
|
167 |
initialSelection:initial |
|
119 | 168 |
! ! |
169 |
||
844
03e45d817dce
fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
170 |
!TextView class methodsFor:'defaults'! |
38 | 171 |
|
896 | 172 |
defaultIcon |
1195 | 173 |
"return the default icon if started as a topView" |
174 |
||
175 |
<resource: #style (#ICON #ICON_FILE)> |
|
176 |
||
177 |
|nm i| |
|
1143 | 178 |
|
1146 | 179 |
i := self classResources at:'ICON' default:nil. |
1143 | 180 |
i isNil ifTrue:[ |
1195 | 181 |
nm := ClassResources at:'ICON_FILE' default:'Editor.xbm'. |
182 |
i := Image fromFile:nm resolution:100. |
|
183 |
i isNil ifTrue:[ |
|
184 |
i := Image fromFile:('bitmaps/' , nm) resolution:100. |
|
185 |
] |
|
186 |
]. |
|
187 |
i notNil ifTrue:[ |
|
188 |
i := i on:Display |
|
1143 | 189 |
]. |
190 |
^ i |
|
191 |
||
1195 | 192 |
"Modified: 18.4.1997 / 15:18:06 / cg" |
896 | 193 |
! |
194 |
||
910
0446030ce647
Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents:
906
diff
changeset
|
195 |
defaultMenuMessage |
0446030ce647
Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents:
906
diff
changeset
|
196 |
"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
|
197 |
|
0446030ce647
Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents:
906
diff
changeset
|
198 |
^ #editMenu |
0446030ce647
Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents:
906
diff
changeset
|
199 |
|
0446030ce647
Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents:
906
diff
changeset
|
200 |
"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
|
201 |
! |
0446030ce647
Move rest of menuHolder/menuPerformer stuff to View.
Stefan Vogel <sv@exept.de>
parents:
906
diff
changeset
|
202 |
|
1477
2d4b6115e2c5
redefine #defaultViewBackgroundColor for the spec class
tz
parents:
1476
diff
changeset
|
203 |
defaultViewBackgroundColor |
2d4b6115e2c5
redefine #defaultViewBackgroundColor for the spec class
tz
parents:
1476
diff
changeset
|
204 |
"return the default view background" |
2d4b6115e2c5
redefine #defaultViewBackgroundColor for the spec class
tz
parents:
1476
diff
changeset
|
205 |
|
2d4b6115e2c5
redefine #defaultViewBackgroundColor for the spec class
tz
parents:
1476
diff
changeset
|
206 |
^DefaultViewBackground |
2d4b6115e2c5
redefine #defaultViewBackgroundColor for the spec class
tz
parents:
1476
diff
changeset
|
207 |
! |
2d4b6115e2c5
redefine #defaultViewBackgroundColor for the spec class
tz
parents:
1476
diff
changeset
|
208 |
|
59 | 209 |
updateStyleCache |
441
e170bca66a78
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
428
diff
changeset
|
210 |
"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
|
211 |
|
1353 | 212 |
<resource: #style (#'textView.background' |
1380 | 213 |
#'text.selectionForegroundColor' #'text.selectionBackgroundColor' |
214 |
#'textView.font' #'text.wordSelectCatchesBlanks' |
|
215 |
#'text.st80Selections')> |
|
441
e170bca66a78
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
428
diff
changeset
|
216 |
|
1353 | 217 |
DefaultViewBackground := StyleSheet colorAt:'textView.background' default:White. |
1380 | 218 |
DefaultSelectionForegroundColor := StyleSheet colorAt:'text.selectionForegroundColor'. |
219 |
DefaultSelectionBackgroundColor := StyleSheet colorAt:'text.selectionBackgroundColor'. |
|
1353 | 220 |
DefaultFont := StyleSheet fontAt:'textView.font'. |
504 | 221 |
MatchDelayTime := 0.6. |
1380 | 222 |
WordSelectCatchesBlanks := StyleSheet at:'text.wordSelectCatchesBlanks' default:false. |
223 |
ST80Selections := StyleSheet at:'text.st80Selections' default:false. |
|
224 |
||
225 |
"Modified: / 31.10.1997 / 13:17:16 / cg" |
|
0 | 226 |
! ! |
227 |
||
844
03e45d817dce
fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
228 |
!TextView class methodsFor:'startup'! |
121 | 229 |
|
248 | 230 |
open |
231 |
"start an empty TextView" |
|
232 |
||
233 |
^ self openWith:nil |
|
0 | 234 |
! |
235 |
||
1014
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
236 |
openModalOnModel:aModel |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
237 |
"start a textView on a model; return the textView" |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
238 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
239 |
|textView| |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
240 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
241 |
textView := self setupForModel:aModel. |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
242 |
textView topView openModal. |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
243 |
^ textView |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
244 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
245 |
"Created: 14.2.1997 / 15:24:12 / cg" |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
246 |
! |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
247 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
248 |
openModalWith:aString |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
249 |
"start a textView with aString as initial contents" |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
250 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
251 |
^ self openModalWith:aString title:nil |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
252 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
253 |
" |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
254 |
TextView openModalWith:'some text' |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
255 |
EditTextView openModalWith:'some text' |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
256 |
" |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
257 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
258 |
"Created: 14.2.1997 / 15:19:04 / cg" |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
259 |
! |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
260 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
261 |
openModalWith:aString title:aTitle |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
262 |
"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
|
263 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
264 |
|textView| |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
265 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
266 |
textView := self setupWith:aString title:aTitle. |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
267 |
textView topView openModal. |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
268 |
^ textView |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
269 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
270 |
" |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
271 |
TextView openModalWith:'some text' title:'testing' |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
272 |
EditTextView openModalWith:'some text' title:'testing' |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
273 |
" |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
274 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
275 |
"Modified: 9.9.1996 / 19:32:29 / cg" |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
276 |
"Created: 14.2.1997 / 15:19:18 / cg" |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
277 |
! |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
278 |
|
248 | 279 |
openOn:aFileName |
830
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
280 |
"start a textView on a file; return the textView" |
0 | 281 |
|
830
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
282 |
|textView| |
248 | 283 |
|
1014
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
284 |
textView := self setupForFile:aFileName. |
830
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
285 |
textView topView open. |
248 | 286 |
^ textView |
287 |
||
288 |
" |
|
830
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
289 |
TextView openOn:'../../doc/overview.doc' |
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
290 |
EditTextView openOn:'../../doc/overview.doc' |
248 | 291 |
" |
830
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
292 |
|
1014
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
293 |
"Modified: 14.2.1997 / 15:21:51 / cg" |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
294 |
! |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
295 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
296 |
openOnModel:aModel |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
297 |
"start a textView on a model; return the textView" |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
298 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
299 |
|textView| |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
300 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
301 |
textView := self setupForModel:aModel. |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
302 |
textView topView open. |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
303 |
^ textView |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
304 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
305 |
"Created: 14.2.1997 / 15:23:36 / cg" |
0 | 306 |
! |
307 |
||
1100 | 308 |
openWith:aStringOrStringCollection |
309 |
"start a textView with aStringOrStringCollection as initial contents" |
|
310 |
||
311 |
^ self openWith:aStringOrStringCollection title:nil |
|
0 | 312 |
|
248 | 313 |
" |
314 |
TextView openWith:'some text' |
|
315 |
EditTextView openWith:'some text' |
|
316 |
" |
|
119 | 317 |
|
248 | 318 |
"Created: 10.12.1995 / 17:41:32 / cg" |
1100 | 319 |
"Modified: 5.3.1997 / 15:37:19 / cg" |
126 | 320 |
! |
321 |
||
1100 | 322 |
openWith:aStringOrStringCollection title:aTitle |
323 |
"start a textView with aStringOrStringCollection as initial contents. Return the textView." |
|
248 | 324 |
|
830
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
325 |
|textView| |
248 | 326 |
|
1100 | 327 |
textView := self setupWith:aStringOrStringCollection title:aTitle. |
830
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
328 |
textView topView open. |
248 | 329 |
^ textView |
330 |
||
331 |
" |
|
332 |
TextView openWith:'some text' title:'testing' |
|
333 |
EditTextView openWith:'some text' title:'testing' |
|
334 |
" |
|
126 | 335 |
|
248 | 336 |
"Created: 10.12.1995 / 17:40:02 / cg" |
1100 | 337 |
"Modified: 5.3.1997 / 15:37:26 / cg" |
248 | 338 |
! |
339 |
||
340 |
setupEmpty |
|
341 |
"create a textview in a topview, with horizontal and |
|
342 |
vertical scrollbars - a helper for #startWith: and #startOn:" |
|
343 |
||
344 |
|top frame label| |
|
345 |
||
346 |
label := 'unnamed'. |
|
896 | 347 |
top := StandardSystemView label:label icon:self defaultIcon. |
248 | 348 |
|
349 |
frame := HVScrollableView |
|
896 | 350 |
for:self |
351 |
miniScrollerH:true miniScrollerV:false |
|
352 |
in:top. |
|
248 | 353 |
frame origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
354 |
^ frame scrolledView |
|
896 | 355 |
|
356 |
"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
|
357 |
! |
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
358 |
|
1014
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
359 |
setupForFile:aFileName |
830
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
360 |
"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
|
361 |
|
1326 | 362 |
|top textView f| |
830
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
363 |
|
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
364 |
textView := self setupEmpty. |
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
365 |
top := textView topView. |
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
366 |
aFileName notNil ifTrue:[ |
1326 | 367 |
f := aFileName asFilename. |
368 |
top label:(f baseName). |
|
369 |
textView contents:(f contents). |
|
830
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
370 |
]. |
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
371 |
|
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
372 |
^ textView |
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
373 |
|
1014
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
374 |
"Created: 14.2.1997 / 15:21:43 / cg" |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
375 |
! |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
376 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
377 |
setupForModel:aModel |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
378 |
"setup a textView on a model; return the textView" |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
379 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
380 |
|top textView| |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
381 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
382 |
textView := self setupEmpty. |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
383 |
textView model:aModel. |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
384 |
top := textView topView. |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
385 |
^ textView |
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
386 |
|
d70cad164cd0
more startup protocol; examples.
Claus Gittinger <cg@exept.de>
parents:
1003
diff
changeset
|
387 |
"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
|
388 |
! |
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
389 |
|
1100 | 390 |
setupWith:aStringOrStringCollection title:aTitle |
391 |
"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
|
392 |
|
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
393 |
|top textView| |
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
394 |
|
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
395 |
textView := self setupEmpty. |
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
396 |
top := textView topView. |
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
397 |
aTitle notNil ifTrue:[top label:aTitle]. |
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
398 |
|
1100 | 399 |
aStringOrStringCollection notNil ifTrue:[ |
400 |
textView contents:aStringOrStringCollection |
|
830
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
401 |
]. |
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
402 |
|
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
403 |
^ textView |
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
404 |
|
0441903116d6
separated setup from opening (in class method);
Claus Gittinger <cg@exept.de>
parents:
829
diff
changeset
|
405 |
"Created: 9.9.1996 / 19:31:22 / cg" |
1100 | 406 |
"Modified: 5.3.1997 / 15:37:37 / cg" |
119 | 407 |
! ! |
408 |
||
0 | 409 |
!TextView methodsFor:'accessing'! |
410 |
||
411 |
characterPositionOfSelection |
|
1303 | 412 |
"return the character index of the first character in the selection. |
413 |
Returns 0 if there is no selection." |
|
414 |
||
415 |
selectionStartLine isNil ifTrue:[^ 0]. |
|
0 | 416 |
^ self characterPositionOfLine:selectionStartLine |
1303 | 417 |
col:selectionStartCol |
418 |
||
419 |
"Modified: 14.8.1997 / 16:35:37 / cg" |
|
420 |
! |
|
421 |
||
422 |
characterPositionOfSelectionEnd |
|
423 |
"return the character index of the last character in the selection. |
|
424 |
Returns 0 if there is no selection." |
|
425 |
||
426 |
selectionStartLine isNil ifTrue:[^ 0]. |
|
427 |
^ self characterPositionOfLine:selectionEndLine |
|
428 |
col:selectionEndCol |
|
429 |
||
430 |
"Created: 14.8.1997 / 16:35:24 / cg" |
|
431 |
"Modified: 14.8.1997 / 16:35:45 / cg" |
|
0 | 432 |
! |
433 |
||
434 |
contentsWasSaved |
|
435 |
"return true, if the contents was saved (by a save action), |
|
436 |
false if not (or was modified again after the last save)." |
|
437 |
||
438 |
^ contentsWasSaved |
|
439 |
! |
|
440 |
||
1003
b1affa654489
added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents:
997
diff
changeset
|
441 |
defaultFileNameForFileDialog:aBaseName |
b1affa654489
added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents:
997
diff
changeset
|
442 |
"define the default fileName to use for the save-box" |
b1affa654489
added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents:
997
diff
changeset
|
443 |
|
b1affa654489
added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents:
997
diff
changeset
|
444 |
defaultFileNameForFileDialog := aBaseName |
b1affa654489
added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents:
997
diff
changeset
|
445 |
|
b1affa654489
added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents:
997
diff
changeset
|
446 |
"Created: 13.2.1997 / 18:29:53 / cg" |
b1affa654489
added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents:
997
diff
changeset
|
447 |
! |
b1affa654489
added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents:
997
diff
changeset
|
448 |
|
248 | 449 |
directoryForFileDialog:aDirectory |
1003
b1affa654489
added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents:
997
diff
changeset
|
450 |
"define the default directory to use for save-box" |
248 | 451 |
|
452 |
directoryForFileDialog := aDirectory |
|
1003
b1affa654489
added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents:
997
diff
changeset
|
453 |
|
b1affa654489
added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents:
997
diff
changeset
|
454 |
"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
|
455 |
! |
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
456 |
|
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
457 |
externalEncoding:encodingSymOrNil |
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
458 |
"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
|
459 |
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
|
460 |
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
|
461 |
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
|
462 |
(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
|
463 |
|
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
464 |
externalEncoding := encodingSymOrNil |
599
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
465 |
! ! |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
466 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
467 |
!TextView methodsFor:'accessing-contents'! |
248 | 468 |
|
0 | 469 |
fromFile:aFileName |
470 |
"take contents from a named file" |
|
471 |
||
1326 | 472 |
|f| |
473 |
||
474 |
f := aFileName asFilename. |
|
475 |
self directoryForFileDialog:(f directoryName). |
|
476 |
self contents:(f contents) |
|
0 | 477 |
! |
478 |
||
248 | 479 |
list:something |
480 |
"set the displayed contents (a collection of strings) |
|
481 |
with redraw. |
|
599
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
482 |
Redefined since changing the contents implies deselect" |
0 | 483 |
|
484 |
self unselect. |
|
248 | 485 |
super list:something |
0 | 486 |
|
599
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
487 |
"Modified: 29.4.1996 / 12:13:24 / cg" |
0 | 488 |
! |
489 |
||
1476
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
490 |
setContents:something |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
491 |
"set the contents (either a string or a Collection of strings) |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
492 |
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
|
493 |
|
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
494 |
|selStartLine selStartCol selEndLine selEndCol selStyle| |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
495 |
|
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
496 |
selStartLine := selectionStartLine. |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
497 |
selStartCol := selectionStartCol. |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
498 |
selEndLine := selectionEndLine. |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
499 |
selEndCol := selectionEndCol. |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
500 |
selStyle := selectStyle. |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
501 |
|
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
502 |
super setContents:something. |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
503 |
|
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
504 |
selStartLine notNil ifTrue:[ |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
505 |
self |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
506 |
selectFromLine:selStartLine col:selStartCol |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
507 |
toLine:selEndLine col:selEndCol. |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
508 |
]. |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
509 |
|
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
510 |
selectStyle := selStyle |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
511 |
|
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
512 |
"Modified: / 31.3.1998 / 23:33:21 / cg" |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
513 |
! |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
514 |
|
248 | 515 |
setList:something |
516 |
"set the displayed contents (a collection of strings) |
|
517 |
without redraw. |
|
518 |
Redefined since changing contents implies deselect" |
|
0 | 519 |
|
248 | 520 |
self unselect. |
521 |
super setList:something |
|
599
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
522 |
! |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
523 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
524 |
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
|
525 |
"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
|
526 |
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
|
527 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
528 |
|beginCol endCol endLine thisCharacter flag| |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
529 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
530 |
flag := #word. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
531 |
beginCol := selectCol. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
532 |
endCol := selectCol. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
533 |
endLine := selectLine. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
534 |
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
|
535 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
536 |
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
|
537 |
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
|
538 |
endCol == 0 ifTrue:[ |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
539 |
endLine := selectLine + 1 |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
540 |
]. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
541 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
542 |
"is the initial acharacter within a word ?" |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
543 |
(wordCheck value:thisCharacter) ifTrue:[ |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
544 |
" |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
545 |
try to catch a blank ... |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
546 |
" |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
547 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
548 |
WordSelectCatchesBlanks ifTrue:[ |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
549 |
((beginCol == 1) |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
550 |
or:[(self characterAtLine:selectLine col:(beginCol - 1)) |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
551 |
~~ Character space]) ifTrue:[ |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
552 |
((self characterAtLine:selectLine col:(endCol + 1)) |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
553 |
== Character space) ifTrue:[ |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
554 |
endCol := endCol + 1. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
555 |
flag := #wordRight |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
556 |
] |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
557 |
] ifFalse:[ |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
558 |
beginCol := beginCol - 1. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
559 |
flag := #wordLeft |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
560 |
]. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
561 |
]. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
562 |
]. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
563 |
aFiveArgBlock value:selectLine |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
564 |
value:beginCol |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
565 |
value:endLine |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
566 |
value:endCol |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
567 |
value:flag |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
568 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
569 |
"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
|
570 |
! ! |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
571 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
572 |
!TextView methodsFor:'accessing-look'! |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
573 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
574 |
selectionForegroundColor:color1 backgroundColor:color2 |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
575 |
"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
|
576 |
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
|
577 |
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
|
578 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
579 |
selectionFgColor := color1 on:device. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
580 |
selectionBgColor := color2 on:device. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
581 |
shown ifTrue:[ |
712 | 582 |
self hasSelection ifTrue:[ |
722
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
715
diff
changeset
|
583 |
self invalidate |
712 | 584 |
] |
599
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
585 |
] |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
586 |
|
722
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
715
diff
changeset
|
587 |
"Modified: 29.5.1996 / 16:22:15 / cg" |
0 | 588 |
! ! |
589 |
||
248 | 590 |
!TextView methodsFor:'accessing-mvc'! |
0 | 591 |
|
248 | 592 |
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
|
593 |
"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
|
594 |
and selection. Added for ST-80 compatibility" |
0 | 595 |
|
906 | 596 |
aspectSym notNil ifTrue:[aspectMsg := aspectSym. |
597 |
listMsg isNil ifTrue:[listMsg := aspectSym]]. |
|
248 | 598 |
changeSym notNil ifTrue:[changeMsg := changeSym]. |
599 |
listSym notNil ifTrue:[listMsg := listSym]. |
|
600 |
menuSym notNil ifTrue:[menuMsg := menuSym]. |
|
601 |
"/ initial notNil ifTrue:[initialSelectionMsg := initial]. |
|
602 |
self model:aModel. |
|
0 | 603 |
|
824
f62922fcfa5d
Send #getListFromModel when setting #model:
Stefan Vogel <sv@exept.de>
parents:
813
diff
changeset
|
604 |
"Modified: 15.8.1996 / 12:52:54 / stefan" |
906 | 605 |
"Modified: 2.1.1997 / 16:11:28 / cg" |
0 | 606 |
! ! |
607 |
||
608 |
!TextView methodsFor:'event processing'! |
|
609 |
||
53 | 610 |
buttonMotion:buttonMask x:x y:y |
0 | 611 |
"mouse-move while button was pressed - handle selection changes" |
612 |
||
613 |
|movedVisibleLine movedLine movedCol |
|
614 |
movedUp |
|
615 |
oldStartLine oldEndLine oldStartCol oldEndCol| |
|
616 |
||
617 |
clickLine isNil ifTrue:[^ self]. |
|
618 |
||
63 | 619 |
"is it the select or 1-button ?" |
620 |
(device buttonMotionMask:buttonMask includesButton:#select) ifFalse:[ |
|
621 |
(device buttonMotionMask:buttonMask includesButton:1) ifFalse:[ |
|
622 |
^ self |
|
623 |
]. |
|
53 | 624 |
]. |
625 |
||
0 | 626 |
"if moved outside of view, start autoscroll" |
627 |
(y < 0) ifTrue:[ |
|
59 | 628 |
self compressMotionEvents:false. |
629 |
self startAutoScrollUp:y. |
|
630 |
^ self |
|
0 | 631 |
]. |
632 |
(y > height) ifTrue:[ |
|
59 | 633 |
self compressMotionEvents:false. |
634 |
self startAutoScrollDown:(y - height). |
|
635 |
^ self |
|
636 |
]. |
|
637 |
((x < 0) and:[leftOffset ~~ 0]) ifTrue:[ |
|
638 |
self compressMotionEvents:false. |
|
639 |
self startAutoScrollLeft:x. |
|
640 |
^ self |
|
641 |
]. |
|
642 |
(x > width) ifTrue:[ |
|
643 |
self compressMotionEvents:false. |
|
644 |
self startAutoScrollRight:(x - width). |
|
645 |
^ self |
|
0 | 646 |
]. |
647 |
||
648 |
"move inside - stop autoscroll if any" |
|
649 |
autoScrollBlock notNil ifTrue:[ |
|
59 | 650 |
self stopScrollSelect |
0 | 651 |
]. |
652 |
||
653 |
movedVisibleLine := self visibleLineOfY:y. |
|
654 |
movedLine := self visibleLineToAbsoluteLine:movedVisibleLine. |
|
655 |
(x < leftMargin) ifTrue:[ |
|
59 | 656 |
movedCol := 0 |
0 | 657 |
] ifFalse:[ |
59 | 658 |
movedCol := self colOfX:x inVisibleLine:movedVisibleLine |
0 | 659 |
]. |
660 |
((movedLine == clickLine) and:[movedCol == clickCol]) ifTrue:[^ self]. |
|
661 |
||
662 |
selectionStartLine isNil ifTrue:[ |
|
59 | 663 |
selectionStartLine := clickLine. |
664 |
selectionStartCol := clickCol. |
|
665 |
selectionEndLine := selectionStartLine. |
|
666 |
selectionEndCol := selectionStartCol |
|
0 | 667 |
]. |
668 |
oldStartLine := selectionStartLine. |
|
669 |
oldEndLine := selectionEndLine. |
|
670 |
oldStartCol := selectionStartCol. |
|
671 |
oldEndCol := selectionEndCol. |
|
672 |
||
673 |
||
674 |
"find out if we are before or after initial click" |
|
675 |
movedUp := false. |
|
676 |
(movedLine < clickStartLine) ifTrue:[ |
|
59 | 677 |
movedUp := true |
0 | 678 |
] ifFalse:[ |
59 | 679 |
(movedLine == clickStartLine) ifTrue:[ |
680 |
(movedCol < clickStartCol) ifTrue:[ |
|
681 |
movedUp := true |
|
682 |
] |
|
683 |
] |
|
0 | 684 |
]. |
685 |
||
686 |
movedUp ifTrue:[ |
|
59 | 687 |
"change selectionStart" |
688 |
selectionStartCol := movedCol. |
|
689 |
selectionStartLine := movedLine. |
|
690 |
selectionEndCol := clickStartCol. |
|
691 |
selectionEndLine := clickStartLine. |
|
692 |
selectStyle notNil ifTrue:[ |
|
693 |
selectionEndCol := wordEndCol. |
|
694 |
selectionEndLine := wordEndLine. |
|
695 |
] |
|
0 | 696 |
] ifFalse:[ |
59 | 697 |
"change selectionEnd" |
698 |
selectionEndCol := movedCol. |
|
699 |
selectionEndLine := movedLine. |
|
700 |
selectionStartCol := clickStartCol. |
|
701 |
selectionStartLine := clickStartLine. |
|
702 |
selectStyle notNil ifTrue:[ |
|
703 |
selectionStartCol := wordStartCol. |
|
704 |
selectionStartLine := wordStartLine. |
|
705 |
] |
|
0 | 706 |
]. |
707 |
||
164 | 708 |
selectionStartLine isNil ifTrue:[^ self]. |
709 |
||
0 | 710 |
(selectionStartCol == 0) ifTrue:[ |
59 | 711 |
selectionStartCol := 1 |
0 | 712 |
]. |
713 |
||
38 | 714 |
" |
715 |
if in word-select, just catch the rest of the word |
|
716 |
" |
|
717 |
(selectStyle notNil and:[selectStyle startsWith:'word']) ifTrue:[ |
|
59 | 718 |
movedUp ifTrue:[ |
719 |
selectionStartCol := self findBeginOfWordAtLine:selectionStartLine col:selectionStartCol |
|
720 |
] ifFalse:[ |
|
721 |
selectionEndCol := self findEndOfWordAtLine:selectionEndLine col:selectionEndCol. |
|
722 |
selectionEndCol == 0 ifTrue:[ |
|
723 |
selectionEndLine := selectionEndLine + 1 |
|
724 |
] |
|
725 |
]. |
|
38 | 726 |
]. |
727 |
||
728 |
selectStyle == #line ifTrue:[ |
|
59 | 729 |
movedUp ifTrue:[ |
730 |
selectionStartCol := 1. |
|
731 |
] ifFalse:[ |
|
732 |
selectionEndCol := 0. |
|
733 |
selectionEndLine := selectionEndLine + 1 |
|
734 |
] |
|
38 | 735 |
]. |
736 |
||
209
7a6db7fac566
dont allow multiline selections in EditField
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
737 |
self validateNewSelection. |
7a6db7fac566
dont allow multiline selections in EditField
Claus Gittinger <cg@exept.de>
parents:
186
diff
changeset
|
738 |
|
0 | 739 |
(oldStartLine == selectionStartLine) ifTrue:[ |
59 | 740 |
(oldStartCol ~~ selectionStartCol) ifTrue:[ |
741 |
self redrawLine:oldStartLine |
|
742 |
from:((selectionStartCol min:oldStartCol) max:1) |
|
743 |
to:((selectionStartCol max:oldStartCol) max:1) |
|
744 |
] |
|
0 | 745 |
] ifFalse:[ |
59 | 746 |
self redrawFromLine:(oldStartLine min:selectionStartLine) |
747 |
to:(oldStartLine max:selectionStartLine) |
|
0 | 748 |
]. |
749 |
||
750 |
(oldEndLine == selectionEndLine) ifTrue:[ |
|
59 | 751 |
(oldEndCol ~~ selectionEndCol) ifTrue:[ |
752 |
self redrawLine:oldEndLine |
|
753 |
from:((selectionEndCol min:oldEndCol) max:1) |
|
754 |
to:((selectionEndCol max:oldEndCol) max:1) |
|
755 |
] |
|
0 | 756 |
] ifFalse:[ |
59 | 757 |
self redrawFromLine:(oldEndLine min:selectionEndLine) |
758 |
to:(oldEndLine max:selectionEndLine) |
|
0 | 759 |
]. |
760 |
clickLine := movedLine. |
|
761 |
clickCol := movedCol |
|
762 |
! |
|
763 |
||
248 | 764 |
buttonMultiPress:button x:x y:y |
765 |
"multi-mouse-click - select word under pointer" |
|
766 |
||
767 |
((button == 1) or:[button == #select]) ifTrue:[ |
|
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
768 |
clickCount notNil ifTrue:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
769 |
clickCount := clickCount + 1. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
770 |
(clickCount == 2) ifTrue:[ |
1322
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
771 |
self doubleClickX:x y:y |
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
772 |
] ifFalse:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
773 |
(clickCount == 3) ifTrue:[ |
1322
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
774 |
self tripleClickX:x y:y |
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
775 |
] ifFalse:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
776 |
(clickCount == 4) ifTrue:[ |
1322
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
777 |
self quadClickX:x y:y |
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
778 |
] |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
779 |
] |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
780 |
] |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
781 |
] |
248 | 782 |
] ifFalse:[ |
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
783 |
super buttonMultiPress:button x:x y:y |
248 | 784 |
] |
785 |
||
1322
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
786 |
"Modified: 11.9.1997 / 04:15:35 / cg" |
248 | 787 |
! |
788 |
||
789 |
buttonPress:button x:x y:y |
|
790 |
"mouse-click - prepare for selection change" |
|
791 |
||
1308 | 792 |
|sensor clickVisibleLine| |
793 |
||
794 |
sensor := self sensor. |
|
795 |
(sensor notNil and:[ sensor shiftDown]) ifTrue:[ |
|
813
7168eda47e3b
Display no longer sends buttonShiftPress messages
Claus Gittinger <cg@exept.de>
parents:
770
diff
changeset
|
796 |
"mouse-click with shift - adding to selection" |
7168eda47e3b
Display no longer sends buttonShiftPress messages
Claus Gittinger <cg@exept.de>
parents:
770
diff
changeset
|
797 |
|
7168eda47e3b
Display no longer sends buttonShiftPress messages
Claus Gittinger <cg@exept.de>
parents:
770
diff
changeset
|
798 |
"very simple - just simulate a move" |
7168eda47e3b
Display no longer sends buttonShiftPress messages
Claus Gittinger <cg@exept.de>
parents:
770
diff
changeset
|
799 |
^ self buttonMotion:(device button1MotionMask) x:x y:y |
7168eda47e3b
Display no longer sends buttonShiftPress messages
Claus Gittinger <cg@exept.de>
parents:
770
diff
changeset
|
800 |
]. |
7168eda47e3b
Display no longer sends buttonShiftPress messages
Claus Gittinger <cg@exept.de>
parents:
770
diff
changeset
|
801 |
|
248 | 802 |
((button == 1) or:[button == #select]) ifTrue:[ |
813
7168eda47e3b
Display no longer sends buttonShiftPress messages
Claus Gittinger <cg@exept.de>
parents:
770
diff
changeset
|
803 |
clickVisibleLine := self visibleLineOfY:y. |
7168eda47e3b
Display no longer sends buttonShiftPress messages
Claus Gittinger <cg@exept.de>
parents:
770
diff
changeset
|
804 |
clickCol := self colOfX:x inVisibleLine:clickVisibleLine. |
7168eda47e3b
Display no longer sends buttonShiftPress messages
Claus Gittinger <cg@exept.de>
parents:
770
diff
changeset
|
805 |
clickLine := self visibleLineToAbsoluteLine:clickVisibleLine. |
7168eda47e3b
Display no longer sends buttonShiftPress messages
Claus Gittinger <cg@exept.de>
parents:
770
diff
changeset
|
806 |
clickStartLine := clickLine. |
7168eda47e3b
Display no longer sends buttonShiftPress messages
Claus Gittinger <cg@exept.de>
parents:
770
diff
changeset
|
807 |
clickStartCol := clickCol. |
7168eda47e3b
Display no longer sends buttonShiftPress messages
Claus Gittinger <cg@exept.de>
parents:
770
diff
changeset
|
808 |
self unselect. |
7168eda47e3b
Display no longer sends buttonShiftPress messages
Claus Gittinger <cg@exept.de>
parents:
770
diff
changeset
|
809 |
clickCount := 1 |
248 | 810 |
] ifFalse:[ |
813
7168eda47e3b
Display no longer sends buttonShiftPress messages
Claus Gittinger <cg@exept.de>
parents:
770
diff
changeset
|
811 |
super buttonPress:button x:x y:y |
248 | 812 |
] |
813
7168eda47e3b
Display no longer sends buttonShiftPress messages
Claus Gittinger <cg@exept.de>
parents:
770
diff
changeset
|
813 |
|
1308 | 814 |
"Modified: 19.8.1997 / 17:01:15 / cg" |
248 | 815 |
! |
816 |
||
0 | 817 |
buttonRelease:button x:x y:y |
818 |
"mouse- button release - turn off autoScroll if any" |
|
819 |
||
38 | 820 |
((button == 1) or:[button == #select]) ifTrue:[ |
59 | 821 |
autoScrollBlock notNil ifTrue:[ |
822 |
self stopScrollSelect |
|
823 |
]. |
|
0 | 824 |
] ifFalse:[ |
59 | 825 |
super buttonRelease:button x:x y:y |
0 | 826 |
] |
824
f62922fcfa5d
Send #getListFromModel when setting #model:
Stefan Vogel <sv@exept.de>
parents:
813
diff
changeset
|
827 |
! |
248 | 828 |
|
1322
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
829 |
doubleClickX:x y:y |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
830 |
"double-click - select word under pointer" |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
831 |
|
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
832 |
|sel ch matchCol scanCol fwdScan| |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
833 |
|
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
834 |
ST80Selections == true ifTrue:[ |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
835 |
"/ st80 selects: |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
836 |
"/ if clicked right after a parenthesis -> select to matching parenthesis |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
837 |
"/ if clicked at beginning of the line -> select that line |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
838 |
"/ if clicked at the top of the text -> select all |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
839 |
"/ |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
840 |
clickCol == 1 ifTrue:[ |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
841 |
clickLine == 1 ifTrue:[ |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
842 |
self selectAll. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
843 |
^ self. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
844 |
]. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
845 |
self selectLineAtY:y. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
846 |
selectStyle := #line. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
847 |
^ self |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
848 |
]. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
849 |
|
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
850 |
matchCol := nil. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
851 |
"/ see what is to the left of that character ... |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
852 |
clickCol > 1 ifTrue:[ |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
853 |
ch := self characterAtLine:clickLine col:clickCol-1. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
854 |
('([{<' includes:ch) ifTrue:[ |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
855 |
matchCol := clickCol - 1 |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
856 |
] ifFalse:[ |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
857 |
('"' includes:ch) ifTrue:[ |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
858 |
scanCol := clickCol - 1. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
859 |
fwdScan := true |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
860 |
] |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
861 |
] |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
862 |
]. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
863 |
clickCol < (self listAt:clickLine) size ifTrue:[ |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
864 |
ch := self characterAtLine:clickLine col:clickCol+1. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
865 |
(')]}>' includes:ch) ifTrue:[ |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
866 |
matchCol := clickCol + 1. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
867 |
] ifFalse:[ |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
868 |
('"' includes:ch) ifTrue:[ |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
869 |
scanCol := clickCol + 1. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
870 |
fwdScan := false |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
871 |
] |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
872 |
] |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
873 |
]. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
874 |
matchCol notNil ifTrue:[ |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
875 |
self searchForMatchingParenthesisFromLine:clickLine col:matchCol |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
876 |
ifFound:[:line :col | |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
877 |
self selectFromLine:clickLine col:matchCol |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
878 |
toLine:line col:col. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
879 |
^ self |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
880 |
] |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
881 |
ifNotFound:[self showNotFound] |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
882 |
onError:[self beep]. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
883 |
^ self |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
884 |
]. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
885 |
scanCol notNil ifTrue:[ |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
886 |
"/ if its an EOL comment, do it differently |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
887 |
ch := self characterAtLine:clickLine col:clickCol. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
888 |
ch == $/ ifTrue:[ |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
889 |
self selectFromLine:clickLine col:clickCol+1 toLine:clickLine+1 col:0. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
890 |
^ self |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
891 |
]. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
892 |
|
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
893 |
self scanFor:$" fromLine:clickLine col:scanCol forward:fwdScan |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
894 |
ifFound:[:line :col | |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
895 |
fwdScan ifTrue:[ |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
896 |
self selectFromLine:clickLine col:scanCol+1 |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
897 |
toLine:line col:col-1. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
898 |
] ifFalse:[ |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
899 |
self selectFromLine:clickLine col:scanCol-1 |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
900 |
toLine:line col:col+1. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
901 |
]. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
902 |
^ self |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
903 |
] |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
904 |
ifNotFound:[self showNotFound]. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
905 |
^ self |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
906 |
] |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
907 |
]. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
908 |
|
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
909 |
self selectWordAtX:x y:y. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
910 |
|
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
911 |
" |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
912 |
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
|
913 |
" |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
914 |
((sel := self selection) size == 1 |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
915 |
and:[(sel := sel at:1) size == 1]) ifTrue:[ |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
916 |
ch := sel at:1. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
917 |
('()[]{}<>' includes:ch) ifTrue:[ |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
918 |
self searchForMatchingParenthesisFromLine:selectionStartLine col:selectionStartCol |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
919 |
ifFound:[:line :col | |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
920 |
|prevLine prevCol moveBack pos1| |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
921 |
|
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
922 |
prevLine := firstLineShown. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
923 |
prevCol := leftOffset. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
924 |
self selectFromLine:selectionStartLine col:selectionStartCol |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
925 |
toLine:line col:col. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
926 |
|
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
927 |
self sensor ctrlDown ifFalse:[ |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
928 |
"/ undo scroll operation ... |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
929 |
self withCursor:Cursor eye do:[ |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
930 |
moveBack := false. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
931 |
(')]}>' includes:ch) ifTrue:[ |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
932 |
(firstLineShown ~~ prevLine or:[prevCol ~~ leftOffset]) ifTrue:[ |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
933 |
moveBack := true |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
934 |
] |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
935 |
] ifFalse:[ |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
936 |
selectionEndLine > (firstLineShown + nFullLinesShown) ifTrue:[ |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
937 |
self makeLineVisible:selectionEndLine. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
938 |
moveBack := true |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
939 |
] |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
940 |
]. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
941 |
moveBack ifTrue:[ |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
942 |
pos1 := x@y. |
1332 | 943 |
self invalidateRepairNow:true. |
1322
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
944 |
Delay waitForSeconds:MatchDelayTime. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
945 |
|
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
946 |
[self sensor hasUserEventFor:self] whileFalse:[ |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
947 |
Delay waitForSeconds:MatchDelayTime / 2. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
948 |
]. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
949 |
self scrollToLine:prevLine; scrollToCol:prevCol. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
950 |
]. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
951 |
] |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
952 |
] |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
953 |
] |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
954 |
ifNotFound:[self showNotFound] |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
955 |
onError:[self beep]. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
956 |
selectStyle := nil |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
957 |
] |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
958 |
]. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
959 |
|
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
960 |
" |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
961 |
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
|
962 |
" |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
963 |
wordStartLine := selectionStartLine. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
964 |
wordEndLine := selectionEndLine. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
965 |
selectStyle == #wordLeft ifTrue:[ |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
966 |
wordStartCol := selectionStartCol + 1 |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
967 |
] ifFalse:[ |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
968 |
wordStartCol := selectionStartCol. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
969 |
]. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
970 |
selectStyle == #wordRight ifTrue:[ |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
971 |
wordEndCol := selectionEndCol - 1 |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
972 |
] ifFalse:[ |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
973 |
wordEndCol := selectionEndCol |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
974 |
] |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
975 |
|
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
976 |
"Created: 11.9.1997 / 04:12:55 / cg" |
1332 | 977 |
"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
|
978 |
! |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
979 |
|
248 | 980 |
keyPress:key x:x y:y |
981 |
"handle some keyboard input (there is not much to be done here)" |
|
982 |
||
447
ed41e1bbd9a1
also support goto-default (use selection if any)
Claus Gittinger <cg@exept.de>
parents:
441
diff
changeset
|
983 |
<resource: #keyboard (#Find #Copy #FindNext #FindPrev |
922 | 984 |
#GotoLine #SelectAll #SaveAs #Print |
985 |
#'F*' #'f*' )> |
|
248 | 986 |
|
987 |
(key == #Find) ifTrue:[self search. ^self]. |
|
988 |
(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
|
989 |
(key == #GotoLine) ifTrue:[self gotoLine. ^self]. |
248 | 990 |
|
991 |
(key == #FindNext) ifTrue:[self searchFwd. ^self]. |
|
992 |
(key == #FindPrev) ifTrue:[self searchBwd. ^self]. |
|
993 |
||
994 |
(key == #SelectAll) ifTrue:[self selectAll. ^self]. |
|
995 |
||
614 | 996 |
(key == #SaveAs) ifTrue:[self save. ^self]. |
997 |
(key == #Print) ifTrue:[self doPrint. ^self]. |
|
428
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
411
diff
changeset
|
998 |
|
248 | 999 |
" |
1000 |
shift-Fn defines a key-sequence |
|
1001 |
Fn pastes that sequence |
|
1002 |
cmd-Fn performs a 'doIt' on the sequence (Workspaces only) |
|
1003 |
||
1004 |
(see EditTextView>>keyPress:x:y and Workspace>>keyPress:x:y) |
|
1005 |
" |
|
1193
811135bbd017
Do not crash when typing simple keys.
Stefan Vogel <sv@exept.de>
parents:
1188
diff
changeset
|
1006 |
(key size > 1 and:[(key at:1) asLowercase == $f]) ifTrue:[ |
1177
9d23e1241404
avoid match: if possible (to not clobber the previous matchString)
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
1007 |
(('[fF][0-9]' match:key) |
9d23e1241404
avoid match: if possible (to not clobber the previous matchString)
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
1008 |
or:['[fF][0-9][0-9]' match:key]) ifTrue:[ |
9d23e1241404
avoid match: if possible (to not clobber the previous matchString)
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
1009 |
self sensor shiftDown ifTrue:[ |
9d23e1241404
avoid match: if possible (to not clobber the previous matchString)
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
1010 |
(Smalltalk at:#FunctionKeySequences) isNil ifTrue:[ |
9d23e1241404
avoid match: if possible (to not clobber the previous matchString)
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
1011 |
Smalltalk at:#FunctionKeySequences put:Dictionary new |
9d23e1241404
avoid match: if possible (to not clobber the previous matchString)
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
1012 |
]. |
9d23e1241404
avoid match: if possible (to not clobber the previous matchString)
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
1013 |
(Smalltalk at:#FunctionKeySequences) at:key put:(self selection) |
326
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
309
diff
changeset
|
1014 |
]. |
1177
9d23e1241404
avoid match: if possible (to not clobber the previous matchString)
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
1015 |
^ self |
326
f04c328526c4
use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents:
309
diff
changeset
|
1016 |
]. |
248 | 1017 |
]. |
1018 |
||
1019 |
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
|
1020 |
|
1177
9d23e1241404
avoid match: if possible (to not clobber the previous matchString)
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
1021 |
"Modified: 2.4.1997 / 16:48:26 / cg" |
1193
811135bbd017
Do not crash when typing simple keys.
Stefan Vogel <sv@exept.de>
parents:
1188
diff
changeset
|
1022 |
"Modified: 18.4.1997 / 12:12:27 / stefan" |
248 | 1023 |
! |
1024 |
||
1025 |
mapped |
|
1026 |
super mapped. |
|
1027 |
selectionFgColor := selectionFgColor on:device. |
|
1028 |
selectionBgColor := selectionBgColor on:device. |
|
1322
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1029 |
! |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1030 |
|
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1031 |
quadClickX:x y:y |
1476
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
1032 |
"quadrupleClick-click - select all" |
1322
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1033 |
|
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1034 |
self selectAll |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1035 |
|
1476
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
1036 |
"Created: / 11.9.1997 / 04:15:24 / cg" |
ac38c8af8585
setContents: - keep selection
Claus Gittinger <cg@exept.de>
parents:
1475
diff
changeset
|
1037 |
"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
|
1038 |
! |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1039 |
|
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1040 |
tripleClickX:x y:y |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1041 |
"triple-click - select line under pointer" |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1042 |
|
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1043 |
self selectLineAtY:y. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1044 |
selectStyle := #line |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1045 |
|
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1046 |
"Created: 11.9.1997 / 04:13:37 / cg" |
0 | 1047 |
! ! |
248 | 1048 |
|
1049 |
!TextView methodsFor:'initialize & release'! |
|
1050 |
||
941 | 1051 |
fetchDeviceResources |
1052 |
"fetch device colors, to avoid reallocation at redraw time" |
|
1053 |
||
1054 |
super fetchDeviceResources. |
|
1055 |
||
1056 |
selectionFgColor notNil ifTrue:[selectionFgColor := selectionFgColor on:device]. |
|
1057 |
selectionBgColor notNil ifTrue:[selectionBgColor := selectionBgColor on:device]. |
|
1058 |
||
1059 |
"Created: 14.1.1997 / 00:14:33 / cg" |
|
1060 |
! |
|
1061 |
||
248 | 1062 |
initStyle |
966 | 1063 |
"setup viewStyle specifics" |
1064 |
||
248 | 1065 |
super initStyle. |
1066 |
||
392
81343306d796
eliminated all DefaultFont classVars (are now classINSTvars)
Claus Gittinger <cg@exept.de>
parents:
326
diff
changeset
|
1067 |
"/ DefaultFont notNil ifTrue:[font := DefaultFont on:device]. |
81343306d796
eliminated all DefaultFont classVars (are now classINSTvars)
Claus Gittinger <cg@exept.de>
parents:
326
diff
changeset
|
1068 |
|
248 | 1069 |
viewBackground := DefaultViewBackground. |
1070 |
selectionFgColor := DefaultSelectionForegroundColor. |
|
1071 |
selectionFgColor isNil ifTrue:[selectionFgColor := bgColor]. |
|
1072 |
selectionBgColor := DefaultSelectionBackgroundColor. |
|
1073 |
selectionBgColor isNil ifTrue:[ |
|
708 | 1074 |
device hasColors ifTrue:[ |
1075 |
DefaultSelectionForegroundColor isNil ifTrue:[ |
|
1076 |
selectionFgColor := fgColor |
|
1077 |
]. |
|
1078 |
selectionBgColor := Color green |
|
1079 |
] ifFalse:[ |
|
1080 |
device hasGrayscales ifTrue:[ |
|
1081 |
DefaultSelectionForegroundColor isNil ifTrue:[ |
|
1082 |
selectionFgColor := fgColor |
|
1083 |
]. |
|
1084 |
selectionBgColor := Color grey |
|
1085 |
] ifFalse:[ |
|
1086 |
selectionBgColor := fgColor |
|
1087 |
] |
|
1088 |
] |
|
248 | 1089 |
]. |
708 | 1090 |
|
966 | 1091 |
"Modified: 22.1.1997 / 11:57:53 / cg" |
248 | 1092 |
! |
1093 |
||
1094 |
initialize |
|
1095 |
super initialize. |
|
1096 |
contentsWasSaved := false. |
|
1097 |
||
911 | 1098 |
"I handle menus myself" |
1099 |
menuHolder := menuPerformer := self. |
|
1100 |
||
1101 |
"Modified: 3.1.1997 / 02:14:01 / stefan" |
|
248 | 1102 |
! ! |
1103 |
||
1104 |
!TextView methodsFor:'menu actions'! |
|
1105 |
||
1106 |
appendTo:fileName |
|
1107 |
"append contents to a file named fileName" |
|
1108 |
||
1109 |
|aStream msg| |
|
1110 |
||
1111 |
aStream := FileStream appendingOldFileNamed:fileName. |
|
1112 |
aStream isNil ifTrue:[ |
|
1113 |
msg := resources string:'cannot append to file %1 !!' with:fileName. |
|
1114 |
self warn:(msg , '\\(' , FileStream lastErrorString , ')' ) withCRs |
|
1115 |
] ifFalse:[ |
|
1255
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
1116 |
self |
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
1117 |
fileOutContentsOn:aStream |
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
1118 |
compressTabs:true |
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
1119 |
encoding:externalEncoding. |
248 | 1120 |
aStream close. |
1121 |
contentsWasSaved := true |
|
1122 |
] |
|
1123 |
! |
|
1124 |
||
1125 |
changeFont |
|
1126 |
"pop up a fontPanel to change font" |
|
1127 |
||
411 | 1128 |
|newFont| |
248 | 1129 |
|
411 | 1130 |
newFont := FontPanel fontFromUserInitial:font. |
1131 |
newFont notNil ifTrue:[ |
|
1132 |
self font:newFont. |
|
1133 |
] |
|
1134 |
||
1135 |
"Modified: 27.2.1996 / 00:53:51 / cg" |
|
248 | 1136 |
! |
1137 |
||
1138 |
copySelection |
|
1139 |
"copy contents into smalltalk copybuffer" |
|
1140 |
||
863 | 1141 |
|text| |
248 | 1142 |
|
1143 |
text := self selection. |
|
1144 |
text notNil ifTrue:[ |
|
649
097c69ce9599
forget emphasis in copySelection
Claus Gittinger <cg@exept.de>
parents:
633
diff
changeset
|
1145 |
self unselect. |
097c69ce9599
forget emphasis in copySelection
Claus Gittinger <cg@exept.de>
parents:
633
diff
changeset
|
1146 |
|
863 | 1147 |
"/ forget any emphasis ... |
1148 |
text := text collect:[:l | l isNil ifTrue:[l] ifFalse:[l string]]. |
|
649
097c69ce9599
forget emphasis in copySelection
Claus Gittinger <cg@exept.de>
parents:
633
diff
changeset
|
1149 |
self setTextSelection:text. |
248 | 1150 |
] |
649
097c69ce9599
forget emphasis in copySelection
Claus Gittinger <cg@exept.de>
parents:
633
diff
changeset
|
1151 |
|
097c69ce9599
forget emphasis in copySelection
Claus Gittinger <cg@exept.de>
parents:
633
diff
changeset
|
1152 |
"Modified: 17.5.1996 / 08:57:54 / cg" |
248 | 1153 |
! |
1154 |
||
1155 |
defaultForGotoLine |
|
1156 |
"return a default value to show in the gotoLine box" |
|
1157 |
||
447
ed41e1bbd9a1
also support goto-default (use selection if any)
Claus Gittinger <cg@exept.de>
parents:
441
diff
changeset
|
1158 |
^ selectionStartLine |
ed41e1bbd9a1
also support goto-default (use selection if any)
Claus Gittinger <cg@exept.de>
parents:
441
diff
changeset
|
1159 |
|
ed41e1bbd9a1
also support goto-default (use selection if any)
Claus Gittinger <cg@exept.de>
parents:
441
diff
changeset
|
1160 |
"Modified: 1.3.1996 / 18:44:36 / cg" |
248 | 1161 |
! |
1162 |
||
614 | 1163 |
doPrint |
1164 |
"print the contents on the printer" |
|
1165 |
||
1166 |
|printStream| |
|
1167 |
||
1168 |
list isNil ifTrue:[^ self]. |
|
1169 |
||
829
fd15ef9c598a
show wait cursor while printing
Claus Gittinger <cg@exept.de>
parents:
824
diff
changeset
|
1170 |
self withWaitCursorDo:[ |
fd15ef9c598a
show wait cursor while printing
Claus Gittinger <cg@exept.de>
parents:
824
diff
changeset
|
1171 |
printStream := Printer new. |
fd15ef9c598a
show wait cursor while printing
Claus Gittinger <cg@exept.de>
parents:
824
diff
changeset
|
1172 |
printStream notNil ifTrue:[ |
fd15ef9c598a
show wait cursor while printing
Claus Gittinger <cg@exept.de>
parents:
824
diff
changeset
|
1173 |
Printer writeErrorSignal handle:[:ex | |
fd15ef9c598a
show wait cursor while printing
Claus Gittinger <cg@exept.de>
parents:
824
diff
changeset
|
1174 |
self warn:('error while printing:\\' |
fd15ef9c598a
show wait cursor while printing
Claus Gittinger <cg@exept.de>
parents:
824
diff
changeset
|
1175 |
, ex errorString |
fd15ef9c598a
show wait cursor while printing
Claus Gittinger <cg@exept.de>
parents:
824
diff
changeset
|
1176 |
, '\\(printing with: ' , (Printer printCommand) , ')') withCRs |
fd15ef9c598a
show wait cursor while printing
Claus Gittinger <cg@exept.de>
parents:
824
diff
changeset
|
1177 |
] do:[ |
fd15ef9c598a
show wait cursor while printing
Claus Gittinger <cg@exept.de>
parents:
824
diff
changeset
|
1178 |
self fileOutContentsOn:printStream. |
fd15ef9c598a
show wait cursor while printing
Claus Gittinger <cg@exept.de>
parents:
824
diff
changeset
|
1179 |
]. |
fd15ef9c598a
show wait cursor while printing
Claus Gittinger <cg@exept.de>
parents:
824
diff
changeset
|
1180 |
printStream close |
fd15ef9c598a
show wait cursor while printing
Claus Gittinger <cg@exept.de>
parents:
824
diff
changeset
|
1181 |
] |
fd15ef9c598a
show wait cursor while printing
Claus Gittinger <cg@exept.de>
parents:
824
diff
changeset
|
1182 |
]. |
fd15ef9c598a
show wait cursor while printing
Claus Gittinger <cg@exept.de>
parents:
824
diff
changeset
|
1183 |
|
614 | 1184 |
"Created: 6.5.1996 / 16:11:26 / cg" |
829
fd15ef9c598a
show wait cursor while printing
Claus Gittinger <cg@exept.de>
parents:
824
diff
changeset
|
1185 |
"Modified: 5.9.1996 / 19:18:30 / cg" |
614 | 1186 |
! |
1187 |
||
248 | 1188 |
editMenu |
1109 | 1189 |
"return my popUpMenu" |
1190 |
||
489 | 1191 |
<resource: #keyboard (#Copy #Find #GotoLine #SaveAs #Print)> |
1262
d69149b5be1f
resource flag: #menu -> #programMenu
Claus Gittinger <cg@exept.de>
parents:
1255
diff
changeset
|
1192 |
<resource: #programMenu> |
489 | 1193 |
|
248 | 1194 |
|labels selectors m| |
1195 |
||
1196 |
labels := #( |
|
428
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
411
diff
changeset
|
1197 |
'copy' |
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
411
diff
changeset
|
1198 |
'-' |
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
411
diff
changeset
|
1199 |
'font ...' |
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
411
diff
changeset
|
1200 |
'-' |
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
411
diff
changeset
|
1201 |
'search ...' |
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
411
diff
changeset
|
1202 |
'goto ...' |
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
411
diff
changeset
|
1203 |
'-' |
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
411
diff
changeset
|
1204 |
'save as ...' |
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
411
diff
changeset
|
1205 |
'print' |
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
411
diff
changeset
|
1206 |
). |
248 | 1207 |
|
1208 |
selectors := #( |
|
428
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
411
diff
changeset
|
1209 |
copySelection |
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
411
diff
changeset
|
1210 |
nil |
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
411
diff
changeset
|
1211 |
changeFont |
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
411
diff
changeset
|
1212 |
nil |
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
411
diff
changeset
|
1213 |
search |
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
411
diff
changeset
|
1214 |
gotoLine |
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
411
diff
changeset
|
1215 |
nil |
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
411
diff
changeset
|
1216 |
save |
614 | 1217 |
doPrint |
428
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
411
diff
changeset
|
1218 |
). |
248 | 1219 |
|
1220 |
m := PopUpMenu |
|
428
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
411
diff
changeset
|
1221 |
labels:(resources array:labels) |
489 | 1222 |
selectors:selectors |
1223 |
accelerators:#( |
|
1224 |
#Copy |
|
1225 |
nil |
|
1226 |
nil |
|
731 | 1227 |
nil |
489 | 1228 |
#Find |
1229 |
#GotoLine |
|
1230 |
nil |
|
1231 |
#SaveAs |
|
1232 |
||
1233 |
). |
|
248 | 1234 |
|
1235 |
self hasSelection ifFalse:[ |
|
428
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
411
diff
changeset
|
1236 |
m disable:#copySelection. |
248 | 1237 |
]. |
1238 |
^ m |
|
428
6b0881b0bce1
changes for accelerator-display
Claus Gittinger <cg@exept.de>
parents:
411
diff
changeset
|
1239 |
|
1262
d69149b5be1f
resource flag: #menu -> #programMenu
Claus Gittinger <cg@exept.de>
parents:
1255
diff
changeset
|
1240 |
"Modified: 3.7.1997 / 13:54:09 / cg" |
248 | 1241 |
! |
1242 |
||
1288
19eee9e48131
added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
1243 |
find |
19eee9e48131
added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
1244 |
"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
|
1245 |
|
19eee9e48131
added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
1246 |
self search |
19eee9e48131
added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
1247 |
|
19eee9e48131
added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
1248 |
"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
|
1249 |
! |
19eee9e48131
added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
1250 |
|
248 | 1251 |
gotoLine |
1252 |
"show a box to enter lineNumber for positioning" |
|
1253 |
||
1380 | 1254 |
|l lineNumberBox lineToGo| |
248 | 1255 |
|
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1256 |
lineNumberBox := |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1257 |
EnterBox |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1258 |
title:(resources string:'line number:') |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1259 |
okText:(resources string:'goto') |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1260 |
abortText:(resources string:'cancel') |
1380 | 1261 |
action:[:l | lineToGo := Integer readFromString:l onError:nil]. |
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1262 |
|
248 | 1263 |
l := self defaultForGotoLine. |
1264 |
l notNil ifTrue:[ |
|
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1265 |
l := l printString |
248 | 1266 |
]. |
1267 |
lineNumberBox initialText:l . |
|
1380 | 1268 |
lineNumberBox showAtPointer. |
1269 |
||
1270 |
lineToGo notNil ifTrue:[ |
|
1271 |
self gotoLine:lineToGo |
|
1272 |
]. |
|
1273 |
||
1274 |
"Modified: / 30.10.1997 / 21:40:05 / cg" |
|
248 | 1275 |
! |
1276 |
||
1277 |
save |
|
1278 |
"save contents into a file |
|
1279 |
- ask user for filename using a fileSelectionBox." |
|
1280 |
||
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1281 |
|fileBox| |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1282 |
|
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1283 |
fileBox := FileSaveBox |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1284 |
title:(resources string:'save contents in:') |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1285 |
okText:(resources string:'save') |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1286 |
abortText:(resources string:'cancel') |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1287 |
action:[:fileName | self saveAs:fileName]. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1288 |
fileBox appendAction:[:fileName | self appendTo:fileName]. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1289 |
directoryForFileDialog notNil ifTrue:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1290 |
fileBox directory:directoryForFileDialog |
248 | 1291 |
]. |
1003
b1affa654489
added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents:
997
diff
changeset
|
1292 |
defaultFileNameForFileDialog notNil ifTrue:[ |
b1affa654489
added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents:
997
diff
changeset
|
1293 |
fileBox initialText:defaultFileNameForFileDialog asString |
b1affa654489
added #defaultFileNameForFileDialog
Claus Gittinger <cg@exept.de>
parents:
997
diff
changeset
|
1294 |
]. |
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1295 |
fileBox showAtPointer. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1296 |
|
1188 | 1297 |
directoryForFileDialog := fileBox directory. "/ remember for next time |
1298 |
||
1299 |
fileBox destroy. |
|
1300 |
||
1301 |
"Modified: 16.4.1997 / 20:49:26 / cg" |
|
248 | 1302 |
! |
1303 |
||
1304 |
saveAs:fileName |
|
916
4201c9c2a4f0
show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
1305 |
"save the contents into a file named fileName" |
248 | 1306 |
|
916
4201c9c2a4f0
show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
1307 |
self withCursor:Cursor write do:[ |
4201c9c2a4f0
show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
1308 |
|aStream msg| |
248 | 1309 |
|
1349
09db5ecfb437
catch file errors when saving
Claus Gittinger <cg@exept.de>
parents:
1337
diff
changeset
|
1310 |
FileStream openErrorSignal catch:[ |
09db5ecfb437
catch file errors when saving
Claus Gittinger <cg@exept.de>
parents:
1337
diff
changeset
|
1311 |
aStream := FileStream newFileNamed:fileName. |
09db5ecfb437
catch file errors when saving
Claus Gittinger <cg@exept.de>
parents:
1337
diff
changeset
|
1312 |
]. |
916
4201c9c2a4f0
show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
1313 |
aStream isNil ifTrue:[ |
1359 | 1314 |
msg := resources string:'cannot write file ''%1'' !!' with:fileName. |
916
4201c9c2a4f0
show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
1315 |
self warn:(msg , '\\(' , FileStream lastErrorString , ')' ) withCRs |
4201c9c2a4f0
show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
1316 |
] ifFalse:[ |
1255
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
1317 |
self |
1349
09db5ecfb437
catch file errors when saving
Claus Gittinger <cg@exept.de>
parents:
1337
diff
changeset
|
1318 |
fileOutContentsOn:aStream |
09db5ecfb437
catch file errors when saving
Claus Gittinger <cg@exept.de>
parents:
1337
diff
changeset
|
1319 |
compressTabs:true |
09db5ecfb437
catch file errors when saving
Claus Gittinger <cg@exept.de>
parents:
1337
diff
changeset
|
1320 |
encoding:externalEncoding. |
916
4201c9c2a4f0
show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
1321 |
aStream close. |
4201c9c2a4f0
show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
1322 |
contentsWasSaved := true |
4201c9c2a4f0
show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
1323 |
] |
248 | 1324 |
] |
916
4201c9c2a4f0
show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents:
911
diff
changeset
|
1325 |
|
1359 | 1326 |
"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
|
1327 |
! |
19eee9e48131
added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
1328 |
|
19eee9e48131
added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
1329 |
search |
19eee9e48131
added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
1330 |
"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
|
1331 |
- 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
|
1332 |
|
19eee9e48131
added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
1333 |
" |
19eee9e48131
added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
1334 |
Q: should we preserve the last searchstring between views ? |
19eee9e48131
added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
1335 |
" |
19eee9e48131
added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
1336 |
|
1475
fe86beb9eb07
ok-cursor in search-prev button
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
1337 |
|searchBox patternField stringHolder caseHolder |
fe86beb9eb07
ok-cursor in search-prev button
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
1338 |
b bPrev bNext pattern fwd ign| |
1326 | 1339 |
|
1340 |
ign := lastSearchIgnoredCase ? false. |
|
1341 |
||
1342 |
searchBox := Dialog new. |
|
1334 | 1343 |
searchBox label:'string search'. |
1329 | 1344 |
(searchBox addTextLabel:(resources at:'searchPattern:')) adjust:#left. |
1326 | 1345 |
searchBox addVerticalSpace. |
1346 |
searchBox leftIndent:ViewSpacing; rightIndent:ViewSpacing. |
|
1380 | 1347 |
patternField := searchBox addInputFieldOn:(stringHolder := '' asValue). |
1326 | 1348 |
searchBox addVerticalSpace. |
1349 |
searchBox addCheckBox:(resources string:'ignore case') on:(caseHolder := ign asValue). |
|
1350 |
searchBox addVerticalSpace. |
|
1288
19eee9e48131
added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
1351 |
"/ |
1326 | 1352 |
"/ "soon to come: search & replace box ... |
1353 |
"/ |
|
1354 |
"/ searchBox addLabel:((resources string:'replace with:'). |
|
1355 |
"/ searchBox addInputFieldOn:(replacementHolder := '' asValue). |
|
1288
19eee9e48131
added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
1356 |
"/ searchBox addVerticalSpace. |
1326 | 1357 |
"/ |
1358 |
searchBox addAbortButtonLabelled:(resources at:'cancel'). |
|
1475
fe86beb9eb07
ok-cursor in search-prev button
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
1359 |
|
fe86beb9eb07
ok-cursor in search-prev button
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
1360 |
bPrev := searchBox addButton:(Button label:(resources at:'prev')). |
fe86beb9eb07
ok-cursor in search-prev button
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
1361 |
bPrev action:[fwd := false. searchBox okPressed]. |
fe86beb9eb07
ok-cursor in search-prev button
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
1362 |
bNext := searchBox addOkButtonLabelled:(resources at:'next'). |
fe86beb9eb07
ok-cursor in search-prev button
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
1363 |
bNext action:[fwd := true. "searchBox okPressed"]. |
fe86beb9eb07
ok-cursor in search-prev button
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
1364 |
bPrev cursor:(bNext cursor). |
fe86beb9eb07
ok-cursor in search-prev button
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
1365 |
|
1326 | 1366 |
"/ searchBox addButton:(Button label:(resources at:'all')); |
1367 |
||
1368 |
lastSearchPattern notNil ifTrue:[ |
|
1369 |
stringHolder value:lastSearchPattern |
|
1288
19eee9e48131
added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
1370 |
]. |
19eee9e48131
added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
1371 |
self hasSelection ifTrue:[ |
19eee9e48131
added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
1372 |
selectionStartLine == selectionEndLine ifTrue:[ |
1326 | 1373 |
stringHolder value:self selection |
1374 |
] |
|
1375 |
]. |
|
1380 | 1376 |
patternField selectAll. |
1326 | 1377 |
|
1378 |
searchBox open. |
|
1379 |
||
1380 |
searchBox accepted ifTrue:[ |
|
1381 |
pattern := stringHolder value. |
|
1382 |
pattern := pattern withoutSeparators. "/ is that a good idea ? |
|
1383 |
pattern notEmpty ifTrue:[ |
|
1384 |
ign := caseHolder value. |
|
1385 |
fwd ifFalse:[ |
|
1386 |
self searchBwd:pattern ignoreCase:ign. |
|
1387 |
] ifTrue:[ |
|
1388 |
self searchFwd:pattern ignoreCase:ign. |
|
1389 |
] |
|
1288
19eee9e48131
added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
1390 |
] |
19eee9e48131
added #find (same as #search) to allow VW menus to function.
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
1391 |
]. |
1326 | 1392 |
|
1393 |
"/ searchBox := |
|
1394 |
"/ EnterBox2 |
|
1395 |
"/ title:(resources at:'searchPattern:') |
|
1396 |
"/ okText1:(resources at:'prev') |
|
1397 |
"/ okText2:(resources at:'next') |
|
1398 |
"/ abortText:(resources at:'cancel') |
|
1399 |
"/ action1:[:pattern | pattern notEmpty ifTrue:[self searchBwd:(pattern withoutSeparators)]] |
|
1400 |
"/ action2:[:pattern | pattern notEmpty ifTrue:[self searchFwd:(pattern withoutSeparators)]]. |
|
1401 |
"/ |
|
1402 |
"/ searchPattern notNil ifTrue:[ |
|
1403 |
"/ searchBox initialText:searchPattern |
|
1404 |
"/ ]. |
|
1405 |
"/ self hasSelection ifTrue:[ |
|
1406 |
"/ selectionStartLine == selectionEndLine ifTrue:[ |
|
1407 |
"/ searchBox initialText:self selection |
|
1408 |
"/ ] |
|
1409 |
"/ ]. |
|
1410 |
"/ searchBox showAtPointer |
|
1411 |
||
1475
fe86beb9eb07
ok-cursor in search-prev button
Claus Gittinger <cg@exept.de>
parents:
1454
diff
changeset
|
1412 |
"Modified: / 31.3.1998 / 11:25:32 / cg" |
248 | 1413 |
! ! |
1414 |
||
1415 |
!TextView methodsFor:'private'! |
|
1416 |
||
1417 |
fileOutContentsOn:aStream |
|
1418 |
"save contents on a stream, replacing leading spaces by tab-characters." |
|
1419 |
||
1255
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
1420 |
self |
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
1421 |
fileOutContentsOn:aStream |
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
1422 |
compressTabs:true |
248 | 1423 |
! |
1424 |
||
1425 |
fileOutContentsOn:aStream compressTabs:compressTabs |
|
1426 |
"save contents on a stream. If compressTabs is true, |
|
1427 |
leading spaces will be replaced by tab-characters in the output." |
|
1428 |
||
1255
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
1429 |
self |
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
1430 |
fileOutContentsOn:aStream |
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
1431 |
compressTabs:compressTabs |
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
1432 |
encoding:nil |
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
1433 |
! |
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
1434 |
|
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
1435 |
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
|
1436 |
"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
|
1437 |
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
|
1438 |
|
248 | 1439 |
|startNr nLines string| |
1440 |
||
758 | 1441 |
aStream isFileStream ifTrue:[ |
1442 |
"on some systems, writing linewise is very slow (via NFS) |
|
1443 |
therefore we convert to a string and write it in big chunks. |
|
1444 |
To avoid creating huge strings, we do it in blocks of 1000 lines, |
|
1445 |
limiting temporary string creation to about 50-80k. |
|
1446 |
" |
|
1447 |
startNr := 1. |
|
1448 |
nLines := list size. |
|
1449 |
[startNr <= nLines] whileTrue:[ |
|
1450 |
string := list asStringWithCRsFrom:startNr |
|
1451 |
to:((startNr + 1000) min:nLines) |
|
1452 |
compressTabs:compressTabs. |
|
1255
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
1453 |
encodingSymOrNil notNil ifTrue:[ |
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
1454 |
string := string encodeInto:encodingSymOrNil |
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
1455 |
]. |
758 | 1456 |
aStream nextPutAll:string. |
1457 |
startNr := startNr + 1000 + 1. |
|
1458 |
]. |
|
1459 |
] ifFalse:[ |
|
1460 |
list do:[:aLine | |
|
1461 |
aLine notNil ifTrue:[ |
|
1255
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
1462 |
encodingSymOrNil notNil ifTrue:[ |
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
1463 |
aStream nextPutLine:(aLine encodeInto:encodingSymOrNil) |
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
1464 |
] ifFalse:[ |
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
1465 |
aStream nextPutLine:aLine. |
c1bf6a3dbb78
allow the encoding for save/saveAs to be specified.
Claus Gittinger <cg@exept.de>
parents:
1195
diff
changeset
|
1466 |
] |
758 | 1467 |
]. |
1468 |
] |
|
1469 |
] |
|
248 | 1470 |
|
758 | 1471 |
"Modified: 8.6.1996 / 11:50:46 / cg" |
248 | 1472 |
! |
1473 |
||
668
729295eb37fc
use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1474 |
getFontParameters |
729295eb37fc
use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1475 |
"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
|
1476 |
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
|
1477 |
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
|
1478 |
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
|
1479 |
|
729295eb37fc
use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1480 |
font := font on:device. |
729295eb37fc
use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1481 |
includesNonStrings == true ifTrue:[ |
729295eb37fc
use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1482 |
"/ for now, we do not support variable height entries ... |
729295eb37fc
use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1483 |
fontHeight := list first heightOn:self |
729295eb37fc
use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1484 |
] ifFalse:[ |
729295eb37fc
use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1485 |
fontHeight := font maxHeight. |
729295eb37fc
use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1486 |
]. |
729295eb37fc
use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1487 |
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
|
1488 |
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
|
1489 |
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
|
1490 |
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
|
1491 |
|
729295eb37fc
use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1492 |
"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
|
1493 |
"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
|
1494 |
! |
729295eb37fc
use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1495 |
|
248 | 1496 |
scrollSelectDown |
1497 |
"auto scroll action; scroll and reinstall timed-block" |
|
1498 |
||
1499 |
|prevEndLine| |
|
1500 |
||
1501 |
"just to make certain ..." |
|
1502 |
selectionEndLine isNil ifTrue:[^ self]. |
|
1503 |
||
1504 |
self scrollDown. |
|
1505 |
||
1506 |
"make new selection immediately visible" |
|
1507 |
prevEndLine := selectionEndLine. |
|
1508 |
selectionEndLine := firstLineShown + nFullLinesShown. |
|
1509 |
selectionEndCol := 0. |
|
1510 |
prevEndLine to:selectionEndLine do:[:lineNr | |
|
1511 |
self redrawLine:lineNr |
|
1512 |
]. |
|
1513 |
Processor addTimedBlock:autoScrollBlock afterSeconds:autoScrollDeltaT. |
|
1514 |
! |
|
1515 |
||
1516 |
scrollSelectLeft |
|
1517 |
"auto scroll action; scroll and reinstall timed-block" |
|
1518 |
||
1519 |
|prevStartLine| |
|
1520 |
||
1521 |
"just to make certain ..." |
|
1522 |
selectionStartLine isNil ifTrue:[^ self]. |
|
1523 |
selectionStartCol isNil ifTrue:[^ self]. |
|
1524 |
||
1525 |
"make new selection immediately visible" |
|
1526 |
prevStartLine := selectionStartLine. |
|
1527 |
selectionStartCol := selectionStartCol - 1 max:1. |
|
1528 |
self scrollLeft. |
|
1529 |
||
1530 |
Processor addTimedBlock:autoScrollBlock afterSeconds:autoScrollDeltaT. |
|
1531 |
! |
|
1532 |
||
1533 |
scrollSelectRight |
|
1534 |
"auto scroll action; scroll and reinstall timed-block" |
|
1535 |
||
1536 |
|prevEndCol| |
|
1537 |
||
1538 |
"just to make certain ..." |
|
1539 |
selectionEndCol isNil ifTrue:[^ self]. |
|
1540 |
||
1541 |
prevEndCol := selectionEndCol. |
|
1542 |
selectionEndCol := selectionEndCol + 1. |
|
1543 |
self scrollRight. |
|
1544 |
||
1545 |
Processor addTimedBlock:autoScrollBlock afterSeconds:autoScrollDeltaT. |
|
1546 |
! |
|
1547 |
||
1548 |
scrollSelectUp |
|
1549 |
"auto scroll action; scroll and reinstall timed-block" |
|
1550 |
||
1551 |
|prevStartLine| |
|
1552 |
||
1553 |
"just to make certain ..." |
|
1554 |
selectionStartLine isNil ifTrue:[^ self]. |
|
1555 |
||
1556 |
self scrollUp. |
|
1557 |
||
1558 |
"make new selection immediately visible" |
|
1559 |
prevStartLine := selectionStartLine. |
|
1560 |
selectionStartLine := firstLineShown. |
|
1561 |
selectionStartCol := 1. |
|
1562 |
selectionStartLine to:prevStartLine do:[:lineNr | |
|
1563 |
self redrawLine:lineNr |
|
1564 |
]. |
|
1565 |
Processor addTimedBlock:autoScrollBlock afterSeconds:autoScrollDeltaT. |
|
1566 |
! |
|
1567 |
||
1568 |
stopScrollSelect |
|
1569 |
"stop auto scroll; deinstall timed-block" |
|
1570 |
||
1571 |
autoScrollBlock notNil ifTrue:[ |
|
1572 |
Processor removeTimedBlock:autoScrollBlock. |
|
1573 |
self compressMotionEvents:true. |
|
1574 |
autoScrollBlock := nil. |
|
1575 |
autoScrollDeltaT := nil |
|
1576 |
] |
|
1577 |
! |
|
1578 |
||
1579 |
widthForScrollBetween:firstLine and:lastLine |
|
1580 |
"return the width in pixels for a scroll between firstLine and lastLine" |
|
1581 |
||
1582 |
selectionStartLine notNil ifTrue:[ |
|
1583 |
(lastLine < selectionStartLine) ifFalse:[ |
|
1584 |
(firstLine > selectionEndLine) ifFalse:[ |
|
1585 |
^ width |
|
1586 |
] |
|
1587 |
] |
|
1588 |
]. |
|
1589 |
^ super widthForScrollBetween:firstLine and:lastLine |
|
1590 |
! ! |
|
1591 |
||
997 | 1592 |
!TextView methodsFor:'queries'! |
1593 |
||
1594 |
specClass |
|
1380 | 1595 |
"redefined, since the name of my specClass is nonStandard (i.e. not TextViewSpec)" |
1596 |
||
997 | 1597 |
self class == TextView ifTrue:[^ TextEditorSpec]. |
1046 | 1598 |
^ super specClass |
997 | 1599 |
|
1380 | 1600 |
"Modified: / 31.10.1997 / 19:48:35 / cg" |
997 | 1601 |
! ! |
1602 |
||
248 | 1603 |
!TextView methodsFor:'redrawing'! |
1604 |
||
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1605 |
clearMarginOfVisibleLine:visLine with:color |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1606 |
"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
|
1607 |
|
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1608 |
(leftMargin ~~ 0) ifTrue:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1609 |
self paint:color. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1610 |
self fillRectangleX:margin |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1611 |
y:(self yOfVisibleLine:visLine) |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1612 |
width:leftMargin |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1613 |
height:fontHeight |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1614 |
] |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1615 |
|
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1616 |
"Created: 6.3.1996 / 14:22:55 / cg" |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1617 |
! |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1618 |
|
248 | 1619 |
redrawFromVisibleLine:startVisLineNr to:endVisLineNr |
1620 |
"redraw a visible line range" |
|
1621 |
||
1622 |
|startLine endLine specialCare end selVisStart line1 line2| |
|
1623 |
||
1624 |
shown ifFalse:[^ self]. |
|
1625 |
||
1626 |
end := endVisLineNr. |
|
1627 |
(end > nLinesShown) ifTrue:[ |
|
1628 |
end := nLinesShown |
|
1629 |
]. |
|
1630 |
||
1631 |
selectionStartLine isNil ifTrue:[ |
|
1632 |
specialCare := false |
|
1633 |
] ifFalse:[ |
|
1634 |
startLine := self visibleLineToAbsoluteLine:startVisLineNr. |
|
1635 |
(startLine > selectionEndLine) ifTrue:[ |
|
1636 |
specialCare := false |
|
1637 |
] ifFalse:[ |
|
1638 |
endLine := self visibleLineToAbsoluteLine:end. |
|
1639 |
(endLine < selectionStartLine) ifTrue:[ |
|
1640 |
specialCare := false |
|
1641 |
] ifFalse:[ |
|
1642 |
specialCare := true |
|
1643 |
] |
|
1644 |
] |
|
1645 |
]. |
|
1646 |
||
1647 |
"easy: nothing is selected" |
|
1648 |
specialCare ifFalse:[ |
|
1649 |
super redrawFromVisibleLine:startVisLineNr to:end. |
|
1650 |
^ self |
|
1651 |
]. |
|
1652 |
||
1653 |
"easy: all is selected" |
|
1654 |
((selectionStartLine < startLine) and:[selectionEndLine > endLine]) ifTrue:[ |
|
1655 |
self drawFromVisibleLine:startVisLineNr to:end with:selectionFgColor |
|
1656 |
and:selectionBgColor. |
|
1657 |
^ self |
|
1658 |
]. |
|
1659 |
||
1660 |
(selectionStartLine >= firstLineShown) ifTrue:[ |
|
1661 |
"draw unselected top part" |
|
1662 |
||
1663 |
selVisStart := self listLineToVisibleLine:selectionStartLine. |
|
1664 |
super redrawFromVisibleLine:startVisLineNr to:(selVisStart - 1). |
|
1665 |
||
1666 |
"and first partial selected line" |
|
1667 |
self redrawVisibleLine:selVisStart. |
|
1668 |
||
1669 |
"rest starts after this one" |
|
1670 |
line1 := selVisStart + 1 |
|
1671 |
] ifFalse:[ |
|
1672 |
line1 := 1 |
|
1673 |
]. |
|
1674 |
||
1675 |
(line1 > end) ifTrue:[^ self]. |
|
1676 |
(line1 < startVisLineNr) ifTrue:[ |
|
1677 |
line1 := startVisLineNr |
|
1678 |
]. |
|
1679 |
||
1680 |
"draw middle part of selection" |
|
1681 |
||
1682 |
(selectionEndLine >= (firstLineShown + nLinesShown)) ifTrue:[ |
|
1683 |
line2 := nLinesShown |
|
1684 |
] ifFalse:[ |
|
1685 |
line2 := (self listLineToVisibleLine:selectionEndLine) - 1 |
|
1686 |
]. |
|
1687 |
(line2 > end) ifTrue:[ |
|
1688 |
line2 := end |
|
1689 |
]. |
|
1690 |
||
1691 |
self drawFromVisibleLine:line1 to:line2 with:selectionFgColor |
|
1692 |
and:selectionBgColor. |
|
1693 |
||
1694 |
(line2 >= end) ifTrue:[^ self]. |
|
1695 |
||
1696 |
"last line of selection" |
|
1697 |
self redrawVisibleLine:(line2 + 1). |
|
1698 |
||
1699 |
((line2 + 2) <= end) ifTrue:[ |
|
1700 |
super redrawFromVisibleLine:(line2 + 2) to:end |
|
1701 |
] |
|
1702 |
! |
|
1703 |
||
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1704 |
redrawMarginOfVisibleLine:visLine |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1705 |
"draw margin - a helper for selection drawing" |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1706 |
|
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1707 |
|
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1708 |
(leftMargin ~~ 0) ifTrue:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1709 |
] |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1710 |
|
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1711 |
"Created: 6.3.1996 / 14:21:48 / cg" |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1712 |
! |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1713 |
|
248 | 1714 |
redrawVisibleLine:visLine |
1715 |
"redraw visible line lineNr" |
|
1716 |
||
1717 |
|len line l| |
|
1718 |
||
1719 |
selectionStartLine notNil ifTrue:[ |
|
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1720 |
line := self visibleLineToAbsoluteLine:visLine. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1721 |
(line between:selectionStartLine and:selectionEndLine) ifTrue:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1722 |
(line == selectionStartLine) ifTrue:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1723 |
(line == selectionEndLine) ifTrue:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1724 |
"its part-of-single-line selection" |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1725 |
self clearMarginOfVisibleLine:visLine with:bgColor. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1726 |
(selectionStartCol > 1) ifTrue:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1727 |
super redrawVisibleLine:visLine |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1728 |
from:1 |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1729 |
to:(selectionStartCol - 1) |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1730 |
]. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1731 |
self drawVisibleLine:visLine from:selectionStartCol |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1732 |
to:selectionEndCol |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1733 |
with:selectionFgColor |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1734 |
and:selectionBgColor. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1735 |
super redrawVisibleLine:visLine |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1736 |
from:(selectionEndCol + 1). |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1737 |
^ self |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1738 |
]. |
248 | 1739 |
|
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1740 |
"its the first line of a multi-line selection" |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1741 |
(selectionStartCol ~~ 1) ifTrue:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1742 |
self clearMarginOfVisibleLine:visLine with:bgColor. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1743 |
super redrawVisibleLine:visLine |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1744 |
from:1 |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1745 |
to:(selectionStartCol - 1) |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1746 |
] ifFalse:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1747 |
leftOffset == 0 ifTrue:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1748 |
self clearMarginOfVisibleLine:visLine with:selectionBgColor. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1749 |
] |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1750 |
]. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1751 |
self drawVisibleLine:visLine from:selectionStartCol |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1752 |
with:selectionFgColor and:selectionBgColor. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1753 |
^ self |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1754 |
]. |
248 | 1755 |
|
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1756 |
(line == selectionEndLine) ifTrue:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1757 |
"its the last line of a multi-line selection" |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1758 |
(selectionEndCol == 0) ifTrue:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1759 |
^ super redrawVisibleLine:visLine |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1760 |
]. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1761 |
l := self visibleAt:selectionEndLine. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1762 |
len := l size. |
248 | 1763 |
|
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1764 |
self clearMarginOfVisibleLine:visLine with:selectionBgColor. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1765 |
self drawVisibleLine:visLine from:1 to:selectionEndCol |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1766 |
with:selectionFgColor and:selectionBgColor. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1767 |
super redrawVisibleLine:visLine from:(selectionEndCol + 1). |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1768 |
^ self |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1769 |
]. |
248 | 1770 |
|
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1771 |
"its a full line in a multi-line selection" |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1772 |
self clearMarginOfVisibleLine:visLine with:selectionBgColor. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1773 |
self drawVisibleLine:visLine with:selectionFgColor and:selectionBgColor. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1774 |
^ self |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1775 |
] |
248 | 1776 |
]. |
1777 |
super redrawVisibleLine:visLine |
|
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1778 |
|
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1779 |
"Modified: 6.3.1996 / 14:22:19 / cg" |
248 | 1780 |
! |
1781 |
||
1782 |
redrawVisibleLine:visLine col:col |
|
633 | 1783 |
"redraw single character at col in visible line lineNr." |
248 | 1784 |
|
633 | 1785 |
|line fg bg| |
248 | 1786 |
|
1787 |
line := self visibleLineToAbsoluteLine:visLine. |
|
633 | 1788 |
|
1789 |
"/ |
|
1790 |
"/ care for selection |
|
1791 |
"/ |
|
1792 |
fg := fgColor. |
|
1793 |
bg := bgColor. |
|
1794 |
||
248 | 1795 |
selectionStartLine notNil ifTrue:[ |
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1796 |
(line between:selectionStartLine and:selectionEndLine) ifTrue:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1797 |
((line == selectionStartLine) |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1798 |
and: [col < selectionStartCol]) ifFalse:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1799 |
((line == selectionEndLine) |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1800 |
and: [col > selectionEndCol]) ifFalse:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1801 |
"its in the selection" |
633 | 1802 |
fg := selectionFgColor. |
1803 |
bg := selectionBgColor. |
|
1804 |
||
1805 |
"/ self |
|
1806 |
"/ drawVisibleLine:visLine |
|
1807 |
"/ col:col |
|
1808 |
"/ with:selectionFgColor |
|
1809 |
"/ and:selectionBgColor. |
|
1810 |
"/ ^ self |
|
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1811 |
] |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1812 |
] |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1813 |
] |
248 | 1814 |
]. |
633 | 1815 |
self drawVisibleLine:visLine col:col with:fg and:bg |
1816 |
"/ super redrawVisibleLine:visLine col:col |
|
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1817 |
|
633 | 1818 |
"Modified: 12.5.1996 / 17:46:51 / cg" |
248 | 1819 |
! |
1820 |
||
1821 |
redrawVisibleLine:visLine from:startCol |
|
1822 |
"redraw visible line lineNr from startCol to end of line" |
|
1823 |
||
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1824 |
|col line| |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1825 |
|
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1826 |
col := startCol. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1827 |
col == 0 ifTrue:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1828 |
col := 1. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1829 |
]. |
248 | 1830 |
|
1831 |
line := self visibleLineToAbsoluteLine:visLine. |
|
1832 |
selectionStartLine notNil ifTrue:[ |
|
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1833 |
(line between:selectionStartLine and:selectionEndLine) ifTrue:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1834 |
((line == selectionStartLine) |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1835 |
or:[line == selectionEndLine]) ifTrue:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1836 |
"since I'm lazy, redraw full line" |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1837 |
self redrawVisibleLine:visLine. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1838 |
^ self |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1839 |
]. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1840 |
"the line is fully within the selection" |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1841 |
self |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1842 |
drawVisibleLine:visLine |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1843 |
from:col |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1844 |
with:selectionFgColor |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1845 |
and:selectionBgColor. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1846 |
^ self |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1847 |
] |
248 | 1848 |
]. |
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1849 |
super redrawVisibleLine:visLine from:col |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1850 |
|
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1851 |
"Modified: 6.3.1996 / 14:19:38 / cg" |
248 | 1852 |
! |
1853 |
||
1854 |
redrawVisibleLine:visLine from:startCol to:endCol |
|
1855 |
"redraw visible line lineNr from startCol to endCol" |
|
1856 |
||
1857 |
|line allOut allIn leftCol rightCol| |
|
1858 |
||
1859 |
line := self visibleLineToAbsoluteLine:visLine. |
|
1860 |
||
1861 |
allIn := false. |
|
1862 |
allOut := false. |
|
1863 |
selectionStartLine isNil ifTrue:[ |
|
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1864 |
allOut := true |
248 | 1865 |
] ifFalse:[ |
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1866 |
(line between:selectionStartLine and:selectionEndLine) ifFalse:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1867 |
allOut := true |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1868 |
] ifTrue:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1869 |
(selectionStartLine == selectionEndLine) ifTrue:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1870 |
((endCol < selectionStartCol) |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1871 |
or:[startCol > selectionEndCol]) ifTrue:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1872 |
allOut := true |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1873 |
] ifFalse:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1874 |
((startCol >= selectionStartCol) |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1875 |
and:[endCol <= selectionEndCol]) ifTrue:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1876 |
allIn := true |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1877 |
] |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1878 |
] |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1879 |
] ifFalse:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1880 |
(line == selectionStartLine) ifTrue:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1881 |
(endCol < selectionStartCol) ifTrue:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1882 |
allOut := true |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1883 |
] ifFalse:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1884 |
(startCol >= selectionStartCol) ifTrue:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1885 |
allIn := true |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1886 |
] |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1887 |
] |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1888 |
] ifFalse:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1889 |
(line == selectionEndLine) ifTrue:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1890 |
(startCol > selectionEndCol) ifTrue:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1891 |
allOut := true |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1892 |
] ifFalse:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1893 |
(endCol <= selectionEndCol) ifTrue:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1894 |
allIn := true |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1895 |
] |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1896 |
] |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1897 |
] ifFalse:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1898 |
allIn := true |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1899 |
] |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1900 |
] |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1901 |
] |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1902 |
] |
248 | 1903 |
]. |
1904 |
allOut ifTrue:[ |
|
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1905 |
super redrawVisibleLine:visLine from:startCol to:endCol. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1906 |
^ self |
248 | 1907 |
]. |
1908 |
||
1909 |
allIn ifTrue:[ |
|
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1910 |
self drawVisibleLine:visLine from:startCol to:endCol |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1911 |
with:selectionFgColor and:selectionBgColor |
248 | 1912 |
] ifFalse:[ |
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1913 |
"redraw part before selection" |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1914 |
((line == selectionStartLine) |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1915 |
and:[startCol <= selectionStartCol]) ifTrue:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1916 |
super redrawVisibleLine:visLine from:startCol |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1917 |
to:(selectionStartCol - 1). |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1918 |
leftCol := selectionStartCol |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1919 |
] ifFalse:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1920 |
leftCol := startCol |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1921 |
]. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1922 |
"redraw selected part" |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1923 |
(selectionEndLine > line) ifTrue:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1924 |
rightCol := endCol |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1925 |
] ifFalse:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1926 |
rightCol := selectionEndCol min:endCol |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1927 |
]. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1928 |
self drawVisibleLine:visLine from:leftCol to:rightCol |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1929 |
with:selectionFgColor and:selectionBgColor. |
248 | 1930 |
|
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1931 |
"redraw part after selection" |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1932 |
(rightCol < endCol) ifTrue:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1933 |
super redrawVisibleLine:visLine from:(rightCol + 1) to:endCol |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1934 |
] |
248 | 1935 |
]. |
1936 |
||
1937 |
"special care for first and last line of selection: |
|
1938 |
must handle margin also" |
|
1939 |
||
1940 |
((line == selectionEndLine) |
|
1941 |
and:[(startCol == 1) |
|
1942 |
and:[selectionStartLine < selectionEndLine]]) |
|
1943 |
ifTrue:[ |
|
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1944 |
self clearMarginOfVisibleLine:visLine with:selectionBgColor. |
248 | 1945 |
]. |
1946 |
||
1947 |
((line == selectionStartLine) |
|
1948 |
and:[(startCol == 1) |
|
1949 |
and:[selectionStartLine < selectionEndLine]]) |
|
1950 |
ifTrue:[ |
|
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1951 |
self clearMarginOfVisibleLine:visLine with:bgColor. |
248 | 1952 |
] |
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1953 |
|
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
1954 |
"Modified: 6.3.1996 / 14:23:26 / cg" |
248 | 1955 |
! ! |
1956 |
||
1957 |
!TextView methodsFor:'searching'! |
|
1958 |
||
1322
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1959 |
scanFor:aCharacter fromLine:startLine col:startCol forward:forward |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1960 |
ifFound:foundBlock |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1961 |
ifNotFound:notFoundBlock |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1962 |
"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
|
1963 |
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
|
1964 |
|
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1965 |
|i lineString |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1966 |
line "{ Class: SmallInteger }" |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1967 |
col "{ Class: SmallInteger }" |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1968 |
delta "{ Class: SmallInteger }" |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1969 |
endCol "{ Class: SmallInteger }" |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1970 |
cc |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1971 |
maxLine "{ Class: SmallInteger }" |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1972 |
| |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1973 |
|
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1974 |
col := startCol. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1975 |
line := startLine. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1976 |
forward ifTrue:[ |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1977 |
delta := 1. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1978 |
] ifFalse:[ |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1979 |
delta := -1. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1980 |
]. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1981 |
|
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1982 |
lineString := list at:line. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1983 |
maxLine := list size. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1984 |
|
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1985 |
col := col + delta. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1986 |
[true] whileTrue:[ |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1987 |
lineString notNil ifTrue:[ |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1988 |
forward ifTrue:[ |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1989 |
endCol := lineString size. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1990 |
] ifFalse:[ |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1991 |
endCol := 1 |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1992 |
]. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1993 |
|
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1994 |
col to:endCol by:delta do:[:rCol | |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1995 |
cc := lineString at:rCol. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1996 |
cc == aCharacter ifTrue:[ |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1997 |
^ foundBlock value:line value:rCol. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1998 |
] |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
1999 |
]. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
2000 |
]. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
2001 |
line := line + delta. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
2002 |
(line < 1 or:[line > maxLine]) ifTrue:[ |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
2003 |
^ notFoundBlock value |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
2004 |
]. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
2005 |
lineString := list at:line. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
2006 |
forward ifTrue:[ |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
2007 |
col := 1 |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
2008 |
] ifFalse:[ |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
2009 |
col := lineString size |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
2010 |
] |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
2011 |
]. |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
2012 |
"not reached" |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
2013 |
|
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
2014 |
"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
|
2015 |
"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
|
2016 |
! |
b4ffcad003a7
support ST-80 style doubleClicking (enable in styleSheet)
Claus Gittinger <cg@exept.de>
parents:
1308
diff
changeset
|
2017 |
|
248 | 2018 |
searchBwd |
2019 |
"search backward and -if found- position cursor" |
|
2020 |
||
1353 | 2021 |
|ign| |
2022 |
||
2023 |
ign := lastSearchIgnoredCase ? false. |
|
2024 |
||
248 | 2025 |
self setSearchPattern. |
1326 | 2026 |
lastSearchPattern notNil ifTrue:[ |
1353 | 2027 |
self |
2028 |
searchBwd:lastSearchPattern |
|
2029 |
ignoreCase:ign |
|
248 | 2030 |
] |
1326 | 2031 |
|
2032 |
"Modified: 13.9.1997 / 06:24:35 / cg" |
|
248 | 2033 |
! |
2034 |
||
2035 |
searchBwd:pattern |
|
2036 |
"do a backward search" |
|
2037 |
||
2038 |
self searchBwd:pattern ifAbsent:[self showNotFound]. |
|
1326 | 2039 |
lastSearchIgnoredCase := false. |
2040 |
lastSearchPattern := pattern |
|
2041 |
||
2042 |
"Modified: 13.9.1997 / 06:20:27 / cg" |
|
248 | 2043 |
! |
2044 |
||
2045 |
searchBwd:pattern ifAbsent:aBlock |
|
2046 |
"do a backward search" |
|
2047 |
||
2048 |
|startLine startCol| |
|
2049 |
||
2050 |
selectionStartLine notNil ifTrue:[ |
|
1326 | 2051 |
startLine := selectionStartLine. |
2052 |
startCol := selectionStartCol |
|
248 | 2053 |
] ifFalse:[ |
1326 | 2054 |
startLine := 1. |
2055 |
startCol := 1 |
|
248 | 2056 |
]. |
1326 | 2057 |
self |
2058 |
searchBackwardFor:pattern startingAtLine:startLine col:startCol |
|
2059 |
ifFound:[:line :col | self showMatch:pattern atLine:line col:col] |
|
2060 |
ifAbsent:aBlock |
|
2061 |
||
2062 |
"Modified: 13.9.1997 / 01:05:49 / cg" |
|
2063 |
! |
|
2064 |
||
2065 |
searchBwd:pattern ignoreCase:ign |
|
2066 |
"do a backward search" |
|
2067 |
||
2068 |
self searchBwd:pattern ignoreCase:ign ifAbsent:[self showNotFound]. |
|
2069 |
lastSearchIgnoredCase := ign. |
|
2070 |
lastSearchPattern := pattern |
|
2071 |
||
2072 |
"Created: 13.9.1997 / 06:18:00 / cg" |
|
2073 |
"Modified: 13.9.1997 / 06:20:33 / cg" |
|
2074 |
! |
|
2075 |
||
2076 |
searchBwd:pattern ignoreCase:ign ifAbsent:aBlock |
|
2077 |
"do a backward search" |
|
2078 |
||
2079 |
|startLine startCol| |
|
2080 |
||
2081 |
selectionStartLine notNil ifTrue:[ |
|
2082 |
startLine := selectionStartLine. |
|
2083 |
startCol := selectionStartCol |
|
2084 |
] ifFalse:[ |
|
2085 |
startLine := 1. |
|
2086 |
startCol := 1 |
|
2087 |
]. |
|
2088 |
self |
|
2089 |
searchBackwardFor:pattern |
|
2090 |
ignoreCase:ign |
|
2091 |
startingAtLine:startLine col:startCol |
|
2092 |
ifFound:[:line :col | self showMatch:pattern atLine:line col:col] |
|
2093 |
ifAbsent:aBlock |
|
2094 |
||
2095 |
"Modified: 13.9.1997 / 01:05:49 / cg" |
|
2096 |
"Created: 13.9.1997 / 06:18:41 / cg" |
|
248 | 2097 |
! |
2098 |
||
2099 |
searchForMatchingParenthesisFromLine:startLine col:startCol |
|
651
1e7153e21b36
skip character consts in match parent
Claus Gittinger <cg@exept.de>
parents:
649
diff
changeset
|
2100 |
ifFound:foundBlock |
1e7153e21b36
skip character consts in match parent
Claus Gittinger <cg@exept.de>
parents:
649
diff
changeset
|
2101 |
ifNotFound:notFoundBlock |
1e7153e21b36
skip character consts in match parent
Claus Gittinger <cg@exept.de>
parents:
649
diff
changeset
|
2102 |
onError:failBlock |
248 | 2103 |
|
2104 |
"search for a matching parenthesis, parChar is one of '$( $[ ${ $) $] $}'. |
|
2105 |
Search for the corresponding character is done forward if its an opening, |
|
2106 |
backwards if its a closing parenthesis. |
|
2107 |
Performs foundBlock with line/col as argument if found, notFoundBlock if not. |
|
2108 |
If there is a nesting error, performs failBlock." |
|
2109 |
||
2110 |
^ self |
|
651
1e7153e21b36
skip character consts in match parent
Claus Gittinger <cg@exept.de>
parents:
649
diff
changeset
|
2111 |
searchForMatchingParenthesisFromLine:startLine col:startCol |
1e7153e21b36
skip character consts in match parent
Claus Gittinger <cg@exept.de>
parents:
649
diff
changeset
|
2112 |
ifFound:foundBlock |
1e7153e21b36
skip character consts in match parent
Claus Gittinger <cg@exept.de>
parents:
649
diff
changeset
|
2113 |
ifNotFound:notFoundBlock |
1e7153e21b36
skip character consts in match parent
Claus Gittinger <cg@exept.de>
parents:
649
diff
changeset
|
2114 |
onError:failBlock |
1e7153e21b36
skip character consts in match parent
Claus Gittinger <cg@exept.de>
parents:
649
diff
changeset
|
2115 |
ignoring:#( $' $" '$[' '$]' '${' '$)' ) |
248 | 2116 |
|
651
1e7153e21b36
skip character consts in match parent
Claus Gittinger <cg@exept.de>
parents:
649
diff
changeset
|
2117 |
"Modified: 18.5.1996 / 11:05:57 / cg" |
248 | 2118 |
! |
2119 |
||
2120 |
searchForMatchingParenthesisFromLine:startLine col:startCol |
|
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2121 |
ifFound:foundBlock |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2122 |
ifNotFound:notFoundBlock |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2123 |
onError:failBlock |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2124 |
ignoring:ignoreSet |
248 | 2125 |
"search for a matching parenthesis, parChar is one of '$( $[ ${ $) $] $}'. |
2126 |
Search for the corresponding character is done forward if its an opening, |
|
2127 |
backwards if its a closing parenthesis. |
|
2128 |
Performs foundBlock with line/col as argument if found, notFoundBlock if not. |
|
2129 |
If there is a nesting error, performs failBlock." |
|
2130 |
||
770
a41466e3dfaa
use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents:
758
diff
changeset
|
2131 |
|i direction lineString |
a41466e3dfaa
use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents:
758
diff
changeset
|
2132 |
parChar charSet closingChar |
a41466e3dfaa
use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents:
758
diff
changeset
|
2133 |
ignoring |
a41466e3dfaa
use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents:
758
diff
changeset
|
2134 |
line "{ Class: SmallInteger }" |
a41466e3dfaa
use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents:
758
diff
changeset
|
2135 |
col "{ Class: SmallInteger }" |
a41466e3dfaa
use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents:
758
diff
changeset
|
2136 |
delta "{ Class: SmallInteger }" |
a41466e3dfaa
use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents:
758
diff
changeset
|
2137 |
endCol "{ Class: SmallInteger }" |
a41466e3dfaa
use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents:
758
diff
changeset
|
2138 |
runCol "{ Class: SmallInteger }" |
844
03e45d817dce
fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2139 |
cc prevCC nextCC incSet decSet |
770
a41466e3dfaa
use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents:
758
diff
changeset
|
2140 |
nesting "{ Class: SmallInteger }" |
a41466e3dfaa
use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents:
758
diff
changeset
|
2141 |
maxLine "{ Class: SmallInteger }" |
1454 | 2142 |
ign skip anySet| |
248 | 2143 |
|
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2144 |
charSet := #( $( $) $[ $] ${ $} " $< $> " ). |
248 | 2145 |
|
2146 |
parChar := self characterAtLine:startLine col:startCol. |
|
2147 |
i := charSet indexOf:parChar. |
|
2148 |
i == 0 ifTrue:[ |
|
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2149 |
^ failBlock value "not a parenthesis" |
248 | 2150 |
]. |
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2151 |
direction := #( fwd bwd fwd bwd fwd bwd fwd bwd) at:i. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2152 |
closingChar := #( $) $( $] $[ $} ${ "$> $<") at:i. |
248 | 2153 |
|
2154 |
col := startCol. |
|
2155 |
line := startLine. |
|
2156 |
direction == #fwd ifTrue:[ |
|
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2157 |
delta := 1. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2158 |
incSet := #( $( $[ ${ "$<" ). |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2159 |
decSet := #( $) $] $} "$>" ). |
248 | 2160 |
] ifFalse:[ |
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2161 |
delta := -1. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2162 |
incSet := #( $) $] $} "$>" ). |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2163 |
decSet := #( $( $[ ${ "$<" ). |
248 | 2164 |
]. |
1454 | 2165 |
anySet := Set new. |
2166 |
anySet addAll:incSet; addAll:decSet; addAll:ignoreSet. |
|
2167 |
anySet := (anySet select:[:c | c isCharacter]) asString. |
|
248 | 2168 |
|
2169 |
nesting := 1. |
|
2170 |
ignoring := false. |
|
2171 |
lineString := list at:line. |
|
2172 |
maxLine := list size. |
|
2173 |
||
2174 |
col := col + delta. |
|
2175 |
[nesting ~~ 0] whileTrue:[ |
|
1454 | 2176 |
(lineString notNil |
2177 |
and:[lineString includesAny:anySet]) ifTrue:[ |
|
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2178 |
direction == #fwd ifTrue:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2179 |
endCol := lineString size. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2180 |
] ifFalse:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2181 |
endCol := 1 |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2182 |
]. |
651
1e7153e21b36
skip character consts in match parent
Claus Gittinger <cg@exept.de>
parents:
649
diff
changeset
|
2183 |
|
770
a41466e3dfaa
use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents:
758
diff
changeset
|
2184 |
col to:endCol by:delta do:[:rCol | |
844
03e45d817dce
fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2185 |
runCol := rCol. |
770
a41466e3dfaa
use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents:
758
diff
changeset
|
2186 |
|
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2187 |
cc := lineString at:runCol. |
844
03e45d817dce
fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2188 |
runCol < lineString size ifTrue:[ |
03e45d817dce
fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2189 |
nextCC := lineString at:runCol+1 |
03e45d817dce
fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2190 |
] ifFalse:[ |
03e45d817dce
fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2191 |
nextCC := nil |
03e45d817dce
fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2192 |
]. |
03e45d817dce
fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2193 |
runCol > 1 ifTrue:[ |
03e45d817dce
fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2194 |
prevCC := lineString at:runCol-1 |
03e45d817dce
fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2195 |
] ifFalse:[ |
03e45d817dce
fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2196 |
prevCC := nil |
03e45d817dce
fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2197 |
]. |
248 | 2198 |
|
651
1e7153e21b36
skip character consts in match parent
Claus Gittinger <cg@exept.de>
parents:
649
diff
changeset
|
2199 |
ign := skip := false. |
844
03e45d817dce
fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2200 |
(cc == $" |
03e45d817dce
fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2201 |
and:[nextCC == $/ or:[prevCC == $$ ]]) ifTrue:[ |
03e45d817dce
fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2202 |
"/ do nothing |
03e45d817dce
fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2203 |
|
03e45d817dce
fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2204 |
skip := true. |
03e45d817dce
fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2205 |
] ifFalse:[ |
03e45d817dce
fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2206 |
ignoreSet do:[:ignore | |
03e45d817dce
fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2207 |
ignore == cc ifTrue:[ |
03e45d817dce
fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2208 |
ign := true |
03e45d817dce
fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2209 |
] ifFalse:[ |
03e45d817dce
fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2210 |
ignore isString ifTrue:[ |
03e45d817dce
fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2211 |
cc == (ignore at:2) ifTrue:[ |
03e45d817dce
fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2212 |
runCol > 1 ifTrue:[ |
03e45d817dce
fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2213 |
(lineString at:(runCol-1)) == (ignore at:1) ifTrue:[ |
03e45d817dce
fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2214 |
skip := true |
03e45d817dce
fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2215 |
] |
651
1e7153e21b36
skip character consts in match parent
Claus Gittinger <cg@exept.de>
parents:
649
diff
changeset
|
2216 |
] |
844
03e45d817dce
fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2217 |
] ifFalse:[ |
03e45d817dce
fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2218 |
cc == (ignore at:1) ifTrue:[ |
03e45d817dce
fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2219 |
runCol < lineString size ifTrue:[ |
03e45d817dce
fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2220 |
(lineString at:(runCol+1)) == (ignore at:2) ifTrue:[ |
03e45d817dce
fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2221 |
skip := true |
03e45d817dce
fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2222 |
] |
651
1e7153e21b36
skip character consts in match parent
Claus Gittinger <cg@exept.de>
parents:
649
diff
changeset
|
2223 |
] |
1e7153e21b36
skip character consts in match parent
Claus Gittinger <cg@exept.de>
parents:
649
diff
changeset
|
2224 |
] |
1e7153e21b36
skip character consts in match parent
Claus Gittinger <cg@exept.de>
parents:
649
diff
changeset
|
2225 |
] |
1e7153e21b36
skip character consts in match parent
Claus Gittinger <cg@exept.de>
parents:
649
diff
changeset
|
2226 |
] |
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2227 |
] |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2228 |
] |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2229 |
]. |
651
1e7153e21b36
skip character consts in match parent
Claus Gittinger <cg@exept.de>
parents:
649
diff
changeset
|
2230 |
|
1e7153e21b36
skip character consts in match parent
Claus Gittinger <cg@exept.de>
parents:
649
diff
changeset
|
2231 |
ign ifTrue:[ |
1e7153e21b36
skip character consts in match parent
Claus Gittinger <cg@exept.de>
parents:
649
diff
changeset
|
2232 |
ignoring := ignoring not |
1e7153e21b36
skip character consts in match parent
Claus Gittinger <cg@exept.de>
parents:
649
diff
changeset
|
2233 |
]. |
1e7153e21b36
skip character consts in match parent
Claus Gittinger <cg@exept.de>
parents:
649
diff
changeset
|
2234 |
|
1e7153e21b36
skip character consts in match parent
Claus Gittinger <cg@exept.de>
parents:
649
diff
changeset
|
2235 |
ignoring ifFalse:[ |
1e7153e21b36
skip character consts in match parent
Claus Gittinger <cg@exept.de>
parents:
649
diff
changeset
|
2236 |
skip ifFalse:[ |
1e7153e21b36
skip character consts in match parent
Claus Gittinger <cg@exept.de>
parents:
649
diff
changeset
|
2237 |
(incSet includes:cc) ifTrue:[ |
1e7153e21b36
skip character consts in match parent
Claus Gittinger <cg@exept.de>
parents:
649
diff
changeset
|
2238 |
nesting := nesting + 1 |
1e7153e21b36
skip character consts in match parent
Claus Gittinger <cg@exept.de>
parents:
649
diff
changeset
|
2239 |
] ifFalse:[ |
1e7153e21b36
skip character consts in match parent
Claus Gittinger <cg@exept.de>
parents:
649
diff
changeset
|
2240 |
(decSet includes:cc) ifTrue:[ |
1e7153e21b36
skip character consts in match parent
Claus Gittinger <cg@exept.de>
parents:
649
diff
changeset
|
2241 |
nesting := nesting - 1 |
1e7153e21b36
skip character consts in match parent
Claus Gittinger <cg@exept.de>
parents:
649
diff
changeset
|
2242 |
] |
1e7153e21b36
skip character consts in match parent
Claus Gittinger <cg@exept.de>
parents:
649
diff
changeset
|
2243 |
] |
1e7153e21b36
skip character consts in match parent
Claus Gittinger <cg@exept.de>
parents:
649
diff
changeset
|
2244 |
] |
1e7153e21b36
skip character consts in match parent
Claus Gittinger <cg@exept.de>
parents:
649
diff
changeset
|
2245 |
]. |
1e7153e21b36
skip character consts in match parent
Claus Gittinger <cg@exept.de>
parents:
649
diff
changeset
|
2246 |
|
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2247 |
nesting == 0 ifTrue:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2248 |
"check if legal" |
248 | 2249 |
|
651
1e7153e21b36
skip character consts in match parent
Claus Gittinger <cg@exept.de>
parents:
649
diff
changeset
|
2250 |
skip ifFalse:[ |
1e7153e21b36
skip character consts in match parent
Claus Gittinger <cg@exept.de>
parents:
649
diff
changeset
|
2251 |
cc == closingChar ifFalse:[ |
1e7153e21b36
skip character consts in match parent
Claus Gittinger <cg@exept.de>
parents:
649
diff
changeset
|
2252 |
^ failBlock value |
1e7153e21b36
skip character consts in match parent
Claus Gittinger <cg@exept.de>
parents:
649
diff
changeset
|
2253 |
]. |
1e7153e21b36
skip character consts in match parent
Claus Gittinger <cg@exept.de>
parents:
649
diff
changeset
|
2254 |
^ foundBlock value:line value:runCol. |
1e7153e21b36
skip character consts in match parent
Claus Gittinger <cg@exept.de>
parents:
649
diff
changeset
|
2255 |
] |
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2256 |
] |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2257 |
]. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2258 |
]. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2259 |
line := line + delta. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2260 |
(line < 1 or:[line > maxLine]) ifTrue:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2261 |
^ failBlock value |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2262 |
]. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2263 |
lineString := list at:line. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2264 |
direction == #fwd ifTrue:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2265 |
col := 1 |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2266 |
] ifFalse:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2267 |
col := lineString size |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2268 |
] |
248 | 2269 |
]. |
2270 |
^ notFoundBlock value |
|
2271 |
||
844
03e45d817dce
fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2272 |
"Modified: 15.10.1996 / 12:22:30 / cg" |
248 | 2273 |
! |
2274 |
||
2275 |
searchFwd |
|
2276 |
"search forward for pattern or selection" |
|
2277 |
||
1353 | 2278 |
|ign| |
2279 |
||
2280 |
ign := lastSearchIgnoredCase ? false. |
|
2281 |
||
248 | 2282 |
selectStyle == #wordLeft ifTrue:[ |
1326 | 2283 |
" |
2284 |
remove the space from the selection |
|
2285 |
" |
|
2286 |
selectionStartCol := selectionStartCol + 1. |
|
2287 |
super redrawLine:selectionStartLine from:selectionStartCol-1 to:selectionStartCol-1. |
|
2288 |
selectStyle := #word. |
|
248 | 2289 |
]. |
2290 |
self setSearchPattern. |
|
1326 | 2291 |
lastSearchPattern notNil ifTrue:[ |
1353 | 2292 |
self |
2293 |
searchFwd:lastSearchPattern |
|
2294 |
ignoreCase:ign |
|
248 | 2295 |
] |
1326 | 2296 |
|
2297 |
"Modified: 13.9.1997 / 06:24:26 / cg" |
|
248 | 2298 |
! |
2299 |
||
2300 |
searchFwd:pattern |
|
2301 |
"do a forward search" |
|
2302 |
||
2303 |
self searchFwd:pattern ifAbsent:[self showNotFound]. |
|
1326 | 2304 |
lastSearchIgnoredCase := false. |
2305 |
lastSearchPattern := pattern |
|
2306 |
||
2307 |
"Modified: 13.9.1997 / 06:20:43 / cg" |
|
248 | 2308 |
! |
2309 |
||
2310 |
searchFwd:pattern ifAbsent:aBlock |
|
2311 |
"do a forward search" |
|
2312 |
||
2313 |
|startLine startCol| |
|
2314 |
||
2315 |
selectionStartLine notNil ifTrue:[ |
|
1326 | 2316 |
startLine := selectionStartLine. |
2317 |
startCol := selectionStartCol |
|
248 | 2318 |
] ifFalse:[ |
1326 | 2319 |
startLine := 1. |
2320 |
startCol := 1 |
|
248 | 2321 |
]. |
1326 | 2322 |
self |
2323 |
searchForwardFor:pattern startingAtLine:startLine col:startCol |
|
2324 |
ifFound:[:line :col | self showMatch:pattern atLine:line col:col] |
|
2325 |
ifAbsent:aBlock |
|
2326 |
||
2327 |
"Modified: 13.9.1997 / 01:05:35 / cg" |
|
2328 |
! |
|
2329 |
||
2330 |
searchFwd:pattern ignoreCase:ign |
|
2331 |
"do a forward search" |
|
2332 |
||
2333 |
self searchFwd:pattern ignoreCase:ign ifAbsent:[self showNotFound]. |
|
2334 |
lastSearchIgnoredCase := ign. |
|
2335 |
lastSearchPattern := pattern |
|
2336 |
||
2337 |
"Created: 13.9.1997 / 06:18:13 / cg" |
|
2338 |
"Modified: 13.9.1997 / 06:20:37 / cg" |
|
2339 |
! |
|
2340 |
||
2341 |
searchFwd:pattern ignoreCase:ign ifAbsent:aBlock |
|
2342 |
"do a forward search" |
|
2343 |
||
2344 |
|startLine startCol| |
|
2345 |
||
2346 |
selectionStartLine notNil ifTrue:[ |
|
2347 |
startLine := selectionStartLine. |
|
2348 |
startCol := selectionStartCol |
|
2349 |
] ifFalse:[ |
|
2350 |
startLine := 1. |
|
2351 |
startCol := 1 |
|
2352 |
]. |
|
2353 |
self |
|
2354 |
searchForwardFor:pattern |
|
2355 |
ignoreCase:ign |
|
2356 |
startingAtLine:startLine col:startCol |
|
2357 |
ifFound:[:line :col | self showMatch:pattern atLine:line col:col] |
|
2358 |
ifAbsent:aBlock |
|
2359 |
||
2360 |
"Modified: 13.9.1997 / 01:05:35 / cg" |
|
2361 |
"Created: 13.9.1997 / 06:18:27 / cg" |
|
248 | 2362 |
! |
2363 |
||
2364 |
searchPattern |
|
2365 |
"return the last search pattern" |
|
2366 |
||
1326 | 2367 |
^ lastSearchPattern |
248 | 2368 |
! |
2369 |
||
2370 |
setSearchPattern |
|
2371 |
"set the searchpattern from the selection if there is one" |
|
2372 |
||
2373 |
|sel| |
|
2374 |
||
2375 |
sel := self selection. |
|
2376 |
sel notNil ifTrue:[ |
|
1326 | 2377 |
lastSearchPattern := sel asString withoutSeparators |
248 | 2378 |
] |
2379 |
! |
|
2380 |
||
2381 |
setSearchPattern:aString |
|
2382 |
"set the searchpattern for future searches" |
|
2383 |
||
2384 |
aString isNil ifTrue:[ |
|
1326 | 2385 |
lastSearchPattern := aString |
248 | 2386 |
] ifFalse:[ |
1326 | 2387 |
lastSearchPattern := aString withoutSeparators |
248 | 2388 |
] |
2389 |
! |
|
2390 |
||
2391 |
showMatch:pattern atLine:line col:col |
|
2392 |
"after a search, highlight the matched pattern. |
|
2393 |
The code below needs a rewrite to take care of match-characters |
|
2394 |
(for now, it only highlights simple patterns and '*string*' correctly)" |
|
2395 |
||
2396 |
|realPattern| |
|
2397 |
||
2398 |
realPattern := pattern. |
|
2399 |
(realPattern startsWith:$*) ifTrue:[ |
|
2400 |
realPattern := realPattern copyFrom:2 |
|
2401 |
]. |
|
2402 |
(realPattern endsWith:$*) ifTrue:[ |
|
2403 |
realPattern := realPattern copyWithoutLast:1 |
|
2404 |
]. |
|
2405 |
||
2406 |
self selectFromLine:line col:col |
|
2407 |
toLine:line col:(col + realPattern size - 1). |
|
2408 |
self makeLineVisible:line |
|
2409 |
! |
|
2410 |
||
2411 |
showNotFound |
|
2412 |
"search not found - tell user by beeping and changing |
|
2413 |
cursor for a while (sometimes I work with a headset :-) |
|
2414 |
(used to be: tell user by changing cursor for a while)" |
|
2415 |
||
2416 |
|savedCursor| |
|
2417 |
||
2418 |
savedCursor := cursor. |
|
1028 | 2419 |
[ |
2420 |
self cursor:(Cursor cross). |
|
2421 |
self beep. |
|
2422 |
Processor activeProcess millisecondDelay:300. |
|
2423 |
] valueNowOrOnUnwindDo:[ |
|
2424 |
self cursor:savedCursor |
|
2425 |
] |
|
2426 |
||
2427 |
"Modified: 20.2.1997 / 12:49:27 / cg" |
|
248 | 2428 |
! ! |
2429 |
||
2430 |
!TextView methodsFor:'selections'! |
|
2431 |
||
458 | 2432 |
expandSelectionDown |
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2433 |
|l t| |
458 | 2434 |
|
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2435 |
selectionStartLine notNil ifTrue:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2436 |
expandingTop ifTrue:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2437 |
l := selectionStartLine. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2438 |
selectionStartLine := selectionStartLine + 1. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2439 |
(selectionStartLine > clickLine |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2440 |
or:[selectionStartLine == clickLine and:[selectionStartCol > clickCol]]) |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2441 |
ifTrue:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2442 |
t := selectionStartLine. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2443 |
selectionStartLine := selectionEndLine. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2444 |
selectionEndLine := t. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2445 |
t := selectionStartCol. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2446 |
selectionStartCol := selectionEndCol. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2447 |
selectionEndCol := t. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2448 |
expandingTop := false |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2449 |
]. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2450 |
] ifFalse:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2451 |
l := selectionEndLine. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2452 |
selectionEndLine := selectionEndLine + 1. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2453 |
]. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2454 |
self redrawLine:l. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2455 |
self redrawLine:l+1. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2456 |
self makeSelectionVisible. |
458 | 2457 |
]. |
2458 |
||
2459 |
"Created: 1.3.1996 / 23:35:08 / cg" |
|
502 | 2460 |
"Modified: 18.3.1996 / 17:18:15 / cg" |
458 | 2461 |
! |
2462 |
||
2463 |
expandSelectionLeft |
|
502 | 2464 |
|c l t c1 c2| |
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2465 |
|
458 | 2466 |
selectionStartLine notNil ifTrue:[ |
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2467 |
expandingTop ifTrue:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2468 |
selectionStartCol == 0 ifTrue:[^ self]. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2469 |
l := selectionStartLine. |
502 | 2470 |
selectionStartCol := (selectionStartCol - 1) max:1. |
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2471 |
c := selectionStartCol. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2472 |
] ifFalse:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2473 |
l := selectionEndLine. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2474 |
selectionEndCol := (selectionEndCol - 1) max:0. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2475 |
c := selectionEndCol. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2476 |
selectionEndLine == selectionStartLine ifTrue:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2477 |
selectionEndCol <= selectionStartCol ifTrue:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2478 |
t := selectionStartCol. selectionStartCol := selectionEndCol. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2479 |
selectionEndCol := t. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2480 |
expandingTop := true. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2481 |
c := selectionStartCol. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2482 |
] |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2483 |
]. |
458 | 2484 |
]. |
502 | 2485 |
c1 := c. |
2486 |
c2 := c1 + 1. |
|
2487 |
c1 == 0 ifTrue:[ |
|
2488 |
c1 := 1 |
|
2489 |
]. |
|
2490 |
self redrawLine:l from:c1 to:c2. |
|
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2491 |
self makeSelectionVisible. |
458 | 2492 |
]. |
2493 |
||
502 | 2494 |
"Modified: 18.3.1996 / 17:05:46 / cg" |
458 | 2495 |
! |
2496 |
||
2497 |
expandSelectionRight |
|
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2498 |
|l c t| |
458 | 2499 |
|
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2500 |
selectionStartLine notNil ifTrue:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2501 |
expandingTop ifTrue:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2502 |
l := selectionStartLine. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2503 |
c := selectionStartCol. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2504 |
selectionStartCol := selectionStartCol + 1. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2505 |
l == selectionEndLine ifTrue:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2506 |
c >= selectionEndCol ifTrue:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2507 |
expandingTop := false. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2508 |
t := selectionStartCol. selectionStartCol := selectionEndCol. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2509 |
selectionEndCol := t. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2510 |
c := selectionStartCol. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2511 |
] |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2512 |
] |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2513 |
] ifFalse:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2514 |
l := selectionEndLine. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2515 |
c := selectionEndCol. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2516 |
selectionEndCol := selectionEndCol + 1. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2517 |
]. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2518 |
|
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2519 |
self redrawLine:l from:c to:c+1. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2520 |
self makeSelectionVisible. |
458 | 2521 |
]. |
2522 |
||
2523 |
"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
|
2524 |
"Modified: 6.3.1996 / 13:54:10 / cg" |
458 | 2525 |
! |
2526 |
||
2527 |
expandSelectionUp |
|
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2528 |
|l t| |
458 | 2529 |
|
2530 |
selectionStartLine notNil ifTrue:[ |
|
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2531 |
expandingTop ifTrue:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2532 |
selectionStartLine := (selectionStartLine - 1) max:1. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2533 |
l := selectionStartLine. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2534 |
] ifFalse:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2535 |
selectionEndLine := (selectionEndLine - 1) max:0. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2536 |
|
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2537 |
l := selectionEndLine. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2538 |
(selectionEndLine < clickLine |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2539 |
or:[(selectionEndLine == clickLine and:[selectionEndCol < clickCol])]) |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2540 |
ifTrue:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2541 |
t := selectionStartLine. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2542 |
selectionStartLine := selectionEndLine. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2543 |
selectionEndLine := t. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2544 |
t := selectionStartCol. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2545 |
selectionStartCol := selectionEndCol. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2546 |
selectionEndCol := t. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2547 |
l := selectionStartLine. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2548 |
expandingTop := true |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2549 |
]. |
458 | 2550 |
]. |
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2551 |
self redrawLine:l. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2552 |
self redrawLine:l+1. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2553 |
self makeSelectionVisible. |
458 | 2554 |
]. |
2555 |
||
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2556 |
"Modified: 6.3.1996 / 14:12:06 / cg" |
458 | 2557 |
! |
2558 |
||
248 | 2559 |
hasSelection |
2560 |
"return true, if there is a selection" |
|
2561 |
||
2562 |
^ selectionStartLine notNil |
|
2563 |
! |
|
2564 |
||
2565 |
makeSelectionVisible |
|
2566 |
"scroll to make the selection visible" |
|
2567 |
||
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2568 |
|line col| |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2569 |
|
248 | 2570 |
selectionStartLine notNil ifTrue:[ |
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2571 |
expandingTop ~~ false ifTrue:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2572 |
line := selectionStartLine. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2573 |
col := selectionStartCol. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2574 |
] ifFalse:[ |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2575 |
line := selectionEndLine. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2576 |
col := selectionEndCol. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2577 |
]. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2578 |
self makeLineVisible:line. |
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2579 |
self makeColVisible:col inLine:line. |
248 | 2580 |
] |
478
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2581 |
|
180275291838
show another cursor when matching parents
Claus Gittinger <cg@exept.de>
parents:
458
diff
changeset
|
2582 |
"Modified: 6.3.1996 / 13:53:45 / cg" |
248 | 2583 |
! |
2584 |
||
2585 |
selectAll |
|
2586 |
"select the whole text" |
|
2587 |
||
2588 |
self selectFromLine:1 col:1 toLine:(list size + 1) col:0 |
|
2589 |
! |
|
2590 |
||
2591 |
selectFromCharacterPosition:pos1 to:pos2 |
|
2592 |
"compute line/col from character positions and select the text" |
|
2593 |
||
2594 |
|line1 col1 line2 col2| |
|
2595 |
||
2596 |
line1 := self lineOfCharacterPosition:pos1. |
|
2597 |
col1 := pos1 - (self characterPositionOfLine:line1 col:1) + 1. |
|
2598 |
line2 := self lineOfCharacterPosition:pos2. |
|
2599 |
col2 := pos2 - (self characterPositionOfLine:line2 col:1) + 1. |
|
2600 |
self selectFromLine:line1 col:col1 toLine:line2 col:col2 |
|
2601 |
! |
|
2602 |
||
2603 |
selectFromLine:startLine col:startCol toLine:endLine col:endCol |
|
2604 |
"select a piece of text and redraw that area" |
|
2605 |
||
2606 |
self unselect. |
|
2607 |
startLine notNil ifTrue:[ |
|
599
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2608 |
"new:" |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2609 |
endLine < startLine ifTrue:[ |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2610 |
^ self selectFromLine:endLine col:endCol toLine:startLine col:startCol |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2611 |
]. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2612 |
(endLine == startLine and:[endCol < startCol]) ifTrue:[ |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2613 |
endCol ~~ 0 ifTrue:[ |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2614 |
self selectFromLine:endLine col:endCol toLine:startLine col:startCol. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2615 |
]. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2616 |
^ self |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2617 |
]. |
248 | 2618 |
|
2619 |
" old: |
|
599
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2620 |
endLine < startLine ifTrue:[^ self]. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2621 |
(startLine == endLine and:[endCol < startCol]) ifTrue:[^ self]. |
248 | 2622 |
" |
599
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2623 |
selectionStartLine := startLine. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2624 |
selectionStartCol := startCol. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2625 |
selectionEndLine := endLine. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2626 |
selectionEndCol := endCol. |
904
597bf5cfe653
care for changed selection from #validateNewSelection
Claus Gittinger <cg@exept.de>
parents:
896
diff
changeset
|
2627 |
self validateNewSelection. |
597bf5cfe653
care for changed selection from #validateNewSelection
Claus Gittinger <cg@exept.de>
parents:
896
diff
changeset
|
2628 |
|
597bf5cfe653
care for changed selection from #validateNewSelection
Claus Gittinger <cg@exept.de>
parents:
896
diff
changeset
|
2629 |
(selectionStartLine == selectionEndLine) ifTrue:[ |
597bf5cfe653
care for changed selection from #validateNewSelection
Claus Gittinger <cg@exept.de>
parents:
896
diff
changeset
|
2630 |
self redrawLine:selectionStartLine from:selectionStartCol to:selectionEndCol |
599
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2631 |
] ifFalse:[ |
904
597bf5cfe653
care for changed selection from #validateNewSelection
Claus Gittinger <cg@exept.de>
parents:
896
diff
changeset
|
2632 |
selectionStartLine to:selectionEndLine do:[:lineNr | |
599
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2633 |
self redrawLine:lineNr |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2634 |
] |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2635 |
]. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2636 |
selectStyle := nil. |
248 | 2637 |
] |
599
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2638 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2639 |
" |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2640 |
|v| |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2641 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2642 |
v := TextView extent:300@300. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2643 |
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
|
2644 |
v openAndWait. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2645 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2646 |
Delay waitForSeconds:1. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2647 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2648 |
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
|
2649 |
" |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2650 |
|
904
597bf5cfe653
care for changed selection from #validateNewSelection
Claus Gittinger <cg@exept.de>
parents:
896
diff
changeset
|
2651 |
"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
|
2652 |
! |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2653 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2654 |
selectFromLine:startLine toLine:endLine |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2655 |
"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
|
2656 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2657 |
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
|
2658 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2659 |
" |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2660 |
|v| |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2661 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2662 |
v := TextView extent:300@300. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2663 |
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
|
2664 |
v openAndWait. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2665 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2666 |
Delay waitForSeconds:1. |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2667 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2668 |
v selectFromLine:2 toLine:10 |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2669 |
" |
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2670 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2671 |
"Modified: 29.4.1996 / 12:23:46 / cg" |
248 | 2672 |
! |
2673 |
||
2674 |
selectLine:selectLine |
|
2675 |
"select one line and redraw it" |
|
2676 |
||
2677 |
self selectFromLine:selectLine col:1 toLine:(selectLine + 1) col:0. |
|
2678 |
wordStartCol := selectionStartCol. |
|
2679 |
wordEndCol := selectionEndCol. |
|
2680 |
wordStartLine := selectionStartLine. |
|
2681 |
wordEndLine := selectionEndLine. |
|
2682 |
selectStyle := #line |
|
2683 |
! |
|
2684 |
||
2685 |
selectLineAtY:y |
|
2686 |
"select the line at given y-(view-)coordinate" |
|
2687 |
||
2688 |
|selectVisibleLine selectLine| |
|
2689 |
||
2690 |
selectVisibleLine := self visibleLineOfY:y. |
|
2691 |
selectLine := self visibleLineToListLine:selectVisibleLine. |
|
2692 |
selectLine notNil ifTrue:[ |
|
2693 |
self selectLine:selectLine |
|
2694 |
] |
|
2695 |
! |
|
2696 |
||
2697 |
selectLineWhereCharacterPosition:pos |
|
2698 |
"select the line, where characterPosition pos is living. |
|
2699 |
The argument pos starts at 1 from the start of the text |
|
2700 |
and counts characters (i.e. can be used to convert from |
|
2701 |
character position within a string to line-position in view)." |
|
2702 |
||
2703 |
self selectLine:(self lineOfCharacterPosition:pos) |
|
2704 |
! |
|
2705 |
||
2706 |
selectWordAtLine:line col:col |
|
2707 |
"select the word at given line/col" |
|
2708 |
||
2709 |
self wordAtLine:line col:col do:[ |
|
504 | 2710 |
:beginLine :beginCol :endLine :endCol :style | |
248 | 2711 |
|
504 | 2712 |
self selectFromLine:beginLine col:beginCol toLine:endLine col:endCol. |
2713 |
selectStyle := style |
|
248 | 2714 |
] |
504 | 2715 |
|
2716 |
"Modified: 18.3.1996 / 17:30:38 / cg" |
|
248 | 2717 |
! |
2718 |
||
2719 |
selectWordAtX:x y:y |
|
2720 |
"select the word at given x/y-(view-)coordinate" |
|
2721 |
||
2722 |
|selectVisibleLine selectLine selectCol| |
|
2723 |
||
2724 |
selectStyle := nil. |
|
2725 |
selectVisibleLine := self visibleLineOfY:y. |
|
2726 |
selectLine := self visibleLineToListLine:selectVisibleLine. |
|
2727 |
selectLine notNil ifTrue:[ |
|
2728 |
selectCol := self colOfX:x inVisibleLine:selectLine. |
|
2729 |
self selectWordAtLine:selectLine col:selectCol |
|
2730 |
] |
|
2731 |
! |
|
2732 |
||
2733 |
selection |
|
2734 |
"return the selection as a collection of (line-)strings. |
|
2735 |
If the selection ends in a full line, the last entry in the returned |
|
2736 |
collection will be an empty string." |
|
2737 |
||
2738 |
|text sz index last |
|
2739 |
startLine "{ Class: SmallInteger }" |
|
2740 |
endLine "{ Class: SmallInteger }"| |
|
2741 |
||
2742 |
selectionStartLine isNil ifTrue:[^ nil]. |
|
2743 |
startLine := selectionStartLine. |
|
2744 |
endLine := selectionEndLine. |
|
2745 |
||
2746 |
(startLine == endLine) ifTrue:[ |
|
2747 |
"part of a line" |
|
2748 |
^ StringCollection with:(self listAt:startLine |
|
2749 |
from:selectionStartCol |
|
2750 |
to:selectionEndCol) |
|
2751 |
]. |
|
2752 |
sz := endLine - startLine + 1. |
|
2753 |
text := StringCollection new:sz. |
|
2754 |
||
2755 |
"get 1st and last (possibly) partial lines" |
|
2756 |
text at:1 put:(self listAt:startLine from:selectionStartCol). |
|
2757 |
selectionEndCol == 0 ifTrue:[ |
|
2758 |
last := '' |
|
2759 |
] ifFalse:[ |
|
2760 |
last := self listAt:selectionEndLine to:selectionEndCol. |
|
2761 |
]. |
|
2762 |
text at:sz put:last. |
|
2763 |
||
2764 |
"get bulk of text" |
|
2765 |
index := 2. |
|
2766 |
(startLine + 1) to:(endLine - 1) do:[:lineNr | |
|
2767 |
text at:index put:(self listAt:lineNr). |
|
2768 |
index := index + 1 |
|
2769 |
]. |
|
2770 |
^ text |
|
2771 |
! |
|
2772 |
||
2773 |
selectionEndCol |
|
2774 |
^ selectionEndCol |
|
2775 |
! |
|
2776 |
||
2777 |
selectionEndLine |
|
2778 |
^ selectionEndLine |
|
2779 |
! |
|
2780 |
||
2781 |
selectionStartCol |
|
2782 |
^ selectionStartCol |
|
2783 |
! |
|
2784 |
||
2785 |
selectionStartLine |
|
2786 |
^ selectionStartLine |
|
2787 |
! |
|
2788 |
||
2789 |
unselect |
|
2790 |
"unselect - if there was a selection redraw that area" |
|
2791 |
||
2792 |
|startLine endLine startVisLine endVisLine| |
|
2793 |
||
2794 |
selectionStartLine notNil ifTrue:[ |
|
503 | 2795 |
startLine := selectionStartLine. |
2796 |
endLine := selectionEndLine. |
|
248 | 2797 |
|
503 | 2798 |
self unselectWithoutRedraw. |
2799 |
||
715 | 2800 |
"/ if the selection is not visible, we are done |
2801 |
||
503 | 2802 |
startLine >= (firstLineShown + nLinesShown) ifTrue:[^ self]. |
2803 |
endLine < firstLineShown ifTrue:[^ self]. |
|
248 | 2804 |
|
503 | 2805 |
startLine < firstLineShown ifTrue:[ |
2806 |
startVisLine := 1 |
|
2807 |
] ifFalse:[ |
|
2808 |
startVisLine := self listLineToVisibleLine:startLine |
|
2809 |
]. |
|
2810 |
endLine >= (firstLineShown + nLinesShown) ifTrue:[ |
|
2811 |
endVisLine := nLinesShown |
|
2812 |
] ifFalse:[ |
|
2813 |
endVisLine := self listLineToVisibleLine:endLine |
|
2814 |
]. |
|
715 | 2815 |
|
2816 |
"/ if its only part of a line, just redraw what has to be |
|
2817 |
||
2818 |
(startLine == endLine) ifTrue:[ |
|
503 | 2819 |
super redrawVisibleLine:startVisLine from:selectionStartCol to:selectionEndCol |
2820 |
] ifFalse:[ |
|
715 | 2821 |
self redrawFromVisibleLine:startVisLine to:endVisLine |
503 | 2822 |
]. |
248 | 2823 |
]. |
2824 |
selectStyle := nil |
|
503 | 2825 |
|
715 | 2826 |
"Modified: 29.5.1996 / 14:54:11 / cg" |
248 | 2827 |
! |
2828 |
||
2829 |
unselectWithoutRedraw |
|
2830 |
"forget selection but do not redraw the selection area |
|
2831 |
- 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
|
2832 |
known to be invisible (however, redraw knows about that anyway)." |
248 | 2833 |
|
2834 |
selectionStartLine := nil. |
|
599
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2835 |
|
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2836 |
"Modified: 29.4.1996 / 12:33:28 / cg" |
248 | 2837 |
! |
2838 |
||
2839 |
validateNewSelection |
|
599
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2840 |
"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
|
2841 |
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
|
2842 |
may redefine it to limit the selection to a single line, or whatever." |
248 | 2843 |
|
599
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2844 |
^ self |
504 | 2845 |
|
599
aae5e752e1cf
characterAtLine:col: moved to super; added #selectFromLine:toLine: ; comments
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2846 |
"Modified: 29.4.1996 / 12:32:08 / cg" |
248 | 2847 |
! ! |
2848 |
||
844
03e45d817dce
fixed matching-parenthesis search over eol-comments
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2849 |
!TextView class methodsFor:'documentation'! |
248 | 2850 |
|
2851 |
version |
|
1477
2d4b6115e2c5
redefine #defaultViewBackgroundColor for the spec class
tz
parents:
1476
diff
changeset
|
2852 |
^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.115 1998-04-03 14:54:44 tz Exp $' |
248 | 2853 |
! ! |