Commit 9222ec3c authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

wineps.drv: Many MacOSX generated ppd files don't include a *ColorDevice line.…

wineps.drv: Many MacOSX generated ppd files don't include a *ColorDevice line. Treat these as if they were colour.
parent beff84c1
...@@ -84,7 +84,7 @@ BOOL PSDRV_CopyColor(PSCOLOR *col1, PSCOLOR *col2) ...@@ -84,7 +84,7 @@ BOOL PSDRV_CopyColor(PSCOLOR *col1, PSCOLOR *col2)
* PSDRV_CreateColor * PSDRV_CreateColor
* *
* Creates a PostScript colour from a COLORREF. * Creates a PostScript colour from a COLORREF.
* Result is grey scale if ColorDevice field of ppd is FALSE else an * Result is grey scale if ColorDevice field of ppd is CD_False else an
* rgb colour is produced. * rgb colour is produced.
*/ */
void PSDRV_CreateColor( PSDRV_PDEVICE *physDev, PSCOLOR *pscolor, void PSDRV_CreateColor( PSDRV_PDEVICE *physDev, PSCOLOR *pscolor,
...@@ -100,7 +100,7 @@ void PSDRV_CreateColor( PSDRV_PDEVICE *physDev, PSCOLOR *pscolor, ...@@ -100,7 +100,7 @@ void PSDRV_CreateColor( PSDRV_PDEVICE *physDev, PSCOLOR *pscolor,
g = ((wincolor >> 8) & 0xff) / 256.0; g = ((wincolor >> 8) & 0xff) / 256.0;
b = ((wincolor >> 16) & 0xff) / 256.0; b = ((wincolor >> 16) & 0xff) / 256.0;
if(physDev->pi->ppd->ColorDevice) { if(physDev->pi->ppd->ColorDevice != CD_False) {
pscolor->type = PSCOLOR_RGB; pscolor->type = PSCOLOR_RGB;
pscolor->value.rgb.r = r; pscolor->value.rgb.r = r;
pscolor->value.rgb.g = g; pscolor->value.rgb.g = g;
......
...@@ -632,7 +632,7 @@ DWORD PSDRV_DeviceCapabilities(LPSTR lpszDriver, LPCSTR lpszDevice, LPCSTR lpszP ...@@ -632,7 +632,7 @@ DWORD PSDRV_DeviceCapabilities(LPSTR lpszDriver, LPCSTR lpszDevice, LPCSTR lpszP
/* Printer supports colour printing - 1 if yes, 0 if no (Win2k/XP only) */ /* Printer supports colour printing - 1 if yes, 0 if no (Win2k/XP only) */
case DC_COLORDEVICE: case DC_COLORDEVICE:
return pi->ppd->ColorDevice; return (pi->ppd->ColorDevice != CD_False) ? TRUE : FALSE;
/* Identification number of the printer manufacturer for use with ICM (Win9x only) */ /* Identification number of the printer manufacturer for use with ICM (Win9x only) */
case DC_MANUFACTURER: case DC_MANUFACTURER:
......
...@@ -430,7 +430,7 @@ INT PSDRV_GetDeviceCaps( PSDRV_PDEVICE *physDev, INT cap ) ...@@ -430,7 +430,7 @@ INT PSDRV_GetDeviceCaps( PSDRV_PDEVICE *physDev, INT cap )
case VERTRES: case VERTRES:
return physDev->vertRes; return physDev->vertRes;
case BITSPIXEL: case BITSPIXEL:
return physDev->pi->ppd->ColorDevice ? 8 : 1; return (physDev->pi->ppd->ColorDevice != CD_False) ? 8 : 1;
case PLANES: case PLANES:
return 1; return 1;
case NUMBRUSHES: case NUMBRUSHES:
...@@ -442,7 +442,7 @@ INT PSDRV_GetDeviceCaps( PSDRV_PDEVICE *physDev, INT cap ) ...@@ -442,7 +442,7 @@ INT PSDRV_GetDeviceCaps( PSDRV_PDEVICE *physDev, INT cap )
case NUMFONTS: case NUMFONTS:
return 39; return 39;
case NUMCOLORS: case NUMCOLORS:
return (physDev->pi->ppd->ColorDevice ? 256 : -1); return (physDev->pi->ppd->ColorDevice != CD_False) ? 256 : -1;
case PDEVICESIZE: case PDEVICESIZE:
return sizeof(PSDRV_PDEVICE); return sizeof(PSDRV_PDEVICE);
case CURVECAPS: case CURVECAPS:
......
...@@ -572,6 +572,8 @@ PPD *PSDRV_ParsePPD(char *fname) ...@@ -572,6 +572,8 @@ PPD *PSDRV_ParsePPD(char *fname)
return NULL; return NULL;
} }
ppd->ColorDevice = CD_NotSpecified;
/* /*
* The Windows PostScript drivers create the following "virtual bin" for * The Windows PostScript drivers create the following "virtual bin" for
* every PostScript printer * every PostScript printer
...@@ -599,8 +601,10 @@ PPD *PSDRV_ParsePPD(char *fname) ...@@ -599,8 +601,10 @@ PPD *PSDRV_ParsePPD(char *fname)
else if(!strcmp("*ColorDevice", tuple.key)) { else if(!strcmp("*ColorDevice", tuple.key)) {
if(!strcasecmp(tuple.value, "true")) if(!strcasecmp(tuple.value, "true"))
ppd->ColorDevice = TRUE; ppd->ColorDevice = CD_True;
TRACE("ColorDevice = %d\n", (int)ppd->ColorDevice); else
ppd->ColorDevice = CD_False;
TRACE("ColorDevice = %s\n", ppd->ColorDevice == CD_True ? "True" : "False");
} }
else if((!strcmp("*DefaultResolution", tuple.key)) || else if((!strcmp("*DefaultResolution", tuple.key)) ||
......
...@@ -191,10 +191,19 @@ typedef struct _tagDUPLEX { ...@@ -191,10 +191,19 @@ typedef struct _tagDUPLEX {
struct _tagDUPLEX *next; struct _tagDUPLEX *next;
} DUPLEX; } DUPLEX;
/* Many MacOSX based ppd files don't include a *ColorDevice line, so
we use a tristate here rather than a boolean. Code that
cares is expected to treat these as if they were colour. */
typedef enum {
CD_NotSpecified,
CD_False,
CD_True
} COLORDEVICE;
typedef struct { typedef struct {
char *NickName; char *NickName;
int LanguageLevel; int LanguageLevel;
BOOL ColorDevice; COLORDEVICE ColorDevice;
int DefaultResolution; int DefaultResolution;
signed int LandscapeOrientation; signed int LandscapeOrientation;
char *JCLBegin; char *JCLBegin;
......
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