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