PrinterStream.st
author Claus Gittinger <cg@exept.de>
Wed, 09 Jul 2014 05:08:14 +0200
changeset 3318 01dca72063e2
parent 3280 27f9e6b6e7b5
child 3653 8adb22c4ead5
permissions -rw-r--r--
class: PrinterStream added: #newForFile:native: comment/format in: #printFilename changed: #new #newForFile: #newNative
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
1cf8d1747859 Initial revision
claus
parents:
diff changeset
     1
"
4
1f66800df351 *** empty log message ***
claus
parents: 2
diff changeset
     2
 COPYRIGHT (c) 1990 by Claus Gittinger
1109
3dd9d0a420a1 Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents: 1107
diff changeset
     3
              All Rights Reserved
0
1cf8d1747859 Initial revision
claus
parents:
diff changeset
     4
1cf8d1747859 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
1cf8d1747859 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
1cf8d1747859 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
1cf8d1747859 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
1cf8d1747859 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
1cf8d1747859 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
1cf8d1747859 Initial revision
claus
parents:
diff changeset
    11
"
913
99228537653d Speed up native printing: #nextPutAll
Stefan Vogel <sv@exept.de>
parents: 879
diff changeset
    12
"{ Package: 'stx:libbasic2' }"
99228537653d Speed up native printing: #nextPutAll
Stefan Vogel <sv@exept.de>
parents: 879
diff changeset
    13
1317
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
    14
Stream subclass:#PrinterStream
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
    15
	instanceVariableNames:'stream native pageFormat underline strikeout'
1220
33fa58c0596d category
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
    16
	classVariableNames:'DefaultPageFormat'
33fa58c0596d category
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
    17
	poolDictionaries:''
1652
663247b3d8a1 category change
fm
parents: 1622
diff changeset
    18
	category:'Interface-Printing'
0
1cf8d1747859 Initial revision
claus
parents:
diff changeset
    19
!
1cf8d1747859 Initial revision
claus
parents:
diff changeset
    20
1317
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
    21
PrinterStream class instanceVariableNames:'PrintCommand PrintFilename DefaultCommands PageFormat DefaultPageFormats
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
    22
	Landscape PrintDevice DefaultDevices'
627
8003af47744a add landscape
ca
parents: 571
diff changeset
    23
8003af47744a add landscape
ca
parents: 571
diff changeset
    24
"
879
e69bf56dc758 category change
Claus Gittinger <cg@exept.de>
parents: 774
diff changeset
    25
 No other class instance variables are inherited by this class.
627
8003af47744a add landscape
ca
parents: 571
diff changeset
    26
"
370
705453f00711 keep per-printer defaults
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
    27
!
705453f00711 keep per-printer defaults
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
    28
456
37b86d48d290 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 443
diff changeset
    29
!PrinterStream class methodsFor:'documentation'!
31
e223f3cf2995 *** empty log message ***
claus
parents: 10
diff changeset
    30
e223f3cf2995 *** empty log message ***
claus
parents: 10
diff changeset
    31
copyright
e223f3cf2995 *** empty log message ***
claus
parents: 10
diff changeset
    32
"
e223f3cf2995 *** empty log message ***
claus
parents: 10
diff changeset
    33
 COPYRIGHT (c) 1990 by Claus Gittinger
1109
3dd9d0a420a1 Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents: 1107
diff changeset
    34
              All Rights Reserved
0
1cf8d1747859 Initial revision
claus
parents:
diff changeset
    35
31
e223f3cf2995 *** empty log message ***
claus
parents: 10
diff changeset
    36
 This software is furnished under a license and may be used
e223f3cf2995 *** empty log message ***
claus
parents: 10
diff changeset
    37
 only in accordance with the terms of that license and with the
e223f3cf2995 *** empty log message ***
claus
parents: 10
diff changeset
    38
 inclusion of the above copyright notice.   This software may not
e223f3cf2995 *** empty log message ***
claus
parents: 10
diff changeset
    39
 be provided or otherwise made available to, or used by, any
e223f3cf2995 *** empty log message ***
claus
parents: 10
diff changeset
    40
 other person.  No title to or ownership of the software is
e223f3cf2995 *** empty log message ***
claus
parents: 10
diff changeset
    41
 hereby transferred.
e223f3cf2995 *** empty log message ***
claus
parents: 10
diff changeset
    42
"
e223f3cf2995 *** empty log message ***
claus
parents: 10
diff changeset
    43
!
0
1cf8d1747859 Initial revision
claus
parents:
diff changeset
    44
31
e223f3cf2995 *** empty log message ***
claus
parents: 10
diff changeset
    45
documentation
e223f3cf2995 *** empty log message ***
claus
parents: 10
diff changeset
    46
"
e223f3cf2995 *** empty log message ***
claus
parents: 10
diff changeset
    47
    a stream for printing; this (concrete or abstract) class can handle only
348
e4790af5d077 comments & category rename
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    48
    very dumb printers. 
e4790af5d077 comments & category rename
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    49
    No attributes (italic, bold etc) and no multiple fonts are supported 
e4790af5d077 comments & category rename
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    50
    - just plain single font text printing.
179
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 160
diff changeset
    51
38773360f4b7 more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents: 160
diff changeset
    52
    More intelligence is added by subclasses (see PostscriptPrinterStream among others.)
211
a7ca79962b92 commentary
Claus Gittinger <cg@exept.de>
parents: 186
diff changeset
    53
1906
ba10f3f4e6e0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1779
diff changeset
    54
    These classes do not support graphics printing - they are only for text; 
ba10f3f4e6e0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1779
diff changeset
    55
    although some limited font functionality (such as bold or italic printing)
211
a7ca79962b92 commentary
Claus Gittinger <cg@exept.de>
parents: 186
diff changeset
    56
    may be supported by some subclasses.
a7ca79962b92 commentary
Claus Gittinger <cg@exept.de>
parents: 186
diff changeset
    57
348
e4790af5d077 comments & category rename
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    58
e4790af5d077 comments & category rename
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    59
    [usage:]
e4790af5d077 comments & category rename
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    60
211
a7ca79962b92 commentary
Claus Gittinger <cg@exept.de>
parents: 186
diff changeset
    61
    The concrete printer class is bound to the global variable Printer,
235
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
    62
    which is either set to PrinterStream (for dumb printers) or to one of
211
a7ca79962b92 commentary
Claus Gittinger <cg@exept.de>
parents: 186
diff changeset
    63
    the subclasses (PostscriptPrinterStream etc.).
a7ca79962b92 commentary
Claus Gittinger <cg@exept.de>
parents: 186
diff changeset
    64
a7ca79962b92 commentary
Claus Gittinger <cg@exept.de>
parents: 186
diff changeset
    65
    To print:
a7ca79962b92 commentary
Claus Gittinger <cg@exept.de>
parents: 186
diff changeset
    66
1109
3dd9d0a420a1 Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents: 1107
diff changeset
    67
        |p|
211
a7ca79962b92 commentary
Claus Gittinger <cg@exept.de>
parents: 186
diff changeset
    68
1109
3dd9d0a420a1 Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents: 1107
diff changeset
    69
        p := Printer new.
3dd9d0a420a1 Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents: 1107
diff changeset
    70
        p notNil ifTrue:[
3dd9d0a420a1 Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents: 1107
diff changeset
    71
            p nextPutAll:'hello world'; cr.
3dd9d0a420a1 Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents: 1107
diff changeset
    72
            p nextPutAll:' ...'; cr.
3dd9d0a420a1 Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents: 1107
diff changeset
    73
            p close
3dd9d0a420a1 Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents: 1107
diff changeset
    74
        ].
211
a7ca79962b92 commentary
Claus Gittinger <cg@exept.de>
parents: 186
diff changeset
    75
a7ca79962b92 commentary
Claus Gittinger <cg@exept.de>
parents: 186
diff changeset
    76
    See users of the Printer global variable for more examples.
259
6d36f3ac42a2 documentation
Claus Gittinger <cg@exept.de>
parents: 247
diff changeset
    77
348
e4790af5d077 comments & category rename
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    78
    [class variables:]
1109
3dd9d0a420a1 Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents: 1107
diff changeset
    79
        PrintCommand    <String>        UNIX only: the operatingSystem command for printing.
3dd9d0a420a1 Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents: 1107
diff changeset
    80
                                        Usually something like 'lp' or 'lpr'
348
e4790af5d077 comments & category rename
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
    81
1109
3dd9d0a420a1 Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents: 1107
diff changeset
    82
        PrintDevice     <String>        VMS only: the printers device.
3dd9d0a420a1 Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents: 1107
diff changeset
    83
                                        Usually something like 'sys$print:'
571
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
    84
259
6d36f3ac42a2 documentation
Claus Gittinger <cg@exept.de>
parents: 247
diff changeset
    85
    [author:]
