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