Release 20030408.
[wine/gsoc-2012-control.git] / dlls / wineps / driver.c
blob6230b6550c67f2823991f0e9dceab41481a8af71
1 /*
2 * Exported functions from the PostScript driver.
4 * [Ext]DeviceMode, DeviceCapabilities, AdvancedSetupDialog.
6 * Will need ExtTextOut for winword6 (urgh!)
8 * Copyright 1998 Huw D M Davies
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.
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.
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
25 #include <string.h>
27 #define NONAMELESSUNION
28 #define NONAMELESSSTRUCT
29 #include "psdrv.h"
30 #include <wine/debug.h>
31 #include <winuser.h>
32 #include <wownt32.h>
33 #include <winspool.h>
34 #include <prsht.h>
35 #include "psdlg.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(psdrv);
40 /************************************************************************
42 * PSDRV_MergeDevmodes
44 * Updates dm1 with some fields from dm2
47 void PSDRV_MergeDevmodes(PSDRV_DEVMODEA *dm1, PSDRV_DEVMODEA *dm2,
48 PRINTERINFO *pi)
50 /* some sanity checks here on dm2 */
52 if(dm2->dmPublic.dmFields & DM_ORIENTATION) {
53 dm1->dmPublic.u1.s1.dmOrientation = dm2->dmPublic.u1.s1.dmOrientation;
54 TRACE("Changing orientation to %d (%s)\n",
55 dm1->dmPublic.u1.s1.dmOrientation,
56 dm1->dmPublic.u1.s1.dmOrientation == DMORIENT_PORTRAIT ?
57 "Portrait" :
58 (dm1->dmPublic.u1.s1.dmOrientation == DMORIENT_LANDSCAPE ?
59 "Landscape" : "unknown"));
62 /* NB PaperWidth is always < PaperLength */
63 if(dm2->dmPublic.dmFields & DM_PAPERSIZE) {
64 PAGESIZE *page;
66 for(page = pi->ppd->PageSizes; page; page = page->next) {
67 if(page->WinPage == dm2->dmPublic.u1.s1.dmPaperSize)
68 break;
70 if(page) {
71 dm1->dmPublic.u1.s1.dmPaperSize = dm2->dmPublic.u1.s1.dmPaperSize;
72 dm1->dmPublic.u1.s1.dmPaperWidth = page->PaperDimension->x *
73 254.0 / 72.0;
74 dm1->dmPublic.u1.s1.dmPaperLength = page->PaperDimension->y *
75 254.0 / 72.0;
76 dm1->dmPublic.dmFields &= ~(DM_PAPERLENGTH | DM_PAPERWIDTH);
77 dm1->dmPublic.dmFields |= DM_PAPERSIZE;
78 TRACE("Changing page to %s %d x %d\n", page->FullName,
79 dm1->dmPublic.u1.s1.dmPaperWidth,
80 dm1->dmPublic.u1.s1.dmPaperLength );
81 } else {
82 TRACE("Trying to change to unsupported pagesize %d\n",
83 dm2->dmPublic.u1.s1.dmPaperSize);
85 } else if((dm2->dmPublic.dmFields & DM_PAPERLENGTH) &&
86 (dm2->dmPublic.dmFields & DM_PAPERWIDTH)) {
87 dm1->dmPublic.u1.s1.dmPaperLength = dm2->dmPublic.u1.s1.dmPaperLength;
88 dm1->dmPublic.u1.s1.dmPaperWidth = dm2->dmPublic.u1.s1.dmPaperWidth;
89 TRACE("Changing PaperLength|Width to %dx%d\n",
90 dm2->dmPublic.u1.s1.dmPaperLength,
91 dm2->dmPublic.u1.s1.dmPaperWidth);
92 dm1->dmPublic.dmFields &= ~DM_PAPERSIZE;
93 dm1->dmPublic.dmFields |= (DM_PAPERLENGTH | DM_PAPERWIDTH);
94 } else if(dm2->dmPublic.dmFields & (DM_PAPERLENGTH | DM_PAPERWIDTH)) {
95 /* You might think that this would be allowed if dm1 is in custom size
96 mode, but apparently Windows reverts to standard paper mode even in
97 this case */
98 FIXME("Trying to change only paperlength or paperwidth\n");
99 dm1->dmPublic.dmFields &= ~(DM_PAPERLENGTH | DM_PAPERWIDTH);
100 dm1->dmPublic.dmFields |= DM_PAPERSIZE;
103 if(dm2->dmPublic.dmFields & DM_SCALE) {
104 dm1->dmPublic.dmScale = dm2->dmPublic.dmScale;
105 TRACE("Changing Scale to %d\n", dm2->dmPublic.dmScale);
108 if(dm2->dmPublic.dmFields & DM_COPIES) {
109 dm1->dmPublic.dmCopies = dm2->dmPublic.dmCopies;
110 TRACE("Changing Copies to %d\n", dm2->dmPublic.dmCopies);
113 if(dm2->dmPublic.dmFields & DM_DEFAULTSOURCE) {
114 INPUTSLOT *slot;
116 for(slot = pi->ppd->InputSlots; slot; slot = slot->next) {
117 if(slot->WinBin == dm2->dmPublic.dmDefaultSource)
118 break;
120 if(slot) {
121 dm1->dmPublic.dmDefaultSource = dm2->dmPublic.dmDefaultSource;
122 TRACE("Changing bin to '%s'\n", slot->FullName);
123 } else {
124 TRACE("Trying to change to unsupported bin %d\n",
125 dm2->dmPublic.dmDefaultSource);
129 if (dm2->dmPublic.dmFields & DM_DEFAULTSOURCE )
130 dm1->dmPublic.dmDefaultSource = dm2->dmPublic.dmDefaultSource;
131 if (dm2->dmPublic.dmFields & DM_PRINTQUALITY )
132 dm1->dmPublic.dmPrintQuality = dm2->dmPublic.dmPrintQuality;
133 if (dm2->dmPublic.dmFields & DM_COLOR )
134 dm1->dmPublic.dmColor = dm2->dmPublic.dmColor;
135 if (dm2->dmPublic.dmFields & DM_DUPLEX )
136 dm1->dmPublic.dmDuplex = dm2->dmPublic.dmDuplex;
137 if (dm2->dmPublic.dmFields & DM_YRESOLUTION )
138 dm1->dmPublic.dmYResolution = dm2->dmPublic.dmYResolution;
139 if (dm2->dmPublic.dmFields & DM_TTOPTION )
140 dm1->dmPublic.dmTTOption = dm2->dmPublic.dmTTOption;
141 if (dm2->dmPublic.dmFields & DM_COLLATE )
142 dm1->dmPublic.dmCollate = dm2->dmPublic.dmCollate;
143 if (dm2->dmPublic.dmFields & DM_FORMNAME )
144 lstrcpynA(dm1->dmPublic.dmFormName, dm2->dmPublic.dmFormName, CCHFORMNAME);
145 if (dm2->dmPublic.dmFields & DM_BITSPERPEL )
146 dm1->dmPublic.dmBitsPerPel = dm2->dmPublic.dmBitsPerPel;
147 if (dm2->dmPublic.dmFields & DM_PELSWIDTH )
148 dm1->dmPublic.dmPelsWidth = dm2->dmPublic.dmPelsWidth;
149 if (dm2->dmPublic.dmFields & DM_PELSHEIGHT )
150 dm1->dmPublic.dmPelsHeight = dm2->dmPublic.dmPelsHeight;
151 if (dm2->dmPublic.dmFields & DM_DISPLAYFLAGS )
152 dm1->dmPublic.dmDisplayFlags = dm2->dmPublic.dmDisplayFlags;
153 if (dm2->dmPublic.dmFields & DM_DISPLAYFREQUENCY )
154 dm1->dmPublic.dmDisplayFrequency = dm2->dmPublic.dmDisplayFrequency;
155 if (dm2->dmPublic.dmFields & DM_POSITION )
156 dm1->dmPublic.u1.dmPosition = dm2->dmPublic.u1.dmPosition;
157 if (dm2->dmPublic.dmFields & DM_LOGPIXELS )
158 dm1->dmPublic.dmLogPixels = dm2->dmPublic.dmLogPixels;
159 if (dm2->dmPublic.dmFields & DM_ICMMETHOD )
160 dm1->dmPublic.dmICMMethod = dm2->dmPublic.dmICMMethod;
161 if (dm2->dmPublic.dmFields & DM_ICMINTENT )
162 dm1->dmPublic.dmICMIntent = dm2->dmPublic.dmICMIntent;
163 if (dm2->dmPublic.dmFields & DM_MEDIATYPE )
164 dm1->dmPublic.dmMediaType = dm2->dmPublic.dmMediaType;
165 if (dm2->dmPublic.dmFields & DM_DITHERTYPE )
166 dm1->dmPublic.dmDitherType = dm2->dmPublic.dmDitherType;
167 if (dm2->dmPublic.dmFields & DM_PANNINGWIDTH )
168 dm1->dmPublic.dmPanningWidth = dm2->dmPublic.dmPanningWidth;
169 if (dm2->dmPublic.dmFields & DM_PANNINGHEIGHT )
170 dm1->dmPublic.dmPanningHeight = dm2->dmPublic.dmPanningHeight;
172 return;
176 /**************************************************************
177 * AdvancedSetupDialog [WINEPS16.93]
180 WORD WINAPI PSDRV_AdvancedSetupDialog16(HWND16 hwnd, HANDLE16 hDriver,
181 LPDEVMODEA devin, LPDEVMODEA devout)
184 TRACE("hwnd = %04x, hDriver = %04x devin=%p devout=%p\n", hwnd,
185 hDriver, devin, devout);
186 return IDCANCEL;
189 /****************************************************************
190 * PSDRV_PaperDlgProc
192 * Dialog proc for 'Paper' propsheet
194 INT_PTR CALLBACK PSDRV_PaperDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
195 lParam)
197 PSDRV_DLGINFO *di;
198 int i, Cursel = 0;
199 PAGESIZE *ps;
202 switch(msg) {
203 case WM_INITDIALOG:
204 di = (PSDRV_DLGINFO*)((PROPSHEETPAGEA*)lParam)->lParam;
205 SetWindowLongA(hwnd, DWL_USER, (LONG)di);
207 for(ps = di->pi->ppd->PageSizes, i = 0; ps; ps = ps->next, i++) {
208 SendDlgItemMessageA(hwnd, IDD_PAPERS, LB_INSERTSTRING, i,
209 (LPARAM)ps->FullName);
210 if(di->pi->Devmode->dmPublic.u1.s1.dmPaperSize == ps->WinPage)
211 Cursel = i;
213 SendDlgItemMessageA(hwnd, IDD_PAPERS, LB_SETCURSEL, Cursel, 0);
215 CheckRadioButton(hwnd, IDD_ORIENT_PORTRAIT, IDD_ORIENT_LANDSCAPE,
216 di->pi->Devmode->dmPublic.u1.s1.dmOrientation ==
217 DMORIENT_PORTRAIT ? IDD_ORIENT_PORTRAIT :
218 IDD_ORIENT_LANDSCAPE);
219 break;
221 case WM_COMMAND:
222 di = (PSDRV_DLGINFO *)GetWindowLongA(hwnd, DWL_USER);
223 switch(LOWORD(wParam)) {
224 case IDD_PAPERS:
225 if(HIWORD(wParam) == LBN_SELCHANGE) {
226 Cursel = SendDlgItemMessageA(hwnd, LOWORD(wParam), LB_GETCURSEL, 0, 0);
227 for(i = 0, ps = di->pi->ppd->PageSizes; i < Cursel; i++, ps = ps->next)
229 TRACE("Setting pagesize to item %d Winpage = %d\n", Cursel,
230 ps->WinPage);
231 di->dlgdm->dmPublic.u1.s1.dmPaperSize = ps->WinPage;
233 break;
234 case IDD_ORIENT_PORTRAIT:
235 case IDD_ORIENT_LANDSCAPE:
236 TRACE("Setting orientation to %s\n", wParam == IDD_ORIENT_PORTRAIT ?
237 "portrait" : "landscape");
238 di->dlgdm->dmPublic.u1.s1.dmOrientation = wParam == IDD_ORIENT_PORTRAIT ?
239 DMORIENT_PORTRAIT : DMORIENT_LANDSCAPE;
240 break;
242 break;
244 case WM_NOTIFY:
246 NMHDR *nmhdr = (NMHDR *)lParam;
247 di = (PSDRV_DLGINFO *)GetWindowLongA(hwnd, DWL_USER);
248 switch(nmhdr->code) {
249 case PSN_APPLY:
250 memcpy(di->pi->Devmode, di->dlgdm, sizeof(PSDRV_DEVMODEA));
251 SetWindowLongA(hwnd, DWL_MSGRESULT, PSNRET_NOERROR);
252 return TRUE;
253 break;
255 default:
256 return FALSE;
257 break;
259 break;
262 default:
263 return FALSE;
265 return TRUE;
269 static void (WINAPI *pInitCommonControls) (void);
270 static HPROPSHEETPAGE (WINAPI *pCreatePropertySheetPage) (LPCPROPSHEETPAGEW);
271 static int (WINAPI *pPropertySheet) (LPCPROPSHEETHEADERW);
274 /******************************************************************
275 * PSDRV_ExtDeviceMode
277 * Retrieves or modifies device-initialization information for the PostScript
278 * driver, or displays a driver-supplied dialog box for configuring the driver.
280 * PARAMETERS
281 * lpszDriver -- Driver name
282 * hwnd -- Parent window for the dialog box
283 * lpdmOutput -- Address of a DEVMODE structure for writing initialization information
284 * lpszDevice -- Device name
285 * lpszPort -- Port name
286 * lpdmInput -- Address of a DEVMODE structure for reading initialization information
287 * lpProfile -- Name of initialization file, defaults to WIN.INI if NULL
288 * wMode -- Operation to perform. Can be a combination if > 0.
289 * (0) -- Returns number of bytes required by DEVMODE structure
290 * DM_UPDATE (1) -- Write current settings to environment and initialization file
291 * DM_COPY (2) -- Write current settings to lpdmOutput
292 * DM_PROMPT (4) -- Presents the driver's modal dialog box (USER.240)
293 * DM_MODIFY (8) -- Changes current settings according to lpdmInput before any other operation
295 * RETURNS
296 * Returns size of DEVMODE structure if wMode is 0. Otherwise, IDOK is returned for success
297 * for both dialog and non-dialog operations. IDCANCEL is returned if the dialog box was cancelled.
298 * A return value less than zero is returned if a non-dialog operation fails.
300 * BUGS
302 * Just returns default devmode at the moment. No use of initialization file.
304 INT PSDRV_ExtDeviceMode(LPSTR lpszDriver, HWND hwnd, LPDEVMODEA lpdmOutput,
305 LPSTR lpszDevice, LPSTR lpszPort, LPDEVMODEA lpdmInput,
306 LPSTR lpszProfile, DWORD dwMode)
308 PRINTERINFO *pi = PSDRV_FindPrinterInfo(lpszDevice);
309 if(!pi) return -1;
311 TRACE("(Driver=%s, hwnd=%p, devOut=%p, Device='%s', Port='%s', devIn=%p, Profile='%s', Mode=%04lx)\n",
312 lpszDriver, hwnd, lpdmOutput, lpszDevice, lpszPort, lpdmInput, lpszProfile, dwMode);
314 /* If dwMode == 0, return size of DEVMODE structure */
315 if(!dwMode)
316 return pi->Devmode->dmPublic.dmSize + pi->Devmode->dmPublic.dmDriverExtra;
318 /* If DM_MODIFY is set, change settings in accordance with lpdmInput */
319 if((dwMode & DM_MODIFY) && lpdmInput) {
320 TRACE("DM_MODIFY set. devIn->dmFields = %08lx\n", lpdmInput->dmFields);
321 PSDRV_MergeDevmodes(pi->Devmode, (PSDRV_DEVMODEA *)lpdmInput, pi);
324 /* If DM_PROMPT is set, present modal dialog box */
325 if(dwMode & DM_PROMPT) {
326 HINSTANCE hinstComctl32, hinstWineps32 = LoadLibraryA("WINEPS");
327 HPROPSHEETPAGE hpsp[1];
328 PROPSHEETPAGEW psp;
329 PROPSHEETHEADERW psh;
330 PSDRV_DLGINFO *di;
331 PSDRV_DEVMODEA *dlgdm;
332 static const WCHAR PAPERW[] = {'P','A','P','E','R','\0'};
333 static const WCHAR SetupW[] = {'S','e','t','u','p','\0'};
335 hinstComctl32 = LoadLibraryA("comctl32.dll");
336 pInitCommonControls = (void*)GetProcAddress(hinstComctl32,
337 "InitCommonControls");
338 pCreatePropertySheetPage = (void*)GetProcAddress(hinstComctl32,
339 "CreatePropertySheetPageW");
340 pPropertySheet = (void*)GetProcAddress(hinstComctl32, "PropertySheetW");
341 memset(&psp,0,sizeof(psp));
342 dlgdm = HeapAlloc( PSDRV_Heap, 0, sizeof(*dlgdm) );
343 memcpy(dlgdm, pi->Devmode, sizeof(*dlgdm));
344 di = HeapAlloc( PSDRV_Heap, 0, sizeof(*di) );
345 di->pi = pi;
346 di->dlgdm = dlgdm;
347 psp.dwSize = sizeof(psp);
348 psp.hInstance = hinstWineps32;
349 psp.u.pszTemplate = PAPERW;
350 psp.u2.pszIcon = NULL;
351 psp.pfnDlgProc = PSDRV_PaperDlgProc;
352 psp.lParam = (LPARAM)di;
353 hpsp[0] = pCreatePropertySheetPage(&psp);
355 memset(&psh, 0, sizeof(psh));
356 psh.dwSize = sizeof(psh);
357 psh.pszCaption = SetupW;
358 psh.nPages = 1;
359 psh.hwndParent = HWND_32(hwnd);
360 psh.u3.phpage = hpsp;
362 pPropertySheet(&psh);
366 /* If DM_UPDATE is set, should write settings to environment and initialization file */
367 if(dwMode & DM_UPDATE)
368 FIXME("Mode DM_UPDATE. Just do the same as DM_COPY\n");
370 /* If DM_COPY is set, should write settings to lpdmOutput */
371 if((dwMode & DM_COPY) || (dwMode & DM_UPDATE)) {
372 if (lpdmOutput)
373 memcpy(lpdmOutput, pi->Devmode, pi->Devmode->dmPublic.dmSize + pi->Devmode->dmPublic.dmDriverExtra );
374 else
375 FIXME("lpdmOutput is NULL what should we do??\n");
377 return IDOK;
379 /***************************************************************
380 * ExtDeviceMode [WINEPS16.90]
384 INT16 WINAPI PSDRV_ExtDeviceMode16(HWND16 hwnd, HANDLE16 hDriver,
385 LPDEVMODEA lpdmOutput, LPSTR lpszDevice,
386 LPSTR lpszPort, LPDEVMODEA lpdmInput,
387 LPSTR lpszProfile, WORD fwMode)
390 return PSDRV_ExtDeviceMode(NULL, HWND_32(hwnd), lpdmOutput, lpszDevice,
391 lpszPort, lpdmInput, lpszProfile, (DWORD) fwMode);
394 /***********************************************************************
395 * PSDRV_DeviceCapabilities
397 * Retrieves the capabilities of a printer device driver.
399 * Parameters
400 * lpszDriver -- printer driver name
401 * lpszDevice -- printer name
402 * lpszPort -- port name
403 * fwCapability -- device capability
404 * lpszOutput -- output buffer
405 * lpDevMode -- device data buffer
407 * Returns
408 * Result depends on the setting of fwCapability. -1 indicates failure.
410 DWORD PSDRV_DeviceCapabilities(LPSTR lpszDriver, LPCSTR lpszDevice, LPCSTR lpszPort,
411 WORD fwCapability, LPSTR lpszOutput,
412 LPDEVMODEA lpDevMode)
414 PRINTERINFO *pi;
415 DEVMODEA *lpdm;
416 pi = PSDRV_FindPrinterInfo(lpszDevice);
418 TRACE("Cap=%d. Got PrinterInfo = %p\n", fwCapability, pi);
421 if (!pi) {
422 ERR("no printerinfo for %s, return 0!\n",lpszDevice);
423 return 0;
427 lpdm = lpDevMode ? lpDevMode : (DEVMODEA *)pi->Devmode;
429 switch(fwCapability) {
431 case DC_PAPERS:
433 PAGESIZE *ps;
434 WORD *wp = (WORD *)lpszOutput;
435 int i = 0;
437 for(ps = pi->ppd->PageSizes; ps; ps = ps->next, i++)
438 if(lpszOutput != NULL)
439 *wp++ = ps->WinPage;
440 return i;
443 case DC_PAPERSIZE:
445 PAGESIZE *ps;
446 POINT16 *pt = (POINT16 *)lpszOutput;
447 int i = 0;
449 for(ps = pi->ppd->PageSizes; ps; ps = ps->next, i++)
450 if(lpszOutput != NULL) {
451 pt->x = ps->PaperDimension->x * 254.0 / 72.0;
452 pt->y = ps->PaperDimension->y * 254.0 / 72.0;
453 pt++;
455 return i;
458 case DC_PAPERNAMES:
460 PAGESIZE *ps;
461 char *cp = lpszOutput;
462 int i = 0;
464 for(ps = pi->ppd->PageSizes; ps; ps = ps->next, i++)
465 if(lpszOutput != NULL) {
466 lstrcpynA(cp, ps->FullName, 64);
467 cp += 64;
469 return i;
472 case DC_ORIENTATION:
473 return pi->ppd->LandscapeOrientation ? pi->ppd->LandscapeOrientation : 90;
475 case DC_BINS:
477 INPUTSLOT *slot;
478 WORD *wp = (WORD *)lpszOutput;
479 int i = 0;
481 /* We explicitly list DMBIN_AUTO first; actually while win9x does this
482 win2000 lists DMBIN_FORMSOURCE instead. */
483 i++;
484 if(lpszOutput != NULL)
485 *wp++ = DMBIN_AUTO;
487 for(slot = pi->ppd->InputSlots; slot; slot = slot->next, i++)
488 if(lpszOutput != NULL)
489 *wp++ = slot->WinBin;
490 return i;
493 case DC_BINNAMES:
495 INPUTSLOT *slot;
496 char *cp = lpszOutput;
497 int i = 0;
499 /* Add an entry corresponding to DMBIN_AUTO, see DC_BINS */
500 i++;
501 if(lpszOutput != NULL) {
502 strcpy(cp, "Automatically Select");
503 cp += 24;
506 for(slot = pi->ppd->InputSlots; slot; slot = slot->next, i++)
507 if(lpszOutput != NULL) {
508 lstrcpynA(cp, slot->FullName, 24);
509 cp += 24;
511 return i;
514 case DC_BINADJUST:
515 FIXME("DC_BINADJUST: stub.\n");
516 return DCBA_FACEUPNONE;
518 case DC_ENUMRESOLUTIONS:
520 LONG *lp = (LONG*)lpszOutput;
522 if(lpszOutput != NULL) {
523 lp[0] = (LONG)pi->ppd->DefaultResolution;
524 lp[1] = (LONG)pi->ppd->DefaultResolution;
526 return 1;
529 case DC_COPIES:
530 FIXME("DC_COPIES: returning %d. Is this correct?\n", lpdm->dmCopies);
531 return lpdm->dmCopies;
533 case DC_DRIVER:
534 return lpdm->dmDriverVersion;
536 case DC_DATATYPE_PRODUCED:
537 FIXME("DATA_TYPE_PRODUCED: stub.\n");
538 return -1; /* simulate that the driver supports 'RAW' */
540 case DC_DUPLEX:
541 FIXME("DC_DUPLEX: returning %d. Is this correct?\n", lpdm->dmDuplex);
542 return lpdm->dmDuplex;
544 case DC_EMF_COMPLIANT:
545 FIXME("DC_EMF_COMPLIANT: stub.\n");
546 return -1; /* simulate that the driver do not support EMF */
548 case DC_EXTRA:
549 return lpdm->dmDriverExtra;
551 case DC_FIELDS:
552 return lpdm->dmFields;
554 case DC_FILEDEPENDENCIES:
555 FIXME("DC_FILEDEPENDENCIES: stub.\n");
556 return 0;
558 case DC_MAXEXTENT:
560 PAGESIZE *ps;
561 int i;
562 POINT ptMax;
563 ptMax.x = ptMax.y = 0;
565 if(lpszOutput == NULL)
566 return -1;
568 i = 0;
569 for(ps = pi->ppd->PageSizes; ps; ps = ps->next, i++) {
570 if(ps->PaperDimension->x > ptMax.x)
571 ptMax.x = ps->PaperDimension->x;
572 if(ps->PaperDimension->y > ptMax.y)
573 ptMax.y = ps->PaperDimension->y;
575 *((POINT*)lpszOutput) = ptMax;
576 return 1;
579 case DC_MINEXTENT:
581 PAGESIZE *ps;
582 int i;
583 POINT ptMax;
584 ptMax.x = ptMax.y = 0;
586 if(lpszOutput == NULL)
587 return -1;
589 i = 0;
590 for(ps = pi->ppd->PageSizes; ps; ps = ps->next, i++) {
591 if(ps->PaperDimension->x > ptMax.x)
592 ptMax.x = ps->PaperDimension->x;
593 if(ps->PaperDimension->y > ptMax.y)
594 ptMax.y = ps->PaperDimension->y;
596 *((POINT*)lpszOutput) = ptMax;
597 return 1;
600 case DC_SIZE:
601 return lpdm->dmSize;
603 case DC_TRUETYPE:
604 FIXME("DC_TRUETYPE: stub\n");
605 return DCTT_SUBDEV;
607 case DC_VERSION:
608 return lpdm->dmSpecVersion;
610 /* Printer supports collating - 1 if yes, 0 if no. */
611 case DC_COLLATE:
612 return ((lpdm->dmFields & DM_COLLATE) ? 1 : 0); /* Collation is supported if DM_COLLATE is set */
614 /* Printer supports colour printing - 1 if yes, 0 if no (Win2k/XP only) */
615 case DC_COLORDEVICE:
616 return ((lpdm->dmFields & DM_COLOR) ? 1 : 0); /* Colour is supported if DM_COLOR is set */
618 /* Identification number of the printer manufacturer for use with ICM (Win9x only) */
619 case DC_MANUFACTURER:
620 FIXME("DC_MANUFACTURER: stub\n");
621 return -1;
623 /* Identification number of the printer model for use with ICM (Win9x only) */
624 case DC_MODEL:
625 FIXME("DC_MODEL: stub\n");
626 return -1;
628 /* Nonzero if the printer supports stapling, zero otherwise (Win2k/XP only) */
629 case DC_STAPLE: /* WINVER >= 0x0500 */
630 FIXME("DC_STAPLE: stub\n");
631 return -1;
633 /* Returns an array of 64-character string buffers containing the names of the paper forms
634 * available for use, unless pOutput is NULL. The return value is the number of paper forms.
635 * (Win2k/XP only)
637 case DC_MEDIAREADY: /* WINVER >= 0x0500 */
638 FIXME("DC_MEDIAREADY: stub\n");
639 return -1;
641 /* Returns an array of 64-character string buffers containing the names of the supported
642 * media types, unless pOutput is NULL. The return value is the number of supported.
643 * media types (XP only)
645 case DC_MEDIATYPENAMES: /* WINVER >= 0x0501 */
646 FIXME("DC_MEDIATYPENAMES: stub\n");
647 return -1;
649 /* Returns an array of DWORD values which represent the supported media types, unless
650 * pOutput is NULL. The return value is the number of supported media types. (XP only)
652 case DC_MEDIATYPES: /* WINVER >= 0x0501 */
653 FIXME("DC_MEDIATYPES: stub\n");
654 return -1;
656 /* Returns an array of DWORD values, each representing a supported number of document
657 * pages per printed page, unless pOutput is NULL. The return value is the number of
658 * array entries. (Win2k/XP only)
660 case DC_NUP:
661 FIXME("DC_NUP: stub\n");
662 return -1;
664 /* Returns an array of 32-character string buffers containing a list of printer description
665 * languages supported by the printer, unless pOutput is NULL. The return value is
666 * number of array entries. (Win2k/XP only)
669 case DC_PERSONALITY: /* WINVER >= 0x0500 */
670 FIXME("DC_PERSONALITY: stub\n");
671 return -1;
673 /* Returns the amount of printer memory in kilobytes. (Win2k/XP only) */
674 case DC_PRINTERMEM: /* WINVER >= 0x0500 */
675 FIXME("DC_PRINTERMEM: stub\n");
676 return -1;
678 /* Returns the printer's print rate in PRINTRATEUNIT units. (Win2k/XP only) */
679 case DC_PRINTRATE: /* WINVER >= 0x0500 */
680 FIXME("DC_PRINTRATE: stub\n");
681 return -1;
683 /* Returns the printer's print rate in pages per minute. (Win2k/XP only) */
684 case DC_PRINTRATEPPM: /* WINVER >= 0x0500 */
685 FIXME("DC_PRINTRATEPPM: stub\n");
686 return -1;
688 /* Returns the printer rate unit used for DC_PRINTRATE, which is one of
689 * PRINTRATEUNIT_{CPS,IPM,LPM,PPM} (Win2k/XP only)
691 case DC_PRINTRATEUNIT: /* WINVER >= 0x0500 */
692 FIXME("DC_PRINTRATEUNIT: stub\n");
693 return -1;
695 default:
696 FIXME("Unsupported capability %d\n", fwCapability);
698 return -1;
701 /**************************************************************
703 * PSDRV_DeviceCapabilities [WINEPS16.91]
705 DWORD WINAPI PSDRV_DeviceCapabilities16(LPCSTR lpszDevice,
706 LPCSTR lpszPort, WORD fwCapability,
707 LPSTR lpszOutput, LPDEVMODEA lpdm)
709 return PSDRV_DeviceCapabilities(NULL, lpszDevice, lpszPort, fwCapability,
710 lpszOutput, lpdm);
713 /***************************************************************
714 * DeviceMode [WINEPS16.13]
717 void WINAPI PSDRV_DeviceMode16(HWND16 hwnd, HANDLE16 hDriver,
718 LPSTR lpszDevice, LPSTR lpszPort)
720 PSDRV_ExtDeviceMode16( hwnd, hDriver, NULL, lpszDevice, lpszPort, NULL,
721 NULL, DM_PROMPT );
722 return;
725 #if 0
726 typedef struct {
727 DWORD nPages;
728 DWORD Unknown;
729 HPROPSHEETPAGE hPages[10];
730 } EDMPS;
732 INT PSDRV_ExtDeviceModePropSheet(HWND hwnd, LPSTR lpszDevice, LPSTR lpszPort,
733 LPVOID pPropSheet)
735 EDMPS *ps = pPropSheet;
736 PROPSHEETPAGE psp;
738 psp->dwSize = sizeof(psp);
739 psp->hInstance = 0x1234;
741 ps->nPages = 1;
745 #endif