Commit 277f4744 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

wineps.drv: Convert the page size list to a standard Wine list.

parent c69ebe3b
......@@ -67,7 +67,7 @@ void PSDRV_MergeDevmodes(PSDRV_DEVMODEA *dm1, PSDRV_DEVMODEA *dm2,
if(dm2->dmPublic.dmFields & DM_PAPERSIZE) {
PAGESIZE *page;
for(page = pi->ppd->PageSizes; page; page = page->next) {
LIST_FOR_EACH_ENTRY(page, &pi->ppd->PageSizes, PAGESIZE, entry) {
if(page->WinPage == dm2->dmPublic.u1.s1.dmPaperSize)
break;
}
......@@ -208,11 +208,13 @@ static INT_PTR CALLBACK PSDRV_PaperDlgProc(HWND hwnd, UINT msg,
di = (PSDRV_DLGINFO*)((PROPSHEETPAGEA*)lParam)->lParam;
SetWindowLongPtrW(hwnd, DWLP_USER, (LONG_PTR)di);
for(ps = di->pi->ppd->PageSizes, i = 0; ps; ps = ps->next, i++) {
i = 0;
LIST_FOR_EACH_ENTRY(ps, &di->pi->ppd->PageSizes, PAGESIZE, entry) {
SendDlgItemMessageA(hwnd, IDD_PAPERS, LB_INSERTSTRING, i,
(LPARAM)ps->FullName);
if(di->pi->Devmode->dmPublic.u1.s1.dmPaperSize == ps->WinPage)
Cursel = i;
i++;
}
SendDlgItemMessageA(hwnd, IDD_PAPERS, LB_SETCURSEL, Cursel, 0);
......@@ -242,8 +244,11 @@ static INT_PTR CALLBACK PSDRV_PaperDlgProc(HWND hwnd, UINT msg,
case IDD_PAPERS:
if(HIWORD(wParam) == LBN_SELCHANGE) {
Cursel = SendDlgItemMessageA(hwnd, LOWORD(wParam), LB_GETCURSEL, 0, 0);
for(i = 0, ps = di->pi->ppd->PageSizes; i < Cursel; i++, ps = ps->next)
;
i = 0;
LIST_FOR_EACH_ENTRY(ps, &di->pi->ppd->PageSizes, PAGESIZE, entry) {
if(i >= Cursel) break;
i++;
}
TRACE("Setting pagesize to item %d Winpage = %d\n", Cursel,
ps->WinPage);
di->dlgdm->dmPublic.u1.s1.dmPaperSize = ps->WinPage;
......@@ -461,9 +466,12 @@ DWORD PSDRV_DeviceCapabilities(LPSTR lpszDriver, LPCSTR lpszDevice, LPCSTR lpszP
WORD *wp = (WORD *)lpszOutput;
int i = 0;
for(ps = pi->ppd->PageSizes; ps; ps = ps->next, i++)
LIST_FOR_EACH_ENTRY(ps, &pi->ppd->PageSizes, PAGESIZE, entry)
{
i++;
if(lpszOutput != NULL)
*wp++ = ps->WinPage;
}
return i;
}
......@@ -473,12 +481,15 @@ DWORD PSDRV_DeviceCapabilities(LPSTR lpszDriver, LPCSTR lpszDevice, LPCSTR lpszP
POINT16 *pt = (POINT16 *)lpszOutput;
int i = 0;
for(ps = pi->ppd->PageSizes; ps; ps = ps->next, i++)
LIST_FOR_EACH_ENTRY(ps, &pi->ppd->PageSizes, PAGESIZE, entry)
{
i++;
if(lpszOutput != NULL) {
pt->x = ps->PaperDimension->x * 254.0 / 72.0;
pt->y = ps->PaperDimension->y * 254.0 / 72.0;
pt++;
}
}
return i;
}
......@@ -488,11 +499,14 @@ DWORD PSDRV_DeviceCapabilities(LPSTR lpszDriver, LPCSTR lpszDevice, LPCSTR lpszP
char *cp = lpszOutput;
int i = 0;
for(ps = pi->ppd->PageSizes; ps; ps = ps->next, i++)
LIST_FOR_EACH_ENTRY(ps, &pi->ppd->PageSizes, PAGESIZE, entry)
{
i++;
if(lpszOutput != NULL) {
lstrcpynA(cp, ps->FullName, 64);
cp += 64;
}
}
return i;
}
......@@ -576,15 +590,14 @@ DWORD PSDRV_DeviceCapabilities(LPSTR lpszDriver, LPCSTR lpszDevice, LPCSTR lpszP
case DC_MAXEXTENT:
{
PAGESIZE *ps;
int i;
POINT ptMax;
ptMax.x = ptMax.y = 0;
if(lpszOutput == NULL)
return -1;
i = 0;
for(ps = pi->ppd->PageSizes; ps; ps = ps->next, i++) {
LIST_FOR_EACH_ENTRY(ps, &pi->ppd->PageSizes, PAGESIZE, entry)
{
if(ps->PaperDimension->x > ptMax.x)
ptMax.x = ps->PaperDimension->x;
if(ps->PaperDimension->y > ptMax.y)
......@@ -597,15 +610,14 @@ DWORD PSDRV_DeviceCapabilities(LPSTR lpszDriver, LPCSTR lpszDevice, LPCSTR lpszP
case DC_MINEXTENT:
{
PAGESIZE *ps;
int i;
POINT ptMax;
ptMax.x = ptMax.y = 0;
if(lpszOutput == NULL)
return -1;
i = 0;
for(ps = pi->ppd->PageSizes; ps; ps = ps->next, i++) {
LIST_FOR_EACH_ENTRY(ps, &pi->ppd->PageSizes, PAGESIZE, entry)
{
if(ps->PaperDimension->x > ptMax.x)
ptMax.x = ps->PaperDimension->x;
if(ps->PaperDimension->y > ptMax.y)
......
......@@ -176,7 +176,7 @@ static void PSDRV_UpdateDevCaps( PSDRV_PDEVICE *physDev )
INT width = 0, height = 0;
if(physDev->Devmode->dmPublic.dmFields & DM_PAPERSIZE) {
for(page = physDev->pi->ppd->PageSizes; page; page = page->next) {
LIST_FOR_EACH_ENTRY(page, &physDev->pi->ppd->PageSizes, PAGESIZE, entry) {
if(page->WinPage == physDev->Devmode->dmPublic.u1.s1.dmPaperSize)
break;
}
......
......@@ -469,23 +469,17 @@ static BOOL PSDRV_PPDGetNextTuple(FILE *fp, PPDTuple *tuple)
*/
static PAGESIZE *PSDRV_PPDGetPageSizeInfo(PPD *ppd, char *name)
{
PAGESIZE *page = ppd->PageSizes, *lastpage;
PAGESIZE *page;
if(!page) {
page = ppd->PageSizes = HeapAlloc( PSDRV_Heap,
HEAP_ZERO_MEMORY, sizeof(*page) );
return page;
} else {
for( ; page; page = page->next) {
if(!strcmp(page->Name, name))
return page;
lastpage = page;
}
lastpage->next = HeapAlloc( PSDRV_Heap,
HEAP_ZERO_MEMORY, sizeof(*page) );
return lastpage->next;
LIST_FOR_EACH_ENTRY(page, &ppd->PageSizes, PAGESIZE, entry)
{
if(!strcmp(page->Name, name))
return page;
}
page = HeapAlloc( PSDRV_Heap, HEAP_ZERO_MEMORY, sizeof(*page) );
list_add_tail(&ppd->PageSizes, &page->entry);
return page;
}
/**********************************************************************
......@@ -573,6 +567,7 @@ PPD *PSDRV_ParsePPD(char *fname)
}
ppd->ColorDevice = CD_NotSpecified;
list_init(&ppd->PageSizes);
/*
* The Windows PostScript drivers create the following "virtual bin" for
......@@ -868,7 +863,7 @@ PPD *PSDRV_ParsePPD(char *fname)
ppd->DefaultPageSize = NULL;
if(default_pagesize) {
PAGESIZE *page;
for(page = ppd->PageSizes; page; page = page->next) {
LIST_FOR_EACH_ENTRY(page, &ppd->PageSizes, PAGESIZE, entry) {
if(!strcmp(page->Name, default_pagesize)) {
ppd->DefaultPageSize = page;
TRACE("DefaultPageSize: %s\n", page->Name);
......@@ -878,7 +873,7 @@ PPD *PSDRV_ParsePPD(char *fname)
HeapFree(PSDRV_Heap, 0, default_pagesize);
}
if(!ppd->DefaultPageSize) {
ppd->DefaultPageSize = ppd->PageSizes;
ppd->DefaultPageSize = LIST_ENTRY(list_head(&ppd->PageSizes), PAGESIZE, entry);
TRACE("Setting DefaultPageSize to first in list\n");
}
......@@ -911,7 +906,7 @@ PPD *PSDRV_ParsePPD(char *fname)
for(fn = ppd->InstalledFonts; fn; fn = fn->next)
TRACE("'%s'\n", fn->Name);
for(page = ppd->PageSizes; page; page = page->next) {
LIST_FOR_EACH_ENTRY(page, &ppd->PageSizes, PAGESIZE, entry) {
TRACE("'%s' aka '%s' (%d) invoked by '%s'\n", page->Name,
page->FullName, page->WinPage, page->InvocationString);
if(page->ImageableArea)
......
......@@ -365,7 +365,7 @@ INT PSDRV_WriteHeader( PSDRV_PDEVICE *physDev, LPCSTR title )
}
}
for(page = physDev->pi->ppd->PageSizes; page; page = page->next) {
LIST_FOR_EACH_ENTRY(page, &physDev->pi->ppd->PageSizes, PAGESIZE, entry) {
if(page->WinPage == physDev->Devmode->dmPublic.u1.s1.dmPaperSize) {
if(page->InvocationString) {
PSDRV_WriteFeature(physDev->job.hJob, "*PageSize", page->Name,
......
......@@ -29,6 +29,8 @@
#include "wine/wingdi16.h"
#include "winspool.h"
#include "wine/list.h"
typedef struct {
INT index;
LPCSTR sz;
......@@ -131,13 +133,13 @@ typedef struct {
/* Solaris kludge */
#undef PAGESIZE
typedef struct _tagPAGESIZE {
struct list entry;
char *Name;
char *FullName;
char *InvocationString;
IMAGEABLEAREA *ImageableArea;
PAPERDIMENSION *PaperDimension;
WORD WinPage; /*eg DMPAPER_A4. Doesn't really belong here */
struct _tagPAGESIZE *next;
} PAGESIZE;
......@@ -211,7 +213,7 @@ typedef struct {
char *JCLEnd;
char *DefaultFont;
FONTNAME *InstalledFonts; /* ptr to a list of FontNames */
PAGESIZE *PageSizes;
struct list PageSizes;
PAGESIZE *DefaultPageSize;
OPTION *InstalledOptions;
CONSTRAINT *Constraints;
......
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