/****************** Mandelbrot Fractal Generator ************************

This program was written to learn the lattice environment and to better
learn how the AMIGA works.  It started out as an extra credit project
for CO-127-A1 (C-class).  I became very interested in what these chaotic
fractal images looked like and decided to design a program that would
let anyone interested in them explore "chaos" on their own.  If you have
the patience to wait, they sure make some beautiful looking images.

**************************************************************************/

/*************************************************************************

                I N C L U D E S   A N D   D E F I N E S
             
*************************************************************************/

#include <exec/types.h>
#include <intuition/intuition.h>
#include <stdio.h>
#include <math.h>
#include <exec/memory.h>
#include <graphics/sprite.h>

#define MAND_DRAWING 1
#define JULIA_DRAWING 2
#define MAK_PIC 0
#define MAP_PIC 1
#define TITLE_PIC 2


/************************************************************************

                  S T R U C T U R E    P O I N T E R S
        
************************************************************************/

extern struct Menu *MAKMenu;

struct MathBase *MathBase;
struct GfxBase *GfxBase;
struct RastPort *rp;
struct ViewPort *vp;
struct IntuitionBase *IntuitionBase;
struct Screen *FirstScreen;
struct Window *FirstWindow, *NoBorder, *ColorWindow, *QuitWindow;
struct IntuiMessage *message;



/************************************************************************

                       F O N T   S T R U C T U R E  
             
************************************************************************/

struct TextAttr Font =
  {
  (STRPTR)"topaz.font",
  TOPAZ_EIGHTY,
  FS_NORMAL,
  FPF_ROMFONT
  };


/************************************************************************

                      S C R E E N    S T R U C T U R E
            
************************************************************************/

struct NewScreen FirstNewScreen =
  {
  0, 0,
  640, 400,
  4,
  0, 1,
  HIRES | LACE,
  CUSTOMSCREEN,
  &Font,
  (UBYTE *)"Mandelbrot Adventure Kit",
  NULL,
  NULL,
  };


/*************************************************************************

                         F I R S T     W I N D O W
          
*************************************************************************/

struct NewWindow FirstNewWindow =
  {
  0, 0,
  640, 400,
  0, 1,
  GADGETUP | GADGETDOWN | MENUPICK | REQCLEAR,
  WINDOWDEPTH | WINDOWSIZING | WINDOWDRAG |
  SMART_REFRESH | ACTIVATE,
  NULL,
  NULL,
  (UBYTE *)"Mandelbrot Adventure Kit",
  NULL,
  NULL,
  320, 200,
  640, 400,
  CUSTOMSCREEN,
  };


/*************************************************************************

                 C O L O R   T A B L E    C O L O R S
       
*************************************************************************/


USHORT colortable[16] = { 0x000,0xfff,0x00f,0xc1f,0x91f,
                        0xf00,0x0f0,0xf90,0xff0,0x61f,
                        0x0db,0xbf0,0xfac,0x1fb,0xd00,
                        0x8e0 };

USHORT colortable_2[16];
         
/*****   Color Table colors respectively are: ***************************

         Black, White, Blue, Violet, Purple,
         Red, Green, Orange, Lemon Yellow, Bright Blue,
         Aqua, Lime Green, Pink, Light Aqua, Brick Red,
         Light Green...

*************************************************************************/

/************************************************************************

                           Pointer colors
            
************************************************************************/  

UWORD POINTER_col[] = { 0xff0, 0x000, 0x0f0 };
UWORD CROSS_col[] = { 0xfff, 0x000, 0xf00 };
UWORD SLEEPY_col[] = { 0x9bc, 0x000, 0xff0 };      

/************************************************************************

              Pointer definitions and initializations                      
                                                       
************************************************************************/ 

#define POINTER_SIZE 152
#define CROSS_SIZE 152
#define SLEEPY_SIZE 216

USHORT *Pointer = (USHORT *) NULL;
USHORT *Cross = (USHORT *) NULL;
USHORT *Sleepy = (USHORT *) NULL;

/************************************************************************

             This is the data for the sleepy cloud sprite 
                  
*************************************************************************/

USHORT Sleepy_Sprite[] = {
      0x0000,  0x0000,
      0x0ff0,  0x0000,
      0x1ff0,  0x0000,
      0x3ffc,  0x0000,
      0x7ffe,  0x0000,
      0xffff,  0x1f00,
      0xffff,  0x1300,
      0xffff,  0x067c,
      0xffff,  0x0c4c,
      0xffff,  0x1918,
      0xffff,  0x1f30,
      0xffff,  0x0064,
      0x7fff,  0x007c,
      0x3fff,  0x0000,
      0x1ffe,  0x0000,
      0x07f8,  0x0000,
      0x03ae,  0x0000,
      0x06db,  0x0000,
      0x0451,  0x0000,
      0x06fb,  0x0000,
      0x03de,  0x0000,
      0x0034,  0x0000,
      0x0036,  0x0000,
      0x001d,  0x0000,
      0x0002,  0x0000,
      0x0000,  0x0000,
      0x0000,  0x0000,
                        };

/************************************************************************

                This is the data for the cross sprite 
                  
*************************************************************************/

USHORT Cross_Sprite[] = {
   0x0000, 0x0000,
   0x0100, 0x0100,
   0x0100, 0x0100,
   0x0100, 0x0000,
   0x0100, 0x0000,
   0x0100, 0x0000,
   0x0100, 0x0000,
   0x0000, 0x0000,
   0xfd7e, 0xc106,
   0x0000, 0x0000,
   0x0100, 0x0000,
   0x0100, 0x0000,
   0x0100, 0x0000,
   0x0100, 0x0000,
   0x0100, 0x0100,
   0x0100, 0x0100,
   0x0000, 0x0000,
   0x0000, 0x0000  };

/************************************************************************

                This is the data for the pointer sprite 
                  
*************************************************************************/

USHORT Pointer_Sprite[] = {
   0x0000, 0x0000,
   0x4000, 0x4000,
   0x6000, 0x6000,
   0x7000, 0xb000,
   0x7800, 0xb800,
   0x7c00, 0x9c00,
   0x7e00, 0x9e00,
   0x7f00, 0x8f00,
   0x7f80, 0x8f80,
   0x7fc0, 0x87c0,
   0x7e00, 0x83c0,
   0x7600, 0x8b00,
   0x6300, 0x9d00,
   0x4300, 0xb500,
   0x0180, 0xe680,
   0x0180, 0x0280,
   0x0000, 0x0380,
   0x0000, 0x0000  };

/**************************************************************************

 D E F A U L T   C O L O R   R E Q U E S T E R   I N F O R M A T I O N
 
**************************************************************************/


struct Requester dc_requester;

struct IntuiText dc_OK_txt =
       {1, 0, JAM1, 8, 8, &Font, (UBYTE *)" OK !", NULL};
   
struct Image dc_OK_img = {0,0, 50,25, 3, NULL, 0, 0, NULL};

struct Gadget dc_OK_gadg =
    {
     NULL,
     20, 230, 50, 25,
     GADGIMAGE|GADGHBOX, ENDGADGET|RELVERIFY, REQGADGET|BOOLGADGET,
     (APTR)&dc_OK_img, NULL,
     &dc_OK_txt, NULL,
     NULL, 1, NULL
    };

SHORT default_border1_cords[] = {5,22, 220,22, 220,280, 5,280, 5,22};
SHORT default_border2_cords[] = {10,25, 216,25, 216,275, 10,275, 10,25};
 

struct Border default_border2 =
    {
     0, 0,
     1, 0, JAM1,
     5, &default_border2_cords[0],
     NULL
    };

struct Border default_border1 =
    {
     0, 0,
     1, 0, JAM1,
     5, &default_border1_cords[0],
     &default_border2
    };

struct IntuiText dctxt[19] =
   { 
   {1, 0, JAM1, 60, 34, &Font,
    "Default Colors",
    &dctxt[1]},
   {1, 0, JAM1, 20, 52, &Font,
    "Color #       Color",
    &dctxt[2]},
   {1, 0, JAM1, 20, 61, &Font,
    "-------       -----",
    &dctxt[3]},
   {1, 0, JAM1, 20, 79, &Font,
    " 0          Black",
    &dctxt[4]},
   {1, 0, JAM1, 20, 88, &Font,
    " 1          White",
    &dctxt[5]},
   {1, 0, JAM1, 20, 97, &Font,
    " 2          Blue",
    &dctxt[6]},
   {1, 0, JAM1, 20, 106, &Font,
    " 3          Violet",
    &dctxt[7]},
   {1, 0, JAM1, 20, 115, &Font,
    " 4          Purple",
    &dctxt[8]},
   {1, 0, JAM1, 20, 124, &Font,
    " 5          Red",
    &dctxt[9]},
   {1, 0, JAM1, 20, 133, &Font,
    " 6          Green",
    &dctxt[10]},
   {1, 0, JAM1, 20, 142, &Font,
    " 7          Orange",
    &dctxt[11]},
   {1, 0, JAM1, 20, 151, &Font,
    " 8          Lemon Yellow",
    &dctxt[12]},
   {1, 0, JAM1, 20, 160, &Font,
    " 9          Bright Blue",
    &dctxt[13]},
   {1, 0, JAM1, 20, 169, &Font,
    " 10         Aqua",
    &dctxt[14]},
   {1, 0, JAM1, 20, 178, &Font,
    " 11         Light Green",
    &dctxt[15]},
   {1, 0, JAM1, 20, 187, &Font,
    " 12         Pink",
    &dctxt[16]},
   {1, 0, JAM1, 20, 196, &Font,
    " 13         Light Aqua",
    &dctxt[17]},
   {1, 0, JAM1, 20, 205, &Font,
    " 14         Brick Red",
    &dctxt[18]},
   {1, 0, JAM1, 20, 214, &Font,
    " 15         Light Green",
    NULL}
   };


/**************************************************************************

    D R A W I N G   A R E A   R E Q U E S T E R   I N F O R M A T I O N
    
**************************************************************************/
 
struct Requester da_requester;

struct IntuiText draw_area_OK_txt =
       {1, 0, JAM1, 8, 8, &Font, (UBYTE *)"OK !", NULL};
struct IntuiText draw_area_cancel_txt =
       {1, 0, JAM1, 8, 8, &Font, (UBYTE *)"CANCEL", NULL};

struct Image draw_area_OK_img = {0,0, 50,30, 3, NULL, 0, 0, NULL};
struct Image draw_area_cancel_img = {0,0, 70,30, 3, NULL, 0, 0, NULL};


unsigned char da_H_StringBuffer[6] = "390";
unsigned char da_H_UndoBuffer[6];

struct StringInfo *da_H_ptr;
struct StringInfo da_H_StringInfo =
  {
   &da_H_StringBuffer[0],
   &da_H_UndoBuffer[0],
   0, 6, 0, 0, 0, 0, 0, 0, NULL, 390, NULL,
  };

struct Image da_H_String_img = {0,0, 60,10, 3, NULL, 0, 0, NULL};

struct Gadget da_H_String_gadg =
  {
   NULL,
   120, 120, 60, 10,
   GADGHCOMP, RELVERIFY|LONGINT, REQGADGET|STRGADGET,
   (APTR)&da_H_String_img, NULL,
   NULL, NULL,
   (APTR)&da_H_StringInfo,
   6, NULL,
  };


unsigned char da_W_StringBuffer[6] = "640";
unsigned char da_W_UndoBuffer[6];

struct StringInfo *da_W_ptr;
struct StringInfo da_W_StringInfo =
  {
   &da_W_StringBuffer[0],
   &da_W_UndoBuffer[0],
   0, 6, 0, 0, 0, 0, 0, 0, NULL, 640, NULL,
  };

struct Image da_W_String_img = {0,0, 60,10, 3, NULL, 0, 0, NULL};

struct Gadget da_W_String_gadg =
  {
   &da_H_String_gadg,
   120, 100, 60, 10,
   GADGHCOMP, RELVERIFY|LONGINT, REQGADGET|STRGADGET,
   (APTR)&da_W_String_img, NULL,
   NULL, NULL,
   (APTR)&da_W_StringInfo,
   5, NULL,
  };

unsigned char da_TE_StringBuffer[6] = "10";
unsigned char da_TE_UndoBuffer[6];

struct StringInfo *da_TE_ptr;
struct StringInfo da_TE_StringInfo =
  {
   &da_TE_StringBuffer[0],
   &da_TE_UndoBuffer[0],
   0, 6, 0, 0, 0, 0, 0, 0, NULL, 10, NULL,
  };

struct Image da_TE_String_img = {0,0, 60,10, 3, NULL, 0, 0, NULL};

