Ignore:
Timestamp:
Jan 11, 2004, 12:43:22 PM (22 years ago)
Author:
sandervl
Message:

Update

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gdi32/printer.cpp

    r6331 r10374  
    1 /* $Id: printer.cpp,v 1.1 2001-07-14 15:31:45 sandervl Exp $ */
     1/* $Id: printer.cpp,v 1.2 2004-01-11 11:42:21 sandervl Exp $ */
    22
    33/*
     
    1919#include <os2win.h>
    2020#include <stdarg.h>
    21 #include <misc.h>
     21#include <string.h>
     22#include <dcdata.h>
     23#include <dbglog.h>
    2224#include <heapstring.h>
     25#include "oslibgpi.h"
    2326
    2427#define DBG_LOCALLOG    DBG_printer
    2528#include "dbglocal.h"
    2629
     30static char *lpszPassThrough = NULL;
     31static int   cbPassThrough   = 0;
     32
     33//NOTE: We need to insert this postscript statement into the stream or else
     34//      the output will be completely inverted (x & y)
     35static char  szSetupString[] = "%%BeginSetup\n[{\n%%BeginColorModelSetup\n<< /ProcessColorModel /DeviceCMYK >> setpagedevice\n%%EndColorModelSetup\n} stopped cleartomark\n%%EndSetup\n";
     36
     37//******************************************************************************
     38//******************************************************************************
     39int WIN32API Escape( HDC hdc, int nEscape, int cbInput, LPCSTR lpvInData, PVOID lpvOutData)
     40{
     41    int rc;
     42    char *lpszEscape = NULL;
     43
     44    switch(nEscape)
     45    {
     46    case SET_BOUNDS:
     47    {
     48        RECT *r = (RECT *)lpvInData;
     49        if(cbInput != sizeof(RECT)) {
     50            dprintf(("WARNING: cbInput != sizeof(RECT) (=%d) for SET_BOUNDS", cbInput));
     51            return 0;
     52        }
     53        dprintf(("SET_BOUNDS (%d,%d) (%d,%d)", r->left, r->top, r->right, r->bottom));
     54        return 0;
     55    }
     56    case POSTSCRIPT_PASSTHROUGH:
     57        if(!lpszEscape) lpszEscape = "POSTSCRIPT_PASSTHROUGH";
     58        nEscape = PASSTHROUGH;
     59    case POSTSCRIPT_DATA:
     60        if(!lpszEscape) lpszEscape = "POSTSCRIPT_DATA";
     61    case PASSTHROUGH:
     62    {
     63        if(!lpszEscape) lpszEscape = "PASSTHROUGH";
     64        dprintf(("Postscript %s data of size %d", lpszEscape, *(WORD *)lpvInData));
     65
     66        rc = O32_Escape(hdc, nEscape, cbInput, lpvInData, lpvOutData);
     67        if(rc == 1) rc = *(WORD *)lpvInData;
     68        else        rc = 0;
     69        return rc;
     70    }
     71
     72    case SPCLPASSTHROUGH2:
     73    {
     74        int rawsize = *(WORD *)(lpvInData+4);
     75
     76        dprintf(("SPCLPASSTHROUGH2: pretend success"));
     77        dprintf(("SPCLPASSTHROUGH2: virt mem %x size %x", *(DWORD *)lpvInData, rawsize));
     78        return 1;
     79    }
     80
     81    case DOWNLOADFACE:
     82        dprintf(("DOWNLOADFACE: pretend success"));
     83        return 1;
     84
     85    case POSTSCRIPT_IGNORE:
     86    {
     87        BOOL ret = FALSE;
     88        dprintf(("POSTSCRIPT_IGNORE %d", *(WORD *)lpvInData));
     89        return ret;
     90    }
     91    case EPSPRINTING:
     92    {
     93        UINT epsprint = *(UINT*)lpvInData;
     94        dprintf(("EPSPRINTING support %sable.\n",epsprint?"en":"dis"));
     95        return 1;
     96    }
     97
     98    case QUERYESCSUPPORT:
     99    {
     100        DWORD nEscapeSup = *(DWORD *)lpvInData;
     101        BOOL fdprintf = FALSE;
     102
     103        switch(nEscapeSup) {
     104        case SET_BOUNDS:
     105            if(!fdprintf) dprintf(("QUERYESCSUPPORT: SET_BOUNDS"));
     106            fdprintf = TRUE;
     107/*        case SPCLPASSTHROUGH2:
     108            if(!fdprintf) dprintf(("QUERYESCSUPPORT: SPCLPASSTHROUGH2"));
     109            fdprintf = TRUE;
     110        case DOWNLOADHEADER:
     111            if(!fdprintf) dprintf(("QUERYESCSUPPORT: DOWNLOADHEADER"));
     112            fdprintf = TRUE;
     113        case DOWNLOADFACE:
     114            if(!fdprintf) dprintf(("QUERYESCSUPPORT: DOWNLOADFACE"));
     115            fdprintf = TRUE;
     116*/
     117        case POSTSCRIPT_IGNORE:
     118            if(!fdprintf) dprintf(("QUERYESCSUPPORT: POSTSCRIPT_IGNORE"));
     119            fdprintf = TRUE;
     120        case EPSPRINTING:
     121        {
     122            if(!fdprintf) dprintf(("QUERYESCSUPPORT: EPSPRINTING"));
     123            fdprintf = TRUE;
     124
     125            nEscapeSup = POSTSCRIPT_PASSTHROUGH;
     126            return Escape(hdc, QUERYESCSUPPORT, sizeof(nEscapeSup), (LPCSTR)&nEscapeSup, NULL);
     127        }
     128        default:
     129            break;
     130        }
     131    }
     132    default:
     133        if(cbInput && lpvInData) {
     134            ULONG *tmp = (ULONG *)lpvInData;
     135            for(int i=0;i<min(16,cbInput/4);i++) {
     136                    dprintf(("GDI32: Escape par %d: %x", i, *tmp++));
     137            }
     138        }
     139        break;
     140    }
     141
     142    rc = O32_Escape(hdc, nEscape, cbInput, lpvInData, lpvOutData);
     143    if(rc == 0) {
     144         dprintf(("GDI32: Escape %x %d %d %x %x returned %d (WARNING: might not be implemented!!) ", hdc, nEscape, cbInput, lpvInData, lpvOutData, rc));
     145    }
     146    else dprintf(("GDI32: Escape %x %d %d %x %x returned %d ", hdc, nEscape, cbInput, lpvInData, lpvOutData, rc));
     147
     148    return rc;
     149}
     150//******************************************************************************
     151//******************************************************************************
     152INT WIN32API ExtEscape(HDC hdc, INT nEscape, INT cbInput, LPCSTR lpszInData,
     153                       INT cbOutput, LPSTR lpszOutData)
     154{
     155    dprintf(("GDI32: ExtEscape, %x %x %d %x %d %x partly implemented", hdc, nEscape, cbInput, lpszInData, cbOutput, lpszOutData));
     156
     157    switch(nEscape) {
     158    case DOWNLOADHEADER:
     159    {
     160        dprintf(("DOWNLOADHEADER: hardcoded result"));
     161        if(lpszOutData && cbOutput >= 8) {
     162            strcpy(lpszOutData, "PM_1.2");
     163            return 1;
     164        }
     165        dprintf(("Not enough room for proc name"));
     166        return 0;
     167    }
     168    }
     169    return Escape(hdc, nEscape, cbInput, lpszInData, lpszOutData);
     170}
    27171//******************************************************************************
    28172//******************************************************************************
    29173INT WIN32API StartDocA(HDC hdc, const DOCINFOA *lpDocInfo)
    30174{
    31     dprintf(("GDI32: StartDocA %x %x", hdc, lpDocInfo));
    32     return O32_StartDoc(hdc, (LPDOCINFOA)lpDocInfo);
     175    INT ret;
     176
     177    if(lpDocInfo) {
     178         dprintf(("GDI32: StartDocA %x %x (%s %s %s %x)", hdc, lpDocInfo, lpDocInfo->lpszDocName, lpDocInfo->lpszOutput, lpDocInfo->lpszDatatype, lpDocInfo->fwType));
     179    }
     180    else dprintf(("GDI32: StartDocA %x %x", hdc, lpDocInfo));
     181
     182    ret = O32_StartDoc(hdc, (LPDOCINFOA)lpDocInfo);
     183
     184    if(ret != 0) {
     185        pDCData pHps = (pDCData)OSLibGpiQueryDCData((HPS)hdc);
     186        if(pHps)
     187        {
     188            pHps->Reserved |= DC_FLAG_SEND_POSTSCRIPT_SETUP_STRING;
     189        }
     190        else DebugInt3();
     191    }
     192
     193    return ret;
    33194}
    34195//******************************************************************************
     
    91252int WIN32API SetAbortProc(HDC hdc, ABORTPROC lpAbortProc)
    92253{
    93   dprintf(("GDI32: SetAbortProc %x %x - stub (1)", hdc, lpAbortProc));
    94   return(1);
    95 }
    96 //******************************************************************************
    97 //******************************************************************************
     254    dprintf(("GDI32: SetAbortProc %x %x - stub (1)", hdc, lpAbortProc));
     255    return(1);
     256}
     257//******************************************************************************
     258//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.