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