home *** CD-ROM | disk | FTP | other *** search
- #include <exec/types.h>
- #include <intuition/intuition.h>
- #include <devices/printer.h>
- #include <libraries/dos.h>
- #include "LabelDef.h"
-
- extern struct IODRPReq *CreateExtIO();
- extern struct MsgPort *CreatePort();
- extern UWORD MyColorMap[16];
- extern struct RastPort *wrp;
- extern int LabelSkip, PrintWidth, PrintHeight;
-
-
-
- int
- DumpLabel( FromScreen)
- struct Screen *FromScreen;
- {
- struct IODRPReq *MyIODRP;
- struct MsgPort *MPSPort;
- struct ViewPort *vp;
- int back, FastHeight;
- int Flags, Height, Width;
-
- back = 1;
- if (MPSPort = CreatePort("My_Printer",0))
- {
- if (MyIODRP = CreateExtIO( MPSPort, sizeof( struct IODRPReq)))
- {
- if (!(back = OpenDevice("printer.device", 0, MyIODRP, 0)))
- {
- LMMessage("Please adjust your Label NOW!!!");
- PointerState( 2);
- vp = &FromScreen->ViewPort;
- if ( MyColorMap[1] == 0xeca) SetRGB4( vp, 1, 0xf, 0xf, 0xf);
- Flags = ((PrintWidth != 0)&&(PrintWidth != 0))?
- SPECIAL_MILCOLS | SPECIAL_MILROWS:
- SPECIAL_MILCOLS | SPECIAL_MILROWS | SPECIAL_DENSITY2;
- Width = (PrintWidth == 0) ? 2666: PrintWidth;
- Height = (PrintHeight == 0)? 2555: PrintHeight;
- MyIODRP->io_Command = PRD_DUMPRPORT;
- MyIODRP->io_RastPort = &FromScreen->RastPort;
- MyIODRP->io_ColorMap = vp->ColorMap;
- MyIODRP->io_Modes = (ULONG)vp->Modes;
- MyIODRP->io_SrcX = (USHORT) LABEL_LEFT;
- MyIODRP->io_SrcY = (USHORT) LABEL_TOP;
- MyIODRP->io_SrcWidth = (USHORT) LABEL_WIDTH;
- MyIODRP->io_SrcHeight = (USHORT) LABEL_HEIGHT;
- MyIODRP->io_DestCols = (UWORD) Width;
- MyIODRP->io_DestRows = (UWORD) Height;
- MyIODRP->io_Special = (UWORD) Flags;
- back = DoIO( MyIODRP);
- if ( LabelSkip > 0)
- {
- FastHeight = (LabelSkip * 72) / 1000;
- if ( FastHeight > 184) FastHeight = 184;
- SetAPen( wrp, 1);
- RectFill( wrp, 0, 0, LABEL_WIDTH -1, LABEL_HEIGHT -1);
- SetRGB4( vp, 1, 15, 15, 15);
- MyIODRP->io_Command = PRD_DUMPRPORT;
- MyIODRP->io_RastPort = wrp;
- MyIODRP->io_ColorMap = vp->ColorMap;
- MyIODRP->io_Modes = (ULONG)vp->Modes;
- MyIODRP->io_SrcX = (USHORT) 0;
- MyIODRP->io_SrcY = (USHORT) 0;
- MyIODRP->io_SrcWidth = (USHORT) LABEL_WIDTH;
- MyIODRP->io_SrcHeight = (USHORT) FastHeight;
- MyIODRP->io_DestCols = (UWORD) 2666;
- MyIODRP->io_DestRows = (UWORD) LabelSkip;
- MyIODRP->io_Special = (UWORD) Flags;
- back = DoIO( MyIODRP);
- }
- CloseDevice( MyIODRP);
- PointerState( 0);
- LoadRGB4( vp, MyColorMap, 16);
- }
- else
- {
- LMMessage("I cannot find your printer.");
- }
- DeleteExtIO( MyIODRP, sizeof( struct IODRPReq));
- }
- else
- {
- LMMessage("Exec will not let me communicate.");
- }
- DeletePort( MPSPort);
- }
- else
- {
- LMMessage("I cannot get a port ???");
- }
- return( back);
- }
-
-
-