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