/***********************************************************************
*      Copyright 1986 by Doug Caruthers                                *
*      Header file -- Defines screen,window, menus etc.                *
*      Created 7/10/85                                                 *
***********************************************************************/
#include "maclib/intuall.h"
/*#include "exec/types.h"
#include "exec/nodes.h"
#include "exec/lists.h"
#include "intuition/intuition.h"
#include "graphics/text.h"*/
long GfxBase = 0;   /* Base of graphics library */
long IntuitionBase = 0;      /* Base of Intuition library */
struct Window *OpenWindow();
struct InputEvent *Intuition();
struct RastPort *CDRastPort();
struct Screen *OpenScreen();
struct TextAttr TestFont = {
   "Topaz80",8,0,0      /* Define text font for our screen */
   };
USHORT wakeup;   /* Wake me up for event */
USHORT class;   /* Intu event class */
USHORT code;   /* Intu event code */
USHORT qual;   /* Intu event qualifier */
USHORT mode;   /* Intu event mode */
APTR address;   /* address of gadget that user hit */
struct Window *w;      /* Lots of pointers for lots of things */
struct RastPort *rp,*cdrp;
struct ViewPort *vp;
struct IntuiMessage *message;
struct Screen *screen;
/************************ Screen Defines *******************************/

struct NewScreen ns = {
   0,0,            /* start pos.*/
   640,200,2,      /* width height depth (2 bit planes) */
   0,1,            /* detail pen, block pen */
   HIRES,          /* viewing mode (640x400 interlaced) */
   CUSTOMSCREEN,   /* screen type */
   NULL,           /* font */
   "Doug's Screen",/* screen title */
   NULL            /* gadget pointer */
   };
/************************ Window Defines *******************************/

struct NewWindow nw = {
      0,0,          /* Starting corner */
      640,200,      /* Width, height */
      0,1,          /* detail, block pens */
   CLOSEWINDOW,     /* IDCMP flags */
   WINDOWCLOSE | WINDOWSIZING | GIMMEZEROZERO | WINDOWDEPTH | WINDOWDRAG
   | ACTIVATE | REPORTMOUSE | SIMPLE_REFRESH,
                    /* Window flags */
      NULL,         /* Pointer to first gadget */
      NULL,         /* Pointer to checkmark */
      "Doug's Window",/* title */
      NULL,         /* screen pointer */
      NULL,         /* bitmap pointer */
      30,30,640,200,/* sizing limits */
      WBENCHSCREEN  /* type of screen */
      };
/*********************** Menu definitions ******************************/

struct IntuiText text2_1_2 = {
      2,3,              /* front and back pen colors */
      JAM1,             /* drawmode */
      5,                /* left edge */
      0,                /* top edge */
      NULL,             /* font */
      "sub 2 ",         /* text */
      NULL              /* pointer to another string */
      };

struct MenuItem menu2_item1_sub2 = {
      NULL,            /* pointer to next item */
      0,0,64,0,        /* select box dimension */
      ITEMTEXT | ITEMENABLED | HIGHCOMP,
      0,               /* mutual exclude */
      &text2_1_2,      /* pointer to text */
      NULL,            /* AMIGA key */
      NULL             /* pointer to sub-menu */
      };

struct IntuiText text2_1_1 = {
      2,3,              /* front and back pen colors */
      JAM1,             /* drawmode */
      5,                /* left edge */
      0,                /* top edge */
      NULL,             /* font */
      "sub 1 ",         /* text */
      NULL              /* pointer to another string */
      };

struct MenuItem menu2_item1_sub1 = {
      &menu2_item1_sub2, /* pointer to next item */
      0,0,64,0,         /* select box dimension */
      ITEMTEXT | ITEMENABLED | HIGHCOMP,
      0,                /* mutual exclude */
      &text2_1_1,       /* pointer to text */
      NULL,             /* AMIGA key */
      NULL             /* pointer to sub-menu */
      };

struct IntuiText text2_1 = {
      2,3,              /* front and back pen colors */
      JAM1,             /* drawmode */
      5,                /* left edge */
      0,                /* top edge */
      NULL,             /* font */
      "sample",         /* text */
      NULL              /* pointer to another string */
      };

struct MenuItem menu2_item1 = {
      NULL,              /* pointer to next item */
      0,0,64,0,          /* select box dimension */
      ITEMTEXT | ITEMENABLED | HIGHCOMP,
      0,                 /* mutual exclude */
      &text2_1,          /* pointer to text */
      NULL,              /* AMIGA key */
      NULL
      };

struct Menu menu2 = {
      NULL,            /* pointer to next menu */
      64,0,128,0,      /* select box dimensions */
      MENUENABLED,     /* menu enable and items shown */
      "Big Sample",    /* menu name */
      &menu2_item1     /* pointer to first item */
      };

struct IntuiText text1_5 = {
      2,3,              /* front and back pen colors */
      JAM1,             /* drawmode */
      5,                /* left edge */
      0,                /* top edge */
      NULL,             /* font */
      "Quit",           /* text */
      NULL              /* pointer to another string */
      };                

