"
COPYRIGHT (c) 1990-92 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.
"
PipeStream subclass:#PrinterStream
instanceVariableNames:''
classVariableNames:'printCommand leftMargin'
poolDictionaries:''
category:'Streams-External'
!
PrinterStream comment:'
COPYRIGHT (c) 1990-92 by Claus Gittinger
All Rights Reserved
a stream for printing; this (abstract) class can handle only
very dumb printers
$Header: /cvs/stx/stx/libbasic2/PrinterStream.st,v 1.3 1993-10-13 00:17:02 claus Exp $
'!
!PrinterStream class methodsFor:'initialization'!
initialize
"this is usually redefined by the startup-file"
printCommand isNil ifTrue:[
OperatingSystem isBSDlike ifTrue:[
printCommand := 'lpr'
] ifFalse:[
printCommand := 'lp'
]
].
leftMargin isNil ifTrue:[
leftMargin := 0
]
! !
!PrinterStream class methodsFor:'accessing'!
leftMargin:aNumber
"set the number of blanks for the left margin"
leftMargin := aNumber
!
printCommand:aString
"set the command for printing (usually lp or lpr)"
printCommand := aString
!
printCommand
"return the command for printing (usually lp or lpr)"
^ printCommand
! !
!PrinterStream class methodsFor:'instance creation'!
new
"return a new stream for printing"
^ self basicNew startPrint
! !
!PrinterStream methodsFor:'open/close'!
startPrint
super writingTo:printCommand.
self spaces:leftMargin
!
endPrint
^ self
!
close
self endPrint.
super close
! !
!PrinterStream methodsFor:'access writing'!
nextPutUntranslated:aCharacter
super nextPut:aCharacter
!
nextPutAllUntranslated:aCollection
super nextPutAll:aCollection
!
nextPutAll:aCollection
aCollection do:[:aChar |
self nextPut:aChar
]
!
nextPut:aCharacter
(aCharacter == Character cr) ifTrue:[
super nextPut:(Character cr).
self spaces:leftMargin
] ifFalse:[
super nextPut:aCharacter
]
!
cr
super nextPut:(Character cr).
self spaces:leftMargin
!
spaces:aNumber
aNumber timesRepeat:[
super nextPut:(Character space)
]
!
lineLength
^ 80
!
courier
^ self
!
times
^ self
!
helvetica
^ self
!
italic
^ self
!
bold
^ self
!
normal
^ self
! !