author | Claus Gittinger <cg@exept.de> |
Tue, 24 Feb 2015 16:46:36 +0100 | |
changeset 5282 | 382e6cfb447d |
parent 5217 | a243db9b7c43 |
child 5221 | d036f1df0408 |
child 5369 | 6bddfe83bab9 |
permissions | -rw-r--r-- |
0 | 1 |
" |
5 | 2 |
COPYRIGHT (c) 1989 by Claus Gittinger |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
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 |
" |
|
2180
d208b77444a7
must set modified flag in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents:
2158
diff
changeset
|
12 |
"{ Package: 'stx:libwidg' }" |
d208b77444a7
must set modified flag in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents:
2158
diff
changeset
|
13 |
|
0 | 14 |
View subclass:#ListView |
3563 | 15 |
instanceVariableNames:'list firstLineShown nFullLinesShown nLinesShown fgColor bgColor |
16 |
partialLines leftMargin topMargin textStartLeft textStartTop |
|
17 |
innerWidth tabPositions lineSpacing fontHeight fontAscent |
|
18 |
fontIsFixedWidth fontWidth autoScroll autoScrollBlock |
|
19 |
autoScrollDeltaT wordCheck includesNonStrings widthOfWidestLine |
|
20 |
listMsg viewOrigin listChannel backgroundAlreadyClearedColor |
|
4747 | 21 |
scrollWhenUpdating scrollLocked lineEndCRLF highlightAreas |
22 |
compareModelOnUpdate expandTabsWhenUpdating |
|
23 |
checkLineEndConventionWhenUpdating |
|
4751 | 24 |
checkedLinesForWidthOfContentsComputation' |
3563 | 25 |
classVariableNames:'DefaultForegroundColor DefaultBackgroundColor DefaultTabPositions |
26 |
UserDefaultTabPositions DefaultLeftMargin DefaultTopMargin' |
|
27 |
poolDictionaries:'' |
|
28 |
category:'Views-Text' |
|
0 | 29 |
! |
30 |
||
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
31 |
Object subclass:#HighlightArea |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
32 |
instanceVariableNames:'startLine startCol endLine endCol fgColor bgColor' |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
33 |
classVariableNames:'' |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
34 |
poolDictionaries:'' |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
35 |
privateIn:ListView |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
36 |
! |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
37 |
|
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
38 |
Object subclass:#SearchSpec |
5076 | 39 |
instanceVariableNames:'pattern match ignoreCase variable fullWord forward |
5217 | 40 |
atBeginOfLineOnly ignoreDiacritics' |
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
41 |
classVariableNames:'' |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
42 |
poolDictionaries:'' |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
43 |
privateIn:ListView |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
44 |
! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
45 |
|
851
b9d71ccdefaa
care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents:
837
diff
changeset
|
46 |
!ListView class methodsFor:'documentation'! |
0 | 47 |
|
38 | 48 |
copyright |
49 |
" |
|
50 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
51 |
All Rights Reserved |
38 | 52 |
|
53 |
This software is furnished under a license and may be used |
|
54 |
only in accordance with the terms of that license and with the |
|
55 |
inclusion of the above copyright notice. This software may not |
|
56 |
be provided or otherwise made available to, or used by, any |
|
57 |
other person. No title to or ownership of the software is |
|
58 |
hereby transferred. |
|
59 |
" |
|
60 |
! |
|
61 |
||
0 | 62 |
documentation |
63 |
" |
|
38 | 64 |
a View for (string-)lists. |
65 |
||
4751 | 66 |
This class can only passively display collections of strings, |
67 |
text or display objects which behave line-like (i.e. all have constant height). |
|
68 |
||
69 |
Selections, editing, cursors etc. must be implemented in subclasses. |
|
70 |
(see SelectionInListView, TextView etc.) |
|
38 | 71 |
|
72 |
This code currently handles only fixed-height fonts correctly - |
|
4751 | 73 |
it should be rewritten in some places to not compute the position/height from |
74 |
the view's font height, but by accumulating line heights... |
|
0 | 75 |
|
38 | 76 |
It can only scroll by full lines vertically (i.e. setting firstLineShown to ~~ 1) |
77 |
which should be changed to have this behavior optionally for smooth scroll. |
|
78 |
||
4751 | 79 |
The text is internally kept in the 'list' instance variable, and is supposed to consist |
120 | 80 |
of a collection (Ordered- or StringCollection) of line entries. |
4751 | 81 |
Typically, individual entries are either strings/text or nil (for empty lines). |
82 |
However, ANY object which supports the displayOn: and widthIn: protocol can be |
|
120 | 83 |
used - see MultipleColumnListEntry as an example. |
84 |
Therefore, ListView (and all subclasses) are prepared to handle non-string entries |
|
4751 | 85 |
(especially: attributed Text and labelAndIcon-like entities). |
86 |
||
87 |
The internal version of the text has tabulators expanded to blanks. ListView is not prepared |
|
88 |
to deal with them. When text is exchanged with an external medium (i.e. reading/writing files), |
|
89 |
these are expanded/compressed assuming a tab-setting of 8. |
|
90 |
This is done independent of the user's tab setting, which is used ONLY for positioning, |
|
91 |
while the text is edited. |
|
92 |
Thus, even if the tab setting is multiple of 4's, tabs are |
|
120 | 93 |
written in multiples of 8 when the text is saved. Since this is the default on all ascii |
94 |
terminals and printers, this assures that the text looks correctly indented when finally printed. |
|
95 |
||
305 | 96 |
Notice: |
4751 | 97 |
------- |
98 |
ListView is one of the OLDEST widget classes in the system and definitely requires a major rewrite: |
|
305 | 99 |
|
120 | 100 |
Due to historic reasons (ListView implemented scrolling before the general |
101 |
scrolling code in View was added), this one does scrolling different from all other |
|
4159
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
102 |
views. The general scrolling code (in View) uses the transformation for transparent scrolling |
4751 | 103 |
using the viewOrigin (transparent means, that the code does not need to know - it simply draws |
104 |
as if all of the text was visible). |
|
105 |
Here in ListView, the transformation is not used, instead it is done again, and different, |
|
106 |
by keeping the firstLineShown (i.e. vertical offset) and leftOffset (horizontal offset). |
|
107 |
Even worse: the firstLineShown is a line-index, the most annoying consequence of this is that |
|
108 |
scrolling is done by lines here, whereas it is done in pixels in the View class. |
|
109 |
Thus, be very careful, when changing things (better: don't touch it ;-). |
|
110 |
Also, the viewOrigin variable is only valid for the x coordinate. The viewOrigin's y is always 0 !! |
|
120 | 111 |
|
305 | 112 |
Also, all controller functionality is completely performed by the listView |
113 |
(and subclasses) itself. It is still possible, to define and set a specialized |
|
114 |
controller, though. I.e. if you like to change the input behavior, define |
|
115 |
a corresponding controller class and intersect the keyXXX/buttonXXX messages |
|
116 |
there. |
|
117 |
||
4751 | 118 |
This may be totally rewritten ... so don't depend on the internals; especially the scrolling |
120 | 119 |
code will be totally removed here and the inherited functionality be used in the next version. |
38 | 120 |
|
4751 | 121 |
Also Notice: |
122 |
------------ |
|
123 |
because ListView was written at a time when most of the graphics was done via remote connections |
|
124 |
(X-window network protocol), it is highly tuned to avoid redraw operations. Thus, it can be used |
|
125 |
happily over a slow WLAN (say: 64kBit connection). |
|
126 |
In that, it performed *much* better than other widgets, especialy Java and Qt, some of which are |
|
127 |
hardly usable via the network. |
|
128 |
It may be questionable whether this is still a requirement these days, where network connections |
|
129 |
are usually pretty fast. However, the author insists on this to remain as it is!! |
|
130 |
Future underlying graphics may well become network dependent in the future, for example, when |
|
131 |
the display connection is implemented as an RPC into a web browser... |
|
132 |
||
133 |
||
134 |
Also Notice: |
|
135 |
------------ |
|
136 |
ListView shall be configurable to avoid accesses to its underlying list if required. |
|
137 |
Currently, it can be customized to disable lineWidth computation, tab expansion and scanning for |
|
138 |
non-string entries. All of which is required when huge texts which are not in memory are to be displayed |
|
139 |
(for example: a virtual array of 10million text lines). Please be careful to not reintroduce such |
|
140 |
code when adding features (as happened in the past). |
|
141 |
||
0 | 142 |
|
586 | 143 |
[Instance variables:] |
0 | 144 |
|
1325 | 145 |
list <aCollection> the text strings, a collection of lines. |
4159
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
146 |
Nils may be used for empty lines. |
1325 | 147 |
|
148 |
firstLineShown <Number> the index of the 1st visible line (1 ..) |
|
149 |
leftOffset <Number> left offset for horizontal scroll |
|
150 |
||
151 |
nFullLinesShown <Number> the number of unclipped lines in visible area |
|
4159
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
152 |
(internal; updated on size changes) |
1325 | 153 |
nLinesShown <Number> the number of lines in visible area, incl. partial |
4159
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
154 |
(internal; updated on size changes) |
1325 | 155 |
|
156 |
fgColor <Color> color to draw characters |
|
157 |
bgColor <Color> the background |
|
158 |
||
159 |
partialLines <Boolean> allow last line to be partial displayed |
|
160 |
leftMargin <Number> margin at left in pixels |
|
161 |
topMargin <Number> margin at top in pixels |
|
162 |
textStartLeft <Number> margin + leftMargin (internal) |
|
163 |
textStartTop <Number> margin + topMargin (internal) |
|
164 |
innerWidth <Number> width - margins (internal) |
|
165 |
tabPositions <aCollection> tab stops (cols) |
|
166 |
fontHeight <Number> font height in pixels (internal) |
|
167 |
fontAscent <Number> font ascent in pixels (internal) |
|
168 |
fontIsFixed <Boolean> true if its a fixed font (internal) |
|
169 |
fontWidth <Number> width of space (internal) |
|
170 |
lineSpacing <Number> pixels between lines |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
171 |
lastSearchPattern <String> last pattern for searching |
4159
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
172 |
(kept to provide a default for next search) |
1325 | 173 |
lastSearchIgnoredCase <Boolean> last search ignored case |
4159
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
174 |
(kept to provide a default for next search) |
1325 | 175 |
wordCheck <Block> rule used for check for word boundaries in word select |
4159
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
176 |
The default rule is to return true for alphaNumeric characters. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
177 |
(can be changed to allow for underscore and other |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
178 |
characters to be treated as alphaCharacters) |
1325 | 179 |
|
180 |
autoScrollBlock <Block> block installed as timeoutBlock when doing an |
|
4159
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
181 |
autoScroll (internal) |
1325 | 182 |
autoScrollDeltaT computed scroll time delta in seconds (internal) |
183 |
||
184 |
includesNonStrings cached flag if any non-strings are in list |
|
185 |
widthOfWidestLine cached width of widest line |
|
186 |
listMsg if view has a model and listMsg is non-nil, |
|
4159
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
187 |
this is sent to the model to aquired a new contents |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
188 |
whenever a change of the aspect (aspectMsg) occurs. |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
189 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
190 |
viewOrigin the current origin |
1325 | 191 |
|
1693
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
192 |
backgroundAlreadyClearedColor internal; speedup by avoiding |
4159
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
193 |
multiple fills when drawing |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
194 |
internal lines |
2128
33830e4f998f
added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents:
2090
diff
changeset
|
195 |
|
33830e4f998f
added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents:
2090
diff
changeset
|
196 |
scrollWhenUpdating |
4159
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
197 |
<Symbol> defines how the view is scrolled if the |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
198 |
model changes its value by some outside activity |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
199 |
(i.e. not by user input). |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
200 |
Can be one of: |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
201 |
#keep / nil -> stay unchanged |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
202 |
#endOfText -> scroll to the end |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
203 |
#beginOfText -> scroll to the top |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
204 |
The default is #beginOfText (i.e. scroll to top). |
120 | 205 |
|
586 | 206 |
[StyleSheet parameters:] |
77 | 207 |
|
1325 | 208 |
textForegroundColor defaults to Black |
209 |
textBackgroundColor defaults to White |
|
210 |
textFont defaults to defaultFont |
|
211 |
textTabPositions defaults to #(1 9 17 25 ...) |
|
586 | 212 |
|
213 |
[author:] |
|
4159
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
214 |
Claus Gittinger |
586 | 215 |
|
216 |
[see also:] |
|
4159
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
217 |
TextView EditTextView |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
218 |
|
0 | 219 |
" |
451 | 220 |
! |
221 |
||
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
222 |
examples |
451 | 223 |
" |
224 |
ListViews alone are rarely used - its mostly an abstract superclass |
|
225 |
for TextView, EditTextView and SelectionInListView. |
|
226 |
||
227 |
anyway, here are a few examples: |
|
228 |
||
229 |
basic simple setup: |
|
4536 | 230 |
[exBegin] |
231 |
|top l| |
|
232 |
||
233 |
top := StandardSystemView new. |
|
234 |
top extent:100@200. |
|
235 |
||
236 |
l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top. |
|
237 |
l list:#('one' 'two' 'three'). |
|
238 |
||
239 |
top open |
|
240 |
[exEnd] |
|
451 | 241 |
|
242 |
||
243 |
||
244 |
specifying textMargins (these have NOTHING to do with the viewInset): |
|
4536 | 245 |
[exBegin] |
246 |
|top l| |
|
247 |
||
248 |
top := StandardSystemView new. |
|
249 |
top extent:100@200. |
|
250 |
||
251 |
l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top. |
|
252 |
l list:#('one' 'two' 'three'). |
|
253 |
l topMargin:10. |
|
254 |
l leftMargin:20. |
|
255 |
||
256 |
top open |
|
257 |
[exEnd] |
|
451 | 258 |
|
259 |
||
587
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
260 |
|
451 | 261 |
globally set the fg/bg colors: |
4536 | 262 |
[exBegin] |
263 |
|top l| |
|
264 |
||
265 |
top := StandardSystemView new. |
|
266 |
top extent:100@200. |
|
267 |
||
268 |
l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top. |
|
269 |
l list:#('one' 'two' 'three'). |
|
270 |
l foregroundColor:(Color white). |
|
271 |
l backgroundColor:(Color blue). |
|
272 |
||
273 |
top open |
|
274 |
[exEnd] |
|
451 | 275 |
|
276 |
||
587
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
277 |
|
627 | 278 |
non-string (text) entries: |
4536 | 279 |
[exBegin] |
280 |
|top list l| |
|
281 |
||
282 |
top := StandardSystemView new. |
|
283 |
top extent:100@200. |
|
284 |
||
285 |
l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top. |
|
286 |
list := #('all' 'of' 'your' 'preferred' 'colors') |
|
287 |
with:#(red green blue 'orange' cyan) |
|
288 |
collect:[:s :clr | |
|
289 |
Text string:s |
|
290 |
emphasis:(Array with:#bold |
|
291 |
with:(#color->(Color name:clr))) ]. |
|
292 |
l list:list. |
|
293 |
||
294 |
top open |
|
295 |
[exEnd] |
|
627 | 296 |
|
297 |
||
298 |
||
299 |
generic non-string entries: |
|
300 |
(notice: ColoredListEntry is obsoleted by Text) |
|
4536 | 301 |
[exBegin] |
302 |
|top list l| |
|
303 |
||
304 |
top := StandardSystemView new. |
|
305 |
top extent:100@200. |
|
306 |
||
307 |
l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top. |
|
308 |
list := #('all' 'of' 'your' 'preferred' 'colors') |
|
309 |
with:#(red green blue 'orange' cyan) |
|
310 |
collect:[:s :clr | ColoredListEntry string:s color:(Color name:clr) ]. |
|
311 |
l list:list. |
|
312 |
||
313 |
top open |
|
314 |
[exEnd] |
|
587
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
315 |
|
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
316 |
|
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
317 |
|
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
318 |
using a model (default listMessage is aspectMessage): |
4536 | 319 |
[exBegin] |
320 |
|top model l theModelsText| |
|
321 |
||
322 |
model := Plug new. |
|
323 |
model respondTo:#modelsAspect |
|
324 |
with:[ theModelsText ]. |
|
325 |
||
326 |
top := StandardSystemView new. |
|
327 |
top extent:100@200. |
|
328 |
||
329 |
l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top. |
|
330 |
l model:model. |
|
331 |
l aspect:#modelsAspect. |
|
332 |
||
333 |
top open. |
|
334 |
||
335 |
Delay waitForSeconds:3. |
|
336 |
theModelsText := #('foo' 'bar' 'baz'). |
|
337 |
model changed:#modelsAspect. |
|
338 |
[exEnd] |
|
587
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
339 |
|
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
340 |
|
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
341 |
|
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
342 |
using a model with different aspects |
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
343 |
for two listViews: |
4536 | 344 |
[exBegin] |
345 |
|top model l1 l2 plainText| |
|
346 |
||
347 |
plainText := #(''). |
|
348 |
||
349 |
model := Plug new. |
|
350 |
model respondTo:#modelsUppercaseText |
|
351 |
with:[ plainText asStringCollection |
|
352 |
collect:[:l | l asUppercase]]. |
|
353 |
model respondTo:#modelsLowercaseText |
|
354 |
with:[ plainText asStringCollection |
|
355 |
collect:[:l | l asLowercase]]. |
|
356 |
||
357 |
top := StandardSystemView extent:200@200. |
|
358 |
||
359 |
l1 := ListView origin:0.0 @ 0.0 corner:1.0 @ 0.5 in:top. |
|
360 |
l1 model:model. |
|
361 |
l1 aspect:#modelsAspect. |
|
362 |
l1 listMessage:#modelsUppercaseText. |
|
363 |
||
364 |
l2 := ListView origin:0.0 @ 0.5 corner:1.0 @ 1.0 in:top. |
|
365 |
l2 model:model. |
|
366 |
l2 aspect:#modelsAspect. |
|
367 |
l2 listMessage:#modelsLowercaseText. |
|
368 |
||
369 |
top open. |
|
370 |
||
371 |
Delay waitForSeconds:3. |
|
372 |
plainText := #('foo' 'bar' 'baz'). |
|
373 |
model changed:#modelsAspect. |
|
374 |
[exEnd] |
|
375 |
||
376 |
using a big list (100000 lines), |
|
377 |
wrapping in a ScrollableView: |
|
378 |
[exBegin] |
|
379 |
|bigList top lv| |
|
380 |
||
381 |
bigList := (1 to:100000) collect:[:lineNr | 'List line Nr. ' , lineNr printString]. |
|
382 |
bigList at:10 put:('Some Text ' asText , 'with Bold part' allBold). |
|
383 |
bigList at:20 put:('Some Text ' asText , 'with Italic part' allItalic). |
|
384 |
||
385 |
top := StandardSystemView extent:200@200. |
|
386 |
||
387 |
lv := HVScrollableView for:ListView in:top. |
|
388 |
lv origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
|
389 |
lv list:bigList expandTabs:false scanForNonStrings:false includesNonStrings:false. |
|
390 |
||
391 |
top open. |
|
392 |
[exEnd] |
|
393 |
||
394 |
using a huge virtual list (1 mio simulated lines), |
|
395 |
wrapping in a ScrollableView: |
|
396 |
[exBegin] |
|
397 |
|virtualList top lv| |
|
398 |
||
399 |
virtualList := Plug new. |
|
400 |
virtualList inheritFrom:SequenceableCollection. |
|
401 |
virtualList respondTo:#size with:[ 1000000 ]. |
|
402 |
virtualList respondTo:#at: with:[:lineNr | 'List line Nr. ' , lineNr printString ]. |
|
403 |
||
404 |
top := StandardSystemView extent:200@200. |
|
405 |
||
406 |
lv := ScrollableView for:ListView in:top. |
|
407 |
lv origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
|
408 |
lv list:virtualList expandTabs:false scanForNonStrings:false includesNonStrings:false. |
|
409 |
||
410 |
top open. |
|
411 |
[exEnd] |
|
4751 | 412 |
|
413 |
||
414 |
using a huge virtual array (1 mio simulated lines), |
|
415 |
wrapping in a ScrollableView. |
|
416 |
To simulate an expensive computation, a delay is planted into the line generator; |
|
417 |
Startup and display of page full of lines should not take longer than the number of lines shown: |
|
418 |
[exBegin] |
|
419 |
|virtualList top lv| |
|
420 |
||
421 |
virtualList := VirtualArray new. |
|
422 |
virtualList |
|
423 |
setSize:1000000; |
|
424 |
generator:[:index | Transcript showCR:index. |
|
425 |
Delay waitForSeconds:0.5. |
|
426 |
'%1 -> %2' bindWith:index with:index squared]. |
|
427 |
||
428 |
top := StandardSystemView extent:200@200. |
|
429 |
||
430 |
lv := ScrollableView for:ListView in:top. |
|
431 |
lv origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
|
432 |
lv expandTabsWhenUpdating:false. |
|
433 |
lv checkLineEndConventionWhenUpdating:false. |
|
434 |
lv checkedLinesForWidthOfContentsComputation:-1. |
|
435 |
lv list:virtualList. |
|
436 |
||
437 |
top open. |
|
438 |
[exEnd] |
|
451 | 439 |
" |
0 | 440 |
! ! |
441 |
||
851
b9d71ccdefaa
care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents:
837
diff
changeset
|
442 |
!ListView class methodsFor:'defaults'! |
0 | 443 |
|
105 | 444 |
defaultTabPositions |
2378 | 445 |
"return an array containing the styleSheets default tab positions" |
446 |
||
3777 | 447 |
^ DefaultTabPositions ? self tab4Positions |
2378 | 448 |
! |
449 |
||
450 |
defaultTabPositions:aVector |
|
451 |
"set the array containing the styleSheets tab positions" |
|
452 |
||
453 |
DefaultTabPositions := aVector |
|
454 |
||
455 |
" |
|
3777 | 456 |
ListView defaultTabPositions:(ListView tab4Positions) |
2378 | 457 |
" |
105 | 458 |
! |
459 |
||
7 | 460 |
tab4Positions |
1693
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
461 |
"return an array containing tab positions for 4-col tabs" |
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
462 |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
463 |
^ #(1 5 9 13 17 21 25 29 33 37 41 45 49 53 57 61 65 69 73 77 81 |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
464 |
85 89 93 97 101 105 109 113 114 121 125 129 133 137 141 145) |
120 | 465 |
! |
466 |
||
467 |
tab8Positions |
|
1693
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
468 |
"return an array containing tab positions for 8-col tabs" |
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
469 |
|
120 | 470 |
^ #(1 9 17 25 33 41 49 57 65 73 81 89 97 105 113 121 129 137 145) |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
471 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
472 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
473 |
updateStyleCache |
439
4c6799ace14b
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
427
diff
changeset
|
474 |
"extract values from the styleSheet and cache them in class variables" |
4c6799ace14b
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
427
diff
changeset
|
475 |
|
1354 | 476 |
<resource: #style (#'text.foregroundColor' #'text.backgroundColor' |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
477 |
#'text.tabPositions' |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
478 |
#'text.font')> |
1354 | 479 |
|
480 |
DefaultForegroundColor := StyleSheet colorAt:'text.foregroundColor' default:Black. |
|
481 |
DefaultBackgroundColor := StyleSheet colorAt:'text.backgroundColor' default:White. |
|
482 |
DefaultFont := StyleSheet fontAt:'text.font'. |
|
483 |
DefaultTabPositions := StyleSheet at:'text.tabPositions'. |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
484 |
DefaultTabPositions isNil ifTrue:[DefaultTabPositions := self defaultTabPositions]. |
1693
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
485 |
DefaultLeftMargin := 0.5. |
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
486 |
DefaultTopMargin := 0.5. |
439
4c6799ace14b
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
427
diff
changeset
|
487 |
|
1354 | 488 |
"Modified: 20.10.1997 / 15:05:30 / cg" |
2378 | 489 |
! |
490 |
||
491 |
userDefaultTabPositions |
|
492 |
"return an array containing the users default tab positions" |
|
493 |
||
494 |
^ UserDefaultTabPositions |
|
495 |
! |
|
496 |
||
497 |
userDefaultTabPositions:aVector |
|
498 |
"set the array containing the users tab positions" |
|
499 |
||
500 |
UserDefaultTabPositions := aVector |
|
501 |
||
502 |
" |
|
503 |
self userDefaultTabPositions:(self tab4Positions) |
|
504 |
" |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
505 |
! ! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
506 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
507 |
!ListView methodsFor:'accessing'! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
508 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
509 |
innerHeight |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
510 |
"return the number of pixels visible of the contents |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
511 |
- redefined since ListView adds another margin to start the text |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
512 |
somewhat to indented from the 3D border." |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
513 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
514 |
^ height - (2 * margin) - topMargin |
0 | 515 |
! ! |
516 |
||
2133 | 517 |
!ListView methodsFor:'accessing-behavior'! |
2132 | 518 |
|
4747 | 519 |
checkLineEndConventionWhenUpdating |
520 |
"return the line-end convention check when updating behavior. |
|
521 |
If true (the default), the first line of the list given is checked for having a |
|
522 |
cr-lf line end (which is a DOS convention), and the lineEndCRLF flag is set dynamically. |
|
523 |
If false, the lineEndCRLF remains as specified by the user. |
|
524 |
You may want to disable this flag if it is very expensive to generate a line |
|
525 |
(although, only the very first line is checked, anyway)" |
|
526 |
||
527 |
^ checkLineEndConventionWhenUpdating |
|
528 |
! |
|
529 |
||
530 |
checkLineEndConventionWhenUpdating:aBoolean |
|
531 |
"define the line-end convention check when updating behavior. |
|
532 |
If true (the default), the first line of the list given is checked for having a |
|
533 |
cr-lf line end (which is a DOS convention), and the lineEndCRLF flag is set dynamically. |
|
534 |
If false, the lineEndCRLF remains as specified by the user. |
|
535 |
You may want to disable this flag if it is very expensive to generate a line |
|
536 |
(although, only the very first line is checked, anyway)" |
|
537 |
||
538 |
checkLineEndConventionWhenUpdating := aBoolean |
|
539 |
! |
|
540 |
||
4751 | 541 |
checkedLinesForWidthOfContentsComputation |
542 |
"return which lines to consider in the widthOfContents computation, |
|
543 |
which is needed by the scrollBar interface. |
|
544 |
If nil (the default), all lines are processed and the width of the longest line is taken. |
|
545 |
If positive, that number of lines is checked near the start of the text, |
|
546 |
if negative, from the end of the text. |
|
547 |
If 0, the width is dynamically re adjusted, as lines are drawn. |
|
548 |
You may want to change this to 1 if it is guaranteed that all linesa are of the same width, |
|
549 |
or -1, if all are shorter than the last line. |
|
550 |
(useful, for example, when it is very expensive to generate all lines, and a huge number |
|
551 |
of same-width lines is generated through a virtual array)" |
|
552 |
||
553 |
^ checkedLinesForWidthOfContentsComputation |
|
554 |
! |
|
555 |
||
556 |
checkedLinesForWidthOfContentsComputation:aNumberOrNil |
|
557 |
"set which lines to consider in the widthOfContents computation, |
|
558 |
which is needed by the scrollBar interface. |
|
559 |
If nil (the default), all lines are processed and the width of the longest line is taken. |
|
560 |
If positive, that number of lines is checked near the start of the text, |
|
561 |
if negative, from the end of the text. |
|
562 |
If 0, the width is dynamically re adjusted, as lines are drawn. |
|
563 |
You may want to change this to 1 if it is guaranteed that all linesa are of the same width, |
|
564 |
or -1, if all are shorter than the last line. |
|
565 |
(useful, for example, when it is very expensive to generate all lines, and a huge number |
|
566 |
of same-width lines is generated through a virtual array)" |
|
567 |
||
568 |
checkedLinesForWidthOfContentsComputation := aNumberOrNil |
|
569 |
! |
|
570 |
||
4747 | 571 |
compareModelWhenUpdating |
572 |
"return the compare when updating behavior. |
|
573 |
If true (the default), the list of lines as given due to a model update |
|
574 |
is processed and compared against the currently shown text. |
|
575 |
If they are the same, no action is taken. |
|
576 |
This behavior is ok in 99.99% of all applications. |
|
577 |
However, you may turn this off iff: |
|
578 |
- it is very expensive to process the list (for example, because the list |
|
579 |
is defined by a virtual array, which computes the lines dynamically, on |
|
580 |
the fly). |
|
581 |
One use where this flag should be turned off is in the hex-memory display, |
|
582 |
which is able to simulate texts with millions of lines, but they are actually |
|
583 |
simulated by generating the presented lines dynamically, as they are displayed." |
|
584 |
||
585 |
^ compareModelOnUpdate |
|
586 |
! |
|
587 |
||
588 |
compareModelWhenUpdating:aBoolean |
|
589 |
"define the compare when updating behavior. |
|
590 |
If true (the default), the list of lines as given due to a model update |
|
591 |
is processed and compared against the currently shown text. |
|
592 |
If they are the same, no action is taken. |
|
593 |
This behavior is ok in 99.99% of all applications. |
|
594 |
However, you may turn this off iff: |
|
595 |
- it is very expensive to process the list (for example, because the list |
|
596 |
is defined by a virtual array, which computes the lines dynamically, on |
|
597 |
the fly). |
|
598 |
One use where this flag should be turned off is in the hex-memory display, |
|
599 |
which is able to simulate texts with millions of lines, but they are actually |
|
600 |
simulated by generating the presented lines dynamically, as they are displayed." |
|
601 |
||
602 |
compareModelOnUpdate := aBoolean |
|
603 |
! |
|
604 |
||
605 |
expandTabsWhenUpdating |
|
606 |
"return the tab expansion behavior. |
|
607 |
If true (the default), the list of lines as given via #list: or |
|
608 |
due to a model update is processed and lines are replaced by lines with |
|
609 |
tabs expanded. |
|
610 |
This behavior is ok in 99.99% of all applications. |
|
611 |
However, you may turn this off iff: |
|
612 |
- you are certain, that no tabs are in the passed in list |
|
613 |
- it is very expensive to process the list (for example, because the list |
|
614 |
is defined by a virtual array, which computes the lines dynamically, on |
|
615 |
the fly). |
|
616 |
One use where this flag should be turned off is in the hex-memory display, |
|
617 |
which is able to simulate texts with millions of lines, but they are actually |
|
618 |
simulated by generating the presented lines dynamically, as they are displayed." |
|
619 |
||
620 |
^ expandTabsWhenUpdating |
|
621 |
! |
|
622 |
||
623 |
expandTabsWhenUpdating:aBoolean |
|
624 |
"define the tab expansion behavior. |
|
625 |
If true (the default), the list of lines as given via #list: or |
|
626 |
due to a model update is processed and lines are replaced by lines with |
|
627 |
tabs expanded. |
|
628 |
This behavior is ok in 99.99% of all applications. |
|
629 |
However, you may turn this off iff: |
|
630 |
- you are certain, that no tabs are in the passed in list |
|
631 |
- it is very expensive to process the list (for example, because the list |
|
632 |
is defined by a virtual array, which computes the lines dynamically, on |
|
633 |
the fly). |
|
634 |
One use where this flag should be turned off is in the hex-memory display, |
|
635 |
which is able to simulate texts with millions of lines, but they are actually |
|
636 |
simulated by generating the presented lines dynamically, as they are displayed." |
|
637 |
||
638 |
expandTabsWhenUpdating := aBoolean |
|
639 |
! |
|
640 |
||
3314 | 641 |
lineEndCRLF |
4610 | 642 |
"answer true, if CRLF is used for the line end. |
643 |
This is true for DOS/Windows files. |
|
644 |
Otherwise 'Character cr' is the line end (which is LF in unix)" |
|
645 |
||
3314 | 646 |
^ lineEndCRLF ? false |
647 |
||
648 |
"Created: / 04-07-2006 / 19:05:01 / fm" |
|
649 |
! |
|
650 |
||
2325 | 651 |
scrollWhenUpdating |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
652 |
"return the scroll behavior, when I get a new text |
2325 | 653 |
(via the model or the #contents/#list) |
654 |
Possible returnValues are: |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
655 |
#keep / nil -> no change |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
656 |
#endOfText -> scroll to the end |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
657 |
#beginOfText -> scroll to the top |
3116
2df69a526f06
default for scrollWhenUpdating is now #keep
Claus Gittinger <cg@exept.de>
parents:
2997
diff
changeset
|
658 |
The default is #keep. |
2325 | 659 |
This may be useful for fields which get new values assigned from |
660 |
the program (i.e. not from the user)" |
|
661 |
||
662 |
^ scrollWhenUpdating |
|
663 |
! |
|
664 |
||
2132 | 665 |
scrollWhenUpdating:aSymbolOrNil |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
666 |
"define how to scroll, when I get a new text |
2132 | 667 |
(via the model or the #contents/#list) |
668 |
Allowed arguments are: |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
669 |
#keep / nil -> no change |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
670 |
#endOfText -> scroll to the end |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
671 |
#beginOfText -> scroll to the top |
3116
2df69a526f06
default for scrollWhenUpdating is now #keep
Claus Gittinger <cg@exept.de>
parents:
2997
diff
changeset
|
672 |
The default is #keep. |
2132 | 673 |
This may be useful for fields which get new values assigned from |
674 |
the program (i.e. not from the user)" |
|
675 |
||
676 |
scrollWhenUpdating := aSymbolOrNil |
|
4403 | 677 |
! |
678 |
||
679 |
wordCheckBlock:aBlock |
|
680 |
"set the word-check block - this block is called with a character argument, |
|
681 |
when the end/beginning of a word is searched. |
|
682 |
It should return true, if the character belongs to the word. |
|
683 |
The default block is set in #initialize, and returns true for alphanumeric |
|
684 |
(national) characters. |
|
685 |
Applications may change it to include underlines, dollars or other characters. |
|
686 |
(a C/C++ editor would include underlines ...)" |
|
687 |
||
688 |
wordCheck := aBlock. |
|
689 |
||
690 |
"Modified: 22.5.1996 / 12:26:55 / cg" |
|
2132 | 691 |
! ! |
692 |
||
105 | 693 |
!ListView methodsFor:'accessing-contents'! |
694 |
||
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
695 |
add:aString |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
696 |
"add a line and redisplay" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
697 |
|
2219
9ffca3757666
fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents:
2216
diff
changeset
|
698 |
|fontHeightBefore| |
9ffca3757666
fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents:
2216
diff
changeset
|
699 |
|
2967 | 700 |
list isNil ifTrue:[list := OrderedCollection new]. |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
701 |
list add:aString. |
2219
9ffca3757666
fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents:
2216
diff
changeset
|
702 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
703 |
includesNonStrings ifFalse:[ |
5111 | 704 |
includesNonStrings := (aString notNil and:[(aString isSingleByteString) not]). |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
705 |
includesNonStrings ifTrue:[ |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
706 |
fontHeightBefore := fontHeight. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
707 |
self getFontParameters. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
708 |
fontHeightBefore ~~ fontHeight ifTrue:[ |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
709 |
self invalidate |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
710 |
]. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
711 |
]. |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
712 |
]. |
2224
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
713 |
|
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
714 |
widthOfWidestLine notNil ifTrue:[ |
4751 | 715 |
self recomputeWidthOfWidestLineFor:aString old:nil. |
2224
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
716 |
]. |
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
717 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
718 |
shown ifTrue:[ |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
719 |
self redrawLine:(self size). |
2182
fb9bc638123a
mus notify textChanged in #add: / #add:beforeIndex:
Claus Gittinger <cg@exept.de>
parents:
2181
diff
changeset
|
720 |
]. |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
721 |
self enqueueDelayedContentsChangedNotification. "recompute scrollbars" |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
722 |
|
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
723 |
"Modified: / 25-07-2012 / 12:00:20 / cg" |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
724 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
725 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
726 |
add:aString beforeIndex:index |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
727 |
"add a line and redisplay" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
728 |
|
2348 | 729 |
|lastShown| |
730 |
||
1351 | 731 |
list isNil ifTrue:[list := OrderedCollection new]. |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
732 |
list add:aString beforeIndex:index. |
2224
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
733 |
|
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
734 |
widthOfWidestLine notNil ifTrue:[ |
4751 | 735 |
self recomputeWidthOfWidestLineFor:aString old:nil. |
2224
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
736 |
]. |
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
737 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
738 |
includesNonStrings ifFalse:[ |
5111 | 739 |
includesNonStrings := (aString notNil and:[(aString isSingleByteString) not]). |
851
b9d71ccdefaa
care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents:
837
diff
changeset
|
740 |
"/ includesNonStrings ifTrue:[self getFontParameters]. |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
741 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
742 |
shown ifTrue:[ |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
743 |
lastShown := self lastLineShown. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
744 |
index <= 2 ifTrue:[ |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
745 |
self invalidate |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
746 |
] ifFalse:[ |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
747 |
index to:lastShown do:[:eachLine | |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
748 |
self invalidateLine:eachLine |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
749 |
]. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
750 |
]. |
2182
fb9bc638123a
mus notify textChanged in #add: / #add:beforeIndex:
Claus Gittinger <cg@exept.de>
parents:
2181
diff
changeset
|
751 |
]. |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
752 |
self enqueueDelayedContentsChangedNotification. "recompute scrollbars" |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
753 |
|
2257
d095d1e0779e
care for scrollWhenUpdating when adding individual lines
src
parents:
2249
diff
changeset
|
754 |
(scrollWhenUpdating == #end or:[scrollWhenUpdating == #endOfText]) ifTrue:[ |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
755 |
"/ self selection isNil ifTrue:[ |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
756 |
self scrollToBottom. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
757 |
"/ ] |
2257
d095d1e0779e
care for scrollWhenUpdating when adding individual lines
src
parents:
2249
diff
changeset
|
758 |
]. |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
759 |
|
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
760 |
"Modified: / 25-07-2012 / 12:00:42 / cg" |
65 | 761 |
! |
762 |
||
2246 | 763 |
addAll:aCollectionOfLines beforeIndex:index |
2348 | 764 |
"add a bunch of lines and redisplay" |
765 |
||
766 |
|lastShown| |
|
2246 | 767 |
|
768 |
list isNil ifTrue:[list := OrderedCollection new]. |
|
769 |
aCollectionOfLines do:[:eachLine | |
|
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
770 |
list addAll:aCollectionOfLines beforeIndex:index. |
2246 | 771 |
]. |
2348 | 772 |
includesNonStrings ifFalse:[ |
4765 | 773 |
includesNonStrings := |
774 |
aCollectionOfLines |
|
775 |
contains:[:someLine | |
|
5111 | 776 |
someLine notNil and:[(someLine isSingleByteString) not]. |
4765 | 777 |
] |
2348 | 778 |
]. |
2246 | 779 |
|
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
780 |
widthOfWidestLine notNil ifTrue:[ |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
781 |
aCollectionOfLines do:[:eachLine | |
4751 | 782 |
self recomputeWidthOfWidestLineFor:eachLine old:nil. |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
783 |
]. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
784 |
]. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
785 |
"/ widthOfWidestLine := nil. "/ i.e. unknown |
2246 | 786 |
self textChanged. |
787 |
||
2348 | 788 |
shown ifTrue:[ |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
789 |
lastShown := self lastLineShown. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
790 |
((index-1) <= lastShown) ifTrue:[ |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
791 |
index <= 2 ifTrue:[ |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
792 |
self invalidate |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
793 |
] ifFalse:[ |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
794 |
index-1 to:lastShown do:[:eachLine | |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
795 |
self invalidateLine:eachLine |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
796 |
]. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
797 |
"/ self redrawFromLine:index-1. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
798 |
]. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
799 |
]. |
2246 | 800 |
]. |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
801 |
self enqueueDelayedContentsChangedNotification. "recompute scrollbars" |
2257
d095d1e0779e
care for scrollWhenUpdating when adding individual lines
src
parents:
2249
diff
changeset
|
802 |
|
d095d1e0779e
care for scrollWhenUpdating when adding individual lines
src
parents:
2249
diff
changeset
|
803 |
(scrollWhenUpdating == #end or:[scrollWhenUpdating == #endOfText]) ifTrue:[ |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
804 |
"/ self selection isNil ifTrue:[ |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
805 |
self scrollToBottom. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
806 |
"/ ] |
2257
d095d1e0779e
care for scrollWhenUpdating when adding individual lines
src
parents:
2249
diff
changeset
|
807 |
]. |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
808 |
|
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
809 |
"Modified: / 25-07-2012 / 12:00:54 / cg" |
2246 | 810 |
! |
811 |
||
105 | 812 |
at:lineNr |
120 | 813 |
"retrieve a line; return nil if beyond end-of-text. |
814 |
this allows textViews to be used like collections in some places." |
|
105 | 815 |
|
816 |
list isNil ifTrue:[^ nil]. |
|
817 |
(lineNr between:1 and:self size) ifFalse:[^ nil]. |
|
818 |
^ list at:lineNr |
|
59 | 819 |
! |
820 |
||
105 | 821 |
at:index put:aString |
822 |
"change a line and redisplay" |
|
823 |
||
2577 | 824 |
|fontHeightBefore widthBefore| |
1608
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
825 |
|
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
826 |
fontHeightBefore := fontHeight. |
2224
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
827 |
widthBefore := widthOfWidestLine. |
105 | 828 |
self withoutRedrawAt:index put:aString. |
1608
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
829 |
|
105 | 830 |
shown ifTrue:[ |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
831 |
fontHeightBefore ~= fontHeight ifTrue:[ |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
832 |
"/ must redraw everything |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
833 |
self invalidate. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
834 |
^ self |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
835 |
]. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
836 |
self redrawLine:index. |
2219
9ffca3757666
fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents:
2216
diff
changeset
|
837 |
|
9ffca3757666
fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents:
2216
diff
changeset
|
838 |
"/ the code below is wrong - we really have to redraw everything, if the |
9ffca3757666
fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents:
2216
diff
changeset
|
839 |
"/ fontHeight changes (due to a labelAndIcon in the list). |
9ffca3757666
fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents:
2216
diff
changeset
|
840 |
|
9ffca3757666
fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents:
2216
diff
changeset
|
841 |
|
9ffca3757666
fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents:
2216
diff
changeset
|
842 |
"/ "/ this could have changed the font height; |
9ffca3757666
fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents:
2216
diff
changeset
|
843 |
"/ "/ must clear all below last line, if it became smaller |
9ffca3757666
fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents:
2216
diff
changeset
|
844 |
"/ fontHeightBefore > fontHeight ifTrue:[ |
9ffca3757666
fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents:
2216
diff
changeset
|
845 |
"/ (self listLineIsVisible:(self size)) ifTrue:[ |
9ffca3757666
fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents:
2216
diff
changeset
|
846 |
"/ self clearRectangle:(margin @ (self yOfVisibleLine:nLinesShown+1)) |
9ffca3757666
fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents:
2216
diff
changeset
|
847 |
"/ corner:(width-margin) @ (height-margin). |
9ffca3757666
fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents:
2216
diff
changeset
|
848 |
"/ ]. |
9ffca3757666
fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents:
2216
diff
changeset
|
849 |
"/ self redrawFromLine:index |
9ffca3757666
fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents:
2216
diff
changeset
|
850 |
"/ ] ifFalse:[ |
9ffca3757666
fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents:
2216
diff
changeset
|
851 |
"/ self redrawLine:index |
9ffca3757666
fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents:
2216
diff
changeset
|
852 |
"/ ]. |
9ffca3757666
fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents:
2216
diff
changeset
|
853 |
|
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
854 |
"/ asynchronous: |
1194 | 855 |
"/ visibleLine := self listLineToVisibleLine:index. |
856 |
"/ visibleLine notNil ifTrue:[ |
|
857 |
"/ y := self yOfVisibleLine:visibleLine. |
|
858 |
"/ self invalidate:((margin @ y) extent:(width@fontHeight)) |
|
859 |
"/ ]. |
|
2224
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
860 |
|
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
861 |
widthBefore ~~ widthOfWidestLine ifTrue:[ |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
862 |
self enqueueDelayedContentsChangedNotification |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
863 |
] |
105 | 864 |
] |
1194 | 865 |
|
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
866 |
"Modified: / 25-07-2012 / 12:01:46 / cg" |
105 | 867 |
! |
868 |
||
2427
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
869 |
characterAtCharacterPosition:charPos |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
870 |
"return the character at a 1-based character position. |
2427
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
871 |
Return a space character if nothing is there |
2707 | 872 |
(i.e. beyond the end of the line or below the last line)" |
2427
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
873 |
|
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
874 |
|line col| |
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
875 |
|
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
876 |
line := self lineOfCharacterPosition:charPos. |
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
877 |
col := charPos - (self characterPositionOfLine:line col:1) + 1. |
2443 | 878 |
col == 0 ifTrue:[^ Character cr]. |
2427
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
879 |
^ self characterAtLine:line col:col |
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
880 |
! |
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
881 |
|
598
5d5194703de8
characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents:
594
diff
changeset
|
882 |
characterAtLine:lineNr col:colNr |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
883 |
"return the character at physical line/col. |
598
5d5194703de8
characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents:
594
diff
changeset
|
884 |
The lineNr and colNr arguments start at 1, for the top-left cgaracter. |
5d5194703de8
characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents:
594
diff
changeset
|
885 |
Return a space character if nothing is there |
2707 | 886 |
(i.e. beyond the end of the line or below the last line)" |
598
5d5194703de8
characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents:
594
diff
changeset
|
887 |
|
5d5194703de8
characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents:
594
diff
changeset
|
888 |
|line| |
5d5194703de8
characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents:
594
diff
changeset
|
889 |
|
5d5194703de8
characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents:
594
diff
changeset
|
890 |
list notNil ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
891 |
line := self listAt:lineNr. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
892 |
line notNil ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
893 |
(line size >= colNr) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
894 |
^ line at:colNr |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
895 |
] |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
896 |
] |
598
5d5194703de8
characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents:
594
diff
changeset
|
897 |
]. |
5d5194703de8
characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents:
594
diff
changeset
|
898 |
^ Character space |
5d5194703de8
characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents:
594
diff
changeset
|
899 |
|
5d5194703de8
characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents:
594
diff
changeset
|
900 |
"Created: 29.4.1996 / 12:11:00 / cg" |
5d5194703de8
characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents:
594
diff
changeset
|
901 |
"Modified: 29.4.1996 / 12:12:41 / cg" |
5d5194703de8
characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents:
594
diff
changeset
|
902 |
! |
5d5194703de8
characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents:
594
diff
changeset
|
903 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
904 |
contents |
4610 | 905 |
"return the contents as a string, terminated by the line end character (sequence)" |
906 |
||
907 |
|stringCollection lineEnd| |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
908 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
909 |
list isNil ifTrue:[^ '']. |
4610 | 910 |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
911 |
self lineEndCRLF ifTrue:[ |
4610 | 912 |
lineEnd := String crlf. |
913 |
] ifFalse:[ |
|
914 |
lineEnd := Character cr. |
|
3314 | 915 |
]. |
4610 | 916 |
|
917 |
stringCollection := list asStringCollection. |
|
918 |
^ stringCollection |
|
919 |
asStringWith:lineEnd |
|
920 |
from:1 to:stringCollection size |
|
921 |
compressTabs:false |
|
922 |
final:lineEnd |
|
3314 | 923 |
|
924 |
"Modified: / 04-07-2006 / 19:18:47 / fm" |
|
105 | 925 |
! |
926 |
||
927 |
contents:something |
|
1240
1b3611a8e972
added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents:
1234
diff
changeset
|
928 |
"set the contents (either a String or a Collection of strings) |
1b3611a8e972
added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents:
1234
diff
changeset
|
929 |
also scroll to top. See #setContents:, which does not scroll. |
1b3611a8e972
added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents:
1234
diff
changeset
|
930 |
If the argument is a string, it is converted |
1b3611a8e972
added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents:
1234
diff
changeset
|
931 |
to a collection of line-strings here." |
105 | 932 |
|
933 |
|l| |
|
934 |
||
935 |
l := something. |
|
936 |
l notNil ifTrue:[ |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
937 |
l isString ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
938 |
l := l asStringCollection |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
939 |
] |
105 | 940 |
]. |
941 |
self list:l |
|
652 | 942 |
|
1240
1b3611a8e972
added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents:
1234
diff
changeset
|
943 |
"Modified: 5.6.1997 / 11:11:54 / cg" |
51 | 944 |
! |
945 |
||
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
946 |
from:from to:to do:aBlock |
652 | 947 |
"evaluate aBlock on some of my lines" |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
948 |
|
3256
0e978bc1d5fd
examples for big and huge lists added
Claus Gittinger <cg@exept.de>
parents:
3253
diff
changeset
|
949 |
list from:from to:to do:aBlock. |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
950 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
951 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
952 |
grow:n |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
953 |
"grow our list" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
954 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
955 |
^ list grow:n. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
956 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
957 |
|
2455 | 958 |
lineAtY:y |
959 |
"return the lineNr for a given y-(view-)coordinate" |
|
960 |
||
961 |
|visibleLine| |
|
962 |
||
963 |
visibleLine := self visibleLineOfY:y. |
|
964 |
visibleLine isNil ifTrue:[^ nil]. |
|
965 |
^ self visibleLineToListLine:visibleLine. |
|
966 |
! |
|
967 |
||
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
968 |
list |
652 | 969 |
"return the contents as a collection of strings. |
1240
1b3611a8e972
added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents:
1234
diff
changeset
|
970 |
This returns the views internal list - modifying it may confuse |
652 | 971 |
the listView." |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
972 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
973 |
^ list |
652 | 974 |
|
1240
1b3611a8e972
added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents:
1234
diff
changeset
|
975 |
"Modified: 5.6.1997 / 11:10:54 / cg" |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
976 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
977 |
|
0 | 978 |
list:aCollection |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
979 |
"set the contents (a collection of strings or list entries) |
2128
33830e4f998f
added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents:
2090
diff
changeset
|
980 |
and scroll as specified in scrollWhenUpdating (default:top-left). |
1240
1b3611a8e972
added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents:
1234
diff
changeset
|
981 |
See also #setList:, which does not scroll. |
1b3611a8e972
added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents:
1234
diff
changeset
|
982 |
Tabs are expanded (to spaces). |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
983 |
The passed list is scanned for nonStrings |
1240
1b3611a8e972
added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents:
1234
diff
changeset
|
984 |
(remembered to optimize later redraws)." |
128 | 985 |
|
4751 | 986 |
self list:aCollection expandTabs:expandTabsWhenUpdating |
652 | 987 |
|
1240
1b3611a8e972
added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents:
1234
diff
changeset
|
988 |
"Modified: 5.6.1997 / 11:10:45 / cg" |
128 | 989 |
! |
990 |
||
991 |
list:aCollection expandTabs:expand |
|
2128
33830e4f998f
added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents:
2090
diff
changeset
|
992 |
"set the contents (a collection of strings) |
33830e4f998f
added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents:
2090
diff
changeset
|
993 |
and scroll as specified in scrollWhenUpdating (default:top-left). |
1240
1b3611a8e972
added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents:
1234
diff
changeset
|
994 |
If expand is true, tabs are expanded (to spaces). |
1b3611a8e972
added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents:
1234
diff
changeset
|
995 |
The passed list is scanned for nonStrings (remembered to optimize |
1b3611a8e972
added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents:
1234
diff
changeset
|
996 |
later redraws)." |
1b3611a8e972
added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents:
1234
diff
changeset
|
997 |
|
4765 | 998 |
self list:aCollection expandTabs:expand scanForNonStrings:true |
1240
1b3611a8e972
added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents:
1234
diff
changeset
|
999 |
|
1b3611a8e972
added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents:
1234
diff
changeset
|
1000 |
"Modified: 5.6.1997 / 11:09:44 / cg" |
1b3611a8e972
added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents:
1234
diff
changeset
|
1001 |
! |
1b3611a8e972
added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents:
1234
diff
changeset
|
1002 |
|
1b3611a8e972
added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents:
1234
diff
changeset
|
1003 |
list:aCollection expandTabs:expand scanForNonStrings:scan |
2128
33830e4f998f
added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents:
2090
diff
changeset
|
1004 |
"set the contents (a collection of strings) |
33830e4f998f
added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents:
2090
diff
changeset
|
1005 |
and scroll as specified in scrollWhenUpdating (default:top-left). |
1240
1b3611a8e972
added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents:
1234
diff
changeset
|
1006 |
If expand is true, tabs are expanded (to spaces). |
1b3611a8e972
added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents:
1234
diff
changeset
|
1007 |
If scan is true, scan the passed list for nonStrings; otherwise, |
1b3611a8e972
added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents:
1234
diff
changeset
|
1008 |
assume that it does contain non-strings |
1b3611a8e972
added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents:
1234
diff
changeset
|
1009 |
(remembered to optimize later redraws)." |
0 | 1010 |
|
1241 | 1011 |
self |
4747 | 1012 |
list:aCollection expandTabs:expand scanForNonStrings:scan includesNonStrings:nil |
1241 | 1013 |
|
1014 |
"Modified: 5.6.1997 / 12:40:35 / cg" |
|
1015 |
! |
|
1016 |
||
4747 | 1017 |
list:aCollection expandTabs:expand scanForNonStrings:scan includesNonStrings:nonStringsIfNoScan |
1018 |
"set the contents (a collection of strings) |
|
1019 |
and scroll as specified in scrollWhenUpdating (default:top-left). |
|
1020 |
If expand is true, tabs are expanded (to spaces). |
|
1021 |
If scan is true, scan the passed list for nonStrings; |
|
1022 |
otherwise, take the information from the nonStrings arg. |
|
1023 |
(the nonStrings information is remembered to optimize later redraws & height computations)." |
|
1024 |
||
1025 |
self |
|
1026 |
list:aCollection |
|
1027 |
expandTabs:expand |
|
1028 |
scanForNonStrings:scan |
|
1029 |
includesNonStrings:nonStringsIfNoScan |
|
1030 |
redraw:true |
|
1031 |
! |
|
1032 |
||
1033 |
list:aCollection expandTabs:expand scanForNonStrings:scan includesNonStrings:nonStringsIfNoScan redraw:doRedraw |
|
2128
33830e4f998f
added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents:
2090
diff
changeset
|
1034 |
"set the contents (a collection of strings) |
33830e4f998f
added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents:
2090
diff
changeset
|
1035 |
and scroll as specified in scrollWhenUpdating (default:top-left). |
1241 | 1036 |
If expand is true, tabs are expanded (to spaces). |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1037 |
If scan is true, scan the passed list for nonStrings; |
1241 | 1038 |
otherwise, take the information from the nonStrings arg. |
1039 |
(the nonStrings information is remembered to optimize later redraws & height computations)." |
|
1040 |
||
2199
455cd1c65af1
auto-scroll (when fetching list from model) to bottom fixed
Claus Gittinger <cg@exept.de>
parents:
2188
diff
changeset
|
1041 |
|oldFirst oldLeft nonStringsBefore fontHeightBefore |
3821 | 1042 |
scrollToEnd scrollToTop newLeftOffset wText same firstLine| |
2891 | 1043 |
|
4747 | 1044 |
"/ cg: what is the point in comparing here? |
1045 |
"/ I think, if there is something to optimize, |
|
1046 |
"/ the caller should do so (moved to getListFromModel). |
|
1047 |
"/ notice, that it may be very expensive to ask aCollection for each line |
|
1048 |
"/ for example, iff the lines are generated on the fly by an algorithm |
|
1049 |
false ifTrue:[ |
|
1050 |
"/ see if there is a change at all. |
|
1051 |
"/ use to compare using =, but that's not enough in case of emphasis change. |
|
1052 |
aCollection size == list size ifTrue:[ |
|
1053 |
same := true. |
|
1054 |
aCollection size > 0 ifTrue:[ |
|
1055 |
aCollection with:list do:[:eachNewLine :eachOldLine | |
|
1056 |
(eachNewLine == eachOldLine) |
|
1057 |
ifFalse:[ |
|
1058 |
same := false. |
|
1059 |
] |
|
4610 | 1060 |
] |
4747 | 1061 |
]. |
1062 |
same ifTrue:[^ self]. |
|
4610 | 1063 |
]. |
2891 | 1064 |
]. |
2199
455cd1c65af1
auto-scroll (when fetching list from model) to bottom fixed
Claus Gittinger <cg@exept.de>
parents:
2188
diff
changeset
|
1065 |
|
455cd1c65af1
auto-scroll (when fetching list from model) to bottom fixed
Claus Gittinger <cg@exept.de>
parents:
2188
diff
changeset
|
1066 |
scrollToTop := scrollWhenUpdating == #begin or:[scrollWhenUpdating == #beginOfText]. |
455cd1c65af1
auto-scroll (when fetching list from model) to bottom fixed
Claus Gittinger <cg@exept.de>
parents:
2188
diff
changeset
|
1067 |
scrollToEnd := scrollWhenUpdating == #end or:[scrollWhenUpdating == #endOfText]. |
0 | 1068 |
|
4747 | 1069 |
(aCollection isEmptyOrNil and:[list isEmptyOrNil]) ifTrue:[ |
4610 | 1070 |
"no contents change" |
4747 | 1071 |
list := aCollection. |
1072 |
scrollLocked ifFalse:[ |
|
1073 |
scrollToTop ifTrue:[ |
|
1074 |
self scrollToTop. |
|
1075 |
] ifFalse:[ |
|
1076 |
scrollToEnd ifTrue:[ |
|
1077 |
self scrollToBottom. |
|
1078 |
] |
|
1079 |
]. |
|
1080 |
self scrollToLeft. |
|
4610 | 1081 |
]. |
1082 |
^ self |
|
0 | 1083 |
]. |
3314 | 1084 |
|
4747 | 1085 |
checkLineEndConventionWhenUpdating ifTrue:[ |
1086 |
"Check if the we use DOS/Windows line end convention with CR LF. |
|
1087 |
The LF has already been consumed by the conversion to a StringCollection, |
|
1088 |
now check for and remove the trailing left over CRs" |
|
1089 |
||
1090 |
lineEndCRLF := (aCollection size > 0 |
|
1091 |
and:[(firstLine := aCollection at:1) isString |
|
1092 |
and:[firstLine notEmpty |
|
1093 |
and:[firstLine string endsWith:Character return]]]). |
|
1094 |
]. |
|
3314 | 1095 |
lineEndCRLF ifTrue:[ |
4610 | 1096 |
list := aCollection |
1097 |
collect:[:eachLineWithCROrNil | |
|
1098 |
eachLineWithCROrNil isNil |
|
1099 |
ifTrue:nil |
|
1100 |
ifFalse:[(eachLineWithCROrNil endsWith:Character return) |
|
1101 |
ifTrue:[eachLineWithCROrNil copyButLast:1] |
|
1102 |
ifFalse:[eachLineWithCROrNil]]]. |
|
3314 | 1103 |
] ifFalse:[ |
4610 | 1104 |
list := aCollection. |
3314 | 1105 |
]. |
0 | 1106 |
|
864 | 1107 |
nonStringsBefore := includesNonStrings. |
1608
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
1108 |
fontHeightBefore := fontHeight. |
864 | 1109 |
includesNonStrings := false. |
1110 |
||
152 | 1111 |
list notNil ifTrue:[ |
4610 | 1112 |
expand ifTrue:[ |
1113 |
self expandTabs |
|
1114 |
] ifFalse:[ |
|
1115 |
scan ifTrue:[ |
|
1116 |
includesNonStrings := list contains:[:e | e isString not]. |
|
1117 |
] ifFalse:[ |
|
4747 | 1118 |
includesNonStrings := nonStringsIfNoScan ? nonStringsBefore |
4610 | 1119 |
] |
1120 |
]. |
|
0 | 1121 |
]. |
1608
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
1122 |
(includesNonStrings ~~ nonStringsBefore) ifTrue:[ |
4610 | 1123 |
self getFontParameters. |
1608
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
1124 |
]. |
152 | 1125 |
|
125 | 1126 |
widthOfWidestLine := nil. "/ i.e. unknown |
0 | 1127 |
oldFirst := firstLineShown. |
2429
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2427
diff
changeset
|
1128 |
oldLeft := viewOrigin x. |
2128
33830e4f998f
added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents:
2090
diff
changeset
|
1129 |
|
2199
455cd1c65af1
auto-scroll (when fetching list from model) to bottom fixed
Claus Gittinger <cg@exept.de>
parents:
2188
diff
changeset
|
1130 |
(includesNonStrings ~~ nonStringsBefore) ifTrue:[ |
4610 | 1131 |
self computeNumberOfLinesShown. |
2199
455cd1c65af1
auto-scroll (when fetching list from model) to bottom fixed
Claus Gittinger <cg@exept.de>
parents:
2188
diff
changeset
|
1132 |
]. |
2429
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2427
diff
changeset
|
1133 |
|
4747 | 1134 |
scrollLocked ifFalse:[ |
1135 |
newLeftOffset := viewOrigin x. |
|
1136 |
scrollToTop ifTrue:[ |
|
1137 |
firstLineShown := 1. |
|
4610 | 1138 |
newLeftOffset := 0. |
4747 | 1139 |
] ifFalse:[ |
1140 |
scrollToEnd ifTrue:[ |
|
1141 |
firstLineShown := (list size - nFullLinesShown + 1) max:1. |
|
1142 |
newLeftOffset := 0. |
|
1143 |
] |
|
4610 | 1144 |
]. |
4747 | 1145 |
newLeftOffset > 0 ifTrue:[ |
1146 |
wText := self widthOfContents. |
|
1147 |
(viewOrigin x + self innerWidth) > wText ifTrue:[ |
|
1148 |
newLeftOffset := (wText - self innerWidth) max:0. |
|
1149 |
]. |
|
1150 |
]. |
|
1151 |
newLeftOffset ~= oldLeft ifTrue:[ |
|
1152 |
viewOrigin := newLeftOffset @ viewOrigin y. |
|
1153 |
]. |
|
2429
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2427
diff
changeset
|
1154 |
]. |
837 | 1155 |
|
38 | 1156 |
realized ifTrue:[ |
4610 | 1157 |
self contentsChanged. |
4747 | 1158 |
scrollLocked ifFalse:[ |
1159 |
" |
|
1160 |
don't use scroll here to avoid double redraw |
|
1161 |
" |
|
1162 |
viewOrigin := viewOrigin isNil ifTrue:[0@0] ifFalse:[(viewOrigin x) @ 0]. |
|
1163 |
transformation := nil. |
|
1164 |
||
1165 |
oldFirst ~~ firstLineShown ifTrue:[ |
|
1166 |
self originChanged:0 @ ((oldFirst - 1) * fontHeight negated). |
|
1167 |
]. |
|
4610 | 1168 |
]. |
4747 | 1169 |
doRedraw ifTrue:[ |
1170 |
shown ifTrue:[ |
|
1171 |
self invalidate. |
|
1172 |
] |
|
4610 | 1173 |
] |
0 | 1174 |
] |
153 | 1175 |
|
3314 | 1176 |
"Modified: / 30-08-1995 / 19:07:13 / claus" |
1177 |
"Created: / 05-06-1997 / 12:40:06 / cg" |
|
1178 |
"Modified: / 04-07-2006 / 19:12:39 / fm" |
|
3339 | 1179 |
"Modified: / 22-08-2006 / 11:59:56 / cg" |
0 | 1180 |
! |
1181 |
||
2812 | 1182 |
listAt:lineNr |
1183 |
"given a lineNumber, return the corresponding string |
|
1184 |
This is used for accessing; i.e. for non-string entries, this |
|
1185 |
returns the corresponding string." |
|
1186 |
||
1187 |
|l| |
|
1188 |
||
1189 |
list isNil ifTrue:[^ nil]. |
|
1190 |
(lineNr between:1 and:self size) ifFalse:[^ nil]. |
|
1191 |
l := self at:lineNr. |
|
1192 |
l isNil ifTrue:[^ l]. |
|
1193 |
^ self visibleStringFrom:l "/ l asString |
|
1194 |
||
1195 |
"Modified: 7.9.1995 / 15:54:59 / claus" |
|
1196 |
! |
|
1197 |
||
2233
ea4d220ac381
added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
1198 |
removeFromIndex:startLineNr toIndex:endLineNr |
ea4d220ac381
added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
1199 |
"delete some lines" |
ea4d220ac381
added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
1200 |
|
3442
418b14cb6a78
do not always flush widthOfWidestLine info.
Claus Gittinger <cg@exept.de>
parents:
3437
diff
changeset
|
1201 |
|nLines widestLineRemoved| |
2233
ea4d220ac381
added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
1202 |
|
ea4d220ac381
added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
1203 |
list isNil ifTrue:[^ self]. |
ea4d220ac381
added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
1204 |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1205 |
widestLineRemoved := self widthOfWidestLineBetween:startLineNr and:endLineNr. |
2233
ea4d220ac381
added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
1206 |
list removeFromIndex:startLineNr toIndex:(endLineNr min:list size). |
ea4d220ac381
added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
1207 |
|
3442
418b14cb6a78
do not always flush widthOfWidestLine info.
Claus Gittinger <cg@exept.de>
parents:
3437
diff
changeset
|
1208 |
widthOfWidestLine == widestLineRemoved ifTrue:[ |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1209 |
widthOfWidestLine := nil. "/ i.e. unknown |
3442
418b14cb6a78
do not always flush widthOfWidestLine info.
Claus Gittinger <cg@exept.de>
parents:
3437
diff
changeset
|
1210 |
]. |
2233
ea4d220ac381
added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
1211 |
self textChanged. |
ea4d220ac381
added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
1212 |
|
2237
43f0318a830e
scroll pixel bug; removeFromIndex:toIndex: redraw bug.
Claus Gittinger <cg@exept.de>
parents:
2233
diff
changeset
|
1213 |
((startLineNr <= self lastLineShown) |
43f0318a830e
scroll pixel bug; removeFromIndex:toIndex: redraw bug.
Claus Gittinger <cg@exept.de>
parents:
2233
diff
changeset
|
1214 |
and:[endLineNr >= firstLineShown]) ifTrue:[ |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1215 |
startLineNr to:self lastLineShown do:[:eachLine | |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1216 |
self invalidateLine:eachLine |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1217 |
]. |
2233
ea4d220ac381
added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
1218 |
]. |
ea4d220ac381
added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
1219 |
|
ea4d220ac381
added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
1220 |
nLines := list size. |
ea4d220ac381
added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
1221 |
(firstLineShown >= nLines) ifTrue:[ |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1222 |
self makeLineVisible:nLines |
2233
ea4d220ac381
added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
1223 |
]. |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1224 |
self enqueueDelayedContentsChangedNotification. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1225 |
|
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1226 |
"Modified: / 25-07-2012 / 12:01:59 / cg" |
2233
ea4d220ac381
added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
1227 |
! |
ea4d220ac381
added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
1228 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1229 |
removeIndex:lineNr |
587
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
1230 |
"delete a line, redraw the view" |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1231 |
|
1453 | 1232 |
|visLine w h x |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1233 |
srcY "{ Class: SmallInteger }" | |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1234 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1235 |
(self removeIndexWithoutRedraw:lineNr) ifFalse:[^ self]. |
587
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
1236 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1237 |
" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1238 |
is there a need to redraw ? |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1239 |
" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1240 |
shown ifFalse:[^ self]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1241 |
visLine := self listLineToVisibleLine:lineNr. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1242 |
visLine notNil ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1243 |
w := self widthForScrollBetween:lineNr and:(firstLineShown + nLinesShown). |
1433 | 1244 |
"/ x := textStartLeft. |
1245 |
"/ CLAUS fixes leftOver selection pixels |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1246 |
w := w + leftMargin. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1247 |
x := margin. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1248 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1249 |
srcY := topMargin + (visLine * fontHeight). |
1453 | 1250 |
"/ h := ((nLinesShown - visLine) * fontHeight). |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1251 |
h := (height - margin - srcY). |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1252 |
h > 0 ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1253 |
self catchExpose. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1254 |
self |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1255 |
copyFrom:self |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1256 |
x:x y:srcY |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1257 |
toX:x y:(srcY - fontHeight) |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1258 |
width:w height:h |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1259 |
async:true. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1260 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1261 |
self redrawVisibleLine:nFullLinesShown. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1262 |
" |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1263 |
redraw last partial line - if any |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1264 |
" |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1265 |
(nFullLinesShown ~~ nLinesShown) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1266 |
self redrawVisibleLine:nLinesShown |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1267 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1268 |
h > 0 ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1269 |
self waitForExpose |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1270 |
]. |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1271 |
] |
587
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
1272 |
|
1460
b9929a029249
dont bitBlt if height is <= 0
Claus Gittinger <cg@exept.de>
parents:
1458
diff
changeset
|
1273 |
"Modified: / 27.2.1998 / 12:36:59 / cg" |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1274 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1275 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1276 |
removeIndexWithoutRedraw:lineNr |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1277 |
"delete a line, given its lineNr - no redraw; |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1278 |
return true, if something was really deleted (so sender knows, |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1279 |
if a redraw is needed)" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1280 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1281 |
(list isNil or:[lineNr > self size]) ifTrue:[^ false]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1282 |
list removeIndex:lineNr. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1283 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1284 |
lineNr < firstLineShown ifTrue:[ |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1285 |
firstLineShown := firstLineShown - 1 |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1286 |
]. |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1287 |
self enqueueDelayedContentsChangedNotification. |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1288 |
^ true |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1289 |
|
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1290 |
"Modified: / 25-07-2012 / 12:02:09 / cg" |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1291 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1292 |
|
2248
c6cb654bb807
added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
1293 |
replaceFrom:startLineNr to:endLineNr with:aCollection startingAt:replStartIndex |
c6cb654bb807
added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
1294 |
"replace some lines" |
c6cb654bb807
added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
1295 |
|
3198 | 1296 |
list isNil ifTrue:[ |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1297 |
list := OrderedCollection new. |
3198 | 1298 |
]. |
2248
c6cb654bb807
added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
1299 |
list replaceFrom:startLineNr to:endLineNr with:aCollection startingAt:replStartIndex. |
c6cb654bb807
added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
1300 |
|
c6cb654bb807
added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
1301 |
widthOfWidestLine := nil. "/ i.e. unknown |
c6cb654bb807
added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
1302 |
self textChanged. |
c6cb654bb807
added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
1303 |
|
c6cb654bb807
added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
1304 |
((startLineNr <= self lastLineShown) |
c6cb654bb807
added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
1305 |
and:[endLineNr >= firstLineShown]) ifTrue:[ |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1306 |
self invalidate. |
2248
c6cb654bb807
added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
1307 |
]. |
c6cb654bb807
added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
1308 |
|
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1309 |
self enqueueDelayedContentsChangedNotification. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1310 |
|
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1311 |
"Modified: / 25-07-2012 / 12:02:15 / cg" |
2248
c6cb654bb807
added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
1312 |
! |
c6cb654bb807
added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
1313 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1314 |
setContents:something |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1315 |
"set the contents (either a string or a Collection of strings) |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1316 |
dont change position (i.e. do not scroll). |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1317 |
This can be used to update a self-changing list |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1318 |
(for example: a file list being shown, without disturbing user too much). |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1319 |
Compare with #contents:, which scrolls to top." |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1320 |
|
2891 | 1321 |
|l| |
1322 |
||
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1323 |
l := something. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1324 |
l notNil ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1325 |
l isString ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1326 |
l := l asStringCollection |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1327 |
] |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1328 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1329 |
self setList:l. |
267
cc8e122f7dbe
Reset cache widthOfLongestLine in setList:, also reposition if contents fits
Stefan Vogel <sv@exept.de>
parents:
249
diff
changeset
|
1330 |
|
cc8e122f7dbe
Reset cache widthOfLongestLine in setList:, also reposition if contents fits
Stefan Vogel <sv@exept.de>
parents:
249
diff
changeset
|
1331 |
"Modified: 18.12.1995 / 22:20:43 / stefan" |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1332 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1333 |
|
105 | 1334 |
setList:aCollection |
1335 |
"set the contents (a collection of strings); |
|
153 | 1336 |
do not change position (i.e. do not scroll). |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1337 |
This can be used to update a self-changing list |
105 | 1338 |
(for example: a file list being shown, without disturbing user too much)" |
1339 |
||
1340 |
^ self setList:aCollection expandTabs:true |
|
0 | 1341 |
! |
1342 |
||
153 | 1343 |
setList:aCollection expandTabs:expandTabs |
1344 |
"set the contents (a collection of strings); |
|
1345 |
do not change position (i.e. do not scroll). |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1346 |
This can be used to update a self-changing list |
153 | 1347 |
(for example: a file list being shown, without disturbing the user too much)" |
1348 |
||
1497
5b55a84e2258
added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents:
1494
diff
changeset
|
1349 |
self setList:aCollection expandTabs:expandTabs redraw:true |
5b55a84e2258
added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents:
1494
diff
changeset
|
1350 |
|
5b55a84e2258
added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents:
1494
diff
changeset
|
1351 |
"Modified: / 22.4.1998 / 11:12:24 / cg" |
5b55a84e2258
added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents:
1494
diff
changeset
|
1352 |
! |
5b55a84e2258
added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents:
1494
diff
changeset
|
1353 |
|
5b55a84e2258
added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents:
1494
diff
changeset
|
1354 |
setList:aCollection expandTabs:expandTabs redraw:doRedraw |
5b55a84e2258
added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents:
1494
diff
changeset
|
1355 |
"set the contents (a collection of strings); |
5b55a84e2258
added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents:
1494
diff
changeset
|
1356 |
do not change position (i.e. do not scroll). |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1357 |
This can be used to update a self-changing list |
1497
5b55a84e2258
added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents:
1494
diff
changeset
|
1358 |
(for example: a file list being shown, without disturbing the user too much)" |
5b55a84e2258
added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents:
1494
diff
changeset
|
1359 |
|
4747 | 1360 |
self |
1361 |
setList:aCollection expandTabs:expandTabs scanForNonStrings:true includesNonStrings:nil |
|
1362 |
redraw:doRedraw |
|
1363 |
! |
|
1364 |
||
1365 |
setList:aCollection expandTabs:expandTabs scanForNonStrings:scan includesNonStrings:nonStringsIfNoScan redraw:doRedraw |
|
1366 |
"set the contents (a collection of strings); |
|
1367 |
do not change position (i.e. do not scroll). |
|
1368 |
This can be used to update a self-changing list |
|
1369 |
(for example: a file list being shown, without disturbing the user too much). |
|
1370 |
TODO: this stinks: most of the code is the same as in #list:expandTabs:... |
|
1371 |
needs a refactoring" |
|
1372 |
||
1373 |
|prev| |
|
1374 |
||
1375 |
prev := scrollLocked. |
|
1376 |
[ |
|
1377 |
scrollLocked := false. |
|
1378 |
self |
|
1379 |
list:aCollection |
|
1380 |
expandTabs:expandTabs |
|
1381 |
scanForNonStrings:scan |
|
1382 |
includesNonStrings:nonStringsIfNoScan |
|
1383 |
redraw:doRedraw |
|
1384 |
] ensure:[ |
|
1385 |
scrollLocked := prev |
|
1608
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
1386 |
]. |
4747 | 1387 |
"/ |
1388 |
"/ |
|
1389 |
"/"/ scrollLocked ifTrue:[ |
|
1390 |
"/"/ self setList:newText expandTabs:expandTabsWhenUpdating |
|
1391 |
"/"/ ] ifFalse:[ |
|
1392 |
"/ self list:newText expandTabs:expandTabsWhenUpdating scanForNonStrings:expandTabsWhenUpdating |
|
1393 |
"/"/ ] |
|
1394 |
"/ |
|
1395 |
"/ |oldFirst nonStringsBefore| |
|
1396 |
"/ |
|
1397 |
"/ (aCollection isNil and:[list isNil]) ifTrue:[ |
|
1398 |
"/ "no change" |
|
1399 |
"/ ^ self |
|
1400 |
"/ ]. |
|
1401 |
"/ |
|
1402 |
"/ list := aCollection. |
|
1403 |
"/ |
|
1404 |
"/ nonStringsBefore := includesNonStrings. |
|
1405 |
"/ includesNonStrings := false. |
|
1406 |
"/ |
|
1407 |
"/ list notNil ifTrue:[ |
|
1408 |
"/ expandTabs ifTrue:[ |
|
1409 |
"/ self expandTabs |
|
1410 |
"/ ] ifFalse:[ |
|
1411 |
"/ scan ifTrue:[ |
|
1412 |
"/ includesNonStrings := (list findFirst:[:e | e isString not]) ~~ 0. |
|
1413 |
"/ ] ifFalse:[ |
|
1414 |
"/ includesNonStrings := nonStringsIfNoScan ? nonStringsBefore |
|
1415 |
"/ ] |
|
1416 |
"/ ]. |
|
1417 |
"/ ]. |
|
1418 |
"/ (includesNonStrings ~~ nonStringsBefore) ifTrue:[ |
|
1419 |
"/ self getFontParameters. |
|
1420 |
"/ self computeNumberOfLinesShown. |
|
1421 |
"/ ]. |
|
1422 |
"/ |
|
1423 |
"/ "/ new: reposition horizontally if too big |
|
1424 |
"/ widthOfWidestLine := nil. "/ i.e. unknown |
|
1425 |
"/ innerWidth >= self widthOfContents ifTrue:[ |
|
1426 |
"/ viewOrigin := 0 @ viewOrigin y. |
|
1427 |
"/ ]. |
|
1428 |
"/ self contentsChanged. |
|
1429 |
"/ |
|
1430 |
"/ "/ new: reposition vertically if too big |
|
1431 |
"/ (firstLineShown + nFullLinesShown) > self size ifTrue:[ |
|
1432 |
"/ oldFirst := firstLineShown. |
|
1433 |
"/ firstLineShown := self size - nFullLinesShown + 1. |
|
1434 |
"/ firstLineShown < 1 ifTrue:[firstLineShown := 1]. |
|
1435 |
"/ oldFirst ~= firstLineShown ifTrue:[ |
|
1436 |
"/ viewOrigin y:((firstLineShown - 1) * fontHeight). |
|
1437 |
"/ self originChanged:0 @ ((oldFirst - 1) negated * fontHeight). |
|
1438 |
"/ shown ifTrue:[ |
|
1439 |
"/ self clearView. |
|
1440 |
"/ ] |
|
1441 |
"/ ] |
|
1442 |
"/ ]. |
|
1443 |
"/ |
|
1444 |
"/ (shown and:[doRedraw]) ifTrue:[ |
|
1445 |
"/ self invalidate |
|
1446 |
"/ "/ self redrawFromVisibleLine:1 to:nLinesShown |
|
1447 |
"/ ] |
|
1448 |
"/ |
|
1449 |
"/ "Modified: / 18.12.1995 / 23:27:54 / stefan" |
|
1450 |
"/ "Created: / 22.4.1998 / 11:11:51 / cg" |
|
1451 |
"/ "Modified: / 26.7.1998 / 13:46:49 / cg" |
|
153 | 1452 |
! |
1453 |
||
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1454 |
size |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1455 |
"return the size (i.e. number of lines) |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1456 |
this allows textViews to be used like collections in some places." |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1457 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1458 |
^ list size. |
0 | 1459 |
! |
1460 |
||
919 | 1461 |
stringAtLine:lineNr from:col1 to:col2 |
1462 |
"return the substring starting at physical line/col1, up-to and |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1463 |
including col2. |
919 | 1464 |
The lineNr and colNr arguments start at 1, for the top-left character. |
1465 |
Fills the string with space characters at the right. |
|
2707 | 1466 |
(i.e. beyond the end of the line or below the last line)" |
919 | 1467 |
|
1468 |
|line len s| |
|
1469 |
||
1470 |
len := col2 - col1 + 1. |
|
1471 |
list notNil ifTrue:[ |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1472 |
line := self listAt:lineNr. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1473 |
line notNil ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1474 |
(line size >= col1) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1475 |
s := line copyFrom:col1. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1476 |
s size < len ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1477 |
^ s paddedTo:len |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1478 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1479 |
^ s copyTo:len |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1480 |
] |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1481 |
] |
919 | 1482 |
]. |
1483 |
^ String new:len withAll:Character space |
|
1484 |
||
1485 |
"Created: 7.1.1997 / 19:58:43 / cg" |
|
1486 |
! |
|
1487 |
||
2427
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
1488 |
textFromCharacterPosition:charPos1 to:charPos2 |
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
1489 |
"return some text as a collection of (line-)strings." |
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
1490 |
|
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
1491 |
|line1 col1 line2 col2| |
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
1492 |
|
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
1493 |
line1 := self lineOfCharacterPosition:charPos1. |
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
1494 |
col1 := charPos1 - (self characterPositionOfLine:line1 col:1) + 1. |
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
1495 |
|
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
1496 |
line2 := self lineOfCharacterPosition:charPos2. |
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
1497 |
col2 := charPos2 - (self characterPositionOfLine:line2 col:1) + 1. |
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
1498 |
|
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
1499 |
^ self textFromLine:line1 col:col1 toLine:line2 col:col2. |
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
1500 |
! |
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
1501 |
|
2158
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1502 |
textFromLine:startLine col:startCol toLine:endLine col:endCol |
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1503 |
"return some text as a collection of (line-)strings." |
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1504 |
|
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1505 |
|text sz index last| |
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1506 |
|
4422
9954fb1dc0a4
changed: #textFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
4403
diff
changeset
|
1507 |
startLine isNil ifTrue:[^ nil]. |
9954fb1dc0a4
changed: #textFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
4403
diff
changeset
|
1508 |
endLine isNil ifTrue:[^ nil]. |
9954fb1dc0a4
changed: #textFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
4403
diff
changeset
|
1509 |
|
2158
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1510 |
(startLine == endLine) ifTrue:[ |
4422
9954fb1dc0a4
changed: #textFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
4403
diff
changeset
|
1511 |
"part of a line" |
9954fb1dc0a4
changed: #textFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
4403
diff
changeset
|
1512 |
^ StringCollection with:(self listAt:startLine from:startCol to:endCol) |
2158
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1513 |
]. |
4422
9954fb1dc0a4
changed: #textFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
4403
diff
changeset
|
1514 |
|
2158
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1515 |
sz := endLine - startLine + 1. |
2687 | 1516 |
sz < 1 ifTrue:[^ nil]. |
1517 |
||
2158
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1518 |
text := StringCollection new:sz. |
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1519 |
|
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1520 |
"get 1st and last (possibly) partial lines" |
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1521 |
text at:1 put:(self listAt:startLine from:startCol). |
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1522 |
endCol == 0 ifTrue:[ |
4422
9954fb1dc0a4
changed: #textFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
4403
diff
changeset
|
1523 |
last := '' |
2158
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1524 |
] ifFalse:[ |
4422
9954fb1dc0a4
changed: #textFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
4403
diff
changeset
|
1525 |
last := self listAt:endLine to:endCol. |
2158
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1526 |
]. |
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1527 |
text at:sz put:last. |
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1528 |
|
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1529 |
"get bulk of text" |
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1530 |
index := 2. |
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1531 |
(startLine + 1) to:(endLine - 1) do:[:lineNr | |
4422
9954fb1dc0a4
changed: #textFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
4403
diff
changeset
|
1532 |
text at:index put:(self listAt:lineNr). |
9954fb1dc0a4
changed: #textFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
4403
diff
changeset
|
1533 |
index := index + 1 |
2158
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1534 |
]. |
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1535 |
^ text |
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1536 |
|
4422
9954fb1dc0a4
changed: #textFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
4403
diff
changeset
|
1537 |
"Created: / 22-02-2000 / 23:53:06 / cg" |
2158
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1538 |
! |
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1539 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1540 |
withoutRedrawAt:index put:aString |
2224
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
1541 |
"change a line without redisplay and WITHOUT any sizeChange notifications. |
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
1542 |
Somewhat dangerous, since scrollBars will not be informed about contents-changes. |
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
1543 |
Use only if multiple lines are to be changed, and a sizeChanged is invoked by some other |
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
1544 |
means at the end." |
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
1545 |
|
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
1546 |
|didIncludeNonStrings oldLine| |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1547 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1548 |
self checkForExistingLine:index. |
2180
d208b77444a7
must set modified flag in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents:
2158
diff
changeset
|
1549 |
|
d208b77444a7
must set modified flag in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents:
2158
diff
changeset
|
1550 |
oldLine := self listAt:index. |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1551 |
list at:index put:aString. |
2180
d208b77444a7
must set modified flag in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents:
2158
diff
changeset
|
1552 |
oldLine ~= aString ifTrue:[ |
4751 | 1553 |
self textChanged |
2180
d208b77444a7
must set modified flag in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents:
2158
diff
changeset
|
1554 |
]. |
d208b77444a7
must set modified flag in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents:
2158
diff
changeset
|
1555 |
|
1608
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
1556 |
didIncludeNonStrings := includesNonStrings. |
105 | 1557 |
includesNonStrings ifFalse:[ |
5111 | 1558 |
includesNonStrings := (aString notNil and:[(aString isSingleByteString) not]). |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1559 |
] ifTrue:[ |
5111 | 1560 |
(aString isNil or:[(aString isSingleByteString)]) ifTrue:[ |
1561 |
includesNonStrings := list contains:[:l | l notNil and:[(l isSingleByteString) not]]. |
|
4751 | 1562 |
] |
105 | 1563 |
]. |
851
b9d71ccdefaa
care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents:
837
diff
changeset
|
1564 |
|
1608
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
1565 |
includesNonStrings ~~ didIncludeNonStrings ifTrue:[ |
4751 | 1566 |
self getFontParameters. |
1567 |
self computeNumberOfLinesShown |
|
1608
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
1568 |
]. |
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
1569 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1570 |
widthOfWidestLine notNil ifTrue:[ |
4751 | 1571 |
self recomputeWidthOfWidestLineFor:aString old:oldLine. |
1963
aa5d0f63db19
notify about contentsChange in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents:
1938
diff
changeset
|
1572 |
]. |
634
1ca770b2c494
handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
1573 |
|
1608
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
1574 |
"Modified: / 26.7.1998 / 13:00:14 / cg" |
105 | 1575 |
! ! |
1576 |
||
2455 | 1577 |
!ListView methodsFor:'accessing-look'! |
1578 |
||
1579 |
backgroundColor |
|
1580 |
"return the background color" |
|
1581 |
||
1582 |
^ bgColor |
|
1583 |
! |
|
1584 |
||
1585 |
backgroundColor:aColor |
|
1586 |
"set the background color of the contents" |
|
1587 |
||
1588 |
bgColor ~~ aColor ifTrue:[ |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1589 |
bgColor := aColor. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1590 |
self viewBackground:bgColor. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1591 |
self invalidate "/ clear; redraw |
2455 | 1592 |
] |
1593 |
||
1594 |
"Modified: 3.5.1997 / 10:27:40 / cg" |
|
1595 |
! |
|
1596 |
||
1597 |
font:aFont |
|
1598 |
"set the font for all shown text. |
|
1599 |
Redraws everything. |
|
1600 |
CAVEAT: with the addition of Text objects, |
|
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1601 |
this method is going to be obsoleted by a textStyle |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1602 |
method, which allows specific control over |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1603 |
normalFont/boldFont/italicFont parameters." |
2455 | 1604 |
|
1605 |
aFont isNil ifTrue:[ |
|
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1606 |
^ self error:'nil font' mayProceed:true |
2455 | 1607 |
]. |
1608 |
font ~~ aFont ifTrue:[ |
|
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1609 |
super font:(aFont onDevice:device). |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1610 |
preferredExtent := nil. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1611 |
widthOfWidestLine := nil. "/ i.e. unknown |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1612 |
self getFontParameters. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1613 |
realized ifTrue:[ |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1614 |
(font graphicsDevice == device) ifTrue:[ |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1615 |
self computeNumberOfLinesShown. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1616 |
shown ifTrue:[ |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1617 |
self redrawFromVisibleLine:1 to:nLinesShown |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1618 |
] |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1619 |
]. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1620 |
self enqueueDelayedContentsChangedNotification |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1621 |
] |
2455 | 1622 |
] |
1623 |
||
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1624 |
"Modified: / 25-07-2012 / 12:01:36 / cg" |
2455 | 1625 |
! |
1626 |
||
1627 |
fontHeight:pixels |
|
4830 | 1628 |
"set the lines height - that's the number of pixels, |
2455 | 1629 |
by which lines are vertically separated." |
1630 |
||
1631 |
fontHeight ~~ pixels ifTrue:[ |
|
4830 | 1632 |
fontHeight := pixels. |
2455 | 1633 |
] |
1634 |
||
1635 |
"Created: 17.4.1997 / 01:41:33 / cg" |
|
1636 |
! |
|
1637 |
||
1638 |
foregroundColor |
|
1639 |
"return the foreground color" |
|
1640 |
||
1641 |
^ fgColor |
|
1642 |
! |
|
1643 |
||
1644 |
foregroundColor:aColor |
|
1645 |
"set the foreground color" |
|
1646 |
||
1647 |
fgColor ~~ aColor ifTrue:[ |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1648 |
fgColor := aColor. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1649 |
self invalidate |
2455 | 1650 |
] |
1651 |
||
1652 |
"Modified: 29.5.1996 / 16:19:02 / cg" |
|
1653 |
! |
|
1654 |
||
1655 |
foregroundColor:color1 backgroundColor:color2 |
|
1656 |
"set both foreground and background colors" |
|
1657 |
||
1658 |
((fgColor ~~ color1) or:[bgColor ~~ color2]) ifTrue:[ |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1659 |
fgColor := color1. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1660 |
bgColor := color2. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1661 |
self invalidate |
2455 | 1662 |
] |
1663 |
||
1664 |
"Modified: 29.5.1996 / 16:19:05 / cg" |
|
1665 |
! |
|
1666 |
||
1667 |
innerHorizontalMargin |
|
1668 |
"return the margin between the left border and the 1st col" |
|
1669 |
||
1670 |
^ leftMargin |
|
1671 |
||
1672 |
"Created: 16.1.1996 / 19:28:23 / cg" |
|
1673 |
! |
|
1674 |
||
1675 |
innerVerticalMargin |
|
1676 |
"return the margin between the top border and the 1st line" |
|
1677 |
||
1678 |
^ topMargin |
|
1679 |
||
1680 |
"Created: 16.1.1996 / 19:28:00 / cg" |
|
1681 |
! |
|
1682 |
||
1683 |
leftMargin |
|
1684 |
"return the margin to left of 1st col" |
|
1685 |
||
1686 |
^ leftMargin |
|
1687 |
! |
|
1688 |
||
1689 |
leftMargin:aNumber |
|
1690 |
"set the margin between the left border and the 1st col" |
|
1691 |
||
1692 |
leftMargin := aNumber. |
|
1693 |
textStartLeft := aNumber + margin. |
|
1694 |
innerWidth := width - aNumber - margin |
|
1695 |
||
1696 |
"Modified: 28.2.1996 / 19:32:55 / cg" |
|
1697 |
! |
|
1698 |
||
1699 |
level:aNumber |
|
1700 |
"set the 3D level - caught here to update text-position variables |
|
1701 |
(which avoids many computations later)" |
|
1702 |
||
1703 |
|newMargin| |
|
1704 |
||
1705 |
aNumber ~~ level ifTrue:[ |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1706 |
newMargin := aNumber abs. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1707 |
textStartLeft := leftMargin + newMargin. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1708 |
textStartTop := topMargin + newMargin. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1709 |
innerWidth := width - textStartLeft - newMargin. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1710 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1711 |
super level:aNumber. |
2455 | 1712 |
] |
1713 |
||
1714 |
"Modified: 11.8.1997 / 02:59:15 / cg" |
|
1715 |
! |
|
1716 |
||
4668 | 1717 |
lineSpacing |
1718 |
"get the lineSpacing - that's an additional number of pixels, |
|
1719 |
by which lines are vertically separated." |
|
1720 |
||
1721 |
^ lineSpacing |
|
1722 |
! |
|
1723 |
||
2455 | 1724 |
lineSpacing:pixels |
4668 | 1725 |
"set the lineSpacing - that's an additional number of pixels, |
2455 | 1726 |
by which lines are vertically separated." |
1727 |
||
1728 |
lineSpacing ~~ pixels ifTrue:[ |
|
4668 | 1729 |
lineSpacing := pixels. |
1730 |
self getFontParameters. |
|
2455 | 1731 |
] |
1732 |
||
1733 |
"Modified: 22.5.1996 / 12:22:29 / cg" |
|
1734 |
! |
|
1735 |
||
1736 |
partialLines:aBoolean |
|
1737 |
"allow/disallow display of a last partial line" |
|
1738 |
||
1739 |
partialLines := aBoolean. |
|
1740 |
self computeNumberOfLinesShown |
|
1741 |
! |
|
1742 |
||
1743 |
topMargin:aNumber |
|
1744 |
"set the margin between the top border and the 1st line" |
|
1745 |
||
1746 |
topMargin := aNumber. |
|
1747 |
textStartTop := topMargin + margin. |
|
1748 |
! |
|
1749 |
||
1750 |
viewBackground:aColor |
|
1751 |
super viewBackground:aColor. |
|
1752 |
self isTextView ifFalse:[ |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1753 |
self backgroundColor:aColor |
2455 | 1754 |
]. |
1755 |
! ! |
|
1756 |
||
118 | 1757 |
!ListView methodsFor:'accessing-mvc'! |
1758 |
||
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1759 |
addModelInterfaceTo:aDictionary |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1760 |
"see comment in View>>modelInterface" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1761 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1762 |
super addModelInterfaceTo:aDictionary. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1763 |
aDictionary at:#listMessage put:listMsg |
118 | 1764 |
! |
1765 |
||
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1766 |
listMessage |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1767 |
"return the listMsg selector; |
125 | 1768 |
if non-nil, this is the message sent to the model (if any) to aquire |
1769 |
a new text upon change of the aspect. |
|
120 | 1770 |
This defaults to the aspect-selector." |
118 | 1771 |
|
125 | 1772 |
^ listMsg |
1773 |
! |
|
1774 |
||
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1775 |
listMessage:aSymbol |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1776 |
"ST-80 compatibility: set the listMsg selector; |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1777 |
if non-nil, this will be sent to the model (if any) to aquire a |
125 | 1778 |
new text upon change of the aspect. |
1779 |
This defaults to the aspect-selector." |
|
1780 |
||
1781 |
listMsg := aSymbol. |
|
120 | 1782 |
! |
1783 |
||
907
ea81777689f1
Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents:
903
diff
changeset
|
1784 |
model:aModel |
5029 | 1785 |
"define the receiver's model, from which the text is |
907
ea81777689f1
Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents:
903
diff
changeset
|
1786 |
to be aquired via list- or aspect-messages, whenever its aspect |
ea81777689f1
Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents:
903
diff
changeset
|
1787 |
changes." |
ea81777689f1
Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents:
903
diff
changeset
|
1788 |
|
ea81777689f1
Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents:
903
diff
changeset
|
1789 |
super model:aModel. |
ea81777689f1
Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents:
903
diff
changeset
|
1790 |
self getListFromModel |
ea81777689f1
Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents:
903
diff
changeset
|
1791 |
|
ea81777689f1
Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents:
903
diff
changeset
|
1792 |
"Created: 31.12.1996 / 14:56:43 / stefan" |
ea81777689f1
Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents:
903
diff
changeset
|
1793 |
! |
ea81777689f1
Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents:
903
diff
changeset
|
1794 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1795 |
on:aModel aspect:aspectSymbol |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1796 |
"ST-80 compatibility" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1797 |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1798 |
^ self on:aModel aspect:aspectSymbol change:nil list:aspectSymbol menu:nil |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1799 |
! |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1800 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1801 |
on:aModel aspect:aspectSymbol change:changeSymbol |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1802 |
"ST-80 compatibility" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1803 |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1804 |
^self on:aModel aspect:aspectSymbol change:changeSymbol list:aspectSymbol menu:nil |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1805 |
! |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1806 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1807 |
on:aModel aspect:aspectSymbol change:changeSymbol list:listSymbol menu:menuSymbol |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1808 |
"ST-80 compatibility" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1809 |
|
4015
8647dad37cb0
comment/format in: #on:aspect:change:list:menu:
Claus Gittinger <cg@exept.de>
parents:
3869
diff
changeset
|
1810 |
aspectSymbol notNil ifTrue:[ |
8647dad37cb0
comment/format in: #on:aspect:change:list:menu:
Claus Gittinger <cg@exept.de>
parents:
3869
diff
changeset
|
1811 |
aspectMsg := aspectSymbol. |
8647dad37cb0
comment/format in: #on:aspect:change:list:menu:
Claus Gittinger <cg@exept.de>
parents:
3869
diff
changeset
|
1812 |
listMsg isNil ifTrue:[ |
8647dad37cb0
comment/format in: #on:aspect:change:list:menu:
Claus Gittinger <cg@exept.de>
parents:
3869
diff
changeset
|
1813 |
listMsg := aspectSymbol |
8647dad37cb0
comment/format in: #on:aspect:change:list:menu:
Claus Gittinger <cg@exept.de>
parents:
3869
diff
changeset
|
1814 |
] |
8647dad37cb0
comment/format in: #on:aspect:change:list:menu:
Claus Gittinger <cg@exept.de>
parents:
3869
diff
changeset
|
1815 |
]. |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1816 |
listSymbol notNil ifTrue:[listMsg := listSymbol]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1817 |
changeSymbol notNil ifTrue:[changeMsg := changeSymbol]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1818 |
menuMsg := menuSymbol. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1819 |
self model:aModel. |
909
be8e88881f4d
dont clear listMessage in #on:aspect:...
Claus Gittinger <cg@exept.de>
parents:
907
diff
changeset
|
1820 |
|
be8e88881f4d
dont clear listMessage in #on:aspect:...
Claus Gittinger <cg@exept.de>
parents:
907
diff
changeset
|
1821 |
"Modified: 2.1.1997 / 16:11:16 / cg" |
105 | 1822 |
! |
1823 |
||
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1824 |
on:aModel aspect:aspectSymbol change:changeSymbol menu:menuSymbol |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1825 |
"ST-80 compatibility" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1826 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1827 |
^ self on:aModel aspect:aspectSymbol change:changeSymbol list:nil menu:menuSymbol |
0 | 1828 |
! |
1829 |
||
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1830 |
on:aModel aspect:aspectSymbol list:listSymbol menu:menuSymbol |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1831 |
"ST-80 compatibility" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1832 |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1833 |
^ self on:aModel aspect:aspectSymbol change:nil list:listSymbol menu:menuSymbol |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1834 |
! |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1835 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1836 |
on:aModel aspect:aspectSymbol menu:menuSymbol |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1837 |
"ST-80 compatibility" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1838 |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1839 |
^self on:aModel aspect:aspectSymbol change:nil list:aspectSymbol menu:menuSymbol |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1840 |
! ! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1841 |
|
2227 | 1842 |
!ListView methodsFor:'change & update'! |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1843 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1844 |
update:something with:aParameter from:changedObject |
2322 | 1845 |
|idx| |
1846 |
||
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1847 |
changedObject == model ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1848 |
model isList ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1849 |
list ~~ model ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1850 |
something == #at: ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1851 |
idx := aParameter isCollection ifTrue:[aParameter at:1] |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1852 |
ifFalse:[aParameter]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1853 |
^ self at:aParameter put:(model at:idx). |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1854 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1855 |
something == #insert: ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1856 |
(list size + 1) >= aParameter ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1857 |
^ self add:(model at:aParameter) beforeIndex:aParameter |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1858 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1859 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1860 |
something == #remove: ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1861 |
list size >= aParameter ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1862 |
^ self removeIndex:aParameter |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1863 |
] |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1864 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1865 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1866 |
self getListFromModel. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1867 |
^ self |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1868 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1869 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1870 |
(aspectMsg notNil |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1871 |
and:[something == aspectMsg]) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1872 |
self getListFromModel. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1873 |
^ self |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1874 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1875 |
something isNil ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1876 |
"/ model changed (not more information) |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1877 |
self getListFromModel. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1878 |
^ self |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1879 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1880 |
something == #size ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1881 |
self getListFromModelScroll:false. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1882 |
^ self |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1883 |
]. |
0 | 1884 |
]. |
3425
883607c8a0df
care for listChannel changes
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
1885 |
changedObject == listChannel ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1886 |
self getListFromModel. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1887 |
^ self |
3425
883607c8a0df
care for listChannel changes
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
1888 |
]. |
883607c8a0df
care for listChannel changes
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
1889 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1890 |
^ super update:something with:aParameter from:changedObject |
1099
eccab3759ddb
in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents:
1081
diff
changeset
|
1891 |
|
3425
883607c8a0df
care for listChannel changes
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
1892 |
"Modified: / 08-11-2006 / 19:40:29 / cg" |
0 | 1893 |
! ! |
1894 |
||
105 | 1895 |
!ListView methodsFor:'drawing'! |
1896 |
||
1897 |
drawFromVisibleLine:startVisLineNr to:endVisLineNr with:fg and:bg |
|
1898 |
"draw a visible line range in fg/bg" |
|
1899 |
||
1900 |
|y "{ Class: SmallInteger }" |
|
1901 |
x "{ Class: SmallInteger }" |
|
1902 |
startLine "{ Class: SmallInteger }" |
|
1903 |
endLine "{ Class: SmallInteger }" |
|
2089
b774525a10b2
avoid drawing blue-on-blue, if selection bg is lines fg color
Claus Gittinger <cg@exept.de>
parents:
2082
diff
changeset
|
1904 |
listSize e sH l| |
105 | 1905 |
|
1906 |
y := self yOfVisibleLine:startVisLineNr. |
|
394
795f293f8520
fixed debris-leftover in scrollDown
Claus Gittinger <cg@exept.de>
parents:
392
diff
changeset
|
1907 |
sH := lineSpacing // 2. |
795f293f8520
fixed debris-leftover in scrollDown
Claus Gittinger <cg@exept.de>
parents:
392
diff
changeset
|
1908 |
|
1700
3538310c2724
fixed widthOfContents with variable fonts (win32);
Claus Gittinger <cg@exept.de>
parents:
1699
diff
changeset
|
1909 |
backgroundAlreadyClearedColor == bg ifFalse:[ |
4641 | 1910 |
self paint:bg. |
1911 |
self fillRectangleX:margin |
|
1912 |
y:y-sH |
|
1913 |
width:(width - (margin * 2)) |
|
1914 |
height:(endVisLineNr - startVisLineNr + 1) * fontHeight + (lineSpacing - sH). |
|
1700
3538310c2724
fixed widthOfContents with variable fonts (win32);
Claus Gittinger <cg@exept.de>
parents:
1699
diff
changeset
|
1915 |
]. |
105 | 1916 |
list isNil ifTrue:[^ self]. |
1917 |
||
1918 |
y := y + fontAscent. |
|
1919 |
listSize := self size. |
|
1920 |
||
1921 |
startLine := startVisLineNr + firstLineShown - 1. |
|
1922 |
endLine := endVisLineNr + firstLineShown - 1. |
|
1923 |
(startLine == 0) ifTrue:[ |
|
4641 | 1924 |
y := y + fontHeight. |
1925 |
startLine := startLine + 1 |
|
105 | 1926 |
]. |
1927 |
||
1928 |
(endLine > listSize) ifTrue:[ |
|
4641 | 1929 |
e := listSize |
105 | 1930 |
] ifFalse:[ |
4641 | 1931 |
e := endLine |
105 | 1932 |
]. |
1933 |
||
1934 |
(startLine <= e) ifTrue:[ |
|
4641 | 1935 |
x := textStartLeft - viewOrigin x. |
1936 |
self paint:fg on:bg. |
|
1937 |
"/ dont use list from:to:do:, to allow for subclasses to redefine the enumeration (TableView) |
|
1938 |
self from:startLine to:e do:[:line | |
|
1939 |
line notNil ifTrue:[ |
|
1940 |
"/ remove line's color emphasis, to enforce color. |
|
1941 |
"/ otherwise blue text is not visible if selection-bg is blue |
|
1942 |
l := self withoutColorEmphasis:line ifFg:fg andBg:bg. |
|
1943 |
self displayOpaqueString:l x:x y:y |
|
1944 |
]. |
|
1945 |
y := y + fontHeight |
|
1946 |
] |
|
105 | 1947 |
] |
1948 |
||
2090
85c0dd8a4281
selection over colored text - again
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
1949 |
"Modified: / 15.12.1999 / 23:19:39 / cg" |
7 | 1950 |
! |
1951 |
||
131 | 1952 |
drawLine:line atX:x inVisible:visLineNr with:fg and:bg |
1953 |
"draw a given string at visible lines position with |
|
422
12bfba6f62b5
redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents:
407
diff
changeset
|
1954 |
given x position in fg/bg. Clears the whole line before drawing the string. |
5198 | 1955 |
This is a low level entry; not meant for public use." |
422
12bfba6f62b5
redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents:
407
diff
changeset
|
1956 |
|
2090
85c0dd8a4281
selection over colored text - again
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
1957 |
|y l| |
422
12bfba6f62b5
redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents:
407
diff
changeset
|
1958 |
|
12bfba6f62b5
redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents:
407
diff
changeset
|
1959 |
y := self yOfVisibleLine:visLineNr. |
1700
3538310c2724
fixed widthOfContents with variable fonts (win32);
Claus Gittinger <cg@exept.de>
parents:
1699
diff
changeset
|
1960 |
backgroundAlreadyClearedColor == bg ifFalse:[ |
4049 | 1961 |
self paint:bg. |
1962 |
self fillRectangleX:margin y:y - (lineSpacing//2) |
|
1963 |
width:(width - (2 * margin)) |
|
1964 |
height:fontHeight. |
|
1700
3538310c2724
fixed widthOfContents with variable fonts (win32);
Claus Gittinger <cg@exept.de>
parents:
1699
diff
changeset
|
1965 |
]. |
422
12bfba6f62b5
redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents:
407
diff
changeset
|
1966 |
line notNil ifTrue:[ |
4049 | 1967 |
self paint:fg on:bg. |
1968 |
||
1969 |
"/ remove lines color emphasis, to enforce color. |
|
1970 |
"/ otherwise blue text is not visible if selection-bg is blue. |
|
1971 |
"/ this is only done in EditTextViews and subClasses. |
|
1972 |
self suppressEmphasisInSelection ifTrue:[ |
|
1973 |
l := self withoutColorEmphasis:line ifFg:fg andBg:bg. |
|
1974 |
] ifFalse:[ |
|
1975 |
l := line |
|
1976 |
]. |
|
1977 |
self displayOpaqueString:l x:x y:(y + fontAscent) |
|
422
12bfba6f62b5
redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents:
407
diff
changeset
|
1978 |
] |
12bfba6f62b5
redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents:
407
diff
changeset
|
1979 |
|
2090
85c0dd8a4281
selection over colored text - again
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
1980 |
"Modified: / 15.12.1999 / 23:19:46 / cg" |
422
12bfba6f62b5
redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents:
407
diff
changeset
|
1981 |
! |
12bfba6f62b5
redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents:
407
diff
changeset
|
1982 |
|
12bfba6f62b5
redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents:
407
diff
changeset
|
1983 |
drawLine:line fromX:x inVisible:visLineNr with:fg and:bg |
12bfba6f62b5
redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents:
407
diff
changeset
|
1984 |
"draw a given string at visible lines position with |
12bfba6f62b5
redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents:
407
diff
changeset
|
1985 |
given x position in fg/bg. Clears partial line before drawing the string. |
131 | 1986 |
Low level entry; not meant for public use." |
1987 |
||
2090
85c0dd8a4281
selection over colored text - again
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
1988 |
|y l| |
105 | 1989 |
|
1990 |
y := self yOfVisibleLine:visLineNr. |
|
1991 |
line notNil ifTrue:[ |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1992 |
self paint:fg on:bg. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1993 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1994 |
"/ remove lines color emphasis, to enforce color. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1995 |
"/ otherwise blue text is not visible if selection-bg is blue |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1996 |
l := self withoutColorEmphasis:line ifFg:fg andBg:bg. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1997 |
self displayOpaqueString:l x:x y:(y + fontAscent) |
105 | 1998 |
] |
191
5ccbde40bb6b
draw strings half a lineSpacing lower - highlight frames look better
Claus Gittinger <cg@exept.de>
parents:
190
diff
changeset
|
1999 |
|
2090
85c0dd8a4281
selection over colored text - again
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
2000 |
"Modified: / 15.12.1999 / 23:19:55 / cg" |
105 | 2001 |
! |
2002 |
||
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
2003 |
drawLine:lineStringArg inVisible:visLineNr col:col with:fg and:bg |
105 | 2004 |
"draw single character at col index of visible line in fg/bg" |
2005 |
||
2561 | 2006 |
|y yf x len lineString characterString w| |
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
2007 |
|
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
2008 |
lineString := lineStringArg. |
2561 | 2009 |
len := lineString size. |
1927
d5e14e7bce6f
fixed cursor drawing over coloured text
Claus Gittinger <cg@exept.de>
parents:
1911
diff
changeset
|
2010 |
|
2429
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2427
diff
changeset
|
2011 |
x := (self xOfCol:col inVisibleLine:visLineNr) - viewOrigin x. |
105 | 2012 |
y := self yOfVisibleLine:visLineNr. |
2561 | 2013 |
yf := y - (lineSpacing // 2). |
2014 |
||
2576
8af235849704
partial redraw behone non-string lines end
Michael Beyl <mb@exept.de>
parents:
2565
diff
changeset
|
2015 |
self paint:bg. |
8af235849704
partial redraw behone non-string lines end
Michael Beyl <mb@exept.de>
parents:
2565
diff
changeset
|
2016 |
|
2561 | 2017 |
(lineString notNil and:[lineString isString not]) ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2018 |
w := lineString widthFrom:col to:(col min:len) on:self. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2019 |
w <= 0 ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2020 |
w := font width. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2021 |
self fillRectangleX:x y:yf width:w height:fontHeight. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2022 |
self paint:fg |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2023 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2024 |
self clippedTo:(Rectangle left:x top:yf width:w height:fontHeight) do:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2025 |
self drawVisibleLine:visLineNr with:fg and:bg |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2026 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2027 |
^ self |
2561 | 2028 |
]. |
2029 |
||
2654 | 2030 |
(lineString isNil or:[col > len]) ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2031 |
self fillRectangleX:x y:yf width:(font width) height:fontHeight. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2032 |
self paint:fg |
105 | 2033 |
] ifFalse:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2034 |
characterString := lineString copyFrom:col to:col. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2035 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2036 |
"/ remove lines color emphasis, to enforce color. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2037 |
"/ otherwise blue text is not visible if selection-bg is blue |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2038 |
characterString := self withoutColorEmphasis:characterString ifFg:fg andBg:bg. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2039 |
w := characterString widthOn:self. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2040 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2041 |
self fillRectangleX:x y:yf width:w height:fontHeight. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2042 |
self paint:fg. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2043 |
self clippedTo:(Rectangle left:x top:yf width:w height:fontHeight) do:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2044 |
self displayString:characterString x:x y:(y + fontAscent) |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2045 |
] |
105 | 2046 |
] |
191
5ccbde40bb6b
draw strings half a lineSpacing lower - highlight frames look better
Claus Gittinger <cg@exept.de>
parents:
190
diff
changeset
|
2047 |
|
2090
85c0dd8a4281
selection over colored text - again
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
2048 |
"Modified: / 15.12.1999 / 23:21:12 / cg" |
105 | 2049 |
! |
2050 |
||
2558
4c10bec1117d
more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents:
2557
diff
changeset
|
2051 |
drawLine:lineStringArg inVisible:visLineNr from:startCol to:endColOrNil with:fg and:bg |
105 | 2052 |
"draw part of a visible line in fg/bg" |
2053 |
||
4637 | 2054 |
|y yf x lineString len characterString w endCol sCol eCol numExtraCols| |
2558
4c10bec1117d
more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents:
2557
diff
changeset
|
2055 |
|
4c10bec1117d
more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents:
2557
diff
changeset
|
2056 |
"/ hack - please rewrite |
4c10bec1117d
more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents:
2557
diff
changeset
|
2057 |
endCol := endColOrNil ? lineStringArg size. |
105 | 2058 |
(endCol >= startCol) ifTrue:[ |
4049 | 2059 |
sCol := startCol max:1. |
2060 |
||
2061 |
lineString := lineStringArg. |
|
2062 |
||
2063 |
x := (self xOfCol:sCol inVisibleLine:visLineNr) - viewOrigin x. |
|
2064 |
y := (self yOfVisibleLine:visLineNr). |
|
2065 |
yf := y - (lineSpacing // 2). |
|
2066 |
||
2067 |
len := lineString size. |
|
5111 | 2068 |
(lineString notNil and:[lineString isString not ]) |
4049 | 2069 |
ifTrue:[ |
2070 |
w := lineString widthFrom:sCol to:(endCol min:len) on:self. |
|
2071 |
endCol > len ifTrue:[ |
|
2072 |
sCol > len ifTrue:[ |
|
4637 | 2073 |
numExtraCols := (endCol - sCol + 1). |
4049 | 2074 |
] ifFalse:[ |
4637 | 2075 |
numExtraCols := (endCol - len" + 1"). |
4049 | 2076 |
]. |
2077 |
self paint:bg. |
|
4637 | 2078 |
self fillRectangleX:x+w y:yf width:(numExtraCols * fontWidth) height:fontHeight. |
4049 | 2079 |
]. |
2080 |
w > 0 ifTrue:[ |
|
2081 |
self clippedTo:(Rectangle left:x top:yf width:w height:fontHeight) do:[ |
|
2082 |
self drawVisibleLine:visLineNr with:fg and:bg. |
|
2083 |
] |
|
2084 |
]. |
|
2085 |
^ self. |
|
2086 |
]. |
|
2087 |
||
2088 |
(sCol > len) ifTrue:[ |
|
2089 |
backgroundAlreadyClearedColor == bg ifFalse:[ |
|
2090 |
len := endCol - sCol + 1. |
|
2091 |
self paint:bg. |
|
2092 |
self fillRectangleX:x y:yf |
|
2093 |
width:(fontWidth * len) |
|
2094 |
height:fontHeight |
|
2095 |
] |
|
2096 |
] ifFalse:[ |
|
2097 |
eCol := endCol. |
|
2098 |
(endCol > len) ifTrue:[ |
|
2099 |
backgroundAlreadyClearedColor == bg ifFalse:[ |
|
2100 |
characterString := lineString string species new:endCol. |
|
2101 |
characterString replaceFrom:1 to:len with:lineString startingAt:1. |
|
2102 |
lineString := characterString. |
|
2103 |
] ifTrue:[ |
|
2104 |
eCol := len. |
|
2105 |
]. |
|
2106 |
]. |
|
2107 |
||
2108 |
"/ remove any color emphasis, to enforce drawing in fg/bg |
|
2109 |
||
2110 |
lineString := self withoutColorEmphasis:lineString ifFg:fg andBg:bg. |
|
2111 |
||
2112 |
backgroundAlreadyClearedColor == bg ifFalse:[ |
|
5111 | 2113 |
(lineString isSingleByteString) ifTrue:[ |
4049 | 2114 |
fontIsFixedWidth ifTrue:[ |
2115 |
w := (eCol - sCol + 1) * fontWidth |
|
2116 |
] ifFalse:[ |
|
2117 |
w := font widthOf:lineString from:sCol to:eCol |
|
2118 |
] |
|
2119 |
] ifFalse:[ |
|
2120 |
w := lineString widthFrom:sCol to:endCol on:self |
|
2121 |
]. |
|
2122 |
self paint:bg. |
|
2123 |
self fillRectangleX:x y:yf |
|
2124 |
width:w |
|
2125 |
height:fontHeight. |
|
2126 |
]. |
|
2127 |
self paint:fg on:bg. |
|
2128 |
w notNil ifTrue:[ |
|
2129 |
"/ clip req'd for VISTAs new font rendering (which seems to shoot over the compute |
|
2130 |
self clippedTo:(Rectangle left:x top:yf width:w height:fontHeight) do:[ |
|
4495 | 2131 |
"/ self displayOpaqueString:lineString from:sCol to:eCol x:x y:(y + fontAscent) |
2132 |
self displayString:lineString from:sCol to:eCol x:x y:(y + fontAscent) |
|
4049 | 2133 |
] |
2134 |
] ifFalse:[ |
|
4495 | 2135 |
"/ self displayOpaqueString:lineString from:sCol to:eCol x:x y:(y + fontAscent) |
2136 |
self displayString:lineString from:sCol to:eCol x:x y:(y + fontAscent) |
|
4049 | 2137 |
]. |
2138 |
] |
|
105 | 2139 |
] |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2140 |
|
2090
85c0dd8a4281
selection over colored text - again
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
2141 |
"Modified: / 15.12.1999 / 23:21:43 / cg" |
0 | 2142 |
! |
2143 |
||
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
2144 |
drawLine:lineString inVisible:visLineNr from:startCol with:fg and:bg |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2145 |
"draw right part of a visible line from startCol to end of line in fg/bg" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2146 |
|
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
2147 |
|y x index1 index2 lineWithoutColor| |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2148 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2149 |
(startCol < 1) ifTrue:[ |
4495 | 2150 |
index1 := 1 |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2151 |
] ifFalse:[ |
4495 | 2152 |
index1 := startCol |
0 | 2153 |
]. |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2154 |
y := self yOfVisibleLine:visLineNr. |
2429
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2427
diff
changeset
|
2155 |
x := (self xOfCol:index1 inVisibleLine:visLineNr) - viewOrigin x. |
1700
3538310c2724
fixed widthOfContents with variable fonts (win32);
Claus Gittinger <cg@exept.de>
parents:
1699
diff
changeset
|
2156 |
backgroundAlreadyClearedColor == bg ifFalse:[ |
4495 | 2157 |
self paint:bg. |
2158 |
self fillRectangleX:x y:y - (lineSpacing // 2) |
|
2159 |
width:(width + viewOrigin x - x) |
|
2160 |
height:fontHeight. |
|
2161 |
]. |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2162 |
lineString notNil ifTrue:[ |
4495 | 2163 |
lineString isString ifFalse:[ |
2164 |
self drawLine:lineString inVisible:visLineNr from:startCol to:nil with:fg and:bg. |
|
2165 |
] ifTrue:[ |
|
2166 |
lineWithoutColor := self withoutColorEmphasis:lineString ifFg:fg andBg:bg. |
|
2167 |
index2 := lineWithoutColor size. |
|
2168 |
(index2 < index1) ifTrue:[^ self]. |
|
2169 |
(index1 <= index2) ifTrue:[ |
|
2170 |
self paint:fg on:bg. |
|
2171 |
"/ self displayOpaqueString:lineWithoutColor from:index1 to:index2 x:x y:(y + fontAscent) |
|
2172 |
self displayString:lineWithoutColor from:index1 to:index2 x:x y:(y + fontAscent) |
|
2173 |
] |
|
2174 |
] |
|
0 | 2175 |
] |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2176 |
|
2090
85c0dd8a4281
selection over colored text - again
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
2177 |
"Modified: / 15.12.1999 / 23:24:40 / cg" |
105 | 2178 |
! |
2179 |
||
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
2180 |
drawLine:line inVisible:visLineNr with:fg and:bg |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
2181 |
"draw a given string at visible lines position in fg/bg" |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
2182 |
|
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
2183 |
self drawLine:line atX:(textStartLeft - viewOrigin x) inVisible:visLineNr with:fg and:bg |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
2184 |
! |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
2185 |
|
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
2186 |
drawVisibleLine:visLineNr col:col with:fg and:bg |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
2187 |
"draw single character at col index of visible line in fg/bg" |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
2188 |
|
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
2189 |
self |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2190 |
drawLine:(self visibleAt:visLineNr) |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2191 |
inVisible:visLineNr |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2192 |
col:col |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2193 |
with:fg and:bg |
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
2194 |
! |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
2195 |
|
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
2196 |
drawVisibleLine:visLineNr from:startCol to:endCol with:fg and:bg |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
2197 |
"draw part of a visible line in fg/bg" |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
2198 |
|
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
2199 |
self |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2200 |
drawLine:(self visibleAt:visLineNr) |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2201 |
inVisible:visLineNr |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2202 |
from:startCol to:endCol |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2203 |
with:fg and:bg |
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
2204 |
! |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
2205 |
|
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
2206 |
drawVisibleLine:visLineNr from:startCol with:fg and:bg |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
2207 |
"draw right part of a visible line from startCol to end of line in fg/bg" |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
2208 |
|
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
2209 |
self |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2210 |
drawLine:(self visibleAt:visLineNr) |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2211 |
inVisible:visLineNr |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2212 |
from:startCol |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2213 |
with:fg and:bg |
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
2214 |
! |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
2215 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2216 |
drawVisibleLine:visLineNr with:fg and:bg |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2217 |
"draw a visible line in fg/bg" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2218 |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2219 |
self |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2220 |
drawLine:(self visibleAt:visLineNr) |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2221 |
atX:(textStartLeft - viewOrigin x) |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2222 |
inVisible:visLineNr |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2223 |
with:fg |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2224 |
and:bg |
427
a75bc351b17f
slight rewrites (changes for accelerator-display)
Claus Gittinger <cg@exept.de>
parents:
422
diff
changeset
|
2225 |
|
a75bc351b17f
slight rewrites (changes for accelerator-display)
Claus Gittinger <cg@exept.de>
parents:
422
diff
changeset
|
2226 |
"Modified: 28.2.1996 / 19:30:23 / cg" |
1462 | 2227 |
! |
2228 |
||
2229 |
fillRectangleX:x y:y width:w height:h |
|
2230 |
"fill rectangle; checks whether the rectangle already is filled with |
|
2231 |
the current paint (#redrawX:y:w:h). |
|
2232 |
" |
|
2233 |
backgroundAlreadyClearedColor ~~ paint ifTrue:[ |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2234 |
super fillRectangleX:x y:y width:w height:h |
1462 | 2235 |
] |
2236 |
||
2237 |
||
1465
7832492b8443
added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents:
1462
diff
changeset
|
2238 |
! |
7832492b8443
added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents:
1462
diff
changeset
|
2239 |
|
7832492b8443
added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents:
1462
diff
changeset
|
2240 |
invalidateLine:line |
1466
fd077de6285d
comment for #invalidateLine:
Claus Gittinger <cg@exept.de>
parents:
1465
diff
changeset
|
2241 |
"invalidate the area of a single line. |
fd077de6285d
comment for #invalidateLine:
Claus Gittinger <cg@exept.de>
parents:
1465
diff
changeset
|
2242 |
This arranges for that line to be redrawn asynchronously (later). |
fd077de6285d
comment for #invalidateLine:
Claus Gittinger <cg@exept.de>
parents:
1465
diff
changeset
|
2243 |
If multiple such invalidations arrive, those areas may be lumped |
fd077de6285d
comment for #invalidateLine:
Claus Gittinger <cg@exept.de>
parents:
1465
diff
changeset
|
2244 |
together for a block update. |
fd077de6285d
comment for #invalidateLine:
Claus Gittinger <cg@exept.de>
parents:
1465
diff
changeset
|
2245 |
The update takes place when the windowGroup process gets a chance to |
fd077de6285d
comment for #invalidateLine:
Claus Gittinger <cg@exept.de>
parents:
1465
diff
changeset
|
2246 |
process expose events." |
1465
7832492b8443
added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents:
1462
diff
changeset
|
2247 |
|
7832492b8443
added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents:
1462
diff
changeset
|
2248 |
|yTop visLineNr| |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2249 |
|
1465
7832492b8443
added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents:
1462
diff
changeset
|
2250 |
visLineNr := self listLineToVisibleLine:line. |
7832492b8443
added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents:
1462
diff
changeset
|
2251 |
visLineNr notNil ifTrue:[ |
4583 | 2252 |
yTop := self yOfVisibleLine:visLineNr. |
2253 |
yTop isNil ifTrue:[^ self]. "/ not visible |
|
2254 |
(yTop + fontHeight) < 0 ifTrue:[^ self]. "/ not visible |
|
2255 |
self |
|
2256 |
invalidateDeviceRectangle:(Rectangle |
|
2257 |
left:margin top:yTop-(lineSpacing//2) |
|
2258 |
width:(width - (2 * margin)) height:fontHeight) |
|
2259 |
repairNow:false. |
|
1465
7832492b8443
added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents:
1462
diff
changeset
|
2260 |
] |
7832492b8443
added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents:
1462
diff
changeset
|
2261 |
|
7832492b8443
added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents:
1462
diff
changeset
|
2262 |
"Created: / 5.3.1998 / 01:24:19 / cg" |
1466
fd077de6285d
comment for #invalidateLine:
Claus Gittinger <cg@exept.de>
parents:
1465
diff
changeset
|
2263 |
"Modified: / 5.3.1998 / 13:41:31 / cg" |
105 | 2264 |
! ! |
2265 |
||
2752 | 2266 |
!ListView methodsFor:'event handling'! |
105 | 2267 |
|
887
9b25df4d193a
Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents:
883
diff
changeset
|
2268 |
contentsChanged |
4634 | 2269 |
"size of contents changed - move origin up if possible" |
887
9b25df4d193a
Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents:
883
diff
changeset
|
2270 |
|
9b25df4d193a
Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents:
883
diff
changeset
|
2271 |
|listSize newOrigin| |
9b25df4d193a
Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents:
883
diff
changeset
|
2272 |
|
890
abd28e2f66ca
stefan ! test your changes ;-)
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
2273 |
shown ifTrue:[ |
4634 | 2274 |
list notNil ifTrue:[ |
2275 |
listSize := self numberOfLines. |
|
2276 |
||
2277 |
listSize == 0 ifTrue:[ |
|
2278 |
widthOfWidestLine := 0. |
|
2279 |
]. |
|
2280 |
||
2281 |
" |
|
2282 |
if we are beyond the end, scroll up a bit |
|
2283 |
" |
|
2284 |
((firstLineShown + nFullLinesShown) > listSize) ifTrue:[ |
|
2285 |
newOrigin := listSize - nFullLinesShown + 1. |
|
2286 |
newOrigin < 1 ifTrue:[ |
|
2287 |
newOrigin := 1 |
|
2288 |
]. |
|
2289 |
self scrollToLine: newOrigin. |
|
2290 |
]. |
|
2291 |
]. |
|
887
9b25df4d193a
Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents:
883
diff
changeset
|
2292 |
]. |
9b25df4d193a
Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents:
883
diff
changeset
|
2293 |
|
9b25df4d193a
Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents:
883
diff
changeset
|
2294 |
^ super contentsChanged |
9b25df4d193a
Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents:
883
diff
changeset
|
2295 |
|
9b25df4d193a
Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents:
883
diff
changeset
|
2296 |
"Modified: 18.11.1996 / 19:50:07 / stefan" |
1099
eccab3759ddb
in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents:
1081
diff
changeset
|
2297 |
"Modified: 5.3.1997 / 15:50:46 / cg" |
887
9b25df4d193a
Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents:
883
diff
changeset
|
2298 |
! |
9b25df4d193a
Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents:
883
diff
changeset
|
2299 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2300 |
keyPress:key x:x y:y |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2301 |
"a key was pressed - handle page-keys here" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2302 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2303 |
<resource: #keyboard (#PreviousPage #NextPage #HalfPageUp #HalfPageDown |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2304 |
#BeginOfText #EndOfText |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2305 |
#ScrollUp #ScrollDown )> |
2731
0f3c02f592d0
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2707
diff
changeset
|
2306 |
|n| |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2307 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2308 |
(key == #PreviousPage) ifTrue: [^ self pageUp]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2309 |
(key == #NextPage) ifTrue: [^ self pageDown]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2310 |
(key == #HalfPageUp) ifTrue: [^ self halfPageUp]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2311 |
(key == #HalfPageDown) ifTrue: [^ self halfPageDown]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2312 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2313 |
(key == #BeginOfText) ifTrue:[^ self scrollToTop]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2314 |
(key == #EndOfText) ifTrue:[^ self scrollToBottom]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2315 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2316 |
(key == #ScrollUp) ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2317 |
n := 1 + (self sensor compressKeyPressEventsWithKey:#ScrollUp). |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2318 |
^ self scrollUp:n |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2319 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2320 |
(key == #ScrollDown) ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2321 |
n := 1 + (self sensor compressKeyPressEventsWithKey:#ScrollDown). |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2322 |
^ self scrollDown:n |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2323 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2324 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2325 |
super keyPress:key x:x y:y |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2326 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2327 |
|
2273
e40b815ce3e2
stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents:
2258
diff
changeset
|
2328 |
mapped |
e40b815ce3e2
stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents:
2258
diff
changeset
|
2329 |
self stopAutoScroll. |
e40b815ce3e2
stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents:
2258
diff
changeset
|
2330 |
super mapped |
e40b815ce3e2
stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents:
2258
diff
changeset
|
2331 |
! |
e40b815ce3e2
stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents:
2258
diff
changeset
|
2332 |
|
3836 | 2333 |
mouseWheelZoom:amount |
4070
8225a547d6a7
comment/format in: #mouseWheelZoom:
Claus Gittinger <cg@exept.de>
parents:
4049
diff
changeset
|
2334 |
"CTRL-wheel action" |
3836 | 2335 |
|
2336 |
|oldSize newSize delta mul| |
|
2337 |
||
2338 |
amount > 0 ifTrue:[ |
|
4070
8225a547d6a7
comment/format in: #mouseWheelZoom:
Claus Gittinger <cg@exept.de>
parents:
4049
diff
changeset
|
2339 |
"/ delta := 1. mul := 1. |
8225a547d6a7
comment/format in: #mouseWheelZoom:
Claus Gittinger <cg@exept.de>
parents:
4049
diff
changeset
|
2340 |
delta := 0. mul := 1.2. |
3836 | 2341 |
] ifFalse:[ |
4070
8225a547d6a7
comment/format in: #mouseWheelZoom:
Claus Gittinger <cg@exept.de>
parents:
4049
diff
changeset
|
2342 |
"/ delta := -1. mul := 1. |
8225a547d6a7
comment/format in: #mouseWheelZoom:
Claus Gittinger <cg@exept.de>
parents:
4049
diff
changeset
|
2343 |
delta := 0. mul := 0.8. |
3836 | 2344 |
]. |
2345 |
||
3842 | 2346 |
font sizeUnit == #px ifFalse:[ |
4070
8225a547d6a7
comment/format in: #mouseWheelZoom:
Claus Gittinger <cg@exept.de>
parents:
4049
diff
changeset
|
2347 |
oldSize := font size. |
8225a547d6a7
comment/format in: #mouseWheelZoom:
Claus Gittinger <cg@exept.de>
parents:
4049
diff
changeset
|
2348 |
newSize := ((oldSize + delta)* mul) max:2. |
8225a547d6a7
comment/format in: #mouseWheelZoom:
Claus Gittinger <cg@exept.de>
parents:
4049
diff
changeset
|
2349 |
newSize ~= oldSize ifTrue:[ |
8225a547d6a7
comment/format in: #mouseWheelZoom:
Claus Gittinger <cg@exept.de>
parents:
4049
diff
changeset
|
2350 |
self font:(font asSize:newSize). |
8225a547d6a7
comment/format in: #mouseWheelZoom:
Claus Gittinger <cg@exept.de>
parents:
4049
diff
changeset
|
2351 |
] |
3836 | 2352 |
]. |
2353 |
! |
|
2354 |
||
0 | 2355 |
redrawX:x y:y width:w height:h |
2356 |
"a region must be redrawn" |
|
2357 |
||
1462 | 2358 |
|startCol endCol line saveClip |
2359 |
startLine "{ Class:SmallInteger }" |
|
2360 |
stopLine "{ Class:SmallInteger }" |
|
2361 |
| |
|
0 | 2362 |
|
127 | 2363 |
shown ifFalse:[^ self]. |
2364 |
||
0 | 2365 |
startLine := self visibleLineOfY:y. |
2366 |
stopLine := self visibleLineOfY:(y + h). |
|
2367 |
||
1462 | 2368 |
saveClip := clipRect. |
2369 |
self clippingRectangle:(Rectangle left:x top:y width:w height:h). |
|
2370 |
self paint:bgColor. |
|
2371 |
self fillRectangleX:x y:y width:w height:h. |
|
2372 |
backgroundAlreadyClearedColor := bgColor. |
|
2373 |
||
2374 |
(includesNonStrings or:[w > (width // 4 * 3)]) ifTrue:[ |
|
4765 | 2375 |
"includes non strings or area is big enough: redraw whole lines" |
4536 | 2376 |
self redrawFromVisibleLine:startLine to:stopLine |
0 | 2377 |
] ifFalse:[ |
4536 | 2378 |
line := self visibleAt:startLine. |
2379 |
||
5111 | 2380 |
(fontIsFixedWidth and:[line isSingleByteString]) ifFalse:[ |
4536 | 2381 |
"start/end col has to be computed for each line" |
2382 |
||
2383 |
startLine to:stopLine do:[:i | |
|
2384 |
startCol := self colOfX:x inVisibleLine:i. |
|
2385 |
endCol := self colOfX:(x + w) inVisibleLine:i. |
|
2386 |
startCol > 0 ifTrue:[ |
|
2387 |
endCol > 0 ifTrue:[ |
|
2388 |
self redrawVisibleLine:i from:startCol to:endCol |
|
2389 |
] |
|
2390 |
] |
|
2391 |
] |
|
2392 |
] ifTrue:[ |
|
2393 |
"start/end col is the same for all lines" |
|
2394 |
startCol := self colOfX:x inVisibleLine:startLine. |
|
2395 |
endCol := self colOfX:(x + w) inVisibleLine:startLine. |
|
2396 |
startCol > 0 ifTrue:[ |
|
2397 |
endCol > 0 ifTrue:[ |
|
2398 |
startLine to:stopLine do:[:i | |
|
2399 |
line := self visibleAt:i. |
|
5111 | 2400 |
(line isSingleByteString) ifTrue:[ |
4536 | 2401 |
self redrawVisibleLine:i from:startCol to:endCol |
2402 |
] ifFalse:[ |
|
2403 |
self redrawVisibleLine:i |
|
2404 |
] |
|
2405 |
] |
|
2406 |
] |
|
2407 |
] |
|
2408 |
] |
|
1462 | 2409 |
]. |
2410 |
backgroundAlreadyClearedColor := nil. |
|
2411 |
self clippingRectangle:saveClip. |
|
0 | 2412 |
! |
2413 |
||
105 | 2414 |
sizeChanged:how |
2415 |
"size changed - move origin up if possible" |
|
2416 |
||
2417 |
super sizeChanged:how. |
|
721
4a01084cf643
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
716
diff
changeset
|
2418 |
|
105 | 2419 |
self computeNumberOfLinesShown. |
2420 |
||
2421 |
innerWidth := width - textStartLeft - margin. |
|
1972 | 2422 |
|
2577 | 2423 |
"/ Makes trouble when fighting with SelListViews sizeChanged-positioning ... |
1972 | 2424 |
"/ |
2425 |
"/ shown ifFalse:[^ self]. |
|
2426 |
"/ list isNil ifTrue:[^ self]. |
|
2427 |
"/ |
|
2428 |
"/ listSize := self numberOfLines. |
|
2429 |
"/ " |
|
2430 |
"/ if we are beyond the end, scroll up a bit |
|
2431 |
"/ " |
|
2432 |
"/ ((firstLineShown + nFullLinesShown) >= listSize) ifTrue:[ |
|
2433 |
"/ self scrollToBottom. |
|
2434 |
"/ ^ self |
|
1429
b7b7f3477594
do not invalidate, when the size changes;
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
2435 |
"/ ]. |
643 | 2436 |
|
1429
b7b7f3477594
do not invalidate, when the size changes;
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
2437 |
"Modified: / 18.11.1996 / 19:37:02 / stefan" |
b7b7f3477594
do not invalidate, when the size changes;
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
2438 |
"Modified: / 27.1.1998 / 14:10:04 / cg" |
2273
e40b815ce3e2
stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents:
2258
diff
changeset
|
2439 |
! |
e40b815ce3e2
stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents:
2258
diff
changeset
|
2440 |
|
e40b815ce3e2
stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents:
2258
diff
changeset
|
2441 |
unmap |
e40b815ce3e2
stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents:
2258
diff
changeset
|
2442 |
self stopAutoScroll. |
e40b815ce3e2
stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents:
2258
diff
changeset
|
2443 |
super unmap |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2444 |
! ! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2445 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2446 |
!ListView methodsFor:'initialization'! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2447 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2448 |
create |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2449 |
super create. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2450 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2451 |
"I cache font parameters here - they are used so often ..." |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2452 |
self getFontParameters. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2453 |
self computeNumberOfLinesShown. |
1990 | 2454 |
fgColor := fgColor onDevice:device. |
2455 |
bgColor := bgColor onDevice:device |
|
105 | 2456 |
! |
2457 |
||
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2458 |
defaultControllerClass |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2459 |
self class == ListView ifTrue:[^ ListViewController]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2460 |
^ super defaultControllerClass |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2461 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2462 |
|
940 | 2463 |
fetchDeviceResources |
2464 |
"fetch device colors, to avoid reallocation at redraw time" |
|
2465 |
||
2466 |
super fetchDeviceResources. |
|
2467 |
||
1990 | 2468 |
fgColor notNil ifTrue:[fgColor := fgColor onDevice:device]. |
2469 |
bgColor notNil ifTrue:[bgColor := bgColor onDevice:device]. |
|
940 | 2470 |
|
2471 |
"Created: 14.1.1997 / 00:12:12 / cg" |
|
2472 |
! |
|
2473 |
||
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2474 |
initStyle |
967 | 2475 |
"setup viewStyle specifics" |
2476 |
||
1693
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2477 |
|n| |
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2478 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2479 |
super initStyle. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2480 |
|
1693
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2481 |
n := DefaultTopMargin. |
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2482 |
n isInteger ifFalse:[ |
4322 | 2483 |
n := (self verticalPixelPerMillimeter:n) rounded. |
1693
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2484 |
]. |
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2485 |
self topMargin:n. |
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2486 |
|
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2487 |
n := DefaultLeftMargin. |
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2488 |
n isInteger ifFalse:[ |
4322 | 2489 |
n := (self verticalPixelPerMillimeter:n) rounded. |
1693
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2490 |
]. |
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2491 |
self leftMargin:n. |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2492 |
|
4573 | 2493 |
lineSpacing := 2. |
4577 | 2494 |
"/ q&d temporary hack. |
2495 |
"/ X11 fonts are currently so ugly... add more spacing. |
|
4859 | 2496 |
device platformName = #X11 ifTrue:[ |
4577 | 2497 |
lineSpacing := lineSpacing + 3. |
2498 |
]. |
|
940 | 2499 |
fgColor := DefaultForegroundColor. |
2500 |
bgColor := DefaultBackgroundColor. |
|
4322 | 2501 |
|
2502 |
"Modified (comment): / 05-10-2011 / 15:51:02 / az" |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2503 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2504 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2505 |
initialize |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2506 |
super initialize. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2507 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2508 |
viewOrigin := 0@0. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2509 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2510 |
textStartTop := topMargin + margin. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2511 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2512 |
bitGravity := #NorthWest. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2513 |
list := nil. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2514 |
firstLineShown := 1. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2515 |
nFullLinesShown := 1. "just any value ..." |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2516 |
nLinesShown := 1. "just any value" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2517 |
partialLines := true. |
2378 | 2518 |
tabPositions := UserDefaultTabPositions ? DefaultTabPositions. |
864 | 2519 |
includesNonStrings := false. |
4751 | 2520 |
lineEndCRLF := false. |
2521 |
checkedLinesForWidthOfContentsComputation := nil."/ i.e. all |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2522 |
self getFontParameters. |
3312 | 2523 |
self initializeWordCheckAction. |
4747 | 2524 |
|
3312 | 2525 |
scrollWhenUpdating := #keep. "/ #beginOfText. |
4747 | 2526 |
expandTabsWhenUpdating := true. |
2527 |
compareModelOnUpdate := true. |
|
2528 |
checkLineEndConventionWhenUpdating := true. |
|
2529 |
scrollLocked := false. |
|
3312 | 2530 |
autoScroll := true. |
2531 |
||
2532 |
"Modified: / 03-07-2006 / 17:03:59 / cg" |
|
2533 |
! |
|
2534 |
||
3564 | 2535 |
initializeWordCheckAction |
4403 | 2536 |
"the wordCheck is a predicate block which returns true if the given character |
2537 |
belongs to the (textual) word. Used with double click to select a word. |
|
2538 |
When editing code, typically characters which are part of an identifier |
|
2539 |
are part of a word (underline, dollar, but no other non-letters). |
|
2540 |
The standardWordCheck aks the current userPreferences for details." |
|
2541 |
||
3564 | 2542 |
wordCheck := [:char | self standardWordCheck:char]. |
2543 |
||
2544 |
"Created: / 03-07-2006 / 17:03:50 / cg" |
|
2545 |
! |
|
2546 |
||
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2547 |
realize |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2548 |
|sz| |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2549 |
|
2305
f2850e54b0ab
only access originChanged, extentChanged and cornerChanged
Claus Gittinger <cg@exept.de>
parents:
2273
diff
changeset
|
2550 |
self extentChangedFlag ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2551 |
self computeNumberOfLinesShown. |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2552 |
]. |
691
906e4d67b9cf
fixed makeLineVisible; when not-yet realized
Claus Gittinger <cg@exept.de>
parents:
688
diff
changeset
|
2553 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2554 |
firstLineShown ~~ 1 ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2555 |
sz := self size. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2556 |
firstLineShown + nLinesShown > sz ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2557 |
self scrollToLine:sz - nLinesShown. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2558 |
] |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2559 |
]. |
691
906e4d67b9cf
fixed makeLineVisible; when not-yet realized
Claus Gittinger <cg@exept.de>
parents:
688
diff
changeset
|
2560 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2561 |
super realize. |
837 | 2562 |
|
1081
0d3f4ad6e7e5
now fetch models value when model is assigned;
Claus Gittinger <cg@exept.de>
parents:
1027
diff
changeset
|
2563 |
"/ old: fetch models value on realize; |
0d3f4ad6e7e5
now fetch models value when model is assigned;
Claus Gittinger <cg@exept.de>
parents:
1027
diff
changeset
|
2564 |
"/ new: fetch value when model is assigned. |
0d3f4ad6e7e5
now fetch models value when model is assigned;
Claus Gittinger <cg@exept.de>
parents:
1027
diff
changeset
|
2565 |
"/ |
0d3f4ad6e7e5
now fetch models value when model is assigned;
Claus Gittinger <cg@exept.de>
parents:
1027
diff
changeset
|
2566 |
"/ model notNil ifTrue:[ |
0d3f4ad6e7e5
now fetch models value when model is assigned;
Claus Gittinger <cg@exept.de>
parents:
1027
diff
changeset
|
2567 |
"/ self getListFromModel. |
0d3f4ad6e7e5
now fetch models value when model is assigned;
Claus Gittinger <cg@exept.de>
parents:
1027
diff
changeset
|
2568 |
"/ ] |
691
906e4d67b9cf
fixed makeLineVisible; when not-yet realized
Claus Gittinger <cg@exept.de>
parents:
688
diff
changeset
|
2569 |
|
825
d115a0923b7d
Send #getListFromModel when setting #model:
Stefan Vogel <sv@exept.de>
parents:
820
diff
changeset
|
2570 |
"Modified: 15.8.1996 / 13:08:56 / stefan" |
1081
0d3f4ad6e7e5
now fetch models value when model is assigned;
Claus Gittinger <cg@exept.de>
parents:
1027
diff
changeset
|
2571 |
"Modified: 28.2.1997 / 19:44:19 / cg" |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2572 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2573 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2574 |
recreate |
2258 | 2575 |
"recreate after a snapin or a migration" |
1693
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2576 |
|n| |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2577 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2578 |
super recreate. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2579 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2580 |
" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2581 |
recompute margins and font parameters |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2582 |
- display may have different resolution/font sizes. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2583 |
" |
1693
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2584 |
"/ topMargin := (self verticalPixelPerMillimeter:0.5) rounded. |
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2585 |
"/ self leftMargin:(self horizontalPixelPerMillimeter:0.5) rounded. |
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2586 |
|
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2587 |
n := DefaultTopMargin. |
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2588 |
n isInteger ifFalse:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2589 |
n := (self verticalPixelPerMillimeter:n) rounded. |
1693
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2590 |
]. |
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2591 |
self topMargin:n. |
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2592 |
|
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2593 |
n := DefaultLeftMargin. |
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2594 |
n isInteger ifFalse:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2595 |
n := (self verticalPixelPerMillimeter:n) rounded. |
1693
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2596 |
]. |
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2597 |
self leftMargin:n. |
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2598 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2599 |
self getFontParameters |
1693
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2600 |
|
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2601 |
"Modified: / 26.9.1998 / 17:09:32 / cg" |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2602 |
! ! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2603 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2604 |
!ListView methodsFor:'private'! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2605 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2606 |
absoluteLineToVisibleLine:absLineNr |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2607 |
"given an absolute line (1..) return visible linenr or nil" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2608 |
|
2976 | 2609 |
<resource:#obsolete> |
2423
8b9c2946a5a7
absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
2412
diff
changeset
|
2610 |
self obsoleteMethodWarning:'use #listLineToVisibleLine:'. |
8b9c2946a5a7
absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
2412
diff
changeset
|
2611 |
^ self listLineToVisibleLine:absLineNr |
8b9c2946a5a7
absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
2412
diff
changeset
|
2612 |
|
8b9c2946a5a7
absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
2412
diff
changeset
|
2613 |
"/ absLineNr isNil ifTrue:[^ nil]. |
8b9c2946a5a7
absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
2412
diff
changeset
|
2614 |
"/ (absLineNr < firstLineShown) ifTrue:[^ nil]. |
8b9c2946a5a7
absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
2412
diff
changeset
|
2615 |
"/ (absLineNr >= (firstLineShown + nLinesShown)) ifTrue:[^ nil]. |
8b9c2946a5a7
absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
2412
diff
changeset
|
2616 |
"/ ^ absLineNr - firstLineShown + 1 |
8b9c2946a5a7
absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
2412
diff
changeset
|
2617 |
"/ |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2618 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2619 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2620 |
checkForExistingLine:lineNr |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2621 |
"check if a line for lineNr exists; if not, expand text" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2622 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2623 |
list isNil ifTrue: [ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2624 |
list := StringCollection new:lineNr. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2625 |
self contentsChanged |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2626 |
] ifFalse: [ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2627 |
lineNr > (list size) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2628 |
self grow:lineNr. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2629 |
self contentsChanged |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2630 |
] |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2631 |
] |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2632 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2633 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2634 |
colOfX:x inVisibleLine:visLineNr |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2635 |
"given a visible lineNr and x-coordinate, return colNr" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2636 |
|
650
563ea7f99aa8
handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents:
643
diff
changeset
|
2637 |
|lineString linePixelWidth xRel runCol posLeft posRight done |
1259
aba6a9deab8d
break out of col-search loop in case of bad string
Claus Gittinger <cg@exept.de>
parents:
1249
diff
changeset
|
2638 |
hasEmphasis oPosRight oPosLeft| |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2639 |
|
2429
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2427
diff
changeset
|
2640 |
xRel := x - textStartLeft + viewOrigin x. |
650
563ea7f99aa8
handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents:
643
diff
changeset
|
2641 |
(xRel <= 0) ifTrue:[^ 1]. |
563ea7f99aa8
handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents:
643
diff
changeset
|
2642 |
|
1656
1202fbc95970
some fixes forvariable fonts on win32
Claus Gittinger <cg@exept.de>
parents:
1637
diff
changeset
|
2643 |
lineString := self visibleAt:visLineNr. |
1202fbc95970
some fixes forvariable fonts on win32
Claus Gittinger <cg@exept.de>
parents:
1637
diff
changeset
|
2644 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2645 |
" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2646 |
for fix fonts, this is easy ... |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2647 |
" |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2648 |
(fontIsFixedWidth |
1656
1202fbc95970
some fixes forvariable fonts on win32
Claus Gittinger <cg@exept.de>
parents:
1637
diff
changeset
|
2649 |
and:[lineString isNil |
4245
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2650 |
or:[lineString hasChangeOfEmphasis not]]) ifTrue:[ |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2651 |
^ (xRel // fontWidth) + 1 |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2652 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2653 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2654 |
" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2655 |
for variable fonts, more work is required ... |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2656 |
" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2657 |
lineString notNil ifTrue:[ |
4245
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2658 |
lineString := self visibleStringFrom:lineString. |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2659 |
(hasEmphasis := lineString hasChangeOfEmphasis) ifTrue:[ |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2660 |
linePixelWidth := lineString widthOn:self |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2661 |
] ifFalse:[ |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2662 |
lineString := lineString string. |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2663 |
linePixelWidth := font widthOf:lineString. |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2664 |
] |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2665 |
] ifFalse:[ |
4245
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2666 |
linePixelWidth := 0 |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2667 |
]. |
650
563ea7f99aa8
handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents:
643
diff
changeset
|
2668 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2669 |
(linePixelWidth <= xRel) ifTrue:[ |
4245
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2670 |
fontWidth == 0 ifTrue:[ |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2671 |
" |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2672 |
although this 'cannot happen', |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2673 |
it seems that X reports this width for some strange fonts ... |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2674 |
" |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2675 |
^ lineString size |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2676 |
]. |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2677 |
^ lineString size + ((xRel - linePixelWidth) // fontWidth) + 1 |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2678 |
]. |
650
563ea7f99aa8
handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents:
643
diff
changeset
|
2679 |
|
563ea7f99aa8
handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents:
643
diff
changeset
|
2680 |
"/ cannot simply count individual characters, |
563ea7f99aa8
handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents:
643
diff
changeset
|
2681 |
"/ since kerning or other non-linear effects may be involved ... |
4245
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2682 |
"/ use a binary search, initialized with some guess. |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2683 |
|
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2684 |
"/ a guess: take some 'average' character's width and compute an initial guess |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2685 |
runCol := x // (font widthOf:'e'). |
4247 | 2686 |
runCol := runCol min:lineString size. |
4245
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2687 |
|
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2688 |
"/ runCol := lineString size // 2. |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2689 |
"/ (runCol == 0) ifTrue:[runCol := 1]. |
650
563ea7f99aa8
handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents:
643
diff
changeset
|
2690 |
|
563ea7f99aa8
handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents:
643
diff
changeset
|
2691 |
hasEmphasis ifTrue:[ |
4245
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2692 |
posLeft := (lineString copyFrom:1 to:(runCol - 1)) widthOn:self. |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2693 |
posRight := (lineString copyFrom:1 to:runCol) widthOn:self. |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2694 |
] ifFalse:[ |
4245
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2695 |
posLeft := font widthOf:lineString from:1 to:(runCol - 1). |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2696 |
posRight := font widthOf:lineString from:1 to:runCol. |
650
563ea7f99aa8
handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents:
643
diff
changeset
|
2697 |
]. |
563ea7f99aa8
handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents:
643
diff
changeset
|
2698 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2699 |
done := (posLeft <= xRel) and:[posRight > xRel]. |
650
563ea7f99aa8
handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents:
643
diff
changeset
|
2700 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2701 |
[done] whileFalse:[ |
4245
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2702 |
oPosRight := posRight. |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2703 |
oPosLeft := posLeft. |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2704 |
|
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2705 |
(posRight <= xRel) ifTrue:[ |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2706 |
runCol := runCol + 1. |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2707 |
posLeft := posRight. |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2708 |
hasEmphasis ifTrue:[ |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2709 |
posRight := (lineString copyFrom:1 to:runCol) widthOn:self. |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2710 |
] ifFalse:[ |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2711 |
posRight := font widthOf:lineString from:1 to:runCol |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2712 |
] |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2713 |
] ifFalse:[ |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2714 |
(posLeft > xRel) ifTrue:[ |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2715 |
runCol := runCol - 1. |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2716 |
(runCol == 0) ifTrue:[^ 0]. |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2717 |
posRight := posLeft. |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2718 |
hasEmphasis ifTrue:[ |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2719 |
posLeft := (lineString copyFrom:1 to:(runCol - 1)) widthOn:self. |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2720 |
] ifFalse:[ |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2721 |
posLeft := font widthOf:lineString from:1 to:(runCol - 1) |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2722 |
] |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2723 |
] |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2724 |
]. |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2725 |
done := (posLeft <= xRel) and:[posRight > xRel]. |
1775 | 2726 |
"234567890123456789012345678901234567890" |
4245
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2727 |
((oPosRight == posRight) and:[oPosLeft == posLeft]) ifTrue:[ |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2728 |
"/ paranoia: just in case there are unprintable characters |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2729 |
"/ (avoid endless loop if the binary search does not make progress) |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2730 |
done := true. |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2731 |
] |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2732 |
]. |
1777 | 2733 |
"/self paint:Color red. |
2429
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2427
diff
changeset
|
2734 |
"/self displayRectangleX:posLeft+textStartLeft-viewOrigin x y:(self yOfVisibleLine:visLineNr) |
1777 | 2735 |
"/ width:(posRight-posLeft) height:fontHeight. |
2736 |
"/self paint:Color black. |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2737 |
^ runCol |
650
563ea7f99aa8
handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents:
643
diff
changeset
|
2738 |
|
4245
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2739 |
"Modified: / 25-04-2011 / 11:26:58 / cg" |
4247 | 2740 |
"Modified: / 02-05-2011 / 14:08:54 / sr" |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2741 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2742 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2743 |
computeNumberOfLinesShown |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2744 |
"recompute the number of visible lines" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2745 |
|
716
366fca254239
fixed number-of-lines computation
Claus Gittinger <cg@exept.de>
parents:
691
diff
changeset
|
2746 |
|innerHeight| |
366fca254239
fixed number-of-lines computation
Claus Gittinger <cg@exept.de>
parents:
691
diff
changeset
|
2747 |
|
366fca254239
fixed number-of-lines computation
Claus Gittinger <cg@exept.de>
parents:
691
diff
changeset
|
2748 |
innerHeight := self innerHeight. |
366fca254239
fixed number-of-lines computation
Claus Gittinger <cg@exept.de>
parents:
691
diff
changeset
|
2749 |
nFullLinesShown := (innerHeight + lineSpacing) // fontHeight. |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2750 |
nLinesShown := nFullLinesShown. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2751 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2752 |
partialLines ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2753 |
((nLinesShown * fontHeight) < innerHeight) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2754 |
nLinesShown := nLinesShown + 1 |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2755 |
] |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2756 |
] |
716
366fca254239
fixed number-of-lines computation
Claus Gittinger <cg@exept.de>
parents:
691
diff
changeset
|
2757 |
|
366fca254239
fixed number-of-lines computation
Claus Gittinger <cg@exept.de>
parents:
691
diff
changeset
|
2758 |
"Modified: 29.5.1996 / 14:48:43 / cg" |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2759 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2760 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2761 |
convertRTF:aList |
3844 | 2762 |
<resource: #obsolete> |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2763 |
"this is a q&d RTF to poor-text converter which removes any rich stuff. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2764 |
- a first shot 'til DocumentView is finished ..." |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2765 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2766 |
|newList newLine charIndex inEscape char special| |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2767 |
|
652 | 2768 |
self obsoleteMethodWarning. |
2769 |
||
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2770 |
newList := StringCollection new:200. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2771 |
newList grow:0. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2772 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2773 |
newLine := ''. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2774 |
aList do:[:line | |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2775 |
((line size == 0) or:[line isBlank]) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2776 |
newList add:newLine. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2777 |
newLine := '' |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2778 |
] ifFalse:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2779 |
special := ((line at:1) == ${) or:[(line includes:$\)]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2780 |
special := special or:[(line at:1) == $}]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2781 |
special ifFalse:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2782 |
newList add:(newLine , line) |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2783 |
] ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2784 |
charIndex := 1. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2785 |
[charIndex <= line size] whileTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2786 |
char := line at:charIndex. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2787 |
((char == ${ ) or:[char == $} ]) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2788 |
"left-brace: ignore rest of line" |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2789 |
charIndex := line size + 1 |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2790 |
] ifFalse:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2791 |
(char == $\) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2792 |
inEscape := true |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2793 |
] ifFalse:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2794 |
inEscape ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2795 |
(char == Character space) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2796 |
inEscape := false |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2797 |
] |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2798 |
] ifFalse:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2799 |
newLine := newLine copyWith:char |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2800 |
] |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2801 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2802 |
charIndex := charIndex + 1 |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2803 |
] |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2804 |
] |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2805 |
] |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2806 |
] |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2807 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2808 |
^ newList |
652 | 2809 |
|
2810 |
"Modified: 18.5.1996 / 14:03:16 / cg" |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2811 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2812 |
|
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
2813 |
enqueueDelayedContentsChangedNotification |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
2814 |
"because contentschanged may be slow (recomputing width of widest line), |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
2815 |
we delay its execution by pushing it onto the event queue. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
2816 |
This has the effect of allowing for multiple add-lines before recomputing. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
2817 |
Much speeding up inserting into long lists" |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
2818 |
|
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
2819 |
|sensor| |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
2820 |
|
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
2821 |
sensor := self sensor. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
2822 |
(sensor hasUserEvent:#contentsChanged for:self) ifFalse:[ |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
2823 |
sensor pushUserEvent:#contentsChanged for:self |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
2824 |
]. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
2825 |
"/ used to be syncronous: |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
2826 |
"/ self contentsChanged. "recompute scrollbars" |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
2827 |
|
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
2828 |
"Created: / 25-07-2012 / 11:59:58 / cg" |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
2829 |
! |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
2830 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2831 |
getFontParameters |
668
729295eb37fc
use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents:
663
diff
changeset
|
2832 |
"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:
663
diff
changeset
|
2833 |
The code below uses the fonts average height parameters - these |
729295eb37fc
use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents:
663
diff
changeset
|
2834 |
are not OK for some oversized 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:
663
diff
changeset
|
2835 |
Therefore, this method should be redefined in views which will be used |
729295eb37fc
use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents:
663
diff
changeset
|
2836 |
with national characters (i.e. editTextViews)." |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2837 |
|
1451
3598c65cd89d
search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents:
1450
diff
changeset
|
2838 |
|hMax| |
3598c65cd89d
search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents:
1450
diff
changeset
|
2839 |
|
1990 | 2840 |
font := font onDevice:device. |
1451
3598c65cd89d
search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents:
1450
diff
changeset
|
2841 |
hMax := font height. |
3598c65cd89d
search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents:
1450
diff
changeset
|
2842 |
|
634
1ca770b2c494
handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
2843 |
includesNonStrings == true ifTrue:[ |
4570 | 2844 |
"/ |
2845 |
"/ find maximum height of lines |
|
2846 |
"/ |
|
2847 |
hMax := list inject:hMax into:[:maxSoFar :thisLine | |
|
2848 |
thisLine isNil ifTrue:[ |
|
2849 |
maxSoFar |
|
2850 |
] ifFalse:[ |
|
5111 | 2851 |
(thisLine isSingleByteString) ifTrue:[ |
4570 | 2852 |
maxSoFar |
2853 |
] ifFalse:[ |
|
2854 |
maxSoFar max:(thisLine heightOn:self) |
|
2855 |
] |
|
2856 |
] |
|
2857 |
]. |
|
1451
3598c65cd89d
search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents:
1450
diff
changeset
|
2858 |
|
634
1ca770b2c494
handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
2859 |
]. |
4573 | 2860 |
fontHeight := font maxHeight. |
2861 |
"/ fontHeight := font height. |
|
2862 |
fontHeight := fontHeight max:(hMax + lineSpacing). |
|
2863 |
fontAscent := font ascent. "/ maxAscent. -- see SelectionInListViews selection in motif style |
|
2864 |
"/ fontAscent := font maxAscent "ascent". "/ maxAscent. -- see SelectionInListViews selection in motif style |
|
2865 |
"/ fontAscent := (font maxAscent + font ascent) // 2. "/ maxAscent. -- see SelectionInListViews selection in motif style |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2866 |
fontWidth := font width. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2867 |
fontIsFixedWidth := font isFixedWidth. |
634
1ca770b2c494
handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
2868 |
|
1260
5a548d4c6724
handle nil entry in #getFontParameters
Claus Gittinger <cg@exept.de>
parents:
1259
diff
changeset
|
2869 |
"Modified: 3.7.1997 / 12:24:25 / cg" |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2870 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2871 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2872 |
getListFromModel |
587
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2873 |
"ask my model (if any) for the text via the listMsg. |
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2874 |
If there is no listMessage, try aspect for backward compatibility." |
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2875 |
|
5031 | 2876 |
|newText msg doCompareIfUnchanged| |
587
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2877 |
|
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2878 |
model notNil ifTrue:[ |
4734 | 2879 |
msg := listMsg ? aspectMsg. |
2880 |
||
2881 |
msg notNil ifTrue:[ |
|
5031 | 2882 |
doCompareIfUnchanged := compareModelOnUpdate. |
2883 |
||
4747 | 2884 |
newText := model perform:msg. |
4734 | 2885 |
"/ cg: this makes many optimizations (virtualArray) useless; |
4747 | 2886 |
"/ I do not think that this is a good idea: |
4734 | 2887 |
"/ text notNil ifTrue:[ |
2888 |
"/ so I changed it to: |
|
4747 | 2889 |
(newText notNil and:[newText isString]) ifTrue:[ |
2890 |
newText := newText asStringCollection. |
|
5030 | 2891 |
] ifFalse:[ |
2892 |
newText == model ifTrue:[ |
|
2893 |
"/ I must operate on a copy |
|
5031 | 2894 |
newText := model asNewOrderedCollection. |
2895 |
"/ doCompareIfUnchanged := false. |
|
5030 | 2896 |
]. |
4747 | 2897 |
]. |
2898 |
||
5031 | 2899 |
doCompareIfUnchanged ifTrue:[ |
4747 | 2900 |
"/ see if there is a change at all. |
2901 |
"/ use to compare using =, but that's not enough in case of emphasis change. |
|
2902 |
newText size == list size ifTrue:[ |
|
2903 |
|same| |
|
2904 |
||
2905 |
same := true. |
|
2906 |
newText size > 0 ifTrue:[ |
|
2907 |
newText with:list do:[:eachNewLine :eachOldLine | |
|
2908 |
(eachNewLine == eachOldLine) ifFalse:[ |
|
2909 |
same := false. |
|
2910 |
] |
|
2911 |
] |
|
2912 |
]. |
|
2913 |
same ifTrue:[^ self]. |
|
2914 |
]. |
|
4734 | 2915 |
]. |
2916 |
||
2917 |
"/ SV: this compare does not work, if model uses (i.e. updates) |
|
2918 |
"/ the same stringCollection as the view!! |
|
2919 |
true "text ~= list" ifTrue:[ |
|
4747 | 2920 |
"/ changed #list to care for scrollLocked |
2921 |
"/ scrollLocked ifTrue:[ |
|
2922 |
"/ self setList:newText expandTabs:expandTabsWhenUpdating |
|
2923 |
"/ ] ifFalse:[ |
|
2924 |
self list:newText expandTabs:expandTabsWhenUpdating scanForNonStrings:expandTabsWhenUpdating |
|
2925 |
"/ ] |
|
4734 | 2926 |
]. |
2927 |
]. |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2928 |
]. |
587
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2929 |
|
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2930 |
"Modified: 26.4.1996 / 14:09:42 / cg" |
1027
fe7279540aa5
Fix getListFromModel when model updates the stringCollection
Stefan Vogel <sv@exept.de>
parents:
993
diff
changeset
|
2931 |
"Modified: 19.2.1997 / 12:08:50 / stefan" |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2932 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2933 |
|
1099
eccab3759ddb
in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents:
1081
diff
changeset
|
2934 |
getListFromModelScroll:aBoolean |
eccab3759ddb
in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents:
1081
diff
changeset
|
2935 |
"ask my model (if any) for the text via the listMsg. |
3249
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
2936 |
If there is no listMessage, try aspect for backward compatibility. |
4747 | 2937 |
If aBoolean is false, scrolling is suppressed here" |
3249
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
2938 |
|
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
2939 |
|prev| |
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
2940 |
|
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
2941 |
prev := scrollLocked. |
4747 | 2942 |
scrollLocked := aBoolean not. |
3249
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
2943 |
[ |
4747 | 2944 |
self getListFromModel |
3249
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
2945 |
] ensure:[ |
4747 | 2946 |
scrollLocked := prev. |
1099
eccab3759ddb
in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents:
1081
diff
changeset
|
2947 |
]. |
eccab3759ddb
in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents:
1081
diff
changeset
|
2948 |
! |
eccab3759ddb
in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents:
1081
diff
changeset
|
2949 |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2950 |
line:line withoutEmphasis:emphasisToRemove |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2951 |
(line notNil |
2558
4c10bec1117d
more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents:
2557
diff
changeset
|
2952 |
and:[line isString]) ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2953 |
^ line withoutEmphasis:emphasisToRemove. |
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
2954 |
]. |
2558
4c10bec1117d
more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents:
2557
diff
changeset
|
2955 |
^ line |
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
2956 |
! |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
2957 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2958 |
listAt:lineNr from:startCol |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2959 |
"return right substring from startCol to end of a line" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2960 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2961 |
|line| |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2962 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2963 |
line := self listAt:lineNr. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2964 |
line isNil ifTrue:[^ nil]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2965 |
(startCol > line size) ifTrue:[^ nil]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2966 |
^ line copyFrom:startCol |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2967 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2968 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2969 |
listAt:lineNr from:startCol to:endCol |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2970 |
"return substring from startCol to endCol of a line" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2971 |
|
4638 | 2972 |
|line lineLen nCols| |
2973 |
||
2974 |
nCols := (endCol - startCol + 1). |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2975 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2976 |
line := self listAt:lineNr. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2977 |
lineLen := line size. |
4638 | 2978 |
|
2979 |
(line isNil or:[startCol > lineLen]) ifTrue:[ |
|
2980 |
(nCols > 0) ifTrue:[ |
|
2981 |
^ (String new:nCols) |
|
2982 |
]. |
|
2983 |
^ nil |
|
2984 |
]. |
|
2985 |
||
2986 |
(endCol > lineLen) ifTrue:[ |
|
2987 |
^ (line copyFrom:startCol to:lineLen) , (String new:(endCol-lineLen)) |
|
2988 |
]. |
|
2989 |
^ line copyFrom:startCol to:endCol |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2990 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2991 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2992 |
listAt:lineNr to:endCol |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2993 |
"return left substring from start to endCol of a line" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2994 |
|
4639 | 2995 |
|line lineSize| |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2996 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2997 |
line := self listAt:lineNr. |
4638 | 2998 |
line isNil ifTrue:[ |
4639 | 2999 |
(endCol > 0) ifTrue:[ |
3000 |
^ (String new:endCol) |
|
4638 | 3001 |
]. |
3002 |
^ nil |
|
3003 |
]. |
|
3004 |
||
3005 |
lineSize := line size. |
|
4639 | 3006 |
|
3007 |
(endCol > lineSize) ifTrue:[ |
|
3008 |
^ (line copyTo:lineSize) , (String new:(endCol - lineSize)). |
|
4638 | 3009 |
]. |
4639 | 3010 |
^ line copyTo:endCol |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3011 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3012 |
|
1608
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
3013 |
listLineIsVisible:listLineNr |
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
3014 |
"return true, if a particular line is visible" |
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
3015 |
|
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
3016 |
|visibleLineNr "{ Class: SmallInteger }"| |
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
3017 |
|
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
3018 |
shown ifFalse:[^ false]. |
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
3019 |
listLineNr isNil ifTrue:[^ false]. |
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
3020 |
visibleLineNr := listLineNr + 1 - firstLineShown. |
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
3021 |
^ (visibleLineNr between:1 and:nLinesShown) |
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
3022 |
|
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
3023 |
"Created: / 26.7.1998 / 13:24:16 / cg" |
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
3024 |
! |
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
3025 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3026 |
listLineToVisibleLine:listLineNr |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3027 |
"given a list line (1..) return visible linenr or nil" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3028 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3029 |
|visibleLineNr "{ Class: SmallInteger }"| |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3030 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3031 |
shown ifFalse:[^ nil]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3032 |
listLineNr isNil ifTrue:[^ nil]. |
2423
8b9c2946a5a7
absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
2412
diff
changeset
|
3033 |
visibleLineNr := listLineNr - firstLineShown + 1. |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3034 |
(visibleLineNr between:1 and:nLinesShown) ifFalse:[^ nil]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3035 |
^ visibleLineNr |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3036 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3037 |
|
2224
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
3038 |
recomputeWidthOfWidestLineFor:aString |
4751 | 3039 |
<resource: #obsolete> |
3040 |
self recomputeWidthOfWidestLineFor:aString old:nil |
|
3041 |
! |
|
3042 |
||
3043 |
recomputeWidthOfWidestLineFor:newEntry old:oldEntry |
|
3044 |
"a new line was added (oldEntry == nil) or replaced oldEntry. |
|
3045 |
Update the widthOfWidestLine cache or flush it, if we cannot easily |
|
3046 |
figure out the overall text width" |
|
3047 |
||
3048 |
|newW oldW| |
|
2224
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
3049 |
|
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
3050 |
widthOfWidestLine notNil ifTrue:[ |
4751 | 3051 |
newEntry isNil ifTrue:[ |
3052 |
newW := 0 |
|
3053 |
] ifFalse:[ |
|
5111 | 3054 |
(newEntry isSingleByteString) ifTrue:[ |
4751 | 3055 |
newW := font widthOf:newEntry |
3056 |
] ifFalse:[ |
|
3057 |
newW := newEntry widthOn:self |
|
3058 |
]. |
|
3059 |
]. |
|
3060 |
||
3061 |
newW >= widthOfWidestLine ifTrue:[ |
|
3062 |
widthOfWidestLine := newW. |
|
3063 |
] ifFalse:[ |
|
3064 |
oldEntry isNil ifTrue:[ |
|
3065 |
oldW := 0 |
|
3066 |
] ifFalse:[ |
|
5111 | 3067 |
(oldEntry isSingleByteString) ifTrue:[ |
4751 | 3068 |
oldW := font widthOf:oldEntry |
3069 |
] ifFalse:[ |
|
3070 |
oldW := oldEntry widthOn:self |
|
3071 |
]. |
|
3072 |
]. |
|
3073 |
newW > oldW ifTrue:[ |
|
3074 |
"/ no change; new entries width is between this width and amx width |
|
3075 |
] ifFalse:[ |
|
3076 |
"/ new entry is smaller than oldEntry; if the oldEntry was the previos max, |
|
3077 |
"/ we don't know the new max |
|
3078 |
oldW = widthOfWidestLine ifTrue:[ |
|
3079 |
widthOfWidestLine := nil "/ means: unknown |
|
3080 |
] ifFalse:[ |
|
3081 |
"/ old line was not the widest, and new line is shorter; |
|
3082 |
"/ no change |
|
3083 |
] |
|
3084 |
] |
|
3085 |
]. |
|
2224
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
3086 |
]. |
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
3087 |
^ widthOfWidestLine |
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
3088 |
! |
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
3089 |
|
2225
65ac7cbffc60
added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents:
2224
diff
changeset
|
3090 |
suppressEmphasisInSelection |
65ac7cbffc60
added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents:
2224
diff
changeset
|
3091 |
"selection is shown with original emphasis" |
65ac7cbffc60
added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents:
2224
diff
changeset
|
3092 |
|
65ac7cbffc60
added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents:
2224
diff
changeset
|
3093 |
^ false |
65ac7cbffc60
added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents:
2224
diff
changeset
|
3094 |
! |
65ac7cbffc60
added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents:
2224
diff
changeset
|
3095 |
|
2181 | 3096 |
textChanged |
3097 |
"ignored here" |
|
3098 |
! |
|
3099 |
||
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3100 |
visibleAt:visibleLineNr |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3101 |
"return what is visible at line (numbers start at 1). |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3102 |
This is used for redrawing; i.e. for non-string entries, this |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3103 |
returns the original." |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3104 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3105 |
|listLineNr listsize| |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3106 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3107 |
listLineNr := visibleLineNr + firstLineShown - 1. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3108 |
(listLineNr == 0) ifTrue:[^ nil]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3109 |
(list notNil) ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3110 |
listsize := self size |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3111 |
] ifFalse:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3112 |
listsize := 0 |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3113 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3114 |
(listLineNr <= listsize) ifTrue:[^ self at:listLineNr]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3115 |
^ '' |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3116 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3117 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3118 |
visibleLineOfY:y |
3818 | 3119 |
"given a y-coordinate, return the visible lineNr |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3120 |
- works for fix-height fonts only" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3121 |
|
1448
4220c80ab099
Do not reurn lineNumbers < 1 in #visibleLineOfY:
Stefan Vogel <sv@exept.de>
parents:
1433
diff
changeset
|
3122 |
^ (((y - textStartTop) // fontHeight) + 1) max:1 |
4220c80ab099
Do not reurn lineNumbers < 1 in #visibleLineOfY:
Stefan Vogel <sv@exept.de>
parents:
1433
diff
changeset
|
3123 |
|
4220c80ab099
Do not reurn lineNumbers < 1 in #visibleLineOfY:
Stefan Vogel <sv@exept.de>
parents:
1433
diff
changeset
|
3124 |
"Modified: / 13.2.1998 / 20:57:26 / stefan" |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3125 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3126 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3127 |
visibleLineToAbsoluteLine:visibleLineNr |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3128 |
"given a visible line (1..) return absolut linenr" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3129 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3130 |
visibleLineNr isNil ifTrue:[^ nil]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3131 |
^ visibleLineNr + firstLineShown - 1 |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3132 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3133 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3134 |
visibleLineToListLine:visibleLineNr |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3135 |
"given a visible line (1..) return linenr in list or nil |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3136 |
(this one returns nil if the given visibleLineNr is one of the |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3137 |
separators)" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3138 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3139 |
|listLineNr "{ Class: SmallInteger }" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3140 |
listsize "{ Class: SmallInteger }" | |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3141 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3142 |
visibleLineNr isNil ifTrue:[^ nil]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3143 |
listLineNr := visibleLineNr + firstLineShown - 1. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3144 |
(listLineNr == 0) ifTrue:[^nil]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3145 |
listsize := self size. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3146 |
(listLineNr <= listsize) ifTrue:[^ listLineNr]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3147 |
^ nil |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3148 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3149 |
|
2559 | 3150 |
visibleStringFrom:aString |
3151 |
^ aString asString |
|
3152 |
! |
|
3153 |
||
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3154 |
widthForScrollBetween:firstLine and:lastLine |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3155 |
"return the width in pixels for a scroll between firstLine and lastLine. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3156 |
- used to optimize scrolling, by limiting the scrolled area. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3157 |
Subclasses with selections or other additional visible stuff should redefine |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3158 |
this method." |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3159 |
|
957
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3160 |
^ innerWidth |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3161 |
|
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3162 |
"/ "for small width, its not worth searching for |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3163 |
"/ longest line ... |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3164 |
"/ " |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3165 |
"/ (width < 300) ifTrue:[^ innerWidth]. |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3166 |
"/ |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3167 |
"/ "for large lists, search may take longer than scrolling full |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3168 |
"/ " |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3169 |
"/ self size > 2000 ifTrue:[^ innerWidth]. |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3170 |
"/ |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3171 |
"/ " |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3172 |
"/ if there is a pattern-background, we have to scroll everything |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3173 |
"/ " |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3174 |
"/ (viewBackground isColor not |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3175 |
"/ or:[viewBackground isDithered]) ifTrue:[ |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3176 |
"/ ^ width |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3177 |
"/ ]. |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3178 |
"/ |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3179 |
"/ w := self widthOfWidestLineBetween:firstLine and:lastLine. |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3180 |
"/ (w > innerWidth) ifTrue:[^ innerWidth]. |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3181 |
"/ ^ w |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3182 |
|
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3183 |
"Modified: 17.1.1997 / 17:44:12 / cg" |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3184 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3185 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3186 |
widthOfLineString:entry |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3187 |
"return the width of an entry" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3188 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3189 |
entry isNil ifTrue:[^ 0]. |
5111 | 3190 |
(entry isSingleByteString) ifTrue:[ |
4765 | 3191 |
^ font widthOf:entry |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3192 |
]. |
634
1ca770b2c494
handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
3193 |
^ entry widthOn:self |
1ca770b2c494
handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
3194 |
|
1ca770b2c494
handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
3195 |
"Modified: 12.5.1996 / 20:09:53 / cg" |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3196 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3197 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3198 |
widthOfWidestLineBetween:firstLine and:lastLine |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3199 |
"return the width in pixels of the widest line in a range |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3200 |
- used to optimize scrolling, by limiting the scrolled area" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3201 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3202 |
|max "{ Class: SmallInteger }" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3203 |
first "{ Class: SmallInteger }" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3204 |
last "{ Class: SmallInteger }" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3205 |
thisLen "{ Class: SmallInteger }" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3206 |
listSize "{ Class: SmallInteger }" | |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3207 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3208 |
includesNonStrings ifTrue:[ |
4765 | 3209 |
^ width |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3210 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3211 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3212 |
fontIsFixedWidth ifTrue:[ |
4765 | 3213 |
^ (self lengthOfLongestLineBetween:firstLine and:lastLine) * fontWidth |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3214 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3215 |
listSize := self size. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3216 |
max := 0. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3217 |
first := firstLine. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3218 |
last := lastLine. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3219 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3220 |
(first > listSize) ifTrue:[^ max]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3221 |
(last > listSize) ifTrue:[ |
4765 | 3222 |
last := listSize |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3223 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3224 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3225 |
self from:first to:last do:[:line | |
4765 | 3226 |
line notNil ifTrue:[ |
5111 | 3227 |
(line isSingleByteString) ifTrue:[ |
4765 | 3228 |
thisLen := font widthOf:line |
3229 |
] ifFalse:[ |
|
3230 |
thisLen := line widthOn:self |
|
3231 |
]. |
|
3232 |
(thisLen > max) ifTrue:[ |
|
3233 |
max := thisLen |
|
3234 |
] |
|
3235 |
] |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3236 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3237 |
^ max |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3238 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3239 |
|
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
3240 |
withoutAnyColorEmphasis:line |
4046 | 3241 |
(line notNil and:[line isText]) ifTrue:[ |
4392 | 3242 |
^ line withoutAnyColorEmphasis |
4046 | 3243 |
]. |
3244 |
^ line |
|
3245 |
||
3246 |
" |
|
3247 |
'hello' asText colorizeAllWith:Color red. |
|
3248 |
('hello' asText colorizeAllWith:Color red) withoutForegroundColorEmphasis. |
|
4392 | 3249 |
('hello' asText colorizeAllWith:Color red) withoutAnyColorEmphasis. |
4046 | 3250 |
" |
4392 | 3251 |
|
3252 |
"Modified (comment): / 06-03-2012 / 18:16:41 / cg" |
|
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
3253 |
! |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
3254 |
|
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
3255 |
withoutBackgroundColorEmphasis:line |
4046 | 3256 |
(line notNil and:[line isText]) ifTrue:[ |
3257 |
^ line withoutBackgroundColorEmphasis |
|
3258 |
]. |
|
3259 |
^ line |
|
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
3260 |
! |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
3261 |
|
2090
85c0dd8a4281
selection over colored text - again
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
3262 |
withoutColorEmphasis:line |
4046 | 3263 |
(line notNil and:[line isText]) ifTrue:[ |
3264 |
^ line withoutForegroundColorEmphasis |
|
3265 |
]. |
|
3266 |
^ line |
|
2090
85c0dd8a4281
selection over colored text - again
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
3267 |
! |
85c0dd8a4281
selection over colored text - again
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
3268 |
|
85c0dd8a4281
selection over colored text - again
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
3269 |
withoutColorEmphasis:line ifFg:fg andBg:bg |
85c0dd8a4281
selection over colored text - again
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
3270 |
"/ remove lines color emphasis, to enforce color. |
85c0dd8a4281
selection over colored text - again
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
3271 |
"/ otherwise blue text is not visible if selection-bg is blue |
4046 | 3272 |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3273 |
(line notNil |
4046 | 3274 |
and:[line isText |
3275 |
and:[fg ~= fgColor or:[bg ~= bgColor]]]) ifTrue:[ |
|
4392 | 3276 |
^ line withoutAnyColorEmphasis |
2090
85c0dd8a4281
selection over colored text - again
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
3277 |
]. |
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
3278 |
^ line |
2090
85c0dd8a4281
selection over colored text - again
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
3279 |
|
4392 | 3280 |
"Created: / 15-12-1999 / 23:19:30 / cg" |
2090
85c0dd8a4281
selection over colored text - again
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
3281 |
! |
85c0dd8a4281
selection over colored text - again
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
3282 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3283 |
xOfCol:col inVisibleLine:visLineNr |
2209 | 3284 |
"given a visible line- and colNr, return the x-coordinate in view" |
3285 |
||
3286 |
|line lineSize tcol lText| |
|
3287 |
||
3288 |
col == 1 ifTrue:[ |
|
4651 | 3289 |
lText := 0 |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3290 |
] ifFalse:[ |
4651 | 3291 |
tcol := col - 1. |
3292 |
||
3293 |
line := self visibleAt:visLineNr. |
|
3294 |
(fontIsFixedWidth |
|
5111 | 3295 |
and:[line isNil or:[line isSingleByteString]]) |
4651 | 3296 |
ifTrue:[ |
3297 |
lText := (tcol * fontWidth) |
|
3298 |
] ifFalse:[ |
|
3299 |
line notNil ifTrue:[ |
|
3300 |
lineSize := line string size |
|
3301 |
] ifFalse:[ |
|
3302 |
lineSize := 0 |
|
3303 |
]. |
|
3304 |
(lineSize == 0) ifTrue:[ |
|
3305 |
lText := (tcol * fontWidth) |
|
3306 |
] ifFalse:[ |
|
3307 |
(lineSize < col) ifTrue:[ |
|
3308 |
lText := (line widthOn:self) + (fontWidth * (tcol - lineSize)) |
|
3309 |
] ifFalse:[ |
|
5111 | 3310 |
(line isSingleByteString) ifTrue:[ |
4651 | 3311 |
lText := (font widthOf:line from:1 to:tcol) |
3312 |
] ifFalse:[ |
|
3313 |
lText := line widthFrom:1 to:tcol on:self. |
|
3314 |
] |
|
3315 |
] |
|
3316 |
] |
|
3317 |
] |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3318 |
]. |
2209 | 3319 |
^ lText + textStartLeft |
670
8e381269591c
more fixes for non-string entries
Claus Gittinger <cg@exept.de>
parents:
668
diff
changeset
|
3320 |
|
1656
1202fbc95970
some fixes forvariable fonts on win32
Claus Gittinger <cg@exept.de>
parents:
1637
diff
changeset
|
3321 |
"Modified: / 3.9.1998 / 21:56:33 / cg" |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3322 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3323 |
|
1608
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
3324 |
yOfLine:lineNr |
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
3325 |
"given a physical lineNr, return y-coordinate in view |
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
3326 |
- works for fix-height fonts only" |
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
3327 |
|
4641 | 3328 |
|visLine| |
3329 |
||
3330 |
visLine := self listLineToVisibleLine:lineNr. |
|
3331 |
visLine isNil ifTrue:[ |
|
3332 |
^ nil |
|
3333 |
]. |
|
3334 |
^ self yOfVisibleLine:visLine |
|
1608
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
3335 |
|
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
3336 |
"Created: / 26.7.1998 / 13:23:16 / cg" |
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
3337 |
! |
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
3338 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3339 |
yOfVisibleLine:visLineNr |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3340 |
"given a visible lineNr, return y-coordinate in view |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3341 |
- works for fix-height fonts only" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3342 |
|
3819 | 3343 |
"/ care for visLineNr being nil during initialization |
3344 |
^ (((visLineNr ? 1) - 1) * fontHeight) + textStartTop |
|
3398
d5c915fe3d92
oops - ListModelView protocol
Claus Gittinger <cg@exept.de>
parents:
3339
diff
changeset
|
3345 |
! |
d5c915fe3d92
oops - ListModelView protocol
Claus Gittinger <cg@exept.de>
parents:
3339
diff
changeset
|
3346 |
|
d5c915fe3d92
oops - ListModelView protocol
Claus Gittinger <cg@exept.de>
parents:
3339
diff
changeset
|
3347 |
yVisibleToLineNr:yVisible |
d5c915fe3d92
oops - ListModelView protocol
Claus Gittinger <cg@exept.de>
parents:
3339
diff
changeset
|
3348 |
|vL| |
d5c915fe3d92
oops - ListModelView protocol
Claus Gittinger <cg@exept.de>
parents:
3339
diff
changeset
|
3349 |
|
d5c915fe3d92
oops - ListModelView protocol
Claus Gittinger <cg@exept.de>
parents:
3339
diff
changeset
|
3350 |
vL := self visibleLineOfY:yVisible. |
d5c915fe3d92
oops - ListModelView protocol
Claus Gittinger <cg@exept.de>
parents:
3339
diff
changeset
|
3351 |
^ self visibleLineToListLine:vL |
d5c915fe3d92
oops - ListModelView protocol
Claus Gittinger <cg@exept.de>
parents:
3339
diff
changeset
|
3352 |
|
d5c915fe3d92
oops - ListModelView protocol
Claus Gittinger <cg@exept.de>
parents:
3339
diff
changeset
|
3353 |
"Created: / 20-09-2006 / 15:29:12 / cg" |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3354 |
! ! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3355 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3356 |
!ListView methodsFor:'queries'! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3357 |
|
4303 | 3358 |
characterPositionOfLine:lineNr col:colArg |
2812 | 3359 |
"given a line/col position, return the character index within the contents-string, |
4468
6d711c19c529
comment/format in: #characterPositionOfLine:col:
Claus Gittinger <cg@exept.de>
parents:
4463
diff
changeset
|
3360 |
- used with compiler's error-positioning, which is based on character positions |
2812 | 3361 |
of the contents-string." |
3362 |
||
4468
6d711c19c529
comment/format in: #characterPositionOfLine:col:
Claus Gittinger <cg@exept.de>
parents:
4463
diff
changeset
|
3363 |
|lineString charPos lineEndCharSize col| |
3314 | 3364 |
|
3854 | 3365 |
lineEndCharSize := self lineEndCRLF ifTrue:[2] ifFalse:[1]. |
2812 | 3366 |
|
3367 |
self checkForExistingLine:lineNr. |
|
4468
6d711c19c529
comment/format in: #characterPositionOfLine:col:
Claus Gittinger <cg@exept.de>
parents:
4463
diff
changeset
|
3368 |
charPos := 1. |
2812 | 3369 |
1 to:(lineNr - 1) do:[:lnr | |
4303 | 3370 |
lineString := self at:lnr. |
3371 |
lineString notNil ifTrue:[ |
|
4468
6d711c19c529
comment/format in: #characterPositionOfLine:col:
Claus Gittinger <cg@exept.de>
parents:
4463
diff
changeset
|
3372 |
charPos := charPos + (lineString string "withoutTrailingSeparators") size |
4303 | 3373 |
]. |
4468
6d711c19c529
comment/format in: #characterPositionOfLine:col:
Claus Gittinger <cg@exept.de>
parents:
4463
diff
changeset
|
3374 |
charPos := charPos + lineEndCharSize "the return-character" |
2812 | 3375 |
]. |
4303 | 3376 |
|
4759 | 3377 |
"/ if beyond end of line, be careful to not advance into next line. |
3378 |
"/ otherwise, syntaxHighlighter (and others) walk into trouble, |
|
3379 |
"/ if clicked on a space beyond a line's end. |
|
3380 |
col := colArg min:((self at:lineNr) size + 1). |
|
4468
6d711c19c529
comment/format in: #characterPositionOfLine:col:
Claus Gittinger <cg@exept.de>
parents:
4463
diff
changeset
|
3381 |
^ charPos + col - 1 |
3314 | 3382 |
|
3383 |
"Modified: / 04-07-2006 / 19:14:25 / fm" |
|
4303 | 3384 |
"Modified: / 21-08-2011 / 11:03:19 / cg" |
2812 | 3385 |
! |
3386 |
||
3387 |
colOfCharacterPosition:charPos |
|
3388 |
"given a character index within the contents-string, |
|
3389 |
return the column number where the character is |
|
3390 |
- used to find line to hilight from Compilers error-position" |
|
3391 |
||
3392 |
|line| |
|
3393 |
||
3394 |
line := self lineOfCharacterPosition:charPos. |
|
3395 |
^ charPos - (self characterPositionOfLine:line col:1) + 1. |
|
3396 |
||
3397 |
! |
|
3398 |
||
1525
6079f38d5e89
added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents:
1497
diff
changeset
|
3399 |
currentLine |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3400 |
"the current line (for relative gotos); |
1525
6079f38d5e89
added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents:
1497
diff
changeset
|
3401 |
since listViews have no cursor, the first shown line is returned here. |
6079f38d5e89
added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents:
1497
diff
changeset
|
3402 |
Redefined in editTextView, to return the cursors line." |
6079f38d5e89
added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents:
1497
diff
changeset
|
3403 |
|
6079f38d5e89
added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents:
1497
diff
changeset
|
3404 |
^ firstLineShown |
6079f38d5e89
added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents:
1497
diff
changeset
|
3405 |
|
6079f38d5e89
added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents:
1497
diff
changeset
|
3406 |
"Created: / 17.5.1998 / 20:07:36 / cg" |
6079f38d5e89
added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents:
1497
diff
changeset
|
3407 |
! |
6079f38d5e89
added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents:
1497
diff
changeset
|
3408 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3409 |
firstLineShown |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3410 |
"return the index of the first (possibly partial) visible line" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3411 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3412 |
^ firstLineShown |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3413 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3414 |
|
311
cddf10b2207e
added query for height with n lines
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
3415 |
heightForLines:numberOfLines |
cddf10b2207e
added query for height with n lines
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
3416 |
"return the height of the receiver, if numberOfLines are to be displayed" |
cddf10b2207e
added query for height with n lines
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
3417 |
|
cddf10b2207e
added query for height with n lines
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
3418 |
"need a device font for query" |
1990 | 3419 |
font := font onDevice:device. |
311
cddf10b2207e
added query for height with n lines
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
3420 |
^ numberOfLines * fontHeight + topMargin + font descent + (lineSpacing) + (margin * 2) |
cddf10b2207e
added query for height with n lines
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
3421 |
|
cddf10b2207e
added query for height with n lines
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
3422 |
"Created: 27.1.1996 / 16:55:39 / cg" |
cddf10b2207e
added query for height with n lines
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
3423 |
! |
cddf10b2207e
added query for height with n lines
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
3424 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3425 |
heightOfContents |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3426 |
"return the height of the contents in pixels |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3427 |
- used for scrollbar interface" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3428 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3429 |
| numLines | |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3430 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3431 |
numLines := self numberOfLines. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3432 |
numLines == 0 ifTrue:[^ 0]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3433 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3434 |
"/ |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3435 |
"/ kludge for last partial line |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3436 |
"/ |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3437 |
"/ nFullLinesShown ~~ nLinesShown ifTrue:[ |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3438 |
"/ numLines := numLines + 1 |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3439 |
"/ ]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3440 |
" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3441 |
need device-font for query |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3442 |
" |
1990 | 3443 |
font := font onDevice:device. |
2649 | 3444 |
^ numLines * fontHeight "dont take font height here - think of LabelAndIcons" |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3445 |
"/ + textStartTop |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3446 |
- (lineSpacing // 2) |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3447 |
+ (font descent) |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3448 |
"/ + (font descent) |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3449 |
"/ + (font descent * 2) "makes it look better" |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3450 |
. |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3451 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3452 |
"/ "it used to be that code - which is wrong" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3453 |
"/ (nLinesShown == nFullLinesShown) ifTrue:[ |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3454 |
"/ ^ numLines * fontHeight |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3455 |
"/ ]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3456 |
"/ "add one - otherwise we cannot make last line |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3457 |
"/ fully visible since scrolling is done by full lines only" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3458 |
"/ |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3459 |
"/ ^ (numLines + 1) * fontHeight |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3460 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3461 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3462 |
lastLineShown |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3463 |
"return the index of the last (possibly partial) visible line" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3464 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3465 |
^ firstLineShown + nLinesShown |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3466 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3467 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3468 |
leftIndentOfLine:lineNr |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3469 |
"return the number of spaces at the left in line, lineNr. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3470 |
returns 0 for empty lines." |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3471 |
|
566 | 3472 |
|lineString indent| |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3473 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3474 |
lineString := self listAt:lineNr. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3475 |
lineString notNil ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3476 |
indent := lineString leftIndent. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3477 |
indent == lineString size ifTrue:[^ 0]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3478 |
^ indent. |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3479 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3480 |
^ 0 |
566 | 3481 |
|
3482 |
"Modified: 20.4.1996 / 19:30:38 / cg" |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3483 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3484 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3485 |
lengthOfLongestLine |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3486 |
"return the length (in characters) of the longest line" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3487 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3488 |
^ self lengthOfLongestLineBetween:1 and:self size |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3489 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3490 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3491 |
lengthOfLongestLineBetween:firstLine and:lastLine |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3492 |
"return the length (in characters) of the longest line in a line-range" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3493 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3494 |
|max "{ Class: SmallInteger }" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3495 |
thisLen "{ Class: SmallInteger }" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3496 |
listSize "{ Class: SmallInteger }" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3497 |
first "{ Class: SmallInteger }" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3498 |
last "{ Class: SmallInteger }" | |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3499 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3500 |
list isNil ifTrue:[^ 0]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3501 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3502 |
listSize := self size. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3503 |
max := 0. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3504 |
first := firstLine. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3505 |
last := lastLine. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3506 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3507 |
(first > listSize) ifTrue:[^ max]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3508 |
(last > listSize) ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3509 |
last := listSize |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3510 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3511 |
self from:first to:last do:[:lineString | |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3512 |
lineString notNil ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3513 |
thisLen := lineString size. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3514 |
(thisLen > max) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3515 |
max := thisLen |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3516 |
] |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3517 |
] |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3518 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3519 |
^ max |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3520 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3521 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3522 |
|
587
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3523 |
lineIsFullyVisible:line |
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3524 |
"is line fully visible?" |
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3525 |
|
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3526 |
(line >= firstLineShown |
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3527 |
and:[ line < (firstLineShown + nFullLinesShown) ]) ifTrue:[ ^ true ]. |
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3528 |
^ false. |
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3529 |
|
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3530 |
"Created: 26.4.1996 / 14:36:45 / cg" |
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3531 |
! |
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3532 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3533 |
lineIsVisible:line |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3534 |
"is line visible?" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3535 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3536 |
(line >= firstLineShown and:[ line < (firstLineShown + nLinesShown) ]) ifTrue:[ ^ true ]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3537 |
^ false. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3538 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3539 |
|
2812 | 3540 |
lineOfCharacterPosition:charPos |
3541 |
"given a character index within the contents-string, |
|
3542 |
return the lineNumber where the character is |
|
4448
2e4bb12f298c
changed: #lineOfCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
4444
diff
changeset
|
3543 |
- used to find line to hilight from compiler's error-position" |
2812 | 3544 |
|
4303 | 3545 |
|lineNr sum lastLine lineEndCharSize l| |
3314 | 3546 |
|
4280
61a16b0a99d5
changed: #lineOfCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
4247
diff
changeset
|
3547 |
lineEndCharSize := self lineEndCRLF ifTrue:[2] ifFalse:[1]. |
2812 | 3548 |
|
3549 |
lineNr := 1. |
|
3550 |
sum := 0. |
|
3551 |
lastLine := self size. |
|
3552 |
[(sum < charPos) and:[lineNr <= lastLine]] whileTrue:[ |
|
4303 | 3553 |
l := (self at:lineNr) ? ''. |
3554 |
sum := sum + (l string "withoutTrailingSeparators" size) + lineEndCharSize. |
|
4280
61a16b0a99d5
changed: #lineOfCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
4247
diff
changeset
|
3555 |
lineNr := lineNr + 1 |
2812 | 3556 |
]. |
3557 |
sum == charPos ifTrue:[ |
|
4280
61a16b0a99d5
changed: #lineOfCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
4247
diff
changeset
|
3558 |
^ lineNr |
2812 | 3559 |
]. |
3560 |
||
4448
2e4bb12f298c
changed: #lineOfCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
4444
diff
changeset
|
3561 |
^ (lineNr - 1) max:1 |
2812 | 3562 |
|
3314 | 3563 |
"Modified: / 04-07-2006 / 19:13:32 / fm" |
4303 | 3564 |
"Modified: / 21-08-2011 / 10:50:12 / cg" |
2812 | 3565 |
! |
3566 |
||
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3567 |
numberOfLines |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3568 |
"return the number of lines the text has" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3569 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3570 |
^ self size |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3571 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3572 |
|
4607 | 3573 |
preferredExtentForContents |
3574 |
^ (self widthOfContents @ self heightOfContents) |
|
3575 |
! |
|
3576 |
||
678
c1967a46b2c1
added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents:
670
diff
changeset
|
3577 |
preferredExtentForLines:numLines cols:numCols |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3578 |
^ (((font widthOf:'x') * numCols + margin + margin) |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3579 |
@ |
688 | 3580 |
(fontHeight * numLines + margin + margin + font descent + lineSpacing + topMargin)). |
3581 |
||
3582 |
"Modified: 26.5.1996 / 12:26:41 / cg" |
|
678
c1967a46b2c1
added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents:
670
diff
changeset
|
3583 |
! |
c1967a46b2c1
added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents:
670
diff
changeset
|
3584 |
|
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
3585 |
supportsSyntaxElements |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
3586 |
"see CodeView2::TextView" |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
3587 |
|
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
3588 |
^ false |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
3589 |
! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
3590 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3591 |
widthOfContents |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3592 |
"return the width of the contents in pixels |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3593 |
- used for scrollbar interface" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3594 |
|
4749 | 3595 |
|f d |
3596 |
start "{ Class: SmallInteger }" |
|
3597 |
stop "{ Class: SmallInteger }" |
|
3598 |
lengthOfLongestString "{ Class: SmallInteger }" |
|
3599 |
lengthOfLongestLine "{ Class: SmallInteger }" |
|
3600 |
max "{ Class: SmallInteger }"| |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3601 |
|
4752 | 3602 |
list isEmptyOrNil ifTrue:[^ 0]. |
4751 | 3603 |
widthOfWidestLine notNil ifTrue:[ |
3604 |
"/ already computed (cached); this cache is cleared when the contents is modified |
|
3605 |
^ widthOfWidestLine + (leftMargin * 2) |
|
3606 |
]. |
|
607
67462978fb20
fixed #widthOfContents if no device is known
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
3607 |
|
1990 | 3608 |
(d := device) isNil ifTrue:[ |
4522 | 3609 |
"/ mhmh - really dont know yet |
3610 |
d := Screen current |
|
607
67462978fb20
fixed #widthOfContents if no device is known
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
3611 |
]. |
1990 | 3612 |
f := font := font onDevice:d. |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3613 |
|
4751 | 3614 |
checkedLinesForWidthOfContentsComputation isNil ifTrue:[ |
3615 |
start := 1. |
|
3616 |
stop := list size |
|
3617 |
] ifFalse:[ |
|
3618 |
checkedLinesForWidthOfContentsComputation >= 0 ifTrue:[ |
|
3619 |
start := 1. |
|
4770 | 3620 |
stop := (checkedLinesForWidthOfContentsComputation min:list size) |
4751 | 3621 |
] ifFalse:[ |
3622 |
stop := list size. |
|
4770 | 3623 |
start := (list size + 1 + checkedLinesForWidthOfContentsComputation) max:1. |
4751 | 3624 |
] |
3625 |
]. |
|
4749 | 3626 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3627 |
includesNonStrings ifTrue:[ |
4749 | 3628 |
max := 0. |
3629 |
start to:stop do:[:lineNr | |
|
3630 |
|entry w| |
|
3631 |
||
3632 |
entry := list at:lineNr. |
|
3633 |
entry notNil ifTrue:[ |
|
5111 | 3634 |
(entry isSingleByteString) ifTrue:[ |
4749 | 3635 |
w := f widthOf:entry |
3636 |
] ifFalse:[ |
|
3637 |
w := entry widthOn:self |
|
3638 |
]. |
|
3639 |
max := max max:w. |
|
3640 |
]. |
|
3641 |
]. |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3642 |
] ifFalse:[ |
4522 | 3643 |
fontIsFixedWidth ifTrue:[ |
3644 |
max := lengthOfLongestString := 0. |
|
3645 |
list notNil ifTrue:[ |
|
4749 | 3646 |
start to:stop do:[:lineNr | |
3647 |
|line| |
|
3648 |
||
3649 |
line := list at:lineNr. |
|
4522 | 3650 |
line notNil ifTrue:[ |
5111 | 3651 |
(line isSingleByteString) ifTrue:[ |
4522 | 3652 |
line size > lengthOfLongestString ifTrue:[ |
3653 |
lengthOfLongestString := line size |
|
3654 |
]. |
|
3655 |
] ifFalse:[ |
|
3656 |
max := max max:(line widthOn:self) |
|
3657 |
] |
|
3658 |
] |
|
3659 |
]. |
|
3660 |
max := max max:(lengthOfLongestString * fontWidth) |
|
3661 |
]. |
|
3662 |
] ifFalse:[ |
|
4732 | 3663 |
max := lengthOfLongestLine := 0. |
3664 |
list notNil ifTrue:[ |
|
4749 | 3665 |
start to:stop do:[:lineNr | |
3666 |
|line len| |
|
3667 |
||
5090 | 3668 |
line := list at:lineNr ifAbsent:nil. |
4732 | 3669 |
line notNil ifTrue:[ |
3670 |
len := line size. |
|
3671 |
"/ consider this a speed hack (not exact, but fast) |
|
3672 |
lengthOfLongestLine := lengthOfLongestLine max:len. |
|
3673 |
len > (lengthOfLongestLine // 3) ifTrue:[ |
|
3674 |
max := max max:(line widthOn:self) |
|
3675 |
]. |
|
3676 |
] |
|
4522 | 3677 |
]. |
3678 |
]. |
|
3679 |
]. |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3680 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3681 |
widthOfWidestLine := max. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3682 |
^ max + (leftMargin * 2) |
607
67462978fb20
fixed #widthOfContents if no device is known
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
3683 |
|
1700
3538310c2724
fixed widthOfContents with variable fonts (win32);
Claus Gittinger <cg@exept.de>
parents:
1699
diff
changeset
|
3684 |
"Modified: / 24.9.1998 / 18:21:08 / cg" |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3685 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3686 |
|
1716 | 3687 |
widthOfLine:lineNr |
3688 |
"return the width of a line in pixels" |
|
3689 |
||
1990 | 3690 |
|line f d| |
1716 | 3691 |
|
3692 |
list isNil ifTrue:[^ 0]. |
|
3693 |
lineNr > list size ifTrue:[^ 0]. |
|
3694 |
line := list at:lineNr. |
|
3695 |
list isNil ifTrue:[^ 0]. |
|
3696 |
||
1990 | 3697 |
(d := device) isNil ifTrue:[ |
4765 | 3698 |
"/ mhmh - really dont know yet |
3699 |
d := Screen current |
|
1716 | 3700 |
]. |
1990 | 3701 |
f := font := font onDevice:d. |
1716 | 3702 |
|
5111 | 3703 |
(line isSingleByteString) ifTrue:[ |
4765 | 3704 |
^ f widthOf:line |
1716 | 3705 |
]. |
3706 |
^ line widthOn:self |
|
3707 |
||
3708 |
"Created: / 10.11.1998 / 23:59:20 / cg" |
|
3709 |
"Modified: / 11.11.1998 / 15:25:07 / cg" |
|
3710 |
! |
|
3711 |
||
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3712 |
xOriginOfContents |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3713 |
"return the horizontal origin of the contents in pixels |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3714 |
- used for scrollbar interface" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3715 |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3716 |
^ viewOrigin x |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3717 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3718 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3719 |
yOriginOfContents |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3720 |
"return the vertical origin of the contents in pixels |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3721 |
- used for scrollbar interface" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3722 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3723 |
^ (firstLineShown - 1) * fontHeight |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3724 |
! ! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3725 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3726 |
!ListView methodsFor:'redrawing'! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3727 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3728 |
flash |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3729 |
"show contents in reverse colors for a moment - to wakeup the user :-)" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3730 |
|
4987 | 3731 |
super flash. |
3732 |
"/ self redrawInverted. |
|
3733 |
"/ Delay waitForSeconds:0.1. |
|
3734 |
"/ self redraw |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3735 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3736 |
" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3737 |
Transcript flash |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3738 |
Transcript redrawInverted |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3739 |
Transcript redraw |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3740 |
" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3741 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3742 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3743 |
redraw |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3744 |
"redraw complete view" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3745 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3746 |
shown ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3747 |
self redrawFromVisibleLine:1 to:nLinesShown |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3748 |
] |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3749 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3750 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3751 |
redrawFromLine:lineNr |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3752 |
"redraw starting at linrNr" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3753 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3754 |
|visibleLine first| |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3755 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3756 |
shown ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3757 |
"if first line to redraw is above 1st visible line, |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3758 |
start redraw at 1st visible line" |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3759 |
(lineNr < firstLineShown) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3760 |
first := firstLineShown |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3761 |
] ifFalse:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3762 |
first := lineNr |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3763 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3764 |
visibleLine := self listLineToVisibleLine:first. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3765 |
visibleLine notNil ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3766 |
self redrawFromVisibleLine:visibleLine to:nLinesShown |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3767 |
] |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3768 |
] |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3769 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3770 |
|
2605
4f8c7e50f217
added redrawFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2577
diff
changeset
|
3771 |
redrawFromLine:startLine col:startCol toLine:endLine col:endCol |
4f8c7e50f217
added redrawFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2577
diff
changeset
|
3772 |
shown ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3773 |
self redrawLine:startLine from:startCol. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3774 |
endLine > (startLine+1) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3775 |
self redrawFromLine:startLine+1 to:endLine-1 |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3776 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3777 |
self redrawLine:endLine from:1 to:endCol. |
2605
4f8c7e50f217
added redrawFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2577
diff
changeset
|
3778 |
] |
4f8c7e50f217
added redrawFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2577
diff
changeset
|
3779 |
! |
4f8c7e50f217
added redrawFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2577
diff
changeset
|
3780 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3781 |
redrawFromLine:start to:end |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3782 |
"redraw lines from start to end" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3783 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3784 |
|visibleFirst visibleLast first last lastLineShown| |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3785 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3786 |
shown ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3787 |
lastLineShown := firstLineShown + nLinesShown - 1. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3788 |
(start <= lastLineShown) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3789 |
(end >= firstLineShown) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3790 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3791 |
"if first line to redraw is above 1st visible line, |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3792 |
start redraw at 1st visible line" |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3793 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3794 |
(start < firstLineShown) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3795 |
first := firstLineShown |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3796 |
] ifFalse:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3797 |
first := start |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3798 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3799 |
(end > lastLineShown) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3800 |
last := lastLineShown |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3801 |
] ifFalse:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3802 |
last := end |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3803 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3804 |
visibleFirst := self listLineToVisibleLine:first. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3805 |
visibleLast := self listLineToVisibleLine:last. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3806 |
self redrawFromVisibleLine:visibleFirst to:visibleLast |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3807 |
] |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3808 |
] |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3809 |
] |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3810 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3811 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3812 |
redrawFromVisibleLine:startVisLineNr to:endVisLineNr |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3813 |
"redraw a visible line range" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3814 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3815 |
shown ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3816 |
self drawFromVisibleLine:startVisLineNr to:endVisLineNr with:fgColor and:bgColor |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3817 |
] |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3818 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3819 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3820 |
redrawInverted |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3821 |
"show contents in reverse colors" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3822 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3823 |
|savFg savBg| |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3824 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3825 |
savFg := fgColor. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3826 |
savBg := bgColor. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3827 |
fgColor := savBg. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3828 |
bgColor := savFg. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3829 |
self redraw. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3830 |
fgColor := savFg. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3831 |
bgColor := savBg. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3832 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3833 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3834 |
redrawLine:lineNr |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3835 |
"redraw a list line" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3836 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3837 |
|visibleLine| |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3838 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3839 |
visibleLine := self listLineToVisibleLine:lineNr. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3840 |
visibleLine notNil ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3841 |
self redrawVisibleLine:visibleLine |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3842 |
] |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3843 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3844 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3845 |
redrawLine:lineNr col:col |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3846 |
"redraw a single character" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3847 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3848 |
|visibleLine| |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3849 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3850 |
visibleLine := self listLineToVisibleLine:lineNr. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3851 |
visibleLine notNil ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3852 |
self redrawVisibleLine:visibleLine col:col |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3853 |
] |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3854 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3855 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3856 |
redrawLine:lineNr from:startCol |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3857 |
"redraw a list line from startCol to end of line" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3858 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3859 |
|visibleLine| |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3860 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3861 |
visibleLine := self listLineToVisibleLine:lineNr. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3862 |
visibleLine notNil ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3863 |
self redrawVisibleLine:visibleLine from:startCol |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3864 |
] |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3865 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3866 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3867 |
redrawLine:lineNr from:startCol to:endCol |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3868 |
"redraw a list line from startCol to endCol" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3869 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3870 |
|visibleLine| |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3871 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3872 |
visibleLine := self listLineToVisibleLine:lineNr. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3873 |
visibleLine notNil ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3874 |
self redrawVisibleLine:visibleLine from:startCol to:endCol |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3875 |
] |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3876 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3877 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3878 |
redrawVisibleLine:visLineNr |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3879 |
"redraw a visible line" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3880 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3881 |
shown ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3882 |
self drawVisibleLine:visLineNr with:fgColor and:bgColor |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3883 |
] |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3884 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3885 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3886 |
redrawVisibleLine:visLineNr col:col |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3887 |
"redraw single character at col index of visible line" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3888 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3889 |
shown ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3890 |
self drawVisibleLine:visLineNr col:col with:fgColor and:bgColor |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3891 |
] |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3892 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3893 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3894 |
redrawVisibleLine:visLineNr from:startCol |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3895 |
"redraw right part of a visible line from startCol to end of line" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3896 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3897 |
shown ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3898 |
self drawVisibleLine:visLineNr from:startCol with:fgColor and:bgColor |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3899 |
] |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3900 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3901 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3902 |
redrawVisibleLine:visLineNr from:startCol to:endCol |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3903 |
"redraw part of a visible line" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3904 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3905 |
shown ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3906 |
startCol == endCol ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3907 |
self redrawVisibleLine:visLineNr col:startCol |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3908 |
] ifFalse:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3909 |
self drawVisibleLine:visLineNr from:startCol to:endCol with:fgColor and:bgColor |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3910 |
] |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3911 |
] |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3912 |
! ! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3913 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3914 |
!ListView methodsFor:'scrolling'! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3915 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3916 |
gotoLine:aLineNumber |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3917 |
"position to line aLineNumber; this may be redefined |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3918 |
in subclasses (for example to move the cursor also)" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3919 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3920 |
^ self scrollToLine:aLineNumber |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3921 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3922 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3923 |
halfPageDown |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3924 |
"scroll down half a page" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3925 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3926 |
self scrollDown:(nFullLinesShown // 2) |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3927 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3928 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3929 |
halfPageUp |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3930 |
"scroll up half a page" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3931 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3932 |
self scrollUp:(nFullLinesShown // 2) |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3933 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3934 |
|
1910
0d68937d088b
removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents:
1888
diff
changeset
|
3935 |
horizontalScrollStep |
0d68937d088b
removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents:
1888
diff
changeset
|
3936 |
"return the amount to scroll when stepping up/down. |
0d68937d088b
removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents:
1888
diff
changeset
|
3937 |
Here, the scrolling unit is characters." |
0d68937d088b
removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents:
1888
diff
changeset
|
3938 |
|
0d68937d088b
removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents:
1888
diff
changeset
|
3939 |
^ font width |
0d68937d088b
removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents:
1888
diff
changeset
|
3940 |
|
0d68937d088b
removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents:
1888
diff
changeset
|
3941 |
"Created: / 21.5.1999 / 15:55:06 / cg" |
0d68937d088b
removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents:
1888
diff
changeset
|
3942 |
! |
0d68937d088b
removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents:
1888
diff
changeset
|
3943 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3944 |
makeColVisible:aCol inLine:aLineNr |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3945 |
"if column aCol is not visible, scroll horizontal to make it visible" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3946 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3947 |
|xWant xVis visLnr| |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3948 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3949 |
(aCol isNil or:[shown not]) ifTrue:[^ self]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3950 |
|
2423
8b9c2946a5a7
absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
2412
diff
changeset
|
3951 |
visLnr := self listLineToVisibleLine:aLineNr. |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3952 |
visLnr isNil ifTrue:[^ self]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3953 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3954 |
xWant := self xOfCol:aCol inVisibleLine:visLnr. |
2429
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2427
diff
changeset
|
3955 |
xVis := xWant - viewOrigin x. |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3956 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3957 |
" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3958 |
dont scroll, if already visible |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3959 |
(but scroll, if not in inner 20%..80% of visible area) |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3960 |
" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3961 |
"/ ((xVis >= (width // 5)) and:[xVis <= (width * 4 // 5)]) ifTrue:[ |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3962 |
"/ ^ self |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3963 |
"/ ]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3964 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3965 |
" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3966 |
no, the above does not look good, if you click / select at the |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3967 |
far right - makes selecting so difficult ... |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3968 |
" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3969 |
(xVis >= 0 and:[xVis < (width - font width)]) ifTrue:[^ self]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3970 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3971 |
self scrollHorizontalTo:(xWant - (width // 2)). |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3972 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3973 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3974 |
makeLineVisible:aListLineNr |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3975 |
"if aListLineNr is not visible, scroll to make it visible. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3976 |
Numbering starts with 1 for the very first line of the text." |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3977 |
|
1637
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
3978 |
|bott newTopLine| |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3979 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3980 |
(aListLineNr isNil "or:[shown not]") ifTrue:[^ self]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3981 |
|
895
02d8e324dca5
Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents:
890
diff
changeset
|
3982 |
"/ Old code follows. It is no longer used, because: |
02d8e324dca5
Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents:
890
diff
changeset
|
3983 |
"/ 1. we must maintain our viewOrigin (not maintained in this code!!) |
02d8e324dca5
Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents:
890
diff
changeset
|
3984 |
"/ 2. we must inform our dependents about originChanges. |
02d8e324dca5
Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents:
890
diff
changeset
|
3985 |
"/ |
02d8e324dca5
Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents:
890
diff
changeset
|
3986 |
"/ shown ifFalse:[ |
02d8e324dca5
Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents:
890
diff
changeset
|
3987 |
"/ firstLineShown := (aListLineNr - 1) max:1. |
02d8e324dca5
Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents:
890
diff
changeset
|
3988 |
"/ firstLineShown > (list size - nFullLinesShown) ifTrue:[ |
02d8e324dca5
Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents:
890
diff
changeset
|
3989 |
"/ firstLineShown := list size - nFullLinesShown |
02d8e324dca5
Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents:
890
diff
changeset
|
3990 |
"/ ]. |
02d8e324dca5
Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents:
890
diff
changeset
|
3991 |
"/ list size <= nFullLinesShown ifTrue:[ |
02d8e324dca5
Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents:
890
diff
changeset
|
3992 |
"/ firstLineShown := 1 |
02d8e324dca5
Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents:
890
diff
changeset
|
3993 |
"/ ]. |
02d8e324dca5
Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents:
890
diff
changeset
|
3994 |
"/ ^ self |
02d8e324dca5
Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents:
890
diff
changeset
|
3995 |
"/ ]. |
691
906e4d67b9cf
fixed makeLineVisible; when not-yet realized
Claus Gittinger <cg@exept.de>
parents:
688
diff
changeset
|
3996 |
|
2216 | 3997 |
(self needScrollToMakeLineVisible:aListLineNr) ifFalse:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3998 |
^ self |
1637
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
3999 |
]. |
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
4000 |
|
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
4001 |
(aListLineNr < nFullLinesShown) ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4002 |
"/ at the very top of the list - show from top |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4003 |
newTopLine := 1 |
1637
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
4004 |
] ifFalse:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4005 |
(nFullLinesShown < 3) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4006 |
"/ a small view - show from that line |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4007 |
newTopLine := aListLineNr |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4008 |
] ifFalse:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4009 |
bott := self numberOfLines - (nFullLinesShown - 1). |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4010 |
(aListLineNr > bott) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4011 |
"/ at the end of the list - show the bottom of the list |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4012 |
newTopLine := bott |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4013 |
] ifFalse:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4014 |
"/ somewhere else - place selected line into the middle of |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4015 |
"/ the view |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4016 |
newTopLine := (aListLineNr - (nFullLinesShown // 2) + 1) |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4017 |
] |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4018 |
] |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4019 |
]. |
1637
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
4020 |
|
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
4021 |
self scrollToLine:newTopLine. |
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
4022 |
|
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
4023 |
"Modified: / 18.12.1996 / 17:48:22 / stefan" |
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
4024 |
"Modified: / 7.8.1998 / 15:14:12 / cg" |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4025 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4026 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4027 |
makeVisible:someString |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4028 |
"if nescessary, scroll to make the (first) |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4029 |
line containing someString visible." |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4030 |
|
1808 | 4031 |
|index list| |
1319 | 4032 |
|
4033 |
(list := self list) notNil ifTrue:[ |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4034 |
index := list indexOf:someString. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4035 |
index ~~ 0 ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4036 |
self makeLineVisible:index |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4037 |
] |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4038 |
] |
1319 | 4039 |
|
4040 |
"Modified: 9.9.1997 / 10:10:13 / cg" |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4041 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4042 |
|
1637
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
4043 |
needScrollToMakeLine:aListLineNr |
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
4044 |
"return true, if a scroll is needd to make a line visible. |
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
4045 |
Numbering starts with 1 for the very first line of the text." |
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
4046 |
|
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
4047 |
(aListLineNr >= firstLineShown) ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4048 |
(aListLineNr < (firstLineShown + nFullLinesShown)) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4049 |
^ false |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4050 |
] |
1637
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
4051 |
]. |
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
4052 |
^ true |
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
4053 |
|
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
4054 |
"Created: / 7.8.1998 / 15:13:51 / cg" |
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
4055 |
"Modified: / 7.8.1998 / 15:14:44 / cg" |
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
4056 |
! |
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
4057 |
|
2216 | 4058 |
needScrollToMakeLineVisible:aListLineNr |
4059 |
"return true, if a scroll is needd to make a line visible. |
|
4060 |
Numbering starts with 1 for the very first line of the text." |
|
4061 |
||
4062 |
(aListLineNr >= firstLineShown) ifTrue:[ |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4063 |
(aListLineNr < (firstLineShown + nFullLinesShown)) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4064 |
^ false |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4065 |
] |
2216 | 4066 |
]. |
4067 |
^ true |
|
4068 |
||
4069 |
"Created: / 7.8.1998 / 15:13:51 / cg" |
|
4070 |
"Modified: / 7.8.1998 / 15:14:44 / cg" |
|
4071 |
! |
|
4072 |
||
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4073 |
pageDown |
4203 | 4074 |
"change origin to display the next page" |
4075 |
||
4201 | 4076 |
"/ self scrollTo:(viewOrigin + (0 @ height)) |
4203 | 4077 |
self scrollToLine:(self firstLineShown + nFullLinesShown) |
4078 |
||
4079 |
"Modified: / 15-12-2010 / 10:12:37 / cg" |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4080 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4081 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4082 |
pageUp |
4203 | 4083 |
"change origin to display the previous page" |
4084 |
||
4201 | 4085 |
"/ self scrollTo:(viewOrigin - (0 @ height)) |
4203 | 4086 |
self scrollToLine:(self firstLineShown - nFullLinesShown) |
4087 |
||
4088 |
"Modified: / 15-12-2010 / 10:12:41 / cg" |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4089 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4090 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4091 |
scrollDown:nLines |
394
795f293f8520
fixed debris-leftover in scrollDown
Claus Gittinger <cg@exept.de>
parents:
392
diff
changeset
|
4092 |
"change origin to scroll down some lines (towards the bottom of the text)" |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4093 |
|
1911 | 4094 |
nLines ~~ 0 ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4095 |
self scrollTo:(viewOrigin + (0 @ (fontHeight * nLines))) |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4096 |
redraw:true |
1468 | 4097 |
] |
4098 |
||
1911 | 4099 |
"Modified: / 21.5.1999 / 15:59:52 / cg" |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4100 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4101 |
|
808
0fb219efdfa2
Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents:
798
diff
changeset
|
4102 |
scrollDownPixels:pix |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4103 |
"change origin to scroll down some pixels |
808
0fb219efdfa2
Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents:
798
diff
changeset
|
4104 |
(towards the bottom of the text) |
0fb219efdfa2
Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents:
798
diff
changeset
|
4105 |
THIS WILL VANISH!!" |
0fb219efdfa2
Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents:
798
diff
changeset
|
4106 |
|
1468 | 4107 |
pix > 0 ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4108 |
self scrollTo:(viewOrigin + (0 @ (pix abs))) redraw:true |
1468 | 4109 |
] |
4110 |
||
4111 |
||
808
0fb219efdfa2
Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents:
798
diff
changeset
|
4112 |
! |
0fb219efdfa2
Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents:
798
diff
changeset
|
4113 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4114 |
scrollHorizontalTo:aPixelOffset |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4115 |
"change origin to make aPixelOffset be the left col" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4116 |
|
1756 | 4117 |
|nPixel| |
4118 |
||
2429
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2427
diff
changeset
|
4119 |
nPixel := aPixelOffset - viewOrigin x. |
1756 | 4120 |
nPixel ~~ 0 ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4121 |
self scrollTo:(viewOrigin + (nPixel @ 0)) redraw:true |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4122 |
] |
1756 | 4123 |
|
4124 |
"Modified: / 3.3.1999 / 22:55:20 / cg" |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4125 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4126 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4127 |
scrollLeft:nPixel |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4128 |
"change origin to scroll left some cols" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4129 |
|
1911 | 4130 |
nPixel ~~ 0 ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4131 |
self scrollTo:(viewOrigin - (nPixel @ 0)) redraw:true |
1468 | 4132 |
] |
4133 |
||
1911 | 4134 |
"Modified: / 21.5.1999 / 15:59:16 / cg" |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4135 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4136 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4137 |
scrollRight:nPixel |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4138 |
"change origin to scroll right some cols" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4139 |
|
1911 | 4140 |
nPixel ~~ 0 ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4141 |
self scrollTo:(self viewOrigin + (nPixel @ 0)) redraw:true |
1468 | 4142 |
] |
4143 |
||
1911 | 4144 |
"Modified: / 21.5.1999 / 15:59:21 / cg" |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4145 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4146 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4147 |
scrollSelectDown |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4148 |
"just a template - I do not know anything about selections" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4149 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4150 |
^ self subclassResponsibility |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4151 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4152 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4153 |
scrollSelectUp |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4154 |
"just a template - I do not know anything about selections" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4155 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4156 |
^ self subclassResponsibility |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4157 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4158 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4159 |
scrollToBottom |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4160 |
"change origin to show end of text" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4161 |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4162 |
"scrolling to the end is not really correct (i.e. should scroll to list size - nFullLinesShown), |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4163 |
but scrollDown: will adjust it ..." |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4164 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4165 |
self scrollToLine:(self size) |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4166 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4167 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4168 |
scrollToCol:aColNr |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4169 |
"change origin to make aColNr be the left col" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4170 |
|
2429
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2427
diff
changeset
|
4171 |
|pxlOffset leftOffset| |
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2427
diff
changeset
|
4172 |
|
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2427
diff
changeset
|
4173 |
leftOffset := viewOrigin x. |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4174 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4175 |
aColNr == 1 ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4176 |
leftOffset ~~ 0 ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4177 |
self scrollLeft:leftOffset. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4178 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4179 |
^ self |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4180 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4181 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4182 |
pxlOffset := font width * (aColNr - 1). |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4183 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4184 |
pxlOffset < leftOffset ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4185 |
self scrollLeft:(leftOffset - pxlOffset) |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4186 |
] ifFalse:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4187 |
pxlOffset > leftOffset ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4188 |
self scrollRight:(pxlOffset - leftOffset) |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4189 |
] |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4190 |
] |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4191 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4192 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4193 |
scrollToLeft |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4194 |
"change origin to start (left) of text" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4195 |
|
2429
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2427
diff
changeset
|
4196 |
viewOrigin x ~~ 0 ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4197 |
self scrollToCol:1 |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4198 |
] |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4199 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4200 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4201 |
scrollToLine:aLineNr |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4202 |
"change origin to make aLineNr be the top line" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4203 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4204 |
aLineNr < firstLineShown ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4205 |
self scrollUp:(firstLineShown - aLineNr) |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4206 |
] ifFalse:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4207 |
aLineNr > firstLineShown ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4208 |
self scrollDown:(aLineNr - firstLineShown) |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4209 |
] |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4210 |
] |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4211 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4212 |
|
833 | 4213 |
scrollToPercent:percentOrigin |
4214 |
"scroll to a position given in percent of total" |
|
4215 |
||
4216 |
"kludge - ListView thinks in lines" |
|
4217 |
||
4218 |
self scrollHorizontalToPercent:percentOrigin x. |
|
4219 |
self scrollVerticalToPercent:percentOrigin y. |
|
4220 |
! |
|
4221 |
||
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4222 |
scrollToTop |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4223 |
"change origin to start of text" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4224 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4225 |
self scrollToLine:1 |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4226 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4227 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4228 |
scrollUp:nLines |
394
795f293f8520
fixed debris-leftover in scrollDown
Claus Gittinger <cg@exept.de>
parents:
392
diff
changeset
|
4229 |
"change origin to scroll up some lines (towards the top of the text)" |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4230 |
|
1911 | 4231 |
nLines ~~ 0 ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4232 |
self scrollTo:(viewOrigin - (0 @ (fontHeight * nLines))) |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4233 |
redraw:true |
1468 | 4234 |
] |
4235 |
||
1911 | 4236 |
"Modified: / 21.5.1999 / 15:59:45 / cg" |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4237 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4238 |
|
808
0fb219efdfa2
Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents:
798
diff
changeset
|
4239 |
scrollUpPixels:pix |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4240 |
"change origin to scroll up some pixels |
808
0fb219efdfa2
Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents:
798
diff
changeset
|
4241 |
(towards the top of the text) |
0fb219efdfa2
Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents:
798
diff
changeset
|
4242 |
THIS WILL VANISH!!" |
0fb219efdfa2
Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents:
798
diff
changeset
|
4243 |
|
1468 | 4244 |
pix > 0 ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4245 |
self scrollTo:(viewOrigin - (0 @ pix)) redraw:true |
1468 | 4246 |
] |
4247 |
||
4248 |
||
808
0fb219efdfa2
Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents:
798
diff
changeset
|
4249 |
! |
0fb219efdfa2
Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents:
798
diff
changeset
|
4250 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4251 |
scrollVerticalToPercent:percent |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4252 |
"scroll to a position given in percent of total" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4253 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4254 |
|nL lineNr| |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4255 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4256 |
nL := self numberOfLines. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4257 |
"/ |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4258 |
"/ kludge for last partial line |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4259 |
"/ |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4260 |
nFullLinesShown ~~ nLinesShown ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4261 |
nL := nL + 1 |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4262 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4263 |
lineNr := (((nL * percent) asFloat / 100.0) + 0.5) asInteger + 1. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4264 |
self scrollToLine:lineNr |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4265 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4266 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4267 |
startAutoScrollDown:yDistance |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4268 |
"setup for auto-scroll down (when button-press-moving below view) |
5096 | 4269 |
- timeDelta for scroll is computed from distance. |
4270 |
Return true, to tell caller that scrolling is allowed (redefined in editField)" |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4271 |
|
2765
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4272 |
self |
5096 | 4273 |
startAutoScrollVertical:yDistance |
4274 |
scrollSelector:#scrollSelectDown. |
|
4275 |
^ true |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4276 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4277 |
|
2765
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4278 |
startAutoScrollHorizontal:xDistance scrollSelector:scrollSelector |
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4279 |
"setup for auto-scroll left/right (when button-press-moving to the right of the view) |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4280 |
- timeDelta for scroll is computed from distance" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4281 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4282 |
|deltaT mm| |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4283 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4284 |
autoScroll ifFalse:[^ self]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4285 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4286 |
mm := xDistance // self horizontalIntegerPixelPerMillimeter + 1. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4287 |
deltaT := 0.5 / mm. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4288 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4289 |
(deltaT = autoScrollDeltaT) ifFalse:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4290 |
autoScrollDeltaT := deltaT. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4291 |
autoScrollBlock isNil ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4292 |
autoScrollBlock := [self realized ifTrue:[self perform:scrollSelector]]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4293 |
Processor addTimedBlock:autoScrollBlock afterSeconds:deltaT |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4294 |
] |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4295 |
] |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4296 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4297 |
|
2765
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4298 |
startAutoScrollLeft:xDistance |
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4299 |
"setup for auto-scroll up (when button-press-moving to the left of the view) |
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4300 |
- timeDelta for scroll is computed from distance" |
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4301 |
|
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4302 |
self |
5096 | 4303 |
startAutoScrollHorizontal:xDistance negated |
4304 |
scrollSelector:#scrollSelectLeft. |
|
4305 |
^ true |
|
2765
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4306 |
! |
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4307 |
|
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4308 |
startAutoScrollRight:xDistance |
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4309 |
"setup for auto-scroll down (when button-press-moving to the right of the view) |
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4310 |
- timeDelta for scroll is computed from distance" |
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4311 |
|
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4312 |
self |
5096 | 4313 |
startAutoScrollHorizontal:xDistance |
4314 |
scrollSelector:#scrollSelectRight. |
|
4315 |
^ true |
|
2765
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4316 |
! |
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4317 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4318 |
startAutoScrollUp:yDistance |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4319 |
"setup for auto-scroll up (when button-press-moving below view) |
5096 | 4320 |
- timeDelta for scroll is computed from distance. |
4321 |
Return true, to tell caller that scrolling is allowed (redefined in editField)" |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4322 |
|
2765
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4323 |
self |
5096 | 4324 |
startAutoScrollVertical:yDistance negated |
4325 |
scrollSelector:#scrollSelectUp. |
|
4326 |
^ true |
|
2765
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4327 |
! |
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4328 |
|
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4329 |
startAutoScrollVertical:yDistance scrollSelector:scrollSelector |
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4330 |
"setup for auto-scroll up (when button-press-moving below view) |
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4331 |
- timeDelta for scroll is computed from distance" |
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4332 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4333 |
|deltaT mm| |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4334 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4335 |
autoScroll ifFalse:[^ self]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4336 |
|
4159
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4337 |
mm := (yDistance abs // self verticalIntegerPixelPerMillimeter) + 1. |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4338 |
deltaT := 0.5 / mm. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4339 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4340 |
(deltaT = autoScrollDeltaT) ifFalse:[ |
4159
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4341 |
autoScrollDeltaT := deltaT. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4342 |
autoScrollBlock isNil ifTrue:[ |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4343 |
autoScrollBlock := [self realized ifTrue:[self perform:scrollSelector]]. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4344 |
Processor addTimedBlock:autoScrollBlock afterSeconds:deltaT |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4345 |
] |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4346 |
] |
4159
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4347 |
|
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4348 |
"Modified: / 08-08-2010 / 11:26:26 / cg" |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4349 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4350 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4351 |
stopAutoScroll |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4352 |
"stop any auto-scroll" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4353 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4354 |
autoScrollBlock notNil ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4355 |
self compressMotionEvents:true. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4356 |
Processor removeTimedBlock:autoScrollBlock. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4357 |
autoScrollBlock := nil. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4358 |
autoScrollDeltaT := nil |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4359 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4360 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4361 |
|
1910
0d68937d088b
removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents:
1888
diff
changeset
|
4362 |
verticalScrollStep |
0d68937d088b
removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents:
1888
diff
changeset
|
4363 |
"return the amount to scroll when stepping up/down. |
0d68937d088b
removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents:
1888
diff
changeset
|
4364 |
Here, the scrolling unit is lines." |
0d68937d088b
removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents:
1888
diff
changeset
|
4365 |
|
0d68937d088b
removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents:
1888
diff
changeset
|
4366 |
^ 1 |
0d68937d088b
removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents:
1888
diff
changeset
|
4367 |
|
0d68937d088b
removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents:
1888
diff
changeset
|
4368 |
"Created: / 21.5.1999 / 14:00:12 / cg" |
0d68937d088b
removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents:
1888
diff
changeset
|
4369 |
! |
0d68937d088b
removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents:
1888
diff
changeset
|
4370 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4371 |
viewOrigin |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4372 |
"return the viewOrigin; thats the coordinate of the contents |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4373 |
which is shown topLeft in the view |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4374 |
(i.e. the origin of the visible part of the contents)." |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4375 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4376 |
^ viewOrigin |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4377 |
! ! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4378 |
|
2316 | 4379 |
!ListView methodsFor:'scrolling-basic'! |
1468 | 4380 |
|
2331
218a017dc1f3
additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents:
2325
diff
changeset
|
4381 |
additionalMarginForHorizontalScroll |
218a017dc1f3
additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents:
2325
diff
changeset
|
4382 |
"return the number of pixels by which we may scroll more than the actual |
218a017dc1f3
additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents:
2325
diff
changeset
|
4383 |
width of the document would allow. |
218a017dc1f3
additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents:
2325
diff
changeset
|
4384 |
This is redefined by editable textViews, to allo for the cursor |
218a017dc1f3
additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents:
2325
diff
changeset
|
4385 |
to be visible if it is positioned right behind the longest line of text. |
218a017dc1f3
additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents:
2325
diff
changeset
|
4386 |
The default returned here is the width of a blank (to beautify italic text)" |
218a017dc1f3
additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents:
2325
diff
changeset
|
4387 |
|
218a017dc1f3
additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents:
2325
diff
changeset
|
4388 |
^ font width |
218a017dc1f3
additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents:
2325
diff
changeset
|
4389 |
! |
218a017dc1f3
additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents:
2325
diff
changeset
|
4390 |
|
1468 | 4391 |
scrollTo:anOrigin redraw:doRedraw |
4392 |
"change origin to have newOrigin be visible at the top-left. |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4393 |
The argument defines the integer device coordinates of the new top-left |
1468 | 4394 |
point. |
4395 |
" |
|
4396 |
|dltOrg |
|
4397 |
noLn "{ Class:SmallInteger }" |
|
4398 |
max "{ Class:SmallInteger }" |
|
4399 |
tmp "{ Class:SmallInteger }" |
|
4400 |
h "{ Class:SmallInteger }" |
|
4401 |
w "{ Class:SmallInteger }" |
|
4402 |
y0 "{ Class:SmallInteger }" |
|
4403 |
y1 "{ Class:SmallInteger }" |
|
4404 |
y "{ Class:SmallInteger }" |
|
1581
71fee652b652
oops - must be careful to not repair damage with
Claus Gittinger <cg@exept.de>
parents:
1579
diff
changeset
|
4405 |
x "{ Class:SmallInteger }" |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4406 |
delta newFirstLine newViewOrigin |
1984 | 4407 |
hBefore wBefore inv wg| |
4408 |
||
4409 |
hBefore := height. |
|
4410 |
wBefore := width. |
|
1468 | 4411 |
|
4412 |
dltOrg := anOrigin - viewOrigin. |
|
4413 |
||
4414 |
"/ compute valid horizontal offset x |
|
4415 |
||
4416 |
(x := dltOrg x) ~~ 0 ifTrue:[ |
|
4159
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4417 |
tmp := viewOrigin x + x. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4418 |
|
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4419 |
x < 0 ifTrue:[ "/ scrolling left |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4420 |
tmp < 0 ifTrue:[x := 0 - viewOrigin x] |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4421 |
] ifFalse:[ "/ scrolling right |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4422 |
"/ allows scrolling to the right of widest line |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4423 |
max := self widthOfContents + (self additionalMarginForHorizontalScroll). |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4424 |
|
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4425 |
tmp + width > max ifTrue:[ |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4426 |
x := (max - viewOrigin x - width) max:0 |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4427 |
] |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4428 |
] |
1468 | 4429 |
]. |
4430 |
||
4431 |
"/ compute valid vertical offset measured in lines |
|
4432 |
||
4433 |
(y := dltOrg y // fontHeight) ~~ 0 ifTrue:[ |
|
4159
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4434 |
tmp := firstLineShown + y. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4435 |
|
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4436 |
y < 0 ifTrue:[ "/ scrolling up |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4437 |
tmp < 1 ifTrue:[y := 1 - firstLineShown] |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4438 |
] ifFalse:[ "/ scrolling down |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4439 |
max := self size. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4440 |
|
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4441 |
tmp + nFullLinesShown > max ifTrue:[ |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4442 |
y := (max - firstLineShown - nFullLinesShown + 1) max:0 |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4443 |
] |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4444 |
] |
1468 | 4445 |
]. |
4446 |
||
1578 | 4447 |
(x == 0 and:[y == 0]) ifTrue:[ "/ has viewOrigin changed ? |
4159
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4448 |
^ self |
1468 | 4449 |
]. |
4450 |
||
4451 |
(noLn := y) ~~ 0 ifTrue:[ |
|
4159
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4452 |
y := y * fontHeight |
1468 | 4453 |
]. |
1581
71fee652b652
oops - must be careful to not repair damage with
Claus Gittinger <cg@exept.de>
parents:
1579
diff
changeset
|
4454 |
delta := (x @ y). |
1468 | 4455 |
|
1582 | 4456 |
newFirstLine := firstLineShown + noLn. |
4457 |
newViewOrigin := viewOrigin + delta. |
|
4458 |
||
1468 | 4459 |
(shown and:[doRedraw]) ifFalse:[ |
4159
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4460 |
self originWillChange. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4461 |
firstLineShown := newFirstLine. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4462 |
viewOrigin := newViewOrigin. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4463 |
self assert:(viewOrigin x >= 0). |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4464 |
^ self originChanged:delta |
1468 | 4465 |
]. |
4466 |
||
1578 | 4467 |
"/ (self sensor notNil and: [self sensor hasExposeEventFor:self]) ifTrue:[ "/ outstanding expose events |
4468 |
"/ self invalidate. "/ redraw all |
|
4469 |
"/ self originWillChange. |
|
4470 |
"/ ^ self originChanged:(x @ y ) |
|
4471 |
"/ ]. |
|
1468 | 4472 |
|
1984 | 4473 |
( (y ~~ 0 and:[x ~~ 0]) "/ both x and y changed |
4474 |
or:[(noLn abs) >= nLinesShown "/ at least one area is |
|
4475 |
or:[(x abs) > (width // 4 * 3)]] "/ big enough to redraw all |
|
1468 | 4476 |
) ifTrue:[ |
4159
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4477 |
self originWillChange. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4478 |
firstLineShown := newFirstLine. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4479 |
viewOrigin := newViewOrigin. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4480 |
self invalidate. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4481 |
^ self originChanged:delta |
1468 | 4482 |
]. |
4483 |
||
1726 | 4484 |
"/ OLD: |
4485 |
"/ self repairDamage. |
|
1969
69d9c43db5e9
scrolling - again (added a device sync)
Claus Gittinger <cg@exept.de>
parents:
1964
diff
changeset
|
4486 |
|
1730 | 4487 |
(wg := self windowGroup) notNil ifTrue:[ |
4159
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4488 |
wg processRealExposeEventsFor:self. |
1730 | 4489 |
]. |
1578 | 4490 |
|
4491 |
self originWillChange. |
|
1970 | 4492 |
|
4493 |
"/ make certain, that all drawing is complete |
|
1984 | 4494 |
"/ device sync. |
4495 |
||
1975
0eda51a6d48e
uff - scroll bug (must catch BEFORE changing viewOrigin)
Claus Gittinger <cg@exept.de>
parents:
1972
diff
changeset
|
4496 |
self catchExpose. |
1970 | 4497 |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4498 |
x == 0 ifTrue:[ |
4159
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4499 |
"/ scrolling vertical |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4500 |
|
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4501 |
y0 := textStartTop + (y abs). |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4502 |
h := hBefore - margin - y0. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4503 |
w := wBefore - margin. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4504 |
y > 0 ifTrue:[ "/ copy down |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4505 |
"/ kludge: if the selection highlighting draws into the textStartTop area, |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4506 |
"/ the copy below leaves some selection depris in the top area. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4507 |
"/ Therefore, clear the top area. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4508 |
"/ (should avoid this, in case we know there cannot be anything |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4509 |
"/ there - selection is nil or >= firstLineShown). |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4510 |
self clearDeviceRectangleX:margin y:margin width:width-margin-margin height:(textStartTop-margin). |
1983 | 4511 |
"/ self invalidateDeviceRectangle:((margin@margin) corner:(width-margin@textStartTop)) repairNow:false. |
1977 | 4512 |
|
4159
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4513 |
self copyFrom:self |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4514 |
x:0 y:y0 toX:0 y:textStartTop |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4515 |
width:w height:h async:true. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4516 |
y1 := h - 1. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4517 |
y0 := y0 + 1. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4518 |
] ifFalse:[ "/ copy up |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4519 |
self copyFrom:self |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4520 |
x:margin y:textStartTop toX:margin y:y0 |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4521 |
width:w height:h async:true. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4522 |
y1 := 0. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4523 |
]. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4524 |
|
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4525 |
inv := (margin@y1) extent:(w@y0). |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4526 |
] ifFalse:[ |
4159
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4527 |
"/ scrolling horizontal |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4528 |
|
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4529 |
x > 0 ifTrue:[ "/ scrolling right |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4530 |
y0 := margin + x. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4531 |
y1 := wBefore - y0. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4532 |
] ifFalse:[ "/ scrolling left |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4533 |
y0 := margin - x. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4534 |
y1 := 0. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4535 |
]. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4536 |
h := hBefore - margin - margin. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4537 |
w := wBefore - margin - y0. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4538 |
|
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4539 |
x > 0 ifTrue:[ "/ copy right |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4540 |
self copyFrom:self x:y0 y:margin toX:margin y:margin |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4541 |
width:w height:h async:true. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4542 |
] ifFalse:[ "/ copy left |
4603 | 4543 |
"/ self copyFrom:self x:textStartLeft y:margin toX:y0 y:margin |
4544 |
"/ viewOrigin x > margin ifTrue:[ |
|
4545 |
"/ self copyFrom:self x:0 y:margin toX:y0-margin y:margin |
|
4546 |
"/ width:w height:h async:true. |
|
4547 |
"/ ] ifFalse:[ |
|
4548 |
self copyFrom:self x:margin y:margin toX:y0 y:margin |
|
4549 |
width:w height:h async:true. |
|
4550 |
"/ ]. |
|
4159
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4551 |
]. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4552 |
|
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4553 |
inv := (y1@margin) extent:(y0@h). |
1468 | 4554 |
]. |
4555 |
||
1984 | 4556 |
firstLineShown := newFirstLine. |
4557 |
viewOrigin := newViewOrigin. |
|
1969
69d9c43db5e9
scrolling - again (added a device sync)
Claus Gittinger <cg@exept.de>
parents:
1964
diff
changeset
|
4558 |
|
1885 | 4559 |
self invalidateDeviceRectangle:inv repairNow:false. |
4603 | 4560 |
viewOrigin x <= margin ifTrue:[ |
4561 |
self invalidateDeviceRectangle:((0@margin) extent:(margin@h)) repairNow:false. |
|
4562 |
]. |
|
1712
cb753ba02fb4
remember old width/height before doing a repairDamage
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
4563 |
|
1975
0eda51a6d48e
uff - scroll bug (must catch BEFORE changing viewOrigin)
Claus Gittinger <cg@exept.de>
parents:
1972
diff
changeset
|
4564 |
self originChanged:delta. |
1969
69d9c43db5e9
scrolling - again (added a device sync)
Claus Gittinger <cg@exept.de>
parents:
1964
diff
changeset
|
4565 |
self waitForExpose. |
1726 | 4566 |
|
2202
edf8821d56a1
synchronous redraw after a scroll
Claus Gittinger <cg@exept.de>
parents:
2199
diff
changeset
|
4567 |
(wg := self windowGroup) notNil ifTrue:[ |
4159
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4568 |
wg processRealExposeEventsFor:self. |
2202
edf8821d56a1
synchronous redraw after a scroll
Claus Gittinger <cg@exept.de>
parents:
2199
diff
changeset
|
4569 |
]. |
edf8821d56a1
synchronous redraw after a scroll
Claus Gittinger <cg@exept.de>
parents:
2199
diff
changeset
|
4570 |
|
1984 | 4571 |
"/ (hBefore ~= height or:[wBefore ~= width]) ifTrue:[ |
4572 |
"/ self halt. |
|
4573 |
"/ ]. |
|
4574 |
||
4159
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4575 |
"Modified: / 08-08-2010 / 11:14:09 / cg" |
1468 | 4576 |
! ! |
4577 |
||
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4578 |
!ListView methodsFor:'searching'! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4579 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4580 |
findBeginOfWordAtLine:selectLine col:selectCol |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4581 |
"return the col of first character of the word at given line/col. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4582 |
If the character under the initial col is a space character, return |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4583 |
the first col of the blank-block." |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4584 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4585 |
|beginCol thisCharacter| |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4586 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4587 |
beginCol := selectCol. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4588 |
thisCharacter := self characterAtLine:selectLine col:beginCol. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4589 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4590 |
"is this acharacter within a word ?" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4591 |
(wordCheck value:thisCharacter) ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4592 |
[wordCheck value:thisCharacter] whileTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4593 |
beginCol := beginCol - 1. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4594 |
beginCol < 1 ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4595 |
^ 1 |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4596 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4597 |
thisCharacter := self characterAtLine:selectLine col:beginCol |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4598 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4599 |
beginCol := beginCol + 1. |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4600 |
] ifFalse:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4601 |
"nope - maybe its a space" |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4602 |
thisCharacter == Character space ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4603 |
[beginCol > 1 and:[thisCharacter == Character space]] whileTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4604 |
beginCol := beginCol - 1. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4605 |
thisCharacter := self characterAtLine:selectLine col:beginCol |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4606 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4607 |
thisCharacter ~~ Character space ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4608 |
beginCol := beginCol + 1. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4609 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4610 |
] ifFalse:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4611 |
"select single character" |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4612 |
] |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4613 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4614 |
^ beginCol |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4615 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4616 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4617 |
findEndOfWordAtLine:selectLine col:selectCol |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4618 |
"return the col of last character of the word at given line/col. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4619 |
If the character under the initial col is a space character, return |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4620 |
the last col of the blank-block. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4621 |
Return 0 if we should wrap to next line (for spaces)" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4622 |
|
770
a41466e3dfaa
use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents:
721
diff
changeset
|
4623 |
|endCol "{ Class: SmallInteger }" |
a41466e3dfaa
use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents:
721
diff
changeset
|
4624 |
len "{ Class: SmallInteger }" |
a41466e3dfaa
use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents:
721
diff
changeset
|
4625 |
thisCharacter| |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4626 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4627 |
endCol := selectCol. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4628 |
endCol == 0 ifTrue:[endCol := 1]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4629 |
thisCharacter := self characterAtLine:selectLine col:endCol. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4630 |
|
2900 | 4631 |
len := (self listAt:selectLine) size. |
4632 |
||
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4633 |
"is this acharacter within a word ?" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4634 |
(wordCheck value:thisCharacter) ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4635 |
[wordCheck value:thisCharacter] whileTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4636 |
endCol := endCol + 1. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4637 |
endCol > len ifTrue:[ ^ len ]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4638 |
thisCharacter := self characterAtLine:selectLine col:endCol |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4639 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4640 |
endCol := endCol - 1. |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4641 |
] ifFalse:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4642 |
"nope - maybe its a space" |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4643 |
thisCharacter == Character space ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4644 |
endCol > len ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4645 |
"select rest to end" |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4646 |
endCol := 0 |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4647 |
] ifFalse:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4648 |
thisCharacter := self characterAtLine:selectLine col:endCol. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4649 |
[endCol <= len and:[thisCharacter == Character space]] whileTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4650 |
endCol := endCol + 1. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4651 |
thisCharacter := self characterAtLine:selectLine col:endCol |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4652 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4653 |
endCol := endCol - 1. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4654 |
] |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4655 |
] ifFalse:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4656 |
"select single character" |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4657 |
] |
125 | 4658 |
]. |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4659 |
^ endCol. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4660 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4661 |
|
1325 | 4662 |
searchBackwardFor:pattern ignoreCase:ignCase startingAtLine:startLine col:startCol ifFound:block1 ifAbsent:block2 |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4663 |
"search for a pattern, if found evaluate block1 with row/col as arguments, if not |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4664 |
found evaluate block2. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4665 |
Sorry, but pattern is no regular expression pattern (yet)" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4666 |
|
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4667 |
^ self |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4668 |
searchBackwardUsingSpec:(SearchSpec new |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4669 |
pattern:pattern |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4670 |
ignoreCase:ignCase |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4671 |
match:false) |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4672 |
startingAtLine:startLine col:startCol |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4673 |
ifFound:block1 ifAbsent:block2 |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4674 |
! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4675 |
|
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4676 |
searchBackwardFor:pattern startingAtLine:startLine col:startCol ifFound:block1 ifAbsent:block2 |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4677 |
"search for a pattern, if found evaluate block1 with row/col as arguments, if not |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4678 |
found evaluate block2. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4679 |
Sorry, but pattern is no regular expression pattern (yet)" |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4680 |
|
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4681 |
^ self |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4682 |
searchBackwardFor:pattern |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4683 |
ignoreCase:false |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4684 |
startingAtLine:startLine col:startCol |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4685 |
ifFound:block1 |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4686 |
ifAbsent:block2 |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4687 |
|
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4688 |
"Modified: 13.9.1997 / 01:07:36 / cg" |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4689 |
! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4690 |
|
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4691 |
searchBackwardUsingSpec:searchSpec startingAtLine:startLine col:startCol ifFound:block1 ifAbsent:block2 |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4692 |
"search for a pattern, if found evaluate block1 with row/col as arguments, if not |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4693 |
found evaluate block2. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4694 |
Sorry, but pattern is no regular expression pattern (yet)" |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4695 |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4696 |
|lineString |
5076 | 4697 |
pattern ignCase match fullWord atBeginOfLineOnly |
4444 | 4698 |
found firstChar1 firstChar2 c pc col1 |
770
a41466e3dfaa
use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents:
721
diff
changeset
|
4699 |
col "{ Class: SmallInteger }" |
a41466e3dfaa
use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents:
721
diff
changeset
|
4700 |
cc "{ Class: SmallInteger }" |
a41466e3dfaa
use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents:
721
diff
changeset
|
4701 |
patternSize "{ Class: SmallInteger }" |
a41466e3dfaa
use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents:
721
diff
changeset
|
4702 |
line1 "{ Class: SmallInteger }" |
a41466e3dfaa
use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents:
721
diff
changeset
|
4703 |
lineSize "{ Class: SmallInteger }" | |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4704 |
|
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4705 |
pattern := searchSpec pattern. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4706 |
ignCase := searchSpec ignoreCase. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4707 |
match := searchSpec match. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4708 |
match ifTrue:[ Transcript showCR:'backward matchsearch is (still) not implemented' ]. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4709 |
fullWord := searchSpec fullWord. |
5076 | 4710 |
atBeginOfLineOnly := searchSpec atBeginOfLineOnly. |
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4711 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4712 |
patternSize := pattern size. |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4713 |
(list notNil |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4714 |
and:[startLine > 0 |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4715 |
and:[patternSize ~~ 0]]) |
2508
5bf86df079c9
backward search without inital line
Claus Gittinger <cg@exept.de>
parents:
2455
diff
changeset
|
4716 |
ifTrue:[ |
4444 | 4717 |
self withCursor:Cursor questionMark do:[ |
4718 |
col := startCol - 1. |
|
4719 |
firstChar1 := pattern at:1. |
|
4720 |
ignCase ifTrue:[ |
|
4721 |
firstChar1 := firstChar1 asLowercase. |
|
4722 |
firstChar2 := firstChar1 asUppercase. |
|
4723 |
] ifFalse:[ |
|
4724 |
firstChar2 := firstChar1 |
|
4725 |
]. |
|
4726 |
||
4727 |
line1 := startLine. |
|
4728 |
line1 > list size ifTrue:[ |
|
4729 |
line1 := list size. |
|
4730 |
col := -999 |
|
4731 |
] ifFalse:[ |
|
4732 |
col > (list at:line1) size ifTrue:[ |
|
4733 |
col := -999 |
|
4734 |
] |
|
4735 |
]. |
|
4736 |
line1 to:1 by:-1 do:[:lnr | |
|
4737 |
lineString := list at:lnr. |
|
4738 |
lineString notNil ifTrue:[ |
|
4739 |
lineString := lineString asString. |
|
4740 |
lineString isString ifTrue:[ |
|
4741 |
"/ quick check if pattern is present |
|
4742 |
col1 := lineString |
|
4743 |
findString:pattern |
|
4744 |
startingAt:1 |
|
4745 |
ifAbsent:0 |
|
4746 |
caseSensitive: ignCase not. |
|
4747 |
col1 ~~ 0 ifTrue:[ |
|
4748 |
lineSize := lineString size. |
|
4749 |
col == -999 ifTrue:[col := lineSize - patternSize + 1]. |
|
4750 |
[(col > 0) |
|
4751 |
and:[(c := lineString at:col) ~= firstChar1 |
|
4752 |
and:[c ~= firstChar2]]] whileTrue:[ |
|
4753 |
col := col - 1 |
|
4754 |
]. |
|
4755 |
[col > 0] whileTrue:[ |
|
4756 |
cc := col. |
|
4757 |
found := true. |
|
4758 |
1 to:patternSize do:[:cnr | |
|
4759 |
cc > lineSize ifTrue:[ |
|
4760 |
found := false |
|
4761 |
] ifFalse:[ |
|
4762 |
pc := pattern at:cnr. |
|
4763 |
c := lineString at:cc. |
|
4764 |
pc ~= c ifTrue:[ |
|
4765 |
(ignCase not or:[pc asLowercase ~= c asLowercase]) ifTrue:[ |
|
4766 |
found := false |
|
4767 |
] |
|
4768 |
] |
|
4769 |
]. |
|
4770 |
cc := cc + 1 |
|
4771 |
]. |
|
4772 |
found ifTrue:[ |
|
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4773 |
(fullWord not |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4774 |
or:[ (self findBeginOfWordAtLine:lnr col:col) == col |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4775 |
and:[ (self findEndOfWordAtLine:lnr col:col) == (col + patternSize - 1) ]] |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4776 |
) ifTrue:[ |
5076 | 4777 |
(atBeginOfLineOnly not or:[col == 1]) ifTrue:[ |
4778 |
^ block1 value:lnr value:col. |
|
4779 |
] |
|
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4780 |
] |
4444 | 4781 |
]. |
4782 |
col := col - 1. |
|
4783 |
[(col > 0) |
|
4784 |
and:[(c := lineString at:col) ~= firstChar1 |
|
4785 |
and:[c ~= firstChar2]]] whileTrue:[ |
|
4786 |
col := col - 1 |
|
4787 |
] |
|
4788 |
] |
|
4789 |
] |
|
4790 |
]. |
|
4791 |
]. |
|
4792 |
col := -999. |
|
4793 |
] |
|
4794 |
] |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4795 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4796 |
"not found" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4797 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4798 |
^ block2 value |
386
514f73e07c2d
more 16bit fixes (compare chars using = / ~= instead of == / ~=)
Claus Gittinger <cg@exept.de>
parents:
383
diff
changeset
|
4799 |
|
4444 | 4800 |
"Created: / 13-09-1997 / 01:06:19 / cg" |
4801 |
"Modified: / 05-08-2012 / 12:16:31 / cg" |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4802 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4803 |
|
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4804 |
searchForwardFor:pattern ignoreCase:ignCase match:match startingAtLine:startLine col:startCol ifFound:block1 ifAbsent:block2 |
1325 | 4805 |
"search for a pattern, if found evaluate block1 with row/col as arguments, if not |
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4806 |
found evaluate block2." |
1325 | 4807 |
|
4808 |
^ self |
|
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4809 |
searchForwardUsingSpec:(SearchSpec new |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4810 |
pattern:pattern |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4811 |
ignoreCase:ignCase |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4812 |
match:match) |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4813 |
startingAtLine:startLine col:startCol |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4814 |
ifFound:block1 ifAbsent:block2 |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4815 |
! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4816 |
|
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4817 |
searchForwardFor:pattern ignoreCase:ignCase startingAtLine:startLine col:startCol ifFound:block1 ifAbsent:block2 |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4818 |
"search for a pattern, if found evaluate block1 with row/col as arguments, if not |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4819 |
found evaluate block2." |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4820 |
|
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4821 |
^ self searchForwardFor:pattern ignoreCase:ignCase match: true startingAtLine:startLine col:startCol ifFound:block1 ifAbsent:block2 |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4822 |
! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4823 |
|
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4824 |
searchForwardFor:pattern startingAtLine:startLine col:startCol ifFound:block1 ifAbsent:block2 |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4825 |
"search for a pattern, if found evaluate block1 with row/col as arguments, if not |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4826 |
found evaluate block2." |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4827 |
|
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4828 |
^ self |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4829 |
searchForwardFor:pattern |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4830 |
ignoreCase:false |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4831 |
startingAtLine:startLine col:startCol |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4832 |
ifFound:block1 |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4833 |
ifAbsent:block2 |
1325 | 4834 |
|
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4835 |
"Modified: 13.9.1997 / 01:07:11 / cg" |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4836 |
! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4837 |
|
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4838 |
searchForwardUsingSpec:searchSpec startingAtLine:startLine col:startCol ifFound:block1 ifAbsent:block2 |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4839 |
"search for a pattern, if found evaluate block1 with row/col as arguments, if not |
1178
c221e0f8cbb6
handle escaped matchCharacters
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4840 |
found evaluate block2." |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4841 |
|
5076 | 4842 |
|lineString col pattern match ignCase fullWord atBeginOfLineOnly |
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4843 |
patternSize |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4844 |
line1 "{Class: SmallInteger}" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4845 |
line2 "{Class: SmallInteger}" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4846 |
p realPattern| |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4847 |
|
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4848 |
pattern := searchSpec pattern. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4849 |
match := searchSpec match. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4850 |
ignCase := searchSpec ignoreCase. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4851 |
fullWord := searchSpec fullWord. |
5076 | 4852 |
atBeginOfLineOnly := searchSpec atBeginOfLineOnly. |
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4853 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4854 |
patternSize := pattern size. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4855 |
(list notNil and:[patternSize ~~ 0]) ifTrue:[ |
4444 | 4856 |
self withCursor:Cursor questionMark do:[ |
4857 |
||
4858 |
col := startCol + 1. |
|
4859 |
line1 := startLine. |
|
4860 |
line2 := list size. |
|
4861 |
||
4862 |
(match and:[pattern includesUnescapedMatchCharacters]) ifTrue:[ |
|
4863 |
"perform a findMatchString (matching)" |
|
4864 |
p := pattern species new:0. |
|
4865 |
(pattern startsWith:$*) ifFalse:[ |
|
4866 |
p := p , '*' |
|
4867 |
]. |
|
4868 |
p := p , pattern. |
|
4869 |
(pattern endsWith:$*) ifFalse:[ |
|
4870 |
p := p , '*' |
|
4871 |
]. |
|
4872 |
realPattern := pattern. |
|
4873 |
(realPattern startsWith:$*) ifTrue:[ |
|
4874 |
realPattern := realPattern copyFrom:2 |
|
4875 |
]. |
|
4876 |
line1 to:line2 do:[:lnr | |
|
4877 |
lineString := list at:lnr. |
|
4878 |
lineString notNil ifTrue:[ |
|
4879 |
lineString := lineString asString string. |
|
4880 |
lineString isString ifTrue:[ |
|
4881 |
"/ first a crude check ... |
|
4712 | 4882 |
(p match:lineString caseSensitive:ignCase not) ifTrue:[ |
4444 | 4883 |
"/ ok, there it is; look at which position |
4884 |
col := lineString |
|
4885 |
findMatchString:realPattern |
|
4886 |
startingAt:col |
|
4712 | 4887 |
caseSensitive:ignCase not |
4444 | 4888 |
ifAbsent:0. |
4889 |
col ~~ 0 ifTrue:[ |
|
5076 | 4890 |
(atBeginOfLineOnly not or:[col == 1]) ifTrue:[ |
4891 |
^ block1 value:lnr value:col. |
|
4892 |
] |
|
4444 | 4893 |
] |
4894 |
] |
|
4895 |
]. |
|
4896 |
]. |
|
4897 |
col := 1 |
|
4898 |
] |
|
4899 |
] ifFalse:[ |
|
4900 |
"perform a findString (no matching)" |
|
4901 |
p := pattern "withoutMatchEscapes". |
|
4902 |
line1 to:line2 do:[:lnr | |
|
4903 |
lineString := list at:lnr. |
|
4904 |
lineString notNil ifTrue:[ |
|
4905 |
lineString := lineString asString string. |
|
4906 |
lineString isString ifTrue:[ |
|
4907 |
col := lineString |
|
4908 |
findString:p |
|
4909 |
startingAt:col |
|
4910 |
ifAbsent:0 |
|
4911 |
caseSensitive: ignCase not. |
|
4912 |
col ~~ 0 ifTrue:[ |
|
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4913 |
"/Transcript showCR:'---'. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4914 |
"/Transcript showCR:lineString. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4915 |
"/Transcript showCR:col. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4916 |
"/Transcript showCR:(self findBeginOfWordAtLine:lnr col:col). |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4917 |
"/Transcript showCR:(self findEndOfWordAtLine:lnr col:col). |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4918 |
"/Transcript showCR:(lineString copyFrom:(self findBeginOfWordAtLine:lnr col:col) to:(self findEndOfWordAtLine:lnr col:col)). |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4919 |
(fullWord not |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4920 |
or:[ (self findBeginOfWordAtLine:lnr col:col) == col |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4921 |
and:[ (self findEndOfWordAtLine:lnr col:col) == (col + patternSize - 1) ]] |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4922 |
) ifTrue:[ |
5076 | 4923 |
(atBeginOfLineOnly not or:[col == 1]) ifTrue:[ |
4924 |
^ block1 value:lnr value:col. |
|
4925 |
] |
|
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4926 |
] |
4444 | 4927 |
] |
4928 |
] |
|
4929 |
]. |
|
4930 |
col := 1 |
|
4931 |
] |
|
4932 |
]. |
|
4933 |
] |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4934 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4935 |
"not found" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4936 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4937 |
^ block2 value |
403
ee8f6d080077
preserve cursor (error while searching)
Claus Gittinger <cg@exept.de>
parents:
394
diff
changeset
|
4938 |
|
4444 | 4939 |
"Created: / 13-09-1997 / 01:06:31 / cg" |
4940 |
"Modified: / 05-08-2012 / 12:22:42 / cg" |
|
1325 | 4941 |
! |
4942 |
||
3564 | 4943 |
standardWordCheck:char |
4403 | 4944 |
"the wordCheck is a predicate which returns true if the given character |
4945 |
belongs to the (textual) word. Used with double click to select a word. |
|
4946 |
When editing code, typically characters which are part of an identifier |
|
4947 |
are part of a word (underline, dollar, but no other non-letters). |
|
4948 |
The standardWordCheck aks the current userPreferences for details." |
|
4949 |
||
4950 |
|prefs| |
|
4951 |
||
4952 |
(prefs := UserPreferences current) whitespaceWordSelectMode ifTrue:[ |
|
4953 |
"an extremely simple mode, where every non-space is treated as part of the word" |
|
4954 |
^ char isSeparator not |
|
3564 | 4955 |
]. |
4403 | 4956 |
prefs extendedWordSelectMode ifTrue:[ |
4957 |
"the typical mode, useful for text and code" |
|
4958 |
^ char isNationalAlphaNumeric or:[char == $_] |
|
3564 | 4959 |
]. |
4403 | 4960 |
"another typical mode, also useful for text and code" |
3564 | 4961 |
^ char isNationalAlphaNumeric |
4403 | 4962 |
|
4963 |
"Modified (comment): / 17-03-2012 / 19:04:13 / cg" |
|
0 | 4964 |
! ! |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4965 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4966 |
!ListView methodsFor:'tabulators'! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4967 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4968 |
expandTabs |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4969 |
"go through whole text expanding tabs into spaces. |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4970 |
This is meant to be called for text being imported from a file. |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4971 |
Therefore, 8-col tabs are assumed - independent of any private tab setting." |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4972 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4973 |
|line newLine nLines "{ Class: SmallInteger }"| |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4974 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4975 |
includesNonStrings := false. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4976 |
list notNil ifTrue:[ |
4765 | 4977 |
nLines := self size. |
4978 |
1 to:nLines do:[:index | |
|
4979 |
line := self at:index. |
|
4980 |
line notNil ifTrue:[ |
|
4768 | 4981 |
(line isString) ifTrue:[ |
4765 | 4982 |
newLine := line withTabsExpanded. |
4983 |
newLine ~~ line ifTrue:[ |
|
4984 |
list at:index put:newLine |
|
4985 |
]. |
|
4986 |
] ifFalse:[ |
|
4987 |
includesNonStrings := true. |
|
4988 |
] |
|
4989 |
] |
|
4990 |
] |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4991 |
] |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4992 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4993 |
"Modified: 30.8.1995 / 19:06:37 / claus" |
627 | 4994 |
"Modified: 12.5.1996 / 12:48:03 / cg" |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4995 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4996 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4997 |
nextTabAfter:colNr |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4998 |
"return the next tab position after col" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4999 |
|
3151
fc183d8ff88c
next-tab: fallback to mod-8 tabs if beyond tab-list
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
5000 |
^ self nextTabAfter:colNr in:tabPositions. |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5001 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5002 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5003 |
nextTabAfter:colNr in:tabPositions |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5004 |
"return the next tab position after col. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5005 |
The second arg, tabPositions is a collection of tabStops." |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5006 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5007 |
|col "{ Class: SmallInteger }" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5008 |
tabIndex "{ Class: SmallInteger }" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5009 |
thisTab "{ Class: SmallInteger }" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5010 |
nTabs "{ Class: SmallInteger }" | |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5011 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5012 |
tabIndex := 1. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5013 |
col := colNr. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5014 |
thisTab := tabPositions at:tabIndex. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5015 |
nTabs := tabPositions size. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5016 |
[thisTab <= col] whileTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5017 |
(tabIndex == nTabs) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5018 |
"/ fallback to mod-8 tabs if beyond tab-list. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5019 |
thisTab := col + 1. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5020 |
thisTab := thisTab + (8 - (thisTab \\ 8)). |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5021 |
^ thisTab |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5022 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5023 |
tabIndex := tabIndex + 1. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5024 |
thisTab := tabPositions at:tabIndex |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5025 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5026 |
^ thisTab |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5027 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5028 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5029 |
prevTabBefore:colNr |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5030 |
"return the prev tab position before col" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5031 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5032 |
|col "{ Class: SmallInteger }" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5033 |
tabIndex "{ Class: SmallInteger }" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5034 |
thisTab "{ Class: SmallInteger }" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5035 |
nTabs "{ Class: SmallInteger }" | |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5036 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5037 |
tabIndex := 1. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5038 |
col := colNr. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5039 |
thisTab := tabPositions at:tabIndex. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5040 |
nTabs := tabPositions size. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5041 |
[thisTab < col] whileTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5042 |
(tabIndex == nTabs) ifTrue:[^ thisTab]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5043 |
tabIndex := tabIndex + 1. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5044 |
thisTab := tabPositions at:tabIndex |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5045 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5046 |
(tabIndex == 1) ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5047 |
^ 1 |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5048 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5049 |
^ tabPositions at:(tabIndex - 1) |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5050 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5051 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5052 |
setTab4 |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5053 |
"set 4-character tab stops" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5054 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5055 |
tabPositions := self class tab4Positions. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5056 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5057 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5058 |
setTab8 |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5059 |
"set 8-character tab stops" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5060 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5061 |
tabPositions := self class tab8Positions. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5062 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5063 |
|
2378 | 5064 |
setTabPositions:aVector |
5065 |
"set tab stops" |
|
5066 |
||
5067 |
tabPositions := aVector. |
|
5068 |
! |
|
5069 |
||
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5070 |
withTabs:line |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5071 |
"Assuming an 8-character tab, |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5072 |
compress multiple leading spaces to tabs, return a new line string |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5073 |
or the original line, if no tabs where created. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5074 |
good idea, to make this one a primitive, since its called |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5075 |
many times when a big text is saved to a file." |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5076 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5077 |
|newLine eightSpaces nTabs| |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5078 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5079 |
" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5080 |
the code below is a hack, producing many garbage strings for lines |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5081 |
which compress multiple tabs ... needs rewrite: saving big files |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5082 |
stresses the garbage collector a bit ... |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5083 |
" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5084 |
line isNil ifTrue:[^ line]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5085 |
eightSpaces := ' '. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5086 |
(line startsWith:eightSpaces) ifFalse:[^ line]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5087 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5088 |
nTabs := 1. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5089 |
newLine := line copyFrom:9. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5090 |
[newLine startsWith:eightSpaces] whileTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5091 |
newLine := newLine copyFrom:9. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5092 |
nTabs := nTabs + 1. |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5093 |
]. |
386
514f73e07c2d
more 16bit fixes (compare chars using = / ~= instead of == / ~=)
Claus Gittinger <cg@exept.de>
parents:
383
diff
changeset
|
5094 |
^ (line species new:nTabs withAll:Character tab) asString , newLine. |
514f73e07c2d
more 16bit fixes (compare chars using = / ~= instead of == / ~=)
Claus Gittinger <cg@exept.de>
parents:
383
diff
changeset
|
5095 |
|
514f73e07c2d
more 16bit fixes (compare chars using = / ~= instead of == / ~=)
Claus Gittinger <cg@exept.de>
parents:
383
diff
changeset
|
5096 |
"Modified: 23.2.1996 / 19:10:36 / cg" |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5097 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5098 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5099 |
withTabs:tabulatorTable expand:line |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5100 |
"expand tabs into spaces, return a new line string, |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5101 |
or original line, if no tabs are included. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5102 |
good idea, to make this one a primitive, since it is called |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5103 |
many times if a big text is read from a file." |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5104 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5105 |
|tmpString nString nTabs |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5106 |
currentMax "{ Class: SmallInteger }" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5107 |
dstIndex "{ Class: SmallInteger }" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5108 |
nextTab "{ Class: SmallInteger }" | |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5109 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5110 |
" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5111 |
the code below tries to avoid creating too much garbage; |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5112 |
therefore, the string is scanned first for the number of |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5113 |
tabs to get a rough idea of the final strings size. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5114 |
(it could be done better, by computing the exact size |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5115 |
required here ...) |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5116 |
" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5117 |
line isNil ifTrue:[^ line]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5118 |
nTabs := line occurrencesOf:(Character tab). |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5119 |
nTabs == 0 ifTrue:[^ line]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5120 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5121 |
currentMax := line size + (nTabs * 7). |
386
514f73e07c2d
more 16bit fixes (compare chars using = / ~= instead of == / ~=)
Claus Gittinger <cg@exept.de>
parents:
383
diff
changeset
|
5122 |
tmpString := line species new:currentMax. |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5123 |
dstIndex := 1. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5124 |
line do:[:character | |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5125 |
(character == (Character tab)) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5126 |
nextTab := self nextTabAfter:dstIndex in:tabulatorTable. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5127 |
[dstIndex < nextTab] whileTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5128 |
tmpString at:dstIndex put:(Character space). |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5129 |
dstIndex := dstIndex + 1 |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5130 |
] |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5131 |
] ifFalse:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5132 |
tmpString at:dstIndex put:character. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5133 |
dstIndex := dstIndex + 1 |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5134 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5135 |
(dstIndex > currentMax) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5136 |
" |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5137 |
this cannot happen with <= 8 tabs |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5138 |
" |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5139 |
currentMax := currentMax + currentMax. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5140 |
nString := line species new:currentMax. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5141 |
nString replaceFrom:1 to:(dstIndex - 1) |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5142 |
with:tmpString startingAt:1. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5143 |
tmpString := nString. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5144 |
nString := nil |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5145 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5146 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5147 |
"make stc-optimizer happy |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5148 |
- no need to return value of ifTrue:/ifFalse above" |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5149 |
0 |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5150 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5151 |
dstIndex := dstIndex - 1. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5152 |
dstIndex == currentMax ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5153 |
^ tmpString |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5154 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5155 |
^ tmpString copyTo:dstIndex |
386
514f73e07c2d
more 16bit fixes (compare chars using = / ~= instead of == / ~=)
Claus Gittinger <cg@exept.de>
parents:
383
diff
changeset
|
5156 |
|
514f73e07c2d
more 16bit fixes (compare chars using = / ~= instead of == / ~=)
Claus Gittinger <cg@exept.de>
parents:
383
diff
changeset
|
5157 |
"Modified: 23.2.1996 / 19:11:01 / cg" |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5158 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5159 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5160 |
withTabsExpanded:line |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5161 |
"expand tabs into spaces, return a new line string, |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5162 |
or original line, if no tabs are included. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5163 |
good idea, to make this one a primitive" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5164 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5165 |
^ self withTabs:tabPositions expand:line |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5166 |
! ! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5167 |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5168 |
!ListView::HighlightArea methodsFor:'accessing'! |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5169 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5170 |
bgColor |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5171 |
^ bgColor |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5172 |
! |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5173 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5174 |
bgColor:something |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5175 |
bgColor := something. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5176 |
! |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5177 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5178 |
endCol |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5179 |
^ endCol |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5180 |
! |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5181 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5182 |
endCol:something |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5183 |
endCol := something. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5184 |
! |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5185 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5186 |
endLine |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5187 |
^ endLine |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5188 |
! |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5189 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5190 |
endLine:something |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5191 |
endLine := something. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5192 |
! |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5193 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5194 |
fgColor |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5195 |
^ fgColor |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5196 |
! |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5197 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5198 |
fgColor:something |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5199 |
fgColor := something. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5200 |
! |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5201 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5202 |
startCol |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5203 |
^ startCol |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5204 |
! |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5205 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5206 |
startCol:something |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5207 |
startCol := something. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5208 |
! |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5209 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5210 |
startLine |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5211 |
^ startLine |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5212 |
! |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5213 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5214 |
startLine:something |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5215 |
startLine := something. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5216 |
! ! |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5217 |
|
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5218 |
!ListView::SearchSpec methodsFor:'accessing'! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5219 |
|
5076 | 5220 |
atBeginOfLineOnly |
5079 | 5221 |
^ atBeginOfLineOnly ? false |
5076 | 5222 |
! |
5223 |
||
5224 |
atBeginOfLineOnly:something |
|
5225 |
atBeginOfLineOnly := something. |
|
5226 |
! |
|
5227 |
||
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5228 |
forward |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5229 |
^ forward ? true |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5230 |
! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5231 |
|
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5232 |
fullWord |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5233 |
^ fullWord ? false |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5234 |
! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5235 |
|
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5236 |
ignoreCase |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5237 |
^ ignoreCase ? false |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5238 |
! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5239 |
|
5217 | 5240 |
ignoreDiacritics |
5241 |
^ ignoreDiacritics |
|
5242 |
! |
|
5243 |
||
5244 |
ignoreDiacritics:something |
|
5245 |
ignoreDiacritics := something. |
|
5246 |
! |
|
5247 |
||
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5248 |
match |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5249 |
^ match ? false |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5250 |
! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5251 |
|
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5252 |
pattern |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5253 |
^ pattern |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5254 |
! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5255 |
|
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5256 |
pattern:patternString |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5257 |
pattern := patternString. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5258 |
! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5259 |
|
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5260 |
pattern:patternString ignoreCase:ignoredCaseBoolean |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5261 |
pattern := patternString. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5262 |
ignoreCase := ignoredCaseBoolean. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5263 |
! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5264 |
|
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5265 |
pattern:patternString ignoreCase:ignoredCaseBoolean match:matchBoolean |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5266 |
pattern := patternString. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5267 |
ignoreCase := ignoredCaseBoolean. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5268 |
match := matchBoolean. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5269 |
! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5270 |
|
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5271 |
pattern:patternString ignoreCase:ignoredCaseBoolean match:matchBoolean forward:forwardBoolean |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5272 |
pattern := patternString. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5273 |
ignoreCase := ignoredCaseBoolean. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5274 |
match := matchBoolean. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5275 |
forward := forwardBoolean |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5276 |
! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5277 |
|
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5278 |
pattern:patternString ignoreCase:ignoredCaseBoolean match:matchBoolean variable:variableBoolen forward:forwardBoolean |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5279 |
pattern := patternString. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5280 |
ignoreCase := ignoredCaseBoolean. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5281 |
match := matchBoolean. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5282 |
variable := variableBoolen. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5283 |
forward := forwardBoolean |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5284 |
! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5285 |
|
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5286 |
pattern:patternString ignoreCase:ignoredCaseBoolean match:matchBoolean variable:variableBoolen fullWord:fullWordBoolen forward:forwardBoolean |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5287 |
pattern := patternString. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5288 |
ignoreCase := ignoredCaseBoolean. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5289 |
match := matchBoolean. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5290 |
variable := variableBoolen. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5291 |
fullWord := fullWordBoolen. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5292 |
forward := forwardBoolean |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5293 |
! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5294 |
|
5076 | 5295 |
pattern:patternString ignoreCase:ignoredCaseBoolean match:matchBoolean variable:variableBoolen |
5296 |
fullWord:fullWordBoolen forward:forwardBoolean |
|
5297 |
atBeginOfLineOnly:atBeginOfLineOnlyArg |
|
5298 |
pattern := patternString. |
|
5299 |
ignoreCase := ignoredCaseBoolean. |
|
5300 |
match := matchBoolean. |
|
5301 |
variable := variableBoolen. |
|
5302 |
fullWord := fullWordBoolen. |
|
5303 |
forward := forwardBoolean. |
|
5304 |
atBeginOfLineOnly := atBeginOfLineOnlyArg |
|
5305 |
! |
|
5306 |
||
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5307 |
variable |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5308 |
^ variable |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5309 |
! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5310 |
|
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5311 |
variable:variableBoolean |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5312 |
variable := variableBoolean |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5313 |
! ! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5314 |
|
851
b9d71ccdefaa
care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents:
837
diff
changeset
|
5315 |
!ListView class methodsFor:'documentation'! |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5316 |
|
4523 | 5317 |
version |
5217 | 5318 |
^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.401 2014-12-08 17:31:05 cg Exp $' |
4523 | 5319 |
! |
5320 |
||
4015
8647dad37cb0
comment/format in: #on:aspect:change:list:menu:
Claus Gittinger <cg@exept.de>
parents:
3869
diff
changeset
|
5321 |
version_CVS |
5217 | 5322 |
^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.401 2014-12-08 17:31:05 cg Exp $' |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5323 |
! ! |
4495 | 5324 |