struct MenuItem menu1_item5 = {
      NULL,             /* pointer to next item */
      0,40,64,0,         /* select box dimension */
      ITEMTEXT | ITEMENABLED | HIGHCOMP,
      0,                /* mutual exclude */
      &text1_5,         /* pointer to text */
      NULL,             /* AMIGA key */
      NULL              /* pointer to sub-menu */
      };

struct IntuiText text1_4 = {
      2,3,              /* front and back pen colors */
      JAM1,             /* drawmode */
      5,                /* left edge */
      0,                /* top edge */
      NULL,             /* font */
      "Save As",        /* text */
      NULL              /* pointer to another string */
      };

struct MenuItem menu1_item4 = {
      &menu1_item5,     /* pointer to next item */
      0,30,64,0,         /* select box dimension */
      ITEMTEXT | ITEMENABLED | HIGHCOMP,
      0,                /* mutual exclude */
      &text1_4,         /* pointer to text */
      NULL,             /* AMIGA key */
      NULL              /* pointer to sub-menu */
      };

struct IntuiText text1_3 = {
      2,3,              /* front and back pen colors */
      JAM2,             /* drawmode */
      5,                /* left edge */
      0,                /* top edge */
      NULL,             /* font */
      "Save",           /* text */
      NULL              /* pointer to another string */
      };

struct MenuItem menu1_item3 = {
      &menu1_item4,     /* pointer to next item */
      0,20,64,0,        /* select box dimension */
      ITEMTEXT | ITEMENABLED | HIGHCOMP,
      0,                /* mutual exclude */
      &text1_3,         /* pointer to text */
      NULL,             /* AMIGA key */
      NULL              /* pointer to next item */
      };

struct IntuiText text1_2 = {
      2,3,               /* front and back pen colors */
      JAM1,              /* drawmode */
      5,                 /* left edge */
      0,                 /* top edge */
      NULL,              /* font */
      "Open",            /* text */
      NULL               /* pointer to another string */
      };

struct MenuItem menu1_item2 = {
      &menu1_item3,      /* pointer to next item */
      0,10,64,0,          /* select box dimension */
      ITEMTEXT | ITEMENABLED | HIGHBOX,
      0,                 /* mutual exclude */
      &text1_2,          /* pointer to text */
      NULL,              /* AMIGA key */
      NULL               /* pointer to sub-menu */
      };

struct IntuiText text1_1 = {
      2,3,               /* front and back pen colors */
      JAM1,              /* drawmode */
      5,                 /* left edge */
      0,                 /* top edge */
      NULL,              /* font */
      "New",             /* text */
      NULL               /* pointer to another string */
      };

struct MenuItem menu1_item1 = {
      &menu1_item2,      /* pointer to next item */
      0,0,64,0,          /* select box dimension */
      ITEMTEXT | ITEMENABLED | HIGHFLAGS | HIGHCOMP,
      0,                 /* mutual exclude */
      &text1_1,          /* pointer to text */
      NULL,              /* AMIGA key */
      NULL               /* pointer to sub-menu */
      };

struct Menu menu1 = {
      &menu2,            /* pointer to next menu */
      0,0,64,0,          /* select box demensions */
      MENUENABLED | MIDRAWN,       /* menu enable and items shown */
      "Project",         /* menu name */
      &menu1_item1       /* pointer to first item */
      };

/************************ Set-Up routine *******************************
*   This function opens the Intuition and Graphics libraries, then     *
*       opens up our custom screen and window, defining screen colors, *
*       size, and then menu items.                                     *
***********************************************************************/
initwind()
{
   GfxBase = OpenLibrary("graphics.library",0); /* Get graphics driver */
   if(GfxBase == NULL)
   {
      printf("Can't open graphics library...\n");
      exit();
   }
   IntuitionBase = OpenLibrary("intuition.library",0); /*Get Intuition*/  
   if(IntuitionBase == NULL)
   {
      printf("Can't open intuition library...\n");
      exit();
   }

   menu2_item1.SubItem = &menu2_item1_sub1;

/*   screen = OpenScreen(&ns);  * Open our new screen *
   if(screen == NULL)
   {
      exit(0);
   }
   nw.Screen = screen; */

   w = OpenWindow(&nw);         /* Open our new window */
   SetMenuStrip(w,&menu1);       /* Attatch menu */
   rp = w->RPort;               /* Get the raster port pointer */
   vp = &w->WScreen->ViewPort;  /* Get the view port pointer */
   /* SetRGB4(vp,0,0,0,15);        Color 0 is blue
   SetRGB4(vp,1,15,0,0);           Color 1 is red
   SetRGB4(vp,2,0,15,0);           Color 2 is green
   SetRGB4(vp,3,15,15,15);         Color 3 is white
   SetDrMd(rp,JAM1);               Draw with foreground pen only */
}

