Changeset 21304 for trunk/src/gdi32/printer.cpp
- Timestamp:
- Jun 18, 2009, 12:12:33 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gdi32/printer.cpp
r10597 r21304 1 /* $Id: printer.cpp,v 1. 3 2004-05-05 09:19:11sandervl Exp $ */1 /* $Id: printer.cpp,v 1.14 2004/05/04 13:49:24 sandervl Exp $ */ 2 2 3 3 /* … … 5 5 * 6 6 * Copyright 2001 Sander van Leeuwen (sandervl@xs4all.nl) 7 * 7 * Copyright 2002-2003 InnoTek Systemberatung GmbH (sandervl@innotek.de) 8 8 * 9 9 * Parts based on Wine code (StartDocW) … … 19 19 #include <os2win.h> 20 20 #include <stdarg.h> 21 #include <stdio.h> 21 22 #include <string.h> 22 23 #include <dcdata.h> … … 28 29 #include "dbglocal.h" 29 30 31 // Private WGSS escape extensions 32 #define PRIVATE_QUERYORIENTATION 0x99990001 33 #define PRIVATE_QUERYCOPIES 0x99990002 34 #define PRIVATE_QUERYCOLLATE 0x99990003 35 30 36 static char *lpszPassThrough = NULL; 31 37 static int cbPassThrough = 0; … … 33 39 //NOTE: We need to insert this postscript statement into the stream or else 34 40 // the output will be completely inverted (x & y) 35 static char szSetupString[] = "%%BeginSetup\n[{\n%%BeginColorModelSetup\n<< /ProcessColorModel /DeviceCMYK >> setpagedevice\n%%EndColorModelSetup\n} stopped cleartomark\n%%EndSetup\n"; 36 41 static char szSetupStringPortrait[] = "%%BeginSetup\n[{\n%%BeginColorModelSetup\n<< /ProcessColorModel /DeviceCMYK >> setpagedevice\n%%EndColorModelSetup\n} stopped cleartomark\n%%EndSetup\n"; 42 static char szSetupStringLandscape[] = "%%BeginSetup\n[{\n%%BeginColorModelSetup\n<< /ProcessColorModel /DeviceCMYK >> setpagedevice\n%%EndColorModelSetup\n} stopped cleartomark\n-90 rotate\n%%EndSetup\n"; 43 44 45 static BOOL fPostscriptPassthrough = TRUE; 46 47 //****************************************************************************** 48 //****************************************************************************** 49 BOOL WIN32API ODIN_QueryPostscriptPassthrough() 50 { 51 return fPostscriptPassthrough; 52 } 53 //****************************************************************************** 54 //****************************************************************************** 55 void WIN32API ODIN_SetPostscriptPassthrough(BOOL fEnabled) 56 { 57 fPostscriptPassthrough = fEnabled; 58 } 37 59 //****************************************************************************** 38 60 //****************************************************************************** … … 64 86 dprintf(("Postscript %s data of size %d", lpszEscape, *(WORD *)lpvInData)); 65 87 88 if(fPostscriptPassthrough == FALSE) 89 { 90 return 0; 91 } 92 if(lpszPassThrough) { 93 O32_Escape(hdc, nEscape, cbPassThrough, lpszPassThrough, NULL); 94 free(lpszPassThrough); 95 lpszPassThrough = NULL; 96 } 97 pDCData pHps = (pDCData)OSLibGpiQueryDCData((HPS)hdc); 98 if(pHps && (pHps->Reserved & DC_FLAG_SEND_POSTSCRIPT_SETUP_STRING)) 99 { 100 DWORD dmOrientation = 0, hdrsize, dmCollate, dmCopies; 101 char *pvSetupData = NULL; 102 103 O32_Escape(hdc, PRIVATE_QUERYORIENTATION, 0, NULL, &dmOrientation); 104 if(dmOrientation == DMORIENT_LANDSCAPE) { 105 hdrsize = sizeof(szSetupStringLandscape)-1; 106 pvSetupData = (char *)alloca(hdrsize+sizeof(WORD)); 107 } 108 else {//portrait 109 hdrsize = sizeof(szSetupStringPortrait)-1; 110 pvSetupData = (char *)alloca(hdrsize+sizeof(WORD)); 111 } 112 if(pvSetupData) { 113 *(WORD *)pvSetupData = hdrsize; 114 memcpy(pvSetupData+sizeof(WORD), (hdrsize == sizeof(szSetupStringPortrait)-1) ? szSetupStringPortrait : szSetupStringLandscape, hdrsize); 115 116 O32_Escape(hdc, nEscape, *(WORD *)pvSetupData, pvSetupData, NULL); 117 118 dprintf(("Send Postscript setup string %d (%x):\n%s", dmOrientation, pHps->Reserved, pvSetupData+sizeof(WORD))); 119 } 120 pHps->Reserved &= ~DC_FLAG_SEND_POSTSCRIPT_SETUP_STRING; 121 } 122 66 123 rc = O32_Escape(hdc, nEscape, cbInput, lpvInData, lpvOutData); 67 124 if(rc == 1) rc = *(WORD *)lpvInData; … … 70 127 } 71 128 129 case PRIVATE_QUERYORIENTATION: 130 DebugInt3(); 131 return 0; 132 72 133 case SPCLPASSTHROUGH2: 73 134 { … … 76 137 dprintf(("SPCLPASSTHROUGH2: pretend success")); 77 138 dprintf(("SPCLPASSTHROUGH2: virt mem %x size %x", *(DWORD *)lpvInData, rawsize)); 139 if(lpszPassThrough == NULL) { 140 lpszPassThrough = (char *)malloc(rawsize+sizeof(WORD)); 141 if(lpszPassThrough == NULL) { 142 DebugInt3(); 143 return 0; 144 } 145 memcpy(lpszPassThrough+sizeof(WORD), (char *)lpvInData+6, rawsize); 146 cbPassThrough = rawsize; 147 *(WORD *)lpszPassThrough = (WORD)cbPassThrough; 148 } 149 else { 150 char *tmp = lpszPassThrough; 151 152 lpszPassThrough = (char *)malloc(cbPassThrough+rawsize+sizeof(WORD)); 153 if(lpszPassThrough == NULL) { 154 DebugInt3(); 155 return 0; 156 } 157 memcpy(lpszPassThrough+sizeof(WORD), tmp+sizeof(WORD), cbPassThrough); 158 free(tmp); 159 memcpy(lpszPassThrough+sizeof(WORD)+cbPassThrough, (char *)lpvInData+6, rawsize); 160 cbPassThrough += rawsize; 161 *(WORD *)lpszPassThrough = (WORD)cbPassThrough; 162 } 78 163 return 1; 79 164 } … … 126 211 return Escape(hdc, QUERYESCSUPPORT, sizeof(nEscapeSup), (LPCSTR)&nEscapeSup, NULL); 127 212 } 213 case POSTSCRIPT_PASSTHROUGH: 214 case POSTSCRIPT_DATA: 215 case PASSTHROUGH: 216 if(fPostscriptPassthrough == FALSE) 217 { 218 return 0; 219 } 220 break; 221 128 222 default: 129 223 break;
Note:
See TracChangeset
for help on using the changeset viewer.