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