home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d5xx / d548 / labelmaker.lha / LabelMaker / LabelMakerV1.5.lzh / LabelDump.c < prev    next >
C/C++ Source or Header  |  1991-07-22  |  3KB  |  97 lines

  1. #include <exec/types.h>
  2. #include <intuition/intuition.h>
  3. #include <devices/printer.h>
  4. #include <libraries/dos.h>
  5. #include "LabelDef.h"
  6.  
  7. extern struct IODRPReq *CreateExtIO();
  8. extern struct MsgPort *CreatePort();
  9. extern UWORD MyColorMap[16];
  10. extern struct RastPort *wrp;
  11. extern int LabelSkip, PrintWidth, PrintHeight;
  12.  
  13.  
  14.  
  15. int
  16. DumpLabel( FromScreen)
  17. struct Screen *FromScreen;
  18. {
  19.  struct IODRPReq *MyIODRP;
  20.  struct MsgPort *MPSPort;
  21.  struct ViewPort *vp;
  22.  int back, FastHeight;
  23.  int Flags, Height, Width;
  24.  
  25.  back = 1;
  26.  if (MPSPort = CreatePort("My_Printer",0))
  27.    {
  28.     if (MyIODRP = CreateExtIO( MPSPort, sizeof( struct IODRPReq)))
  29.       {
  30.        if (!(back = OpenDevice("printer.device", 0, MyIODRP, 0)))
  31.          {
  32.           LMMessage("Please adjust your Label NOW!!!");
  33.           PointerState( 2);
  34.           vp = &FromScreen->ViewPort;
  35.           if ( MyColorMap[1] == 0xeca) SetRGB4( vp, 1, 0xf, 0xf, 0xf);
  36.           Flags = ((PrintWidth != 0)&&(PrintWidth != 0))?
  37.                    SPECIAL_MILCOLS | SPECIAL_MILROWS:
  38.                    SPECIAL_MILCOLS | SPECIAL_MILROWS | SPECIAL_DENSITY2;
  39.           Width  = (PrintWidth == 0) ? 2666: PrintWidth;
  40.           Height = (PrintHeight == 0)? 2555: PrintHeight;
  41.           MyIODRP->io_Command   = PRD_DUMPRPORT;
  42.           MyIODRP->io_RastPort  = &FromScreen->RastPort;
  43.           MyIODRP->io_ColorMap  = vp->ColorMap;
  44.           MyIODRP->io_Modes     = (ULONG)vp->Modes;
  45.           MyIODRP->io_SrcX      = (USHORT) LABEL_LEFT;
  46.           MyIODRP->io_SrcY      = (USHORT) LABEL_TOP;
  47.           MyIODRP->io_SrcWidth  = (USHORT) LABEL_WIDTH;
  48.           MyIODRP->io_SrcHeight = (USHORT) LABEL_HEIGHT;
  49.           MyIODRP->io_DestCols  = (UWORD) Width;
  50.           MyIODRP->io_DestRows  = (UWORD) Height;
  51.           MyIODRP->io_Special   = (UWORD) Flags;
  52.           back = DoIO( MyIODRP);
  53.           if ( LabelSkip > 0)
  54.             {
  55.              FastHeight = (LabelSkip * 72) / 1000;
  56.              if ( FastHeight > 184) FastHeight = 184;
  57.              SetAPen( wrp, 1);
  58.              RectFill( wrp, 0, 0, LABEL_WIDTH -1, LABEL_HEIGHT -1);
  59.              SetRGB4( vp, 1, 15, 15, 15);
  60.              MyIODRP->io_Command   = PRD_DUMPRPORT;
  61.              MyIODRP->io_RastPort  = wrp;
  62.              MyIODRP->io_ColorMap  = vp->ColorMap;
  63.              MyIODRP->io_Modes     = (ULONG)vp->Modes;
  64.              MyIODRP->io_SrcX      = (USHORT) 0;
  65.              MyIODRP->io_SrcY      = (USHORT) 0;
  66.              MyIODRP->io_SrcWidth  = (USHORT) LABEL_WIDTH;
  67.              MyIODRP->io_SrcHeight = (USHORT) FastHeight;
  68.              MyIODRP->io_DestCols  = (UWORD) 2666;
  69.              MyIODRP->io_DestRows  = (UWORD) LabelSkip;
  70.              MyIODRP->io_Special   = (UWORD) Flags;
  71.              back = DoIO( MyIODRP);
  72.             }
  73.           CloseDevice( MyIODRP);
  74.           PointerState( 0);
  75.           LoadRGB4( vp, MyColorMap, 16);
  76.          }
  77.        else
  78.          {
  79.           LMMessage("I cannot find your printer.");
  80.          }
  81.        DeleteExtIO( MyIODRP, sizeof( struct IODRPReq));
  82.       }
  83.     else
  84.       {
  85.        LMMessage("Exec will not let me communicate.");
  86.       }
  87.     DeletePort( MPSPort);
  88.    }
  89.  else
  90.    {
  91.     LMMessage("I cannot get a port ???");
  92.    }
  93.  return( back);
  94. }
  95.  
  96.  
  97.