1109
3dd9d0a420a1 Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents: 1107
diff changeset
    86
        Claus Gittinger
31
e223f3cf2995 *** empty log message ***
claus
parents: 10
diff changeset
    87
"
e223f3cf2995 *** empty log message ***
claus
parents: 10
diff changeset
    88
! !
0
1cf8d1747859 Initial revision
claus
parents:
diff changeset
    89
456
37b86d48d290 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 443
diff changeset
    90
!PrinterStream class methodsFor:'initialization'!
0
1cf8d1747859 Initial revision
claus
parents:
diff changeset
    91
1cf8d1747859 Initial revision
claus
parents:
diff changeset
    92
initialize
1cf8d1747859 Initial revision
claus
parents:
diff changeset
    93
    "this is usually redefined by the startup-file"
1cf8d1747859 Initial revision
claus
parents:
diff changeset
    94
2969
ac9ce708b061 lazy initialization
Claus Gittinger <cg@exept.de>
parents: 2863
diff changeset
    95
    "/ self initializePrintParameters  -- now done lazily
ac9ce708b061 lazy initialization
Claus Gittinger <cg@exept.de>
parents: 2863
diff changeset
    96
!
ac9ce708b061 lazy initialization
Claus Gittinger <cg@exept.de>
parents: 2863
diff changeset
    97
ac9ce708b061 lazy initialization
Claus Gittinger <cg@exept.de>
parents: 2863
diff changeset
    98
initializePrintParameters
ac9ce708b061 lazy initialization
Claus Gittinger <cg@exept.de>
parents: 2863
diff changeset
    99
    "this is usually redefined by the startup-file"
ac9ce708b061 lazy initialization
Claus Gittinger <cg@exept.de>
parents: 2863
diff changeset
   100
569
9030f82afd08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 468
diff changeset
   101
    OperatingSystem isUNIXlike ifTrue:[
9030f82afd08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 468
diff changeset
   102
        DefaultCommands isNil ifTrue:[
9030f82afd08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 468
diff changeset
   103
            DefaultCommands := #(
9030f82afd08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 468
diff changeset
   104
                                 'lpr' 
9030f82afd08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 468
diff changeset
   105
                                 'lpr -P<your-printer>' 
1109
3dd9d0a420a1 Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents: 1107
diff changeset
   106
                                 'rsh <printHost> lpr -h' 
3dd9d0a420a1 Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents: 1107
diff changeset
   107
                                 'cat >preview.ps ; gv preview.ps'
3dd9d0a420a1 Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents: 1107
diff changeset
   108
                                 'cat >printfile'
3dd9d0a420a1 Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents: 1107
diff changeset
   109
                                 'gs -q -DNOPAUSE -sDEVICE=pdfwrite -sOutputFile=/tmp/preview.pdf -'
569
9030f82afd08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 468
diff changeset
   110
                                 'a2ps'
9030f82afd08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 468
diff changeset
   111
                                 'a2ps | rsh <printHost> lpr -h' 
1109
3dd9d0a420a1 Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents: 1107
diff changeset
   112
                                 'a2ps >printfile' 
569
9030f82afd08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 468
diff changeset
   113
                                ).
9030f82afd08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 468
diff changeset
   114
        ].
370
705453f00711 keep per-printer defaults
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   115
569
9030f82afd08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 468
diff changeset
   116
        PrintCommand isNil ifTrue:[
9030f82afd08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 468
diff changeset
   117
            (OperatingSystem canExecuteCommand:'lpr') ifTrue:[
9030f82afd08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 468
diff changeset
   118
                PrintCommand := 'lpr'
9030f82afd08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 468
diff changeset
   119
            ] ifFalse:[
9030f82afd08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 468
diff changeset
   120
                PrintCommand := 'lp'
9030f82afd08 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 468
diff changeset
   121
            ]
1107
8ea38fa19bd6 ghostview -> gv
ca
parents: 1076
diff changeset
   122
        ]
0
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   123
    ].
571
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   124
    OperatingSystem isVMSlike ifTrue:[
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   125
        DefaultDevices isNil ifTrue:[
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   126
            DefaultDevices := #(
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   127
                                 'sys$print:'
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   128
                                ).
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   129
        ].
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   130
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   131
        PrintDevice isNil ifTrue:[
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   132
            PrintDevice := 'sys$print:'
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   133
        ]
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   134
    ].
367
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   135
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   136
    DefaultPageFormats isNil ifTrue:[
571
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   137
        "/ UnitConverter must support all of them.
442
dcc6bcb69eba oops - linux has lpr, but is not bsd-like
dq
parents: 437
diff changeset
   138
        self defaultPageFormats:#(
2862
1465c29a684c class: PrinterStream
Stefan Vogel <sv@exept.de>
parents: 2710
diff changeset
   139
                                    a3
1465c29a684c class: PrinterStream
Stefan Vogel <sv@exept.de>
parents: 2710
diff changeset
   140
                                    a4
1465c29a684c class: PrinterStream
Stefan Vogel <sv@exept.de>
parents: 2710
diff changeset
   141
                                    a5
1465c29a684c class: PrinterStream
Stefan Vogel <sv@exept.de>
parents: 2710
diff changeset
   142
                                    a6
1465c29a684c class: PrinterStream
Stefan Vogel <sv@exept.de>
parents: 2710
diff changeset
   143
                                    b5
1465c29a684c class: PrinterStream
Stefan Vogel <sv@exept.de>
parents: 2710
diff changeset
   144
                                    letter
1465c29a684c class: PrinterStream
Stefan Vogel <sv@exept.de>
parents: 2710
diff changeset
   145
                                    legal
1465c29a684c class: PrinterStream
Stefan Vogel <sv@exept.de>
parents: 2710
diff changeset
   146
                                    ledger
442
dcc6bcb69eba oops - linux has lpr, but is not bsd-like
dq
parents: 437
diff changeset
   147
                               ).
367
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   148
    ].
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   149
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   150
    Landscape isNil ifTrue:[
442
dcc6bcb69eba oops - linux has lpr, but is not bsd-like
dq
parents: 437
diff changeset
   151
        Landscape := false
367
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   152
    ].
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   153
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   154
    PageFormat isNil ifTrue:[
442
dcc6bcb69eba oops - linux has lpr, but is not bsd-like
dq
parents: 437
diff changeset
   155
        Language == #us ifTrue:[
dcc6bcb69eba oops - linux has lpr, but is not bsd-like
dq
parents: 437
diff changeset
   156
            PageFormat := #letter
dcc6bcb69eba oops - linux has lpr, but is not bsd-like
dq
parents: 437
diff changeset
   157
        ] ifFalse:[
dcc6bcb69eba oops - linux has lpr, but is not bsd-like
dq
parents: 437
diff changeset
   158
            PageFormat := #a4
dcc6bcb69eba oops - linux has lpr, but is not bsd-like
dq
parents: 437
diff changeset
   159
        ]
0
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   160
    ]
367
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   161
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   162
    "
386
cebdfb2e9cf0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
   163
     DefaultPageFormats := nil.
1109
3dd9d0a420a1 Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents: 1107
diff changeset
   164
     DefaultCommands := nil.
442
dcc6bcb69eba oops - linux has lpr, but is not bsd-like
dq
parents: 437
diff changeset
   165
     PrintCommand := nil.
367
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   166
     PrinterStream initialize
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   167
    "
370
705453f00711 keep per-printer defaults
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   168
386
cebdfb2e9cf0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
   169
    "Modified: 4.6.1996 / 17:16:32 / cg"
373
6834d6a61ea9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 371
diff changeset
   170
!
6834d6a61ea9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 371
diff changeset
   171
6834d6a61ea9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 371
diff changeset
   172
reInitPage
6834d6a61ea9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 371
diff changeset
   173
    "nothing done here"
6834d6a61ea9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 371
diff changeset
   174
6834d6a61ea9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 371
diff changeset
   175
    "Created: 1.6.1996 / 00:49:40 / cg"
2
07d9ee98e092 *** empty log message ***
claus
parents: 0
diff changeset
   176
! !
07d9ee98e092 *** empty log message ***
claus
parents: 0
diff changeset
   177
456
37b86d48d290 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 443
diff changeset
   178
!PrinterStream class methodsFor:'instance creation'!
0
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   179
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   180
new
1317
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   181
    "return a new stream for printing.
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   182
     If printFilename is nonNil, printOut goes into that file.
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   183
     otherwise, it is piped through the printCommand OS-command."
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   184
3318
01dca72063e2 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 3280
diff changeset
   185
    ^ self newForFile:(self printFilename) native:false.
