Commit 44d880b4 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

wineps: Add a helper to find a page size.

parent 61efdbfd
......@@ -56,6 +56,17 @@ INPUTSLOT *find_slot( PPD *ppd, PSDRV_DEVMODE *dm )
return NULL;
}
PAGESIZE *find_pagesize( PPD *ppd, PSDRV_DEVMODE *dm )
{
PAGESIZE *page;
LIST_FOR_EACH_ENTRY( page, &ppd->PageSizes, PAGESIZE, entry )
if (page->WinPage == dm->dmPublic.u1.s1.dmPaperSize)
return page;
return NULL;
}
/************************************************************************
*
* PSDRV_MergeDevmodes
......@@ -78,14 +89,12 @@ void PSDRV_MergeDevmodes( PSDRV_DEVMODE *dm1, PSDRV_DEVMODE *dm2, PRINTERINFO *p
}
/* NB PaperWidth is always < PaperLength */
if(dm2->dmPublic.dmFields & DM_PAPERSIZE) {
PAGESIZE *page;
if (dm2->dmPublic.dmFields & DM_PAPERSIZE)
{
PAGESIZE *page = find_pagesize( pi->ppd, dm2 );
LIST_FOR_EACH_ENTRY(page, &pi->ppd->PageSizes, PAGESIZE, entry) {
if(page->WinPage == dm2->dmPublic.u1.s1.dmPaperSize)
break;
}
if(&page->entry != &pi->ppd->PageSizes ) {
if (page)
{
dm1->dmPublic.u1.s1.dmPaperSize = dm2->dmPublic.u1.s1.dmPaperSize;
dm1->dmPublic.u1.s1.dmPaperWidth = paper_size_from_points( page->PaperDimension->x );
dm1->dmPublic.u1.s1.dmPaperLength = paper_size_from_points( page->PaperDimension->y );
......@@ -94,11 +103,12 @@ void PSDRV_MergeDevmodes( PSDRV_DEVMODE *dm1, PSDRV_DEVMODE *dm2, PRINTERINFO *p
TRACE("Changing page to %s %d x %d\n", page->FullName,
dm1->dmPublic.u1.s1.dmPaperWidth,
dm1->dmPublic.u1.s1.dmPaperLength );
} else {
TRACE("Trying to change to unsupported pagesize %d\n",
dm2->dmPublic.u1.s1.dmPaperSize);
}
} else if((dm2->dmPublic.dmFields & DM_PAPERLENGTH) &&
else
TRACE("Trying to change to unsupported pagesize %d\n", dm2->dmPublic.u1.s1.dmPaperSize);
}
else if((dm2->dmPublic.dmFields & DM_PAPERLENGTH) &&
(dm2->dmPublic.dmFields & DM_PAPERWIDTH)) {
dm1->dmPublic.u1.s1.dmPaperLength = dm2->dmPublic.u1.s1.dmPaperLength;
dm1->dmPublic.u1.s1.dmPaperWidth = dm2->dmPublic.u1.s1.dmPaperWidth;
......
......@@ -302,7 +302,7 @@ INT PSDRV_WriteHeader( PHYSDEV dev, LPCWSTR title )
PSDRV_PDEVICE *physDev = get_psdrv_dev( dev );
char *buf, *escaped_title;
INPUTSLOT *slot = find_slot( physDev->pi->ppd, physDev->Devmode );
PAGESIZE *page;
PAGESIZE *page = find_pagesize( physDev->pi->ppd, physDev->Devmode );
DUPLEX *duplex;
int win_duplex;
int llx, lly, urx, ury;
......@@ -353,15 +353,8 @@ INT PSDRV_WriteHeader( PHYSDEV dev, LPCWSTR title )
if (slot && slot->InvocationString)
PSDRV_WriteFeature( dev, "*InputSlot", slot->Name, slot->InvocationString );
LIST_FOR_EACH_ENTRY(page, &physDev->pi->ppd->PageSizes, PAGESIZE, entry) {
if(page->WinPage == physDev->Devmode->dmPublic.u1.s1.dmPaperSize) {
if(page->InvocationString) {
PSDRV_WriteFeature(dev, "*PageSize", page->Name,
page->InvocationString);
break;
}
}
}
if (page && page->InvocationString)
PSDRV_WriteFeature( dev, "*PageSize", page->Name, page->InvocationString );
win_duplex = physDev->Devmode->dmPublic.dmFields & DM_DUPLEX ?
physDev->Devmode->dmPublic.dmDuplex : 0;
......
......@@ -402,6 +402,7 @@ extern HANDLE PSDRV_Heap DECLSPEC_HIDDEN;
extern char *PSDRV_ANSIVector[256] DECLSPEC_HIDDEN;
extern INPUTSLOT *find_slot( PPD *ppd, PSDRV_DEVMODE *dm );
extern PAGESIZE *find_pagesize( PPD *ppd, PSDRV_DEVMODE *dm );
/* GDI driver functions */
extern BOOL PSDRV_Arc( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
......
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