wineps: Add a helper to find an input slot.

This commit is contained in:
Huw Davies 2012-04-16 13:18:37 +01:00 committed by Alexandre Julliard
parent c9178fdf6f
commit 61efdbfd5f
3 changed files with 18 additions and 16 deletions

View File

@ -45,6 +45,17 @@ static inline int paper_size_from_points( float size )
return size * 254 / 72;
}
INPUTSLOT *find_slot( PPD *ppd, PSDRV_DEVMODE *dm )
{
INPUTSLOT *slot;
LIST_FOR_EACH_ENTRY( slot, &ppd->InputSlots, INPUTSLOT, entry )
if (slot->WinBin == dm->dmPublic.u1.s1.dmDefaultSource)
return slot;
return NULL;
}
/************************************************************************
*
* PSDRV_MergeDevmodes
@ -117,13 +128,9 @@ void PSDRV_MergeDevmodes( PSDRV_DEVMODE *dm1, PSDRV_DEVMODE *dm2, PRINTERINFO *p
if (dm2->dmPublic.dmFields & DM_DEFAULTSOURCE)
{
INPUTSLOT *slot;
INPUTSLOT *slot = find_slot( pi->ppd, dm2 );
LIST_FOR_EACH_ENTRY( slot, &pi->ppd->InputSlots, INPUTSLOT, entry )
if(slot->WinBin == dm2->dmPublic.u1.s1.dmDefaultSource)
break;
if (&slot->entry != &pi->ppd->InputSlots)
if (slot)
{
dm1->dmPublic.u1.s1.dmDefaultSource = dm2->dmPublic.u1.s1.dmDefaultSource;
TRACE("Changing bin to '%s'\n", slot->FullName);

View File

@ -301,7 +301,7 @@ INT PSDRV_WriteHeader( PHYSDEV dev, LPCWSTR title )
{
PSDRV_PDEVICE *physDev = get_psdrv_dev( dev );
char *buf, *escaped_title;
INPUTSLOT *slot;
INPUTSLOT *slot = find_slot( physDev->pi->ppd, physDev->Devmode );
PAGESIZE *page;
DUPLEX *duplex;
int win_duplex;
@ -350,15 +350,8 @@ INT PSDRV_WriteHeader( PHYSDEV dev, LPCWSTR title )
write_spool(dev, copies_buf, strlen(copies_buf));
}
LIST_FOR_EACH_ENTRY( slot, &physDev->pi->ppd->InputSlots, INPUTSLOT, entry ) {
if(slot->WinBin == physDev->Devmode->dmPublic.u1.s1.dmDefaultSource) {
if(slot->InvocationString) {
PSDRV_WriteFeature(dev, "*InputSlot", slot->Name,
slot->InvocationString);
break;
}
}
}
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) {

View File

@ -401,6 +401,8 @@ extern HINSTANCE PSDRV_hInstance DECLSPEC_HIDDEN;
extern HANDLE PSDRV_Heap DECLSPEC_HIDDEN;
extern char *PSDRV_ANSIVector[256] DECLSPEC_HIDDEN;
extern INPUTSLOT *find_slot( PPD *ppd, PSDRV_DEVMODE *dm );
/* GDI driver functions */
extern BOOL PSDRV_Arc( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
INT xstart, INT ystart, INT xend, INT yend ) DECLSPEC_HIDDEN;