Commit 4a8c8e4e authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

Handle multicopy printing correctly.

parent 149bb9e6
......@@ -542,9 +542,10 @@ DWORD PSDRV_DeviceCapabilities(LPSTR lpszDriver, LPCSTR lpszDevice, LPCSTR lpszP
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 @@ DWORD PSDRV_DeviceCapabilities(LPSTR lpszDriver, LPCSTR lpszDevice, LPCSTR lpszP
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");
......
......@@ -306,7 +306,12 @@ INT PSDRV_StartPage( PSDRV_PDEVICE *physDev )
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 @@ INT PSDRV_StartDoc( PSDRV_PDEVICE *physDev, const DOCINFOA *doc )
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 @@ INT PSDRV_EndDoc( PSDRV_PDEVICE *physDev )
ret = 0;
}
physDev->job.hJob = 0;
if(physDev->job.DocName) {
HeapFree(GetProcessHeap(), 0, physDev->job.DocName);
physDev->job.DocName = NULL;
}
return ret;
}
......@@ -271,6 +271,12 @@ INT PSDRV_WriteHeader( PSDRV_PDEVICE *physDev, LPCSTR title )
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) {
......
......@@ -316,6 +316,7 @@ typedef struct {
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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment