/* *****                                                            *****
** *****           Program created by Ken Farinsky, 1986.           *****
** *****                                                            *****
**
** All material contained herein may be used in any way desired.
**                    >>>>> i.e.  PUBLIC DOMAIN. <<<<<
** Not limited to any single bulletin board - can be freely transferred.
**
** Original distribution through:
**     Slipped Disk, Inc.
**     Madison Heights,  MI  48071
**     (313) 583-9803
**
** Distributed in the hopes of increasing the level of understanding of the
** Amiga personal computer.  Even the best computer can only succeed with
** the proper software support.
*/
#include <exec/types.h>
#include <intuition/intuition.h>
#include <functions.h>
#include "view.h"

struct Library		*IntuitionBase = NULL ;
struct Library		*GfxBase = NULL ;
struct Library		*LayersBase = NULL ;
struct Library		*DiskfontBase = NULL ;
struct Library		*DosBase = NULL ;

SHORT nums_on = FALSE ;
SHORT tab_width = 4 ;


/*----------------------------------------------------------------------
** proportional gadget...
** used for large movements in the file.
**
** this gadget is tucked into the GZZ part of the screen.
*/
struct Image		botgad_image ;
struct PropInfo		botgad_info =
	{AUTOKNOB | FREEHORIZ,0,0,0x2222,0xffff,0,0,0,0,0,0,} ;
struct Gadget		bot_gad =
	{NULL,0,-8,-15,9, GADGHCOMP | GRELWIDTH | GRELBOTTOM,
	 RELVERIFY | BOTTOMBORDER, GZZGADGET | PROPGADGET,
	 (APTR)&botgad_image,NULL,NULL,0L,(APTR)&botgad_info,31,NULL,} ;

struct Image		gad_image ;
struct PropInfo		gad_info =
	{AUTOKNOB | FREEVERT,0,0,0xffff,0xffff,0,0,0,0,0,0,} ;
struct Gadget		my_gad =
	{&bot_gad,-16,25,17,-48, GADGHNONE | GRELHEIGHT | GRELRIGHT,
	 RELVERIFY | RIGHTBORDER, GZZGADGET | PROPGADGET,
	 (APTR)&gad_image,NULL,NULL,0L,(APTR)&gad_info,30,NULL,} ;

/*---------------------------------------------------------------------
** arrow gadgets...
** used for small movements in the file. (1 line at a time)
**
** these gadgets are tucked into the GZZ part of the screen.
*/
SHORT				arrowboxdata[] =
	{ 0,0, 0,15, 15,15, 15,0, 0,0, } ;
struct Border	arrowbox = {-1,-1,BLKP,0,JAM1,5,arrowboxdata,NULL} ;
SHORT  			arrow0data[] =
	{ 8,0, 15,9, 11,9, 11,15, 4,15, 4,9, 0,9, 7,0,
	  14,9, 10,9, 10,15, 5,15, 5,9, 1,9, 8,0, } ;
struct Border	arrow0border = {-1,-1,BLKP,0,JAM1,15,arrow0data,&arrowbox} ;
SHORT  			arrow1data[] =
	{ 4,0, 4,6, 0,6, 7,15, 8,15, 15,6, 11,6, 11,0,
	  10,0, 10,6, 14,6, 7,15, 8,15, 1,6, 5,6, 5,0, } ;
struct Border	arrow1border = {-1,-1,BLKP,0,JAM1,16,arrow1data,&arrowbox} ;

struct Gadget	arrowgad[] =
	{
	{&arrowgad[1],-15,11,15,15, GADGHNONE | GRELRIGHT,
	 GADGIMMEDIATE, GZZGADGET | BOOLGADGET,
	 (APTR)&arrow0border,NULL,NULL,0L,NULL,20,NULL},
	{&my_gad,-15,-22,15,15, GADGHNONE | GRELBOTTOM | GRELRIGHT,
	 GADGIMMEDIATE, GZZGADGET | BOOLGADGET,
	 (APTR)&arrow1border,NULL,NULL,0L,NULL,21,NULL},
	} ;

/*---------------------------------------------------------------------
** big gadget
** this is a gadget which covers the entire file display part of the
** screen.  when the user selects it with the mouse a box for that
** line is drawn.  the user may then drag the line up or down on the
** screen.
*/
struct Gadget		big_gad =
	{
	&arrowgad[0],0,0,-20,-1,GADGHNONE | GRELWIDTH | GRELHEIGHT,
	RELVERIFY | GADGIMMEDIATE | FOLLOWMOUSE,
	BOOLGADGET, NULL,NULL,NULL,0L,NULL,70,NULL,
	};

/*---------------------------------------------------------------------
** window for gadgets...
*/
struct NewWindow	NewWin =
	{
	10, 10, 602, 165,			/* left, top, width, height			*/
	-1, -1,						/* detail pen, block pen (defaults)	*/
	MOUSEBUTTONS | MOUSEMOVE | MENUPICK | GADGETDOWN | GADGETUP | 
		RAWKEY | NEWSIZE | CLOSEWINDOW,	/* idcmp flags	*/
	WINDOWDEPTH | WINDOWCLOSE | WINDOWDRAG | WINDOWSIZING |
		GIMMEZEROZERO | SMART_REFRESH | ACTIVATE,	/* window flags */
	&big_gad,					/* first gadget */
	NULL,						/* checkmark image */
	NULL,						/* title */
	NULL, NULL,					/* screen, bit map */
	150, 70, 640, 400,			/* min width, height; max width, height */
	WBENCHSCREEN,
	} ;
