Commit 5a0129c0 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

wineps: Move the duplex list to a standard list.

parent e6e42c86
...@@ -195,7 +195,7 @@ static INT_PTR CALLBACK PSDRV_PaperDlgProc(HWND hwnd, UINT msg, ...@@ -195,7 +195,7 @@ static INT_PTR CALLBACK PSDRV_PaperDlgProc(HWND hwnd, UINT msg,
WPARAM wParam, LPARAM lParam) WPARAM wParam, LPARAM lParam)
{ {
PSDRV_DLGINFO *di; PSDRV_DLGINFO *di;
int i, Cursel = 0; int i, Cursel;
PAGESIZE *ps; PAGESIZE *ps;
DUPLEX *duplex; DUPLEX *duplex;
...@@ -204,7 +204,7 @@ static INT_PTR CALLBACK PSDRV_PaperDlgProc(HWND hwnd, UINT msg, ...@@ -204,7 +204,7 @@ static INT_PTR CALLBACK PSDRV_PaperDlgProc(HWND hwnd, UINT msg,
di = (PSDRV_DLGINFO*)((PROPSHEETPAGEA*)lParam)->lParam; di = (PSDRV_DLGINFO*)((PROPSHEETPAGEA*)lParam)->lParam;
SetWindowLongPtrW(hwnd, DWLP_USER, (LONG_PTR)di); SetWindowLongPtrW(hwnd, DWLP_USER, (LONG_PTR)di);
i = 0; i = Cursel = 0;
LIST_FOR_EACH_ENTRY(ps, &di->pi->ppd->PageSizes, PAGESIZE, entry) { LIST_FOR_EACH_ENTRY(ps, &di->pi->ppd->PageSizes, PAGESIZE, entry) {
SendDlgItemMessageA(hwnd, IDD_PAPERS, LB_INSERTSTRING, i, SendDlgItemMessageA(hwnd, IDD_PAPERS, LB_INSERTSTRING, i,
(LPARAM)ps->FullName); (LPARAM)ps->FullName);
...@@ -219,16 +219,21 @@ static INT_PTR CALLBACK PSDRV_PaperDlgProc(HWND hwnd, UINT msg, ...@@ -219,16 +219,21 @@ static INT_PTR CALLBACK PSDRV_PaperDlgProc(HWND hwnd, UINT msg,
DMORIENT_PORTRAIT ? IDD_ORIENT_PORTRAIT : DMORIENT_PORTRAIT ? IDD_ORIENT_PORTRAIT :
IDD_ORIENT_LANDSCAPE); IDD_ORIENT_LANDSCAPE);
if(!di->pi->ppd->Duplexes) { if (list_empty( &di->pi->ppd->Duplexes ))
{
ShowWindow(GetDlgItem(hwnd, IDD_DUPLEX), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDD_DUPLEX), SW_HIDE);
ShowWindow(GetDlgItem(hwnd, IDD_DUPLEX_NAME), SW_HIDE); ShowWindow(GetDlgItem(hwnd, IDD_DUPLEX_NAME), SW_HIDE);
} else { }
Cursel = 0; else
for(duplex = di->pi->ppd->Duplexes, i = 0; duplex; duplex = duplex->next, i++) { {
i = Cursel = 0;
LIST_FOR_EACH_ENTRY( duplex, &di->pi->ppd->Duplexes, DUPLEX, entry )
{
SendDlgItemMessageA(hwnd, IDD_DUPLEX, CB_INSERTSTRING, i, SendDlgItemMessageA(hwnd, IDD_DUPLEX, CB_INSERTSTRING, i,
(LPARAM)(duplex->FullName ? duplex->FullName : duplex->Name)); (LPARAM)(duplex->FullName ? duplex->FullName : duplex->Name));
if(di->pi->Devmode->dmPublic.dmDuplex == duplex->WinDuplex) if(di->pi->Devmode->dmPublic.dmDuplex == duplex->WinDuplex)
Cursel = i; Cursel = i;
i++;
} }
SendDlgItemMessageA(hwnd, IDD_DUPLEX, CB_SETCURSEL, Cursel, 0); SendDlgItemMessageA(hwnd, IDD_DUPLEX, CB_SETCURSEL, Cursel, 0);
} }
...@@ -261,8 +266,12 @@ static INT_PTR CALLBACK PSDRV_PaperDlgProc(HWND hwnd, UINT msg, ...@@ -261,8 +266,12 @@ static INT_PTR CALLBACK PSDRV_PaperDlgProc(HWND hwnd, UINT msg,
case IDD_DUPLEX: case IDD_DUPLEX:
if(HIWORD(wParam) == CBN_SELCHANGE) { if(HIWORD(wParam) == CBN_SELCHANGE) {
Cursel = SendDlgItemMessageA(hwnd, LOWORD(wParam), CB_GETCURSEL, 0, 0); Cursel = SendDlgItemMessageA(hwnd, LOWORD(wParam), CB_GETCURSEL, 0, 0);
for(i = 0, duplex = di->pi->ppd->Duplexes; i < Cursel; i++, duplex = duplex->next) i = 0;
; LIST_FOR_EACH_ENTRY( duplex, &di->pi->ppd->Duplexes, DUPLEX, entry )
{
if (i >= Cursel) break;
i++;
}
TRACE("Setting duplex to item %d Winduplex = %d\n", Cursel, duplex->WinDuplex); TRACE("Setting duplex to item %d Winduplex = %d\n", Cursel, duplex->WinDuplex);
di->dlgdm->dmPublic.dmDuplex = duplex->WinDuplex; di->dlgdm->dmPublic.dmDuplex = duplex->WinDuplex;
SendMessageW(GetParent(hwnd), PSM_CHANGED, 0, 0); SendMessageW(GetParent(hwnd), PSM_CHANGED, 0, 0);
......
...@@ -632,6 +632,7 @@ PPD *PSDRV_ParsePPD(char *fname) ...@@ -632,6 +632,7 @@ PPD *PSDRV_ParsePPD(char *fname)
list_init( &ppd->PageSizes ); list_init( &ppd->PageSizes );
list_init( &ppd->Constraints ); list_init( &ppd->Constraints );
list_init( &ppd->InputSlots ); list_init( &ppd->InputSlots );
list_init( &ppd->Duplexes );
/* /*
* The Windows PostScript drivers create the following "virtual bin" for * The Windows PostScript drivers create the following "virtual bin" for
...@@ -869,27 +870,24 @@ PPD *PSDRV_ParsePPD(char *fname) ...@@ -869,27 +870,24 @@ PPD *PSDRV_ParsePPD(char *fname)
TRACE("*TTRasterizer = %d\n", ppd->TTRasterizer); TRACE("*TTRasterizer = %d\n", ppd->TTRasterizer);
} }
else if(!strcmp("*Duplex", tuple.key)) { else if(!strcmp("*Duplex", tuple.key))
DUPLEX **duplex; {
for(duplex = &ppd->Duplexes; *duplex; duplex = &(*duplex)->next) DUPLEX *duplex = HeapAlloc( GetProcessHeap(), 0, sizeof(*duplex) );
; duplex->Name = tuple.option;
*duplex = HeapAlloc(GetProcessHeap(), 0, sizeof(**duplex)); duplex->FullName = tuple.opttrans;
(*duplex)->Name = tuple.option; duplex->InvocationString = tuple.value;
(*duplex)->FullName = tuple.opttrans;
(*duplex)->InvocationString = tuple.value;
(*duplex)->next = NULL;
if(!strcasecmp("None", tuple.option) || !strcasecmp("False", tuple.option) if(!strcasecmp("None", tuple.option) || !strcasecmp("False", tuple.option)
|| !strcasecmp("Simplex", tuple.option)) || !strcasecmp("Simplex", tuple.option))
(*duplex)->WinDuplex = DMDUP_SIMPLEX; duplex->WinDuplex = DMDUP_SIMPLEX;
else if(!strcasecmp("DuplexNoTumble", tuple.option)) else if(!strcasecmp("DuplexNoTumble", tuple.option))
(*duplex)->WinDuplex = DMDUP_VERTICAL; duplex->WinDuplex = DMDUP_VERTICAL;
else if(!strcasecmp("DuplexTumble", tuple.option)) else if(!strcasecmp("DuplexTumble", tuple.option))
(*duplex)->WinDuplex = DMDUP_HORIZONTAL; duplex->WinDuplex = DMDUP_HORIZONTAL;
else if(!strcasecmp("Notcapable", tuple.option)) else if(!strcasecmp("Notcapable", tuple.option))
(*duplex)->WinDuplex = 0; duplex->WinDuplex = 0;
else { else {
FIXME("Unknown option %s for *Duplex defaulting to simplex\n", tuple.option); FIXME("Unknown option %s for *Duplex defaulting to simplex\n", tuple.option);
(*duplex)->WinDuplex = DMDUP_SIMPLEX; duplex->WinDuplex = DMDUP_SIMPLEX;
} }
tuple.option = tuple.opttrans = tuple.value = NULL; tuple.option = tuple.opttrans = tuple.value = NULL;
} }
...@@ -945,10 +943,13 @@ PPD *PSDRV_ParsePPD(char *fname) ...@@ -945,10 +943,13 @@ PPD *PSDRV_ParsePPD(char *fname)
} }
ppd->DefaultDuplex = NULL; ppd->DefaultDuplex = NULL;
if(default_duplex) { if (default_duplex)
{
DUPLEX *duplex; DUPLEX *duplex;
for(duplex = ppd->Duplexes; duplex; duplex = duplex->next) { LIST_FOR_EACH_ENTRY( duplex, &ppd->Duplexes, DUPLEX, entry )
if(!strcmp(duplex->Name, default_duplex)) { {
if (!strcmp(duplex->Name, default_duplex))
{
ppd->DefaultDuplex = duplex; ppd->DefaultDuplex = duplex;
TRACE("DefaultDuplex: %s\n", duplex->Name); TRACE("DefaultDuplex: %s\n", duplex->Name);
break; break;
...@@ -956,8 +957,9 @@ PPD *PSDRV_ParsePPD(char *fname) ...@@ -956,8 +957,9 @@ PPD *PSDRV_ParsePPD(char *fname)
} }
HeapFree(PSDRV_Heap, 0, default_duplex); HeapFree(PSDRV_Heap, 0, default_duplex);
} }
if(!ppd->DefaultDuplex) { if (!ppd->DefaultDuplex)
ppd->DefaultDuplex = ppd->Duplexes; {
ppd->DefaultDuplex = LIST_ENTRY( list_head( &ppd->Duplexes ), DUPLEX, entry );
TRACE("Setting DefaultDuplex to first in list\n"); TRACE("Setting DefaultDuplex to first in list\n");
} }
......
...@@ -372,7 +372,8 @@ INT PSDRV_WriteHeader( PHYSDEV dev, LPCWSTR title ) ...@@ -372,7 +372,8 @@ INT PSDRV_WriteHeader( PHYSDEV dev, LPCWSTR title )
win_duplex = physDev->Devmode->dmPublic.dmFields & DM_DUPLEX ? win_duplex = physDev->Devmode->dmPublic.dmFields & DM_DUPLEX ?
physDev->Devmode->dmPublic.dmDuplex : 0; physDev->Devmode->dmPublic.dmDuplex : 0;
for(duplex = physDev->pi->ppd->Duplexes; duplex; duplex = duplex->next) { LIST_FOR_EACH_ENTRY( duplex, &physDev->pi->ppd->Duplexes, DUPLEX, entry )
{
if(duplex->WinDuplex == win_duplex) { if(duplex->WinDuplex == win_duplex) {
if(duplex->InvocationString) { if(duplex->InvocationString) {
PSDRV_WriteFeature(dev, "*Duplex", duplex->Name, PSDRV_WriteFeature(dev, "*Duplex", duplex->Name,
......
...@@ -189,12 +189,13 @@ typedef struct ...@@ -189,12 +189,13 @@ typedef struct
typedef enum _RASTERIZEROPTION typedef enum _RASTERIZEROPTION
{RO_None, RO_Accept68K, RO_Type42, RO_TrueImage} RASTERIZEROPTION; {RO_None, RO_Accept68K, RO_Type42, RO_TrueImage} RASTERIZEROPTION;
typedef struct _tagDUPLEX { typedef struct
{
struct list entry;
char *Name; char *Name;
char *FullName; char *FullName;
char *InvocationString; char *InvocationString;
WORD WinDuplex; /* eg DMDUP_SIMPLEX */ WORD WinDuplex; /* eg DMDUP_SIMPLEX */
struct _tagDUPLEX *next;
} DUPLEX; } DUPLEX;
/* 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
...@@ -223,7 +224,7 @@ typedef struct { ...@@ -223,7 +224,7 @@ typedef struct {
struct list Constraints; struct list Constraints;
struct list InputSlots; struct list InputSlots;
RASTERIZEROPTION TTRasterizer; RASTERIZEROPTION TTRasterizer;
DUPLEX *Duplexes; struct list Duplexes;
DUPLEX *DefaultDuplex; DUPLEX *DefaultDuplex;
} PPD; } PPD;
......
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