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