PrinterStream.st
changeset 390 3f22865fa873
parent 386 cebdfb2e9cf0
child 392 bf31405a1f65
--- a/PrinterStream.st	Wed Jun 05 20:37:25 1996 +0200
+++ b/PrinterStream.st	Sat Jun 08 11:10:06 1996 +0200
@@ -11,7 +11,7 @@
 "
 
 PipeStream subclass:#PrinterStream
-	instanceVariableNames:'native pageFormat'
+	instanceVariableNames:'native pageFormat underline strikeout'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'Streams-External'
@@ -73,7 +73,7 @@
 
     To print:
 
-        |p|
+	|p|
 
 	p := Printer new.
 	p notNil ifTrue:[
@@ -103,52 +103,52 @@
     "this is usually redefined by the startup-file"
 
     DefaultCommands isNil ifTrue:[
-        DefaultCommands := #('lpr' 
-                             'lpr -P<your-printer>' 
-                             'cat | rsh <printHost> lpr -h' 
-                             'cat >xxx ; ghostview xxx'
-                             'cat > printfile'
-                             'a2ps'
-                             'a2ps | rsh <printHost> lpr -h' 
-                             'a2ps > printfile' 
-                            ).
+	DefaultCommands := #('lpr' 
+			     'lpr -P<your-printer>' 
+			     'cat | rsh <printHost> lpr -h' 
+			     'cat >xxx ; ghostview xxx'
+			     'cat > printfile'
+			     'a2ps'
+			     'a2ps | rsh <printHost> lpr -h' 
+			     'a2ps > printfile' 
+			    ).
     ].
 
     PrintCommand isNil ifTrue:[
-        OperatingSystem isBSDlike ifTrue:[
-            PrintCommand := 'lpr'
-        ] ifFalse:[
-            PrintCommand := 'lp'
-        ]
+	OperatingSystem isBSDlike ifTrue:[
+	    PrintCommand := 'lpr'
+	] ifFalse:[
+	    PrintCommand := 'lp'
+	]
     ].
     LeftMargin isNil ifTrue:[
-        LeftMargin := 0
+	LeftMargin := 0
     ].
 
     DefaultPageFormats isNil ifTrue:[
     "/ UnitConverter must support all of them.
-        self defaultPageFormats:#(
-                                    'letter'
-                                    'legal'
-                                    'ledger'
-                                    'a3'
-                                    'a4'
-                                    'a5'
-                                    'a6'
-                                    'b5'
-                               ).
+	self defaultPageFormats:#(
+				    'letter'
+				    'legal'
+				    'ledger'
+				    'a3'
+				    'a4'
+				    'a5'
+				    'a6'
+				    'b5'
+			       ).
     ].
 
     Landscape isNil ifTrue:[
-        Landscape := false
+	Landscape := false
     ].
 
     PageFormat isNil ifTrue:[
-        Language == #us ifTrue:[
-            PageFormat := #letter
-        ] ifFalse:[
-            PageFormat := #a4
-        ]
+	Language == #us ifTrue:[
+	    PageFormat := #letter
+	] ifFalse:[
+	    PageFormat := #a4
+	]
     ]
 
     "
@@ -199,9 +199,9 @@
 	PrinterStream defaultCommands:#( ... )"
 
     DefaultCommands isNil ifTrue:[
-        self == PrinterStream ifFalse:[
-            ^ self superclass defaultCommands
-        ]
+	self == PrinterStream ifFalse:[
+	    ^ self superclass defaultCommands
+	]
     ].
     ^ DefaultCommands
 
@@ -225,9 +225,9 @@
 	PrinterStream defaultPageFormats:#..."
 
     DefaultPageFormats isNil ifTrue:[
-        self == PrinterStream ifFalse:[
-            ^ self superclass defaultPageFormats
-        ]
+	self == PrinterStream ifFalse:[
+	    ^ self superclass defaultPageFormats
+	]
     ].
     ^ DefaultPageFormats
 
@@ -276,9 +276,9 @@
     "return the landscape setting"
 
     Landscape isNil ifTrue:[
-        self == PrinterStream ifFalse:[
-            ^ self superclass landscape
-        ]
+	self == PrinterStream ifFalse:[
+	    ^ self superclass landscape
+	]
     ].
     ^ Landscape
 !
@@ -305,9 +305,9 @@
     "return the number of blanks for the left margin"
 
     LeftMargin isNil ifTrue:[
-        self == PrinterStream ifFalse:[
-            ^ self superclass leftMargin
-        ]
+	self == PrinterStream ifFalse:[
+	    ^ self superclass leftMargin
+	]
     ].
     ^ LeftMargin
 !
@@ -325,9 +325,9 @@
      or via the launchers settings menu."
 
     PageFormat isNil ifTrue:[
-        self == PrinterStream ifFalse:[
-            ^ self superclass pageFormat
-        ]
+	self == PrinterStream ifFalse:[
+	    ^ self superclass pageFormat
+	]
     ].
     ^ PageFormat
 
