Removed trailing whitespace.
[wine] / dlls / wineps / driver.c
1 /*
2  * Exported functions from the PostScript driver.
3  *
4  * [Ext]DeviceMode, DeviceCapabilities, AdvancedSetupDialog.
5  *
6  * Will need ExtTextOut for winword6 (urgh!)
7  *
8  * Copyright 1998  Huw D M Davies
9  *
10  * This library is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License as published by the Free Software Foundation; either
13  * version 2.1 of the License, or (at your option) any later version.
14  *
15  * This library is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18  * Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public
21  * License along with this library; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23  */
24
25 #include <string.h>
26 #include "psdrv.h"
27 #include "wine/debug.h"
28 #include "winuser.h"
29 #include "winspool.h"
30 #include "prsht.h"
31 #include "psdlg.h"
32
33 WINE_DEFAULT_DEBUG_CHANNEL(psdrv);
34
35
36 /************************************************************************
37  *
38  *              PSDRV_MergeDevmodes
39  *
40  * Updates dm1 with some fields from dm2
41  *
42  */
43 void PSDRV_MergeDevmodes(PSDRV_DEVMODEA *dm1, PSDRV_DEVMODEA *dm2,
44                          PRINTERINFO *pi)
45 {
46     /* some sanity checks here on dm2 */
47
48     if(dm2->dmPublic.dmFields & DM_ORIENTATION) {
49         dm1->dmPublic.u1.s1.dmOrientation = dm2->dmPublic.u1.s1.dmOrientation;
50         TRACE("Changing orientation to %d (%s)\n",
51               dm1->dmPublic.u1.s1.dmOrientation,
52               dm1->dmPublic.u1.s1.dmOrientation == DMORIENT_PORTRAIT ?
53               "Portrait" :
54               (dm1->dmPublic.u1.s1.dmOrientation == DMORIENT_LANDSCAPE ?
55                "Landscape" : "unknown"));
56     }
57
58     /* NB PaperWidth is always < PaperLength */
59     if(dm2->dmPublic.dmFields & DM_PAPERSIZE) {
60         PAGESIZE *page;
61
62         for(page = pi->ppd->PageSizes; page; page = page->next) {
63             if(page->WinPage == dm2->dmPublic.u1.s1.dmPaperSize)
64                 break;
65         }
66         if(page) {
67             dm1->dmPublic.u1.s1.dmPaperSize = dm2->dmPublic.u1.s1.dmPaperSize;
68             dm1->dmPublic.u1.s1.dmPaperWidth = page->PaperDimension->x *
69                                                                 254.0 / 72.0;
70             dm1->dmPublic.u1.s1.dmPaperLength = page->PaperDimension->y *
71                                                                 254.0 / 72.0;
72             dm1->dmPublic.dmFields &= ~(DM_PAPERLENGTH | DM_PAPERWIDTH);
73             dm1->dmPublic.dmFields |= DM_PAPERSIZE;
74             TRACE("Changing page to %s %d x %d\n", page->FullName,
75                   dm1->dmPublic.u1.s1.dmPaperWidth,
76                   dm1->dmPublic.u1.s1.dmPaperLength );
77         } else {
78             TRACE("Trying to change to unsupported pagesize %d\n",
79                       dm2->dmPublic.u1.s1.dmPaperSize);
80         }
81     } else if((dm2->dmPublic.dmFields & DM_PAPERLENGTH) &&
82        (dm2->dmPublic.dmFields & DM_PAPERWIDTH)) {
83         dm1->dmPublic.u1.s1.dmPaperLength = dm2->dmPublic.u1.s1.dmPaperLength;
84         dm1->dmPublic.u1.s1.dmPaperWidth = dm2->dmPublic.u1.s1.dmPaperWidth;
85         TRACE("Changing PaperLength|Width to %dx%d\n",
86               dm2->dmPublic.u1.s1.dmPaperLength,
87               dm2->dmPublic.u1.s1.dmPaperWidth);
88         dm1->dmPublic.dmFields &= ~DM_PAPERSIZE;
89         dm1->dmPublic.dmFields |= (DM_PAPERLENGTH | DM_PAPERWIDTH);
90     } else if(dm2->dmPublic.dmFields & (DM_PAPERLENGTH | DM_PAPERWIDTH)) {
91       /* You might think that this would be allowed if dm1 is in custom size
92          mode, but apparently Windows reverts to standard paper mode even in
93          this case */
94         FIXME("Trying to change only paperlength or paperwidth\n");
95         dm1->dmPublic.dmFields &= ~(DM_PAPERLENGTH | DM_PAPERWIDTH);
96         dm1->dmPublic.dmFields |= DM_PAPERSIZE;
97     }
98
99     if(dm2->dmPublic.dmFields & DM_SCALE) {
100         dm1->dmPublic.dmScale = dm2->dmPublic.dmScale;
101         TRACE("Changing Scale to %d\n", dm2->dmPublic.dmScale);
102     }
103
104     if(dm2->dmPublic.dmFields & DM_COPIES) {
105         dm1->dmPublic.dmCopies = dm2->dmPublic.dmCopies;
106         TRACE("Changing Copies to %d\n", dm2->dmPublic.dmCopies);
107     }
108
109     if(dm2->dmPublic.dmFields & DM_DEFAULTSOURCE) {
110         INPUTSLOT *slot;
111
112         for(slot = pi->ppd->InputSlots; slot; slot = slot->next) {
113             if(slot->WinBin == dm2->dmPublic.dmDefaultSource)
114                 break;
115         }
116         if(slot) {
117             dm1->dmPublic.dmDefaultSource = dm2->dmPublic.dmDefaultSource;
118             TRACE("Changing bin to '%s'\n", slot->FullName);
119         } else {
120           TRACE("Trying to change to unsupported bin %d\n",
121                 dm2->dmPublic.dmDefaultSource);
122         }
123     }
124
125    if (dm2->dmPublic.dmFields & DM_DEFAULTSOURCE )
126        dm1->dmPublic.dmDefaultSource = dm2->dmPublic.dmDefaultSource;
127    if (dm2->dmPublic.dmFields & DM_PRINTQUALITY )
128        dm1->dmPublic.dmPrintQuality = dm2->dmPublic.dmPrintQuality;
129    if (dm2->dmPublic.dmFields & DM_COLOR )
130        dm1->dmPublic.dmColor = dm2->dmPublic.dmColor;
131    if (dm2->dmPublic.dmFields & DM_DUPLEX )
132        dm1->dmPublic.dmDuplex = dm2->dmPublic.dmDuplex;
133    if (dm2->dmPublic.dmFields & DM_YRESOLUTION )
134        dm1->dmPublic.dmYResolution = dm2->dmPublic.dmYResolution;
135    if (dm2->dmPublic.dmFields & DM_TTOPTION )
136        dm1->dmPublic.dmTTOption = dm2->dmPublic.dmTTOption;
137    if (dm2->dmPublic.dmFields & DM_COLLATE )
138        dm1->dmPublic.dmCollate = dm2->dmPublic.dmCollate;
139    if (dm2->dmPublic.dmFields & DM_FORMNAME )
140        lstrcpynA(dm1->dmPublic.dmFormName, dm2->dmPublic.dmFormName, CCHFORMNAME);
141    if (dm2->dmPublic.dmFields & DM_BITSPERPEL )
142        dm1->dmPublic.dmBitsPerPel = dm2->dmPublic.dmBitsPerPel;
143    if (dm2->dmPublic.dmFields & DM_PELSWIDTH )
144        dm1->dmPublic.dmPelsWidth = dm2->dmPublic.dmPelsWidth;
145    if (dm2->dmPublic.dmFields & DM_PELSHEIGHT )
146        dm1->dmPublic.dmPelsHeight = dm2->dmPublic.dmPelsHeight;
147    if (dm2->dmPublic.dmFields & DM_DISPLAYFLAGS )
148        dm1->dmPublic.dmDisplayFlags = dm2->dmPublic.dmDisplayFlags;
149    if (dm2->dmPublic.dmFields & DM_DISPLAYFREQUENCY )
150        dm1->dmPublic.dmDisplayFrequency = dm2->dmPublic.dmDisplayFrequency;
151    if (dm2->dmPublic.dmFields & DM_POSITION )
152        dm1->dmPublic.u1.dmPosition = dm2->dmPublic.u1.dmPosition;
153    if (dm2->dmPublic.dmFields & DM_LOGPIXELS )
154        dm1->dmPublic.dmLogPixels = dm2->dmPublic.dmLogPixels;
155    if (dm2->dmPublic.dmFields & DM_ICMMETHOD )
156        dm1->dmPublic.dmICMMethod = dm2->dmPublic.dmICMMethod;
157    if (dm2->dmPublic.dmFields & DM_ICMINTENT )
158        dm1->dmPublic.dmICMIntent = dm2->dmPublic.dmICMIntent;
159    if (dm2->dmPublic.dmFields & DM_MEDIATYPE )
160        dm1->dmPublic.dmMediaType = dm2->dmPublic.dmMediaType;
161    if (dm2->dmPublic.dmFields & DM_DITHERTYPE )
162        dm1->dmPublic.dmDitherType = dm2->dmPublic.dmDitherType;
163    if (dm2->dmPublic.dmFields & DM_PANNINGWIDTH )
164        dm1->dmPublic.dmPanningWidth = dm2->dmPublic.dmPanningWidth;
165    if (dm2->dmPublic.dmFields & DM_PANNINGHEIGHT )
166        dm1->dmPublic.dmPanningHeight = dm2->dmPublic.dmPanningHeight;
167
168     return;
169 }
170
171
172 /**************************************************************
173  *      AdvancedSetupDialog     [WINEPS16.93]
174  *
175  */
176 WORD WINAPI PSDRV_AdvancedSetupDialog16(HWND16 hwnd, HANDLE16 hDriver,
177                                          LPDEVMODEA devin, LPDEVMODEA devout)
178 {
179
180   TRACE("hwnd = %04x, hDriver = %04x devin=%p devout=%p\n", hwnd,
181         hDriver, devin, devout);
182   return IDCANCEL;
183 }
184
185 /****************************************************************
186  *       PSDRV_PaperDlgProc
187  *
188  * Dialog proc for 'Paper' propsheet
189  */
190 BOOL WINAPI PSDRV_PaperDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
191                                lParam)
192 {
193   PSDRV_DLGINFO *di;
194   int i, Cursel = 0;
195   PAGESIZE *ps;
196
197
198   switch(msg) {
199   case WM_INITDIALOG:
200     di = (PSDRV_DLGINFO*)((PROPSHEETPAGEA*)lParam)->lParam;
201     SetWindowLongA(hwnd, DWL_USER, (LONG)di);
202
203     for(ps = di->pi->ppd->PageSizes, i = 0; ps; ps = ps->next, i++) {
204       SendDlgItemMessageA(hwnd, IDD_PAPERS, LB_INSERTSTRING, i,
205                           (LPARAM)ps->FullName);
206       if(di->pi->Devmode->dmPublic.u1.s1.dmPaperSize == ps->WinPage)
207         Cursel = i;
208     }
209     SendDlgItemMessageA(hwnd, IDD_PAPERS, LB_SETCURSEL, Cursel, 0);
210
211     CheckRadioButton(hwnd, IDD_ORIENT_PORTRAIT, IDD_ORIENT_LANDSCAPE,
212                      di->pi->Devmode->dmPublic.u1.s1.dmOrientation ==
213                      DMORIENT_PORTRAIT ? IDD_ORIENT_PORTRAIT :
214                      IDD_ORIENT_LANDSCAPE);
215     break;
216
217   case WM_COMMAND:
218     di = (PSDRV_DLGINFO *)GetWindowLongA(hwnd, DWL_USER);
219     switch(LOWORD(wParam)) {
220     case IDD_PAPERS:
221       if(HIWORD(wParam) == LBN_SELCHANGE) {
222         Cursel = SendDlgItemMessageA(hwnd, LOWORD(wParam), LB_GETCURSEL, 0, 0);
223         for(i = 0, ps = di->pi->ppd->PageSizes; i < Cursel; i++, ps = ps->next)
224           ;
225         TRACE("Setting pagesize to item %d Winpage = %d\n", Cursel,
226               ps->WinPage);
227         di->dlgdm->dmPublic.u1.s1.dmPaperSize = ps->WinPage;
228       }
229       break;
230     case IDD_ORIENT_PORTRAIT:
231     case IDD_ORIENT_LANDSCAPE:
232       TRACE("Setting orientation to %s\n", wParam == IDD_ORIENT_PORTRAIT ?
233             "portrait" : "landscape");
234       di->dlgdm->dmPublic.u1.s1.dmOrientation = wParam == IDD_ORIENT_PORTRAIT ?
235         DMORIENT_PORTRAIT : DMORIENT_LANDSCAPE;
236       break;
237     }
238     break;
239
240   case WM_NOTIFY:
241    {
242     NMHDR *nmhdr = (NMHDR *)lParam;
243     di = (PSDRV_DLGINFO *)GetWindowLongA(hwnd, DWL_USER);
244     switch(nmhdr->code) {
245     case PSN_APPLY:
246       memcpy(di->pi->Devmode, di->dlgdm, sizeof(PSDRV_DEVMODEA));
247       SetWindowLongA(hwnd, DWL_MSGRESULT, PSNRET_NOERROR);
248       return TRUE;
249       break;
250
251     default:
252       return FALSE;
253       break;
254     }
255     break;
256    }
257
258   default:
259     return FALSE;
260   }
261   return TRUE;
262 }
263
264
265 static void (WINAPI *pInitCommonControls) (void);
266 static HPROPSHEETPAGE (WINAPI *pCreatePropertySheetPage) (LPCPROPSHEETPAGEW);
267 static int (WINAPI *pPropertySheet) (LPCPROPSHEETHEADERW);
268
269 /***************************************************************
270  *      ExtDeviceMode   [WINEPS16.90]
271  *
272  * Just returns default devmode at the moment
273  */
274 INT16 WINAPI PSDRV_ExtDeviceMode16(HWND16 hwnd, HANDLE16 hDriver,
275                                    LPDEVMODEA lpdmOutput, LPSTR lpszDevice,
276                                    LPSTR lpszPort, LPDEVMODEA lpdmInput,
277                                    LPSTR lpszProfile, WORD fwMode)
278 {
279   PRINTERINFO *pi = PSDRV_FindPrinterInfo(lpszDevice);
280   if(!pi) return -1;
281
282   TRACE("(hwnd=%04x, hDriver=%04x, devOut=%p, Device='%s', Port='%s', devIn=%p, Profile='%s', Mode=%04x)\n",
283 hwnd, hDriver, lpdmOutput, lpszDevice, lpszPort, lpdmInput, lpszProfile,
284 fwMode);
285
286   if(!fwMode)
287     return sizeof(DEVMODEA); /* Just copy dmPublic bit of PSDRV_DEVMODE */
288
289   if((fwMode & DM_MODIFY) && lpdmInput) {
290     TRACE("DM_MODIFY set. devIn->dmFields = %08lx\n", lpdmInput->dmFields);
291     PSDRV_MergeDevmodes(pi->Devmode, (PSDRV_DEVMODEA *)lpdmInput, pi);
292   }
293
294   if(fwMode & DM_PROMPT) {
295     HINSTANCE hinstComctl32, hinstWineps32 = LoadLibraryA("WINEPS");
296     HPROPSHEETPAGE hpsp[1];
297     PROPSHEETPAGEW psp;
298     PROPSHEETHEADERW psh;
299     PSDRV_DLGINFO *di;
300     PSDRV_DEVMODEA *dlgdm;
301     static const WCHAR PAPERW[] = {'P','A','P','E','R','\0'};
302     static const WCHAR SetupW[] = {'S','e','t','u','p','\0'};
303
304     hinstComctl32 = LoadLibraryA("comctl32.dll");
305     pInitCommonControls = (void*)GetProcAddress(hinstComctl32,
306                                                 "InitCommonControls");
307     pCreatePropertySheetPage = (void*)GetProcAddress(hinstComctl32,
308                                                     "CreatePropertySheetPageW");
309     pPropertySheet = (void*)GetProcAddress(hinstComctl32, "PropertySheetW");
310     memset(&psp,0,sizeof(psp));
311     dlgdm = HeapAlloc( PSDRV_Heap, 0, sizeof(*dlgdm) );
312     memcpy(dlgdm, pi->Devmode, sizeof(*dlgdm));
313     di = HeapAlloc( PSDRV_Heap, 0, sizeof(*di) );
314     di->pi = pi;
315     di->dlgdm = dlgdm;
316     psp.dwSize = sizeof(psp);
317     psp.hInstance = hinstWineps32;
318     psp.u.pszTemplate = PAPERW;
319     psp.u2.pszIcon = NULL;
320     psp.pfnDlgProc = PSDRV_PaperDlgProc;
321     psp.lParam = (LPARAM)di;
322     hpsp[0] = pCreatePropertySheetPage(&psp);
323
324     memset(&psh, 0, sizeof(psh));
325     psh.dwSize = sizeof(psh);
326     psh.pszCaption = SetupW;
327     psh.nPages = 1;
328     psh.hwndParent = hwnd;
329     psh.u3.phpage = hpsp;
330
331     pPropertySheet(&psh);
332
333   }
334   if(fwMode & DM_UPDATE)
335     FIXME("Mode DM_UPDATE.  Just do the same as DM_COPY\n");
336
337   if((fwMode & DM_COPY) || (fwMode & DM_UPDATE)) {
338     memcpy(lpdmOutput, pi->Devmode, sizeof(DEVMODEA));
339   }
340   return IDOK;
341 }
342
343 /**************************************************************
344  *
345  *       PSDRV_ExtDeviceMode
346  */
347 INT PSDRV_ExtDeviceMode(LPSTR lpszDriver, HWND hwnd, LPDEVMODEA lpdmOutput,
348                         LPSTR lpszDevice, LPSTR lpszPort, LPDEVMODEA lpdmInput,
349                         LPSTR lpszProfile, DWORD dwMode)
350 {
351     return PSDRV_ExtDeviceMode16(hwnd, 0, lpdmOutput, lpszDevice, lpszPort,
352                                  lpdmInput, lpszProfile, dwMode);
353 }
354
355 /***********************************************************************
356  *      DeviceCapabilities      [WINEPS16.91]
357  *
358  */
359 DWORD WINAPI PSDRV_DeviceCapabilities16(LPCSTR lpszDevice, LPCSTR lpszPort,
360                                         WORD fwCapability, LPSTR lpszOutput,
361                                         LPDEVMODEA lpDevMode)
362 {
363   PRINTERINFO *pi;
364   DEVMODEA *lpdm;
365   pi = PSDRV_FindPrinterInfo(lpszDevice);
366
367   TRACE("Cap=%d. Got PrinterInfo = %p\n", fwCapability, pi);
368
369
370   if (!pi) {
371           ERR("no printerinfo for %s, return 0!\n",lpszDevice);
372           return 0;
373   }
374
375
376   lpdm = lpDevMode ? lpDevMode : (DEVMODEA *)pi->Devmode;
377
378   switch(fwCapability) {
379
380   case DC_PAPERS:
381     {
382       PAGESIZE *ps;
383       WORD *wp = (WORD *)lpszOutput;
384       int i = 0;
385
386       for(ps = pi->ppd->PageSizes; ps; ps = ps->next, i++)
387         if(lpszOutput != NULL)
388           *wp++ = ps->WinPage;
389       return i;
390     }
391
392   case DC_PAPERSIZE:
393     {
394       PAGESIZE *ps;
395       POINT16 *pt = (POINT16 *)lpszOutput;
396       int i = 0;
397
398       for(ps = pi->ppd->PageSizes; ps; ps = ps->next, i++)
399         if(lpszOutput != NULL) {
400           pt->x = ps->PaperDimension->x * 254.0 / 72.0;
401           pt->y = ps->PaperDimension->y * 254.0 / 72.0;
402           pt++;
403         }
404       return i;
405     }
406
407   case DC_PAPERNAMES:
408     {
409       PAGESIZE *ps;
410       char *cp = lpszOutput;
411       int i = 0;
412
413       for(ps = pi->ppd->PageSizes; ps; ps = ps->next, i++)
414         if(lpszOutput != NULL) {
415           lstrcpynA(cp, ps->FullName, 64);
416           cp += 64;
417         }
418       return i;
419     }
420
421   case DC_ORIENTATION:
422     return pi->ppd->LandscapeOrientation ? pi->ppd->LandscapeOrientation : 90;
423
424   case DC_BINS:
425     {
426       INPUTSLOT *slot;
427       WORD *wp = (WORD *)lpszOutput;
428       int i = 0;
429
430       /* We explicitly list DMBIN_AUTO first; actually while win9x does this
431          win2000 lists DMBIN_FORMSOURCE instead. */
432       i++;
433       if(lpszOutput != NULL)
434         *wp++ = DMBIN_AUTO;
435
436       for(slot = pi->ppd->InputSlots; slot; slot = slot->next, i++)
437         if(lpszOutput != NULL)
438           *wp++ = slot->WinBin;
439       return i;
440     }
441
442   case DC_BINNAMES:
443     {
444       INPUTSLOT *slot;
445       char *cp = lpszOutput;
446       int i = 0;
447
448       /* Add an entry corresponding to DMBIN_AUTO, see DC_BINS */
449       i++;
450       if(lpszOutput != NULL) {
451         strcpy(cp, "Automatically Select");
452         cp += 24;
453       }
454
455       for(slot = pi->ppd->InputSlots; slot; slot = slot->next, i++)
456         if(lpszOutput != NULL) {
457           lstrcpynA(cp, slot->FullName, 24);
458           cp += 24;
459         }
460       return i;
461     }
462
463   case DC_BINADJUST:
464     FIXME("DC_BINADJUST: stub.\n");
465     return DCBA_FACEUPNONE;
466
467   case DC_ENUMRESOLUTIONS:
468     {
469       LONG *lp = (LONG*)lpszOutput;
470
471       if(lpszOutput != NULL) {
472         lp[0] = (LONG)pi->ppd->DefaultResolution;
473         lp[1] = (LONG)pi->ppd->DefaultResolution;
474       }
475       return 1;
476     }
477
478   case DC_COPIES:
479     FIXME("DC_COPIES: returning %d.  Is this correct?\n", lpdm->dmCopies);
480     return lpdm->dmCopies;
481
482   case DC_DRIVER:
483     return lpdm->dmDriverVersion;
484
485   case DC_DATATYPE_PRODUCED:
486     FIXME("DATA_TYPE_PRODUCED: stub.\n");
487     return -1; /* simulate that the driver supports 'RAW' */
488
489   case DC_DUPLEX:
490     FIXME("DC_DUPLEX: returning %d.  Is this correct?\n", lpdm->dmDuplex);
491     return lpdm->dmDuplex;
492
493   case DC_EMF_COMPLIANT:
494     FIXME("DC_EMF_COMPLIANT: stub.\n");
495     return -1; /* simulate that the driver do not support EMF */
496
497   case DC_EXTRA:
498     return lpdm->dmDriverExtra;
499
500   case DC_FIELDS:
501     return lpdm->dmFields;
502
503   case DC_FILEDEPENDENCIES:
504     FIXME("DC_FILEDEPENDENCIES: stub.\n");
505     return 0;
506
507   case DC_MAXEXTENT:
508     {
509       PAGESIZE *ps;
510       int i;
511       POINT ptMax;
512       ptMax.x = ptMax.y = 0;
513
514       if(lpszOutput == NULL)
515         return -1;
516
517       i = 0;
518       for(ps = pi->ppd->PageSizes; ps; ps = ps->next, i++) {
519         if(ps->PaperDimension->x > ptMax.x)
520           ptMax.x = ps->PaperDimension->x;
521         if(ps->PaperDimension->y > ptMax.y)
522           ptMax.y = ps->PaperDimension->y;
523       }
524       *((POINT*)lpszOutput) = ptMax;
525       return 1;
526     }
527
528   case DC_MINEXTENT:
529     {
530       PAGESIZE *ps;
531       int i;
532       POINT ptMax;
533       ptMax.x = ptMax.y = 0;
534
535       if(lpszOutput == NULL)
536         return -1;
537
538       i = 0;
539       for(ps = pi->ppd->PageSizes; ps; ps = ps->next, i++) {
540         if(ps->PaperDimension->x > ptMax.x)
541           ptMax.x = ps->PaperDimension->x;
542         if(ps->PaperDimension->y > ptMax.y)
543           ptMax.y = ps->PaperDimension->y;
544       }
545       *((POINT*)lpszOutput) = ptMax;
546       return 1;
547     }
548
549   case DC_SIZE:
550     return lpdm->dmSize;
551
552   case DC_TRUETYPE:
553     FIXME("DC_TRUETYPE: stub\n");
554     return DCTT_SUBDEV;
555
556   case DC_VERSION:
557     return lpdm->dmSpecVersion;
558
559   default:
560     FIXME("Unsupported capability %d\n", fwCapability);
561   }
562   return -1;
563 }
564
565 /**************************************************************
566  *
567  *     PSDRV_DeviceCapabilities
568  */
569 DWORD PSDRV_DeviceCapabilities(LPSTR lpszDriver, LPCSTR lpszDevice,
570                                LPCSTR lpszPort, WORD fwCapability,
571                                LPSTR lpszOutput, LPDEVMODEA lpdm)
572 {
573     return PSDRV_DeviceCapabilities16(lpszDevice, lpszPort, fwCapability,
574                                       lpszOutput, lpdm);
575 }
576
577 /***************************************************************
578  *      DeviceMode      [WINEPS16.13]
579  *
580  */
581 void WINAPI PSDRV_DeviceMode16(HWND16 hwnd, HANDLE16 hDriver,
582 LPSTR lpszDevice, LPSTR lpszPort)
583 {
584     PSDRV_ExtDeviceMode16( hwnd, hDriver, NULL, lpszDevice, lpszPort, NULL,
585                            NULL, DM_PROMPT );
586     return;
587 }
588
589 #if 0
590 typedef struct {
591   DWORD nPages;
592   DWORD Unknown;
593   HPROPSHEETPAGE hPages[10];
594 } EDMPS;
595
596 INT PSDRV_ExtDeviceModePropSheet(HWND hwnd, LPSTR lpszDevice, LPSTR lpszPort,
597                                  LPVOID pPropSheet)
598 {
599     EDMPS *ps = pPropSheet;
600     PROPSHEETPAGE psp;
601
602     psp->dwSize = sizeof(psp);
603     psp->hInstance = 0x1234;
604
605     ps->nPages = 1;
606
607 }
608
609 #endif