struct Gadget da_TE_String_gadg =
  {
   &da_W_String_gadg,
   120, 80, 60, 10,
   GADGHCOMP, RELVERIFY|LONGINT, REQGADGET|STRGADGET,
   (APTR)&da_TE_String_img, NULL,
   NULL, NULL,
   (APTR)&da_TE_StringInfo,
   4, NULL,
  };


unsigned char da_LE_StringBuffer[6] = "0";
unsigned char da_LE_UndoBuffer[6];


struct StringInfo *da_LE_ptr;
struct StringInfo da_LE_StringInfo =
  {
   &da_LE_StringBuffer[0],
   &da_LE_UndoBuffer[0],
   0, 6, 0, 0, 0, 0, 0, 0, NULL, 0, NULL,
  };

struct Image da_LE_String_img = {0,0, 60,10, 3, NULL, 0, 0, NULL};

struct Gadget da_LE_String_gadg =
  {
   &da_TE_String_gadg,
   120, 60, 60, 10,
   GADGHCOMP, RELVERIFY|LONGINT, REQGADGET|STRGADGET,
   (APTR)&da_LE_String_img, NULL,
   NULL, NULL,
   (APTR)&da_LE_StringInfo,
   3, NULL,
  };

struct Gadget draw_area_cancel_gadg =
    {
     &da_LE_String_gadg,
     120, 150, 70, 30,
     GADGIMAGE|GADGHBOX, ENDGADGET|RELVERIFY, REQGADGET|BOOLGADGET,
     (APTR)&draw_area_cancel_img, NULL,
     &draw_area_cancel_txt, NULL,
     NULL, 2, NULL
    };

struct Gadget draw_area_OK_gadg =
    {
     &draw_area_cancel_gadg,
     32, 150, 50, 30,
     GADGIMAGE|GADGHBOX, ENDGADGET|RELVERIFY, REQGADGET|BOOLGADGET,
     (APTR)&draw_area_OK_img, NULL,
     &draw_area_OK_txt, NULL,
     NULL, 1, NULL
    };

SHORT draw_area_border1_cords[] = {10,15, 238,15, 238,195, 10,195, 10,15};
SHORT draw_area_border2_cords[] = {14,20, 234,20, 234,190, 14,190, 14,20};
 

struct Border draw_area_border2 =
    {
     0, 0,
     1, 0, JAM1,
     5, &draw_area_border2_cords[0],
     NULL
    };

struct Border draw_area_border1 =
    {
     0, 0,
     1, 0, JAM1,
     5, &draw_area_border1_cords[0],
     &draw_area_border2
    };

struct IntuiText draw_area_txt[5] =
 {
   {1,0,JAM1,24,40,&Font,"Drawing Area Parameters",&draw_area_txt[1]},
   {1, 0, JAM1, 24, 60, &Font, "Left Edge:", &draw_area_txt[2]},
   {1, 0, JAM1, 24, 80, &Font, "Top Edge:", &draw_area_txt[3]},
   {1, 0, JAM1, 24, 100, &Font, "Width:", &draw_area_txt[4]},
   {1, 0, JAM1, 24, 120, &Font, "Height:", NULL}
 };


/**************************************************************************

 D R A W I N G   A R E A   E R R O R   #1   R E Q U E S T E R   I N F O

**************************************************************************/


struct Requester da_err1_requester;

struct IntuiText da_err1_OK_txt =
       {1, 0, JAM1, 8, 8, &Font, (UBYTE *)"OK !", NULL};

struct Image da_err1_OK_img = {0,0, 50,30, 3, NULL, 0, 0, NULL};

struct Gadget da_err1_OK_gadg =
    {
     NULL,
     32, 150, 50, 30,
     GADGIMAGE|GADGHBOX, ENDGADGET|RELVERIFY, REQGADGET|BOOLGADGET,
     (APTR)&da_err1_OK_img, NULL,
     &da_err1_OK_txt, NULL,
     NULL, 1, NULL
    };


SHORT da_err1_border1_cords[] = {10,15, 600,15, 600,195, 10,195, 10,15};
SHORT da_err1_border2_cords[] = {14,20, 596,20, 596,190, 14,190, 14,20};
 

struct Border da_err1_border2 =
    {
     0, 0,
     1, 0, JAM1,
     5, &da_err1_border2_cords[0],
     NULL
    };

struct Border da_err1_border1 =
    {
     0, 0,
     1, 0, JAM1,
     5, &da_err1_border1_cords[0],
     &da_err1_border2
    };

struct IntuiText da_err1_txt[5] =
 {
   {1, 0, JAM1, 24, 40, &Font,
    "The maximum width for drawing allowed by this program is 640!!",
    &da_err1_txt[1]},
   {1, 0, JAM1, 24, 60, &Font,
    "When you are changing the drawing area parameters, please keep",
    &da_err1_txt[2]},
   {1, 0, JAM1, 24, 80, &Font,
    "in mind that the numbers you specify in the Left Edge: and",
    &da_err1_txt[3]},
   {1, 0, JAM1, 24, 100, &Font,
    "Width: fields can not have a sum larger than 640!!  These",
    &da_err1_txt[4]},
   {1, 0, JAM1, 24, 120, &Font,
    "fields have been reset to their default values...",
    NULL}
 };


/**************************************************************************

 D R A W I N G   A R E A   E R R O R   #2   R E Q U E S T E R   I N F O

**************************************************************************/


struct Requester da_err2_requester;

struct IntuiText da_err2_OK_txt =
       {1, 0, JAM1, 8, 8, &Font, (UBYTE *)"OK !", NULL};

struct Image da_err2_OK_img = {0,0, 50,30, 3, NULL, 0, 0, NULL};

struct Gadget da_err2_OK_gadg =
    {
     NULL,
     32, 150, 50, 30,
     GADGIMAGE|GADGHBOX, ENDGADGET|RELVERIFY, REQGADGET|BOOLGADGET,
     (APTR)&da_err2_OK_img, NULL,
     &da_err2_OK_txt, NULL,
     NULL, 1, NULL
    };


SHORT da_err2_border1_cords[] = {10,15, 600,15, 600,195, 10,195, 10,15};
SHORT da_err2_border2_cords[] = {14,20, 596,20, 596,190, 14,190, 14,20};
 

struct Border da_err2_border2 =
    {
     0, 0,
     1, 0, JAM1,
     5, &da_err2_border2_cords[0],
     NULL
    };

struct Border da_err2_border1 =
    {
     0, 0,
     1, 0, JAM1,
     5, &da_err2_border1_cords[0],
     &da_err2_border2
    };

struct IntuiText da_err2_txt[5] =
 {
   {1, 0, JAM1, 24, 40, &Font,
    "The maximum height for drawing allowed by this program is 400!!",
    &da_err2_txt[1]},
   {1, 0, JAM1, 24, 60, &Font,
    "When you are changing the drawing area parameters, please keep",
    &da_err2_txt[2]},
   {1, 0, JAM1, 24, 80, &Font,
    "in mind that the numbers you specify in the Top Edge: and",
    &da_err2_txt[3]},
   {1, 0, JAM1, 24, 100, &Font,
    "Height: fields can not have a sum larger than 400!!  These",
    &da_err2_txt[4]},
   {1, 0, JAM1, 24, 120, &Font,
    "fields have been reset to their default values...",
    NULL}
 };


/**************************************************************************

                             Q U I T     I N F O

**************************************************************************/

struct IntuiText quit_OK_txt =
       {0, 1, JAM2, 4, 4, &Font, (UBYTE *)"OK !", NULL};
         
struct IntuiText quit_cancel_txt =
       {0, 1, JAM2, 4, 4, &Font, (UBYTE *)"CANCEL", NULL};

struct IntuiText quit_crnt_txt[5] =
 {
   {0, 1, JAM2, 5, 10, &Font,
    "  Q U I T    C U R R E N T    J O B",
    &quit_crnt_txt[1]},
   {0, 1, JAM2, 65, 25, &Font,
    "The Drawing Window will",
    &quit_crnt_txt[2]},
   {0, 1, JAM2, 5, 40, &Font,
    "  be closed and, unless saved, the",
    &quit_crnt_txt[3]},
   {0, 1, JAM2, 5, 55, &Font,
    "  current drawing will be lost !!!",
    &quit_crnt_txt[4]},
   {0, 1, JAM2, 85, 70, &Font,
    "STILL WANT TO QUIT ?",
    NULL}
 };   

struct IntuiText quit_prog_txt[2] =
 {
   {0, 1, JAM2, 5, 10, &Font,
    "    Q U I T    P R O G R A M",
    &quit_prog_txt[1]},
   {0, 1, JAM2, 5, 50, &Font,
    "         ARE YOU SURE ?",
    NULL}
 };


/**************************************************************************

            M A N D E L B R O T    F R A C T A L   V A L U E S  
 
                R E Q U E S T E R   I N F O R M A T I O N

**************************************************************************/

struct Requester fv_requester;

struct IntuiText frac_val_OK_txt =
       {1, 0, JAM1, 8, 8, &Font, (UBYTE *)"OK !", NULL};
struct IntuiText frac_val_cancel_txt =
       {1, 0, JAM1, 8, 8, &Font, (UBYTE *)"CANCEL", NULL};

struct Image frac_val_OK_img = {0,0, 50,30, 3, NULL, 0, 0, NULL};
struct Image frac_val_cancel_img = {0,0, 70,30, 3, NULL, 0, 0, NULL};


unsigned char fv_rn_StringBuffer[13] = "-2.000000";
unsigned char fv_rn_UndoBuffer[13];
unsigned char *fv_rn_ptr;

struct StringInfo fv_rn_StringInfo =
  {
   &fv_rn_StringBuffer[0],
   &fv_rn_UndoBuffer[0],
   0, 13, 0, 0, 0, 0, 0, 0, NULL, 0, NULL,
  };

struct Image fv_rn_String_img = {0,0, 110,10, 3, NULL, 0, 0, NULL};

struct Gadget fv_rn_String_gadg =
  {
   NULL,
   120, 60, 110, 10,
   GADGHCOMP, RELVERIFY, REQGADGET|STRGADGET,
   (APTR)&fv_rn_String_img, NULL,
   NULL, NULL,
   (APTR)&fv_rn_StringInfo,
   6, NULL,
  };


unsigned char fv_rx_StringBuffer[13] = ".500000";
unsigned char fv_rx_UndoBuffer[13];
unsigned char *fv_rx_ptr;

struct StringInfo fv_rx_StringInfo =
  {
   &fv_rx_StringBuffer[0],
   &fv_rx_UndoBuffer[0],
   0, 13, 0, 0, 0, 0, 0, 0, NULL, 0, NULL,
  };

struct Image fv_rx_String_img = {0,0, 110,10, 3, NULL, 0, 0, NULL};

struct Gadget fv_rx_String_gadg =
  {
   &fv_rn_String_gadg,
   120, 80, 110, 10,
   GADGHCOMP, RELVERIFY, REQGADGET|STRGADGET,
   (APTR)&fv_rx_String_img, NULL,
   NULL, NULL,
   (APTR)&fv_rx_StringInfo,
   5, NULL,
  };

unsigned char fv_in_StringBuffer[13] = "-1.250000";
unsigned char fv_in_UndoBuffer[13];
unsigned char *fv_in_ptr;

struct StringInfo fv_in_StringInfo =
  {
   &fv_in_StringBuffer[0],
   &fv_in_UndoBuffer[0],
   0, 13, 0, 0, 0, 0, 0, 0, NULL, 0, NULL,
  };

struct Image fv_in_String_img = {0,0, 110,10, 3, NULL, 0, 0, NULL};

struct Gadget fv_in_String_gadg =
  {
   &fv_rx_String_gadg,
   120, 100, 110, 10,
   GADGHCOMP, RELVERIFY, REQGADGET|STRGADGET,
   (APTR)&fv_in_String_img, NULL,
   NULL, NULL,
   (APTR)&fv_in_StringInfo,
   4, NULL,
  };


unsigned char fv_ix_StringBuffer[13] = "1.250000";
unsigned char fv_ix_UndoBuffer[13];
unsigned char *fv_ix_ptr;

struct StringInfo fv_ix_StringInfo =
  {
   &fv_ix_StringBuffer[0],
   &fv_ix_UndoBuffer[0],
   0, 13, 0, 0, 0, 0, 0, 0, NULL, 0, NULL,
  };

struct Image fv_ix_String_img = {0,0, 110,10, 3, NULL, 0, 0, NULL};

struct Gadget fv_ix_String_gadg =
  {
   &fv_in_String_gadg,
   120, 120, 110, 10,
   GADGHCOMP, RELVERIFY, REQGADGET|STRGADGET,
   (APTR)&fv_ix_String_img, NULL,
   NULL, NULL,
   (APTR)&fv_ix_StringInfo,
   3, NULL,
  };

