wineps: multicopy
Huw D M Davies
h.davies1 at physics.ox.ac.uk
Tue Nov 11 06:13:59 CST 2003
Huw Davies <huw at codeweavers.com>
Handle multicopy printing correctly
--
Huw Davies
huw at codeweavers.com
Index: dlls/wineps/driver.c
===================================================================
RCS file: /home/wine/wine/dlls/wineps/driver.c,v
retrieving revision 1.21
diff -u -r1.21 driver.c
--- dlls/wineps/driver.c 5 Nov 2003 00:37:48 -0000 1.21
+++ dlls/wineps/driver.c 11 Nov 2003 12:10:59 -0000
@@ -542,9 +542,10 @@
return 1;
}
+ /* Windows returns 9999 too */
case DC_COPIES:
- FIXME("DC_COPIES: returning %d. Is this correct?\n", lpdm->dmCopies);
- return lpdm->dmCopies;
+ TRACE("DC_COPIES: returning 9999\n");
+ return 9999;
case DC_DRIVER:
return lpdm->dmDriverVersion;
@@ -626,14 +627,15 @@
case DC_VERSION:
return lpdm->dmSpecVersion;
- /* Printer supports collating - 1 if yes, 0 if no. */
+ /* We'll just return false here, very few printers can collate anyway */
case DC_COLLATE:
- return ((lpdm->dmFields & DM_COLLATE) ? 1 : 0); /* Collation is supported if DM_COLLATE is set */
-
+ TRACE("DC_COLLATE: returning FALSE\n");
+ return FALSE;
+
/* Printer supports colour printing - 1 if yes, 0 if no (Win2k/XP only) */
case DC_COLORDEVICE:
- return ((lpdm->dmFields & DM_COLOR) ? 1 : 0); /* Colour is supported if DM_COLOR is set */
-
+ return pi->ppd->ColorDevice;
+
/* Identification number of the printer manufacturer for use with ICM (Win9x only) */
case DC_MANUFACTURER:
FIXME("DC_MANUFACTURER: stub\n");
Index: dlls/wineps/escape.c
===================================================================
RCS file: /home/wine/wine/dlls/wineps/escape.c,v
retrieving revision 1.21
diff -u -r1.21 escape.c
--- dlls/wineps/escape.c 5 Sep 2003 23:08:28 -0000 1.21
+++ dlls/wineps/escape.c 11 Nov 2003 12:10:59 -0000
@@ -306,7 +306,12 @@
FIXME("Already started a page?\n");
return 1;
}
- physDev->job.PageNo++;
+
+ if(physDev->job.PageNo++ == 0) {
+ if(!PSDRV_WriteHeader( physDev, physDev->job.DocName ))
+ return 0;
+ }
+
if(!PSDRV_WriteNewPage( physDev ))
return 0;
physDev->job.OutOfPage = FALSE;
@@ -368,8 +373,12 @@
physDev->job.banding = FALSE;
physDev->job.OutOfPage = TRUE;
physDev->job.PageNo = 0;
- if(!PSDRV_WriteHeader( physDev, doc->lpszDocName ))
- return 0;
+
+ if(doc->lpszDocName) {
+ physDev->job.DocName = HeapAlloc(GetProcessHeap(), 0, strlen(doc->lpszDocName)+1);
+ strcpy(physDev->job.DocName, doc->lpszDocName);
+ } else
+ physDev->job.DocName = NULL;
return physDev->job.hJob;
}
@@ -397,5 +406,9 @@
ret = 0;
}
physDev->job.hJob = 0;
+ if(physDev->job.DocName) {
+ HeapFree(GetProcessHeap(), 0, physDev->job.DocName);
+ physDev->job.DocName = NULL;
+ }
return ret;
}
Index: dlls/wineps/ps.c
===================================================================
RCS file: /home/wine/wine/dlls/wineps/ps.c,v
retrieving revision 1.20
diff -u -r1.20 ps.c
--- dlls/wineps/ps.c 11 Nov 2003 00:30:42 -0000 1.20
+++ dlls/wineps/ps.c 11 Nov 2003 12:10:59 -0000
@@ -271,6 +271,12 @@
WriteSpool16( physDev->job.hJob, (LPSTR)psbeginsetup, strlen(psbeginsetup) );
+ if(physDev->Devmode->dmPublic.dmCopies > 1) {
+ char copies_buf[100];
+ sprintf(copies_buf, "mark {\n << /NumCopies %d >> setpagedevice\n} stopped cleartomark\n", physDev->Devmode->dmPublic.dmCopies);
+ WriteSpool16(physDev->job.hJob, copies_buf, strlen(copies_buf));
+ }
+
for(slot = physDev->pi->ppd->InputSlots; slot; slot = slot->next) {
if(slot->WinBin == physDev->Devmode->dmPublic.dmDefaultSource) {
if(slot->InvocationString) {
Index: dlls/wineps/psdrv.h
===================================================================
RCS file: /home/wine/wine/dlls/wineps/psdrv.h,v
retrieving revision 1.43
diff -u -r1.43 psdrv.h
--- dlls/wineps/psdrv.h 11 Nov 2003 00:30:42 -0000 1.43
+++ dlls/wineps/psdrv.h 11 Nov 2003 12:10:59 -0000
@@ -316,6 +316,7 @@
typedef struct {
HANDLE16 hJob;
LPSTR output; /* Output file/port */
+ LPSTR DocName; /* Document Name */
BOOL banding; /* Have we received a NEXTBAND */
BOOL OutOfPage; /* Page header not sent yet */
INT PageNo;
More information about the wine-patches
mailing list