author | Claus Gittinger <cg@exept.de> |
Mon, 19 May 2003 11:44:22 +0200 | |
changeset 1220 | 33fa58c0596d |
parent 1109 | 3dd9d0a420a1 |
child 1317 | 890b41076c7c |
permissions | -rw-r--r-- |
0 | 1 |
" |
4 | 2 |
COPYRIGHT (c) 1990 by Claus Gittinger |
1109
3dd9d0a420a1
Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents:
1107
diff
changeset
|
3 |
All Rights Reserved |
0 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
913
99228537653d
Speed up native printing: #nextPutAll
Stefan Vogel <sv@exept.de>
parents:
879
diff
changeset
|
13 |
"{ Package: 'stx:libbasic2' }" |
99228537653d
Speed up native printing: #nextPutAll
Stefan Vogel <sv@exept.de>
parents:
879
diff
changeset
|
14 |
|
0 | 15 |
PipeStream subclass:#PrinterStream |
1220 | 16 |
instanceVariableNames:'native pageFormat underline strikeout' |
17 |
classVariableNames:'DefaultPageFormat' |
|
18 |
poolDictionaries:'' |
|
19 |
category:'Streams-External' |
|
0 | 20 |
! |
21 |
||
627 | 22 |
PrinterStream class instanceVariableNames:'PrintCommand DefaultCommands PageFormat DefaultPageFormats Landscape |
1220 | 23 |
PrintDevice DefaultDevices' |
627 | 24 |
|
25 |
" |
|
879 | 26 |
No other class instance variables are inherited by this class. |
627 | 27 |
" |
370 | 28 |
! |
29 |
||
456 | 30 |
!PrinterStream class methodsFor:'documentation'! |
31 | 31 |
|
32 |
copyright |
|
33 |
" |
|
34 |
COPYRIGHT (c) 1990 by Claus Gittinger |
|
1109
3dd9d0a420a1
Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents:
1107
diff
changeset
|
35 |
All Rights Reserved |
0 | 36 |
|
31 | 37 |
This software is furnished under a license and may be used |
38 |
only in accordance with the terms of that license and with the |
|
39 |
inclusion of the above copyright notice. This software may not |
|
40 |
be provided or otherwise made available to, or used by, any |
|
41 |
other person. No title to or ownership of the software is |
|
42 |
hereby transferred. |
|
43 |
" |
|
44 |
! |
|
0 | 45 |
|
31 | 46 |
documentation |
47 |
" |
|
48 |
a stream for printing; this (concrete or abstract) class can handle only |
|
348 | 49 |
very dumb printers. |
50 |
No attributes (italic, bold etc) and no multiple fonts are supported |
|
51 |
- just plain single font text printing. |
|
179
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
160
diff
changeset
|
52 |
|
38773360f4b7
more on printing (printerType-query)
Claus Gittinger <cg@exept.de>
parents:
160
diff
changeset
|
53 |
More intelligence is added by subclasses (see PostscriptPrinterStream among others.) |
211 | 54 |
|
55 |
These classes do not support graphics printing - they are only for |
|
56 |
text; although some limited font functionality (such as bold or italic printing) |
|
57 |
may be supported by some subclasses. |
|
58 |
||
348 | 59 |
|
60 |
[usage:] |
|
61 |
||
211 | 62 |
The concrete printer class is bound to the global variable Printer, |
235 | 63 |
which is either set to PrinterStream (for dumb printers) or to one of |
211 | 64 |
the subclasses (PostscriptPrinterStream etc.). |
65 |
||
66 |
To print: |
|
67 |
||
1109
3dd9d0a420a1
Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents:
1107
diff
changeset
|
68 |
|p| |
211 | 69 |
|
1109
3dd9d0a420a1
Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents:
1107
diff
changeset
|
70 |
p := Printer new. |
3dd9d0a420a1
Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents:
1107
diff
changeset
|
71 |
p notNil ifTrue:[ |
3dd9d0a420a1
Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents:
1107
diff
changeset
|
72 |
p nextPutAll:'hello world'; cr. |
3dd9d0a420a1
Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents:
1107
diff
changeset
|
73 |
p nextPutAll:' ...'; cr. |
3dd9d0a420a1
Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents:
1107
diff
changeset
|
74 |
p close |
3dd9d0a420a1
Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents:
1107
diff
changeset
|
75 |
]. |
211 | 76 |
|
77 |
See users of the Printer global variable for more examples. |
|
259 | 78 |
|
348 | 79 |
[class variables:] |
1109
3dd9d0a420a1
Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents:
1107
diff
changeset
|
80 |
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
|
81 |
Usually something like 'lp' or 'lpr' |
348 | 82 |
|
1109
3dd9d0a420a1
Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents:
1107
diff
changeset
|
83 |
PrintDevice <String> VMS only: the printers device. |
3dd9d0a420a1
Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents:
1107
diff
changeset
|
84 |
Usually something like 'sys$print:' |
571 | 85 |
|
259 | 86 |
[author:] |
1109
3dd9d0a420a1
Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents:
1107
diff
changeset
|
87 |
Claus Gittinger |
31 | 88 |
" |
89 |
! ! |
|
0 | 90 |
|
456 | 91 |
!PrinterStream class methodsFor:'initialization'! |
0 | 92 |
|
93 |
initialize |
|
94 |
"this is usually redefined by the startup-file" |
|
95 |
||
569 | 96 |
OperatingSystem isUNIXlike ifTrue:[ |
97 |
DefaultCommands isNil ifTrue:[ |
|
98 |
DefaultCommands := #( |
|
99 |
'lpr' |
|
100 |
'lpr -P<your-printer>' |
|
1109
3dd9d0a420a1
Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents:
1107
diff
changeset
|
101 |
'rsh <printHost> lpr -h' |
3dd9d0a420a1
Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents:
1107
diff
changeset
|
102 |
'cat >preview.ps ; gv preview.ps' |
3dd9d0a420a1
Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents:
1107
diff
changeset
|
103 |
'cat >printfile' |
3dd9d0a420a1
Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents:
1107
diff
changeset
|
104 |
'gs -q -DNOPAUSE -sDEVICE=pdfwrite -sOutputFile=/tmp/preview.pdf -' |
569 | 105 |
'a2ps' |
106 |
'a2ps | rsh <printHost> lpr -h' |
|
1109
3dd9d0a420a1
Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents:
1107
diff
changeset
|
107 |
'a2ps >printfile' |
569 | 108 |
). |
109 |
]. |
|
370 | 110 |
|
569 | 111 |
PrintCommand isNil ifTrue:[ |
112 |
(OperatingSystem canExecuteCommand:'lpr') ifTrue:[ |
|
113 |
PrintCommand := 'lpr' |
|
114 |
] ifFalse:[ |
|
115 |
PrintCommand := 'lp' |
|
116 |
] |
|
1107 | 117 |
] |
0 | 118 |
]. |
571 | 119 |
OperatingSystem isVMSlike ifTrue:[ |
120 |
DefaultDevices isNil ifTrue:[ |
|
121 |
DefaultDevices := #( |
|
122 |
'sys$print:' |
|
123 |
). |
|
124 |
]. |
|
125 |
||
126 |
PrintDevice isNil ifTrue:[ |
|
127 |
PrintDevice := 'sys$print:' |
|
128 |
] |
|
129 |
]. |
|
367 | 130 |
|
131 |
DefaultPageFormats isNil ifTrue:[ |
|
571 | 132 |
"/ UnitConverter must support all of them. |
442 | 133 |
self defaultPageFormats:#( |
134 |
'a3' |
|
135 |
'a4' |
|
136 |
'a5' |
|
137 |
'a6' |
|
138 |
'b5' |
|
1109
3dd9d0a420a1
Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents:
1107
diff
changeset
|
139 |
'letter' |
3dd9d0a420a1
Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents:
1107
diff
changeset
|
140 |
'legal' |
3dd9d0a420a1
Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents:
1107
diff
changeset
|
141 |
'ledger' |
442 | 142 |
). |
367 | 143 |
]. |
144 |
||
145 |
Landscape isNil ifTrue:[ |
|
442 | 146 |
Landscape := false |
367 | 147 |
]. |
148 |
||
149 |
PageFormat isNil ifTrue:[ |
|
442 | 150 |
Language == #us ifTrue:[ |
151 |
PageFormat := #letter |
|
152 |
] ifFalse:[ |
|
153 |
PageFormat := #a4 |
|
154 |
] |
|
0 | 155 |
] |
367 | 156 |
|
157 |
" |
|
386 | 158 |
DefaultPageFormats := nil. |
1109
3dd9d0a420a1
Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents:
1107
diff
changeset
|
159 |
DefaultCommands := nil. |
442 | 160 |
PrintCommand := nil. |
367 | 161 |
PrinterStream initialize |
162 |
" |
|
370 | 163 |
|
386 | 164 |
"Modified: 4.6.1996 / 17:16:32 / cg" |
373 | 165 |
! |
166 |
||
167 |
reInitPage |
|
168 |
"nothing done here" |
|
169 |
||
170 |
"Created: 1.6.1996 / 00:49:40 / cg" |
|
2 | 171 |
! ! |
172 |
||
456 | 173 |
!PrinterStream class methodsFor:'instance creation'! |
0 | 174 |
|
175 |
new |
|
176 |
"return a new stream for printing" |
|
177 |
||
367 | 178 |
^ self basicNew initialize startPrint |
160 | 179 |
! |
180 |
||
181 |
newNative |
|
182 |
"return a new stream for untranslated printing |
|
183 |
(i.e. text should be sent via nextPutUntranslated in the printers |
|
184 |
native format)" |
|
185 |
||
1076
4bb0e9411317
Define #nextPutAll:startingAt:to: to fix Text>>printOn:aPrinterStream
Stefan Vogel <sv@exept.de>
parents:
914
diff
changeset
|
186 |
^ self basicNew initialize setNative; startPrint. |
4bb0e9411317
Define #nextPutAll:startingAt:to: to fix Text>>printOn:aPrinterStream
Stefan Vogel <sv@exept.de>
parents:
914
diff
changeset
|
187 |
! ! |
0 | 188 |
|
1220 | 189 |
!PrinterStream class methodsFor:'accessing-defaults'! |
0 | 190 |
|
433
2b5b9df0981c
renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents:
392
diff
changeset
|
191 |
bottomMargin |
2b5b9df0981c
renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents:
392
diff
changeset
|
192 |
"return the bottomMargin (in inches). Here, no margin is supported, |
378 | 193 |
but its redefined in some printer classes" |
194 |
||
195 |
^ 0 |
|
196 |
||
433
2b5b9df0981c
renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents:
392
diff
changeset
|
197 |
"Created: 5.9.1996 / 21:37:49 / cg" |
378 | 198 |
! |
199 |
||
247
d1e5c0187e59
keep defaultCommands in a classVar
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
200 |
defaultCommands |
571 | 201 |
"UNIX only: |
202 |
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
|
203 |
(in the launchers printer configuration). |
d1e5c0187e59
keep defaultCommands in a classVar
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
204 |
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
|
205 |
PrinterStream defaultCommands:#( ... )" |
247
d1e5c0187e59
keep defaultCommands in a classVar
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
206 |
|
370 | 207 |
DefaultCommands isNil ifTrue:[ |
1109
3dd9d0a420a1
Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents:
1107
diff
changeset
|
208 |
self == PrinterStream ifFalse:[ |
3dd9d0a420a1
Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents:
1107
diff
changeset
|
209 |
^ self superclass defaultCommands |
3dd9d0a420a1
Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents:
1107
diff
changeset
|
210 |
] |
370 | 211 |
]. |
247
d1e5c0187e59
keep defaultCommands in a classVar
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
212 |
^ DefaultCommands |
d1e5c0187e59
keep defaultCommands in a classVar
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
213 |
|
d1e5c0187e59
keep defaultCommands in a classVar
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
214 |
"Created: 23.4.1996 / 18:25:18 / cg" |
d1e5c0187e59
keep defaultCommands in a classVar
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
215 |
! |
d1e5c0187e59
keep defaultCommands in a classVar
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
216 |
|
d1e5c0187e59
keep defaultCommands in a classVar
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
217 |
defaultCommands:collectionOfCommandStrings |
571 | 218 |
"UNIX only: |
219 |
set the list which will be presented as possible commands for printing. |
|
367 | 220 |
(shown in in the launchers printer configuration). |
247
d1e5c0187e59
keep defaultCommands in a classVar
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
221 |
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
|
222 |
PrinterStream defaultCommands:#( ... )" |
247
d1e5c0187e59
keep defaultCommands in a classVar
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
223 |
|
d1e5c0187e59
keep defaultCommands in a classVar
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
224 |
DefaultCommands := collectionOfCommandStrings |
d1e5c0187e59
keep defaultCommands in a classVar
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
225 |
|
d1e5c0187e59
keep defaultCommands in a classVar
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
226 |
"Created: 23.4.1996 / 18:26:06 / cg" |
d1e5c0187e59
keep defaultCommands in a classVar
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
227 |
! |
d1e5c0187e59
keep defaultCommands in a classVar
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
228 |
|
571 | 229 |
defaultDevices |
230 |
"VMS only: |
|
231 |
return a list presented as possible devices for printers. |
|
232 |
(in the launchers printer configuration). |
|
233 |
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
|
234 |
PrinterStream defaultDevices:#( ... )" |
571 | 235 |
|
236 |
DefaultDevices isNil ifTrue:[ |
|
1109
3dd9d0a420a1
Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents:
1107
diff
changeset
|
237 |
self == PrinterStream ifFalse:[ |
3dd9d0a420a1
Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents:
1107
diff
changeset
|
238 |
^ self superclass defaultDevices |
3dd9d0a420a1
Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents:
1107
diff
changeset
|
239 |
] |
571 | 240 |
]. |
241 |
^ DefaultDevices |
|
242 |
! |
|
243 |
||
244 |
defaultDevices:collectionOfDeviceNameStrings |
|
245 |
"VMS only: |
|
246 |
set the list which will be presented as possible devices for printing. |
|
247 |
(shown in in the launchers printer configuration). |
|
248 |
This can be done from the startup script with: |
|
249 |
PrinterStream defaultDevices:#( ... )" |
|
250 |
||
251 |
DefaultDevices := collectionOfDeviceNameStrings |
|
252 |
! |
|
253 |
||
367 | 254 |
defaultPageFormats |
443
2c85dbf33207
Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents:
442
diff
changeset
|
255 |
"return a list of supported page formats. |
367 | 256 |
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
|
257 |
PrinterStream defaultPageFormats:#( ... )" |
367 | 258 |
|
370 | 259 |
DefaultPageFormats isNil ifTrue:[ |
443
2c85dbf33207
Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents:
442
diff
changeset
|
260 |
self == PrinterStream ifFalse:[ |
2c85dbf33207
Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents:
442
diff
changeset
|
261 |
^ self superclass defaultPageFormats |
2c85dbf33207
Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents:
442
diff
changeset
|
262 |
] |
370 | 263 |
]. |
367 | 264 |
^ DefaultPageFormats |
265 |
||
266 |
"Created: 23.4.1996 / 18:25:18 / cg" |
|
443
2c85dbf33207
Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents:
442
diff
changeset
|
267 |
"Modified: 11.9.1996 / 11:17:44 / stefan" |
367 | 268 |
! |
269 |
||
270 |
defaultPageFormats:aList |
|
443
2c85dbf33207
Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents:
442
diff
changeset
|
271 |
"set the list of supported page formats. |
367 | 272 |
(shown in in the launchers printer configuration). |
273 |
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
|
274 |
PrinterStream defaultPageFormats:#( ... ). |
2c85dbf33207
Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents:
442
diff
changeset
|
275 |
All symbols must be known by UnitConverter" |
367 | 276 |
|
277 |
DefaultPageFormats := aList. |
|
278 |
||
279 |
"/ validate the list |
|
280 |
aList do:[:name | |
|
443
2c85dbf33207
Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents:
442
diff
changeset
|
281 |
|unit ok| |
367 | 282 |
|
443
2c85dbf33207
Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents:
442
diff
changeset
|
283 |
ok := true. |
2c85dbf33207
Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents:
442
diff
changeset
|
284 |
#('W' 'H' 'lW' 'lH') do:[:what | |
2c85dbf33207
Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents:
442
diff
changeset
|
285 |
unit := (name , what) asSymbolIfInterned. |
2c85dbf33207
Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents:
442
diff
changeset
|
286 |
(unit isNil |
2c85dbf33207
Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents:
442
diff
changeset
|
287 |
or:[(UnitConverter convert:1 from:unit to:#millimeter) isNil]) ifTrue:[ |
2c85dbf33207
Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents:
442
diff
changeset
|
288 |
ok := false |
2c85dbf33207
Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents:
442
diff
changeset
|
289 |
] |
2c85dbf33207
Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents:
442
diff
changeset
|
290 |
]. |
2c85dbf33207
Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents:
442
diff
changeset
|
291 |
ok ifFalse:[ |
2c85dbf33207
Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents:
442
diff
changeset
|
292 |
('PRINTER: UnitConverter has no size-info for ''' , name , '''-format') errorPrintCR |
2c85dbf33207
Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents:
442
diff
changeset
|
293 |
] |
367 | 294 |
]. |
295 |
||
296 |
" |
|
297 |
PrinterStream |
|
443
2c85dbf33207
Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents:
442
diff
changeset
|
298 |
defaultPageFormats:#( |
2c85dbf33207
Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents:
442
diff
changeset
|
299 |
'letter' |
2c85dbf33207
Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents:
442
diff
changeset
|
300 |
'a4' |
2c85dbf33207
Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents:
442
diff
changeset
|
301 |
'a5' |
2c85dbf33207
Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents:
442
diff
changeset
|
302 |
'a6' |
2c85dbf33207
Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents:
442
diff
changeset
|
303 |
) |
367 | 304 |
" |
305 |
||
306 |
"Created: 23.4.1996 / 18:25:18 / cg" |
|
443
2c85dbf33207
Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents:
442
diff
changeset
|
307 |
"Modified: 11.9.1996 / 11:19:01 / stefan" |
367 | 308 |
! |
309 |
||
310 |
landscape |
|
311 |
"return the landscape setting" |
|
312 |
||
370 | 313 |
Landscape isNil ifTrue:[ |
1109
3dd9d0a420a1
Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents:
1107
diff
changeset
|
314 |
self == PrinterStream ifFalse:[ |
3dd9d0a420a1
Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents:
1107
diff
changeset
|
315 |
^ self superclass landscape |
3dd9d0a420a1
Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents:
1107
diff
changeset
|
316 |
] |
370 | 317 |
]. |
367 | 318 |
^ Landscape |
319 |
! |
|
320 |
||
321 |
landscape:aBoolean |
|
322 |
"set/clear landscape printing" |
|
323 |
||
373 | 324 |
Landscape := aBoolean. |
325 |
self reInitPage. |
|
326 |
||
327 |
"Modified: 1.6.1996 / 00:49:22 / cg" |
|
367 | 328 |
! |
329 |
||
433
2b5b9df0981c
renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents:
392
diff
changeset
|
330 |
leftMargin |
2b5b9df0981c
renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents:
392
diff
changeset
|
331 |
"return the leftMargin (in inches). Here, no margin is supported, |
378 | 332 |
but its redefined in some printer classes" |
333 |
||
334 |
^ 0 |
|
335 |
||
433
2b5b9df0981c
renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents:
392
diff
changeset
|
336 |
"Created: 5.9.1996 / 21:37:49 / cg" |
2b5b9df0981c
renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents:
392
diff
changeset
|
337 |
"Modified: 5.9.1996 / 21:39:55 / cg" |
0 | 338 |
! |
339 |
||
367 | 340 |
pageFormat |
341 |
"return a symbol describing the default page format. |
|
443
2c85dbf33207
Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents:
442
diff
changeset
|
342 |
This can be set from the startup script with: |
2c85dbf33207
Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents:
442
diff
changeset
|
343 |
PrinterStream pageFormat:#... |
367 | 344 |
or via the launchers settings menu." |
345 |
||
370 | 346 |
PageFormat isNil ifTrue:[ |
443
2c85dbf33207
Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents:
442
diff
changeset
|
347 |
self == PrinterStream ifFalse:[ |
2c85dbf33207
Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents:
442
diff
changeset
|
348 |
^ self superclass pageFormat |
2c85dbf33207
Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents:
442
diff
changeset
|
349 |
] |
370 | 350 |
]. |
367 | 351 |
^ PageFormat |
352 |
||
353 |
"Created: 23.4.1996 / 18:25:18 / cg" |
|
443
2c85dbf33207
Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents:
442
diff
changeset
|
354 |
"Modified: 11.9.1996 / 11:16:51 / stefan" |
367 | 355 |
! |
356 |
||
357 |
pageFormat:aSymbol |
|
358 |
"set the the default page format to be aSymbol. |
|
359 |
Valid symbols are #letter, #a4, #a5 etc. |
|
360 |
The UnitConverter must contain width/height information on |
|
361 |
that symbol, in order for printing to be correct. |
|
443
2c85dbf33207
Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents:
442
diff
changeset
|
362 |
" |
367 | 363 |
|
373 | 364 |
PageFormat := aSymbol. |
365 |
self reInitPage. |
|
367 | 366 |
|
367 |
"Created: 23.4.1996 / 18:25:18 / cg" |
|
373 | 368 |
"Modified: 1.6.1996 / 00:49:06 / cg" |
443
2c85dbf33207
Fix documentation (mostly typos).
Stefan Vogel <sv@exept.de>
parents:
442
diff
changeset
|
369 |
"Modified: 11.9.1996 / 11:16:04 / stefan" |
367 | 370 |
! |
371 |
||
186
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
372 |
printCommand |
571 | 373 |
"UNIX only: |
374 |
return the command used for printing (usually 'lp' or 'lpr'). |
|
367 | 375 |
This is either set from the startup file, or via the launchers |
376 |
settings menu." |
|
186
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
377 |
|
370 | 378 |
PrintCommand isNil ifTrue:[ |
1109
3dd9d0a420a1
Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents:
1107
diff
changeset
|
379 |
self == PrinterStream ifFalse:[ |
3dd9d0a420a1
Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents:
1107
diff
changeset
|
380 |
^ self superclass printCommand |
3dd9d0a420a1
Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents:
1107
diff
changeset
|
381 |
] |
370 | 382 |
]. |
186
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
383 |
^ PrintCommand |
348 | 384 |
|
385 |
"Modified: 18.5.1996 / 09:12:35 / cg" |
|
186
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
386 |
! |
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
387 |
|
126 | 388 |
printCommand:aString |
571 | 389 |
"UNIX only: |
390 |
set the command for printing (usually 'lp' or 'lpr'). |
|
367 | 391 |
This is either set from the startup file, or via the launchers |
392 |
settings menu." |
|
126 | 393 |
|
394 |
PrintCommand := aString |
|
139 | 395 |
|
396 |
" |
|
397 |
PrinterStream printCommand:'lpr' |
|
398 |
PrinterStream printCommand:'lpr -h' |
|
399 |
PrinterStream printCommand:'rsh ibm lpr -h' |
|
400 |
PrinterStream printCommand:'gs -sDEVICE=djet500 -sOutputFile=/tmp/stx.ps -sPAPERSIZE=a4 -q -; cat /tmp/stx.ps | rsh ibm lpr -h' |
|
401 |
" |
|
348 | 402 |
|
403 |
"Modified: 18.5.1996 / 09:12:48 / cg" |
|
378 | 404 |
! |
405 |
||
571 | 406 |
printDevice |
407 |
"VMS only: return the device for printing (usually 'sys$print:') |
|
408 |
This is either set from the startup file, or via the launchers |
|
409 |
settings menu." |
|
410 |
||
411 |
PrintDevice isNil ifTrue:[ |
|
1109
3dd9d0a420a1
Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents:
1107
diff
changeset
|
412 |
self == PrinterStream ifFalse:[ |
3dd9d0a420a1
Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents:
1107
diff
changeset
|
413 |
^ self superclass printDevice |
3dd9d0a420a1
Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents:
1107
diff
changeset
|
414 |
] |
571 | 415 |
]. |
416 |
^ PrintDevice |
|
417 |
! |
|
418 |
||
419 |
printDevice:aString |
|
420 |
"VMS only: |
|
421 |
set the device for printing (usually 'sys$print:'). |
|
422 |
This is either set from the startup file, or via the launchers |
|
423 |
settings menu." |
|
424 |
||
425 |
PrintCommand := aString |
|
426 |
||
427 |
" |
|
428 |
PrinterStream printDevice:'lta1739:' |
|
429 |
" |
|
430 |
! |
|
431 |
||
456 | 432 |
rightMargin |
433 |
"return the rightMargin (in inches). Here, no margin is supported, |
|
434 |
but its redefined in some printer classes" |
|
435 |
||
436 |
^ 0 |
|
437 |
||
438 |
"Modified: 5.9.1996 / 21:39:55 / cg" |
|
439 |
"Created: 6.11.1996 / 15:40:12 / cg" |
|
440 |
! |
|
441 |
||
433
2b5b9df0981c
renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents:
392
diff
changeset
|
442 |
topMargin |
2b5b9df0981c
renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents:
392
diff
changeset
|
443 |
"return the topMargin (in inches). Here, no margin is supported, |
378 | 444 |
but its redefined in some printer classes" |
445 |
||
446 |
^ 0 |
|
447 |
||
433
2b5b9df0981c
renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents:
392
diff
changeset
|
448 |
"Created: 5.9.1996 / 21:40:13 / cg" |
186
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
449 |
! ! |
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
450 |
|
456 | 451 |
!PrinterStream class methodsFor:'queries'! |
186
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
452 |
|
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
453 |
printerTypeName |
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
454 |
"return a descriptive name" |
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
455 |
|
442 | 456 |
^ 'dumb printer (or print filter)' |
235 | 457 |
|
458 |
"Modified: 18.4.1996 / 20:04:12 / cg" |
|
139 | 459 |
! |
460 |
||
383 | 461 |
supportsColor |
462 |
"return true if this is a color printer" |
|
463 |
||
464 |
^ false |
|
465 |
||
466 |
"Created: 3.6.1996 / 18:00:36 / cg" |
|
467 |
! |
|
468 |
||
378 | 469 |
supportsMargins |
383 | 470 |
"return true if this printer supports margin settings (in inches) |
471 |
if not, it supports at least a leftMargin to be specified in columns." |
|
378 | 472 |
|
473 |
^ false |
|
474 |
||
475 |
"Created: 3.6.1996 / 10:47:54 / cg" |
|
383 | 476 |
"Modified: 3.6.1996 / 18:24:20 / cg" |
378 | 477 |
! |
478 |
||
368
423cf3f4e522
added query if printer supports pages at all (only PS does)
Claus Gittinger <cg@exept.de>
parents:
367
diff
changeset
|
479 |
supportsPageSizes |
423cf3f4e522
added query if printer supports pages at all (only PS does)
Claus Gittinger <cg@exept.de>
parents:
367
diff
changeset
|
480 |
"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
|
481 |
|
423cf3f4e522
added query if printer supports pages at all (only PS does)
Claus Gittinger <cg@exept.de>
parents:
367
diff
changeset
|
482 |
^ false |
423cf3f4e522
added query if printer supports pages at all (only PS does)
Claus Gittinger <cg@exept.de>
parents:
367
diff
changeset
|
483 |
|
423cf3f4e522
added query if printer supports pages at all (only PS does)
Claus Gittinger <cg@exept.de>
parents:
367
diff
changeset
|
484 |
"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
|
485 |
! |
423cf3f4e522
added query if printer supports pages at all (only PS does)
Claus Gittinger <cg@exept.de>
parents:
367
diff
changeset
|
486 |
|
186
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
487 |
supportsPostscript |
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
488 |
"return true if this is a postscript printer" |
139 | 489 |
|
186
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
490 |
^ false |
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
491 |
|
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
492 |
"Created: 10.2.1996 / 16:23:07 / cg" |
126 | 493 |
! ! |
0 | 494 |
|
879 | 495 |
!PrinterStream methodsFor:'access-writing'! |
126 | 496 |
|
221
7bc2c2d89ede
added native setting (suppress trailer in PS-subclass)
Claus Gittinger <cg@exept.de>
parents:
211
diff
changeset
|
497 |
next:count put:aCharacter |
7bc2c2d89ede
added native setting (suppress trailer in PS-subclass)
Claus Gittinger <cg@exept.de>
parents:
211
diff
changeset
|
498 |
"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
|
499 |
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
|
500 |
|
7bc2c2d89ede
added native setting (suppress trailer in PS-subclass)
Claus Gittinger <cg@exept.de>
parents:
211
diff
changeset
|
501 |
count timesRepeat:[ |
1109
3dd9d0a420a1
Default entry for pdf file generation.
Stefan Vogel <sv@exept.de>
parents:
1107
diff
changeset
|
502 |
self nextPut:aCharacter |
221
7bc2c2d89ede
added native setting (suppress trailer in PS-subclass)
Claus Gittinger <cg@exept.de>
parents:
211
diff
changeset
|
503 |
] |
7bc2c2d89ede
added native setting (suppress trailer in PS-subclass)
Claus Gittinger <cg@exept.de>
parents:
211
diff
changeset
|
504 |
|
7bc2c2d89ede
added native setting (suppress trailer in PS-subclass)
Claus Gittinger <cg@exept.de>
parents:
211
diff
changeset
|
505 |
"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
|
506 |
"Modified: 10.4.1996 / 13:09:06 / cg" |
126 | 507 |
! |
508 |
||
509 |
nextPutAll:aCollection |
|
348 | 510 |
"send some characters to the printer - translate as needed. |
511 |
The argument, aCollection can be a Text (i.e. include emphasis)" |
|
126 | 512 |
|
381
9afd4993bc24
avoid #emphasis: messages if there is no change
Claus Gittinger <cg@exept.de>
parents:
379
diff
changeset
|
513 |
|lastE| |
9afd4993bc24
avoid #emphasis: messages if there is no change
Claus Gittinger <cg@exept.de>
parents:
379
diff
changeset
|
514 |
|
913
99228537653d
Speed up native printing: #nextPutAll
Stefan Vogel <sv@exept.de>
parents:
879
diff
changeset
|
515 |
native == true ifTrue:[ |
99228537653d
Speed up native printing: #nextPutAll
Stefan Vogel <sv@exept.de>
parents:
879
diff
changeset
|
516 |
^ super nextPutAll:aCollection. |
99228537653d
Speed up native printing: #nextPutAll
Stefan Vogel <sv@exept.de>
parents:
879
diff
changeset
|
517 |
]. |
99228537653d
Speed up native printing: #nextPutAll
Stefan Vogel <sv@exept.de>
parents:
879
diff
changeset
|
518 |
|
348 | 519 |
aCollection hasChangeOfEmphasis ifTrue:[ |
392 | 520 |
aCollection keysAndValuesDo:[:idx :aChar | |
521 |
|e| |
|
381
9afd4993bc24
avoid #emphasis: messages if there is no change
Claus Gittinger <cg@exept.de>
parents:
379
diff
changeset
|
522 |
|
392 | 523 |
e := aCollection emphasisAt:idx. |
524 |
(idx == 1 |
|
525 |
or:[lastE ~~ e]) ifTrue:[ |
|
526 |
self emphasis:e. |
|
527 |
lastE := e. |
|
528 |
]. |
|
529 |
self nextPut:aChar. |
|
530 |
]. |
|
531 |
self emphasis:nil. |
|
348 | 532 |
] ifFalse:[ |
392 | 533 |
aCollection do:[:aChar | |
534 |
self nextPut:aChar |
|
535 |
] |
|
126 | 536 |
] |
348 | 537 |
|
1076
4bb0e9411317
Define #nextPutAll:startingAt:to: to fix Text>>printOn:aPrinterStream
Stefan Vogel <sv@exept.de>
parents:
914
diff
changeset
|
538 |
"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
|
539 |
! |
4bb0e9411317
Define #nextPutAll:startingAt:to: to fix Text>>printOn:aPrinterStream
Stefan Vogel <sv@exept.de>
parents:
914
diff
changeset
|
540 |
|
4bb0e9411317
Define #nextPutAll:startingAt:to: to fix Text>>printOn:aPrinterStream
Stefan Vogel <sv@exept.de>
parents:
914
diff
changeset
|
541 |
nextPutAll:aCollection startingAt:first to:last |
4bb0e9411317
Define #nextPutAll:startingAt:to: to fix Text>>printOn:aPrinterStream
Stefan Vogel <sv@exept.de>
parents:
914
diff
changeset
|
542 |
"append the elements with index from first to last |
4bb0e9411317
Define #nextPutAll:startingAt:to: to fix Text>>printOn:aPrinterStream
Stefan Vogel <sv@exept.de>
parents:
914
diff
changeset
|
543 |
of the argument, aCollection onto the receiver. |
4bb0e9411317
Define #nextPutAll:startingAt:to: to fix Text>>printOn:aPrinterStream
Stefan Vogel <sv@exept.de>
parents:
914
diff
changeset
|
544 |
This is only allowed, if the receiver supports writing." |
4bb0e9411317
Define #nextPutAll:startingAt:to: to fix Text>>printOn:aPrinterStream
Stefan Vogel <sv@exept.de>
parents:
914
diff
changeset
|
545 |
|
4bb0e9411317
Define #nextPutAll:startingAt:to: to fix Text>>printOn:aPrinterStream
Stefan Vogel <sv@exept.de>
parents:
914
diff
changeset
|
546 |
aCollection from:first to:last do:[:element | |
4bb0e9411317
Define #nextPutAll:startingAt:to: to fix Text>>printOn:aPrinterStream
Stefan Vogel <sv@exept.de>
parents:
914
diff
changeset
|
547 |
self nextPut:element |
4bb0e9411317
Define #nextPutAll:startingAt:to: to fix Text>>printOn:aPrinterStream
Stefan Vogel <sv@exept.de>
parents:
914
diff
changeset
|
548 |
]. |
4bb0e9411317
Define #nextPutAll:startingAt:to: to fix Text>>printOn:aPrinterStream
Stefan Vogel <sv@exept.de>
parents:
914
diff
changeset
|
549 |
^ aCollection |
4bb0e9411317
Define #nextPutAll:startingAt:to: to fix Text>>printOn:aPrinterStream
Stefan Vogel <sv@exept.de>
parents:
914
diff
changeset
|
550 |
! |
126 | 551 |
|
552 |
nextPutAllUntranslated:aCollection |
|
221
7bc2c2d89ede
added native setting (suppress trailer in PS-subclass)
Claus Gittinger <cg@exept.de>
parents:
211
diff
changeset
|
553 |
"send some raw characters to the printer - even if not in native mode" |
126 | 554 |
|
555 |
super nextPutAll:aCollection |
|
221
7bc2c2d89ede
added native setting (suppress trailer in PS-subclass)
Claus Gittinger <cg@exept.de>
parents:
211
diff
changeset
|
556 |
|
7bc2c2d89ede
added native setting (suppress trailer in PS-subclass)
Claus Gittinger <cg@exept.de>
parents:
211
diff
changeset
|
557 |
"Modified: 10.4.1996 / 13:08:35 / cg" |
126 | 558 |
! |
559 |
||
468 | 560 |
nextPutLine:aCollection |
561 |
self nextPutAll:aCollection. |
|
562 |
self cr |
|
563 |
||
564 |
"Created: 3.1.1997 / 19:43:56 / cg" |
|
565 |
! |
|
566 |
||
126 | 567 |
nextPutUntranslated:aCharacter |
221
7bc2c2d89ede
added native setting (suppress trailer in PS-subclass)
Claus Gittinger <cg@exept.de>
parents:
211
diff
changeset
|
568 |
"send a raw character to the printer - even if not in native mode" |
126 | 569 |
|
570 |
super nextPut:aCharacter |
|
221
7bc2c2d89ede
added native setting (suppress trailer in PS-subclass)
Claus Gittinger <cg@exept.de>
parents:
211
diff
changeset
|
571 |
|
7bc2c2d89ede
added native setting (suppress trailer in PS-subclass)
Claus Gittinger <cg@exept.de>
parents:
211
diff
changeset
|
572 |
"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
|
573 |
! ! |
0 | 574 |
|
348 | 575 |
!PrinterStream methodsFor:'emphasis change'! |
576 |
||
577 |
bold |
|
578 |
"set emphasis to bold |
|
579 |
- ignore here, since this class does not know anything about the printer" |
|
580 |
||
581 |
^ self |
|
582 |
||
583 |
"Modified: 18.5.1996 / 08:55:10 / cg" |
|
584 |
! |
|
585 |
||
586 |
boldItalic |
|
587 |
"set emphasis to boldItalic |
|
588 |
- ignore here, since this class does not know anything about the printer" |
|
589 |
||
590 |
^ self |
|
591 |
||
592 |
"Created: 14.5.1996 / 18:53:43 / cg" |
|
593 |
"Modified: 18.5.1996 / 08:55:14 / cg" |
|
594 |
! |
|
595 |
||
596 |
emphasis:anEmphasis |
|
597 |
"change the emphasis" |
|
598 |
||
392 | 599 |
|b i| |
600 |
||
390
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
601 |
(Text emphasis:anEmphasis includes:#underline) ifTrue:[ |
392 | 602 |
underline ifFalse:[ |
603 |
self underline |
|
604 |
] |
|
390
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
605 |
] ifFalse:[ |
392 | 606 |
underline ifTrue:[ |
607 |
self noUnderline |
|
608 |
] |
|
348 | 609 |
]. |
390
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
610 |
|
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
611 |
(Text emphasis:anEmphasis includes:#strikeout) ifTrue:[ |
392 | 612 |
strikeout ifFalse:[ |
613 |
self strikeout |
|
614 |
] |
|
390
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
615 |
] ifFalse:[ |
392 | 616 |
strikeout ifTrue:[ |
617 |
self noStrikeout |
|
618 |
] |
|
390
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
619 |
]. |
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
620 |
|
392 | 621 |
b := (Text emphasis:anEmphasis includes:#bold). |
622 |
i := (Text emphasis:anEmphasis includes:#italic). |
|
623 |
||
624 |
b ifTrue:[ |
|
625 |
i ifTrue:[ |
|
626 |
^ self boldItalic |
|
627 |
] ifFalse:[ |
|
628 |
^ self bold |
|
629 |
] |
|
630 |
] ifFalse:[ |
|
631 |
i ifTrue:[ |
|
632 |
^ self italic |
|
633 |
] |
|
349 | 634 |
]. |
348 | 635 |
|
390
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
636 |
^ self normal |
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
637 |
|
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
638 |
"Modified: 8.6.1996 / 08:15:00 / cg" |
348 | 639 |
! |
640 |
||
641 |
italic |
|
642 |
"set emphasis to italic |
|
643 |
- ignore here, since this class does not know anything about the printer" |
|
644 |
||
645 |
^ self |
|
646 |
||
647 |
"Modified: 18.5.1996 / 08:55:18 / cg" |
|
648 |
! |
|
649 |
||
392 | 650 |
noStrikeout |
651 |
"set emphasis to no strikeout |
|
652 |
- ignore here, since this class does not know anything about the printer" |
|
653 |
||
654 |
^ self |
|
655 |
||
656 |
"Modified: 18.5.1996 / 08:55:10 / cg" |
|
657 |
"Created: 8.6.1996 / 08:15:20 / cg" |
|
658 |
! |
|
659 |
||
390
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
660 |
noUnderline |
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
661 |
"set emphasis to no underline |
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
662 |
- ignore here, since this class does not know anything about the printer" |
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
663 |
|
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
664 |
^ self |
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
665 |
|
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
666 |
"Modified: 18.5.1996 / 08:55:10 / cg" |
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
667 |
"Created: 8.6.1996 / 08:15:12 / cg" |
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
668 |
! |
3f22865fa873
fixed handling of underline; no longer affects bold/italic setting.
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
669 |
|
348 | 670 |
normal |
671 |
"set emphasis to normal (non-bold, non-italic) |
|
672 |
- ignore here, since this class does not know anything about the printer" |
|
673 |
||
674 |
^ self |
|
675 |
||
676 |
"Modified: 18.5.1996 / 08:55:21 / cg" |
|
677 |
! |
|
678 |
||
679 |
strikeout |
|
680 |
"set emphasis to strikeout |
|
681 |
- ignore here, since this class does not know anything about the printer" |
|
682 |
||
683 |
^ self |
|
684 |
||
685 |
"Modified: 18.5.1996 / 08:55:10 / cg" |
|
686 |
"Created: 18.5.1996 / 08:56:13 / cg" |
|
687 |
! |
|
688 |
||
689 |
underline |
|
690 |
"set emphasis to underline |
|
691 |
- ignore here, since this class does not know anything about the printer" |
|
692 |
||
693 |
^ self |
|
694 |
||
695 |
"Modified: 18.5.1996 / 08:55:10 / cg" |
|
696 |
"Created: 18.5.1996 / 08:56:24 / cg" |
|
697 |
! ! |
|
698 |
||
699 |
!PrinterStream methodsFor:'font change'! |
|
700 |
||
701 |
courier |
|
702 |
"set font to courier |
|
703 |
- ignore here, since this class does not know anything about the printer" |
|
704 |
||
705 |
^ self |
|
706 |
! |
|
707 |
||
708 |
helvetica |
|
709 |
"set font to helvetic |
|
710 |
- ignore here, since this class does not know anything about the printer" |
|
711 |
||
712 |
^ self |
|
713 |
! |
|
714 |
||
715 |
times |
|
716 |
"set font to times |
|
717 |
- ignore here, since this class does not know anything about the printer" |
|
718 |
||
719 |
^ self |
|
720 |
! ! |
|
721 |
||
221
7bc2c2d89ede
added native setting (suppress trailer in PS-subclass)
Claus Gittinger <cg@exept.de>
parents:
211
diff
changeset
|
722 |
!PrinterStream methodsFor:'helpers writing'! |
6 | 723 |
|
221
7bc2c2d89ede
added native setting (suppress trailer in PS-subclass)
Claus Gittinger <cg@exept.de>
parents:
211
diff
changeset
|
724 |
escape:aCharacter |
7bc2c2d89ede
added native setting (suppress trailer in PS-subclass)
Claus Gittinger <cg@exept.de>
parents:
211
diff
changeset
|
725 |
"since its so common, this method sends escape followed by aCharacter" |
7bc2c2d89ede
added native setting (suppress trailer in PS-subclass)
Claus Gittinger <cg@exept.de>
parents:
211
diff
changeset
|
726 |
|
7bc2c2d89ede
added native setting (suppress trailer in PS-subclass)
Claus Gittinger <cg@exept.de>
parents:
211
diff
changeset
|
727 |
super nextPut:(Character escape); nextPut:aCharacter |
126 | 728 |
! |
729 |
||
221
7bc2c2d89ede
added native setting (suppress trailer in PS-subclass)
Claus Gittinger <cg@exept.de>
parents:
211
diff
changeset
|
730 |
escapeAll:aString |
7bc2c2d89ede
added native setting (suppress trailer in PS-subclass)
Claus Gittinger <cg@exept.de>
parents:
211
diff
changeset
|
731 |
"since its so common, this method sends escape followed by aString" |
126 | 732 |
|
221
7bc2c2d89ede
added native setting (suppress trailer in PS-subclass)
Claus Gittinger <cg@exept.de>
parents:
211
diff
changeset
|
733 |
super nextPut:(Character escape); nextPutAll:aString |
0 | 734 |
! ! |
126 | 735 |
|
367 | 736 |
!PrinterStream methodsFor:'initialization'! |
737 |
||
738 |
initialize |
|
914 | 739 |
pageFormat := DefaultPageFormat. |
367 | 740 |
|
1076
4bb0e9411317
Define #nextPutAll:startingAt:to: to fix Text>>printOn:aPrinterStream
Stefan Vogel <sv@exept.de>
parents:
914
diff
changeset
|
741 |
"Created: 31.5.1996 / 20:14:36 / cg" |
4bb0e9411317
Define #nextPutAll:startingAt:to: to fix Text>>printOn:aPrinterStream
Stefan Vogel <sv@exept.de>
parents:
914
diff
changeset
|
742 |
! ! |
367 | 743 |
|
126 | 744 |
!PrinterStream methodsFor:'open/close'! |
745 |
||
160 | 746 |
basicClose |
747 |
super close |
|
748 |
! |
|
749 |
||
126 | 750 |
close |
751 |
self endPrint. |
|
752 |
super close |
|
753 |
! |
|
754 |
||
755 |
endPrint |
|
756 |
^ self |
|
757 |
! |
|
758 |
||
221
7bc2c2d89ede
added native setting (suppress trailer in PS-subclass)
Claus Gittinger <cg@exept.de>
parents:
211
diff
changeset
|
759 |
setNative |
913
99228537653d
Speed up native printing: #nextPutAll
Stefan Vogel <sv@exept.de>
parents:
879
diff
changeset
|
760 |
self setNative:true |
221
7bc2c2d89ede
added native setting (suppress trailer in PS-subclass)
Claus Gittinger <cg@exept.de>
parents:
211
diff
changeset
|
761 |
|
7bc2c2d89ede
added native setting (suppress trailer in PS-subclass)
Claus Gittinger <cg@exept.de>
parents:
211
diff
changeset
|
762 |
! |
7bc2c2d89ede
added native setting (suppress trailer in PS-subclass)
Claus Gittinger <cg@exept.de>
parents:
211
diff
changeset
|
763 |
|
362 | 764 |
setNative:aBoolean |
765 |
native := aBoolean |
|
766 |
||
767 |
"Created: 30.5.1996 / 17:49:09 / cg" |
|
768 |
! |
|
769 |
||
126 | 770 |
startPrint |
751 | 771 |
self |
772 |
openPipeFor:(self class printCommand) |
|
773 |
withMode:'w' |
|
774 |
errorDisposition:#stderr |
|
914 | 775 |
inDirectory:nil. |
370 | 776 |
|
1076
4bb0e9411317
Define #nextPutAll:startingAt:to: to fix Text>>printOn:aPrinterStream
Stefan Vogel <sv@exept.de>
parents:
914
diff
changeset
|
777 |
"Modified: / 26.5.1999 / 16:14:57 / cg" |
4bb0e9411317
Define #nextPutAll:startingAt:to: to fix Text>>printOn:aPrinterStream
Stefan Vogel <sv@exept.de>
parents:
914
diff
changeset
|
778 |
! ! |
126 | 779 |
|
221
7bc2c2d89ede
added native setting (suppress trailer in PS-subclass)
Claus Gittinger <cg@exept.de>
parents:
211
diff
changeset
|
780 |
!PrinterStream methodsFor:'queries'! |
7bc2c2d89ede
added native setting (suppress trailer in PS-subclass)
Claus Gittinger <cg@exept.de>
parents:
211
diff
changeset
|
781 |
|
433
2b5b9df0981c
renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents:
392
diff
changeset
|
782 |
bottomMargin |
2b5b9df0981c
renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents:
392
diff
changeset
|
783 |
^ self class bottomMargin |
383 | 784 |
|
785 |
"Modified: 3.6.1996 / 10:27:45 / cg" |
|
433
2b5b9df0981c
renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents:
392
diff
changeset
|
786 |
"Created: 5.9.1996 / 21:37:26 / cg" |
383 | 787 |
! |
788 |
||
379 | 789 |
isPrinterStream |
790 |
"return true, if this is a printerStream. |
|
791 |
Always true here." |
|
792 |
||
793 |
^ true |
|
794 |
||
795 |
"Created: 3.6.1996 / 12:06:21 / cg" |
|
796 |
! |
|
797 |
||
627 | 798 |
landscape |
799 |
^ self class landscape |
|
800 |
||
801 |
"Modified: 3.6.1996 / 10:27:45 / cg" |
|
802 |
"Created: 5.9.1996 / 21:38:23 / cg" |
|
803 |
! |
|
804 |
||
433
2b5b9df0981c
renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents:
392
diff
changeset
|
805 |
leftMargin |
2b5b9df0981c
renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents:
392
diff
changeset
|
806 |
^ self class leftMargin |
383 | 807 |
|
808 |
"Modified: 3.6.1996 / 10:27:45 / cg" |
|
433
2b5b9df0981c
renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents:
392
diff
changeset
|
809 |
"Created: 5.9.1996 / 21:38:23 / cg" |
383 | 810 |
! |
811 |
||
221
7bc2c2d89ede
added native setting (suppress trailer in PS-subclass)
Claus Gittinger <cg@exept.de>
parents:
211
diff
changeset
|
812 |
lineLength |
7bc2c2d89ede
added native setting (suppress trailer in PS-subclass)
Claus Gittinger <cg@exept.de>
parents:
211
diff
changeset
|
813 |
"the printer pages width (in characters)" |
7bc2c2d89ede
added native setting (suppress trailer in PS-subclass)
Claus Gittinger <cg@exept.de>
parents:
211
diff
changeset
|
814 |
|
7bc2c2d89ede
added native setting (suppress trailer in PS-subclass)
Claus Gittinger <cg@exept.de>
parents:
211
diff
changeset
|
815 |
^ 80 |
383 | 816 |
! |
817 |
||
818 |
pageFormat |
|
819 |
^ self class pageFormat |
|
820 |
||
821 |
"Modified: 3.6.1996 / 10:27:45 / cg" |
|
822 |
! |
|
823 |
||
437 | 824 |
rightMargin |
825 |
^ self class rightMargin |
|
826 |
||
827 |
"Modified: 3.6.1996 / 10:27:45 / cg" |
|
828 |
"Created: 5.9.1996 / 21:38:23 / cg" |
|
829 |
! |
|
830 |
||
383 | 831 |
supportsColor |
832 |
"return true if this is a color printer" |
|
833 |
||
834 |
^ self class supportsColor |
|
835 |
||
836 |
"Created: 3.6.1996 / 18:00:27 / cg" |
|
837 |
! |
|
838 |
||
839 |
supportsMargins |
|
840 |
"return true if this printer supports margin settings (in inches) |
|
841 |
if not, it supports at least a leftMargin to be specified in columns." |
|
842 |
||
843 |
^ self class supportsMargins |
|
844 |
||
845 |
"Created: 3.6.1996 / 17:59:35 / cg" |
|
846 |
"Modified: 3.6.1996 / 18:24:04 / cg" |
|
847 |
! |
|
848 |
||
849 |
supportsPostscript |
|
850 |
"return true if this is a postscript printer" |
|
851 |
||
852 |
^ self class supportsPostscript |
|
853 |
||
854 |
"Created: 3.6.1996 / 17:59:58 / cg" |
|
855 |
! |
|
856 |
||
433
2b5b9df0981c
renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents:
392
diff
changeset
|
857 |
topMargin |
2b5b9df0981c
renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents:
392
diff
changeset
|
858 |
^ self class topMargin |
383 | 859 |
|
860 |
"Modified: 3.6.1996 / 10:27:45 / cg" |
|
433
2b5b9df0981c
renamed *Inset to *Margin; cleanup.
Claus Gittinger <cg@exept.de>
parents:
392
diff
changeset
|
861 |
"Created: 5.9.1996 / 21:40:32 / cg" |
221
7bc2c2d89ede
added native setting (suppress trailer in PS-subclass)
Claus Gittinger <cg@exept.de>
parents:
211
diff
changeset
|
862 |
! ! |
7bc2c2d89ede
added native setting (suppress trailer in PS-subclass)
Claus Gittinger <cg@exept.de>
parents:
211
diff
changeset
|
863 |
|
456 | 864 |
!PrinterStream class methodsFor:'documentation'! |
186
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
865 |
|
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
866 |
version |
1220 | 867 |
^ '$Header: /cvs/stx/stx/libbasic2/PrinterStream.st,v 1.58 2003-05-19 09:44:22 cg Exp $' |
186
bc1b056b097c
added #supportsPostscript query
Claus Gittinger <cg@exept.de>
parents:
179
diff
changeset
|
868 |
! ! |
1107 | 869 |
|
126 | 870 |
PrinterStream initialize! |