wineps: Move the input slot list to a standard list.

This commit is contained in:
Huw Davies 2012-04-11 12:36:16 +01:00 committed by Alexandre Julliard
parent 4dfef2ef2d
commit e6e42c8610
4 changed files with 36 additions and 31 deletions

View File

@ -116,20 +116,21 @@ void PSDRV_MergeDevmodes(PSDRV_DEVMODEA *dm1, PSDRV_DEVMODEA *dm2,
TRACE("Changing Copies to %d\n", dm2->dmPublic.u1.s1.dmCopies);
}
if(dm2->dmPublic.dmFields & DM_DEFAULTSOURCE) {
if (dm2->dmPublic.dmFields & DM_DEFAULTSOURCE)
{
INPUTSLOT *slot;
for(slot = pi->ppd->InputSlots; slot; slot = slot->next) {
LIST_FOR_EACH_ENTRY( slot, &pi->ppd->InputSlots, INPUTSLOT, entry )
if(slot->WinBin == dm2->dmPublic.u1.s1.dmDefaultSource)
break;
}
if(slot) {
if (&slot->entry != &pi->ppd->InputSlots)
{
dm1->dmPublic.u1.s1.dmDefaultSource = dm2->dmPublic.u1.s1.dmDefaultSource;
TRACE("Changing bin to '%s'\n", slot->FullName);
} else {
TRACE("Trying to change to unsupported bin %d\n",
dm2->dmPublic.u1.s1.dmDefaultSource);
}
else
TRACE("Trying to change to unsupported bin %d\n", dm2->dmPublic.u1.s1.dmDefaultSource);
}
if (dm2->dmPublic.dmFields & DM_DEFAULTSOURCE )
@ -512,9 +513,12 @@ DWORD PSDRV_DeviceCapabilities(LPSTR lpszDriver, LPCSTR lpszDevice, LPCSTR lpszP
WORD *wp = (WORD *)lpszOutput;
int i = 0;
for(slot = pi->ppd->InputSlots; slot; slot = slot->next, i++)
if(lpszOutput != NULL)
*wp++ = slot->WinBin;
LIST_FOR_EACH_ENTRY( slot, &pi->ppd->InputSlots, INPUTSLOT, entry )
{
i++;
if (lpszOutput != NULL)
*wp++ = slot->WinBin;
}
return i;
}
@ -524,11 +528,15 @@ DWORD PSDRV_DeviceCapabilities(LPSTR lpszDriver, LPCSTR lpszDevice, LPCSTR lpszP
char *cp = lpszOutput;
int i = 0;
for(slot = pi->ppd->InputSlots; slot; slot = slot->next, i++)
if(lpszOutput != NULL) {
lstrcpynA(cp, slot->FullName, 24);
cp += 24;
}
LIST_FOR_EACH_ENTRY( slot, &pi->ppd->InputSlots, INPUTSLOT, entry )
{
i++;
if (lpszOutput != NULL)
{
lstrcpynA( cp, slot->FullName, 24 );
cp += 24;
}
}
return i;
}

View File

@ -583,23 +583,19 @@ static BOOL parse_resolution(const char *str, SIZE *sz)
* PSDRV_AddSlot
*
*/
static INT PSDRV_AddSlot(PPD *ppd, LPCSTR szName, LPCSTR szFullName,
static BOOL PSDRV_AddSlot(PPD *ppd, LPCSTR szName, LPCSTR szFullName,
LPSTR szInvocationString, WORD wWinBin)
{
INPUTSLOT *slot, **insert = &ppd->InputSlots;
while (*insert)
insert = &((*insert)->next);
slot = *insert = HeapAlloc(PSDRV_Heap, HEAP_ZERO_MEMORY, sizeof(INPUTSLOT));
if (!slot) return 1;
INPUTSLOT *slot = HeapAlloc( PSDRV_Heap, 0, sizeof(INPUTSLOT) );
if (!slot) return FALSE;
slot->Name = szName;
slot->FullName = szFullName;
slot->InvocationString = szInvocationString;
slot->WinBin = wWinBin;
return 0;
list_add_tail( &ppd->InputSlots, &slot->entry );
return TRUE;
}
/***********************************************************************
@ -635,13 +631,13 @@ PPD *PSDRV_ParsePPD(char *fname)
list_init( &ppd->InstalledFonts );
list_init( &ppd->PageSizes );
list_init( &ppd->Constraints );
list_init( &ppd->InputSlots );
/*
* The Windows PostScript drivers create the following "virtual bin" for
* every PostScript printer
*/
if (PSDRV_AddSlot(ppd, NULL, "Automatically Select", NULL,
DMBIN_FORMSOURCE))
if (!PSDRV_AddSlot( ppd, NULL, "Automatically Select", NULL, DMBIN_FORMSOURCE ))
{
HeapFree (PSDRV_Heap, 0, ppd);
fclose(fp);
@ -1002,7 +998,7 @@ PPD *PSDRV_ParsePPD(char *fname)
optionEntry->FullName, optionEntry->InvocationString);
}
for(slot = ppd->InputSlots; slot; slot = slot->next)
LIST_FOR_EACH_ENTRY( slot, &ppd->InputSlots, INPUTSLOT, entry )
TRACE("INPUTSLOTS '%s' Name '%s' (%d) Invocation '%s'\n",
debugstr_a(slot->Name), slot->FullName, slot->WinBin,
debugstr_a(slot->InvocationString));

View File

@ -350,7 +350,7 @@ INT PSDRV_WriteHeader( PHYSDEV dev, LPCWSTR title )
write_spool(dev, copies_buf, strlen(copies_buf));
}
for(slot = physDev->pi->ppd->InputSlots; slot; slot = slot->next) {
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,

View File

@ -177,12 +177,13 @@ typedef struct
char *Value2;
} CONSTRAINT;
typedef struct _tagINPUTSLOT {
typedef struct
{
struct list entry;
const char *Name;
const char *FullName;
char *InvocationString;
WORD WinBin; /* eg DMBIN_LOWER */
struct _tagINPUTSLOT *next;
} INPUTSLOT;
typedef enum _RASTERIZEROPTION
@ -220,7 +221,7 @@ typedef struct {
PAGESIZE *DefaultPageSize;
OPTION *InstalledOptions;
struct list Constraints;
INPUTSLOT *InputSlots;
struct list InputSlots;
RASTERIZEROPTION TTRasterizer;
DUPLEX *Duplexes;
DUPLEX *DefaultDuplex;