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