|
Class: TextCollector
Object
|
+--GraphicsMedium
|
+--DisplaySurface
|
+--SimpleView
|
+--View
|
+--ListView
|
+--TextView
|
+--EditTextView
|
+--TextCollector
|
+--TerminalView
|
+--Workspace
- Package:
- stx:libwidg
- Category:
- Views-Text
- Version:
- rev:
1.212
date: 2024/03/27 16:55:01
- user: alkurz
- file: TextCollector.st directory: libwidg
- module: stx stc-classLibrary: libwidg
a view for editable text, which also understands some stream messages.
Instances of this view can take the place of a stream and display the
received text.
Its main use in the system is the Transcript, but it can also be used for
things like trace-windows, errorLogs etc.
(i.e. any view into which text is generated by stream-like messages)
It is also inherited by TerminalView, which especially uses the buffering and
delayed output features for higher performance output (compare to a Windows console).
If collecting is turned on, a textcollector will not immediately display
entered text, but wait for some short time (timeDelay) and collect incoming
data - finally updating the whole chunk in one piece.
This helps slow display devices, which would otherwise scroll a lot.
(on fast displays this is less of a problem).
The total number of lines kept is controlled by lineLimit, if more lines
than this limit are added at the bottom, the textcollector will forget lines
at the top. You can set linelimit to nil (i.e. no limit), but you may need a lot
of memory then ...
You can force the buffered text to be flushed with #endEndtry.
[StyleSheet paramters (transcript only):]
transcriptForegroundColor defaults to textForegroundColor
transcriptBackgroundColor' defaults to textBackgroundColor.
transcriptCursorForegroundColor
transcriptCursorBackgroundColor
copyrightCOPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
Signal constants
-
transcriptQuerySignal
-
class access
-
transcriptFilterQuery
-
TextCollector transcriptFilterQuery
answer:[:lineIn |
'xxx ',lineIn
]
do:[
Transcript showCR:('hello world' withColor:Color red).
Transcript showCR:('a' withColor:Color blue).
Transcript showCR:'b'.
Transcript showCR:'c'.
].
[
Transcript showCR:'hello world'.
Transcript showCR:'a'.
Transcript showCR:'b'.
Transcript showCR:'c'.
] on:TextCollector transcriptFilterQuery
do:[:ex |
ex proceedWith:[:lineIn | 'xxx',lineIn ]
].
]
TextCollector transcriptFilterQuery query
debugging
-
debugSendersOfMessagePattern
-
-
debugSendersOfMessagePattern: aGLOBMatchPattern
-
ever want to know, who sends a particular text-message to the transcript ?
Call this with a match string and get a halt, when a matching text is sent to the transcript
Usage example(s):
self debugSendersOfMessagePattern:'no such*'
self debugSendersOfMessagePattern:'remove*'
self debugSendersOfMessagePattern:nil.
self debugSendersOfMessagePattern:'*'.
|
-
timestampMessages
-
if true, all messages are shown with a timestamp in front
-
timestampMessages: aBoolean
-
if true, all messages are shown with a timestamp in front
Usage example(s):
self timestampMessages:true
self timestampMessages:false.
|
-
traceSendersOfMessagePattern
-
-
traceSendersOfMessagePattern: aGLOBMatchPattern
-
ever want to know, who sends a particular text-message to the transcript ?
Call this with a match string and get a trace, when a matching text is sent to the transcript
Usage example(s):
self traceSendersOfMessagePattern:'removed unreached*'
self traceSendersOfMessagePattern:nil.
self traceSendersOfMessagePattern:'*'.
|
defaults
-
defaultCollectSize
-
the number of lines buffered for delayed update.
At most this number of lines to be shown are buffered (without redrawing),
before a redraw is done. Thus, if a lot of output is generated fast,
the redrawing is performed in chunks.
This has a significant effect on the performane,
as the view does not have to scroll and redraw for each
individual line, but does junp-scrolling instead.
See also defaultTimeDelay
-
defaultCollectSize: numberOfLines
-
the number of lines buffered for delayed update.
At most this number of lines to be shown are buffered (without redrawing),
before a redraw is done. Thus, if a lot of output is generated fast,
the redrawing is performed in chunks.
This has a significant effect on the performane,
as the view does not have to scroll and redraw for each
individual line, but does junp-scrolling instead.
See also defaultTimeDelay
-
defaultLineLimit
-
the number of lines remembered by default.
Only the last n lines are remembered and can be seen by scrolling.
Older lines are forgotten.
This limit can be changed by the userPreferences dialog
-
defaultLineLimit: numberOfLines
-
the number of lines remembered by default.
Only the last n lines are remembered and can be seen by scrolling.
Older lines are forgotten.
This limit can be changed by the userPreferences dialog
-
defaultTimeDelay
-
the time in seconds to wait & collect by default.
At most this number of seconds incoming text is buffered (without redrawing),
before a redraw is done. Thus, if a lot of output is generated fast,
the redrawing is performed in chunks.
This has a significant effect on the performane,
as the view does not have to scroll and redraw for each
individual line, but does junp-scrolling instead.
The value may be a float (eg. 0.5)
See also defaultCollectSize
-
defaultTimeDelay: seconds
-
the time in seconds to wait & collect by default.
At most this number of seconds incoming text is buffered (without redrawing),
before a redraw is done. Thus, if a lot of output is generated fast,
the redrawing is performed in chunks.
This has a significant effect on the performane,
as the view does not have to scroll and redraw for each
individual line, but does junp-scrolling instead.
The argument may be a float (eg. 0.5)
See also defaultCollectSize
-
defaultTranscriptSize
-
the number of cols/lines by which the Transcript should come up
instance creation
-
initialize
-
(comment from inherited method)
to get language changes
-
newTranscript
-
create and open a new transcript.
This is a leftOver method from times were the Launcher & Transcript
were two different views. It is no longer recommended.
Usage example(s):
TextCollector newTranscript.
Transcript lineLimit:3000.
|
-
newTranscript: nameSymbol
-
create and open a new transcript, unless one already exists by that name.
The transcript is remembered in a global by that name.
This is a leftOver method from times were the Launcher & Transcript
were two different views. It is no longer recommended.
Usage example(s):
TextCollector newTranscript:#T2.
T2 showCR:'Hello world'.
Smalltalk removeKey:#T2
|
Compatibility-ST80
-
deselect
-
(comment from inherited method)
remove the selection
accessing
-
autoRaise
-
-
autoRaise: something
-
-
collect: aBoolean
-
turn on/off collecting - if on, do not output immediately
but collect text and output en-bloque after some time delta
-
collectSize: numberOfLines
-
set the collect buffer size. If collect is enabled,
the receiver will force update of the view,
whenever that many lines have been collected
(or the updateTimeDelay interval has passed).
With collect turned off, an immediate update is performed.
-
destroyAction: aBlock
-
define the action to be performed when I get destroyed.
This is a special feature, to allow resetting Transcript to Stderr
when closed. (see TextCollectorclass>>newTranscript)
-
entryStream
-
returns something which is a stream, sending its input to me.
Typically, this will be an ActorStream
-
entryStream: aStream
-
changes the entryStream.
This is the stream which gets all of my lines via nextPut/nextPutLine/nextPutAll.
Can be changed to (temporarily) divert the output to some file
and/or to duplicate (send to multiple destinations) via a splitter or filterStream.
(see example in SplittingWriteStream)
-
lineLimit
-
return the number of text-lines I am supposed to hold when collecting.
Nil means: unlimited
Usage example(s):
Transcript lineLimit:5000
Transcript lineLimit
|
-
lineLimit: aNumber
-
define the number of text-lines I am supposed to hold
Usage example(s):
Transcript lineLimit:5000
|
-
updateTimeDelay: seconds
-
if collect is enabled, the receiver will update its view,
after that time delay (i.e. it collects output during that period),
or when collectSize lines have been collected without update.
With collect turned off, an immediate update is performed.
initialization & release
-
destroy
-
destroy this view
-
initialize
-
we always use unicode internally
-
mapped
-
view became visible - show collected lines (if any)
-
reinitialize
-
reinit after a snapIn.
recreate access-semaphore; image could have been save (theoretically)
with the semaphore locked - in this case, we had a deadlock
-
release
-
menu - actions
-
doSetLineLimit
-
ask for a new line limit (= number of buffered & remembered lines)
-
isDivertingOutput
-
is the output currently being diverted to a file?
-
startDivertingOutput
-
ask for a filename to divert (i.e. send) the output to
-
startDivertingOutputTo: aFilename
-
divert (i.e. send) the output to the given logFile
-
stopDivertingOutput
-
no longer send the output to the logFile (see startDivertingOutput)
printing
-
classDisplayString
-
(comment from inherited method)
used by walkbacks and inspectors;
same as self class displayString for smalltalk objects;
redefinable for proxy objects to not display the className of the proxy,
but the classname of the remote object (-> JavaObject)
private
-
checkLineLimit
-
this method checks if the text has become too large (> lineLimit)
and cuts off some lines at the top if so; it must be called whenever lines
have been added to the bottom
-
installDelayedUpdate
-
arrange for collecting input for some time,
and output all buffered strings at once after a while.
This makes output to the transcript much faster on systems
with poor scrolling performance (i.e. dumb vga cards ...).
-
senderTraceString
-
generate a sender trace string.
queries
-
canDivertOutput
-
-
current
-
return the current (your screen's) transcript.
In multiDisplay applications, this need NOT be the main transcript,
as each display may have its own transcript.
But typically, this is the same as Transcript.
Usage example(s):
-
isStream
-
if I am the Transcript, I am used as a stream.
See #displayOn:
Usage example(s):
-
isTextCollector
-
true, iff this is a text collector emulating a stream
Usage example(s):
Transcript isTextCollector
|
-
position
-
for compatibiliy with normal streams; return the column
-
showLineLimitInMenu
-
scrolling
-
makeCursorVisible
-
must check again because of possible raise
-
scrollLock: aBoolean
-
-
scrollTo: anOrigin redraw: doRedraw
-
(comment from inherited method)
change origin to have newOrigin be visible at the top-left.
The argument defines the integer device coordinates of the new top-left
point.
stream messages
-
addLine: lineIn
-
append a line to the outstanding lines buffer
-
binary: beBinaryBool
-
ExternalStream protocol compatibility
-
bufferSizeForBulkCopy
-
-
buffered: aBoolean
-
ignored here
-
cr
-
output a carriage return, finishing the current line
Usage example(s):
self ~~ Transcript ifTrue:['xc' printCR].
|
-
display: someObject
-
dolphin compatibility.
and also sent by displayOn:
-
doesNotUnderstand: aMessage
-
this is funny: all message we do not understand, are passed
on to the stream which will send the characters via nextPut:
This way, we understand all Stream messages - great isn't it!
Usage example(s):
^ super doesNotUnderstand:aMessage
|
-
encoding
-
-
ensureCr
-
if the output position is not already at the beginning of a line,
output a carriage return
-
flush
-
write out all buffered data
-
format: formatSpec with: args
-
convenient formatted printing:
%1..%9 - positional parameters from args-collection
%(name) - named parameter from args-dictionary
%% - escape for %
%<cr> - cr (also tab, nl)
Usage example(s):
1 to: 10 do:[:i |
Transcript
format:'[%1] Hello %2 World - this is %3%'
with:{i . 'my' . 'nice'}
].
|
-
lineLength
-
to make a textCollector (somewhat) compatible with printer
streams, support the lineLength query
-
nextPut: something
-
append somethings printString to my displayed text.
Answer something.
This allows TextCollectors to be used Stream-wise
-
nextPutAll: something
-
append all of something to my displayed text.
This allows TextCollectors to be used Stream-wise
-
nextPutAll: count from: buffer startingAt: initialPosition
-
append count characters from buffer starting at initialPosition to my displayed text.
Answer the number of elements that were appended.
This allows TextCollectors to be used Stream-wise
-
printf: formatSpec
-
convenient C-style formatted printing.
For smalltalk specific formats,
see documentation in PrintfScanf >> format_printf
Usage example(s):
1 to: 10 do:[:i |
Transcript printf:'Hello World\n'
].
|
-
printf: formatSpec arguments: args
-
convenient C-style formatted printing with an arbitrary number of arguments.
Same as printf:withAll:, for protocol completeness.
For smalltalk specific formats,
see documentation in PrintfScanf >> format_printf
Usage example(s):
1 to: 10 do:[:i |
Transcript
printf:'[%d] Hello %s World - this is %s\n'
with:{i . 'my' . 'nice'}
].
|
-
printf: formatSpec with: arg1
-
convenient C-style formatted printing with 1 argument.
For smalltalk specific formats,
see documentation in PrintfScanf >> format_printf
Usage example(s):
1 to: 10 do:[:i |
Transcript printf:'[%d] Hello World\n' with:i
].
|
-
printf: formatSpec with: arg1 with: arg2
-
convenient C-style formatted printing with 2 arguments.
For smalltalk specific formats,
see documentation in PrintfScanf >> format_printf
Usage example(s):
1 to: 10 do:[:i |
Transcript
printf:'[%d] Hello World\n' with:i
].
|
-
printf: formatSpec with: arg1 with: arg2 with: arg3
-
convenient C-style formatted printing with 3 arguments.
For smalltalk specific formats,
see documentation in PrintfScanf >> format_printf
Usage example(s):
1 to: 10 do:[:i |
Transcript
printf:'[%d] Hello World\n' with:i
].
|
-
printf: formatSpec with: arg1 with: arg2 with: arg3 with: arg4
-
convenient C-style formatted printing.
For smalltalk specific formats,
see documentation in PrintfScanf >> format_printf
Usage example(s):
1 to: 10 do:[:i |
Transcript
printf:'[%d] Hello World\n' with:i
].
|
-
printf: formatSpec with: arg1 with: arg2 with: arg3 with: arg4 with: arg5
-
convenient C-style formatted printing.
For smalltalk specific formats,
see documentation in PrintfScanf >> format_printf
Usage example(s):
1 to: 10 do:[:i |
Transcript
printf:'[%d] Hello World\n' with:i
].
|
-
printf: formatSpec withAll: args
-
convenient C-style formatted printing with an arbitrary number of arguments.
For smalltalk specific formats,
see documentation in PrintfScanf >> format_printf
Usage example(s):
1 to: 10 do:[:i |
Transcript
printf:'[%d] Hello %s World - this is %s\n'
with:{i . 'my' . 'nice'}
].
|
-
println
-
for those used to Java/Javascript, a compatibility message.
Most useful inside expecco
-
println: anObject
-
for those used to Java/Javascript, a compatibility message.
Most useful inside expecco
-
show: anObject
-
insert the argument aString at the current cursor position.
Ignores the currentEmphasis setting.
-
showCR: anObject
-
insert the argument aString at the current cursor position,
and advance to the next line.
This is the same as a #show: followed by a #cr.
Ignores the currentEmphasis setting.
-
space
-
-
tab
-
append a tab-character to the stream.
This is only allowed, if the receiver supports writing.
stream messages-emphasis
-
bgColor: aColorOrNil
-
followup characters sent with stream messages (nextPut/nextPutAll)
will be rendered with background color in aColorOrNil.
Does not affect show/showCR
-
bold
-
switch to bold
followup characters sent with stream messages (nextPut/nextPutAll)
will be rendered in a bold font.
Does not affect show/showCR
Usage example(s):
Transcript
nextPutAll:'hello';
bold;
nextPutAll:' world';
notBold;
nextPutLine:' again'
|
-
color: aColorOrNil
-
switch color
followup characters sent with stream messages (nextPut/nextPutAll)
will be rendered in aColorOrNil.
Does not affect show/showCR
Usage example(s):
Transcript
nextPutAll:'hello';
color:Color red;
nextPutAll:' world';
color:nil;
nextPutLine:' again'
|
-
emphasis: anEmphasisCollectionOrNil
-
change emphasis
followup characters sent with stream messages (nextPut/nextPutAll)
will be rendered with anEmphasisCollectionOrNil.
Does not affect show/showCR
Usage example(s):
Transcript
nextPutAll:'hello ';
emphasis:#( bold underline );
nextPutAll:'world';
emphasis:nil;
nextPutLine:' again'
|
-
italic
-
switch to italic
followup characters sent with stream messages (nextPut/nextPutAll)
will be rendered in an italic font.
Does not affect show/showCR
-
normal
-
switch back to normal
followup characters sent with stream messages (nextPut/nextPutAll)
will be rendered in the default font without color
-
notBold
-
switch to non-bold
followup characters sent with stream messages (nextPut/nextPutAll)
will be rendered in a non-bold font.
Does not affect show/showCR
-
notItalic
-
switch to non-italic
followup characters sent with stream messages (nextPut/nextPutAll)
will be rendered in a non-italic font.
Does not affect show/showCR
-
notReverse
-
switch back default colors
-
notUnderline
-
switch to non-underline
followup characters sent with stream messages (nextPut/nextPutAll)
will be rendered without underline.
Does not affect show/showCR
-
reverse
-
switch to reverse
followup characters sent with stream messages (nextPut/nextPutAll)
will be rendered with reversed colors.
Does not affect show/showCR
-
underline
-
switch to underline
followup characters sent with stream messages (nextPut/nextPutAll)
will be rendered with underline.
Does not affect show/showCR
transcript specials
-
assertEndEntry
-
assert there is no pending collected output
-
beTranscript
-
make the receiver be the systemTranscript; this one
is accessible via the global Transcript and gets relevant
system messages from various places.
-
beTranscript: name
-
make the receiver be the systemTranscript; this one
is accessible via the global Transcript and gets relevant
system messages from various places.
-
beginEntry
-
noop for now, ST80 compatibility
-
clear
-
Transcript clear
-
delayedEndEntry
-
flush collected output; displaying all that has been buffered so far
-
endEntry
-
flush collected output; displaying all that has been buffered so far
-
flash
-
make sure everything is visible, before flashing
-
flash: messageOrNil withColor: flashColor
-
make sure everything is visible, before flashing
TranscriptFilterQuery
|