struct Gadget frac_val_cancel_gadg =
    {
     &fv_ix_String_gadg,
     120, 150, 70, 30,
     GADGIMAGE|GADGHBOX, ENDGADGET|RELVERIFY, REQGADGET|BOOLGADGET,
     (APTR)&frac_val_cancel_img, NULL,
     &frac_val_cancel_txt, NULL,
     NULL, 2, NULL
    };

struct Gadget frac_val_OK_gadg =
    {
     &frac_val_cancel_gadg,
     32, 150, 50, 30,
     GADGIMAGE|GADGHBOX, ENDGADGET|RELVERIFY, REQGADGET|BOOLGADGET,
     (APTR)&frac_val_OK_img, NULL,
     &frac_val_OK_txt, NULL,
     NULL, 1, NULL
    };

SHORT frac_val_border1_cords[] = {10,15, 250,15, 250,195, 10,195, 10,15};
SHORT frac_val_border2_cords[] = {14,20, 246,20, 246,190, 14,190, 14,20};
 

struct Border frac_val_border2 =
    {
     0, 0,
     1, 0, JAM1,
     5, &frac_val_border2_cords[0],
     NULL
    };

struct Border frac_val_border1 =
    {
     0, 0,
     1, 0, JAM1,
     5, &frac_val_border1_cords[0],
     &frac_val_border2
    };

struct IntuiText frac_val_txt[6] =
 {
   {1, 0, JAM1, 24, 30, &Font,
    "    Fractal  Values",
    &frac_val_txt[1]},
    {1, 0, JAM1, 24, 40, &Font,
    "    Mandelbrot  Set",
    &frac_val_txt[2]},
   {1, 0, JAM1, 24, 60, &Font, 
    "Real Min.:", 
    &frac_val_txt[3]},
   {1, 0, JAM1, 24, 80, &Font, 
    "Real Max.:", 
    &frac_val_txt[4]},
   {1, 0, JAM1, 24, 100, &Font, 
    "Imag. Min.:", 
    &frac_val_txt[5]},
   {1, 0, JAM1, 24, 120, &Font, 
    "Imag. Max.:", 
    NULL}
 };


/**************************************************************************

                J U L I A    F R A C T A L    V A L U E S  
 
                R E Q U E S T E R   I N F O R M A T I O N

**************************************************************************/

struct Requester jv_requester;

struct IntuiText jul_val_OK_txt =
       {1, 0, JAM1, 8, 8, &Font, (UBYTE *)"OK !", NULL};
   
struct IntuiText jul_val_cancel_txt =
       {1, 0, JAM1, 8, 8, &Font, (UBYTE *)"CANCEL", NULL};

struct Image jul_val_OK_img = {0,0, 50,30, 3, NULL, 0, 0, NULL};
struct Image jul_val_cancel_img = {0,0, 70,30, 3, NULL, 0, 0, NULL};


unsigned char jv_rn_StringBuffer[13] = "-1.500000";
unsigned char jv_rn_UndoBuffer[13];
unsigned char *jv_rn_ptr;

struct StringInfo jv_rn_StringInfo =
  {
   &jv_rn_StringBuffer[0],
   &jv_rn_UndoBuffer[0],
   0, 13, 0, 0, 0, 0, 0, 0, NULL, 0, NULL,
  };

struct Image jv_rn_String_img = {0,0, 110,10, 3, NULL, 0, 0, NULL};

struct Gadget jv_rn_String_gadg =
  {
   NULL,
   120, 60, 110, 10,
   GADGHCOMP, RELVERIFY, REQGADGET|STRGADGET,
   (APTR)&jv_rn_String_img, NULL,
   NULL, NULL,
   (APTR)&jv_rn_StringInfo,
   8, NULL,
  };


unsigned char jv_rx_StringBuffer[13] = "1.500000";
unsigned char jv_rx_UndoBuffer[13];
unsigned char *jv_rx_ptr;

struct StringInfo jv_rx_StringInfo =
  {
   &jv_rx_StringBuffer[0],
   &jv_rx_UndoBuffer[0],
   0, 13, 0, 0, 0, 0, 0, 0, NULL, 0, NULL,
  };

struct Image jv_rx_String_img = {0,0, 110,10, 3, NULL, 0, 0, NULL};

struct Gadget jv_rx_String_gadg =
  {
   &jv_rn_String_gadg,
   120, 80, 110, 10,
   GADGHCOMP, RELVERIFY, REQGADGET|STRGADGET,
   (APTR)&jv_rx_String_img, NULL,
   NULL, NULL,
   (APTR)&jv_rx_StringInfo,
   7, NULL,
  };

unsigned char jv_in_StringBuffer[13] = "-1.500000";
unsigned char jv_in_UndoBuffer[13];
unsigned char *jv_in_ptr;

struct StringInfo jv_in_StringInfo =
  {
   &jv_in_StringBuffer[0],
   &jv_in_UndoBuffer[0],
   0, 13, 0, 0, 0, 0, 0, 0, NULL, 0, NULL,
  };

struct Image jv_in_String_img = {0,0, 110,10, 3, NULL, 0, 0, NULL};

struct Gadget jv_in_String_gadg =
  {
   &jv_rx_String_gadg,
   120, 100, 110, 10,
   GADGHCOMP, RELVERIFY, REQGADGET|STRGADGET,
   (APTR)&jv_in_String_img, NULL,
   NULL, NULL,
   (APTR)&jv_in_StringInfo,
   6, NULL,
  };


unsigned char jv_ix_StringBuffer[13] = "1.500000";
unsigned char jv_ix_UndoBuffer[13];
unsigned char *jv_ix_ptr;

struct StringInfo jv_ix_StringInfo =
  {
   &jv_ix_StringBuffer[0],
   &jv_ix_UndoBuffer[0],
   0, 13, 0, 0, 0, 0, 0, 0, NULL, 0, NULL,
  };

struct Image jv_ix_String_img = {0,0, 110,10, 3, NULL, 0, 0, NULL};

struct Gadget jv_ix_String_gadg =
  {
   &jv_in_String_gadg,
   120, 120, 110, 10,
   GADGHCOMP, RELVERIFY, REQGADGET|STRGADGET,
   (APTR)&jv_ix_String_img, NULL,
   NULL, NULL,
   (APTR)&jv_ix_StringInfo,
   5, NULL,
  };


unsigned char rl_pm_StringBuffer[13] = "-1.100000";
unsigned char rl_pm_UndoBuffer[13];
unsigned char *rl_pm_ptr;

struct StringInfo rl_pm_StringInfo =
  {
   &rl_pm_StringBuffer[0],
   &rl_pm_UndoBuffer[0],
   0, 13, 0, 0, 0, 0, 0, 0, NULL, 0, NULL,
  };

struct Image rl_pm_String_img = {0,0, 110,10, 3, NULL, 0, 0, NULL};

struct Gadget rl_pm_String_gadg =
  {
   &jv_ix_String_gadg,
   140, 140, 110, 10,
   GADGHCOMP, RELVERIFY, REQGADGET|STRGADGET,
   (APTR)&rl_pm_String_img, NULL,
   NULL, NULL,
   (APTR)&rl_pm_StringInfo,
   4, NULL,
  };

unsigned char im_pm_StringBuffer[13] = ".6557000";
unsigned char im_pm_UndoBuffer[13];
unsigned char *im_pm_ptr;

struct StringInfo im_pm_StringInfo =
  {
   &im_pm_StringBuffer[0],
   &im_pm_UndoBuffer[0],
   0, 13, 0, 0, 0, 0, 0, 0, NULL, 0, NULL,
  };

struct Image im_pm_String_img = {0,0, 110,10, 3, NULL, 0, 0, NULL};

struct Gadget im_pm_String_gadg =
  {
   &rl_pm_String_gadg,
   140, 150, 110, 10,
   GADGHCOMP, RELVERIFY, REQGADGET|STRGADGET,
   (APTR)&im_pm_String_img, NULL,
   NULL, NULL,
   (APTR)&im_pm_StringInfo,
   3, NULL,
  };


struct Gadget jul_val_cancel_gadg =
    {
     &im_pm_String_gadg,
     120, 180, 70, 30,
     GADGIMAGE|GADGHBOX, ENDGADGET|RELVERIFY, REQGADGET|BOOLGADGET,
     (APTR)&jul_val_cancel_img, NULL,
     &jul_val_cancel_txt, NULL,
     NULL, 2, NULL
    };

struct Gadget jul_val_OK_gadg =
    {
     &jul_val_cancel_gadg,
     32, 180, 50, 30,
     GADGIMAGE|GADGHBOX, ENDGADGET|RELVERIFY, REQGADGET|BOOLGADGET,
     (APTR)&jul_val_OK_img, NULL,
     &jul_val_OK_txt, NULL,
     NULL, 1, NULL
    };

SHORT jul_val_border1_cords[] = {10,15, 270,15, 270,225, 10,225, 10,15};
SHORT jul_val_border2_cords[] = {14,20, 266,20, 266,220, 14,220, 14,20};
 

struct Border jul_val_border2 =
    {
     0, 0,
     1, 0, JAM1,
     5, &jul_val_border2_cords[0],
     NULL
    };

struct Border jul_val_border1 =
    {
     0, 0,
     1, 0, JAM1,
     5, &jul_val_border1_cords[0],
     &jul_val_border2
    };

struct IntuiText jul_val_txt[8] =
 {
   {1, 0, JAM1, 24, 30, &Font,
    "    Fractal  Values",
    &jul_val_txt[1]},
    {1, 0, JAM1, 24, 40, &Font,
    "      Julia   Set",
    &jul_val_txt[2]},
   {1, 0, JAM1, 24, 60, &Font, 
    "Real Min.:", 
    &jul_val_txt[3]},
   {1, 0, JAM1, 24, 80, &Font, 
    "Real Max.:", 
    &jul_val_txt[4]},
   {1, 0, JAM1, 24, 100, &Font, 
    "Imag. Min.:", 
    &jul_val_txt[5]},
   {1, 0, JAM1, 24, 120, &Font, 
    "Imag. Max.:", 
    &jul_val_txt[6]},
   {1, 0, JAM1, 24, 140, &Font,
    "Real Param.",
    &jul_val_txt[7]},
   {1, 0, JAM1, 24, 150, &Font,
    "Imag. Param.",
    NULL}
 };


/**************************************************************************
 
  C O L O R   A D J U S T E R   R E Q U E S T E R   I N F O R M A T I O N

**************************************************************************/
 
struct Image clr_adj_box_img = {0, 0, 70, 40, 3, NULL, 0, 0, NULL};

char clr_adj_box_str[4];

struct IntuiText clr_adj_box_txt = 
            {1, 0, JAM1, 12, 12, &Font, NULL, NULL};

struct Gadget clr_adj_box_gad =
  {
   NULL,
   115, 145, 70, 40,
   GADGHNONE|GADGIMAGE, RELVERIFY,
   BOOLGADGET|REQGADGET,
   (APTR)&clr_adj_box_img,
   NULL, &clr_adj_box_txt, 
   NULL, NULL,
   22, NULL
  };
 
/*************************** Slider Info ********************************/

struct IntuiText R_txt = 
            {1, 0, JAM1, -14, 2, &Font, (UBYTE *)"R", NULL};
      
struct IntuiText G_txt = 
            {1, 0, JAM1, -14, 2, &Font, (UBYTE *)"G", NULL};
      
struct IntuiText B_txt =  
            {1, 0, JAM1, -14, 2, &Font, (UBYTE *)"B", NULL};
      
struct Image    R_img, G_img, B_img;
struct PropInfo R_Propinfo, G_Propinfo, B_Propinfo;
 
struct Gadget B_gad = 
  {
   &clr_adj_box_gad, 
   40, 125, 140, 11, 
   GADGHCOMP, GADGIMMEDIATE|RELVERIFY,
   PROPGADGET|REQGADGET,
   (APTR)&B_img, NULL,
   &B_txt, NULL,
   (APTR)&B_Propinfo, 
   16, NULL 
  };
 
struct Gadget G_gad = 
  {
   &B_gad, 
   40, 110, 140, 11, 
   GADGHCOMP, GADGIMMEDIATE|RELVERIFY,
   PROPGADGET|REQGADGET,
   (APTR)&G_img, NULL,
   &G_txt, NULL,
   (APTR)&G_Propinfo, 
   17, NULL 
  };
 
struct Gadget R_gad = 
  {
   &G_gad, 
   40, 95, 140, 11, 
   GADGHCOMP, GADGIMMEDIATE|RELVERIFY,
   PROPGADGET|REQGADGET,
   (APTR)&R_img, NULL,
   &R_txt, NULL,
   (APTR)&R_Propinfo, 
   18, NULL 
  };

