author | Claus Gittinger <cg@exept.de> |
Fri, 15 Jan 2016 17:17:24 +0100 | |
changeset 5534 | a4b0471717d0 |
parent 5486 | 199af728fa7a |
child 5552 | 58ac0bd34b7b |
child 5569 | 93970a44420f |
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 |
|
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
105 |
newTranscript:name |
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 |
|
4476 | 113 |
transcript := Smalltalk at:name. |
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 |
||
3852
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
122 |
topView := StandardSystemView label:name "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 |
|
3852
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
139 |
transcript beTranscript:name. |
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'. |
110 | 152 |
" |
778
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
153 |
|
1026 | 154 |
"Modified: 17.2.1997 / 18:20:27 / cg" |
0 | 155 |
! ! |
156 |
||
2025
0c9729befabc
allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
157 |
!TextCollector class methodsFor:'Signal constants'! |
0c9729befabc
allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
158 |
|
0c9729befabc
allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
159 |
transcriptQuerySignal |
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 |
! ! |
0c9729befabc
allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
162 |
|
4105
c2c3a96f8757
debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
163 |
!TextCollector class methodsFor:'debugging'! |
c2c3a96f8757
debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
164 |
|
4365 | 165 |
debugSendersOfMessagePattern |
166 |
^ DebugSendersOfMessagePattern |
|
167 |
||
168 |
"Created: / 02-02-2012 / 12:05:27 / cg" |
|
169 |
! |
|
170 |
||
4105
c2c3a96f8757
debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
171 |
debugSendersOfMessagePattern:aGLOBMatchPattern |
4233
ae8979201707
changed: #debugSendersOfMessagePattern:
Claus Gittinger <cg@exept.de>
parents:
4124
diff
changeset
|
172 |
"ever want to know, who sends a particular text-message to the transcript ? |
4365 | 173 |
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
|
174 |
|
4654 | 175 |
DebugSendersOfMessagePattern := aGLOBMatchPattern asNilIfEmpty |
4105
c2c3a96f8757
debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
176 |
|
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 |
self debugSendersOfMessagePattern:'no such*' |
4233
ae8979201707
changed: #debugSendersOfMessagePattern:
Claus Gittinger <cg@exept.de>
parents:
4124
diff
changeset
|
179 |
self debugSendersOfMessagePattern:'remove*' |
4105
c2c3a96f8757
debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
180 |
self debugSendersOfMessagePattern:nil. |
4284
3e487b994a8b
changed: #debugSendersOfMessagePattern:
Claus Gittinger <cg@exept.de>
parents:
4233
diff
changeset
|
181 |
self debugSendersOfMessagePattern:'*'. |
4105
c2c3a96f8757
debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
182 |
" |
4233
ae8979201707
changed: #debugSendersOfMessagePattern:
Claus Gittinger <cg@exept.de>
parents:
4124
diff
changeset
|
183 |
|
4365 | 184 |
"Modified: / 02-02-2012 / 12:07:11 / cg" |
185 |
! |
|
186 |
||
4643 | 187 |
timestampMessages |
188 |
^ TimestampMessages |
|
189 |
! |
|
190 |
||
191 |
timestampMessages:aBoolean |
|
192 |
"if true, all messages are shown with a timestamp in front" |
|
193 |
||
194 |
TimestampMessages := aBoolean |
|
195 |
||
196 |
" |
|
197 |
self timestampMessages:true |
|
198 |
self timestampMessages:false. |
|
199 |
" |
|
200 |
! |
|
201 |
||
4365 | 202 |
traceSendersOfMessagePattern |
203 |
^ TraceSendersOfMessagePattern |
|
204 |
||
205 |
"Created: / 02-02-2012 / 12:05:32 / cg" |
|
206 |
! |
|
207 |
||
208 |
traceSendersOfMessagePattern:aGLOBMatchPattern |
|
209 |
"ever want to know, who sends a particular text-message to the transcript ? |
|
210 |
Call this with a match string and get a trace, when a matching text is sent to the transcript" |
|
211 |
||
4654 | 212 |
TraceSendersOfMessagePattern := aGLOBMatchPattern asNilIfEmpty |
4365 | 213 |
|
214 |
" |
|
215 |
self traceSendersOfMessagePattern:'removed unreached*' |
|
216 |
self traceSendersOfMessagePattern:nil. |
|
217 |
self traceSendersOfMessagePattern:'*'. |
|
218 |
" |
|
219 |
||
220 |
"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
|
221 |
! ! |
c2c3a96f8757
debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
222 |
|
928 | 223 |
!TextCollector class methodsFor:'defaults'! |
0 | 224 |
|
1610
b05a3e405b33
allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents:
1598
diff
changeset
|
225 |
defaultCollectSize |
5301 | 226 |
"the number of lines buffered for delayed update. |
227 |
At most this number of lines to be shown are buffered (without redrawing), |
|
228 |
before a redraw is done. Thus, if a lot of output is generated fast, |
|
229 |
the redrawing is performed in chunks. |
|
230 |
This has a significant effect on the performane, |
|
231 |
as the view does not have to scroll and redraw for each |
|
232 |
individual line, but does junp-scrolling instead. |
|
233 |
See also defaultTimeDelay" |
|
234 |
||
235 |
^ DefaultCollectSize ? 1000 |
|
1610
b05a3e405b33
allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents:
1598
diff
changeset
|
236 |
|
5301 | 237 |
"Modified: / 27.7.1998 / 16:14:51 / cg" |
238 |
! |
|
239 |
||
240 |
defaultCollectSize:numberOfLines |
|
241 |
"the number of lines buffered for delayed update. |
|
242 |
At most this number of lines to be shown are buffered (without redrawing), |
|
243 |
before a redraw is done. Thus, if a lot of output is generated fast, |
|
244 |
the redrawing is performed in chunks. |
|
245 |
This has a significant effect on the performane, |
|
246 |
as the view does not have to scroll and redraw for each |
|
247 |
individual line, but does junp-scrolling instead. |
|
248 |
See also defaultTimeDelay" |
|
249 |
||
250 |
DefaultCollectSize := numberOfLines |
|
1610
b05a3e405b33
allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents:
1598
diff
changeset
|
251 |
|
b05a3e405b33
allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents:
1598
diff
changeset
|
252 |
"Modified: / 27.7.1998 / 16:14:51 / cg" |
b05a3e405b33
allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents:
1598
diff
changeset
|
253 |
! |
b05a3e405b33
allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents:
1598
diff
changeset
|
254 |
|
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
255 |
defaultLineLimit |
5301 | 256 |
"the number of lines remembered by default. |
257 |
Only the last n lines are remembered and can be seen by scrolling. |
|
258 |
Older lines are forgotten. |
|
259 |
This limit can be changed by the userPreferences dialog" |
|
260 |
||
261 |
^ DefaultLineLimit ? 1000 |
|
262 |
! |
|
59 | 263 |
|
5301 | 264 |
defaultLineLimit:numberOfLines |
265 |
"the number of lines remembered by default. |
|
266 |
Only the last n lines are remembered and can be seen by scrolling. |
|
267 |
Older lines are forgotten. |
|
268 |
This limit can be changed by the userPreferences dialog" |
|
269 |
||
270 |
DefaultLineLimit := numberOfLines |
|
59 | 271 |
! |
272 |
||
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
273 |
defaultTimeDelay |
5301 | 274 |
"the time in seconds to wait & collect by default. |
275 |
At most this number of seconds incoming text is buffered (without redrawing), |
|
276 |
before a redraw is done. Thus, if a lot of output is generated fast, |
|
277 |
the redrawing is performed in chunks. |
|
278 |
This has a significant effect on the performane, |
|
279 |
as the view does not have to scroll and redraw for each |
|
280 |
individual line, but does junp-scrolling instead. |
|
281 |
The value may be a float (eg. 0.5) |
|
282 |
See also defaultCollectSize" |
|
283 |
||
284 |
^ DefaultTimeDelay ? 0.5 |
|
285 |
! |
|
36 | 286 |
|
5301 | 287 |
defaultTimeDelay:seconds |
288 |
"the time in seconds to wait & collect by default. |
|
289 |
At most this number of seconds incoming text is buffered (without redrawing), |
|
290 |
before a redraw is done. Thus, if a lot of output is generated fast, |
|
291 |
the redrawing is performed in chunks. |
|
292 |
This has a significant effect on the performane, |
|
293 |
as the view does not have to scroll and redraw for each |
|
294 |
individual line, but does junp-scrolling instead. |
|
295 |
The argument may be a float (eg. 0.5) |
|
296 |
See also defaultCollectSize" |
|
297 |
||
298 |
DefaultTimeDelay := seconds |
|
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
299 |
! |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
300 |
|
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
301 |
defaultTranscriptSize |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
302 |
"the number of cols/lines by which the Transcript should come up" |
110 | 303 |
|
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
304 |
^ 70@11 |
110 | 305 |
! ! |
306 |
||
2744 | 307 |
!TextCollector methodsFor:'Compatibility-ST80'! |
1500 | 308 |
|
309 |
deselect |
|
310 |
self unselect |
|
1504
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
311 |
! |
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 |
flush |
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
314 |
self endEntry. |
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
315 |
super flush |
1500 | 316 |
! ! |
317 |
||
0 | 318 |
!TextCollector methodsFor:'accessing'! |
319 |
||
3710 | 320 |
autoRaise |
321 |
^ autoRaise ? false |
|
322 |
! |
|
323 |
||
324 |
autoRaise:something |
|
325 |
autoRaise := something. |
|
326 |
! |
|
327 |
||
0 | 328 |
collect:aBoolean |
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
329 |
"turn on/off collecting - if on, do not output immediately |
15 | 330 |
but collect text and output en-bloque after some time delta" |
0 | 331 |
|
332 |
collecting := aBoolean |
|
333 |
! |
|
334 |
||
1610
b05a3e405b33
allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents:
1598
diff
changeset
|
335 |
collectSize:numberOfLines |
b05a3e405b33
allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents:
1598
diff
changeset
|
336 |
"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
|
337 |
the receiver will force update of the view, |
b05a3e405b33
allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents:
1598
diff
changeset
|
338 |
whenever that many lines have been collected |
b05a3e405b33
allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents:
1598
diff
changeset
|
339 |
(or the updateTimeDelay interval has passed). |
b05a3e405b33
allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents:
1598
diff
changeset
|
340 |
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
|
341 |
|
b05a3e405b33
allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents:
1598
diff
changeset
|
342 |
collectSize := numberOfLines |
b05a3e405b33
allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents:
1598
diff
changeset
|
343 |
|
b05a3e405b33
allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents:
1598
diff
changeset
|
344 |
"Modified: / 27.7.1998 / 16:16:00 / cg" |
b05a3e405b33
allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents:
1598
diff
changeset
|
345 |
! |
b05a3e405b33
allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents:
1598
diff
changeset
|
346 |
|
0 | 347 |
destroyAction:aBlock |
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
348 |
"define the action to be performed when I get destroyed. |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
349 |
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
|
350 |
when closed. (see TextCollectorclass>>newTranscript)" |
0 | 351 |
|
352 |
destroyAction := aBlock |
|
353 |
! |
|
354 |
||
5486 | 355 |
entryStream |
356 |
^ entryStream |
|
357 |
! |
|
358 |
||
2103 | 359 |
lineLimit |
360 |
"return the number of text-lines I am supposed to hold" |
|
361 |
||
362 |
^ lineLimit |
|
363 |
||
364 |
" |
|
365 |
Transcript lineLimit:5000 |
|
366 |
Transcript lineLimit |
|
367 |
" |
|
368 |
||
369 |
"Modified: / 16.5.1998 / 01:33:52 / cg" |
|
370 |
! |
|
371 |
||
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
372 |
lineLimit:aNumber |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
373 |
"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
|
374 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
375 |
lineLimit := aNumber |
1611 | 376 |
|
377 |
" |
|
378 |
Transcript lineLimit:5000 |
|
379 |
" |
|
380 |
||
381 |
"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
|
382 |
! |
b05a3e405b33
allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents:
1598
diff
changeset
|
383 |
|
b05a3e405b33
allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents:
1598
diff
changeset
|
384 |
updateTimeDelay:seconds |
b05a3e405b33
allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents:
1598
diff
changeset
|
385 |
"if collect is enabled, the receiver will update its view, |
4643 | 386 |
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
|
387 |
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
|
388 |
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
|
389 |
|
b05a3e405b33
allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents:
1598
diff
changeset
|
390 |
timeDelay := seconds |
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 |
"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
|
393 |
! ! |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
394 |
|
3969
a914bce039b7
category of: #exposeX:y:width:height:
Claus Gittinger <cg@exept.de>
parents:
3958
diff
changeset
|
395 |
!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
|
396 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
397 |
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
|
398 |
"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
|
399 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
400 |
super exposeX:x y:y width:w height:h. |
4657 | 401 |
"/ self endEntry |
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
402 |
! ! |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
403 |
|
2750 | 404 |
!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
|
405 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
406 |
destroy |
928 | 407 |
"destroy this view" |
408 |
||
3201 | 409 |
destroyAction value. |
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
410 |
super destroy |
928 | 411 |
|
1714 | 412 |
"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
|
413 |
! |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
414 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
415 |
editMenu |
928 | 416 |
"return my popUpMenu; thats the superClasses menu, |
417 |
minus any accept item." |
|
418 |
||
1262
d69149b5be1f
resource flag: #menu -> #programMenu
Claus Gittinger <cg@exept.de>
parents:
1221
diff
changeset
|
419 |
<resource: #programMenu> |
1109 | 420 |
|
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
421 |
|m idx| |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
422 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
423 |
m := super editMenu. |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
424 |
|
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 |
textcollectors do not support #accept |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
427 |
remove it from the menu (and the preceeding separating line) |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
428 |
" |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
429 |
idx := m indexOf:#accept. |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
430 |
idx ~~ 0 ifTrue:[ |
928 | 431 |
m remove:idx. |
432 |
(m labels at:(idx - 1)) = '-' ifTrue:[ |
|
433 |
m remove:idx - 1 |
|
434 |
]. |
|
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
435 |
]. |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
436 |
^ m |
928 | 437 |
|
1262
d69149b5be1f
resource flag: #menu -> #programMenu
Claus Gittinger <cg@exept.de>
parents:
1221
diff
changeset
|
438 |
"Modified: 3.7.1997 / 13:54:11 / cg" |
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
439 |
! |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
440 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
441 |
initialize |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
442 |
super initialize. |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
443 |
|
2164
ed46136cb2cf
honor scrollWhenUpdating setting
Claus Gittinger <cg@exept.de>
parents:
2103
diff
changeset
|
444 |
scrollWhenUpdating := #endOfText. |
ed46136cb2cf
honor scrollWhenUpdating setting
Claus Gittinger <cg@exept.de>
parents:
2103
diff
changeset
|
445 |
|
928 | 446 |
outstandingLines := nil. |
1562
9b7557a81849
made the number of buffered lines an instVar.
Claus Gittinger <cg@exept.de>
parents:
1504
diff
changeset
|
447 |
alwaysAppendAtEnd := true. |
1610
b05a3e405b33
allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents:
1598
diff
changeset
|
448 |
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
|
449 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
450 |
flushPending := inFlush := false. |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
451 |
collecting := true. |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
452 |
timeDelay := self class defaultTimeDelay. |
4965 | 453 |
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
|
454 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
455 |
lineLimit := self class defaultLineLimit. |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
456 |
entryStream := ActorStream new. |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
457 |
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
|
458 |
entryStream nextPutAllBlock:[:something | self nextPutAll:something] |
928 | 459 |
|
2086
95ec18a17198
give my access sema a name (for the semaphoreMonitor)
Claus Gittinger <cg@exept.de>
parents:
2025
diff
changeset
|
460 |
"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
|
461 |
! |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
462 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
463 |
mapped |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
464 |
"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
|
465 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
466 |
super mapped. |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
467 |
self endEntry |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
468 |
! |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
469 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
470 |
reinitialize |
2259 | 471 |
"reinit after a snapIn. |
472 |
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
|
473 |
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
|
474 |
|
4645 | 475 |
flushPending := inFlush := false. |
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
476 |
access := RecursionLock new. "/ Semaphore forMutualExclusion. |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
477 |
super reinitialize. |
1467
5c09bb2dadef
Add (dummy fore now) #beginEntry for ST80 compat.
Stefan Vogel <sv@exept.de>
parents:
1421
diff
changeset
|
478 |
|
5c09bb2dadef
Add (dummy fore now) #beginEntry for ST80 compat.
Stefan Vogel <sv@exept.de>
parents:
1421
diff
changeset
|
479 |
"Modified: / 5.3.1998 / 10:09:14 / stefan" |
2591 | 480 |
! |
481 |
||
482 |
release |
|
483 |
flushBlock notNil ifTrue:[ |
|
484 |
Processor removeTimedBlock:flushBlock. |
|
485 |
flushBlock := nil. |
|
486 |
]. |
|
487 |
outstandingLines := nil. |
|
488 |
outstandingLine := ''. |
|
489 |
||
490 |
super release |
|
491 |
||
492 |
"Modified: / 9.11.1998 / 21:18:17 / cg" |
|
0 | 493 |
! ! |
494 |
||
495 |
!TextCollector methodsFor:'private'! |
|
496 |
||
497 |
checkLineLimit |
|
498 |
"this method checks if the text has become too large (> lineLimit) |
|
499 |
and cuts off some lines at the top if so; it must be called whenever lines |
|
500 |
have been added to the bottom" |
|
501 |
||
2426
281067d406c7
eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents:
2371
diff
changeset
|
502 |
|nDel newCursorLine| |
0 | 503 |
|
504 |
lineLimit notNil ifTrue:[ |
|
2426
281067d406c7
eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents:
2371
diff
changeset
|
505 |
(cursorLine > lineLimit) ifTrue:[ |
281067d406c7
eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents:
2371
diff
changeset
|
506 |
nDel := list size - lineLimit. |
4772 | 507 |
self basicListRemoveFromIndex:1 toIndex:nDel. |
2426
281067d406c7
eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents:
2371
diff
changeset
|
508 |
newCursorLine := cursorLine - nDel. |
281067d406c7
eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents:
2371
diff
changeset
|
509 |
firstLineShown := firstLineShown - nDel. |
281067d406c7
eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents:
2371
diff
changeset
|
510 |
(firstLineShown < 1) ifTrue:[ |
281067d406c7
eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents:
2371
diff
changeset
|
511 |
newCursorLine := newCursorLine - firstLineShown + 1. |
281067d406c7
eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents:
2371
diff
changeset
|
512 |
firstLineShown := 1 |
281067d406c7
eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents:
2371
diff
changeset
|
513 |
]. |
281067d406c7
eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents:
2371
diff
changeset
|
514 |
self setCursorLine:newCursorLine. |
3320
a820e3101bb6
refresh when removing some lines after hitting linelimit
fm
parents:
3295
diff
changeset
|
515 |
self contentsChanged. |
a820e3101bb6
refresh when removing some lines after hitting linelimit
fm
parents:
3295
diff
changeset
|
516 |
self invalidate. |
2426
281067d406c7
eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents:
2371
diff
changeset
|
517 |
] |
3710 | 518 |
]. |
519 |
self autoRaise ifTrue:[ |
|
520 |
self topView |
|
521 |
raise; |
|
522 |
"/ setForegroundWindow; |
|
523 |
yourself. |
|
524 |
]. |
|
3320
a820e3101bb6
refresh when removing some lines after hitting linelimit
fm
parents:
3295
diff
changeset
|
525 |
|
a820e3101bb6
refresh when removing some lines after hitting linelimit
fm
parents:
3295
diff
changeset
|
526 |
"Modified: / 26-07-2006 / 16:02:15 / fm" |
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
527 |
! |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
528 |
|
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
529 |
installDelayedUpdate |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
530 |
"arrange for collecting input for some time, |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
531 |
and output all buffered strings at once after a while. |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
532 |
This makes output to the transcript much faster on systems |
553 | 533 |
with poor scrolling performance (i.e. dumb vga cards ...)." |
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
534 |
|
131 | 535 |
|p| |
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
536 |
|
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
537 |
flushPending ifFalse:[ |
553 | 538 |
inFlush ifFalse:[ |
4643 | 539 |
flushPending := true. |
553 | 540 |
" |
541 |
we could run under a process, which dies in the meantime; |
|
542 |
therefore, we have to arrange for the transcript process to |
|
543 |
be interrupted and do the update. |
|
544 |
" |
|
545 |
windowGroup isNil ifTrue:[ |
|
4503 | 546 |
p := Processor timeoutHandlerProcess |
553 | 547 |
] ifFalse:[ |
548 |
p := windowGroup process |
|
549 |
]. |
|
1221
0c2a4231fc9e
Move #isSystemProcess from ProcessorScheduler to Process.
Stefan Vogel <sv@exept.de>
parents:
1109
diff
changeset
|
550 |
(p isNil or:[p isSystemProcess]) ifTrue:[ |
834
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
551 |
self endEntry |
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
552 |
] ifFalse:[ |
1711 | 553 |
flushBlock isNil ifTrue:[ |
4650 | 554 |
flushBlock := [self delayedEndEntry]. |
1711 | 555 |
]. |
834
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
556 |
Processor addTimedBlock:flushBlock for:p afterSeconds:timeDelay. |
3009
7eb1704fa5a6
Avoid dangling references in context
Stefan Vogel <sv@exept.de>
parents:
3006
diff
changeset
|
557 |
]. |
4650 | 558 |
p := nil. "hack: avoid dangling references to p through the home context of flushBlock" |
553 | 559 |
] |
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
560 |
] |
553 | 561 |
|
1711 | 562 |
"Modified: / 17.4.1997 / 13:03:15 / stefan" |
563 |
"Modified: / 9.11.1998 / 14:34:07 / cg" |
|
4365 | 564 |
! |
565 |
||
566 |
senderTraceString |
|
567 |
"generate a sender trace string." |
|
568 |
||
569 |
|con| |
|
570 |
||
571 |
"/ skip over intermediate contexts |
|
572 |
"/ con := con sender. |
|
573 |
"/ con := thisContext sender sender. |
|
574 |
"/ [ con receiver == self ] whileTrue:[ |
|
575 |
"/ con := con sender |
|
576 |
"/ ]. |
|
577 |
con := DebugView interestingContextFrom:thisContext sender sender. |
|
578 |
^ con printString |
|
579 |
||
580 |
"Created: / 02-02-2012 / 11:58:17 / cg" |
|
0 | 581 |
! ! |
582 |
||
778
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
583 |
!TextCollector methodsFor:'queries'! |
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
584 |
|
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
585 |
current |
4687 | 586 |
"return the current (your screen's) transcript. |
5301 | 587 |
In multiDisplay applications, this need NOT be the main transcript, |
588 |
as each display may have its own transcript. |
|
778
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
589 |
But typically, this is the same as Transcript." |
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
590 |
|
2278 | 591 |
|theTranscript app| |
2025
0c9729befabc
allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
592 |
|
0c9729befabc
allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
593 |
theTranscript := TranscriptQuerySignal query. |
0c9729befabc
allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
594 |
theTranscript isNil ifTrue:[ |
2278 | 595 |
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
|
596 |
(app notNil and:[thisContext isRecursive not]) ifTrue:[ |
2278 | 597 |
theTranscript := (app transcript ? Stderr). |
598 |
] ifFalse:[ |
|
599 |
theTranscript := Stderr. |
|
600 |
] |
|
2025
0c9729befabc
allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
601 |
]. |
0c9729befabc
allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
602 |
^ theTranscript |
778
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
603 |
|
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
604 |
" |
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
605 |
Transcript current flash |
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
606 |
" |
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
607 |
|
4687 | 608 |
"Created: / 05-07-1996 / 14:14:34 / cg" |
609 |
"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
|
610 |
! |
fb138fb5cf04
#isStream answers true for Transcript
Stefan Vogel <sv@exept.de>
parents:
4428
diff
changeset
|
611 |
|
fb138fb5cf04
#isStream answers true for Transcript
Stefan Vogel <sv@exept.de>
parents:
4428
diff
changeset
|
612 |
isStream |
fb138fb5cf04
#isStream answers true for Transcript
Stefan Vogel <sv@exept.de>
parents:
4428
diff
changeset
|
613 |
"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
|
614 |
See #displayOn:" |
fb138fb5cf04
#isStream answers true for Transcript
Stefan Vogel <sv@exept.de>
parents:
4428
diff
changeset
|
615 |
|
fb138fb5cf04
#isStream answers true for Transcript
Stefan Vogel <sv@exept.de>
parents:
4428
diff
changeset
|
616 |
^ self == Transcript |
fb138fb5cf04
#isStream answers true for Transcript
Stefan Vogel <sv@exept.de>
parents:
4428
diff
changeset
|
617 |
|
fb138fb5cf04
#isStream answers true for Transcript
Stefan Vogel <sv@exept.de>
parents:
4428
diff
changeset
|
618 |
" |
fb138fb5cf04
#isStream answers true for Transcript
Stefan Vogel <sv@exept.de>
parents:
4428
diff
changeset
|
619 |
Transcript isStream |
fb138fb5cf04
#isStream answers true for Transcript
Stefan Vogel <sv@exept.de>
parents:
4428
diff
changeset
|
620 |
" |
4687 | 621 |
! |
622 |
||
623 |
isTextCollector |
|
624 |
^ true |
|
625 |
||
626 |
" |
|
627 |
Transcript isTextCollector |
|
628 |
" |
|
629 |
||
630 |
"Created: / 29-08-2013 / 11:32:46 / cg" |
|
5330 | 631 |
! |
632 |
||
633 |
position |
|
634 |
"for compatibiliy with normal streams; return the column" |
|
635 |
||
636 |
^ cursorCol |
|
778
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
637 |
! ! |
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
638 |
|
2450 | 639 |
!TextCollector methodsFor:'scrolling'! |
640 |
||
5136 | 641 |
makeCursorVisible |
5137 | 642 |
(scrollLocked ? false) ifFalse:[ |
5136 | 643 |
access critical:[ |
644 |
super makeCursorVisible |
|
645 |
] |
|
646 |
] |
|
647 |
! |
|
648 |
||
649 |
scrollLock:aBoolean |
|
650 |
aBoolean ifTrue:[ |
|
651 |
scrollWhenUpdating := #endOfText. |
|
652 |
] ifFalse:[ |
|
653 |
scrollWhenUpdating := nil. |
|
654 |
]. |
|
5137 | 655 |
scrollLocked := aBoolean. |
5136 | 656 |
! |
657 |
||
2450 | 658 |
scrollTo:anOrigin redraw:doRedraw |
659 |
access critical:[ |
|
660 |
super scrollTo:anOrigin redraw:doRedraw |
|
661 |
] |
|
662 |
! ! |
|
663 |
||
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
664 |
!TextCollector methodsFor:'stream messages'! |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
665 |
|
4106 | 666 |
addLine:line |
667 |
"append a line to the outstanding lines buffer" |
|
668 |
||
669 |
access critical:[ |
|
670 |
outstandingLine size ~~ 0 ifTrue:[ |
|
671 |
outstandingLine := outstandingLine , line |
|
672 |
] ifFalse:[ |
|
4645 | 673 |
(TimestampMessages == true and:[self == Transcript]) ifTrue:[ |
4643 | 674 |
outstandingLine := Timestamp now printString,' ',line |
675 |
] ifFalse:[ |
|
676 |
outstandingLine := line |
|
677 |
] |
|
4106 | 678 |
]. |
4650 | 679 |
"/ self ~~ Transcript ifTrue:['xa' printCR]. |
4106 | 680 |
outstandingLines isNil ifTrue:[ |
681 |
outstandingLines := OrderedCollection with:outstandingLine |
|
682 |
] ifFalse:[ |
|
683 |
outstandingLines add:outstandingLine. |
|
684 |
]. |
|
685 |
outstandingLine := ''. |
|
686 |
||
687 |
collecting ifTrue:[ |
|
4643 | 688 |
flushPending ifFalse:[ |
689 |
self installDelayedUpdate |
|
690 |
] ifTrue:[ |
|
4106 | 691 |
outstandingLines size > collectSize ifTrue:[ |
692 |
self endEntry |
|
693 |
] |
|
694 |
] |
|
695 |
] ifFalse:[ |
|
696 |
self endEntry. |
|
697 |
self cursorReturn. |
|
698 |
self checkLineLimit. |
|
699 |
self cursorToEnd. |
|
700 |
] |
|
701 |
]. |
|
702 |
||
703 |
"Created: / 28.7.1998 / 00:31:46 / cg" |
|
704 |
"Modified: / 28.7.1998 / 00:34:58 / cg" |
|
705 |
! |
|
706 |
||
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
707 |
cr |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
708 |
"output a carriage return, finishing the current line" |
135 | 709 |
|
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
710 |
access critical:[ |
4643 | 711 |
|line| |
712 |
||
834
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
713 |
collecting ifTrue:[ |
4643 | 714 |
line := outstandingLine. |
4645 | 715 |
(TimestampMessages == true and:[self == Transcript]) ifTrue:[ |
4643 | 716 |
outstandingLine size == 0 ifTrue:[ |
717 |
line := Timestamp now printString |
|
718 |
]. |
|
719 |
]. |
|
4650 | 720 |
"/ self ~~ Transcript ifTrue:['xc' printCR]. |
4643 | 721 |
outstandingLines isNil ifTrue:[ |
722 |
outstandingLines := OrderedCollection with:line |
|
723 |
] ifFalse:[ |
|
724 |
outstandingLines add:line. |
|
834
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
725 |
]. |
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
726 |
outstandingLine := ''. |
4643 | 727 |
flushPending ifFalse:[ |
728 |
self installDelayedUpdate |
|
729 |
] |
|
834
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
730 |
] ifFalse:[ |
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
731 |
self cursorReturn. |
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
732 |
self checkLineLimit. |
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
733 |
self cursorToEnd. |
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
734 |
]. |
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
735 |
]. |
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
736 |
! |
135 | 737 |
|
4460 | 738 |
display:someObject |
739 |
"dolphin compatibility" |
|
740 |
||
5246 | 741 |
"/ someObject printOn:self. |
742 |
self nextPutAll: someObject asString. |
|
4460 | 743 |
! |
744 |
||
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
745 |
doesNotUnderstand:aMessage |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
746 |
"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
|
747 |
on to the stream which will send the characters via nextPut: |
3006 | 748 |
This way, we understand all Stream messages - great isn't it!!" |
749 |
||
3243 | 750 |
^ aMessage sendTo:entryStream |
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
751 |
! |
0 | 752 |
|
4311 | 753 |
ensureCr |
754 |
"if the output position is not already at the beginning of a line, |
|
755 |
output a carriage return" |
|
756 |
||
757 |
|needCR| |
|
758 |
||
759 |
collecting ifTrue:[ |
|
760 |
needCR := outstandingLine notEmptyOrNil |
|
761 |
] ifFalse:[ |
|
762 |
needCR := cursorCol > 0 |
|
763 |
]. |
|
764 |
||
765 |
needCR ifTrue:[ |
|
766 |
self cr. |
|
767 |
]. |
|
768 |
||
769 |
"Created: / 14-09-2011 / 09:01:03 / cg" |
|
770 |
! |
|
771 |
||
5025 | 772 |
format:formatSpec with:args |
773 |
^ entryStream format:formatSpec with:args |
|
774 |
! |
|
775 |
||
0 | 776 |
lineLength |
928 | 777 |
"to make a textCollector (somewhat) compatible with printer |
778 |
streams, support the lineLength query" |
|
779 |
||
4918 | 780 |
^ width // (gc font width) |
928 | 781 |
|
782 |
"Modified: 11.1.1997 / 14:42:41 / cg" |
|
0 | 783 |
! |
784 |
||
785 |
nextPut:something |
|
928 | 786 |
"append somethings printString to my displayed text. |
787 |
This allows TextCollectors to be used Stream-wise" |
|
0 | 788 |
|
1504
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
789 |
|txt| |
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
790 |
|
656 | 791 |
(something isCharacter) ifTrue:[ |
792 |
((something == Character cr) or:[something == Character nl]) ifTrue:[ |
|
793 |
^ self cr |
|
794 |
]. |
|
0 | 795 |
]. |
1504
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
796 |
|
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
797 |
txt := something asString. |
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
798 |
currentEmphasis notNil ifTrue:[ |
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
799 |
txt := txt emphasizeAllWith:currentEmphasis |
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
800 |
]. |
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
801 |
self show:txt. |
656 | 802 |
|
803 |
"/ flushPending ifTrue:[ |
|
804 |
"/ self endEntry |
|
805 |
"/ ]. |
|
806 |
"/ (something isMemberOf:Character) ifTrue:[ |
|
807 |
"/ ((something == Character cr) or:[something == Character nl]) ifTrue:[ |
|
808 |
"/ ^ self cr |
|
809 |
"/ ]. |
|
810 |
"/ self insertCharAtCursor:something |
|
811 |
"/ ] ifFalse:[ |
|
812 |
"/ self insertStringAtCursor:(something printString). |
|
813 |
"/ self checkLineLimit |
|
814 |
"/ ]. |
|
815 |
"/ device flush |
|
816 |
||
928 | 817 |
"Modified: 11.1.1997 / 14:43:05 / cg" |
0 | 818 |
! |
819 |
||
820 |
nextPutAll:something |
|
928 | 821 |
"append all of something to my displayed text. |
822 |
This allows TextCollectors to be used Stream-wise" |
|
0 | 823 |
|
3958 | 824 |
self show:(currentEmphasis notNil |
825 |
ifTrue:[something emphasizeAllWith:currentEmphasis] |
|
826 |
ifFalse:[something]) |
|
656 | 827 |
|
928 | 828 |
"Modified: 11.1.1997 / 14:43:26 / cg" |
0 | 829 |
! |
830 |
||
5320 | 831 |
nextPutAll:count from:buffer startingAt:initialPosition |
832 |
"append count characters from buffer starting at initialPosition to my displayed text. |
|
833 |
This allows TextCollectors to be used Stream-wise" |
|
834 |
||
835 |
|stringToShow| |
|
836 |
||
837 |
stringToShow := buffer copyFrom:initialPosition to:initialPosition+count-1. |
|
838 |
||
839 |
self show:(currentEmphasis notNil |
|
840 |
ifTrue:[stringToShow emphasizeAllWith:currentEmphasis] |
|
841 |
ifFalse:[stringToShow]). |
|
842 |
^ count. |
|
843 |
||
844 |
"Modified: 11.1.1997 / 14:43:26 / cg" |
|
845 |
! |
|
846 |
||
5130 | 847 |
println |
848 |
"for those used to Java/Javascript, a compatibility message. |
|
849 |
Most useful inside expecco" |
|
850 |
||
851 |
self cr |
|
852 |
! |
|
853 |
||
854 |
println:anObject |
|
855 |
"for those used to Java/Javascript, a compatibility message. |
|
856 |
Most useful inside expecco" |
|
857 |
||
858 |
self showCR:anObject |
|
859 |
! |
|
860 |
||
0 | 861 |
show:anObject |
862 |
"insert the argument aString at current cursor position" |
|
863 |
||
4045 | 864 |
|printString lines| |
0 | 865 |
|
4045 | 866 |
printString := anObject printString. |
928 | 867 |
|
4643 | 868 |
(self == Transcript) ifTrue:[ |
869 |
DebugSendersOfMessagePattern notNil ifTrue:[ |
|
870 |
(DebugSendersOfMessagePattern match:printString string) ifTrue:[ |
|
871 |
"disable all with: DebugSendersOfMessagePattern := nil" |
|
872 |
self halt:('Transcript: text matches: "', printString,'"'). |
|
873 |
]. |
|
4122 | 874 |
]. |
4643 | 875 |
TraceSendersOfMessagePattern notNil ifTrue:[ |
876 |
(TraceSendersOfMessagePattern match:printString string) ifTrue:[ |
|
877 |
printString := self senderTraceString,': ',printString |
|
878 |
]. |
|
4365 | 879 |
]. |
880 |
]. |
|
4105
c2c3a96f8757
debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
881 |
|
4045 | 882 |
(printString includes:(Character cr)) ifTrue:[ |
883 |
lines := printString asStringCollection. |
|
653 | 884 |
lines keysAndValuesDo:[:nr :line | |
1562
9b7557a81849
made the number of buffered lines an instVar.
Claus Gittinger <cg@exept.de>
parents:
1504
diff
changeset
|
885 |
(nr == lines size |
4045 | 886 |
and:[(printString endsWith:(Character cr)) not]) ifTrue:[ |
653 | 887 |
"/ the last one. |
888 |
self show:line |
|
889 |
] ifFalse:[ |
|
890 |
self showCR:line |
|
891 |
]. |
|
892 |
]. |
|
893 |
^ self. |
|
308
b216a5efa2c8
handle show: with a string containing cr's
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
894 |
]. |
b216a5efa2c8
handle show: with a string containing cr's
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
895 |
|
1026 | 896 |
access critical:[ |
4650 | 897 |
"/ self ~~ Transcript ifTrue:['xs' printCR]. |
3295
37cb2b5d579a
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3248
diff
changeset
|
898 |
outstandingLine size ~~ 0 ifTrue:[ |
4045 | 899 |
outstandingLine := outstandingLine , printString |
1026 | 900 |
] ifFalse:[ |
4045 | 901 |
outstandingLine := printString |
653 | 902 |
]. |
1026 | 903 |
collecting ifTrue:[ |
904 |
flushPending ifFalse:[ |
|
905 |
self installDelayedUpdate |
|
1312
eaa44f7649f5
flush after some lines have been collected
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
906 |
] ifTrue:[ |
1562
9b7557a81849
made the number of buffered lines an instVar.
Claus Gittinger <cg@exept.de>
parents:
1504
diff
changeset
|
907 |
outstandingLines size > collectSize ifTrue:[ |
1312
eaa44f7649f5
flush after some lines have been collected
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
908 |
self endEntry |
eaa44f7649f5
flush after some lines have been collected
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
909 |
] |
1026 | 910 |
] |
911 |
] ifFalse:[ |
|
912 |
self endEntry |
|
653 | 913 |
] |
1026 | 914 |
]. |
0 | 915 |
|
4411 | 916 |
"Modified: / 24-03-2012 / 20:04:10 / cg" |
4428 | 917 |
"Modified (format): / 02-06-2012 / 01:54:55 / cg" |
1617 | 918 |
! |
919 |
||
920 |
showCR:anObject |
|
921 |
"insert the argument aString at current cursor position, |
|
922 |
and advance to the next line. This is the same as a #show: |
|
923 |
followed by a #cr." |
|
924 |
||
5302 | 925 |
|printString lines crlf| |
1617 | 926 |
|
4647 | 927 |
"/ self ~~ Transcript ifTrue:[ ^ self tshow:anObject]. |
4045 | 928 |
printString := anObject printString. |
929 |
printString size == 0 ifTrue:[ |
|
2689
ddaa98a64bd5
Fix #showCR: when displaying multi-line strings
Stefan Vogel <sv@exept.de>
parents:
2632
diff
changeset
|
930 |
self cr. |
ddaa98a64bd5
Fix #showCR: when displaying multi-line strings
Stefan Vogel <sv@exept.de>
parents:
2632
diff
changeset
|
931 |
^ self. |
1617 | 932 |
]. |
933 |
||
4643 | 934 |
self == Transcript ifTrue:[ |
935 |
DebugSendersOfMessagePattern notNil ifTrue:[ |
|
936 |
(DebugSendersOfMessagePattern match:printString string) ifTrue:[ |
|
937 |
"/ to disable this right from inside the debugger, evaluate: |
|
5454 | 938 |
" |
939 |
DebugSendersOfMessagePattern := nil |
|
940 |
" |
|
4643 | 941 |
self halt:('Transcript: text matches: "', printString, '"'). |
942 |
]. |
|
4365 | 943 |
]. |
4643 | 944 |
TraceSendersOfMessagePattern notNil ifTrue:[ |
945 |
(TraceSendersOfMessagePattern match:printString string) ifTrue:[ |
|
946 |
printString := self senderTraceString,': ',printString |
|
947 |
]. |
|
4122 | 948 |
]. |
4105
c2c3a96f8757
debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
949 |
]. |
c2c3a96f8757
debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
950 |
|
5302 | 951 |
crlf := String crlf. |
952 |
(printString includesAny:crlf) ifTrue:[ |
|
4045 | 953 |
lines := printString asStringCollection. |
2689
ddaa98a64bd5
Fix #showCR: when displaying multi-line strings
Stefan Vogel <sv@exept.de>
parents:
2632
diff
changeset
|
954 |
lines do:[:line| |
5302 | 955 |
|lineWithoutEOL| |
956 |
||
4106 | 957 |
(line endsWith:Character nl) ifTrue:[ |
5302 | 958 |
(line endsWith:crlf) ifTrue:[ |
959 |
lineWithoutEOL := line copyButLast:2. |
|
4106 | 960 |
] ifFalse:[ |
5302 | 961 |
lineWithoutEOL := line copyButLast:1. |
4106 | 962 |
] |
2805 | 963 |
] ifFalse:[ |
4106 | 964 |
(line endsWith:Character return) ifTrue:[ |
5302 | 965 |
lineWithoutEOL := line copyButLast:1. |
4106 | 966 |
] ifFalse:[ |
5302 | 967 |
lineWithoutEOL := line |
4106 | 968 |
] |
5302 | 969 |
]. |
970 |
self addLine:lineWithoutEOL. |
|
1617 | 971 |
]. |
972 |
^ self. |
|
973 |
]. |
|
4106 | 974 |
self addLine:printString |
4365 | 975 |
|
4410 | 976 |
"Modified: / 24-03-2012 / 20:00:08 / cg" |
4073 | 977 |
! |
978 |
||
4473 | 979 |
space |
980 |
self show:' ' |
|
981 |
! |
|
982 |
||
4073 | 983 |
tab |
984 |
"append a tab-character to the stream. |
|
985 |
This is only allowed, if the receiver supports writing." |
|
986 |
||
987 |
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
|
988 |
! ! |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
989 |
|
2746 | 990 |
!TextCollector methodsFor:'stream messages-emphasis'! |
1822
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
991 |
|
2539 | 992 |
bgColor:aColor |
4658 | 993 |
aColor isNil ifTrue:[ |
994 |
currentEmphasis := Text removeEmphasis:#backgroundColor from:currentEmphasis |
|
995 |
] ifFalse:[ |
|
996 |
currentEmphasis := Text addEmphasis:(#backgroundColor->aColor) to:currentEmphasis |
|
997 |
] |
|
2539 | 998 |
! |
999 |
||
1822
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1000 |
bold |
3205 | 1001 |
"switch to bold - followup text sent via show/nextPutAll: will be inserted in |
1002 |
a bold font." |
|
1003 |
||
4658 | 1004 |
currentEmphasis := Text addEmphasis:#bold to:currentEmphasis |
1822
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1005 |
! |
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1006 |
|
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1007 |
color:aColor |
4658 | 1008 |
aColor isNil ifTrue:[ |
1009 |
currentEmphasis := Text removeEmphasis:#color from:currentEmphasis |
|
1010 |
] ifFalse:[ |
|
1011 |
currentEmphasis := Text addEmphasis:(#color->aColor) to:currentEmphasis |
|
1012 |
]. |
|
1822
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1013 |
|
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1014 |
"Modified: / 26.3.1999 / 14:29:21 / cg" |
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1015 |
! |
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1016 |
|
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1017 |
italic |
4658 | 1018 |
currentEmphasis := Text addEmphasis:#italic to:currentEmphasis |
1822
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1019 |
! |
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1020 |
|
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1021 |
normal |
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1022 |
currentEmphasis := nil |
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1023 |
! |
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1024 |
|
4659 | 1025 |
notBold |
1026 |
"switch to non-bold - followup text sent via show/nextPutAll: will be inserted in |
|
1027 |
a non-bold font." |
|
1028 |
||
1029 |
currentEmphasis := Text removeEmphasis:#bold from:currentEmphasis |
|
1030 |
! |
|
1031 |
||
1032 |
notItalic |
|
1033 |
"switch to non-italic - followup text sent via show/nextPutAll: will be inserted in |
|
1034 |
a non-italic font." |
|
1035 |
||
1036 |
currentEmphasis := Text removeEmphasis:#italic from:currentEmphasis |
|
1037 |
! |
|
1038 |
||
1039 |
notReverse |
|
1040 |
currentEmphasis := Text removeEmphasis:#color from:currentEmphasis. |
|
1041 |
currentEmphasis := Text removeEmphasis:#backgroundColor from:currentEmphasis. |
|
1042 |
! |
|
1043 |
||
1044 |
notUnderline |
|
1045 |
currentEmphasis := Text removeEmphasis:#underline from:currentEmphasis |
|
1046 |
||
1047 |
"Created: / 26.3.1999 / 14:27:07 / cg" |
|
1048 |
! |
|
1049 |
||
1822
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1050 |
reverse |
4658 | 1051 |
currentEmphasis := Text addEmphasis:(#color->bgColor) to:currentEmphasis. |
1052 |
currentEmphasis := Text addEmphasis:(#backgroundColor->fgColor) to:currentEmphasis. |
|
1822
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1053 |
! |
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1054 |
|
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1055 |
underline |
4658 | 1056 |
currentEmphasis := Text addEmphasis:#underline to:currentEmphasis |
1822
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1057 |
|
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1058 |
"Created: / 26.3.1999 / 14:27:07 / cg" |
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1059 |
! ! |
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1060 |
|
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1061 |
!TextCollector methodsFor:'transcript specials'! |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1062 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1063 |
beTranscript |
928 | 1064 |
"make the receiver be the systemTranscript; this one |
1065 |
is accessable via the global Transcript and gets relevant |
|
1066 |
system messages from various places." |
|
1067 |
||
3852
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
1068 |
self beTranscript:#Transcript |
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
1069 |
|
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
1070 |
"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
|
1071 |
! |
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
1072 |
|
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
1073 |
beTranscript:name |
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
1074 |
"make the receiver be the systemTranscript; this one |
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
1075 |
is accessable via the global Transcript and gets relevant |
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
1076 |
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
|
1077 |
|
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1078 |
|fg bg cFg cBg| |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1079 |
|
3852
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
1080 |
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
|
1081 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1082 |
" |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1083 |
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
|
1084 |
" |
1421
afef284eadc4
only reset Transcript to stdErr, if I really am the transcript.
ca
parents:
1389
diff
changeset
|
1085 |
self destroyAction:[ |
3852
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
1086 |
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
|
1087 |
Smalltalk at:name put:Stderr |
1421
afef284eadc4
only reset Transcript to stdErr, if I really am the transcript.
ca
parents:
1389
diff
changeset
|
1088 |
] |
afef284eadc4
only reset Transcript to stdErr, if I really am the transcript.
ca
parents:
1389
diff
changeset
|
1089 |
]. |
0 | 1090 |
|
928 | 1091 |
"/ user may prefer a special color for this one; |
1092 |
"/ look into the style definitions ... |
|
1093 |
||
1389 | 1094 |
fg := styleSheet colorAt:'transcript.foregroundColor' default:self foregroundColor. |
1095 |
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
|
1096 |
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
|
1097 |
self viewBackground:bg. |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1098 |
|
1389 | 1099 |
cFg := styleSheet colorAt:'transcript.cursorForegroundColor' default:bg. |
1100 |
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
|
1101 |
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
|
1102 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1103 |
"self lineLimit:1000. " "or whatever you think makes sense" |
928 | 1104 |
|
1389 | 1105 |
"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
|
1106 |
! |
24991431c7e0
added #clear (to clear its contents)
Claus Gittinger <cg@exept.de>
parents:
2831
diff
changeset
|
1107 |
|
4643 | 1108 |
beginEntry |
1109 |
"noop for now, ST80 compatibility" |
|
1110 |
||
1111 |
^ self |
|
1112 |
||
1113 |
"Created: / 4.3.1998 / 11:08:14 / stefan" |
|
1114 |
! |
|
1115 |
||
2928
24991431c7e0
added #clear (to clear its contents)
Claus Gittinger <cg@exept.de>
parents:
2831
diff
changeset
|
1116 |
clear |
3119 | 1117 |
self endEntry. |
2928
24991431c7e0
added #clear (to clear its contents)
Claus Gittinger <cg@exept.de>
parents:
2831
diff
changeset
|
1118 |
self contents:nil. |
24991431c7e0
added #clear (to clear its contents)
Claus Gittinger <cg@exept.de>
parents:
2831
diff
changeset
|
1119 |
|
24991431c7e0
added #clear (to clear its contents)
Claus Gittinger <cg@exept.de>
parents:
2831
diff
changeset
|
1120 |
" |
24991431c7e0
added #clear (to clear its contents)
Claus Gittinger <cg@exept.de>
parents:
2831
diff
changeset
|
1121 |
Transcript clear |
24991431c7e0
added #clear (to clear its contents)
Claus Gittinger <cg@exept.de>
parents:
2831
diff
changeset
|
1122 |
" |
3774 | 1123 |
! |
1124 |
||
4650 | 1125 |
delayedEndEntry |
1126 |
"flush collected output; displaying all that has been buffered so far" |
|
1127 |
||
1128 |
"/ self ~~ Transcript ifTrue:[ 'de0' printCR ]. |
|
1129 |
inFlush ifTrue:[ |
|
1130 |
"/ self ~~ Transcript ifTrue:[ 'deX' printCR ]. |
|
1131 |
^ self |
|
1132 |
]. |
|
1133 |
||
1134 |
"/ self ~~ Transcript ifTrue:[ 'de1' printCR ]. |
|
1135 |
access owner == Processor activeProcess ifTrue:[ |
|
1136 |
"/ self ~~ Transcript ifTrue:[ 'de2' printCR ]. |
|
1137 |
self installDelayedUpdate. |
|
1138 |
^ self |
|
1139 |
]. |
|
1140 |
||
1141 |
self endEntry |
|
1142 |
! |
|
1143 |
||
4643 | 1144 |
endEntry |
1145 |
"flush collected output; displaying all that has been buffered so far" |
|
1146 |
||
4961 | 1147 |
|nLines lines device| |
4643 | 1148 |
|
4965 | 1149 |
((outstandingLines isEmptyOrNil) and:[outstandingLine isEmptyOrNil]) ifTrue:[ |
4650 | 1150 |
"/ self ~~ Transcript ifTrue:[ 'e- ' print. thisContext sender selector printCR ]. |
1151 |
^ self |
|
1152 |
]. |
|
4965 | 1153 |
shown ifFalse:[ |
1154 |
"/ when iconified or not yet shown, keep |
|
1155 |
"/ collecting. But not too much ... |
|
1156 |
outstandingLines size < 300 ifTrue:[ |
|
1157 |
"/ self ~~ Transcript ifTrue:[ 'eC' printCR ]. |
|
1158 |
access critical:[ |
|
1159 |
flushPending ifFalse:[ |
|
1160 |
self installDelayedUpdate. |
|
1161 |
]. |
|
1162 |
]. |
|
1163 |
^ self |
|
1164 |
] |
|
1165 |
]. |
|
4650 | 1166 |
|
4961 | 1167 |
device := self graphicsDevice. |
4963 | 1168 |
(device isNil or:[device isOpen not or:[self drawableId isNil]]) ifTrue:[ |
4961 | 1169 |
"on snapshot load, Transcript may not yet be re-created. |
1170 |
Write to Stderr then." |
|
1171 |
Stderr notNil ifTrue:[ |
|
4963 | 1172 |
outstandingLines do:[:eachLine| |
1173 |
eachLine printOn:Stderr. |
|
1174 |
]. |
|
4961 | 1175 |
outstandingLines := nil. |
1176 |
outstandingLine notNil ifTrue:[ |
|
1177 |
outstandingLine printOn:Stderr. |
|
1178 |
outstandingLine := nil. |
|
1179 |
]. |
|
1180 |
Stderr cr. |
|
1181 |
]. |
|
1182 |
^ self. |
|
1183 |
]. |
|
1184 |
||
4650 | 1185 |
"/ self ~~ Transcript ifTrue:[ 'e ' print. |
1186 |
"/ thisContext fullPrintAll. |
|
1187 |
"/ ]. |
|
4643 | 1188 |
|
4650 | 1189 |
"/ access owner == Processor activeProcess ifTrue:[ |
1190 |
"/self ~~ Transcript ifTrue:[ 'eI' printCR ]. |
|
1191 |
"/ self installDelayedUpdate. |
|
1192 |
"/ ^ self |
|
1193 |
"/ ]. |
|
4643 | 1194 |
|
1195 |
access critical:[ |
|
1196 |
collecting ifTrue:[ |
|
1197 |
flushBlock notNil ifTrue:[ |
|
1198 |
Processor removeTimedBlock:flushBlock. |
|
1199 |
]. |
|
4650 | 1200 |
"/ flushPending ifFalse:[ |
1201 |
"/self ~~ Transcript ifTrue:[ 'eP' printCR ]. |
|
1202 |
"/ ^ self |
|
1203 |
"/ ]. |
|
4643 | 1204 |
]. |
1205 |
||
4650 | 1206 |
"/ self ~~ Transcript ifTrue:[ 'e1' printCR ]. |
4643 | 1207 |
inFlush ifFalse:[ |
4650 | 1208 |
"/ self ~~ Transcript ifTrue:[ 'e2' printCR ]. |
4643 | 1209 |
inFlush := true. |
1210 |
[ |
|
1211 |
flushPending := false. |
|
5147 | 1212 |
self withAutoIndent:false do:[ |
4650 | 1213 |
"/ self ~~ Transcript ifTrue:[ 'e3 "' print. outstandingLine print. '" ' print. outstandingLine asByteArray hexPrintString print. ' ' printCR. |
1214 |
"/ (outstandingLines ? #()) do:[:l | '"' print. l print. '" ' print. l asByteArray hexPrintString printCR ]]. |
|
1215 |
(nLines := outstandingLines size) ~~ 0 ifTrue:[ |
|
1216 |
"/ self ~~ Transcript ifTrue:[ 'e4' printCR.]. |
|
4643 | 1217 |
"insert the bunch of lines - if any" |
1218 |
lines := outstandingLines. |
|
1219 |
outstandingLines := nil. |
|
1220 |
||
4650 | 1221 |
"/ self ~~ Transcript ifTrue:[ 'e5 ' print. nLines printCR.]. |
4643 | 1222 |
(nLines ~~ 0) ifTrue:[ |
1223 |
self isInInsertMode ifTrue:[ |
|
4650 | 1224 |
"/ self ~~ Transcript ifTrue:[ (nLines > 1 and:[(lines second ? '') startsWith:'111']) ifTrue:['e6a' printCR.self halt.]]. |
4643 | 1225 |
self insertLines:lines withCR:true. |
4650 | 1226 |
"/ self ~~ Transcript ifTrue:[ (nLines > 1 and:[(lines second ? '') startsWith:'111']) ifTrue:['e6a' printCR.self halt.]]. |
4643 | 1227 |
] ifFalse:[ |
1228 |
self replaceLines:lines withCR:true |
|
1229 |
]. |
|
1230 |
alwaysAppendAtEnd ifTrue:[ |
|
1231 |
self cursorToEnd. |
|
1232 |
]. |
|
1233 |
(cursorLine >= (firstLineShown + nFullLinesShown)) ifTrue:[ |
|
5137 | 1234 |
scrollLocked ifFalse:[ |
1235 |
self withCursorOffDo:[ |
|
1236 |
self scrollDown:nLines |
|
1237 |
] |
|
1238 |
]. |
|
4643 | 1239 |
]. |
1240 |
]. |
|
1241 |
]. |
|
1242 |
||
4650 | 1243 |
"/ self ~~ Transcript ifTrue:[ (nLines > 1 and:[(lines second ? '') startsWith:'111']) ifTrue:['e7a' printCR.self halt.]]. |
4643 | 1244 |
"and the last partial line - if any" |
1245 |
outstandingLine size ~~ 0 ifTrue:[ |
|
1246 |
self isInInsertMode ifTrue:[ |
|
1247 |
self insertStringAtCursor:outstandingLine. |
|
1248 |
] ifFalse:[ |
|
1249 |
self replaceStringAtCursor:outstandingLine. |
|
1250 |
]. |
|
1251 |
outstandingLine := ''. |
|
1252 |
]. |
|
1253 |
self checkLineLimit. |
|
1254 |
"/ device flush. |
|
5147 | 1255 |
]. |
4643 | 1256 |
] ensure:[ |
1257 |
inFlush := false. |
|
1258 |
] |
|
1259 |
]. |
|
4657 | 1260 |
"/ flushPending ifTrue:[ |
1261 |
"/ flushPending := false. |
|
1262 |
"/ self installDelayedUpdate |
|
1263 |
"/ ] |
|
4643 | 1264 |
]. |
1265 |
||
1266 |
"Modified: / 9.11.1998 / 21:17:56 / cg" |
|
1267 |
! |
|
1268 |
||
3774 | 1269 |
flash |
1270 |
"make sure everything is visible, before flashing" |
|
1271 |
||
1272 |
self endEntry. |
|
1273 |
super flash. |
|
5408 | 1274 |
! |
1275 |
||
1276 |
flash:message withColor:flashColor |
|
1277 |
"make sure everything is visible, before flashing" |
|
1278 |
||
1279 |
self endEntry. |
|
1280 |
super flash:message withColor:flashColor. |
|
0 | 1281 |
! ! |
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1282 |
|
928 | 1283 |
!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
|
1284 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1285 |
version |
5408 | 1286 |
^ '$Header$' |
3958 | 1287 |
! |
1288 |
||
1289 |
version_CVS |
|
5408 | 1290 |
^ '$Header$' |
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1291 |
! ! |
2632 | 1292 |
|
4503 | 1293 |
|
2025
0c9729befabc
allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
1294 |
TextCollector initialize! |