1317
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   186
!
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   187
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   188
newForFile:aFileNameOrNil
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   189
    "return a new stream for printing into aFileName"
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   190
3318
01dca72063e2 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 3280
diff changeset
   191
    ^ self newForFile:aFileNameOrNil native:false
01dca72063e2 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 3280
diff changeset
   192
01dca72063e2 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 3280
diff changeset
   193
    "
01dca72063e2 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 3280
diff changeset
   194
     |p|
01dca72063e2 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 3280
diff changeset
   195
01dca72063e2 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 3280
diff changeset
   196
     p := PostscriptPrinterStream newForFile:'/tmp/out.ps'.
01dca72063e2 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 3280
diff changeset
   197
     True printOutOn:p.
01dca72063e2 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 3280
diff changeset
   198
     p close.
01dca72063e2 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 3280
diff changeset
   199
    "
01dca72063e2 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 3280
diff changeset
   200
!
01dca72063e2 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 3280
diff changeset
   201
01dca72063e2 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 3280
diff changeset
   202
newForFile:aFileNameOrNil native:nativePrinting
01dca72063e2 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 3280
diff changeset
   203
    "return a new stream for printing into aFileName"
01dca72063e2 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 3280
diff changeset
   204
1317
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   205
    |str printer|
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   206
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   207
    printer := self basicNew initialize.
0
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   208
1317
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   209
    aFileNameOrNil notNil ifTrue:[
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   210
        str := aFileNameOrNil asFilename writeStream.
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   211
        printer stream:str.
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   212
    ].
3318
01dca72063e2 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 3280
diff changeset
   213
    nativePrinting ifTrue:[
01dca72063e2 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 3280
diff changeset
   214
        printer setNative
01dca72063e2 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 3280
diff changeset
   215
    ].
1317
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   216
    printer startPrint.
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   217
    ^ printer
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   218
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   219
    "
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   220
     |p|
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   221
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   222
     p := PostscriptPrinterStream newForFile:'/tmp/out.ps'.
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   223
     True printOutOn:p.
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   224
     p close.
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   225
    "
160
879568e66211 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 139
diff changeset
   226
!
879568e66211 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 139
diff changeset
   227
879568e66211 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 139
diff changeset
   228
newNative
879568e66211 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 139
diff changeset
   229
    "return a new stream for untranslated printing
1317
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   230
     (i.e. text should be sent via nextPutUntranslated in the printers native format).
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   231
     For example, this is used with PostScriptPrinterStream,
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   232
     if the application generates postscript."
160
879568e66211 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 139
diff changeset
   233
3318
01dca72063e2 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 3280
diff changeset
   234
    ^ self newForFile:(self printFilename) native:true.
1076
4bb0e9411317 Define #nextPutAll:startingAt:to: to fix Text>>printOn:aPrinterStream
Stefan Vogel <sv@exept.de>
parents: 914
diff changeset
   235
! !
0
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   236
1220
33fa58c0596d category
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
   237
!PrinterStream class methodsFor:'accessing-defaults'!
0
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   238
433
2b5b9df0981c renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   239
bottomMargin
2b5b9df0981c renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   240
    "return the bottomMargin (in inches). Here, no margin is supported,
378
91abcf70e0c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 373
diff changeset
   241
     but its redefined in some printer classes"
91abcf70e0c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 373
diff changeset
   242
91abcf70e0c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 373
diff changeset
   243
    ^ 0
91abcf70e0c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 373
diff changeset
   244
433
2b5b9df0981c renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   245
    "Created: 5.9.1996 / 21:37:49 / cg"
378
91abcf70e0c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 373
diff changeset
   246
!
91abcf70e0c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 373
diff changeset
   247
247
d1e5c0187e59 keep defaultCommands in a classVar
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
   248
defaultCommands
571
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   249
    "UNIX only: 
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   250
     return a list presented as possible commands for printing
247
d1e5c0187e59 keep defaultCommands in a classVar
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
   251
     (in the launchers printer configuration).
d1e5c0187e59 keep defaultCommands in a classVar
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
   252
     This list can be set from the startup script with:
1109
3dd9d0a420a1 Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents: 1107
diff changeset
   253
        PrinterStream defaultCommands:#( ... )"
247
d1e5c0187e59 keep defaultCommands in a classVar
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
   254
370
705453f00711 keep per-printer defaults
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   255
    DefaultCommands isNil ifTrue:[
1109
3dd9d0a420a1 Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents: 1107
diff changeset
   256
        self == PrinterStream ifFalse:[
3dd9d0a420a1 Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents: 1107
diff changeset
   257
            ^ self superclass defaultCommands
2969
ac9ce708b061 lazy initialization
Claus Gittinger <cg@exept.de>
parents: 2863
diff changeset
   258
        ].
ac9ce708b061 lazy initialization
Claus Gittinger <cg@exept.de>
parents: 2863
diff changeset
   259
        self initializePrintParameters
370
705453f00711 keep per-printer defaults
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   260
    ].
247
d1e5c0187e59 keep defaultCommands in a classVar
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
   261
    ^ DefaultCommands
d1e5c0187e59 keep defaultCommands in a classVar
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
   262
d1e5c0187e59 keep defaultCommands in a classVar
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
   263
    "Created: 23.4.1996 / 18:25:18 / cg"
d1e5c0187e59 keep defaultCommands in a classVar
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
   264
!
d1e5c0187e59 keep defaultCommands in a classVar
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
   265
d1e5c0187e59 keep defaultCommands in a classVar
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
   266
defaultCommands:collectionOfCommandStrings
571
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   267
    "UNIX only: 
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   268
     set the list which will be presented as possible commands for printing.
367
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   269
     (shown in in the launchers printer configuration).
247
d1e5c0187e59 keep defaultCommands in a classVar
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
   270
     This can be done from the startup script with:
1109
3dd9d0a420a1 Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents: 1107
diff changeset
   271
        PrinterStream defaultCommands:#( ... )"
247
d1e5c0187e59 keep defaultCommands in a classVar
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
   272
d1e5c0187e59 keep defaultCommands in a classVar
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
   273
    DefaultCommands := collectionOfCommandStrings
d1e5c0187e59 keep defaultCommands in a classVar
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
   274
d1e5c0187e59 keep defaultCommands in a classVar
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
   275
    "Created: 23.4.1996 / 18:26:06 / cg"
d1e5c0187e59 keep defaultCommands in a classVar
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
   276
!
d1e5c0187e59 keep defaultCommands in a classVar
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
   277
571
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   278
defaultDevices
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   279
    "VMS only: 
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   280
     return a list presented as possible devices for printers.
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   281
     (in the launchers printer configuration).
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   282
     This list can be set from the startup script with:
1109
3dd9d0a420a1 Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents: 1107
diff changeset
   283
        PrinterStream defaultDevices:#( ... )"
571
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   284
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   285
    DefaultDevices isNil ifTrue:[
1109
3dd9d0a420a1 Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents: 1107
diff changeset
   286
        self == PrinterStream ifFalse:[
3dd9d0a420a1 Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents: 1107
diff changeset
   287
            ^ self superclass defaultDevices
2969
ac9ce708b061 lazy initialization
Claus Gittinger <cg@exept.de>
parents: 2863
diff changeset
   288
        ].
ac9ce708b061 lazy initialization
Claus Gittinger <cg@exept.de>
parents: 2863
diff changeset
   289
        self initializePrintParameters
571
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   290
    ].
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   291
    ^ DefaultDevices
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   292
!
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   293
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   294
defaultDevices:collectionOfDeviceNameStrings
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   295
    "VMS only:
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   296
     set the list which will be presented as possible devices for printing.
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   297
     (shown in in the launchers printer configuration).
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   298
     This can be done from the startup script with:
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   299
        PrinterStream defaultDevices:#( ... )"
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   300
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   301
    DefaultDevices := collectionOfDeviceNameStrings
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   302
!
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   303
367
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   304
defaultPageFormats
443
2c85dbf33207 Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents: 442
diff changeset
   305
    "return a list of supported page formats.
367
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   306
     This list can be set from the startup script with:
443
2c85dbf33207 Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents: 442
diff changeset
   307
        PrinterStream defaultPageFormats:#( ... )"
367
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   308
370
705453f00711 keep per-printer defaults
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   309
    DefaultPageFormats isNil ifTrue:[
2969
ac9ce708b061 lazy initialization
Claus Gittinger <cg@exept.de>
parents: 2863
diff changeset
   310
        self == PrinterStream ifFalse:[
443
2c85dbf33207 Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents: 442
diff changeset
   311
            ^ self superclass defaultPageFormats
2969
ac9ce708b061 lazy initialization
Claus Gittinger <cg@exept.de>
parents: 2863
diff changeset
   312
        ].
ac9ce708b061 lazy initialization
Claus Gittinger <cg@exept.de>
parents: 2863
diff changeset
   313
        self initializePrintParameters
370
705453f00711 keep per-printer defaults
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   314
    ].