struct IntuiText clr_adj_cancel_txt = 
            {1, 0, JAM1, 13, 1, &Font, (UBYTE *)"Cancel", NULL};
      
struct IntuiText clr_adj_default_txt = 
            {1, 0, JAM1, 8, 1, &Font, (UBYTE *)"Default", NULL};
       
struct IntuiText clr_adj_OK_txt =  
            {1, 0, JAM1, 26, 1, &Font, (UBYTE *)"OK", NULL};

struct Image clr_adj_gad_img = {0, 0, 70, 10, 3, NULL, 0, 2, NULL};
   
struct Gadget clr_adj_default_gad = 
  {
   &R_gad, 
   30, 160, 70, 10, 
   GADGHBOX|GADGIMAGE, RELVERIFY,
   BOOLGADGET|REQGADGET, 
   (APTR)&clr_adj_gad_img, NULL,
   &clr_adj_default_txt, 
   NULL, NULL, 
   19, NULL 
  };
   
struct Gadget clr_adj_cancel_gad = 
  {
   &clr_adj_default_gad, 
   30, 145, 70, 10, 
   GADGHBOX|GADGIMAGE, RELVERIFY,
   BOOLGADGET|REQGADGET, 
   (APTR)&clr_adj_gad_img, NULL,
   &clr_adj_cancel_txt, 
   NULL, NULL, 
   20, NULL 
  };
 
  
struct Gadget clr_adj_OK_gad = 
  {
   &clr_adj_cancel_gad, 
   30, 175, 70, 10, 
   GADGHBOX|GADGIMAGE,
   RELVERIFY|ENDGADGET, 
   BOOLGADGET|REQGADGET, 
   (APTR)&clr_adj_gad_img, NULL,
   &clr_adj_OK_txt, 
   NULL, NULL, 
   21, NULL 
  };
  

/************************ Color Select ***********************************/
 
struct Image clr_adj_boxes[16] = 
  {
   {0, 0, 30, 15, 1, NULL, 0, 0, NULL},
   {0, 0, 30, 15, 1, NULL, 0, 1, NULL},
   {0, 0, 30, 15, 1, NULL, 0, 2, NULL},
   {0, 0, 30, 15, 1, NULL, 0, 3, NULL},
   {0, 0, 30, 15, 1, NULL, 0, 4, NULL},
   {0, 0, 30, 15, 1, NULL, 0, 5, NULL},
   {0, 0, 30, 15, 1, NULL, 0, 6, NULL},
   {0, 0, 30, 15, 1, NULL, 0, 7, NULL},
   {0, 0, 30, 15, 1, NULL, 0, 8, NULL},
   {0, 0, 30, 15, 1, NULL, 0, 9, NULL},
   {0, 0, 30, 15, 1, NULL, 0, 10, NULL},
   {0, 0, 30, 15, 1, NULL, 0, 11, NULL},
   {0, 0, 30, 15, 1, NULL, 0, 12, NULL},
   {0, 0, 30, 15, 1, NULL, 0, 13, NULL},
   {0, 0, 30, 15, 1, NULL, 0, 14, NULL},
   {0, 0, 30, 15, 1, NULL, 0, 15, NULL} 
  };
 
struct Gadget clr_adj_gads[16] = 
  {
   {&clr_adj_gads[1], 44, 22,  30, 15, GADGHBOX|GADGIMAGE, RELVERIFY,
     BOOLGADGET|REQGADGET, (APTR)&clr_adj_boxes[0], 
      NULL, NULL, NULL, NULL, 0, NULL},
   {&clr_adj_gads[2], 78, 22, 30, 15, GADGHBOX|GADGIMAGE, RELVERIFY,
     BOOLGADGET|REQGADGET, (APTR)&clr_adj_boxes[1], 
      NULL, NULL, NULL, NULL, 1, NULL},
   {&clr_adj_gads[3], 112, 22, 30, 15, GADGHBOX|GADGIMAGE, RELVERIFY,
     BOOLGADGET|REQGADGET, (APTR)&clr_adj_boxes[2], 
      NULL, NULL, NULL, NULL, 2, NULL},
   {&clr_adj_gads[4], 146, 22, 30, 15, GADGHBOX|GADGIMAGE, RELVERIFY,
     BOOLGADGET|REQGADGET, (APTR)&clr_adj_boxes[3], 
      NULL, NULL, NULL, NULL, 3, NULL},
   {&clr_adj_gads[5], 44, 39, 30, 15, GADGHBOX|GADGIMAGE, RELVERIFY,
     BOOLGADGET|REQGADGET, (APTR)&clr_adj_boxes[4], 
      NULL, NULL, NULL, NULL, 4, NULL},
   {&clr_adj_gads[6], 78, 39, 30, 15, GADGHBOX|GADGIMAGE, RELVERIFY,
     BOOLGADGET|REQGADGET, (APTR)&clr_adj_boxes[5], 
      NULL, NULL, NULL, NULL, 5, NULL},
   {&clr_adj_gads[7], 112, 39, 30, 15, GADGHBOX|GADGIMAGE, RELVERIFY,
     BOOLGADGET|REQGADGET, (APTR)&clr_adj_boxes[6], 
      NULL, NULL, NULL, NULL, 6, NULL},
   {&clr_adj_gads[8], 146, 39,  30, 15, GADGHBOX|GADGIMAGE, RELVERIFY,
     BOOLGADGET|REQGADGET, (APTR)&clr_adj_boxes[7], 
      NULL, NULL, NULL, NULL, 7, NULL},
   {&clr_adj_gads[9], 44, 56, 30, 15, GADGHBOX|GADGIMAGE, RELVERIFY,
     BOOLGADGET|REQGADGET, (APTR)&clr_adj_boxes[8], 
      NULL, NULL, NULL, NULL, 8, NULL},
   {&clr_adj_gads[10], 78, 56, 30, 15, GADGHBOX|GADGIMAGE, RELVERIFY,
     BOOLGADGET|REQGADGET, (APTR)&clr_adj_boxes[9], 
      NULL, NULL, NULL, NULL, 9, NULL},
   {&clr_adj_gads[11], 112, 56, 30, 15, GADGHBOX|GADGIMAGE, RELVERIFY,
     BOOLGADGET|REQGADGET, (APTR)&clr_adj_boxes[10], 
      NULL, NULL, NULL, NULL, 10, NULL},
   {&clr_adj_gads[12], 146, 56, 30, 15, GADGHBOX|GADGIMAGE, RELVERIFY,
     BOOLGADGET|REQGADGET, (APTR)&clr_adj_boxes[11], 
      NULL, NULL, NULL, NULL, 11, NULL},
   {&clr_adj_gads[13], 44, 73, 30, 15, GADGHBOX|GADGIMAGE, RELVERIFY,
     BOOLGADGET|REQGADGET, (APTR)&clr_adj_boxes[12], 
      NULL, NULL, NULL, NULL, 12, NULL},
   {&clr_adj_gads[14], 78, 73, 30, 15, GADGHBOX|GADGIMAGE, RELVERIFY,
     BOOLGADGET|REQGADGET, (APTR)&clr_adj_boxes[13], 
      NULL, NULL, NULL, NULL, 13, NULL},
   {&clr_adj_gads[15], 112, 73, 30, 15, GADGHBOX|GADGIMAGE, RELVERIFY,
     BOOLGADGET|REQGADGET, (APTR)&clr_adj_boxes[14], 
      NULL, NULL, NULL, NULL, 14, NULL},
   {&clr_adj_OK_gad, 146, 73, 30, 15, GADGHBOX|GADGIMAGE, RELVERIFY,
     BOOLGADGET | REQGADGET,  (APTR)&clr_adj_boxes[15], 
      NULL, NULL, NULL, NULL, 15, NULL} 
  };
 
struct IntuiText clr_adj_txt = 
            {1, 0, JAM1, 55, 10, &Font, (UBYTE *)"Color Modifier", NULL};

struct Requester clr_adj_requester;

SHORT clr_adj_border1_cords[] = {10,1, 205,1, 205,195, 10,195, 10,1};
SHORT clr_adj_border2_cords[] = {15,4, 200,4, 200,192, 15,192, 15,4};

struct Border clr_adj_border2 =
  {
   0, 0,
   1, 0, JAM1,
   5, &clr_adj_border2_cords[0], 
   NULL
  };

struct Border clr_adj_border1 =
  {
   0, 0,
   1, 0, JAM1,
   5, &clr_adj_border1_cords[0], 
   &clr_adj_border2
  };
  
/**************************************************************************

 G L O B A L   V A R I A B L E S   &   S T R U C T U R E S
 
**************************************************************************/ 
   
struct Values
  {
   double realmn;
   double realmx;
   double imagmn;
   double imagmx;
  };
struct Values vls;

BOOL DrawWindow = FALSE; 

int colr, xpos, ypos;
int maxcolr = 25;

long da_W = 640,
     da_H = 400,
     da_LE = 0,
     da_TE = 0;

int zn1, zn2, zn3, zn4, zn5, zn6, zn7, zn8, zn9, zn10, 
    zn11, zn12, zn13, zn14, zn15, zn16, zn17, zn18, zn19, zn20, 
    zn21, zn22, zn23, zn24, zn25, zn26, zn27, zn28, zn29, zn30,
    zn31, zn32, zn33, zn34, zn35, zn36, zn37, zn38, zn39, zn40,
    zn41, zn42, zn43, zn44, zn45, zn46, zn47, zn48, zn49, zn50,
    zn51, zn52, zn53, zn54, zn55, zn56, zn57, zn58, zn59, zn60,
    zn61, zn62, zn63, zn64, zn65, zn66, zn67, zn68, zn69, zn70,
    zn71, zn72, zn73, zn74, zn75, zn76, zn77, zn78, zn79, zn80,
    zn81, zn82, zn83, zn84, zn85, zn86, zn87, zn88, zn89, zn90,
    zn91, zn92, zn93, zn94, zn95, zn96, zn97, zn98, zn99, zn100,
    zn101, zn102, zn103, zn104, zn105, zn106, zn107, zn108, zn109, zn110, 
    zn111, zn112, zn113, zn114, zn115, zn116, zn117, zn118, zn119, zn120, 
    zn121, zn122, zn123, zn124, zn125, zn126, zn127, zn128, zn129, zn130,
    zn131, zn132, zn133, zn134, zn135, zn136, zn137, zn138, zn139, zn140,
    zn141, zn142, zn143, zn144, zn145, zn146, zn147, zn148, zn149, zn150,
    zn151, zn152, zn153, zn154, zn155, zn156, zn157, zn158, zn159, zn160,
    zn161, zn162, zn163, zn164, zn165, zn166, zn167, zn168, zn169, zn170,
    zn171, zn172, zn173, zn174, zn175, zn176, zn177, zn178, zn179, zn180,
    zn181, zn182, zn183, zn184, zn185, zn186, zn187, zn188, zn189, zn190,
    zn191, zn192, zn193, zn194, zn195, zn196, zn197, zn198, zn199, zn200;
        

int *Zones[200] = 
                 { &zn1, &zn2, &zn3, &zn4, &zn5, &zn6, 
                   &zn7, &zn8, &zn9, &zn10, 
                   &zn11, &zn12, &zn13, &zn14, &zn15,  
                   &zn16, &zn17, &zn18, &zn19, &zn20, 
                   &zn21, &zn22, &zn23, &zn24, &zn25,
                   &zn26, &zn27, &zn28, &zn29, &zn30,
                   &zn31, &zn32, &zn33, &zn34, &zn35,
                   &zn36, &zn37, &zn38, &zn39, &zn40,
                   &zn41, &zn42, &zn43, &zn44, &zn45,
                   &zn46, &zn47, &zn48, &zn49, &zn50,
                   &zn51, &zn52,   &zn53,  &zn54,  &zn55,
                   &zn56, &zn57,   &zn58,  &zn59,  &zn60,
                   &zn61, &zn62,   &zn63,  &zn64,  &zn65,
                   &zn66, &zn67,   &zn68,  &zn69,  &zn70,
                   &zn71, &zn72,   &zn73,  &zn74,  &zn75,
                   &zn76, &zn77,   &zn78,  &zn79,  &zn80,
                   &zn81, &zn82,   &zn83,  &zn84,  &zn85,
                   &zn86, &zn87,   &zn88,  &zn89,  &zn90,
                   &zn91, &zn92,   &zn93,  &zn94,  &zn95,
                   &zn96, &zn97,   &zn98,  &zn99,  &zn100,
                   &zn101, &zn102, &zn103, &zn104, &zn105,  
                   &zn106, &zn107, &zn108, &zn109, &zn110, 
                   &zn111, &zn112, &zn113, &zn114, &zn115,  
                   &zn116, &zn117, &zn118, &zn119, &zn120, 
                   &zn121, &zn122, &zn123, &zn124, &zn125,
                   &zn126, &zn127, &zn128, &zn129, &zn130,
                   &zn131, &zn132, &zn133, &zn134, &zn135,
                   &zn136, &zn137, &zn138, &zn139, &zn140,
                   &zn141, &zn142, &zn143, &zn144, &zn145,
                   &zn146, &zn147, &zn148, &zn149, &zn150,
                   &zn151, &zn152, &zn153, &zn154, &zn155,
                   &zn156, &zn157, &zn158, &zn159, &zn160,
                   &zn161, &zn162, &zn163, &zn164, &zn165,
                   &zn166, &zn167, &zn168, &zn169, &zn170,
                   &zn171, &zn172, &zn173, &zn174, &zn175,
                   &zn176, &zn177, &zn178, &zn179, &zn180,
                   &zn181, &zn182, &zn183, &zn184, &zn185,
                   &zn186, &zn187, &zn188, &zn189, &zn190,
                   &zn191, &zn192, &zn193, &zn194, &zn195,
                   &zn196, &zn197, &zn198, &zn199, &zn200 };