@@ -341,7 +341,7 @@
      that symbol, in order for printing to be correct.
 
      This list can be set from the startup script with:
-        PrinterStream defaultPageFormat:#...
+	PrinterStream defaultPageFormat:#...
      or via the launchers settings menu."
 
     PageFormat := aSymbol.
@@ -357,9 +357,9 @@
      settings menu."
 
     PrintCommand isNil ifTrue:[
-        self == PrinterStream ifFalse:[
-            ^ self superclass printCommand
-        ]
+	self == PrinterStream ifFalse:[
+	    ^ self superclass printCommand
+	]
     ].
     ^ PrintCommand
 
@@ -463,10 +463,10 @@
     "send some characters to the printer - translate as needed"
 
     (aCharacter == Character cr) ifTrue:[
-        super nextPut:(Character cr).
-        self spaces:(self class leftMargin)
+	super nextPut:(Character cr).
+	self spaces:(self class leftMargin)
     ] ifFalse:[
-        super nextPut:aCharacter
+	super nextPut:aCharacter
     ]
 
     "Modified: 1.6.1996 / 00:13:48 / cg"
@@ -479,22 +479,22 @@
     |lastE|
 
     aCollection hasChangeOfEmphasis ifTrue:[
-        aCollection keysAndValuesDo:[:idx :aChar |
-            |e|
+	aCollection keysAndValuesDo:[:idx :aChar |
+	    |e|
 
-            e := aCollection emphasisAt:idx.
-            (idx == 1
-            or:[lastE ~~ e]) ifTrue:[
-                self emphasis:e.
-                lastE := e.
-            ].
-            self nextPut:aChar.
-        ].
-        self normal.
+	    e := aCollection emphasisAt:idx.
+	    (idx == 1
+	    or:[lastE ~~ e]) ifTrue:[
+		self emphasis:e.
+		lastE := e.
+	    ].
+	    self nextPut:aChar.
+	].
+	self normal.
     ] ifFalse:[
-        aCollection do:[:aChar |
-            self nextPut:aChar
-        ]
+	aCollection do:[:aChar |
+	    self nextPut:aChar
+	]
     ]
 
     "Modified: 3.6.1996 / 17:12:31 / cg"
@@ -540,9 +540,26 @@
 emphasis:anEmphasis
     "change the emphasis"
 
-    anEmphasis isNil ifTrue:[
-	^ self normal
+    (Text emphasis:anEmphasis includes:#underline) ifTrue:[
+	underline ifFalse:[
+	    self underline
+	]
+    ] ifFalse:[
+	underline ifTrue:[
+	    self noUnderline
+	]
     ].
+
+    (Text emphasis:anEmphasis includes:#strikeout) ifTrue:[
+	strikeout ifFalse:[
+	    self strikeout
+	]
+    ] ifFalse:[
+	strikeout ifTrue:[
+	    self noStrikeout
+	]
+    ].
+
     anEmphasis == #bold ifTrue:[
 	^ self bold
     ].
@@ -553,15 +570,10 @@
     or:[anEmphasis = #(italic bold)]) ifTrue:[
 	^ self boldItalic
     ].
-    anEmphasis == #underline ifTrue:[
-	^ self underline
-    ].
-    anEmphasis == #strikeout ifTrue:[
-	^ self strikeout
-    ].
 
-    "Created: 14.5.1996 / 18:53:54 / cg"
-    "Modified: 18.5.1996 / 09:42:49 / cg"
+    ^ self normal
+
+    "Modified: 8.6.1996 / 08:15:00 / cg"
 !
 
 italic
@@ -573,6 +585,26 @@
     "Modified: 18.5.1996 / 08:55:18 / cg"
 !
 
+noUnderline
+    "set emphasis to no underline
+     - ignore here, since this class does not know anything about the printer"
+
+    ^ self
+
+    "Modified: 18.5.1996 / 08:55:10 / cg"
+    "Created: 8.6.1996 / 08:15:12 / cg"
+!
+
+noStrikeout
+    "set emphasis to no strikeout
+     - ignore here, since this class does not know anything about the printer"
+
+    ^ self
+
+    "Modified: 18.5.1996 / 08:55:10 / cg"
+    "Created: 8.6.1996 / 08:15:20 / cg"
+!
+
 normal
     "set emphasis to normal (non-bold, non-italic)
      - ignore here, since this class does not know anything about the printer"
@@ -754,6 +786,6 @@
 !PrinterStream class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic2/PrinterStream.st,v 1.35 1996-06-04 15:19:21 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic2/PrinterStream.st,v 1.36 1996-06-08 09:10:06 cg Exp $'
 ! !
 PrinterStream initialize!