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