float jlrow, jlcolmn;
double row, colmn, dltax, dltay;

float realmin = -2.00,
      realmax = .550,
      imagmin = -1.2500,
      imagmax = 1.2500,
      jl_rlmin = -1.5,
      jl_rlmax = 1.5,
      jl_imgmin = -1.5,
      jl_imgmax = 1.5,
      rlparm = -.11,
      imparm = .6557;

float mandmax = 5.0;
float juliamax = 100.0;

SHORT op_code, FractalType;

/**************************************************************************

                                 M A I N
                 
**************************************************************************/


VOID main()
  {
   VOID Open_All(), Close_All();
   UBYTE pict[30];
   int run, Code, Menu, MenuItem, SubItem, MessageClass, i;
   BOOL result;
   Open_All();
   
   for(i = 0; i < 16; i++) colortable_2[i] = colortable[i];

   run = TRUE;

   while (run)
    {
     while ((message = (struct IntuiMessage *)
        GetMsg(FirstWindow->UserPort)))
      {
       MessageClass = message->Class;
       Code = message->Code;
       Menu = MENUNUM(Code);
       MenuItem = ITEMNUM(Code);
       SubItem = SUBNUM(Code);
       ReplyMsg(message);

       if(MessageClass == MENUPICK)
        {
         if((Code) != MENUNULL)
          {
           switch(Menu)
             {
              case 0 : switch(MenuItem)
               {
                case 0: switch(SubItem)
                 {
                  case 0 : op_code = 0;
                           Info_requester(FirstWindow,op_code);
                           ModifyIDCMP(FirstWindow,NULL);
                           ModifyIDCMP(FirstWindow,GADGETUP | 
                           GADGETDOWN | MENUPICK | REQCLEAR);
                           break;
                  
                  case 1 : op_code = 1;
                           Info_requester(FirstWindow,op_code);
                           ModifyIDCMP(FirstWindow,NULL);
                           ModifyIDCMP(FirstWindow,GADGETUP | 
                           GADGETDOWN | MENUPICK | REQCLEAR);
                           break;
                           
                  case 2 : op_code = 2;
                           Info_requester(FirstWindow,op_code);
                           ModifyIDCMP(FirstWindow,NULL);
                           ModifyIDCMP(FirstWindow,GADGETUP | 
                           GADGETDOWN | MENUPICK | REQCLEAR);
                           break;
                           
                  case 3 : op_code = 3;
                           Info_requester(FirstWindow,op_code);
                           ModifyIDCMP(FirstWindow,NULL);
                           ModifyIDCMP(FirstWindow,GADGETUP | 
                           GADGETDOWN | MENUPICK | REQCLEAR);
                           break;
                  
                  case 4 : op_code = 4;
                           Info_requester(FirstWindow,op_code);
                           ModifyIDCMP(FirstWindow,NULL);
                           ModifyIDCMP(FirstWindow,GADGETUP | 
                           GADGETDOWN | MENUPICK | REQCLEAR);
                           break;
                           
                  case 5 : op_code = 5;
                           Info_requester(FirstWindow,op_code);
                           ModifyIDCMP(FirstWindow,NULL);
                           ModifyIDCMP(FirstWindow,GADGETUP | 
                           GADGETDOWN | MENUPICK | REQCLEAR);
                           break;
                  
                  case 6 : op_code = 6;
                           Info_requester(FirstWindow,op_code);
                           ModifyIDCMP(FirstWindow,NULL);
                           ModifyIDCMP(FirstWindow,GADGETUP | 
                           GADGETDOWN | MENUPICK | REQCLEAR);
                           break;
                  
                  case 7 : op_code = 7;
                           Info_requester(FirstWindow,op_code);
                           ModifyIDCMP(FirstWindow,NULL);
                           ModifyIDCMP(FirstWindow,GADGETUP | 
                           GADGETDOWN | MENUPICK | REQCLEAR);
                           break;
                           
                  case 8 : op_code = 8;
                           Info_requester(FirstWindow,op_code);
                           ModifyIDCMP(FirstWindow,NULL);
                           ModifyIDCMP(FirstWindow,GADGETUP | 
                           GADGETDOWN | MENUPICK | REQCLEAR);
                           break;
                           
                  case 9 : op_code = 9;
                           Info_requester(FirstWindow,op_code);
                           ModifyIDCMP(FirstWindow,NULL);
                           ModifyIDCMP(FirstWindow,GADGETUP | 
                           GADGETDOWN | MENUPICK | REQCLEAR);
                           break;
                  
                  case 10 : op_code = 10;
                           Info_requester(FirstWindow,op_code);
                           ModifyIDCMP(FirstWindow,NULL);
                           ModifyIDCMP(FirstWindow,GADGETUP | 
                           GADGETDOWN | MENUPICK | REQCLEAR);
                           break;
                 }                
                break;
               
                case 1:   strcpy(pict,"MAP.ILBM");
                          LoadIt(pict,1);   
                          break;
               
                case 2: switch(SubItem)
                 {
                  case 0 : OffMenu(FirstWindow, 0x07E1);
                           OffMenu(FirstWindow, 0x07E2);
                           OffMenu(FirstWindow, 0x07E3);
                           OffMenu(FirstWindow, 0x07E4);
                           OffMenu(FirstWindow, 0xF800);
                           OffMenu(FirstWindow, 0xF820);
                           OffMenu(FirstWindow, 0xF840);
                           OffMenu(FirstWindow, 0xF860);
                           OffMenu(FirstWindow, 0xF880);
                           OffMenu(FirstWindow, 0xF8A0);
                           mand_draw_func(FirstWindow);
                           FractalType = MAND_DRAWING;
                           DisplayBeep(FirstScreen);
                           if(DrawWindow == TRUE)
                             {
                              OnMenu(FirstWindow, 0x07E2);
                              OffMenu(FirstWindow, 0xF802);
                              OffMenu(FirstWindow, 0xF822);
                             }
                           OnMenu(FirstWindow, 0xF860);
                           break;
                           
                  case 1 : OffMenu(FirstWindow, 0x07E1);
                           OffMenu(FirstWindow, 0x07E2);
                           OffMenu(FirstWindow, 0x07E3);
                           OffMenu(FirstWindow, 0x07E4);
                           OffMenu(FirstWindow, 0xF800);
                           OffMenu(FirstWindow, 0xF820);
                           OffMenu(FirstWindow, 0xF840);
                           OffMenu(FirstWindow, 0xF860);
                           OffMenu(FirstWindow, 0xF880);
                           OffMenu(FirstWindow, 0xF8A0);
                           julia_draw_func(FirstWindow);
                           FractalType = JULIA_DRAWING;
                           DisplayBeep(FirstScreen);
                           if(DrawWindow == TRUE)
                             {
                              OnMenu(FirstWindow, 0x07E2);
                              OffMenu(FirstWindow, 0xF802);
                              OffMenu(FirstWindow, 0xF822);
                             }
                           OnMenu(FirstWindow, 0xF860);
                           break;
                  }
                 break;
                  
                case 3: switch(SubItem)
                 {
                  case 0 : op_code = 1;  
                           file_manager(FirstWindow,Pointer,op_code);
                           break;
                  case 1 : op_code = 2;
                           file_manager(FirstWindow,Pointer,op_code);
                           break;
                 }          
                 break;
                 
                case 4: switch(SubItem)
                 {
                  case 0 : op_code = 3;  
                           file_manager(FirstWindow,Pointer,op_code);
                           break;
                  case 1 : op_code = 4;
                           file_manager(FirstWindow,Pointer,op_code);
                           break;
                 }          
                 break; 
            
                case 5: switch(SubItem)
                 {
                  case 0 : op_code = 5;  
                           file_manager(FirstWindow,Pointer,op_code);
                           break;
                  case 1 : op_code = 6;
                           file_manager(FirstWindow,Pointer,op_code);
                           break;
                 }          
                 break;
                
                case 6: switch(SubItem)
                 {
                  case 0 : result = quit_crnt(FirstWindow);
                           if(result == TRUE)
                             { 
                               if(DrawWindow == TRUE)   
                                 {
                                   CloseWindow(NoBorder);
                                   DrawWindow = FALSE;
                                   OnMenu(FirstWindow, 0x07E1);
                                   OnMenu(FirstWindow, 0x07E3);
                                   OnMenu(FirstWindow, 0x07E4);
                                   OnMenu(FirstWindow, 0xF800);
                                   OnMenu(FirstWindow, 0xF802);
                                   OnMenu(FirstWindow, 0xF820);
                                   OnMenu(FirstWindow, 0xF822);
                                   OnMenu(FirstWindow, 0xF840);
                                   OnMenu(FirstWindow, 0xF880);
                                   OnMenu(FirstWindow, 0xF8A0);
                                 }
                             }
                           else
                             {
                               WindowToFront(NoBorder);
                             }          
                           break;
                  case 1 : result = quit_prog(FirstWindow);
                           if(result == TRUE)
                             {
                               run = 0;
                             }
                           else
                             {
                               WindowToFront(NoBorder);
                             }      
                           break;
                 }          
                 break;       
               } /* close off case 0 MenuItem Switch */
               break;

              case 1 : switch(MenuItem)
                           {
                            case 0 : draw_area(FirstWindow);
                                     break;
                           }
                       break;

              case 2 : switch(MenuItem)
                       {
                        case 0 : default_colors(FirstWindow);
                                 break;
             
                        case 1 : switch(SubItem)
                          {
                            case 0:  color_assign_zn1(FirstWindow);
                                     break;
                   
                            case 1:  color_assign_zn2(FirstWindow);
                                     break;
                           }              
                          break;
                                     
                        case 2 : color_adjust(FirstWindow);
                                 BeginRefresh(FirstWindow);
                                 EndRefresh(FirstWindow);
                                 break;        
                       }
                       break;

              case 3 : switch(MenuItem)
                       {
                         case 0 : maxcolr = 25;
                                  break;
                         case 1 : maxcolr = 50;
                                  break;
                         case 2 : maxcolr = 75;
                                  break;
                         case 3 : maxcolr = 100;
                                  break;
                         case 4 : maxcolr = 125;
                                  break;
                         case 5 : maxcolr = 175;
                                  break;
                         case 6 : maxcolr = 225;
                                  break;
                         case 7 : maxcolr = 275;
                                  break;         
                         case 8 : maxcolr = 325;
                                  break;
                         case 9 : maxcolr = 375;
                                  break;
                       }          
                       break;
                       
              case 4 : switch(MenuItem)
                           {
                            case 0 : fract_vals(FirstWindow);
                                     break;
                 
                            case 1 : julia_vals(FirstWindow);
                                     break;        
                           }
                       break;

             } /*** Menu Switch ***/

          } /*** MENUNULL if ***/

        } /*** MENUPICK if ***/

      } /*** While Message ***/

    } /*** While run loop ***/
    
    Close_All();
    
  } /***  Close Off Main ***/


/*************************************************************************

                    O P E N   A L L   F U N C T I O N 

*************************************************************************/ 

