[Wine-devel] [BUGFIX] comdlg32->printdlg.c: FIXES BUG 1686; Pages are printed incorrecly in duplex mode

Виталий Перов =?iso-8859-1?q?vitperov_=CE=C1_etersoft=2Eru?=
Сб Май 24 17:52:48 MSD 2008


-- 
С уважением,
Виталий Перов
Россия, Санкт-Петербург. www.etersoft.ru
----------- следующая часть -----------
commit a4a8747c3bd774cdf349b979f16ff218f8cb7eae
Author: Vitaly Perov <vitperov на etersoft.ru>
Date:   Sat May 24 17:32:03 2008 +0400

       [BUGFIX] comdlg32->printdlg.c: FIXES BUG 1686; Pages are printed incorrecly in duplex mode

diff --git a/dlls/comdlg32/printdlg.c b/dlls/comdlg32/printdlg.c
index 2f07dfd..3aa9da7 100644
--- a/dlls/comdlg32/printdlg.c
+++ b/dlls/comdlg32/printdlg.c
@@ -286,6 +286,11 @@ static BOOL PRINTDLG_CreateDevNamesW(HGLOBAL *hmem, LPCWSTR DeviceDriverName,
 static BOOL PRINTDLG_UpdatePrintDlgA(HWND hDlg,
 				    PRINT_PTRA* PrintStructures)
 {
+    DEVNAMES	*dn;
+    DEVMODEA	*dm;
+    INT         copiesSupported;
+    LPSTR	devname, portname;
+
     LPPRINTDLGA       lppd = PrintStructures->lpPrintDlg;
     PDEVMODEA         lpdm = PrintStructures->lpDevMode;
     LPPRINTER_INFO_2A pi = PrintStructures->lpPrinterInfo;
@@ -340,6 +345,20 @@ static BOOL PRINTDLG_UpdatePrintDlgA(HWND hDlg,
 	    FIXME("Collate lppd not yet implemented as output\n");
 	}
 
+        /* If printer support multiple copies, then printer should do this (even if application support it too). It prevent some bugs with a duplex printing */
+        dn = GlobalLock(lppd->hDevNames);
+        dm = GlobalLock(lppd->hDevMode);
+        devname	= ((char*)dn)+dn->wDeviceOffset;
+        portname = ((char*)dn)+dn->wOutputOffset;
+
+        copiesSupported = DeviceCapabilitiesA(devname,portname,DC_COPIES,NULL,dm);
+
+        GlobalUnlock(lppd->hDevNames);
+        GlobalUnlock(lppd->hDevMode);
+
+        if (copiesSupported > 1)
+            lppd->Flags |= PD_USEDEVMODECOPIESANDCOLLATE; 
+
 	/* set PD_Collate and nCopies */
 	if (lppd->Flags & PD_USEDEVMODECOPIESANDCOLLATE) {
 	  /*  The application doesn't support multiple copies or collate...


Подробная информация о списке рассылки Wine-devel