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