author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Sun, 03 Apr 2016 19:25:10 +0100 | |
branch | jv |
changeset 5649 | 6f57a64ccaa1 |
parent 5647 | a072d911671f |
child 5665 | a28ccea0dc36 |
permissions | -rw-r--r-- |
5617 | 1 |
"{ Encoding: utf8 }" |
2 |
||
0 | 3 |
" |
5 | 4 |
COPYRIGHT (c) 1989 by Claus Gittinger |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5 |
All Rights Reserved |
0 | 6 |
|
7 |
This software is furnished under a license and may be used |
|
8 |
only in accordance with the terms of that license and with the |
|
9 |
inclusion of the above copyright notice. This software may not |
|
10 |
be provided or otherwise made available to, or used by, any |
|
11 |
other person. No title to or ownership of the software is |
|
12 |
hereby transferred. |
|
13 |
" |
|
2180
d208b77444a7
must set modified flag in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents:
2158
diff
changeset
|
14 |
"{ Package: 'stx:libwidg' }" |
d208b77444a7
must set modified flag in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents:
2158
diff
changeset
|
15 |
|
5369 | 16 |
"{ NameSpace: Smalltalk }" |
17 |
||
0 | 18 |
View subclass:#ListView |
3563 | 19 |
instanceVariableNames:'list firstLineShown nFullLinesShown nLinesShown fgColor bgColor |
20 |
partialLines leftMargin topMargin textStartLeft textStartTop |
|
21 |
innerWidth tabPositions lineSpacing fontHeight fontAscent |
|
22 |
fontIsFixedWidth fontWidth autoScroll autoScrollBlock |
|
23 |
autoScrollDeltaT wordCheck includesNonStrings widthOfWidestLine |
|
24 |
listMsg viewOrigin listChannel backgroundAlreadyClearedColor |
|
4747 | 25 |
scrollWhenUpdating scrollLocked lineEndCRLF highlightAreas |
26 |
compareModelOnUpdate expandTabsWhenUpdating |
|
27 |
checkLineEndConventionWhenUpdating |
|
4751 | 28 |
checkedLinesForWidthOfContentsComputation' |
3563 | 29 |
classVariableNames:'DefaultForegroundColor DefaultBackgroundColor DefaultTabPositions |
30 |
UserDefaultTabPositions DefaultLeftMargin DefaultTopMargin' |
|
31 |
poolDictionaries:'' |
|
32 |
category:'Views-Text' |
|
0 | 33 |
! |
34 |
||
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
35 |
Object subclass:#HighlightArea |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
36 |
instanceVariableNames:'startLine startCol endLine endCol fgColor bgColor' |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
37 |
classVariableNames:'' |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
38 |
poolDictionaries:'' |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
39 |
privateIn:ListView |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
40 |
! |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
41 |
|
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
42 |
Object subclass:#SearchSpec |
5076 | 43 |
instanceVariableNames:'pattern match ignoreCase variable fullWord forward |
5544 | 44 |
atBeginOfLineOnly ignoreDiacritics regexMatch wrapAtEndOfText' |
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
45 |
classVariableNames:'' |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
46 |
poolDictionaries:'' |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
47 |
privateIn:ListView |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
48 |
! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
49 |
|
851
b9d71ccdefaa
care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents:
837
diff
changeset
|
50 |
!ListView class methodsFor:'documentation'! |
0 | 51 |
|
38 | 52 |
copyright |
53 |
" |
|
54 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
55 |
All Rights Reserved |
38 | 56 |
|
57 |
This software is furnished under a license and may be used |
|
58 |
only in accordance with the terms of that license and with the |
|
59 |
inclusion of the above copyright notice. This software may not |
|
60 |
be provided or otherwise made available to, or used by, any |
|
61 |
other person. No title to or ownership of the software is |
|
62 |
hereby transferred. |
|
63 |
" |
|
64 |
! |
|
65 |
||
0 | 66 |
documentation |
67 |
" |
|
38 | 68 |
a View for (string-)lists. |
69 |
||
4751 | 70 |
This class can only passively display collections of strings, |
71 |
text or display objects which behave line-like (i.e. all have constant height). |
|
72 |
||
73 |
Selections, editing, cursors etc. must be implemented in subclasses. |
|
74 |
(see SelectionInListView, TextView etc.) |
|
38 | 75 |
|
76 |
This code currently handles only fixed-height fonts correctly - |
|
4751 | 77 |
it should be rewritten in some places to not compute the position/height from |
78 |
the view's font height, but by accumulating line heights... |
|
0 | 79 |
|
38 | 80 |
It can only scroll by full lines vertically (i.e. setting firstLineShown to ~~ 1) |
81 |
which should be changed to have this behavior optionally for smooth scroll. |
|
82 |
||
4751 | 83 |
The text is internally kept in the 'list' instance variable, and is supposed to consist |
120 | 84 |
of a collection (Ordered- or StringCollection) of line entries. |
4751 | 85 |
Typically, individual entries are either strings/text or nil (for empty lines). |
86 |
However, ANY object which supports the displayOn: and widthIn: protocol can be |
|
120 | 87 |
used - see MultipleColumnListEntry as an example. |
88 |
Therefore, ListView (and all subclasses) are prepared to handle non-string entries |
|
4751 | 89 |
(especially: attributed Text and labelAndIcon-like entities). |
90 |
||
91 |
The internal version of the text has tabulators expanded to blanks. ListView is not prepared |
|
92 |
to deal with them. When text is exchanged with an external medium (i.e. reading/writing files), |
|
93 |
these are expanded/compressed assuming a tab-setting of 8. |
|
94 |
This is done independent of the user's tab setting, which is used ONLY for positioning, |
|
95 |
while the text is edited. |
|
96 |
Thus, even if the tab setting is multiple of 4's, tabs are |
|
120 | 97 |
written in multiples of 8 when the text is saved. Since this is the default on all ascii |
98 |
terminals and printers, this assures that the text looks correctly indented when finally printed. |
|
99 |
||
305 | 100 |
Notice: |
4751 | 101 |
------- |
102 |
ListView is one of the OLDEST widget classes in the system and definitely requires a major rewrite: |
|
305 | 103 |
|
120 | 104 |
Due to historic reasons (ListView implemented scrolling before the general |
105 |
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
|
106 |
views. The general scrolling code (in View) uses the transformation for transparent scrolling |
4751 | 107 |
using the viewOrigin (transparent means, that the code does not need to know - it simply draws |
108 |
as if all of the text was visible). |
|
109 |
Here in ListView, the transformation is not used, instead it is done again, and different, |
|
110 |
by keeping the firstLineShown (i.e. vertical offset) and leftOffset (horizontal offset). |
|
111 |
Even worse: the firstLineShown is a line-index, the most annoying consequence of this is that |
|
112 |
scrolling is done by lines here, whereas it is done in pixels in the View class. |
|
113 |
Thus, be very careful, when changing things (better: don't touch it ;-). |
|
114 |
Also, the viewOrigin variable is only valid for the x coordinate. The viewOrigin's y is always 0 !! |
|
120 | 115 |
|
305 | 116 |
Also, all controller functionality is completely performed by the listView |
117 |
(and subclasses) itself. It is still possible, to define and set a specialized |
|
118 |
controller, though. I.e. if you like to change the input behavior, define |
|
119 |
a corresponding controller class and intersect the keyXXX/buttonXXX messages |
|
120 |
there. |
|
121 |
||
4751 | 122 |
This may be totally rewritten ... so don't depend on the internals; especially the scrolling |
120 | 123 |
code will be totally removed here and the inherited functionality be used in the next version. |
38 | 124 |
|
4751 | 125 |
Also Notice: |
126 |
------------ |
|
127 |
because ListView was written at a time when most of the graphics was done via remote connections |
|
128 |
(X-window network protocol), it is highly tuned to avoid redraw operations. Thus, it can be used |
|
129 |
happily over a slow WLAN (say: 64kBit connection). |
|
130 |
In that, it performed *much* better than other widgets, especialy Java and Qt, some of which are |
|
131 |
hardly usable via the network. |
|
132 |
It may be questionable whether this is still a requirement these days, where network connections |
|
133 |
are usually pretty fast. However, the author insists on this to remain as it is!! |
|
134 |
Future underlying graphics may well become network dependent in the future, for example, when |
|
135 |
the display connection is implemented as an RPC into a web browser... |
|
136 |
||
137 |
||
138 |
Also Notice: |
|
139 |
------------ |
|
140 |
ListView shall be configurable to avoid accesses to its underlying list if required. |
|
141 |
Currently, it can be customized to disable lineWidth computation, tab expansion and scanning for |
|
142 |
non-string entries. All of which is required when huge texts which are not in memory are to be displayed |
|
143 |
(for example: a virtual array of 10million text lines). Please be careful to not reintroduce such |
|
144 |
code when adding features (as happened in the past). |
|
145 |
||
0 | 146 |
|
586 | 147 |
[Instance variables:] |
0 | 148 |
|
1325 | 149 |
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
|
150 |
Nils may be used for empty lines. |
1325 | 151 |
|
152 |
firstLineShown <Number> the index of the 1st visible line (1 ..) |
|
153 |
leftOffset <Number> left offset for horizontal scroll |
|
154 |
||
155 |
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
|
156 |
(internal; updated on size changes) |
1325 | 157 |
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
|
158 |
(internal; updated on size changes) |
1325 | 159 |
|
160 |
fgColor <Color> color to draw characters |
|
161 |
bgColor <Color> the background |
|
162 |
||
163 |
partialLines <Boolean> allow last line to be partial displayed |
|
164 |
leftMargin <Number> margin at left in pixels |
|
165 |
topMargin <Number> margin at top in pixels |
|
166 |
textStartLeft <Number> margin + leftMargin (internal) |
|
167 |
textStartTop <Number> margin + topMargin (internal) |
|
168 |
innerWidth <Number> width - margins (internal) |
|
169 |
tabPositions <aCollection> tab stops (cols) |
|
170 |
fontHeight <Number> font height in pixels (internal) |
|
171 |
fontAscent <Number> font ascent in pixels (internal) |
|
172 |
fontIsFixed <Boolean> true if its a fixed font (internal) |
|
173 |
fontWidth <Number> width of space (internal) |
|
174 |
lineSpacing <Number> pixels between lines |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
175 |
lastSearchPattern <String> last pattern for searching |
4159
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
176 |
(kept to provide a default for next search) |
1325 | 177 |
lastSearchIgnoredCase <Boolean> last search ignored case |
4159
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
178 |
(kept to provide a default for next search) |
1325 | 179 |
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
|
180 |
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
|
181 |
(can be changed to allow for underscore and other |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
182 |
characters to be treated as alphaCharacters) |
1325 | 183 |
|
184 |
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
|
185 |
autoScroll (internal) |
1325 | 186 |
autoScrollDeltaT computed scroll time delta in seconds (internal) |
187 |
||
188 |
includesNonStrings cached flag if any non-strings are in list |
|
189 |
widthOfWidestLine cached width of widest line |
|
190 |
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
|
191 |
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
|
192 |
whenever a change of the aspect (aspectMsg) occurs. |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
193 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
194 |
viewOrigin the current origin |
1325 | 195 |
|
1693
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
196 |
backgroundAlreadyClearedColor internal; speedup by avoiding |
4159
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
197 |
multiple fills when drawing |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
198 |
internal lines |
2128
33830e4f998f
added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents:
2090
diff
changeset
|
199 |
|
33830e4f998f
added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents:
2090
diff
changeset
|
200 |
scrollWhenUpdating |
4159
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
201 |
<Symbol> defines how the view is scrolled if the |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
202 |
model changes its value by some outside activity |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
203 |
(i.e. not by user input). |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
204 |
Can be one of: |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
205 |
#keep / nil -> stay unchanged |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
206 |
#endOfText -> scroll to the end |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
207 |
#beginOfText -> scroll to the top |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
208 |
The default is #beginOfText (i.e. scroll to top). |
120 | 209 |
|
586 | 210 |
[StyleSheet parameters:] |
77 | 211 |
|
1325 | 212 |
textForegroundColor defaults to Black |
213 |
textBackgroundColor defaults to White |
|
214 |
textFont defaults to defaultFont |
|
215 |
textTabPositions defaults to #(1 9 17 25 ...) |
|
586 | 216 |
|
217 |
[author:] |
|
4159
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
218 |
Claus Gittinger |
586 | 219 |
|
220 |
[see also:] |
|
4159
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
221 |
TextView EditTextView |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
222 |
|
0 | 223 |
" |
451 | 224 |
! |
225 |
||
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
226 |
examples |
451 | 227 |
" |
228 |
ListViews alone are rarely used - its mostly an abstract superclass |
|
229 |
for TextView, EditTextView and SelectionInListView. |
|
230 |
||
231 |
anyway, here are a few examples: |
|
232 |
||
233 |
basic simple setup: |
|
4536 | 234 |
[exBegin] |
235 |
|top l| |
|
236 |
||
237 |
top := StandardSystemView new. |
|
238 |
top extent:100@200. |
|
239 |
||
240 |
l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top. |
|
241 |
l list:#('one' 'two' 'three'). |
|
242 |
||
243 |
top open |
|
244 |
[exEnd] |
|
451 | 245 |
|
246 |
||
247 |
||
248 |
specifying textMargins (these have NOTHING to do with the viewInset): |
|
4536 | 249 |
[exBegin] |
250 |
|top l| |
|
251 |
||
252 |
top := StandardSystemView new. |
|
253 |
top extent:100@200. |
|
254 |
||
255 |
l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top. |
|
256 |
l list:#('one' 'two' 'three'). |
|
257 |
l topMargin:10. |
|
258 |
l leftMargin:20. |
|
259 |
||
260 |
top open |
|
261 |
[exEnd] |
|
451 | 262 |
|
263 |
||
587
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
264 |
|
451 | 265 |
globally set the fg/bg colors: |
4536 | 266 |
[exBegin] |
267 |
|top l| |
|
268 |
||
269 |
top := StandardSystemView new. |
|
270 |
top extent:100@200. |
|
271 |
||
272 |
l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top. |
|
273 |
l list:#('one' 'two' 'three'). |
|
274 |
l foregroundColor:(Color white). |
|
275 |
l backgroundColor:(Color blue). |
|
276 |
||
277 |
top open |
|
278 |
[exEnd] |
|
451 | 279 |
|
280 |
||
587
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
281 |
|
627 | 282 |
non-string (text) entries: |
4536 | 283 |
[exBegin] |
284 |
|top list l| |
|
285 |
||
286 |
top := StandardSystemView new. |
|
287 |
top extent:100@200. |
|
288 |
||
289 |
l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top. |
|
290 |
list := #('all' 'of' 'your' 'preferred' 'colors') |
|
291 |
with:#(red green blue 'orange' cyan) |
|
292 |
collect:[:s :clr | |
|
293 |
Text string:s |
|
294 |
emphasis:(Array with:#bold |
|
295 |
with:(#color->(Color name:clr))) ]. |
|
296 |
l list:list. |
|
297 |
||
298 |
top open |
|
299 |
[exEnd] |
|
627 | 300 |
|
301 |
||
302 |
||
303 |
generic non-string entries: |
|
304 |
(notice: ColoredListEntry is obsoleted by Text) |
|
4536 | 305 |
[exBegin] |
306 |
|top list l| |
|
307 |
||
308 |
top := StandardSystemView new. |
|
309 |
top extent:100@200. |
|
310 |
||
311 |
l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top. |
|
312 |
list := #('all' 'of' 'your' 'preferred' 'colors') |
|
313 |
with:#(red green blue 'orange' cyan) |
|
314 |
collect:[:s :clr | ColoredListEntry string:s color:(Color name:clr) ]. |
|
315 |
l list:list. |
|
316 |
||
317 |
top open |
|
318 |
[exEnd] |
|
587
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
319 |
|
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
320 |
|
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
321 |
|
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
322 |
using a model (default listMessage is aspectMessage): |
4536 | 323 |
[exBegin] |
324 |
|top model l theModelsText| |
|
325 |
||
326 |
model := Plug new. |
|
327 |
model respondTo:#modelsAspect |
|
328 |
with:[ theModelsText ]. |
|
329 |
||
330 |
top := StandardSystemView new. |
|
331 |
top extent:100@200. |
|
332 |
||
333 |
l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top. |
|
334 |
l model:model. |
|
335 |
l aspect:#modelsAspect. |
|
336 |
||
337 |
top open. |
|
338 |
||
339 |
Delay waitForSeconds:3. |
|
340 |
theModelsText := #('foo' 'bar' 'baz'). |
|
341 |
model changed:#modelsAspect. |
|
342 |
[exEnd] |
|
587
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
343 |
|
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
344 |
|
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
345 |
|
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
346 |
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
|
347 |
for two listViews: |
4536 | 348 |
[exBegin] |
349 |
|top model l1 l2 plainText| |
|
350 |
||
351 |
plainText := #(''). |
|
352 |
||
353 |
model := Plug new. |
|
354 |
model respondTo:#modelsUppercaseText |
|
355 |
with:[ plainText asStringCollection |
|
356 |
collect:[:l | l asUppercase]]. |
|
357 |
model respondTo:#modelsLowercaseText |
|
358 |
with:[ plainText asStringCollection |
|
359 |
collect:[:l | l asLowercase]]. |
|
360 |
||
361 |
top := StandardSystemView extent:200@200. |
|
362 |
||
363 |
l1 := ListView origin:0.0 @ 0.0 corner:1.0 @ 0.5 in:top. |
|
364 |
l1 model:model. |
|
365 |
l1 aspect:#modelsAspect. |
|
366 |
l1 listMessage:#modelsUppercaseText. |
|
367 |
||
368 |
l2 := ListView origin:0.0 @ 0.5 corner:1.0 @ 1.0 in:top. |
|
369 |
l2 model:model. |
|
370 |
l2 aspect:#modelsAspect. |
|
371 |
l2 listMessage:#modelsLowercaseText. |
|
372 |
||
373 |
top open. |
|
374 |
||
375 |
Delay waitForSeconds:3. |
|
376 |
plainText := #('foo' 'bar' 'baz'). |
|
377 |
model changed:#modelsAspect. |
|
378 |
[exEnd] |
|
379 |
||
380 |
using a big list (100000 lines), |
|
381 |
wrapping in a ScrollableView: |
|
382 |
[exBegin] |
|
383 |
|bigList top lv| |
|
384 |
||
385 |
bigList := (1 to:100000) collect:[:lineNr | 'List line Nr. ' , lineNr printString]. |
|
386 |
bigList at:10 put:('Some Text ' asText , 'with Bold part' allBold). |
|
387 |
bigList at:20 put:('Some Text ' asText , 'with Italic part' allItalic). |
|
388 |
||
389 |
top := StandardSystemView extent:200@200. |
|
390 |
||
391 |
lv := HVScrollableView for:ListView in:top. |
|
392 |
lv origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
|
393 |
lv list:bigList expandTabs:false scanForNonStrings:false includesNonStrings:false. |
|
394 |
||
395 |
top open. |
|
396 |
[exEnd] |
|
397 |
||
398 |
using a huge virtual list (1 mio simulated lines), |
|
399 |
wrapping in a ScrollableView: |
|
400 |
[exBegin] |
|
401 |
|virtualList top lv| |
|
402 |
||
403 |
virtualList := Plug new. |
|
404 |
virtualList inheritFrom:SequenceableCollection. |
|
405 |
virtualList respondTo:#size with:[ 1000000 ]. |
|
406 |
virtualList respondTo:#at: with:[:lineNr | 'List line Nr. ' , lineNr printString ]. |
|
407 |
||
408 |
top := StandardSystemView extent:200@200. |
|
409 |
||
410 |
lv := ScrollableView for:ListView in:top. |
|
411 |
lv origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
|
412 |
lv list:virtualList expandTabs:false scanForNonStrings:false includesNonStrings:false. |
|
413 |
||
414 |
top open. |
|
415 |
[exEnd] |
|
4751 | 416 |
|
417 |
||
418 |
using a huge virtual array (1 mio simulated lines), |
|
419 |
wrapping in a ScrollableView. |
|
420 |
To simulate an expensive computation, a delay is planted into the line generator; |
|
421 |
Startup and display of page full of lines should not take longer than the number of lines shown: |
|
422 |
[exBegin] |
|
423 |
|virtualList top lv| |
|
424 |
||
425 |
virtualList := VirtualArray new. |
|
426 |
virtualList |
|
427 |
setSize:1000000; |
|
428 |
generator:[:index | Transcript showCR:index. |
|
429 |
Delay waitForSeconds:0.5. |
|
430 |
'%1 -> %2' bindWith:index with:index squared]. |
|
431 |
||
432 |
top := StandardSystemView extent:200@200. |
|
433 |
||
434 |
lv := ScrollableView for:ListView in:top. |
|
435 |
lv origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
|
436 |
lv expandTabsWhenUpdating:false. |
|
437 |
lv checkLineEndConventionWhenUpdating:false. |
|
438 |
lv checkedLinesForWidthOfContentsComputation:-1. |
|
439 |
lv list:virtualList. |
|
440 |
||
441 |
top open. |
|
442 |
[exEnd] |
|
451 | 443 |
" |
0 | 444 |
! ! |
445 |
||
851
b9d71ccdefaa
care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents:
837
diff
changeset
|
446 |
!ListView class methodsFor:'defaults'! |
0 | 447 |
|
105 | 448 |
defaultTabPositions |
2378 | 449 |
"return an array containing the styleSheets default tab positions" |
450 |
||
3777 | 451 |
^ DefaultTabPositions ? self tab4Positions |
2378 | 452 |
! |
453 |
||
454 |
defaultTabPositions:aVector |
|
455 |
"set the array containing the styleSheets tab positions" |
|
456 |
||
457 |
DefaultTabPositions := aVector |
|
458 |
||
459 |
" |
|
3777 | 460 |
ListView defaultTabPositions:(ListView tab4Positions) |
2378 | 461 |
" |
105 | 462 |
! |
463 |
||
7 | 464 |
tab4Positions |
1693
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
465 |
"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
|
466 |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
467 |
^ #(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
|
468 |
85 89 93 97 101 105 109 113 114 121 125 129 133 137 141 145) |
120 | 469 |
! |
470 |
||
471 |
tab8Positions |
|
1693
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
472 |
"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
|
473 |
|
120 | 474 |
^ #(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
|
475 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
476 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
477 |
updateStyleCache |
439
4c6799ace14b
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
427
diff
changeset
|
478 |
"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
|
479 |
|
1354 | 480 |
<resource: #style (#'text.foregroundColor' #'text.backgroundColor' |
5617 | 481 |
#'text.tabPositions' |
482 |
#'text.font')> |
|
1354 | 483 |
|
5023
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
484 |
DefaultForegroundColor := StyleSheet colorAt:'text.foregroundColor' default:Color black. |
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
485 |
DefaultBackgroundColor := StyleSheet colorAt:'text.backgroundColor' default:Color white. |
1354 | 486 |
DefaultFont := StyleSheet fontAt:'text.font'. |
5617 | 487 |
"/ that's not style, but a personal setting |
488 |
"/ DefaultTabPositions := StyleSheet at:'text.tabPositions'. |
|
489 |
"/ DefaultTabPositions isNil ifTrue:[DefaultTabPositions := self defaultTabPositions]. |
|
1693
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
490 |
DefaultLeftMargin := 0.5. |
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
491 |
DefaultTopMargin := 0.5. |
439
4c6799ace14b
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
427
diff
changeset
|
492 |
|
5617 | 493 |
"Modified: / 31-03-2016 / 10:49:45 / cg" |
2378 | 494 |
! |
495 |
||
496 |
userDefaultTabPositions |
|
497 |
"return an array containing the users default tab positions" |
|
498 |
||
499 |
^ UserDefaultTabPositions |
|
500 |
! |
|
501 |
||
502 |
userDefaultTabPositions:aVector |
|
503 |
"set the array containing the users tab positions" |
|
504 |
||
505 |
UserDefaultTabPositions := aVector |
|
506 |
||
507 |
" |
|
508 |
self userDefaultTabPositions:(self tab4Positions) |
|
509 |
" |
|
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
|
510 |
! ! |
75b8fb924904
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 |
|
75b8fb924904
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 |
!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
|
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 |
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
|
515 |
"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
|
516 |
- 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
|
517 |
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
|
518 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
519 |
^ height - (2 * margin) - topMargin |
0 | 520 |
! ! |
521 |
||
2133 | 522 |
!ListView methodsFor:'accessing-behavior'! |
2132 | 523 |
|
4747 | 524 |
checkLineEndConventionWhenUpdating |
525 |
"return the line-end convention check when updating behavior. |
|
526 |
If true (the default), the first line of the list given is checked for having a |
|
527 |
cr-lf line end (which is a DOS convention), and the lineEndCRLF flag is set dynamically. |
|
528 |
If false, the lineEndCRLF remains as specified by the user. |
|
529 |
You may want to disable this flag if it is very expensive to generate a line |
|
530 |
(although, only the very first line is checked, anyway)" |
|
531 |
||
532 |
^ checkLineEndConventionWhenUpdating |
|
533 |
! |
|
534 |
||
535 |
checkLineEndConventionWhenUpdating:aBoolean |
|
536 |
"define the line-end convention check when updating behavior. |
|
537 |
If true (the default), the first line of the list given is checked for having a |
|
538 |
cr-lf line end (which is a DOS convention), and the lineEndCRLF flag is set dynamically. |
|
539 |
If false, the lineEndCRLF remains as specified by the user. |
|
540 |
You may want to disable this flag if it is very expensive to generate a line |
|
541 |
(although, only the very first line is checked, anyway)" |
|
542 |
||
543 |
checkLineEndConventionWhenUpdating := aBoolean |
|
544 |
! |
|
545 |
||
4751 | 546 |
checkedLinesForWidthOfContentsComputation |
547 |
"return which lines to consider in the widthOfContents computation, |
|
548 |
which is needed by the scrollBar interface. |
|
549 |
If nil (the default), all lines are processed and the width of the longest line is taken. |
|
550 |
If positive, that number of lines is checked near the start of the text, |
|
551 |
if negative, from the end of the text. |
|
552 |
If 0, the width is dynamically re adjusted, as lines are drawn. |
|
553 |
You may want to change this to 1 if it is guaranteed that all linesa are of the same width, |
|
554 |
or -1, if all are shorter than the last line. |
|
555 |
(useful, for example, when it is very expensive to generate all lines, and a huge number |
|
556 |
of same-width lines is generated through a virtual array)" |
|
557 |
||
558 |
^ checkedLinesForWidthOfContentsComputation |
|
559 |
! |
|
560 |
||
561 |
checkedLinesForWidthOfContentsComputation:aNumberOrNil |
|
562 |
"set which lines to consider in the widthOfContents computation, |
|
563 |
which is needed by the scrollBar interface. |
|
564 |
If nil (the default), all lines are processed and the width of the longest line is taken. |
|
565 |
If positive, that number of lines is checked near the start of the text, |
|
566 |
if negative, from the end of the text. |
|
567 |
If 0, the width is dynamically re adjusted, as lines are drawn. |
|
568 |
You may want to change this to 1 if it is guaranteed that all linesa are of the same width, |
|
569 |
or -1, if all are shorter than the last line. |
|
570 |
(useful, for example, when it is very expensive to generate all lines, and a huge number |
|
571 |
of same-width lines is generated through a virtual array)" |
|
572 |
||
573 |
checkedLinesForWidthOfContentsComputation := aNumberOrNil |
|
574 |
! |
|
575 |
||
4747 | 576 |
compareModelWhenUpdating |
577 |
"return the compare when updating behavior. |
|
578 |
If true (the default), the list of lines as given due to a model update |
|
579 |
is processed and compared against the currently shown text. |
|
580 |
If they are the same, no action is taken. |
|
581 |
This behavior is ok in 99.99% of all applications. |
|
582 |
However, you may turn this off iff: |
|
583 |
- it is very expensive to process the list (for example, because the list |
|
584 |
is defined by a virtual array, which computes the lines dynamically, on |
|
585 |
the fly). |
|
586 |
One use where this flag should be turned off is in the hex-memory display, |
|
587 |
which is able to simulate texts with millions of lines, but they are actually |
|
588 |
simulated by generating the presented lines dynamically, as they are displayed." |
|
589 |
||
590 |
^ compareModelOnUpdate |
|
591 |
! |
|
592 |
||
593 |
compareModelWhenUpdating:aBoolean |
|
594 |
"define the compare when updating behavior. |
|
595 |
If true (the default), the list of lines as given due to a model update |
|
596 |
is processed and compared against the currently shown text. |
|
597 |
If they are the same, no action is taken. |
|
598 |
This behavior is ok in 99.99% of all applications. |
|
599 |
However, you may turn this off iff: |
|
600 |
- it is very expensive to process the list (for example, because the list |
|
601 |
is defined by a virtual array, which computes the lines dynamically, on |
|
602 |
the fly). |
|
603 |
One use where this flag should be turned off is in the hex-memory display, |
|
604 |
which is able to simulate texts with millions of lines, but they are actually |
|
605 |
simulated by generating the presented lines dynamically, as they are displayed." |
|
606 |
||
607 |
compareModelOnUpdate := aBoolean |
|
608 |
! |
|
609 |
||
610 |
expandTabsWhenUpdating |
|
611 |
"return the tab expansion behavior. |
|
612 |
If true (the default), the list of lines as given via #list: or |
|
613 |
due to a model update is processed and lines are replaced by lines with |
|
614 |
tabs expanded. |
|
615 |
This behavior is ok in 99.99% of all applications. |
|
616 |
However, you may turn this off iff: |
|
617 |
- you are certain, that no tabs are in the passed in list |
|
618 |
- it is very expensive to process the list (for example, because the list |
|
619 |
is defined by a virtual array, which computes the lines dynamically, on |
|
620 |
the fly). |
|
621 |
One use where this flag should be turned off is in the hex-memory display, |
|
622 |
which is able to simulate texts with millions of lines, but they are actually |
|
623 |
simulated by generating the presented lines dynamically, as they are displayed." |
|
624 |
||
625 |
^ expandTabsWhenUpdating |
|
626 |
! |
|
627 |
||
628 |
expandTabsWhenUpdating:aBoolean |
|
629 |
"define the tab expansion behavior. |
|
630 |
If true (the default), the list of lines as given via #list: or |
|
631 |
due to a model update is processed and lines are replaced by lines with |
|
632 |
tabs expanded. |
|
633 |
This behavior is ok in 99.99% of all applications. |
|
634 |
However, you may turn this off iff: |
|
635 |
- you are certain, that no tabs are in the passed in list |
|
636 |
- it is very expensive to process the list (for example, because the list |
|
637 |
is defined by a virtual array, which computes the lines dynamically, on |
|
638 |
the fly). |
|
639 |
One use where this flag should be turned off is in the hex-memory display, |
|
640 |
which is able to simulate texts with millions of lines, but they are actually |
|
641 |
simulated by generating the presented lines dynamically, as they are displayed." |
|
642 |
||
643 |
expandTabsWhenUpdating := aBoolean |
|
644 |
! |
|
645 |
||
3314 | 646 |
lineEndCRLF |
4610 | 647 |
"answer true, if CRLF is used for the line end. |
648 |
This is true for DOS/Windows files. |
|
649 |
Otherwise 'Character cr' is the line end (which is LF in unix)" |
|
650 |
||
3314 | 651 |
^ lineEndCRLF ? false |
652 |
||
653 |
"Created: / 04-07-2006 / 19:05:01 / fm" |
|
654 |
! |
|
655 |
||
2325 | 656 |
scrollWhenUpdating |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
657 |
"return the scroll behavior, when I get a new text |
2325 | 658 |
(via the model or the #contents/#list) |
659 |
Possible returnValues are: |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
660 |
#keep / nil -> no change |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
661 |
#endOfText -> scroll to the end |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
662 |
#beginOfText -> scroll to the top |
3116
2df69a526f06
default for scrollWhenUpdating is now #keep
Claus Gittinger <cg@exept.de>
parents:
2997
diff
changeset
|
663 |
The default is #keep. |
2325 | 664 |
This may be useful for fields which get new values assigned from |
665 |
the program (i.e. not from the user)" |
|
666 |
||
667 |
^ scrollWhenUpdating |
|
668 |
! |
|
669 |
||
2132 | 670 |
scrollWhenUpdating:aSymbolOrNil |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
671 |
"define how to scroll, when I get a new text |
2132 | 672 |
(via the model or the #contents/#list) |
673 |
Allowed arguments are: |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
674 |
#keep / nil -> no change |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
675 |
#endOfText -> scroll to the end |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
676 |
#beginOfText -> scroll to the top |
3116
2df69a526f06
default for scrollWhenUpdating is now #keep
Claus Gittinger <cg@exept.de>
parents:
2997
diff
changeset
|
677 |
The default is #keep. |
2132 | 678 |
This may be useful for fields which get new values assigned from |
679 |
the program (i.e. not from the user)" |
|
680 |
||
681 |
scrollWhenUpdating := aSymbolOrNil |
|
4403 | 682 |
! |
683 |
||
684 |
wordCheckBlock:aBlock |
|
685 |
"set the word-check block - this block is called with a character argument, |
|
686 |
when the end/beginning of a word is searched. |
|
687 |
It should return true, if the character belongs to the word. |
|
688 |
The default block is set in #initialize, and returns true for alphanumeric |
|
689 |
(national) characters. |
|
690 |
Applications may change it to include underlines, dollars or other characters. |
|
691 |
(a C/C++ editor would include underlines ...)" |
|
692 |
||
693 |
wordCheck := aBlock. |
|
694 |
||
695 |
"Modified: 22.5.1996 / 12:26:55 / cg" |
|
2132 | 696 |
! ! |
697 |
||
105 | 698 |
!ListView methodsFor:'accessing-contents'! |
699 |
||
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
|
700 |
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
|
701 |
"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
|
702 |
|
2219
9ffca3757666
fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents:
2216
diff
changeset
|
703 |
|fontHeightBefore| |
9ffca3757666
fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents:
2216
diff
changeset
|
704 |
|
2967 | 705 |
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
|
706 |
list add:aString. |
2219
9ffca3757666
fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents:
2216
diff
changeset
|
707 |
|
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
|
708 |
includesNonStrings ifFalse:[ |
5111 | 709 |
includesNonStrings := (aString notNil and:[(aString isSingleByteString) not]). |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
710 |
includesNonStrings ifTrue:[ |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
711 |
fontHeightBefore := fontHeight. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
712 |
self getFontParameters. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
713 |
fontHeightBefore ~~ fontHeight ifTrue:[ |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
714 |
self invalidate |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
715 |
]. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
716 |
]. |
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
|
717 |
]. |
2224
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
718 |
|
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
719 |
widthOfWidestLine notNil ifTrue:[ |
4751 | 720 |
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
|
721 |
]. |
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
722 |
|
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
|
723 |
shown ifTrue:[ |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
724 |
self redrawLine:(self size). |
2182
fb9bc638123a
mus notify textChanged in #add: / #add:beforeIndex:
Claus Gittinger <cg@exept.de>
parents:
2181
diff
changeset
|
725 |
]. |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
726 |
self enqueueDelayedContentsChangedNotification. "recompute scrollbars" |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
727 |
|
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
728 |
"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
|
729 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
730 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
731 |
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
|
732 |
"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
|
733 |
|
2348 | 734 |
|lastShown| |
735 |
||
1351 | 736 |
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
|
737 |
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
|
738 |
|
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
739 |
widthOfWidestLine notNil ifTrue:[ |
4751 | 740 |
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
|
741 |
]. |
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
742 |
|
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
|
743 |
includesNonStrings ifFalse:[ |
5111 | 744 |
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
|
745 |
"/ 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
|
746 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
747 |
shown ifTrue:[ |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
748 |
lastShown := self lastLineShown. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
749 |
index <= 2 ifTrue:[ |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
750 |
self invalidate |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
751 |
] ifFalse:[ |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
752 |
index to:lastShown do:[:eachLine | |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
753 |
self invalidateLine:eachLine |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
754 |
]. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
755 |
]. |
2182
fb9bc638123a
mus notify textChanged in #add: / #add:beforeIndex:
Claus Gittinger <cg@exept.de>
parents:
2181
diff
changeset
|
756 |
]. |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
757 |
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
|
758 |
|
2257
d095d1e0779e
care for scrollWhenUpdating when adding individual lines
src
parents:
2249
diff
changeset
|
759 |
(scrollWhenUpdating == #end or:[scrollWhenUpdating == #endOfText]) ifTrue:[ |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
760 |
"/ self selection isNil ifTrue:[ |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
761 |
self scrollToBottom. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
762 |
"/ ] |
2257
d095d1e0779e
care for scrollWhenUpdating when adding individual lines
src
parents:
2249
diff
changeset
|
763 |
]. |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
764 |
|
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
765 |
"Modified: / 25-07-2012 / 12:00:42 / cg" |
65 | 766 |
! |
767 |
||
2246 | 768 |
addAll:aCollectionOfLines beforeIndex:index |
2348 | 769 |
"add a bunch of lines and redisplay" |
770 |
||
771 |
|lastShown| |
|
2246 | 772 |
|
773 |
list isNil ifTrue:[list := OrderedCollection new]. |
|
774 |
aCollectionOfLines do:[:eachLine | |
|
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
775 |
list addAll:aCollectionOfLines beforeIndex:index. |
2246 | 776 |
]. |
2348 | 777 |
includesNonStrings ifFalse:[ |
4765 | 778 |
includesNonStrings := |
779 |
aCollectionOfLines |
|
780 |
contains:[:someLine | |
|
5111 | 781 |
someLine notNil and:[(someLine isSingleByteString) not]. |
4765 | 782 |
] |
2348 | 783 |
]. |
2246 | 784 |
|
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
785 |
widthOfWidestLine notNil ifTrue:[ |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
786 |
aCollectionOfLines do:[:eachLine | |
4751 | 787 |
self recomputeWidthOfWidestLineFor:eachLine old:nil. |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
788 |
]. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
789 |
]. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
790 |
"/ widthOfWidestLine := nil. "/ i.e. unknown |
2246 | 791 |
self textChanged. |
792 |
||
2348 | 793 |
shown ifTrue:[ |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
794 |
lastShown := self lastLineShown. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
795 |
((index-1) <= lastShown) ifTrue:[ |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
796 |
index <= 2 ifTrue:[ |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
797 |
self invalidate |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
798 |
] ifFalse:[ |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
799 |
index-1 to:lastShown do:[:eachLine | |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
800 |
self invalidateLine:eachLine |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
801 |
]. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
802 |
"/ self redrawFromLine:index-1. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
803 |
]. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
804 |
]. |
2246 | 805 |
]. |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
806 |
self enqueueDelayedContentsChangedNotification. "recompute scrollbars" |
2257
d095d1e0779e
care for scrollWhenUpdating when adding individual lines
src
parents:
2249
diff
changeset
|
807 |
|
d095d1e0779e
care for scrollWhenUpdating when adding individual lines
src
parents:
2249
diff
changeset
|
808 |
(scrollWhenUpdating == #end or:[scrollWhenUpdating == #endOfText]) ifTrue:[ |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
809 |
"/ self selection isNil ifTrue:[ |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
810 |
self scrollToBottom. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
811 |
"/ ] |
2257
d095d1e0779e
care for scrollWhenUpdating when adding individual lines
src
parents:
2249
diff
changeset
|
812 |
]. |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
813 |
|
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
814 |
"Modified: / 25-07-2012 / 12:00:54 / cg" |
2246 | 815 |
! |
816 |
||
105 | 817 |
at:lineNr |
120 | 818 |
"retrieve a line; return nil if beyond end-of-text. |
819 |
this allows textViews to be used like collections in some places." |
|
105 | 820 |
|
821 |
list isNil ifTrue:[^ nil]. |
|
822 |
(lineNr between:1 and:self size) ifFalse:[^ nil]. |
|
823 |
^ list at:lineNr |
|
59 | 824 |
! |
825 |
||
105 | 826 |
at:index put:aString |
827 |
"change a line and redisplay" |
|
828 |
||
2577 | 829 |
|fontHeightBefore widthBefore| |
1608
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
830 |
|
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
831 |
fontHeightBefore := fontHeight. |
2224
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
832 |
widthBefore := widthOfWidestLine. |
105 | 833 |
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
|
834 |
|
105 | 835 |
shown ifTrue:[ |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
836 |
fontHeightBefore ~= fontHeight ifTrue:[ |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
837 |
"/ must redraw everything |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
838 |
self invalidate. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
839 |
^ self |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
840 |
]. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
841 |
self redrawLine:index. |
2219
9ffca3757666
fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents:
2216
diff
changeset
|
842 |
|
9ffca3757666
fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents:
2216
diff
changeset
|
843 |
"/ 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
|
844 |
"/ 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
|
845 |
|
9ffca3757666
fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents:
2216
diff
changeset
|
846 |
|
9ffca3757666
fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents:
2216
diff
changeset
|
847 |
"/ "/ this could have changed the font height; |
9ffca3757666
fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents:
2216
diff
changeset
|
848 |
"/ "/ 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
|
849 |
"/ fontHeightBefore > fontHeight ifTrue:[ |
9ffca3757666
fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents:
2216
diff
changeset
|
850 |
"/ (self listLineIsVisible:(self size)) ifTrue:[ |
9ffca3757666
fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents:
2216
diff
changeset
|
851 |
"/ self clearRectangle:(margin @ (self yOfVisibleLine:nLinesShown+1)) |
9ffca3757666
fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents:
2216
diff
changeset
|
852 |
"/ corner:(width-margin) @ (height-margin). |
9ffca3757666
fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents:
2216
diff
changeset
|
853 |
"/ ]. |
9ffca3757666
fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents:
2216
diff
changeset
|
854 |
"/ self redrawFromLine:index |
9ffca3757666
fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents:
2216
diff
changeset
|
855 |
"/ ] ifFalse:[ |
9ffca3757666
fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents:
2216
diff
changeset
|
856 |
"/ self redrawLine:index |
9ffca3757666
fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents:
2216
diff
changeset
|
857 |
"/ ]. |
9ffca3757666
fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents:
2216
diff
changeset
|
858 |
|
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
859 |
"/ asynchronous: |
1194 | 860 |
"/ visibleLine := self listLineToVisibleLine:index. |
861 |
"/ visibleLine notNil ifTrue:[ |
|
862 |
"/ y := self yOfVisibleLine:visibleLine. |
|
863 |
"/ self invalidate:((margin @ y) extent:(width@fontHeight)) |
|
864 |
"/ ]. |
|
2224
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
865 |
|
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
866 |
widthBefore ~~ widthOfWidestLine ifTrue:[ |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
867 |
self enqueueDelayedContentsChangedNotification |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
868 |
] |
105 | 869 |
] |
1194 | 870 |
|
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
871 |
"Modified: / 25-07-2012 / 12:01:46 / cg" |
105 | 872 |
! |
873 |
||
2427
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
874 |
characterAtCharacterPosition:charPos |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
875 |
"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
|
876 |
Return a space character if nothing is there |
2707 | 877 |
(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
|
878 |
|
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
879 |
|line 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 |
line := self lineOfCharacterPosition:charPos. |
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
882 |
col := charPos - (self characterPositionOfLine:line col:1) + 1. |
2443 | 883 |
col == 0 ifTrue:[^ Character cr]. |
2427
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
884 |
^ self characterAtLine:line col:col |
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
885 |
! |
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
886 |
|
598
5d5194703de8
characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents:
594
diff
changeset
|
887 |
characterAtLine:lineNr col:colNr |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
888 |
"return the character at physical line/col. |
598
5d5194703de8
characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents:
594
diff
changeset
|
889 |
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
|
890 |
Return a space character if nothing is there |
2707 | 891 |
(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
|
892 |
|
5d5194703de8
characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents:
594
diff
changeset
|
893 |
|line| |
5d5194703de8
characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents:
594
diff
changeset
|
894 |
|
5d5194703de8
characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents:
594
diff
changeset
|
895 |
list notNil ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
896 |
line := self listAt:lineNr. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
897 |
line notNil ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
898 |
(line size >= colNr) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
899 |
^ line at:colNr |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
900 |
] |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
901 |
] |
598
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 |
^ Character space |
5d5194703de8
characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents:
594
diff
changeset
|
904 |
|
5d5194703de8
characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents:
594
diff
changeset
|
905 |
"Created: 29.4.1996 / 12:11:00 / cg" |
5d5194703de8
characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents:
594
diff
changeset
|
906 |
"Modified: 29.4.1996 / 12:12:41 / cg" |
5d5194703de8
characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents:
594
diff
changeset
|
907 |
! |
5d5194703de8
characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents:
594
diff
changeset
|
908 |
|
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
|
909 |
contents |
4610 | 910 |
"return the contents as a string, terminated by the line end character (sequence)" |
911 |
||
912 |
|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
|
913 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
914 |
list isNil ifTrue:[^ '']. |
4610 | 915 |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
916 |
self lineEndCRLF ifTrue:[ |
4610 | 917 |
lineEnd := String crlf. |
918 |
] ifFalse:[ |
|
919 |
lineEnd := Character cr. |
|
3314 | 920 |
]. |
4610 | 921 |
|
922 |
stringCollection := list asStringCollection. |
|
923 |
^ stringCollection |
|
924 |
asStringWith:lineEnd |
|
925 |
from:1 to:stringCollection size |
|
926 |
compressTabs:false |
|
927 |
final:lineEnd |
|
3314 | 928 |
|
929 |
"Modified: / 04-07-2006 / 19:18:47 / fm" |
|
105 | 930 |
! |
931 |
||
932 |
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
|
933 |
"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
|
934 |
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
|
935 |
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
|
936 |
to a collection of line-strings here." |
105 | 937 |
|
938 |
|l| |
|
939 |
||
940 |
l := something. |
|
941 |
l notNil ifTrue:[ |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
942 |
l isString ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
943 |
l := l asStringCollection |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
944 |
] |
105 | 945 |
]. |
946 |
self list:l |
|
652 | 947 |
|
1240
1b3611a8e972
added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents:
1234
diff
changeset
|
948 |
"Modified: 5.6.1997 / 11:11:54 / cg" |
51 | 949 |
! |
950 |
||
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
|
951 |
from:from to:to do:aBlock |
652 | 952 |
"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
|
953 |
|
3256
0e978bc1d5fd
examples for big and huge lists added
Claus Gittinger <cg@exept.de>
parents:
3253
diff
changeset
|
954 |
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
|
955 |
! |
75b8fb924904
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 |
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
|
958 |
"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
|
959 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
960 |
^ 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
|
961 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
962 |
|
2455 | 963 |
lineAtY:y |
964 |
"return the lineNr for a given y-(view-)coordinate" |
|
965 |
||
966 |
|visibleLine| |
|
967 |
||
968 |
visibleLine := self visibleLineOfY:y. |
|
969 |
visibleLine isNil ifTrue:[^ nil]. |
|
970 |
^ self visibleLineToListLine:visibleLine. |
|
971 |
! |
|
972 |
||
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
|
973 |
list |
652 | 974 |
"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
|
975 |
This returns the views internal list - modifying it may confuse |
652 | 976 |
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
|
977 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
978 |
^ list |
652 | 979 |
|
1240
1b3611a8e972
added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents:
1234
diff
changeset
|
980 |
"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
|
981 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
982 |
|
0 | 983 |
list:aCollection |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
984 |
"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
|
985 |
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
|
986 |
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
|
987 |
Tabs are expanded (to spaces). |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
988 |
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
|
989 |
(remembered to optimize later redraws)." |
128 | 990 |
|
4751 | 991 |
self list:aCollection expandTabs:expandTabsWhenUpdating |
652 | 992 |
|
1240
1b3611a8e972
added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents:
1234
diff
changeset
|
993 |
"Modified: 5.6.1997 / 11:10:45 / cg" |
128 | 994 |
! |
995 |
||
996 |
list:aCollection expandTabs:expand |
|
2128
33830e4f998f
added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents:
2090
diff
changeset
|
997 |
"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
|
998 |
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
|
999 |
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
|
1000 |
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
|
1001 |
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
|
1002 |
|
4765 | 1003 |
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
|
1004 |
|
1b3611a8e972
added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents:
1234
diff
changeset
|
1005 |
"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
|
1006 |
! |
1b3611a8e972
added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents:
1234
diff
changeset
|
1007 |
|
1b3611a8e972
added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents:
1234
diff
changeset
|
1008 |
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
|
1009 |
"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
|
1010 |
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
|
1011 |
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
|
1012 |
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
|
1013 |
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
|
1014 |
(remembered to optimize later redraws)." |
0 | 1015 |
|
1241 | 1016 |
self |
4747 | 1017 |
list:aCollection expandTabs:expand scanForNonStrings:scan includesNonStrings:nil |
1241 | 1018 |
|
1019 |
"Modified: 5.6.1997 / 12:40:35 / cg" |
|
1020 |
! |
|
1021 |
||
4747 | 1022 |
list:aCollection expandTabs:expand scanForNonStrings:scan includesNonStrings:nonStringsIfNoScan |
1023 |
"set the contents (a collection of strings) |
|
1024 |
and scroll as specified in scrollWhenUpdating (default:top-left). |
|
1025 |
If expand is true, tabs are expanded (to spaces). |
|
1026 |
If scan is true, scan the passed list for nonStrings; |
|
1027 |
otherwise, take the information from the nonStrings arg. |
|
1028 |
(the nonStrings information is remembered to optimize later redraws & height computations)." |
|
1029 |
||
1030 |
self |
|
1031 |
list:aCollection |
|
1032 |
expandTabs:expand |
|
1033 |
scanForNonStrings:scan |
|
1034 |
includesNonStrings:nonStringsIfNoScan |
|
1035 |
redraw:true |
|
1036 |
! |
|
1037 |
||
1038 |
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
|
1039 |
"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
|
1040 |
and scroll as specified in scrollWhenUpdating (default:top-left). |
1241 | 1041 |
If expand is true, tabs are expanded (to spaces). |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1042 |
If scan is true, scan the passed list for nonStrings; |
1241 | 1043 |
otherwise, take the information from the nonStrings arg. |
1044 |
(the nonStrings information is remembered to optimize later redraws & height computations)." |
|
1045 |
||
2199
455cd1c65af1
auto-scroll (when fetching list from model) to bottom fixed
Claus Gittinger <cg@exept.de>
parents:
2188
diff
changeset
|
1046 |
|oldFirst oldLeft nonStringsBefore fontHeightBefore |
3821 | 1047 |
scrollToEnd scrollToTop newLeftOffset wText same firstLine| |
2891 | 1048 |
|
4747 | 1049 |
"/ cg: what is the point in comparing here? |
1050 |
"/ I think, if there is something to optimize, |
|
1051 |
"/ the caller should do so (moved to getListFromModel). |
|
1052 |
"/ notice, that it may be very expensive to ask aCollection for each line |
|
1053 |
"/ for example, iff the lines are generated on the fly by an algorithm |
|
1054 |
false ifTrue:[ |
|
1055 |
"/ see if there is a change at all. |
|
1056 |
"/ use to compare using =, but that's not enough in case of emphasis change. |
|
1057 |
aCollection size == list size ifTrue:[ |
|
1058 |
same := true. |
|
1059 |
aCollection size > 0 ifTrue:[ |
|
1060 |
aCollection with:list do:[:eachNewLine :eachOldLine | |
|
1061 |
(eachNewLine == eachOldLine) |
|
1062 |
ifFalse:[ |
|
1063 |
same := false. |
|
1064 |
] |
|
4610 | 1065 |
] |
4747 | 1066 |
]. |
1067 |
same ifTrue:[^ self]. |
|
4610 | 1068 |
]. |
2891 | 1069 |
]. |
2199
455cd1c65af1
auto-scroll (when fetching list from model) to bottom fixed
Claus Gittinger <cg@exept.de>
parents:
2188
diff
changeset
|
1070 |
|
455cd1c65af1
auto-scroll (when fetching list from model) to bottom fixed
Claus Gittinger <cg@exept.de>
parents:
2188
diff
changeset
|
1071 |
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
|
1072 |
scrollToEnd := scrollWhenUpdating == #end or:[scrollWhenUpdating == #endOfText]. |
0 | 1073 |
|
4747 | 1074 |
(aCollection isEmptyOrNil and:[list isEmptyOrNil]) ifTrue:[ |
4610 | 1075 |
"no contents change" |
4747 | 1076 |
list := aCollection. |
1077 |
scrollLocked ifFalse:[ |
|
1078 |
scrollToTop ifTrue:[ |
|
1079 |
self scrollToTop. |
|
1080 |
] ifFalse:[ |
|
1081 |
scrollToEnd ifTrue:[ |
|
1082 |
self scrollToBottom. |
|
1083 |
] |
|
1084 |
]. |
|
1085 |
self scrollToLeft. |
|
4610 | 1086 |
]. |
1087 |
^ self |
|
0 | 1088 |
]. |
3314 | 1089 |
|
4747 | 1090 |
checkLineEndConventionWhenUpdating ifTrue:[ |
1091 |
"Check if the we use DOS/Windows line end convention with CR LF. |
|
1092 |
The LF has already been consumed by the conversion to a StringCollection, |
|
1093 |
now check for and remove the trailing left over CRs" |
|
1094 |
||
1095 |
lineEndCRLF := (aCollection size > 0 |
|
1096 |
and:[(firstLine := aCollection at:1) isString |
|
1097 |
and:[firstLine notEmpty |
|
1098 |
and:[firstLine string endsWith:Character return]]]). |
|
1099 |
]. |
|
3314 | 1100 |
lineEndCRLF ifTrue:[ |
4610 | 1101 |
list := aCollection |
1102 |
collect:[:eachLineWithCROrNil | |
|
1103 |
eachLineWithCROrNil isNil |
|
1104 |
ifTrue:nil |
|
1105 |
ifFalse:[(eachLineWithCROrNil endsWith:Character return) |
|
1106 |
ifTrue:[eachLineWithCROrNil copyButLast:1] |
|
1107 |
ifFalse:[eachLineWithCROrNil]]]. |
|
3314 | 1108 |
] ifFalse:[ |
4610 | 1109 |
list := aCollection. |
3314 | 1110 |
]. |
0 | 1111 |
|
864 | 1112 |
nonStringsBefore := includesNonStrings. |
1608
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
1113 |
fontHeightBefore := fontHeight. |
864 | 1114 |
includesNonStrings := false. |
1115 |
||
152 | 1116 |
list notNil ifTrue:[ |
4610 | 1117 |
expand ifTrue:[ |
1118 |
self expandTabs |
|
1119 |
] ifFalse:[ |
|
1120 |
scan ifTrue:[ |
|
1121 |
includesNonStrings := list contains:[:e | e isString not]. |
|
1122 |
] ifFalse:[ |
|
4747 | 1123 |
includesNonStrings := nonStringsIfNoScan ? nonStringsBefore |
4610 | 1124 |
] |
1125 |
]. |
|
0 | 1126 |
]. |
1608
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
1127 |
(includesNonStrings ~~ nonStringsBefore) ifTrue:[ |
4610 | 1128 |
self getFontParameters. |
1608
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
1129 |
]. |
152 | 1130 |
|
125 | 1131 |
widthOfWidestLine := nil. "/ i.e. unknown |
0 | 1132 |
oldFirst := firstLineShown. |
2429
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2427
diff
changeset
|
1133 |
oldLeft := viewOrigin x. |
2128
33830e4f998f
added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents:
2090
diff
changeset
|
1134 |
|
2199
455cd1c65af1
auto-scroll (when fetching list from model) to bottom fixed
Claus Gittinger <cg@exept.de>
parents:
2188
diff
changeset
|
1135 |
(includesNonStrings ~~ nonStringsBefore) ifTrue:[ |
4610 | 1136 |
self computeNumberOfLinesShown. |
2199
455cd1c65af1
auto-scroll (when fetching list from model) to bottom fixed
Claus Gittinger <cg@exept.de>
parents:
2188
diff
changeset
|
1137 |
]. |
2429
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2427
diff
changeset
|
1138 |
|
4747 | 1139 |
scrollLocked ifFalse:[ |
1140 |
newLeftOffset := viewOrigin x. |
|
1141 |
scrollToTop ifTrue:[ |
|
1142 |
firstLineShown := 1. |
|
4610 | 1143 |
newLeftOffset := 0. |
4747 | 1144 |
] ifFalse:[ |
1145 |
scrollToEnd ifTrue:[ |
|
1146 |
firstLineShown := (list size - nFullLinesShown + 1) max:1. |
|
1147 |
newLeftOffset := 0. |
|
1148 |
] |
|
4610 | 1149 |
]. |
4747 | 1150 |
newLeftOffset > 0 ifTrue:[ |
1151 |
wText := self widthOfContents. |
|
1152 |
(viewOrigin x + self innerWidth) > wText ifTrue:[ |
|
1153 |
newLeftOffset := (wText - self innerWidth) max:0. |
|
1154 |
]. |
|
1155 |
]. |
|
1156 |
newLeftOffset ~= oldLeft ifTrue:[ |
|
1157 |
viewOrigin := newLeftOffset @ viewOrigin y. |
|
1158 |
]. |
|
2429
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2427
diff
changeset
|
1159 |
]. |
837 | 1160 |
|
38 | 1161 |
realized ifTrue:[ |
4610 | 1162 |
self contentsChanged. |
4747 | 1163 |
scrollLocked ifFalse:[ |
1164 |
" |
|
1165 |
don't use scroll here to avoid double redraw |
|
1166 |
" |
|
1167 |
viewOrigin := viewOrigin isNil ifTrue:[0@0] ifFalse:[(viewOrigin x) @ 0]. |
|
5023
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
1168 |
gc transformation:nil. |
4747 | 1169 |
|
1170 |
oldFirst ~~ firstLineShown ifTrue:[ |
|
1171 |
self originChanged:0 @ ((oldFirst - 1) * fontHeight negated). |
|
1172 |
]. |
|
4610 | 1173 |
]. |
4747 | 1174 |
doRedraw ifTrue:[ |
1175 |
shown ifTrue:[ |
|
1176 |
self invalidate. |
|
1177 |
] |
|
4610 | 1178 |
] |
0 | 1179 |
] |
153 | 1180 |
|
3314 | 1181 |
"Modified: / 30-08-1995 / 19:07:13 / claus" |
1182 |
"Created: / 05-06-1997 / 12:40:06 / cg" |
|
1183 |
"Modified: / 04-07-2006 / 19:12:39 / fm" |
|
3339 | 1184 |
"Modified: / 22-08-2006 / 11:59:56 / cg" |
0 | 1185 |
! |
1186 |
||
2812 | 1187 |
listAt:lineNr |
1188 |
"given a lineNumber, return the corresponding string |
|
1189 |
This is used for accessing; i.e. for non-string entries, this |
|
1190 |
returns the corresponding string." |
|
1191 |
||
1192 |
|l| |
|
1193 |
||
1194 |
list isNil ifTrue:[^ nil]. |
|
1195 |
(lineNr between:1 and:self size) ifFalse:[^ nil]. |
|
1196 |
l := self at:lineNr. |
|
1197 |
l isNil ifTrue:[^ l]. |
|
1198 |
^ self visibleStringFrom:l "/ l asString |
|
1199 |
||
1200 |
"Modified: 7.9.1995 / 15:54:59 / claus" |
|
1201 |
! |
|
1202 |
||
2233
ea4d220ac381
added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
1203 |
removeFromIndex:startLineNr toIndex:endLineNr |
ea4d220ac381
added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
1204 |
"delete some lines" |
ea4d220ac381
added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
1205 |
|
3442
418b14cb6a78
do not always flush widthOfWidestLine info.
Claus Gittinger <cg@exept.de>
parents:
3437
diff
changeset
|
1206 |
|nLines widestLineRemoved| |
2233
ea4d220ac381
added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
1207 |
|
ea4d220ac381
added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
1208 |
list isNil ifTrue:[^ self]. |
ea4d220ac381
added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
1209 |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1210 |
widestLineRemoved := self widthOfWidestLineBetween:startLineNr and:endLineNr. |
2233
ea4d220ac381
added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
1211 |
list removeFromIndex:startLineNr toIndex:(endLineNr min:list size). |
ea4d220ac381
added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
1212 |
|
3442
418b14cb6a78
do not always flush widthOfWidestLine info.
Claus Gittinger <cg@exept.de>
parents:
3437
diff
changeset
|
1213 |
widthOfWidestLine == widestLineRemoved ifTrue:[ |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1214 |
widthOfWidestLine := nil. "/ i.e. unknown |
3442
418b14cb6a78
do not always flush widthOfWidestLine info.
Claus Gittinger <cg@exept.de>
parents:
3437
diff
changeset
|
1215 |
]. |
2233
ea4d220ac381
added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
1216 |
self textChanged. |
ea4d220ac381
added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
1217 |
|
2237
43f0318a830e
scroll pixel bug; removeFromIndex:toIndex: redraw bug.
Claus Gittinger <cg@exept.de>
parents:
2233
diff
changeset
|
1218 |
((startLineNr <= self lastLineShown) |
43f0318a830e
scroll pixel bug; removeFromIndex:toIndex: redraw bug.
Claus Gittinger <cg@exept.de>
parents:
2233
diff
changeset
|
1219 |
and:[endLineNr >= firstLineShown]) ifTrue:[ |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1220 |
startLineNr to:self lastLineShown do:[:eachLine | |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1221 |
self invalidateLine:eachLine |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1222 |
]. |
2233
ea4d220ac381
added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
1223 |
]. |
ea4d220ac381
added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
1224 |
|
ea4d220ac381
added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
1225 |
nLines := list size. |
ea4d220ac381
added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
1226 |
(firstLineShown >= nLines) ifTrue:[ |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1227 |
self makeLineVisible:nLines |
2233
ea4d220ac381
added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
1228 |
]. |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1229 |
self enqueueDelayedContentsChangedNotification. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1230 |
|
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1231 |
"Modified: / 25-07-2012 / 12:01:59 / cg" |
2233
ea4d220ac381
added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
1232 |
! |
ea4d220ac381
added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
1233 |
|
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
|
1234 |
removeIndex:lineNr |
587
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
1235 |
"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
|
1236 |
|
1453 | 1237 |
|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
|
1238 |
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
|
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 |
(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
|
1241 |
|
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
|
1242 |
" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1243 |
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
|
1244 |
" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1245 |
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
|
1246 |
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
|
1247 |
visLine notNil ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1248 |
w := self widthForScrollBetween:lineNr and:(firstLineShown + nLinesShown). |
1433 | 1249 |
"/ x := textStartLeft. |
1250 |
"/ CLAUS fixes leftOver selection pixels |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1251 |
w := w + leftMargin. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1252 |
x := margin. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1253 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1254 |
srcY := topMargin + (visLine * fontHeight). |
1453 | 1255 |
"/ h := ((nLinesShown - visLine) * fontHeight). |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1256 |
h := (height - margin - srcY). |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1257 |
h > 0 ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1258 |
self catchExpose. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1259 |
self |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1260 |
copyFrom:self |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1261 |
x:x y:srcY |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1262 |
toX:x y:(srcY - fontHeight) |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1263 |
width:w height:h |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1264 |
async:true. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1265 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1266 |
self redrawVisibleLine:nFullLinesShown. |
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 |
redraw last partial line - if any |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1269 |
" |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1270 |
(nFullLinesShown ~~ nLinesShown) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1271 |
self redrawVisibleLine:nLinesShown |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1272 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1273 |
h > 0 ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1274 |
self waitForExpose |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1275 |
]. |
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
|
1276 |
] |
587
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
1277 |
|
1460
b9929a029249
dont bitBlt if height is <= 0
Claus Gittinger <cg@exept.de>
parents:
1458
diff
changeset
|
1278 |
"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
|
1279 |
! |
75b8fb924904
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 |
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
|
1282 |
"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
|
1283 |
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
|
1284 |
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
|
1285 |
|
75b8fb924904
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 |
(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
|
1287 |
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
|
1288 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1289 |
lineNr < firstLineShown ifTrue:[ |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1290 |
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
|
1291 |
]. |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1292 |
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
|
1293 |
^ true |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1294 |
|
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1295 |
"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
|
1296 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1297 |
|
2248
c6cb654bb807
added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
1298 |
replaceFrom:startLineNr to:endLineNr with:aCollection startingAt:replStartIndex |
c6cb654bb807
added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
1299 |
"replace some lines" |
c6cb654bb807
added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
1300 |
|
3198 | 1301 |
list isNil ifTrue:[ |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1302 |
list := OrderedCollection new. |
3198 | 1303 |
]. |
2248
c6cb654bb807
added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
1304 |
list replaceFrom:startLineNr to:endLineNr with:aCollection startingAt:replStartIndex. |
c6cb654bb807
added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
1305 |
|
c6cb654bb807
added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
1306 |
widthOfWidestLine := nil. "/ i.e. unknown |
c6cb654bb807
added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
1307 |
self textChanged. |
c6cb654bb807
added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
1308 |
|
c6cb654bb807
added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
1309 |
((startLineNr <= self lastLineShown) |
c6cb654bb807
added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
1310 |
and:[endLineNr >= firstLineShown]) ifTrue:[ |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1311 |
self invalidate. |
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 |
|
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1314 |
self enqueueDelayedContentsChangedNotification. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1315 |
|
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1316 |
"Modified: / 25-07-2012 / 12:02:15 / cg" |
2248
c6cb654bb807
added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
1317 |
! |
c6cb654bb807
added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
1318 |
|
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
|
1319 |
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
|
1320 |
"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
|
1321 |
dont change position (i.e. do not scroll). |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1322 |
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
|
1323 |
(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
|
1324 |
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
|
1325 |
|
2891 | 1326 |
|l| |
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 |
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
|
1329 |
l notNil ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1330 |
l isString ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1331 |
l := l asStringCollection |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1332 |
] |
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
|
1333 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1334 |
self setList:l. |
267
cc8e122f7dbe
Reset cache widthOfLongestLine in setList:, also reposition if contents fits
Stefan Vogel <sv@exept.de>
parents:
249
diff
changeset
|
1335 |
|
cc8e122f7dbe
Reset cache widthOfLongestLine in setList:, also reposition if contents fits
Stefan Vogel <sv@exept.de>
parents:
249
diff
changeset
|
1336 |
"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
|
1337 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1338 |
|
105 | 1339 |
setList:aCollection |
1340 |
"set the contents (a collection of strings); |
|
153 | 1341 |
do not change position (i.e. do not scroll). |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1342 |
This can be used to update a self-changing list |
105 | 1343 |
(for example: a file list being shown, without disturbing user too much)" |
1344 |
||
1345 |
^ self setList:aCollection expandTabs:true |
|
0 | 1346 |
! |
1347 |
||
153 | 1348 |
setList:aCollection expandTabs:expandTabs |
1349 |
"set the contents (a collection of strings); |
|
1350 |
do not change position (i.e. do not scroll). |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1351 |
This can be used to update a self-changing list |
153 | 1352 |
(for example: a file list being shown, without disturbing the user too much)" |
1353 |
||
1497
5b55a84e2258
added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents:
1494
diff
changeset
|
1354 |
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
|
1355 |
|
5b55a84e2258
added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents:
1494
diff
changeset
|
1356 |
"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
|
1357 |
! |
5b55a84e2258
added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents:
1494
diff
changeset
|
1358 |
|
5b55a84e2258
added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents:
1494
diff
changeset
|
1359 |
setList:aCollection expandTabs:expandTabs redraw:doRedraw |
5b55a84e2258
added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents:
1494
diff
changeset
|
1360 |
"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
|
1361 |
do not change position (i.e. do not scroll). |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1362 |
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
|
1363 |
(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
|
1364 |
|
4747 | 1365 |
self |
1366 |
setList:aCollection expandTabs:expandTabs scanForNonStrings:true includesNonStrings:nil |
|
1367 |
redraw:doRedraw |
|
1368 |
! |
|
1369 |
||
1370 |
setList:aCollection expandTabs:expandTabs scanForNonStrings:scan includesNonStrings:nonStringsIfNoScan redraw:doRedraw |
|
1371 |
"set the contents (a collection of strings); |
|
1372 |
do not change position (i.e. do not scroll). |
|
1373 |
This can be used to update a self-changing list |
|
1374 |
(for example: a file list being shown, without disturbing the user too much). |
|
1375 |
TODO: this stinks: most of the code is the same as in #list:expandTabs:... |
|
1376 |
needs a refactoring" |
|
1377 |
||
1378 |
|prev| |
|
1379 |
||
1380 |
prev := scrollLocked. |
|
1381 |
[ |
|
1382 |
scrollLocked := false. |
|
1383 |
self |
|
1384 |
list:aCollection |
|
1385 |
expandTabs:expandTabs |
|
1386 |
scanForNonStrings:scan |
|
1387 |
includesNonStrings:nonStringsIfNoScan |
|
1388 |
redraw:doRedraw |
|
1389 |
] ensure:[ |
|
1390 |
scrollLocked := prev |
|
1608
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
1391 |
]. |
4747 | 1392 |
"/ |
1393 |
"/ |
|
1394 |
"/"/ scrollLocked ifTrue:[ |
|
1395 |
"/"/ self setList:newText expandTabs:expandTabsWhenUpdating |
|
1396 |
"/"/ ] ifFalse:[ |
|
1397 |
"/ self list:newText expandTabs:expandTabsWhenUpdating scanForNonStrings:expandTabsWhenUpdating |
|
1398 |
"/"/ ] |
|
1399 |
"/ |
|
1400 |
"/ |oldFirst nonStringsBefore| |
|
1401 |
"/ |
|
1402 |
"/ (aCollection isNil and:[list isNil]) ifTrue:[ |
|
1403 |
"/ "no change" |
|
1404 |
"/ ^ self |
|
1405 |
"/ ]. |
|
1406 |
"/ |
|
1407 |
"/ list := aCollection. |
|
1408 |
"/ |
|
1409 |
"/ nonStringsBefore := includesNonStrings. |
|
1410 |
"/ includesNonStrings := false. |
|
1411 |
"/ |
|
1412 |
"/ list notNil ifTrue:[ |
|
1413 |
"/ expandTabs ifTrue:[ |
|
1414 |
"/ self expandTabs |
|
1415 |
"/ ] ifFalse:[ |
|
1416 |
"/ scan ifTrue:[ |
|
1417 |
"/ includesNonStrings := (list findFirst:[:e | e isString not]) ~~ 0. |
|
1418 |
"/ ] ifFalse:[ |
|
1419 |
"/ includesNonStrings := nonStringsIfNoScan ? nonStringsBefore |
|
1420 |
"/ ] |
|
1421 |
"/ ]. |
|
1422 |
"/ ]. |
|
1423 |
"/ (includesNonStrings ~~ nonStringsBefore) ifTrue:[ |
|
1424 |
"/ self getFontParameters. |
|
1425 |
"/ self computeNumberOfLinesShown. |
|
1426 |
"/ ]. |
|
1427 |
"/ |
|
1428 |
"/ "/ new: reposition horizontally if too big |
|
1429 |
"/ widthOfWidestLine := nil. "/ i.e. unknown |
|
1430 |
"/ innerWidth >= self widthOfContents ifTrue:[ |
|
1431 |
"/ viewOrigin := 0 @ viewOrigin y. |
|
1432 |
"/ ]. |
|
1433 |
"/ self contentsChanged. |
|
1434 |
"/ |
|
1435 |
"/ "/ new: reposition vertically if too big |
|
1436 |
"/ (firstLineShown + nFullLinesShown) > self size ifTrue:[ |
|
1437 |
"/ oldFirst := firstLineShown. |
|
1438 |
"/ firstLineShown := self size - nFullLinesShown + 1. |
|
1439 |
"/ firstLineShown < 1 ifTrue:[firstLineShown := 1]. |
|
1440 |
"/ oldFirst ~= firstLineShown ifTrue:[ |
|
1441 |
"/ viewOrigin y:((firstLineShown - 1) * fontHeight). |
|
1442 |
"/ self originChanged:0 @ ((oldFirst - 1) negated * fontHeight). |
|
1443 |
"/ shown ifTrue:[ |
|
1444 |
"/ self clearView. |
|
1445 |
"/ ] |
|
1446 |
"/ ] |
|
1447 |
"/ ]. |
|
1448 |
"/ |
|
1449 |
"/ (shown and:[doRedraw]) ifTrue:[ |
|
1450 |
"/ self invalidate |
|
1451 |
"/ "/ self redrawFromVisibleLine:1 to:nLinesShown |
|
1452 |
"/ ] |
|
1453 |
"/ |
|
1454 |
"/ "Modified: / 18.12.1995 / 23:27:54 / stefan" |
|
1455 |
"/ "Created: / 22.4.1998 / 11:11:51 / cg" |
|
1456 |
"/ "Modified: / 26.7.1998 / 13:46:49 / cg" |
|
153 | 1457 |
! |
1458 |
||
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
|
1459 |
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
|
1460 |
"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
|
1461 |
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
|
1462 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1463 |
^ list size. |
0 | 1464 |
! |
1465 |
||
919 | 1466 |
stringAtLine:lineNr from:col1 to:col2 |
1467 |
"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
|
1468 |
including col2. |
919 | 1469 |
The lineNr and colNr arguments start at 1, for the top-left character. |
1470 |
Fills the string with space characters at the right. |
|
2707 | 1471 |
(i.e. beyond the end of the line or below the last line)" |
919 | 1472 |
|
1473 |
|line len s| |
|
1474 |
||
1475 |
len := col2 - col1 + 1. |
|
1476 |
list notNil ifTrue:[ |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1477 |
line := self listAt:lineNr. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1478 |
line notNil ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1479 |
(line size >= col1) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1480 |
s := line copyFrom:col1. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1481 |
s size < len ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1482 |
^ s paddedTo:len |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1483 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1484 |
^ s copyTo:len |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1485 |
] |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1486 |
] |
919 | 1487 |
]. |
1488 |
^ String new:len withAll:Character space |
|
1489 |
||
1490 |
"Created: 7.1.1997 / 19:58:43 / cg" |
|
1491 |
! |
|
1492 |
||
2427
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
1493 |
textFromCharacterPosition:charPos1 to:charPos2 |
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
1494 |
"return some text as a collection of (line-)strings." |
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 |
|line1 col1 line2 col2| |
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
1497 |
|
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
1498 |
line1 := self lineOfCharacterPosition:charPos1. |
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
1499 |
col1 := charPos1 - (self characterPositionOfLine:line1 col:1) + 1. |
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 |
line2 := self lineOfCharacterPosition:charPos2. |
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
1502 |
col2 := charPos2 - (self characterPositionOfLine:line2 col:1) + 1. |
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
1503 |
|
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
1504 |
^ self textFromLine:line1 col:col1 toLine:line2 col:col2. |
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
1505 |
! |
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
1506 |
|
2158
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1507 |
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
|
1508 |
"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
|
1509 |
|
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1510 |
|text sz index last| |
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1511 |
|
4422
9954fb1dc0a4
changed: #textFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
4403
diff
changeset
|
1512 |
startLine isNil ifTrue:[^ nil]. |
9954fb1dc0a4
changed: #textFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
4403
diff
changeset
|
1513 |
endLine isNil ifTrue:[^ nil]. |
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 |
(startLine == endLine) ifTrue:[ |
4422
9954fb1dc0a4
changed: #textFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
4403
diff
changeset
|
1516 |
"part of a line" |
9954fb1dc0a4
changed: #textFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
4403
diff
changeset
|
1517 |
^ 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
|
1518 |
]. |
4422
9954fb1dc0a4
changed: #textFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
4403
diff
changeset
|
1519 |
|
2158
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1520 |
sz := endLine - startLine + 1. |
5392 | 1521 |
sz < 1 ifTrue:[^ '']. |
2687 | 1522 |
|
2158
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1523 |
text := StringCollection new:sz. |
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1524 |
|
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1525 |
"get 1st and last (possibly) partial lines" |
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1526 |
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
|
1527 |
endCol == 0 ifTrue:[ |
4422
9954fb1dc0a4
changed: #textFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
4403
diff
changeset
|
1528 |
last := '' |
2158
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1529 |
] ifFalse:[ |
4422
9954fb1dc0a4
changed: #textFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
4403
diff
changeset
|
1530 |
last := self listAt:endLine to:endCol. |
2158
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1531 |
]. |
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1532 |
text at:sz put:last. |
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1533 |
|
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1534 |
"get bulk of text" |
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1535 |
index := 2. |
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1536 |
(startLine + 1) to:(endLine - 1) do:[:lineNr | |
4422
9954fb1dc0a4
changed: #textFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
4403
diff
changeset
|
1537 |
text at:index put:(self listAt:lineNr). |
9954fb1dc0a4
changed: #textFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
4403
diff
changeset
|
1538 |
index := index + 1 |
2158
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1539 |
]. |
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1540 |
^ text |
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1541 |
|
4422
9954fb1dc0a4
changed: #textFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
4403
diff
changeset
|
1542 |
"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
|
1543 |
! |
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1544 |
|
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
|
1545 |
withoutRedrawAt:index put:aString |
2224
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
1546 |
"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
|
1547 |
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
|
1548 |
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
|
1549 |
means at the end." |
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
1550 |
|
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
1551 |
|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
|
1552 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1553 |
self checkForExistingLine:index. |
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 |
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
|
1556 |
list at:index put:aString. |
2180
d208b77444a7
must set modified flag in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents:
2158
diff
changeset
|
1557 |
oldLine ~= aString ifTrue:[ |
4751 | 1558 |
self textChanged |
2180
d208b77444a7
must set modified flag in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents:
2158
diff
changeset
|
1559 |
]. |
d208b77444a7
must set modified flag in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents:
2158
diff
changeset
|
1560 |
|
1608
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
1561 |
didIncludeNonStrings := includesNonStrings. |
105 | 1562 |
includesNonStrings ifFalse:[ |
5111 | 1563 |
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
|
1564 |
] ifTrue:[ |
5111 | 1565 |
(aString isNil or:[(aString isSingleByteString)]) ifTrue:[ |
1566 |
includesNonStrings := list contains:[:l | l notNil and:[(l isSingleByteString) not]]. |
|
4751 | 1567 |
] |
105 | 1568 |
]. |
851
b9d71ccdefaa
care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents:
837
diff
changeset
|
1569 |
|
1608
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
1570 |
includesNonStrings ~~ didIncludeNonStrings ifTrue:[ |
4751 | 1571 |
self getFontParameters. |
1572 |
self computeNumberOfLinesShown |
|
1608
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
1573 |
]. |
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
1574 |
|
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
|
1575 |
widthOfWidestLine notNil ifTrue:[ |
4751 | 1576 |
self recomputeWidthOfWidestLineFor:aString old:oldLine. |
1963
aa5d0f63db19
notify about contentsChange in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents:
1938
diff
changeset
|
1577 |
]. |
634
1ca770b2c494
handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
1578 |
|
1608
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
1579 |
"Modified: / 26.7.1998 / 13:00:14 / cg" |
105 | 1580 |
! ! |
1581 |
||
2455 | 1582 |
!ListView methodsFor:'accessing-look'! |
1583 |
||
1584 |
backgroundColor |
|
1585 |
"return the background color" |
|
1586 |
||
1587 |
^ bgColor |
|
1588 |
! |
|
1589 |
||
1590 |
backgroundColor:aColor |
|
1591 |
"set the background color of the contents" |
|
1592 |
||
1593 |
bgColor ~~ aColor ifTrue:[ |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1594 |
bgColor := aColor. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1595 |
self viewBackground:bgColor. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1596 |
self invalidate "/ clear; redraw |
2455 | 1597 |
] |
1598 |
||
1599 |
"Modified: 3.5.1997 / 10:27:40 / cg" |
|
1600 |
! |
|
1601 |
||
1602 |
font:aFont |
|
1603 |
"set the font for all shown text. |
|
1604 |
Redraws everything. |
|
1605 |
CAVEAT: with the addition of Text objects, |
|
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1606 |
this method is going to be obsoleted by a textStyle |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1607 |
method, which allows specific control over |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1608 |
normalFont/boldFont/italicFont parameters." |
2455 | 1609 |
|
1610 |
aFont isNil ifTrue:[ |
|
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1611 |
^ self error:'nil font' mayProceed:true |
2455 | 1612 |
]. |
5023
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
1613 |
gc font ~~ aFont ifTrue:[ |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1614 |
preferredExtent := nil. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1615 |
widthOfWidestLine := nil. "/ i.e. unknown |
5023
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
1616 |
super font:aFont. |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1617 |
self getFontParameters. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1618 |
realized ifTrue:[ |
5023
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
1619 |
(gc font graphicsDevice == gc device) ifTrue:[ |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1620 |
self computeNumberOfLinesShown. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1621 |
shown ifTrue:[ |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1622 |
self redrawFromVisibleLine:1 to:nLinesShown |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1623 |
] |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1624 |
]. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1625 |
self enqueueDelayedContentsChangedNotification |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1626 |
] |
2455 | 1627 |
] |
1628 |
||
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1629 |
"Modified: / 25-07-2012 / 12:01:36 / cg" |
2455 | 1630 |
! |
1631 |
||
1632 |
fontHeight:pixels |
|
4830 | 1633 |
"set the lines height - that's the number of pixels, |
2455 | 1634 |
by which lines are vertically separated." |
1635 |
||
1636 |
fontHeight ~~ pixels ifTrue:[ |
|
4830 | 1637 |
fontHeight := pixels. |
2455 | 1638 |
] |
1639 |
||
1640 |
"Created: 17.4.1997 / 01:41:33 / cg" |
|
1641 |
! |
|
1642 |
||
1643 |
foregroundColor |
|
1644 |
"return the foreground color" |
|
1645 |
||
1646 |
^ fgColor |
|
1647 |
! |
|
1648 |
||
1649 |
foregroundColor:aColor |
|
1650 |
"set the foreground color" |
|
1651 |
||
1652 |
fgColor ~~ aColor ifTrue:[ |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1653 |
fgColor := aColor. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1654 |
self invalidate |
2455 | 1655 |
] |
1656 |
||
1657 |
"Modified: 29.5.1996 / 16:19:02 / cg" |
|
1658 |
! |
|
1659 |
||
1660 |
foregroundColor:color1 backgroundColor:color2 |
|
1661 |
"set both foreground and background colors" |
|
1662 |
||
1663 |
((fgColor ~~ color1) or:[bgColor ~~ color2]) ifTrue:[ |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1664 |
fgColor := color1. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1665 |
bgColor := color2. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1666 |
self invalidate |
2455 | 1667 |
] |
1668 |
||
1669 |
"Modified: 29.5.1996 / 16:19:05 / cg" |
|
1670 |
! |
|
1671 |
||
1672 |
innerHorizontalMargin |
|
1673 |
"return the margin between the left border and the 1st col" |
|
1674 |
||
1675 |
^ leftMargin |
|
1676 |
||
1677 |
"Created: 16.1.1996 / 19:28:23 / cg" |
|
1678 |
! |
|
1679 |
||
1680 |
innerVerticalMargin |
|
1681 |
"return the margin between the top border and the 1st line" |
|
1682 |
||
1683 |
^ topMargin |
|
1684 |
||
1685 |
"Created: 16.1.1996 / 19:28:00 / cg" |
|
1686 |
! |
|
1687 |
||
1688 |
leftMargin |
|
1689 |
"return the margin to left of 1st col" |
|
1690 |
||
1691 |
^ leftMargin |
|
1692 |
! |
|
1693 |
||
1694 |
leftMargin:aNumber |
|
1695 |
"set the margin between the left border and the 1st col" |
|
1696 |
||
1697 |
leftMargin := aNumber. |
|
1698 |
textStartLeft := aNumber + margin. |
|
1699 |
innerWidth := width - aNumber - margin |
|
1700 |
||
1701 |
"Modified: 28.2.1996 / 19:32:55 / cg" |
|
1702 |
! |
|
1703 |
||
1704 |
level:aNumber |
|
1705 |
"set the 3D level - caught here to update text-position variables |
|
1706 |
(which avoids many computations later)" |
|
1707 |
||
1708 |
|newMargin| |
|
1709 |
||
1710 |
aNumber ~~ level ifTrue:[ |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1711 |
newMargin := aNumber abs. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1712 |
textStartLeft := leftMargin + newMargin. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1713 |
textStartTop := topMargin + newMargin. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1714 |
innerWidth := width - textStartLeft - newMargin. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1715 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1716 |
super level:aNumber. |
2455 | 1717 |
] |
1718 |
||
1719 |
"Modified: 11.8.1997 / 02:59:15 / cg" |
|
1720 |
! |
|
1721 |
||
4668 | 1722 |
lineSpacing |
1723 |
"get the lineSpacing - that's an additional number of pixels, |
|
1724 |
by which lines are vertically separated." |
|
1725 |
||
1726 |
^ lineSpacing |
|
1727 |
! |
|
1728 |
||
2455 | 1729 |
lineSpacing:pixels |
4668 | 1730 |
"set the lineSpacing - that's an additional number of pixels, |
2455 | 1731 |
by which lines are vertically separated." |
1732 |
||
1733 |
lineSpacing ~~ pixels ifTrue:[ |
|
4668 | 1734 |
lineSpacing := pixels. |
1735 |
self getFontParameters. |
|
2455 | 1736 |
] |
1737 |
||
1738 |
"Modified: 22.5.1996 / 12:22:29 / cg" |
|
1739 |
! |
|
1740 |
||
1741 |
partialLines:aBoolean |
|
1742 |
"allow/disallow display of a last partial line" |
|
1743 |
||
1744 |
partialLines := aBoolean. |
|
1745 |
self computeNumberOfLinesShown |
|
1746 |
! |
|
1747 |
||
1748 |
topMargin:aNumber |
|
1749 |
"set the margin between the top border and the 1st line" |
|
1750 |
||
1751 |
topMargin := aNumber. |
|
1752 |
textStartTop := topMargin + margin. |
|
1753 |
! |
|
1754 |
||
1755 |
viewBackground:aColor |
|
1756 |
super viewBackground:aColor. |
|
1757 |
self isTextView ifFalse:[ |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1758 |
self backgroundColor:aColor |
2455 | 1759 |
]. |
1760 |
! ! |
|
1761 |
||
118 | 1762 |
!ListView methodsFor:'accessing-mvc'! |
1763 |
||
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
|
1764 |
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
|
1765 |
"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
|
1766 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1767 |
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
|
1768 |
aDictionary at:#listMessage put:listMsg |
118 | 1769 |
! |
1770 |
||
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1771 |
listMessage |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1772 |
"return the listMsg selector; |
125 | 1773 |
if non-nil, this is the message sent to the model (if any) to aquire |
1774 |
a new text upon change of the aspect. |
|
120 | 1775 |
This defaults to the aspect-selector." |
118 | 1776 |
|
125 | 1777 |
^ listMsg |
1778 |
! |
|
1779 |
||
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1780 |
listMessage:aSymbol |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1781 |
"ST-80 compatibility: set the listMsg selector; |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1782 |
if non-nil, this will be sent to the model (if any) to aquire a |
125 | 1783 |
new text upon change of the aspect. |
1784 |
This defaults to the aspect-selector." |
|
1785 |
||
1786 |
listMsg := aSymbol. |
|
120 | 1787 |
! |
1788 |
||
907
ea81777689f1
Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents:
903
diff
changeset
|
1789 |
model:aModel |
5023
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
1790 |
"define the receivers model, from which the text is |
907
ea81777689f1
Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents:
903
diff
changeset
|
1791 |
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
|
1792 |
changes." |
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 |
super model:aModel. |
ea81777689f1
Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents:
903
diff
changeset
|
1795 |
self getListFromModel |
ea81777689f1
Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents:
903
diff
changeset
|
1796 |
|
ea81777689f1
Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents:
903
diff
changeset
|
1797 |
"Created: 31.12.1996 / 14:56:43 / stefan" |
ea81777689f1
Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents:
903
diff
changeset
|
1798 |
! |
ea81777689f1
Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents:
903
diff
changeset
|
1799 |
|
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
|
1800 |
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
|
1801 |
"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
|
1802 |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1803 |
^ 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
|
1804 |
! |
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 |
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
|
1807 |
"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
|
1808 |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1809 |
^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
|
1810 |
! |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1811 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1812 |
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
|
1813 |
"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
|
1814 |
|
4015
8647dad37cb0
comment/format in: #on:aspect:change:list:menu:
Claus Gittinger <cg@exept.de>
parents:
3869
diff
changeset
|
1815 |
aspectSymbol notNil ifTrue:[ |
8647dad37cb0
comment/format in: #on:aspect:change:list:menu:
Claus Gittinger <cg@exept.de>
parents:
3869
diff
changeset
|
1816 |
aspectMsg := aspectSymbol. |
8647dad37cb0
comment/format in: #on:aspect:change:list:menu:
Claus Gittinger <cg@exept.de>
parents:
3869
diff
changeset
|
1817 |
listMsg isNil ifTrue:[ |
8647dad37cb0
comment/format in: #on:aspect:change:list:menu:
Claus Gittinger <cg@exept.de>
parents:
3869
diff
changeset
|
1818 |
listMsg := aspectSymbol |
8647dad37cb0
comment/format in: #on:aspect:change:list:menu:
Claus Gittinger <cg@exept.de>
parents:
3869
diff
changeset
|
1819 |
] |
8647dad37cb0
comment/format in: #on:aspect:change:list:menu:
Claus Gittinger <cg@exept.de>
parents:
3869
diff
changeset
|
1820 |
]. |
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
|
1821 |
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
|
1822 |
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
|
1823 |
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
|
1824 |
self model:aModel. |
909
be8e88881f4d
dont clear listMessage in #on:aspect:...
Claus Gittinger <cg@exept.de>
parents:
907
diff
changeset
|
1825 |
|
be8e88881f4d
dont clear listMessage in #on:aspect:...
Claus Gittinger <cg@exept.de>
parents:
907
diff
changeset
|
1826 |
"Modified: 2.1.1997 / 16:11:16 / cg" |
105 | 1827 |
! |
1828 |
||
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
|
1829 |
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
|
1830 |
"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
|
1831 |
|
75b8fb924904
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 |
^ self on:aModel aspect:aspectSymbol change:changeSymbol list:nil menu:menuSymbol |
0 | 1833 |
! |
1834 |
||
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1835 |
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
|
1836 |
"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
|
1837 |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1838 |
^ 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
|
1839 |
! |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1840 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1841 |
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
|
1842 |
"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
|
1843 |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1844 |
^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
|
1845 |
! ! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1846 |
|
2227 | 1847 |
!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
|
1848 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1849 |
update:something with:aParameter from:changedObject |
2322 | 1850 |
|idx| |
1851 |
||
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
|
1852 |
changedObject == model ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1853 |
model isList ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1854 |
list ~~ model ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1855 |
something == #at: ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1856 |
idx := aParameter isCollection ifTrue:[aParameter at:1] |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1857 |
ifFalse:[aParameter]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1858 |
^ self at:aParameter put:(model at:idx). |
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 == #insert: ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1861 |
(list size + 1) >= aParameter ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1862 |
^ self add:(model at:aParameter) beforeIndex: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 |
something == #remove: ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1866 |
list size >= aParameter ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1867 |
^ self removeIndex:aParameter |
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 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1871 |
self getListFromModel. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1872 |
^ self |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1873 |
]. |
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 |
(aspectMsg notNil |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1876 |
and:[something == aspectMsg]) ifTrue:[ |
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 isNil ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1881 |
"/ model changed (not more information) |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1882 |
self getListFromModel. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1883 |
^ self |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1884 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1885 |
something == #size ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1886 |
self getListFromModelScroll:false. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1887 |
^ self |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1888 |
]. |
0 | 1889 |
]. |
3425
883607c8a0df
care for listChannel changes
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
1890 |
changedObject == listChannel ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1891 |
self getListFromModel. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1892 |
^ self |
3425
883607c8a0df
care for listChannel changes
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
1893 |
]. |
883607c8a0df
care for listChannel changes
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
1894 |
|
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
|
1895 |
^ 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
|
1896 |
|
3425
883607c8a0df
care for listChannel changes
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
1897 |
"Modified: / 08-11-2006 / 19:40:29 / cg" |
0 | 1898 |
! ! |
1899 |
||
105 | 1900 |
!ListView methodsFor:'drawing'! |
1901 |
||
1902 |
drawFromVisibleLine:startVisLineNr to:endVisLineNr with:fg and:bg |
|
1903 |
"draw a visible line range in fg/bg" |
|
1904 |
||
1905 |
|y "{ Class: SmallInteger }" |
|
1906 |
x "{ Class: SmallInteger }" |
|
1907 |
startLine "{ Class: SmallInteger }" |
|
1908 |
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
|
1909 |
listSize e sH l| |
105 | 1910 |
|
1911 |
y := self yOfVisibleLine:startVisLineNr. |
|
394
795f293f8520
fixed debris-leftover in scrollDown
Claus Gittinger <cg@exept.de>
parents:
392
diff
changeset
|
1912 |
sH := lineSpacing // 2. |
795f293f8520
fixed debris-leftover in scrollDown
Claus Gittinger <cg@exept.de>
parents:
392
diff
changeset
|
1913 |
|
1700
3538310c2724
fixed widthOfContents with variable fonts (win32);
Claus Gittinger <cg@exept.de>
parents:
1699
diff
changeset
|
1914 |
backgroundAlreadyClearedColor == bg ifFalse:[ |
4641 | 1915 |
self paint:bg. |
1916 |
self fillRectangleX:margin |
|
1917 |
y:y-sH |
|
1918 |
width:(width - (margin * 2)) |
|
1919 |
height:(endVisLineNr - startVisLineNr + 1) * fontHeight + (lineSpacing - sH). |
|
1700
3538310c2724
fixed widthOfContents with variable fonts (win32);
Claus Gittinger <cg@exept.de>
parents:
1699
diff
changeset
|
1920 |
]. |
105 | 1921 |
list isNil ifTrue:[^ self]. |
1922 |
||
1923 |
y := y + fontAscent. |
|
1924 |
listSize := self size. |
|
1925 |
||
1926 |
startLine := startVisLineNr + firstLineShown - 1. |
|
1927 |
endLine := endVisLineNr + firstLineShown - 1. |
|
1928 |
(startLine == 0) ifTrue:[ |
|
4641 | 1929 |
y := y + fontHeight. |
1930 |
startLine := startLine + 1 |
|
105 | 1931 |
]. |
1932 |
||
1933 |
(endLine > listSize) ifTrue:[ |
|
4641 | 1934 |
e := listSize |
105 | 1935 |
] ifFalse:[ |
4641 | 1936 |
e := endLine |
105 | 1937 |
]. |
1938 |
||
1939 |
(startLine <= e) ifTrue:[ |
|
4641 | 1940 |
x := textStartLeft - viewOrigin x. |
1941 |
self paint:fg on:bg. |
|
5585 | 1942 |
"/ don't use list from:to:do:, to allow for subclasses to redefine the enumeration (TableView) |
4641 | 1943 |
self from:startLine to:e do:[:line | |
1944 |
line notNil ifTrue:[ |
|
1945 |
"/ remove line's color emphasis, to enforce color. |
|
1946 |
"/ otherwise blue text is not visible if selection-bg is blue |
|
1947 |
l := self withoutColorEmphasis:line ifFg:fg andBg:bg. |
|
1948 |
self displayOpaqueString:l x:x y:y |
|
1949 |
]. |
|
1950 |
y := y + fontHeight |
|
1951 |
] |
|
105 | 1952 |
] |
1953 |
||
2090
85c0dd8a4281
selection over colored text - again
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
1954 |
"Modified: / 15.12.1999 / 23:19:39 / cg" |
7 | 1955 |
! |
1956 |
||
131 | 1957 |
drawLine:line atX:x inVisible:visLineNr with:fg and:bg |
1958 |
"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
|
1959 |
given x position in fg/bg. Clears the whole line before drawing the string. |
5198 | 1960 |
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
|
1961 |
|
5372 | 1962 |
|y l halfSpacing extraBelow| |
422
12bfba6f62b5
redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents:
407
diff
changeset
|
1963 |
|
12bfba6f62b5
redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents:
407
diff
changeset
|
1964 |
y := self yOfVisibleLine:visLineNr. |
1700
3538310c2724
fixed widthOfContents with variable fonts (win32);
Claus Gittinger <cg@exept.de>
parents:
1699
diff
changeset
|
1965 |
backgroundAlreadyClearedColor == bg ifFalse:[ |
4049 | 1966 |
self paint:bg. |
5372 | 1967 |
halfSpacing := (lineSpacing//2). |
1968 |
extraBelow := 0. |
|
1969 |
self highlightLineSpacing ifTrue:[ |
|
1970 |
extraBelow := halfSpacing. |
|
1971 |
]. |
|
1972 |
self fillRectangleX:margin y:y - halfSpacing |
|
4049 | 1973 |
width:(width - (2 * margin)) |
5372 | 1974 |
height:fontHeight+extraBelow. |
1700
3538310c2724
fixed widthOfContents with variable fonts (win32);
Claus Gittinger <cg@exept.de>
parents:
1699
diff
changeset
|
1975 |
]. |
422
12bfba6f62b5
redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents:
407
diff
changeset
|
1976 |
line notNil ifTrue:[ |
4049 | 1977 |
self paint:fg on:bg. |
1978 |
||
1979 |
"/ remove lines color emphasis, to enforce color. |
|
1980 |
"/ otherwise blue text is not visible if selection-bg is blue. |
|
1981 |
"/ this is only done in EditTextViews and subClasses. |
|
1982 |
self suppressEmphasisInSelection ifTrue:[ |
|
1983 |
l := self withoutColorEmphasis:line ifFg:fg andBg:bg. |
|
1984 |
] ifFalse:[ |
|
1985 |
l := line |
|
1986 |
]. |
|
1987 |
self displayOpaqueString:l x:x y:(y + fontAscent) |
|
5372 | 1988 |
]. |
422
12bfba6f62b5
redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents:
407
diff
changeset
|
1989 |
|
2090
85c0dd8a4281
selection over colored text - again
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
1990 |
"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
|
1991 |
! |
12bfba6f62b5
redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents:
407
diff
changeset
|
1992 |
|
12bfba6f62b5
redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents:
407
diff
changeset
|
1993 |
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
|
1994 |
"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
|
1995 |
given x position in fg/bg. Clears partial line before drawing the string. |
131 | 1996 |
Low level entry; not meant for public use." |
1997 |
||
2090
85c0dd8a4281
selection over colored text - again
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
1998 |
|y l| |
105 | 1999 |
|
2000 |
y := self yOfVisibleLine:visLineNr. |
|
2001 |
line notNil ifTrue:[ |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2002 |
self paint:fg on:bg. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2003 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2004 |
"/ remove lines color emphasis, to enforce color. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2005 |
"/ 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
|
2006 |
l := self withoutColorEmphasis:line ifFg:fg andBg:bg. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2007 |
self displayOpaqueString:l x:x y:(y + fontAscent) |
105 | 2008 |
] |
191
5ccbde40bb6b
draw strings half a lineSpacing lower - highlight frames look better
Claus Gittinger <cg@exept.de>
parents:
190
diff
changeset
|
2009 |
|
2090
85c0dd8a4281
selection over colored text - again
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
2010 |
"Modified: / 15.12.1999 / 23:19:55 / cg" |
105 | 2011 |
! |
2012 |
||
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
2013 |
drawLine:lineStringArg inVisible:visLineNr col:col with:fg and:bg |
105 | 2014 |
"draw single character at col index of visible line in fg/bg" |
2015 |
||
2561 | 2016 |
|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
|
2017 |
|
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
2018 |
lineString := lineStringArg. |
2561 | 2019 |
len := lineString size. |
1927
d5e14e7bce6f
fixed cursor drawing over coloured text
Claus Gittinger <cg@exept.de>
parents:
1911
diff
changeset
|
2020 |
|
2429
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2427
diff
changeset
|
2021 |
x := (self xOfCol:col inVisibleLine:visLineNr) - viewOrigin x. |
105 | 2022 |
y := self yOfVisibleLine:visLineNr. |
2561 | 2023 |
yf := y - (lineSpacing // 2). |
2024 |
||
2576
8af235849704
partial redraw behone non-string lines end
Michael Beyl <mb@exept.de>
parents:
2565
diff
changeset
|
2025 |
self paint:bg. |
8af235849704
partial redraw behone non-string lines end
Michael Beyl <mb@exept.de>
parents:
2565
diff
changeset
|
2026 |
|
2561 | 2027 |
(lineString notNil and:[lineString isString not]) ifTrue:[ |
5023
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2028 |
w := lineString widthFrom:col to:(col min:len) on:self. |
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2029 |
w <= 0 ifTrue:[ |
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2030 |
w := gc font width. |
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2031 |
self fillRectangleX:x y:yf width:w height:fontHeight. |
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2032 |
self paint:fg |
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2033 |
]. |
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2034 |
self clippedTo:(Rectangle left:x top:yf width:w height:fontHeight) do:[ |
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2035 |
self drawVisibleLine:visLineNr with:fg and:bg |
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2036 |
]. |
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2037 |
^ self |
2561 | 2038 |
]. |
2039 |
||
2654 | 2040 |
(lineString isNil or:[col > len]) ifTrue:[ |
5023
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2041 |
self fillRectangleX:x y:yf width:(gc font width) height:fontHeight. |
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2042 |
self paint:fg |
105 | 2043 |
] ifFalse:[ |
5023
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2044 |
characterString := lineString copyFrom:col to:col. |
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2045 |
|
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2046 |
"/ remove lines color emphasis, to enforce color. |
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2047 |
"/ otherwise blue text is not visible if selection-bg is blue |
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2048 |
characterString := self withoutColorEmphasis:characterString ifFg:fg andBg:bg. |
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2049 |
w := characterString widthOn:self. |
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2050 |
|
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2051 |
self fillRectangleX:x y:yf width:w height:fontHeight. |
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2052 |
self paint:fg. |
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2053 |
self clippedTo:(Rectangle left:x top:yf width:w height:fontHeight) do:[ |
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2054 |
self displayString:characterString x:x y:(y + fontAscent) |
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2055 |
] |
105 | 2056 |
] |
191
5ccbde40bb6b
draw strings half a lineSpacing lower - highlight frames look better
Claus Gittinger <cg@exept.de>
parents:
190
diff
changeset
|
2057 |
|
2090
85c0dd8a4281
selection over colored text - again
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
2058 |
"Modified: / 15.12.1999 / 23:21:12 / cg" |
105 | 2059 |
! |
2060 |
||
2558
4c10bec1117d
more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents:
2557
diff
changeset
|
2061 |
drawLine:lineStringArg inVisible:visLineNr from:startCol to:endColOrNil with:fg and:bg |
105 | 2062 |
"draw part of a visible line in fg/bg" |
2063 |
||
4637 | 2064 |
|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
|
2065 |
|
4c10bec1117d
more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents:
2557
diff
changeset
|
2066 |
"/ hack - please rewrite |
4c10bec1117d
more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents:
2557
diff
changeset
|
2067 |
endCol := endColOrNil ? lineStringArg size. |
105 | 2068 |
(endCol >= startCol) ifTrue:[ |
4049 | 2069 |
sCol := startCol max:1. |
2070 |
||
2071 |
lineString := lineStringArg. |
|
2072 |
||
2073 |
x := (self xOfCol:sCol inVisibleLine:visLineNr) - viewOrigin x. |
|
2074 |
y := (self yOfVisibleLine:visLineNr). |
|
2075 |
yf := y - (lineSpacing // 2). |
|
2076 |
||
2077 |
len := lineString size. |
|
5111 | 2078 |
(lineString notNil and:[lineString isString not ]) |
4049 | 2079 |
ifTrue:[ |
2080 |
w := lineString widthFrom:sCol to:(endCol min:len) on:self. |
|
2081 |
endCol > len ifTrue:[ |
|
2082 |
sCol > len ifTrue:[ |
|
4637 | 2083 |
numExtraCols := (endCol - sCol + 1). |
4049 | 2084 |
] ifFalse:[ |
4637 | 2085 |
numExtraCols := (endCol - len" + 1"). |
4049 | 2086 |
]. |
2087 |
self paint:bg. |
|
4637 | 2088 |
self fillRectangleX:x+w y:yf width:(numExtraCols * fontWidth) height:fontHeight. |
4049 | 2089 |
]. |
2090 |
w > 0 ifTrue:[ |
|
2091 |
self clippedTo:(Rectangle left:x top:yf width:w height:fontHeight) do:[ |
|
2092 |
self drawVisibleLine:visLineNr with:fg and:bg. |
|
2093 |
] |
|
2094 |
]. |
|
2095 |
^ self. |
|
2096 |
]. |
|
2097 |
||
2098 |
(sCol > len) ifTrue:[ |
|
2099 |
backgroundAlreadyClearedColor == bg ifFalse:[ |
|
2100 |
len := endCol - sCol + 1. |
|
2101 |
self paint:bg. |
|
2102 |
self fillRectangleX:x y:yf |
|
2103 |
width:(fontWidth * len) |
|
2104 |
height:fontHeight |
|
2105 |
] |
|
2106 |
] ifFalse:[ |
|
2107 |
eCol := endCol. |
|
2108 |
(endCol > len) ifTrue:[ |
|
2109 |
backgroundAlreadyClearedColor == bg ifFalse:[ |
|
2110 |
characterString := lineString string species new:endCol. |
|
2111 |
characterString replaceFrom:1 to:len with:lineString startingAt:1. |
|
2112 |
lineString := characterString. |
|
2113 |
] ifTrue:[ |
|
2114 |
eCol := len. |
|
2115 |
]. |
|
2116 |
]. |
|
2117 |
||
2118 |
"/ remove any color emphasis, to enforce drawing in fg/bg |
|
2119 |
||
2120 |
lineString := self withoutColorEmphasis:lineString ifFg:fg andBg:bg. |
|
2121 |
||
2122 |
backgroundAlreadyClearedColor == bg ifFalse:[ |
|
5111 | 2123 |
(lineString isSingleByteString) ifTrue:[ |
4049 | 2124 |
fontIsFixedWidth ifTrue:[ |
2125 |
w := (eCol - sCol + 1) * fontWidth |
|
2126 |
] ifFalse:[ |
|
5023
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2127 |
w := gc font widthOf:lineString from:sCol to:eCol |
4049 | 2128 |
] |
2129 |
] ifFalse:[ |
|
2130 |
w := lineString widthFrom:sCol to:endCol on:self |
|
2131 |
]. |
|
2132 |
self paint:bg. |
|
2133 |
self fillRectangleX:x y:yf |
|
2134 |
width:w |
|
2135 |
height:fontHeight. |
|
2136 |
]. |
|
2137 |
self paint:fg on:bg. |
|
5023
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2138 |
"/ w notNil ifTrue:[ |
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2139 |
"/ "/ clip req'd for VISTAs new font rendering (which seems to shoot over the compute |
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2140 |
"/ self clippedTo:(Rectangle left:x top:yf width:w height:fontHeight) do:[ |
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2141 |
"/ "/ self displayOpaqueString:lineString from:sCol to:eCol x:x y:(y + fontAscent) |
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2142 |
"/ self displayString:lineString from:sCol to:eCol x:x y:(y + fontAscent) |
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2143 |
"/ ] |
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2144 |
"/ ] ifFalse:[ |
4495 | 2145 |
"/ self displayOpaqueString:lineString from:sCol to:eCol x:x y:(y + fontAscent) |
5023
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2146 |
self displayString:lineString from:sCol to:eCol x:x y:(y + fontAscent) opaque:false maxWidth:self width |
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2147 |
"/ ]. |
4049 | 2148 |
] |
105 | 2149 |
] |
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
|
2150 |
|
2090
85c0dd8a4281
selection over colored text - again
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
2151 |
"Modified: / 15.12.1999 / 23:21:43 / cg" |
0 | 2152 |
! |
2153 |
||
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
2154 |
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
|
2155 |
"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
|
2156 |
|
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
2157 |
|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
|
2158 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2159 |
(startCol < 1) ifTrue:[ |
4495 | 2160 |
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
|
2161 |
] ifFalse:[ |
4495 | 2162 |
index1 := startCol |
0 | 2163 |
]. |
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
|
2164 |
y := self yOfVisibleLine:visLineNr. |
2429
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2427
diff
changeset
|
2165 |
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
|
2166 |
backgroundAlreadyClearedColor == bg ifFalse:[ |
4495 | 2167 |
self paint:bg. |
2168 |
self fillRectangleX:x y:y - (lineSpacing // 2) |
|
2169 |
width:(width + viewOrigin x - x) |
|
2170 |
height:fontHeight. |
|
2171 |
]. |
|
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
|
2172 |
lineString notNil ifTrue:[ |
4495 | 2173 |
lineString isString ifFalse:[ |
2174 |
self drawLine:lineString inVisible:visLineNr from:startCol to:nil with:fg and:bg. |
|
2175 |
] ifTrue:[ |
|
2176 |
lineWithoutColor := self withoutColorEmphasis:lineString ifFg:fg andBg:bg. |
|
2177 |
index2 := lineWithoutColor size. |
|
2178 |
(index2 < index1) ifTrue:[^ self]. |
|
2179 |
(index1 <= index2) ifTrue:[ |
|
2180 |
self paint:fg on:bg. |
|
2181 |
"/ self displayOpaqueString:lineWithoutColor from:index1 to:index2 x:x y:(y + fontAscent) |
|
2182 |
self displayString:lineWithoutColor from:index1 to:index2 x:x y:(y + fontAscent) |
|
2183 |
] |
|
2184 |
] |
|
0 | 2185 |
] |
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
|
2186 |
|
2090
85c0dd8a4281
selection over colored text - again
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
2187 |
"Modified: / 15.12.1999 / 23:24:40 / cg" |
105 | 2188 |
! |
2189 |
||
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
2190 |
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
|
2191 |
"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
|
2192 |
|
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
2193 |
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
|
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 col:col with:fg and:bg |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
2197 |
"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
|
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 |
col:col |
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 to:endCol with:fg and:bg |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
2207 |
"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
|
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 to:endCol |
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 |
|
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
2216 |
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
|
2217 |
"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
|
2218 |
|
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
2219 |
self |
3869
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 |
inVisible:visLineNr |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2222 |
from:startCol |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2223 |
with:fg and:bg |
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
2224 |
! |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
2225 |
|
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
|
2226 |
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
|
2227 |
"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
|
2228 |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2229 |
self |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2230 |
drawLine:(self visibleAt:visLineNr) |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2231 |
atX:(textStartLeft - viewOrigin x) |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2232 |
inVisible:visLineNr |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2233 |
with:fg |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2234 |
and:bg |
427
a75bc351b17f
slight rewrites (changes for accelerator-display)
Claus Gittinger <cg@exept.de>
parents:
422
diff
changeset
|
2235 |
|
a75bc351b17f
slight rewrites (changes for accelerator-display)
Claus Gittinger <cg@exept.de>
parents:
422
diff
changeset
|
2236 |
"Modified: 28.2.1996 / 19:30:23 / cg" |
1462 | 2237 |
! |
2238 |
||
2239 |
fillRectangleX:x y:y width:w height:h |
|
2240 |
"fill rectangle; checks whether the rectangle already is filled with |
|
5023
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2241 |
the current paint (#redrawX:y:w:h)." |
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2242 |
|
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2243 |
backgroundAlreadyClearedColor ~~ self paint ifTrue:[ |
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2244 |
super fillRectangleX:x y:y width:w height:h |
1462 | 2245 |
] |
1465
7832492b8443
added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents:
1462
diff
changeset
|
2246 |
! |
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 |
invalidateLine:line |
1466
fd077de6285d
comment for #invalidateLine:
Claus Gittinger <cg@exept.de>
parents:
1465
diff
changeset
|
2249 |
"invalidate the area of a single line. |
fd077de6285d
comment for #invalidateLine:
Claus Gittinger <cg@exept.de>
parents:
1465
diff
changeset
|
2250 |
This arranges for that line to be redrawn asynchronously (later). |
fd077de6285d
comment for #invalidateLine:
Claus Gittinger <cg@exept.de>
parents:
1465
diff
changeset
|
2251 |
If multiple such invalidations arrive, those areas may be lumped |
fd077de6285d
comment for #invalidateLine:
Claus Gittinger <cg@exept.de>
parents:
1465
diff
changeset
|
2252 |
together for a block update. |
fd077de6285d
comment for #invalidateLine:
Claus Gittinger <cg@exept.de>
parents:
1465
diff
changeset
|
2253 |
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
|
2254 |
process expose events." |
1465
7832492b8443
added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents:
1462
diff
changeset
|
2255 |
|
7832492b8443
added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents:
1462
diff
changeset
|
2256 |
|yTop visLineNr| |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2257 |
|
1465
7832492b8443
added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents:
1462
diff
changeset
|
2258 |
visLineNr := self listLineToVisibleLine:line. |
7832492b8443
added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents:
1462
diff
changeset
|
2259 |
visLineNr notNil ifTrue:[ |
4583 | 2260 |
yTop := self yOfVisibleLine:visLineNr. |
2261 |
yTop isNil ifTrue:[^ self]. "/ not visible |
|
2262 |
(yTop + fontHeight) < 0 ifTrue:[^ self]. "/ not visible |
|
2263 |
self |
|
2264 |
invalidateDeviceRectangle:(Rectangle |
|
2265 |
left:margin top:yTop-(lineSpacing//2) |
|
2266 |
width:(width - (2 * margin)) height:fontHeight) |
|
2267 |
repairNow:false. |
|
1465
7832492b8443
added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents:
1462
diff
changeset
|
2268 |
] |
7832492b8443
added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents:
1462
diff
changeset
|
2269 |
|
7832492b8443
added #invalidateLine: for asynchronous redraw of a single line
Claus Gittinger <cg@exept.de>
parents:
1462
diff
changeset
|
2270 |
"Created: / 5.3.1998 / 01:24:19 / cg" |
1466
fd077de6285d
comment for #invalidateLine:
Claus Gittinger <cg@exept.de>
parents:
1465
diff
changeset
|
2271 |
"Modified: / 5.3.1998 / 13:41:31 / cg" |
105 | 2272 |
! ! |
2273 |
||
2752 | 2274 |
!ListView methodsFor:'event handling'! |
105 | 2275 |
|
887
9b25df4d193a
Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents:
883
diff
changeset
|
2276 |
contentsChanged |
4634 | 2277 |
"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
|
2278 |
|
9b25df4d193a
Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents:
883
diff
changeset
|
2279 |
|listSize newOrigin| |
9b25df4d193a
Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents:
883
diff
changeset
|
2280 |
|
890
abd28e2f66ca
stefan ! test your changes ;-)
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
2281 |
shown ifTrue:[ |
4634 | 2282 |
list notNil ifTrue:[ |
2283 |
listSize := self numberOfLines. |
|
2284 |
||
2285 |
listSize == 0 ifTrue:[ |
|
2286 |
widthOfWidestLine := 0. |
|
2287 |
]. |
|
2288 |
||
2289 |
" |
|
2290 |
if we are beyond the end, scroll up a bit |
|
2291 |
" |
|
2292 |
((firstLineShown + nFullLinesShown) > listSize) ifTrue:[ |
|
2293 |
newOrigin := listSize - nFullLinesShown + 1. |
|
2294 |
newOrigin < 1 ifTrue:[ |
|
2295 |
newOrigin := 1 |
|
2296 |
]. |
|
2297 |
self scrollToLine: newOrigin. |
|
2298 |
]. |
|
2299 |
]. |
|
887
9b25df4d193a
Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents:
883
diff
changeset
|
2300 |
]. |
9b25df4d193a
Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents:
883
diff
changeset
|
2301 |
|
9b25df4d193a
Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents:
883
diff
changeset
|
2302 |
^ super contentsChanged |
9b25df4d193a
Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents:
883
diff
changeset
|
2303 |
|
9b25df4d193a
Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents:
883
diff
changeset
|
2304 |
"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
|
2305 |
"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
|
2306 |
! |
9b25df4d193a
Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents:
883
diff
changeset
|
2307 |
|
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
|
2308 |
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
|
2309 |
"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
|
2310 |
|
75b8fb924904
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 |
<resource: #keyboard (#PreviousPage #NextPage #HalfPageUp #HalfPageDown |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2312 |
#BeginOfText #EndOfText |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2313 |
#ScrollUp #ScrollDown )> |
2731
0f3c02f592d0
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2707
diff
changeset
|
2314 |
|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
|
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 == #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
|
2317 |
(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
|
2318 |
(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
|
2319 |
(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
|
2320 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2321 |
(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
|
2322 |
(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
|
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 |
(key == #ScrollUp) ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2325 |
n := 1 + (self sensor compressKeyPressEventsWithKey:#ScrollUp). |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2326 |
^ 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
|
2327 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2328 |
(key == #ScrollDown) ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2329 |
n := 1 + (self sensor compressKeyPressEventsWithKey:#ScrollDown). |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2330 |
^ 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
|
2331 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2332 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2333 |
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
|
2334 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2335 |
|
2273
e40b815ce3e2
stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents:
2258
diff
changeset
|
2336 |
mapped |
e40b815ce3e2
stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents:
2258
diff
changeset
|
2337 |
self stopAutoScroll. |
e40b815ce3e2
stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents:
2258
diff
changeset
|
2338 |
super mapped |
e40b815ce3e2
stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents:
2258
diff
changeset
|
2339 |
! |
e40b815ce3e2
stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents:
2258
diff
changeset
|
2340 |
|
3836 | 2341 |
mouseWheelZoom:amount |
4070
8225a547d6a7
comment/format in: #mouseWheelZoom:
Claus Gittinger <cg@exept.de>
parents:
4049
diff
changeset
|
2342 |
"CTRL-wheel action" |
3836 | 2343 |
|
5023
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2344 |
|oldSize newSize delta mul currentFont| |
3836 | 2345 |
|
2346 |
amount > 0 ifTrue:[ |
|
4070
8225a547d6a7
comment/format in: #mouseWheelZoom:
Claus Gittinger <cg@exept.de>
parents:
4049
diff
changeset
|
2347 |
"/ delta := 1. mul := 1. |
8225a547d6a7
comment/format in: #mouseWheelZoom:
Claus Gittinger <cg@exept.de>
parents:
4049
diff
changeset
|
2348 |
delta := 0. mul := 1.2. |
3836 | 2349 |
] ifFalse:[ |
4070
8225a547d6a7
comment/format in: #mouseWheelZoom:
Claus Gittinger <cg@exept.de>
parents:
4049
diff
changeset
|
2350 |
"/ delta := -1. mul := 1. |
8225a547d6a7
comment/format in: #mouseWheelZoom:
Claus Gittinger <cg@exept.de>
parents:
4049
diff
changeset
|
2351 |
delta := 0. mul := 0.8. |
3836 | 2352 |
]. |
2353 |
||
5023
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2354 |
currentFont := gc font. |
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2355 |
currentFont sizeUnit == #px ifFalse:[ |
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2356 |
oldSize := currentFont size. |
4070
8225a547d6a7
comment/format in: #mouseWheelZoom:
Claus Gittinger <cg@exept.de>
parents:
4049
diff
changeset
|
2357 |
newSize := ((oldSize + delta)* mul) max:2. |
8225a547d6a7
comment/format in: #mouseWheelZoom:
Claus Gittinger <cg@exept.de>
parents:
4049
diff
changeset
|
2358 |
newSize ~= oldSize ifTrue:[ |
5023
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2359 |
self font:(currentFont asSize:newSize). |
4070
8225a547d6a7
comment/format in: #mouseWheelZoom:
Claus Gittinger <cg@exept.de>
parents:
4049
diff
changeset
|
2360 |
] |
3836 | 2361 |
]. |
2362 |
! |
|
2363 |
||
0 | 2364 |
redrawX:x y:y width:w height:h |
2365 |
"a region must be redrawn" |
|
2366 |
||
1462 | 2367 |
|startCol endCol line saveClip |
2368 |
startLine "{ Class:SmallInteger }" |
|
2369 |
stopLine "{ Class:SmallInteger }" |
|
2370 |
| |
|
0 | 2371 |
|
127 | 2372 |
shown ifFalse:[^ self]. |
2373 |
||
0 | 2374 |
startLine := self visibleLineOfY:y. |
2375 |
stopLine := self visibleLineOfY:(y + h). |
|
2376 |
||
5023
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2377 |
saveClip := gc clippingBoundsOrNil. |
1462 | 2378 |
self clippingRectangle:(Rectangle left:x top:y width:w height:h). |
2379 |
self paint:bgColor. |
|
2380 |
self fillRectangleX:x y:y width:w height:h. |
|
2381 |
backgroundAlreadyClearedColor := bgColor. |
|
2382 |
||
2383 |
(includesNonStrings or:[w > (width // 4 * 3)]) ifTrue:[ |
|
4765 | 2384 |
"includes non strings or area is big enough: redraw whole lines" |
4536 | 2385 |
self redrawFromVisibleLine:startLine to:stopLine |
0 | 2386 |
] ifFalse:[ |
4536 | 2387 |
line := self visibleAt:startLine. |
2388 |
||
5111 | 2389 |
(fontIsFixedWidth and:[line isSingleByteString]) ifFalse:[ |
4536 | 2390 |
"start/end col has to be computed for each line" |
2391 |
||
2392 |
startLine to:stopLine do:[:i | |
|
2393 |
startCol := self colOfX:x inVisibleLine:i. |
|
2394 |
endCol := self colOfX:(x + w) inVisibleLine:i. |
|
2395 |
startCol > 0 ifTrue:[ |
|
2396 |
endCol > 0 ifTrue:[ |
|
2397 |
self redrawVisibleLine:i from:startCol to:endCol |
|
2398 |
] |
|
2399 |
] |
|
2400 |
] |
|
2401 |
] ifTrue:[ |
|
2402 |
"start/end col is the same for all lines" |
|
2403 |
startCol := self colOfX:x inVisibleLine:startLine. |
|
2404 |
endCol := self colOfX:(x + w) inVisibleLine:startLine. |
|
2405 |
startCol > 0 ifTrue:[ |
|
2406 |
endCol > 0 ifTrue:[ |
|
2407 |
startLine to:stopLine do:[:i | |
|
2408 |
line := self visibleAt:i. |
|
5111 | 2409 |
(line isSingleByteString) ifTrue:[ |
4536 | 2410 |
self redrawVisibleLine:i from:startCol to:endCol |
2411 |
] ifFalse:[ |
|
2412 |
self redrawVisibleLine:i |
|
2413 |
] |
|
2414 |
] |
|
2415 |
] |
|
2416 |
] |
|
2417 |
] |
|
1462 | 2418 |
]. |
2419 |
backgroundAlreadyClearedColor := nil. |
|
2420 |
self clippingRectangle:saveClip. |
|
0 | 2421 |
! |
2422 |
||
105 | 2423 |
sizeChanged:how |
2424 |
"size changed - move origin up if possible" |
|
2425 |
||
2426 |
super sizeChanged:how. |
|
721
4a01084cf643
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
716
diff
changeset
|
2427 |
|
105 | 2428 |
self computeNumberOfLinesShown. |
2429 |
||
2430 |
innerWidth := width - textStartLeft - margin. |
|
1972 | 2431 |
|
2577 | 2432 |
"/ Makes trouble when fighting with SelListViews sizeChanged-positioning ... |
1972 | 2433 |
"/ |
2434 |
"/ shown ifFalse:[^ self]. |
|
2435 |
"/ list isNil ifTrue:[^ self]. |
|
2436 |
"/ |
|
2437 |
"/ listSize := self numberOfLines. |
|
2438 |
"/ " |
|
2439 |
"/ if we are beyond the end, scroll up a bit |
|
2440 |
"/ " |
|
2441 |
"/ ((firstLineShown + nFullLinesShown) >= listSize) ifTrue:[ |
|
2442 |
"/ self scrollToBottom. |
|
2443 |
"/ ^ self |
|
1429
b7b7f3477594
do not invalidate, when the size changes;
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
2444 |
"/ ]. |
643 | 2445 |
|
1429
b7b7f3477594
do not invalidate, when the size changes;
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
2446 |
"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
|
2447 |
"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
|
2448 |
! |
e40b815ce3e2
stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents:
2258
diff
changeset
|
2449 |
|
e40b815ce3e2
stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents:
2258
diff
changeset
|
2450 |
unmap |
e40b815ce3e2
stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents:
2258
diff
changeset
|
2451 |
self stopAutoScroll. |
e40b815ce3e2
stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents:
2258
diff
changeset
|
2452 |
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
|
2453 |
! ! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2454 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2455 |
!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
|
2456 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2457 |
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
|
2458 |
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
|
2459 |
|
75b8fb924904
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 |
"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
|
2461 |
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
|
2462 |
self computeNumberOfLinesShown. |
5649
6f57a64ccaa1
Replace all `self graphicsDevice` with `device`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5647
diff
changeset
|
2463 |
fgColor := fgColor onDevice:device. |
6f57a64ccaa1
Replace all `self graphicsDevice` with `device`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5647
diff
changeset
|
2464 |
bgColor := bgColor onDevice:device |
105 | 2465 |
! |
2466 |
||
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
|
2467 |
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
|
2468 |
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
|
2469 |
^ 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
|
2470 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2471 |
|
940 | 2472 |
fetchDeviceResources |
2473 |
"fetch device colors, to avoid reallocation at redraw time" |
|
2474 |
||
2475 |
super fetchDeviceResources. |
|
2476 |
||
5649
6f57a64ccaa1
Replace all `self graphicsDevice` with `device`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5647
diff
changeset
|
2477 |
fgColor notNil ifTrue:[fgColor := fgColor onDevice:device]. |
6f57a64ccaa1
Replace all `self graphicsDevice` with `device`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5647
diff
changeset
|
2478 |
bgColor notNil ifTrue:[bgColor := bgColor onDevice:device]. |
940 | 2479 |
|
2480 |
"Created: 14.1.1997 / 00:12:12 / cg" |
|
2481 |
! |
|
2482 |
||
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
|
2483 |
initStyle |
967 | 2484 |
"setup viewStyle specifics" |
2485 |
||
1693
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2486 |
|n| |
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2487 |
|
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
|
2488 |
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
|
2489 |
|
1693
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2490 |
n := DefaultTopMargin. |
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2491 |
n isInteger ifFalse:[ |
4322 | 2492 |
n := (self verticalPixelPerMillimeter:n) rounded. |
1693
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2493 |
]. |
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2494 |
self topMargin:n. |
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2495 |
|
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2496 |
n := DefaultLeftMargin. |
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2497 |
n isInteger ifFalse:[ |
4322 | 2498 |
n := (self verticalPixelPerMillimeter:n) rounded. |
1693
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2499 |
]. |
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2500 |
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
|
2501 |
|
4573 | 2502 |
lineSpacing := 2. |
4577 | 2503 |
"/ q&d temporary hack. |
2504 |
"/ X11 fonts are currently so ugly... add more spacing. |
|
5649
6f57a64ccaa1
Replace all `self graphicsDevice` with `device`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5647
diff
changeset
|
2505 |
device platformName = #X11 ifTrue:[ |
4577 | 2506 |
lineSpacing := lineSpacing + 3. |
2507 |
]. |
|
940 | 2508 |
fgColor := DefaultForegroundColor. |
2509 |
bgColor := DefaultBackgroundColor. |
|
4322 | 2510 |
|
2511 |
"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
|
2512 |
! |
75b8fb924904
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 |
|
75b8fb924904
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 |
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
|
2515 |
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
|
2516 |
|
75b8fb924904
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 |
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
|
2518 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2519 |
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
|
2520 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2521 |
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
|
2522 |
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
|
2523 |
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
|
2524 |
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
|
2525 |
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
|
2526 |
partialLines := true. |
2378 | 2527 |
tabPositions := UserDefaultTabPositions ? DefaultTabPositions. |
864 | 2528 |
includesNonStrings := false. |
4751 | 2529 |
lineEndCRLF := false. |
2530 |
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
|
2531 |
self getFontParameters. |
3312 | 2532 |
self initializeWordCheckAction. |
4747 | 2533 |
|
3312 | 2534 |
scrollWhenUpdating := #keep. "/ #beginOfText. |
4747 | 2535 |
expandTabsWhenUpdating := true. |
2536 |
compareModelOnUpdate := true. |
|
2537 |
checkLineEndConventionWhenUpdating := true. |
|
2538 |
scrollLocked := false. |
|
3312 | 2539 |
autoScroll := true. |
2540 |
||
2541 |
"Modified: / 03-07-2006 / 17:03:59 / cg" |
|
2542 |
! |
|
2543 |
||
3564 | 2544 |
initializeWordCheckAction |
4403 | 2545 |
"the wordCheck is a predicate block which returns true if the given character |
2546 |
belongs to the (textual) word. Used with double click to select a word. |
|
2547 |
When editing code, typically characters which are part of an identifier |
|
2548 |
are part of a word (underline, dollar, but no other non-letters). |
|
2549 |
The standardWordCheck aks the current userPreferences for details." |
|
2550 |
||
3564 | 2551 |
wordCheck := [:char | self standardWordCheck:char]. |
2552 |
||
2553 |
"Created: / 03-07-2006 / 17:03:50 / cg" |
|
2554 |
! |
|
2555 |
||
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
|
2556 |
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
|
2557 |
|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
|
2558 |
|
2305
f2850e54b0ab
only access originChanged, extentChanged and cornerChanged
Claus Gittinger <cg@exept.de>
parents:
2273
diff
changeset
|
2559 |
self extentChangedFlag ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2560 |
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
|
2561 |
]. |
691
906e4d67b9cf
fixed makeLineVisible; when not-yet realized
Claus Gittinger <cg@exept.de>
parents:
688
diff
changeset
|
2562 |
|
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
|
2563 |
firstLineShown ~~ 1 ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2564 |
sz := self size. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2565 |
firstLineShown + nLinesShown > sz ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2566 |
self scrollToLine:sz - nLinesShown. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2567 |
] |
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
|
2568 |
]. |
691
906e4d67b9cf
fixed makeLineVisible; when not-yet realized
Claus Gittinger <cg@exept.de>
parents:
688
diff
changeset
|
2569 |
|
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
|
2570 |
super realize. |
837 | 2571 |
|
1081
0d3f4ad6e7e5
now fetch models value when model is assigned;
Claus Gittinger <cg@exept.de>
parents:
1027
diff
changeset
|
2572 |
"/ old: fetch models value on realize; |
0d3f4ad6e7e5
now fetch models value when model is assigned;
Claus Gittinger <cg@exept.de>
parents:
1027
diff
changeset
|
2573 |
"/ 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
|
2574 |
"/ |
0d3f4ad6e7e5
now fetch models value when model is assigned;
Claus Gittinger <cg@exept.de>
parents:
1027
diff
changeset
|
2575 |
"/ model notNil ifTrue:[ |
0d3f4ad6e7e5
now fetch models value when model is assigned;
Claus Gittinger <cg@exept.de>
parents:
1027
diff
changeset
|
2576 |
"/ self getListFromModel. |
0d3f4ad6e7e5
now fetch models value when model is assigned;
Claus Gittinger <cg@exept.de>
parents:
1027
diff
changeset
|
2577 |
"/ ] |
691
906e4d67b9cf
fixed makeLineVisible; when not-yet realized
Claus Gittinger <cg@exept.de>
parents:
688
diff
changeset
|
2578 |
|
825
d115a0923b7d
Send #getListFromModel when setting #model:
Stefan Vogel <sv@exept.de>
parents:
820
diff
changeset
|
2579 |
"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
|
2580 |
"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
|
2581 |
! |
75b8fb924904
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 |
|
75b8fb924904
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 |
recreate |
2258 | 2584 |
"recreate after a snapin or a migration" |
1693
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2585 |
|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
|
2586 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2587 |
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
|
2588 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2589 |
" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2590 |
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
|
2591 |
- 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
|
2592 |
" |
1693
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2593 |
"/ topMargin := (self verticalPixelPerMillimeter:0.5) rounded. |
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2594 |
"/ self leftMargin:(self horizontalPixelPerMillimeter:0.5) rounded. |
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2595 |
|
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2596 |
n := DefaultTopMargin. |
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2597 |
n isInteger ifFalse:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2598 |
n := (self verticalPixelPerMillimeter:n) rounded. |
1693
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2599 |
]. |
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2600 |
self topMargin:n. |
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2601 |
|
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2602 |
n := DefaultLeftMargin. |
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2603 |
n isInteger ifFalse:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2604 |
n := (self verticalPixelPerMillimeter:n) rounded. |
1693
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2605 |
]. |
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2606 |
self leftMargin:n. |
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2607 |
|
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
|
2608 |
self getFontParameters |
1693
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2609 |
|
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2610 |
"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
|
2611 |
! ! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2612 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2613 |
!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
|
2614 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2615 |
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
|
2616 |
"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
|
2617 |
|
2976 | 2618 |
<resource:#obsolete> |
2423
8b9c2946a5a7
absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
2412
diff
changeset
|
2619 |
self obsoleteMethodWarning:'use #listLineToVisibleLine:'. |
8b9c2946a5a7
absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
2412
diff
changeset
|
2620 |
^ self listLineToVisibleLine:absLineNr |
8b9c2946a5a7
absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
2412
diff
changeset
|
2621 |
|
8b9c2946a5a7
absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
2412
diff
changeset
|
2622 |
"/ absLineNr isNil ifTrue:[^ nil]. |
8b9c2946a5a7
absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
2412
diff
changeset
|
2623 |
"/ (absLineNr < firstLineShown) ifTrue:[^ nil]. |
8b9c2946a5a7
absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
2412
diff
changeset
|
2624 |
"/ (absLineNr >= (firstLineShown + nLinesShown)) ifTrue:[^ nil]. |
8b9c2946a5a7
absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
2412
diff
changeset
|
2625 |
"/ ^ absLineNr - firstLineShown + 1 |
8b9c2946a5a7
absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
2412
diff
changeset
|
2626 |
"/ |
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
|
2627 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2628 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2629 |
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
|
2630 |
"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
|
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 |
list isNil ifTrue: [ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2633 |
list := StringCollection new:lineNr. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2634 |
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
|
2635 |
] ifFalse: [ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2636 |
lineNr > (list size) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2637 |
self grow:lineNr. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2638 |
self contentsChanged |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2639 |
] |
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
|
2640 |
] |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2641 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2642 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2643 |
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
|
2644 |
"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
|
2645 |
|
650
563ea7f99aa8
handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents:
643
diff
changeset
|
2646 |
|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
|
2647 |
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
|
2648 |
|
2429
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2427
diff
changeset
|
2649 |
xRel := x - textStartLeft + viewOrigin x. |
650
563ea7f99aa8
handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents:
643
diff
changeset
|
2650 |
(xRel <= 0) ifTrue:[^ 1]. |
563ea7f99aa8
handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents:
643
diff
changeset
|
2651 |
|
1656
1202fbc95970
some fixes forvariable fonts on win32
Claus Gittinger <cg@exept.de>
parents:
1637
diff
changeset
|
2652 |
lineString := self visibleAt:visLineNr. |
1202fbc95970
some fixes forvariable fonts on win32
Claus Gittinger <cg@exept.de>
parents:
1637
diff
changeset
|
2653 |
|
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
|
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 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
|
2656 |
" |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2657 |
(fontIsFixedWidth |
1656
1202fbc95970
some fixes forvariable fonts on win32
Claus Gittinger <cg@exept.de>
parents:
1637
diff
changeset
|
2658 |
and:[lineString isNil |
4245
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2659 |
or:[lineString hasChangeOfEmphasis not]]) ifTrue:[ |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2660 |
^ (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
|
2661 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2662 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2663 |
" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2664 |
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
|
2665 |
" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2666 |
lineString notNil ifTrue:[ |
4245
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2667 |
lineString := self visibleStringFrom:lineString. |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2668 |
(hasEmphasis := lineString hasChangeOfEmphasis) ifTrue:[ |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2669 |
linePixelWidth := lineString widthOn:self |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2670 |
] ifFalse:[ |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2671 |
lineString := lineString string. |
5023
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2672 |
linePixelWidth := gc font widthOf:lineString. |
4245
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2673 |
] |
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
|
2674 |
] ifFalse:[ |
4245
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2675 |
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
|
2676 |
]. |
650
563ea7f99aa8
handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents:
643
diff
changeset
|
2677 |
|
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 |
(linePixelWidth <= xRel) ifTrue:[ |
4245
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2679 |
fontWidth == 0 ifTrue:[ |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2680 |
" |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2681 |
although this 'cannot happen', |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2682 |
it seems that X reports this width for some strange fonts ... |
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 |
^ lineString size |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2685 |
]. |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2686 |
^ 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
|
2687 |
]. |
650
563ea7f99aa8
handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents:
643
diff
changeset
|
2688 |
|
563ea7f99aa8
handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents:
643
diff
changeset
|
2689 |
"/ cannot simply count individual characters, |
563ea7f99aa8
handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents:
643
diff
changeset
|
2690 |
"/ since kerning or other non-linear effects may be involved ... |
4245
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2691 |
"/ use a binary search, initialized with some guess. |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2692 |
|
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2693 |
"/ a guess: take some 'average' character's width and compute an initial guess |
5023
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2694 |
runCol := x // (gc font widthOf:'e'). |
4247 | 2695 |
runCol := runCol min:lineString size. |
4245
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2696 |
|
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2697 |
"/ runCol := lineString size // 2. |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2698 |
"/ (runCol == 0) ifTrue:[runCol := 1]. |
650
563ea7f99aa8
handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents:
643
diff
changeset
|
2699 |
|
563ea7f99aa8
handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents:
643
diff
changeset
|
2700 |
hasEmphasis ifTrue:[ |
4245
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2701 |
posLeft := (lineString copyFrom:1 to:(runCol - 1)) widthOn:self. |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2702 |
posRight := (lineString copyFrom:1 to:runCol) widthOn:self. |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2703 |
] ifFalse:[ |
5023
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2704 |
posLeft := gc font widthOf:lineString from:1 to:(runCol - 1). |
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2705 |
posRight := gc font widthOf:lineString from:1 to:runCol. |
650
563ea7f99aa8
handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents:
643
diff
changeset
|
2706 |
]. |
563ea7f99aa8
handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents:
643
diff
changeset
|
2707 |
|
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
|
2708 |
done := (posLeft <= xRel) and:[posRight > xRel]. |
650
563ea7f99aa8
handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents:
643
diff
changeset
|
2709 |
|
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
|
2710 |
[done] whileFalse:[ |
4245
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2711 |
oPosRight := posRight. |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2712 |
oPosLeft := posLeft. |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2713 |
|
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2714 |
(posRight <= 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 |
posLeft := posRight. |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2717 |
hasEmphasis ifTrue:[ |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2718 |
posRight := (lineString copyFrom:1 to:runCol) widthOn:self. |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2719 |
] ifFalse:[ |
5023
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2720 |
posRight := gc font widthOf:lineString from:1 to:runCol |
4245
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2721 |
] |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2722 |
] ifFalse:[ |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2723 |
(posLeft > xRel) ifTrue:[ |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2724 |
runCol := runCol - 1. |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2725 |
(runCol == 0) ifTrue:[^ 0]. |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2726 |
posRight := posLeft. |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2727 |
hasEmphasis ifTrue:[ |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2728 |
posLeft := (lineString copyFrom:1 to:(runCol - 1)) widthOn:self. |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2729 |
] ifFalse:[ |
5023
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2730 |
posLeft := gc font widthOf:lineString from:1 to:(runCol - 1) |
4245
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2731 |
] |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2732 |
] |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2733 |
]. |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2734 |
done := (posLeft <= xRel) and:[posRight > xRel]. |
1775 | 2735 |
"234567890123456789012345678901234567890" |
4245
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2736 |
((oPosRight == posRight) and:[oPosLeft == posLeft]) ifTrue:[ |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2737 |
"/ paranoia: just in case there are unprintable characters |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2738 |
"/ (avoid endless loop if the binary search does not make progress) |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2739 |
done := true. |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2740 |
] |
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 |
]. |
1777 | 2742 |
"/self paint:Color red. |
2429
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2427
diff
changeset
|
2743 |
"/self displayRectangleX:posLeft+textStartLeft-viewOrigin x y:(self yOfVisibleLine:visLineNr) |
1777 | 2744 |
"/ width:(posRight-posLeft) height:fontHeight. |
2745 |
"/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
|
2746 |
^ runCol |
650
563ea7f99aa8
handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents:
643
diff
changeset
|
2747 |
|
4245
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2748 |
"Modified: / 25-04-2011 / 11:26:58 / cg" |
4247 | 2749 |
"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
|
2750 |
! |
75b8fb924904
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 |
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
|
2753 |
"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
|
2754 |
|
716
366fca254239
fixed number-of-lines computation
Claus Gittinger <cg@exept.de>
parents:
691
diff
changeset
|
2755 |
|innerHeight| |
366fca254239
fixed number-of-lines computation
Claus Gittinger <cg@exept.de>
parents:
691
diff
changeset
|
2756 |
|
366fca254239
fixed number-of-lines computation
Claus Gittinger <cg@exept.de>
parents:
691
diff
changeset
|
2757 |
innerHeight := self innerHeight. |
366fca254239
fixed number-of-lines computation
Claus Gittinger <cg@exept.de>
parents:
691
diff
changeset
|
2758 |
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
|
2759 |
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
|
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 |
partialLines ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2762 |
((nLinesShown * fontHeight) < innerHeight) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2763 |
nLinesShown := nLinesShown + 1 |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2764 |
] |
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
|
2765 |
] |
716
366fca254239
fixed number-of-lines computation
Claus Gittinger <cg@exept.de>
parents:
691
diff
changeset
|
2766 |
|
366fca254239
fixed number-of-lines computation
Claus Gittinger <cg@exept.de>
parents:
691
diff
changeset
|
2767 |
"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
|
2768 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2769 |
|
75b8fb924904
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 |
convertRTF:aList |
3844 | 2771 |
<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
|
2772 |
"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
|
2773 |
- 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
|
2774 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2775 |
|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
|
2776 |
|
652 | 2777 |
self obsoleteMethodWarning. |
2778 |
||
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
|
2779 |
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
|
2780 |
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
|
2781 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2782 |
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
|
2783 |
aList do:[:line | |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2784 |
((line size == 0) or:[line isBlank]) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2785 |
newList add:newLine. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2786 |
newLine := '' |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2787 |
] ifFalse:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2788 |
special := ((line at:1) == ${) or:[(line includes:$\)]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2789 |
special := special or:[(line at:1) == $}]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2790 |
special ifFalse:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2791 |
newList add:(newLine , line) |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2792 |
] ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2793 |
charIndex := 1. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2794 |
[charIndex <= line size] whileTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2795 |
char := line at:charIndex. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2796 |
((char == ${ ) or:[char == $} ]) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2797 |
"left-brace: ignore rest of line" |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2798 |
charIndex := line size + 1 |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2799 |
] ifFalse:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2800 |
(char == $\) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2801 |
inEscape := true |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2802 |
] ifFalse:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2803 |
inEscape ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2804 |
(char == Character space) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2805 |
inEscape := false |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2806 |
] |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2807 |
] ifFalse:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2808 |
newLine := newLine copyWith:char |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2809 |
] |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2810 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2811 |
charIndex := charIndex + 1 |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2812 |
] |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2813 |
] |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2814 |
] |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2815 |
] |
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
|
2816 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2817 |
^ newList |
652 | 2818 |
|
2819 |
"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
|
2820 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2821 |
|
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
2822 |
enqueueDelayedContentsChangedNotification |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
2823 |
"because contentschanged may be slow (recomputing width of widest line), |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
2824 |
we delay its execution by pushing it onto the event queue. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
2825 |
This has the effect of allowing for multiple add-lines before recomputing. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
2826 |
Much speeding up inserting into long lists" |
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 |
|sensor| |
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 |
sensor := self sensor. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
2831 |
(sensor hasUserEvent:#contentsChanged for:self) ifFalse:[ |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
2832 |
sensor pushUserEvent:#contentsChanged for:self |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
2833 |
]. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
2834 |
"/ used to be syncronous: |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
2835 |
"/ self contentsChanged. "recompute scrollbars" |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
2836 |
|
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
2837 |
"Created: / 25-07-2012 / 11:59:58 / cg" |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
2838 |
! |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
2839 |
|
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
|
2840 |
getFontParameters |
668
729295eb37fc
use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents:
663
diff
changeset
|
2841 |
"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
|
2842 |
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
|
2843 |
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
|
2844 |
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
|
2845 |
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
|
2846 |
|
5023
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2847 |
|hMax newDeviceFont| |
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2848 |
|
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2849 |
newDeviceFont := gc createFontOnDevice. |
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2850 |
hMax := newDeviceFont height. |
1451
3598c65cd89d
search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents:
1450
diff
changeset
|
2851 |
|
634
1ca770b2c494
handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
2852 |
includesNonStrings == true ifTrue:[ |
4570 | 2853 |
"/ |
2854 |
"/ find maximum height of lines |
|
2855 |
"/ |
|
2856 |
hMax := list inject:hMax into:[:maxSoFar :thisLine | |
|
2857 |
thisLine isNil ifTrue:[ |
|
2858 |
maxSoFar |
|
2859 |
] ifFalse:[ |
|
5111 | 2860 |
(thisLine isSingleByteString) ifTrue:[ |
4570 | 2861 |
maxSoFar |
2862 |
] ifFalse:[ |
|
2863 |
maxSoFar max:(thisLine heightOn:self) |
|
2864 |
] |
|
2865 |
] |
|
2866 |
]. |
|
1451
3598c65cd89d
search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents:
1450
diff
changeset
|
2867 |
|
634
1ca770b2c494
handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
2868 |
]. |
5023
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2869 |
fontHeight := newDeviceFont maxHeight. |
4573 | 2870 |
"/ fontHeight := font height. |
2871 |
fontHeight := fontHeight max:(hMax + lineSpacing). |
|
5023
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2872 |
fontAscent := newDeviceFont ascent. "/ maxAscent. -- see SelectionInListViews selection in motif style |
4573 | 2873 |
"/ fontAscent := font maxAscent "ascent". "/ maxAscent. -- see SelectionInListViews selection in motif style |
2874 |
"/ fontAscent := (font maxAscent + font ascent) // 2. "/ maxAscent. -- see SelectionInListViews selection in motif style |
|
5023
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2875 |
fontWidth := newDeviceFont width. |
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2876 |
fontIsFixedWidth := newDeviceFont isFixedWidth. |
634
1ca770b2c494
handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
2877 |
|
1260
5a548d4c6724
handle nil entry in #getFontParameters
Claus Gittinger <cg@exept.de>
parents:
1259
diff
changeset
|
2878 |
"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
|
2879 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2880 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2881 |
getListFromModel |
587
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2882 |
"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
|
2883 |
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
|
2884 |
|
5023
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2885 |
|newText msg| |
587
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2886 |
|
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2887 |
model notNil ifTrue:[ |
4734 | 2888 |
msg := listMsg ? aspectMsg. |
2889 |
||
2890 |
msg notNil ifTrue:[ |
|
4747 | 2891 |
newText := model perform:msg. |
4734 | 2892 |
"/ cg: this makes many optimizations (virtualArray) useless; |
4747 | 2893 |
"/ I do not think that this is a good idea: |
4734 | 2894 |
"/ text notNil ifTrue:[ |
2895 |
"/ so I changed it to: |
|
4747 | 2896 |
(newText notNil and:[newText isString]) ifTrue:[ |
2897 |
newText := newText asStringCollection. |
|
2898 |
]. |
|
2899 |
||
5023
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
2900 |
compareModelOnUpdate ifTrue:[ |
4747 | 2901 |
"/ see if there is a change at all. |
2902 |
"/ use to compare using =, but that's not enough in case of emphasis change. |
|
2903 |
newText size == list size ifTrue:[ |
|
2904 |
|same| |
|
2905 |
||
2906 |
same := true. |
|
2907 |
newText size > 0 ifTrue:[ |
|
2908 |
newText with:list do:[:eachNewLine :eachOldLine | |
|
2909 |
(eachNewLine == eachOldLine) ifFalse:[ |
|
2910 |
same := false. |
|
2911 |
] |
|
2912 |
] |
|
2913 |
]. |
|
2914 |
same ifTrue:[^ self]. |
|
2915 |
]. |
|
4734 | 2916 |
]. |
2917 |
||
2918 |
"/ SV: this compare does not work, if model uses (i.e. updates) |
|
2919 |
"/ the same stringCollection as the view!! |
|
2920 |
true "text ~= list" ifTrue:[ |
|
4747 | 2921 |
"/ changed #list to care for scrollLocked |
2922 |
"/ scrollLocked ifTrue:[ |
|
2923 |
"/ self setList:newText expandTabs:expandTabsWhenUpdating |
|
2924 |
"/ ] ifFalse:[ |
|
2925 |
self list:newText expandTabs:expandTabsWhenUpdating scanForNonStrings:expandTabsWhenUpdating |
|
2926 |
"/ ] |
|
4734 | 2927 |
]. |
2928 |
]. |
|
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
|
2929 |
]. |
587
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2930 |
|
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
2931 |
"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
|
2932 |
"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
|
2933 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2934 |
|
1099
eccab3759ddb
in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents:
1081
diff
changeset
|
2935 |
getListFromModelScroll:aBoolean |
eccab3759ddb
in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents:
1081
diff
changeset
|
2936 |
"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
|
2937 |
If there is no listMessage, try aspect for backward compatibility. |
4747 | 2938 |
If aBoolean is false, scrolling is suppressed here" |
3249
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
2939 |
|
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
2940 |
|prev| |
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
2941 |
|
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
2942 |
prev := scrollLocked. |
4747 | 2943 |
scrollLocked := aBoolean not. |
3249
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
2944 |
[ |
4747 | 2945 |
self getListFromModel |
3249
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
2946 |
] ensure:[ |
4747 | 2947 |
scrollLocked := prev. |
1099
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 |
! |
eccab3759ddb
in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents:
1081
diff
changeset
|
2950 |
|
5372 | 2951 |
highlightLineSpacing |
2952 |
"true if the spacing between lines is to be drawn with selected color, |
|
2953 |
false if it remains white. |
|
2954 |
false for selection in list views; true for edit/text views" |
|
2955 |
||
2956 |
^ true |
|
2957 |
! |
|
2958 |
||
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2959 |
line:line withoutEmphasis:emphasisToRemove |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2960 |
(line notNil |
2558
4c10bec1117d
more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents:
2557
diff
changeset
|
2961 |
and:[line isString]) ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2962 |
^ line withoutEmphasis:emphasisToRemove. |
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
2963 |
]. |
2558
4c10bec1117d
more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents:
2557
diff
changeset
|
2964 |
^ line |
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
2965 |
! |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
2966 |
|
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
|
2967 |
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
|
2968 |
"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
|
2969 |
|
75b8fb924904
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 |
|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 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2972 |
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
|
2973 |
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
|
2974 |
(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
|
2975 |
^ 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
|
2976 |
! |
75b8fb924904
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 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2978 |
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
|
2979 |
"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
|
2980 |
|
4638 | 2981 |
|line lineLen nCols| |
2982 |
||
2983 |
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
|
2984 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2985 |
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
|
2986 |
lineLen := line size. |
4638 | 2987 |
|
2988 |
(line isNil or:[startCol > lineLen]) ifTrue:[ |
|
2989 |
(nCols > 0) ifTrue:[ |
|
2990 |
^ (String new:nCols) |
|
2991 |
]. |
|
2992 |
^ nil |
|
2993 |
]. |
|
2994 |
||
2995 |
(endCol > lineLen) ifTrue:[ |
|
2996 |
^ (line copyFrom:startCol to:lineLen) , (String new:(endCol-lineLen)) |
|
2997 |
]. |
|
2998 |
^ 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
|
2999 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3000 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3001 |
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
|
3002 |
"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
|
3003 |
|
4639 | 3004 |
|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
|
3005 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3006 |
line := self listAt:lineNr. |
4638 | 3007 |
line isNil ifTrue:[ |
4639 | 3008 |
(endCol > 0) ifTrue:[ |
3009 |
^ (String new:endCol) |
|
4638 | 3010 |
]. |
3011 |
^ nil |
|
3012 |
]. |
|
3013 |
||
3014 |
lineSize := line size. |
|
4639 | 3015 |
|
3016 |
(endCol > lineSize) ifTrue:[ |
|
3017 |
^ (line copyTo:lineSize) , (String new:(endCol - lineSize)). |
|
4638 | 3018 |
]. |
4639 | 3019 |
^ 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
|
3020 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3021 |
|
1608
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
3022 |
listLineIsVisible:listLineNr |
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
3023 |
"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
|
3024 |
|
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
3025 |
|visibleLineNr "{ Class: SmallInteger }"| |
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
3026 |
|
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
3027 |
shown ifFalse:[^ false]. |
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
3028 |
listLineNr isNil ifTrue:[^ false]. |
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
3029 |
visibleLineNr := listLineNr + 1 - firstLineShown. |
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
3030 |
^ (visibleLineNr between:1 and:nLinesShown) |
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
3031 |
|
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
3032 |
"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
|
3033 |
! |
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
3034 |
|
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
|
3035 |
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
|
3036 |
"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
|
3037 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3038 |
|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
|
3039 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3040 |
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
|
3041 |
listLineNr isNil ifTrue:[^ nil]. |
2423
8b9c2946a5a7
absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
2412
diff
changeset
|
3042 |
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
|
3043 |
(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
|
3044 |
^ 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
|
3045 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3046 |
|
2224
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
3047 |
recomputeWidthOfWidestLineFor:aString |
4751 | 3048 |
<resource: #obsolete> |
3049 |
self recomputeWidthOfWidestLineFor:aString old:nil |
|
3050 |
! |
|
3051 |
||
3052 |
recomputeWidthOfWidestLineFor:newEntry old:oldEntry |
|
3053 |
"a new line was added (oldEntry == nil) or replaced oldEntry. |
|
3054 |
Update the widthOfWidestLine cache or flush it, if we cannot easily |
|
3055 |
figure out the overall text width" |
|
3056 |
||
3057 |
|newW oldW| |
|
2224
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
3058 |
|
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
3059 |
widthOfWidestLine notNil ifTrue:[ |
4751 | 3060 |
newEntry isNil ifTrue:[ |
3061 |
newW := 0 |
|
3062 |
] ifFalse:[ |
|
5111 | 3063 |
(newEntry isSingleByteString) ifTrue:[ |
5023
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
3064 |
newW := gc font widthOf:newEntry |
4751 | 3065 |
] ifFalse:[ |
3066 |
newW := newEntry widthOn:self |
|
3067 |
]. |
|
3068 |
]. |
|
3069 |
||
3070 |
newW >= widthOfWidestLine ifTrue:[ |
|
3071 |
widthOfWidestLine := newW. |
|
3072 |
] ifFalse:[ |
|
3073 |
oldEntry isNil ifTrue:[ |
|
3074 |
oldW := 0 |
|
3075 |
] ifFalse:[ |
|
5111 | 3076 |
(oldEntry isSingleByteString) ifTrue:[ |
5023
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
3077 |
oldW := gc font widthOf:oldEntry |
4751 | 3078 |
] ifFalse:[ |
3079 |
oldW := oldEntry widthOn:self |
|
3080 |
]. |
|
3081 |
]. |
|
3082 |
newW > oldW ifTrue:[ |
|
3083 |
"/ no change; new entries width is between this width and amx width |
|
3084 |
] ifFalse:[ |
|
3085 |
"/ new entry is smaller than oldEntry; if the oldEntry was the previos max, |
|
3086 |
"/ we don't know the new max |
|
3087 |
oldW = widthOfWidestLine ifTrue:[ |
|
3088 |
widthOfWidestLine := nil "/ means: unknown |
|
3089 |
] ifFalse:[ |
|
3090 |
"/ old line was not the widest, and new line is shorter; |
|
3091 |
"/ no change |
|
3092 |
] |
|
3093 |
] |
|
3094 |
]. |
|
2224
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
3095 |
]. |
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
3096 |
^ widthOfWidestLine |
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
3097 |
! |
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
3098 |
|
2225
65ac7cbffc60
added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents:
2224
diff
changeset
|
3099 |
suppressEmphasisInSelection |
65ac7cbffc60
added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents:
2224
diff
changeset
|
3100 |
"selection is shown with original emphasis" |
65ac7cbffc60
added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents:
2224
diff
changeset
|
3101 |
|
65ac7cbffc60
added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents:
2224
diff
changeset
|
3102 |
^ false |
65ac7cbffc60
added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents:
2224
diff
changeset
|
3103 |
! |
65ac7cbffc60
added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents:
2224
diff
changeset
|
3104 |
|
2181 | 3105 |
textChanged |
3106 |
"ignored here" |
|
3107 |
! |
|
3108 |
||
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
|
3109 |
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
|
3110 |
"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
|
3111 |
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
|
3112 |
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
|
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| |
75b8fb924904
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 |
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
|
3117 |
(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
|
3118 |
(list notNil) ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3119 |
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
|
3120 |
] ifFalse:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3121 |
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
|
3122 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3123 |
(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
|
3124 |
^ '' |
75b8fb924904
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 |
visibleLineOfY:y |
3818 | 3128 |
"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
|
3129 |
- 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
|
3130 |
|
1448
4220c80ab099
Do not reurn lineNumbers < 1 in #visibleLineOfY:
Stefan Vogel <sv@exept.de>
parents:
1433
diff
changeset
|
3131 |
^ (((y - textStartTop) // fontHeight) + 1) max:1 |
4220c80ab099
Do not reurn lineNumbers < 1 in #visibleLineOfY:
Stefan Vogel <sv@exept.de>
parents:
1433
diff
changeset
|
3132 |
|
4220c80ab099
Do not reurn lineNumbers < 1 in #visibleLineOfY:
Stefan Vogel <sv@exept.de>
parents:
1433
diff
changeset
|
3133 |
"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
|
3134 |
! |
75b8fb924904
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 |
|
75b8fb924904
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 |
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
|
3137 |
"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
|
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 |
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
|
3140 |
^ 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
|
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 |
|
75b8fb924904
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 |
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
|
3144 |
"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
|
3145 |
(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
|
3146 |
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
|
3147 |
|
75b8fb924904
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 |
|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
|
3149 |
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
|
3150 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3151 |
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
|
3152 |
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
|
3153 |
(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
|
3154 |
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
|
3155 |
(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
|
3156 |
^ 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
|
3157 |
! |
75b8fb924904
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 |
|
2559 | 3159 |
visibleStringFrom:aString |
3160 |
^ aString asString |
|
3161 |
! |
|
3162 |
||
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
|
3163 |
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
|
3164 |
"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
|
3165 |
- 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
|
3166 |
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
|
3167 |
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
|
3168 |
|
957
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3169 |
^ 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 |
"/ "for small width, its not worth searching for |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3172 |
"/ longest line ... |
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 |
"/ (width < 300) ifTrue:[^ innerWidth]. |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3175 |
"/ |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3176 |
"/ "for large lists, search may take longer than scrolling full |
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 |
"/ self size > 2000 ifTrue:[^ innerWidth]. |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3179 |
"/ |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3180 |
"/ " |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3181 |
"/ 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
|
3182 |
"/ " |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3183 |
"/ (viewBackground isColor not |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3184 |
"/ or:[viewBackground isDithered]) ifTrue:[ |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3185 |
"/ ^ width |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3186 |
"/ ]. |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3187 |
"/ |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3188 |
"/ w := self widthOfWidestLineBetween:firstLine and:lastLine. |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3189 |
"/ (w > innerWidth) ifTrue:[^ innerWidth]. |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3190 |
"/ ^ w |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3191 |
|
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3192 |
"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
|
3193 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3194 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3195 |
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
|
3196 |
"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
|
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 |
entry isNil ifTrue:[^ 0]. |
5111 | 3199 |
(entry isSingleByteString) ifTrue:[ |
5023
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
3200 |
^ gc 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
|
3201 |
]. |
634
1ca770b2c494
handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
3202 |
^ entry widthOn:self |
1ca770b2c494
handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
3203 |
|
1ca770b2c494
handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
3204 |
"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
|
3205 |
! |
75b8fb924904
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 |
|
75b8fb924904
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 |
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
|
3208 |
"return the width in pixels of the widest line in a range |
5480 | 3209 |
- used to optimize scrolling, by limiting the scrolled area; |
3210 |
not for scrollbar or other width related stuff which should be exact." |
|
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
|
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 |
|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
|
3213 |
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
|
3214 |
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
|
3215 |
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
|
3216 |
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
|
3217 |
|
75b8fb924904
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 |
includesNonStrings ifTrue:[ |
4765 | 3219 |
^ 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
|
3220 |
]. |
75b8fb924904
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 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3222 |
fontIsFixedWidth ifTrue:[ |
4765 | 3223 |
^ (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
|
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 |
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
|
3226 |
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
|
3227 |
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
|
3228 |
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
|
3229 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3230 |
(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
|
3231 |
(last > listSize) ifTrue:[ |
4765 | 3232 |
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
|
3233 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3234 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3235 |
self from:first to:last do:[:line | |
4765 | 3236 |
line notNil ifTrue:[ |
5111 | 3237 |
(line isSingleByteString) ifTrue:[ |
5023
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
3238 |
thisLen := gc font widthOf:line |
4765 | 3239 |
] ifFalse:[ |
3240 |
thisLen := line widthOn:self |
|
3241 |
]. |
|
3242 |
(thisLen > max) ifTrue:[ |
|
3243 |
max := thisLen |
|
3244 |
] |
|
3245 |
] |
|
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
|
3246 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3247 |
^ 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
|
3248 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3249 |
|
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
3250 |
withoutAnyColorEmphasis:line |
4046 | 3251 |
(line notNil and:[line isText]) ifTrue:[ |
4392 | 3252 |
^ line withoutAnyColorEmphasis |
4046 | 3253 |
]. |
3254 |
^ line |
|
3255 |
||
3256 |
" |
|
3257 |
'hello' asText colorizeAllWith:Color red. |
|
3258 |
('hello' asText colorizeAllWith:Color red) withoutForegroundColorEmphasis. |
|
4392 | 3259 |
('hello' asText colorizeAllWith:Color red) withoutAnyColorEmphasis. |
4046 | 3260 |
" |
4392 | 3261 |
|
3262 |
"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
|
3263 |
! |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
3264 |
|
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
3265 |
withoutBackgroundColorEmphasis:line |
4046 | 3266 |
(line notNil and:[line isText]) ifTrue:[ |
3267 |
^ line withoutBackgroundColorEmphasis |
|
3268 |
]. |
|
3269 |
^ line |
|
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
3270 |
! |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
3271 |
|
2090
85c0dd8a4281
selection over colored text - again
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
3272 |
withoutColorEmphasis:line |
4046 | 3273 |
(line notNil and:[line isText]) ifTrue:[ |
3274 |
^ line withoutForegroundColorEmphasis |
|
3275 |
]. |
|
3276 |
^ line |
|
2090
85c0dd8a4281
selection over colored text - again
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
3277 |
! |
85c0dd8a4281
selection over colored text - again
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
3278 |
|
85c0dd8a4281
selection over colored text - again
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
3279 |
withoutColorEmphasis:line ifFg:fg andBg:bg |
85c0dd8a4281
selection over colored text - again
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
3280 |
"/ remove lines color emphasis, to enforce color. |
85c0dd8a4281
selection over colored text - again
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
3281 |
"/ otherwise blue text is not visible if selection-bg is blue |
4046 | 3282 |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3283 |
(line notNil |
4046 | 3284 |
and:[line isText |
3285 |
and:[fg ~= fgColor or:[bg ~= bgColor]]]) ifTrue:[ |
|
4392 | 3286 |
^ line withoutAnyColorEmphasis |
2090
85c0dd8a4281
selection over colored text - again
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
3287 |
]. |
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
3288 |
^ line |
2090
85c0dd8a4281
selection over colored text - again
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
3289 |
|
4392 | 3290 |
"Created: / 15-12-1999 / 23:19:30 / cg" |
2090
85c0dd8a4281
selection over colored text - again
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
3291 |
! |
85c0dd8a4281
selection over colored text - again
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
3292 |
|
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
|
3293 |
xOfCol:col inVisibleLine:visLineNr |
2209 | 3294 |
"given a visible line- and colNr, return the x-coordinate in view" |
3295 |
||
3296 |
|line lineSize tcol lText| |
|
3297 |
||
3298 |
col == 1 ifTrue:[ |
|
4651 | 3299 |
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
|
3300 |
] ifFalse:[ |
4651 | 3301 |
tcol := col - 1. |
3302 |
||
3303 |
line := self visibleAt:visLineNr. |
|
3304 |
(fontIsFixedWidth |
|
5111 | 3305 |
and:[line isNil or:[line isSingleByteString]]) |
4651 | 3306 |
ifTrue:[ |
3307 |
lText := (tcol * fontWidth) |
|
3308 |
] ifFalse:[ |
|
3309 |
line notNil ifTrue:[ |
|
3310 |
lineSize := line string size |
|
3311 |
] ifFalse:[ |
|
3312 |
lineSize := 0 |
|
3313 |
]. |
|
3314 |
(lineSize == 0) ifTrue:[ |
|
3315 |
lText := (tcol * fontWidth) |
|
3316 |
] ifFalse:[ |
|
3317 |
(lineSize < col) ifTrue:[ |
|
3318 |
lText := (line widthOn:self) + (fontWidth * (tcol - lineSize)) |
|
3319 |
] ifFalse:[ |
|
5111 | 3320 |
(line isSingleByteString) ifTrue:[ |
5023
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
3321 |
lText := (gc font widthOf:line from:1 to:tcol) |
4651 | 3322 |
] ifFalse:[ |
3323 |
lText := line widthFrom:1 to:tcol on:self. |
|
3324 |
] |
|
3325 |
] |
|
3326 |
] |
|
3327 |
] |
|
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
|
3328 |
]. |
2209 | 3329 |
^ lText + textStartLeft |
670
8e381269591c
more fixes for non-string entries
Claus Gittinger <cg@exept.de>
parents:
668
diff
changeset
|
3330 |
|
1656
1202fbc95970
some fixes forvariable fonts on win32
Claus Gittinger <cg@exept.de>
parents:
1637
diff
changeset
|
3331 |
"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
|
3332 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3333 |
|
1608
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
3334 |
yOfLine:lineNr |
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
3335 |
"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
|
3336 |
- 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
|
3337 |
|
4641 | 3338 |
|visLine| |
3339 |
||
3340 |
visLine := self listLineToVisibleLine:lineNr. |
|
3341 |
visLine isNil ifTrue:[ |
|
3342 |
^ nil |
|
3343 |
]. |
|
3344 |
^ self yOfVisibleLine:visLine |
|
1608
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
3345 |
|
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
3346 |
"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
|
3347 |
! |
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
3348 |
|
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
|
3349 |
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
|
3350 |
"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
|
3351 |
- 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
|
3352 |
|
3819 | 3353 |
"/ care for visLineNr being nil during initialization |
3354 |
^ (((visLineNr ? 1) - 1) * fontHeight) + textStartTop |
|
3398
d5c915fe3d92
oops - ListModelView protocol
Claus Gittinger <cg@exept.de>
parents:
3339
diff
changeset
|
3355 |
! |
d5c915fe3d92
oops - ListModelView protocol
Claus Gittinger <cg@exept.de>
parents:
3339
diff
changeset
|
3356 |
|
d5c915fe3d92
oops - ListModelView protocol
Claus Gittinger <cg@exept.de>
parents:
3339
diff
changeset
|
3357 |
yVisibleToLineNr:yVisible |
d5c915fe3d92
oops - ListModelView protocol
Claus Gittinger <cg@exept.de>
parents:
3339
diff
changeset
|
3358 |
|vL| |
d5c915fe3d92
oops - ListModelView protocol
Claus Gittinger <cg@exept.de>
parents:
3339
diff
changeset
|
3359 |
|
d5c915fe3d92
oops - ListModelView protocol
Claus Gittinger <cg@exept.de>
parents:
3339
diff
changeset
|
3360 |
vL := self visibleLineOfY:yVisible. |
d5c915fe3d92
oops - ListModelView protocol
Claus Gittinger <cg@exept.de>
parents:
3339
diff
changeset
|
3361 |
^ self visibleLineToListLine:vL |
d5c915fe3d92
oops - ListModelView protocol
Claus Gittinger <cg@exept.de>
parents:
3339
diff
changeset
|
3362 |
|
d5c915fe3d92
oops - ListModelView protocol
Claus Gittinger <cg@exept.de>
parents:
3339
diff
changeset
|
3363 |
"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
|
3364 |
! ! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3365 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3366 |
!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
|
3367 |
|
4303 | 3368 |
characterPositionOfLine:lineNr col:colArg |
2812 | 3369 |
"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
|
3370 |
- used with compiler's error-positioning, which is based on character positions |
2812 | 3371 |
of the contents-string." |
3372 |
||
4468
6d711c19c529
comment/format in: #characterPositionOfLine:col:
Claus Gittinger <cg@exept.de>
parents:
4463
diff
changeset
|
3373 |
|lineString charPos lineEndCharSize col| |
3314 | 3374 |
|
3854 | 3375 |
lineEndCharSize := self lineEndCRLF ifTrue:[2] ifFalse:[1]. |
2812 | 3376 |
|
3377 |
self checkForExistingLine:lineNr. |
|
4468
6d711c19c529
comment/format in: #characterPositionOfLine:col:
Claus Gittinger <cg@exept.de>
parents:
4463
diff
changeset
|
3378 |
charPos := 1. |
2812 | 3379 |
1 to:(lineNr - 1) do:[:lnr | |
4303 | 3380 |
lineString := self at:lnr. |
3381 |
lineString notNil ifTrue:[ |
|
4468
6d711c19c529
comment/format in: #characterPositionOfLine:col:
Claus Gittinger <cg@exept.de>
parents:
4463
diff
changeset
|
3382 |
charPos := charPos + (lineString string "withoutTrailingSeparators") size |
4303 | 3383 |
]. |
4468
6d711c19c529
comment/format in: #characterPositionOfLine:col:
Claus Gittinger <cg@exept.de>
parents:
4463
diff
changeset
|
3384 |
charPos := charPos + lineEndCharSize "the return-character" |
2812 | 3385 |
]. |
4303 | 3386 |
|
4759 | 3387 |
"/ if beyond end of line, be careful to not advance into next line. |
3388 |
"/ otherwise, syntaxHighlighter (and others) walk into trouble, |
|
3389 |
"/ if clicked on a space beyond a line's end. |
|
3390 |
col := colArg min:((self at:lineNr) size + 1). |
|
4468
6d711c19c529
comment/format in: #characterPositionOfLine:col:
Claus Gittinger <cg@exept.de>
parents:
4463
diff
changeset
|
3391 |
^ charPos + col - 1 |
3314 | 3392 |
|
3393 |
"Modified: / 04-07-2006 / 19:14:25 / fm" |
|
4303 | 3394 |
"Modified: / 21-08-2011 / 11:03:19 / cg" |
2812 | 3395 |
! |
3396 |
||
3397 |
colOfCharacterPosition:charPos |
|
3398 |
"given a character index within the contents-string, |
|
3399 |
return the column number where the character is |
|
3400 |
- used to find line to hilight from Compilers error-position" |
|
3401 |
||
3402 |
|line| |
|
3403 |
||
3404 |
line := self lineOfCharacterPosition:charPos. |
|
3405 |
^ charPos - (self characterPositionOfLine:line col:1) + 1. |
|
3406 |
||
3407 |
! |
|
3408 |
||
1525
6079f38d5e89
added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents:
1497
diff
changeset
|
3409 |
currentLine |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3410 |
"the current line (for relative gotos); |
1525
6079f38d5e89
added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents:
1497
diff
changeset
|
3411 |
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
|
3412 |
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
|
3413 |
|
6079f38d5e89
added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents:
1497
diff
changeset
|
3414 |
^ firstLineShown |
6079f38d5e89
added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents:
1497
diff
changeset
|
3415 |
|
6079f38d5e89
added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents:
1497
diff
changeset
|
3416 |
"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
|
3417 |
! |
6079f38d5e89
added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents:
1497
diff
changeset
|
3418 |
|
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
|
3419 |
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
|
3420 |
"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
|
3421 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3422 |
^ 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
|
3423 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3424 |
|
311
cddf10b2207e
added query for height with n lines
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
3425 |
heightForLines:numberOfLines |
cddf10b2207e
added query for height with n lines
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
3426 |
"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
|
3427 |
|
5023
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
3428 |
|realFont| |
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
3429 |
|
311
cddf10b2207e
added query for height with n lines
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
3430 |
"need a device font for query" |
5023
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
3431 |
realFont := gc createFontOnDevice. |
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
3432 |
^ numberOfLines * fontHeight + topMargin + realFont descent + (lineSpacing) + (margin * 2) |
311
cddf10b2207e
added query for height with n lines
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
3433 |
|
cddf10b2207e
added query for height with n lines
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
3434 |
"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
|
3435 |
! |
cddf10b2207e
added query for height with n lines
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
3436 |
|
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
|
3437 |
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
|
3438 |
"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
|
3439 |
- 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
|
3440 |
|
5023
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
3441 |
| numLines realFont| |
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
|
3442 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3443 |
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
|
3444 |
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
|
3445 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3446 |
"/ |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3447 |
"/ 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
|
3448 |
"/ |
75b8fb924904
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 |
"/ 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
|
3450 |
"/ 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
|
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 |
" |
75b8fb924904
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 |
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
|
3454 |
" |
5023
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
3455 |
realFont := gc createFontOnDevice. |
5585 | 3456 |
^ numLines * fontHeight "don't 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
|
3457 |
"/ + textStartTop |
5585 | 3458 |
- (lineSpacing // 2) |
5023
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
3459 |
+ (realFont descent) |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3460 |
"/ + (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
|
3461 |
"/ + (font descent * 2) "makes it look better" |
5585 | 3462 |
. |
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
|
3463 |
|
75b8fb924904
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 |
"/ "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
|
3465 |
"/ (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
|
3466 |
"/ ^ 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
|
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 |
"/ "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
|
3469 |
"/ 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
|
3470 |
"/ |
75b8fb924904
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 |
"/ ^ (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
|
3472 |
! |
75b8fb924904
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 |
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
|
3475 |
"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
|
3476 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3477 |
^ 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
|
3478 |
! |
75b8fb924904
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 |
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
|
3481 |
"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
|
3482 |
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
|
3483 |
|
566 | 3484 |
|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
|
3485 |
|
75b8fb924904
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 |
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
|
3487 |
lineString notNil ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3488 |
indent := lineString leftIndent. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3489 |
indent == lineString size ifTrue:[^ 0]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3490 |
^ 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
|
3491 |
]. |
75b8fb924904
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 |
^ 0 |
566 | 3493 |
|
3494 |
"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
|
3495 |
! |
75b8fb924904
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 |
|
75b8fb924904
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 |
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
|
3498 |
"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
|
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 |
^ 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
|
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 |
|
75b8fb924904
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 |
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
|
3504 |
"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
|
3505 |
|
75b8fb924904
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 |
|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
|
3507 |
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
|
3508 |
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
|
3509 |
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
|
3510 |
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
|
3511 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3512 |
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
|
3513 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3514 |
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
|
3515 |
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
|
3516 |
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
|
3517 |
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
|
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 |
(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
|
3520 |
(last > listSize) ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3521 |
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
|
3522 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3523 |
self from:first to:last do:[:lineString | |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3524 |
lineString notNil ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3525 |
thisLen := lineString size. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3526 |
(thisLen > max) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3527 |
max := thisLen |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3528 |
] |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3529 |
] |
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
|
3530 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3531 |
^ 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
|
3532 |
|
75b8fb924904
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 |
! |
75b8fb924904
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 |
|
587
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3535 |
lineIsFullyVisible:line |
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3536 |
"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
|
3537 |
|
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3538 |
(line >= firstLineShown |
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3539 |
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
|
3540 |
^ false. |
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3541 |
|
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3542 |
"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
|
3543 |
! |
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3544 |
|
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
|
3545 |
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
|
3546 |
"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
|
3547 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3548 |
(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
|
3549 |
^ 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
|
3550 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3551 |
|
2812 | 3552 |
lineOfCharacterPosition:charPos |
3553 |
"given a character index within the contents-string, |
|
3554 |
return the lineNumber where the character is |
|
4448
2e4bb12f298c
changed: #lineOfCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
4444
diff
changeset
|
3555 |
- used to find line to hilight from compiler's error-position" |
2812 | 3556 |
|
4303 | 3557 |
|lineNr sum lastLine lineEndCharSize l| |
3314 | 3558 |
|
4280
61a16b0a99d5
changed: #lineOfCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
4247
diff
changeset
|
3559 |
lineEndCharSize := self lineEndCRLF ifTrue:[2] ifFalse:[1]. |
2812 | 3560 |
|
3561 |
lineNr := 1. |
|
3562 |
sum := 0. |
|
3563 |
lastLine := self size. |
|
3564 |
[(sum < charPos) and:[lineNr <= lastLine]] whileTrue:[ |
|
4303 | 3565 |
l := (self at:lineNr) ? ''. |
3566 |
sum := sum + (l string "withoutTrailingSeparators" size) + lineEndCharSize. |
|
4280
61a16b0a99d5
changed: #lineOfCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
4247
diff
changeset
|
3567 |
lineNr := lineNr + 1 |
2812 | 3568 |
]. |
3569 |
sum == charPos ifTrue:[ |
|
4280
61a16b0a99d5
changed: #lineOfCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
4247
diff
changeset
|
3570 |
^ lineNr |
2812 | 3571 |
]. |
3572 |
||
4448
2e4bb12f298c
changed: #lineOfCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
4444
diff
changeset
|
3573 |
^ (lineNr - 1) max:1 |
2812 | 3574 |
|
3314 | 3575 |
"Modified: / 04-07-2006 / 19:13:32 / fm" |
4303 | 3576 |
"Modified: / 21-08-2011 / 10:50:12 / cg" |
2812 | 3577 |
! |
3578 |
||
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
|
3579 |
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
|
3580 |
"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
|
3581 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3582 |
^ 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
|
3583 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3584 |
|
4607 | 3585 |
preferredExtentForContents |
3586 |
^ (self widthOfContents @ self heightOfContents) |
|
3587 |
! |
|
3588 |
||
678
c1967a46b2c1
added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents:
670
diff
changeset
|
3589 |
preferredExtentForLines:numLines cols:numCols |
5023
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
3590 |
^ (((gc font widthOf:'x') * numCols + margin + margin) |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3591 |
@ |
5023
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
3592 |
(fontHeight * numLines + margin + margin + gc font descent + lineSpacing + topMargin)). |
688 | 3593 |
|
3594 |
"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
|
3595 |
! |
c1967a46b2c1
added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents:
670
diff
changeset
|
3596 |
|
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
3597 |
supportsSyntaxElements |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
3598 |
"see CodeView2::TextView" |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
3599 |
|
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
3600 |
^ false |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
3601 |
! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
3602 |
|
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
|
3603 |
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
|
3604 |
"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
|
3605 |
- 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
|
3606 |
|
4749 | 3607 |
|f d |
3608 |
start "{ Class: SmallInteger }" |
|
3609 |
stop "{ Class: SmallInteger }" |
|
3610 |
lengthOfLongestString "{ Class: SmallInteger }" |
|
3611 |
lengthOfLongestLine "{ Class: SmallInteger }" |
|
3612 |
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
|
3613 |
|
4752 | 3614 |
list isEmptyOrNil ifTrue:[^ 0]. |
4751 | 3615 |
widthOfWidestLine notNil ifTrue:[ |
3616 |
"/ already computed (cached); this cache is cleared when the contents is modified |
|
3617 |
^ widthOfWidestLine + (leftMargin * 2) |
|
3618 |
]. |
|
607
67462978fb20
fixed #widthOfContents if no device is known
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
3619 |
|
5023
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
3620 |
(d := gc device) isNil ifTrue:[ |
4522 | 3621 |
"/ mhmh - really dont know yet |
3622 |
d := Screen current |
|
607
67462978fb20
fixed #widthOfContents if no device is known
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
3623 |
]. |
5023
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
3624 |
f := gc font onDevice:d. |
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
3625 |
gc font:f. |
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
|
3626 |
|
4751 | 3627 |
checkedLinesForWidthOfContentsComputation isNil ifTrue:[ |
3628 |
start := 1. |
|
3629 |
stop := list size |
|
3630 |
] ifFalse:[ |
|
3631 |
checkedLinesForWidthOfContentsComputation >= 0 ifTrue:[ |
|
3632 |
start := 1. |
|
4770 | 3633 |
stop := (checkedLinesForWidthOfContentsComputation min:list size) |
4751 | 3634 |
] ifFalse:[ |
3635 |
stop := list size. |
|
4770 | 3636 |
start := (list size + 1 + checkedLinesForWidthOfContentsComputation) max:1. |
4751 | 3637 |
] |
3638 |
]. |
|
4749 | 3639 |
|
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
|
3640 |
includesNonStrings ifTrue:[ |
4749 | 3641 |
max := 0. |
3642 |
start to:stop do:[:lineNr | |
|
3643 |
|entry w| |
|
3644 |
||
3645 |
entry := list at:lineNr. |
|
3646 |
entry notNil ifTrue:[ |
|
5111 | 3647 |
(entry isSingleByteString) ifTrue:[ |
4749 | 3648 |
w := f widthOf:entry |
3649 |
] ifFalse:[ |
|
3650 |
w := entry widthOn:self |
|
3651 |
]. |
|
3652 |
max := max max:w. |
|
3653 |
]. |
|
3654 |
]. |
|
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
|
3655 |
] ifFalse:[ |
4522 | 3656 |
fontIsFixedWidth ifTrue:[ |
3657 |
max := lengthOfLongestString := 0. |
|
3658 |
list notNil ifTrue:[ |
|
4749 | 3659 |
start to:stop do:[:lineNr | |
3660 |
|line| |
|
3661 |
||
3662 |
line := list at:lineNr. |
|
4522 | 3663 |
line notNil ifTrue:[ |
5111 | 3664 |
(line isSingleByteString) ifTrue:[ |
4522 | 3665 |
line size > lengthOfLongestString ifTrue:[ |
3666 |
lengthOfLongestString := line size |
|
3667 |
]. |
|
3668 |
] ifFalse:[ |
|
3669 |
max := max max:(line widthOn:self) |
|
3670 |
] |
|
3671 |
] |
|
3672 |
]. |
|
3673 |
max := max max:(lengthOfLongestString * fontWidth) |
|
3674 |
]. |
|
3675 |
] ifFalse:[ |
|
4732 | 3676 |
max := lengthOfLongestLine := 0. |
3677 |
list notNil ifTrue:[ |
|
4749 | 3678 |
start to:stop do:[:lineNr | |
3679 |
|line len| |
|
3680 |
||
5090 | 3681 |
line := list at:lineNr ifAbsent:nil. |
4732 | 3682 |
line notNil ifTrue:[ |
3683 |
len := line size. |
|
3684 |
"/ consider this a speed hack (not exact, but fast) |
|
3685 |
lengthOfLongestLine := lengthOfLongestLine max:len. |
|
3686 |
len > (lengthOfLongestLine // 3) ifTrue:[ |
|
3687 |
max := max max:(line widthOn:self) |
|
3688 |
]. |
|
3689 |
] |
|
4522 | 3690 |
]. |
3691 |
]. |
|
3692 |
]. |
|
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
|
3693 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3694 |
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
|
3695 |
^ max + (leftMargin * 2) |
607
67462978fb20
fixed #widthOfContents if no device is known
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
3696 |
|
1700
3538310c2724
fixed widthOfContents with variable fonts (win32);
Claus Gittinger <cg@exept.de>
parents:
1699
diff
changeset
|
3697 |
"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
|
3698 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3699 |
|
1716 | 3700 |
widthOfLine:lineNr |
3701 |
"return the width of a line in pixels" |
|
3702 |
||
1990 | 3703 |
|line f d| |
1716 | 3704 |
|
3705 |
list isNil ifTrue:[^ 0]. |
|
3706 |
lineNr > list size ifTrue:[^ 0]. |
|
3707 |
line := list at:lineNr. |
|
3708 |
list isNil ifTrue:[^ 0]. |
|
3709 |
||
5649
6f57a64ccaa1
Replace all `self graphicsDevice` with `device`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
5647
diff
changeset
|
3710 |
(d := device) isNil ifTrue:[ |
4765 | 3711 |
"/ mhmh - really dont know yet |
3712 |
d := Screen current |
|
1716 | 3713 |
]. |
5023
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
3714 |
f := gc font onDevice:d. |
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
3715 |
gc font:f. |
1716 | 3716 |
|
5111 | 3717 |
(line isSingleByteString) ifTrue:[ |
4765 | 3718 |
^ f widthOf:line |
1716 | 3719 |
]. |
3720 |
^ line widthOn:self |
|
3721 |
||
3722 |
"Created: / 10.11.1998 / 23:59:20 / cg" |
|
3723 |
"Modified: / 11.11.1998 / 15:25:07 / cg" |
|
3724 |
! |
|
3725 |
||
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
|
3726 |
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
|
3727 |
"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
|
3728 |
- 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
|
3729 |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3730 |
^ 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
|
3731 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3732 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3733 |
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
|
3734 |
"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
|
3735 |
- 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
|
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 |
^ (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
|
3738 |
! ! |
75b8fb924904
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 |
|
75b8fb924904
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 |
!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
|
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 |
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
|
3743 |
"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
|
3744 |
|
4987 | 3745 |
super flash. |
3746 |
"/ self redrawInverted. |
|
3747 |
"/ Delay waitForSeconds:0.1. |
|
3748 |
"/ 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
|
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 |
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
|
3752 |
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
|
3753 |
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
|
3754 |
" |
75b8fb924904
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 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3757 |
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
|
3758 |
"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
|
3759 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3760 |
shown ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3761 |
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
|
3762 |
] |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3763 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3764 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3765 |
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
|
3766 |
"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
|
3767 |
|
75b8fb924904
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 |
|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
|
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 |
shown ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3771 |
"if first line to redraw is above 1st visible line, |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3772 |
start redraw at 1st visible line" |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3773 |
(lineNr < firstLineShown) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3774 |
first := firstLineShown |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3775 |
] ifFalse:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3776 |
first := lineNr |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3777 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3778 |
visibleLine := self listLineToVisibleLine:first. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3779 |
visibleLine notNil ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3780 |
self redrawFromVisibleLine:visibleLine to:nLinesShown |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3781 |
] |
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
|
3782 |
] |
75b8fb924904
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 |
|
2605
4f8c7e50f217
added redrawFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2577
diff
changeset
|
3785 |
redrawFromLine:startLine col:startCol toLine:endLine col:endCol |
4f8c7e50f217
added redrawFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2577
diff
changeset
|
3786 |
shown ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3787 |
self redrawLine:startLine from:startCol. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3788 |
endLine > (startLine+1) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3789 |
self redrawFromLine:startLine+1 to:endLine-1 |
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 |
self redrawLine:endLine from:1 to:endCol. |
2605
4f8c7e50f217
added redrawFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2577
diff
changeset
|
3792 |
] |
4f8c7e50f217
added redrawFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2577
diff
changeset
|
3793 |
! |
4f8c7e50f217
added redrawFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2577
diff
changeset
|
3794 |
|
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
|
3795 |
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
|
3796 |
"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
|
3797 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3798 |
|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
|
3799 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3800 |
shown ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3801 |
lastLineShown := firstLineShown + nLinesShown - 1. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3802 |
(start <= lastLineShown) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3803 |
(end >= firstLineShown) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3804 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3805 |
"if first line to redraw is above 1st visible line, |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3806 |
start redraw at 1st visible line" |
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 |
(start < firstLineShown) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3809 |
first := firstLineShown |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3810 |
] ifFalse:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3811 |
first := start |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3812 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3813 |
(end > lastLineShown) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3814 |
last := lastLineShown |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3815 |
] ifFalse:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3816 |
last := end |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3817 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3818 |
visibleFirst := self listLineToVisibleLine:first. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3819 |
visibleLast := self listLineToVisibleLine:last. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3820 |
self redrawFromVisibleLine:visibleFirst to:visibleLast |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3821 |
] |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3822 |
] |
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
|
3823 |
] |
75b8fb924904
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 |
|
75b8fb924904
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 |
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
|
3827 |
"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
|
3828 |
|
75b8fb924904
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 |
shown ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3830 |
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
|
3831 |
] |
75b8fb924904
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 |
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
|
3835 |
"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
|
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 |
|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
|
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 |
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
|
3840 |
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
|
3841 |
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
|
3842 |
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
|
3843 |
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
|
3844 |
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
|
3845 |
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
|
3846 |
! |
75b8fb924904
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 |
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
|
3849 |
"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
|
3850 |
|
75b8fb924904
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| |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3852 |
|
75b8fb924904
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 |
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
|
3854 |
visibleLine notNil ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3855 |
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
|
3856 |
] |
75b8fb924904
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 |
! |
75b8fb924904
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 |
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
|
3860 |
"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
|
3861 |
|
75b8fb924904
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| |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3863 |
|
75b8fb924904
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 |
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
|
3865 |
visibleLine notNil ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3866 |
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
|
3867 |
] |
75b8fb924904
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 |
! |
75b8fb924904
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 |
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
|
3871 |
"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
|
3872 |
|
75b8fb924904
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| |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3874 |
|
75b8fb924904
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 |
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
|
3876 |
visibleLine notNil ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3877 |
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
|
3878 |
] |
75b8fb924904
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 |
! |
75b8fb924904
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 |
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
|
3882 |
"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
|
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 |
|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
|
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 |
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
|
3887 |
visibleLine notNil ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3888 |
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
|
3889 |
] |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3890 |
! |
75b8fb924904
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 |
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
|
3893 |
"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
|
3894 |
|
75b8fb924904
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 |
shown ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3896 |
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
|
3897 |
] |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3898 |
! |
75b8fb924904
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 |
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
|
3901 |
"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
|
3902 |
|
75b8fb924904
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 |
shown ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3904 |
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
|
3905 |
] |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3906 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3907 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3908 |
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
|
3909 |
"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
|
3910 |
|
75b8fb924904
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 |
shown ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3912 |
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
|
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 |
! |
75b8fb924904
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 |
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
|
3917 |
"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
|
3918 |
|
75b8fb924904
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 |
shown ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3920 |
startCol == endCol ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3921 |
self redrawVisibleLine:visLineNr col:startCol |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3922 |
] ifFalse:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3923 |
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
|
3924 |
] |
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
|
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 |
! ! |
75b8fb924904
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 |
!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
|
3929 |
|
75b8fb924904
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 |
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
|
3931 |
"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
|
3932 |
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
|
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 |
^ 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
|
3935 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3936 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3937 |
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
|
3938 |
"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
|
3939 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3940 |
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
|
3941 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3942 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3943 |
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
|
3944 |
"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
|
3945 |
|
75b8fb924904
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 |
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
|
3947 |
! |
75b8fb924904
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 |
|
1910
0d68937d088b
removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents:
1888
diff
changeset
|
3949 |
horizontalScrollStep |
0d68937d088b
removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents:
1888
diff
changeset
|
3950 |
"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
|
3951 |
Here, the scrolling unit is characters." |
0d68937d088b
removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents:
1888
diff
changeset
|
3952 |
|
5023
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
3953 |
^ gc font width |
1910
0d68937d088b
removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents:
1888
diff
changeset
|
3954 |
|
0d68937d088b
removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents:
1888
diff
changeset
|
3955 |
"Created: / 21.5.1999 / 15:55:06 / cg" |
0d68937d088b
removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents:
1888
diff
changeset
|
3956 |
! |
0d68937d088b
removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents:
1888
diff
changeset
|
3957 |
|
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
|
3958 |
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
|
3959 |
"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
|
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 |
|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
|
3962 |
|
75b8fb924904
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 |
(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
|
3964 |
|
2423
8b9c2946a5a7
absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
2412
diff
changeset
|
3965 |
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
|
3966 |
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
|
3967 |
|
75b8fb924904
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 |
xWant := self xOfCol:aCol inVisibleLine:visLnr. |
2429
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2427
diff
changeset
|
3969 |
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
|
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 |
" |
75b8fb924904
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 |
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
|
3973 |
(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
|
3974 |
" |
75b8fb924904
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 |
"/ ((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
|
3976 |
"/ ^ 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
|
3977 |
"/ ]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3978 |
|
75b8fb924904
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 |
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
|
3981 |
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
|
3982 |
" |
5023
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
3983 |
(xVis >= 0 and:[xVis < (width - gc font width)]) ifTrue:[^ 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
|
3984 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3985 |
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
|
3986 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3987 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3988 |
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
|
3989 |
"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
|
3990 |
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
|
3991 |
|
1637
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
3992 |
|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
|
3993 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3994 |
(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
|
3995 |
|
895
02d8e324dca5
Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents:
890
diff
changeset
|
3996 |
"/ 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
|
3997 |
"/ 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
|
3998 |
"/ 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
|
3999 |
"/ |
02d8e324dca5
Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents:
890
diff
changeset
|
4000 |
"/ shown ifFalse:[ |
02d8e324dca5
Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents:
890
diff
changeset
|
4001 |
"/ firstLineShown := (aListLineNr - 1) max:1. |
02d8e324dca5
Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents:
890
diff
changeset
|
4002 |
"/ firstLineShown > (list size - nFullLinesShown) ifTrue:[ |
02d8e324dca5
Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents:
890
diff
changeset
|
4003 |
"/ firstLineShown := list size - nFullLinesShown |
02d8e324dca5
Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents:
890
diff
changeset
|
4004 |
"/ ]. |
02d8e324dca5
Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents:
890
diff
changeset
|
4005 |
"/ list size <= nFullLinesShown ifTrue:[ |
02d8e324dca5
Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents:
890
diff
changeset
|
4006 |
"/ firstLineShown := 1 |
02d8e324dca5
Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents:
890
diff
changeset
|
4007 |
"/ ]. |
02d8e324dca5
Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents:
890
diff
changeset
|
4008 |
"/ ^ self |
02d8e324dca5
Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents:
890
diff
changeset
|
4009 |
"/ ]. |
691
906e4d67b9cf
fixed makeLineVisible; when not-yet realized
Claus Gittinger <cg@exept.de>
parents:
688
diff
changeset
|
4010 |
|
2216 | 4011 |
(self needScrollToMakeLineVisible:aListLineNr) ifFalse:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4012 |
^ self |
1637
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
4013 |
]. |
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
4014 |
|
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
4015 |
(aListLineNr < nFullLinesShown) ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4016 |
"/ at the very top of the list - show from top |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4017 |
newTopLine := 1 |
1637
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
4018 |
] ifFalse:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4019 |
(nFullLinesShown < 3) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4020 |
"/ a small view - show from that line |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4021 |
newTopLine := aListLineNr |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4022 |
] ifFalse:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4023 |
bott := self numberOfLines - (nFullLinesShown - 1). |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4024 |
(aListLineNr > bott) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4025 |
"/ 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
|
4026 |
newTopLine := bott |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4027 |
] ifFalse:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4028 |
"/ somewhere else - place selected line into the middle of |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4029 |
"/ the view |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4030 |
newTopLine := (aListLineNr - (nFullLinesShown // 2) + 1) |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4031 |
] |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4032 |
] |
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
|
4033 |
]. |
1637
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
4034 |
|
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
4035 |
self scrollToLine:newTopLine. |
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
4036 |
|
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
4037 |
"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
|
4038 |
"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
|
4039 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4040 |
|
75b8fb924904
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 |
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
|
4042 |
"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
|
4043 |
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
|
4044 |
|
1808 | 4045 |
|index list| |
1319 | 4046 |
|
4047 |
(list := self list) notNil ifTrue:[ |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4048 |
index := list indexOf:someString. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4049 |
index ~~ 0 ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4050 |
self makeLineVisible:index |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4051 |
] |
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
|
4052 |
] |
1319 | 4053 |
|
4054 |
"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
|
4055 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4056 |
|
1637
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
4057 |
needScrollToMakeLine:aListLineNr |
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
4058 |
"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
|
4059 |
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
|
4060 |
|
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
4061 |
(aListLineNr >= firstLineShown) ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4062 |
(aListLineNr < (firstLineShown + nFullLinesShown)) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4063 |
^ false |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4064 |
] |
1637
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
4065 |
]. |
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
4066 |
^ true |
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
4067 |
|
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
4068 |
"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
|
4069 |
"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
|
4070 |
! |
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
4071 |
|
2216 | 4072 |
needScrollToMakeLineVisible:aListLineNr |
4073 |
"return true, if a scroll is needd to make a line visible. |
|
4074 |
Numbering starts with 1 for the very first line of the text." |
|
4075 |
||
4076 |
(aListLineNr >= firstLineShown) ifTrue:[ |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4077 |
(aListLineNr < (firstLineShown + nFullLinesShown)) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4078 |
^ false |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4079 |
] |
2216 | 4080 |
]. |
4081 |
^ true |
|
4082 |
||
4083 |
"Created: / 7.8.1998 / 15:13:51 / cg" |
|
4084 |
"Modified: / 7.8.1998 / 15:14:44 / cg" |
|
4085 |
! |
|
4086 |
||
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
|
4087 |
pageDown |
4203 | 4088 |
"change origin to display the next page" |
4089 |
||
4201 | 4090 |
"/ self scrollTo:(viewOrigin + (0 @ height)) |
4203 | 4091 |
self scrollToLine:(self firstLineShown + nFullLinesShown) |
4092 |
||
4093 |
"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
|
4094 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4095 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4096 |
pageUp |
4203 | 4097 |
"change origin to display the previous page" |
4098 |
||
4201 | 4099 |
"/ self scrollTo:(viewOrigin - (0 @ height)) |
4203 | 4100 |
self scrollToLine:(self firstLineShown - nFullLinesShown) |
4101 |
||
4102 |
"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
|
4103 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4104 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4105 |
scrollDown:nLines |
394
795f293f8520
fixed debris-leftover in scrollDown
Claus Gittinger <cg@exept.de>
parents:
392
diff
changeset
|
4106 |
"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
|
4107 |
|
1911 | 4108 |
nLines ~~ 0 ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4109 |
self scrollTo:(viewOrigin + (0 @ (fontHeight * nLines))) |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4110 |
redraw:true |
1468 | 4111 |
] |
4112 |
||
1911 | 4113 |
"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
|
4114 |
! |
75b8fb924904
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 |
|
808
0fb219efdfa2
Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents:
798
diff
changeset
|
4116 |
scrollDownPixels:pix |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4117 |
"change origin to scroll down some pixels |
808
0fb219efdfa2
Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents:
798
diff
changeset
|
4118 |
(towards the bottom of the text) |
0fb219efdfa2
Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents:
798
diff
changeset
|
4119 |
THIS WILL VANISH!!" |
0fb219efdfa2
Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents:
798
diff
changeset
|
4120 |
|
1468 | 4121 |
pix > 0 ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4122 |
self scrollTo:(viewOrigin + (0 @ (pix abs))) redraw:true |
1468 | 4123 |
] |
4124 |
||
4125 |
||
808
0fb219efdfa2
Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents:
798
diff
changeset
|
4126 |
! |
0fb219efdfa2
Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents:
798
diff
changeset
|
4127 |
|
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
|
4128 |
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
|
4129 |
"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
|
4130 |
|
1756 | 4131 |
|nPixel| |
4132 |
||
2429
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2427
diff
changeset
|
4133 |
nPixel := aPixelOffset - viewOrigin x. |
1756 | 4134 |
nPixel ~~ 0 ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4135 |
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
|
4136 |
] |
1756 | 4137 |
|
4138 |
"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
|
4139 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4140 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4141 |
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
|
4142 |
"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
|
4143 |
|
1911 | 4144 |
nPixel ~~ 0 ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4145 |
self scrollTo:(viewOrigin - (nPixel @ 0)) redraw:true |
1468 | 4146 |
] |
4147 |
||
1911 | 4148 |
"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
|
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 |
|
75b8fb924904
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 |
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
|
4152 |
"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
|
4153 |
|
1911 | 4154 |
nPixel ~~ 0 ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4155 |
self scrollTo:(self viewOrigin + (nPixel @ 0)) redraw:true |
1468 | 4156 |
] |
4157 |
||
1911 | 4158 |
"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
|
4159 |
! |
75b8fb924904
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 |
|
75b8fb924904
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 |
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
|
4162 |
"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
|
4163 |
|
75b8fb924904
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 |
^ 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
|
4165 |
! |
75b8fb924904
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 |
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
|
4168 |
"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
|
4169 |
|
75b8fb924904
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 |
^ 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
|
4171 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4172 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4173 |
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
|
4174 |
"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
|
4175 |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4176 |
"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
|
4177 |
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
|
4178 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4179 |
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
|
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 |
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
|
4183 |
"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
|
4184 |
|
2429
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2427
diff
changeset
|
4185 |
|pxlOffset leftOffset| |
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2427
diff
changeset
|
4186 |
|
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2427
diff
changeset
|
4187 |
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
|
4188 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4189 |
aColNr == 1 ifTrue:[ |
5023
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
4190 |
leftOffset ~~ 0 ifTrue:[ |
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
4191 |
self scrollLeft:leftOffset. |
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
4192 |
]. |
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
4193 |
^ 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
|
4194 |
]. |
75b8fb924904
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 |
|
5023
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
4196 |
pxlOffset := gc font width * (aColNr - 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
|
4197 |
|
75b8fb924904
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 |
pxlOffset < leftOffset ifTrue:[ |
5023
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
4199 |
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
|
4200 |
] ifFalse:[ |
5023
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
4201 |
pxlOffset > leftOffset ifTrue:[ |
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
4202 |
self scrollRight:(pxlOffset - leftOffset) |
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
4203 |
] |
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
|
4204 |
] |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4205 |
! |
75b8fb924904
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 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4207 |
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
|
4208 |
"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
|
4209 |
|
2429
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2427
diff
changeset
|
4210 |
viewOrigin x ~~ 0 ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4211 |
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
|
4212 |
] |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4213 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4214 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4215 |
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
|
4216 |
"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
|
4217 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4218 |
aLineNr < firstLineShown ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4219 |
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
|
4220 |
] ifFalse:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4221 |
aLineNr > firstLineShown ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4222 |
self scrollDown:(aLineNr - firstLineShown) |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4223 |
] |
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
|
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 |
! |
75b8fb924904
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 |
|
833 | 4227 |
scrollToPercent:percentOrigin |
4228 |
"scroll to a position given in percent of total" |
|
4229 |
||
4230 |
"kludge - ListView thinks in lines" |
|
4231 |
||
4232 |
self scrollHorizontalToPercent:percentOrigin x. |
|
4233 |
self scrollVerticalToPercent:percentOrigin y. |
|
4234 |
! |
|
4235 |
||
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
|
4236 |
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
|
4237 |
"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
|
4238 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4239 |
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
|
4240 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4241 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4242 |
scrollUp:nLines |
394
795f293f8520
fixed debris-leftover in scrollDown
Claus Gittinger <cg@exept.de>
parents:
392
diff
changeset
|
4243 |
"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
|
4244 |
|
1911 | 4245 |
nLines ~~ 0 ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4246 |
self scrollTo:(viewOrigin - (0 @ (fontHeight * nLines))) |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4247 |
redraw:true |
1468 | 4248 |
] |
4249 |
||
1911 | 4250 |
"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
|
4251 |
! |
75b8fb924904
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 |
|
808
0fb219efdfa2
Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents:
798
diff
changeset
|
4253 |
scrollUpPixels:pix |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4254 |
"change origin to scroll up some pixels |
808
0fb219efdfa2
Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents:
798
diff
changeset
|
4255 |
(towards the top of the text) |
0fb219efdfa2
Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents:
798
diff
changeset
|
4256 |
THIS WILL VANISH!!" |
0fb219efdfa2
Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents:
798
diff
changeset
|
4257 |
|
1468 | 4258 |
pix > 0 ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4259 |
self scrollTo:(viewOrigin - (0 @ pix)) redraw:true |
1468 | 4260 |
] |
4261 |
||
4262 |
||
808
0fb219efdfa2
Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents:
798
diff
changeset
|
4263 |
! |
0fb219efdfa2
Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents:
798
diff
changeset
|
4264 |
|
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
|
4265 |
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
|
4266 |
"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
|
4267 |
|
75b8fb924904
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 |
|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
|
4269 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4270 |
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
|
4271 |
"/ |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4272 |
"/ 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
|
4273 |
"/ |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4274 |
nFullLinesShown ~~ nLinesShown ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4275 |
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
|
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 |
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
|
4278 |
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
|
4279 |
! |
75b8fb924904
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 |
|
75b8fb924904
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 |
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
|
4282 |
"setup for auto-scroll down (when button-press-moving below view) |
5096 | 4283 |
- timeDelta for scroll is computed from distance. |
4284 |
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
|
4285 |
|
2765
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4286 |
self |
5096 | 4287 |
startAutoScrollVertical:yDistance |
4288 |
scrollSelector:#scrollSelectDown. |
|
4289 |
^ 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
|
4290 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4291 |
|
2765
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4292 |
startAutoScrollHorizontal:xDistance scrollSelector:scrollSelector |
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4293 |
"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
|
4294 |
- 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
|
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 |
|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
|
4297 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4298 |
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
|
4299 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4300 |
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
|
4301 |
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
|
4302 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4303 |
(deltaT = autoScrollDeltaT) ifFalse:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4304 |
autoScrollDeltaT := deltaT. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4305 |
autoScrollBlock isNil ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4306 |
autoScrollBlock := [self realized ifTrue:[self perform:scrollSelector]]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4307 |
Processor addTimedBlock:autoScrollBlock afterSeconds:deltaT |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4308 |
] |
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
|
4309 |
] |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4310 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4311 |
|
2765
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4312 |
startAutoScrollLeft:xDistance |
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4313 |
"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
|
4314 |
- timeDelta for scroll is computed from distance" |
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4315 |
|
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4316 |
self |
5096 | 4317 |
startAutoScrollHorizontal:xDistance negated |
4318 |
scrollSelector:#scrollSelectLeft. |
|
4319 |
^ true |
|
2765
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4320 |
! |
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4321 |
|
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4322 |
startAutoScrollRight:xDistance |
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4323 |
"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
|
4324 |
- timeDelta for scroll is computed from distance" |
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4325 |
|
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4326 |
self |
5096 | 4327 |
startAutoScrollHorizontal:xDistance |
4328 |
scrollSelector:#scrollSelectRight. |
|
4329 |
^ true |
|
2765
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4330 |
! |
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4331 |
|
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
|
4332 |
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
|
4333 |
"setup for auto-scroll up (when button-press-moving below view) |
5096 | 4334 |
- timeDelta for scroll is computed from distance. |
4335 |
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
|
4336 |
|
2765
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4337 |
self |
5096 | 4338 |
startAutoScrollVertical:yDistance negated |
4339 |
scrollSelector:#scrollSelectUp. |
|
4340 |
^ true |
|
2765
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4341 |
! |
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4342 |
|
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4343 |
startAutoScrollVertical:yDistance scrollSelector:scrollSelector |
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4344 |
"setup for auto-scroll up (when button-press-moving below view) |
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4345 |
- timeDelta for scroll is computed from distance" |
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4346 |
|
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
|
4347 |
|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
|
4348 |
|
75b8fb924904
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 |
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
|
4350 |
|
4159
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4351 |
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
|
4352 |
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
|
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 |
(deltaT = autoScrollDeltaT) ifFalse:[ |
4159
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4355 |
autoScrollDeltaT := deltaT. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4356 |
autoScrollBlock isNil ifTrue:[ |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4357 |
autoScrollBlock := [self realized ifTrue:[self perform:scrollSelector]]. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4358 |
Processor addTimedBlock:autoScrollBlock afterSeconds:deltaT |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4359 |
] |
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
|
4360 |
] |
4159
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4361 |
|
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4362 |
"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
|
4363 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4364 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4365 |
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
|
4366 |
"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
|
4367 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4368 |
autoScrollBlock notNil ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4369 |
self compressMotionEvents:true. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4370 |
Processor removeTimedBlock:autoScrollBlock. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4371 |
autoScrollBlock := nil. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4372 |
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
|
4373 |
]. |
75b8fb924904
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 |
! |
75b8fb924904
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 |
|
1910
0d68937d088b
removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents:
1888
diff
changeset
|
4376 |
verticalScrollStep |
0d68937d088b
removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents:
1888
diff
changeset
|
4377 |
"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
|
4378 |
Here, the scrolling unit is lines." |
0d68937d088b
removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents:
1888
diff
changeset
|
4379 |
|
0d68937d088b
removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents:
1888
diff
changeset
|
4380 |
^ 1 |
0d68937d088b
removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents:
1888
diff
changeset
|
4381 |
|
0d68937d088b
removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents:
1888
diff
changeset
|
4382 |
"Created: / 21.5.1999 / 14:00:12 / cg" |
0d68937d088b
removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents:
1888
diff
changeset
|
4383 |
! |
0d68937d088b
removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents:
1888
diff
changeset
|
4384 |
|
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
|
4385 |
viewOrigin |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4386 |
"return the viewOrigin; thats the coordinate of the contents |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4387 |
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
|
4388 |
(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
|
4389 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4390 |
^ 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
|
4391 |
! ! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4392 |
|
2316 | 4393 |
!ListView methodsFor:'scrolling-basic'! |
1468 | 4394 |
|
2331
218a017dc1f3
additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents:
2325
diff
changeset
|
4395 |
additionalMarginForHorizontalScroll |
218a017dc1f3
additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents:
2325
diff
changeset
|
4396 |
"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
|
4397 |
width of the document would allow. |
218a017dc1f3
additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents:
2325
diff
changeset
|
4398 |
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
|
4399 |
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
|
4400 |
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
|
4401 |
|
5023
a18a03c5c572
GC is delegated instead of inherited
Stefan Vogel <sv@exept.de>
parents:
diff
changeset
|
4402 |
^ gc font width |
2331
218a017dc1f3
additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents:
2325
diff
changeset
|
4403 |
! |
218a017dc1f3
additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents:
2325
diff
changeset
|
4404 |
|
1468 | 4405 |
scrollTo:anOrigin redraw:doRedraw |
4406 |
"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
|
4407 |
The argument defines the integer device coordinates of the new top-left |
1468 | 4408 |
point. |
4409 |
" |
|
4410 |
|dltOrg |
|
4411 |
noLn "{ Class:SmallInteger }" |
|
4412 |
max "{ Class:SmallInteger }" |
|
4413 |
tmp "{ Class:SmallInteger }" |
|
4414 |
h "{ Class:SmallInteger }" |
|
4415 |
w "{ Class:SmallInteger }" |
|
4416 |
y0 "{ Class:SmallInteger }" |
|
4417 |
y1 "{ Class:SmallInteger }" |
|
4418 |
y "{ Class:SmallInteger }" |
|
1581
71fee652b652
oops - must be careful to not repair damage with
Claus Gittinger <cg@exept.de>
parents:
1579
diff
changeset
|
4419 |
x "{ Class:SmallInteger }" |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4420 |
delta newFirstLine newViewOrigin |
1984 | 4421 |
hBefore wBefore inv wg| |
4422 |
||
4423 |
hBefore := height. |
|
4424 |
wBefore := width. |
|
1468 | 4425 |
|
4426 |
dltOrg := anOrigin - viewOrigin. |
|
4427 |
||
4428 |
"/ compute valid horizontal offset x |
|
4429 |
||
4430 |
(x := dltOrg x) ~~ 0 ifTrue:[ |
|
4159
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4431 |
tmp := viewOrigin x + x. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4432 |
|
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4433 |
x < 0 ifTrue:[ "/ scrolling left |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4434 |
tmp < 0 ifTrue:[x := 0 - viewOrigin x] |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4435 |
] ifFalse:[ "/ scrolling right |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4436 |
"/ allows scrolling to the right of widest line |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4437 |
max := self widthOfContents + (self additionalMarginForHorizontalScroll). |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4438 |
|
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4439 |
tmp + width > max ifTrue:[ |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4440 |
x := (max - viewOrigin x - width) max:0 |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4441 |
] |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4442 |
] |
1468 | 4443 |
]. |
4444 |
||
4445 |
"/ compute valid vertical offset measured in lines |
|
4446 |
||
4447 |
(y := dltOrg y // fontHeight) ~~ 0 ifTrue:[ |
|
4159
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4448 |
tmp := firstLineShown + y. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4449 |
|
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4450 |
y < 0 ifTrue:[ "/ scrolling up |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4451 |
tmp < 1 ifTrue:[y := 1 - firstLineShown] |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4452 |
] ifFalse:[ "/ scrolling down |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4453 |
max := self size. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4454 |
|
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4455 |
tmp + nFullLinesShown > max ifTrue:[ |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4456 |
y := (max - firstLineShown - nFullLinesShown + 1) max:0 |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4457 |
] |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4458 |
] |
1468 | 4459 |
]. |
4460 |
||
1578 | 4461 |
(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
|
4462 |
^ self |
1468 | 4463 |
]. |
4464 |
||
4465 |
(noLn := y) ~~ 0 ifTrue:[ |
|
4159
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4466 |
y := y * fontHeight |
1468 | 4467 |
]. |
1581
71fee652b652
oops - must be careful to not repair damage with
Claus Gittinger <cg@exept.de>
parents:
1579
diff
changeset
|
4468 |
delta := (x @ y). |
1468 | 4469 |
|
1582 | 4470 |
newFirstLine := firstLineShown + noLn. |
4471 |
newViewOrigin := viewOrigin + delta. |
|
4472 |
||
1468 | 4473 |
(shown and:[doRedraw]) ifFalse:[ |
4159
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4474 |
self originWillChange. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4475 |
firstLineShown := newFirstLine. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4476 |
viewOrigin := newViewOrigin. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4477 |
self assert:(viewOrigin x >= 0). |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4478 |
^ self originChanged:delta |
1468 | 4479 |
]. |
4480 |
||
1578 | 4481 |
"/ (self sensor notNil and: [self sensor hasExposeEventFor:self]) ifTrue:[ "/ outstanding expose events |
4482 |
"/ self invalidate. "/ redraw all |
|
4483 |
"/ self originWillChange. |
|
4484 |
"/ ^ self originChanged:(x @ y ) |
|
4485 |
"/ ]. |
|
1468 | 4486 |
|
1984 | 4487 |
( (y ~~ 0 and:[x ~~ 0]) "/ both x and y changed |
4488 |
or:[(noLn abs) >= nLinesShown "/ at least one area is |
|
4489 |
or:[(x abs) > (width // 4 * 3)]] "/ big enough to redraw all |
|
1468 | 4490 |
) ifTrue:[ |
4159
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4491 |
self originWillChange. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4492 |
firstLineShown := newFirstLine. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4493 |
viewOrigin := newViewOrigin. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4494 |
self invalidate. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4495 |
^ self originChanged:delta |
1468 | 4496 |
]. |
4497 |
||
1726 | 4498 |
"/ OLD: |
4499 |
"/ self repairDamage. |
|
1969
69d9c43db5e9
scrolling - again (added a device sync)
Claus Gittinger <cg@exept.de>
parents:
1964
diff
changeset
|
4500 |
|
1730 | 4501 |
(wg := self windowGroup) notNil ifTrue:[ |
4159
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4502 |
wg processRealExposeEventsFor:self. |
1730 | 4503 |
]. |
1578 | 4504 |
|
4505 |
self originWillChange. |
|
1970 | 4506 |
|
4507 |
"/ make certain, that all drawing is complete |
|
1984 | 4508 |
"/ device sync. |
4509 |
||
1975
0eda51a6d48e
uff - scroll bug (must catch BEFORE changing viewOrigin)
Claus Gittinger <cg@exept.de>
parents:
1972
diff
changeset
|
4510 |
self catchExpose. |
1970 | 4511 |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4512 |
x == 0 ifTrue:[ |
4159
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4513 |
"/ scrolling vertical |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4514 |
|
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4515 |
y0 := textStartTop + (y abs). |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4516 |
h := hBefore - margin - y0. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4517 |
w := wBefore - margin. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4518 |
y > 0 ifTrue:[ "/ copy down |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4519 |
"/ 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
|
4520 |
"/ 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
|
4521 |
"/ Therefore, clear the top area. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4522 |
"/ (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
|
4523 |
"/ there - selection is nil or >= firstLineShown). |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4524 |
self clearDeviceRectangleX:margin y:margin width:width-margin-margin height:(textStartTop-margin). |
1983 | 4525 |
"/ self invalidateDeviceRectangle:((margin@margin) corner:(width-margin@textStartTop)) repairNow:false. |
1977 | 4526 |
|
4159
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4527 |
self copyFrom:self |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4528 |
x:0 y:y0 toX:0 y:textStartTop |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4529 |
width:w height:h async:true. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4530 |
y1 := h - 1. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4531 |
y0 := y0 + 1. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4532 |
] ifFalse:[ "/ copy up |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4533 |
self copyFrom:self |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4534 |
x:margin y:textStartTop toX:margin y:y0 |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4535 |
width:w height:h async:true. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4536 |
y1 := 0. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4537 |
]. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4538 |
|
5369 | 4539 |
inv := (margin@y1) extent:(w@y0+margin). |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4540 |
] ifFalse:[ |
4159
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4541 |
"/ scrolling horizontal |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4542 |
|
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4543 |
x > 0 ifTrue:[ "/ scrolling right |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4544 |
y0 := margin + x. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4545 |
y1 := wBefore - y0. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4546 |
] ifFalse:[ "/ scrolling left |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4547 |
y0 := margin - x. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4548 |
y1 := 0. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4549 |
]. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4550 |
h := hBefore - margin - margin. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4551 |
w := wBefore - margin - y0. |
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 |
x > 0 ifTrue:[ "/ copy right |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4554 |
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
|
4555 |
width:w height:h async:true. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4556 |
] ifFalse:[ "/ copy left |
4603 | 4557 |
"/ self copyFrom:self x:textStartLeft y:margin toX:y0 y:margin |
4558 |
"/ viewOrigin x > margin ifTrue:[ |
|
4559 |
"/ self copyFrom:self x:0 y:margin toX:y0-margin y:margin |
|
4560 |
"/ width:w height:h async:true. |
|
4561 |
"/ ] ifFalse:[ |
|
4562 |
self copyFrom:self x:margin y:margin toX:y0 y:margin |
|
4563 |
width:w height:h async:true. |
|
4564 |
"/ ]. |
|
4159
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4565 |
]. |
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4566 |
|
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4567 |
inv := (y1@margin) extent:(y0@h). |
1468 | 4568 |
]. |
4569 |
||
1984 | 4570 |
firstLineShown := newFirstLine. |
4571 |
viewOrigin := newViewOrigin. |
|
1969
69d9c43db5e9
scrolling - again (added a device sync)
Claus Gittinger <cg@exept.de>
parents:
1964
diff
changeset
|
4572 |
|
1885 | 4573 |
self invalidateDeviceRectangle:inv repairNow:false. |
4603 | 4574 |
viewOrigin x <= margin ifTrue:[ |
4575 |
self invalidateDeviceRectangle:((0@margin) extent:(margin@h)) repairNow:false. |
|
4576 |
]. |
|
1712
cb753ba02fb4
remember old width/height before doing a repairDamage
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
4577 |
|
1975
0eda51a6d48e
uff - scroll bug (must catch BEFORE changing viewOrigin)
Claus Gittinger <cg@exept.de>
parents:
1972
diff
changeset
|
4578 |
self originChanged:delta. |
1969
69d9c43db5e9
scrolling - again (added a device sync)
Claus Gittinger <cg@exept.de>
parents:
1964
diff
changeset
|
4579 |
self waitForExpose. |
1726 | 4580 |
|
2202
edf8821d56a1
synchronous redraw after a scroll
Claus Gittinger <cg@exept.de>
parents:
2199
diff
changeset
|
4581 |
(wg := self windowGroup) notNil ifTrue:[ |
4159
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4582 |
wg processRealExposeEventsFor:self. |
2202
edf8821d56a1
synchronous redraw after a scroll
Claus Gittinger <cg@exept.de>
parents:
2199
diff
changeset
|
4583 |
]. |
edf8821d56a1
synchronous redraw after a scroll
Claus Gittinger <cg@exept.de>
parents:
2199
diff
changeset
|
4584 |
|
1984 | 4585 |
"/ (hBefore ~= height or:[wBefore ~= width]) ifTrue:[ |
4586 |
"/ self halt. |
|
4587 |
"/ ]. |
|
4588 |
||
4159
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4589 |
"Modified: / 08-08-2010 / 11:14:09 / cg" |
1468 | 4590 |
! ! |
4591 |
||
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
|
4592 |
!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
|
4593 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4594 |
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
|
4595 |
"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
|
4596 |
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
|
4597 |
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
|
4598 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4599 |
|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
|
4600 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4601 |
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
|
4602 |
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
|
4603 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4604 |
"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
|
4605 |
(wordCheck value:thisCharacter) ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4606 |
[wordCheck value:thisCharacter] whileTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4607 |
beginCol := beginCol - 1. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4608 |
beginCol < 1 ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4609 |
^ 1 |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4610 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4611 |
thisCharacter := self characterAtLine:selectLine col:beginCol |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4612 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4613 |
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
|
4614 |
] ifFalse:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4615 |
"nope - maybe its a space" |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4616 |
thisCharacter == Character space ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4617 |
[beginCol > 1 and:[thisCharacter == Character space]] whileTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4618 |
beginCol := beginCol - 1. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4619 |
thisCharacter := self characterAtLine:selectLine col:beginCol |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4620 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4621 |
thisCharacter ~~ Character space ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4622 |
beginCol := beginCol + 1. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4623 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4624 |
] ifFalse:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4625 |
"select single character" |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4626 |
] |
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
|
4627 |
]. |
75b8fb924904
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 |
^ 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
|
4629 |
! |
75b8fb924904
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 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4631 |
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
|
4632 |
"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
|
4633 |
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
|
4634 |
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
|
4635 |
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
|
4636 |
|
770
a41466e3dfaa
use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents:
721
diff
changeset
|
4637 |
|endCol "{ Class: SmallInteger }" |
a41466e3dfaa
use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents:
721
diff
changeset
|
4638 |
len "{ Class: SmallInteger }" |
a41466e3dfaa
use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents:
721
diff
changeset
|
4639 |
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
|
4640 |
|
75b8fb924904
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 |
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
|
4642 |
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
|
4643 |
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
|
4644 |
|
2900 | 4645 |
len := (self listAt:selectLine) size. |
4646 |
||
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
|
4647 |
"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
|
4648 |
(wordCheck value:thisCharacter) ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4649 |
[wordCheck value:thisCharacter] 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 |
endCol > len ifTrue:[ ^ len ]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4652 |
thisCharacter := self characterAtLine:selectLine col:endCol |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4653 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4654 |
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
|
4655 |
] ifFalse:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4656 |
"nope - maybe its a space" |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4657 |
thisCharacter == Character space ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4658 |
endCol > len ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4659 |
"select rest to end" |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4660 |
endCol := 0 |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4661 |
] ifFalse:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4662 |
thisCharacter := self characterAtLine:selectLine col:endCol. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4663 |
[endCol <= len and:[thisCharacter == Character space]] whileTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4664 |
endCol := endCol + 1. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4665 |
thisCharacter := self characterAtLine:selectLine col:endCol |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4666 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4667 |
endCol := endCol - 1. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4668 |
] |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4669 |
] ifFalse:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4670 |
"select single character" |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4671 |
] |
125 | 4672 |
]. |
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
|
4673 |
^ 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
|
4674 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4675 |
|
1325 | 4676 |
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
|
4677 |
"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
|
4678 |
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
|
4679 |
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
|
4680 |
|
4463
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 |
searchBackwardUsingSpec:(SearchSpec new |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4683 |
pattern:pattern |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4684 |
ignoreCase:ignCase |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4685 |
match:false) |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4686 |
startingAtLine:startLine col:startCol |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4687 |
ifFound:block1 ifAbsent:block2 |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4688 |
! |
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 |
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
|
4691 |
"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
|
4692 |
found evaluate block2. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4693 |
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
|
4694 |
|
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4695 |
^ self |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4696 |
searchBackwardFor:pattern |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4697 |
ignoreCase:false |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4698 |
startingAtLine:startLine col:startCol |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4699 |
ifFound:block1 |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4700 |
ifAbsent:block2 |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4701 |
|
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4702 |
"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
|
4703 |
! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4704 |
|
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4705 |
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
|
4706 |
"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
|
4707 |
found evaluate block2. |
5546 | 4708 |
Sorry, but pattern is no regular expression pattern (yet). |
4709 |
Also, wraps are not done when searching backward." |
|
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4710 |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4711 |
|lineString |
5076 | 4712 |
pattern ignCase match fullWord atBeginOfLineOnly |
4444 | 4713 |
found firstChar1 firstChar2 c pc col1 |
770
a41466e3dfaa
use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents:
721
diff
changeset
|
4714 |
col "{ Class: SmallInteger }" |
a41466e3dfaa
use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents:
721
diff
changeset
|
4715 |
cc "{ Class: SmallInteger }" |
a41466e3dfaa
use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents:
721
diff
changeset
|
4716 |
patternSize "{ Class: SmallInteger }" |
a41466e3dfaa
use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents:
721
diff
changeset
|
4717 |
line1 "{ Class: SmallInteger }" |
a41466e3dfaa
use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents:
721
diff
changeset
|
4718 |
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
|
4719 |
|
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4720 |
pattern := searchSpec pattern. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4721 |
ignCase := searchSpec ignoreCase. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4722 |
match := searchSpec match. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4723 |
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
|
4724 |
fullWord := searchSpec fullWord. |
5076 | 4725 |
atBeginOfLineOnly := searchSpec atBeginOfLineOnly. |
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4726 |
|
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
|
4727 |
patternSize := pattern size. |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4728 |
(list notNil |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4729 |
and:[startLine > 0 |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4730 |
and:[patternSize ~~ 0]]) |
2508
5bf86df079c9
backward search without inital line
Claus Gittinger <cg@exept.de>
parents:
2455
diff
changeset
|
4731 |
ifTrue:[ |
4444 | 4732 |
self withCursor:Cursor questionMark do:[ |
4733 |
col := startCol - 1. |
|
4734 |
firstChar1 := pattern at:1. |
|
4735 |
ignCase ifTrue:[ |
|
4736 |
firstChar1 := firstChar1 asLowercase. |
|
4737 |
firstChar2 := firstChar1 asUppercase. |
|
4738 |
] ifFalse:[ |
|
4739 |
firstChar2 := firstChar1 |
|
4740 |
]. |
|
4741 |
||
4742 |
line1 := startLine. |
|
4743 |
line1 > list size ifTrue:[ |
|
4744 |
line1 := list size. |
|
4745 |
col := -999 |
|
4746 |
] ifFalse:[ |
|
4747 |
col > (list at:line1) size ifTrue:[ |
|
4748 |
col := -999 |
|
4749 |
] |
|
4750 |
]. |
|
4751 |
line1 to:1 by:-1 do:[:lnr | |
|
4752 |
lineString := list at:lnr. |
|
4753 |
lineString notNil ifTrue:[ |
|
4754 |
lineString := lineString asString. |
|
4755 |
lineString isString ifTrue:[ |
|
4756 |
"/ quick check if pattern is present |
|
4757 |
col1 := lineString |
|
5546 | 4758 |
findString:pattern startingAt:1 |
4759 |
ifAbsent:0 caseSensitive: ignCase not. |
|
4444 | 4760 |
col1 ~~ 0 ifTrue:[ |
4761 |
lineSize := lineString size. |
|
4762 |
col == -999 ifTrue:[col := lineSize - patternSize + 1]. |
|
4763 |
[(col > 0) |
|
4764 |
and:[(c := lineString at:col) ~= firstChar1 |
|
4765 |
and:[c ~= firstChar2]]] whileTrue:[ |
|
4766 |
col := col - 1 |
|
4767 |
]. |
|
4768 |
[col > 0] whileTrue:[ |
|
4769 |
cc := col. |
|
4770 |
found := true. |
|
4771 |
1 to:patternSize do:[:cnr | |
|
4772 |
cc > lineSize ifTrue:[ |
|
4773 |
found := false |
|
4774 |
] ifFalse:[ |
|
4775 |
pc := pattern at:cnr. |
|
4776 |
c := lineString at:cc. |
|
4777 |
pc ~= c ifTrue:[ |
|
4778 |
(ignCase not or:[pc asLowercase ~= c asLowercase]) ifTrue:[ |
|
4779 |
found := false |
|
4780 |
] |
|
4781 |
] |
|
4782 |
]. |
|
4783 |
cc := cc + 1 |
|
4784 |
]. |
|
4785 |
found ifTrue:[ |
|
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4786 |
(fullWord not |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4787 |
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
|
4788 |
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
|
4789 |
) ifTrue:[ |
5076 | 4790 |
(atBeginOfLineOnly not or:[col == 1]) ifTrue:[ |
4791 |
^ block1 value:lnr value:col. |
|
4792 |
] |
|
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4793 |
] |
4444 | 4794 |
]. |
4795 |
col := col - 1. |
|
4796 |
[(col > 0) |
|
4797 |
and:[(c := lineString at:col) ~= firstChar1 |
|
4798 |
and:[c ~= firstChar2]]] whileTrue:[ |
|
4799 |
col := col - 1 |
|
4800 |
] |
|
4801 |
] |
|
4802 |
] |
|
4803 |
]. |
|
4804 |
]. |
|
4805 |
col := -999. |
|
4806 |
] |
|
4807 |
] |
|
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
|
4808 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4809 |
"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
|
4810 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4811 |
^ block2 value |
386
514f73e07c2d
more 16bit fixes (compare chars using = / ~= instead of == / ~=)
Claus Gittinger <cg@exept.de>
parents:
383
diff
changeset
|
4812 |
|
4444 | 4813 |
"Created: / 13-09-1997 / 01:06:19 / cg" |
4814 |
"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
|
4815 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4816 |
|
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4817 |
searchForwardFor:pattern ignoreCase:ignCase match:match startingAtLine:startLine col:startCol ifFound:block1 ifAbsent:block2 |
1325 | 4818 |
"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
|
4819 |
found evaluate block2." |
1325 | 4820 |
|
4821 |
^ self |
|
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4822 |
searchForwardUsingSpec:(SearchSpec new |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4823 |
pattern:pattern |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4824 |
ignoreCase:ignCase |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4825 |
match:match) |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4826 |
startingAtLine:startLine col:startCol |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4827 |
ifFound:block1 ifAbsent:block2 |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4828 |
! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4829 |
|
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4830 |
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
|
4831 |
"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
|
4832 |
found evaluate block2." |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4833 |
|
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4834 |
^ 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
|
4835 |
! |
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 |
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
|
4838 |
"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
|
4839 |
found evaluate block2." |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4840 |
|
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4841 |
^ self |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4842 |
searchForwardFor:pattern |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4843 |
ignoreCase:false |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4844 |
startingAtLine:startLine col:startCol |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4845 |
ifFound:block1 |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4846 |
ifAbsent:block2 |
1325 | 4847 |
|
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4848 |
"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
|
4849 |
! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4850 |
|
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4851 |
searchForwardUsingSpec:searchSpec startingAtLine:startLine col:startCol ifFound:block1 ifAbsent:block2 |
5546 | 4852 |
"search for a pattern, if found evaluate block1 with row/col as arguments, |
4853 |
if not found evaluate block2. |
|
4854 |
If the block is a three-arg block, it gets the end-col (or nil, if not found)" |
|
4855 |
||
4856 |
|lineString col pattern match regexMatch ignCase fullWord atBeginOfLineOnly |
|
4857 |
wrapAtEndOfText patternSize matcher lnr "{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
|
4858 |
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
|
4859 |
line2 "{Class: SmallInteger}" |
5546 | 4860 |
p realPattern runner foundCol 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
|
4861 |
|
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4862 |
pattern := searchSpec pattern. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4863 |
match := searchSpec match. |
5546 | 4864 |
regexMatch := searchSpec regexMatch. |
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4865 |
ignCase := searchSpec ignoreCase. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4866 |
fullWord := searchSpec fullWord. |
5076 | 4867 |
atBeginOfLineOnly := searchSpec atBeginOfLineOnly. |
5546 | 4868 |
wrapAtEndOfText := searchSpec wrapAtEndOfText. |
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4869 |
|
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
|
4870 |
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
|
4871 |
(list notNil and:[patternSize ~~ 0]) ifTrue:[ |
4444 | 4872 |
self withCursor:Cursor questionMark do:[ |
4873 |
||
4874 |
col := startCol + 1. |
|
4875 |
line1 := startLine. |
|
4876 |
line2 := list size. |
|
4877 |
||
5546 | 4878 |
"/ call searchBlock with lnr, col, and line. Cares for wrap |
4879 |
runner := |
|
4880 |
[:searchBlock | |
|
4881 |
|didWrap| |
|
4882 |
||
4883 |
lnr := line1. |
|
4884 |
didWrap := false. |
|
4885 |
[lnr <= line2] whileTrue:[ |
|
4886 |
lineString := list at:lnr. |
|
4887 |
lineString notNil ifTrue:[ |
|
4888 |
lineString := lineString asString string. |
|
4889 |
lineString isString ifTrue:[ |
|
4890 |
searchBlock value:lnr value:col value:lineString |
|
4891 |
] |
|
4892 |
]. |
|
4893 |
col := 1. |
|
4894 |
lnr := lnr + 1. |
|
4895 |
lnr > line2 ifTrue:[ |
|
4896 |
(wrapAtEndOfText and:[didWrap not]) ifTrue:[ |
|
4897 |
didWrap := true. |
|
4898 |
lnr := 1. |
|
4899 |
line2 := line1-1. |
|
4900 |
]. |
|
4901 |
]. |
|
4902 |
]. |
|
4903 |
||
4444 | 4904 |
]. |
5546 | 4905 |
|
4906 |
(match and:[regexMatch]) ifTrue:[ |
|
4907 |
"perform a findMatchString (regex matching)" |
|
4908 |
matcher := ignCase ifTrue:[pattern asRegexIgnoringCase] ifFalse:[pattern asRegex]. |
|
4909 |
runner |
|
4910 |
value:[:lnr :col :lineString | |
|
4911 |
"/ first a crude check ... |
|
4912 |
(matcher hasMatchesIn:lineString) ifTrue:[ |
|
4913 |
"/ find which match to show |
|
4914 |
1 to:matcher subexpressionCount do:[:i | |
|
4915 |
foundCol := matcher subBeginning:i. |
|
4916 |
endCol := matcher subEnd:i. |
|
4917 |
(foundCol notNil and: [endCol notNil]) ifTrue: [ |
|
4918 |
foundCol := foundCol + 1. "/ regex uses 0-based indexes (sigh) |
|
4919 |
foundCol >= col ifTrue:[ |
|
4920 |
(atBeginOfLineOnly not or:[foundCol == 1]) ifTrue:[ |
|
4921 |
^ block1 value:lnr value:foundCol optionalArgument:endCol. |
|
4922 |
]]]]]]. |
|
4923 |
] ifFalse:[ |
|
4924 |
(match and:[regexMatch or:[pattern includesUnescapedMatchCharacters]]) ifTrue:[ |
|
4925 |
"perform a findMatchString (glob matching)" |
|
4926 |
p := pattern species new:0. |
|
4927 |
(pattern startsWith:$*) ifFalse:[p := p , '*']. |
|
4928 |
p := p , pattern. |
|
4929 |
(pattern endsWith:$*) ifFalse:[p := p , '*']. |
|
4930 |
realPattern := pattern. |
|
4931 |
(realPattern startsWith:$*) ifTrue:[ |
|
4932 |
realPattern := realPattern copyFrom:2 |
|
4933 |
]. |
|
4934 |
runner |
|
4935 |
value:[:lnr :col :lineString | |
|
4712 | 4936 |
(p match:lineString caseSensitive:ignCase not) ifTrue:[ |
4444 | 4937 |
"/ ok, there it is; look at which position |
5546 | 4938 |
foundCol := lineString |
4939 |
findMatchString:realPattern startingAt:col |
|
4940 |
caseSensitive:ignCase not ifAbsent:0. |
|
4941 |
foundCol ~~ 0 ifTrue:[ |
|
4942 |
(atBeginOfLineOnly not or:[foundCol == 1]) ifTrue:[ |
|
4943 |
^ block1 value:lnr value:foundCol optionalArgument:nil. |
|
4944 |
]]]]. |
|
4945 |
] ifFalse:[ |
|
4946 |
"perform a findString (no matching)" |
|
4947 |
p := pattern. |
|
4948 |
runner |
|
4949 |
value:[:lnr :col :lineString | |
|
4950 |
foundCol := lineString |
|
4951 |
findString:p startingAt:col ifAbsent:0 caseSensitive: ignCase not. |
|
4952 |
foundCol ~~ 0 ifTrue:[ |
|
4953 |
(fullWord not |
|
4954 |
or:[ (self findBeginOfWordAtLine:lnr col:foundCol) == foundCol |
|
4955 |
and:[ (self findEndOfWordAtLine:lnr col:foundCol) == (foundCol + patternSize - 1) ]] |
|
4956 |
) ifTrue:[ |
|
4957 |
(atBeginOfLineOnly not or:[foundCol == 1]) ifTrue:[ |
|
4958 |
^ block1 value:lnr value:foundCol optionalArgument:nil. |
|
5076 | 4959 |
] |
4444 | 4960 |
] |
4961 |
] |
|
4962 |
]. |
|
5546 | 4963 |
]. |
4444 | 4964 |
]. |
4965 |
] |
|
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
|
4966 |
]. |
75b8fb924904
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 |
"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
|
4968 |
|
75b8fb924904
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 |
^ block2 value |
403
ee8f6d080077
preserve cursor (error while searching)
Claus Gittinger <cg@exept.de>
parents:
394
diff
changeset
|
4970 |
|
4444 | 4971 |
"Created: / 13-09-1997 / 01:06:31 / cg" |
4972 |
"Modified: / 05-08-2012 / 12:22:42 / cg" |
|
1325 | 4973 |
! |
4974 |
||
3564 | 4975 |
standardWordCheck:char |
4403 | 4976 |
"the wordCheck is a predicate which returns true if the given character |
4977 |
belongs to the (textual) word. Used with double click to select a word. |
|
4978 |
When editing code, typically characters which are part of an identifier |
|
4979 |
are part of a word (underline, dollar, but no other non-letters). |
|
4980 |
The standardWordCheck aks the current userPreferences for details." |
|
4981 |
||
4982 |
|prefs| |
|
4983 |
||
4984 |
(prefs := UserPreferences current) whitespaceWordSelectMode ifTrue:[ |
|
4985 |
"an extremely simple mode, where every non-space is treated as part of the word" |
|
4986 |
^ char isSeparator not |
|
3564 | 4987 |
]. |
4403 | 4988 |
prefs extendedWordSelectMode ifTrue:[ |
4989 |
"the typical mode, useful for text and code" |
|
4990 |
^ char isNationalAlphaNumeric or:[char == $_] |
|
3564 | 4991 |
]. |
4403 | 4992 |
"another typical mode, also useful for text and code" |
3564 | 4993 |
^ char isNationalAlphaNumeric |
4403 | 4994 |
|
4995 |
"Modified (comment): / 17-03-2012 / 19:04:13 / cg" |
|
0 | 4996 |
! ! |
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
|
4997 |
|
75b8fb924904
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 |
!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
|
4999 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5000 |
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
|
5001 |
"go through whole text expanding tabs into spaces. |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5002 |
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
|
5003 |
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
|
5004 |
|
75b8fb924904
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 |
|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
|
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 |
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
|
5008 |
list notNil ifTrue:[ |
4765 | 5009 |
nLines := self size. |
5010 |
1 to:nLines do:[:index | |
|
5011 |
line := self at:index. |
|
5012 |
line notNil ifTrue:[ |
|
4768 | 5013 |
(line isString) ifTrue:[ |
4765 | 5014 |
newLine := line withTabsExpanded. |
5015 |
newLine ~~ line ifTrue:[ |
|
5016 |
list at:index put:newLine |
|
5017 |
]. |
|
5018 |
] ifFalse:[ |
|
5019 |
includesNonStrings := true. |
|
5020 |
] |
|
5021 |
] |
|
5022 |
] |
|
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
|
5023 |
] |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5024 |
|
75b8fb924904
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 |
"Modified: 30.8.1995 / 19:06:37 / claus" |
627 | 5026 |
"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
|
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 |
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
|
5030 |
"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
|
5031 |
|
3151
fc183d8ff88c
next-tab: fallback to mod-8 tabs if beyond tab-list
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
5032 |
^ 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
|
5033 |
! |
75b8fb924904
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 |
|
75b8fb924904
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 |
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
|
5036 |
"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
|
5037 |
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
|
5038 |
|
75b8fb924904
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 |
|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
|
5040 |
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
|
5041 |
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
|
5042 |
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
|
5043 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5044 |
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
|
5045 |
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
|
5046 |
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
|
5047 |
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
|
5048 |
[thisTab <= col] whileTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5049 |
(tabIndex == nTabs) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5050 |
"/ fallback to mod-8 tabs if beyond tab-list. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5051 |
thisTab := col + 1. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5052 |
thisTab := thisTab + (8 - (thisTab \\ 8)). |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5053 |
^ thisTab |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5054 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5055 |
tabIndex := tabIndex + 1. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5056 |
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
|
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 |
^ 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
|
5059 |
! |
75b8fb924904
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 |
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
|
5062 |
"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
|
5063 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5064 |
|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
|
5065 |
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
|
5066 |
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
|
5067 |
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
|
5068 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5069 |
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
|
5070 |
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
|
5071 |
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
|
5072 |
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
|
5073 |
[thisTab < col] whileTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5074 |
(tabIndex == nTabs) ifTrue:[^ thisTab]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5075 |
tabIndex := tabIndex + 1. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5076 |
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
|
5077 |
]. |
75b8fb924904
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 |
(tabIndex == 1) ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5079 |
^ 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
|
5080 |
]. |
75b8fb924904
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 |
^ 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
|
5082 |
! |
75b8fb924904
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 |
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
|
5085 |
"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
|
5086 |
|
75b8fb924904
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 |
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
|
5088 |
! |
75b8fb924904
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 |
|
75b8fb924904
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 |
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
|
5091 |
"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
|
5092 |
|
75b8fb924904
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 |
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
|
5094 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5095 |
|
2378 | 5096 |
setTabPositions:aVector |
5097 |
"set tab stops" |
|
5098 |
||
5099 |
tabPositions := aVector. |
|
5100 |
! |
|
5101 |
||
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
|
5102 |
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
|
5103 |
"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
|
5104 |
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
|
5105 |
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
|
5106 |
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
|
5107 |
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
|
5108 |
|
75b8fb924904
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 |
|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
|
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 |
" |
75b8fb924904
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 |
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
|
5113 |
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
|
5114 |
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
|
5115 |
" |
75b8fb924904
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 |
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
|
5117 |
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
|
5118 |
(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
|
5119 |
|
75b8fb924904
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 |
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
|
5121 |
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
|
5122 |
[newLine startsWith:eightSpaces] whileTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5123 |
newLine := newLine copyFrom:9. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5124 |
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
|
5125 |
]. |
386
514f73e07c2d
more 16bit fixes (compare chars using = / ~= instead of == / ~=)
Claus Gittinger <cg@exept.de>
parents:
383
diff
changeset
|
5126 |
^ (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
|
5127 |
|
514f73e07c2d
more 16bit fixes (compare chars using = / ~= instead of == / ~=)
Claus Gittinger <cg@exept.de>
parents:
383
diff
changeset
|
5128 |
"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
|
5129 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5130 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5131 |
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
|
5132 |
"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
|
5133 |
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
|
5134 |
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
|
5135 |
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
|
5136 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5137 |
|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
|
5138 |
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
|
5139 |
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
|
5140 |
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
|
5141 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5142 |
" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5143 |
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
|
5144 |
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
|
5145 |
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
|
5146 |
(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
|
5147 |
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
|
5148 |
" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5149 |
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
|
5150 |
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
|
5151 |
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
|
5152 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5153 |
currentMax := line size + (nTabs * 7). |
386
514f73e07c2d
more 16bit fixes (compare chars using = / ~= instead of == / ~=)
Claus Gittinger <cg@exept.de>
parents:
383
diff
changeset
|
5154 |
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
|
5155 |
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
|
5156 |
line do:[:character | |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5157 |
(character == (Character tab)) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5158 |
nextTab := self nextTabAfter:dstIndex in:tabulatorTable. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5159 |
[dstIndex < nextTab] whileTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5160 |
tmpString at:dstIndex put:(Character space). |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5161 |
dstIndex := dstIndex + 1 |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5162 |
] |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5163 |
] ifFalse:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5164 |
tmpString at:dstIndex put:character. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5165 |
dstIndex := dstIndex + 1 |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5166 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5167 |
(dstIndex > currentMax) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5168 |
" |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5169 |
this cannot happen with <= 8 tabs |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5170 |
" |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5171 |
currentMax := currentMax + currentMax. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5172 |
nString := line species new:currentMax. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5173 |
nString replaceFrom:1 to:(dstIndex - 1) |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5174 |
with:tmpString startingAt:1. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5175 |
tmpString := nString. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5176 |
nString := nil |
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 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5179 |
"make stc-optimizer happy |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5180 |
- no need to return value of ifTrue:/ifFalse above" |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5181 |
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
|
5182 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5183 |
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
|
5184 |
dstIndex == currentMax ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5185 |
^ 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
|
5186 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5187 |
^ tmpString copyTo:dstIndex |
386
514f73e07c2d
more 16bit fixes (compare chars using = / ~= instead of == / ~=)
Claus Gittinger <cg@exept.de>
parents:
383
diff
changeset
|
5188 |
|
514f73e07c2d
more 16bit fixes (compare chars using = / ~= instead of == / ~=)
Claus Gittinger <cg@exept.de>
parents:
383
diff
changeset
|
5189 |
"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
|
5190 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5191 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5192 |
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
|
5193 |
"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
|
5194 |
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
|
5195 |
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
|
5196 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5197 |
^ 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
|
5198 |
! ! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5199 |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5200 |
!ListView::HighlightArea methodsFor:'accessing'! |
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 |
bgColor |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5203 |
^ bgColor |
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 |
bgColor:something |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5207 |
bgColor := 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 |
endCol |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5211 |
^ endCol |
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 |
endCol:something |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5215 |
endCol := 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 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5218 |
endLine |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5219 |
^ endLine |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5220 |
! |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5221 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5222 |
endLine:something |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5223 |
endLine := something. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5224 |
! |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5225 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5226 |
fgColor |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5227 |
^ fgColor |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5228 |
! |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5229 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5230 |
fgColor:something |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5231 |
fgColor := something. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5232 |
! |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5233 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5234 |
startCol |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5235 |
^ startCol |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5236 |
! |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5237 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5238 |
startCol:something |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5239 |
startCol := something. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5240 |
! |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5241 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5242 |
startLine |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5243 |
^ startLine |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5244 |
! |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5245 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5246 |
startLine:something |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5247 |
startLine := something. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5248 |
! ! |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5249 |
|
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5250 |
!ListView::SearchSpec methodsFor:'accessing'! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5251 |
|
5076 | 5252 |
atBeginOfLineOnly |
5079 | 5253 |
^ atBeginOfLineOnly ? false |
5076 | 5254 |
! |
5255 |
||
5256 |
atBeginOfLineOnly:something |
|
5257 |
atBeginOfLineOnly := something. |
|
5258 |
! |
|
5259 |
||
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5260 |
forward |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5261 |
^ forward ? true |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5262 |
! |
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 |
fullWord |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5265 |
^ fullWord ? false |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5266 |
! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5267 |
|
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5268 |
ignoreCase |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5269 |
^ ignoreCase ? false |
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 |
|
5217 | 5272 |
ignoreDiacritics |
5273 |
^ ignoreDiacritics |
|
5274 |
! |
|
5275 |
||
5276 |
ignoreDiacritics:something |
|
5277 |
ignoreDiacritics := something. |
|
5278 |
! |
|
5279 |
||
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5280 |
match |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5281 |
^ match ? false |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5282 |
! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5283 |
|
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5284 |
pattern |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5285 |
^ pattern |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5286 |
! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5287 |
|
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5288 |
pattern:patternString |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5289 |
pattern := patternString. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5290 |
! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5291 |
|
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5292 |
pattern:patternString ignoreCase:ignoredCaseBoolean |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5293 |
pattern := patternString. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5294 |
ignoreCase := ignoredCaseBoolean. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5295 |
! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5296 |
|
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5297 |
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
|
5298 |
pattern := patternString. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5299 |
ignoreCase := ignoredCaseBoolean. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5300 |
match := matchBoolean. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5301 |
! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5302 |
|
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5303 |
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
|
5304 |
pattern := patternString. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5305 |
ignoreCase := ignoredCaseBoolean. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5306 |
match := matchBoolean. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5307 |
forward := forwardBoolean |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5308 |
! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5309 |
|
5533 | 5310 |
pattern:patternString ignoreCase:ignoredCaseBoolean |
5311 |
match:matchBoolean regexMatch:regexMatchBoolean |
|
5312 |
variable:variableBoolen |
|
5313 |
fullWord:fullWordBoolen forward:forwardBoolean |
|
5314 |
atBeginOfLineOnly:atBeginOfLineOnlyArg |
|
5315 |
pattern := patternString. |
|
5316 |
ignoreCase := ignoredCaseBoolean. |
|
5317 |
match := matchBoolean. |
|
5318 |
regexMatch := regexMatchBoolean. |
|
5319 |
variable := variableBoolen. |
|
5320 |
fullWord := fullWordBoolen. |
|
5321 |
forward := forwardBoolean. |
|
5322 |
atBeginOfLineOnly := atBeginOfLineOnlyArg |
|
5323 |
! |
|
5324 |
||
5325 |
pattern:patternString ignoreCase:ignoredCaseBoolean |
|
5326 |
match:matchBoolean regexMatch:regexMatchBoolean |
|
5327 |
variable:variableBoolen |
|
5328 |
fullWord:fullWordBoolen forward:forwardBoolean |
|
5329 |
atBeginOfLineOnly:atBeginOfLineOnlyArg |
|
5544 | 5330 |
wrapAtEnd:wrapAtEndOfTextArg |
5533 | 5331 |
pattern := patternString. |
5332 |
ignoreCase := ignoredCaseBoolean. |
|
5333 |
match := matchBoolean. |
|
5334 |
regexMatch := regexMatchBoolean. |
|
5335 |
variable := variableBoolen. |
|
5336 |
fullWord := fullWordBoolen. |
|
5337 |
forward := forwardBoolean. |
|
5338 |
atBeginOfLineOnly := atBeginOfLineOnlyArg. |
|
5544 | 5339 |
wrapAtEndOfText := wrapAtEndOfTextArg. |
5533 | 5340 |
! |
5341 |
||
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5342 |
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
|
5343 |
pattern := patternString. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5344 |
ignoreCase := ignoredCaseBoolean. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5345 |
match := matchBoolean. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5346 |
variable := variableBoolen. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5347 |
forward := forwardBoolean |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5348 |
! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5349 |
|
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5350 |
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
|
5351 |
pattern := patternString. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5352 |
ignoreCase := ignoredCaseBoolean. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5353 |
match := matchBoolean. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5354 |
variable := variableBoolen. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5355 |
fullWord := fullWordBoolen. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5356 |
forward := forwardBoolean |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5357 |
! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5358 |
|
5076 | 5359 |
pattern:patternString ignoreCase:ignoredCaseBoolean match:matchBoolean variable:variableBoolen |
5360 |
fullWord:fullWordBoolen forward:forwardBoolean |
|
5361 |
atBeginOfLineOnly:atBeginOfLineOnlyArg |
|
5362 |
pattern := patternString. |
|
5363 |
ignoreCase := ignoredCaseBoolean. |
|
5364 |
match := matchBoolean. |
|
5365 |
variable := variableBoolen. |
|
5366 |
fullWord := fullWordBoolen. |
|
5367 |
forward := forwardBoolean. |
|
5368 |
atBeginOfLineOnly := atBeginOfLineOnlyArg |
|
5369 |
! |
|
5370 |
||
5533 | 5371 |
regexMatch |
5372 |
^ regexMatch |
|
5373 |
! |
|
5374 |
||
5375 |
regexMatch:something |
|
5376 |
regexMatch := something. |
|
5377 |
! |
|
5378 |
||
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5379 |
variable |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5380 |
^ variable |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5381 |
! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5382 |
|
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5383 |
variable:variableBoolean |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5384 |
variable := variableBoolean |
5533 | 5385 |
! |
5386 |
||
5544 | 5387 |
wrapAtEndOfText |
5388 |
^ wrapAtEndOfText |
|
5389 |
! |
|
5390 |
||
5391 |
wrapAtEndOfText:aBoolean |
|
5392 |
wrapAtEndOfText := aBoolean. |
|
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5393 |
! ! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5394 |
|
851
b9d71ccdefaa
care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents:
837
diff
changeset
|
5395 |
!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
|
5396 |
|
4523 | 5397 |
version |
5369 | 5398 |
^ '$Header$' |
4523 | 5399 |
! |
5400 |
||
4015
8647dad37cb0
comment/format in: #on:aspect:change:list:menu:
Claus Gittinger <cg@exept.de>
parents:
3869
diff
changeset
|
5401 |
version_CVS |
5369 | 5402 |
^ '$Header$' |
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
|
5403 |
! ! |
4495 | 5404 |