author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Sun, 03 Apr 2016 17:13:01 +0100 | |
branch | jv |
changeset 5648 | 83d019d51deb |
parent 5611 | 17b35abfb74e |
parent 5644 | b04b627860b9 |
child 5740 | 430b7b15a684 |
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'. |
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 |
5569 | 773 |
"convenient formatted printing: |
774 |
%1..%9 - positional parameters from args-collection |
|
775 |
%(name) - named parameter from args-dictionary |
|
776 |
%% - escape for % |
|
777 |
%<cr> - cr (also tab, nl)" |
|
778 |
||
5025 | 779 |
^ entryStream format:formatSpec with:args |
5569 | 780 |
|
781 |
" |
|
782 |
1 to: 10 do:[:i | |
|
783 |
Transcript |
|
784 |
format:'[%1] Hello %2 World - this is %3%<cr>' |
|
785 |
with:{i . 'my' . 'nice'} |
|
786 |
]. |
|
787 |
" |
|
5025 | 788 |
! |
789 |
||
0 | 790 |
lineLength |
928 | 791 |
"to make a textCollector (somewhat) compatible with printer |
792 |
streams, support the lineLength query" |
|
793 |
||
4918 | 794 |
^ width // (gc font width) |
928 | 795 |
|
796 |
"Modified: 11.1.1997 / 14:42:41 / cg" |
|
0 | 797 |
! |
798 |
||
799 |
nextPut:something |
|
928 | 800 |
"append somethings printString to my displayed text. |
801 |
This allows TextCollectors to be used Stream-wise" |
|
0 | 802 |
|
1504
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
803 |
|txt| |
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
804 |
|
656 | 805 |
(something isCharacter) ifTrue:[ |
806 |
((something == Character cr) or:[something == Character nl]) ifTrue:[ |
|
807 |
^ self cr |
|
808 |
]. |
|
0 | 809 |
]. |
1504
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
810 |
|
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
811 |
txt := something asString. |
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
812 |
currentEmphasis notNil ifTrue:[ |
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
813 |
txt := txt emphasizeAllWith:currentEmphasis |
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
814 |
]. |
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
815 |
self show:txt. |
656 | 816 |
|
817 |
"/ flushPending ifTrue:[ |
|
818 |
"/ self endEntry |
|
819 |
"/ ]. |
|
820 |
"/ (something isMemberOf:Character) ifTrue:[ |
|
821 |
"/ ((something == Character cr) or:[something == Character nl]) ifTrue:[ |
|
822 |
"/ ^ self cr |
|
823 |
"/ ]. |
|
824 |
"/ self insertCharAtCursor:something |
|
825 |
"/ ] ifFalse:[ |
|
826 |
"/ self insertStringAtCursor:(something printString). |
|
827 |
"/ self checkLineLimit |
|
828 |
"/ ]. |
|
829 |
"/ device flush |
|
830 |
||
928 | 831 |
"Modified: 11.1.1997 / 14:43:05 / cg" |
0 | 832 |
! |
833 |
||
834 |
nextPutAll:something |
|
928 | 835 |
"append all of something to my displayed text. |
836 |
This allows TextCollectors to be used Stream-wise" |
|
0 | 837 |
|
3958 | 838 |
self show:(currentEmphasis notNil |
839 |
ifTrue:[something emphasizeAllWith:currentEmphasis] |
|
840 |
ifFalse:[something]) |
|
656 | 841 |
|
928 | 842 |
"Modified: 11.1.1997 / 14:43:26 / cg" |
0 | 843 |
! |
844 |
||
5320 | 845 |
nextPutAll:count from:buffer startingAt:initialPosition |
846 |
"append count characters from buffer starting at initialPosition to my displayed text. |
|
847 |
This allows TextCollectors to be used Stream-wise" |
|
848 |
||
849 |
|stringToShow| |
|
850 |
||
851 |
stringToShow := buffer copyFrom:initialPosition to:initialPosition+count-1. |
|
852 |
||
853 |
self show:(currentEmphasis notNil |
|
854 |
ifTrue:[stringToShow emphasizeAllWith:currentEmphasis] |
|
855 |
ifFalse:[stringToShow]). |
|
856 |
^ count. |
|
857 |
||
858 |
"Modified: 11.1.1997 / 14:43:26 / cg" |
|
859 |
! |
|
860 |
||
5603 | 861 |
printf:formatSpec |
862 |
"convenient C-style formatted printing" |
|
863 |
||
864 |
^ entryStream printf:formatSpec |
|
865 |
||
866 |
" |
|
867 |
1 to: 10 do:[:i | |
|
868 |
Transcript printf:'Hello World\n' |
|
869 |
]. |
|
870 |
" |
|
871 |
! |
|
872 |
||
5569 | 873 |
printf:formatSpec with:arg1 |
5603 | 874 |
"convenient C-style formatted printing with 1 argument" |
5569 | 875 |
|
876 |
^ entryStream printf:formatSpec with:arg1 |
|
877 |
||
878 |
" |
|
879 |
1 to: 10 do:[:i | |
|
5603 | 880 |
Transcript printf:'[%d] Hello World\n' with:i |
5569 | 881 |
]. |
882 |
" |
|
883 |
! |
|
884 |
||
885 |
printf:formatSpec with:arg1 with:arg2 |
|
5603 | 886 |
"convenient C-style formatted printing with 2 arguments" |
5569 | 887 |
|
888 |
^ entryStream printf:formatSpec with:arg1 with:arg2 |
|
889 |
||
890 |
" |
|
891 |
1 to: 10 do:[:i | |
|
892 |
Transcript |
|
893 |
printf:'[%d] Hello World\n' with:i |
|
894 |
]. |
|
895 |
" |
|
896 |
! |
|
897 |
||
898 |
printf:formatSpec with:arg1 with:arg2 with:arg3 |
|
5603 | 899 |
"convenient C-style formatted printing with 3 arguments" |
5569 | 900 |
|
901 |
^ entryStream printf:formatSpec with:arg1 with:arg2 with:arg3 |
|
902 |
||
903 |
" |
|
904 |
1 to: 10 do:[:i | |
|
905 |
Transcript |
|
906 |
printf:'[%d] Hello World\n' with:i |
|
907 |
]. |
|
908 |
" |
|
909 |
! |
|
910 |
||
911 |
printf:formatSpec with:arg1 with:arg2 with:arg3 with:arg4 |
|
912 |
"convenient C-style formatted printing" |
|
913 |
||
914 |
^ entryStream printf:formatSpec with:arg1 with:arg2 with:arg3 with:arg4 |
|
915 |
||
916 |
" |
|
917 |
1 to: 10 do:[:i | |
|
918 |
Transcript |
|
919 |
printf:'[%d] Hello World\n' with:i |
|
920 |
]. |
|
921 |
" |
|
922 |
! |
|
923 |
||
924 |
printf:formatSpec with:arg1 with:arg2 with:arg3 with:arg4 with:arg5 |
|
925 |
"convenient C-style formatted printing" |
|
926 |
||
927 |
^ entryStream printf:formatSpec with:arg1 with:arg2 with:arg3 with:arg4 with:arg5 |
|
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 withAll:args |
|
5603 | 938 |
"convenient C-style formatted printing with an arbitrary number of arguments" |
5569 | 939 |
|
940 |
^ entryStream printf:formatSpec withAll:args |
|
941 |
||
942 |
" |
|
943 |
1 to: 10 do:[:i | |
|
944 |
Transcript |
|
945 |
printf:'[%d] Hello %s World - this is %s\n' |
|
946 |
with:{i . 'my' . 'nice'} |
|
947 |
]. |
|
948 |
" |
|
949 |
! |
|
950 |
||
5130 | 951 |
println |
952 |
"for those used to Java/Javascript, a compatibility message. |
|
953 |
Most useful inside expecco" |
|
954 |
||
955 |
self cr |
|
956 |
! |
|
957 |
||
958 |
println:anObject |
|
959 |
"for those used to Java/Javascript, a compatibility message. |
|
960 |
Most useful inside expecco" |
|
961 |
||
962 |
self showCR:anObject |
|
963 |
! |
|
964 |
||
0 | 965 |
show:anObject |
966 |
"insert the argument aString at current cursor position" |
|
967 |
||
4045 | 968 |
|printString lines| |
0 | 969 |
|
4045 | 970 |
printString := anObject printString. |
928 | 971 |
|
4643 | 972 |
(self == Transcript) ifTrue:[ |
973 |
DebugSendersOfMessagePattern notNil ifTrue:[ |
|
974 |
(DebugSendersOfMessagePattern match:printString string) ifTrue:[ |
|
975 |
"disable all with: DebugSendersOfMessagePattern := nil" |
|
976 |
self halt:('Transcript: text matches: "', printString,'"'). |
|
977 |
]. |
|
4122 | 978 |
]. |
4643 | 979 |
TraceSendersOfMessagePattern notNil ifTrue:[ |
980 |
(TraceSendersOfMessagePattern match:printString string) ifTrue:[ |
|
981 |
printString := self senderTraceString,': ',printString |
|
982 |
]. |
|
4365 | 983 |
]. |
984 |
]. |
|
4105
c2c3a96f8757
debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
985 |
|
4045 | 986 |
(printString includes:(Character cr)) ifTrue:[ |
987 |
lines := printString asStringCollection. |
|
653 | 988 |
lines keysAndValuesDo:[:nr :line | |
1562
9b7557a81849
made the number of buffered lines an instVar.
Claus Gittinger <cg@exept.de>
parents:
1504
diff
changeset
|
989 |
(nr == lines size |
4045 | 990 |
and:[(printString endsWith:(Character cr)) not]) ifTrue:[ |
653 | 991 |
"/ the last one. |
992 |
self show:line |
|
993 |
] ifFalse:[ |
|
994 |
self showCR:line |
|
995 |
]. |
|
996 |
]. |
|
997 |
^ self. |
|
308
b216a5efa2c8
handle show: with a string containing cr's
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
998 |
]. |
b216a5efa2c8
handle show: with a string containing cr's
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
999 |
|
1026 | 1000 |
access critical:[ |
4650 | 1001 |
"/ self ~~ Transcript ifTrue:['xs' printCR]. |
3295
37cb2b5d579a
Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents:
3248
diff
changeset
|
1002 |
outstandingLine size ~~ 0 ifTrue:[ |
4045 | 1003 |
outstandingLine := outstandingLine , printString |
1026 | 1004 |
] ifFalse:[ |
4045 | 1005 |
outstandingLine := printString |
653 | 1006 |
]. |
1026 | 1007 |
collecting ifTrue:[ |
1008 |
flushPending ifFalse:[ |
|
1009 |
self installDelayedUpdate |
|
1312
eaa44f7649f5
flush after some lines have been collected
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
1010 |
] ifTrue:[ |
1562
9b7557a81849
made the number of buffered lines an instVar.
Claus Gittinger <cg@exept.de>
parents:
1504
diff
changeset
|
1011 |
outstandingLines size > collectSize ifTrue:[ |
1312
eaa44f7649f5
flush after some lines have been collected
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
1012 |
self endEntry |
eaa44f7649f5
flush after some lines have been collected
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
1013 |
] |
1026 | 1014 |
] |
1015 |
] ifFalse:[ |
|
1016 |
self endEntry |
|
653 | 1017 |
] |
1026 | 1018 |
]. |
0 | 1019 |
|
4411 | 1020 |
"Modified: / 24-03-2012 / 20:04:10 / cg" |
4428 | 1021 |
"Modified (format): / 02-06-2012 / 01:54:55 / cg" |
1617 | 1022 |
! |
1023 |
||
1024 |
showCR:anObject |
|
1025 |
"insert the argument aString at current cursor position, |
|
1026 |
and advance to the next line. This is the same as a #show: |
|
1027 |
followed by a #cr." |
|
1028 |
||
5302 | 1029 |
|printString lines crlf| |
1617 | 1030 |
|
4647 | 1031 |
"/ self ~~ Transcript ifTrue:[ ^ self tshow:anObject]. |
4045 | 1032 |
printString := anObject printString. |
1033 |
printString size == 0 ifTrue:[ |
|
2689
ddaa98a64bd5
Fix #showCR: when displaying multi-line strings
Stefan Vogel <sv@exept.de>
parents:
2632
diff
changeset
|
1034 |
self cr. |
ddaa98a64bd5
Fix #showCR: when displaying multi-line strings
Stefan Vogel <sv@exept.de>
parents:
2632
diff
changeset
|
1035 |
^ self. |
1617 | 1036 |
]. |
1037 |
||
4643 | 1038 |
self == Transcript ifTrue:[ |
1039 |
DebugSendersOfMessagePattern notNil ifTrue:[ |
|
1040 |
(DebugSendersOfMessagePattern match:printString string) ifTrue:[ |
|
1041 |
"/ to disable this right from inside the debugger, evaluate: |
|
5454 | 1042 |
" |
1043 |
DebugSendersOfMessagePattern := nil |
|
1044 |
" |
|
4643 | 1045 |
self halt:('Transcript: text matches: "', printString, '"'). |
1046 |
]. |
|
4365 | 1047 |
]. |
4643 | 1048 |
TraceSendersOfMessagePattern notNil ifTrue:[ |
1049 |
(TraceSendersOfMessagePattern match:printString string) ifTrue:[ |
|
1050 |
printString := self senderTraceString,': ',printString |
|
1051 |
]. |
|
4122 | 1052 |
]. |
4105
c2c3a96f8757
debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
1053 |
]. |
c2c3a96f8757
debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
1054 |
|
5302 | 1055 |
crlf := String crlf. |
1056 |
(printString includesAny:crlf) ifTrue:[ |
|
4045 | 1057 |
lines := printString asStringCollection. |
2689
ddaa98a64bd5
Fix #showCR: when displaying multi-line strings
Stefan Vogel <sv@exept.de>
parents:
2632
diff
changeset
|
1058 |
lines do:[:line| |
5302 | 1059 |
|lineWithoutEOL| |
1060 |
||
4106 | 1061 |
(line endsWith:Character nl) ifTrue:[ |
5302 | 1062 |
(line endsWith:crlf) ifTrue:[ |
1063 |
lineWithoutEOL := line copyButLast:2. |
|
4106 | 1064 |
] ifFalse:[ |
5302 | 1065 |
lineWithoutEOL := line copyButLast:1. |
4106 | 1066 |
] |
2805 | 1067 |
] ifFalse:[ |
4106 | 1068 |
(line endsWith:Character return) ifTrue:[ |
5302 | 1069 |
lineWithoutEOL := line copyButLast:1. |
4106 | 1070 |
] ifFalse:[ |
5302 | 1071 |
lineWithoutEOL := line |
4106 | 1072 |
] |
5302 | 1073 |
]. |
1074 |
self addLine:lineWithoutEOL. |
|
1617 | 1075 |
]. |
1076 |
^ self. |
|
1077 |
]. |
|
4106 | 1078 |
self addLine:printString |
4365 | 1079 |
|
4410 | 1080 |
"Modified: / 24-03-2012 / 20:00:08 / cg" |
4073 | 1081 |
! |
1082 |
||
4473 | 1083 |
space |
1084 |
self show:' ' |
|
1085 |
! |
|
1086 |
||
4073 | 1087 |
tab |
1088 |
"append a tab-character to the stream. |
|
1089 |
This is only allowed, if the receiver supports writing." |
|
1090 |
||
1091 |
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
|
1092 |
! ! |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1093 |
|
2746 | 1094 |
!TextCollector methodsFor:'stream messages-emphasis'! |
1822
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1095 |
|
2539 | 1096 |
bgColor:aColor |
4658 | 1097 |
aColor isNil ifTrue:[ |
1098 |
currentEmphasis := Text removeEmphasis:#backgroundColor from:currentEmphasis |
|
1099 |
] ifFalse:[ |
|
1100 |
currentEmphasis := Text addEmphasis:(#backgroundColor->aColor) to:currentEmphasis |
|
1101 |
] |
|
2539 | 1102 |
! |
1103 |
||
1822
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1104 |
bold |
3205 | 1105 |
"switch to bold - followup text sent via show/nextPutAll: will be inserted in |
1106 |
a bold font." |
|
1107 |
||
4658 | 1108 |
currentEmphasis := Text addEmphasis:#bold to:currentEmphasis |
1822
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1109 |
! |
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1110 |
|
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1111 |
color:aColor |
4658 | 1112 |
aColor isNil ifTrue:[ |
1113 |
currentEmphasis := Text removeEmphasis:#color from:currentEmphasis |
|
1114 |
] ifFalse:[ |
|
1115 |
currentEmphasis := Text addEmphasis:(#color->aColor) to:currentEmphasis |
|
1116 |
]. |
|
1822
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1117 |
|
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1118 |
"Modified: / 26.3.1999 / 14:29:21 / cg" |
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1119 |
! |
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1120 |
|
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1121 |
italic |
4658 | 1122 |
currentEmphasis := Text addEmphasis:#italic to:currentEmphasis |
1822
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1123 |
! |
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1124 |
|
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1125 |
normal |
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1126 |
currentEmphasis := nil |
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1127 |
! |
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1128 |
|
4659 | 1129 |
notBold |
1130 |
"switch to non-bold - followup text sent via show/nextPutAll: will be inserted in |
|
1131 |
a non-bold font." |
|
1132 |
||
1133 |
currentEmphasis := Text removeEmphasis:#bold from:currentEmphasis |
|
1134 |
! |
|
1135 |
||
1136 |
notItalic |
|
1137 |
"switch to non-italic - followup text sent via show/nextPutAll: will be inserted in |
|
1138 |
a non-italic font." |
|
1139 |
||
1140 |
currentEmphasis := Text removeEmphasis:#italic from:currentEmphasis |
|
1141 |
! |
|
1142 |
||
1143 |
notReverse |
|
1144 |
currentEmphasis := Text removeEmphasis:#color from:currentEmphasis. |
|
1145 |
currentEmphasis := Text removeEmphasis:#backgroundColor from:currentEmphasis. |
|
1146 |
! |
|
1147 |
||
1148 |
notUnderline |
|
1149 |
currentEmphasis := Text removeEmphasis:#underline from:currentEmphasis |
|
1150 |
||
1151 |
"Created: / 26.3.1999 / 14:27:07 / cg" |
|
1152 |
! |
|
1153 |
||
1822
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1154 |
reverse |
4658 | 1155 |
currentEmphasis := Text addEmphasis:(#color->bgColor) to:currentEmphasis. |
1156 |
currentEmphasis := Text addEmphasis:(#backgroundColor->fgColor) to:currentEmphasis. |
|
1822
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1157 |
! |
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1158 |
|
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1159 |
underline |
4658 | 1160 |
currentEmphasis := Text addEmphasis:#underline to:currentEmphasis |
1822
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 |
"Created: / 26.3.1999 / 14:27:07 / cg" |
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1163 |
! ! |
9abf58839e67
added #color: and #underline
Claus Gittinger <cg@exept.de>
parents:
1714
diff
changeset
|
1164 |
|
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1165 |
!TextCollector methodsFor:'transcript specials'! |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1166 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1167 |
beTranscript |
928 | 1168 |
"make the receiver be the systemTranscript; this one |
5575 | 1169 |
is accessible via the global Transcript and gets relevant |
928 | 1170 |
system messages from various places." |
1171 |
||
3852
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
1172 |
self beTranscript:#Transcript |
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
1173 |
|
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
1174 |
"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
|
1175 |
! |
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
1176 |
|
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
1177 |
beTranscript:name |
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
1178 |
"make the receiver be the systemTranscript; this one |
5575 | 1179 |
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
|
1180 |
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
|
1181 |
|
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1182 |
|fg bg cFg cBg| |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1183 |
|
3852
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
1184 |
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
|
1185 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1186 |
" |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1187 |
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
|
1188 |
" |
1421
afef284eadc4
only reset Transcript to stdErr, if I really am the transcript.
ca
parents:
1389
diff
changeset
|
1189 |
self destroyAction:[ |
3852
8322d7c41f1c
refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents:
3774
diff
changeset
|
1190 |
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
|
1191 |
Smalltalk at:name put:Stderr |
1421
afef284eadc4
only reset Transcript to stdErr, if I really am the transcript.
ca
parents:
1389
diff
changeset
|
1192 |
] |
afef284eadc4
only reset Transcript to stdErr, if I really am the transcript.
ca
parents:
1389
diff
changeset
|
1193 |
]. |
0 | 1194 |
|
928 | 1195 |
"/ user may prefer a special color for this one; |
1196 |
"/ look into the style definitions ... |
|
1197 |
||
1389 | 1198 |
fg := styleSheet colorAt:'transcript.foregroundColor' default:self foregroundColor. |
1199 |
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
|
1200 |
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
|
1201 |
self viewBackground:bg. |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1202 |
|
1389 | 1203 |
cFg := styleSheet colorAt:'transcript.cursorForegroundColor' default:bg. |
1204 |
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
|
1205 |
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
|
1206 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1207 |
"self lineLimit:1000. " "or whatever you think makes sense" |
928 | 1208 |
|
1389 | 1209 |
"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
|
1210 |
! |
24991431c7e0
added #clear (to clear its contents)
Claus Gittinger <cg@exept.de>
parents:
2831
diff
changeset
|
1211 |
|
4643 | 1212 |
beginEntry |
1213 |
"noop for now, ST80 compatibility" |
|
1214 |
||
1215 |
^ self |
|
1216 |
||
1217 |
"Created: / 4.3.1998 / 11:08:14 / stefan" |
|
1218 |
! |
|
1219 |
||
2928
24991431c7e0
added #clear (to clear its contents)
Claus Gittinger <cg@exept.de>
parents:
2831
diff
changeset
|
1220 |
clear |
3119 | 1221 |
self endEntry. |
2928
24991431c7e0
added #clear (to clear its contents)
Claus Gittinger <cg@exept.de>
parents:
2831
diff
changeset
|
1222 |
self contents:nil. |
24991431c7e0
added #clear (to clear its contents)
Claus Gittinger <cg@exept.de>
parents:
2831
diff
changeset
|
1223 |
|
24991431c7e0
added #clear (to clear its contents)
Claus Gittinger <cg@exept.de>
parents:
2831
diff
changeset
|
1224 |
" |
24991431c7e0
added #clear (to clear its contents)
Claus Gittinger <cg@exept.de>
parents:
2831
diff
changeset
|
1225 |
Transcript clear |
24991431c7e0
added #clear (to clear its contents)
Claus Gittinger <cg@exept.de>
parents:
2831
diff
changeset
|
1226 |
" |
3774 | 1227 |
! |
1228 |
||
4650 | 1229 |
delayedEndEntry |
1230 |
"flush collected output; displaying all that has been buffered so far" |
|
1231 |
||
1232 |
"/ self ~~ Transcript ifTrue:[ 'de0' printCR ]. |
|
1233 |
inFlush ifTrue:[ |
|
1234 |
"/ self ~~ Transcript ifTrue:[ 'deX' printCR ]. |
|
1235 |
^ self |
|
1236 |
]. |
|
1237 |
||
1238 |
"/ self ~~ Transcript ifTrue:[ 'de1' printCR ]. |
|
1239 |
access owner == Processor activeProcess ifTrue:[ |
|
1240 |
"/ self ~~ Transcript ifTrue:[ 'de2' printCR ]. |
|
1241 |
self installDelayedUpdate. |
|
1242 |
^ self |
|
1243 |
]. |
|
1244 |
||
1245 |
self endEntry |
|
1246 |
! |
|
1247 |
||
4643 | 1248 |
endEntry |
1249 |
"flush collected output; displaying all that has been buffered so far" |
|
1250 |
||
5644 | 1251 |
|nLines lines| |
4643 | 1252 |
|
4965 | 1253 |
((outstandingLines isEmptyOrNil) and:[outstandingLine isEmptyOrNil]) ifTrue:[ |
4650 | 1254 |
"/ self ~~ Transcript ifTrue:[ 'e- ' print. thisContext sender selector printCR ]. |
1255 |
^ self |
|
1256 |
]. |
|
4965 | 1257 |
shown ifFalse:[ |
1258 |
"/ when iconified or not yet shown, keep |
|
1259 |
"/ collecting. But not too much ... |
|
1260 |
outstandingLines size < 300 ifTrue:[ |
|
1261 |
"/ self ~~ Transcript ifTrue:[ 'eC' printCR ]. |
|
1262 |
access critical:[ |
|
1263 |
flushPending ifFalse:[ |
|
1264 |
self installDelayedUpdate. |
|
1265 |
]. |
|
1266 |
]. |
|
1267 |
^ self |
|
1268 |
] |
|
1269 |
]. |
|
4650 | 1270 |
|
4963 | 1271 |
(device isNil or:[device isOpen not or:[self drawableId isNil]]) ifTrue:[ |
4961 | 1272 |
"on snapshot load, Transcript may not yet be re-created. |
1273 |
Write to Stderr then." |
|
1274 |
Stderr notNil ifTrue:[ |
|
4963 | 1275 |
outstandingLines do:[:eachLine| |
1276 |
eachLine printOn:Stderr. |
|
1277 |
]. |
|
4961 | 1278 |
outstandingLines := nil. |
1279 |
outstandingLine notNil ifTrue:[ |
|
1280 |
outstandingLine printOn:Stderr. |
|
1281 |
outstandingLine := nil. |
|
1282 |
]. |
|
1283 |
Stderr cr. |
|
1284 |
]. |
|
1285 |
^ self. |
|
1286 |
]. |
|
1287 |
||
4650 | 1288 |
"/ self ~~ Transcript ifTrue:[ 'e ' print. |
1289 |
"/ thisContext fullPrintAll. |
|
1290 |
"/ ]. |
|
4643 | 1291 |
|
4650 | 1292 |
"/ access owner == Processor activeProcess ifTrue:[ |
1293 |
"/self ~~ Transcript ifTrue:[ 'eI' printCR ]. |
|
1294 |
"/ self installDelayedUpdate. |
|
1295 |
"/ ^ self |
|
1296 |
"/ ]. |
|
4643 | 1297 |
|
1298 |
access critical:[ |
|
1299 |
collecting ifTrue:[ |
|
1300 |
flushBlock notNil ifTrue:[ |
|
1301 |
Processor removeTimedBlock:flushBlock. |
|
1302 |
]. |
|
4650 | 1303 |
"/ flushPending ifFalse:[ |
1304 |
"/self ~~ Transcript ifTrue:[ 'eP' printCR ]. |
|
1305 |
"/ ^ self |
|
1306 |
"/ ]. |
|
4643 | 1307 |
]. |
1308 |
||
4650 | 1309 |
"/ self ~~ Transcript ifTrue:[ 'e1' printCR ]. |
4643 | 1310 |
inFlush ifFalse:[ |
4650 | 1311 |
"/ self ~~ Transcript ifTrue:[ 'e2' printCR ]. |
4643 | 1312 |
inFlush := true. |
1313 |
[ |
|
1314 |
flushPending := false. |
|
5147 | 1315 |
self withAutoIndent:false do:[ |
4650 | 1316 |
"/ self ~~ Transcript ifTrue:[ 'e3 "' print. outstandingLine print. '" ' print. outstandingLine asByteArray hexPrintString print. ' ' printCR. |
1317 |
"/ (outstandingLines ? #()) do:[:l | '"' print. l print. '" ' print. l asByteArray hexPrintString printCR ]]. |
|
1318 |
(nLines := outstandingLines size) ~~ 0 ifTrue:[ |
|
1319 |
"/ self ~~ Transcript ifTrue:[ 'e4' printCR.]. |
|
4643 | 1320 |
"insert the bunch of lines - if any" |
1321 |
lines := outstandingLines. |
|
1322 |
outstandingLines := nil. |
|
1323 |
||
4650 | 1324 |
"/ self ~~ Transcript ifTrue:[ 'e5 ' print. nLines printCR.]. |
4643 | 1325 |
(nLines ~~ 0) ifTrue:[ |
1326 |
self isInInsertMode ifTrue:[ |
|
4650 | 1327 |
"/ self ~~ Transcript ifTrue:[ (nLines > 1 and:[(lines second ? '') startsWith:'111']) ifTrue:['e6a' printCR.self halt.]]. |
4643 | 1328 |
self insertLines:lines withCR:true. |
4650 | 1329 |
"/ self ~~ Transcript ifTrue:[ (nLines > 1 and:[(lines second ? '') startsWith:'111']) ifTrue:['e6a' printCR.self halt.]]. |
4643 | 1330 |
] ifFalse:[ |
1331 |
self replaceLines:lines withCR:true |
|
1332 |
]. |
|
1333 |
alwaysAppendAtEnd ifTrue:[ |
|
1334 |
self cursorToEnd. |
|
1335 |
]. |
|
1336 |
(cursorLine >= (firstLineShown + nFullLinesShown)) ifTrue:[ |
|
5137 | 1337 |
scrollLocked ifFalse:[ |
1338 |
self withCursorOffDo:[ |
|
1339 |
self scrollDown:nLines |
|
1340 |
] |
|
1341 |
]. |
|
4643 | 1342 |
]. |
1343 |
]. |
|
1344 |
]. |
|
1345 |
||
4650 | 1346 |
"/ self ~~ Transcript ifTrue:[ (nLines > 1 and:[(lines second ? '') startsWith:'111']) ifTrue:['e7a' printCR.self halt.]]. |
4643 | 1347 |
"and the last partial line - if any" |
1348 |
outstandingLine size ~~ 0 ifTrue:[ |
|
1349 |
self isInInsertMode ifTrue:[ |
|
1350 |
self insertStringAtCursor:outstandingLine. |
|
1351 |
] ifFalse:[ |
|
1352 |
self replaceStringAtCursor:outstandingLine. |
|
1353 |
]. |
|
1354 |
outstandingLine := ''. |
|
1355 |
]. |
|
1356 |
self checkLineLimit. |
|
1357 |
"/ device flush. |
|
5147 | 1358 |
]. |
4643 | 1359 |
] ensure:[ |
1360 |
inFlush := false. |
|
1361 |
] |
|
1362 |
]. |
|
4657 | 1363 |
"/ flushPending ifTrue:[ |
1364 |
"/ flushPending := false. |
|
1365 |
"/ self installDelayedUpdate |
|
1366 |
"/ ] |
|
4643 | 1367 |
]. |
1368 |
||
1369 |
"Modified: / 9.11.1998 / 21:17:56 / cg" |
|
1370 |
! |
|
1371 |
||
3774 | 1372 |
flash |
1373 |
"make sure everything is visible, before flashing" |
|
1374 |
||
1375 |
self endEntry. |
|
1376 |
super flash. |
|
5408 | 1377 |
! |
1378 |
||
1379 |
flash:message withColor:flashColor |
|
1380 |
"make sure everything is visible, before flashing" |
|
1381 |
||
1382 |
self endEntry. |
|
1383 |
super flash:message withColor:flashColor. |
|
0 | 1384 |
! ! |
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1385 |
|
928 | 1386 |
!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
|
1387 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1388 |
version |
5408 | 1389 |
^ '$Header$' |
3958 | 1390 |
! |
1391 |
||
1392 |
version_CVS |
|
5408 | 1393 |
^ '$Header$' |
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
1394 |
! ! |
2632 | 1395 |
|
4503 | 1396 |
|
2025
0c9729befabc
allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents:
2024
diff
changeset
|
1397 |
TextCollector initialize! |