home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 6 / FreshFish_September1994.bin / bbs / misc / cp-4.3.lha / cP / Source / dump.c < prev    next >
C/C++ Source or Header  |  1994-03-14  |  2KB  |  75 lines

  1. #include "cp.h"
  2.  
  3. union printerIO
  4. {
  5.     struct IOStdReq    ios;
  6.     struct IODRPReq    iodrp;
  7.     struct IOPrtCmdReq iopc;
  8. };
  9.  
  10. WORD Dump() 
  11. {
  12. union printerIO *PrintIO;
  13. struct MsgPort  *PrintMP;
  14. WORD   error;
  15. LONG  modeID;
  16. struct PrinterData *PD;
  17. struct PrinterExtendedData *PED;
  18. char Mes[64];
  19.  
  20.     if ((PrintMP = CreateMsgPort()))
  21.       {
  22.         if ((PrintIO = (union printerIO *)CreateIORequest( PrintMP, max(sizeof(union printerIO *),1024))))  /* 1024 fixes mungwall problem ? */
  23.           {
  24.               if ((NULL == OpenDevice("printer.device",0,(struct IORequest *)PrintIO,0)))
  25.               {
  26.                   PD  = (struct PrinterData *)PrintIO-> iodrp.io_Device;
  27.                   PED = (struct PrinterExtendedData *) &PD->pd_SegmentData->ps_PED;
  28.               
  29.                   if ((modeID = GetVPModeID(vp)) != INVALID_ID)
  30.                     {
  31.                     
  32.                       PrintIO-> iodrp.io_Command   = PRD_DUMPRPORT;
  33.                       PrintIO-> iodrp.io_RastPort  = rp;
  34.                       PrintIO-> iodrp.io_ColorMap  = vp-> ColorMap;
  35.                       PrintIO-> iodrp.io_Modes     = modeID;
  36.                       PrintIO-> iodrp.io_SrcX      = 0;
  37.                       PrintIO-> iodrp.io_SrcY      = 0;
  38.                       PrintIO-> iodrp.io_SrcWidth  = PlotWindowWnd-> Width /*-1*/;
  39.                       PrintIO-> iodrp.io_SrcHeight = PlotWindowWnd-> Height - (CPANEL ? (cPFont->ta_YSize * 3) : 0);
  40.                       PrintIO-> iodrp.io_DestCols  = 0;
  41.                       PrintIO-> iodrp.io_DestRows  = 0;
  42.                       PrintIO-> iodrp.io_Special   = SPECIAL_NOPRINT;
  43.  
  44.                       error = DoIO((struct IORequest *) PrintIO);
  45.  
  46.                          sprintf(Mes,"Printing ... destC %ld destR %ld  maxX %ld maxY %ld",PrintIO->iodrp.io_DestCols,PrintIO->iodrp.io_DestRows,PED->ped_MaxXDots,PED->ped_MaxYDots);
  47.                     SetWindowTitles( PlotWindowWnd, Mes,Mes );
  48.  
  49.                       if ( PrintIO->iodrp.io_Error == 0 )
  50.                         {
  51.                           PrintIO-> iodrp.io_Special   &= ~SPECIAL_NOPRINT;
  52.  
  53.                           if ( FEED == FALSE )
  54.                               PrintIO-> iodrp.io_Special   |= SPECIAL_NOFORMFEED;
  55.  
  56.                           error = DoIO((struct IORequest *) PrintIO);
  57.                       }
  58.  
  59.                     SetWindowTitles( PlotWindowWnd, "Done Printing !","Done Printing !" );
  60.                     }
  61.                     else error = 104;
  62.                 CloseDevice((struct IORequest *)PrintIO);
  63.               }
  64.               else  error = 103;
  65.             DeleteIORequest((struct IORequest *)PrintIO);
  66.           }
  67.           else  error = 102;
  68.          DeleteMsgPort(PrintMP);
  69.       }
  70.       else error = 101;
  71.             
  72.     return ( error );
  73. }
  74.   
  75.