author | Claus Gittinger <cg@exept.de> |
Fri, 24 Apr 1998 20:46:15 +0200 | |
changeset 1504 | 3101f410e230 |
parent 1500 | dee7275372f1 |
child 1562 | 9b7557a81849 |
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 |
" |
|
12 |
||
13 |
EditTextView subclass:#TextCollector |
|
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
14 |
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
|
15 |
outstandingLine flushBlock flushPending inFlush collecting |
1504
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
16 |
timeDelay access currentEmphasis' |
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
17 |
classVariableNames:'' |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
18 |
poolDictionaries:'' |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
19 |
category:'Views-Text' |
0 | 20 |
! |
21 |
||
928 | 22 |
!TextCollector class methodsFor:'documentation'! |
15 | 23 |
|
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
24 |
copyright |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
25 |
" |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
26 |
COPYRIGHT (c) 1989 by Claus Gittinger |
59 | 27 |
All Rights Reserved |
34
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 |
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
|
30 |
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
|
31 |
inclusion of the above copyright notice. This software may not |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
32 |
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
|
33 |
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
|
34 |
hereby transferred. |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
35 |
" |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
36 |
! |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
37 |
|
15 | 38 |
documentation |
39 |
" |
|
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
40 |
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
|
41 |
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
|
42 |
received text. |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
43 |
Its main use in the system is the Transcript, but it can also be used for |
110 | 44 |
things like trace-windows, errorLogs etc. |
0 | 45 |
|
60 | 46 |
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
|
47 |
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
|
48 |
data - finally updating the whole chunk in one piece. |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
49 |
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
|
50 |
(on fast displays this is less of a problem). |
15 | 51 |
|
60 | 52 |
The total number of lines kept is controlled by lineLimit, if more lines |
53 |
than this limit are added at the bottom, the textcollector will forget lines |
|
54 |
at the top. |
|
55 |
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
|
56 |
of memory then ... |
77 | 57 |
|
586 | 58 |
[StyleSheet paramters (transcript only):] |
59 |
||
60 |
transcriptForegroundColor defaults to textForegroundColor |
|
61 |
transcriptBackgroundColor' defaults to textBackgroundColor. |
|
77 | 62 |
|
586 | 63 |
transcriptCursorForegroundColor |
64 |
transcriptCursorBackgroundColor |
|
77 | 65 |
|
586 | 66 |
[author:] |
67 |
Claus Gittinger |
|
68 |
||
69 |
[see also:] |
|
70 |
CodeView EditTextView |
|
71 |
ActorStream |
|
15 | 72 |
" |
73 |
! ! |
|
0 | 74 |
|
928 | 75 |
!TextCollector class methodsFor:'instance creation'! |
0 | 76 |
|
77 |
newTranscript |
|
778
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
78 |
"create and open a new transcript. |
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
79 |
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
|
80 |
were two different views. It is no longer recommended." |
110 | 81 |
|
130 | 82 |
|topView transcript f v lines cols| |
0 | 83 |
|
7 | 84 |
topView := StandardSystemView label:'Transcript' minExtent:(100 @ 100). |
0 | 85 |
|
60 | 86 |
v := HVScrollableView for:self miniScrollerH:true miniScrollerV:false in:topView. |
0 | 87 |
v origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
88 |
transcript := v scrolledView. |
|
89 |
"transcript partialLines:false." |
|
90 |
||
91 |
f := transcript font. |
|
60 | 92 |
|
93 |
" |
|
94 |
should add the height of the frame & scrollbars to be exact ... |
|
95 |
" |
|
96 |
cols := self defaultTranscriptSize x. |
|
97 |
lines := self defaultTranscriptSize y. |
|
98 |
topView extent:(((f widthOf:'x') * cols) @ (f height * lines)). |
|
0 | 99 |
|
110 | 100 |
transcript beTranscript. |
59 | 101 |
|
80 | 102 |
" |
103 |
run it at a slightly higher prio, to allow for |
|
104 |
delayed buffered updates to be performed |
|
105 |
" |
|
106 |
topView openWithPriority:(Processor userSchedulingPriority + 1). |
|
15 | 107 |
|
0 | 108 |
^ transcript |
110 | 109 |
|
110 |
" |
|
1026 | 111 |
TextCollector newTranscript. |
112 |
Transcript lineLimit:3000. |
|
110 | 113 |
" |
778
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
114 |
|
1026 | 115 |
"Modified: 17.2.1997 / 18:20:27 / cg" |
0 | 116 |
! ! |
117 |
||
928 | 118 |
!TextCollector class methodsFor:'defaults'! |
0 | 119 |
|
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
120 |
defaultLineLimit |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
121 |
"the number of lines remembered by default" |
59 | 122 |
|
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
123 |
^ 600 |
59 | 124 |
! |
125 |
||
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
126 |
defaultTimeDelay |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
127 |
"the time in seconds to wait & collect by default" |
36 | 128 |
|
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
129 |
^ 0.3 |
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
130 |
! |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
131 |
|
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
132 |
defaultTranscriptSize |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
133 |
"the number of cols/lines by which the Transcript should come up" |
110 | 134 |
|
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
135 |
^ 70@11 |
110 | 136 |
! ! |
137 |
||
1500 | 138 |
!TextCollector methodsFor:'ST-80 compatibility'! |
139 |
||
140 |
deselect |
|
141 |
self unselect |
|
1504
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
142 |
! |
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
143 |
|
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
144 |
flush |
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
145 |
self endEntry. |
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
146 |
super flush |
1500 | 147 |
! ! |
148 |
||
0 | 149 |
!TextCollector methodsFor:'accessing'! |
150 |
||
1467
5c09bb2dadef
Add (dummy fore now) #beginEntry for ST80 compat.
Stefan Vogel <sv@exept.de>
parents:
1421
diff
changeset
|
151 |
beginEntry |
5c09bb2dadef
Add (dummy fore now) #beginEntry for ST80 compat.
Stefan Vogel <sv@exept.de>
parents:
1421
diff
changeset
|
152 |
"noop for now, ST80 compatibility" |
5c09bb2dadef
Add (dummy fore now) #beginEntry for ST80 compat.
Stefan Vogel <sv@exept.de>
parents:
1421
diff
changeset
|
153 |
|
5c09bb2dadef
Add (dummy fore now) #beginEntry for ST80 compat.
Stefan Vogel <sv@exept.de>
parents:
1421
diff
changeset
|
154 |
^ self |
5c09bb2dadef
Add (dummy fore now) #beginEntry for ST80 compat.
Stefan Vogel <sv@exept.de>
parents:
1421
diff
changeset
|
155 |
|
5c09bb2dadef
Add (dummy fore now) #beginEntry for ST80 compat.
Stefan Vogel <sv@exept.de>
parents:
1421
diff
changeset
|
156 |
"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
|
157 |
! |
5c09bb2dadef
Add (dummy fore now) #beginEntry for ST80 compat.
Stefan Vogel <sv@exept.de>
parents:
1421
diff
changeset
|
158 |
|
0 | 159 |
collect:aBoolean |
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
160 |
"turn on/off collecting - if on, do not output immediately |
15 | 161 |
but collect text and output en-bloque after some time delta" |
0 | 162 |
|
163 |
collecting := aBoolean |
|
164 |
! |
|
165 |
||
166 |
destroyAction:aBlock |
|
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
167 |
"define the action to be performed when I get destroyed. |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
168 |
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
|
169 |
when closed. (see TextCollectorclass>>newTranscript)" |
0 | 170 |
|
171 |
destroyAction := aBlock |
|
172 |
! |
|
173 |
||
174 |
endEntry |
|
928 | 175 |
"flush collected output; displaying all that has been buffered so far" |
0 | 176 |
|
36 | 177 |
|nLines lines| |
0 | 178 |
|
133 | 179 |
shown ifFalse:[ |
653 | 180 |
flushPending ifFalse:[ |
181 |
self installDelayedUpdate. |
|
182 |
]. |
|
183 |
^ self |
|
133 | 184 |
]. |
119 | 185 |
inFlush ifTrue:[^ self]. |
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
186 |
|
15 | 187 |
Processor removeTimedBlock:flushBlock. |
59 | 188 |
flushPending ifFalse:[^ self]. |
15 | 189 |
|
52 | 190 |
access critical:[ |
653 | 191 |
inFlush := true. |
1491
0445841f7852
care for unwind (clear inFlush flag)
Claus Gittinger <cg@exept.de>
parents:
1489
diff
changeset
|
192 |
[ |
0445841f7852
care for unwind (clear inFlush flag)
Claus Gittinger <cg@exept.de>
parents:
1489
diff
changeset
|
193 |
flushPending := false. |
0445841f7852
care for unwind (clear inFlush flag)
Claus Gittinger <cg@exept.de>
parents:
1489
diff
changeset
|
194 |
outstandingLines size ~~ 0 ifTrue:[ |
0445841f7852
care for unwind (clear inFlush flag)
Claus Gittinger <cg@exept.de>
parents:
1489
diff
changeset
|
195 |
"insert the bunch of lines - if any" |
0445841f7852
care for unwind (clear inFlush flag)
Claus Gittinger <cg@exept.de>
parents:
1489
diff
changeset
|
196 |
lines := outstandingLines. |
0445841f7852
care for unwind (clear inFlush flag)
Claus Gittinger <cg@exept.de>
parents:
1489
diff
changeset
|
197 |
outstandingLines := nil. |
36 | 198 |
|
1491
0445841f7852
care for unwind (clear inFlush flag)
Claus Gittinger <cg@exept.de>
parents:
1489
diff
changeset
|
199 |
nLines := lines size. |
0445841f7852
care for unwind (clear inFlush flag)
Claus Gittinger <cg@exept.de>
parents:
1489
diff
changeset
|
200 |
(nLines ~~ 0) ifTrue:[ |
0445841f7852
care for unwind (clear inFlush flag)
Claus Gittinger <cg@exept.de>
parents:
1489
diff
changeset
|
201 |
self insertLines:lines withCR:true. |
0445841f7852
care for unwind (clear inFlush flag)
Claus Gittinger <cg@exept.de>
parents:
1489
diff
changeset
|
202 |
self cursorToEnd. |
0445841f7852
care for unwind (clear inFlush flag)
Claus Gittinger <cg@exept.de>
parents:
1489
diff
changeset
|
203 |
self withCursorOffDo:[ |
0445841f7852
care for unwind (clear inFlush flag)
Claus Gittinger <cg@exept.de>
parents:
1489
diff
changeset
|
204 |
(cursorLine >= (firstLineShown + nFullLinesShown)) ifTrue:[ |
0445841f7852
care for unwind (clear inFlush flag)
Claus Gittinger <cg@exept.de>
parents:
1489
diff
changeset
|
205 |
self scrollDown:nLines |
0445841f7852
care for unwind (clear inFlush flag)
Claus Gittinger <cg@exept.de>
parents:
1489
diff
changeset
|
206 |
] |
0445841f7852
care for unwind (clear inFlush flag)
Claus Gittinger <cg@exept.de>
parents:
1489
diff
changeset
|
207 |
]. |
653 | 208 |
]. |
209 |
]. |
|
928 | 210 |
|
1491
0445841f7852
care for unwind (clear inFlush flag)
Claus Gittinger <cg@exept.de>
parents:
1489
diff
changeset
|
211 |
"and the last partial line - if any" |
0445841f7852
care for unwind (clear inFlush flag)
Claus Gittinger <cg@exept.de>
parents:
1489
diff
changeset
|
212 |
outstandingLine size > 0 ifTrue:[ |
0445841f7852
care for unwind (clear inFlush flag)
Claus Gittinger <cg@exept.de>
parents:
1489
diff
changeset
|
213 |
self insertStringAtCursor:outstandingLine. |
0445841f7852
care for unwind (clear inFlush flag)
Claus Gittinger <cg@exept.de>
parents:
1489
diff
changeset
|
214 |
outstandingLine := ''. |
0445841f7852
care for unwind (clear inFlush flag)
Claus Gittinger <cg@exept.de>
parents:
1489
diff
changeset
|
215 |
]. |
0445841f7852
care for unwind (clear inFlush flag)
Claus Gittinger <cg@exept.de>
parents:
1489
diff
changeset
|
216 |
self checkLineLimit. |
0445841f7852
care for unwind (clear inFlush flag)
Claus Gittinger <cg@exept.de>
parents:
1489
diff
changeset
|
217 |
device flush. |
0445841f7852
care for unwind (clear inFlush flag)
Claus Gittinger <cg@exept.de>
parents:
1489
diff
changeset
|
218 |
] valueNowOrOnUnwindDo:[ |
0445841f7852
care for unwind (clear inFlush flag)
Claus Gittinger <cg@exept.de>
parents:
1489
diff
changeset
|
219 |
inFlush := false. |
0445841f7852
care for unwind (clear inFlush flag)
Claus Gittinger <cg@exept.de>
parents:
1489
diff
changeset
|
220 |
] |
119 | 221 |
]. |
222 |
flushPending ifTrue:[ |
|
653 | 223 |
flushPending := false. |
224 |
self installDelayedUpdate |
|
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
225 |
] |
653 | 226 |
|
1491
0445841f7852
care for unwind (clear inFlush flag)
Claus Gittinger <cg@exept.de>
parents:
1489
diff
changeset
|
227 |
"Modified: / 7.4.1998 / 09:45:32 / cg" |
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
228 |
! |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
229 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
230 |
lineLimit:aNumber |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
231 |
"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
|
232 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
233 |
lineLimit := aNumber |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
234 |
! ! |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
235 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
236 |
!TextCollector methodsFor:'change & update'! |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
237 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
238 |
getListFromModel |
928 | 239 |
"a textCollector always scrolls to the bottom" |
240 |
||
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
241 |
super getListFromModel. |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
242 |
self scrollToBottom |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
243 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
244 |
"Created: 12.2.1996 / 14:27:56 / stefan" |
928 | 245 |
"Modified: 11.1.1997 / 14:41:50 / cg" |
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
246 |
! ! |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
247 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
248 |
!TextCollector methodsFor:'events'! |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
249 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
250 |
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
|
251 |
"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
|
252 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
253 |
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
|
254 |
self endEntry |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
255 |
! ! |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
256 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
257 |
!TextCollector methodsFor:'initialize / release'! |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
258 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
259 |
destroy |
928 | 260 |
"destroy this view" |
261 |
||
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
262 |
destroyAction notNil ifTrue:[ |
928 | 263 |
destroyAction value |
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
264 |
]. |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
265 |
Processor removeTimedBlock:flushBlock. |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
266 |
flushBlock := nil. |
928 | 267 |
outstandingLines := nil. |
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
268 |
outstandingLine := ''. |
928 | 269 |
|
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
270 |
super destroy |
928 | 271 |
|
272 |
"Modified: 11.1.1997 / 14:40:30 / cg" |
|
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
273 |
! |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
274 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
275 |
editMenu |
928 | 276 |
"return my popUpMenu; thats the superClasses menu, |
277 |
minus any accept item." |
|
278 |
||
1262
d69149b5be1f
resource flag: #menu -> #programMenu
Claus Gittinger <cg@exept.de>
parents:
1221
diff
changeset
|
279 |
<resource: #programMenu> |
1109 | 280 |
|
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
281 |
|m idx| |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
282 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
283 |
m := super editMenu. |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
284 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
285 |
" |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
286 |
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
|
287 |
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
|
288 |
" |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
289 |
idx := m indexOf:#accept. |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
290 |
idx ~~ 0 ifTrue:[ |
928 | 291 |
m remove:idx. |
292 |
(m labels at:(idx - 1)) = '-' ifTrue:[ |
|
293 |
m remove:idx - 1 |
|
294 |
]. |
|
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
295 |
]. |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
296 |
^ m |
928 | 297 |
|
1262
d69149b5be1f
resource flag: #menu -> #programMenu
Claus Gittinger <cg@exept.de>
parents:
1221
diff
changeset
|
298 |
"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
|
299 |
! |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
300 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
301 |
initialize |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
302 |
super initialize. |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
303 |
|
928 | 304 |
outstandingLines := nil. |
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
305 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
306 |
flushBlock := [self endEntry]. |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
307 |
flushPending := inFlush := false. |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
308 |
collecting := true. |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
309 |
timeDelay := self class defaultTimeDelay. |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
310 |
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
|
311 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
312 |
lineLimit := self class defaultLineLimit. |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
313 |
entryStream := ActorStream new. |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
314 |
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
|
315 |
entryStream nextPutAllBlock:[:something | self nextPutAll:something] |
928 | 316 |
|
317 |
"Modified: 11.1.1997 / 14:35:32 / cg" |
|
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
318 |
! |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
319 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
320 |
mapped |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
321 |
"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
|
322 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
323 |
super mapped. |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
324 |
self endEntry |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
325 |
! |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
326 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
327 |
reinitialize |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
328 |
"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
|
329 |
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
|
330 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
331 |
flushPending := false. |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
332 |
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
|
333 |
super reinitialize. |
1467
5c09bb2dadef
Add (dummy fore now) #beginEntry for ST80 compat.
Stefan Vogel <sv@exept.de>
parents:
1421
diff
changeset
|
334 |
|
5c09bb2dadef
Add (dummy fore now) #beginEntry for ST80 compat.
Stefan Vogel <sv@exept.de>
parents:
1421
diff
changeset
|
335 |
"Modified: / 5.3.1998 / 10:09:14 / stefan" |
0 | 336 |
! ! |
337 |
||
338 |
!TextCollector methodsFor:'private'! |
|
339 |
||
340 |
checkLineLimit |
|
341 |
"this method checks if the text has become too large (> lineLimit) |
|
342 |
and cuts off some lines at the top if so; it must be called whenever lines |
|
343 |
have been added to the bottom" |
|
344 |
||
345 |
|nDel| |
|
346 |
||
347 |
lineLimit notNil ifTrue:[ |
|
59 | 348 |
(cursorLine > lineLimit) ifTrue:[ |
349 |
nDel := list size - lineLimit. |
|
350 |
list removeFromIndex:1 toIndex:nDel. |
|
351 |
cursorLine := cursorLine - nDel. |
|
352 |
firstLineShown := firstLineShown - nDel. |
|
353 |
(firstLineShown < 1) ifTrue:[ |
|
354 |
cursorLine := cursorLine - firstLineShown + 1. |
|
355 |
firstLineShown := 1 |
|
356 |
]. |
|
357 |
self contentsChanged |
|
358 |
] |
|
0 | 359 |
] |
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
360 |
! |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
361 |
|
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
362 |
installDelayedUpdate |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
363 |
"arrange for collecting input for some time, |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
364 |
and output all buffered strings at once after a while. |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
365 |
This makes output to the transcript much faster on systems |
553 | 366 |
with poor scrolling performance (i.e. dumb vga cards ...)." |
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
367 |
|
131 | 368 |
|p| |
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
369 |
|
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
370 |
flushPending ifFalse:[ |
553 | 371 |
flushPending := true. |
372 |
inFlush ifFalse:[ |
|
373 |
" |
|
374 |
we could run under a process, which dies in the meantime; |
|
375 |
therefore, we have to arrange for the transcript process to |
|
376 |
be interrupted and do the update. |
|
377 |
" |
|
378 |
windowGroup isNil ifTrue:[ |
|
379 |
p := Processor activeProcess |
|
380 |
] ifFalse:[ |
|
381 |
p := windowGroup process |
|
382 |
]. |
|
1221
0c2a4231fc9e
Move #isSystemProcess from ProcessorScheduler to Process.
Stefan Vogel <sv@exept.de>
parents:
1109
diff
changeset
|
383 |
(p isNil or:[p isSystemProcess]) ifTrue:[ |
834
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
384 |
self endEntry |
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
385 |
] ifFalse:[ |
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
386 |
Processor addTimedBlock:flushBlock for:p afterSeconds:timeDelay. |
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
387 |
] |
553 | 388 |
] |
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
389 |
] |
553 | 390 |
|
834
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
391 |
"Modified: 17.9.1996 / 00:11:53 / cg" |
1221
0c2a4231fc9e
Move #isSystemProcess from ProcessorScheduler to Process.
Stefan Vogel <sv@exept.de>
parents:
1109
diff
changeset
|
392 |
"Modified: 17.4.1997 / 13:03:15 / stefan" |
0 | 393 |
! ! |
394 |
||
778
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
395 |
!TextCollector methodsFor:'queries'! |
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
396 |
|
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
397 |
current |
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
398 |
"return the current (your screens) transcript. |
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
399 |
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
|
400 |
But typically, this is the same as Transcript." |
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
401 |
|
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
402 |
^ self topView application class current transcript |
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
403 |
|
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
404 |
" |
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
405 |
Transcript current flash |
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
406 |
" |
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
407 |
|
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
408 |
"Created: 5.7.1996 / 14:14:34 / cg" |
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
409 |
"Modified: 5.7.1996 / 14:14:52 / cg" |
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
410 |
! ! |
3a8fabcf1872
added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents:
656
diff
changeset
|
411 |
|
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
412 |
!TextCollector methodsFor:'stream messages'! |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
413 |
|
1504
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
414 |
bold |
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
415 |
currentEmphasis := #bold |
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
416 |
! |
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
417 |
|
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
418 |
cr |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
419 |
"output a carriage return, finishing the current line" |
135 | 420 |
|
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
421 |
access critical:[ |
834
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
422 |
collecting ifTrue:[ |
928 | 423 |
outstandingLine notNil ifTrue:[ "/ mhmh - is never nil |
424 |
outstandingLines isNil ifTrue:[ |
|
425 |
outstandingLines := OrderedCollection with:outstandingLine |
|
426 |
] ifFalse:[ |
|
427 |
outstandingLines add:outstandingLine. |
|
428 |
] |
|
834
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
429 |
]. |
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
430 |
outstandingLine := ''. |
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
431 |
] ifFalse:[ |
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
432 |
self cursorReturn. |
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
433 |
self checkLineLimit. |
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
434 |
self cursorToEnd. |
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
435 |
]. |
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
436 |
]. |
135 | 437 |
|
834
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
438 |
collecting ifTrue:[ |
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
439 |
flushPending ifFalse:[ |
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
440 |
self installDelayedUpdate |
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
441 |
] |
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
442 |
] |
834
0da7c9923d1b
prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents:
778
diff
changeset
|
443 |
|
928 | 444 |
"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
|
445 |
! |
135 | 446 |
|
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
447 |
doesNotUnderstand:aMessage |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
448 |
"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
|
449 |
on to the stream which will send the characters via nextPut: |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
450 |
This way, we understand all Stream messages - great isn't it !! |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
451 |
" |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
452 |
^ entryStream perform:(aMessage selector) withArguments:(aMessage arguments) |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
453 |
! |
0 | 454 |
|
1504
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
455 |
italic |
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
456 |
currentEmphasis := #italic |
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
457 |
! |
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
458 |
|
0 | 459 |
lineLength |
928 | 460 |
"to make a textCollector (somewhat) compatible with printer |
461 |
streams, support the lineLength query" |
|
462 |
||
0 | 463 |
^ width // (font width) |
928 | 464 |
|
465 |
"Modified: 11.1.1997 / 14:42:41 / cg" |
|
0 | 466 |
! |
467 |
||
468 |
nextPut:something |
|
928 | 469 |
"append somethings printString to my displayed text. |
470 |
This allows TextCollectors to be used Stream-wise" |
|
0 | 471 |
|
1504
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
472 |
|txt| |
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
473 |
|
656 | 474 |
(something isCharacter) ifTrue:[ |
475 |
((something == Character cr) or:[something == Character nl]) ifTrue:[ |
|
476 |
^ self cr |
|
477 |
]. |
|
0 | 478 |
]. |
1504
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
479 |
|
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
480 |
txt := something asString. |
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
481 |
currentEmphasis notNil ifTrue:[ |
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
482 |
txt := txt emphasizeAllWith:currentEmphasis |
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
483 |
]. |
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
484 |
self show:txt. |
656 | 485 |
|
486 |
"/ flushPending ifTrue:[ |
|
487 |
"/ self endEntry |
|
488 |
"/ ]. |
|
489 |
"/ (something isMemberOf:Character) ifTrue:[ |
|
490 |
"/ ((something == Character cr) or:[something == Character nl]) ifTrue:[ |
|
491 |
"/ ^ self cr |
|
492 |
"/ ]. |
|
493 |
"/ self insertCharAtCursor:something |
|
494 |
"/ ] ifFalse:[ |
|
495 |
"/ self insertStringAtCursor:(something printString). |
|
496 |
"/ self checkLineLimit |
|
497 |
"/ ]. |
|
498 |
"/ device flush |
|
499 |
||
928 | 500 |
"Modified: 11.1.1997 / 14:43:05 / cg" |
0 | 501 |
! |
502 |
||
503 |
nextPutAll:something |
|
928 | 504 |
"append all of something to my displayed text. |
505 |
This allows TextCollectors to be used Stream-wise" |
|
0 | 506 |
|
1504
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
507 |
currentEmphasis notNil ifTrue:[ |
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
508 |
^ self show:(something emphasizeAllWith:currentEmphasis) |
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
509 |
]. |
656 | 510 |
^ self show:something |
511 |
||
928 | 512 |
"Modified: 11.1.1997 / 14:43:26 / cg" |
0 | 513 |
! |
514 |
||
1504
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
515 |
normal |
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
516 |
currentEmphasis := nil |
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
517 |
! |
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
518 |
|
0 | 519 |
show:anObject |
520 |
"insert the argument aString at current cursor position" |
|
521 |
||
308
b216a5efa2c8
handle show: with a string containing cr's
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
522 |
|aString lines| |
0 | 523 |
|
524 |
aString := anObject printString. |
|
928 | 525 |
|
308
b216a5efa2c8
handle show: with a string containing cr's
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
526 |
(aString includes:(Character cr)) ifTrue:[ |
653 | 527 |
lines := aString asStringCollection. |
528 |
lines keysAndValuesDo:[:nr :line | |
|
529 |
nr == lines size ifTrue:[ |
|
530 |
"/ the last one. |
|
531 |
self show:line |
|
532 |
] ifFalse:[ |
|
533 |
self showCR:line |
|
534 |
]. |
|
535 |
]. |
|
1489
5ee18622ae6a
care for trailing cr in show:-string.
Claus Gittinger <cg@exept.de>
parents:
1467
diff
changeset
|
536 |
(aString endsWith:(Character cr)) ifTrue:[ |
5ee18622ae6a
care for trailing cr in show:-string.
Claus Gittinger <cg@exept.de>
parents:
1467
diff
changeset
|
537 |
self cr. |
5ee18622ae6a
care for trailing cr in show:-string.
Claus Gittinger <cg@exept.de>
parents:
1467
diff
changeset
|
538 |
]. |
653 | 539 |
^ self. |
308
b216a5efa2c8
handle show: with a string containing cr's
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
540 |
]. |
b216a5efa2c8
handle show: with a string containing cr's
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
541 |
|
1026 | 542 |
access critical:[ |
543 |
outstandingLine size > 0 ifTrue:[ |
|
544 |
outstandingLine := outstandingLine , aString |
|
545 |
] ifFalse:[ |
|
546 |
outstandingLine := aString |
|
653 | 547 |
]. |
1026 | 548 |
collecting ifTrue:[ |
549 |
flushPending ifFalse:[ |
|
550 |
self installDelayedUpdate |
|
1312
eaa44f7649f5
flush after some lines have been collected
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
551 |
] ifTrue:[ |
eaa44f7649f5
flush after some lines have been collected
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
552 |
outstandingLines size > 50 ifTrue:[ |
eaa44f7649f5
flush after some lines have been collected
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
553 |
self endEntry |
eaa44f7649f5
flush after some lines have been collected
Claus Gittinger <cg@exept.de>
parents:
1262
diff
changeset
|
554 |
] |
1026 | 555 |
] |
556 |
] ifFalse:[ |
|
557 |
self endEntry |
|
653 | 558 |
] |
1026 | 559 |
]. |
0 | 560 |
|
1489
5ee18622ae6a
care for trailing cr in show:-string.
Claus Gittinger <cg@exept.de>
parents:
1467
diff
changeset
|
561 |
"Modified: / 20.4.1998 / 12:15:43 / cg" |
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
562 |
! ! |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
563 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
564 |
!TextCollector methodsFor:'transcript specials'! |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
565 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
566 |
beTranscript |
928 | 567 |
"make the receiver be the systemTranscript; this one |
568 |
is accessable via the global Transcript and gets relevant |
|
569 |
system messages from various places." |
|
570 |
||
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
571 |
|fg bg cFg cBg| |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
572 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
573 |
Smalltalk at:#Transcript put:self. |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
574 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
575 |
" |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
576 |
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
|
577 |
" |
1421
afef284eadc4
only reset Transcript to stdErr, if I really am the transcript.
ca
parents:
1389
diff
changeset
|
578 |
self destroyAction:[ |
afef284eadc4
only reset Transcript to stdErr, if I really am the transcript.
ca
parents:
1389
diff
changeset
|
579 |
self == (Smalltalk at:#Transcript) ifTrue:[ |
afef284eadc4
only reset Transcript to stdErr, if I really am the transcript.
ca
parents:
1389
diff
changeset
|
580 |
Smalltalk at:#Transcript put:Stderr |
afef284eadc4
only reset Transcript to stdErr, if I really am the transcript.
ca
parents:
1389
diff
changeset
|
581 |
] |
afef284eadc4
only reset Transcript to stdErr, if I really am the transcript.
ca
parents:
1389
diff
changeset
|
582 |
]. |
0 | 583 |
|
928 | 584 |
"/ user may prefer a special color for this one; |
585 |
"/ look into the style definitions ... |
|
586 |
||
1389 | 587 |
fg := styleSheet colorAt:'transcript.foregroundColor' default:self foregroundColor. |
588 |
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
|
589 |
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
|
590 |
self viewBackground:bg. |
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
591 |
|
1389 | 592 |
cFg := styleSheet colorAt:'transcript.cursorForegroundColor' default:bg. |
593 |
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
|
594 |
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
|
595 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
596 |
"self lineLimit:1000. " "or whatever you think makes sense" |
928 | 597 |
|
1389 | 598 |
"Modified: / 2.11.1997 / 22:34:47 / cg" |
0 | 599 |
! ! |
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
600 |
|
928 | 601 |
!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
|
602 |
|
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
603 |
version |
1504
3101f410e230
rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents:
1500
diff
changeset
|
604 |
^ '$Header: /cvs/stx/stx/libwidg/TextCollector.st,v 1.46 1998-04-24 18:46:15 cg Exp $' |
363
d780a45df2d4
MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents:
308
diff
changeset
|
605 |
! ! |