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