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