VOID Open_All()
  {
   VOID *OpenLibrary(),move_pointers_to_chipram();
   struct Window *OpenWindow();
   struct Screen *OpenScreen();
   UBYTE pictr[15];
   
   if (!(IntuitionBase = (struct IntuitionBase *)
         OpenLibrary("intuition.library", 0L)))
      {
       printf("Intuition Library not found!\n");
       Close_All();
       exit(FALSE);
      }

   if (!(FirstScreen = (struct Screen *)
         OpenScreen(&FirstNewScreen)))
      {
       printf("No screen page !\n");
       Close_All();
       exit(FALSE);
      }

   FirstNewWindow.Screen = FirstScreen;

   if (!(FirstWindow = (struct Window *)
         OpenWindow(&FirstNewWindow)))
      {
       printf("Window will not open !\n");
       Close_All();
       exit(FALSE);
      }
   
   GfxBase = (struct GfxBase *)
         OpenLibrary("graphics.library",0);
   if(GfxBase == NULL)
      {
       printf("Here graphics library...Here boy...\n");
       exit(FALSE);
      }
    
   MathBase = (struct MathBase *)
          OpenLibrary("mathieeedoubbas.library",0);
   if(MathBase == NULL)
      {
        printf("2 + 2 = 9 ???\n");
        printf("I don't know without my mathieeedoubbas.library\n");
        exit(FALSE);
      }
      
/************************ Load in the colors *****************************/

   vp = (struct ViewPort *)ViewPortAddress(FirstWindow);
   LoadRGB4(vp,&colortable,16);

/************************************************************************/

/************************ Show Title Page *******************************/

   strcpy(pictr,"title");
   LoadIt(pictr,2);

/***********************************************************************/

   move_pointers_to_chipram();
   do_Pointer(FirstWindow);   
   SetMenuStrip(FirstWindow, MAKMenu);
 
  } /*************** Close off Open_All Function ***************/


/************************************************************************

      Move the data for the pointers from the program into chip ram
       
*************************************************************************/

USHORT *MoveData(This_Sprite, Size)
USHORT *This_Sprite;
int Size;
  {
    USHORT *Chip_Sprite, *Save_it, *AllocMem();
    int counter;

    Chip_Sprite = AllocMem( (LONG) (Size * 2), MEMF_CHIP);
    if(Chip_Sprite == (struct USHORT * ) NULL)
       return(Chip_Sprite);

    Save_it = Chip_Sprite;

    for (counter = 0; counter < Size; counter++)
      *(Chip_Sprite++) = *(This_Sprite++);

    return(Save_it);
  }

/***********************************************************************/

VOID move_pointers_to_chipram()
  {
   Pointer = MoveData(Pointer_Sprite, POINTER_SIZE);      
   Cross = MoveData(Cross_Sprite, CROSS_SIZE);   
   Sleepy = MoveData(Sleepy_Sprite, SLEEPY_SIZE); 
  }
  
/**********************************************************************/
  

/************************************************************************

                   D O   P O I N T E R   F U N C T I O N
         
************************************************************************/  

do_Pointer(FirstWindow)
struct Window *FirstWindow;
   {
     SHORT i;
     UWORD red, green, blue;
   
     for (i = 0; i < 3; i++)
       {
   red = (POINTER_col[i] & 0xf00) >> 8;
   green = (POINTER_col[i] & 0x0f0) >> 4;
   blue = (POINTER_col[i] & 0x00f);
   SetRGB4(vp,i + 17,red,green,blue);
       } 
     ClearPointer(FirstWindow);
     SetPointer(FirstWindow,Pointer,16,16,0,0);
   
     return(TRUE);
          
    } /**** Close off do_Pointer function *****/

/************************************************************************

                   D O   C R O S S   F U N C T I O N
         
************************************************************************/

do_Cross(FirstWindow)
struct Window *FirstWindow;
   {
     SHORT i;
     UWORD red, green, blue;
   
     for (i = 0; i < 3; i++)
       {
   red = (CROSS_col[i] & 0xf00) >> 8;
   green = (CROSS_col[i] & 0x0f0) >> 4;
   blue = (CROSS_col[i] & 0x00f);
   SetRGB4(vp,i + 17,red,green,blue);
       } 
     ClearPointer(FirstWindow);
     SetPointer(FirstWindow,Cross,16,16,-8,-8);
   
     return(TRUE);
          
    } /**** Close off the do_Cross function ****/

/************************************************************************

                   D O   S L E E P Y   F U N C T I O N
         
************************************************************************/

do_Sleepy(FirstWindow)
struct Window *FirstWindow;
   {
     SHORT i;
     UWORD red, green, blue;
   
     for (i = 0; i < 3; i++)
       {
   red = (SLEEPY_col[i] & 0xf00) >> 8;
   green = (SLEEPY_col[i] & 0x0f0) >> 4;
   blue = (SLEEPY_col[i] & 0x00f);
   SetRGB4(vp,i + 17,red,green,blue);
       } 
     ClearPointer(FirstWindow);
     SetPointer(FirstWindow,Sleepy,25,16,0,0);
   
     return(TRUE);
          
    } /**** Close off do_Sleepy function ****/

/***********************************************************************

          M A N D E L B R O T      D R A W      F U N C T I O N
         
************************************************************************/  
  
mand_draw_func(FirstWindow)
struct Window *FirstWindow;
  {
   VOID calculate(), pick_color();
      
   int MessageClass, Code, Menu, MenuItem, SubItem;
   BOOL result;
     
   open_draw_window(FirstWindow);

   vls.realmn = realmin;
   vls.realmx = realmax;
   vls.imagmn = imagmin;
   vls.imagmx = imagmax;
   dltax = (vls.realmx - vls.realmn)/da_W;
   dltay = (vls.imagmx - vls.imagmn)/da_H;

   ypos = da_H;

   for(row = vls.imagmn; row <= (vls.imagmx + dltay/2); row += dltay)
    {
      xpos = 0;

      for(colmn=vls.realmn; colmn <= vls.realmx+dltax/2; colmn += dltax)
        {
         calculate();
         SetAPen(rp,1);
         if (xpos + 2 <= da_W)
           {
            WritePixel(rp,xpos,ypos);
            WritePixel(rp,xpos+1,ypos);
            WritePixel(rp,xpos+2,ypos);
           } 
         pick_color();
         WritePixel(rp,xpos,ypos);
         xpos++;

         while((message = (struct IntuiMessage *)
                GetMsg(FirstWindow->UserPort)))
            {
             MessageClass = message->Class;
             Code = message->Code;
             Menu = MENUNUM(Code);
             MenuItem = ITEMNUM(Code);
             SubItem = SUBNUM(Code);
             ReplyMsg(message);
             if(MessageClass == MENUPICK)
               {
                if((Code) != MENUNULL)
                  {
                   if(Menu == 0 && MenuItem == 6)
                     {
                      if(SubItem == 0)
                        {
                         result = quit_crnt(FirstWindow);
                         if(result == TRUE)
                           {
                            if(DrawWindow == TRUE)   
                              {
                               CloseWindow(NoBorder);
                               DrawWindow = FALSE;
                               OnMenu(FirstWindow, 0x07E1);
                               OnMenu(FirstWindow, 0x07E2);
                               OnMenu(FirstWindow, 0x07E3);
                               OnMenu(FirstWindow, 0x07E4);
                               OnMenu(FirstWindow, 0xF800);
                               OnMenu(FirstWindow, 0xF820);
                               OnMenu(FirstWindow, 0xF840);
                               OnMenu(FirstWindow, 0xF880);
                               OnMenu(FirstWindow, 0xF8A0);
                               return(TRUE);
                              }
                           } 
                         else
                           {
                             WindowToFront(NoBorder);
                           }       
                        } /*  If SubItem == 0  */        
                      if(SubItem == 1)
                        {  
                         result = quit_prog(FirstWindow);
                         if(result == TRUE)
                           {
                            Close_All();
                           }
                         else
                           {
                             WindowToFront(NoBorder);
                           }      
                        } /*  If SubItem == 1  */   
                     }
                  }
               }
            } /**** While loop ****/
            
        } /**** Close off column loop ****/

         ypos--;

      }   /**** Close off row loop ****/
      
    return(TRUE);
      
  } /**** Close off draw_func ****/


/***********************************************************************

                J U L I A     D R A W      F U N C T I O N
         
************************************************************************/  
  
julia_draw_func(FirstWindow)
struct Window *FirstWindow;
  {
   VOID julia_calc(), pick_color();
   USHORT xx, yy;
   int MessageClass, Code, Menu, MenuItem, SubItem;
   BOOL result;  
     
   open_draw_window(FirstWindow);

   for(jlrow = da_H; jlrow >= 0; jlrow--)
    {

      for(jlcolmn = 0; jlcolmn <= da_W; jlcolmn++)
        {
         julia_calc();
         xx = jlcolmn;
         yy = jlrow;
         SetAPen(rp,1);
         if (xx + 2 <= da_W)
           {
             WritePixel(rp,xx,yy);
             WritePixel(rp,xx+1,yy);
             WritePixel(rp,xx+2,yy);
           }  
         pick_color();
         WritePixel(rp,xx,yy);

         while((message = (struct IntuiMessage *)
                GetMsg(FirstWindow->UserPort)))
            {
             MessageClass = message->Class;
             Code = message->Code;
             Menu = MENUNUM(Code);
             MenuItem = ITEMNUM(Code);
             SubItem = SUBNUM(Code);
             ReplyMsg(message);
             if(MessageClass == MENUPICK)
               {
                if((Code) != MENUNULL)
                  {
                   if(Menu == 0 && MenuItem == 6)
                     {
                      if(SubItem == 0)
                        {
                         result = quit_crnt(FirstWindow);
                         if(result == TRUE)
                           {
                            if(DrawWindow == TRUE)   
                              {
                               CloseWindow(NoBorder);
                               DrawWindow = FALSE;
                               OnMenu(FirstWindow, 0x07E1);
                               OnMenu(FirstWindow, 0x07E2);
                               OnMenu(FirstWindow, 0x07E3);
                               OnMenu(FirstWindow, 0x07E4);
                               OnMenu(FirstWindow, 0xF800);
                               OnMenu(FirstWindow, 0xF820);
                               OnMenu(FirstWindow, 0xF840);
                               OnMenu(FirstWindow, 0xF880);
                               OnMenu(FirstWindow, 0xF8A0);
                               return(TRUE);
                              }
                           }  /*  If result == TRUE  */
                         else
                              {
                                WindowToFront(NoBorder);
                              }    
                        }    /* If SubItem == 0 */     
                      if(SubItem == 1)
                        {  
                         result = quit_prog(FirstWindow);
                         if(result == TRUE)
                           {
                            Close_All();
                           }
                         else
                           {
                             WindowToFront(NoBorder);
                           }     
                        }  /*  If SubItem == 1 */      
                     }
                  }
               }
            } /**** While loop ****/
         
        } /* Close off julia column loop */
   
      }   /* Close off julia row loop    */
   
    return(TRUE);
      
  } /**** Close off julia_draw_func ****/


/**************************************************************************

           J U L I A     C A L C U L A T E    F U N C T I O N

**************************************************************************/

VOID julia_calc()
  {
   float r, xtemp, ytemp;
   double x, y, deltax, deltay;
   
   deltax = (jl_rlmax - jl_rlmin)/da_W;
   deltay = (jl_imgmax - jl_imgmin)/da_H;
   
   x = jl_rlmin + (jlcolmn * deltax);
   y = jl_imgmin + (jlrow * deltay);
   colr = 0;
   r = 0;

   while(r <= juliamax && colr < maxcolr)
     {
      xtemp = x*x - y*y + rlparm;
      ytemp = 2*x*y + imparm;
      colr++;
      r = x*x + y*y;
      x = xtemp;
      y = ytemp;
     }
     
  } /**** Close Off Julia Calculate Function ****/



/**************************************************************************

             O P E N   D R A W   W I N D O W   F U N C T I O N

**************************************************************************/

open_draw_window(FirstWindow)
struct Window *FirstWindow;
  {
   struct NewWindow noborder;
   noborder.LeftEdge = da_LE;
   noborder.TopEdge = da_TE;
   noborder.Width = da_W;
   noborder.Height = da_H;
   noborder.DetailPen = 0;
   noborder.BlockPen = 1;
   noborder.Flags = SMART_REFRESH|BORDERLESS;
   noborder.IDCMPFlags = NULL;
   noborder.FirstGadget = NULL;
   noborder.CheckMark = NULL;
   noborder.Title = NULL;
   noborder.Screen = FirstScreen;
   noborder.BitMap = NULL;
   noborder.MinWidth = 0;
   noborder.MinHeight = 0;
   noborder.MaxWidth = 0;
   noborder.MaxHeight = 0;
   noborder.Type = CUSTOMSCREEN;

   NoBorder = (struct Window *)OpenWindow(&noborder);
   if(NoBorder == NULL)
      {
       printf("Errors can occur anywhere! Why here??  Why me??");
       exit(FALSE);
      }
   rp = NoBorder->RPort;
   DrawWindow = TRUE;
   return(TRUE);
   
  }  /****  Close Off Open Draw Window Function  ****/


/**************************************************************************

                   C A L C U L A T E    F U N C T I O N

**************************************************************************/