367
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   315
    ^ DefaultPageFormats
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   316
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   317
    "Created: 23.4.1996 / 18:25:18 / cg"
443
2c85dbf33207 Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents: 442
diff changeset
   318
    "Modified: 11.9.1996 / 11:17:44 / stefan"
367
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   319
!
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   320
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   321
defaultPageFormats:aList
443
2c85dbf33207 Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents: 442
diff changeset
   322
    "set the list of supported page formats.
367
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   323
     (shown in in the launchers printer configuration).
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   324
     This list can be set from the startup script with:
443
2c85dbf33207 Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents: 442
diff changeset
   325
        PrinterStream defaultPageFormats:#( ... ).
2c85dbf33207 Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents: 442
diff changeset
   326
     All symbols must be known by UnitConverter"
367
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   327
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   328
    DefaultPageFormats := aList.
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   329
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   330
    "/ validate the list
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   331
    aList do:[:name |
443
2c85dbf33207 Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents: 442
diff changeset
   332
        |unit ok|
367
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   333
443
2c85dbf33207 Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents: 442
diff changeset
   334
        ok := true.
2c85dbf33207 Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents: 442
diff changeset
   335
        #('W' 'H' 'lW' 'lH') do:[:what |
2c85dbf33207 Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents: 442
diff changeset
   336
            unit := (name , what) asSymbolIfInterned.
2c85dbf33207 Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents: 442
diff changeset
   337
            (unit isNil 
2c85dbf33207 Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents: 442
diff changeset
   338
            or:[(UnitConverter convert:1 from:unit to:#millimeter) isNil]) ifTrue:[
2c85dbf33207 Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents: 442
diff changeset
   339
                ok := false
2c85dbf33207 Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents: 442
diff changeset
   340
            ]
2c85dbf33207 Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents: 442
diff changeset
   341
        ].
2c85dbf33207 Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents: 442
diff changeset
   342
        ok ifFalse:[
2c85dbf33207 Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents: 442
diff changeset
   343
            ('PRINTER: UnitConverter has no size-info for ''' , name , '''-format') errorPrintCR
2c85dbf33207 Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents: 442
diff changeset
   344
        ]
367
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   345
    ].
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   346
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   347
    "
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   348
     PrinterStream
443
2c85dbf33207 Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents: 442
diff changeset
   349
        defaultPageFormats:#(
2c85dbf33207 Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents: 442
diff changeset
   350
                                'letter'
2c85dbf33207 Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents: 442
diff changeset
   351
                                'a4'
2c85dbf33207 Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents: 442
diff changeset
   352
                                'a5'
2c85dbf33207 Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents: 442
diff changeset
   353
                                'a6'
2c85dbf33207 Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents: 442
diff changeset
   354
                            )
367
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   355
    "
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   356
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   357
    "Created: 23.4.1996 / 18:25:18 / cg"
443
2c85dbf33207 Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents: 442
diff changeset
   358
    "Modified: 11.9.1996 / 11:19:01 / stefan"
367
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   359
!
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   360
1779
03cee7f19c7d default printer query
Claus Gittinger <cg@exept.de>
parents: 1777
diff changeset
   361
defaultPrinter
03cee7f19c7d default printer query
Claus Gittinger <cg@exept.de>
parents: 1777
diff changeset
   362
    OperatingSystem isMSWINDOWSlike ifTrue:[
03cee7f19c7d default printer query
Claus Gittinger <cg@exept.de>
parents: 1777
diff changeset
   363
        WinPrinterStream notNil ifTrue:[
03cee7f19c7d default printer query
Claus Gittinger <cg@exept.de>
parents: 1777
diff changeset
   364
            ^ WinPrinterStream
03cee7f19c7d default printer query
Claus Gittinger <cg@exept.de>
parents: 1777
diff changeset
   365
        ].
03cee7f19c7d default printer query
Claus Gittinger <cg@exept.de>
parents: 1777
diff changeset
   366
    ].
03cee7f19c7d default printer query
Claus Gittinger <cg@exept.de>
parents: 1777
diff changeset
   367
03cee7f19c7d default printer query
Claus Gittinger <cg@exept.de>
parents: 1777
diff changeset
   368
    ^ PrinterStream
03cee7f19c7d default printer query
Claus Gittinger <cg@exept.de>
parents: 1777
diff changeset
   369
03cee7f19c7d default printer query
Claus Gittinger <cg@exept.de>
parents: 1777
diff changeset
   370
    "
03cee7f19c7d default printer query
Claus Gittinger <cg@exept.de>
parents: 1777
diff changeset
   371
     self defaultPrinter
03cee7f19c7d default printer query
Claus Gittinger <cg@exept.de>
parents: 1777
diff changeset
   372
    "
03cee7f19c7d default printer query
Claus Gittinger <cg@exept.de>
parents: 1777
diff changeset
   373
03cee7f19c7d default printer query
Claus Gittinger <cg@exept.de>
parents: 1777
diff changeset
   374
    "Created: / 25-10-2006 / 17:36:21 / cg"
03cee7f19c7d default printer query
Claus Gittinger <cg@exept.de>
parents: 1777
diff changeset
   375
!
03cee7f19c7d default printer query
Claus Gittinger <cg@exept.de>
parents: 1777
diff changeset
   376
367
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   377
landscape
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   378
    "return the landscape setting"
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   379
370
705453f00711 keep per-printer defaults
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   380
    Landscape isNil ifTrue:[
1109
3dd9d0a420a1 Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents: 1107
diff changeset
   381
        self == PrinterStream ifFalse:[
3dd9d0a420a1 Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents: 1107
diff changeset
   382
            ^ self superclass landscape
2969
ac9ce708b061 lazy initialization
Claus Gittinger <cg@exept.de>
parents: 2863
diff changeset
   383
        ].
ac9ce708b061 lazy initialization
Claus Gittinger <cg@exept.de>
parents: 2863
diff changeset
   384
        self initializePrintParameters
370
705453f00711 keep per-printer defaults
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   385
    ].
367
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   386
    ^ Landscape
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   387
!
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   388
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   389
landscape:aBoolean
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   390
    "set/clear landscape printing"
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   391
373
6834d6a61ea9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 371
diff changeset
   392
    Landscape := aBoolean.
6834d6a61ea9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 371
diff changeset
   393
    self reInitPage.
6834d6a61ea9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 371
diff changeset
   394
6834d6a61ea9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 371
diff changeset
   395
    "Modified: 1.6.1996 / 00:49:22 / cg"
367
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   396
!
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   397
433
2b5b9df0981c renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   398
leftMargin
2b5b9df0981c renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   399
    "return the leftMargin (in inches). Here, no margin is supported,
378
91abcf70e0c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 373
diff changeset
   400
     but its redefined in some printer classes"
91abcf70e0c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 373
diff changeset
   401
91abcf70e0c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 373
diff changeset
   402
    ^ 0
91abcf70e0c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 373
diff changeset
   403
433
2b5b9df0981c renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   404
    "Created: 5.9.1996 / 21:37:49 / cg"
2b5b9df0981c renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   405
    "Modified: 5.9.1996 / 21:39:55 / cg"
0
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   406
!
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   407
367
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   408
pageFormat
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   409
    "return a symbol describing the default page format.
443
2c85dbf33207 Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents: 442
diff changeset
   410
     This can be set from the startup script with:
2c85dbf33207 Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents: 442
diff changeset
   411
        PrinterStream pageFormat:#...
367
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   412
     or via the launchers settings menu."
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   413
370
705453f00711 keep per-printer defaults
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   414
    PageFormat isNil ifTrue:[
443
2c85dbf33207 Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents: 442
diff changeset
   415
        self == PrinterStream ifFalse:[
2c85dbf33207 Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents: 442
diff changeset
   416
            ^ self superclass pageFormat
2969
ac9ce708b061 lazy initialization
Claus Gittinger <cg@exept.de>
parents: 2863
diff changeset
   417
        ].
ac9ce708b061 lazy initialization
Claus Gittinger <cg@exept.de>
parents: 2863
diff changeset
   418
        self initializePrintParameters
370
705453f00711 keep per-printer defaults
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   419
    ].
367
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   420
    ^ PageFormat
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   421
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   422
    "Created: 23.4.1996 / 18:25:18 / cg"
443
2c85dbf33207 Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents: 442
diff changeset
   423
    "Modified: 11.9.1996 / 11:16:51 / stefan"
367
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   424
!
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   425
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   426
pageFormat:aSymbol
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   427
    "set the the default page format to be aSymbol.
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   428
     Valid symbols are #letter, #a4, #a5 etc.
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   429
     The UnitConverter must contain width/height information on
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   430
     that symbol, in order for printing to be correct.
443
2c85dbf33207 Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents: 442
diff changeset
   431
    "
367
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   432
373
6834d6a61ea9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 371
diff changeset
   433
    PageFormat := aSymbol.
6834d6a61ea9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 371
diff changeset
   434
    self reInitPage.
367
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   435
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   436
    "Created: 23.4.1996 / 18:25:18 / cg"
373
6834d6a61ea9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 371
diff changeset
   437
    "Modified: 1.6.1996 / 00:49:06 / cg"
443
2c85dbf33207 Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents: 442
diff changeset
   438
    "Modified: 11.9.1996 / 11:16:04 / stefan"
367
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   439
!
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   440
186
bc1b056b097c added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   441
printCommand
571
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   442
    "UNIX only: 
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   443
     return the command used for printing (usually 'lp' or 'lpr').
367
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   444
     This is either set from the startup file, or via the launchers
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   445
     settings menu."
186
bc1b056b097c added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   446
370
705453f00711 keep per-printer defaults
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   447
    PrintCommand isNil ifTrue:[
2969
ac9ce708b061 lazy initialization
Claus Gittinger <cg@exept.de>
parents: 2863
diff changeset
   448
        self ~~ PrinterStream ifTrue:[  
1109
3dd9d0a420a1 Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents: 1107
diff changeset
   449
            ^ self superclass printCommand
2969
ac9ce708b061 lazy initialization
Claus Gittinger <cg@exept.de>
parents: 2863
diff changeset
   450
        ].
ac9ce708b061 lazy initialization
Claus Gittinger <cg@exept.de>
parents: 2863
diff changeset
   451
        self initializePrintParameters.
370
705453f00711 keep per-printer defaults
Claus Gittinger <cg@exept.de>
parents: 368
diff changeset
   452
    ].
186
bc1b056b097c added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   453
    ^ PrintCommand
348
e4790af5d077 comments & category rename
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   454
e4790af5d077 comments & category rename
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   455
    "Modified: 18.5.1996 / 09:12:35 / cg"
186
bc1b056b097c added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   456
!
bc1b056b097c added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   457
126
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   458
printCommand:aString
571
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   459
    "UNIX only:
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   460
     set the command for printing (usually 'lp' or 'lpr').
367
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   461
     This is either set from the startup file, or via the launchers
647af479888f added stuff for pageFormat
Claus Gittinger <cg@exept.de>
parents: 362
diff changeset
   462
     settings menu."
126
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   463
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   464
    PrintCommand := aString
139
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   465
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   466
    "
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   467
     PrinterStream printCommand:'lpr'
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   468
     PrinterStream printCommand:'lpr -h'
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   469
     PrinterStream printCommand:'rsh ibm lpr -h'
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   470
     PrinterStream printCommand:'gs -sDEVICE=djet500 -sOutputFile=/tmp/stx.ps -sPAPERSIZE=a4 -q -; cat /tmp/stx.ps | rsh ibm lpr -h'
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   471
    "
348
e4790af5d077 comments & category rename
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   472
e4790af5d077 comments & category rename
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   473
    "Modified: 18.5.1996 / 09:12:48 / cg"
378
91abcf70e0c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 373
diff changeset
   474
!
91abcf70e0c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 373
diff changeset
   475
571
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   476
printDevice
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   477
    "VMS only: return the device for printing (usually 'sys$print:')
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   478
     This is either set from the startup file, or via the launchers
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   479
     settings menu."
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   480
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   481
    PrintDevice isNil ifTrue:[
2969
ac9ce708b061 lazy initialization
Claus Gittinger <cg@exept.de>
parents: 2863
diff changeset
   482
        self ~~ PrinterStream ifTrue:[
1109
3dd9d0a420a1 Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents: 1107
diff changeset
   483
            ^ self superclass printDevice
2969
ac9ce708b061 lazy initialization
Claus Gittinger <cg@exept.de>
parents: 2863
diff changeset
   484
        ].
ac9ce708b061 lazy initialization
Claus Gittinger <cg@exept.de>
parents: 2863
diff changeset
   485
        self initializePrintParameters.
571
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   486
    ].
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   487
    ^ PrintDevice
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   488
!
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   489
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   490
printDevice:aString
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   491
    "VMS only:
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   492
     set the device for printing (usually 'sys$print:').
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   493
     This is either set from the startup file, or via the launchers
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   494
     settings menu."
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   495
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   496
    PrintCommand := aString
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   497
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   498
    "
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   499
     PrinterStream printDevice:'lta1739:'
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   500
    "
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   501
!
191b37534643 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 569
diff changeset
   502
1317
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   503
printFilename
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   504
    "UNIX only: 
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   505
     return the file into which the print-document should be generated.
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   506
     If nil (the default), printOut is piped through printCommand, 
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   507
     which is usually a variant of the lpr-command."
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   508
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   509
    ^ PrintFilename
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   510
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   511
    "
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   512
     PrinterStream printFilename
3318
01dca72063e2 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 3280
diff changeset
   513
     Printer printFilename 
1317
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   514
    "
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   515
!
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   516
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   517
printFilename:aString
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   518
    "UNIX only:
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   519
     set the output file for printing. If non nil, printout goes into that file.
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   520
     If nil, it is piped through printCommand.
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   521
     This is either set from the startup file, or via the launchers settings menu."
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   522
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   523
    PrintFilename := aString
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   524
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   525
    "
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   526
     PrinterStream printFilename:'/tmp/out.ps'
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   527
    "
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   528
!
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   529
456
37b86d48d290 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 443
diff changeset
   530
rightMargin
37b86d48d290 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 443
diff changeset
   531
    "return the rightMargin (in inches). Here, no margin is supported,
37b86d48d290 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 443
diff changeset
   532
     but its redefined in some printer classes"
37b86d48d290 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 443
diff changeset
   533
37b86d48d290 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 443
diff changeset
   534
    ^ 0
37b86d48d290 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 443
diff changeset
   535
37b86d48d290 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 443
diff changeset
   536
    "Modified: 5.9.1996 / 21:39:55 / cg"
37b86d48d290 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 443
diff changeset
   537
    "Created: 6.11.1996 / 15:40:12 / cg"
37b86d48d290 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 443
diff changeset
   538
!
37b86d48d290 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 443
diff changeset
   539
433
2b5b9df0981c renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   540
topMargin
2b5b9df0981c renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   541
    "return the topMargin (in inches). Here, no margin is supported,
378
91abcf70e0c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 373
diff changeset
   542
     but its redefined in some printer classes"
91abcf70e0c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 373
diff changeset
   543
91abcf70e0c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 373
diff changeset
   544
    ^ 0
91abcf70e0c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 373
diff changeset
   545
433
2b5b9df0981c renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   546
    "Created: 5.9.1996 / 21:40:13 / cg"
186
bc1b056b097c added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   547
! !
bc1b056b097c added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   548
456
37b86d48d290 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 443
diff changeset
   549
!PrinterStream class methodsFor:'queries'!
186
bc1b056b097c added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   550
1774
4a72b0ecf646 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   551
isDrivenByCommand
4a72b0ecf646 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   552
    "return true if this printer is driven via an OS-command
4a72b0ecf646 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   553
     (as opposed to writing a file or using a native printing API)"
4a72b0ecf646 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   554
4a72b0ecf646 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   555
    ^ true
4a72b0ecf646 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   556
4a72b0ecf646 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   557
    "Created: / 10-10-2006 / 18:12:47 / cg"
4a72b0ecf646 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   558
!
4a72b0ecf646 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   559
186
bc1b056b097c added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   560
printerTypeName
bc1b056b097c added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   561
    "return a descriptive name"
bc1b056b097c added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   562
1906
ba10f3f4e6e0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1779
diff changeset
   563
    ^ 'Dumb Printer (or Filter Program)'
ba10f3f4e6e0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1779
diff changeset
   564
"/    ^ 'dumb printer (or print filter)'
235
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   565
1906
ba10f3f4e6e0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1779
diff changeset
   566
    "Modified: / 08-11-2007 / 12:09:16 / cg"
139
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   567
!
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   568
383
d5bb2a7cf2ff checkin from browser
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   569
supportsColor
d5bb2a7cf2ff checkin from browser
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   570
    "return true if this is a color printer"
d5bb2a7cf2ff checkin from browser
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   571
d5bb2a7cf2ff checkin from browser
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   572
    ^ false
d5bb2a7cf2ff checkin from browser
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   573
d5bb2a7cf2ff checkin from browser
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   574
    "Created: 3.6.1996 / 18:00:36 / cg"
d5bb2a7cf2ff checkin from browser
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   575
!
d5bb2a7cf2ff checkin from browser
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   576
2710
85bd617cdb5a font setting support
Claus Gittinger <cg@exept.de>
parents: 2108
diff changeset
   577
supportsContext
85bd617cdb5a font setting support
Claus Gittinger <cg@exept.de>
parents: 2108
diff changeset
   578
    "return true if this printer supports a graphicContext (fonts, colors etc.)"
85bd617cdb5a font setting support
Claus Gittinger <cg@exept.de>
parents: 2108
diff changeset
   579
85bd617cdb5a font setting support
Claus Gittinger <cg@exept.de>
parents: 2108
diff changeset
   580
    ^ false
85bd617cdb5a font setting support
Claus Gittinger <cg@exept.de>
parents: 2108
diff changeset
   581
85bd617cdb5a font setting support
Claus Gittinger <cg@exept.de>
parents: 2108
diff changeset
   582
    "Created: / 31-01-2012 / 18:16:08 / cg"
85bd617cdb5a font setting support
Claus Gittinger <cg@exept.de>
parents: 2108
diff changeset
   583
!
85bd617cdb5a font setting support
Claus Gittinger <cg@exept.de>
parents: 2108
diff changeset
   584
2108
f97621cb3cf7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2050
diff changeset
   585
supportsGreyscale
f97621cb3cf7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2050
diff changeset
   586
    ^ false
f97621cb3cf7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2050
diff changeset
   587
!
f97621cb3cf7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2050
diff changeset
   588
378
91abcf70e0c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 373
diff changeset
   589
supportsMargins
383
d5bb2a7cf2ff checkin from browser
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   590
    "return true if this printer supports margin settings (in inches)
d5bb2a7cf2ff checkin from browser
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   591
     if not, it supports at least a leftMargin to be specified in columns."
378
91abcf70e0c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 373
diff changeset
   592
91abcf70e0c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 373
diff changeset
   593
    ^ false
91abcf70e0c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 373
diff changeset
   594
91abcf70e0c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 373
diff changeset
   595
    "Created: 3.6.1996 / 10:47:54 / cg"
383
d5bb2a7cf2ff checkin from browser
Claus Gittinger <cg@exept.de>
parents: 381
diff changeset
   596
    "Modified: 3.6.1996 / 18:24:20 / cg"
378
91abcf70e0c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 373
diff changeset
   597
!
91abcf70e0c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 373
diff changeset
   598
368
423cf3f4e522 added query if printer supports pages at all (only PS does)
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   599
supportsPageSizes
423cf3f4e522 added query if printer supports pages at all (only PS does)
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   600
    "return true if this printer supports different page sizes"
423cf3f4e522 added query if printer supports pages at all (only PS does)
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   601
423cf3f4e522 added query if printer supports pages at all (only PS does)
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   602
    ^ false
423cf3f4e522 added query if printer supports pages at all (only PS does)
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   603
423cf3f4e522 added query if printer supports pages at all (only PS does)
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   604
    "Created: 31.5.1996 / 22:35:26 / cg"
423cf3f4e522 added query if printer supports pages at all (only PS does)
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   605
!
423cf3f4e522 added query if printer supports pages at all (only PS does)
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   606
186
bc1b056b097c added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   607
supportsPostscript
bc1b056b097c added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   608
    "return true if this is a postscript printer"
139
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
   609
186
bc1b056b097c added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   610
    ^ false
bc1b056b097c added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   611
bc1b056b097c added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   612
    "Created: 10.2.1996 / 16:23:07 / cg"
1774
4a72b0ecf646 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   613
!
4a72b0ecf646 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   614
1990
9594087e3a0a +supportsPrintingToCommand query
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
   615
supportsPrintingToCommand
9594087e3a0a +supportsPrintingToCommand query
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
   616
    ^ true
9594087e3a0a +supportsPrintingToCommand query
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
   617
!
9594087e3a0a +supportsPrintingToCommand query
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
   618
1774
4a72b0ecf646 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   619
supportsPrintingToFile
4a72b0ecf646 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   620
    ^ true
4a72b0ecf646 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   621
4a72b0ecf646 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   622
    "Created: / 10-10-2006 / 18:27:10 / cg"
126
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   623
! !
0
1cf8d1747859 Initial revision
claus
parents:
diff changeset
   624
3280
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   625
!PrinterStream methodsFor:'emphasis'!
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   626
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   627
bold
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   628
    "set emphasis to bold
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   629
     - ignore here, since this class does not know anything about the printer"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   630
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   631
    ^ self
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   632
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   633
    "Modified: 18.5.1996 / 08:55:10 / cg"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   634
!
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   635
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   636
boldItalic
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   637
    "set emphasis to boldItalic
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   638
     - ignore here, since this class does not know anything about the printer"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   639
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   640
    ^ self
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   641
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   642
    "Created: 14.5.1996 / 18:53:43 / cg"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   643
    "Modified: 18.5.1996 / 08:55:14 / cg"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   644
!
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   645
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   646
emphasis:anEmphasis
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   647
    "change the emphasis"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   648
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   649
    |b i|
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   650
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   651
    (Text emphasis:anEmphasis includes:#underline) ifTrue:[
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   652
        underline ifFalse:[
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   653
            self underline
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   654
        ]
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   655
    ] ifFalse:[
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   656
        underline ifTrue:[
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   657
            self noUnderline
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   658
        ]
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   659
    ].
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   660
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   661
    (Text emphasis:anEmphasis includes:#strikeout) ifTrue:[
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   662
        strikeout ifFalse:[
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   663
            self strikeout
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   664
        ]
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   665
    ] ifFalse:[
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   666
        strikeout ifTrue:[
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   667
            self noStrikeout
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   668
        ]
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   669
    ].
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   670
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   671
    b := (Text emphasis:anEmphasis includes:#bold).
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   672
    i := (Text emphasis:anEmphasis includes:#italic).
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   673
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   674
    b ifTrue:[
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   675
        i ifTrue:[
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   676
            ^ self boldItalic
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   677
        ] ifFalse:[
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   678
            ^ self bold
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   679
        ]
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   680
    ] ifFalse:[
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   681
        i ifTrue:[
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   682
            ^ self italic
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   683
        ]
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   684
    ].
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   685
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   686
    ^ self normal
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   687
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   688
    "Modified: 8.6.1996 / 08:15:00 / cg"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   689
!
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   690
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   691
italic
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   692
    "set emphasis to italic
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   693
     - ignore here, since this class does not know anything about the printer"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   694
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   695
    ^ self
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   696
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   697
    "Modified: 18.5.1996 / 08:55:18 / cg"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   698
!
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   699
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   700
normal
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   701
    "set emphasis to normal (non-bold, non-italic)
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   702
     - ignore here, since this class does not know anything about the printer"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   703
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   704
    ^ self
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   705
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   706
    "Modified: 18.5.1996 / 08:55:21 / cg"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   707
!
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   708
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   709
strikeout
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   710
    "set emphasis to strikeout
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   711
     - ignore here, since this class does not know anything about the printer"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   712
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   713
    ^ self
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   714
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   715
    "Modified: 18.5.1996 / 08:55:10 / cg"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   716
    "Created: 18.5.1996 / 08:56:13 / cg"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   717
!
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   718
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   719
underline
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   720
    "set emphasis to underline
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   721
     - ignore here, since this class does not know anything about the printer"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   722
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   723
    ^ self
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   724
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   725
    "Modified: 18.5.1996 / 08:55:10 / cg"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   726
    "Created: 18.5.1996 / 08:56:24 / cg"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   727
! !
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   728
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   729
!PrinterStream methodsFor:'emphasis change'!
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   730
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   731
noStrikeout
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   732
    "set emphasis to no strikeout
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   733
     - ignore here, since this class does not know anything about the printer"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   734
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   735
    ^ self
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   736
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   737
    "Modified: 18.5.1996 / 08:55:10 / cg"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   738
    "Created: 8.6.1996 / 08:15:20 / cg"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   739
!
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   740
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   741
noUnderline
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   742
    "set emphasis to no underline
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   743
     - ignore here, since this class does not know anything about the printer"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   744
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   745
    ^ self
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   746
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   747
    "Modified: 18.5.1996 / 08:55:10 / cg"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   748
    "Created: 8.6.1996 / 08:15:12 / cg"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   749
! !
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   750
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   751
!PrinterStream methodsFor:'font change'!
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   752
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   753
courier
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   754
    "set font to courier 
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   755
     - ignore here, since this class does not know anything about the printer"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   756
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   757
    ^ self
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   758
!
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   759
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   760
helvetica
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   761
    "set font to helvetic
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   762
     - ignore here, since this class does not know anything about the printer"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   763
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   764
    ^ self
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   765
!
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   766
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   767
times
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   768
    "set font to times 
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   769
     - ignore here, since this class does not know anything about the printer"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   770
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   771
    ^ self
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   772
! !
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   773
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   774
!PrinterStream methodsFor:'helpers writing'!
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   775
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   776
escape:aCharacter
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   777
    "since its so common, this method sends escape followed by aCharacter"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   778
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   779
    stream nextPut:(Character esc); nextPut:aCharacter
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   780
!
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   781
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   782
escapeAll:aString
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   783
    "since its so common, this method sends escape followed by aString"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   784
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   785
    stream nextPut:(Character esc); nextPutAll:aString
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   786
! !
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   787
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   788
!PrinterStream methodsFor:'initialization'!
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   789
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   790
initialize
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   791
    native := false.
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   792
    pageFormat := DefaultPageFormat.
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   793
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   794
    "Created: 31.5.1996 / 20:14:36 / cg"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   795
!
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   796
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   797
printCommand
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   798
    ^ self class printCommand
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   799
!
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   800
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   801
printJobName:aString
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   802
    "ignored here - some subclass might implement this"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   803
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   804
    "Created: / 10-10-2006 / 18:52:29 / cg"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   805
!
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   806
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   807
stream:aStream
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   808
    stream notNil ifTrue:[
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   809
        self error
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   810
    ].
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   811
    stream := aStream.
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   812
! !
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   813
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   814
!PrinterStream methodsFor:'open / close'!
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   815
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   816
basicClose
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   817
    stream close
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   818
!
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   819
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   820
close
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   821
    self endPrint.
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   822
    stream notNil ifTrue:[ stream close ]
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   823
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   824
    "Modified: / 12-10-2006 / 14:58:43 / User"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   825
!
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   826
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   827
endPrint
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   828
    ^ self
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   829
!
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   830
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   831
setNative
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   832
    self setNative:true
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   833
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   834
!
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   835
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   836
setNative:aBoolean
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   837
    native := aBoolean
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   838
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   839
    "Created: 30.5.1996 / 17:49:09 / cg"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   840
!
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   841
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   842
startPrint
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   843
    stream isNil ifTrue:[
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   844
        stream := PipeStream basicNew.
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   845
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   846
        stream
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   847
            openPipeFor:(self class printCommand) 
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   848
            withMode:'w' 
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   849
            errorDisposition:#stderr 
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   850
            inDirectory:nil.
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   851
    ].
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   852
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   853
    "Modified: / 26.5.1999 / 16:14:57 / cg"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   854
! !
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   855
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   856
!PrinterStream methodsFor:'queries'!
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   857
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   858
bottomMargin
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   859
    ^ self class bottomMargin
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   860
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   861
    "Modified: 3.6.1996 / 10:27:45 / cg"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   862
    "Created: 5.9.1996 / 21:37:26 / cg"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   863
!
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   864
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   865
landscape
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   866
    ^ self class landscape
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   867
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   868
    "Modified: 3.6.1996 / 10:27:45 / cg"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   869
    "Created: 5.9.1996 / 21:38:23 / cg"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   870
!
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   871
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   872
leftMargin
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   873
    ^ self class leftMargin
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   874
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   875
    "Modified: 3.6.1996 / 10:27:45 / cg"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   876
    "Created: 5.9.1996 / 21:38:23 / cg"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   877
!
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   878
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   879
lineLength
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   880
    "the printer pages width (in characters)"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   881
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   882
    ^ 80
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   883
!
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   884
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   885
pageFormat
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   886
    ^ self class pageFormat
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   887
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   888
    "Modified: 3.6.1996 / 10:27:45 / cg"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   889
!
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   890
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   891
printerContext
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   892
    ^ nil
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   893
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   894
    "Created: / 31-01-2012 / 18:15:03 / cg"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   895
!
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   896
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   897
rightMargin
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   898
    ^ self class rightMargin
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   899
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   900
    "Modified: 3.6.1996 / 10:27:45 / cg"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   901
    "Created: 5.9.1996 / 21:38:23 / cg"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   902
!
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   903
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   904
supportsColor
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   905
    "return true if this is a color printer"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   906
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   907
    ^ self class supportsColor
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   908
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   909
    "Created: 3.6.1996 / 18:00:27 / cg"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   910
!
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   911
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   912
supportsContext
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   913
    ^ self class supportsContext
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   914
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   915
    "Created: / 31-01-2012 / 18:15:29 / cg"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   916
!
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   917
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   918
supportsGreyscale
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   919
    ^ self class supportsGreyscale
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   920
!
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   921
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   922
supportsMargins
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   923
    "return true if this printer supports margin settings (in inches)
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   924
     if not, it supports at least a leftMargin to be specified in columns."
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   925
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   926
    ^ self class supportsMargins
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   927
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   928
    "Created: 3.6.1996 / 17:59:35 / cg"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   929
    "Modified: 3.6.1996 / 18:24:04 / cg"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   930
!
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   931
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   932
supportsPostscript
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   933
    "return true if this is a postscript printer"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   934
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   935
    ^ self class supportsPostscript
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   936
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   937
    "Created: 3.6.1996 / 17:59:58 / cg"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   938
!
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   939
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   940
supportsPrintingToCommand
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   941
    ^ self class supportsPrintingToCommand
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   942
!
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   943
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   944
supportsPrintingToFile
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   945
    ^ self class supportsPrintingToFile
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   946
!
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   947
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   948
topMargin
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   949
    ^ self class topMargin
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   950
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   951
    "Modified: 3.6.1996 / 10:27:45 / cg"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   952
    "Created: 5.9.1996 / 21:40:32 / cg"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   953
! !
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   954
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   955
!PrinterStream methodsFor:'testing'!
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   956
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   957
isPrinterStream
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   958
    "return true, if this is a printerStream.
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   959
     Always true here."
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   960
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   961
    ^ true
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   962
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   963
    "Created: 3.6.1996 / 12:06:21 / cg"
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   964
! !
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   965
27f9e6b6e7b5 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   966
!PrinterStream methodsFor:'writing'!
126
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   967
1318
08099feb92d2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
   968
flush
08099feb92d2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
   969
    stream flush
08099feb92d2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
   970
!
08099feb92d2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1317
diff changeset
   971
221
7bc2c2d89ede added native setting (suppress trailer in PS-subclass)
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
   972
next:count put:aCharacter
7bc2c2d89ede added native setting (suppress trailer in PS-subclass)
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
   973
    "send some character multiple times to the printer - translate as needed.
7bc2c2d89ede added native setting (suppress trailer in PS-subclass)
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
   974
     Redefined to allow individual character translation in subclasses"
7bc2c2d89ede added native setting (suppress trailer in PS-subclass)
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
   975
7bc2c2d89ede added native setting (suppress trailer in PS-subclass)
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
   976
    count timesRepeat:[
1109
3dd9d0a420a1 Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents: 1107
diff changeset
   977
        self nextPut:aCharacter
221
7bc2c2d89ede added native setting (suppress trailer in PS-subclass)
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
   978
    ]
7bc2c2d89ede added native setting (suppress trailer in PS-subclass)
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
   979
7bc2c2d89ede added native setting (suppress trailer in PS-subclass)
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
   980
    "Created: 10.4.1996 / 13:08:13 / cg"
7bc2c2d89ede added native setting (suppress trailer in PS-subclass)
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
   981
    "Modified: 10.4.1996 / 13:09:06 / cg"
126
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   982
!
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   983
1317
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   984
nextPut:aCharacter
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   985
    "send a character to the printer"
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   986
1622
8d855c16aab3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1318
diff changeset
   987
    self nextPutUntranslated:aCharacter
1317
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   988
!
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   989
126
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   990
nextPutAll:aCollection
348
e4790af5d077 comments & category rename
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   991
    "send some characters to the printer - translate as needed.
e4790af5d077 comments & category rename
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   992
     The argument, aCollection can be a Text (i.e. include emphasis)"
126
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
   993
2050
bf12f977da5f Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 1991
diff changeset
   994
    native ifTrue:[
1317
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   995
        stream nextPutAll:aCollection.
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
   996
        ^ self.
913
99228537653d Speed up native printing: #nextPutAll
Stefan Vogel <sv@exept.de>
parents: 879
diff changeset
   997
    ].
99228537653d Speed up native printing: #nextPutAll
Stefan Vogel <sv@exept.de>
parents: 879
diff changeset
   998
348
e4790af5d077 comments & category rename
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
   999
    aCollection hasChangeOfEmphasis ifTrue:[
2050
bf12f977da5f Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 1991
diff changeset
  1000
        self nextPutAllText:aCollection.
348
e4790af5d077 comments & category rename
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
  1001
    ] ifFalse:[
2050
bf12f977da5f Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 1991
diff changeset
  1002
        aCollection do:[:eachChar |
bf12f977da5f Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 1991
diff changeset
  1003
            self nextPut:eachChar
392
bf31405a1f65 bold & italic & strikeout
ca
parents: 390
diff changeset
  1004
        ]
126
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
  1005
    ]
348
e4790af5d077 comments & category rename
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
  1006
1076
4bb0e9411317 Define #nextPutAll:startingAt:to: to fix Text>>printOn:aPrinterStream
Stefan Vogel <sv@exept.de>
parents: 914
diff changeset
  1007
    "Modified: 3.6.1996 / 17:12:31 / cg"
4bb0e9411317 Define #nextPutAll:startingAt:to: to fix Text>>printOn:aPrinterStream
Stefan Vogel <sv@exept.de>
parents: 914
diff changeset
  1008
!
4bb0e9411317 Define #nextPutAll:startingAt:to: to fix Text>>printOn:aPrinterStream
Stefan Vogel <sv@exept.de>
parents: 914
diff changeset
  1009
4bb0e9411317 Define #nextPutAll:startingAt:to: to fix Text>>printOn:aPrinterStream
Stefan Vogel <sv@exept.de>
parents: 914
diff changeset
  1010
nextPutAll:aCollection startingAt:first to:last
4bb0e9411317 Define #nextPutAll:startingAt:to: to fix Text>>printOn:aPrinterStream
Stefan Vogel <sv@exept.de>
parents: 914
diff changeset
  1011
    "append the elements with index from first to last
4bb0e9411317 Define #nextPutAll:startingAt:to: to fix Text>>printOn:aPrinterStream
Stefan Vogel <sv@exept.de>
parents: 914
diff changeset
  1012
     of the argument, aCollection onto the receiver.
4bb0e9411317 Define #nextPutAll:startingAt:to: to fix Text>>printOn:aPrinterStream
Stefan Vogel <sv@exept.de>
parents: 914
diff changeset
  1013
     This is only allowed, if the receiver supports writing."
4bb0e9411317 Define #nextPutAll:startingAt:to: to fix Text>>printOn:aPrinterStream
Stefan Vogel <sv@exept.de>
parents: 914
diff changeset
  1014
4bb0e9411317 Define #nextPutAll:startingAt:to: to fix Text>>printOn:aPrinterStream
Stefan Vogel <sv@exept.de>
parents: 914
diff changeset
  1015
    aCollection from:first to:last do:[:element |
4bb0e9411317 Define #nextPutAll:startingAt:to: to fix Text>>printOn:aPrinterStream
Stefan Vogel <sv@exept.de>
parents: 914
diff changeset
  1016
        self nextPut:element
4bb0e9411317 Define #nextPutAll:startingAt:to: to fix Text>>printOn:aPrinterStream
Stefan Vogel <sv@exept.de>
parents: 914
diff changeset
  1017
    ].
4bb0e9411317 Define #nextPutAll:startingAt:to: to fix Text>>printOn:aPrinterStream
Stefan Vogel <sv@exept.de>
parents: 914
diff changeset
  1018
    ^ aCollection
4bb0e9411317 Define #nextPutAll:startingAt:to: to fix Text>>printOn:aPrinterStream
Stefan Vogel <sv@exept.de>
parents: 914
diff changeset
  1019
!
126
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
  1020
2050
bf12f977da5f Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 1991
diff changeset
  1021
nextPutAllText:aText
bf12f977da5f Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 1991
diff changeset
  1022
    "send some characters to the printer - translate as needed.
bf12f977da5f Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 1991
diff changeset
  1023
     The argument is a String or Text (i.e. includes emphasis)"
bf12f977da5f Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 1991
diff changeset
  1024
bf12f977da5f Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 1991
diff changeset
  1025
    |lastE|
bf12f977da5f Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 1991
diff changeset
  1026
bf12f977da5f Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 1991
diff changeset
  1027
    native ifTrue:[
bf12f977da5f Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 1991
diff changeset
  1028
        stream nextPutAllText:aText.
bf12f977da5f Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 1991
diff changeset
  1029
        ^ self.
bf12f977da5f Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 1991
diff changeset
  1030
    ].
bf12f977da5f Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 1991
diff changeset
  1031
bf12f977da5f Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 1991
diff changeset
  1032
    lastE := 42.    "initialize to something that is not a valid emphasis"
bf12f977da5f Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 1991
diff changeset
  1033
bf12f977da5f Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 1991
diff changeset
  1034
    aText keysAndValuesDo:[:idx :aChar |
bf12f977da5f Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 1991
diff changeset
  1035
        |e|
bf12f977da5f Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 1991
diff changeset
  1036
bf12f977da5f Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 1991
diff changeset
  1037
        e := aText emphasisAt:idx.
bf12f977da5f Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 1991
diff changeset
  1038
        lastE ~~ e ifTrue:[
bf12f977da5f Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 1991
diff changeset
  1039
            self emphasis:e.
bf12f977da5f Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 1991
diff changeset
  1040
            lastE := e.
bf12f977da5f Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 1991
diff changeset
  1041
        ].
bf12f977da5f Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 1991
diff changeset
  1042
        self nextPut:aChar.
bf12f977da5f Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 1991
diff changeset
  1043
    ].
bf12f977da5f Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 1991
diff changeset
  1044
    self emphasis:nil.
bf12f977da5f Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 1991
diff changeset
  1045
bf12f977da5f Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 1991
diff changeset
  1046
    "Modified: 3.6.1996 / 17:12:31 / cg"
bf12f977da5f Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 1991
diff changeset
  1047
!
bf12f977da5f Unicode handling:
Stefan Vogel <sv@exept.de>
parents: 1991
diff changeset
  1048
126
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
  1049
nextPutAllUntranslated:aCollection
221
7bc2c2d89ede added native setting (suppress trailer in PS-subclass)
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
  1050
    "send some raw characters to the printer - even if not in native mode"
126
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
  1051
1317
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
  1052
    stream nextPutAll:aCollection
221
7bc2c2d89ede added native setting (suppress trailer in PS-subclass)
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
  1053
7bc2c2d89ede added native setting (suppress trailer in PS-subclass)
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
  1054
    "Modified: 10.4.1996 / 13:08:35 / cg"
126
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
  1055
!
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
  1056
468
7f0c61edae54 must also catch nextPutLine:
Claus Gittinger <cg@exept.de>
parents: 456
diff changeset
  1057
nextPutLine:aCollection
7f0c61edae54 must also catch nextPutLine:
Claus Gittinger <cg@exept.de>
parents: 456
diff changeset
  1058
    self nextPutAll:aCollection.
7f0c61edae54 must also catch nextPutLine:
Claus Gittinger <cg@exept.de>
parents: 456
diff changeset
  1059
    self cr
7f0c61edae54 must also catch nextPutLine:
Claus Gittinger <cg@exept.de>
parents: 456
diff changeset
  1060
7f0c61edae54 must also catch nextPutLine:
Claus Gittinger <cg@exept.de>
parents: 456
diff changeset
  1061
    "Created: 3.1.1997 / 19:43:56 / cg"
7f0c61edae54 must also catch nextPutLine:
Claus Gittinger <cg@exept.de>
parents: 456
diff changeset
  1062
!
7f0c61edae54 must also catch nextPutLine:
Claus Gittinger <cg@exept.de>
parents: 456
diff changeset
  1063
126
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
  1064
nextPutUntranslated:aCharacter
221
7bc2c2d89ede added native setting (suppress trailer in PS-subclass)
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
  1065
    "send a raw character to the printer - even if not in native mode"
126
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
  1066
1317
890b41076c7c changed inheritance;
Claus Gittinger <cg@exept.de>
parents: 1220
diff changeset
  1067
    stream nextPut:aCharacter
221
7bc2c2d89ede added native setting (suppress trailer in PS-subclass)
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
  1068
7bc2c2d89ede added native setting (suppress trailer in PS-subclass)
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
  1069
    "Modified: 10.4.1996 / 13:08:28 / cg"
7bc2c2d89ede added native setting (suppress trailer in PS-subclass)
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
  1070
! !
0
1cf8d1747859 Initial revision
claus
parents:
diff changeset
  1071
456
37b86d48d290 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 443
diff changeset
  1072
!PrinterStream class methodsFor:'documentation'!
186
bc1b056b097c added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1073
bc1b056b097c added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1074
version
3318
01dca72063e2 class: PrinterStream
Claus Gittinger <cg@exept.de>
parents: 3280
diff changeset
  1075
    ^ '$Header: /cvs/stx/stx/libbasic2/PrinterStream.st,v 1.76 2014-07-09 03:08:14 cg Exp $'
186
bc1b056b097c added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1076
! !
1107
8ea38fa19bd6 ghostview -> gv
ca
parents: 1076
diff changeset
  1077
2969
ac9ce708b061 lazy initialization
Claus Gittinger <cg@exept.de>
parents: 2863
diff changeset
  1078
126
fca9404da9d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 112
diff changeset
  1079
PrinterStream initialize!