author | Claus Gittinger <cg@exept.de> |
Thu, 12 Mar 2020 19:38:53 +0100 | |
changeset 6846 | 6b3935ec1dec |
parent 6819 | 70fd62a15070 |
permissions | -rw-r--r-- |
6808 | 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 |
|
6398 | 28 |
checkedLinesForWidthOfContentsComputation showLineEndIndicators |
29 |
showControlCharacters' |
|
6557 | 30 |
classVariableNames:'DefaultBackgroundColor DefaultForegroundColor DefaultLeftMargin |
31 |
DefaultTabPositions DefaultTopMargin UserDefaultTabPositions' |
|
3563 | 32 |
poolDictionaries:'' |
33 |
category:'Views-Text' |
|
0 | 34 |
! |
35 |
||
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
36 |
Object subclass:#HighlightArea |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
37 |
instanceVariableNames:'startLine startCol endLine endCol fgColor bgColor' |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
38 |
classVariableNames:'' |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
39 |
poolDictionaries:'' |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
40 |
privateIn:ListView |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
41 |
! |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
42 |
|
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
43 |
Object subclass:#SearchSpec |
5076 | 44 |
instanceVariableNames:'pattern match ignoreCase variable fullWord forward |
6429 | 45 |
atBeginOfLineOnly atEndOfLineOnly ignoreDiacritics regexMatch |
46 |
wrapAtEndOfText' |
|
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
47 |
classVariableNames:'' |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
48 |
poolDictionaries:'' |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
49 |
privateIn:ListView |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
50 |
! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
51 |
|
851
b9d71ccdefaa
care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents:
837
diff
changeset
|
52 |
!ListView class methodsFor:'documentation'! |
0 | 53 |
|
38 | 54 |
copyright |
55 |
" |
|
56 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
57 |
All Rights Reserved |
38 | 58 |
|
59 |
This software is furnished under a license and may be used |
|
60 |
only in accordance with the terms of that license and with the |
|
61 |
inclusion of the above copyright notice. This software may not |
|
62 |
be provided or otherwise made available to, or used by, any |
|
63 |
other person. No title to or ownership of the software is |
|
64 |
hereby transferred. |
|
65 |
" |
|
66 |
! |
|
67 |
||
0 | 68 |
documentation |
69 |
" |
|
38 | 70 |
a View for (string-)lists. |
71 |
||
4751 | 72 |
This class can only passively display collections of strings, |
73 |
text or display objects which behave line-like (i.e. all have constant height). |
|
74 |
||
75 |
Selections, editing, cursors etc. must be implemented in subclasses. |
|
76 |
(see SelectionInListView, TextView etc.) |
|
38 | 77 |
|
78 |
This code currently handles only fixed-height fonts correctly - |
|
4751 | 79 |
it should be rewritten in some places to not compute the position/height from |
80 |
the view's font height, but by accumulating line heights... |
|
0 | 81 |
|
38 | 82 |
It can only scroll by full lines vertically (i.e. setting firstLineShown to ~~ 1) |
83 |
which should be changed to have this behavior optionally for smooth scroll. |
|
5862 | 84 |
|
4751 | 85 |
The text is internally kept in the 'list' instance variable, and is supposed to consist |
5862 | 86 |
of a collection (Ordered-, String- or VirtualCollection) of line entries. |
4751 | 87 |
Typically, individual entries are either strings/text or nil (for empty lines). |
88 |
However, ANY object which supports the displayOn: and widthIn: protocol can be |
|
120 | 89 |
used - see MultipleColumnListEntry as an example. |
90 |
Therefore, ListView (and all subclasses) are prepared to handle non-string entries |
|
4751 | 91 |
(especially: attributed Text and labelAndIcon-like entities). |
92 |
||
5862 | 93 |
The internal version of the text has tabulators expanded to blanks. |
94 |
ListView is not prepared to deal with them. |
|
95 |
When text is exchanged with an external medium (i.e. reading/writing files), |
|
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
96 |
these are expanded/compressed assuming a tab-setting of 8. |
4751 | 97 |
This is done independent of the user's tab setting, which is used ONLY for positioning, |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
98 |
while the text is edited. |
4751 | 99 |
Thus, even if the tab setting is multiple of 4's, tabs are |
5862 | 100 |
written in multiples of 8 when the text is saved. |
101 |
Since this is the default on all ascii terminals and printers, |
|
102 |
this assures that the text looks correctly indented when finally printed. |
|
120 | 103 |
|
305 | 104 |
Notice: |
4751 | 105 |
------- |
106 |
ListView is one of the OLDEST widget classes in the system and definitely requires a major rewrite: |
|
305 | 107 |
|
120 | 108 |
Due to historic reasons (ListView implemented scrolling before the general |
109 |
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
|
110 |
views. The general scrolling code (in View) uses the transformation for transparent scrolling |
4751 | 111 |
using the viewOrigin (transparent means, that the code does not need to know - it simply draws |
112 |
as if all of the text was visible). |
|
5862 | 113 |
|
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
114 |
Here in ListView, the transformation is not used, instead it is done again, and different, |
4751 | 115 |
by keeping the firstLineShown (i.e. vertical offset) and leftOffset (horizontal offset). |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
116 |
Even worse: the firstLineShown is a line-index, the most annoying consequence of this is that |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
117 |
scrolling is done by lines here, whereas it is done in pixels in the View class. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
118 |
Thus, be very careful, when changing things (better: don't touch it ;-). |
4751 | 119 |
Also, the viewOrigin variable is only valid for the x coordinate. The viewOrigin's y is always 0 !! |
120 | 120 |
|
305 | 121 |
Also, all controller functionality is completely performed by the listView |
122 |
(and subclasses) itself. It is still possible, to define and set a specialized |
|
123 |
controller, though. I.e. if you like to change the input behavior, define |
|
124 |
a corresponding controller class and intersect the keyXXX/buttonXXX messages |
|
125 |
there. |
|
126 |
||
4751 | 127 |
This may be totally rewritten ... so don't depend on the internals; especially the scrolling |
120 | 128 |
code will be totally removed here and the inherited functionality be used in the next version. |
38 | 129 |
|
4751 | 130 |
Also Notice: |
131 |
------------ |
|
132 |
because ListView was written at a time when most of the graphics was done via remote connections |
|
133 |
(X-window network protocol), it is highly tuned to avoid redraw operations. Thus, it can be used |
|
6755 | 134 |
happily over a slow Wide area LAN (say: 64kBit connection). |
4751 | 135 |
In that, it performed *much* better than other widgets, especialy Java and Qt, some of which are |
136 |
hardly usable via the network. |
|
137 |
It may be questionable whether this is still a requirement these days, where network connections |
|
5862 | 138 |
are usually pretty fast. |
139 |
However, the author insists on this to remain as it is, because we do have customers |
|
140 |
and applications which rely on relatively good remote display performance!! |
|
4751 | 141 |
Future underlying graphics may well become network dependent in the future, for example, when |
142 |
the display connection is implemented as an RPC into a web browser... |
|
143 |
||
5862 | 144 |
Also Notice (Virtual line collections): |
4751 | 145 |
------------ |
146 |
ListView shall be configurable to avoid accesses to its underlying list if required. |
|
147 |
Currently, it can be customized to disable lineWidth computation, tab expansion and scanning for |
|
5862 | 148 |
non-string entries. |
149 |
All of which is required when huge texts which are not in memory are to be displayed |
|
150 |
(for example: a virtual array of 10million text lines). |
|
151 |
Please be careful to not reintroduce such code when adding features |
|
152 |
(as happened in the past). ListView shall always be configurable to only access |
|
153 |
a minimum subset of the line collection (i.e. only the currently visible page), |
|
154 |
by customizing the tab-expansion, line-end and widthOfContents behavior. |
|
6755 | 155 |
In that case, the max lineWidth (which is used by the h-scroller computation) should be |
156 |
adapted dynamically. |
|
0 | 157 |
|
586 | 158 |
[Instance variables:] |
0 | 159 |
|
1325 | 160 |
list <aCollection> the text strings, a collection of lines. |
5862 | 161 |
Nils may be used for empty lines. |
1325 | 162 |
|
163 |
firstLineShown <Number> the index of the 1st visible line (1 ..) |
|
164 |
leftOffset <Number> left offset for horizontal scroll |
|
165 |
||
166 |
nFullLinesShown <Number> the number of unclipped lines in visible area |
|
5862 | 167 |
(internal; updated on size changes) |
1325 | 168 |
nLinesShown <Number> the number of lines in visible area, incl. partial |
5862 | 169 |
(internal; updated on size changes) |
1325 | 170 |
|
171 |
fgColor <Color> color to draw characters |
|
172 |
bgColor <Color> the background |
|
173 |
||
174 |
partialLines <Boolean> allow last line to be partial displayed |
|
175 |
leftMargin <Number> margin at left in pixels |
|
176 |
topMargin <Number> margin at top in pixels |
|
177 |
textStartLeft <Number> margin + leftMargin (internal) |
|
178 |
textStartTop <Number> margin + topMargin (internal) |
|
179 |
innerWidth <Number> width - margins (internal) |
|
180 |
tabPositions <aCollection> tab stops (cols) |
|
181 |
fontHeight <Number> font height in pixels (internal) |
|
182 |
fontAscent <Number> font ascent in pixels (internal) |
|
6098 | 183 |
fontIsFixed <Boolean> true if it's a fixed font (internal) |
1325 | 184 |
fontWidth <Number> width of space (internal) |
185 |
lineSpacing <Number> pixels between lines |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
186 |
lastSearchPattern <String> last pattern for searching |
5862 | 187 |
(kept to provide a default for next search) |
1325 | 188 |
lastSearchIgnoredCase <Boolean> last search ignored case |
5862 | 189 |
(kept to provide a default for next search) |
1325 | 190 |
wordCheck <Block> rule used for check for word boundaries in word select |
5862 | 191 |
The default rule is to return true for alphaNumeric characters. |
192 |
(can be changed to allow for underscore and other |
|
193 |
characters to be treated as alphaCharacters) |
|
1325 | 194 |
|
195 |
autoScrollBlock <Block> block installed as timeoutBlock when doing an |
|
5862 | 196 |
autoScroll (internal) |
1325 | 197 |
autoScrollDeltaT computed scroll time delta in seconds (internal) |
198 |
||
199 |
includesNonStrings cached flag if any non-strings are in list |
|
200 |
widthOfWidestLine cached width of widest line |
|
201 |
listMsg if view has a model and listMsg is non-nil, |
|
5862 | 202 |
this is sent to the model to acquired a new contents |
203 |
whenever a change of the aspect (aspectMsg) occurs. |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
204 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
205 |
viewOrigin the current origin |
1325 | 206 |
|
1693
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
207 |
backgroundAlreadyClearedColor internal; speedup by avoiding |
5862 | 208 |
multiple fills when drawing |
209 |
internal lines |
|
2128
33830e4f998f
added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents:
2090
diff
changeset
|
210 |
|
33830e4f998f
added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents:
2090
diff
changeset
|
211 |
scrollWhenUpdating |
5862 | 212 |
<Symbol> defines how the view is scrolled if the |
213 |
model changes its value by some outside activity |
|
214 |
(i.e. not by user input). |
|
215 |
Can be one of: |
|
216 |
#keep / nil -> stay unchanged |
|
217 |
#endOfText -> scroll to the end |
|
218 |
#beginOfText -> scroll to the top |
|
219 |
The default is #beginOfText (i.e. scroll to top). |
|
120 | 220 |
|
586 | 221 |
[StyleSheet parameters:] |
77 | 222 |
|
1325 | 223 |
textForegroundColor defaults to Black |
224 |
textBackgroundColor defaults to White |
|
225 |
textFont defaults to defaultFont |
|
226 |
textTabPositions defaults to #(1 9 17 25 ...) |
|
586 | 227 |
|
228 |
[author:] |
|
5862 | 229 |
Claus Gittinger |
586 | 230 |
|
231 |
[see also:] |
|
5862 | 232 |
TextView EditTextView |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
233 |
|
0 | 234 |
" |
451 | 235 |
! |
236 |
||
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
237 |
examples |
451 | 238 |
" |
239 |
ListViews alone are rarely used - its mostly an abstract superclass |
|
240 |
for TextView, EditTextView and SelectionInListView. |
|
241 |
||
242 |
anyway, here are a few examples: |
|
243 |
||
244 |
basic simple setup: |
|
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
245 |
[exBegin] |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
246 |
|top l| |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
247 |
|
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
248 |
top := StandardSystemView new. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
249 |
top extent:100@200. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
250 |
|
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
251 |
l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
252 |
l list:#('one' 'two' 'three'). |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
253 |
|
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
254 |
top open |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
255 |
[exEnd] |
451 | 256 |
|
257 |
||
258 |
||
259 |
specifying textMargins (these have NOTHING to do with the viewInset): |
|
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
260 |
[exBegin] |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
261 |
|top l| |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
262 |
|
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
263 |
top := StandardSystemView new. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
264 |
top extent:100@200. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
265 |
|
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
266 |
l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
267 |
l list:#('one' 'two' 'three'). |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
268 |
l topMargin:10. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
269 |
l leftMargin:20. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
270 |
|
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
271 |
top open |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
272 |
[exEnd] |
451 | 273 |
|
274 |
||
587
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
275 |
|
451 | 276 |
globally set the fg/bg colors: |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
277 |
[exBegin] |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
278 |
|top l| |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
279 |
|
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
280 |
top := StandardSystemView new. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
281 |
top extent:100@200. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
282 |
|
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
283 |
l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
284 |
l list:#('one' 'two' 'three'). |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
285 |
l foregroundColor:(Color white). |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
286 |
l backgroundColor:(Color blue). |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
287 |
|
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
288 |
top open |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
289 |
[exEnd] |
451 | 290 |
|
291 |
||
587
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
292 |
|
627 | 293 |
non-string (text) entries: |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
294 |
[exBegin] |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
295 |
|top list l| |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
296 |
|
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
297 |
top := StandardSystemView new. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
298 |
top extent:100@200. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
299 |
|
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
300 |
l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
301 |
list := #('all' 'of' 'your' 'preferred' 'colors') |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
302 |
with:#(red green blue 'orange' cyan) |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
303 |
collect:[:s :clr | |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
304 |
Text string:s |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
305 |
emphasis:(Array with:#bold |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
306 |
with:(#color->(Color name:clr))) ]. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
307 |
l list:list. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
308 |
|
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
309 |
top open |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
310 |
[exEnd] |
627 | 311 |
|
312 |
||
313 |
||
314 |
generic non-string entries: |
|
315 |
(notice: ColoredListEntry is obsoleted by Text) |
|
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
316 |
[exBegin] |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
317 |
|top list l| |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
318 |
|
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
319 |
top := StandardSystemView new. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
320 |
top extent:100@200. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
321 |
|
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
322 |
l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
323 |
list := #('all' 'of' 'your' 'preferred' 'colors') |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
324 |
with:#(red green blue 'orange' cyan) |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
325 |
collect:[:s :clr | ColoredListEntry string:s color:(Color name:clr) ]. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
326 |
l list:list. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
327 |
|
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
328 |
top open |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
329 |
[exEnd] |
587
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
330 |
|
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
331 |
|
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
332 |
|
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
333 |
using a model (default listMessage is aspectMessage): |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
334 |
[exBegin] |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
335 |
|top model l theModelsText| |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
336 |
|
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
337 |
model := Plug new. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
338 |
model respondTo:#modelsAspect |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
339 |
with:[ theModelsText ]. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
340 |
|
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
341 |
top := StandardSystemView new. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
342 |
top extent:100@200. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
343 |
|
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
344 |
l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
345 |
l model:model. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
346 |
l aspect:#modelsAspect. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
347 |
|
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
348 |
top open. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
349 |
|
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
350 |
Delay waitForSeconds:3. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
351 |
theModelsText := #('foo' 'bar' 'baz'). |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
352 |
model changed:#modelsAspect. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
353 |
[exEnd] |
587
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
354 |
|
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
355 |
|
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
356 |
|
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
357 |
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
|
358 |
for two listViews: |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
359 |
[exBegin] |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
360 |
|top model l1 l2 plainText| |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
361 |
|
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
362 |
plainText := #(''). |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
363 |
|
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
364 |
model := Plug new. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
365 |
model respondTo:#modelsUppercaseText |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
366 |
with:[ plainText asStringCollection |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
367 |
collect:[:l | l asUppercase]]. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
368 |
model respondTo:#modelsLowercaseText |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
369 |
with:[ plainText asStringCollection |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
370 |
collect:[:l | l asLowercase]]. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
371 |
|
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
372 |
top := StandardSystemView extent:200@200. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
373 |
|
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
374 |
l1 := ListView origin:0.0 @ 0.0 corner:1.0 @ 0.5 in:top. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
375 |
l1 model:model. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
376 |
l1 aspect:#modelsAspect. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
377 |
l1 listMessage:#modelsUppercaseText. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
378 |
|
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
379 |
l2 := ListView origin:0.0 @ 0.5 corner:1.0 @ 1.0 in:top. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
380 |
l2 model:model. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
381 |
l2 aspect:#modelsAspect. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
382 |
l2 listMessage:#modelsLowercaseText. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
383 |
|
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
384 |
top open. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
385 |
|
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
386 |
Delay waitForSeconds:3. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
387 |
plainText := #('foo' 'bar' 'baz'). |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
388 |
model changed:#modelsAspect. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
389 |
[exEnd] |
4536 | 390 |
|
391 |
using a big list (100000 lines), |
|
392 |
wrapping in a ScrollableView: |
|
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
393 |
[exBegin] |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
394 |
|bigList top lv| |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
395 |
|
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
396 |
bigList := (1 to:100000) collect:[:lineNr | 'List line Nr. ' , lineNr printString]. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
397 |
bigList at:10 put:('Some Text ' asText , 'with Bold part' allBold). |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
398 |
bigList at:20 put:('Some Text ' asText , 'with Italic part' allItalic). |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
399 |
|
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
400 |
top := StandardSystemView extent:200@200. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
401 |
|
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
402 |
lv := HVScrollableView for:ListView in:top. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
403 |
lv origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
404 |
lv list:bigList expandTabs:false scanForNonStrings:false includesNonStrings:false. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
405 |
|
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
406 |
top open. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
407 |
[exEnd] |
4536 | 408 |
|
409 |
using a huge virtual list (1 mio simulated lines), |
|
410 |
wrapping in a ScrollableView: |
|
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
411 |
[exBegin] |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
412 |
|virtualList top lv| |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
413 |
|
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
414 |
virtualList := Plug new. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
415 |
virtualList inheritFrom:SequenceableCollection. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
416 |
virtualList respondTo:#size with:[ 1000000 ]. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
417 |
virtualList respondTo:#at: with:[:lineNr | 'List line Nr. ' , lineNr printString ]. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
418 |
|
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
419 |
top := StandardSystemView extent:200@200. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
420 |
|
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
421 |
lv := ScrollableView for:ListView in:top. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
422 |
lv origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
423 |
lv list:virtualList expandTabs:false scanForNonStrings:false includesNonStrings:false. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
424 |
|
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
425 |
top open. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
426 |
[exEnd] |
4751 | 427 |
|
428 |
||
429 |
using a huge virtual array (1 mio simulated lines), |
|
430 |
wrapping in a ScrollableView. |
|
431 |
To simulate an expensive computation, a delay is planted into the line generator; |
|
432 |
Startup and display of page full of lines should not take longer than the number of lines shown: |
|
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
433 |
[exBegin] |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
434 |
|virtualList top lv| |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
435 |
|
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
436 |
virtualList := VirtualArray new. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
437 |
virtualList |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
438 |
setSize:1000000; |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
439 |
generator:[:index | Transcript showCR:index. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
440 |
Delay waitForSeconds:0.5. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
441 |
'%1 -> %2' bindWith:index with:index squared]. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
442 |
|
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
443 |
top := StandardSystemView extent:200@200. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
444 |
|
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
445 |
lv := ScrollableView for:ListView in:top. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
446 |
lv origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
447 |
lv expandTabsWhenUpdating:false. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
448 |
lv checkLineEndConventionWhenUpdating:false. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
449 |
lv checkedLinesForWidthOfContentsComputation:-1. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
450 |
lv list:virtualList. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
451 |
|
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
452 |
top open. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
453 |
[exEnd] |
451 | 454 |
" |
0 | 455 |
! ! |
456 |
||
5756 | 457 |
!ListView class methodsFor:'accessing private classes'! |
458 |
||
459 |
searchSpec |
|
460 |
^ SearchSpec |
|
461 |
! ! |
|
462 |
||
851
b9d71ccdefaa
care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents:
837
diff
changeset
|
463 |
!ListView class methodsFor:'defaults'! |
0 | 464 |
|
105 | 465 |
defaultTabPositions |
6213 | 466 |
"return an array containing the styleSheet's default tab positions" |
2378 | 467 |
|
3777 | 468 |
^ DefaultTabPositions ? self tab4Positions |
6213 | 469 |
|
470 |
"Modified (comment): / 12-10-2017 / 13:15:41 / cg" |
|
2378 | 471 |
! |
472 |
||
473 |
defaultTabPositions:aVector |
|
6213 | 474 |
"set the array containing the styleSheet's tab positions" |
2378 | 475 |
|
476 |
DefaultTabPositions := aVector |
|
477 |
||
478 |
" |
|
3777 | 479 |
ListView defaultTabPositions:(ListView tab4Positions) |
2378 | 480 |
" |
6213 | 481 |
|
482 |
"Modified (comment): / 12-10-2017 / 13:15:32 / cg" |
|
105 | 483 |
! |
484 |
||
7 | 485 |
tab4Positions |
1693
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
486 |
"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
|
487 |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
488 |
^ #(1 5 9 13 17 21 25 29 33 37 41 45 49 53 57 61 65 69 73 77 81 |
6458 | 489 |
85 89 93 97 101 105 109 113 117 121 125 129 133 137 141 145) |
120 | 490 |
! |
491 |
||
492 |
tab8Positions |
|
1693
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
493 |
"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
|
494 |
|
120 | 495 |
^ #(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
|
496 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
497 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
498 |
updateStyleCache |
439
4c6799ace14b
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
427
diff
changeset
|
499 |
"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
|
500 |
|
1354 | 501 |
<resource: #style (#'text.foregroundColor' #'text.backgroundColor' |
6336 | 502 |
#'text.tabPositions' |
503 |
#'text.font' |
|
504 |
#'text.topMargin' |
|
505 |
#'text.leftMargin')> |
|
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
506 |
|
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
507 |
DefaultForegroundColor := StyleSheet colorAt:'text.foregroundColor' default:Color black. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
508 |
DefaultBackgroundColor := StyleSheet colorAt:'text.backgroundColor' default:Color white. |
1354 | 509 |
DefaultFont := StyleSheet fontAt:'text.font'. |
5617 | 510 |
"/ that's not style, but a personal setting |
511 |
"/ DefaultTabPositions := StyleSheet at:'text.tabPositions'. |
|
512 |
"/ DefaultTabPositions isNil ifTrue:[DefaultTabPositions := self defaultTabPositions]. |
|
6336 | 513 |
DefaultLeftMargin := StyleSheet at:'text.leftMargin' default:0.5. |
514 |
DefaultTopMargin := StyleSheet at:'text.topMargin' default:0.5. |
|
439
4c6799ace14b
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
427
diff
changeset
|
515 |
|
5617 | 516 |
"Modified: / 31-03-2016 / 10:49:45 / cg" |
6336 | 517 |
"Modified: / 12-06-2018 / 11:19:36 / Claus Gittinger" |
2378 | 518 |
! |
519 |
||
520 |
userDefaultTabPositions |
|
6213 | 521 |
"return an array containing the user's default tab positions" |
2378 | 522 |
|
523 |
^ UserDefaultTabPositions |
|
6213 | 524 |
|
525 |
"Modified (comment): / 12-10-2017 / 13:15:19 / cg" |
|
2378 | 526 |
! |
527 |
||
528 |
userDefaultTabPositions:aVector |
|
6213 | 529 |
"set the array containing the user's tab positions" |
2378 | 530 |
|
531 |
UserDefaultTabPositions := aVector |
|
532 |
||
533 |
" |
|
534 |
self userDefaultTabPositions:(self tab4Positions) |
|
535 |
" |
|
6213 | 536 |
|
537 |
"Modified (comment): / 12-10-2017 / 13:15: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
|
538 |
! ! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
539 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
540 |
!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
|
541 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
542 |
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
|
543 |
"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
|
544 |
- 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
|
545 |
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
|
546 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
547 |
^ height - (2 * margin) - topMargin |
0 | 548 |
! ! |
549 |
||
2133 | 550 |
!ListView methodsFor:'accessing-behavior'! |
2132 | 551 |
|
4747 | 552 |
checkLineEndConventionWhenUpdating |
553 |
"return the line-end convention check when updating behavior. |
|
554 |
If true (the default), the first line of the list given is checked for having a |
|
555 |
cr-lf line end (which is a DOS convention), and the lineEndCRLF flag is set dynamically. |
|
556 |
If false, the lineEndCRLF remains as specified by the user. |
|
557 |
You may want to disable this flag if it is very expensive to generate a line |
|
558 |
(although, only the very first line is checked, anyway)" |
|
559 |
||
560 |
^ checkLineEndConventionWhenUpdating |
|
561 |
! |
|
562 |
||
563 |
checkLineEndConventionWhenUpdating:aBoolean |
|
564 |
"define the line-end convention check when updating behavior. |
|
565 |
If true (the default), the first line of the list given is checked for having a |
|
566 |
cr-lf line end (which is a DOS convention), and the lineEndCRLF flag is set dynamically. |
|
567 |
If false, the lineEndCRLF remains as specified by the user. |
|
568 |
You may want to disable this flag if it is very expensive to generate a line |
|
569 |
(although, only the very first line is checked, anyway)" |
|
570 |
||
571 |
checkLineEndConventionWhenUpdating := aBoolean |
|
572 |
! |
|
573 |
||
4751 | 574 |
checkedLinesForWidthOfContentsComputation |
5861 | 575 |
"return how many and which lines to consider in the widthOfContents computation, |
4751 | 576 |
which is needed by the scrollBar interface. |
6229 | 577 |
|
4751 | 578 |
If nil (the default), all lines are processed and the width of the longest line is taken. |
579 |
If positive, that number of lines is checked near the start of the text, |
|
580 |
if negative, from the end of the text. |
|
6229 | 581 |
If 0, the width is dynamically readjusted, as lines are drawn. |
582 |
||
4751 | 583 |
You may want to change this to 1 if it is guaranteed that all linesa are of the same width, |
584 |
or -1, if all are shorter than the last line. |
|
585 |
(useful, for example, when it is very expensive to generate all lines, and a huge number |
|
586 |
of same-width lines is generated through a virtual array)" |
|
587 |
||
588 |
^ checkedLinesForWidthOfContentsComputation |
|
6229 | 589 |
|
590 |
"Modified (comment): / 19-11-2017 / 14:09:19 / cg" |
|
4751 | 591 |
! |
592 |
||
593 |
checkedLinesForWidthOfContentsComputation:aNumberOrNil |
|
5861 | 594 |
"set how many and which lines to consider in the widthOfContents computation, |
4751 | 595 |
which is needed by the scrollBar interface. |
6229 | 596 |
|
4751 | 597 |
If nil (the default), all lines are processed and the width of the longest line is taken. |
598 |
If positive, that number of lines is checked near the start of the text, |
|
599 |
if negative, from the end of the text. |
|
600 |
If 0, the width is dynamically re adjusted, as lines are drawn. |
|
6229 | 601 |
|
4751 | 602 |
You may want to change this to 1 if it is guaranteed that all linesa are of the same width, |
603 |
or -1, if all are shorter than the last line. |
|
604 |
(useful, for example, when it is very expensive to generate all lines, and a huge number |
|
605 |
of same-width lines is generated through a virtual array)" |
|
606 |
||
607 |
checkedLinesForWidthOfContentsComputation := aNumberOrNil |
|
6229 | 608 |
|
609 |
"Modified (comment): / 19-11-2017 / 14:09:13 / cg" |
|
4751 | 610 |
! |
611 |
||
4747 | 612 |
compareModelWhenUpdating |
613 |
"return the compare when updating behavior. |
|
6231 | 614 |
|
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
615 |
If true (the default), the list of lines as given due to a model update |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
616 |
is processed and compared against the currently shown text. |
4747 | 617 |
If they are the same, no action is taken. |
6231 | 618 |
|
4747 | 619 |
This behavior is ok in 99.99% of all applications. |
620 |
However, you may turn this off iff: |
|
6231 | 621 |
- it is very expensive to process the list (for example, because the list |
622 |
is defined by a virtual array, which computes the lines dynamically, on |
|
623 |
the fly). |
|
4747 | 624 |
One use where this flag should be turned off is in the hex-memory display, |
625 |
which is able to simulate texts with millions of lines, but they are actually |
|
626 |
simulated by generating the presented lines dynamically, as they are displayed." |
|
627 |
||
628 |
^ compareModelOnUpdate |
|
6231 | 629 |
|
630 |
"Modified (comment): / 19-11-2017 / 14:14:04 / cg" |
|
4747 | 631 |
! |
632 |
||
633 |
compareModelWhenUpdating:aBoolean |
|
634 |
"define the compare when updating behavior. |
|
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
635 |
If true (the default), the list of lines as given due to a model update |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
636 |
is processed and compared against the currently shown text. |
4747 | 637 |
If they are the same, no action is taken. |
638 |
This behavior is ok in 99.99% of all applications. |
|
639 |
However, you may turn this off iff: |
|
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
640 |
- it is very expensive to process the list (for example, because the list |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
641 |
is defined by a virtual array, which computes the lines dynamically, on |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
642 |
the fly). |
4747 | 643 |
One use where this flag should be turned off is in the hex-memory display, |
644 |
which is able to simulate texts with millions of lines, but they are actually |
|
645 |
simulated by generating the presented lines dynamically, as they are displayed." |
|
646 |
||
647 |
compareModelOnUpdate := aBoolean |
|
648 |
! |
|
649 |
||
650 |
expandTabsWhenUpdating |
|
651 |
"return the tab expansion behavior. |
|
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
652 |
If true (the default), the list of lines as given via #list: or |
4747 | 653 |
due to a model update is processed and lines are replaced by lines with |
654 |
tabs expanded. |
|
655 |
This behavior is ok in 99.99% of all applications. |
|
656 |
However, you may turn this off iff: |
|
5843 | 657 |
- you are certain, that no tabs are in the passed in list |
658 |
- it is very expensive to process the list (for example, because the list |
|
659 |
is defined by a virtual array, which computes the lines dynamically, on the fly). |
|
4747 | 660 |
One use where this flag should be turned off is in the hex-memory display, |
661 |
which is able to simulate texts with millions of lines, but they are actually |
|
5843 | 662 |
simulated by generating the presented lines dynamically, as they are displayed. |
663 |
Notice, that to totally prevent scanning og the whole text, you may have to turn off |
|
664 |
other flags, such as checkineEndConventionWhenUpdating" |
|
4747 | 665 |
|
666 |
^ expandTabsWhenUpdating |
|
667 |
! |
|
668 |
||
669 |
expandTabsWhenUpdating:aBoolean |
|
670 |
"define the tab expansion behavior. |
|
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
671 |
If true (the default), the list of lines as given via #list: or |
4747 | 672 |
due to a model update is processed and lines are replaced by lines with |
673 |
tabs expanded. |
|
674 |
This behavior is ok in 99.99% of all applications. |
|
675 |
However, you may turn this off iff: |
|
5843 | 676 |
- you are certain, that no tabs are in the passed in list |
677 |
- it is very expensive to process the list (for example, because the list |
|
678 |
is defined by a virtual array, which computes the lines dynamically, on the fly). |
|
4747 | 679 |
One use where this flag should be turned off is in the hex-memory display, |
680 |
which is able to simulate texts with millions of lines, but they are actually |
|
5843 | 681 |
simulated by generating the presented lines dynamically, as they are displayed. |
682 |
Notice, that to totally prevent scanning og the whole text, you may have to turn off |
|
683 |
other flags, such as checkineEndConventionWhenUpdating" |
|
4747 | 684 |
|
685 |
expandTabsWhenUpdating := aBoolean |
|
686 |
! |
|
687 |
||
6179 | 688 |
isReadOnly |
689 |
"return true, if the text is readonly." |
|
690 |
||
691 |
^ true |
|
692 |
! |
|
693 |
||
3314 | 694 |
lineEndCRLF |
4610 | 695 |
"answer true, if CRLF is used for the line end. |
696 |
This is true for DOS/Windows files. |
|
697 |
Otherwise 'Character cr' is the line end (which is LF in unix)" |
|
698 |
||
3314 | 699 |
^ lineEndCRLF ? false |
700 |
||
701 |
"Created: / 04-07-2006 / 19:05:01 / fm" |
|
702 |
! |
|
703 |
||
6179 | 704 |
readOnly:aBoolean |
705 |
"for protocol compatibility with editTextViews, |
|
706 |
but actually ignored" |
|
707 |
! |
|
708 |
||
2325 | 709 |
scrollWhenUpdating |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
710 |
"return the scroll behavior, when I get a new text |
2325 | 711 |
(via the model or the #contents/#list) |
712 |
Possible returnValues are: |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
713 |
#keep / nil -> no change |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
714 |
#endOfText -> scroll to the end |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
715 |
#beginOfText -> scroll to the top |
3116
2df69a526f06
default for scrollWhenUpdating is now #keep
Claus Gittinger <cg@exept.de>
parents:
2997
diff
changeset
|
716 |
The default is #keep. |
2325 | 717 |
This may be useful for fields which get new values assigned from |
718 |
the program (i.e. not from the user)" |
|
719 |
||
720 |
^ scrollWhenUpdating |
|
721 |
! |
|
722 |
||
2132 | 723 |
scrollWhenUpdating:aSymbolOrNil |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
724 |
"define how to scroll, when I get a new text |
2132 | 725 |
(via the model or the #contents/#list) |
726 |
Allowed arguments are: |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
727 |
#keep / nil -> no change |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
728 |
#endOfText -> scroll to the end |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
729 |
#beginOfText -> scroll to the top |
3116
2df69a526f06
default for scrollWhenUpdating is now #keep
Claus Gittinger <cg@exept.de>
parents:
2997
diff
changeset
|
730 |
The default is #keep. |
2132 | 731 |
This may be useful for fields which get new values assigned from |
732 |
the program (i.e. not from the user)" |
|
733 |
||
734 |
scrollWhenUpdating := aSymbolOrNil |
|
4403 | 735 |
! |
736 |
||
737 |
wordCheckBlock:aBlock |
|
738 |
"set the word-check block - this block is called with a character argument, |
|
739 |
when the end/beginning of a word is searched. |
|
740 |
It should return true, if the character belongs to the word. |
|
741 |
The default block is set in #initialize, and returns true for alphanumeric |
|
742 |
(national) characters. |
|
743 |
Applications may change it to include underlines, dollars or other characters. |
|
744 |
(a C/C++ editor would include underlines ...)" |
|
745 |
||
746 |
wordCheck := aBlock. |
|
747 |
||
748 |
"Modified: 22.5.1996 / 12:26:55 / cg" |
|
2132 | 749 |
! ! |
750 |
||
105 | 751 |
!ListView methodsFor:'accessing-contents'! |
752 |
||
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
753 |
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
|
754 |
"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
|
755 |
|
2219
9ffca3757666
fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents:
2216
diff
changeset
|
756 |
|fontHeightBefore| |
9ffca3757666
fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents:
2216
diff
changeset
|
757 |
|
6304 | 758 |
list isNil ifTrue:[list := StringCollection 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
|
759 |
list add:aString. |
2219
9ffca3757666
fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents:
2216
diff
changeset
|
760 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
761 |
includesNonStrings ifFalse:[ |
6304 | 762 |
includesNonStrings := (aString notNil and:[(aString isSingleByteString) not]). |
763 |
includesNonStrings ifTrue:[ |
|
764 |
fontHeightBefore := fontHeight. |
|
765 |
self getFontParameters. |
|
766 |
fontHeightBefore ~~ fontHeight ifTrue:[ |
|
767 |
self invalidate |
|
768 |
]. |
|
769 |
]. |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
770 |
]. |
2224
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
771 |
|
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
772 |
widthOfWidestLine notNil ifTrue:[ |
6304 | 773 |
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
|
774 |
]. |
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
775 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
776 |
shown ifTrue:[ |
6304 | 777 |
self redrawLine:(self size). |
2182
fb9bc638123a
mus notify textChanged in #add: / #add:beforeIndex:
Claus Gittinger <cg@exept.de>
parents:
2181
diff
changeset
|
778 |
]. |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
779 |
self enqueueDelayedContentsChangedNotification. "recompute scrollbars" |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
780 |
|
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
781 |
"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
|
782 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
783 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
784 |
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
|
785 |
"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
|
786 |
|
2348 | 787 |
|lastShown| |
788 |
||
6304 | 789 |
list isNil ifTrue:[list := StringCollection 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
|
790 |
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
|
791 |
|
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
792 |
widthOfWidestLine notNil ifTrue:[ |
6304 | 793 |
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
|
794 |
]. |
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
795 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
796 |
includesNonStrings ifFalse:[ |
6304 | 797 |
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
|
798 |
"/ 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
|
799 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
800 |
shown ifTrue:[ |
6304 | 801 |
lastShown := self lastLineShown. |
802 |
index <= 2 ifTrue:[ |
|
803 |
self invalidate |
|
804 |
] ifFalse:[ |
|
805 |
index to:lastShown do:[:eachLine | |
|
806 |
self invalidateLine:eachLine |
|
807 |
]. |
|
808 |
]. |
|
2182
fb9bc638123a
mus notify textChanged in #add: / #add:beforeIndex:
Claus Gittinger <cg@exept.de>
parents:
2181
diff
changeset
|
809 |
]. |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
810 |
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
|
811 |
|
2257
d095d1e0779e
care for scrollWhenUpdating when adding individual lines
src
parents:
2249
diff
changeset
|
812 |
(scrollWhenUpdating == #end or:[scrollWhenUpdating == #endOfText]) ifTrue:[ |
6304 | 813 |
"/ self selection isNil ifTrue:[ |
814 |
self scrollToBottom. |
|
815 |
"/ ] |
|
2257
d095d1e0779e
care for scrollWhenUpdating when adding individual lines
src
parents:
2249
diff
changeset
|
816 |
]. |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
817 |
|
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
818 |
"Modified: / 25-07-2012 / 12:00:42 / cg" |
65 | 819 |
! |
820 |
||
2246 | 821 |
addAll:aCollectionOfLines beforeIndex:index |
2348 | 822 |
"add a bunch of lines and redisplay" |
823 |
||
824 |
|lastShown| |
|
2246 | 825 |
|
6304 | 826 |
list isNil ifTrue:[list := StringCollection new]. |
2246 | 827 |
aCollectionOfLines do:[:eachLine | |
6304 | 828 |
list addAll:aCollectionOfLines beforeIndex:index. |
2246 | 829 |
]. |
2348 | 830 |
includesNonStrings ifFalse:[ |
6304 | 831 |
includesNonStrings := |
832 |
aCollectionOfLines |
|
833 |
contains:[:someLine | |
|
834 |
someLine notNil and:[(someLine isSingleByteString) not]. |
|
835 |
] |
|
2348 | 836 |
]. |
2246 | 837 |
|
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
838 |
widthOfWidestLine notNil ifTrue:[ |
6304 | 839 |
aCollectionOfLines do:[:eachLine | |
840 |
self recomputeWidthOfWidestLineFor:eachLine old:nil. |
|
841 |
]. |
|
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
842 |
]. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
843 |
"/ widthOfWidestLine := nil. "/ i.e. unknown |
2246 | 844 |
self textChanged. |
845 |
||
2348 | 846 |
shown ifTrue:[ |
6304 | 847 |
lastShown := self lastLineShown. |
848 |
((index-1) <= lastShown) ifTrue:[ |
|
849 |
index <= 2 ifTrue:[ |
|
850 |
self invalidate |
|
851 |
] ifFalse:[ |
|
852 |
index-1 to:lastShown do:[:eachLine | |
|
853 |
self invalidateLine:eachLine |
|
854 |
]. |
|
855 |
"/ self redrawFromLine:index-1. |
|
856 |
]. |
|
857 |
]. |
|
2246 | 858 |
]. |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
859 |
self enqueueDelayedContentsChangedNotification. "recompute scrollbars" |
2257
d095d1e0779e
care for scrollWhenUpdating when adding individual lines
src
parents:
2249
diff
changeset
|
860 |
|
d095d1e0779e
care for scrollWhenUpdating when adding individual lines
src
parents:
2249
diff
changeset
|
861 |
(scrollWhenUpdating == #end or:[scrollWhenUpdating == #endOfText]) ifTrue:[ |
6304 | 862 |
"/ self selection isNil ifTrue:[ |
863 |
self scrollToBottom. |
|
864 |
"/ ] |
|
2257
d095d1e0779e
care for scrollWhenUpdating when adding individual lines
src
parents:
2249
diff
changeset
|
865 |
]. |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
866 |
|
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
867 |
"Modified: / 25-07-2012 / 12:00:54 / cg" |
2246 | 868 |
! |
869 |
||
105 | 870 |
at:lineNr |
6186 | 871 |
"retrieve a line's item; |
872 |
return nil if beyond end-of-text. |
|
873 |
this allows textViews to be used like collections in some places. |
|
874 |
Notice: for text lists, this returns strings (same as listAt:); |
|
875 |
for non-text lists, the item is returned." |
|
105 | 876 |
|
877 |
list isNil ifTrue:[^ nil]. |
|
6248 | 878 |
(lineNr between:1 and:list size) ifFalse:[^ nil]. |
105 | 879 |
^ list at:lineNr |
6186 | 880 |
|
881 |
"Modified (comment): / 18-07-2017 / 13:35:26 / cg" |
|
59 | 882 |
! |
883 |
||
105 | 884 |
at:index put:aString |
885 |
"change a line and redisplay" |
|
886 |
||
2577 | 887 |
|fontHeightBefore widthBefore| |
1608
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
888 |
|
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
889 |
fontHeightBefore := fontHeight. |
2224
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
890 |
widthBefore := widthOfWidestLine. |
105 | 891 |
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
|
892 |
|
105 | 893 |
shown ifTrue:[ |
6304 | 894 |
fontHeightBefore ~= fontHeight ifTrue:[ |
895 |
"/ must redraw everything |
|
896 |
self invalidate. |
|
897 |
^ self |
|
898 |
]. |
|
899 |
self redrawLine:index. |
|
2219
9ffca3757666
fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents:
2216
diff
changeset
|
900 |
|
9ffca3757666
fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents:
2216
diff
changeset
|
901 |
"/ 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
|
902 |
"/ 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
|
903 |
|
9ffca3757666
fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents:
2216
diff
changeset
|
904 |
|
9ffca3757666
fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents:
2216
diff
changeset
|
905 |
"/ "/ this could have changed the font height; |
9ffca3757666
fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents:
2216
diff
changeset
|
906 |
"/ "/ 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
|
907 |
"/ fontHeightBefore > fontHeight ifTrue:[ |
9ffca3757666
fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents:
2216
diff
changeset
|
908 |
"/ (self listLineIsVisible:(self size)) ifTrue:[ |
9ffca3757666
fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents:
2216
diff
changeset
|
909 |
"/ self clearRectangle:(margin @ (self yOfVisibleLine:nLinesShown+1)) |
9ffca3757666
fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents:
2216
diff
changeset
|
910 |
"/ corner:(width-margin) @ (height-margin). |
9ffca3757666
fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents:
2216
diff
changeset
|
911 |
"/ ]. |
9ffca3757666
fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents:
2216
diff
changeset
|
912 |
"/ self redrawFromLine:index |
9ffca3757666
fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents:
2216
diff
changeset
|
913 |
"/ ] ifFalse:[ |
9ffca3757666
fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents:
2216
diff
changeset
|
914 |
"/ self redrawLine:index |
9ffca3757666
fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents:
2216
diff
changeset
|
915 |
"/ ]. |
9ffca3757666
fixed redraw, when at:put: or add:
Claus Gittinger <cg@exept.de>
parents:
2216
diff
changeset
|
916 |
|
6304 | 917 |
"/ asynchronous: |
1194 | 918 |
"/ visibleLine := self listLineToVisibleLine:index. |
919 |
"/ visibleLine notNil ifTrue:[ |
|
920 |
"/ y := self yOfVisibleLine:visibleLine. |
|
921 |
"/ self invalidate:((margin @ y) extent:(width@fontHeight)) |
|
922 |
"/ ]. |
|
2224
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
923 |
|
6304 | 924 |
widthBefore ~~ widthOfWidestLine ifTrue:[ |
925 |
self enqueueDelayedContentsChangedNotification |
|
926 |
] |
|
105 | 927 |
] |
1194 | 928 |
|
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
929 |
"Modified: / 25-07-2012 / 12:01:46 / cg" |
105 | 930 |
! |
931 |
||
2427
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
932 |
characterAtCharacterPosition:charPos |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
933 |
"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
|
934 |
Return a space character if nothing is there |
2707 | 935 |
(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
|
936 |
|
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
937 |
|line col| |
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
938 |
|
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
939 |
line := self lineOfCharacterPosition:charPos. |
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
940 |
col := charPos - (self characterPositionOfLine:line col:1) + 1. |
2443 | 941 |
col == 0 ifTrue:[^ Character cr]. |
2427
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
942 |
^ self characterAtLine:line col:col |
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
943 |
! |
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
944 |
|
598
5d5194703de8
characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents:
594
diff
changeset
|
945 |
characterAtLine:lineNr col:colNr |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
946 |
"return the character at physical line/col. |
6155 | 947 |
The lineNr and colNr arguments start at 1, for the top-left character. |
598
5d5194703de8
characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents:
594
diff
changeset
|
948 |
Return a space character if nothing is there |
2707 | 949 |
(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
|
950 |
|
5d5194703de8
characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents:
594
diff
changeset
|
951 |
|line| |
5d5194703de8
characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents:
594
diff
changeset
|
952 |
|
5d5194703de8
characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents:
594
diff
changeset
|
953 |
list notNil ifTrue:[ |
6155 | 954 |
line := self listAt:lineNr. |
955 |
line notNil ifTrue:[ |
|
956 |
(line size >= colNr) ifTrue:[ |
|
957 |
^ line at:colNr |
|
958 |
] |
|
959 |
] |
|
598
5d5194703de8
characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents:
594
diff
changeset
|
960 |
]. |
5d5194703de8
characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents:
594
diff
changeset
|
961 |
^ Character space |
5d5194703de8
characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents:
594
diff
changeset
|
962 |
|
6155 | 963 |
"Created: / 29-04-1996 / 12:11:00 / cg" |
964 |
"Modified (comment): / 11-05-2017 / 17:11:16 / stefan" |
|
598
5d5194703de8
characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents:
594
diff
changeset
|
965 |
! |
5d5194703de8
characterAtLine:col: moved to here
Claus Gittinger <cg@exept.de>
parents:
594
diff
changeset
|
966 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
967 |
contents |
4610 | 968 |
"return the contents as a string, terminated by the line end character (sequence)" |
969 |
||
970 |
|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
|
971 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
972 |
list isNil ifTrue:[^ '']. |
4610 | 973 |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
974 |
self lineEndCRLF ifTrue:[ |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
975 |
lineEnd := String crlf. |
4610 | 976 |
] ifFalse:[ |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
977 |
lineEnd := Character cr. |
3314 | 978 |
]. |
4610 | 979 |
|
980 |
stringCollection := list asStringCollection. |
|
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
981 |
^ stringCollection |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
982 |
asStringWith:lineEnd |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
983 |
from:1 to:stringCollection size |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
984 |
compressTabs:false |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
985 |
final:lineEnd |
3314 | 986 |
|
987 |
"Modified: / 04-07-2006 / 19:18:47 / fm" |
|
105 | 988 |
! |
989 |
||
6575 | 990 |
contents:aStringOrStringCollection |
1240
1b3611a8e972
added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents:
1234
diff
changeset
|
991 |
"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
|
992 |
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
|
993 |
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
|
994 |
to a collection of line-strings here." |
105 | 995 |
|
6575 | 996 |
|listOfLines| |
997 |
||
998 |
listOfLines := aStringOrStringCollection. |
|
999 |
listOfLines notNil ifTrue:[ |
|
1000 |
listOfLines isString ifTrue:[ |
|
1001 |
listOfLines := listOfLines asStringCollection. |
|
1002 |
] |
|
105 | 1003 |
]. |
6575 | 1004 |
self list:listOfLines |
1005 |
||
1006 |
"Modified: / 05-06-1997 / 11:11:54 / cg" |
|
1007 |
"Modified (comment): / 23-04-2019 / 20:37:54 / Claus Gittinger" |
|
51 | 1008 |
! |
1009 |
||
6707 | 1010 |
flushCachedWidthOfWidestLine |
1011 |
"call this ,if the underlying contents changes without me getting to know |
|
1012 |
(i.e. if the line is a dynamically generated one, |
|
1013 |
such as a hexDump inside a virtual array)" |
|
1014 |
||
1015 |
widthOfWidestLine := nil. |
|
1016 |
! |
|
1017 |
||
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1018 |
from:from to:to do:aBlock |
652 | 1019 |
"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
|
1020 |
|
3256
0e978bc1d5fd
examples for big and huge lists added
Claus Gittinger <cg@exept.de>
parents:
3253
diff
changeset
|
1021 |
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
|
1022 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1023 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1024 |
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
|
1025 |
"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
|
1026 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1027 |
^ 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
|
1028 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1029 |
|
2455 | 1030 |
lineAtY:y |
1031 |
"return the lineNr for a given y-(view-)coordinate" |
|
1032 |
||
1033 |
|visibleLine| |
|
1034 |
||
1035 |
visibleLine := self visibleLineOfY:y. |
|
1036 |
visibleLine isNil ifTrue:[^ nil]. |
|
1037 |
^ self visibleLineToListLine:visibleLine. |
|
1038 |
! |
|
1039 |
||
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1040 |
list |
652 | 1041 |
"return the contents as a collection of strings. |
5978 | 1042 |
This returns the view's internal list - modifying it may confuse |
652 | 1043 |
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
|
1044 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1045 |
^ list |
652 | 1046 |
|
1240
1b3611a8e972
added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents:
1234
diff
changeset
|
1047 |
"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
|
1048 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1049 |
|
0 | 1050 |
list:aCollection |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1051 |
"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
|
1052 |
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
|
1053 |
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
|
1054 |
Tabs are expanded (to spaces). |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1055 |
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
|
1056 |
(remembered to optimize later redraws)." |
128 | 1057 |
|
4751 | 1058 |
self list:aCollection expandTabs:expandTabsWhenUpdating |
652 | 1059 |
|
1240
1b3611a8e972
added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents:
1234
diff
changeset
|
1060 |
"Modified: 5.6.1997 / 11:10:45 / cg" |
128 | 1061 |
! |
1062 |
||
1063 |
list:aCollection expandTabs:expand |
|
2128
33830e4f998f
added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents:
2090
diff
changeset
|
1064 |
"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
|
1065 |
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
|
1066 |
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
|
1067 |
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
|
1068 |
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
|
1069 |
|
4765 | 1070 |
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
|
1071 |
|
1b3611a8e972
added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents:
1234
diff
changeset
|
1072 |
"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
|
1073 |
! |
1b3611a8e972
added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents:
1234
diff
changeset
|
1074 |
|
1b3611a8e972
added low-level entry to set the list without a non-string scan
Claus Gittinger <cg@exept.de>
parents:
1234
diff
changeset
|
1075 |
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
|
1076 |
"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
|
1077 |
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
|
1078 |
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
|
1079 |
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
|
1080 |
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
|
1081 |
(remembered to optimize later redraws)." |
0 | 1082 |
|
1241 | 1083 |
self |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
1084 |
list:aCollection expandTabs:expand scanForNonStrings:scan includesNonStrings:nil |
1241 | 1085 |
|
1086 |
"Modified: 5.6.1997 / 12:40:35 / cg" |
|
1087 |
! |
|
1088 |
||
4747 | 1089 |
list:aCollection expandTabs:expand scanForNonStrings:scan includesNonStrings:nonStringsIfNoScan |
1090 |
"set the contents (a collection of strings) |
|
1091 |
and scroll as specified in scrollWhenUpdating (default:top-left). |
|
1092 |
If expand is true, tabs are expanded (to spaces). |
|
1093 |
If scan is true, scan the passed list for nonStrings; |
|
1094 |
otherwise, take the information from the nonStrings arg. |
|
1095 |
(the nonStrings information is remembered to optimize later redraws & height computations)." |
|
1096 |
||
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
1097 |
self |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
1098 |
list:aCollection |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
1099 |
expandTabs:expand |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
1100 |
scanForNonStrings:scan |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
1101 |
includesNonStrings:nonStringsIfNoScan |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
1102 |
redraw:true |
4747 | 1103 |
! |
1104 |
||
1105 |
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
|
1106 |
"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
|
1107 |
and scroll as specified in scrollWhenUpdating (default:top-left). |
1241 | 1108 |
If expand is true, tabs are expanded (to spaces). |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1109 |
If scan is true, scan the passed list for nonStrings; |
1241 | 1110 |
otherwise, take the information from the nonStrings arg. |
1111 |
(the nonStrings information is remembered to optimize later redraws & height computations)." |
|
1112 |
||
2199
455cd1c65af1
auto-scroll (when fetching list from model) to bottom fixed
Claus Gittinger <cg@exept.de>
parents:
2188
diff
changeset
|
1113 |
|oldFirst oldLeft nonStringsBefore fontHeightBefore |
3821 | 1114 |
scrollToEnd scrollToTop newLeftOffset wText same firstLine| |
2891 | 1115 |
|
4747 | 1116 |
"/ cg: what is the point in comparing here? |
1117 |
"/ I think, if there is something to optimize, |
|
1118 |
"/ the caller should do so (moved to getListFromModel). |
|
1119 |
"/ notice, that it may be very expensive to ask aCollection for each line |
|
1120 |
"/ for example, iff the lines are generated on the fly by an algorithm |
|
1121 |
false ifTrue:[ |
|
6304 | 1122 |
"/ see if there is a change at all. |
1123 |
"/ use to compare using =, but that's not enough in case of emphasis change. |
|
1124 |
aCollection size == list size ifTrue:[ |
|
1125 |
same := true. |
|
1126 |
aCollection size > 0 ifTrue:[ |
|
1127 |
aCollection with:list do:[:eachNewLine :eachOldLine | |
|
1128 |
(eachNewLine == eachOldLine) |
|
1129 |
ifFalse:[ |
|
1130 |
same := false. |
|
1131 |
] |
|
1132 |
] |
|
1133 |
]. |
|
1134 |
same ifTrue:[^ self]. |
|
1135 |
]. |
|
2891 | 1136 |
]. |
2199
455cd1c65af1
auto-scroll (when fetching list from model) to bottom fixed
Claus Gittinger <cg@exept.de>
parents:
2188
diff
changeset
|
1137 |
|
455cd1c65af1
auto-scroll (when fetching list from model) to bottom fixed
Claus Gittinger <cg@exept.de>
parents:
2188
diff
changeset
|
1138 |
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
|
1139 |
scrollToEnd := scrollWhenUpdating == #end or:[scrollWhenUpdating == #endOfText]. |
0 | 1140 |
|
4747 | 1141 |
(aCollection isEmptyOrNil and:[list isEmptyOrNil]) ifTrue:[ |
6304 | 1142 |
"no contents change" |
1143 |
list := aCollection. |
|
1144 |
scrollLocked ifFalse:[ |
|
1145 |
scrollToTop ifTrue:[ |
|
1146 |
self scrollToTop. |
|
1147 |
] ifFalse:[ |
|
1148 |
scrollToEnd ifTrue:[ |
|
1149 |
self scrollToBottom. |
|
1150 |
] |
|
1151 |
]. |
|
1152 |
self scrollToLeft. |
|
1153 |
]. |
|
1154 |
^ self |
|
0 | 1155 |
]. |
3314 | 1156 |
|
4747 | 1157 |
checkLineEndConventionWhenUpdating ifTrue:[ |
6304 | 1158 |
"Check if the we use DOS/Windows line end convention with CR LF. |
1159 |
The LF has already been consumed by the conversion to a StringCollection, |
|
1160 |
now check for and remove the trailing left over CRs" |
|
1161 |
||
1162 |
lineEndCRLF := (aCollection size > 0 |
|
1163 |
and:[(firstLine := aCollection at:1) isString |
|
1164 |
and:[firstLine notEmpty |
|
1165 |
and:[firstLine string endsWith:Character return]]]). |
|
4747 | 1166 |
]. |
3314 | 1167 |
lineEndCRLF ifTrue:[ |
6304 | 1168 |
list := aCollection |
1169 |
collect:[:eachLineWithCROrNil | |
|
1170 |
eachLineWithCROrNil isNil |
|
1171 |
ifTrue:nil |
|
1172 |
ifFalse:[(eachLineWithCROrNil endsWith:Character return) |
|
1173 |
ifTrue:[eachLineWithCROrNil copyButLast:1] |
|
1174 |
ifFalse:[eachLineWithCROrNil]]]. |
|
3314 | 1175 |
] ifFalse:[ |
6304 | 1176 |
list := aCollection. |
3314 | 1177 |
]. |
0 | 1178 |
|
864 | 1179 |
nonStringsBefore := includesNonStrings. |
1608
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
1180 |
fontHeightBefore := fontHeight. |
864 | 1181 |
includesNonStrings := false. |
1182 |
||
152 | 1183 |
list notNil ifTrue:[ |
6304 | 1184 |
expand ifTrue:[ |
1185 |
self expandTabs |
|
1186 |
] ifFalse:[ |
|
1187 |
scan ifTrue:[ |
|
1188 |
includesNonStrings := list contains:[:e | e isString not]. |
|
1189 |
] ifFalse:[ |
|
1190 |
includesNonStrings := nonStringsIfNoScan ? nonStringsBefore |
|
1191 |
] |
|
1192 |
]. |
|
0 | 1193 |
]. |
1608
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
1194 |
(includesNonStrings ~~ nonStringsBefore) ifTrue:[ |
6304 | 1195 |
self getFontParameters. |
1608
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
1196 |
]. |
152 | 1197 |
|
125 | 1198 |
widthOfWidestLine := nil. "/ i.e. unknown |
0 | 1199 |
oldFirst := firstLineShown. |
2429
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2427
diff
changeset
|
1200 |
oldLeft := viewOrigin x. |
2128
33830e4f998f
added control over how-to-scroll when updating text.
Claus Gittinger <cg@exept.de>
parents:
2090
diff
changeset
|
1201 |
|
2199
455cd1c65af1
auto-scroll (when fetching list from model) to bottom fixed
Claus Gittinger <cg@exept.de>
parents:
2188
diff
changeset
|
1202 |
(includesNonStrings ~~ nonStringsBefore) ifTrue:[ |
6304 | 1203 |
self computeNumberOfLinesShown. |
2199
455cd1c65af1
auto-scroll (when fetching list from model) to bottom fixed
Claus Gittinger <cg@exept.de>
parents:
2188
diff
changeset
|
1204 |
]. |
2429
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2427
diff
changeset
|
1205 |
|
4747 | 1206 |
scrollLocked ifFalse:[ |
6304 | 1207 |
newLeftOffset := viewOrigin x. |
1208 |
scrollToTop ifTrue:[ |
|
1209 |
firstLineShown := 1. |
|
1210 |
newLeftOffset := 0. |
|
1211 |
] ifFalse:[ |
|
1212 |
scrollToEnd ifTrue:[ |
|
1213 |
firstLineShown := (list size - nFullLinesShown + 1) max:1. |
|
1214 |
newLeftOffset := 0. |
|
1215 |
] |
|
1216 |
]. |
|
1217 |
newLeftOffset > 0 ifTrue:[ |
|
1218 |
wText := self widthOfContents. |
|
1219 |
(viewOrigin x + self innerWidth) > wText ifTrue:[ |
|
1220 |
newLeftOffset := (wText - self innerWidth) max:0. |
|
1221 |
]. |
|
1222 |
]. |
|
1223 |
newLeftOffset ~= oldLeft ifTrue:[ |
|
1224 |
viewOrigin := newLeftOffset @ viewOrigin y. |
|
1225 |
]. |
|
2429
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2427
diff
changeset
|
1226 |
]. |
837 | 1227 |
|
38 | 1228 |
realized ifTrue:[ |
6304 | 1229 |
self contentsChanged. |
1230 |
scrollLocked ifFalse:[ |
|
1231 |
" |
|
1232 |
don't use scroll here to avoid double redraw |
|
1233 |
" |
|
1234 |
viewOrigin := viewOrigin isNil ifTrue:[0@0] ifFalse:[(viewOrigin x) @ 0]. |
|
1235 |
gc transformation:nil. |
|
1236 |
||
1237 |
oldFirst ~~ firstLineShown ifTrue:[ |
|
1238 |
self originChanged:0 @ ((oldFirst - 1) * fontHeight negated). |
|
1239 |
]. |
|
1240 |
]. |
|
1241 |
doRedraw ifTrue:[ |
|
1242 |
shown ifTrue:[ |
|
1243 |
self invalidate. |
|
1244 |
] |
|
1245 |
] |
|
0 | 1246 |
] |
153 | 1247 |
|
3314 | 1248 |
"Modified: / 30-08-1995 / 19:07:13 / claus" |
1249 |
"Created: / 05-06-1997 / 12:40:06 / cg" |
|
1250 |
"Modified: / 04-07-2006 / 19:12:39 / fm" |
|
3339 | 1251 |
"Modified: / 22-08-2006 / 11:59:56 / cg" |
0 | 1252 |
! |
1253 |
||
2812 | 1254 |
listAt:lineNr |
1255 |
"given a lineNumber, return the corresponding string |
|
1256 |
This is used for accessing; i.e. for non-string entries, this |
|
6186 | 1257 |
returns the corresponding string. |
1258 |
Use #at: to get to the real item (if it is not a string)" |
|
2812 | 1259 |
|
1260 |
|l| |
|
1261 |
||
1262 |
l := self at:lineNr. |
|
1263 |
l isNil ifTrue:[^ l]. |
|
1264 |
^ self visibleStringFrom:l "/ l asString |
|
1265 |
||
6186 | 1266 |
"Modified: / 07-09-1995 / 15:54:59 / claus" |
1267 |
"Modified: / 18-07-2017 / 13:35:54 / cg" |
|
2812 | 1268 |
! |
1269 |
||
2233
ea4d220ac381
added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
1270 |
removeFromIndex:startLineNr toIndex:endLineNr |
ea4d220ac381
added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
1271 |
"delete some lines" |
ea4d220ac381
added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
1272 |
|
3442
418b14cb6a78
do not always flush widthOfWidestLine info.
Claus Gittinger <cg@exept.de>
parents:
3437
diff
changeset
|
1273 |
|nLines widestLineRemoved| |
2233
ea4d220ac381
added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
1274 |
|
ea4d220ac381
added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
1275 |
list isNil ifTrue:[^ self]. |
ea4d220ac381
added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
1276 |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1277 |
widestLineRemoved := self widthOfWidestLineBetween:startLineNr and:endLineNr. |
2233
ea4d220ac381
added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
1278 |
list removeFromIndex:startLineNr toIndex:(endLineNr min:list size). |
ea4d220ac381
added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
1279 |
|
3442
418b14cb6a78
do not always flush widthOfWidestLine info.
Claus Gittinger <cg@exept.de>
parents:
3437
diff
changeset
|
1280 |
widthOfWidestLine == widestLineRemoved ifTrue:[ |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
1281 |
widthOfWidestLine := nil. "/ i.e. unknown |
3442
418b14cb6a78
do not always flush widthOfWidestLine info.
Claus Gittinger <cg@exept.de>
parents:
3437
diff
changeset
|
1282 |
]. |
2233
ea4d220ac381
added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
1283 |
self textChanged. |
ea4d220ac381
added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
1284 |
|
2237
43f0318a830e
scroll pixel bug; removeFromIndex:toIndex: redraw bug.
Claus Gittinger <cg@exept.de>
parents:
2233
diff
changeset
|
1285 |
((startLineNr <= self lastLineShown) |
43f0318a830e
scroll pixel bug; removeFromIndex:toIndex: redraw bug.
Claus Gittinger <cg@exept.de>
parents:
2233
diff
changeset
|
1286 |
and:[endLineNr >= firstLineShown]) ifTrue:[ |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
1287 |
startLineNr to:self lastLineShown do:[:eachLine | |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
1288 |
self invalidateLine:eachLine |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
1289 |
]. |
2233
ea4d220ac381
added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
1290 |
]. |
ea4d220ac381
added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
1291 |
|
ea4d220ac381
added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
1292 |
nLines := list size. |
ea4d220ac381
added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
1293 |
(firstLineShown >= nLines) ifTrue:[ |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
1294 |
self makeLineVisible:nLines |
2233
ea4d220ac381
added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
1295 |
]. |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1296 |
self enqueueDelayedContentsChangedNotification. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1297 |
|
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1298 |
"Modified: / 25-07-2012 / 12:01:59 / cg" |
2233
ea4d220ac381
added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
1299 |
! |
ea4d220ac381
added #removeFromIndex:toIndex:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
1300 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1301 |
removeIndex:lineNr |
6608 | 1302 |
"delete a line, redraw the view. |
1303 |
Returns the receiver" |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1304 |
|
1453 | 1305 |
|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
|
1306 |
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
|
1307 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1308 |
(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
|
1309 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1310 |
" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1311 |
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
|
1312 |
" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1313 |
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
|
1314 |
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
|
1315 |
visLine notNil ifTrue:[ |
6608 | 1316 |
w := self widthForScrollBetween:lineNr and:(firstLineShown + nLinesShown). |
1433 | 1317 |
"/ x := textStartLeft. |
1318 |
"/ CLAUS fixes leftOver selection pixels |
|
6608 | 1319 |
w := w + leftMargin. |
1320 |
x := margin. |
|
1321 |
||
1322 |
srcY := topMargin + (visLine * fontHeight). |
|
1453 | 1323 |
"/ h := ((nLinesShown - visLine) * fontHeight). |
6608 | 1324 |
h := (height - margin - srcY). |
1325 |
h > 0 ifTrue:[ |
|
1326 |
self catchExpose. |
|
1327 |
self |
|
1328 |
copyFrom:self |
|
1329 |
x:x y:srcY |
|
1330 |
toX:x y:(srcY - fontHeight) |
|
1331 |
width:w height:h |
|
1332 |
async:true. |
|
1333 |
]. |
|
1334 |
self redrawVisibleLine:nFullLinesShown. |
|
1335 |
" |
|
1336 |
redraw last partial line - if any |
|
1337 |
" |
|
1338 |
(nFullLinesShown ~~ nLinesShown) ifTrue:[ |
|
1339 |
self redrawVisibleLine:nLinesShown |
|
1340 |
]. |
|
1341 |
h > 0 ifTrue:[ |
|
1342 |
self waitForExpose |
|
1343 |
]. |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1344 |
] |
587
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
1345 |
|
6608 | 1346 |
"Modified: / 27-02-1998 / 12:36:59 / cg" |
1347 |
"Modified (comment): / 24-06-2019 / 12:47:22 / Claus Gittinger" |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1348 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1349 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1350 |
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
|
1351 |
"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
|
1352 |
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
|
1353 |
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
|
1354 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1355 |
(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
|
1356 |
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
|
1357 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1358 |
lineNr < firstLineShown ifTrue:[ |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
1359 |
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
|
1360 |
]. |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1361 |
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
|
1362 |
^ true |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1363 |
|
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1364 |
"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
|
1365 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1366 |
|
2248
c6cb654bb807
added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
1367 |
replaceFrom:startLineNr to:endLineNr with:aCollection startingAt:replStartIndex |
c6cb654bb807
added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
1368 |
"replace some lines" |
c6cb654bb807
added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
1369 |
|
6304 | 1370 |
list isNil ifTrue:[ list := StringCollection new:endLineNr ]. |
2248
c6cb654bb807
added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
1371 |
list replaceFrom:startLineNr to:endLineNr with:aCollection startingAt:replStartIndex. |
c6cb654bb807
added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
1372 |
|
c6cb654bb807
added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
1373 |
widthOfWidestLine := nil. "/ i.e. unknown |
c6cb654bb807
added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
1374 |
self textChanged. |
c6cb654bb807
added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
1375 |
|
c6cb654bb807
added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
1376 |
((startLineNr <= self lastLineShown) |
c6cb654bb807
added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
1377 |
and:[endLineNr >= firstLineShown]) ifTrue:[ |
6304 | 1378 |
self invalidate. |
2248
c6cb654bb807
added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
1379 |
]. |
c6cb654bb807
added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
1380 |
|
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1381 |
self enqueueDelayedContentsChangedNotification. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1382 |
|
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1383 |
"Modified: / 25-07-2012 / 12:02:15 / cg" |
2248
c6cb654bb807
added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
1384 |
! |
c6cb654bb807
added #replaceFrom:to:with:startingAt:
Claus Gittinger <cg@exept.de>
parents:
2246
diff
changeset
|
1385 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1386 |
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
|
1387 |
"set the contents (either a string or a Collection of strings) |
5947 | 1388 |
don't change position (i.e. do not scroll). |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1389 |
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
|
1390 |
(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
|
1391 |
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
|
1392 |
|
2891 | 1393 |
|l| |
1394 |
||
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1395 |
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
|
1396 |
l notNil ifTrue:[ |
5947 | 1397 |
l isString ifTrue:[ |
1398 |
l := l asStringCollection |
|
1399 |
] |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1400 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1401 |
self setList:l. |
267
cc8e122f7dbe
Reset cache widthOfLongestLine in setList:, also reposition if contents fits
Stefan Vogel <sv@exept.de>
parents:
249
diff
changeset
|
1402 |
|
cc8e122f7dbe
Reset cache widthOfLongestLine in setList:, also reposition if contents fits
Stefan Vogel <sv@exept.de>
parents:
249
diff
changeset
|
1403 |
"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
|
1404 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1405 |
|
105 | 1406 |
setList:aCollection |
1407 |
"set the contents (a collection of strings); |
|
153 | 1408 |
do not change position (i.e. do not scroll). |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1409 |
This can be used to update a self-changing list |
105 | 1410 |
(for example: a file list being shown, without disturbing user too much)" |
1411 |
||
1412 |
^ self setList:aCollection expandTabs:true |
|
0 | 1413 |
! |
1414 |
||
153 | 1415 |
setList:aCollection expandTabs:expandTabs |
1416 |
"set the contents (a collection of strings); |
|
1417 |
do not change position (i.e. do not scroll). |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1418 |
This can be used to update a self-changing list |
153 | 1419 |
(for example: a file list being shown, without disturbing the user too much)" |
1420 |
||
1497
5b55a84e2258
added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents:
1494
diff
changeset
|
1421 |
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
|
1422 |
|
5b55a84e2258
added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents:
1494
diff
changeset
|
1423 |
"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
|
1424 |
! |
5b55a84e2258
added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents:
1494
diff
changeset
|
1425 |
|
5b55a84e2258
added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents:
1494
diff
changeset
|
1426 |
setList:aCollection expandTabs:expandTabs redraw:doRedraw |
5b55a84e2258
added entry to set the list without redrawing
Claus Gittinger <cg@exept.de>
parents:
1494
diff
changeset
|
1427 |
"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
|
1428 |
do not change position (i.e. do not scroll). |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1429 |
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
|
1430 |
(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
|
1431 |
|
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
1432 |
self |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
1433 |
setList:aCollection expandTabs:expandTabs scanForNonStrings:true includesNonStrings:nil |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
1434 |
redraw:doRedraw |
4747 | 1435 |
! |
1436 |
||
1437 |
setList:aCollection expandTabs:expandTabs scanForNonStrings:scan includesNonStrings:nonStringsIfNoScan redraw:doRedraw |
|
1438 |
"set the contents (a collection of strings); |
|
1439 |
do not change position (i.e. do not scroll). |
|
1440 |
This can be used to update a self-changing list |
|
1441 |
(for example: a file list being shown, without disturbing the user too much). |
|
1442 |
TODO: this stinks: most of the code is the same as in #list:expandTabs:... |
|
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
1443 |
needs a refactoring" |
4747 | 1444 |
|
1445 |
|prev| |
|
1446 |
||
1447 |
prev := scrollLocked. |
|
1448 |
[ |
|
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
1449 |
scrollLocked := false. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
1450 |
self |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
1451 |
list:aCollection |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
1452 |
expandTabs:expandTabs |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
1453 |
scanForNonStrings:scan |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
1454 |
includesNonStrings:nonStringsIfNoScan |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
1455 |
redraw:doRedraw |
4747 | 1456 |
] ensure:[ |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
1457 |
scrollLocked := prev |
1608
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
1458 |
]. |
4747 | 1459 |
"/ |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
1460 |
"/ |
4747 | 1461 |
"/"/ scrollLocked ifTrue:[ |
1462 |
"/"/ self setList:newText expandTabs:expandTabsWhenUpdating |
|
1463 |
"/"/ ] ifFalse:[ |
|
1464 |
"/ self list:newText expandTabs:expandTabsWhenUpdating scanForNonStrings:expandTabsWhenUpdating |
|
1465 |
"/"/ ] |
|
1466 |
"/ |
|
1467 |
"/ |oldFirst nonStringsBefore| |
|
1468 |
"/ |
|
1469 |
"/ (aCollection isNil and:[list isNil]) ifTrue:[ |
|
1470 |
"/ "no change" |
|
1471 |
"/ ^ self |
|
1472 |
"/ ]. |
|
1473 |
"/ |
|
1474 |
"/ list := aCollection. |
|
1475 |
"/ |
|
1476 |
"/ nonStringsBefore := includesNonStrings. |
|
1477 |
"/ includesNonStrings := false. |
|
1478 |
"/ |
|
1479 |
"/ list notNil ifTrue:[ |
|
1480 |
"/ expandTabs ifTrue:[ |
|
1481 |
"/ self expandTabs |
|
1482 |
"/ ] ifFalse:[ |
|
1483 |
"/ scan ifTrue:[ |
|
1484 |
"/ includesNonStrings := (list findFirst:[:e | e isString not]) ~~ 0. |
|
1485 |
"/ ] ifFalse:[ |
|
1486 |
"/ includesNonStrings := nonStringsIfNoScan ? nonStringsBefore |
|
1487 |
"/ ] |
|
1488 |
"/ ]. |
|
1489 |
"/ ]. |
|
1490 |
"/ (includesNonStrings ~~ nonStringsBefore) ifTrue:[ |
|
1491 |
"/ self getFontParameters. |
|
1492 |
"/ self computeNumberOfLinesShown. |
|
1493 |
"/ ]. |
|
1494 |
"/ |
|
1495 |
"/ "/ new: reposition horizontally if too big |
|
1496 |
"/ widthOfWidestLine := nil. "/ i.e. unknown |
|
1497 |
"/ innerWidth >= self widthOfContents ifTrue:[ |
|
1498 |
"/ viewOrigin := 0 @ viewOrigin y. |
|
1499 |
"/ ]. |
|
1500 |
"/ self contentsChanged. |
|
1501 |
"/ |
|
1502 |
"/ "/ new: reposition vertically if too big |
|
1503 |
"/ (firstLineShown + nFullLinesShown) > self size ifTrue:[ |
|
1504 |
"/ oldFirst := firstLineShown. |
|
1505 |
"/ firstLineShown := self size - nFullLinesShown + 1. |
|
1506 |
"/ firstLineShown < 1 ifTrue:[firstLineShown := 1]. |
|
1507 |
"/ oldFirst ~= firstLineShown ifTrue:[ |
|
1508 |
"/ viewOrigin y:((firstLineShown - 1) * fontHeight). |
|
1509 |
"/ self originChanged:0 @ ((oldFirst - 1) negated * fontHeight). |
|
1510 |
"/ shown ifTrue:[ |
|
1511 |
"/ self clearView. |
|
1512 |
"/ ] |
|
1513 |
"/ ] |
|
1514 |
"/ ]. |
|
1515 |
"/ |
|
1516 |
"/ (shown and:[doRedraw]) ifTrue:[ |
|
1517 |
"/ self invalidate |
|
1518 |
"/ "/ self redrawFromVisibleLine:1 to:nLinesShown |
|
1519 |
"/ ] |
|
1520 |
"/ |
|
1521 |
"/ "Modified: / 18.12.1995 / 23:27:54 / stefan" |
|
1522 |
"/ "Created: / 22.4.1998 / 11:11:51 / cg" |
|
1523 |
"/ "Modified: / 26.7.1998 / 13:46:49 / cg" |
|
153 | 1524 |
! |
1525 |
||
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1526 |
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
|
1527 |
"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
|
1528 |
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
|
1529 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1530 |
^ list size. |
0 | 1531 |
! |
1532 |
||
919 | 1533 |
stringAtLine:lineNr from:col1 to:col2 |
1534 |
"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
|
1535 |
including col2. |
919 | 1536 |
The lineNr and colNr arguments start at 1, for the top-left character. |
1537 |
Fills the string with space characters at the right. |
|
2707 | 1538 |
(i.e. beyond the end of the line or below the last line)" |
919 | 1539 |
|
1540 |
|line len s| |
|
1541 |
||
1542 |
len := col2 - col1 + 1. |
|
1543 |
list notNil ifTrue:[ |
|
6566 | 1544 |
line := self listAt:lineNr. |
1545 |
line notNil ifTrue:[ |
|
1546 |
(line size >= col1) ifTrue:[ |
|
1547 |
s := line copyFrom:col1. |
|
1548 |
s size < len ifTrue:[ |
|
1549 |
^ s paddedTo:len |
|
1550 |
]. |
|
1551 |
^ s copyTo:len |
|
1552 |
] |
|
1553 |
] |
|
919 | 1554 |
]. |
6566 | 1555 |
^ String new:len |
1556 |
||
1557 |
"Created: / 07-01-1997 / 19:58:43 / cg" |
|
1558 |
"Modified: / 24-03-2019 / 09:58:11 / Claus Gittinger" |
|
919 | 1559 |
! |
1560 |
||
2427
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
1561 |
textFromCharacterPosition:charPos1 to:charPos2 |
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
1562 |
"return some text as a collection of (line-)strings." |
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
1563 |
|
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
1564 |
|line1 col1 line2 col2| |
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
1565 |
|
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
1566 |
line1 := self lineOfCharacterPosition:charPos1. |
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
1567 |
col1 := charPos1 - (self characterPositionOfLine:line1 col:1) + 1. |
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
1568 |
|
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
1569 |
line2 := self lineOfCharacterPosition:charPos2. |
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
1570 |
col2 := charPos2 - (self characterPositionOfLine:line2 col:1) + 1. |
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
1571 |
|
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
1572 |
^ self textFromLine:line1 col:col1 toLine:line2 col:col2. |
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
1573 |
! |
43cc7ea39bac
more editing stuff (xxx-characterPosition)
Claus Gittinger <cg@exept.de>
parents:
2423
diff
changeset
|
1574 |
|
2158
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1575 |
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
|
1576 |
"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
|
1577 |
|
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1578 |
|text sz index last| |
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1579 |
|
4422
9954fb1dc0a4
changed: #textFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
4403
diff
changeset
|
1580 |
startLine isNil ifTrue:[^ nil]. |
9954fb1dc0a4
changed: #textFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
4403
diff
changeset
|
1581 |
endLine isNil ifTrue:[^ nil]. |
9954fb1dc0a4
changed: #textFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
4403
diff
changeset
|
1582 |
|
2158
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1583 |
(startLine == endLine) ifTrue:[ |
6019 | 1584 |
"part of a line" |
1585 |
^ 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
|
1586 |
]. |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
1587 |
|
2158
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1588 |
sz := endLine - startLine + 1. |
6019 | 1589 |
sz < 1 ifTrue:[^ StringCollection new]. |
2687 | 1590 |
|
2158
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1591 |
text := StringCollection new:sz. |
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1592 |
|
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1593 |
"get 1st and last (possibly) partial lines" |
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1594 |
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
|
1595 |
endCol == 0 ifTrue:[ |
6019 | 1596 |
last := '' |
2158
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1597 |
] ifFalse:[ |
6019 | 1598 |
last := self listAt:endLine to:endCol. |
2158
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1599 |
]. |
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1600 |
text at:sz put:last. |
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1601 |
|
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1602 |
"get bulk of text" |
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1603 |
index := 2. |
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1604 |
(startLine + 1) to:(endLine - 1) do:[:lineNr | |
6019 | 1605 |
text at:index put:(self listAt:lineNr). |
1606 |
index := index + 1 |
|
2158
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1607 |
]. |
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1608 |
^ text |
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1609 |
|
4422
9954fb1dc0a4
changed: #textFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
4403
diff
changeset
|
1610 |
"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
|
1611 |
! |
1fbe3297506f
generalized text-access fromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2133
diff
changeset
|
1612 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1613 |
withoutRedrawAt:index put:aString |
2224
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
1614 |
"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
|
1615 |
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
|
1616 |
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
|
1617 |
means at the end." |
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
1618 |
|
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
1619 |
|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
|
1620 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1621 |
self checkForExistingLine:index. |
2180
d208b77444a7
must set modified flag in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents:
2158
diff
changeset
|
1622 |
|
d208b77444a7
must set modified flag in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents:
2158
diff
changeset
|
1623 |
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
|
1624 |
list at:index put:aString. |
2180
d208b77444a7
must set modified flag in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents:
2158
diff
changeset
|
1625 |
oldLine ~= aString ifTrue:[ |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
1626 |
self textChanged |
2180
d208b77444a7
must set modified flag in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents:
2158
diff
changeset
|
1627 |
]. |
d208b77444a7
must set modified flag in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents:
2158
diff
changeset
|
1628 |
|
1608
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
1629 |
didIncludeNonStrings := includesNonStrings. |
105 | 1630 |
includesNonStrings ifFalse:[ |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
1631 |
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
|
1632 |
] ifTrue:[ |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
1633 |
(aString isNil or:[(aString isSingleByteString)]) ifTrue:[ |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
1634 |
includesNonStrings := list contains:[:l | l notNil and:[(l isSingleByteString) not]]. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
1635 |
] |
105 | 1636 |
]. |
851
b9d71ccdefaa
care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents:
837
diff
changeset
|
1637 |
|
1608
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
1638 |
includesNonStrings ~~ didIncludeNonStrings ifTrue:[ |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
1639 |
self getFontParameters. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
1640 |
self computeNumberOfLinesShown |
1608
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
1641 |
]. |
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
1642 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1643 |
widthOfWidestLine notNil ifTrue:[ |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
1644 |
self recomputeWidthOfWidestLineFor:aString old:oldLine. |
1963
aa5d0f63db19
notify about contentsChange in #withoutRedrawAt:put:
Claus Gittinger <cg@exept.de>
parents:
1938
diff
changeset
|
1645 |
]. |
634
1ca770b2c494
handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
1646 |
|
1608
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
1647 |
"Modified: / 26.7.1998 / 13:00:14 / cg" |
105 | 1648 |
! ! |
1649 |
||
2455 | 1650 |
!ListView methodsFor:'accessing-look'! |
1651 |
||
1652 |
backgroundColor |
|
1653 |
"return the background color" |
|
1654 |
||
1655 |
^ bgColor |
|
1656 |
! |
|
1657 |
||
1658 |
backgroundColor:aColor |
|
1659 |
"set the background color of the contents" |
|
1660 |
||
1661 |
bgColor ~~ aColor ifTrue:[ |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1662 |
bgColor := aColor. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1663 |
self viewBackground:bgColor. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1664 |
self invalidate "/ clear; redraw |
2455 | 1665 |
] |
1666 |
||
1667 |
"Modified: 3.5.1997 / 10:27:40 / cg" |
|
1668 |
! |
|
1669 |
||
1670 |
font:aFont |
|
1671 |
"set the font for all shown text. |
|
1672 |
Redraws everything. |
|
1673 |
CAVEAT: with the addition of Text objects, |
|
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1674 |
this method is going to be obsoleted by a textStyle |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1675 |
method, which allows specific control over |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1676 |
normalFont/boldFont/italicFont parameters." |
2455 | 1677 |
|
1678 |
aFont isNil ifTrue:[ |
|
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1679 |
^ self error:'nil font' mayProceed:true |
2455 | 1680 |
]. |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
1681 |
gc font ~~ aFont ifTrue:[ |
6497 | 1682 |
self flushCachedPreferredExtent. |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1683 |
widthOfWidestLine := nil. "/ i.e. unknown |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
1684 |
super font:aFont. |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1685 |
self getFontParameters. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1686 |
realized ifTrue:[ |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
1687 |
(gc font graphicsDevice == device) ifTrue:[ |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1688 |
self computeNumberOfLinesShown. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1689 |
shown ifTrue:[ |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1690 |
self redrawFromVisibleLine:1 to:nLinesShown |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1691 |
] |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1692 |
]. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1693 |
self enqueueDelayedContentsChangedNotification |
6471 | 1694 |
]. |
1695 |
self changed:#font. |
|
2455 | 1696 |
] |
1697 |
||
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
1698 |
"Modified: / 25-07-2012 / 12:01:36 / cg" |
6497 | 1699 |
"Modified: / 09-11-2018 / 20:16:05 / Claus Gittinger" |
2455 | 1700 |
! |
1701 |
||
1702 |
fontHeight:pixels |
|
6510
aec3e789e521
#DOCUMENTATION by cgexept.de
Claus Gittinger <cg@exept.de>
parents:
6497
diff
changeset
|
1703 |
"set the line height - that's the number of pixels, |
aec3e789e521
#DOCUMENTATION by cgexept.de
Claus Gittinger <cg@exept.de>
parents:
6497
diff
changeset
|
1704 |
by which lines are vertically separated (from top to top of next line)." |
2455 | 1705 |
|
1706 |
fontHeight ~~ pixels ifTrue:[ |
|
6510
aec3e789e521
#DOCUMENTATION by cgexept.de
Claus Gittinger <cg@exept.de>
parents:
6497
diff
changeset
|
1707 |
fontHeight := pixels. |
2455 | 1708 |
] |
1709 |
||
1710 |
"Created: 17.4.1997 / 01:41:33 / cg" |
|
1711 |
! |
|
1712 |
||
1713 |
foregroundColor |
|
1714 |
"return the foreground color" |
|
1715 |
||
1716 |
^ fgColor |
|
1717 |
! |
|
1718 |
||
1719 |
foregroundColor:aColor |
|
1720 |
"set the foreground color" |
|
1721 |
||
1722 |
fgColor ~~ aColor ifTrue:[ |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1723 |
fgColor := aColor. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1724 |
self invalidate |
2455 | 1725 |
] |
1726 |
||
1727 |
"Modified: 29.5.1996 / 16:19:02 / cg" |
|
1728 |
! |
|
1729 |
||
1730 |
foregroundColor:color1 backgroundColor:color2 |
|
1731 |
"set both foreground and background colors" |
|
1732 |
||
1733 |
((fgColor ~~ color1) or:[bgColor ~~ color2]) ifTrue:[ |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1734 |
fgColor := color1. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1735 |
bgColor := color2. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1736 |
self invalidate |
2455 | 1737 |
] |
1738 |
||
1739 |
"Modified: 29.5.1996 / 16:19:05 / cg" |
|
1740 |
! |
|
1741 |
||
1742 |
innerHorizontalMargin |
|
1743 |
"return the margin between the left border and the 1st col" |
|
1744 |
||
1745 |
^ leftMargin |
|
1746 |
||
1747 |
"Created: 16.1.1996 / 19:28:23 / cg" |
|
1748 |
! |
|
1749 |
||
1750 |
innerVerticalMargin |
|
1751 |
"return the margin between the top border and the 1st line" |
|
1752 |
||
1753 |
^ topMargin |
|
1754 |
||
1755 |
"Created: 16.1.1996 / 19:28:00 / cg" |
|
1756 |
! |
|
1757 |
||
1758 |
leftMargin |
|
1759 |
"return the margin to left of 1st col" |
|
1760 |
||
1761 |
^ leftMargin |
|
1762 |
! |
|
1763 |
||
1764 |
leftMargin:aNumber |
|
1765 |
"set the margin between the left border and the 1st col" |
|
1766 |
||
1767 |
leftMargin := aNumber. |
|
1768 |
textStartLeft := aNumber + margin. |
|
1769 |
innerWidth := width - aNumber - margin |
|
1770 |
||
1771 |
"Modified: 28.2.1996 / 19:32:55 / cg" |
|
1772 |
! |
|
1773 |
||
1774 |
level:aNumber |
|
1775 |
"set the 3D level - caught here to update text-position variables |
|
1776 |
(which avoids many computations later)" |
|
1777 |
||
1778 |
|newMargin| |
|
1779 |
||
1780 |
aNumber ~~ level ifTrue:[ |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1781 |
newMargin := aNumber abs. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1782 |
textStartLeft := leftMargin + newMargin. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1783 |
textStartTop := topMargin + newMargin. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1784 |
innerWidth := width - textStartLeft - newMargin. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1785 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1786 |
super level:aNumber. |
2455 | 1787 |
] |
1788 |
||
1789 |
"Modified: 11.8.1997 / 02:59:15 / cg" |
|
1790 |
! |
|
1791 |
||
4668 | 1792 |
lineSpacing |
1793 |
"get the lineSpacing - that's an additional number of pixels, |
|
1794 |
by which lines are vertically separated." |
|
1795 |
||
1796 |
^ lineSpacing |
|
1797 |
! |
|
1798 |
||
2455 | 1799 |
lineSpacing:pixels |
4668 | 1800 |
"set the lineSpacing - that's an additional number of pixels, |
2455 | 1801 |
by which lines are vertically separated." |
1802 |
||
1803 |
lineSpacing ~~ pixels ifTrue:[ |
|
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
1804 |
lineSpacing := pixels. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
1805 |
self getFontParameters. |
2455 | 1806 |
] |
1807 |
||
1808 |
"Modified: 22.5.1996 / 12:22:29 / cg" |
|
1809 |
! |
|
1810 |
||
1811 |
partialLines:aBoolean |
|
1812 |
"allow/disallow display of a last partial line" |
|
1813 |
||
1814 |
partialLines := aBoolean. |
|
1815 |
self computeNumberOfLinesShown |
|
1816 |
! |
|
1817 |
||
1818 |
topMargin:aNumber |
|
1819 |
"set the margin between the top border and the 1st line" |
|
1820 |
||
1821 |
topMargin := aNumber. |
|
1822 |
textStartTop := topMargin + margin. |
|
1823 |
! |
|
1824 |
||
1825 |
viewBackground:aColor |
|
1826 |
super viewBackground:aColor. |
|
1827 |
self isTextView ifFalse:[ |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1828 |
self backgroundColor:aColor |
2455 | 1829 |
]. |
1830 |
! ! |
|
1831 |
||
118 | 1832 |
!ListView methodsFor:'accessing-mvc'! |
1833 |
||
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1834 |
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
|
1835 |
"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
|
1836 |
|
75b8fb924904
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 |
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
|
1838 |
aDictionary at:#listMessage put:listMsg |
118 | 1839 |
! |
1840 |
||
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1841 |
listMessage |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1842 |
"return the listMsg selector; |
5780 | 1843 |
if non-nil, this is the message sent to the model (if any) to acquire |
125 | 1844 |
a new text upon change of the aspect. |
120 | 1845 |
This defaults to the aspect-selector." |
118 | 1846 |
|
125 | 1847 |
^ listMsg |
1848 |
! |
|
1849 |
||
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1850 |
listMessage:aSymbol |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1851 |
"ST-80 compatibility: set the listMsg selector; |
5780 | 1852 |
if non-nil, this will be sent to the model (if any) to acquire a |
125 | 1853 |
new text upon change of the aspect. |
1854 |
This defaults to the aspect-selector." |
|
1855 |
||
1856 |
listMsg := aSymbol. |
|
120 | 1857 |
! |
1858 |
||
907
ea81777689f1
Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents:
903
diff
changeset
|
1859 |
model:aModel |
5029 | 1860 |
"define the receiver's model, from which the text is |
5780 | 1861 |
to be acquired via list- or aspect-messages, whenever its aspect |
907
ea81777689f1
Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents:
903
diff
changeset
|
1862 |
changes." |
ea81777689f1
Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents:
903
diff
changeset
|
1863 |
|
ea81777689f1
Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents:
903
diff
changeset
|
1864 |
super model:aModel. |
ea81777689f1
Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents:
903
diff
changeset
|
1865 |
self getListFromModel |
ea81777689f1
Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents:
903
diff
changeset
|
1866 |
|
ea81777689f1
Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents:
903
diff
changeset
|
1867 |
"Created: 31.12.1996 / 14:56:43 / stefan" |
ea81777689f1
Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents:
903
diff
changeset
|
1868 |
! |
ea81777689f1
Move #model: from TextView to ListView.
Stefan Vogel <sv@exept.de>
parents:
903
diff
changeset
|
1869 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1870 |
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
|
1871 |
"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
|
1872 |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1873 |
^ 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
|
1874 |
! |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1875 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1876 |
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
|
1877 |
"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
|
1878 |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1879 |
^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
|
1880 |
! |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1881 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1882 |
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
|
1883 |
"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
|
1884 |
|
4015
8647dad37cb0
comment/format in: #on:aspect:change:list:menu:
Claus Gittinger <cg@exept.de>
parents:
3869
diff
changeset
|
1885 |
aspectSymbol notNil ifTrue:[ |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
1886 |
aspectMsg := aspectSymbol. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
1887 |
listMsg isNil ifTrue:[ |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
1888 |
listMsg := aspectSymbol |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
1889 |
] |
4015
8647dad37cb0
comment/format in: #on:aspect:change:list:menu:
Claus Gittinger <cg@exept.de>
parents:
3869
diff
changeset
|
1890 |
]. |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1891 |
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
|
1892 |
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
|
1893 |
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
|
1894 |
self model:aModel. |
909
be8e88881f4d
dont clear listMessage in #on:aspect:...
Claus Gittinger <cg@exept.de>
parents:
907
diff
changeset
|
1895 |
|
be8e88881f4d
dont clear listMessage in #on:aspect:...
Claus Gittinger <cg@exept.de>
parents:
907
diff
changeset
|
1896 |
"Modified: 2.1.1997 / 16:11:16 / cg" |
105 | 1897 |
! |
1898 |
||
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1899 |
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
|
1900 |
"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
|
1901 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1902 |
^ self on:aModel aspect:aspectSymbol change:changeSymbol list:nil menu:menuSymbol |
0 | 1903 |
! |
1904 |
||
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1905 |
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
|
1906 |
"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
|
1907 |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1908 |
^ 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
|
1909 |
! |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1910 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1911 |
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
|
1912 |
"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
|
1913 |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
1914 |
^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
|
1915 |
! ! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1916 |
|
2227 | 1917 |
!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
|
1918 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1919 |
update:something with:aParameter from:changedObject |
2322 | 1920 |
|idx| |
1921 |
||
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1922 |
changedObject == model ifTrue:[ |
5884 | 1923 |
model isList ifTrue:[ |
1924 |
list ~~ model ifTrue:[ |
|
1925 |
something == #at: ifTrue:[ |
|
1926 |
idx := aParameter isCollection ifTrue:[aParameter at:1] |
|
1927 |
ifFalse:[aParameter]. |
|
1928 |
^ self at:aParameter put:(model at:idx). |
|
1929 |
]. |
|
1930 |
something == #insert: ifTrue:[ |
|
1931 |
(list size + 1) >= aParameter ifTrue:[ |
|
1932 |
^ self add:(model at:aParameter) beforeIndex:aParameter |
|
1933 |
]. |
|
1934 |
]. |
|
1935 |
something == #remove: ifTrue:[ |
|
1936 |
list size >= aParameter ifTrue:[ |
|
1937 |
^ self removeIndex:aParameter |
|
1938 |
] |
|
1939 |
]. |
|
1940 |
]. |
|
1941 |
self getListFromModel. |
|
1942 |
^ self |
|
1943 |
]. |
|
1944 |
||
1945 |
(aspectMsg notNil |
|
1946 |
and:[something == aspectMsg]) ifTrue:[ |
|
1947 |
self getListFromModel. |
|
1948 |
^ self |
|
1949 |
]. |
|
1950 |
something isNil ifTrue:[ |
|
1951 |
"/ model changed (not more information) |
|
1952 |
self getListFromModel. |
|
1953 |
^ self |
|
1954 |
]. |
|
1955 |
something == #size ifTrue:[ |
|
1956 |
self getListFromModelScroll:false. |
|
1957 |
^ self |
|
1958 |
]. |
|
0 | 1959 |
]. |
3425
883607c8a0df
care for listChannel changes
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
1960 |
changedObject == listChannel ifTrue:[ |
5884 | 1961 |
self getListFromModel. |
1962 |
^ self |
|
3425
883607c8a0df
care for listChannel changes
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
1963 |
]. |
883607c8a0df
care for listChannel changes
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
1964 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
1965 |
^ 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
|
1966 |
|
3425
883607c8a0df
care for listChannel changes
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
1967 |
"Modified: / 08-11-2006 / 19:40:29 / cg" |
0 | 1968 |
! ! |
1969 |
||
105 | 1970 |
!ListView methodsFor:'drawing'! |
1971 |
||
6388 | 1972 |
drawLine:line inVisible:visLineNr with:fg and:bg |
1973 |
"draw a given string at visible lines position in fg/bg" |
|
1974 |
||
1975 |
self drawLine:line atX:(textStartLeft - viewOrigin x) inVisible:visLineNr with:fg and:bg |
|
1976 |
! |
|
1977 |
||
1978 |
drawVisibleLine:visLineNr col:col with:fg and:bg |
|
1979 |
"draw single character at col index of visible line in fg/bg" |
|
1980 |
||
1981 |
self |
|
1982 |
drawLine:(self visibleAt:visLineNr) |
|
1983 |
inVisible:visLineNr |
|
1984 |
col:col |
|
1985 |
with:fg and:bg |
|
1986 |
! |
|
1987 |
||
1988 |
drawVisibleLine:visLineNr from:startCol to:endCol with:fg and:bg |
|
1989 |
"draw part of a visible line in fg/bg" |
|
1990 |
||
1991 |
self |
|
1992 |
drawLine:(self visibleAt:visLineNr) |
|
1993 |
inVisible:visLineNr |
|
1994 |
from:startCol to:endCol |
|
1995 |
with:fg and:bg |
|
1996 |
! |
|
1997 |
||
1998 |
drawVisibleLine:visLineNr from:startCol with:fg and:bg |
|
1999 |
"draw right part of a visible line from startCol to end of line in fg/bg" |
|
2000 |
||
2001 |
self |
|
2002 |
drawLine:(self visibleAt:visLineNr) |
|
2003 |
inVisible:visLineNr |
|
2004 |
from:startCol |
|
2005 |
with:fg and:bg |
|
2006 |
! |
|
2007 |
||
2008 |
drawVisibleLine:visLineNr with:fg and:bg |
|
2009 |
"draw a visible line in fg/bg" |
|
2010 |
||
2011 |
self |
|
2012 |
drawLine:(self visibleAt:visLineNr) |
|
2013 |
atX:(textStartLeft - viewOrigin x) |
|
2014 |
inVisible:visLineNr |
|
2015 |
with:fg |
|
2016 |
and:bg |
|
2017 |
||
2018 |
"Modified: 28.2.1996 / 19:30:23 / cg" |
|
2019 |
! |
|
2020 |
||
2021 |
fillRectangleX:x y:y width:w height:h |
|
2022 |
"fill rectangle; checks whether the rectangle already is filled with |
|
2023 |
the current paint (#redrawX:y:w:h)." |
|
2024 |
||
2025 |
backgroundAlreadyClearedColor ~~ self paint ifTrue:[ |
|
2026 |
super fillRectangleX:x y:y width:w height:h |
|
2027 |
] |
|
2028 |
! |
|
2029 |
||
2030 |
invalidateLine:line |
|
2031 |
"invalidate the area of a single line. |
|
2032 |
This arranges for that line to be redrawn asynchronously (later). |
|
2033 |
If multiple such invalidations arrive, those areas may be lumped |
|
2034 |
together for a block update. |
|
2035 |
The update takes place when the windowGroup process gets a chance to |
|
2036 |
process expose events." |
|
2037 |
||
2038 |
|yTop visLineNr| |
|
2039 |
||
2040 |
visLineNr := self listLineToVisibleLine:line. |
|
2041 |
visLineNr notNil ifTrue:[ |
|
2042 |
yTop := self yOfVisibleLine:visLineNr. |
|
2043 |
yTop isNil ifTrue:[^ self]. "/ not visible |
|
2044 |
(yTop + fontHeight) < 0 ifTrue:[^ self]. "/ not visible |
|
2045 |
self |
|
2046 |
invalidateDeviceRectangle:(Rectangle |
|
2047 |
left:margin top:yTop-(lineSpacing//2) |
|
2048 |
width:(width - (2 * margin)) height:fontHeight) |
|
2049 |
repairNow:false. |
|
2050 |
] |
|
2051 |
||
2052 |
"Created: / 5.3.1998 / 01:24:19 / cg" |
|
2053 |
"Modified: / 5.3.1998 / 13:41:31 / cg" |
|
2054 |
! ! |
|
2055 |
||
2056 |
!ListView methodsFor:'drawing-basic'! |
|
2057 |
||
105 | 2058 |
drawFromVisibleLine:startVisLineNr to:endVisLineNr with:fg and:bg |
2059 |
"draw a visible line range in fg/bg" |
|
2060 |
||
2061 |
|y "{ Class: SmallInteger }" |
|
2062 |
x "{ Class: SmallInteger }" |
|
2063 |
startLine "{ Class: SmallInteger }" |
|
2064 |
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
|
2065 |
listSize e sH l| |
105 | 2066 |
|
2067 |
y := self yOfVisibleLine:startVisLineNr. |
|
394
795f293f8520
fixed debris-leftover in scrollDown
Claus Gittinger <cg@exept.de>
parents:
392
diff
changeset
|
2068 |
sH := lineSpacing // 2. |
795f293f8520
fixed debris-leftover in scrollDown
Claus Gittinger <cg@exept.de>
parents:
392
diff
changeset
|
2069 |
|
1700
3538310c2724
fixed widthOfContents with variable fonts (win32);
Claus Gittinger <cg@exept.de>
parents:
1699
diff
changeset
|
2070 |
backgroundAlreadyClearedColor == bg ifFalse:[ |
6053 | 2071 |
gc paint:bg. |
2072 |
gc fillRectangleX:margin y:y-sH |
|
2073 |
width:(width - (margin * 2)) |
|
2074 |
height:(endVisLineNr - startVisLineNr + 1) * fontHeight + (lineSpacing - sH). |
|
1700
3538310c2724
fixed widthOfContents with variable fonts (win32);
Claus Gittinger <cg@exept.de>
parents:
1699
diff
changeset
|
2075 |
]. |
105 | 2076 |
list isNil ifTrue:[^ self]. |
2077 |
||
2078 |
y := y + fontAscent. |
|
2079 |
listSize := self size. |
|
2080 |
||
2081 |
startLine := startVisLineNr + firstLineShown - 1. |
|
2082 |
endLine := endVisLineNr + firstLineShown - 1. |
|
2083 |
(startLine == 0) ifTrue:[ |
|
5862 | 2084 |
y := y + fontHeight. |
2085 |
startLine := startLine + 1 |
|
105 | 2086 |
]. |
2087 |
||
2088 |
(endLine > listSize) ifTrue:[ |
|
5862 | 2089 |
e := listSize |
105 | 2090 |
] ifFalse:[ |
5862 | 2091 |
e := endLine |
105 | 2092 |
]. |
2093 |
||
2094 |
(startLine <= e) ifTrue:[ |
|
5862 | 2095 |
x := textStartLeft - viewOrigin x. |
6053 | 2096 |
gc paint:fg on:bg. |
5862 | 2097 |
"/ don't use list from:to:do:, to allow for subclasses to redefine the enumeration (TableView) |
2098 |
self from:startLine to:e do:[:line | |
|
2099 |
line notNil ifTrue:[ |
|
2100 |
"/ remove line's color emphasis, to enforce color. |
|
2101 |
"/ otherwise blue text is not visible if selection-bg is blue |
|
2102 |
l := self withoutColorEmphasis:line ifFg:fg andBg:bg. |
|
6053 | 2103 |
gc displayOpaqueString:l x:x y:y. |
5862 | 2104 |
|
2105 |
checkedLinesForWidthOfContentsComputation == 0 ifTrue:[ |
|
2106 |
self updateWidthOfWidestLineFor:l |
|
2107 |
]. |
|
2108 |
]. |
|
2109 |
y := y + fontHeight |
|
2110 |
] |
|
105 | 2111 |
] |
2112 |
||
2090
85c0dd8a4281
selection over colored text - again
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
2113 |
"Modified: / 15.12.1999 / 23:19:39 / cg" |
7 | 2114 |
! |
2115 |
||
131 | 2116 |
drawLine:line atX:x inVisible:visLineNr with:fg and:bg |
2117 |
"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
|
2118 |
given x position in fg/bg. Clears the whole line before drawing the string. |
5198 | 2119 |
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
|
2120 |
|
5372 | 2121 |
|y l halfSpacing extraBelow| |
422
12bfba6f62b5
redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents:
407
diff
changeset
|
2122 |
|
12bfba6f62b5
redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents:
407
diff
changeset
|
2123 |
y := self yOfVisibleLine:visLineNr. |
1700
3538310c2724
fixed widthOfContents with variable fonts (win32);
Claus Gittinger <cg@exept.de>
parents:
1699
diff
changeset
|
2124 |
backgroundAlreadyClearedColor == bg ifFalse:[ |
6065 | 2125 |
gc paint:bg. |
5862 | 2126 |
halfSpacing := (lineSpacing//2). |
2127 |
extraBelow := 0. |
|
2128 |
self highlightLineSpacing ifTrue:[ |
|
2129 |
extraBelow := halfSpacing. |
|
2130 |
]. |
|
6053 | 2131 |
gc fillRectangleX:margin y:y - halfSpacing |
2132 |
width:(width - (2 * margin)) |
|
2133 |
height:fontHeight+extraBelow. |
|
1700
3538310c2724
fixed widthOfContents with variable fonts (win32);
Claus Gittinger <cg@exept.de>
parents:
1699
diff
changeset
|
2134 |
]. |
6388 | 2135 |
|
422
12bfba6f62b5
redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents:
407
diff
changeset
|
2136 |
line notNil ifTrue:[ |
6053 | 2137 |
gc paint:fg on:bg. |
5862 | 2138 |
|
6388 | 2139 |
"/ remove line's color emphasis, to enforce color. |
5862 | 2140 |
"/ otherwise blue text is not visible if selection-bg is blue. |
6388 | 2141 |
"/ This is only done in EditTextViews and subClasses. |
5862 | 2142 |
self suppressEmphasisInSelection ifTrue:[ |
2143 |
l := self withoutColorEmphasis:line ifFg:fg andBg:bg. |
|
2144 |
] ifFalse:[ |
|
2145 |
l := line |
|
2146 |
]. |
|
6065 | 2147 |
|
2148 |
"/ in the future, we may like to have a flag setting, which highlights non-ISO8859 characters; |
|
2149 |
"/ so we can tell, which chars make problems when saving as non-UTF8 |
|
2150 |
||
2151 |
"/ l string bytesPerCharacter > 1 ifTrue:[ |
|
2152 |
"/ l do:[:each | each bytesPerCharacter > 1 ifTrue:[ self halt ]]. |
|
2153 |
"/ ]. |
|
6053 | 2154 |
gc displayOpaqueString:l x:x y:(y + fontAscent). |
5862 | 2155 |
|
2156 |
checkedLinesForWidthOfContentsComputation == 0 ifTrue:[ |
|
2157 |
self updateWidthOfWidestLineFor:l |
|
2158 |
]. |
|
5372 | 2159 |
]. |
422
12bfba6f62b5
redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents:
407
diff
changeset
|
2160 |
|
6388 | 2161 |
"Modified: / 15-12-1999 / 23:19:46 / cg" |
2162 |
"Modified: / 04-08-2018 / 14:50:54 / Claus Gittinger" |
|
422
12bfba6f62b5
redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents:
407
diff
changeset
|
2163 |
! |
12bfba6f62b5
redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents:
407
diff
changeset
|
2164 |
|
12bfba6f62b5
redraw debris leftover fixed (cursorStyle==#motif)
Claus Gittinger <cg@exept.de>
parents:
407
diff
changeset
|
2165 |
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
|
2166 |
"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
|
2167 |
given x position in fg/bg. Clears partial line before drawing the string. |
131 | 2168 |
Low level entry; not meant for public use." |
2169 |
||
2090
85c0dd8a4281
selection over colored text - again
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
2170 |
|y l| |
105 | 2171 |
|
2172 |
y := self yOfVisibleLine:visLineNr. |
|
2173 |
line notNil ifTrue:[ |
|
6053 | 2174 |
gc paint:fg on:bg. |
5862 | 2175 |
|
2176 |
"/ remove lines color emphasis, to enforce color. |
|
2177 |
"/ otherwise blue text is not visible if selection-bg is blue |
|
2178 |
l := self withoutColorEmphasis:line ifFg:fg andBg:bg. |
|
6053 | 2179 |
gc displayOpaqueString:l x:x y:(y + fontAscent). |
5862 | 2180 |
|
2181 |
checkedLinesForWidthOfContentsComputation == 0 ifTrue:[ |
|
2182 |
self updateWidthOfWidestLineFor:l |
|
2183 |
]. |
|
105 | 2184 |
] |
191
5ccbde40bb6b
draw strings half a lineSpacing lower - highlight frames look better
Claus Gittinger <cg@exept.de>
parents:
190
diff
changeset
|
2185 |
|
2090
85c0dd8a4281
selection over colored text - again
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
2186 |
"Modified: / 15.12.1999 / 23:19:55 / cg" |
105 | 2187 |
! |
2188 |
||
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
2189 |
drawLine:lineStringArg inVisible:visLineNr col:col with:fg and:bg |
105 | 2190 |
"draw single character at col index of visible line in fg/bg" |
2191 |
||
2561 | 2192 |
|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
|
2193 |
|
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
2194 |
lineString := lineStringArg. |
2561 | 2195 |
len := lineString size. |
1927
d5e14e7bce6f
fixed cursor drawing over coloured text
Claus Gittinger <cg@exept.de>
parents:
1911
diff
changeset
|
2196 |
|
2429
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2427
diff
changeset
|
2197 |
x := (self xOfCol:col inVisibleLine:visLineNr) - viewOrigin x. |
105 | 2198 |
y := self yOfVisibleLine:visLineNr. |
2561 | 2199 |
yf := y - (lineSpacing // 2). |
2200 |
||
6053 | 2201 |
gc paint:bg. |
2576
8af235849704
partial redraw behone non-string lines end
Michael Beyl <mb@exept.de>
parents:
2565
diff
changeset
|
2202 |
|
2561 | 2203 |
(lineString notNil and:[lineString isString not]) ifTrue:[ |
5862 | 2204 |
w := lineString widthFrom:col to:(col min:len) on:self. |
2205 |
w <= 0 ifTrue:[ |
|
2206 |
w := gc font width. |
|
6053 | 2207 |
gc fillRectangleX:x y:yf width:w height:fontHeight. |
2208 |
gc paint:fg |
|
5862 | 2209 |
]. |
2210 |
self clippedTo:(Rectangle left:x top:yf width:w height:fontHeight) do:[ |
|
2211 |
self drawVisibleLine:visLineNr with:fg and:bg |
|
2212 |
]. |
|
2213 |
^ self |
|
2561 | 2214 |
]. |
2215 |
||
2654 | 2216 |
(lineString isNil or:[col > len]) ifTrue:[ |
6053 | 2217 |
gc fillRectangleX:x y:yf width:(gc font width) height:fontHeight. |
2218 |
gc paint:fg |
|
105 | 2219 |
] ifFalse:[ |
5862 | 2220 |
characterString := lineString copyFrom:col to:col. |
2221 |
||
2222 |
"/ remove lines color emphasis, to enforce color. |
|
2223 |
"/ otherwise blue text is not visible if selection-bg is blue |
|
2224 |
characterString := self withoutColorEmphasis:characterString ifFg:fg andBg:bg. |
|
2225 |
w := characterString widthOn:self. |
|
2226 |
||
6053 | 2227 |
gc fillRectangleX:x y:yf width:w height:fontHeight. |
2228 |
gc paint:fg. |
|
5862 | 2229 |
self clippedTo:(Rectangle left:x top:yf width:w height:fontHeight) do:[ |
6053 | 2230 |
gc displayString:characterString x:x y:(y + fontAscent) |
5862 | 2231 |
]. |
2232 |
||
2233 |
checkedLinesForWidthOfContentsComputation == 0 ifTrue:[ |
|
2234 |
self updateWidthOfWidestLineFor:characterString |
|
2235 |
]. |
|
105 | 2236 |
] |
191
5ccbde40bb6b
draw strings half a lineSpacing lower - highlight frames look better
Claus Gittinger <cg@exept.de>
parents:
190
diff
changeset
|
2237 |
|
2090
85c0dd8a4281
selection over colored text - again
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
2238 |
"Modified: / 15.12.1999 / 23:21:12 / cg" |
105 | 2239 |
! |
2240 |
||
2558
4c10bec1117d
more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents:
2557
diff
changeset
|
2241 |
drawLine:lineStringArg inVisible:visLineNr from:startCol to:endColOrNil with:fg and:bg |
105 | 2242 |
"draw part of a visible line in fg/bg" |
2243 |
||
4637 | 2244 |
|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
|
2245 |
|
4c10bec1117d
more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents:
2557
diff
changeset
|
2246 |
"/ hack - please rewrite |
4c10bec1117d
more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents:
2557
diff
changeset
|
2247 |
endCol := endColOrNil ? lineStringArg size. |
105 | 2248 |
(endCol >= startCol) ifTrue:[ |
4049 | 2249 |
sCol := startCol max:1. |
2250 |
||
2251 |
lineString := lineStringArg. |
|
2252 |
||
2253 |
x := (self xOfCol:sCol inVisibleLine:visLineNr) - viewOrigin x. |
|
2254 |
y := (self yOfVisibleLine:visLineNr). |
|
2255 |
yf := y - (lineSpacing // 2). |
|
2256 |
||
2257 |
len := lineString size. |
|
5111 | 2258 |
(lineString notNil and:[lineString isString not ]) |
4049 | 2259 |
ifTrue:[ |
2260 |
w := lineString widthFrom:sCol to:(endCol min:len) on:self. |
|
2261 |
endCol > len ifTrue:[ |
|
2262 |
sCol > len ifTrue:[ |
|
4637 | 2263 |
numExtraCols := (endCol - sCol + 1). |
4049 | 2264 |
] ifFalse:[ |
4637 | 2265 |
numExtraCols := (endCol - len" + 1"). |
4049 | 2266 |
]. |
6053 | 2267 |
gc paint:bg. |
2268 |
gc fillRectangleX:x+w y:yf width:(numExtraCols * fontWidth) height:fontHeight. |
|
4049 | 2269 |
]. |
2270 |
w > 0 ifTrue:[ |
|
2271 |
self clippedTo:(Rectangle left:x top:yf width:w height:fontHeight) do:[ |
|
6387 | 2272 |
self drawVisibleLine:visLineNr with:fg and:bg. |
5862 | 2273 |
]. |
2274 |
checkedLinesForWidthOfContentsComputation == 0 ifTrue:[ |
|
2275 |
self updateWidthOfWidestLineFor:characterString |
|
2276 |
]. |
|
4049 | 2277 |
]. |
2278 |
^ self. |
|
2279 |
]. |
|
2280 |
||
2281 |
(sCol > len) ifTrue:[ |
|
2282 |
backgroundAlreadyClearedColor == bg ifFalse:[ |
|
2283 |
len := endCol - sCol + 1. |
|
6053 | 2284 |
gc paint:bg. |
2285 |
gc fillRectangleX:x y:yf |
|
4049 | 2286 |
width:(fontWidth * len) |
2287 |
height:fontHeight |
|
2288 |
] |
|
2289 |
] ifFalse:[ |
|
2290 |
eCol := endCol. |
|
2291 |
(endCol > len) ifTrue:[ |
|
2292 |
backgroundAlreadyClearedColor == bg ifFalse:[ |
|
2293 |
characterString := lineString string species new:endCol. |
|
2294 |
characterString replaceFrom:1 to:len with:lineString startingAt:1. |
|
2295 |
lineString := characterString. |
|
2296 |
] ifTrue:[ |
|
2297 |
eCol := len. |
|
2298 |
]. |
|
2299 |
]. |
|
2300 |
||
2301 |
"/ remove any color emphasis, to enforce drawing in fg/bg |
|
2302 |
||
2303 |
lineString := self withoutColorEmphasis:lineString ifFg:fg andBg:bg. |
|
2304 |
||
2305 |
backgroundAlreadyClearedColor == bg ifFalse:[ |
|
5111 | 2306 |
(lineString isSingleByteString) ifTrue:[ |
4049 | 2307 |
fontIsFixedWidth ifTrue:[ |
2308 |
w := (eCol - sCol + 1) * fontWidth |
|
2309 |
] ifFalse:[ |
|
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
2310 |
w := gc font widthOf:lineString from:sCol to:eCol |
4049 | 2311 |
] |
2312 |
] ifFalse:[ |
|
2313 |
w := lineString widthFrom:sCol to:endCol on:self |
|
2314 |
]. |
|
6053 | 2315 |
gc paint:bg. |
2316 |
gc fillRectangleX:x y:yf width:w height:fontHeight. |
|
4049 | 2317 |
]. |
6053 | 2318 |
gc paint:fg on:bg. |
4049 | 2319 |
w notNil ifTrue:[ |
2320 |
"/ clip req'd for VISTAs new font rendering (which seems to shoot over the compute |
|
2321 |
self clippedTo:(Rectangle left:x top:yf width:w height:fontHeight) do:[ |
|
4495 | 2322 |
"/ self displayOpaqueString:lineString from:sCol to:eCol x:x y:(y + fontAscent) |
6053 | 2323 |
gc displayString:lineString from:sCol to:eCol x:x y:(y + fontAscent) |
4049 | 2324 |
] |
2325 |
] ifFalse:[ |
|
4495 | 2326 |
"/ self displayOpaqueString:lineString from:sCol to:eCol x:x y:(y + fontAscent) |
6053 | 2327 |
gc displayString:lineString from:sCol to:eCol x:x y:(y + fontAscent) opaque:false maxWidth:self width |
4049 | 2328 |
]. |
5862 | 2329 |
checkedLinesForWidthOfContentsComputation == 0 ifTrue:[ |
2330 |
self updateWidthOfWidestLineFor:lineString |
|
2331 |
]. |
|
4049 | 2332 |
] |
105 | 2333 |
] |
249
75b8fb924904
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 |
|
6387 | 2335 |
"Modified: / 15-12-1999 / 23:21:43 / cg" |
2336 |
"Modified: / 31-07-2018 / 23:54:51 / Claus Gittinger" |
|
0 | 2337 |
! |
2338 |
||
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
2339 |
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
|
2340 |
"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
|
2341 |
|
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
2342 |
|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
|
2343 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2344 |
(startCol < 1) ifTrue:[ |
5862 | 2345 |
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
|
2346 |
] ifFalse:[ |
5862 | 2347 |
index1 := startCol |
0 | 2348 |
]. |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2349 |
y := self yOfVisibleLine:visLineNr. |
2429
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2427
diff
changeset
|
2350 |
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
|
2351 |
backgroundAlreadyClearedColor == bg ifFalse:[ |
6053 | 2352 |
gc paint:bg. |
2353 |
gc fillRectangleX:x y:y - (lineSpacing // 2) |
|
2354 |
width:(width + viewOrigin x - x) height:fontHeight. |
|
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
2355 |
]. |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2356 |
lineString notNil ifTrue:[ |
5862 | 2357 |
lineString isString ifFalse:[ |
2358 |
self drawLine:lineString inVisible:visLineNr from:startCol to:nil with:fg and:bg. |
|
2359 |
] ifTrue:[ |
|
2360 |
lineWithoutColor := self withoutColorEmphasis:lineString ifFg:fg andBg:bg. |
|
2361 |
index2 := lineWithoutColor size. |
|
2362 |
(index2 < index1) ifTrue:[^ self]. |
|
2363 |
(index1 <= index2) ifTrue:[ |
|
2364 |
self paint:fg on:bg. |
|
2365 |
"/ self displayOpaqueString:lineWithoutColor from:index1 to:index2 x:x y:(y + fontAscent) |
|
6053 | 2366 |
gc displayString:lineWithoutColor from:index1 to:index2 x:x y:(y + fontAscent). |
5862 | 2367 |
|
2368 |
checkedLinesForWidthOfContentsComputation == 0 ifTrue:[ |
|
2369 |
self updateWidthOfWidestLineFor:lineWithoutColor |
|
2370 |
]. |
|
2371 |
] |
|
2372 |
] |
|
0 | 2373 |
] |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2374 |
|
2090
85c0dd8a4281
selection over colored text - again
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
2375 |
"Modified: / 15.12.1999 / 23:24:40 / cg" |
105 | 2376 |
! ! |
2377 |
||
2752 | 2378 |
!ListView methodsFor:'event handling'! |
105 | 2379 |
|
887
9b25df4d193a
Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents:
883
diff
changeset
|
2380 |
contentsChanged |
4634 | 2381 |
"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
|
2382 |
|
9b25df4d193a
Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents:
883
diff
changeset
|
2383 |
|listSize newOrigin| |
9b25df4d193a
Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents:
883
diff
changeset
|
2384 |
|
890
abd28e2f66ca
stefan ! test your changes ;-)
Claus Gittinger <cg@exept.de>
parents:
887
diff
changeset
|
2385 |
shown ifTrue:[ |
6707 | 2386 |
list notNil ifTrue:[ |
2387 |
listSize := self numberOfLines. |
|
2388 |
listSize == 0 ifTrue:[ |
|
2389 |
widthOfWidestLine := 0. |
|
2390 |
]. |
|
2391 |
||
2392 |
" |
|
2393 |
if we are beyond the end, scroll up a bit |
|
2394 |
" |
|
2395 |
((firstLineShown + nFullLinesShown) > listSize) ifTrue:[ |
|
2396 |
newOrigin := listSize - nFullLinesShown + 1. |
|
2397 |
newOrigin < 1 ifTrue:[ |
|
2398 |
newOrigin := 1 |
|
2399 |
]. |
|
2400 |
self scrollToLine: newOrigin. |
|
2401 |
]. |
|
2402 |
]. |
|
887
9b25df4d193a
Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents:
883
diff
changeset
|
2403 |
]. |
9b25df4d193a
Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents:
883
diff
changeset
|
2404 |
|
9b25df4d193a
Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents:
883
diff
changeset
|
2405 |
^ super contentsChanged |
9b25df4d193a
Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents:
883
diff
changeset
|
2406 |
|
9b25df4d193a
Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents:
883
diff
changeset
|
2407 |
"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
|
2408 |
"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
|
2409 |
! |
9b25df4d193a
Recompute origin when one or more lines have been deleted.
Stefan Vogel <sv@exept.de>
parents:
883
diff
changeset
|
2410 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2411 |
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
|
2412 |
"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
|
2413 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2414 |
<resource: #keyboard (#PreviousPage #NextPage #HalfPageUp #HalfPageDown |
5790 | 2415 |
#BeginOfText #EndOfText |
2416 |
#ScrollUp #ScrollDown |
|
5927 | 2417 |
)> |
2731
0f3c02f592d0
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2707
diff
changeset
|
2418 |
|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
|
2419 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2420 |
(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
|
2421 |
(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
|
2422 |
(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
|
2423 |
(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
|
2424 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2425 |
(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
|
2426 |
(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
|
2427 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2428 |
(key == #ScrollUp) ifTrue:[ |
5790 | 2429 |
n := 1 + (self sensor compressKeyPressEventsWithKey:#ScrollUp). |
6342 | 2430 |
^ self scrollUpLines: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
|
2431 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2432 |
(key == #ScrollDown) ifTrue:[ |
5790 | 2433 |
n := 1 + (self sensor compressKeyPressEventsWithKey:#ScrollDown). |
6342 | 2434 |
^ self scrollDownLines: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
|
2435 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2436 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2437 |
super keyPress:key x:x y:y |
6342 | 2438 |
|
2439 |
"Modified: / 13-06-2018 / 22:09:00 / Claus Gittinger" |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2440 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2441 |
|
6252 | 2442 |
keyboardZoom:largerBoolean |
5790 | 2443 |
"CTRL+/- zoom action" |
2444 |
||
6252 | 2445 |
self fontLargerOrSmaller:largerBoolean |
2446 |
! |
|
2447 |
||
2448 |
keyboardZoom:largerBoolean inAllViews:inAllViews |
|
5924 | 2449 |
"CTRL+/- zoom action" |
2450 |
||
2451 |
inAllViews ifTrue:[ |
|
5925 | 2452 |
SimpleView allSubInstancesDo:[:each | |
6252 | 2453 |
each keyboardZoom:largerBoolean |
5924 | 2454 |
]. |
2455 |
] ifFalse:[ |
|
6252 | 2456 |
self keyboardZoom:largerBoolean |
5924 | 2457 |
]. |
5790 | 2458 |
! |
2459 |
||
2273
e40b815ce3e2
stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents:
2258
diff
changeset
|
2460 |
mapped |
e40b815ce3e2
stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents:
2258
diff
changeset
|
2461 |
self stopAutoScroll. |
e40b815ce3e2
stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents:
2258
diff
changeset
|
2462 |
super mapped |
e40b815ce3e2
stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents:
2258
diff
changeset
|
2463 |
! |
e40b815ce3e2
stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents:
2258
diff
changeset
|
2464 |
|
3836 | 2465 |
mouseWheelZoom:amount |
4070
8225a547d6a7
comment/format in: #mouseWheelZoom:
Claus Gittinger <cg@exept.de>
parents:
4049
diff
changeset
|
2466 |
"CTRL-wheel action" |
3836 | 2467 |
|
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
2468 |
|oldSize newSize delta mul font| |
3836 | 2469 |
|
2470 |
amount > 0 ifTrue:[ |
|
4070
8225a547d6a7
comment/format in: #mouseWheelZoom:
Claus Gittinger <cg@exept.de>
parents:
4049
diff
changeset
|
2471 |
"/ delta := 1. mul := 1. |
5790 | 2472 |
delta := 0. mul := 1.05. |
3836 | 2473 |
] ifFalse:[ |
4070
8225a547d6a7
comment/format in: #mouseWheelZoom:
Claus Gittinger <cg@exept.de>
parents:
4049
diff
changeset
|
2474 |
"/ delta := -1. mul := 1. |
5790 | 2475 |
delta := 0. mul := 0.95. |
3836 | 2476 |
]. |
2477 |
||
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
2478 |
font := gc font. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
2479 |
font sizeUnit ~~ #px ifTrue:[ |
4070
8225a547d6a7
comment/format in: #mouseWheelZoom:
Claus Gittinger <cg@exept.de>
parents:
4049
diff
changeset
|
2480 |
oldSize := font size. |
5790 | 2481 |
newSize := (((oldSize + delta)* mul) max:4) min:100. |
4070
8225a547d6a7
comment/format in: #mouseWheelZoom:
Claus Gittinger <cg@exept.de>
parents:
4049
diff
changeset
|
2482 |
newSize ~= oldSize ifTrue:[ |
8225a547d6a7
comment/format in: #mouseWheelZoom:
Claus Gittinger <cg@exept.de>
parents:
4049
diff
changeset
|
2483 |
self font:(font asSize:newSize). |
8225a547d6a7
comment/format in: #mouseWheelZoom:
Claus Gittinger <cg@exept.de>
parents:
4049
diff
changeset
|
2484 |
] |
3836 | 2485 |
]. |
2486 |
! |
|
2487 |
||
0 | 2488 |
redrawX:x y:y width:w height:h |
2489 |
"a region must be redrawn" |
|
2490 |
||
1462 | 2491 |
|startCol endCol line saveClip |
2492 |
startLine "{ Class:SmallInteger }" |
|
2493 |
stopLine "{ Class:SmallInteger }" |
|
2494 |
| |
|
0 | 2495 |
|
127 | 2496 |
shown ifFalse:[^ self]. |
2497 |
||
0 | 2498 |
startLine := self visibleLineOfY:y. |
2499 |
stopLine := self visibleLineOfY:(y + h). |
|
2500 |
||
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
2501 |
saveClip := gc clippingBoundsOrNil. |
6032 | 2502 |
self clippingBounds:(Rectangle left:x top:y width:w height:h). |
6053 | 2503 |
gc paint:bgColor. |
2504 |
gc fillRectangleX:x y:y width:w height:h. |
|
1462 | 2505 |
backgroundAlreadyClearedColor := bgColor. |
2506 |
||
2507 |
(includesNonStrings or:[w > (width // 4 * 3)]) ifTrue:[ |
|
6032 | 2508 |
"includes non strings or area is big enough: redraw whole lines" |
2509 |
self redrawFromVisibleLine:startLine to:stopLine |
|
0 | 2510 |
] ifFalse:[ |
6032 | 2511 |
line := self visibleAt:startLine. |
2512 |
||
2513 |
(fontIsFixedWidth and:[line isSingleByteString]) ifFalse:[ |
|
2514 |
"start/end col has to be computed for each line" |
|
2515 |
||
2516 |
startLine to:stopLine do:[:i | |
|
2517 |
startCol := self colOfX:x inVisibleLine:i. |
|
2518 |
endCol := self colOfX:(x + w) inVisibleLine:i. |
|
2519 |
startCol > 0 ifTrue:[ |
|
2520 |
endCol > 0 ifTrue:[ |
|
2521 |
self redrawVisibleLine:i from:startCol to:endCol |
|
2522 |
] |
|
2523 |
] |
|
2524 |
] |
|
2525 |
] ifTrue:[ |
|
2526 |
"start/end col is the same for all lines" |
|
2527 |
startCol := self colOfX:x inVisibleLine:startLine. |
|
2528 |
endCol := self colOfX:(x + w) inVisibleLine:startLine. |
|
2529 |
startCol > 0 ifTrue:[ |
|
2530 |
endCol > 0 ifTrue:[ |
|
2531 |
startLine to:stopLine do:[:i | |
|
2532 |
line := self visibleAt:i. |
|
2533 |
(line isSingleByteString) ifTrue:[ |
|
2534 |
self redrawVisibleLine:i from:startCol to:endCol |
|
2535 |
] ifFalse:[ |
|
2536 |
self redrawVisibleLine:i |
|
2537 |
] |
|
2538 |
] |
|
2539 |
] |
|
2540 |
] |
|
2541 |
] |
|
1462 | 2542 |
]. |
2543 |
backgroundAlreadyClearedColor := nil. |
|
6032 | 2544 |
self clippingBounds:saveClip. |
0 | 2545 |
! |
2546 |
||
105 | 2547 |
sizeChanged:how |
2548 |
"size changed - move origin up if possible" |
|
2549 |
||
2550 |
super sizeChanged:how. |
|
721
4a01084cf643
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
716
diff
changeset
|
2551 |
|
105 | 2552 |
self computeNumberOfLinesShown. |
2553 |
||
2554 |
innerWidth := width - textStartLeft - margin. |
|
1972 | 2555 |
|
2577 | 2556 |
"/ Makes trouble when fighting with SelListViews sizeChanged-positioning ... |
1972 | 2557 |
"/ |
2558 |
"/ shown ifFalse:[^ self]. |
|
2559 |
"/ list isNil ifTrue:[^ self]. |
|
2560 |
"/ |
|
2561 |
"/ listSize := self numberOfLines. |
|
2562 |
"/ " |
|
2563 |
"/ if we are beyond the end, scroll up a bit |
|
2564 |
"/ " |
|
2565 |
"/ ((firstLineShown + nFullLinesShown) >= listSize) ifTrue:[ |
|
2566 |
"/ self scrollToBottom. |
|
2567 |
"/ ^ self |
|
1429
b7b7f3477594
do not invalidate, when the size changes;
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
2568 |
"/ ]. |
643 | 2569 |
|
1429
b7b7f3477594
do not invalidate, when the size changes;
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
2570 |
"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
|
2571 |
"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
|
2572 |
! |
e40b815ce3e2
stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents:
2258
diff
changeset
|
2573 |
|
e40b815ce3e2
stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents:
2258
diff
changeset
|
2574 |
unmap |
e40b815ce3e2
stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents:
2258
diff
changeset
|
2575 |
self stopAutoScroll. |
e40b815ce3e2
stop autoscroll if no longer visible
Claus Gittinger <cg@exept.de>
parents:
2258
diff
changeset
|
2576 |
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
|
2577 |
! ! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2578 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2579 |
!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
|
2580 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2581 |
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
|
2582 |
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
|
2583 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2584 |
"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
|
2585 |
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
|
2586 |
self computeNumberOfLinesShown. |
1990 | 2587 |
fgColor := fgColor onDevice:device. |
2588 |
bgColor := bgColor onDevice:device |
|
105 | 2589 |
! |
2590 |
||
249
75b8fb924904
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 |
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
|
2592 |
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
|
2593 |
^ 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
|
2594 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2595 |
|
940 | 2596 |
fetchDeviceResources |
2597 |
"fetch device colors, to avoid reallocation at redraw time" |
|
2598 |
||
2599 |
super fetchDeviceResources. |
|
2600 |
||
1990 | 2601 |
fgColor notNil ifTrue:[fgColor := fgColor onDevice:device]. |
2602 |
bgColor notNil ifTrue:[bgColor := bgColor onDevice:device]. |
|
940 | 2603 |
|
2604 |
"Created: 14.1.1997 / 00:12:12 / cg" |
|
2605 |
! |
|
2606 |
||
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2607 |
initStyle |
967 | 2608 |
"setup viewStyle specifics" |
2609 |
||
1693
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2610 |
|n| |
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2611 |
|
249
75b8fb924904
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 |
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
|
2613 |
|
1693
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2614 |
n := DefaultTopMargin. |
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2615 |
n isInteger ifFalse:[ |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
2616 |
n := (self verticalPixelPerMillimeter:n) rounded. |
1693
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2617 |
]. |
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2618 |
self topMargin:n. |
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2619 |
|
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2620 |
n := DefaultLeftMargin. |
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2621 |
n isInteger ifFalse:[ |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
2622 |
n := (self verticalPixelPerMillimeter:n) rounded. |
1693
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2623 |
]. |
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2624 |
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
|
2625 |
|
4573 | 2626 |
lineSpacing := 2. |
4577 | 2627 |
"/ q&d temporary hack. |
2628 |
"/ X11 fonts are currently so ugly... add more spacing. |
|
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
2629 |
device isX11Platform ifTrue:[ |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
2630 |
lineSpacing := lineSpacing + 3. |
4577 | 2631 |
]. |
940 | 2632 |
fgColor := DefaultForegroundColor. |
2633 |
bgColor := DefaultBackgroundColor. |
|
4322 | 2634 |
|
2635 |
"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
|
2636 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2637 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2638 |
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
|
2639 |
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
|
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 |
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
|
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 |
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
|
2644 |
|
75b8fb924904
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 |
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
|
2646 |
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
|
2647 |
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
|
2648 |
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
|
2649 |
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
|
2650 |
partialLines := true. |
5683 | 2651 |
tabPositions := UserDefaultTabPositions ? self class defaultTabPositions. |
864 | 2652 |
includesNonStrings := false. |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
2653 |
lineEndCRLF := false. |
4751 | 2654 |
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
|
2655 |
self getFontParameters. |
3312 | 2656 |
self initializeWordCheckAction. |
4747 | 2657 |
|
3312 | 2658 |
scrollWhenUpdating := #keep. "/ #beginOfText. |
4747 | 2659 |
expandTabsWhenUpdating := true. |
2660 |
compareModelOnUpdate := true. |
|
2661 |
checkLineEndConventionWhenUpdating := true. |
|
2662 |
scrollLocked := false. |
|
3312 | 2663 |
autoScroll := true. |
2664 |
||
2665 |
"Modified: / 03-07-2006 / 17:03:59 / cg" |
|
2666 |
! |
|
2667 |
||
3564 | 2668 |
initializeWordCheckAction |
4403 | 2669 |
"the wordCheck is a predicate block which returns true if the given character |
2670 |
belongs to the (textual) word. Used with double click to select a word. |
|
2671 |
When editing code, typically characters which are part of an identifier |
|
2672 |
are part of a word (underline, dollar, but no other non-letters). |
|
2673 |
The standardWordCheck aks the current userPreferences for details." |
|
2674 |
||
3564 | 2675 |
wordCheck := [:char | self standardWordCheck:char]. |
2676 |
||
2677 |
"Created: / 03-07-2006 / 17:03:50 / cg" |
|
2678 |
! |
|
2679 |
||
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2680 |
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
|
2681 |
|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
|
2682 |
|
2305
f2850e54b0ab
only access originChanged, extentChanged and cornerChanged
Claus Gittinger <cg@exept.de>
parents:
2273
diff
changeset
|
2683 |
self extentChangedFlag ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2684 |
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
|
2685 |
]. |
691
906e4d67b9cf
fixed makeLineVisible; when not-yet realized
Claus Gittinger <cg@exept.de>
parents:
688
diff
changeset
|
2686 |
|
249
75b8fb924904
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 |
firstLineShown ~~ 1 ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2688 |
sz := self size. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2689 |
firstLineShown + nLinesShown > sz ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2690 |
self scrollToLine:sz - nLinesShown. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2691 |
] |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2692 |
]. |
691
906e4d67b9cf
fixed makeLineVisible; when not-yet realized
Claus Gittinger <cg@exept.de>
parents:
688
diff
changeset
|
2693 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2694 |
super realize. |
837 | 2695 |
|
1081
0d3f4ad6e7e5
now fetch models value when model is assigned;
Claus Gittinger <cg@exept.de>
parents:
1027
diff
changeset
|
2696 |
"/ old: fetch models value on realize; |
0d3f4ad6e7e5
now fetch models value when model is assigned;
Claus Gittinger <cg@exept.de>
parents:
1027
diff
changeset
|
2697 |
"/ 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
|
2698 |
"/ |
0d3f4ad6e7e5
now fetch models value when model is assigned;
Claus Gittinger <cg@exept.de>
parents:
1027
diff
changeset
|
2699 |
"/ model notNil ifTrue:[ |
0d3f4ad6e7e5
now fetch models value when model is assigned;
Claus Gittinger <cg@exept.de>
parents:
1027
diff
changeset
|
2700 |
"/ self getListFromModel. |
0d3f4ad6e7e5
now fetch models value when model is assigned;
Claus Gittinger <cg@exept.de>
parents:
1027
diff
changeset
|
2701 |
"/ ] |
691
906e4d67b9cf
fixed makeLineVisible; when not-yet realized
Claus Gittinger <cg@exept.de>
parents:
688
diff
changeset
|
2702 |
|
825
d115a0923b7d
Send #getListFromModel when setting #model:
Stefan Vogel <sv@exept.de>
parents:
820
diff
changeset
|
2703 |
"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
|
2704 |
"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
|
2705 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2706 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2707 |
recreate |
2258 | 2708 |
"recreate after a snapin or a migration" |
1693
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2709 |
|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
|
2710 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2711 |
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
|
2712 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2713 |
" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2714 |
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
|
2715 |
- 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
|
2716 |
" |
1693
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2717 |
"/ topMargin := (self verticalPixelPerMillimeter:0.5) rounded. |
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2718 |
"/ self leftMargin:(self horizontalPixelPerMillimeter:0.5) rounded. |
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2719 |
|
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2720 |
n := DefaultTopMargin. |
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2721 |
n isInteger ifFalse:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2722 |
n := (self verticalPixelPerMillimeter:n) rounded. |
1693
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2723 |
]. |
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2724 |
self topMargin:n. |
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2725 |
|
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2726 |
n := DefaultLeftMargin. |
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2727 |
n isInteger ifFalse:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2728 |
n := (self verticalPixelPerMillimeter:n) rounded. |
1693
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2729 |
]. |
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2730 |
self leftMargin:n. |
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2731 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2732 |
self getFontParameters |
1693
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2733 |
|
e76979454c2f
more flexible top/leftMargin handling
Claus Gittinger <cg@exept.de>
parents:
1656
diff
changeset
|
2734 |
"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
|
2735 |
! ! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2736 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2737 |
!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
|
2738 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2739 |
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
|
2740 |
"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
|
2741 |
|
2976 | 2742 |
<resource:#obsolete> |
2423
8b9c2946a5a7
absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
2412
diff
changeset
|
2743 |
self obsoleteMethodWarning:'use #listLineToVisibleLine:'. |
8b9c2946a5a7
absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
2412
diff
changeset
|
2744 |
^ self listLineToVisibleLine:absLineNr |
8b9c2946a5a7
absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
2412
diff
changeset
|
2745 |
|
8b9c2946a5a7
absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
2412
diff
changeset
|
2746 |
"/ absLineNr isNil ifTrue:[^ nil]. |
8b9c2946a5a7
absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
2412
diff
changeset
|
2747 |
"/ (absLineNr < firstLineShown) ifTrue:[^ nil]. |
8b9c2946a5a7
absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
2412
diff
changeset
|
2748 |
"/ (absLineNr >= (firstLineShown + nLinesShown)) ifTrue:[^ nil]. |
8b9c2946a5a7
absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
2412
diff
changeset
|
2749 |
"/ ^ absLineNr - firstLineShown + 1 |
8b9c2946a5a7
absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
2412
diff
changeset
|
2750 |
"/ |
249
75b8fb924904
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 |
|
75b8fb924904
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 |
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
|
2754 |
"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
|
2755 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2756 |
list isNil ifTrue: [ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2757 |
list := StringCollection new:lineNr. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2758 |
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
|
2759 |
] ifFalse: [ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2760 |
lineNr > (list size) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2761 |
self grow:lineNr. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2762 |
self contentsChanged |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2763 |
] |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2764 |
] |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2765 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2766 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2767 |
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
|
2768 |
"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
|
2769 |
|
6554 | 2770 |
|lineString linePixelWidth xAbs runCol posLeft posRight done |
2771 |
hasEmphasis oPosRight oPosLeft font| |
|
2772 |
||
2773 |
xAbs := x - textStartLeft + viewOrigin x. |
|
2774 |
(xAbs <= 0) ifTrue:[^ 1]. |
|
650
563ea7f99aa8
handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents:
643
diff
changeset
|
2775 |
|
1656
1202fbc95970
some fixes forvariable fonts on win32
Claus Gittinger <cg@exept.de>
parents:
1637
diff
changeset
|
2776 |
lineString := self visibleAt:visLineNr. |
1202fbc95970
some fixes forvariable fonts on win32
Claus Gittinger <cg@exept.de>
parents:
1637
diff
changeset
|
2777 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2778 |
" |
75b8fb924904
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 |
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
|
2780 |
" |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2781 |
(fontIsFixedWidth |
5928 | 2782 |
and:[lineString isNil or:[lineString hasChangeOfEmphasis not]]) ifTrue:[ |
6554 | 2783 |
^ (xAbs // 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
|
2784 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2785 |
|
6554 | 2786 |
font := gc font. |
2787 |
||
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2788 |
" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2789 |
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
|
2790 |
" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2791 |
lineString notNil ifTrue:[ |
5793 | 2792 |
lineString := self visibleStringFrom:lineString. |
2793 |
(hasEmphasis := lineString hasChangeOfEmphasis) ifTrue:[ |
|
2794 |
linePixelWidth := lineString widthOn:self |
|
2795 |
] ifFalse:[ |
|
2796 |
lineString := lineString string. |
|
6554 | 2797 |
linePixelWidth := font widthOf:lineString. |
5793 | 2798 |
] |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2799 |
] ifFalse:[ |
5793 | 2800 |
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
|
2801 |
]. |
650
563ea7f99aa8
handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents:
643
diff
changeset
|
2802 |
|
6554 | 2803 |
(linePixelWidth <= xAbs) ifTrue:[ |
5793 | 2804 |
fontWidth == 0 ifTrue:[ |
2805 |
" |
|
2806 |
although this 'cannot happen', |
|
2807 |
it seems that X reports this width for some strange fonts ... |
|
2808 |
" |
|
2809 |
^ lineString size |
|
2810 |
]. |
|
6554 | 2811 |
^ lineString size + ((xAbs - 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
|
2812 |
]. |
650
563ea7f99aa8
handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents:
643
diff
changeset
|
2813 |
|
563ea7f99aa8
handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents:
643
diff
changeset
|
2814 |
"/ cannot simply count individual characters, |
563ea7f99aa8
handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents:
643
diff
changeset
|
2815 |
"/ since kerning or other non-linear effects may be involved ... |
4245
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2816 |
"/ use a binary search, initialized with some guess. |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2817 |
|
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2818 |
"/ a guess: take some 'average' character's width and compute an initial guess |
6554 | 2819 |
runCol := x // (font widthOf:'e'). |
4247 | 2820 |
runCol := runCol min:lineString size. |
4245
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2821 |
|
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2822 |
"/ runCol := lineString size // 2. |
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2823 |
"/ (runCol == 0) ifTrue:[runCol := 1]. |
650
563ea7f99aa8
handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents:
643
diff
changeset
|
2824 |
|
563ea7f99aa8
handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents:
643
diff
changeset
|
2825 |
hasEmphasis ifTrue:[ |
5793 | 2826 |
posLeft := (lineString copyFrom:1 to:(runCol - 1)) widthOn:self. |
2827 |
posRight := (lineString copyFrom:1 to:runCol) widthOn:self. |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2828 |
] ifFalse:[ |
6554 | 2829 |
posLeft := font widthOf:lineString from:1 to:(runCol - 1). |
2830 |
posRight := font widthOf:lineString from:1 to:runCol. |
|
650
563ea7f99aa8
handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents:
643
diff
changeset
|
2831 |
]. |
563ea7f99aa8
handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents:
643
diff
changeset
|
2832 |
|
6554 | 2833 |
done := (posLeft <= xAbs) and:[posRight > xAbs]. |
650
563ea7f99aa8
handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents:
643
diff
changeset
|
2834 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2835 |
[done] whileFalse:[ |
5793 | 2836 |
oPosRight := posRight. |
2837 |
oPosLeft := posLeft. |
|
2838 |
||
6554 | 2839 |
(posRight <= xAbs) ifTrue:[ |
5793 | 2840 |
runCol := runCol + 1. |
2841 |
posLeft := posRight. |
|
2842 |
hasEmphasis ifTrue:[ |
|
2843 |
posRight := (lineString copyFrom:1 to:runCol) widthOn:self. |
|
2844 |
] ifFalse:[ |
|
6554 | 2845 |
posRight := font widthOf:lineString from:1 to:runCol |
5793 | 2846 |
] |
2847 |
] ifFalse:[ |
|
6554 | 2848 |
(posLeft > xAbs) ifTrue:[ |
5793 | 2849 |
runCol := runCol - 1. |
2850 |
(runCol == 0) ifTrue:[^ 0]. |
|
2851 |
posRight := posLeft. |
|
2852 |
hasEmphasis ifTrue:[ |
|
2853 |
posLeft := (lineString copyFrom:1 to:(runCol - 1)) widthOn:self. |
|
2854 |
] ifFalse:[ |
|
6554 | 2855 |
posLeft := font widthOf:lineString from:1 to:(runCol - 1) |
5793 | 2856 |
] |
2857 |
] |
|
2858 |
]. |
|
6554 | 2859 |
done := (posLeft <= xAbs) and:[posRight > xAbs]. |
1775 | 2860 |
"234567890123456789012345678901234567890" |
5793 | 2861 |
((oPosRight == posRight) and:[oPosLeft == posLeft]) ifTrue:[ |
2862 |
"/ paranoia: just in case there are unprintable characters |
|
2863 |
"/ (avoid endless loop if the binary search does not make progress) |
|
2864 |
done := true. |
|
2865 |
] |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2866 |
]. |
1777 | 2867 |
"/self paint:Color red. |
2429
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2427
diff
changeset
|
2868 |
"/self displayRectangleX:posLeft+textStartLeft-viewOrigin x y:(self yOfVisibleLine:visLineNr) |
1777 | 2869 |
"/ width:(posRight-posLeft) height:fontHeight. |
5793 | 2870 |
"/self paint:self blackColor. |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2871 |
^ runCol |
650
563ea7f99aa8
handle emphasized text in #colOfX...
Claus Gittinger <cg@exept.de>
parents:
643
diff
changeset
|
2872 |
|
4245
4c62eadf9898
changed: #colOfX:inVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
4203
diff
changeset
|
2873 |
"Modified: / 25-04-2011 / 11:26:58 / cg" |
4247 | 2874 |
"Modified: / 02-05-2011 / 14:08:54 / sr" |
6554 | 2875 |
"Modified: / 01-03-2019 / 22:01:30 / Claus Gittinger" |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2876 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2877 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2878 |
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
|
2879 |
"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
|
2880 |
|
716
366fca254239
fixed number-of-lines computation
Claus Gittinger <cg@exept.de>
parents:
691
diff
changeset
|
2881 |
|innerHeight| |
366fca254239
fixed number-of-lines computation
Claus Gittinger <cg@exept.de>
parents:
691
diff
changeset
|
2882 |
|
366fca254239
fixed number-of-lines computation
Claus Gittinger <cg@exept.de>
parents:
691
diff
changeset
|
2883 |
innerHeight := self innerHeight. |
366fca254239
fixed number-of-lines computation
Claus Gittinger <cg@exept.de>
parents:
691
diff
changeset
|
2884 |
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
|
2885 |
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
|
2886 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2887 |
partialLines ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2888 |
((nLinesShown * fontHeight) < innerHeight) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2889 |
nLinesShown := nLinesShown + 1 |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2890 |
] |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2891 |
] |
716
366fca254239
fixed number-of-lines computation
Claus Gittinger <cg@exept.de>
parents:
691
diff
changeset
|
2892 |
|
366fca254239
fixed number-of-lines computation
Claus Gittinger <cg@exept.de>
parents:
691
diff
changeset
|
2893 |
"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
|
2894 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2895 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2896 |
convertRTF:aList |
3844 | 2897 |
<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
|
2898 |
"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
|
2899 |
- 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
|
2900 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2901 |
|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
|
2902 |
|
652 | 2903 |
self obsoleteMethodWarning. |
2904 |
||
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2905 |
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
|
2906 |
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
|
2907 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2908 |
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
|
2909 |
aList do:[:line | |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2910 |
((line size == 0) or:[line isBlank]) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2911 |
newList add:newLine. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2912 |
newLine := '' |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2913 |
] ifFalse:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2914 |
special := ((line at:1) == ${) or:[(line includes:$\)]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2915 |
special := special or:[(line at:1) == $}]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2916 |
special ifFalse:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2917 |
newList add:(newLine , line) |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2918 |
] ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2919 |
charIndex := 1. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2920 |
[charIndex <= line size] whileTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2921 |
char := line at:charIndex. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2922 |
((char == ${ ) or:[char == $} ]) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2923 |
"left-brace: ignore rest of line" |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2924 |
charIndex := line size + 1 |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2925 |
] ifFalse:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2926 |
(char == $\) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2927 |
inEscape := true |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2928 |
] ifFalse:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2929 |
inEscape ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2930 |
(char == Character space) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2931 |
inEscape := false |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2932 |
] |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2933 |
] ifFalse:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2934 |
newLine := newLine copyWith:char |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2935 |
] |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2936 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2937 |
charIndex := charIndex + 1 |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2938 |
] |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2939 |
] |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2940 |
] |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
2941 |
] |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2942 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2943 |
^ newList |
652 | 2944 |
|
2945 |
"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
|
2946 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
2947 |
|
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
2948 |
enqueueDelayedContentsChangedNotification |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
2949 |
"because contentschanged may be slow (recomputing width of widest line), |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
2950 |
we delay its execution by pushing it onto the event queue. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
2951 |
This has the effect of allowing for multiple add-lines before recomputing. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
2952 |
Much speeding up inserting into long lists" |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
2953 |
|
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
2954 |
|sensor| |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
2955 |
|
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
2956 |
sensor := self sensor. |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
2957 |
(sensor hasUserEvent:#contentsChanged for:self) ifFalse:[ |
6158 | 2958 |
sensor pushUserEvent:#contentsChanged for:self |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
2959 |
]. |
6158 | 2960 |
"/ used to be synchronous: |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
2961 |
"/ self contentsChanged. "recompute scrollbars" |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
2962 |
|
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
2963 |
"Created: / 25-07-2012 / 11:59:58 / cg" |
6158 | 2964 |
"Modified (comment): / 22-05-2017 / 12:07:37 / mawalch" |
4435
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
diff
changeset
|
2965 |
! |
3cacb6eddf23
added: #enqueueDelayedContentsChangedNotification
Claus Gittinger <cg@exept.de>
parents:
4422
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 |
getFontParameters |
668
729295eb37fc
use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents:
663
diff
changeset
|
2968 |
"get some info of the used font. They are cached since we use them often .. |
5721 | 2969 |
The code below uses the font's average height parameters - these |
668
729295eb37fc
use fonts averageHeight for line-grid; redefine in TextView to use maxHeight
Claus Gittinger <cg@exept.de>
parents:
663
diff
changeset
|
2970 |
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
|
2971 |
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
|
2972 |
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
|
2973 |
|
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
2974 |
|hMax newDeviceFont| |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
2975 |
|
5818 | 2976 |
newDeviceFont := gc deviceFont. |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
2977 |
hMax := newDeviceFont height. |
1451
3598c65cd89d
search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents:
1450
diff
changeset
|
2978 |
|
634
1ca770b2c494
handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
2979 |
includesNonStrings == true ifTrue:[ |
5818 | 2980 |
"/ |
2981 |
"/ find maximum height of lines |
|
2982 |
"/ |
|
2983 |
hMax := list inject:hMax into:[:maxSoFar :thisLine | |
|
2984 |
thisLine isNil ifTrue:[ |
|
2985 |
maxSoFar |
|
2986 |
] ifFalse:[ |
|
2987 |
(thisLine isSingleByteString) ifTrue:[ |
|
2988 |
maxSoFar |
|
2989 |
] ifFalse:[ |
|
2990 |
maxSoFar max:(thisLine heightOn:self) |
|
2991 |
] |
|
2992 |
] |
|
2993 |
]. |
|
1451
3598c65cd89d
search max height, if non-strings are present
Claus Gittinger <cg@exept.de>
parents:
1450
diff
changeset
|
2994 |
|
634
1ca770b2c494
handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
2995 |
]. |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
2996 |
fontHeight := newDeviceFont maxHeight. |
4573 | 2997 |
"/ fontHeight := font height. |
2998 |
fontHeight := fontHeight max:(hMax + lineSpacing). |
|
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
2999 |
fontAscent := newDeviceFont ascent. "/ maxAscent. -- see SelectionInListViews selection in motif style |
4573 | 3000 |
"/ fontAscent := font maxAscent "ascent". "/ maxAscent. -- see SelectionInListViews selection in motif style |
3001 |
"/ fontAscent := (font maxAscent + font ascent) // 2. "/ maxAscent. -- see SelectionInListViews selection in motif style |
|
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
3002 |
fontWidth := newDeviceFont width. |
5928 | 3003 |
fontWidth == 0 ifTrue:[ |
3004 |
"/ should not happen, but some bad fonts seem to have it |
|
3005 |
('ListView [info]: font says, it has zero width: ', newDeviceFont printString) infoPrintCR. |
|
3006 |
fontWidth := 1. |
|
3007 |
]. |
|
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
3008 |
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
|
3009 |
|
1260
5a548d4c6724
handle nil entry in #getFontParameters
Claus Gittinger <cg@exept.de>
parents:
1259
diff
changeset
|
3010 |
"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
|
3011 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3012 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3013 |
getListFromModel |
587
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3014 |
"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
|
3015 |
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
|
3016 |
|
5031 | 3017 |
|newText msg doCompareIfUnchanged| |
587
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3018 |
|
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3019 |
model notNil ifTrue:[ |
5884 | 3020 |
msg := listMsg ? aspectMsg. |
3021 |
||
3022 |
msg notNil ifTrue:[ |
|
3023 |
doCompareIfUnchanged := compareModelOnUpdate. |
|
3024 |
||
3025 |
newText := model perform:msg. |
|
3026 |
"/ cg: this makes many optimizations (virtualArray) useless; |
|
3027 |
"/ I do not think that this is a good idea: |
|
3028 |
"/ text notNil ifTrue:[ |
|
3029 |
"/ so I changed it to: |
|
3030 |
(newText notNil and:[newText isString]) ifTrue:[ |
|
3031 |
newText := newText asStringCollection. |
|
3032 |
] ifFalse:[ |
|
3033 |
newText == model ifTrue:[ |
|
3034 |
self isReadOnly ifTrue:[ |
|
3035 |
newText := model. |
|
3036 |
self list:newText expandTabs:expandTabsWhenUpdating scanForNonStrings:expandTabsWhenUpdating. |
|
3037 |
^ self. |
|
3038 |
] . |
|
3039 |
"/ I must operate on a copy |
|
3040 |
newText := model asNewOrderedCollection. |
|
3041 |
"/ doCompareIfUnchanged := false. |
|
3042 |
]. |
|
3043 |
]. |
|
3044 |
||
3045 |
doCompareIfUnchanged ifTrue:[ |
|
3046 |
"/ see if there is a change at all. |
|
3047 |
"/ use to compare using =, but that's not enough in case of emphasis change. |
|
3048 |
newText size == list size ifTrue:[ |
|
3049 |
|same| |
|
3050 |
||
3051 |
same := true. |
|
3052 |
newText size > 0 ifTrue:[ |
|
3053 |
newText ~~ list ifTrue:[ |
|
3054 |
newText with:list do:[:eachNewLine :eachOldLine | |
|
3055 |
(eachNewLine == eachOldLine) ifFalse:[ |
|
3056 |
same := false. |
|
3057 |
] |
|
3058 |
] |
|
3059 |
]. |
|
3060 |
]. |
|
3061 |
same ifTrue:[^ self]. |
|
3062 |
]. |
|
3063 |
]. |
|
3064 |
||
3065 |
"/ SV: this compare does not work, if model uses (i.e. updates) |
|
3066 |
"/ the same stringCollection as the view!! |
|
3067 |
true "text ~= list" ifTrue:[ |
|
3068 |
"/ changed #list to care for scrollLocked |
|
4747 | 3069 |
"/ scrollLocked ifTrue:[ |
3070 |
"/ self setList:newText expandTabs:expandTabsWhenUpdating |
|
3071 |
"/ ] ifFalse:[ |
|
5884 | 3072 |
self list:newText expandTabs:expandTabsWhenUpdating scanForNonStrings:expandTabsWhenUpdating |
4747 | 3073 |
"/ ] |
5884 | 3074 |
]. |
3075 |
]. |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3076 |
]. |
587
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3077 |
|
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3078 |
"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
|
3079 |
"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
|
3080 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3081 |
|
1099
eccab3759ddb
in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents:
1081
diff
changeset
|
3082 |
getListFromModelScroll:aBoolean |
eccab3759ddb
in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents:
1081
diff
changeset
|
3083 |
"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
|
3084 |
If there is no listMessage, try aspect for backward compatibility. |
4747 | 3085 |
If aBoolean is false, scrolling is suppressed here" |
3249
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
3086 |
|
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
3087 |
|prev| |
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
3088 |
|
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
3089 |
prev := scrollLocked. |
4747 | 3090 |
scrollLocked := aBoolean not. |
3249
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
3091 |
[ |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
3092 |
self getListFromModel |
3249
a4beb76b3f59
code formatting is now undoable
Claus Gittinger <cg@exept.de>
parents:
3198
diff
changeset
|
3093 |
] ensure:[ |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
3094 |
scrollLocked := prev. |
1099
eccab3759ddb
in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents:
1081
diff
changeset
|
3095 |
]. |
eccab3759ddb
in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents:
1081
diff
changeset
|
3096 |
! |
eccab3759ddb
in setList: - only redraw lines if required.
Claus Gittinger <cg@exept.de>
parents:
1081
diff
changeset
|
3097 |
|
5372 | 3098 |
highlightLineSpacing |
3099 |
"true if the spacing between lines is to be drawn with selected color, |
|
3100 |
false if it remains white. |
|
3101 |
false for selection in list views; true for edit/text views" |
|
3102 |
||
3103 |
^ true |
|
3104 |
! |
|
3105 |
||
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3106 |
line:line withoutEmphasis:emphasisToRemove |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3107 |
(line notNil |
2558
4c10bec1117d
more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents:
2557
diff
changeset
|
3108 |
and:[line isString]) ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3109 |
^ line withoutEmphasis:emphasisToRemove. |
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
3110 |
]. |
2558
4c10bec1117d
more selection fixes (with non-string/non-text lines)
Michael Beyl <mb@exept.de>
parents:
2557
diff
changeset
|
3111 |
^ line |
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
3112 |
! |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
3113 |
|
249
75b8fb924904
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 |
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
|
3115 |
"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
|
3116 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3117 |
|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
|
3118 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3119 |
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
|
3120 |
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
|
3121 |
(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
|
3122 |
^ 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
|
3123 |
! |
75b8fb924904
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 |
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
|
3126 |
"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
|
3127 |
|
4638 | 3128 |
|line lineLen nCols| |
3129 |
||
3130 |
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
|
3131 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3132 |
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
|
3133 |
lineLen := line size. |
4638 | 3134 |
|
3135 |
(line isNil or:[startCol > lineLen]) ifTrue:[ |
|
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
3136 |
(nCols > 0) ifTrue:[ |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
3137 |
^ (String new:nCols) |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
3138 |
]. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
3139 |
^ nil |
4638 | 3140 |
]. |
3141 |
||
3142 |
(endCol > lineLen) ifTrue:[ |
|
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
3143 |
^ (line copyFrom:startCol to:lineLen) , (String new:(endCol-lineLen)) |
4638 | 3144 |
]. |
3145 |
^ 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
|
3146 |
! |
75b8fb924904
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 |
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
|
3149 |
"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
|
3150 |
|
4639 | 3151 |
|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
|
3152 |
|
75b8fb924904
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 |
line := self listAt:lineNr. |
4638 | 3154 |
line isNil ifTrue:[ |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
3155 |
(endCol > 0) ifTrue:[ |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
3156 |
^ (String new:endCol) |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
3157 |
]. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
3158 |
^ nil |
4638 | 3159 |
]. |
3160 |
||
3161 |
lineSize := line size. |
|
4639 | 3162 |
|
3163 |
(endCol > lineSize) ifTrue:[ |
|
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
3164 |
^ (line copyTo:lineSize) , (String new:(endCol - lineSize)). |
4638 | 3165 |
]. |
4639 | 3166 |
^ 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
|
3167 |
! |
75b8fb924904
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 |
|
1608
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
3169 |
listLineIsVisible:listLineNr |
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
3170 |
"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
|
3171 |
|
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
3172 |
|visibleLineNr "{ Class: SmallInteger }"| |
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
3173 |
|
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
3174 |
shown ifFalse:[^ false]. |
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
3175 |
listLineNr isNil ifTrue:[^ false]. |
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
3176 |
visibleLineNr := listLineNr + 1 - firstLineShown. |
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
3177 |
^ (visibleLineNr between:1 and:nLinesShown) |
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
3178 |
|
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
3179 |
"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
|
3180 |
! |
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
3181 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3182 |
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
|
3183 |
"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
|
3184 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3185 |
|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
|
3186 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3187 |
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
|
3188 |
listLineNr isNil ifTrue:[^ nil]. |
2423
8b9c2946a5a7
absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
2412
diff
changeset
|
3189 |
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
|
3190 |
(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
|
3191 |
^ 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
|
3192 |
! |
75b8fb924904
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 |
|
2224
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
3194 |
recomputeWidthOfWidestLineFor:aString |
4751 | 3195 |
<resource: #obsolete> |
3196 |
self recomputeWidthOfWidestLineFor:aString old:nil |
|
3197 |
! |
|
3198 |
||
3199 |
recomputeWidthOfWidestLineFor:newEntry old:oldEntry |
|
3200 |
"a new line was added (oldEntry == nil) or replaced oldEntry. |
|
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
3201 |
Update the widthOfWidestLine cache or flush it, if we cannot easily |
4751 | 3202 |
figure out the overall text width" |
3203 |
||
3204 |
|newW oldW| |
|
2224
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
3205 |
|
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
3206 |
widthOfWidestLine notNil ifTrue:[ |
6293 | 3207 |
newEntry isNil ifTrue:[ |
3208 |
newW := 0 |
|
3209 |
] ifFalse:[ |
|
3210 |
(newEntry isSingleByteString) ifTrue:[ |
|
3211 |
newW := gc font widthOf:newEntry |
|
3212 |
] ifFalse:[ |
|
3213 |
newW := newEntry widthOn:self |
|
3214 |
]. |
|
3215 |
]. |
|
3216 |
||
3217 |
newW >= widthOfWidestLine ifTrue:[ |
|
3218 |
widthOfWidestLine := newW. |
|
3219 |
] ifFalse:[ |
|
3220 |
oldEntry isNil ifTrue:[ |
|
3221 |
oldW := 0 |
|
3222 |
] ifFalse:[ |
|
3223 |
(oldEntry isSingleByteString) ifTrue:[ |
|
3224 |
oldW := gc font widthOf:oldEntry |
|
3225 |
] ifFalse:[ |
|
3226 |
oldW := oldEntry widthOn:self |
|
3227 |
]. |
|
3228 |
]. |
|
3229 |
newW > oldW ifTrue:[ |
|
3230 |
"/ no change; new entries width is between this width and amx width |
|
3231 |
] ifFalse:[ |
|
3232 |
"/ new entry is smaller than oldEntry; if the oldEntry was the previous max, |
|
3233 |
"/ we don't know the new max |
|
3234 |
oldW = widthOfWidestLine ifTrue:[ |
|
3235 |
widthOfWidestLine := nil "/ means: unknown |
|
3236 |
] ifFalse:[ |
|
3237 |
"/ old line was not the widest, and new line is shorter; |
|
3238 |
"/ no change |
|
3239 |
] |
|
3240 |
] |
|
3241 |
]. |
|
2224
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
3242 |
]. |
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
3243 |
^ widthOfWidestLine |
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
3244 |
! |
b060609f7c16
must recompute width of contents, if inserting/removing lines
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
3245 |
|
2225
65ac7cbffc60
added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents:
2224
diff
changeset
|
3246 |
suppressEmphasisInSelection |
65ac7cbffc60
added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents:
2224
diff
changeset
|
3247 |
"selection is shown with original emphasis" |
65ac7cbffc60
added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents:
2224
diff
changeset
|
3248 |
|
65ac7cbffc60
added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents:
2224
diff
changeset
|
3249 |
^ false |
65ac7cbffc60
added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents:
2224
diff
changeset
|
3250 |
! |
65ac7cbffc60
added suppressEmphasisInSelection handling
Claus Gittinger <cg@exept.de>
parents:
2224
diff
changeset
|
3251 |
|
2181 | 3252 |
textChanged |
3253 |
"ignored here" |
|
3254 |
! |
|
3255 |
||
5862 | 3256 |
updateWidthOfWidestLineFor:aLine |
3257 |
"when set to do this dynamically |
|
3258 |
(eg when checkedLinesForWidthOfContentsComputation == 0)" |
|
3259 |
||
3260 |
|w| |
|
3261 |
||
5884 | 3262 |
w := self widthOfLineString:aLine. |
3263 |
w > (widthOfWidestLine ? 0) ifTrue:[ |
|
5862 | 3264 |
widthOfWidestLine := w. |
3265 |
self contentsChanged. |
|
3266 |
]. |
|
3267 |
! |
|
3268 |
||
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3269 |
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
|
3270 |
"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
|
3271 |
This is used for redrawing; i.e. for non-string entries, this |
6808 | 3272 |
returns the original. |
3273 |
visibleLineNr is a visible lineNr (i.e. not the absolute 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
|
3274 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3275 |
|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
|
3276 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3277 |
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
|
3278 |
(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
|
3279 |
(list notNil) ifTrue:[ |
6808 | 3280 |
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
|
3281 |
] ifFalse:[ |
6808 | 3282 |
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
|
3283 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3284 |
(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
|
3285 |
^ '' |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3286 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3287 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3288 |
visibleLineOfY:y |
3818 | 3289 |
"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
|
3290 |
- 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
|
3291 |
|
1448
4220c80ab099
Do not reurn lineNumbers < 1 in #visibleLineOfY:
Stefan Vogel <sv@exept.de>
parents:
1433
diff
changeset
|
3292 |
^ (((y - textStartTop) // fontHeight) + 1) max:1 |
4220c80ab099
Do not reurn lineNumbers < 1 in #visibleLineOfY:
Stefan Vogel <sv@exept.de>
parents:
1433
diff
changeset
|
3293 |
|
4220c80ab099
Do not reurn lineNumbers < 1 in #visibleLineOfY:
Stefan Vogel <sv@exept.de>
parents:
1433
diff
changeset
|
3294 |
"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
|
3295 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3296 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3297 |
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
|
3298 |
"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
|
3299 |
|
75b8fb924904
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 |
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
|
3301 |
^ 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
|
3302 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3303 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3304 |
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
|
3305 |
"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
|
3306 |
(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
|
3307 |
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
|
3308 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3309 |
|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
|
3310 |
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
|
3311 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3312 |
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
|
3313 |
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
|
3314 |
(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
|
3315 |
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
|
3316 |
(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
|
3317 |
^ 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
|
3318 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3319 |
|
2559 | 3320 |
visibleStringFrom:aString |
3321 |
^ aString asString |
|
3322 |
! |
|
3323 |
||
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3324 |
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
|
3325 |
"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
|
3326 |
- 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
|
3327 |
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
|
3328 |
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
|
3329 |
|
957
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3330 |
^ innerWidth |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3331 |
|
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3332 |
"/ "for small width, its not worth searching for |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3333 |
"/ longest line ... |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3334 |
"/ " |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3335 |
"/ (width < 300) ifTrue:[^ innerWidth]. |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3336 |
"/ |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3337 |
"/ "for large lists, search may take longer than scrolling full |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3338 |
"/ " |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3339 |
"/ self size > 2000 ifTrue:[^ innerWidth]. |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3340 |
"/ |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3341 |
"/ " |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3342 |
"/ 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
|
3343 |
"/ " |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3344 |
"/ (viewBackground isColor not |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3345 |
"/ or:[viewBackground isDithered]) ifTrue:[ |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3346 |
"/ ^ width |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3347 |
"/ ]. |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3348 |
"/ |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3349 |
"/ w := self widthOfWidestLineBetween:firstLine and:lastLine. |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3350 |
"/ (w > innerWidth) ifTrue:[^ innerWidth]. |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3351 |
"/ ^ w |
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3352 |
|
0d6a4d572aa2
oops - widthForScroll was wrong
Claus Gittinger <cg@exept.de>
parents:
954
diff
changeset
|
3353 |
"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
|
3354 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3355 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3356 |
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
|
3357 |
"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
|
3358 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3359 |
entry isNil ifTrue:[^ 0]. |
5111 | 3360 |
(entry isSingleByteString) ifTrue:[ |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
3361 |
^ 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
|
3362 |
]. |
634
1ca770b2c494
handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
3363 |
^ entry widthOn:self |
1ca770b2c494
handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
3364 |
|
1ca770b2c494
handle items which are higher than the font (LabelAndIcons, for example)
Claus Gittinger <cg@exept.de>
parents:
627
diff
changeset
|
3365 |
"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
|
3366 |
! |
75b8fb924904
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 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3368 |
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
|
3369 |
"return the width in pixels of the widest line in a range |
5480 | 3370 |
- used to optimize scrolling, by limiting the scrolled area; |
3371 |
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
|
3372 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3373 |
|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
|
3374 |
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
|
3375 |
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
|
3376 |
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
|
3377 |
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
|
3378 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3379 |
includesNonStrings ifTrue:[ |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
3380 |
^ 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
|
3381 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3382 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3383 |
fontIsFixedWidth ifTrue:[ |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
3384 |
^ (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
|
3385 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3386 |
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
|
3387 |
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
|
3388 |
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
|
3389 |
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
|
3390 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3391 |
(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
|
3392 |
(last > listSize) ifTrue:[ |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
3393 |
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
|
3394 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3395 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3396 |
self from:first to:last do:[:line | |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
3397 |
line notNil ifTrue:[ |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
3398 |
(line isSingleByteString) ifTrue:[ |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
3399 |
thisLen := gc font widthOf:line |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
3400 |
] ifFalse:[ |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
3401 |
thisLen := line widthOn:self |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
3402 |
]. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
3403 |
(thisLen > max) ifTrue:[ |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
3404 |
max := thisLen |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
3405 |
] |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
3406 |
] |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3407 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3408 |
^ 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
|
3409 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3410 |
|
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
3411 |
withoutAnyColorEmphasis:line |
4046 | 3412 |
(line notNil and:[line isText]) ifTrue:[ |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
3413 |
^ line withoutAnyColorEmphasis |
4046 | 3414 |
]. |
3415 |
^ line |
|
3416 |
||
3417 |
" |
|
3418 |
'hello' asText colorizeAllWith:Color red. |
|
3419 |
('hello' asText colorizeAllWith:Color red) withoutForegroundColorEmphasis. |
|
4392 | 3420 |
('hello' asText colorizeAllWith:Color red) withoutAnyColorEmphasis. |
4046 | 3421 |
" |
4392 | 3422 |
|
3423 |
"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
|
3424 |
! |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
3425 |
|
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
3426 |
withoutBackgroundColorEmphasis:line |
4046 | 3427 |
(line notNil and:[line isText]) ifTrue:[ |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
3428 |
^ line withoutBackgroundColorEmphasis |
4046 | 3429 |
]. |
3430 |
^ line |
|
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
3431 |
! |
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
3432 |
|
2090
85c0dd8a4281
selection over colored text - again
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
3433 |
withoutColorEmphasis:line |
4046 | 3434 |
(line notNil and:[line isText]) ifTrue:[ |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
3435 |
^ line withoutForegroundColorEmphasis |
4046 | 3436 |
]. |
3437 |
^ line |
|
2090
85c0dd8a4281
selection over colored text - again
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
3438 |
! |
85c0dd8a4281
selection over colored text - again
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
3439 |
|
85c0dd8a4281
selection over colored text - again
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
3440 |
withoutColorEmphasis:line ifFg:fg andBg:bg |
85c0dd8a4281
selection over colored text - again
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
3441 |
"/ remove lines color emphasis, to enforce color. |
85c0dd8a4281
selection over colored text - again
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
3442 |
"/ otherwise blue text is not visible if selection-bg is blue |
4046 | 3443 |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3444 |
(line notNil |
4046 | 3445 |
and:[line isText |
6471 | 3446 |
and:[(fg ~= fgColor) or:[bg ~= bgColor]]]) ifTrue:[ |
3447 |
^ line withoutAnyColorEmphasis |
|
2090
85c0dd8a4281
selection over colored text - again
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
3448 |
]. |
2557
dabeb8404df8
selecting colored Text: draw correctly in selection-colors
Claus Gittinger <cg@exept.de>
parents:
2513
diff
changeset
|
3449 |
^ line |
2090
85c0dd8a4281
selection over colored text - again
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
3450 |
|
4392 | 3451 |
"Created: / 15-12-1999 / 23:19:30 / cg" |
6471 | 3452 |
"Modified: / 26-10-2018 / 21:56:57 / Claus Gittinger" |
2090
85c0dd8a4281
selection over colored text - again
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
3453 |
! |
85c0dd8a4281
selection over colored text - again
Claus Gittinger <cg@exept.de>
parents:
2089
diff
changeset
|
3454 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3455 |
xOfCol:col inVisibleLine:visLineNr |
2209 | 3456 |
"given a visible line- and colNr, return the x-coordinate in view" |
3457 |
||
3458 |
|line lineSize tcol lText| |
|
3459 |
||
3460 |
col == 1 ifTrue:[ |
|
6554 | 3461 |
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
|
3462 |
] ifFalse:[ |
6554 | 3463 |
tcol := col - 1. |
3464 |
||
3465 |
line := self visibleAt:visLineNr. |
|
3466 |
(fontIsFixedWidth and:[line isNil or:[line isSingleByteString]]) |
|
3467 |
ifTrue:[ |
|
3468 |
lText := (tcol * fontWidth) |
|
3469 |
] ifFalse:[ |
|
3470 |
line notNil ifTrue:[ |
|
3471 |
lineSize := line string size |
|
3472 |
] ifFalse:[ |
|
3473 |
lineSize := 0 |
|
3474 |
]. |
|
3475 |
(lineSize == 0) ifTrue:[ |
|
3476 |
lText := (tcol * fontWidth) |
|
3477 |
] ifFalse:[ |
|
3478 |
(lineSize < col) ifTrue:[ |
|
3479 |
lText := (line widthOn:self) + (fontWidth * (tcol - lineSize)) |
|
3480 |
] ifFalse:[ |
|
3481 |
(line isSingleByteString) ifTrue:[ |
|
3482 |
lText := (gc font widthOf:line from:1 to:tcol) |
|
3483 |
] ifFalse:[ |
|
3484 |
lText := line widthFrom:1 to:tcol on:self. |
|
3485 |
] |
|
3486 |
] |
|
3487 |
] |
|
3488 |
] |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3489 |
]. |
2209 | 3490 |
^ lText + textStartLeft |
670
8e381269591c
more fixes for non-string entries
Claus Gittinger <cg@exept.de>
parents:
668
diff
changeset
|
3491 |
|
6554 | 3492 |
"Modified: / 03-09-1998 / 21:56:33 / cg" |
3493 |
"Modified (format): / 01-03-2019 / 21:50:17 / Claus Gittinger" |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3494 |
! |
75b8fb924904
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 |
|
1608
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
3496 |
yOfLine:lineNr |
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
3497 |
"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
|
3498 |
- 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
|
3499 |
|
4641 | 3500 |
|visLine| |
3501 |
||
3502 |
visLine := self listLineToVisibleLine:lineNr. |
|
3503 |
visLine isNil ifTrue:[ |
|
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
3504 |
^ nil |
4641 | 3505 |
]. |
3506 |
^ self yOfVisibleLine:visLine |
|
1608
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
3507 |
|
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
3508 |
"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
|
3509 |
! |
ce06a6553af1
fixed redraw after a change of the item size
Claus Gittinger <cg@exept.de>
parents:
1582
diff
changeset
|
3510 |
|
249
75b8fb924904
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 |
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
|
3512 |
"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
|
3513 |
- 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
|
3514 |
|
3819 | 3515 |
"/ care for visLineNr being nil during initialization |
3516 |
^ (((visLineNr ? 1) - 1) * fontHeight) + textStartTop |
|
3398
d5c915fe3d92
oops - ListModelView protocol
Claus Gittinger <cg@exept.de>
parents:
3339
diff
changeset
|
3517 |
! |
d5c915fe3d92
oops - ListModelView protocol
Claus Gittinger <cg@exept.de>
parents:
3339
diff
changeset
|
3518 |
|
d5c915fe3d92
oops - ListModelView protocol
Claus Gittinger <cg@exept.de>
parents:
3339
diff
changeset
|
3519 |
yVisibleToLineNr:yVisible |
d5c915fe3d92
oops - ListModelView protocol
Claus Gittinger <cg@exept.de>
parents:
3339
diff
changeset
|
3520 |
|vL| |
d5c915fe3d92
oops - ListModelView protocol
Claus Gittinger <cg@exept.de>
parents:
3339
diff
changeset
|
3521 |
|
d5c915fe3d92
oops - ListModelView protocol
Claus Gittinger <cg@exept.de>
parents:
3339
diff
changeset
|
3522 |
vL := self visibleLineOfY:yVisible. |
d5c915fe3d92
oops - ListModelView protocol
Claus Gittinger <cg@exept.de>
parents:
3339
diff
changeset
|
3523 |
^ self visibleLineToListLine:vL |
d5c915fe3d92
oops - ListModelView protocol
Claus Gittinger <cg@exept.de>
parents:
3339
diff
changeset
|
3524 |
|
d5c915fe3d92
oops - ListModelView protocol
Claus Gittinger <cg@exept.de>
parents:
3339
diff
changeset
|
3525 |
"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
|
3526 |
! ! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3527 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3528 |
!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
|
3529 |
|
4303 | 3530 |
characterPositionOfLine:lineNr col:colArg |
2812 | 3531 |
"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
|
3532 |
- used with compiler's error-positioning, which is based on character positions |
2812 | 3533 |
of the contents-string." |
3534 |
||
4468
6d711c19c529
comment/format in: #characterPositionOfLine:col:
Claus Gittinger <cg@exept.de>
parents:
4463
diff
changeset
|
3535 |
|lineString charPos lineEndCharSize col| |
3314 | 3536 |
|
3854 | 3537 |
lineEndCharSize := self lineEndCRLF ifTrue:[2] ifFalse:[1]. |
2812 | 3538 |
|
3539 |
self checkForExistingLine:lineNr. |
|
4468
6d711c19c529
comment/format in: #characterPositionOfLine:col:
Claus Gittinger <cg@exept.de>
parents:
4463
diff
changeset
|
3540 |
charPos := 1. |
2812 | 3541 |
1 to:(lineNr - 1) do:[:lnr | |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
3542 |
lineString := self at:lnr. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
3543 |
lineString notNil ifTrue:[ |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
3544 |
charPos := charPos + (lineString string) size |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
3545 |
]. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
3546 |
charPos := charPos + lineEndCharSize "the return-character" |
2812 | 3547 |
]. |
4303 | 3548 |
|
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
3549 |
"/ NEW: expand that line, so that characterAtCharacterPosition returns the correct character |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
3550 |
"/ wrong: will modify!! |
5691 | 3551 |
"/ (lineString := self at:lineNr) size < colArg ifTrue:[ |
3552 |
"/ "/ expand this line |
|
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
3553 |
"/ self at:lineNr put:((lineString ? ''),(String new:colArg-lineString size)). |
5691 | 3554 |
"/ ]. |
3555 |
||
3556 |
"/ OLD: if beyond end of line, be careful to not advance into next line. |
|
4759 | 3557 |
"/ otherwise, syntaxHighlighter (and others) walk into trouble, |
3558 |
"/ if clicked on a space beyond a line's end. |
|
3559 |
col := colArg min:((self at:lineNr) size + 1). |
|
4468
6d711c19c529
comment/format in: #characterPositionOfLine:col:
Claus Gittinger <cg@exept.de>
parents:
4463
diff
changeset
|
3560 |
^ charPos + col - 1 |
3314 | 3561 |
|
3562 |
"Modified: / 04-07-2006 / 19:14:25 / fm" |
|
5691 | 3563 |
"Modified: / 01-05-2016 / 15:48:24 / cg" |
2812 | 3564 |
! |
3565 |
||
3566 |
colOfCharacterPosition:charPos |
|
3567 |
"given a character index within the contents-string, |
|
3568 |
return the column number where the character is |
|
3569 |
- used to find line to hilight from Compilers error-position" |
|
3570 |
||
3571 |
|line| |
|
3572 |
||
3573 |
line := self lineOfCharacterPosition:charPos. |
|
3574 |
^ charPos - (self characterPositionOfLine:line col:1) + 1. |
|
3575 |
||
3576 |
! |
|
3577 |
||
1525
6079f38d5e89
added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents:
1497
diff
changeset
|
3578 |
currentLine |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3579 |
"the current line (for relative gotos); |
1525
6079f38d5e89
added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents:
1497
diff
changeset
|
3580 |
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
|
3581 |
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
|
3582 |
|
6079f38d5e89
added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents:
1497
diff
changeset
|
3583 |
^ firstLineShown |
6079f38d5e89
added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents:
1497
diff
changeset
|
3584 |
|
6079f38d5e89
added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents:
1497
diff
changeset
|
3585 |
"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
|
3586 |
! |
6079f38d5e89
added #currentLine (req'd for relative gotos)
Claus Gittinger <cg@exept.de>
parents:
1497
diff
changeset
|
3587 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3588 |
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
|
3589 |
"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
|
3590 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3591 |
^ 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
|
3592 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3593 |
|
311
cddf10b2207e
added query for height with n lines
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
3594 |
heightForLines:numberOfLines |
cddf10b2207e
added query for height with n lines
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
3595 |
"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
|
3596 |
|
5818 | 3597 |
^ numberOfLines * fontHeight + topMargin + gc deviceFont descent + lineSpacing + (margin * 2) |
311
cddf10b2207e
added query for height with n lines
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
3598 |
|
cddf10b2207e
added query for height with n lines
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
3599 |
"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
|
3600 |
! |
cddf10b2207e
added query for height with n lines
Claus Gittinger <cg@exept.de>
parents:
305
diff
changeset
|
3601 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3602 |
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
|
3603 |
"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
|
3604 |
- 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
|
3605 |
|
5818 | 3606 |
|numLines| |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3607 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3608 |
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
|
3609 |
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
|
3610 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3611 |
"/ |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3612 |
"/ 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
|
3613 |
"/ |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3614 |
"/ 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
|
3615 |
"/ 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
|
3616 |
"/ ]. |
5947 | 3617 |
^ 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
|
3618 |
"/ + textStartTop |
5585 | 3619 |
- (lineSpacing // 2) |
5818 | 3620 |
+ (gc deviceFont 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
|
3621 |
"/ + (font descent * 2) "makes it look better" |
5585 | 3622 |
. |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3623 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3624 |
"/ "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
|
3625 |
"/ (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
|
3626 |
"/ ^ 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
|
3627 |
"/ ]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3628 |
"/ "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
|
3629 |
"/ 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
|
3630 |
"/ |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3631 |
"/ ^ (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
|
3632 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3633 |
|
6645 | 3634 |
isLineFullyVisible:lineNr |
3635 |
"is line fully visible?" |
|
3636 |
||
3637 |
(lineNr >= firstLineShown |
|
3638 |
and:[ lineNr < (firstLineShown + nFullLinesShown) ]) ifTrue:[ ^ true ]. |
|
3639 |
^ false. |
|
3640 |
||
3641 |
"Created: / 20-07-2019 / 07:48:35 / Claus Gittinger" |
|
3642 |
! |
|
3643 |
||
3644 |
isLineVisible:line |
|
3645 |
"is line visible?" |
|
3646 |
||
3647 |
(line >= firstLineShown and:[ line < (firstLineShown + nLinesShown) ]) ifTrue:[ ^ true ]. |
|
3648 |
^ false. |
|
3649 |
||
3650 |
"Created: / 20-07-2019 / 07:43:51 / Claus Gittinger" |
|
3651 |
! |
|
3652 |
||
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3653 |
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
|
3654 |
"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
|
3655 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3656 |
^ 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
|
3657 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3658 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3659 |
leftIndentOfLine:lineNr |
6611 | 3660 |
"return the actual number of spaces at the left in line, 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
|
3661 |
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
|
3662 |
|
566 | 3663 |
|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
|
3664 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3665 |
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
|
3666 |
lineString notNil ifTrue:[ |
6611 | 3667 |
indent := lineString leftIndent. |
3668 |
indent == lineString size ifTrue:[^ 0]. |
|
3669 |
^ 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
|
3670 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3671 |
^ 0 |
566 | 3672 |
|
6611 | 3673 |
"Modified: / 20-04-1996 / 19:30:38 / cg" |
3674 |
"Modified (comment): / 26-06-2019 / 22:30:52 / Claus Gittinger" |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3675 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3676 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3677 |
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
|
3678 |
"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
|
3679 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3680 |
^ 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
|
3681 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3682 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3683 |
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
|
3684 |
"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
|
3685 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3686 |
|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
|
3687 |
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
|
3688 |
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
|
3689 |
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
|
3690 |
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
|
3691 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3692 |
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
|
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 |
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
|
3695 |
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
|
3696 |
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
|
3697 |
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
|
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 |
(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
|
3700 |
(last > listSize) ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3701 |
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
|
3702 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3703 |
self from:first to:last do:[:lineString | |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3704 |
lineString notNil ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3705 |
thisLen := lineString size. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3706 |
(thisLen > max) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3707 |
max := thisLen |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3708 |
] |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3709 |
] |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3710 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3711 |
^ 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
|
3712 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3713 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3714 |
|
6645 | 3715 |
lineIsFullyVisible:lineNr |
3716 |
<resource: #obsolete> |
|
587
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3717 |
"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
|
3718 |
|
6645 | 3719 |
^ self isLineFullyVisible:lineNr |
3720 |
||
3721 |
"Created: / 26-04-1996 / 14:36:45 / cg" |
|
3722 |
"Modified: / 20-07-2019 / 07:49:00 / Claus Gittinger" |
|
587
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3723 |
! |
19deffec383d
if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents:
586
diff
changeset
|
3724 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3725 |
lineIsVisible:line |
6645 | 3726 |
<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
|
3727 |
"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
|
3728 |
|
6645 | 3729 |
^ self isLineVisible:line |
3730 |
||
3731 |
"Modified: / 20-07-2019 / 07:44:07 / Claus Gittinger" |
|
249
75b8fb924904
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 |
|
2812 | 3734 |
lineOfCharacterPosition:charPos |
3735 |
"given a character index within the contents-string, |
|
3736 |
return the lineNumber where the character is |
|
4448
2e4bb12f298c
changed: #lineOfCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
4444
diff
changeset
|
3737 |
- used to find line to hilight from compiler's error-position" |
2812 | 3738 |
|
4303 | 3739 |
|lineNr sum lastLine lineEndCharSize l| |
3314 | 3740 |
|
4280
61a16b0a99d5
changed: #lineOfCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
4247
diff
changeset
|
3741 |
lineEndCharSize := self lineEndCRLF ifTrue:[2] ifFalse:[1]. |
2812 | 3742 |
|
3743 |
lineNr := 1. |
|
3744 |
sum := 0. |
|
3745 |
lastLine := self size. |
|
3746 |
[(sum < charPos) and:[lineNr <= lastLine]] whileTrue:[ |
|
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
3747 |
l := (self at:lineNr) ? ''. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
3748 |
sum := sum + (l string "withoutTrailingSeparators" size) + lineEndCharSize. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
3749 |
lineNr := lineNr + 1 |
2812 | 3750 |
]. |
3751 |
sum == charPos ifTrue:[ |
|
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
3752 |
^ lineNr |
2812 | 3753 |
]. |
3754 |
||
4448
2e4bb12f298c
changed: #lineOfCharacterPosition:
Claus Gittinger <cg@exept.de>
parents:
4444
diff
changeset
|
3755 |
^ (lineNr - 1) max:1 |
2812 | 3756 |
|
3314 | 3757 |
"Modified: / 04-07-2006 / 19:13:32 / fm" |
4303 | 3758 |
"Modified: / 21-08-2011 / 10:50:12 / cg" |
2812 | 3759 |
! |
3760 |
||
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3761 |
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
|
3762 |
"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
|
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 |
^ 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
|
3765 |
! |
75b8fb924904
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 |
|
4607 | 3767 |
preferredExtentForContents |
3768 |
^ (self widthOfContents @ self heightOfContents) |
|
3769 |
! |
|
3770 |
||
678
c1967a46b2c1
added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents:
670
diff
changeset
|
3771 |
preferredExtentForLines:numLines cols:numCols |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
3772 |
^ (((gc font widthOf:'x') * numCols + margin + margin) |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3773 |
@ |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
3774 |
(fontHeight * numLines + margin + margin + gc font descent + lineSpacing + topMargin)). |
688 | 3775 |
|
3776 |
"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
|
3777 |
! |
c1967a46b2c1
added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents:
670
diff
changeset
|
3778 |
|
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
3779 |
supportsSyntaxElements |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
3780 |
"see CodeView2::TextView" |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
3781 |
|
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
3782 |
^ false |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
3783 |
! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
3784 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3785 |
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
|
3786 |
"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
|
3787 |
- 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
|
3788 |
|
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
3789 |
|font start "{ Class: SmallInteger }" |
4749 | 3790 |
stop "{ Class: SmallInteger }" |
3791 |
lengthOfLongestString "{ Class: SmallInteger }" |
|
3792 |
lengthOfLongestLine "{ Class: SmallInteger }" |
|
3793 |
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
|
3794 |
|
4752 | 3795 |
list isEmptyOrNil ifTrue:[^ 0]. |
4751 | 3796 |
widthOfWidestLine notNil ifTrue:[ |
3797 |
"/ already computed (cached); this cache is cleared when the contents is modified |
|
3798 |
^ widthOfWidestLine + (leftMargin * 2) |
|
3799 |
]. |
|
607
67462978fb20
fixed #widthOfContents if no device is known
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
3800 |
|
5818 | 3801 |
font := gc deviceFont. |
4751 | 3802 |
checkedLinesForWidthOfContentsComputation isNil ifTrue:[ |
3803 |
start := 1. |
|
6557 | 3804 |
stop := (list size min:10000) |
4751 | 3805 |
] ifFalse:[ |
5862 | 3806 |
checkedLinesForWidthOfContentsComputation == 0 ifTrue:[ |
3807 |
start := firstLineShown. |
|
5885 | 3808 |
stop := (start + nLinesShown - 1) min:list size. |
3809 |
] ifFalse:[ |
|
5862 | 3810 |
checkedLinesForWidthOfContentsComputation > 0 ifTrue:[ |
3811 |
start := 1. |
|
3812 |
stop := (checkedLinesForWidthOfContentsComputation min:list size) |
|
3813 |
] ifFalse:[ |
|
3814 |
stop := list size. |
|
3815 |
start := (list size + 1 + checkedLinesForWidthOfContentsComputation) max:1. |
|
3816 |
] |
|
4751 | 3817 |
] |
3818 |
]. |
|
4749 | 3819 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3820 |
includesNonStrings ifTrue:[ |
4749 | 3821 |
max := 0. |
3822 |
start to:stop do:[:lineNr | |
|
3823 |
|entry w| |
|
3824 |
||
3825 |
entry := list at:lineNr. |
|
3826 |
entry notNil ifTrue:[ |
|
5111 | 3827 |
(entry isSingleByteString) ifTrue:[ |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
3828 |
w := font widthOf:entry |
4749 | 3829 |
] ifFalse:[ |
3830 |
w := entry widthOn:self |
|
3831 |
]. |
|
3832 |
max := max max:w. |
|
3833 |
]. |
|
3834 |
]. |
|
249
75b8fb924904
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 |
] ifFalse:[ |
4522 | 3836 |
fontIsFixedWidth ifTrue:[ |
3837 |
max := lengthOfLongestString := 0. |
|
3838 |
list notNil ifTrue:[ |
|
4749 | 3839 |
start to:stop do:[:lineNr | |
3840 |
|line| |
|
3841 |
||
3842 |
line := list at:lineNr. |
|
4522 | 3843 |
line notNil ifTrue:[ |
5111 | 3844 |
(line isSingleByteString) ifTrue:[ |
4522 | 3845 |
line size > lengthOfLongestString ifTrue:[ |
3846 |
lengthOfLongestString := line size |
|
3847 |
]. |
|
3848 |
] ifFalse:[ |
|
3849 |
max := max max:(line widthOn:self) |
|
3850 |
] |
|
3851 |
] |
|
3852 |
]. |
|
3853 |
max := max max:(lengthOfLongestString * fontWidth) |
|
3854 |
]. |
|
3855 |
] ifFalse:[ |
|
4732 | 3856 |
max := lengthOfLongestLine := 0. |
3857 |
list notNil ifTrue:[ |
|
4749 | 3858 |
start to:stop do:[:lineNr | |
3859 |
|line len| |
|
3860 |
||
5090 | 3861 |
line := list at:lineNr ifAbsent:nil. |
4732 | 3862 |
line notNil ifTrue:[ |
3863 |
len := line size. |
|
3864 |
"/ consider this a speed hack (not exact, but fast) |
|
3865 |
lengthOfLongestLine := lengthOfLongestLine max:len. |
|
3866 |
len > (lengthOfLongestLine // 3) ifTrue:[ |
|
3867 |
max := max max:(line widthOn:self) |
|
3868 |
]. |
|
3869 |
] |
|
4522 | 3870 |
]. |
3871 |
]. |
|
3872 |
]. |
|
249
75b8fb924904
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 |
]. |
75b8fb924904
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 |
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
|
3875 |
^ max + (leftMargin * 2) |
607
67462978fb20
fixed #widthOfContents if no device is known
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
3876 |
|
6557 | 3877 |
"Modified: / 24-09-1998 / 18:21:08 / cg" |
3878 |
"Modified: / 12-03-2019 / 15:13:54 / Claus Gittinger" |
|
249
75b8fb924904
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 |
|
1716 | 3881 |
widthOfLine:lineNr |
3882 |
"return the width of a line in pixels" |
|
3883 |
||
5818 | 3884 |
|line| |
1716 | 3885 |
|
3886 |
list isNil ifTrue:[^ 0]. |
|
3887 |
lineNr > list size ifTrue:[^ 0]. |
|
3888 |
line := list at:lineNr. |
|
5863 | 3889 |
line isNil ifTrue:[^ 0]. |
3890 |
^ self widthOfLineString:line |
|
1716 | 3891 |
|
3892 |
"Created: / 10.11.1998 / 23:59:20 / cg" |
|
3893 |
"Modified: / 11.11.1998 / 15:25:07 / cg" |
|
3894 |
! |
|
3895 |
||
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3896 |
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
|
3897 |
"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
|
3898 |
- 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
|
3899 |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3900 |
^ 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
|
3901 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3902 |
|
75b8fb924904
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 |
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
|
3904 |
"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
|
3905 |
- 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
|
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 |
^ (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
|
3908 |
! ! |
75b8fb924904
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 |
|
75b8fb924904
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 |
!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
|
3911 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3912 |
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
|
3913 |
"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
|
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 |
shown ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3916 |
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
|
3917 |
] |
75b8fb924904
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 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3920 |
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
|
3921 |
"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
|
3922 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3923 |
|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
|
3924 |
|
75b8fb924904
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 |
shown ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3926 |
"if first line to redraw is above 1st visible line, |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3927 |
start redraw at 1st visible line" |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3928 |
(lineNr < firstLineShown) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3929 |
first := firstLineShown |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3930 |
] ifFalse:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3931 |
first := lineNr |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3932 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3933 |
visibleLine := self listLineToVisibleLine:first. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3934 |
visibleLine notNil ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3935 |
self redrawFromVisibleLine:visibleLine to:nLinesShown |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3936 |
] |
249
75b8fb924904
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 |
] |
75b8fb924904
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 |
! |
75b8fb924904
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 |
|
2605
4f8c7e50f217
added redrawFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2577
diff
changeset
|
3940 |
redrawFromLine:startLine col:startCol toLine:endLine col:endCol |
4f8c7e50f217
added redrawFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2577
diff
changeset
|
3941 |
shown ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3942 |
self redrawLine:startLine from:startCol. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3943 |
endLine > (startLine+1) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3944 |
self redrawFromLine:startLine+1 to:endLine-1 |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3945 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3946 |
self redrawLine:endLine from:1 to:endCol. |
2605
4f8c7e50f217
added redrawFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2577
diff
changeset
|
3947 |
] |
4f8c7e50f217
added redrawFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2577
diff
changeset
|
3948 |
! |
4f8c7e50f217
added redrawFromLine:col:toLine:col:
Claus Gittinger <cg@exept.de>
parents:
2577
diff
changeset
|
3949 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3950 |
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
|
3951 |
"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
|
3952 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3953 |
|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
|
3954 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3955 |
shown ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3956 |
lastLineShown := firstLineShown + nLinesShown - 1. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3957 |
(start <= lastLineShown) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3958 |
(end >= firstLineShown) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3959 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3960 |
"if first line to redraw is above 1st visible line, |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3961 |
start redraw at 1st visible line" |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3962 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3963 |
(start < firstLineShown) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3964 |
first := firstLineShown |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3965 |
] ifFalse:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3966 |
first := start |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3967 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3968 |
(end > lastLineShown) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3969 |
last := lastLineShown |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3970 |
] ifFalse:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3971 |
last := end |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3972 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3973 |
visibleFirst := self listLineToVisibleLine:first. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3974 |
visibleLast := self listLineToVisibleLine:last. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3975 |
self redrawFromVisibleLine:visibleFirst to:visibleLast |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3976 |
] |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3977 |
] |
249
75b8fb924904
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 |
|
75b8fb924904
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 |
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
|
3982 |
"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
|
3983 |
|
75b8fb924904
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 |
shown ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
3985 |
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
|
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 |
|
75b8fb924904
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 |
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
|
3990 |
"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
|
3991 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
3992 |
|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
|
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 |
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
|
3995 |
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
|
3996 |
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
|
3997 |
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
|
3998 |
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
|
3999 |
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
|
4000 |
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
|
4001 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4002 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4003 |
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
|
4004 |
"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
|
4005 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4006 |
|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
|
4007 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4008 |
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
|
4009 |
visibleLine notNil ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4010 |
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
|
4011 |
] |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4012 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4013 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4014 |
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
|
4015 |
"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
|
4016 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4017 |
|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
|
4018 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4019 |
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
|
4020 |
visibleLine notNil ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4021 |
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
|
4022 |
] |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4023 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4024 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4025 |
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
|
4026 |
"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
|
4027 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4028 |
|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
|
4029 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4030 |
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
|
4031 |
visibleLine notNil ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4032 |
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
|
4033 |
] |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4034 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4035 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4036 |
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
|
4037 |
"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
|
4038 |
|
75b8fb924904
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 |
|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
|
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 |
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
|
4042 |
visibleLine notNil ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4043 |
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
|
4044 |
] |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4045 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4046 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4047 |
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
|
4048 |
"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
|
4049 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4050 |
shown ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4051 |
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
|
4052 |
] |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4053 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4054 |
|
75b8fb924904
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 |
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
|
4056 |
"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
|
4057 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4058 |
shown ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4059 |
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
|
4060 |
] |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4061 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4062 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4063 |
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
|
4064 |
"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
|
4065 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4066 |
shown ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4067 |
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
|
4068 |
] |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4069 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4070 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4071 |
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
|
4072 |
"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
|
4073 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4074 |
shown ifTrue:[ |
6451 | 4075 |
(startCol == endCol and:[startCol ~~ 0]) ifTrue:[ |
4076 |
self redrawVisibleLine:visLineNr col:startCol |
|
4077 |
] ifFalse:[ |
|
4078 |
"/ if 0, the left margin needs to be drawn |
|
4079 |
self drawVisibleLine:visLineNr from:startCol to:endCol with:fgColor and:bgColor |
|
4080 |
] |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4081 |
] |
6451 | 4082 |
|
4083 |
"Modified: / 10-10-2018 / 18:23:37 / Claus Gittinger" |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4084 |
! ! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4085 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4086 |
!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
|
4087 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4088 |
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
|
4089 |
"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
|
4090 |
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
|
4091 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4092 |
^ 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
|
4093 |
! |
75b8fb924904
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 |
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
|
4096 |
"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
|
4097 |
|
6342 | 4098 |
self scrollDownLines:(nFullLinesShown // 2) |
4099 |
||
4100 |
"Modified: / 13-06-2018 / 22:01:55 / Claus Gittinger" |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4101 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4102 |
|
75b8fb924904
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 |
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
|
4104 |
"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
|
4105 |
|
6342 | 4106 |
self scrollUpLines:(nFullLinesShown // 2) |
4107 |
||
4108 |
"Modified: / 13-06-2018 / 22:02:21 / Claus Gittinger" |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4109 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4110 |
|
1910
0d68937d088b
removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents:
1888
diff
changeset
|
4111 |
horizontalScrollStep |
0d68937d088b
removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents:
1888
diff
changeset
|
4112 |
"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
|
4113 |
Here, the scrolling unit is characters." |
0d68937d088b
removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents:
1888
diff
changeset
|
4114 |
|
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4115 |
^ gc font width |
1910
0d68937d088b
removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents:
1888
diff
changeset
|
4116 |
|
0d68937d088b
removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents:
1888
diff
changeset
|
4117 |
"Created: / 21.5.1999 / 15:55:06 / cg" |
0d68937d088b
removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents:
1888
diff
changeset
|
4118 |
! |
0d68937d088b
removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents:
1888
diff
changeset
|
4119 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4120 |
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
|
4121 |
"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
|
4122 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4123 |
|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
|
4124 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4125 |
(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
|
4126 |
|
2423
8b9c2946a5a7
absoluteLineToVisibleLine: -> listLineToVisibleLine:
Claus Gittinger <cg@exept.de>
parents:
2412
diff
changeset
|
4127 |
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
|
4128 |
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
|
4129 |
|
75b8fb924904
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 |
xWant := self xOfCol:aCol inVisibleLine:visLnr. |
2429
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2427
diff
changeset
|
4131 |
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
|
4132 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4133 |
" |
5947 | 4134 |
don't scroll, if already visible |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4135 |
(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
|
4136 |
" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4137 |
"/ ((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
|
4138 |
"/ ^ 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
|
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 |
" |
75b8fb924904
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 |
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
|
4143 |
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
|
4144 |
" |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4145 |
(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
|
4146 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4147 |
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
|
4148 |
! |
75b8fb924904
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 |
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
|
4151 |
"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
|
4152 |
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
|
4153 |
|
1637
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
4154 |
|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
|
4155 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4156 |
(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
|
4157 |
|
895
02d8e324dca5
Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents:
890
diff
changeset
|
4158 |
"/ 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
|
4159 |
"/ 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
|
4160 |
"/ 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
|
4161 |
"/ |
02d8e324dca5
Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents:
890
diff
changeset
|
4162 |
"/ shown ifFalse:[ |
02d8e324dca5
Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents:
890
diff
changeset
|
4163 |
"/ firstLineShown := (aListLineNr - 1) max:1. |
02d8e324dca5
Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents:
890
diff
changeset
|
4164 |
"/ firstLineShown > (list size - nFullLinesShown) ifTrue:[ |
02d8e324dca5
Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents:
890
diff
changeset
|
4165 |
"/ firstLineShown := list size - nFullLinesShown |
02d8e324dca5
Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents:
890
diff
changeset
|
4166 |
"/ ]. |
02d8e324dca5
Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents:
890
diff
changeset
|
4167 |
"/ list size <= nFullLinesShown ifTrue:[ |
02d8e324dca5
Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents:
890
diff
changeset
|
4168 |
"/ firstLineShown := 1 |
02d8e324dca5
Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents:
890
diff
changeset
|
4169 |
"/ ]. |
02d8e324dca5
Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents:
890
diff
changeset
|
4170 |
"/ ^ self |
02d8e324dca5
Fix #makeLineVisible: to update viewOrigin and dependents.
Stefan Vogel <sv@exept.de>
parents:
890
diff
changeset
|
4171 |
"/ ]. |
691
906e4d67b9cf
fixed makeLineVisible; when not-yet realized
Claus Gittinger <cg@exept.de>
parents:
688
diff
changeset
|
4172 |
|
2216 | 4173 |
(self needScrollToMakeLineVisible:aListLineNr) ifFalse:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4174 |
^ self |
1637
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
4175 |
]. |
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
4176 |
|
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
4177 |
(aListLineNr < nFullLinesShown) ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4178 |
"/ at the very top of the list - show from top |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4179 |
newTopLine := 1 |
1637
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
4180 |
] ifFalse:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4181 |
(nFullLinesShown < 3) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4182 |
"/ a small view - show from that line |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4183 |
newTopLine := aListLineNr |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4184 |
] ifFalse:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4185 |
bott := self numberOfLines - (nFullLinesShown - 1). |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4186 |
(aListLineNr > bott) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4187 |
"/ 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
|
4188 |
newTopLine := bott |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4189 |
] ifFalse:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4190 |
"/ somewhere else - place selected line into the middle of |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4191 |
"/ the view |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4192 |
newTopLine := (aListLineNr - (nFullLinesShown // 2) + 1) |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4193 |
] |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4194 |
] |
249
75b8fb924904
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 |
]. |
1637
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
4196 |
|
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
4197 |
self scrollToLine:newTopLine. |
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
4198 |
|
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
4199 |
"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
|
4200 |
"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
|
4201 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4202 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4203 |
makeVisible:someString |
6164 | 4204 |
"if necessary, scroll to make the (first) |
249
75b8fb924904
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 |
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
|
4206 |
|
1808 | 4207 |
|index list| |
1319 | 4208 |
|
4209 |
(list := self list) notNil ifTrue:[ |
|
6164 | 4210 |
index := list indexOf:someString. |
4211 |
index ~~ 0 ifTrue:[ |
|
4212 |
self makeLineVisible:index |
|
4213 |
] |
|
249
75b8fb924904
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 |
] |
1319 | 4215 |
|
6164 | 4216 |
"Modified: / 09-09-1997 / 10:10:13 / cg" |
4217 |
"Modified (comment): / 30-05-2017 / 17:34:32 / mawalch" |
|
249
75b8fb924904
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 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4219 |
|
6342 | 4220 |
mouseWheelScrollDown:units |
4221 |
self scrollDownLines:units |
|
4222 |
||
4223 |
"Created: / 13-06-2018 / 22:12:59 / Claus Gittinger" |
|
4224 |
! |
|
4225 |
||
4226 |
mouseWheelScrollUp:units |
|
4227 |
self scrollUpLines:units |
|
4228 |
||
4229 |
"Created: / 13-06-2018 / 22:12:53 / Claus Gittinger" |
|
4230 |
! |
|
4231 |
||
1637
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
4232 |
needScrollToMakeLine:aListLineNr |
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
4233 |
"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
|
4234 |
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
|
4235 |
|
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
4236 |
(aListLineNr >= firstLineShown) ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4237 |
(aListLineNr < (firstLineShown + nFullLinesShown)) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4238 |
^ false |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4239 |
] |
1637
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
4240 |
]. |
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
4241 |
^ true |
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
4242 |
|
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
4243 |
"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
|
4244 |
"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
|
4245 |
! |
f40b75c349d7
allow redefinition of check-for-scroll needed in subclass.
Claus Gittinger <cg@exept.de>
parents:
1618
diff
changeset
|
4246 |
|
2216 | 4247 |
needScrollToMakeLineVisible:aListLineNr |
4248 |
"return true, if a scroll is needd to make a line visible. |
|
4249 |
Numbering starts with 1 for the very first line of the text." |
|
4250 |
||
4251 |
(aListLineNr >= firstLineShown) ifTrue:[ |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4252 |
(aListLineNr < (firstLineShown + nFullLinesShown)) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4253 |
^ false |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4254 |
] |
2216 | 4255 |
]. |
4256 |
^ true |
|
4257 |
||
4258 |
"Created: / 7.8.1998 / 15:13:51 / cg" |
|
4259 |
"Modified: / 7.8.1998 / 15:14:44 / cg" |
|
4260 |
! |
|
4261 |
||
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4262 |
pageDown |
4203 | 4263 |
"change origin to display the next page" |
4264 |
||
4201 | 4265 |
"/ self scrollTo:(viewOrigin + (0 @ height)) |
4203 | 4266 |
self scrollToLine:(self firstLineShown + nFullLinesShown) |
4267 |
||
4268 |
"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
|
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 |
|
75b8fb924904
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 |
pageUp |
4203 | 4272 |
"change origin to display the previous page" |
4273 |
||
4201 | 4274 |
"/ self scrollTo:(viewOrigin - (0 @ height)) |
4203 | 4275 |
self scrollToLine:(self firstLineShown - nFullLinesShown) |
4276 |
||
4277 |
"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
|
4278 |
! |
75b8fb924904
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 |
|
6819 | 4280 |
sceduleNextAutoScroll |
4281 |
|b t| |
|
4282 |
||
4283 |
"/ care for a race in case any of autoScrollBlock/autoScrollDeltaT gets nilled in-between (via stopScrollSelect) |
|
4284 |
(b := autoScrollBlock) notNil ifTrue:[ |
|
4285 |
(t := autoScrollDeltaT) notNil ifTrue:[ |
|
4286 |
Processor addTimedBlock:b afterSeconds:t. |
|
4287 |
] |
|
4288 |
] |
|
4289 |
! |
|
4290 |
||
6342 | 4291 |
scrollDown |
4292 |
"scroll down by one line; |
|
4293 |
this is called (among other) when the scrollbar's |
|
4294 |
scroll-step down button is pressed." |
|
4295 |
||
4296 |
self scrollDownLines:1 |
|
4297 |
||
4298 |
"Created: / 13-06-2018 / 22:41:01 / Claus Gittinger" |
|
4299 |
! |
|
4300 |
||
4301 |
scrollDown:nPixels |
|
4302 |
"change origin to scroll down some pixels |
|
6345 | 4303 |
(towards the bottom of the text) |
4304 |
Redefined, as this view only allows scrolling in multiples of the line height" |
|
4305 |
||
4306 |
self scrollDownLines:((nPixels + (fontHeight - 1)) // fontHeight) |
|
6342 | 4307 |
|
4308 |
"Modified: / 21-05-1999 / 15:59:52 / cg" |
|
6345 | 4309 |
"Modified: / 14-06-2018 / 11:27:12 / Claus Gittinger" |
6342 | 4310 |
! |
4311 |
||
4312 |
scrollDownLines:nLines |
|
4313 |
"change origin to scroll down some lines |
|
4314 |
(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
|
4315 |
|
1911 | 4316 |
nLines ~~ 0 ifTrue:[ |
6342 | 4317 |
self scrollTo:(viewOrigin + (0 @ (fontHeight * nLines))) |
4318 |
redraw:true |
|
1468 | 4319 |
] |
4320 |
||
6342 | 4321 |
"Created: / 13-06-2018 / 21:55:56 / Claus Gittinger" |
808
0fb219efdfa2
Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents:
798
diff
changeset
|
4322 |
! |
0fb219efdfa2
Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents:
798
diff
changeset
|
4323 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4324 |
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
|
4325 |
"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
|
4326 |
|
1756 | 4327 |
|nPixel| |
4328 |
||
2429
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2427
diff
changeset
|
4329 |
nPixel := aPixelOffset - viewOrigin x. |
1756 | 4330 |
nPixel ~~ 0 ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4331 |
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
|
4332 |
] |
1756 | 4333 |
|
4334 |
"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
|
4335 |
! |
75b8fb924904
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 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4337 |
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
|
4338 |
"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
|
4339 |
|
1911 | 4340 |
nPixel ~~ 0 ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4341 |
self scrollTo:(viewOrigin - (nPixel @ 0)) redraw:true |
1468 | 4342 |
] |
4343 |
||
1911 | 4344 |
"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
|
4345 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4346 |
|
75b8fb924904
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 |
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
|
4348 |
"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
|
4349 |
|
1911 | 4350 |
nPixel ~~ 0 ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4351 |
self scrollTo:(self viewOrigin + (nPixel @ 0)) redraw:true |
1468 | 4352 |
] |
4353 |
||
1911 | 4354 |
"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
|
4355 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4356 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4357 |
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
|
4358 |
"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
|
4359 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4360 |
^ 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
|
4361 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4362 |
|
75b8fb924904
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 |
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
|
4364 |
"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
|
4365 |
|
75b8fb924904
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 |
^ 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
|
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 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4369 |
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
|
4370 |
"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
|
4371 |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4372 |
"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
|
4373 |
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
|
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 |
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
|
4376 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4377 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4378 |
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
|
4379 |
"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
|
4380 |
|
2429
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2427
diff
changeset
|
4381 |
|pxlOffset leftOffset| |
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2427
diff
changeset
|
4382 |
|
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2427
diff
changeset
|
4383 |
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
|
4384 |
|
75b8fb924904
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 |
aColNr == 1 ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4386 |
leftOffset ~~ 0 ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4387 |
self scrollLeft:leftOffset. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4388 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4389 |
^ 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
|
4390 |
]. |
75b8fb924904
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 |
|
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4392 |
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
|
4393 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4394 |
pxlOffset < leftOffset ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4395 |
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
|
4396 |
] ifFalse:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4397 |
pxlOffset > leftOffset ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4398 |
self scrollRight:(pxlOffset - leftOffset) |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4399 |
] |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4400 |
] |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4401 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4402 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4403 |
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
|
4404 |
"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
|
4405 |
|
2429
eed79a96e43b
eliminated accesses to leftOffset
Claus Gittinger <cg@exept.de>
parents:
2427
diff
changeset
|
4406 |
viewOrigin x ~~ 0 ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4407 |
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
|
4408 |
] |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4409 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4410 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4411 |
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
|
4412 |
"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
|
4413 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4414 |
aLineNr < firstLineShown ifTrue:[ |
6342 | 4415 |
self scrollUpLines:(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
|
4416 |
] ifFalse:[ |
6342 | 4417 |
aLineNr > firstLineShown ifTrue:[ |
4418 |
self scrollDownLines:(aLineNr - firstLineShown) |
|
4419 |
] |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4420 |
] |
6342 | 4421 |
|
4422 |
"Modified: / 13-06-2018 / 21:59:44 / Claus Gittinger" |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4423 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4424 |
|
833 | 4425 |
scrollToPercent:percentOrigin |
4426 |
"scroll to a position given in percent of total" |
|
4427 |
||
4428 |
"kludge - ListView thinks in lines" |
|
4429 |
||
4430 |
self scrollHorizontalToPercent:percentOrigin x. |
|
4431 |
self scrollVerticalToPercent:percentOrigin y. |
|
4432 |
! |
|
4433 |
||
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4434 |
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
|
4435 |
"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
|
4436 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4437 |
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
|
4438 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4439 |
|
6342 | 4440 |
scrollUp |
4441 |
"scroll up by one line; |
|
4442 |
this is called (among other) when the scrollbar's |
|
4443 |
scroll-step up button is pressed." |
|
4444 |
||
4445 |
self scrollUpLines:1 |
|
4446 |
||
4447 |
"Created: / 13-06-2018 / 22:41:07 / Claus Gittinger" |
|
4448 |
! |
|
4449 |
||
4450 |
scrollUp:nPixels |
|
4451 |
"change origin to scroll up some pixels |
|
6345 | 4452 |
(towards the top of the text). |
4453 |
Redefined, as this view only allows scrolling in multiples of the line height" |
|
4454 |
||
4455 |
self scrollUpLines:((nPixels + (fontHeight - 1)) // fontHeight) |
|
6342 | 4456 |
|
4457 |
"Modified: / 21-05-1999 / 15:59:45 / cg" |
|
6345 | 4458 |
"Modified (comment): / 14-06-2018 / 11:26:55 / Claus Gittinger" |
6342 | 4459 |
! |
4460 |
||
4461 |
scrollUpLines:nLines |
|
4462 |
"change origin to scroll up some lines |
|
4463 |
(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
|
4464 |
|
1911 | 4465 |
nLines ~~ 0 ifTrue:[ |
6342 | 4466 |
self scrollTo:(viewOrigin - (0 @ (fontHeight * nLines))) |
4467 |
redraw:true |
|
1468 | 4468 |
] |
4469 |
||
6342 | 4470 |
"Created: / 13-06-2018 / 21:57:42 / Claus Gittinger" |
808
0fb219efdfa2
Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents:
798
diff
changeset
|
4471 |
! |
0fb219efdfa2
Add #scrollUpPixel: and #scrollDownPixel: (needed for TableView).
ah
parents:
798
diff
changeset
|
4472 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4473 |
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
|
4474 |
"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
|
4475 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4476 |
|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
|
4477 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4478 |
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
|
4479 |
"/ |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4480 |
"/ 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
|
4481 |
"/ |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4482 |
nFullLinesShown ~~ nLinesShown ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4483 |
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
|
4484 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4485 |
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
|
4486 |
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
|
4487 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4488 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4489 |
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
|
4490 |
"setup for auto-scroll down (when button-press-moving below view) |
5096 | 4491 |
- timeDelta for scroll is computed from distance. |
4492 |
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
|
4493 |
|
6663 | 4494 |
self startAutoScrollVertical:yDistance scrollSelector:#scrollSelectDown. |
5096 | 4495 |
^ 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
|
4496 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4497 |
|
2765
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4498 |
startAutoScrollHorizontal:xDistance scrollSelector:scrollSelector |
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4499 |
"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
|
4500 |
- 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
|
4501 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4502 |
|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
|
4503 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4504 |
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
|
4505 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4506 |
mm := xDistance // self horizontalIntegerPixelPerMillimeter + 1. |
6663 | 4507 |
deltaT := 0.25 / mm. |
4508 |
||
4509 |
true "(deltaT ~= autoScrollDeltaT)" ifTrue:[ |
|
4510 |
autoScrollDeltaT := deltaT. |
|
4511 |
autoScrollBlock isNil ifTrue:[ |
|
4512 |
autoScrollBlock := [ |
|
4513 |
self realized ifTrue:[ |
|
4514 |
self sensor enqueueMessage:scrollSelector for:self |
|
4515 |
] |
|
4516 |
]. |
|
4517 |
Processor addTimedBlock:autoScrollBlock afterSeconds:deltaT |
|
4518 |
] |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4519 |
] |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4520 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4521 |
|
2765
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4522 |
startAutoScrollLeft:xDistance |
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4523 |
"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
|
4524 |
- timeDelta for scroll is computed from distance" |
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4525 |
|
6663 | 4526 |
self startAutoScrollHorizontal:(xDistance negated) scrollSelector:#scrollSelectLeft. |
5096 | 4527 |
^ true |
2765
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4528 |
! |
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4529 |
|
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4530 |
startAutoScrollRight:xDistance |
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4531 |
"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
|
4532 |
- timeDelta for scroll is computed from distance" |
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4533 |
|
6663 | 4534 |
self startAutoScrollHorizontal:xDistance scrollSelector:#scrollSelectRight. |
5096 | 4535 |
^ true |
2765
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4536 |
! |
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4537 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4538 |
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
|
4539 |
"setup for auto-scroll up (when button-press-moving below view) |
5096 | 4540 |
- timeDelta for scroll is computed from distance. |
4541 |
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
|
4542 |
|
6663 | 4543 |
self startAutoScrollVertical:(yDistance negated) scrollSelector:#scrollSelectUp. |
5096 | 4544 |
^ true |
2765
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4545 |
! |
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4546 |
|
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4547 |
startAutoScrollVertical:yDistance scrollSelector:scrollSelector |
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4548 |
"setup for auto-scroll up (when button-press-moving below view) |
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4549 |
- timeDelta for scroll is computed from distance" |
9ff34c678848
scrollSelect stuff refactored
Claus Gittinger <cg@exept.de>
parents:
2752
diff
changeset
|
4550 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4551 |
|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
|
4552 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4553 |
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
|
4554 |
|
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4555 |
mm := (yDistance abs // self verticalIntegerPixelPerMillimeter) + 1. |
6663 | 4556 |
"/ the number of millimeters distance shortens the delaytime |
4557 |
deltaT := 0.25 / mm. |
|
4558 |
||
4559 |
true "(deltaT ~= autoScrollDeltaT)" ifTrue:[ |
|
4560 |
autoScrollDeltaT := deltaT. |
|
4561 |
autoScrollBlock isNil ifTrue:[ |
|
4562 |
autoScrollBlock := [ |
|
4563 |
self realized ifTrue:[ |
|
4564 |
self sensor enqueueMessage:scrollSelector for:self |
|
4565 |
] |
|
4566 |
]. |
|
4567 |
Processor addTimedBlock:autoScrollBlock afterSeconds:deltaT |
|
4568 |
] |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4569 |
] |
4159
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4570 |
|
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4571 |
"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
|
4572 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4573 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4574 |
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
|
4575 |
"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
|
4576 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4577 |
autoScrollBlock notNil ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4578 |
self compressMotionEvents:true. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4579 |
Processor removeTimedBlock:autoScrollBlock. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4580 |
autoScrollBlock := nil. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4581 |
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
|
4582 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4583 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4584 |
|
1910
0d68937d088b
removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents:
1888
diff
changeset
|
4585 |
verticalScrollStep |
0d68937d088b
removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents:
1888
diff
changeset
|
4586 |
"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
|
4587 |
Here, the scrolling unit is lines." |
0d68937d088b
removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents:
1888
diff
changeset
|
4588 |
|
0d68937d088b
removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents:
1888
diff
changeset
|
4589 |
^ 1 |
0d68937d088b
removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents:
1888
diff
changeset
|
4590 |
|
0d68937d088b
removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents:
1888
diff
changeset
|
4591 |
"Created: / 21.5.1999 / 14:00:12 / cg" |
0d68937d088b
removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents:
1888
diff
changeset
|
4592 |
! |
0d68937d088b
removed unneeded scrollUp, scrollDown, scrollLeft & scrollRight
Claus Gittinger <cg@exept.de>
parents:
1888
diff
changeset
|
4593 |
|
249
75b8fb924904
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 |
viewOrigin |
5877 | 4595 |
"return the viewOrigin; |
4596 |
that's the coordinate of the contents 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
|
4597 |
(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
|
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 |
^ 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
|
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 |
|
2316 | 4602 |
!ListView methodsFor:'scrolling-basic'! |
1468 | 4603 |
|
2331
218a017dc1f3
additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents:
2325
diff
changeset
|
4604 |
additionalMarginForHorizontalScroll |
218a017dc1f3
additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents:
2325
diff
changeset
|
4605 |
"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
|
4606 |
width of the document would allow. |
218a017dc1f3
additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents:
2325
diff
changeset
|
4607 |
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
|
4608 |
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
|
4609 |
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
|
4610 |
|
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4611 |
^ gc font width |
2331
218a017dc1f3
additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents:
2325
diff
changeset
|
4612 |
! |
218a017dc1f3
additional scroll-margin can be redefined
Claus Gittinger <cg@exept.de>
parents:
2325
diff
changeset
|
4613 |
|
1468 | 4614 |
scrollTo:anOrigin redraw:doRedraw |
4615 |
"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
|
4616 |
The argument defines the integer device coordinates of the new top-left |
1468 | 4617 |
point. |
4618 |
" |
|
4619 |
|dltOrg |
|
4620 |
noLn "{ Class:SmallInteger }" |
|
4621 |
max "{ Class:SmallInteger }" |
|
4622 |
tmp "{ Class:SmallInteger }" |
|
4623 |
h "{ Class:SmallInteger }" |
|
4624 |
w "{ Class:SmallInteger }" |
|
4625 |
y0 "{ Class:SmallInteger }" |
|
4626 |
y1 "{ Class:SmallInteger }" |
|
4627 |
y "{ Class:SmallInteger }" |
|
1581
71fee652b652
oops - must be careful to not repair damage with
Claus Gittinger <cg@exept.de>
parents:
1579
diff
changeset
|
4628 |
x "{ Class:SmallInteger }" |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4629 |
delta newFirstLine newViewOrigin |
1984 | 4630 |
hBefore wBefore inv wg| |
4631 |
||
4632 |
hBefore := height. |
|
4633 |
wBefore := width. |
|
1468 | 4634 |
|
4635 |
dltOrg := anOrigin - viewOrigin. |
|
4636 |
||
4637 |
"/ compute valid horizontal offset x |
|
4638 |
||
4639 |
(x := dltOrg x) ~~ 0 ifTrue:[ |
|
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4640 |
tmp := viewOrigin x + x. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4641 |
|
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4642 |
x < 0 ifTrue:[ "/ scrolling left |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4643 |
tmp < 0 ifTrue:[x := 0 - viewOrigin x] |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4644 |
] ifFalse:[ "/ scrolling right |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4645 |
"/ allows scrolling to the right of widest line |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4646 |
max := self widthOfContents + (self additionalMarginForHorizontalScroll). |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4647 |
|
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4648 |
tmp + width > max ifTrue:[ |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4649 |
x := (max - viewOrigin x - width) max:0 |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4650 |
] |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4651 |
] |
1468 | 4652 |
]. |
4653 |
||
4654 |
"/ compute valid vertical offset measured in lines |
|
4655 |
||
4656 |
(y := dltOrg y // fontHeight) ~~ 0 ifTrue:[ |
|
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4657 |
tmp := firstLineShown + y. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4658 |
|
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4659 |
y < 0 ifTrue:[ "/ scrolling up |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4660 |
tmp < 1 ifTrue:[y := 1 - firstLineShown] |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4661 |
] ifFalse:[ "/ scrolling down |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4662 |
max := self size. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4663 |
|
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4664 |
tmp + nFullLinesShown > max ifTrue:[ |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4665 |
y := (max - firstLineShown - nFullLinesShown + 1) max:0 |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4666 |
] |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4667 |
] |
1468 | 4668 |
]. |
4669 |
||
1578 | 4670 |
(x == 0 and:[y == 0]) ifTrue:[ "/ has viewOrigin changed ? |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4671 |
^ self |
1468 | 4672 |
]. |
4673 |
||
4674 |
(noLn := y) ~~ 0 ifTrue:[ |
|
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4675 |
y := y * fontHeight |
1468 | 4676 |
]. |
1581
71fee652b652
oops - must be careful to not repair damage with
Claus Gittinger <cg@exept.de>
parents:
1579
diff
changeset
|
4677 |
delta := (x @ y). |
1468 | 4678 |
|
1582 | 4679 |
newFirstLine := firstLineShown + noLn. |
4680 |
newViewOrigin := viewOrigin + delta. |
|
4681 |
||
1468 | 4682 |
(shown and:[doRedraw]) ifFalse:[ |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4683 |
self originWillChange. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4684 |
firstLineShown := newFirstLine. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4685 |
viewOrigin := newViewOrigin. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4686 |
self assert:(viewOrigin x >= 0). |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4687 |
^ self originChanged:delta |
1468 | 4688 |
]. |
4689 |
||
1578 | 4690 |
"/ (self sensor notNil and: [self sensor hasExposeEventFor:self]) ifTrue:[ "/ outstanding expose events |
4691 |
"/ self invalidate. "/ redraw all |
|
4692 |
"/ self originWillChange. |
|
4693 |
"/ ^ self originChanged:(x @ y ) |
|
4694 |
"/ ]. |
|
1468 | 4695 |
|
1984 | 4696 |
( (y ~~ 0 and:[x ~~ 0]) "/ both x and y changed |
4697 |
or:[(noLn abs) >= nLinesShown "/ at least one area is |
|
4698 |
or:[(x abs) > (width // 4 * 3)]] "/ big enough to redraw all |
|
1468 | 4699 |
) ifTrue:[ |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4700 |
self originWillChange. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4701 |
firstLineShown := newFirstLine. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4702 |
viewOrigin := newViewOrigin. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4703 |
self invalidate. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4704 |
^ self originChanged:delta |
1468 | 4705 |
]. |
4706 |
||
1726 | 4707 |
"/ OLD: |
4708 |
"/ self repairDamage. |
|
1969
69d9c43db5e9
scrolling - again (added a device sync)
Claus Gittinger <cg@exept.de>
parents:
1964
diff
changeset
|
4709 |
|
1730 | 4710 |
(wg := self windowGroup) notNil ifTrue:[ |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4711 |
wg processRealExposeEventsFor:self. |
1730 | 4712 |
]. |
1578 | 4713 |
|
4714 |
self originWillChange. |
|
1970 | 4715 |
|
4716 |
"/ make certain, that all drawing is complete |
|
1984 | 4717 |
"/ device sync. |
4718 |
||
1975
0eda51a6d48e
uff - scroll bug (must catch BEFORE changing viewOrigin)
Claus Gittinger <cg@exept.de>
parents:
1972
diff
changeset
|
4719 |
self catchExpose. |
1970 | 4720 |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4721 |
x == 0 ifTrue:[ |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4722 |
"/ scrolling vertical |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4723 |
|
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4724 |
y0 := textStartTop + (y abs). |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4725 |
h := hBefore - margin - y0. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4726 |
w := wBefore - margin. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4727 |
y > 0 ifTrue:[ "/ copy down |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4728 |
"/ kludge: if the selection highlighting draws into the textStartTop area, |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4729 |
"/ the copy below leaves some selection depris in the top area. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4730 |
"/ Therefore, clear the top area. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4731 |
"/ (should avoid this, in case we know there cannot be anything |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4732 |
"/ there - selection is nil or >= firstLineShown). |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4733 |
self clearDeviceRectangleX:margin y:margin width:width-margin-margin height:(textStartTop-margin). |
1983 | 4734 |
"/ self invalidateDeviceRectangle:((margin@margin) corner:(width-margin@textStartTop)) repairNow:false. |
1977 | 4735 |
|
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4736 |
self copyFrom:self |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4737 |
x:0 y:y0 toX:0 y:textStartTop |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4738 |
width:w height:h async:true. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4739 |
y1 := h - 1. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4740 |
y0 := y0 + 1. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4741 |
] ifFalse:[ "/ copy up |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4742 |
self copyFrom:self |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4743 |
x:margin y:textStartTop toX:margin y:y0 |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4744 |
width:w height:h async:true. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4745 |
y1 := 0. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4746 |
]. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4747 |
|
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4748 |
inv := (margin@y1) extent:(w@y0+margin). |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4749 |
] ifFalse:[ |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4750 |
"/ scrolling horizontal |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4751 |
|
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4752 |
x > 0 ifTrue:[ "/ scrolling right |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4753 |
y0 := margin + x. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4754 |
y1 := wBefore - y0. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4755 |
] ifFalse:[ "/ scrolling left |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4756 |
y0 := margin - x. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4757 |
y1 := 0. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4758 |
]. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4759 |
h := hBefore - margin - margin. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4760 |
w := wBefore - margin - y0. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4761 |
|
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4762 |
x > 0 ifTrue:[ "/ copy right |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4763 |
self copyFrom:self x:y0 y:margin toX:margin y:margin |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4764 |
width:w height:h async:true. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4765 |
] ifFalse:[ "/ copy left |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4766 |
"/ self copyFrom:self x:textStartLeft y:margin toX:y0 y:margin |
4603 | 4767 |
"/ viewOrigin x > margin ifTrue:[ |
4768 |
"/ self copyFrom:self x:0 y:margin toX:y0-margin y:margin |
|
4769 |
"/ width:w height:h async:true. |
|
4770 |
"/ ] ifFalse:[ |
|
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4771 |
self copyFrom:self x:margin y:margin toX:y0 y:margin |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4772 |
width:w height:h async:true. |
4603 | 4773 |
"/ ]. |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4774 |
]. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4775 |
|
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4776 |
inv := (y1@margin) extent:(y0@h). |
1468 | 4777 |
]. |
4778 |
||
1984 | 4779 |
firstLineShown := newFirstLine. |
4780 |
viewOrigin := newViewOrigin. |
|
1969
69d9c43db5e9
scrolling - again (added a device sync)
Claus Gittinger <cg@exept.de>
parents:
1964
diff
changeset
|
4781 |
|
1885 | 4782 |
self invalidateDeviceRectangle:inv repairNow:false. |
4603 | 4783 |
viewOrigin x <= margin ifTrue:[ |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4784 |
self invalidateDeviceRectangle:((0@margin) extent:(margin@h)) repairNow:false. |
4603 | 4785 |
]. |
1712
cb753ba02fb4
remember old width/height before doing a repairDamage
Claus Gittinger <cg@exept.de>
parents:
1700
diff
changeset
|
4786 |
|
1975
0eda51a6d48e
uff - scroll bug (must catch BEFORE changing viewOrigin)
Claus Gittinger <cg@exept.de>
parents:
1972
diff
changeset
|
4787 |
self originChanged:delta. |
1969
69d9c43db5e9
scrolling - again (added a device sync)
Claus Gittinger <cg@exept.de>
parents:
1964
diff
changeset
|
4788 |
self waitForExpose. |
1726 | 4789 |
|
2202
edf8821d56a1
synchronous redraw after a scroll
Claus Gittinger <cg@exept.de>
parents:
2199
diff
changeset
|
4790 |
(wg := self windowGroup) notNil ifTrue:[ |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4791 |
wg processRealExposeEventsFor:self. |
2202
edf8821d56a1
synchronous redraw after a scroll
Claus Gittinger <cg@exept.de>
parents:
2199
diff
changeset
|
4792 |
]. |
edf8821d56a1
synchronous redraw after a scroll
Claus Gittinger <cg@exept.de>
parents:
2199
diff
changeset
|
4793 |
|
1984 | 4794 |
"/ (hBefore ~= height or:[wBefore ~= width]) ifTrue:[ |
4795 |
"/ self halt. |
|
4796 |
"/ ]. |
|
4797 |
||
4159
3032a5a9d8de
comment and warning in documentation
Claus Gittinger <cg@exept.de>
parents:
4070
diff
changeset
|
4798 |
"Modified: / 08-08-2010 / 11:14:09 / cg" |
1468 | 4799 |
! ! |
4800 |
||
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4801 |
!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
|
4802 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4803 |
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
|
4804 |
"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
|
4805 |
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
|
4806 |
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
|
4807 |
|
75b8fb924904
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 |
|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
|
4809 |
|
75b8fb924904
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 |
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
|
4811 |
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
|
4812 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4813 |
"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
|
4814 |
(wordCheck value:thisCharacter) ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4815 |
[wordCheck value:thisCharacter] whileTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4816 |
beginCol := beginCol - 1. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4817 |
beginCol < 1 ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4818 |
^ 1 |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4819 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4820 |
thisCharacter := self characterAtLine:selectLine col:beginCol |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4821 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4822 |
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
|
4823 |
] ifFalse:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4824 |
"nope - maybe its a space" |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4825 |
thisCharacter == Character space ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4826 |
[beginCol > 1 and:[thisCharacter == Character space]] whileTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4827 |
beginCol := beginCol - 1. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4828 |
thisCharacter := self characterAtLine:selectLine col:beginCol |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4829 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4830 |
thisCharacter ~~ Character space ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4831 |
beginCol := beginCol + 1. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4832 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4833 |
] ifFalse:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4834 |
"select single character" |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4835 |
] |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4836 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4837 |
^ 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
|
4838 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4839 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4840 |
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
|
4841 |
"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
|
4842 |
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
|
4843 |
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
|
4844 |
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
|
4845 |
|
770
a41466e3dfaa
use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents:
721
diff
changeset
|
4846 |
|endCol "{ Class: SmallInteger }" |
a41466e3dfaa
use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents:
721
diff
changeset
|
4847 |
len "{ Class: SmallInteger }" |
a41466e3dfaa
use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents:
721
diff
changeset
|
4848 |
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
|
4849 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4850 |
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
|
4851 |
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
|
4852 |
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
|
4853 |
|
2900 | 4854 |
len := (self listAt:selectLine) size. |
4855 |
||
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4856 |
"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
|
4857 |
(wordCheck value:thisCharacter) ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4858 |
[wordCheck value:thisCharacter] whileTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4859 |
endCol := endCol + 1. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4860 |
endCol > len ifTrue:[ ^ len ]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4861 |
thisCharacter := self characterAtLine:selectLine col:endCol |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4862 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4863 |
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
|
4864 |
] ifFalse:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4865 |
"nope - maybe its a space" |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4866 |
thisCharacter == Character space ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4867 |
endCol > len ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4868 |
"select rest to end" |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4869 |
endCol := 0 |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4870 |
] ifFalse:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4871 |
thisCharacter := self characterAtLine:selectLine col:endCol. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4872 |
[endCol <= len and:[thisCharacter == Character space]] whileTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4873 |
endCol := endCol + 1. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4874 |
thisCharacter := self characterAtLine:selectLine col:endCol |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4875 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4876 |
endCol := endCol - 1. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4877 |
] |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4878 |
] ifFalse:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4879 |
"select single character" |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4880 |
] |
125 | 4881 |
]. |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4882 |
^ 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
|
4883 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4884 |
|
1325 | 4885 |
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
|
4886 |
"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
|
4887 |
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
|
4888 |
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
|
4889 |
|
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4890 |
^ self |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4891 |
searchBackwardUsingSpec:(SearchSpec new |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4892 |
pattern:pattern |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4893 |
ignoreCase:ignCase |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4894 |
match:false) |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4895 |
startingAtLine:startLine col:startCol |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
4896 |
ifFound:block1 ifAbsent:block2 |
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4897 |
! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4898 |
|
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4899 |
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
|
4900 |
"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
|
4901 |
found evaluate block2. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4902 |
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
|
4903 |
|
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4904 |
^ self |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4905 |
searchBackwardFor:pattern |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4906 |
ignoreCase:false |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4907 |
startingAtLine:startLine col:startCol |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4908 |
ifFound:block1 |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4909 |
ifAbsent:block2 |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4910 |
|
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4911 |
"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
|
4912 |
! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4913 |
|
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4914 |
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
|
4915 |
"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
|
4916 |
found evaluate block2. |
5546 | 4917 |
Sorry, but pattern is no regular expression pattern (yet). |
4918 |
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
|
4919 |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4920 |
|lineString |
6429 | 4921 |
pattern ignCase match fullWord atBeginOfLineOnly atEndOfLineOnly |
4444 | 4922 |
found firstChar1 firstChar2 c pc col1 |
770
a41466e3dfaa
use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents:
721
diff
changeset
|
4923 |
col "{ Class: SmallInteger }" |
a41466e3dfaa
use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents:
721
diff
changeset
|
4924 |
cc "{ Class: SmallInteger }" |
a41466e3dfaa
use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents:
721
diff
changeset
|
4925 |
patternSize "{ Class: SmallInteger }" |
a41466e3dfaa
use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents:
721
diff
changeset
|
4926 |
line1 "{ Class: SmallInteger }" |
a41466e3dfaa
use integer typed variables for compact code
Claus Gittinger <cg@exept.de>
parents:
721
diff
changeset
|
4927 |
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
|
4928 |
|
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4929 |
pattern := searchSpec pattern. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4930 |
ignCase := searchSpec ignoreCase. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4931 |
match := searchSpec match. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4932 |
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
|
4933 |
fullWord := searchSpec fullWord. |
5076 | 4934 |
atBeginOfLineOnly := searchSpec atBeginOfLineOnly. |
6429 | 4935 |
atEndOfLineOnly := searchSpec atEndOfLineOnly. |
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
4936 |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
4937 |
patternSize := pattern size. |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4938 |
(list notNil |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4939 |
and:[startLine > 0 |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
4940 |
and:[patternSize ~~ 0]]) |
2508
5bf86df079c9
backward search without inital line
Claus Gittinger <cg@exept.de>
parents:
2455
diff
changeset
|
4941 |
ifTrue:[ |
6429 | 4942 |
self withCursor:Cursor questionMark do:[ |
4943 |
col := startCol - 1. |
|
4944 |
firstChar1 := pattern at:1. |
|
4945 |
ignCase ifTrue:[ |
|
4946 |
firstChar1 := firstChar1 asLowercase. |
|
4947 |
firstChar2 := firstChar1 asUppercase. |
|
4948 |
] ifFalse:[ |
|
4949 |
firstChar2 := firstChar1 |
|
4950 |
]. |
|
4951 |
||
4952 |
line1 := startLine. |
|
4953 |
line1 > list size ifTrue:[ |
|
4954 |
line1 := list size. |
|
4955 |
col := -999 |
|
4956 |
] ifFalse:[ |
|
4957 |
col > (list at:line1) size ifTrue:[ |
|
4958 |
col := -999 |
|
4959 |
] |
|
4960 |
]. |
|
4961 |
line1 to:1 by:-1 do:[:lnr | |
|
4962 |
lineString := list at:lnr. |
|
4963 |
lineString notNil ifTrue:[ |
|
4964 |
lineString := lineString asString. |
|
4965 |
lineString isString ifTrue:[ |
|
4966 |
"/ quick check if pattern is present |
|
4967 |
col1 := lineString |
|
4968 |
findString:pattern startingAt:1 |
|
4969 |
ifAbsent:0 caseSensitive: ignCase not. |
|
4970 |
col1 ~~ 0 ifTrue:[ |
|
4971 |
lineSize := lineString size. |
|
4972 |
col == -999 ifTrue:[col := lineSize - patternSize + 1]. |
|
4973 |
[(col > 0) |
|
4974 |
and:[(c := lineString at:col) ~= firstChar1 |
|
4975 |
and:[c ~= firstChar2]]] whileTrue:[ |
|
4976 |
col := col - 1 |
|
4977 |
]. |
|
4978 |
[col > 0] whileTrue:[ |
|
4979 |
cc := col. |
|
4980 |
found := true. |
|
4981 |
1 to:patternSize do:[:cnr | |
|
4982 |
cc > lineSize ifTrue:[ |
|
4983 |
found := false |
|
4984 |
] ifFalse:[ |
|
4985 |
pc := pattern at:cnr. |
|
4986 |
c := lineString at:cc. |
|
4987 |
pc ~= c ifTrue:[ |
|
4988 |
(ignCase not or:[pc asLowercase ~= c asLowercase]) ifTrue:[ |
|
4989 |
found := false |
|
4990 |
] |
|
4991 |
] |
|
4992 |
]. |
|
4993 |
cc := cc + 1 |
|
4994 |
]. |
|
4995 |
found ifTrue:[ |
|
4996 |
(fullWord not |
|
4997 |
or:[ (self findBeginOfWordAtLine:lnr col:col) == col |
|
4998 |
and:[ (self findEndOfWordAtLine:lnr col:col) == (col + patternSize - 1) ]] |
|
4999 |
) ifTrue:[ |
|
5000 |
(atBeginOfLineOnly not or:[col == 1]) ifTrue:[ |
|
5001 |
(atEndOfLineOnly not or:[(col + patternSize - 1) >= lineSize]) ifTrue:[ |
|
5002 |
^ block1 value:lnr value:col optionalArgument:nil. |
|
5003 |
] |
|
5004 |
] |
|
5005 |
] |
|
5006 |
]. |
|
5007 |
col := col - 1. |
|
5008 |
[(col > 0) |
|
5009 |
and:[(c := lineString at:col) ~= firstChar1 |
|
5010 |
and:[c ~= firstChar2]]] whileTrue:[ |
|
5011 |
col := col - 1 |
|
5012 |
] |
|
5013 |
] |
|
5014 |
] |
|
5015 |
]. |
|
5016 |
]. |
|
5017 |
col := -999. |
|
5018 |
] |
|
5019 |
] |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5020 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5021 |
"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
|
5022 |
|
75b8fb924904
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 |
^ block2 value |
386
514f73e07c2d
more 16bit fixes (compare chars using = / ~= instead of == / ~=)
Claus Gittinger <cg@exept.de>
parents:
383
diff
changeset
|
5024 |
|
4444 | 5025 |
"Created: / 13-09-1997 / 01:06:19 / cg" |
5026 |
"Modified: / 05-08-2012 / 12:16:31 / cg" |
|
6429 | 5027 |
"Modified: / 13-09-2018 / 10:07:29 / Claus Gittinger" |
249
75b8fb924904
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 |
|
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5030 |
searchForwardFor:pattern ignoreCase:ignCase match:match startingAtLine:startLine col:startCol ifFound:block1 ifAbsent:block2 |
1325 | 5031 |
"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
|
5032 |
found evaluate block2." |
1325 | 5033 |
|
5034 |
^ self |
|
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
5035 |
searchForwardUsingSpec:(SearchSpec new |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
5036 |
pattern:pattern |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
5037 |
ignoreCase:ignCase |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
5038 |
match:match) |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
5039 |
startingAtLine:startLine col:startCol |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
5040 |
ifFound:block1 ifAbsent:block2 |
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5041 |
! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5042 |
|
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5043 |
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
|
5044 |
"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
|
5045 |
found evaluate block2." |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5046 |
|
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5047 |
^ 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
|
5048 |
! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5049 |
|
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5050 |
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
|
5051 |
"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
|
5052 |
found evaluate block2." |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5053 |
|
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5054 |
^ self |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5055 |
searchForwardFor:pattern |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5056 |
ignoreCase:false |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5057 |
startingAtLine:startLine col:startCol |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5058 |
ifFound:block1 |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5059 |
ifAbsent:block2 |
1325 | 5060 |
|
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5061 |
"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
|
5062 |
! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5063 |
|
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5064 |
searchForwardUsingSpec:searchSpec startingAtLine:startLine col:startCol ifFound:block1 ifAbsent:block2 |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
5065 |
"search for a pattern, if found evaluate block1 with row/col as arguments, |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
5066 |
if not found evaluate block2. |
5715 | 5067 |
If the block is a three-arg block, it gets the end-col (or nil, if not known)" |
5546 | 5068 |
|
6429 | 5069 |
|lineString col pattern match regexMatch ignCase fullWord atBeginOfLineOnly atEndOfLineOnly |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
5070 |
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
|
5071 |
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
|
5072 |
line2 "{Class: SmallInteger}" |
5546 | 5073 |
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
|
5074 |
|
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5075 |
pattern := searchSpec pattern. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5076 |
match := searchSpec match. |
5546 | 5077 |
regexMatch := searchSpec regexMatch. |
5715 | 5078 |
(match and:[regexMatch not]) ifTrue:[ |
6214 | 5079 |
pattern := pattern globPatternAsRegexPattern. |
5080 |
regexMatch := true. |
|
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
5081 |
]. |
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5082 |
ignCase := searchSpec ignoreCase. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5083 |
fullWord := searchSpec fullWord. |
5076 | 5084 |
atBeginOfLineOnly := searchSpec atBeginOfLineOnly. |
6429 | 5085 |
atEndOfLineOnly := searchSpec atEndOfLineOnly. |
5546 | 5086 |
wrapAtEndOfText := searchSpec wrapAtEndOfText. |
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5087 |
|
249
75b8fb924904
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 |
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
|
5089 |
(list notNil and:[patternSize ~~ 0]) ifTrue:[ |
6214 | 5090 |
self withCursor:Cursor questionMark do:[ |
5091 |
||
5092 |
col := startCol + 1. |
|
5093 |
line1 := startLine. |
|
5094 |
line2 := list size. |
|
5095 |
||
5096 |
"/ call searchBlock with lnr, col, and line. Cares for wrap |
|
5097 |
runner := |
|
5098 |
[:searchBlock | |
|
5099 |
|didWrap| |
|
5100 |
||
5101 |
lnr := line1. |
|
5102 |
didWrap := false. |
|
5103 |
[lnr <= line2] whileTrue:[ |
|
5104 |
lineString := list at:lnr. |
|
5105 |
lineString notNil ifTrue:[ |
|
5106 |
lineString := lineString asString string. |
|
5107 |
lineString isString ifTrue:[ |
|
5108 |
searchBlock value:lnr value:col value:lineString |
|
5109 |
] |
|
5110 |
]. |
|
5111 |
col := 1. |
|
5112 |
lnr := lnr + 1. |
|
5113 |
lnr > line2 ifTrue:[ |
|
5114 |
(wrapAtEndOfText and:[didWrap not]) ifTrue:[ |
|
5115 |
didWrap := true. |
|
5116 |
lnr := 1. |
|
5117 |
line2 := line1-1. |
|
5118 |
]. |
|
5119 |
]. |
|
5120 |
]. |
|
5121 |
||
5122 |
]. |
|
5123 |
||
5124 |
(match and:[regexMatch]) ifTrue:[ |
|
5125 |
"perform a findMatchString (regex matching)" |
|
5126 |
Regex::RxParser isNil ifTrue:[ |
|
5127 |
Smalltalk loadPackage:'stx:goodies/regex' |
|
5128 |
]. |
|
5129 |
matcher := ignCase ifTrue:[pattern asRegexIgnoringCase] ifFalse:[pattern asRegex]. |
|
5130 |
runner value:[:lnr :col :lineString | |
|
5131 |
|lineStream| |
|
5132 |
||
6397 | 5133 |
lineStream := lineString readStream. |
5134 |
lineStream position:(col-1 min:lineString size). |
|
6214 | 5135 |
"/ find which match to show |
5136 |
(matcher searchStream:lineStream) ifTrue:[ |
|
5137 |
foundCol := matcher subBeginning:1. |
|
5138 |
endCol := matcher subEnd:1. |
|
5139 |
(foundCol notNil and: [endCol notNil]) ifTrue: [ |
|
5140 |
foundCol := foundCol + 1. "/ regex uses 0-based indexes (sigh) |
|
5141 |
(atBeginOfLineOnly not or:[foundCol == 1]) ifTrue:[ |
|
6429 | 5142 |
(atEndOfLineOnly not or:[endCol >= lineString size]) ifTrue:[ |
5143 |
^ block1 value:lnr value:foundCol optionalArgument:endCol. |
|
5144 |
] |
|
6214 | 5145 |
] |
5146 |
] |
|
5147 |
] |
|
5148 |
]. |
|
5149 |
] ifFalse:[ |
|
5150 |
(match and:[pattern includesUnescapedMatchCharacters]) ifTrue:[ |
|
5151 |
"perform a findMatchString (glob matching)" |
|
5152 |
p := pattern species new:0. |
|
5153 |
(pattern startsWith:$*) ifFalse:[p := p , '*']. |
|
5154 |
p := p , pattern. |
|
5155 |
(pattern endsWith:$*) ifFalse:[p := p , '*']. |
|
5156 |
realPattern := pattern. |
|
5157 |
(realPattern startsWith:$*) ifTrue:[ |
|
5158 |
realPattern := realPattern copyFrom:2 |
|
5159 |
]. |
|
5160 |
runner value:[:lnr :col :lineString | |
|
5161 |
(p match:lineString caseSensitive:ignCase not) ifTrue:[ |
|
5162 |
"/ ok, there it is; look at which position |
|
5163 |
foundCol := lineString |
|
5164 |
findMatchString:realPattern startingAt:col |
|
5165 |
caseSensitive:ignCase not ifAbsent:0. |
|
5166 |
foundCol ~~ 0 ifTrue:[ |
|
5167 |
(atBeginOfLineOnly not or:[foundCol == 1]) ifTrue:[ |
|
6429 | 5168 |
(atEndOfLineOnly not or:[(foundCol+p size) >= lineString size]) ifTrue:[ |
5169 |
^ block1 value:lnr value:foundCol optionalArgument:nil. |
|
5170 |
]]]] |
|
6214 | 5171 |
]. |
5172 |
] ifFalse:[ |
|
5173 |
"perform a findString (no matching)" |
|
5174 |
p := pattern. |
|
5175 |
(match and:[pattern includesMatchCharacters]) ifTrue:[ |
|
5176 |
p := pattern withoutMatchEscapes |
|
5177 |
]. |
|
5178 |
runner |
|
5179 |
value:[:lnr :col :lineString | |
|
5180 |
foundCol := lineString |
|
5181 |
findString:p startingAt:col ifAbsent:0 caseSensitive: ignCase not. |
|
5182 |
foundCol ~~ 0 ifTrue:[ |
|
5183 |
(fullWord not |
|
5184 |
or:[ (self findBeginOfWordAtLine:lnr col:foundCol) == foundCol |
|
5185 |
and:[ (self findEndOfWordAtLine:lnr col:foundCol) == (foundCol + patternSize - 1) ]] |
|
5186 |
) ifTrue:[ |
|
5187 |
(atBeginOfLineOnly not or:[foundCol == 1]) ifTrue:[ |
|
6429 | 5188 |
atEndOfLineOnly ifTrue:[ |
5189 |
(lineString endsWith:p caseSensitive:ignCase not) ifTrue:[ |
|
5190 |
^ block1 value:lnr value:(lineString size - p size + 1) optionalArgument:nil. |
|
5191 |
]. |
|
5192 |
] ifFalse:[ |
|
5193 |
^ block1 value:lnr value:foundCol optionalArgument:nil. |
|
5194 |
] |
|
6214 | 5195 |
] |
5196 |
] |
|
5197 |
] |
|
5198 |
]. |
|
5199 |
]. |
|
5200 |
]. |
|
5201 |
] |
|
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5202 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5203 |
"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
|
5204 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5205 |
^ block2 value |
403
ee8f6d080077
preserve cursor (error while searching)
Claus Gittinger <cg@exept.de>
parents:
394
diff
changeset
|
5206 |
|
4444 | 5207 |
"Created: / 13-09-1997 / 01:06:31 / cg" |
5208 |
"Modified: / 05-08-2012 / 12:22:42 / cg" |
|
6214 | 5209 |
"Modified (format): / 12-10-2017 / 18:35:55 / stefan" |
6429 | 5210 |
"Modified: / 13-09-2018 / 10:20:55 / Claus Gittinger" |
1325 | 5211 |
! |
5212 |
||
3564 | 5213 |
standardWordCheck:char |
4403 | 5214 |
"the wordCheck is a predicate which returns true if the given character |
5215 |
belongs to the (textual) word. Used with double click to select a word. |
|
5216 |
When editing code, typically characters which are part of an identifier |
|
5217 |
are part of a word (underline, dollar, but no other non-letters). |
|
5218 |
The standardWordCheck aks the current userPreferences for details." |
|
5219 |
||
5220 |
|prefs| |
|
5221 |
||
5222 |
(prefs := UserPreferences current) whitespaceWordSelectMode ifTrue:[ |
|
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
5223 |
"an extremely simple mode, where every non-space is treated as part of the word" |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
5224 |
^ char isSeparator not |
3564 | 5225 |
]. |
4403 | 5226 |
prefs extendedWordSelectMode ifTrue:[ |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
5227 |
"the typical mode, useful for text and code" |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
5228 |
^ char isNationalAlphaNumeric or:[char == $_] |
3564 | 5229 |
]. |
4403 | 5230 |
"another typical mode, also useful for text and code" |
3564 | 5231 |
^ char isNationalAlphaNumeric |
4403 | 5232 |
|
5233 |
"Modified (comment): / 17-03-2012 / 19:04:13 / cg" |
|
0 | 5234 |
! ! |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5235 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5236 |
!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
|
5237 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5238 |
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
|
5239 |
"go through whole text expanding tabs into spaces. |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5240 |
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
|
5241 |
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
|
5242 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5243 |
|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
|
5244 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5245 |
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
|
5246 |
list notNil ifTrue:[ |
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
5247 |
nLines := self size. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
5248 |
1 to:nLines do:[:index | |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
5249 |
line := self at:index. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
5250 |
line notNil ifTrue:[ |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
5251 |
(line isString) ifTrue:[ |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
5252 |
newLine := line withTabsExpanded. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
5253 |
newLine ~~ line ifTrue:[ |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
5254 |
list at:index put:newLine |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
5255 |
]. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
5256 |
] ifFalse:[ |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
5257 |
includesNonStrings := true. |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
5258 |
] |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
5259 |
] |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
5260 |
] |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5261 |
] |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5262 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5263 |
"Modified: 30.8.1995 / 19:06:37 / claus" |
627 | 5264 |
"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
|
5265 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5266 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5267 |
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
|
5268 |
"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
|
5269 |
|
3151
fc183d8ff88c
next-tab: fallback to mod-8 tabs if beyond tab-list
Claus Gittinger <cg@exept.de>
parents:
3150
diff
changeset
|
5270 |
^ 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
|
5271 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5272 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5273 |
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
|
5274 |
"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
|
5275 |
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
|
5276 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5277 |
|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
|
5278 |
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
|
5279 |
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
|
5280 |
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
|
5281 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5282 |
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
|
5283 |
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
|
5284 |
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
|
5285 |
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
|
5286 |
[thisTab <= col] whileTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5287 |
(tabIndex == nTabs) ifTrue:[ |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5288 |
"/ fallback to mod-8 tabs if beyond tab-list. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5289 |
thisTab := col + 1. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5290 |
thisTab := thisTab + (8 - (thisTab \\ 8)). |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5291 |
^ thisTab |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5292 |
]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5293 |
tabIndex := tabIndex + 1. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5294 |
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
|
5295 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5296 |
^ 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
|
5297 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5298 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5299 |
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
|
5300 |
"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
|
5301 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5302 |
|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
|
5303 |
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
|
5304 |
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
|
5305 |
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
|
5306 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5307 |
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
|
5308 |
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
|
5309 |
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
|
5310 |
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
|
5311 |
[thisTab < col] whileTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5312 |
(tabIndex == nTabs) ifTrue:[^ thisTab]. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5313 |
tabIndex := tabIndex + 1. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5314 |
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
|
5315 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5316 |
(tabIndex == 1) ifTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5317 |
^ 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
|
5318 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5319 |
^ 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
|
5320 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5321 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5322 |
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
|
5323 |
"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
|
5324 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5325 |
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
|
5326 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5327 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5328 |
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
|
5329 |
"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
|
5330 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5331 |
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
|
5332 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5333 |
|
2378 | 5334 |
setTabPositions:aVector |
5335 |
"set tab stops" |
|
5336 |
||
5337 |
tabPositions := aVector. |
|
5338 |
! |
|
5339 |
||
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5340 |
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
|
5341 |
"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
|
5342 |
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
|
5343 |
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
|
5344 |
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
|
5345 |
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
|
5346 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5347 |
|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
|
5348 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5349 |
" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5350 |
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
|
5351 |
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
|
5352 |
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
|
5353 |
" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5354 |
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
|
5355 |
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
|
5356 |
(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
|
5357 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5358 |
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
|
5359 |
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
|
5360 |
[newLine startsWith:eightSpaces] whileTrue:[ |
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5361 |
newLine := newLine copyFrom:9. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5362 |
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
|
5363 |
]. |
386
514f73e07c2d
more 16bit fixes (compare chars using = / ~= instead of == / ~=)
Claus Gittinger <cg@exept.de>
parents:
383
diff
changeset
|
5364 |
^ (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
|
5365 |
|
514f73e07c2d
more 16bit fixes (compare chars using = / ~= instead of == / ~=)
Claus Gittinger <cg@exept.de>
parents:
383
diff
changeset
|
5366 |
"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
|
5367 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5368 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5369 |
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
|
5370 |
"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
|
5371 |
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
|
5372 |
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
|
5373 |
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
|
5374 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5375 |
|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
|
5376 |
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
|
5377 |
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
|
5378 |
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
|
5379 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5380 |
" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5381 |
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
|
5382 |
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
|
5383 |
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
|
5384 |
(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
|
5385 |
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
|
5386 |
" |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5387 |
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
|
5388 |
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
|
5389 |
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
|
5390 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5391 |
currentMax := line size + (nTabs * 7). |
386
514f73e07c2d
more 16bit fixes (compare chars using = / ~= instead of == / ~=)
Claus Gittinger <cg@exept.de>
parents:
383
diff
changeset
|
5392 |
tmpString := line species new:currentMax. |
6582 | 5393 |
"/ hack/kludge: Text new will not create a wide string. |
5394 |
tmpString isText ifTrue:[ |
|
6592 | 5395 |
tmpString := tmpString asStringWithBitsPerCharacterAtLeast:line string bitsPerCharacter. |
6582 | 5396 |
]. |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5397 |
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
|
5398 |
line do:[:character | |
6522 | 5399 |
(character == (Character tab)) ifTrue:[ |
5400 |
nextTab := self nextTabAfter:dstIndex in:tabulatorTable. |
|
5401 |
tmpString size < nextTab ifTrue:[ |
|
5402 |
currentMax := currentMax * 2. |
|
5403 |
nString := line species new:currentMax. |
|
5404 |
nString replaceFrom:1 to:(dstIndex - 1) with:tmpString startingAt:1. |
|
5405 |
tmpString := nString. |
|
5406 |
nString := nil |
|
5407 |
]. |
|
5408 |
[dstIndex < nextTab] whileTrue:[ |
|
5409 |
tmpString at:dstIndex put:(Character space). |
|
5410 |
dstIndex := dstIndex + 1 |
|
5411 |
] |
|
5412 |
] ifFalse:[ |
|
5413 |
tmpString at:dstIndex put:character. |
|
5414 |
dstIndex := dstIndex + 1 |
|
5415 |
]. |
|
5416 |
(dstIndex > currentMax) ifTrue:[ |
|
5417 |
" |
|
5418 |
this cannot happen with <= 8 tabs |
|
5419 |
" |
|
5420 |
currentMax := currentMax * 2. |
|
5421 |
nString := line species new:currentMax. |
|
5422 |
nString replaceFrom:1 to:(dstIndex - 1) with:tmpString startingAt:1. |
|
5423 |
tmpString := nString. |
|
5424 |
nString := nil |
|
5425 |
]. |
|
5426 |
||
5427 |
"make stc-optimizer happy |
|
5428 |
- no need to return value of ifTrue:/ifFalse above" |
|
5429 |
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
|
5430 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5431 |
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
|
5432 |
dstIndex == currentMax ifTrue:[ |
6522 | 5433 |
^ 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
|
5434 |
]. |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5435 |
^ tmpString copyTo:dstIndex |
386
514f73e07c2d
more 16bit fixes (compare chars using = / ~= instead of == / ~=)
Claus Gittinger <cg@exept.de>
parents:
383
diff
changeset
|
5436 |
|
6522 | 5437 |
"Modified: / 23-02-1996 / 19:11:01 / cg" |
6592 | 5438 |
"Modified: / 04-06-2019 / 12:30:55 / Claus Gittinger" |
249
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5439 |
! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5440 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5441 |
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
|
5442 |
"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
|
5443 |
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
|
5444 |
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
|
5445 |
|
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5446 |
^ 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
|
5447 |
! ! |
75b8fb924904
draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents:
236
diff
changeset
|
5448 |
|
3869
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5449 |
!ListView::HighlightArea methodsFor:'accessing'! |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5450 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5451 |
endCol |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5452 |
^ endCol |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5453 |
! |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5454 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5455 |
endCol:something |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5456 |
endCol := something. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5457 |
! |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5458 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5459 |
endLine |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5460 |
^ endLine |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5461 |
! |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5462 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5463 |
endLine:something |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5464 |
endLine := something. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5465 |
! |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5466 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5467 |
startCol |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5468 |
^ startCol |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5469 |
! |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5470 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5471 |
startCol:something |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5472 |
startCol := something. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5473 |
! |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5474 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5475 |
startLine |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5476 |
^ startLine |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5477 |
! |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5478 |
|
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5479 |
startLine:something |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5480 |
startLine := something. |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5481 |
! ! |
82b87c5ae995
preps for multiple highlightAreas
Claus Gittinger <cg@exept.de>
parents:
3854
diff
changeset
|
5482 |
|
6239 | 5483 |
!ListView::HighlightArea methodsFor:'accessing-color & font'! |
5484 |
||
5485 |
bgColor |
|
5486 |
^ bgColor |
|
5487 |
! |
|
5488 |
||
5489 |
bgColor:something |
|
5490 |
bgColor := something. |
|
5491 |
! |
|
5492 |
||
5493 |
fgColor |
|
5494 |
^ fgColor |
|
5495 |
! |
|
5496 |
||
5497 |
fgColor:something |
|
5498 |
fgColor := something. |
|
5499 |
! ! |
|
5500 |
||
6429 | 5501 |
!ListView::SearchSpec class methodsFor:'documentation'! |
5502 |
||
5503 |
documentation |
|
5504 |
" |
|
5505 |
documentation to be added. |
|
5506 |
||
5507 |
[author:] |
|
5508 |
Claus Gittinger |
|
5509 |
||
5510 |
[instance variables:] |
|
5511 |
||
5512 |
[class variables:] |
|
5513 |
||
5514 |
[see also:] |
|
5515 |
||
5516 |
" |
|
5517 |
! ! |
|
5518 |
||
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5519 |
!ListView::SearchSpec methodsFor:'accessing'! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5520 |
|
5076 | 5521 |
atBeginOfLineOnly |
5079 | 5522 |
^ atBeginOfLineOnly ? false |
5076 | 5523 |
! |
5524 |
||
5715 | 5525 |
atBeginOfLineOnly:aBoolean |
5526 |
atBeginOfLineOnly := aBoolean. |
|
5076 | 5527 |
! |
5528 |
||
6429 | 5529 |
atEndOfLineOnly |
5530 |
^ atEndOfLineOnly ? false |
|
5531 |
||
5532 |
"Created: / 13-09-2018 / 10:04:11 / Claus Gittinger" |
|
5533 |
! |
|
5534 |
||
5535 |
atEndOfLineOnly:aBoolean |
|
5536 |
atEndOfLineOnly := aBoolean. |
|
5537 |
||
5538 |
"Created: / 13-09-2018 / 10:04:16 / Claus Gittinger" |
|
5539 |
! |
|
5540 |
||
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5541 |
forward |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5542 |
^ forward ? true |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5543 |
! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5544 |
|
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5545 |
fullWord |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5546 |
^ fullWord ? false |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5547 |
! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5548 |
|
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5549 |
ignoreCase |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5550 |
^ ignoreCase ? false |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5551 |
! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5552 |
|
5217 | 5553 |
ignoreDiacritics |
6281 | 5554 |
^ ignoreDiacritics ? false |
5217 | 5555 |
! |
5556 |
||
5557 |
ignoreDiacritics:something |
|
5558 |
ignoreDiacritics := something. |
|
5559 |
! |
|
5560 |
||
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5561 |
match |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5562 |
^ match ? false |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5563 |
! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5564 |
|
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5565 |
pattern |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5566 |
^ pattern |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5567 |
! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5568 |
|
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
5569 |
pattern:patternString |
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5570 |
pattern := patternString. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5571 |
! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5572 |
|
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5573 |
pattern:patternString ignoreCase:ignoredCaseBoolean |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5574 |
pattern := patternString. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5575 |
ignoreCase := ignoredCaseBoolean. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5576 |
! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5577 |
|
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5578 |
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
|
5579 |
pattern := patternString. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5580 |
ignoreCase := ignoredCaseBoolean. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5581 |
match := matchBoolean. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5582 |
! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5583 |
|
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5584 |
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
|
5585 |
pattern := patternString. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5586 |
ignoreCase := ignoredCaseBoolean. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5587 |
match := matchBoolean. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5588 |
forward := forwardBoolean |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5589 |
! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5590 |
|
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
5591 |
pattern:patternString ignoreCase:ignoredCaseBoolean |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
5592 |
match:matchBoolean regexMatch:regexMatchBoolean |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
5593 |
variable:variableBoolen |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
5594 |
fullWord:fullWordBoolen forward:forwardBoolean |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
5595 |
atBeginOfLineOnly:atBeginOfLineOnlyArg |
5533 | 5596 |
pattern := patternString. |
5597 |
ignoreCase := ignoredCaseBoolean. |
|
5598 |
match := matchBoolean. |
|
5599 |
regexMatch := regexMatchBoolean. |
|
5600 |
variable := variableBoolen. |
|
5601 |
fullWord := fullWordBoolen. |
|
5602 |
forward := forwardBoolean. |
|
5603 |
atBeginOfLineOnly := atBeginOfLineOnlyArg |
|
5604 |
! |
|
5605 |
||
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
5606 |
pattern:patternString ignoreCase:ignoredCaseBoolean |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
5607 |
match:matchBoolean regexMatch:regexMatchBoolean |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
5608 |
variable:variableBoolen |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
5609 |
fullWord:fullWordBoolen forward:forwardBoolean |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
5610 |
atBeginOfLineOnly:atBeginOfLineOnlyArg |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
5611 |
wrapAtEnd:wrapAtEndOfTextArg |
5533 | 5612 |
pattern := patternString. |
5613 |
ignoreCase := ignoredCaseBoolean. |
|
5614 |
match := matchBoolean. |
|
5615 |
regexMatch := regexMatchBoolean. |
|
5616 |
variable := variableBoolen. |
|
5617 |
fullWord := fullWordBoolen. |
|
5618 |
forward := forwardBoolean. |
|
5619 |
atBeginOfLineOnly := atBeginOfLineOnlyArg. |
|
5544 | 5620 |
wrapAtEndOfText := wrapAtEndOfTextArg. |
5533 | 5621 |
! |
5622 |
||
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5623 |
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
|
5624 |
pattern := patternString. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5625 |
ignoreCase := ignoredCaseBoolean. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5626 |
match := matchBoolean. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5627 |
variable := variableBoolen. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5628 |
forward := forwardBoolean |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5629 |
! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5630 |
|
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5631 |
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
|
5632 |
pattern := patternString. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5633 |
ignoreCase := ignoredCaseBoolean. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5634 |
match := matchBoolean. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5635 |
variable := variableBoolen. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5636 |
fullWord := fullWordBoolen. |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5637 |
forward := forwardBoolean |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5638 |
! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5639 |
|
5789
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
5640 |
pattern:patternString ignoreCase:ignoredCaseBoolean match:matchBoolean variable:variableBoolen |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
5641 |
fullWord:fullWordBoolen forward:forwardBoolean |
a6db617369e9
Delegate GraphicsContext objects
Stefan Vogel <sv@exept.de>
parents:
5780
diff
changeset
|
5642 |
atBeginOfLineOnly:atBeginOfLineOnlyArg |
5076 | 5643 |
pattern := patternString. |
5644 |
ignoreCase := ignoredCaseBoolean. |
|
5645 |
match := matchBoolean. |
|
5646 |
variable := variableBoolen. |
|
5647 |
fullWord := fullWordBoolen. |
|
5648 |
forward := forwardBoolean. |
|
5649 |
atBeginOfLineOnly := atBeginOfLineOnlyArg |
|
5650 |
! |
|
5651 |
||
6429 | 5652 |
pattern:patternString ignoreCase:ignoredCaseBoolean match:matchBoolean variable:variableBoolen |
5653 |
fullWord:fullWordBoolen forward:forwardBoolean |
|
5654 |
atBeginOfLineOnly:atBeginOfLineOnlyArg |
|
5655 |
atEndOfLineOnly:atEndOfLineOnlyArg |
|
5656 |
pattern := patternString. |
|
5657 |
ignoreCase := ignoredCaseBoolean. |
|
5658 |
match := matchBoolean. |
|
5659 |
variable := variableBoolen. |
|
5660 |
fullWord := fullWordBoolen. |
|
5661 |
forward := forwardBoolean. |
|
5662 |
atBeginOfLineOnly := atBeginOfLineOnlyArg. |
|
5663 |
atEndOfLineOnly := atEndOfLineOnlyArg. |
|
5664 |
||
5665 |
"Created: / 13-09-2018 / 10:04:35 / Claus Gittinger" |
|
5666 |
! |
|
5667 |
||
5533 | 5668 |
regexMatch |
5715 | 5669 |
^ regexMatch ? false |
5670 |
! |
|
5671 |
||
5672 |
regexMatch:aBoolean |
|
5673 |
regexMatch := aBoolean. |
|
5533 | 5674 |
! |
5675 |
||
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5676 |
variable |
6281 | 5677 |
^ variable ? false |
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5678 |
! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5679 |
|
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5680 |
variable:variableBoolean |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5681 |
variable := variableBoolean |
5533 | 5682 |
! |
5683 |
||
5544 | 5684 |
wrapAtEndOfText |
6281 | 5685 |
^ wrapAtEndOfText ? false |
5544 | 5686 |
! |
5687 |
||
5688 |
wrapAtEndOfText:aBoolean |
|
5689 |
wrapAtEndOfText := aBoolean. |
|
4463
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5690 |
! ! |
8bfe40af7940
search protocol changed to pass down a searchSpec instead
Claus Gittinger <cg@exept.de>
parents:
4448
diff
changeset
|
5691 |
|
851
b9d71ccdefaa
care for new fontParameters, if changing from a non-string-list
Claus Gittinger <cg@exept.de>
parents:
837
diff
changeset
|
5692 |
!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
|
5693 |
|
4523 | 5694 |
version |
5369 | 5695 |
^ '$Header$' |
4523 | 5696 |
! |
5697 |
||
4015
8647dad37cb0
comment/format in: #on:aspect:change:list:menu:
Claus Gittinger <cg@exept.de>
parents:
3869
diff
changeset
|
5698 |
version_CVS |
5369 | 5699 |
^ '$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
|
5700 |
! ! |
4495 | 5701 |