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