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