VOID calculate()
  {
   float x,y,r,xtemp;
   x = 0;
   y = 0;
   r = 0;
   colr = 0;

   while(r <= mandmax && colr < maxcolr)
     {
      xtemp = x*x - y*y + colmn;
      y = 2*x*y + row;
      x = xtemp;
      colr++;
      r = x*x + y*y;
     }
      
   
  }  /****  Close Off Calculate Function  ****/
  

/*************************************************************************
  
                    P I C K   C O L O R   F U N C T I O N  
  
*************************************************************************/

VOID pick_color()
  {
   int zoneNum;
   
   if(colr <= 25)
     {
      zoneNum = (colr - 1);
      SetAPen(rp,*Zones[zoneNum]);
     }
   else
     {
       if(colr % 2 == 0)
         {
          zoneNum = ((colr / 2) + 12);
          SetAPen(rp,*Zones[zoneNum]);
         }
       else
         {
          zoneNum = (((colr - 1)/ 2) + 12);
          SetAPen(rp,*Zones[zoneNum]);
         }      
     }      
  
      
  }  /****  Close Off Pick Color Function  ****/


/**************************************************************************
 
                D E F A U L T   C O L O R S   F U N C T I O N  

**************************************************************************/

default_colors(FirstWindow)
struct Window *FirstWindow;
  {
   VOID default_color_set();
   BOOL go;
   int class;
   go = TRUE;


   InitRequester(&dc_requester);
 
   dc_requester.LeftEdge = 230;
   dc_requester.TopEdge = 10;
   dc_requester.Width = 230;
   dc_requester.Height = 300;
   dc_requester.ReqGadget = &dc_OK_gadg;
   dc_requester.ReqText = &dctxt[0];
   dc_requester.BackFill = 2;
   dc_requester.Flags = NULL;
   dc_requester.ReqBorder = &default_border1;

   if(DrawWindow == TRUE)
     {
       WindowToFront(FirstWindow);
     } 

   Request(&dc_requester,FirstWindow);

   while(go)
    {
     Wait(1 << FirstWindow->UserPort->mp_SigBit);
     while(message = (struct IntuiMessage *)
        GetMsg(FirstWindow->UserPort))
       {
        class = message->Class;
        ReplyMsg(message);
        if(class == REQCLEAR)
           go = FALSE;

       } /**** While Message ****/

    } /**** While go ****/

   if(DrawWindow == TRUE)
     {
       WindowToFront(NoBorder);
     } 

   return(TRUE);

  } /**** Close Off default_color Function ****/



/**************************************************************************

          D R A W   A R E A   P A R A M E T E R S   F U N C T I O N  

**************************************************************************/

draw_area(FirstWindow)
struct Window *FirstWindow;
  {
   BOOL go;
   int class,item;

   extern long da_LE, da_TE, da_W, da_H;
   
   da_LE_ptr = &da_LE_StringInfo;
   da_TE_ptr = &da_TE_StringInfo;
   da_W_ptr = &da_W_StringInfo;
   da_H_ptr = &da_H_StringInfo;

   go = TRUE;


   InitRequester(&da_requester);
 
   da_requester.LeftEdge = 200;
   da_requester.TopEdge = 10;
   da_requester.Width = 250;
   da_requester.Height = 210;
   da_requester.ReqGadget = &draw_area_OK_gadg;
   da_requester.ReqText = &draw_area_txt[0];
   da_requester.BackFill = 2;
   da_requester.Flags = NULL;
   da_requester.ReqBorder = &draw_area_border1;

   if(DrawWindow == TRUE)
     {
       WindowToFront(FirstWindow);
     } 

   Request(&da_requester,FirstWindow);

   while(go)
    {
     Wait(1 << FirstWindow->UserPort->mp_SigBit);
     while(message = (struct IntuiMessage *)
        GetMsg(FirstWindow->UserPort))
       {
        class = message->Class;
        ReplyMsg(message);

        da_LE = da_LE_ptr->LongInt;
        da_TE = da_TE_ptr->LongInt;
        da_W = da_W_ptr->LongInt;
        da_H = da_H_ptr->LongInt;

        if(class == REQCLEAR)
           go = FALSE;
        if(class == GADGETUP)
           item = ((struct Gadget *) message->IAddress)->GadgetID;
        switch(item)
            {
             case 3:  if(da_LE < 0 || da_LE > 500)
                       {
                        DisplayBeep(FirstScreen);
                        strcpy(da_LE_StringBuffer, "0");
                        da_LE_ptr->LongInt = 0;
                       }
                      break;

             case 4:  if(da_TE < 10 || da_TE > 350)
                       {
                        DisplayBeep(FirstScreen);
                        strcpy(da_TE_StringBuffer, "10");
                        da_LE_ptr->LongInt = 10;
                       }
                      break;

             case 5:  if(da_W < 0 || da_W > 640)
                       {
                        DisplayBeep(FirstScreen);
                        strcpy(da_W_StringBuffer, "640");
                        da_W_ptr->LongInt = 640;
                       }
                      break;

             case 6:  if(da_H < 0 || da_H > 390)
                       {
                        DisplayBeep(FirstScreen);
                        strcpy(da_H_StringBuffer, "390");
                        da_H_ptr->LongInt = 390;
                       }
                      break;

            } /*** item switch ***/

       } /*** While message ***/

    } /**** While go ****/

/*************** Error Check #1 ***************/

   if((da_W + da_LE) > 640)
    {
     da_err1(FirstWindow);
     strcpy(da_W_StringBuffer, "640");
     strcpy(da_LE_StringBuffer, "0");
     da_W_ptr->LongInt = 640;
     da_LE_ptr->LongInt = 0;
    }

/*************** Error Check #2 ***************/

   if((da_H + da_TE) > 400)
    {
     da_err2(FirstWindow);
     strcpy(da_H_StringBuffer, "390");
     strcpy(da_TE_StringBuffer, "10");
     da_H_ptr->LongInt = 390;
     da_TE_ptr->LongInt = 10;
    }

   if(DrawWindow == TRUE)
     {
       WindowToFront(NoBorder);
     } 

   return(TRUE);

  } /**** Close Off draw_area Function ****/


/**************************************************************************

         D R A W I N G   A R E A   E R R O R   #1   F U N C T I O N   

**************************************************************************/


da_err1(FirstWindow)
struct Window *FirstWindow;
  {
   BOOL go;
   int class;
   go = TRUE;

   InitRequester(&da_err1_requester);
 
   da_err1_requester.LeftEdge = 0;
   da_err1_requester.TopEdge = 10;
   da_err1_requester.Width = 640;
   da_err1_requester.Height = 210;
   da_err1_requester.ReqGadget = &da_err1_OK_gadg;
   da_err1_requester.ReqText = &da_err1_txt[0];
   da_err1_requester.BackFill = 2;
   da_err1_requester.Flags = NULL;
   da_err1_requester.ReqBorder = &da_err1_border1;

   if(DrawWindow == TRUE)
     {
       WindowToFront(FirstWindow);
     } 

   Request(&da_err1_requester,FirstWindow);

   while(go)
    {
     Wait(1 << FirstWindow->UserPort->mp_SigBit);
     while(message = (struct IntuiMessage *)
        GetMsg(FirstWindow->UserPort))
       {
        class = message->Class;
        ReplyMsg(message);
        if(class == REQCLEAR)
           go = FALSE;

       } /*** While message ***/

    } /**** While go ****/

   if(DrawWindow == TRUE)
     {
       WindowToFront(NoBorder);
     } 

   return(TRUE);

  } /**** Close Off da_err1 Function ****/


/**************************************************************************

         D R A W I N G   A R E A   E R R O R   #2   F U N C T I O N

**************************************************************************/


da_err2(FirstWindow)
struct Window *FirstWindow;
  {
   BOOL go;
   int class;
   go = TRUE;

   InitRequester(&da_err2_requester);
 
   da_err2_requester.LeftEdge = 0;
   da_err2_requester.TopEdge = 10;
   da_err2_requester.Width = 640;
   da_err2_requester.Height = 210;
   da_err2_requester.ReqGadget = &da_err2_OK_gadg;
   da_err2_requester.ReqText = &da_err2_txt[0];
   da_err2_requester.BackFill = 2;
   da_err2_requester.Flags = NULL;
   da_err2_requester.ReqBorder = &da_err2_border1;

   if(DrawWindow == TRUE)
     {
       WindowToFront(FirstWindow);
     } 

   Request(&da_err2_requester,FirstWindow);

   while(go)
    {
     Wait(1 << FirstWindow->UserPort->mp_SigBit);
     while(message = (struct IntuiMessage *)
        GetMsg(FirstWindow->UserPort))
       {
        class = message->Class;
        ReplyMsg(message);
        if(class == REQCLEAR)
           go = FALSE;

       } /*** While message ***/

    } /**** While go ****/

   if(DrawWindow == TRUE)
     {
       WindowToFront(NoBorder);
     } 

   return(TRUE);

  } /**** Close Off da_err2 function ****/

/**************************************************************************

                 Q U I T   P R O G R A M   F U N C T I O N

**************************************************************************/

quit_prog(FirstWindow)
struct Window *FirstWindow;
  {
   if(AutoRequest(FirstWindow,&quit_prog_txt[0],&quit_OK_txt,
       &quit_cancel_txt,NULL,NULL,300,130))
     return(TRUE);
   else
     return(FALSE);
   
  } /**** Close Off Quit Program Function ****/


/**************************************************************************

             Q U I T   C U R R E N T   J O B   F U N C T I O N

**************************************************************************/

quit_crnt(FirstWindow)
struct Window *FirstWindow;
  {
   if(AutoRequest(FirstWindow,&quit_crnt_txt[0],&quit_OK_txt,
               &quit_cancel_txt,NULL,NULL,340,130))
     return(TRUE);
   else
     return(FALSE);

  } /**** Close Off Quit Current Job Function ****/


/**************************************************************************

                       M A N D E L B R O T   S E T

               F R A C T A L   V A L U E S   F U N C T I O N

**************************************************************************/

fract_vals(FirstWindow)
struct Window *FirstWindow;
  {
   BOOL go;
   int class,item;

   float rlmn, rlmx, immn, immx;
      
   fv_rn_ptr = &fv_rn_StringBuffer[0]; 
   fv_rx_ptr = &fv_rx_StringBuffer[0]; 
   fv_in_ptr = &fv_in_StringBuffer[0]; 
   fv_ix_ptr = &fv_ix_StringBuffer[0];  

   go = TRUE;


   InitRequester(&fv_requester);
 
   fv_requester.LeftEdge = 200;
   fv_requester.TopEdge = 10;
   fv_requester.Width = 260;
   fv_requester.Height = 210;
   fv_requester.ReqGadget = &frac_val_OK_gadg;
   fv_requester.ReqText = &frac_val_txt[0];
   fv_requester.BackFill = 2;
   fv_requester.Flags = NULL;
   fv_requester.ReqBorder = &frac_val_border1;

   if(DrawWindow == TRUE)
     {
       WindowToFront(FirstWindow);
     } 

   Request(&fv_requester, FirstWindow);

   while(go)
    {
     Wait(1 << FirstWindow->UserPort->mp_SigBit);
     while(message = (struct IntuiMessage *)
        GetMsg(FirstWindow->UserPort))
       {
        class = message->Class;
        ReplyMsg(message);

        rlmn = atof(fv_rn_ptr);
        rlmx = atof(fv_rx_ptr);  
        immn = atof(fv_in_ptr);
        immx = atof(fv_ix_ptr);

        if(class == REQCLEAR)
           go = FALSE;
        if(class == GADGETUP)
           item = ((struct Gadget *) message->IAddress)->GadgetID;
        switch(item)
            {
             case 3:  if(immx < -5.0 || immx > 5.0)
                       {
                        DisplayBeep(FirstScreen);
                        strcpy(fv_ix_StringBuffer, "0");
                       }
             
                      if(immx <= 5.0 && immx >= -5.0)
                       {
                        imagmax = immx;
                       }
          
                      break;

             case 4:  if(immn < -5.0 || immn > 5.0)
                       {
                        DisplayBeep(FirstScreen);
                        strcpy(fv_in_StringBuffer, "0");
                       }
             
                      if(immn <= 5.0 && immn >= -5.0)
                       {
                        imagmin = immn;
                       }
             
                      break;

             case 5:  if(rlmx < -5.0 || rlmx > 5.0)
                       {
                        DisplayBeep(FirstScreen);
                        strcpy(fv_rx_StringBuffer, "0");
                       }
             
                      if(rlmx <= 5.0 && rlmx >= -5.0)
                       {
                        realmax = rlmx;
                       }
             
                      break;

             case 6:  if(rlmn < -5.0 || rlmn > 5.0)
                       {
                        DisplayBeep(FirstScreen);
                        strcpy(fv_rn_StringBuffer, "0");
                       }
             
                     if(rlmn <= 5.0 && rlmn >= -5.0)
                      {
                       realmin = rlmn;
                      }
                
                     break;

            } /*** item switch ***/

       } /*** While message ***/

    } /**** While go ****/

   if(DrawWindow == TRUE)
     {
       WindowToFront(NoBorder);
     } 

   return(TRUE);

  } /**** Close Off Fractal Values Function ****/


