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