author | Stefan Vogel <sv@exept.de> |
Mon, 27 Feb 2017 16:43:26 +0100 | |
changeset 6112 | 14fe1826a075 |
parent 6111 | 8f59c48aa393 |
child 6114 | f1a6c00aa715 |
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. |
4965 | 429 |
access := RecursionLock new 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. |
6108 | 452 |
access := RecursionLock new 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 |
|
522 |
lineLimit notNil ifTrue:[ |
|
2426
281067d406c7
eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents:
2371
diff
changeset
|
523 |
(cursorLine > lineLimit) ifTrue:[ |
281067d406c7
eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents:
2371
diff
changeset
|
524 |
nDel := list size - lineLimit. |
4772 | 525 |
self basicListRemoveFromIndex:1 toIndex:nDel. |
2426
281067d406c7
eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents:
2371
diff
changeset
|
526 |
newCursorLine := cursorLine - nDel. |
281067d406c7
eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents:
2371
diff
changeset
|
527 |
firstLineShown := firstLineShown - nDel. |
281067d406c7
eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents:
2371
diff
changeset
|
528 |
(firstLineShown < 1) ifTrue:[ |
281067d406c7
eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents:
2371
diff
changeset
|
529 |
newCursorLine := newCursorLine - firstLineShown + 1. |
281067d406c7
eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents:
2371
diff
changeset
|
530 |
firstLineShown := 1 |
281067d406c7
eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents:
2371
diff
changeset
|
531 |
]. |
281067d406c7
eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents:
2371
diff
changeset
|
532 |
self setCursorLine:newCursorLine. |
3320
a820e3101bb6
refresh when removing some lines after hitting linelimit
fm
parents:
3295
diff
changeset
|
533 |
self contentsChanged. |
a820e3101bb6
refresh when removing some lines after hitting linelimit
fm
parents:
3295
diff
changeset
|
534 |
self invalidate. |
2426
281067d406c7
eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents:
2371
diff
changeset
|
535 |
] |
3710 | 536 |
]. |
537 |
self autoRaise ifTrue:[ |
|
538 |
self topView |
|
539 |
raise; |
|
540 |
"/ setForegroundWindow; |
|
541 |
yourself. |
|
542 |
]. |
|
3320
a820e3101bb6
refresh when removing some lines after hitting linelimit
fm
parents:
3295
diff
changeset
|
543 |
|
a820e3101bb6
refresh when removing some lines after hitting linelimit
fm
parents:
3295
diff
changeset
|
544 |
"Modified: / 26-07-2006 / 16:02:15 / fm" |
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
545 |
! |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
546 |
|
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
547 |
installDelayedUpdate |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
548 |
"arrange for collecting input for some time, |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
549 |
and output all buffered strings at once after a while. |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
550 |
This makes output to the transcript much faster on systems |
553 | 551 |
with poor scrolling performance (i.e. dumb vga cards ...)." |
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
552 |
|
131 | 553 |
|p| |
34
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 |
flushPending ifFalse:[ |
553 | 556 |
inFlush ifFalse:[ |
4643 | 557 |
flushPending := true. |
553 | 558 |
" |
559 |
we could run under a process, which dies in the meantime; |
|
560 |
therefore, we have to arrange for the transcript process to |
|
561 |
be interrupted and do the update. |
|
562 |
" |
|
563 |
windowGroup isNil ifTrue:[ |
|
4503 | 564 |
p := Processor timeoutHandlerProcess |
553 | 565 |
] ifFalse:[ |
566 |
p := windowGroup process |
|
567 |
]. |
|
1221
0c2a4231fc9e
Move #isSystemProcess from ProcessorScheduler to Process.
Stefan Vogel <sv@exept.de>
parents:
1109
diff
changeset
|
568 |
(p isNil or:[p isSystemProcess]) ifTrue:[ |
834
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
569 |
self endEntry |
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
570 |
] ifFalse:[ |
1711 | 571 |
flushBlock isNil ifTrue:[ |
4650 | 572 |
flushBlock := [self delayedEndEntry]. |
1711 | 573 |
]. |
834
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
574 |
Processor addTimedBlock:flushBlock for:p afterSeconds:timeDelay. |
3009
7eb1704fa5a6
Avoid dangling references in context
Stefan Vogel <sv@exept.de>
parents:
3006
diff
changeset
|
575 |
]. |
4650 | 576 |
p := nil. "hack: avoid dangling references to p through the home context of flushBlock" |
553 | 577 |
] |
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
578 |
] |
553 | 579 |
|
1711 | 580 |
"Modified: / 17.4.1997 / 13:03:15 / stefan" |
581 |
"Modified: / 9.11.1998 / 14:34:07 / cg" |
|
4365 | 582 |
! |
583 |
||
584 |
senderTraceString |
|
585 |
"generate a sender trace string." |
|
586 |
||
587 |
|con| |
|
588 |
||
589 |
"/ skip over intermediate contexts |
|
590 |
"/ con := con sender. |
|
591 |
"/ con := thisContext sender sender. |
|
592 |
"/ [ con receiver == self ] whileTrue:[ |
|
593 |
"/ con := con sender |
|
594 |
"/ ]. |
|
595 |
con := DebugView interestingContextFrom:thisContext sender sender. |
|
596 |
^ con printString |
|
597 |
||
598 |
"Created: / 02-02-2012 / 11:58:17 / cg" |
|
0 | 599 |
! ! |
600 |
||
778
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
601 |
!TextCollector methodsFor:'queries'! |
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
602 |
|
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
603 |
current |
4687 | 604 |
"return the current (your screen's) transcript. |
5301 | 605 |
In multiDisplay applications, this need NOT be the main transcript, |
606 |
as each display may have its own transcript. |
|
778
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
607 |
But typically, this is the same as Transcript." |
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
608 |
|
2278 | 609 |
|theTranscript app| |
2025
0c9729befabc
allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
610 |
|
0c9729befabc
allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
611 |
theTranscript := TranscriptQuerySignal query. |
0c9729befabc
allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
612 |
theTranscript isNil ifTrue:[ |
2278 | 613 |
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
|
614 |
(app notNil and:[thisContext isRecursive not]) ifTrue:[ |
2278 | 615 |
theTranscript := (app transcript ? Stderr). |
616 |
] ifFalse:[ |
|
617 |
theTranscript := Stderr. |
|
618 |
] |
|
2025
0c9729befabc
allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
619 |
]. |
0c9729befabc
allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
620 |
^ theTranscript |
778
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
621 |
|
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
622 |
" |
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
623 |
Transcript current flash |
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
624 |
" |
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
625 |
|
4687 | 626 |
"Created: / 05-07-1996 / 14:14:34 / cg" |
627 |
"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
|
628 |
! |
fb138fb5cf04
#isStream answers true for Transcript
Stefan Vogel <sv@exept.de>
parents:
4428
diff
changeset
|
629 |
|
fb138fb5cf04
#isStream answers true for Transcript
Stefan Vogel <sv@exept.de>
parents:
4428
diff
changeset
|
630 |
isStream |
fb138fb5cf04
#isStream answers true for Transcript
Stefan Vogel <sv@exept.de>
parents:
4428
diff
changeset
|
631 |
"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
|
632 |
See #displayOn:" |
fb138fb5cf04
#isStream answers true for Transcript
Stefan Vogel <sv@exept.de>
parents:
4428
diff
changeset
|
633 |
|
fb138fb5cf04
#isStream answers true for Transcript
Stefan Vogel <sv@exept.de>
parents:
4428
diff
changeset
|
634 |
^ self == Transcript |
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 |
" |
fb138fb5cf04
#isStream answers true for Transcript
Stefan Vogel <sv@exept.de>
parents:
4428
diff
changeset
|
637 |
Transcript isStream |
fb138fb5cf04
#isStream answers true for Transcript
Stefan Vogel <sv@exept.de>
parents:
4428
diff
changeset
|
638 |
" |
4687 | 639 |
! |
640 |
||
641 |
isTextCollector |
|
642 |
^ true |
|
643 |
||
644 |
" |
|
645 |
Transcript isTextCollector |
|
646 |
" |
|
647 |
||
648 |
"Created: / 29-08-2013 / 11:32:46 / cg" |
|
5330 | 649 |
! |
650 |
||
651 |
position |
|
652 |
"for compatibiliy with normal streams; return the column" |
|
653 |
||
654 |
^ cursorCol |
|
5989 | 655 |
! |
656 |
||
657 |
showLineLimitInMenu |
|
658 |
^ true. |
|
778
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
659 |
! ! |
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
660 |
|
2450 | 661 |
!TextCollector methodsFor:'scrolling'! |
662 |
||
5136 | 663 |
makeCursorVisible |
5137 | 664 |
(scrollLocked ? false) ifFalse:[ |
5136 | 665 |
access critical:[ |
666 |
super makeCursorVisible |
|
667 |
] |
|
668 |
] |
|
669 |
! |
|
670 |
||
671 |
scrollLock:aBoolean |
|
672 |
aBoolean ifTrue:[ |
|
673 |
scrollWhenUpdating := #endOfText. |
|
674 |
] ifFalse:[ |
|
675 |
scrollWhenUpdating := nil. |
|
676 |
]. |
|
5137 | 677 |
scrollLocked := aBoolean. |
5136 | 678 |
! |
679 |
||
2450 | 680 |
scrollTo:anOrigin redraw:doRedraw |
681 |
access critical:[ |
|
682 |
super scrollTo:anOrigin redraw:doRedraw |
|
683 |
] |
|
684 |
! ! |
|
685 |
||
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
686 |
!TextCollector methodsFor:'stream messages'! |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
687 |
|
4106 | 688 |
addLine:line |
689 |
"append a line to the outstanding lines buffer" |
|
690 |
||
691 |
access critical:[ |
|
692 |
outstandingLine size ~~ 0 ifTrue:[ |
|
693 |
outstandingLine := outstandingLine , line |
|
694 |
] ifFalse:[ |
|
4645 | 695 |
(TimestampMessages == true and:[self == Transcript]) ifTrue:[ |
4643 | 696 |
outstandingLine := Timestamp now printString,' ',line |
697 |
] ifFalse:[ |
|
698 |
outstandingLine := line |
|
699 |
] |
|
4106 | 700 |
]. |
4650 | 701 |
"/ self ~~ Transcript ifTrue:['xa' printCR]. |
4106 | 702 |
outstandingLines isNil ifTrue:[ |
703 |
outstandingLines := OrderedCollection with:outstandingLine |
|
704 |
] ifFalse:[ |
|
705 |
outstandingLines add:outstandingLine. |
|
706 |
]. |
|
707 |
outstandingLine := ''. |
|
708 |
||
709 |
collecting ifTrue:[ |
|
4643 | 710 |
flushPending ifFalse:[ |
711 |
self installDelayedUpdate |
|
712 |
] ifTrue:[ |
|
4106 | 713 |
outstandingLines size > collectSize ifTrue:[ |
714 |
self endEntry |
|
715 |
] |
|
716 |
] |
|
717 |
] ifFalse:[ |
|
718 |
self endEntry. |
|
719 |
self cursorReturn. |
|
720 |
self checkLineLimit. |
|
721 |
self cursorToEnd. |
|
722 |
] |
|
723 |
]. |
|
724 |
||
725 |
"Created: / 28.7.1998 / 00:31:46 / cg" |
|
726 |
"Modified: / 28.7.1998 / 00:34:58 / cg" |
|
727 |
! |
|
728 |
||
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
729 |
cr |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
730 |
"output a carriage return, finishing the current line" |
135 | 731 |
|
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
732 |
access critical:[ |
4643 | 733 |
|line| |
734 |
||
834
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
735 |
collecting ifTrue:[ |
4643 | 736 |
line := outstandingLine. |
4645 | 737 |
(TimestampMessages == true and:[self == Transcript]) ifTrue:[ |
4643 | 738 |
outstandingLine size == 0 ifTrue:[ |
739 |
line := Timestamp now printString |
|
740 |
]. |
|
741 |
]. |
|
4650 | 742 |
"/ self ~~ Transcript ifTrue:['xc' printCR]. |
4643 | 743 |
outstandingLines isNil ifTrue:[ |
744 |
outstandingLines := OrderedCollection with:line |
|
745 |
] ifFalse:[ |
|
746 |
outstandingLines add:line. |
|
834
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
747 |
]. |
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
748 |
outstandingLine := ''. |
4643 | 749 |
flushPending ifFalse:[ |
750 |
self installDelayedUpdate |
|
751 |
] |
|
834
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
752 |
] ifFalse:[ |
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
753 |
self cursorReturn. |
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
754 |
self checkLineLimit. |
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
755 |
self cursorToEnd. |
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
756 |
]. |
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
757 |
]. |
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
758 |
! |
135 | 759 |
|
4460 | 760 |
display:someObject |
761 |
"dolphin compatibility" |
|
762 |
||
5246 | 763 |
"/ someObject printOn:self. |
764 |
self nextPutAll: someObject asString. |
|
4460 | 765 |
! |
766 |
||
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
767 |
doesNotUnderstand:aMessage |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
768 |
"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
|
769 |
on to the stream which will send the characters via nextPut: |
3006 | 770 |
This way, we understand all Stream messages - great isn't it!!" |
771 |
||
3243 | 772 |
^ aMessage sendTo:entryStream |
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
773 |
! |
0 | 774 |
|
4311 | 775 |
ensureCr |
776 |
"if the output position is not already at the beginning of a line, |
|
777 |
output a carriage return" |
|
778 |
||
779 |
|needCR| |
|
780 |
||
781 |
collecting ifTrue:[ |
|
782 |
needCR := outstandingLine notEmptyOrNil |
|
783 |
] ifFalse:[ |
|
784 |
needCR := cursorCol > 0 |
|
785 |
]. |
|
786 |
||
787 |
needCR ifTrue:[ |
|
788 |
self cr. |
|
789 |
]. |
|
790 |
||
791 |
"Created: / 14-09-2011 / 09:01:03 / cg" |
|
792 |
! |
|
793 |
||
5025 | 794 |
format:formatSpec with:args |
5569 | 795 |
"convenient formatted printing: |
796 |
%1..%9 - positional parameters from args-collection |
|
797 |
%(name) - named parameter from args-dictionary |
|
798 |
%% - escape for % |
|
799 |
%<cr> - cr (also tab, nl)" |
|
800 |
||
5025 | 801 |
^ entryStream format:formatSpec with:args |
5569 | 802 |
|
803 |
" |
|
804 |
1 to: 10 do:[:i | |
|
805 |
Transcript |
|
806 |
format:'[%1] Hello %2 World - this is %3%<cr>' |
|
807 |
with:{i . 'my' . 'nice'} |
|
808 |
]. |
|
809 |
" |
|
5025 | 810 |
! |
811 |
||
0 | 812 |
lineLength |
928 | 813 |
"to make a textCollector (somewhat) compatible with printer |
814 |
streams, support the lineLength query" |
|
815 |
||
4918 | 816 |
^ width // (gc font width) |
928 | 817 |
|
818 |
"Modified: 11.1.1997 / 14:42:41 / cg" |
|
0 | 819 |
! |
820 |
||
821 |
nextPut:something |
|
928 | 822 |
"append somethings printString to my displayed text. |
823 |
This allows TextCollectors to be used Stream-wise" |
|
0 | 824 |
|
1504
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
825 |
|txt| |
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
826 |
|
656 | 827 |
(something isCharacter) ifTrue:[ |
828 |
((something == Character cr) or:[something == Character nl]) ifTrue:[ |
|
829 |
^ self cr |
|
830 |
]. |
|
0 | 831 |
]. |
1504
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
832 |
|
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
833 |
txt := something asString. |
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
834 |
currentEmphasis notNil ifTrue:[ |
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
835 |
txt := txt emphasizeAllWith:currentEmphasis |
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
836 |
]. |
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
837 |
self show:txt. |
656 | 838 |
|
839 |
"/ flushPending ifTrue:[ |
|
840 |
"/ self endEntry |
|
841 |
"/ ]. |
|
842 |
"/ (something isMemberOf:Character) ifTrue:[ |
|
843 |
"/ ((something == Character cr) or:[something == Character nl]) ifTrue:[ |
|
844 |
"/ ^ self cr |
|
845 |
"/ ]. |
|
846 |
"/ self insertCharAtCursor:something |
|
847 |
"/ ] ifFalse:[ |
|
848 |
"/ self insertStringAtCursor:(something printString). |
|
849 |
"/ self checkLineLimit |
|
850 |
"/ ]. |
|
851 |
"/ device flush |
|
852 |
||
928 | 853 |
"Modified: 11.1.1997 / 14:43:05 / cg" |
0 | 854 |
! |
855 |
||
856 |
nextPutAll:something |
|
928 | 857 |
"append all of something to my displayed text. |
858 |
This allows TextCollectors to be used Stream-wise" |
|
0 | 859 |
|
3958 | 860 |
self show:(currentEmphasis notNil |
861 |
ifTrue:[something emphasizeAllWith:currentEmphasis] |
|
862 |
ifFalse:[something]) |
|
656 | 863 |
|
928 | 864 |
"Modified: 11.1.1997 / 14:43:26 / cg" |
0 | 865 |
! |
866 |
||
5320 | 867 |
nextPutAll:count from:buffer startingAt:initialPosition |
868 |
"append count characters from buffer starting at initialPosition to my displayed text. |
|
869 |
This allows TextCollectors to be used Stream-wise" |
|
870 |
||
871 |
|stringToShow| |
|
872 |
||
873 |
stringToShow := buffer copyFrom:initialPosition to:initialPosition+count-1. |
|
874 |
||
875 |
self show:(currentEmphasis notNil |
|
876 |
ifTrue:[stringToShow emphasizeAllWith:currentEmphasis] |
|
877 |
ifFalse:[stringToShow]). |
|
878 |
^ count. |
|
879 |
||
880 |
"Modified: 11.1.1997 / 14:43:26 / cg" |
|
881 |
! |
|
882 |
||
5603 | 883 |
printf:formatSpec |
884 |
"convenient C-style formatted printing" |
|
885 |
||
886 |
^ entryStream printf:formatSpec |
|
887 |
||
888 |
" |
|
889 |
1 to: 10 do:[:i | |
|
890 |
Transcript printf:'Hello World\n' |
|
891 |
]. |
|
892 |
" |
|
893 |
! |
|
894 |
||
6111 | 895 |
printf:formatSpec arguments:args |
896 |
"convenient C-style formatted printing with an arbitrary number of arguments. |
|
897 |
Same as printf:withAll:, for protocol completeness" |
|
898 |
||
899 |
^ entryStream printf:formatSpec withAll:args |
|
900 |
||
901 |
" |
|
902 |
1 to: 10 do:[:i | |
|
903 |
Transcript |
|
904 |
printf:'[%d] Hello %s World - this is %s\n' |
|
905 |
with:{i . 'my' . 'nice'} |
|
906 |
]. |
|
907 |
" |
|
908 |
||
909 |
"Created: / 23-02-2017 / 16:43:46 / cg" |
|
910 |
! |
|
911 |
||
5569 | 912 |
printf:formatSpec with:arg1 |
5603 | 913 |
"convenient C-style formatted printing with 1 argument" |
5569 | 914 |
|
915 |
^ entryStream printf:formatSpec with:arg1 |
|
916 |
||
917 |
" |
|
918 |
1 to: 10 do:[:i | |
|
5603 | 919 |
Transcript printf:'[%d] Hello World\n' with:i |
5569 | 920 |
]. |
921 |
" |
|
922 |
! |
|
923 |
||
924 |
printf:formatSpec with:arg1 with:arg2 |
|
5603 | 925 |
"convenient C-style formatted printing with 2 arguments" |
5569 | 926 |
|
927 |
^ entryStream printf:formatSpec with:arg1 with:arg2 |
|
928 |
||
929 |
" |
|
930 |
1 to: 10 do:[:i | |
|
931 |
Transcript |
|
932 |
printf:'[%d] Hello World\n' with:i |
|
933 |
]. |
|
934 |
" |
|
935 |
! |
|
936 |
||
937 |
printf:formatSpec with:arg1 with:arg2 with:arg3 |
|
5603 | 938 |
"convenient C-style formatted printing with 3 arguments" |
5569 | 939 |
|
940 |
^ entryStream printf:formatSpec with:arg1 with:arg2 with:arg3 |
|
941 |
||
942 |
" |
|
943 |
1 to: 10 do:[:i | |
|
944 |
Transcript |
|
945 |
printf:'[%d] Hello World\n' with:i |
|
946 |
]. |
|
947 |
" |
|
948 |
! |
|
949 |
||
950 |
printf:formatSpec with:arg1 with:arg2 with:arg3 with:arg4 |
|
951 |
"convenient C-style formatted printing" |
|
952 |
||
953 |
^ entryStream printf:formatSpec with:arg1 with:arg2 with:arg3 with:arg4 |
|
954 |
||
955 |
" |
|
956 |
1 to: 10 do:[:i | |
|
957 |
Transcript |
|
958 |
printf:'[%d] Hello World\n' with:i |
|
959 |
]. |
|
960 |
" |
|
961 |
! |
|
962 |
||
963 |
printf:formatSpec with:arg1 with:arg2 with:arg3 with:arg4 with:arg5 |
|
964 |
"convenient C-style formatted printing" |
|
965 |
||
966 |
^ entryStream printf:formatSpec with:arg1 with:arg2 with:arg3 with:arg4 with:arg5 |
|
967 |
||
968 |
" |
|
969 |
1 to: 10 do:[:i | |
|
970 |
Transcript |
|
971 |
printf:'[%d] Hello World\n' with:i |
|
972 |
]. |
|
973 |
" |
|
974 |
! |
|
975 |
||
976 |
printf:formatSpec withAll:args |
|
5603 | 977 |
"convenient C-style formatted printing with an arbitrary number of arguments" |
5569 | 978 |
|
979 |
^ entryStream printf:formatSpec withAll:args |
|
980 |
||
981 |
" |
|
982 |
1 to: 10 do:[:i | |
|
983 |
Transcript |
|
984 |
printf:'[%d] Hello %s World - this is %s\n' |
|
985 |
with:{i . 'my' . 'nice'} |
|
986 |
]. |
|
987 |
" |
|
988 |
! |
|
989 |
||
5130 | 990 |
println |
991 |
"for those used to Java/Javascript, a compatibility message. |
|
992 |
Most useful inside expecco" |
|
993 |
||
994 |
self cr |
|
995 |
! |
|
996 |
||
997 |
println:anObject |
|
998 |
"for those used to Java/Javascript, a compatibility message. |
|
999 |
Most useful inside expecco" |
|
1000 |
||
1001 |
self showCR:anObject |
|
1002 |
! |
|
1003 |
||
0 | 1004 |
show:anObject |
1005 |
"insert the argument aString at current cursor position" |
|
1006 |
||
4045 | 1007 |
|printString lines| |
0 | 1008 |
|
4045 | 1009 |
printString := anObject printString. |
928 | 1010 |
|
4643 | 1011 |
(self == Transcript) ifTrue:[ |
1012 |
DebugSendersOfMessagePattern notNil ifTrue:[ |
|
1013 |
(DebugSendersOfMessagePattern match:printString string) ifTrue:[ |
|
5733 | 1014 |
"to disable this breakpoint in the future, evaluate: |
1015 |
DebugSendersOfMessagePattern := nil |
|
1016 |
" |
|
4643 | 1017 |
self halt:('Transcript: text matches: "', printString,'"'). |
1018 |
]. |
|
4122 | 1019 |
]. |
4643 | 1020 |
TraceSendersOfMessagePattern notNil ifTrue:[ |
1021 |
(TraceSendersOfMessagePattern match:printString string) ifTrue:[ |
|
1022 |
printString := self senderTraceString,': ',printString |
|
1023 |
]. |
|
4365 | 1024 |
]. |
1025 |
]. |
|
4105
c2c3a96f8757
debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
1026 |
|
4045 | 1027 |
(printString includes:(Character cr)) ifTrue:[ |
1028 |
lines := printString asStringCollection. |
|
653 | 1029 |
lines keysAndValuesDo:[:nr :line | |
1562
9b7557a81849
made the number of buffered lines an instVar.
Claus Gittinger <cg@exept.de>
parents:
1504
diff
changeset
|
1030 |
(nr == lines size |
4045 | 1031 |
and:[(printString endsWith:(Character cr)) not]) ifTrue:[ |
653 | 1032 |
"/ the last one. |
1033 |
self show:line |
|
1034 |
] ifFalse:[ |
|
1035 |
self showCR:line |
|
1036 |
]. |
|
1037 |
]. |
|
1038 |
^ self. |
|
308
b216a5efa2c8
handle show: with a string containing cr's
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
1039 |
]. |
b216a5efa2c8
handle show: with a string containing cr's
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
1040 |
|
1026 | 1041 |
access critical:[ |
4650 | 1042 |
"/ self ~~ Transcript ifTrue:['xs' printCR]. |
3295
37cb2b5d579a
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3248
diff
changeset
|
1043 |
outstandingLine size ~~ 0 ifTrue:[ |
4045 | 1044 |
outstandingLine := outstandingLine , printString |
1026 | 1045 |
] ifFalse:[ |
4045 | 1046 |
outstandingLine := printString |
653 | 1047 |
]. |
1026 | 1048 |
collecting ifTrue:[ |
1049 |
flushPending ifFalse:[ |
|
1050 |
self installDelayedUpdate |
|
1312
eaa44f7649f5
flush after some lines have been collected
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
1051 |
] ifTrue:[ |
1562
9b7557a81849
made the number of buffered lines an instVar.
Claus Gittinger <cg@exept.de>
parents:
1504
diff
changeset
|
1052 |
outstandingLines size > collectSize ifTrue:[ |
1312
eaa44f7649f5
flush after some lines have been collected
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
1053 |
self endEntry |
eaa44f7649f5
flush after some lines have been collected
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
1054 |
] |
1026 | 1055 |
] |
1056 |
] ifFalse:[ |
|
1057 |
self endEntry |
|
653 | 1058 |
] |
1026 | 1059 |
]. |
0 | 1060 |
|
4411 | 1061 |
"Modified: / 24-03-2012 / 20:04:10 / cg" |
4428 | 1062 |
"Modified (format): / 02-06-2012 / 01:54:55 / cg" |
1617 | 1063 |
! |
1064 |
||
1065 |
showCR:anObject |
|
1066 |
"insert the argument aString at current cursor position, |
|
1067 |
and advance to the next line. This is the same as a #show: |
|
1068 |
followed by a #cr." |
|
1069 |
||
5302 | 1070 |
|printString lines crlf| |
1617 | 1071 |
|
4647 | 1072 |
"/ self ~~ Transcript ifTrue:[ ^ self tshow:anObject]. |
4045 | 1073 |
printString := anObject printString. |
6112 | 1074 |
printString isEmptyOrNil ifTrue:[ |
2689
ddaa98a64bd5
Fix #showCR: when displaying multi-line strings
Stefan Vogel <sv@exept.de>
parents:
2632
diff
changeset
|
1075 |
self cr. |
ddaa98a64bd5
Fix #showCR: when displaying multi-line strings
Stefan Vogel <sv@exept.de>
parents:
2632
diff
changeset
|
1076 |
^ self. |
1617 | 1077 |
]. |
1078 |
||
4643 | 1079 |
self == Transcript ifTrue:[ |
1080 |
DebugSendersOfMessagePattern notNil ifTrue:[ |
|
1081 |
(DebugSendersOfMessagePattern match:printString string) ifTrue:[ |
|
1082 |
"/ to disable this right from inside the debugger, evaluate: |
|
5454 | 1083 |
" |
1084 |
DebugSendersOfMessagePattern := nil |
|
1085 |
" |
|
4643 | 1086 |
self halt:('Transcript: text matches: "', printString, '"'). |
1087 |
]. |
|
4365 | 1088 |
]. |
4643 | 1089 |
TraceSendersOfMessagePattern notNil ifTrue:[ |
1090 |
(TraceSendersOfMessagePattern match:printString string) ifTrue:[ |
|
1091 |
printString := self senderTraceString,': ',printString |
|
1092 |
]. |
|
4122 | 1093 |
]. |
4105
c2c3a96f8757
debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
1094 |
]. |
c2c3a96f8757
debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
1095 |
|
5302 | 1096 |
crlf := String crlf. |
1097 |
(printString includesAny:crlf) ifTrue:[ |
|
4045 | 1098 |
lines := printString asStringCollection. |
2689
ddaa98a64bd5
Fix #showCR: when displaying multi-line strings
Stefan Vogel <sv@exept.de>
parents:
2632
diff
changeset
|
1099 |
lines do:[:line| |
5302 | 1100 |
|lineWithoutEOL| |
1101 |
||
4106 | 1102 |
(line endsWith:Character nl) ifTrue:[ |
5302 | 1103 |
(line endsWith:crlf) ifTrue:[ |
1104 |
lineWithoutEOL := line copyButLast:2. |
|
4106 | 1105 |
] ifFalse:[ |
5302 | 1106 |
lineWithoutEOL := line copyButLast:1. |
4106 | 1107 |
] |
2805 | 1108 |
] ifFalse:[ |
4106 | 1109 |
(line endsWith:Character return) ifTrue:[ |
5302 | 1110 |
lineWithoutEOL := line copyButLast:1. |
4106 | 1111 |
] ifFalse:[ |
5302 | 1112 |
lineWithoutEOL := line |
4106 | 1113 |
] |
5302 | 1114 |
]. |
1115 |
self addLine:lineWithoutEOL. |
|
1617 | 1116 |
]. |
1117 |
^ self. |
|
1118 |
]. |
|
4106 | 1119 |
self addLine:printString |
4365 | 1120 |
|
4410 | 1121 |
"Modified: / 24-03-2012 / 20:00:08 / cg" |
6112 | 1122 |
"Modified: / 27-02-2017 / 15:22:47 / stefan" |
4073 | 1123 |
! |
1124 |
||
4473 | 1125 |
space |
1126 |
self show:' ' |
|
1127 |
! |
|
1128 |
||
4073 | 1129 |
tab |
1130 |
"append a tab-character to the stream. |
|
1131 |
This is only allowed, if the receiver supports writing." |
|
1132 |
||
1133 |
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
|
1134 |
! ! |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1135 |
|
2746 | 1136 |
!TextCollector methodsFor:'stream messages-emphasis'! |
1822
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1137 |
|
2539 | 1138 |
bgColor:aColor |
4658 | 1139 |
aColor isNil ifTrue:[ |
1140 |
currentEmphasis := Text removeEmphasis:#backgroundColor from:currentEmphasis |
|
1141 |
] ifFalse:[ |
|
1142 |
currentEmphasis := Text addEmphasis:(#backgroundColor->aColor) to:currentEmphasis |
|
1143 |
] |
|
2539 | 1144 |
! |
1145 |
||
1822
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1146 |
bold |
3205 | 1147 |
"switch to bold - followup text sent via show/nextPutAll: will be inserted in |
1148 |
a bold font." |
|
1149 |
||
4658 | 1150 |
currentEmphasis := Text addEmphasis:#bold to:currentEmphasis |
1822
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1151 |
! |
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1152 |
|
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1153 |
color:aColor |
4658 | 1154 |
aColor isNil ifTrue:[ |
1155 |
currentEmphasis := Text removeEmphasis:#color from:currentEmphasis |
|
1156 |
] ifFalse:[ |
|
1157 |
currentEmphasis := Text addEmphasis:(#color->aColor) to:currentEmphasis |
|
1158 |
]. |
|
1822
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1159 |
|
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1160 |
"Modified: / 26.3.1999 / 14:29:21 / cg" |
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1161 |
! |
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1162 |
|
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1163 |
italic |
4658 | 1164 |
currentEmphasis := Text addEmphasis:#italic to:currentEmphasis |
1822
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1165 |
! |
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1166 |
|
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1167 |
normal |
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1168 |
currentEmphasis := nil |
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1169 |
! |
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1170 |
|
4659 | 1171 |
notBold |
1172 |
"switch to non-bold - followup text sent via show/nextPutAll: will be inserted in |
|
1173 |
a non-bold font." |
|
1174 |
||
1175 |
currentEmphasis := Text removeEmphasis:#bold from:currentEmphasis |
|
1176 |
! |
|
1177 |
||
1178 |
notItalic |
|
1179 |
"switch to non-italic - followup text sent via show/nextPutAll: will be inserted in |
|
1180 |
a non-italic font." |
|
1181 |
||
1182 |
currentEmphasis := Text removeEmphasis:#italic from:currentEmphasis |
|
1183 |
! |
|
1184 |
||
1185 |
notReverse |
|
1186 |
currentEmphasis := Text removeEmphasis:#color from:currentEmphasis. |
|
1187 |
currentEmphasis := Text removeEmphasis:#backgroundColor from:currentEmphasis. |
|
1188 |
! |
|
1189 |
||
1190 |
notUnderline |
|
1191 |
currentEmphasis := Text removeEmphasis:#underline from:currentEmphasis |
|
1192 |
||
1193 |
"Created: / 26.3.1999 / 14:27:07 / cg" |
|
1194 |
! |
|
1195 |
||
1822
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1196 |
reverse |
4658 | 1197 |
currentEmphasis := Text addEmphasis:(#color->bgColor) to:currentEmphasis. |
1198 |
currentEmphasis := Text addEmphasis:(#backgroundColor->fgColor) to:currentEmphasis. |
|
1822
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1199 |
! |
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1200 |
|
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1201 |
underline |
4658 | 1202 |
currentEmphasis := Text addEmphasis:#underline to:currentEmphasis |
1822
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1203 |
|
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1204 |
"Created: / 26.3.1999 / 14:27:07 / cg" |
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1205 |
! ! |
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1206 |
|
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1207 |
!TextCollector methodsFor:'transcript specials'! |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1208 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1209 |
beTranscript |
928 | 1210 |
"make the receiver be the systemTranscript; this one |
5575 | 1211 |
is accessible via the global Transcript and gets relevant |
928 | 1212 |
system messages from various places." |
1213 |
||
3852
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
1214 |
self beTranscript:#Transcript |
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
1215 |
|
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
1216 |
"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
|
1217 |
! |
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
1218 |
|
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
1219 |
beTranscript:name |
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
1220 |
"make the receiver be the systemTranscript; this one |
5575 | 1221 |
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
|
1222 |
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
|
1223 |
|
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1224 |
|fg bg cFg cBg| |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1225 |
|
5908 | 1226 |
self assert:((Smalltalk includesKey:name) not |
1227 |
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
|
1228 |
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
|
1229 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1230 |
" |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1231 |
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
|
1232 |
" |
1421
afef284eadc4
only reset Transcript to stdErr, if I really am the transcript.
ca
parents:
1389
diff
changeset
|
1233 |
self destroyAction:[ |
3852
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
1234 |
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
|
1235 |
Smalltalk at:name put:Stderr |
1421
afef284eadc4
only reset Transcript to stdErr, if I really am the transcript.
ca
parents:
1389
diff
changeset
|
1236 |
] |
afef284eadc4
only reset Transcript to stdErr, if I really am the transcript.
ca
parents:
1389
diff
changeset
|
1237 |
]. |
0 | 1238 |
|
928 | 1239 |
"/ user may prefer a special color for this one; |
1240 |
"/ look into the style definitions ... |
|
1241 |
||
1389 | 1242 |
fg := styleSheet colorAt:'transcript.foregroundColor' default:self foregroundColor. |
1243 |
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
|
1244 |
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
|
1245 |
self viewBackground:bg. |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1246 |
|
1389 | 1247 |
cFg := styleSheet colorAt:'transcript.cursorForegroundColor' default:bg. |
1248 |
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
|
1249 |
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
|
1250 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1251 |
"self lineLimit:1000. " "or whatever you think makes sense" |
928 | 1252 |
|
1389 | 1253 |
"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
|
1254 |
! |
24991431c7e0
added #clear (to clear its contents)
Claus Gittinger <cg@exept.de>
parents:
2831
diff
changeset
|
1255 |
|
4643 | 1256 |
beginEntry |
1257 |
"noop for now, ST80 compatibility" |
|
1258 |
||
1259 |
^ self |
|
1260 |
||
1261 |
"Created: / 4.3.1998 / 11:08:14 / stefan" |
|
1262 |
! |
|
1263 |
||
2928
24991431c7e0
added #clear (to clear its contents)
Claus Gittinger <cg@exept.de>
parents:
2831
diff
changeset
|
1264 |
clear |
3119 | 1265 |
self endEntry. |
2928
24991431c7e0
added #clear (to clear its contents)
Claus Gittinger <cg@exept.de>
parents:
2831
diff
changeset
|
1266 |
self contents:nil. |
24991431c7e0
added #clear (to clear its contents)
Claus Gittinger <cg@exept.de>
parents:
2831
diff
changeset
|
1267 |
|
24991431c7e0
added #clear (to clear its contents)
Claus Gittinger <cg@exept.de>
parents:
2831
diff
changeset
|
1268 |
" |
24991431c7e0
added #clear (to clear its contents)
Claus Gittinger <cg@exept.de>
parents:
2831
diff
changeset
|
1269 |
Transcript clear |
24991431c7e0
added #clear (to clear its contents)
Claus Gittinger <cg@exept.de>
parents:
2831
diff
changeset
|
1270 |
" |
3774 | 1271 |
! |
1272 |
||
4650 | 1273 |
delayedEndEntry |
1274 |
"flush collected output; displaying all that has been buffered so far" |
|
1275 |
||
1276 |
"/ self ~~ Transcript ifTrue:[ 'de0' printCR ]. |
|
1277 |
inFlush ifTrue:[ |
|
1278 |
"/ self ~~ Transcript ifTrue:[ 'deX' printCR ]. |
|
1279 |
^ self |
|
1280 |
]. |
|
1281 |
||
1282 |
"/ self ~~ Transcript ifTrue:[ 'de1' printCR ]. |
|
1283 |
access owner == Processor activeProcess ifTrue:[ |
|
1284 |
"/ self ~~ Transcript ifTrue:[ 'de2' printCR ]. |
|
1285 |
self installDelayedUpdate. |
|
1286 |
^ self |
|
1287 |
]. |
|
1288 |
||
1289 |
self endEntry |
|
1290 |
! |
|
1291 |
||
4643 | 1292 |
endEntry |
1293 |
"flush collected output; displaying all that has been buffered so far" |
|
1294 |
||
5644 | 1295 |
|nLines lines| |
4643 | 1296 |
|
4965 | 1297 |
((outstandingLines isEmptyOrNil) and:[outstandingLine isEmptyOrNil]) ifTrue:[ |
4650 | 1298 |
"/ self ~~ Transcript ifTrue:[ 'e- ' print. thisContext sender selector printCR ]. |
1299 |
^ self |
|
1300 |
]. |
|
4965 | 1301 |
shown ifFalse:[ |
1302 |
"/ when iconified or not yet shown, keep |
|
1303 |
"/ collecting. But not too much ... |
|
1304 |
outstandingLines size < 300 ifTrue:[ |
|
1305 |
"/ self ~~ Transcript ifTrue:[ 'eC' printCR ]. |
|
1306 |
access critical:[ |
|
1307 |
flushPending ifFalse:[ |
|
1308 |
self installDelayedUpdate. |
|
1309 |
]. |
|
1310 |
]. |
|
1311 |
^ self |
|
1312 |
] |
|
1313 |
]. |
|
4650 | 1314 |
|
4963 | 1315 |
(device isNil or:[device isOpen not or:[self drawableId isNil]]) ifTrue:[ |
4961 | 1316 |
"on snapshot load, Transcript may not yet be re-created. |
1317 |
Write to Stderr then." |
|
1318 |
Stderr notNil ifTrue:[ |
|
4963 | 1319 |
outstandingLines do:[:eachLine| |
1320 |
eachLine printOn:Stderr. |
|
1321 |
]. |
|
4961 | 1322 |
outstandingLines := nil. |
1323 |
outstandingLine notNil ifTrue:[ |
|
1324 |
outstandingLine printOn:Stderr. |
|
1325 |
outstandingLine := nil. |
|
1326 |
]. |
|
1327 |
Stderr cr. |
|
1328 |
]. |
|
1329 |
^ self. |
|
1330 |
]. |
|
1331 |
||
4650 | 1332 |
"/ self ~~ Transcript ifTrue:[ 'e ' print. |
1333 |
"/ thisContext fullPrintAll. |
|
1334 |
"/ ]. |
|
4643 | 1335 |
|
4650 | 1336 |
"/ access owner == Processor activeProcess ifTrue:[ |
1337 |
"/self ~~ Transcript ifTrue:[ 'eI' printCR ]. |
|
1338 |
"/ self installDelayedUpdate. |
|
1339 |
"/ ^ self |
|
1340 |
"/ ]. |
|
4643 | 1341 |
|
1342 |
access critical:[ |
|
1343 |
collecting ifTrue:[ |
|
1344 |
flushBlock notNil ifTrue:[ |
|
1345 |
Processor removeTimedBlock:flushBlock. |
|
1346 |
]. |
|
4650 | 1347 |
"/ flushPending ifFalse:[ |
1348 |
"/self ~~ Transcript ifTrue:[ 'eP' printCR ]. |
|
1349 |
"/ ^ self |
|
1350 |
"/ ]. |
|
4643 | 1351 |
]. |
1352 |
||
4650 | 1353 |
"/ self ~~ Transcript ifTrue:[ 'e1' printCR ]. |
4643 | 1354 |
inFlush ifFalse:[ |
4650 | 1355 |
"/ self ~~ Transcript ifTrue:[ 'e2' printCR ]. |
4643 | 1356 |
inFlush := true. |
1357 |
[ |
|
1358 |
flushPending := false. |
|
5147 | 1359 |
self withAutoIndent:false do:[ |
4650 | 1360 |
"/ self ~~ Transcript ifTrue:[ 'e3 "' print. outstandingLine print. '" ' print. outstandingLine asByteArray hexPrintString print. ' ' printCR. |
1361 |
"/ (outstandingLines ? #()) do:[:l | '"' print. l print. '" ' print. l asByteArray hexPrintString printCR ]]. |
|
1362 |
(nLines := outstandingLines size) ~~ 0 ifTrue:[ |
|
1363 |
"/ self ~~ Transcript ifTrue:[ 'e4' printCR.]. |
|
4643 | 1364 |
"insert the bunch of lines - if any" |
1365 |
lines := outstandingLines. |
|
1366 |
outstandingLines := nil. |
|
1367 |
||
4650 | 1368 |
"/ self ~~ Transcript ifTrue:[ 'e5 ' print. nLines printCR.]. |
4643 | 1369 |
(nLines ~~ 0) ifTrue:[ |
1370 |
self isInInsertMode ifTrue:[ |
|
4650 | 1371 |
"/ self ~~ Transcript ifTrue:[ (nLines > 1 and:[(lines second ? '') startsWith:'111']) ifTrue:['e6a' printCR.self halt.]]. |
4643 | 1372 |
self insertLines:lines withCR:true. |
4650 | 1373 |
"/ self ~~ Transcript ifTrue:[ (nLines > 1 and:[(lines second ? '') startsWith:'111']) ifTrue:['e6a' printCR.self halt.]]. |
4643 | 1374 |
] ifFalse:[ |
1375 |
self replaceLines:lines withCR:true |
|
1376 |
]. |
|
1377 |
alwaysAppendAtEnd ifTrue:[ |
|
1378 |
self cursorToEnd. |
|
1379 |
]. |
|
1380 |
(cursorLine >= (firstLineShown + nFullLinesShown)) ifTrue:[ |
|
5137 | 1381 |
scrollLocked ifFalse:[ |
1382 |
self withCursorOffDo:[ |
|
1383 |
self scrollDown:nLines |
|
1384 |
] |
|
1385 |
]. |
|
4643 | 1386 |
]. |
1387 |
]. |
|
1388 |
]. |
|
1389 |
||
4650 | 1390 |
"/ self ~~ Transcript ifTrue:[ (nLines > 1 and:[(lines second ? '') startsWith:'111']) ifTrue:['e7a' printCR.self halt.]]. |
4643 | 1391 |
"and the last partial line - if any" |
1392 |
outstandingLine size ~~ 0 ifTrue:[ |
|
1393 |
self isInInsertMode ifTrue:[ |
|
1394 |
self insertStringAtCursor:outstandingLine. |
|
1395 |
] ifFalse:[ |
|
1396 |
self replaceStringAtCursor:outstandingLine. |
|
1397 |
]. |
|
1398 |
outstandingLine := ''. |
|
1399 |
]. |
|
1400 |
self checkLineLimit. |
|
1401 |
"/ device flush. |
|
5147 | 1402 |
]. |
4643 | 1403 |
] ensure:[ |
1404 |
inFlush := false. |
|
1405 |
] |
|
1406 |
]. |
|
4657 | 1407 |
"/ flushPending ifTrue:[ |
1408 |
"/ flushPending := false. |
|
1409 |
"/ self installDelayedUpdate |
|
1410 |
"/ ] |
|
4643 | 1411 |
]. |
1412 |
||
1413 |
"Modified: / 9.11.1998 / 21:17:56 / cg" |
|
1414 |
! |
|
1415 |
||
3774 | 1416 |
flash |
1417 |
"make sure everything is visible, before flashing" |
|
1418 |
||
1419 |
self endEntry. |
|
1420 |
super flash. |
|
5408 | 1421 |
! |
1422 |
||
1423 |
flash:message withColor:flashColor |
|
1424 |
"make sure everything is visible, before flashing" |
|
1425 |
||
1426 |
self endEntry. |
|
1427 |
super flash:message withColor:flashColor. |
|
0 | 1428 |
! ! |
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1429 |
|
928 | 1430 |
!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
|
1431 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1432 |
version |
5408 | 1433 |
^ '$Header$' |
3958 | 1434 |
! |
1435 |
||
1436 |
version_CVS |
|
5408 | 1437 |
^ '$Header$' |
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1438 |
! ! |
2632 | 1439 |
|
4503 | 1440 |
|
2025
0c9729befabc
allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
1441 |
TextCollector initialize! |