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