/*
 * abouthelp.c : file containing about(), and help(), as well as
 *    all the text structs for autorequesters.
 */

extern struct Window *wG;
extern struct TextAttr TOPAZ80;

/*
 *    Data describing the requestor text
 *
 */

struct IntuiText oktxt = {
	2,1,JAM2,	/* front and back text pens, drawmode and fill byte */
	5,3,	/* XY origin relative to container TopLeft */
	&TOPAZ80,	/* font pointer or NULL for default */
	(UBYTE *)"OK",	/* pointer to text */
	NULL	/* next IntuiText structure */
};

struct IntuiText parfailtxt = {
	2,1,JAM2,	/* front and back text pens, drawmode and fill byte */
	14,16,	/* XY origin relative to container TopLeft */
	&TOPAZ80,	/* font pointer or NULL for default */
	(UBYTE *)"Parallel failed to open",	/* pointer to text */
	NULL	/* next IntuiText structure */
};

struct IntuiText prerrtxt2 = {
	2,1,JAM2,	/* front and back text pens, drawmode and fill byte */
	14,32,	/* XY origin relative to container TopLeft */
	&TOPAZ80,	/* font pointer or NULL for default */
	(UBYTE *) NULL,	/* filled in from sys_errlist */
	NULL	/* next IntuiText structure */
};

struct IntuiText prerrtxt = {
	2,1,JAM2,	/* front and back text pens, drawmode and fill byte */
	14,16,	/* XY origin relative to container TopLeft */
	&TOPAZ80,	/* font pointer or NULL for default */
	(UBYTE *) "Error Encountered During Printing:",
	&prerrtxt2	/* next IntuiText structure */
};

struct IntuiText badcoptxt = {
	2,1,JAM2,	/* front and back text pens, drawmode and fill byte */
	14,16,	/* XY origin relative to container TopLeft */
	&TOPAZ80,	/* font pointer or NULL for default */
	(UBYTE *)"Invalid Number of COPIES",	/* pointer to text */
	NULL	/* next IntuiText structure */
};

struct IntuiText prfailtxt = {
	2,1,JAM2,	/* front and back text pens, drawmode and fill byte */
	14,16,	/* XY origin relative to container TopLeft */
	&TOPAZ80,	/* font pointer or NULL for default */
	(UBYTE *)"Printer failed to open",	/* pointer to text */
	NULL	/* next IntuiText structure */
};



struct IntuiText cantxt = {
	2,1,JAM2,	/* front and back text pens, drawmode and fill byte */
	5,3,	/* XY origin relative to container TopLeft */
	&TOPAZ80,	/* font pointer or NULL for default */
	(UBYTE *)"CANCEL",	/* pointer to text */
	NULL	/* next IntuiText structure */
};

struct IntuiText retrytxt = {
	2,1,JAM2,	/* front and back text pens, drawmode and fill byte */
	5,3,	/* XY origin relative to container TopLeft */
	&TOPAZ80,	/* font pointer or NULL for default */
	(UBYTE *)"RETRY",	/* pointer to text */
	NULL	/* next IntuiText structure */
};

struct IntuiText aboutmsg4 = {
	0,1,JAM2,	/* front and back text pens, drawmode and fill byte */
	14,40,	/* XY origin relative to container TopLeft */
	&TOPAZ80,	/* font pointer or NULL for default */
	(UBYTE *) "      December 22, 1988",	/* pointer to text */
	NULL	/* next IntuiText structure */
};

struct IntuiText aboutmsg3 = {
	2,1,JAM2,	/* front and back text pens, drawmode and fill byte */
	14,30,	/* XY origin relative to container TopLeft */
	&TOPAZ80,	/* font pointer or NULL for default */
	(UBYTE *)  "        by Joel Swank",	/* pointer to text */
	&aboutmsg4 /* next IntuiText structure */
};

struct IntuiText aboutmsg2 = {
	0,1,JAM2,	/* front and back text pens, drawmode and fill byte */
	14,20,	/* XY origin relative to container TopLeft */
	&TOPAZ80,	/* font pointer or NULL for default */
	(UBYTE *) "         Version 1.1",
	&aboutmsg3	/* next IntuiText structure */
};

struct IntuiText aboutmsg = {
	0,1,JAM2,	/* front and back text pens, drawmode and fill byte */
	14,10,	/* XY origin relative to container TopLeft */
	&TOPAZ80,	/* font pointer or NULL for default */
	(UBYTE *)"  SUPER Return Label Printer",	/* pointer to text */
	&aboutmsg2	/* next IntuiText structure */
};

/*    Text for Help Screen    */
char *HelpText[30] = {
"                          Super Return Labels",
"",
"   Super  Return  Label  prints return address labels 3-up on single-wide",
"3.5 inch by 7/16 inch label  stock.  It can use condensed printing to get",
"19 characters per line and condensed-elite to get 23 characters per line.",
"It can also print 3, 4 or 5  lines per label.  Four and  five line labels",
"are printed with superscript characters and partial line advances.",
"   Gadgets are used to select number  of lines  and linesize.  Six string",
"gadgets are  used to  enter the  5 data  lines  and the number of copies.",
"There are PRINT and STOP gadgets to start/stop printing.",
"   The options menu  allows centering to  be turned  on and off.  It also",
"allows selection of the printer type.  Amiga printer uses the PRT: device",
"and should work with any printer. Epson printer  uses the PAR: device and",
"will work  only with Epson  compatible printers.  Only Epson  mode allows",
"4-line or 5-line  labels,  because of the  inability of  the Amiga escape",
"codes to do partial line feeds.",
NULL };

/*
 *  Handle help request
 */

extern struct NewWindow NewWindowStructure2;
struct Window *wH;
struct RastPort *rpH;

struct Window *OpenWindow();
struct IntuiMessage *GetMsg();
struct TextFont *OpenFont();

help()
{
	struct IntuiMessage *message;	/* the message from the IDCMP */
	struct TextFont *font;
	ULONG class;
	int i;

	font = NULL;
	wH = NULL;

	wH = OpenWindow(&NewWindowStructure2);	/* open the window */
	if ( wH == NULL )
		return;

	rpH = wH->RPort;	/* get a rastport pointer for the window */

	font = OpenFont(&TOPAZ80);
	if (font) SetFont(rpH,font);
	SetAPen(rpH,1L);

	for (i=0; i<40; i++)	/* dump the whole help text array */
		{
		if (!HelpText[i]) break;
		Move(rpH,25L,(long) (i+1)*8+12);
		Text(rpH,HelpText[i], (long) strlen(HelpText[i]));
		}
	while(1)
	{
		WaitPort(wH->UserPort);
			while( (message = (struct IntuiMessage *)
				GetMsg(wH->UserPort) ) != NULL)
			{
				class = message->Class;
				ReplyMsg(message);
				switch (class)
					{
					case GADGETUP:
						goto exit;
						break;
					case MENUPICK:
						continue;
					}
			}
	} 
  exit:
	if (font) CloseFont(font);
	if (wH) CloseWindow(wH);

}


/*
 *  Handle 'about' request
 */


about()
{
	AutoRequest(wG,&aboutmsg,0L,&oktxt,0L,0L,300L,75L);
}
