wineps.drv: Keep track of all supported device resolutions.

This commit is contained in:
Dmitry Timoshkov 2012-12-19 12:43:46 +08:00 committed by Alexandre Julliard
parent 57f84bc7bb
commit d5f27e194a
3 changed files with 44 additions and 7 deletions

View File

@ -638,14 +638,22 @@ DWORD PSDRV_DeviceCapabilities(LPSTR lpszDriver, LPCSTR lpszDevice, LPCSTR lpszP
case DC_ENUMRESOLUTIONS: case DC_ENUMRESOLUTIONS:
{ {
LONG *lp = (LONG*)lpszOutput; RESOLUTION *res;
LONG *lp = (LONG *)lpszOutput;
int i = 0;
if(lpszOutput != NULL) { LIST_FOR_EACH_ENTRY(res, &pi->ppd->Resolutions, RESOLUTION, entry)
lp[0] = pi->ppd->DefaultResolution; {
lp[1] = pi->ppd->DefaultResolution; i++;
} if (lpszOutput != NULL)
ret = 1; {
break; lp[0] = res->resx;
lp[1] = res->resy;
lp += 2;
}
}
ret = i;
break;
} }
/* Windows returns 9999 too */ /* Windows returns 9999 too */

View File

@ -659,6 +659,7 @@ PPD *PSDRV_ParsePPD( char *fname, HANDLE printer )
ppd->ColorDevice = CD_NotSpecified; ppd->ColorDevice = CD_NotSpecified;
list_init( &ppd->Resolutions );
list_init( &ppd->InstalledFonts ); list_init( &ppd->InstalledFonts );
list_init( &ppd->PageSizes ); list_init( &ppd->PageSizes );
list_init( &ppd->Constraints ); list_init( &ppd->Constraints );
@ -713,6 +714,26 @@ PPD *PSDRV_ParsePPD( char *fname, HANDLE printer )
WARN("failed to parse DefaultResolution %s\n", debugstr_a(tuple.value)); WARN("failed to parse DefaultResolution %s\n", debugstr_a(tuple.value));
} }
else if(!strcmp("*Resolution", tuple.key))
{
SIZE sz;
if (parse_resolution(tuple.option, &sz))
{
RESOLUTION *res;
TRACE("Resolution %dx%d, invocation %s\n", sz.cx, sz.cy, tuple.value);
res = HeapAlloc( GetProcessHeap(), 0, sizeof(*res) );
res->resx = sz.cx;
res->resy = sz.cy;
res->InvocationString = tuple.value;
tuple.value = NULL;
list_add_tail( &ppd->Resolutions, &res->entry );
}
else
WARN("failed to parse Resolution %s\n", debugstr_a(tuple.option));
}
else if(!strcmp("*Font", tuple.key)) else if(!strcmp("*Font", tuple.key))
{ {
FONTNAME *fn = HeapAlloc( PSDRV_Heap, 0, sizeof(*fn) ); FONTNAME *fn = HeapAlloc( PSDRV_Heap, 0, sizeof(*fn) );

View File

@ -183,6 +183,13 @@ typedef struct
WORD WinDuplex; /* eg DMDUP_SIMPLEX */ WORD WinDuplex; /* eg DMDUP_SIMPLEX */
} DUPLEX; } DUPLEX;
typedef struct
{
struct list entry;
int resx, resy;
char *InvocationString;
} RESOLUTION;
/* Many Mac OS X based ppd files don't include a *ColorDevice line, so /* Many Mac OS X based ppd files don't include a *ColorDevice line, so
we use a tristate here rather than a boolean. Code that we use a tristate here rather than a boolean. Code that
cares is expected to treat these as if they were colour. */ cares is expected to treat these as if they were colour. */
@ -196,6 +203,7 @@ typedef struct {
char *NickName; char *NickName;
int LanguageLevel; int LanguageLevel;
COLORDEVICE ColorDevice; COLORDEVICE ColorDevice;
struct list Resolutions;
int DefaultResolution; int DefaultResolution;
signed int LandscapeOrientation; signed int LandscapeOrientation;
char *JCLBegin; char *JCLBegin;