author | Claus Gittinger <cg@exept.de> |
Mon, 15 Jul 2019 16:40:05 +0200 | |
changeset 6630 | 5cf6c9bdb07c |
parent 6598 | 90b1f72eeb96 |
child 6654 | 18c4d3d8b1ab |
permissions | -rw-r--r-- |
6588 | 1 |
"{ Encoding: utf8 }" |
2 |
||
0 | 3 |
" |
5 | 4 |
COPYRIGHT (c) 1989 by Claus Gittinger |
59 | 5 |
All Rights Reserved |
0 | 6 |
|
7 |
This software is furnished under a license and may be used |
|
8 |
only in accordance with the terms of that license and with the |
|
9 |
inclusion of the above copyright notice. This software may not |
|
10 |
be provided or otherwise made available to, or used by, any |
|
11 |
other person. No title to or ownership of the software is |
|
12 |
hereby transferred. |
|
13 |
" |
|
2259 | 14 |
"{ Package: 'stx:libwidg' }" |
15 |
||
5246 | 16 |
"{ NameSpace: Smalltalk }" |
17 |
||
0 | 18 |
EditTextView subclass:#TextCollector |
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
19 |
instanceVariableNames:'entryStream lineLimit destroyAction outstandingLines |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
20 |
outstandingLine flushBlock flushPending inFlush collecting |
3710 | 21 |
timeDelay access currentEmphasis alwaysAppendAtEnd collectSize |
5137 | 22 |
autoRaise' |
4365 | 23 |
classVariableNames:'TranscriptQuerySignal DebugSendersOfMessagePattern |
5455 | 24 |
TraceSendersOfMessagePattern TimestampMessages DefaultLineLimit |
5301 | 25 |
DefaultTimeDelay DefaultCollectSize' |
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
26 |
poolDictionaries:'' |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
27 |
category:'Views-Text' |
0 | 28 |
! |
29 |
||
928 | 30 |
!TextCollector class methodsFor:'documentation'! |
15 | 31 |
|
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
32 |
copyright |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
33 |
" |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
34 |
COPYRIGHT (c) 1989 by Claus Gittinger |
59 | 35 |
All Rights Reserved |
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
36 |
|
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
37 |
This software is furnished under a license and may be used |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
38 |
only in accordance with the terms of that license and with the |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
39 |
inclusion of the above copyright notice. This software may not |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
40 |
be provided or otherwise made available to, or used by, any |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
41 |
other person. No title to or ownership of the software is |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
42 |
hereby transferred. |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
43 |
" |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
44 |
! |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
45 |
|
15 | 46 |
documentation |
47 |
" |
|
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
48 |
a view for editable text, which also understands some stream messages. |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
49 |
Instances of this view can take the place of a stream and display the |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
50 |
received text. |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
51 |
Its main use in the system is the Transcript, but it can also be used for |
110 | 52 |
things like trace-windows, errorLogs etc. |
4650 | 53 |
It is also inherited by TerminalView, which especially uses the buffering and |
54 |
delayed output features for high performance output (compare to a windows console). |
|
0 | 55 |
|
60 | 56 |
If collecting is turned on, a textcollector will not immediately display |
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
57 |
entered text, but wait for some short time (timeDelay) and collect incoming |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
58 |
data - finally updating the whole chunk in one piece. |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
59 |
This helps slow display devices, which would otherwise scroll a lot. |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
60 |
(on fast displays this is less of a problem). |
15 | 61 |
|
60 | 62 |
The total number of lines kept is controlled by lineLimit, if more lines |
63 |
than this limit are added at the bottom, the textcollector will forget lines |
|
4650 | 64 |
at the top. You can set linelimit to nil (i.e. no limit), but you may need a lot |
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
65 |
of memory then ... |
77 | 66 |
|
586 | 67 |
[StyleSheet paramters (transcript only):] |
68 |
||
69 |
transcriptForegroundColor defaults to textForegroundColor |
|
70 |
transcriptBackgroundColor' defaults to textBackgroundColor. |
|
77 | 71 |
|
586 | 72 |
transcriptCursorForegroundColor |
73 |
transcriptCursorBackgroundColor |
|
77 | 74 |
|
586 | 75 |
[author:] |
76 |
Claus Gittinger |
|
77 |
||
78 |
[see also:] |
|
79 |
CodeView EditTextView |
|
80 |
ActorStream |
|
15 | 81 |
" |
82 |
! ! |
|
0 | 83 |
|
928 | 84 |
!TextCollector class methodsFor:'instance creation'! |
0 | 85 |
|
2025
0c9729befabc
allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
86 |
initialize |
5534 | 87 |
TranscriptQuerySignal isNil ifTrue:[ |
88 |
TranscriptQuerySignal := QuerySignal new. |
|
89 |
] |
|
2025
0c9729befabc
allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
90 |
! |
0c9729befabc
allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
91 |
|
0 | 92 |
newTranscript |
778
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
93 |
"create and open a new transcript. |
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
94 |
This is a leftOver method from times were the Launcher & Transcript |
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
95 |
were two different views. It is no longer recommended." |
110 | 96 |
|
3852
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
97 |
^ self newTranscript:#Transcript |
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
98 |
|
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
99 |
" |
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
100 |
TextCollector newTranscript. |
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
101 |
Transcript lineLimit:3000. |
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
102 |
" |
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
103 |
|
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
104 |
"Modified: 17.2.1997 / 18:20:27 / cg" |
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
105 |
! |
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
106 |
|
5609 | 107 |
newTranscript:nameSymbol |
5301 | 108 |
"create and open a new transcript, unless one already exists by that name. |
109 |
The transcript is remembered in a global by that name. |
|
3852
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
110 |
This is a leftOver method from times were the Launcher & Transcript |
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
111 |
were two different views. It is no longer recommended." |
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
112 |
|
1900
d334ab9d32d5
removed minExtent - let topView decide.
Claus Gittinger <cg@exept.de>
parents:
1822
diff
changeset
|
113 |
|topView transcript defSz f v lines cols| |
0 | 114 |
|
5609 | 115 |
transcript := Smalltalk at:nameSymbol. |
4476 | 116 |
(transcript isTextView and:[transcript isOpen and:[transcript device == Screen current]]) ifTrue:[ |
117 |
"if there is already an open Transcript on the same device, |
|
118 |
do not open an additional one. |
|
119 |
expecco StandardLibrary <= 2.0.0.3 checked for Transcript>>#isStream and |
|
120 |
tries to opens a new Transcript window for each new Transcribe with expecco >=2.4" |
|
121 |
^ transcript. |
|
122 |
]. |
|
123 |
||
5609 | 124 |
topView := StandardSystemView label:nameSymbol "minExtent:(100 @ 100)". |
0 | 125 |
|
60 | 126 |
v := HVScrollableView for:self miniScrollerH:true miniScrollerV:false in:topView. |
0 | 127 |
v origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
128 |
transcript := v scrolledView. |
|
129 |
"transcript partialLines:false." |
|
130 |
||
131 |
f := transcript font. |
|
60 | 132 |
|
133 |
" |
|
134 |
should add the height of the frame & scrollbars to be exact ... |
|
135 |
" |
|
1900
d334ab9d32d5
removed minExtent - let topView decide.
Claus Gittinger <cg@exept.de>
parents:
1822
diff
changeset
|
136 |
defSz := self defaultTranscriptSize. |
d334ab9d32d5
removed minExtent - let topView decide.
Claus Gittinger <cg@exept.de>
parents:
1822
diff
changeset
|
137 |
cols := defSz x. |
d334ab9d32d5
removed minExtent - let topView decide.
Claus Gittinger <cg@exept.de>
parents:
1822
diff
changeset
|
138 |
lines := defSz y. |
60 | 139 |
topView extent:(((f widthOf:'x') * cols) @ (f height * lines)). |
0 | 140 |
|
5609 | 141 |
transcript beTranscript:nameSymbol. |
59 | 142 |
|
80 | 143 |
" |
144 |
run it at a slightly higher prio, to allow for |
|
145 |
delayed buffered updates to be performed |
|
146 |
" |
|
147 |
topView openWithPriority:(Processor userSchedulingPriority + 1). |
|
15 | 148 |
|
0 | 149 |
^ transcript |
110 | 150 |
|
151 |
" |
|
3852
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
152 |
TextCollector newTranscript:#T2. |
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
153 |
T2 showCR:'Hello world'. |
5908 | 154 |
Smalltalk removeKey:#T2 |
110 | 155 |
" |
778
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
156 |
|
1026 | 157 |
"Modified: 17.2.1997 / 18:20:27 / cg" |
0 | 158 |
! ! |
159 |
||
2025
0c9729befabc
allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
160 |
!TextCollector class methodsFor:'Signal constants'! |
0c9729befabc
allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
161 |
|
0c9729befabc
allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
162 |
transcriptQuerySignal |
0c9729befabc
allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
163 |
^ TranscriptQuerySignal |
0c9729befabc
allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
164 |
! ! |
0c9729befabc
allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
165 |
|
4105
c2c3a96f8757
debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
166 |
!TextCollector class methodsFor:'debugging'! |
c2c3a96f8757
debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
167 |
|
4365 | 168 |
debugSendersOfMessagePattern |
169 |
^ DebugSendersOfMessagePattern |
|
170 |
||
171 |
"Created: / 02-02-2012 / 12:05:27 / cg" |
|
172 |
! |
|
173 |
||
4105
c2c3a96f8757
debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
174 |
debugSendersOfMessagePattern:aGLOBMatchPattern |
4233
ae8979201707
changed: #debugSendersOfMessagePattern:
Claus Gittinger <cg@exept.de>
parents:
4124
diff
changeset
|
175 |
"ever want to know, who sends a particular text-message to the transcript ? |
4365 | 176 |
Call this with a match string and get a halt, when a matching text is sent to the transcript" |
4105
c2c3a96f8757
debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
177 |
|
4654 | 178 |
DebugSendersOfMessagePattern := aGLOBMatchPattern asNilIfEmpty |
4105
c2c3a96f8757
debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
179 |
|
c2c3a96f8757
debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
180 |
" |
c2c3a96f8757
debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
181 |
self debugSendersOfMessagePattern:'no such*' |
4233
ae8979201707
changed: #debugSendersOfMessagePattern:
Claus Gittinger <cg@exept.de>
parents:
4124
diff
changeset
|
182 |
self debugSendersOfMessagePattern:'remove*' |
4105
c2c3a96f8757
debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
183 |
self debugSendersOfMessagePattern:nil. |
4284
3e487b994a8b
changed: #debugSendersOfMessagePattern:
Claus Gittinger <cg@exept.de>
parents:
4233
diff
changeset
|
184 |
self debugSendersOfMessagePattern:'*'. |
4105
c2c3a96f8757
debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
185 |
" |
4233
ae8979201707
changed: #debugSendersOfMessagePattern:
Claus Gittinger <cg@exept.de>
parents:
4124
diff
changeset
|
186 |
|
4365 | 187 |
"Modified: / 02-02-2012 / 12:07:11 / cg" |
188 |
! |
|
189 |
||
4643 | 190 |
timestampMessages |
191 |
^ TimestampMessages |
|
192 |
! |
|
193 |
||
194 |
timestampMessages:aBoolean |
|
195 |
"if true, all messages are shown with a timestamp in front" |
|
196 |
||
197 |
TimestampMessages := aBoolean |
|
198 |
||
199 |
" |
|
200 |
self timestampMessages:true |
|
201 |
self timestampMessages:false. |
|
202 |
" |
|
203 |
! |
|
204 |
||
4365 | 205 |
traceSendersOfMessagePattern |
206 |
^ TraceSendersOfMessagePattern |
|
207 |
||
208 |
"Created: / 02-02-2012 / 12:05:32 / cg" |
|
209 |
! |
|
210 |
||
211 |
traceSendersOfMessagePattern:aGLOBMatchPattern |
|
212 |
"ever want to know, who sends a particular text-message to the transcript ? |
|
213 |
Call this with a match string and get a trace, when a matching text is sent to the transcript" |
|
214 |
||
4654 | 215 |
TraceSendersOfMessagePattern := aGLOBMatchPattern asNilIfEmpty |
4365 | 216 |
|
217 |
" |
|
218 |
self traceSendersOfMessagePattern:'removed unreached*' |
|
219 |
self traceSendersOfMessagePattern:nil. |
|
220 |
self traceSendersOfMessagePattern:'*'. |
|
221 |
" |
|
222 |
||
223 |
"Created: / 02-02-2012 / 11:59:22 / cg" |
|
4105
c2c3a96f8757
debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
224 |
! ! |
c2c3a96f8757
debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
225 |
|
928 | 226 |
!TextCollector class methodsFor:'defaults'! |
0 | 227 |
|
1610
b05a3e405b33
allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents:
1598
diff
changeset
|
228 |
defaultCollectSize |
5301 | 229 |
"the number of lines buffered for delayed update. |
230 |
At most this number of lines to be shown are buffered (without redrawing), |
|
231 |
before a redraw is done. Thus, if a lot of output is generated fast, |
|
232 |
the redrawing is performed in chunks. |
|
233 |
This has a significant effect on the performane, |
|
234 |
as the view does not have to scroll and redraw for each |
|
235 |
individual line, but does junp-scrolling instead. |
|
236 |
See also defaultTimeDelay" |
|
237 |
||
238 |
^ DefaultCollectSize ? 1000 |
|
1610
b05a3e405b33
allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents:
1598
diff
changeset
|
239 |
|
5301 | 240 |
"Modified: / 27.7.1998 / 16:14:51 / cg" |
241 |
! |
|
242 |
||
243 |
defaultCollectSize:numberOfLines |
|
244 |
"the number of lines buffered for delayed update. |
|
245 |
At most this number of lines to be shown are buffered (without redrawing), |
|
246 |
before a redraw is done. Thus, if a lot of output is generated fast, |
|
247 |
the redrawing is performed in chunks. |
|
248 |
This has a significant effect on the performane, |
|
249 |
as the view does not have to scroll and redraw for each |
|
250 |
individual line, but does junp-scrolling instead. |
|
251 |
See also defaultTimeDelay" |
|
252 |
||
253 |
DefaultCollectSize := numberOfLines |
|
1610
b05a3e405b33
allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents:
1598
diff
changeset
|
254 |
|
b05a3e405b33
allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents:
1598
diff
changeset
|
255 |
"Modified: / 27.7.1998 / 16:14:51 / cg" |
b05a3e405b33
allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents:
1598
diff
changeset
|
256 |
! |
b05a3e405b33
allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents:
1598
diff
changeset
|
257 |
|
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
258 |
defaultLineLimit |
5301 | 259 |
"the number of lines remembered by default. |
260 |
Only the last n lines are remembered and can be seen by scrolling. |
|
261 |
Older lines are forgotten. |
|
262 |
This limit can be changed by the userPreferences dialog" |
|
263 |
||
264 |
^ DefaultLineLimit ? 1000 |
|
265 |
! |
|
59 | 266 |
|
5301 | 267 |
defaultLineLimit:numberOfLines |
268 |
"the number of lines remembered by default. |
|
269 |
Only the last n lines are remembered and can be seen by scrolling. |
|
270 |
Older lines are forgotten. |
|
271 |
This limit can be changed by the userPreferences dialog" |
|
272 |
||
273 |
DefaultLineLimit := numberOfLines |
|
59 | 274 |
! |
275 |
||
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
276 |
defaultTimeDelay |
5301 | 277 |
"the time in seconds to wait & collect by default. |
278 |
At most this number of seconds incoming text is buffered (without redrawing), |
|
279 |
before a redraw is done. Thus, if a lot of output is generated fast, |
|
280 |
the redrawing is performed in chunks. |
|
281 |
This has a significant effect on the performane, |
|
282 |
as the view does not have to scroll and redraw for each |
|
283 |
individual line, but does junp-scrolling instead. |
|
284 |
The value may be a float (eg. 0.5) |
|
285 |
See also defaultCollectSize" |
|
286 |
||
287 |
^ DefaultTimeDelay ? 0.5 |
|
288 |
! |
|
36 | 289 |
|
5301 | 290 |
defaultTimeDelay:seconds |
291 |
"the time in seconds to wait & collect by default. |
|
292 |
At most this number of seconds incoming text is buffered (without redrawing), |
|
293 |
before a redraw is done. Thus, if a lot of output is generated fast, |
|
294 |
the redrawing is performed in chunks. |
|
295 |
This has a significant effect on the performane, |
|
296 |
as the view does not have to scroll and redraw for each |
|
297 |
individual line, but does junp-scrolling instead. |
|
298 |
The argument may be a float (eg. 0.5) |
|
299 |
See also defaultCollectSize" |
|
300 |
||
301 |
DefaultTimeDelay := seconds |
|
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
302 |
! |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
303 |
|
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
304 |
defaultTranscriptSize |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
305 |
"the number of cols/lines by which the Transcript should come up" |
110 | 306 |
|
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
307 |
^ 70@11 |
110 | 308 |
! ! |
309 |
||
2744 | 310 |
!TextCollector methodsFor:'Compatibility-ST80'! |
1500 | 311 |
|
312 |
deselect |
|
313 |
self unselect |
|
1504
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
314 |
! |
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
315 |
|
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
316 |
flush |
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
317 |
self endEntry. |
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
318 |
super flush |
1500 | 319 |
! ! |
320 |
||
0 | 321 |
!TextCollector methodsFor:'accessing'! |
322 |
||
3710 | 323 |
autoRaise |
324 |
^ autoRaise ? false |
|
325 |
! |
|
326 |
||
327 |
autoRaise:something |
|
328 |
autoRaise := something. |
|
329 |
! |
|
330 |
||
0 | 331 |
collect:aBoolean |
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
332 |
"turn on/off collecting - if on, do not output immediately |
15 | 333 |
but collect text and output en-bloque after some time delta" |
0 | 334 |
|
335 |
collecting := aBoolean |
|
336 |
! |
|
337 |
||
1610
b05a3e405b33
allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents:
1598
diff
changeset
|
338 |
collectSize:numberOfLines |
b05a3e405b33
allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents:
1598
diff
changeset
|
339 |
"set the collect buffer size. If collect is enabled, |
b05a3e405b33
allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents:
1598
diff
changeset
|
340 |
the receiver will force update of the view, |
b05a3e405b33
allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents:
1598
diff
changeset
|
341 |
whenever that many lines have been collected |
b05a3e405b33
allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents:
1598
diff
changeset
|
342 |
(or the updateTimeDelay interval has passed). |
b05a3e405b33
allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents:
1598
diff
changeset
|
343 |
With collect turned off, an immediate update is performed." |
b05a3e405b33
allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents:
1598
diff
changeset
|
344 |
|
b05a3e405b33
allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents:
1598
diff
changeset
|
345 |
collectSize := numberOfLines |
b05a3e405b33
allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents:
1598
diff
changeset
|
346 |
|
b05a3e405b33
allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents:
1598
diff
changeset
|
347 |
"Modified: / 27.7.1998 / 16:16:00 / cg" |
b05a3e405b33
allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents:
1598
diff
changeset
|
348 |
! |
b05a3e405b33
allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents:
1598
diff
changeset
|
349 |
|
0 | 350 |
destroyAction:aBlock |
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
351 |
"define the action to be performed when I get destroyed. |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
352 |
This is a special feature, to allow resetting Transcript to Stderr |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
353 |
when closed. (see TextCollectorclass>>newTranscript)" |
0 | 354 |
|
355 |
destroyAction := aBlock |
|
356 |
! |
|
357 |
||
5486 | 358 |
entryStream |
6529 | 359 |
"returns something which is a stream, sending its input to me" |
360 |
||
5486 | 361 |
^ entryStream |
6529 | 362 |
|
363 |
"Modified (comment): / 19-02-2019 / 22:37:47 / Claus Gittinger" |
|
5486 | 364 |
! |
365 |
||
2103 | 366 |
lineLimit |
5989 | 367 |
"return the number of text-lines I am supposed to hold when collecting. |
368 |
Nil means: unlimited" |
|
2103 | 369 |
|
370 |
^ lineLimit |
|
371 |
||
372 |
" |
|
373 |
Transcript lineLimit:5000 |
|
374 |
Transcript lineLimit |
|
375 |
" |
|
376 |
||
377 |
"Modified: / 16.5.1998 / 01:33:52 / cg" |
|
378 |
! |
|
379 |
||
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
380 |
lineLimit:aNumber |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
381 |
"define the number of text-lines I am supposed to hold" |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
382 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
383 |
lineLimit := aNumber |
1611 | 384 |
|
385 |
" |
|
386 |
Transcript lineLimit:5000 |
|
387 |
" |
|
388 |
||
389 |
"Modified: / 16.5.1998 / 01:33:52 / cg" |
|
1610
b05a3e405b33
allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents:
1598
diff
changeset
|
390 |
! |
b05a3e405b33
allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents:
1598
diff
changeset
|
391 |
|
b05a3e405b33
allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents:
1598
diff
changeset
|
392 |
updateTimeDelay:seconds |
b05a3e405b33
allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents:
1598
diff
changeset
|
393 |
"if collect is enabled, the receiver will update its view, |
4643 | 394 |
after that time delay (i.e. it collects output during that period), |
1610
b05a3e405b33
allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents:
1598
diff
changeset
|
395 |
or when collectSize lines have been collected without update. |
b05a3e405b33
allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents:
1598
diff
changeset
|
396 |
With collect turned off, an immediate update is performed." |
b05a3e405b33
allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents:
1598
diff
changeset
|
397 |
|
b05a3e405b33
allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents:
1598
diff
changeset
|
398 |
timeDelay := seconds |
b05a3e405b33
allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents:
1598
diff
changeset
|
399 |
|
b05a3e405b33
allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents:
1598
diff
changeset
|
400 |
"Modified: / 27.7.1998 / 16:16:41 / cg" |
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
401 |
! ! |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
402 |
|
3969
a914bce039b7
category of: #exposeX:y:width:height:
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
403 |
!TextCollector methodsFor:'event handling'! |
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
404 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
405 |
exposeX:x y:y width:w height:h |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
406 |
"flush buffered text when exposed" |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
407 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
408 |
super exposeX:x y:y width:w height:h. |
4657 | 409 |
"/ self endEntry |
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
410 |
! ! |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
411 |
|
2750 | 412 |
!TextCollector methodsFor:'initialization & release'! |
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
413 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
414 |
destroy |
928 | 415 |
"destroy this view" |
416 |
||
3201 | 417 |
destroyAction value. |
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
418 |
super destroy |
928 | 419 |
|
1714 | 420 |
"Modified: / 9.11.1998 / 21:18:17 / cg" |
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
421 |
! |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
422 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
423 |
initialize |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
424 |
super initialize. |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
425 |
|
2164
ed46136cb2cf
honor scrollWhenUpdating setting
Claus Gittinger <cg@exept.de>
parents:
2103
diff
changeset
|
426 |
scrollWhenUpdating := #endOfText. |
ed46136cb2cf
honor scrollWhenUpdating setting
Claus Gittinger <cg@exept.de>
parents:
2103
diff
changeset
|
427 |
|
928 | 428 |
outstandingLines := nil. |
1562
9b7557a81849
made the number of buffered lines an instVar.
Claus Gittinger <cg@exept.de>
parents:
1504
diff
changeset
|
429 |
alwaysAppendAtEnd := true. |
1610
b05a3e405b33
allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents:
1598
diff
changeset
|
430 |
collectSize := self class defaultCollectSize. |
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
431 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
432 |
flushPending := inFlush := false. |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
433 |
collecting := true. |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
434 |
timeDelay := self class defaultTimeDelay. |
6189 | 435 |
access := RecursionLock name:'TextCollector access lock'. |
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
436 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
437 |
lineLimit := self class defaultLineLimit. |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
438 |
entryStream := ActorStream new. |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
439 |
entryStream nextPutBlock:[:something | self nextPut:something]. |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
440 |
entryStream nextPutAllBlock:[:something | self nextPutAll:something] |
928 | 441 |
|
2086
95ec18a17198
give my access sema a name (for the semaphoreMonitor)
Claus Gittinger <cg@exept.de>
parents:
2025
diff
changeset
|
442 |
"Modified: / 14.12.1999 / 21:13:54 / cg" |
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
443 |
! |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
444 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
445 |
mapped |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
446 |
"view became visible - show collected lines (if any)" |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
447 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
448 |
super mapped. |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
449 |
self endEntry |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
450 |
! |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
451 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
452 |
reinitialize |
2259 | 453 |
"reinit after a snapIn. |
454 |
recreate access-semaphore; image could have been save (theoretically) |
|
1467
5c09bb2dadef
Add (dummy fore now) #beginEntry for ST80 compat.
Stefan Vogel <sv@exept.de>
parents:
1421
diff
changeset
|
455 |
with the semaphore locked - in this case, we had a deadlock" |
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
456 |
|
4645 | 457 |
flushPending := inFlush := false. |
6189 | 458 |
access := RecursionLock name:'TextCollector access lock'. |
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
459 |
super reinitialize. |
1467
5c09bb2dadef
Add (dummy fore now) #beginEntry for ST80 compat.
Stefan Vogel <sv@exept.de>
parents:
1421
diff
changeset
|
460 |
|
6108 | 461 |
"Modified: / 20-02-2017 / 21:29:13 / stefan" |
2591 | 462 |
! |
463 |
||
464 |
release |
|
465 |
flushBlock notNil ifTrue:[ |
|
466 |
Processor removeTimedBlock:flushBlock. |
|
467 |
flushBlock := nil. |
|
468 |
]. |
|
469 |
outstandingLines := nil. |
|
470 |
outstandingLine := ''. |
|
471 |
||
472 |
super release |
|
473 |
||
474 |
"Modified: / 9.11.1998 / 21:18:17 / cg" |
|
0 | 475 |
! ! |
476 |
||
5783 | 477 |
!TextCollector methodsFor:'menu - actions'! |
478 |
||
479 |
doSetLineLimit |
|
6595 | 480 |
|nLines makeDefault newNLines| |
5783 | 481 |
|
6595 | 482 |
makeDefault := false. |
483 |
Dialog withOptoutOption:[makeDefault := true] labelled:'Make this the default for the future' do:[ |
|
484 |
nLines := Dialog requestNumber:'Enter Line Limit:' initialAnswer:lineLimit. |
|
485 |
]. |
|
5783 | 486 |
nLines notNil ifTrue:[ |
6595 | 487 |
newNLines := nLines asInteger max:100. |
488 |
self lineLimit:newNLines. |
|
489 |
makeDefault ifTrue:[ |
|
490 |
self class defaultLineLimit:newNLines |
|
491 |
]. |
|
5783 | 492 |
]. |
6595 | 493 |
|
494 |
"Modified: / 06-06-2019 / 10:21:08 / Claus Gittinger" |
|
5783 | 495 |
! ! |
496 |
||
0 | 497 |
!TextCollector methodsFor:'private'! |
498 |
||
499 |
checkLineLimit |
|
500 |
"this method checks if the text has become too large (> lineLimit) |
|
501 |
and cuts off some lines at the top if so; it must be called whenever lines |
|
502 |
have been added to the bottom" |
|
503 |
||
2426
281067d406c7
eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents:
2371
diff
changeset
|
504 |
|nDel newCursorLine| |
0 | 505 |
|
6114 | 506 |
list isEmptyOrNil ifTrue:[ |
507 |
"no lines" |
|
508 |
^ self. |
|
509 |
]. |
|
510 |
||
0 | 511 |
lineLimit notNil ifTrue:[ |
2426
281067d406c7
eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents:
2371
diff
changeset
|
512 |
(cursorLine > lineLimit) ifTrue:[ |
281067d406c7
eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents:
2371
diff
changeset
|
513 |
nDel := list size - lineLimit. |
4772 | 514 |
self basicListRemoveFromIndex:1 toIndex:nDel. |
2426
281067d406c7
eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents:
2371
diff
changeset
|
515 |
newCursorLine := cursorLine - nDel. |
281067d406c7
eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents:
2371
diff
changeset
|
516 |
firstLineShown := firstLineShown - nDel. |
281067d406c7
eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents:
2371
diff
changeset
|
517 |
(firstLineShown < 1) ifTrue:[ |
281067d406c7
eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents:
2371
diff
changeset
|
518 |
newCursorLine := newCursorLine - firstLineShown + 1. |
281067d406c7
eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents:
2371
diff
changeset
|
519 |
firstLineShown := 1 |
281067d406c7
eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents:
2371
diff
changeset
|
520 |
]. |
281067d406c7
eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents:
2371
diff
changeset
|
521 |
self setCursorLine:newCursorLine. |
3320
a820e3101bb6
refresh when removing some lines after hitting linelimit
fm
parents:
3295
diff
changeset
|
522 |
self contentsChanged. |
a820e3101bb6
refresh when removing some lines after hitting linelimit
fm
parents:
3295
diff
changeset
|
523 |
self invalidate. |
2426
281067d406c7
eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents:
2371
diff
changeset
|
524 |
] |
3710 | 525 |
]. |
526 |
self autoRaise ifTrue:[ |
|
527 |
self topView |
|
528 |
raise; |
|
529 |
"/ setForegroundWindow; |
|
530 |
yourself. |
|
531 |
]. |
|
3320
a820e3101bb6
refresh when removing some lines after hitting linelimit
fm
parents:
3295
diff
changeset
|
532 |
|
a820e3101bb6
refresh when removing some lines after hitting linelimit
fm
parents:
3295
diff
changeset
|
533 |
"Modified: / 26-07-2006 / 16:02:15 / fm" |
6114 | 534 |
"Modified: / 02-03-2017 / 12:02:03 / stefan" |
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
535 |
! |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
536 |
|
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
537 |
installDelayedUpdate |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
538 |
"arrange for collecting input for some time, |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
539 |
and output all buffered strings at once after a while. |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
540 |
This makes output to the transcript much faster on systems |
553 | 541 |
with poor scrolling performance (i.e. dumb vga cards ...)." |
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
542 |
|
131 | 543 |
|p| |
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
544 |
|
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
545 |
flushPending ifFalse:[ |
553 | 546 |
inFlush ifFalse:[ |
4643 | 547 |
flushPending := true. |
553 | 548 |
" |
549 |
we could run under a process, which dies in the meantime; |
|
550 |
therefore, we have to arrange for the transcript process to |
|
551 |
be interrupted and do the update. |
|
552 |
" |
|
553 |
windowGroup isNil ifTrue:[ |
|
4503 | 554 |
p := Processor timeoutHandlerProcess |
553 | 555 |
] ifFalse:[ |
556 |
p := windowGroup process |
|
557 |
]. |
|
1221
0c2a4231fc9e
Move #isSystemProcess from ProcessorScheduler to Process.
Stefan Vogel <sv@exept.de>
parents:
1109
diff
changeset
|
558 |
(p isNil or:[p isSystemProcess]) ifTrue:[ |
834
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
559 |
self endEntry |
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
560 |
] ifFalse:[ |
1711 | 561 |
flushBlock isNil ifTrue:[ |
4650 | 562 |
flushBlock := [self delayedEndEntry]. |
1711 | 563 |
]. |
834
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
564 |
Processor addTimedBlock:flushBlock for:p afterSeconds:timeDelay. |
3009
7eb1704fa5a6
Avoid dangling references in context
Stefan Vogel <sv@exept.de>
parents:
3006
diff
changeset
|
565 |
]. |
4650 | 566 |
p := nil. "hack: avoid dangling references to p through the home context of flushBlock" |
553 | 567 |
] |
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
568 |
] |
553 | 569 |
|
1711 | 570 |
"Modified: / 17.4.1997 / 13:03:15 / stefan" |
571 |
"Modified: / 9.11.1998 / 14:34:07 / cg" |
|
4365 | 572 |
! |
573 |
||
574 |
senderTraceString |
|
575 |
"generate a sender trace string." |
|
576 |
||
577 |
|con| |
|
578 |
||
579 |
"/ skip over intermediate contexts |
|
580 |
"/ con := con sender. |
|
581 |
"/ con := thisContext sender sender. |
|
582 |
"/ [ con receiver == self ] whileTrue:[ |
|
583 |
"/ con := con sender |
|
584 |
"/ ]. |
|
585 |
con := DebugView interestingContextFrom:thisContext sender sender. |
|
586 |
^ con printString |
|
587 |
||
588 |
"Created: / 02-02-2012 / 11:58:17 / cg" |
|
0 | 589 |
! ! |
590 |
||
778
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
591 |
!TextCollector methodsFor:'queries'! |
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
592 |
|
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
593 |
current |
4687 | 594 |
"return the current (your screen's) transcript. |
5301 | 595 |
In multiDisplay applications, this need NOT be the main transcript, |
596 |
as each display may have its own transcript. |
|
778
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
597 |
But typically, this is the same as Transcript." |
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
598 |
|
2278 | 599 |
|theTranscript app| |
2025
0c9729befabc
allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
600 |
|
0c9729befabc
allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
601 |
theTranscript := TranscriptQuerySignal query. |
0c9729befabc
allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
602 |
theTranscript isNil ifTrue:[ |
2278 | 603 |
app := self topView application class current. |
2763
e2fba3262e07
Avoid recursion when getting the Transcript on extra displays
Stefan Vogel <sv@exept.de>
parents:
2750
diff
changeset
|
604 |
(app notNil and:[thisContext isRecursive not]) ifTrue:[ |
2278 | 605 |
theTranscript := (app transcript ? Stderr). |
606 |
] ifFalse:[ |
|
607 |
theTranscript := Stderr. |
|
608 |
] |
|
2025
0c9729befabc
allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
609 |
]. |
0c9729befabc
allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
610 |
^ theTranscript |
778
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
611 |
|
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
612 |
" |
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
613 |
Transcript current flash |
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
614 |
" |
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
615 |
|
4687 | 616 |
"Created: / 05-07-1996 / 14:14:34 / cg" |
617 |
"Modified (comment): / 29-08-2013 / 11:04:55 / cg" |
|
4441
fb138fb5cf04
#isStream answers true for Transcript
Stefan Vogel <sv@exept.de>
parents:
4428
diff
changeset
|
618 |
! |
fb138fb5cf04
#isStream answers true for Transcript
Stefan Vogel <sv@exept.de>
parents:
4428
diff
changeset
|
619 |
|
fb138fb5cf04
#isStream answers true for Transcript
Stefan Vogel <sv@exept.de>
parents:
4428
diff
changeset
|
620 |
isStream |
fb138fb5cf04
#isStream answers true for Transcript
Stefan Vogel <sv@exept.de>
parents:
4428
diff
changeset
|
621 |
"if I am the Transcript, I am used as a stream. |
fb138fb5cf04
#isStream answers true for Transcript
Stefan Vogel <sv@exept.de>
parents:
4428
diff
changeset
|
622 |
See #displayOn:" |
6529 | 623 |
"If you need a real stream, use entryStream" |
4441
fb138fb5cf04
#isStream answers true for Transcript
Stefan Vogel <sv@exept.de>
parents:
4428
diff
changeset
|
624 |
|
fb138fb5cf04
#isStream answers true for Transcript
Stefan Vogel <sv@exept.de>
parents:
4428
diff
changeset
|
625 |
^ self == Transcript |
fb138fb5cf04
#isStream answers true for Transcript
Stefan Vogel <sv@exept.de>
parents:
4428
diff
changeset
|
626 |
|
fb138fb5cf04
#isStream answers true for Transcript
Stefan Vogel <sv@exept.de>
parents:
4428
diff
changeset
|
627 |
" |
fb138fb5cf04
#isStream answers true for Transcript
Stefan Vogel <sv@exept.de>
parents:
4428
diff
changeset
|
628 |
Transcript isStream |
fb138fb5cf04
#isStream answers true for Transcript
Stefan Vogel <sv@exept.de>
parents:
4428
diff
changeset
|
629 |
" |
6529 | 630 |
|
631 |
"Modified (comment): / 19-02-2019 / 22:38:17 / Claus Gittinger" |
|
4687 | 632 |
! |
633 |
||
634 |
isTextCollector |
|
6530 | 635 |
"true, iff this is a text collector emulating a stream" |
636 |
||
4687 | 637 |
^ true |
638 |
||
639 |
" |
|
640 |
Transcript isTextCollector |
|
641 |
" |
|
642 |
||
643 |
"Created: / 29-08-2013 / 11:32:46 / cg" |
|
6530 | 644 |
"Modified (comment): / 19-02-2019 / 22:48:40 / Claus Gittinger" |
5330 | 645 |
! |
646 |
||
647 |
position |
|
648 |
"for compatibiliy with normal streams; return the column" |
|
649 |
||
650 |
^ cursorCol |
|
5989 | 651 |
! |
652 |
||
653 |
showLineLimitInMenu |
|
654 |
^ true. |
|
778
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
655 |
! ! |
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
656 |
|
2450 | 657 |
!TextCollector methodsFor:'scrolling'! |
658 |
||
5136 | 659 |
makeCursorVisible |
5137 | 660 |
(scrollLocked ? false) ifFalse:[ |
5136 | 661 |
access critical:[ |
662 |
super makeCursorVisible |
|
663 |
] |
|
664 |
] |
|
665 |
! |
|
666 |
||
667 |
scrollLock:aBoolean |
|
668 |
aBoolean ifTrue:[ |
|
669 |
scrollWhenUpdating := #endOfText. |
|
670 |
] ifFalse:[ |
|
671 |
scrollWhenUpdating := nil. |
|
672 |
]. |
|
5137 | 673 |
scrollLocked := aBoolean. |
5136 | 674 |
! |
675 |
||
2450 | 676 |
scrollTo:anOrigin redraw:doRedraw |
677 |
access critical:[ |
|
678 |
super scrollTo:anOrigin redraw:doRedraw |
|
679 |
] |
|
680 |
! ! |
|
681 |
||
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
682 |
!TextCollector methodsFor:'stream messages'! |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
683 |
|
4106 | 684 |
addLine:line |
685 |
"append a line to the outstanding lines buffer" |
|
686 |
||
687 |
access critical:[ |
|
688 |
outstandingLine size ~~ 0 ifTrue:[ |
|
689 |
outstandingLine := outstandingLine , line |
|
690 |
] ifFalse:[ |
|
4645 | 691 |
(TimestampMessages == true and:[self == Transcript]) ifTrue:[ |
4643 | 692 |
outstandingLine := Timestamp now printString,' ',line |
693 |
] ifFalse:[ |
|
694 |
outstandingLine := line |
|
695 |
] |
|
4106 | 696 |
]. |
4650 | 697 |
"/ self ~~ Transcript ifTrue:['xa' printCR]. |
4106 | 698 |
outstandingLines isNil ifTrue:[ |
699 |
outstandingLines := OrderedCollection with:outstandingLine |
|
700 |
] ifFalse:[ |
|
701 |
outstandingLines add:outstandingLine. |
|
702 |
]. |
|
703 |
outstandingLine := ''. |
|
704 |
||
705 |
collecting ifTrue:[ |
|
4643 | 706 |
flushPending ifFalse:[ |
707 |
self installDelayedUpdate |
|
708 |
] ifTrue:[ |
|
4106 | 709 |
outstandingLines size > collectSize ifTrue:[ |
710 |
self endEntry |
|
711 |
] |
|
712 |
] |
|
713 |
] ifFalse:[ |
|
714 |
self endEntry. |
|
715 |
self cursorReturn. |
|
716 |
self checkLineLimit. |
|
717 |
self cursorToEnd. |
|
718 |
] |
|
719 |
]. |
|
720 |
||
721 |
"Created: / 28.7.1998 / 00:31:46 / cg" |
|
722 |
"Modified: / 28.7.1998 / 00:34:58 / cg" |
|
723 |
! |
|
724 |
||
6558 | 725 |
binary:beBinaryBool |
726 |
"ExternalStream protocol compatibility" |
|
727 |
||
728 |
^ false "/ no-op, I am not in binary mode |
|
729 |
||
730 |
"Created: / 13-03-2019 / 19:12:48 / Stefan Vogel" |
|
731 |
! |
|
732 |
||
6560 | 733 |
bufferSizeForBulkCopy |
734 |
^ 1024 |
|
735 |
||
736 |
"Created: / 14-03-2019 / 00:21:49 / Claus Gittinger" |
|
737 |
! |
|
738 |
||
6558 | 739 |
buffered:aBoolean |
740 |
"ignored here" |
|
741 |
||
742 |
^ false "/ pretend, that I am not buffered |
|
743 |
||
744 |
"Created: / 13-03-2019 / 18:30:29 / Stefan Vogel" |
|
745 |
"Modified: / 13-03-2019 / 19:34:41 / Stefan Vogel" |
|
746 |
! |
|
747 |
||
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
748 |
cr |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
749 |
"output a carriage return, finishing the current line" |
135 | 750 |
|
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
751 |
access critical:[ |
4643 | 752 |
|line| |
753 |
||
834
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
754 |
collecting ifTrue:[ |
4643 | 755 |
line := outstandingLine. |
4645 | 756 |
(TimestampMessages == true and:[self == Transcript]) ifTrue:[ |
4643 | 757 |
outstandingLine size == 0 ifTrue:[ |
758 |
line := Timestamp now printString |
|
759 |
]. |
|
760 |
]. |
|
4650 | 761 |
"/ self ~~ Transcript ifTrue:['xc' printCR]. |
4643 | 762 |
outstandingLines isNil ifTrue:[ |
763 |
outstandingLines := OrderedCollection with:line |
|
764 |
] ifFalse:[ |
|
765 |
outstandingLines add:line. |
|
834
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
766 |
]. |
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
767 |
outstandingLine := ''. |
4643 | 768 |
flushPending ifFalse:[ |
769 |
self installDelayedUpdate |
|
770 |
] |
|
834
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
771 |
] ifFalse:[ |
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
772 |
self cursorReturn. |
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
773 |
self checkLineLimit. |
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
774 |
self cursorToEnd. |
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
775 |
]. |
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
776 |
]. |
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
777 |
! |
135 | 778 |
|
4460 | 779 |
display:someObject |
780 |
"dolphin compatibility" |
|
781 |
||
5246 | 782 |
"/ someObject printOn:self. |
783 |
self nextPutAll: someObject asString. |
|
4460 | 784 |
! |
785 |
||
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
786 |
doesNotUnderstand:aMessage |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
787 |
"this is funny: all message we do not understand, are passed |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
788 |
on to the stream which will send the characters via nextPut: |
3006 | 789 |
This way, we understand all Stream messages - great isn't it!!" |
790 |
||
3243 | 791 |
^ aMessage sendTo:entryStream |
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
792 |
! |
0 | 793 |
|
4311 | 794 |
ensureCr |
795 |
"if the output position is not already at the beginning of a line, |
|
796 |
output a carriage return" |
|
797 |
||
798 |
|needCR| |
|
799 |
||
800 |
collecting ifTrue:[ |
|
801 |
needCR := outstandingLine notEmptyOrNil |
|
802 |
] ifFalse:[ |
|
803 |
needCR := cursorCol > 0 |
|
804 |
]. |
|
805 |
||
806 |
needCR ifTrue:[ |
|
807 |
self cr. |
|
808 |
]. |
|
809 |
||
810 |
"Created: / 14-09-2011 / 09:01:03 / cg" |
|
811 |
! |
|
812 |
||
5025 | 813 |
format:formatSpec with:args |
5569 | 814 |
"convenient formatted printing: |
815 |
%1..%9 - positional parameters from args-collection |
|
816 |
%(name) - named parameter from args-dictionary |
|
817 |
%% - escape for % |
|
818 |
%<cr> - cr (also tab, nl)" |
|
819 |
||
5025 | 820 |
^ entryStream format:formatSpec with:args |
5569 | 821 |
|
822 |
" |
|
823 |
1 to: 10 do:[:i | |
|
824 |
Transcript |
|
825 |
format:'[%1] Hello %2 World - this is %3%<cr>' |
|
826 |
with:{i . 'my' . 'nice'} |
|
827 |
]. |
|
828 |
" |
|
5025 | 829 |
! |
830 |
||
0 | 831 |
lineLength |
928 | 832 |
"to make a textCollector (somewhat) compatible with printer |
833 |
streams, support the lineLength query" |
|
834 |
||
4918 | 835 |
^ width // (gc font width) |
928 | 836 |
|
837 |
"Modified: 11.1.1997 / 14:42:41 / cg" |
|
0 | 838 |
! |
839 |
||
840 |
nextPut:something |
|
928 | 841 |
"append somethings printString to my displayed text. |
842 |
This allows TextCollectors to be used Stream-wise" |
|
0 | 843 |
|
1504
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
844 |
|txt| |
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
845 |
|
656 | 846 |
(something isCharacter) ifTrue:[ |
847 |
((something == Character cr) or:[something == Character nl]) ifTrue:[ |
|
848 |
^ self cr |
|
849 |
]. |
|
0 | 850 |
]. |
1504
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
851 |
|
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
852 |
txt := something asString. |
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
853 |
currentEmphasis notNil ifTrue:[ |
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
854 |
txt := txt emphasizeAllWith:currentEmphasis |
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
855 |
]. |
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
856 |
self show:txt. |
656 | 857 |
|
858 |
"/ flushPending ifTrue:[ |
|
859 |
"/ self endEntry |
|
860 |
"/ ]. |
|
861 |
"/ (something isMemberOf:Character) ifTrue:[ |
|
862 |
"/ ((something == Character cr) or:[something == Character nl]) ifTrue:[ |
|
863 |
"/ ^ self cr |
|
864 |
"/ ]. |
|
865 |
"/ self insertCharAtCursor:something |
|
866 |
"/ ] ifFalse:[ |
|
867 |
"/ self insertStringAtCursor:(something printString). |
|
868 |
"/ self checkLineLimit |
|
869 |
"/ ]. |
|
870 |
"/ device flush |
|
871 |
||
928 | 872 |
"Modified: 11.1.1997 / 14:43:05 / cg" |
0 | 873 |
! |
874 |
||
875 |
nextPutAll:something |
|
928 | 876 |
"append all of something to my displayed text. |
877 |
This allows TextCollectors to be used Stream-wise" |
|
0 | 878 |
|
3958 | 879 |
self show:(currentEmphasis notNil |
880 |
ifTrue:[something emphasizeAllWith:currentEmphasis] |
|
881 |
ifFalse:[something]) |
|
656 | 882 |
|
928 | 883 |
"Modified: 11.1.1997 / 14:43:26 / cg" |
0 | 884 |
! |
885 |
||
5320 | 886 |
nextPutAll:count from:buffer startingAt:initialPosition |
887 |
"append count characters from buffer starting at initialPosition to my displayed text. |
|
888 |
This allows TextCollectors to be used Stream-wise" |
|
889 |
||
890 |
|stringToShow| |
|
891 |
||
892 |
stringToShow := buffer copyFrom:initialPosition to:initialPosition+count-1. |
|
893 |
||
894 |
self show:(currentEmphasis notNil |
|
895 |
ifTrue:[stringToShow emphasizeAllWith:currentEmphasis] |
|
896 |
ifFalse:[stringToShow]). |
|
897 |
^ count. |
|
898 |
||
899 |
"Modified: 11.1.1997 / 14:43:26 / cg" |
|
900 |
! |
|
901 |
||
5603 | 902 |
printf:formatSpec |
6296 | 903 |
"convenient C-style formatted printing. |
904 |
For smalltalk specific formats, |
|
905 |
see documentation in PrintfScanf >> format_printf" |
|
5603 | 906 |
|
907 |
^ entryStream printf:formatSpec |
|
908 |
||
909 |
" |
|
910 |
1 to: 10 do:[:i | |
|
911 |
Transcript printf:'Hello World\n' |
|
912 |
]. |
|
913 |
" |
|
914 |
! |
|
915 |
||
6111 | 916 |
printf:formatSpec arguments:args |
917 |
"convenient C-style formatted printing with an arbitrary number of arguments. |
|
6296 | 918 |
Same as printf:withAll:, for protocol completeness. |
919 |
For smalltalk specific formats, |
|
920 |
see documentation in PrintfScanf >> format_printf" |
|
6111 | 921 |
|
922 |
^ entryStream printf:formatSpec withAll:args |
|
923 |
||
924 |
" |
|
925 |
1 to: 10 do:[:i | |
|
926 |
Transcript |
|
927 |
printf:'[%d] Hello %s World - this is %s\n' |
|
928 |
with:{i . 'my' . 'nice'} |
|
929 |
]. |
|
930 |
" |
|
931 |
||
932 |
"Created: / 23-02-2017 / 16:43:46 / cg" |
|
933 |
! |
|
934 |
||
5569 | 935 |
printf:formatSpec with:arg1 |
6296 | 936 |
"convenient C-style formatted printing with 1 argument. |
937 |
For smalltalk specific formats, |
|
938 |
see documentation in PrintfScanf >> format_printf" |
|
5569 | 939 |
|
940 |
^ entryStream printf:formatSpec with:arg1 |
|
941 |
||
942 |
" |
|
943 |
1 to: 10 do:[:i | |
|
5603 | 944 |
Transcript printf:'[%d] Hello World\n' with:i |
5569 | 945 |
]. |
946 |
" |
|
947 |
! |
|
948 |
||
949 |
printf:formatSpec with:arg1 with:arg2 |
|
6296 | 950 |
"convenient C-style formatted printing with 2 arguments. |
951 |
For smalltalk specific formats, |
|
952 |
see documentation in PrintfScanf >> format_printf" |
|
5569 | 953 |
|
954 |
^ entryStream printf:formatSpec with:arg1 with:arg2 |
|
955 |
||
956 |
" |
|
957 |
1 to: 10 do:[:i | |
|
958 |
Transcript |
|
959 |
printf:'[%d] Hello World\n' with:i |
|
960 |
]. |
|
961 |
" |
|
962 |
! |
|
963 |
||
964 |
printf:formatSpec with:arg1 with:arg2 with:arg3 |
|
6296 | 965 |
"convenient C-style formatted printing with 3 arguments. |
966 |
For smalltalk specific formats, |
|
967 |
see documentation in PrintfScanf >> format_printf" |
|
5569 | 968 |
|
969 |
^ entryStream printf:formatSpec with:arg1 with:arg2 with:arg3 |
|
970 |
||
971 |
" |
|
972 |
1 to: 10 do:[:i | |
|
973 |
Transcript |
|
974 |
printf:'[%d] Hello World\n' with:i |
|
975 |
]. |
|
976 |
" |
|
977 |
! |
|
978 |
||
979 |
printf:formatSpec with:arg1 with:arg2 with:arg3 with:arg4 |
|
6296 | 980 |
"convenient C-style formatted printing. |
981 |
For smalltalk specific formats, |
|
982 |
see documentation in PrintfScanf >> format_printf" |
|
5569 | 983 |
|
984 |
^ entryStream printf:formatSpec with:arg1 with:arg2 with:arg3 with:arg4 |
|
985 |
||
986 |
" |
|
987 |
1 to: 10 do:[:i | |
|
988 |
Transcript |
|
989 |
printf:'[%d] Hello World\n' with:i |
|
990 |
]. |
|
991 |
" |
|
992 |
! |
|
993 |
||
994 |
printf:formatSpec with:arg1 with:arg2 with:arg3 with:arg4 with:arg5 |
|
6296 | 995 |
"convenient C-style formatted printing. |
996 |
For smalltalk specific formats, |
|
997 |
see documentation in PrintfScanf >> format_printf" |
|
5569 | 998 |
|
999 |
^ entryStream printf:formatSpec with:arg1 with:arg2 with:arg3 with:arg4 with:arg5 |
|
1000 |
||
1001 |
" |
|
1002 |
1 to: 10 do:[:i | |
|
1003 |
Transcript |
|
1004 |
printf:'[%d] Hello World\n' with:i |
|
1005 |
]. |
|
1006 |
" |
|
1007 |
! |
|
1008 |
||
1009 |
printf:formatSpec withAll:args |
|
6296 | 1010 |
"convenient C-style formatted printing with an arbitrary number of arguments. |
1011 |
For smalltalk specific formats, |
|
1012 |
see documentation in PrintfScanf >> format_printf" |
|
5569 | 1013 |
|
1014 |
^ entryStream printf:formatSpec withAll:args |
|
1015 |
||
1016 |
" |
|
1017 |
1 to: 10 do:[:i | |
|
1018 |
Transcript |
|
1019 |
printf:'[%d] Hello %s World - this is %s\n' |
|
1020 |
with:{i . 'my' . 'nice'} |
|
1021 |
]. |
|
1022 |
" |
|
1023 |
! |
|
1024 |
||
5130 | 1025 |
println |
1026 |
"for those used to Java/Javascript, a compatibility message. |
|
1027 |
Most useful inside expecco" |
|
1028 |
||
1029 |
self cr |
|
1030 |
! |
|
1031 |
||
1032 |
println:anObject |
|
1033 |
"for those used to Java/Javascript, a compatibility message. |
|
1034 |
Most useful inside expecco" |
|
1035 |
||
1036 |
self showCR:anObject |
|
1037 |
! |
|
1038 |
||
0 | 1039 |
show:anObject |
1040 |
"insert the argument aString at current cursor position" |
|
1041 |
||
4045 | 1042 |
|printString lines| |
0 | 1043 |
|
4045 | 1044 |
printString := anObject printString. |
928 | 1045 |
|
4643 | 1046 |
(self == Transcript) ifTrue:[ |
1047 |
DebugSendersOfMessagePattern notNil ifTrue:[ |
|
1048 |
(DebugSendersOfMessagePattern match:printString string) ifTrue:[ |
|
5733 | 1049 |
"to disable this breakpoint in the future, evaluate: |
1050 |
DebugSendersOfMessagePattern := nil |
|
1051 |
" |
|
4643 | 1052 |
self halt:('Transcript: text matches: "', printString,'"'). |
1053 |
]. |
|
4122 | 1054 |
]. |
4643 | 1055 |
TraceSendersOfMessagePattern notNil ifTrue:[ |
1056 |
(TraceSendersOfMessagePattern match:printString string) ifTrue:[ |
|
1057 |
printString := self senderTraceString,': ',printString |
|
1058 |
]. |
|
4365 | 1059 |
]. |
1060 |
]. |
|
4105
c2c3a96f8757
debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
1061 |
|
4045 | 1062 |
(printString includes:(Character cr)) ifTrue:[ |
1063 |
lines := printString asStringCollection. |
|
653 | 1064 |
lines keysAndValuesDo:[:nr :line | |
1562
9b7557a81849
made the number of buffered lines an instVar.
Claus Gittinger <cg@exept.de>
parents:
1504
diff
changeset
|
1065 |
(nr == lines size |
4045 | 1066 |
and:[(printString endsWith:(Character cr)) not]) ifTrue:[ |
653 | 1067 |
"/ the last one. |
1068 |
self show:line |
|
1069 |
] ifFalse:[ |
|
1070 |
self showCR:line |
|
1071 |
]. |
|
1072 |
]. |
|
1073 |
^ self. |
|
308
b216a5efa2c8
handle show: with a string containing cr's
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
1074 |
]. |
b216a5efa2c8
handle show: with a string containing cr's
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
1075 |
|
1026 | 1076 |
access critical:[ |
4650 | 1077 |
"/ self ~~ Transcript ifTrue:['xs' printCR]. |
3295
37cb2b5d579a
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3248
diff
changeset
|
1078 |
outstandingLine size ~~ 0 ifTrue:[ |
4045 | 1079 |
outstandingLine := outstandingLine , printString |
1026 | 1080 |
] ifFalse:[ |
4045 | 1081 |
outstandingLine := printString |
653 | 1082 |
]. |
1026 | 1083 |
collecting ifTrue:[ |
1084 |
flushPending ifFalse:[ |
|
1085 |
self installDelayedUpdate |
|
1312
eaa44f7649f5
flush after some lines have been collected
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
1086 |
] ifTrue:[ |
1562
9b7557a81849
made the number of buffered lines an instVar.
Claus Gittinger <cg@exept.de>
parents:
1504
diff
changeset
|
1087 |
outstandingLines size > collectSize ifTrue:[ |
1312
eaa44f7649f5
flush after some lines have been collected
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
1088 |
self endEntry |
eaa44f7649f5
flush after some lines have been collected
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
1089 |
] |
1026 | 1090 |
] |
1091 |
] ifFalse:[ |
|
1092 |
self endEntry |
|
653 | 1093 |
] |
1026 | 1094 |
]. |
0 | 1095 |
|
4411 | 1096 |
"Modified: / 24-03-2012 / 20:04:10 / cg" |
4428 | 1097 |
"Modified (format): / 02-06-2012 / 01:54:55 / cg" |
6588 | 1098 |
"Modified: / 29-05-2019 / 11:59:55 / Claus Gittinger" |
1617 | 1099 |
! |
1100 |
||
1101 |
showCR:anObject |
|
1102 |
"insert the argument aString at current cursor position, |
|
1103 |
and advance to the next line. This is the same as a #show: |
|
1104 |
followed by a #cr." |
|
1105 |
||
5302 | 1106 |
|printString lines crlf| |
1617 | 1107 |
|
4647 | 1108 |
"/ self ~~ Transcript ifTrue:[ ^ self tshow:anObject]. |
4045 | 1109 |
printString := anObject printString. |
6112 | 1110 |
printString isEmptyOrNil ifTrue:[ |
2689
ddaa98a64bd5
Fix #showCR: when displaying multi-line strings
Stefan Vogel <sv@exept.de>
parents:
2632
diff
changeset
|
1111 |
self cr. |
ddaa98a64bd5
Fix #showCR: when displaying multi-line strings
Stefan Vogel <sv@exept.de>
parents:
2632
diff
changeset
|
1112 |
^ self. |
1617 | 1113 |
]. |
1114 |
||
4643 | 1115 |
self == Transcript ifTrue:[ |
1116 |
DebugSendersOfMessagePattern notNil ifTrue:[ |
|
1117 |
(DebugSendersOfMessagePattern match:printString string) ifTrue:[ |
|
1118 |
"/ to disable this right from inside the debugger, evaluate: |
|
5454 | 1119 |
" |
1120 |
DebugSendersOfMessagePattern := nil |
|
1121 |
" |
|
4643 | 1122 |
self halt:('Transcript: text matches: "', printString, '"'). |
1123 |
]. |
|
4365 | 1124 |
]. |
4643 | 1125 |
TraceSendersOfMessagePattern notNil ifTrue:[ |
1126 |
(TraceSendersOfMessagePattern match:printString string) ifTrue:[ |
|
1127 |
printString := self senderTraceString,': ',printString |
|
1128 |
]. |
|
4122 | 1129 |
]. |
4105
c2c3a96f8757
debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
1130 |
]. |
c2c3a96f8757
debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
1131 |
|
5302 | 1132 |
crlf := String crlf. |
1133 |
(printString includesAny:crlf) ifTrue:[ |
|
4045 | 1134 |
lines := printString asStringCollection. |
2689
ddaa98a64bd5
Fix #showCR: when displaying multi-line strings
Stefan Vogel <sv@exept.de>
parents:
2632
diff
changeset
|
1135 |
lines do:[:line| |
5302 | 1136 |
|lineWithoutEOL| |
1137 |
||
4106 | 1138 |
(line endsWith:Character nl) ifTrue:[ |
5302 | 1139 |
(line endsWith:crlf) ifTrue:[ |
1140 |
lineWithoutEOL := line copyButLast:2. |
|
4106 | 1141 |
] ifFalse:[ |
5302 | 1142 |
lineWithoutEOL := line copyButLast:1. |
4106 | 1143 |
] |
2805 | 1144 |
] ifFalse:[ |
4106 | 1145 |
(line endsWith:Character return) ifTrue:[ |
5302 | 1146 |
lineWithoutEOL := line copyButLast:1. |
4106 | 1147 |
] ifFalse:[ |
5302 | 1148 |
lineWithoutEOL := line |
4106 | 1149 |
] |
5302 | 1150 |
]. |
1151 |
self addLine:lineWithoutEOL. |
|
1617 | 1152 |
]. |
1153 |
^ self. |
|
1154 |
]. |
|
4106 | 1155 |
self addLine:printString |
4365 | 1156 |
|
4410 | 1157 |
"Modified: / 24-03-2012 / 20:00:08 / cg" |
6112 | 1158 |
"Modified: / 27-02-2017 / 15:22:47 / stefan" |
4073 | 1159 |
! |
1160 |
||
4473 | 1161 |
space |
1162 |
self show:' ' |
|
1163 |
! |
|
1164 |
||
4073 | 1165 |
tab |
1166 |
"append a tab-character to the stream. |
|
1167 |
This is only allowed, if the receiver supports writing." |
|
1168 |
||
1169 |
self nextPut:(Character tab) |
|
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1170 |
! ! |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1171 |
|
2746 | 1172 |
!TextCollector methodsFor:'stream messages-emphasis'! |
1822
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1173 |
|
6588 | 1174 |
bgColor:aColorOrNil |
1175 |
"followup characters sent with stream messages (nextPut/nextPutAll) |
|
1176 |
will be rendered with background color in aColorOrNil. |
|
1177 |
Does not affect show/showCR" |
|
1178 |
||
1179 |
aColorOrNil isNil ifTrue:[ |
|
4658 | 1180 |
currentEmphasis := Text removeEmphasis:#backgroundColor from:currentEmphasis |
1181 |
] ifFalse:[ |
|
6588 | 1182 |
currentEmphasis := Text addEmphasis:(#backgroundColor->aColorOrNil) to:currentEmphasis |
4658 | 1183 |
] |
6588 | 1184 |
|
1185 |
"Modified (comment): / 29-05-2019 / 12:01:21 / Claus Gittinger" |
|
2539 | 1186 |
! |
1187 |
||
1822
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1188 |
bold |
6588 | 1189 |
"switch to bold |
1190 |
followup characters sent with stream messages (nextPut/nextPutAll) |
|
1191 |
will be rendered in a bold font. |
|
1192 |
Does not affect show/showCR" |
|
3205 | 1193 |
|
4658 | 1194 |
currentEmphasis := Text addEmphasis:#bold to:currentEmphasis |
6588 | 1195 |
|
1196 |
" |
|
1197 |
Transcript |
|
1198 |
nextPutAll:'hello'; |
|
1199 |
bold; |
|
1200 |
nextPutAll:' world'; |
|
1201 |
notBold; |
|
1202 |
nextPutLine:' again' |
|
1203 |
" |
|
1204 |
||
1205 |
"Modified (comment): / 29-05-2019 / 12:05:08 / Claus Gittinger" |
|
1822
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1206 |
! |
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1207 |
|
6588 | 1208 |
color:aColorOrNil |
1209 |
"switch color |
|
1210 |
followup characters sent with stream messages (nextPut/nextPutAll) |
|
1211 |
will be rendered in aColorOrNil. |
|
1212 |
Does not affect show/showCR" |
|
1213 |
||
6162 | 1214 |
currentEmphasis := Text removeEmphasis:#color from:currentEmphasis. |
6588 | 1215 |
aColorOrNil notNil ifTrue:[ |
1216 |
currentEmphasis := Text addEmphasis:(#color->aColorOrNil) to:currentEmphasis |
|
4658 | 1217 |
]. |
1822
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1218 |
|
6588 | 1219 |
" |
1220 |
Transcript |
|
1221 |
nextPutAll:'hello'; |
|
1222 |
color:Color red; |
|
1223 |
nextPutAll:' world'; |
|
1224 |
color:nil; |
|
1225 |
nextPutLine:' again' |
|
1226 |
" |
|
1227 |
" |
|
1228 |
Transcript |
|
1229 |
showCR:('hello' allBold , ' world') |
|
1230 |
" |
|
1231 |
||
6162 | 1232 |
"Modified: / 30-05-2017 / 09:37:26 / cg" |
6588 | 1233 |
"Modified (comment): / 29-05-2019 / 12:05:33 / Claus Gittinger" |
1234 |
! |
|
1235 |
||
1236 |
emphasis:anEmphasisCollectionOrNil |
|
1237 |
"change emphasis |
|
1238 |
followup characters sent with stream messages (nextPut/nextPutAll) |
|
1239 |
will be rendered with anEmphasisCollectionOrNil. |
|
1240 |
Does not affect show/showCR" |
|
1241 |
||
1242 |
currentEmphasis := anEmphasisCollectionOrNil |
|
1243 |
||
1244 |
" |
|
1245 |
Transcript |
|
1246 |
nextPutAll:'hello '; |
|
1247 |
emphasis:#( bold underline ); |
|
1248 |
nextPutAll:'world'; |
|
1249 |
emphasis:nil; |
|
1250 |
nextPutLine:' again' |
|
1251 |
" |
|
1252 |
" |
|
1253 |
Transcript |
|
1254 |
nextPutAll:'hello'; |
|
1255 |
bold; |
|
1256 |
nextPutAll:' world'; |
|
1257 |
notBold; |
|
1258 |
nextPutLine:' again' |
|
1259 |
" |
|
1260 |
||
1261 |
"Created: / 29-05-2019 / 11:45:35 / Claus Gittinger" |
|
1822
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1262 |
! |
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1263 |
|
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1264 |
italic |
6588 | 1265 |
"switch to italic |
1266 |
followup characters sent with stream messages (nextPut/nextPutAll) |
|
1267 |
will be rendered in an italic font. |
|
1268 |
Does not affect show/showCR" |
|
1269 |
||
6172 | 1270 |
currentEmphasis := Text addEmphasis:(Text italicEmphasis) to:currentEmphasis |
1271 |
||
1272 |
"Modified: / 20-06-2017 / 08:35:20 / cg" |
|
6588 | 1273 |
"Modified (comment): / 29-05-2019 / 12:03:02 / Claus Gittinger" |
1822
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1274 |
! |
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1275 |
|
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1276 |
normal |
6588 | 1277 |
"switch back to normal |
1278 |
followup characters sent with stream messages (nextPut/nextPutAll) |
|
1279 |
will be rendered in the default font without color" |
|
1280 |
||
1822
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1281 |
currentEmphasis := nil |
6588 | 1282 |
|
1283 |
"Modified (comment): / 29-05-2019 / 12:03:40 / Claus Gittinger" |
|
1822
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1284 |
! |
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1285 |
|
4659 | 1286 |
notBold |
6588 | 1287 |
"switch to non-bold |
1288 |
followup characters sent with stream messages (nextPut/nextPutAll) |
|
1289 |
will be rendered in a non-bold font. |
|
1290 |
Does not affect show/showCR" |
|
4659 | 1291 |
|
1292 |
currentEmphasis := Text removeEmphasis:#bold from:currentEmphasis |
|
6588 | 1293 |
|
1294 |
"Modified (comment): / 29-05-2019 / 12:04:00 / Claus Gittinger" |
|
4659 | 1295 |
! |
1296 |
||
1297 |
notItalic |
|
6588 | 1298 |
"switch to non-italic |
1299 |
followup characters sent with stream messages (nextPut/nextPutAll) |
|
1300 |
will be rendered in a non-italic font. |
|
1301 |
Does not affect show/showCR" |
|
4659 | 1302 |
|
6172 | 1303 |
currentEmphasis := Text removeEmphasis:(Text italicEmphasis) from:currentEmphasis |
1304 |
||
1305 |
"Modified: / 20-06-2017 / 08:35:26 / cg" |
|
6588 | 1306 |
"Modified (comment): / 29-05-2019 / 12:04:09 / Claus Gittinger" |
4659 | 1307 |
! |
1308 |
||
1309 |
notReverse |
|
6588 | 1310 |
"switch back default colors" |
1311 |
||
4659 | 1312 |
currentEmphasis := Text removeEmphasis:#color from:currentEmphasis. |
1313 |
currentEmphasis := Text removeEmphasis:#backgroundColor from:currentEmphasis. |
|
6588 | 1314 |
|
1315 |
"Modified (comment): / 29-05-2019 / 11:42:52 / Claus Gittinger" |
|
4659 | 1316 |
! |
1317 |
||
1318 |
notUnderline |
|
6588 | 1319 |
"switch to non-underline |
1320 |
followup characters sent with stream messages (nextPut/nextPutAll) |
|
1321 |
will be rendered without underline. |
|
1322 |
Does not affect show/showCR" |
|
1323 |
||
4659 | 1324 |
currentEmphasis := Text removeEmphasis:#underline from:currentEmphasis |
1325 |
||
6588 | 1326 |
"Created: / 26-03-1999 / 14:27:07 / cg" |
1327 |
"Modified (comment): / 29-05-2019 / 12:04:32 / Claus Gittinger" |
|
4659 | 1328 |
! |
1329 |
||
1822
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1330 |
reverse |
6588 | 1331 |
"switch to reverse |
1332 |
followup characters sent with stream messages (nextPut/nextPutAll) |
|
1333 |
will be rendered with reversed colors. |
|
1334 |
Does not affect show/showCR" |
|
1335 |
||
4658 | 1336 |
currentEmphasis := Text addEmphasis:(#color->bgColor) to:currentEmphasis. |
1337 |
currentEmphasis := Text addEmphasis:(#backgroundColor->fgColor) to:currentEmphasis. |
|
6588 | 1338 |
|
1339 |
"Modified (comment): / 29-05-2019 / 12:04:52 / Claus Gittinger" |
|
1822
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1340 |
! |
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1341 |
|
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1342 |
underline |
6588 | 1343 |
"switch to underline |
1344 |
followup characters sent with stream messages (nextPut/nextPutAll) |
|
1345 |
will be rendered with underline. |
|
1346 |
Does not affect show/showCR" |
|
1347 |
||
4658 | 1348 |
currentEmphasis := Text addEmphasis:#underline to:currentEmphasis |
1822
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1349 |
|
6588 | 1350 |
"Created: / 26-03-1999 / 14:27:07 / cg" |
1351 |
"Modified (comment): / 29-05-2019 / 12:04:39 / Claus Gittinger" |
|
1822
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1352 |
! ! |
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1353 |
|
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1354 |
!TextCollector methodsFor:'transcript specials'! |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1355 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1356 |
beTranscript |
928 | 1357 |
"make the receiver be the systemTranscript; this one |
5575 | 1358 |
is accessible via the global Transcript and gets relevant |
928 | 1359 |
system messages from various places." |
1360 |
||
3852
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
1361 |
self beTranscript:#Transcript |
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
1362 |
|
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
1363 |
"Modified: / 2.11.1997 / 22:34:47 / cg" |
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
1364 |
! |
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
1365 |
|
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
1366 |
beTranscript:name |
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
1367 |
"make the receiver be the systemTranscript; this one |
5575 | 1368 |
is accessible via the global Transcript and gets relevant |
3852
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
1369 |
system messages from various places." |
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
1370 |
|
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1371 |
|fg bg cFg cBg| |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1372 |
|
5908 | 1373 |
self assert:((Smalltalk includesKey:name) not |
1374 |
or:[ (Smalltalk at:name) isBehavior not ]). |
|
3852
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
1375 |
Smalltalk at:name put:self. |
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1376 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1377 |
" |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1378 |
fancy feature: whenever Transcript is closed, reset to StdError |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1379 |
" |
1421
afef284eadc4
only reset Transcript to stdErr, if I really am the transcript.
ca
parents:
1389
diff
changeset
|
1380 |
self destroyAction:[ |
3852
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
1381 |
self == (Smalltalk at:name) ifTrue:[ |
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
1382 |
Smalltalk at:name put:Stderr |
1421
afef284eadc4
only reset Transcript to stdErr, if I really am the transcript.
ca
parents:
1389
diff
changeset
|
1383 |
] |
afef284eadc4
only reset Transcript to stdErr, if I really am the transcript.
ca
parents:
1389
diff
changeset
|
1384 |
]. |
0 | 1385 |
|
928 | 1386 |
"/ user may prefer a special color for this one; |
1387 |
"/ look into the style definitions ... |
|
1388 |
||
1389 | 1389 |
fg := styleSheet colorAt:'transcript.foregroundColor' default:self foregroundColor. |
1390 |
bg := styleSheet colorAt:'transcript.backgroundColor' default:self backgroundColor. |
|
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1391 |
self foregroundColor:fg backgroundColor:bg. |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1392 |
self viewBackground:bg. |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1393 |
|
1389 | 1394 |
cFg := styleSheet colorAt:'transcript.cursorForegroundColor' default:bg. |
1395 |
cBg := styleSheet colorAt:'transcript.cursorBackgroundColor' default:fg. |
|
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1396 |
self cursorForegroundColor:cFg backgroundColor:cBg. |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1397 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1398 |
"self lineLimit:1000. " "or whatever you think makes sense" |
928 | 1399 |
|
1389 | 1400 |
"Modified: / 2.11.1997 / 22:34:47 / cg" |
2928
24991431c7e0
added #clear (to clear its contents)
Claus Gittinger <cg@exept.de>
parents:
2831
diff
changeset
|
1401 |
! |
24991431c7e0
added #clear (to clear its contents)
Claus Gittinger <cg@exept.de>
parents:
2831
diff
changeset
|
1402 |
|
4643 | 1403 |
beginEntry |
1404 |
"noop for now, ST80 compatibility" |
|
1405 |
||
1406 |
^ self |
|
1407 |
||
1408 |
"Created: / 4.3.1998 / 11:08:14 / stefan" |
|
1409 |
! |
|
1410 |
||
2928
24991431c7e0
added #clear (to clear its contents)
Claus Gittinger <cg@exept.de>
parents:
2831
diff
changeset
|
1411 |
clear |
3119 | 1412 |
self endEntry. |
2928
24991431c7e0
added #clear (to clear its contents)
Claus Gittinger <cg@exept.de>
parents:
2831
diff
changeset
|
1413 |
self contents:nil. |
24991431c7e0
added #clear (to clear its contents)
Claus Gittinger <cg@exept.de>
parents:
2831
diff
changeset
|
1414 |
|
24991431c7e0
added #clear (to clear its contents)
Claus Gittinger <cg@exept.de>
parents:
2831
diff
changeset
|
1415 |
" |
24991431c7e0
added #clear (to clear its contents)
Claus Gittinger <cg@exept.de>
parents:
2831
diff
changeset
|
1416 |
Transcript clear |
24991431c7e0
added #clear (to clear its contents)
Claus Gittinger <cg@exept.de>
parents:
2831
diff
changeset
|
1417 |
" |
3774 | 1418 |
! |
1419 |
||
4650 | 1420 |
delayedEndEntry |
1421 |
"flush collected output; displaying all that has been buffered so far" |
|
1422 |
||
1423 |
"/ self ~~ Transcript ifTrue:[ 'de0' printCR ]. |
|
1424 |
inFlush ifTrue:[ |
|
1425 |
"/ self ~~ Transcript ifTrue:[ 'deX' printCR ]. |
|
1426 |
^ self |
|
1427 |
]. |
|
1428 |
||
1429 |
"/ self ~~ Transcript ifTrue:[ 'de1' printCR ]. |
|
1430 |
access owner == Processor activeProcess ifTrue:[ |
|
1431 |
"/ self ~~ Transcript ifTrue:[ 'de2' printCR ]. |
|
1432 |
self installDelayedUpdate. |
|
1433 |
^ self |
|
1434 |
]. |
|
1435 |
||
1436 |
self endEntry |
|
1437 |
! |
|
1438 |
||
4643 | 1439 |
endEntry |
1440 |
"flush collected output; displaying all that has been buffered so far" |
|
1441 |
||
5644 | 1442 |
|nLines lines| |
4643 | 1443 |
|
4965 | 1444 |
((outstandingLines isEmptyOrNil) and:[outstandingLine isEmptyOrNil]) ifTrue:[ |
4650 | 1445 |
"/ self ~~ Transcript ifTrue:[ 'e- ' print. thisContext sender selector printCR ]. |
1446 |
^ self |
|
1447 |
]. |
|
4965 | 1448 |
shown ifFalse:[ |
1449 |
"/ when iconified or not yet shown, keep |
|
1450 |
"/ collecting. But not too much ... |
|
1451 |
outstandingLines size < 300 ifTrue:[ |
|
1452 |
"/ self ~~ Transcript ifTrue:[ 'eC' printCR ]. |
|
1453 |
access critical:[ |
|
1454 |
flushPending ifFalse:[ |
|
1455 |
self installDelayedUpdate. |
|
1456 |
]. |
|
1457 |
]. |
|
1458 |
^ self |
|
1459 |
] |
|
1460 |
]. |
|
4650 | 1461 |
|
4963 | 1462 |
(device isNil or:[device isOpen not or:[self drawableId isNil]]) ifTrue:[ |
4961 | 1463 |
"on snapshot load, Transcript may not yet be re-created. |
1464 |
Write to Stderr then." |
|
1465 |
Stderr notNil ifTrue:[ |
|
4963 | 1466 |
outstandingLines do:[:eachLine| |
1467 |
eachLine printOn:Stderr. |
|
1468 |
]. |
|
4961 | 1469 |
outstandingLines := nil. |
1470 |
outstandingLine notNil ifTrue:[ |
|
1471 |
outstandingLine printOn:Stderr. |
|
1472 |
outstandingLine := nil. |
|
1473 |
]. |
|
1474 |
Stderr cr. |
|
1475 |
]. |
|
1476 |
^ self. |
|
1477 |
]. |
|
1478 |
||
4650 | 1479 |
"/ self ~~ Transcript ifTrue:[ 'e ' print. |
1480 |
"/ thisContext fullPrintAll. |
|
1481 |
"/ ]. |
|
4643 | 1482 |
|
4650 | 1483 |
"/ access owner == Processor activeProcess ifTrue:[ |
1484 |
"/self ~~ Transcript ifTrue:[ 'eI' printCR ]. |
|
1485 |
"/ self installDelayedUpdate. |
|
1486 |
"/ ^ self |
|
1487 |
"/ ]. |
|
4643 | 1488 |
|
1489 |
access critical:[ |
|
1490 |
collecting ifTrue:[ |
|
1491 |
flushBlock notNil ifTrue:[ |
|
1492 |
Processor removeTimedBlock:flushBlock. |
|
1493 |
]. |
|
4650 | 1494 |
"/ flushPending ifFalse:[ |
1495 |
"/self ~~ Transcript ifTrue:[ 'eP' printCR ]. |
|
1496 |
"/ ^ self |
|
1497 |
"/ ]. |
|
4643 | 1498 |
]. |
1499 |
||
4650 | 1500 |
"/ self ~~ Transcript ifTrue:[ 'e1' printCR ]. |
4643 | 1501 |
inFlush ifFalse:[ |
4650 | 1502 |
"/ self ~~ Transcript ifTrue:[ 'e2' printCR ]. |
4643 | 1503 |
inFlush := true. |
1504 |
[ |
|
1505 |
flushPending := false. |
|
5147 | 1506 |
self withAutoIndent:false do:[ |
4650 | 1507 |
"/ self ~~ Transcript ifTrue:[ 'e3 "' print. outstandingLine print. '" ' print. outstandingLine asByteArray hexPrintString print. ' ' printCR. |
1508 |
"/ (outstandingLines ? #()) do:[:l | '"' print. l print. '" ' print. l asByteArray hexPrintString printCR ]]. |
|
1509 |
(nLines := outstandingLines size) ~~ 0 ifTrue:[ |
|
1510 |
"/ self ~~ Transcript ifTrue:[ 'e4' printCR.]. |
|
4643 | 1511 |
"insert the bunch of lines - if any" |
1512 |
lines := outstandingLines. |
|
1513 |
outstandingLines := nil. |
|
1514 |
||
4650 | 1515 |
"/ self ~~ Transcript ifTrue:[ 'e5 ' print. nLines printCR.]. |
4643 | 1516 |
(nLines ~~ 0) ifTrue:[ |
1517 |
self isInInsertMode ifTrue:[ |
|
4650 | 1518 |
"/ self ~~ Transcript ifTrue:[ (nLines > 1 and:[(lines second ? '') startsWith:'111']) ifTrue:['e6a' printCR.self halt.]]. |
4643 | 1519 |
self insertLines:lines withCR:true. |
4650 | 1520 |
"/ self ~~ Transcript ifTrue:[ (nLines > 1 and:[(lines second ? '') startsWith:'111']) ifTrue:['e6a' printCR.self halt.]]. |
4643 | 1521 |
] ifFalse:[ |
1522 |
self replaceLines:lines withCR:true |
|
1523 |
]. |
|
1524 |
alwaysAppendAtEnd ifTrue:[ |
|
1525 |
self cursorToEnd. |
|
1526 |
]. |
|
1527 |
(cursorLine >= (firstLineShown + nFullLinesShown)) ifTrue:[ |
|
5137 | 1528 |
scrollLocked ifFalse:[ |
1529 |
self withCursorOffDo:[ |
|
6341 | 1530 |
self scrollDownLines:nLines |
5137 | 1531 |
] |
1532 |
]. |
|
4643 | 1533 |
]. |
1534 |
]. |
|
1535 |
]. |
|
1536 |
||
4650 | 1537 |
"/ self ~~ Transcript ifTrue:[ (nLines > 1 and:[(lines second ? '') startsWith:'111']) ifTrue:['e7a' printCR.self halt.]]. |
4643 | 1538 |
"and the last partial line - if any" |
1539 |
outstandingLine size ~~ 0 ifTrue:[ |
|
1540 |
self isInInsertMode ifTrue:[ |
|
1541 |
self insertStringAtCursor:outstandingLine. |
|
1542 |
] ifFalse:[ |
|
1543 |
self replaceStringAtCursor:outstandingLine. |
|
1544 |
]. |
|
1545 |
outstandingLine := ''. |
|
1546 |
]. |
|
1547 |
self checkLineLimit. |
|
1548 |
"/ device flush. |
|
5147 | 1549 |
]. |
4643 | 1550 |
] ensure:[ |
1551 |
inFlush := false. |
|
1552 |
] |
|
1553 |
]. |
|
4657 | 1554 |
"/ flushPending ifTrue:[ |
1555 |
"/ flushPending := false. |
|
1556 |
"/ self installDelayedUpdate |
|
1557 |
"/ ] |
|
4643 | 1558 |
]. |
1559 |
||
6341 | 1560 |
"Modified: / 09-11-1998 / 21:17:56 / cg" |
1561 |
"Modified: / 13-06-2018 / 22:00:27 / Claus Gittinger" |
|
4643 | 1562 |
! |
1563 |
||
3774 | 1564 |
flash |
1565 |
"make sure everything is visible, before flashing" |
|
1566 |
||
1567 |
self endEntry. |
|
1568 |
super flash. |
|
5408 | 1569 |
! |
1570 |
||
6219 | 1571 |
flash:messageOrNil withColor:flashColor |
5408 | 1572 |
"make sure everything is visible, before flashing" |
1573 |
||
1574 |
self endEntry. |
|
6219 | 1575 |
super flash:messageOrNil withColor:flashColor. |
1576 |
||
1577 |
"Modified (format): / 21-10-2017 / 23:13:42 / cg" |
|
0 | 1578 |
! ! |
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1579 |
|
928 | 1580 |
!TextCollector class methodsFor:'documentation'! |
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1581 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1582 |
version |
5408 | 1583 |
^ '$Header$' |
3958 | 1584 |
! |
1585 |
||
1586 |
version_CVS |
|
5408 | 1587 |
^ '$Header$' |
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1588 |
! ! |
2632 | 1589 |
|
4503 | 1590 |
|
2025
0c9729befabc
allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
1591 |
TextCollector initialize! |