/**************************************************************************

                          J U L I A   S E T

               F R A C T A L   V A L U E S   F U N C T I O N

**************************************************************************/

julia_vals(FirstWindow)
struct Window *FirstWindow;
  {
   BOOL go;
   int class,item;

   float jl_rlmn, jl_rlmx, jl_immn, jl_immx, rlpm, impm;
   
   rl_pm_ptr = &rl_pm_StringBuffer[0];
   im_pm_ptr = &im_pm_StringBuffer[0];   
   jv_rn_ptr = &jv_rn_StringBuffer[0]; 
   jv_rx_ptr = &jv_rx_StringBuffer[0]; 
   jv_in_ptr = &jv_in_StringBuffer[0]; 
   jv_ix_ptr = &jv_ix_StringBuffer[0];  

   go = TRUE;

   InitRequester(&jv_requester);
 
   jv_requester.LeftEdge = 200;
   jv_requester.TopEdge = 10;
   jv_requester.Width = 290;
   jv_requester.Height = 245;
   jv_requester.ReqGadget = &jul_val_OK_gadg;
   jv_requester.ReqText = &jul_val_txt[0];
   jv_requester.BackFill = 2;
   jv_requester.Flags = NULL;
   jv_requester.ReqBorder = &jul_val_border1;

   if(DrawWindow == TRUE)
     {
       WindowToFront(FirstWindow);
     } 

   Request(&jv_requester, FirstWindow);

   while(go)
    {
     Wait(1 << FirstWindow->UserPort->mp_SigBit);
     while(message = (struct IntuiMessage *)
        GetMsg(FirstWindow->UserPort))
       {
        class = message->Class;
        ReplyMsg(message);

        rlpm = atof(rl_pm_ptr);
        impm = atof(im_pm_ptr);
        jl_rlmn = atof(jv_rn_ptr);
        jl_rlmx = atof(jv_rx_ptr);  
        jl_immn = atof(jv_in_ptr);
        jl_immx = atof(jv_ix_ptr);

        if(class == REQCLEAR)
           go = FALSE;
        if(class == GADGETUP)
           item = ((struct Gadget *) message->IAddress)->GadgetID;
        switch(item)
            { 
         case 3:  if(impm < -5.0 || impm > 5.0)
                       {
                        DisplayBeep(FirstScreen);
                        strcpy(im_pm_StringBuffer, "0");
                       }
             
                      if(impm <= 5.0 && impm >= -5.0)
                       {
                        imparm = impm;
                       }
          
                      break;
      
         case 4:  if(rlpm < -5.0 || rlpm > 5.0)
                       {
                        DisplayBeep(FirstScreen);
                        strcpy(rl_pm_StringBuffer, "0");
                       }
             
                      if(rlpm <= 5.0 && rlpm >= -5.0)
                       {
                        rlparm = rlpm;
                       }
          
                      break;
   
             case 5:  if(jl_immx < -5.0 || jl_immx > 5.0)
                       {
                        DisplayBeep(FirstScreen);
                        strcpy(jv_ix_StringBuffer, "0");
                       }
             
                      if(jl_immx <= 5.0 && jl_immx >= -5.0)
                       {
                        jl_imgmax = jl_immx;
                       }
          
                      break;

             case 6:  if(jl_immn < -5.0 || jl_immn > 5.0)
                       {
                        DisplayBeep(FirstScreen);
                        strcpy(jv_in_StringBuffer, "0");
                       }
             
                      if(jl_immn <= 5.0 && jl_immn >= -5.0)
                       {
                        jl_imgmin = jl_immn;
                       }
             
                      break;

             case 7:  if(jl_rlmx < -5.0 || jl_rlmx > 5.0)
                       {
                        DisplayBeep(FirstScreen);
                        strcpy(jv_rx_StringBuffer, "0");
                       }
             
                      if(jl_rlmx <= 5.0 && jl_rlmx >= -5.0)
                       {
                        jl_rlmax = jl_rlmx;
                       }
             
                      break;

             case 8:  if(jl_rlmn < -5.0 || jl_rlmn > 5.0)
                       {
                        DisplayBeep(FirstScreen);
                        strcpy(jv_rn_StringBuffer, "0");
                       }
             
                     if(jl_rlmn <= 5.0 && jl_rlmn >= -5.0)
                      {
                       jl_rlmin = jl_rlmn;
                      }
                
                     break;

            } /*** item switch ***/

       } /*** While message ***/

    } /**** While go ****/

   if(DrawWindow == TRUE)
     {
       WindowToFront(NoBorder);
     } 

   return(TRUE);

  } /**** Close Off Fractal Values Function ****/






/**************************************************************************

                C O L O R   A D J U S T E R   F U N C T I O N  
                       
**************************************************************************/


color_adjust(FirstWindow)
struct Window *FirstWindow;
  {
 
   register int class, check, c, item;
   BOOL go, pick;
   USHORT backup[16], temp_colr;
 
   for (c = 0; c < 16; c++) backup[c] = colortable[c];
 
   R_Propinfo.Flags = FREEHORIZ|AUTOKNOB;
   G_Propinfo.Flags = FREEHORIZ|AUTOKNOB;
   B_Propinfo.Flags = FREEHORIZ|AUTOKNOB;

   R_Propinfo.HorizBody = 0x1000;
   G_Propinfo.HorizBody = 0x1000;
   B_Propinfo.HorizBody = 0x1000;
 
   open_color_wind(FirstWindow);
   
   ModifyIDCMP(ColorWindow, GADGETUP|GADGETDOWN|REQCLEAR|MOUSEMOVE); 
   
   InitRequester(&clr_adj_requester);

   clr_adj_requester.LeftEdge = 0;
   clr_adj_requester.TopEdge = 0;
   clr_adj_requester.Width = 215;
   clr_adj_requester.Height = 200;
   clr_adj_requester.ReqGadget = &clr_adj_gads[0];
   clr_adj_requester.ReqText = &clr_adj_txt;
   clr_adj_requester.BackFill = 0;
   clr_adj_requester.ReqBorder = &clr_adj_border1;

   Request(&clr_adj_requester, ColorWindow);

   check = 1;

   R_Propinfo.HorizPot = (colortable[check] & 0xf00) << 4;
   G_Propinfo.HorizPot = (colortable[check] & 0x0f0) << 8;
   B_Propinfo.HorizPot = colortable[check] << 12;

   clr_adj_box_img.PlaneOnOff = (UBYTE)check;

   RefreshGList(&R_gad, ColorWindow, &clr_adj_requester, 4);

   go = TRUE;
   pick = FALSE;
        
   while (go)
     {
      Wait(1 << ColorWindow->UserPort->mp_SigBit); 
      while (message = (struct IntuiMessage *) 
                     GetMsg(ColorWindow->UserPort))
       {
        class = message->Class;  
        ReplyMsg(message);

        if(class == REQCLEAR) go = FALSE;         
     
        if((class == GADGETDOWN) || (class == GADGETUP))
           item = ((struct Gadget *) message->IAddress)->GadgetID;
       }

      if((item >= 0) && (item < 16) && (item != check)) pick = TRUE;
      switch (item)
       {
        case 16 : /**** Let these cases fall through because they all
                   have to be handled the same way !!            ****/
        case 17 :
         
        case 18 : temp_colr = ((R_Propinfo.HorizPot >> 4) & 0xf00)
                            + ((G_Propinfo.HorizPot >> 8) & 0xf0)
                            + (B_Propinfo.HorizPot >>12);
                  if(colortable[check] != temp_colr)
                   {
                    colortable[check] = temp_colr;
                    LoadRGB4(vp,&colortable,16);
                    RefreshGList(&clr_adj_box_gad, ColorWindow,
                       &clr_adj_requester, 1);
                    RefreshGList(&clr_adj_gads[check], ColorWindow,
                       &clr_adj_requester, 1);
                   }
                  break;
      
        case 19 : for(c = 0; c < 16; c++) colortable[c] = colortable_2[c];
                  LoadRGB4(vp,&colortable,16);
                  R_Propinfo.HorizPot = (colortable[check] & 0xf00) << 4;
                  G_Propinfo.HorizPot = (colortable[check] & 0x0f0) << 8;
                  B_Propinfo.HorizPot = colortable[check] << 12;
                  RefreshGList(&R_gad, ColorWindow, 
                     &clr_adj_requester, 3);
                  item = 69;
                  break;
        
        case 20 : for(c = 0; c < 16; c++) colortable[c] = backup[c];
                  LoadRGB4(vp,&colortable,16);
                  R_Propinfo.HorizPot = (colortable[check] & 0xf00) << 4;
                  G_Propinfo.HorizPot = (colortable[check] & 0x0f0) << 8;
                  B_Propinfo.HorizPot = colortable[check] << 12;
                  RefreshGList(&R_gad, ColorWindow,
                     &clr_adj_requester, 3);
                  item = 69;
                  break;
        
        case 22 : sprintf(clr_adj_box_str, "%03X\0", colortable[check]);
                  clr_adj_box_txt.IText = (UBYTE *)clr_adj_box_str;
                  if(check != 0) clr_adj_box_txt.FrontPen = 0;
                  else clr_adj_box_txt.FrontPen = 1;
                  RefreshGList(&clr_adj_box_gad, ColorWindow,
                     &clr_adj_requester, 1);
                  clr_adj_box_txt.IText = NULL;
                  item = 69;
                  break;
        
               } /**** Item Switch ****/
        
        if (pick)            /* This is used only when a color box */
         {                   /* gadget has been selected.  It then */
                             /* resets the sliders & box gadget.   */
          check = item;
          clr_adj_box_img.PlaneOnOff = (UBYTE)check;
          R_Propinfo.HorizPot = (colortable[check] & 0xf00) << 4;
          G_Propinfo.HorizPot = (colortable[check] & 0x0f0) << 8;
          B_Propinfo.HorizPot = colortable[check] << 12;
          RefreshGList(&R_gad, ColorWindow,
                  &clr_adj_requester, 4);
          pick = FALSE;
         }
       
      } /**** While loop ****/
   
   CloseWindow(ColorWindow);
   return(TRUE);
   
  } /**** Close Off Color Adjust Function ****/


/**************************************************************************

  O P E N   C O L O R   A D J U S T E R   W I N D O W   F U N C T I O N

**************************************************************************/

open_color_wind(FirstWindow)
struct Window *FirstWindow;
  {
   struct NewWindow color_wind;
   color_wind.LeftEdge = 230;
   color_wind.TopEdge = 10;
   color_wind.Width = 215;
   color_wind.Height = 200;
   color_wind.DetailPen = 0;
   color_wind.BlockPen = 1;
   color_wind.Flags = BORDERLESS;
   color_wind.IDCMPFlags = MENUPICK|REQCLEAR;
   color_wind.FirstGadget = NULL;
   color_wind.CheckMark = NULL;
   color_wind.Title = NULL;
   color_wind.Screen = FirstScreen;
   color_wind.BitMap = NULL;
   color_wind.MinWidth = 0;
   color_wind.MinHeight = 0;
   color_wind.MaxWidth = 0;
   color_wind.MaxHeight = 0;
   color_wind.Type = CUSTOMSCREEN;

   ColorWindow = (struct Window *)OpenWindow(&color_wind);
   if(ColorWindow == NULL)
      {
       printf("Errors can occur anywhere! Why here??  Why me??");
       exit(FALSE);
      }
      
   ClearPointer(ColorWindow);
   SetPointer(ColorWindow,Pointer,16,16,0,0);   
   return(TRUE);
   
  }  /****  Close Off Open Color Adjuster Window Function  ****/


/**************************************************************************

                     C L O S E   A L L   F U N C T I O N  

*************************************************************************/

VOID Close_All()
  {
   FreeMem(Pointer, POINTER_SIZE * 2);
   FreeMem(Cross, CROSS_SIZE * 2);
   FreeMem(Sleepy, SLEEPY_SIZE * 2);   
   if(DrawWindow == TRUE)   
     {
      CloseWindow(NoBorder);
     }  
   ClearMenuStrip(FirstWindow);
   CloseWindow(FirstWindow);
   ClearPointer(FirstWindow);
   CloseScreen(FirstScreen);
   CloseLibrary(GfxBase);
   CloseLibrary(IntuitionBase);
   CloseLibrary(MathBase);
   
   exit(FALSE);
   
  } /****  Close Off The Close All Function ****/
