/*----------------------------------------------------------------------------
 *     menu.c
 *
 *   This file contains the structure declarations and initializations 
 * required to set up menus for the window. 
 *----------------------------------------------------------------------------
*/

#include  <exec/types.h>
#include  <intuition/intuition.h>
#include   "defs.h"
#include   "ds.h"
#include   "menu.h"

extern struct TextAttr  prog_font ;

/* array of text structures that will contain the menu text information */
struct IntuiText  t [34] ;

/*   The menu items are hooked into a linked list of menu items, one for */
/* each menu.  The first declaration is for the last item in the list.  */
/* The list of menu items is connected to the appropriate menu */

struct MenuItem  both_item  =
               { NULL,                        /* next menu item */
                 5, 20, 86, 10,               /* menu item position */
                 ITEMTEXT | HIGHCOMP,
                                              /* item attributes */
                 NULL,                        /* no mutual excludes */
                 NULL,                        /* IntuiText address */
                 NULL,                        /* no alternate image or text */
                 NULL,                        /* no keyboard alternative */
                 NULL                         /* no sub-items */
               } ;

struct MenuItem  flypast_item  =
               { &both_item,                  /* next menu item */
                 5, 10, 86, 10,               /* menu item position */
                 ITEMTEXT | HIGHCOMP | ITEMENABLED,
                                              /* item attributes */
                 NULL,                        /* no mutual excludes */
                 NULL,                        /* IntuiText address */
                 NULL,                        /* no alternate image or text */
                 NULL,                        /* no keyboard alternative */
                 NULL                         /* no sub-items */
               } ;
                  
struct MenuItem  arm_item  =
               { &flypast_item,               /* next menu item */
                 5, 0, 86, 10,                /* menu item position */
                 ITEMTEXT | HIGHCOMP | ITEMENABLED,
                                              /* item attributes */
                 NULL,                        /* no mutual excludes */
                 NULL,                        /* IntuiText address */
                 NULL,                        /* no alternate image or text */
                 NULL,                        /* no keyboard alternative */
                 NULL                         /* no sub-items */
               } ;

/*   The menus are also hooked into a linked list of menus, beginning with */
/* the last menu */

struct Menu  animate_menu  =
           { NULL,                              /* next menu */
             314, NOT_IMPLEMENTED, 72, NOT_IMPLEMENTED, 
                                                /*menu position */
             MENUENABLED,
             "Animate",                         /* menu title */
             &arm_item                          /* pointer to 1st menu item */
           } ;

struct MenuItem  place_obstacles_item  =
               { NULL,                        /* next menu item */
                 5, 20, 150, 10,              /* menu item position */
                 ITEMTEXT | HIGHCOMP,
                                              /* item attributes */
                 NULL,                        /* no mutual excludes */
                 NULL,                        /* IntuiText address */
                 NULL,                        /* no alternate image or text */
                 NULL,                        /* no keyboard alternative */
                 NULL                         /* no sub-items */
               } ;

struct MenuItem  distal_goal_item  =
               { &place_obstacles_item,       /* next menu item */
                 5, 10, 150, 10,              /* menu item position */
                 ITEMTEXT | HIGHCOMP,
                                              /* item attributes */
                 0x0001,                      /* mutual excludes */
                 NULL,                        /* menu item text */
                 NULL,                        /* no alternate image or text */
                 NULL,                        /* no keyboard alternative */
                 NULL                         /* no sub-items */
               } ;

struct MenuItem  set_all_joints_item  =
               { &distal_goal_item,           /* next menu item */
                 5, 0, 150, 10,               /* menu item position */
                 ITEMTEXT | HIGHCOMP | ITEMENABLED,
                                              /* item attributes */
                 0x0002,                      /* mutual excludes */
                 NULL,                        /* IntuiText address */
                 NULL,                        /* no alternate image or text */
                 NULL,                        /* no keyboard alternative */
                 NULL                         /* no sub-items */
               } ;

struct Menu  goal_menu  =
           { &animate_menu,                     /* next menu */
             248, NOT_IMPLEMENTED, 66, NOT_IMPLEMENTED, 
                                                /*menu position */
             MENUENABLED,
             "Goal",                            /* menu title */
             &set_all_joints_item               /* pointer to 1st menu item */
           } ;

struct MenuItem  wrist_item  =
               { NULL,                        /* next menu item */
                 5, 20, 93, 10,               /* menu item position */
                 ITEMTEXT | HIGHCOMP | ITEMENABLED,
                                              /* item attributes */
                 NULL,                        /* no mutual excludes */
                 NULL,                        /* IntuiText address */
                 NULL,                        /* no alternate image or text */
                 NULL,                        /* no keyboard alternative */
                 NULL                         /* no sub-items */
               } ;

struct MenuItem  elbow_item  =
               { &wrist_item,                 /* next menu item */
                 5, 10, 93, 10,               /* menu item position */
                  ITEMTEXT | HIGHCOMP | ITEMENABLED,
                                              /* item attributes */
                 NULL,                        /* no mutual excludes */
                 NULL,                        /* IntuiText address */
                 NULL,                        /* no alternate image or text */
                 NULL,                        /* no keyboard alternative */
                 NULL                         /* no sub-items */
               } ;

struct MenuItem  shoulder_item  =
               { &elbow_item,                 /* next menu item */
                 5, 0, 93, 10,                /* menu item position */
                 ITEMTEXT | HIGHCOMP | ITEMENABLED,
                                              /* item attributes */
                 NULL,                        /* no mutual excludes */
                 NULL,                        /* IntuiText address */
                 NULL,                        /* no alternate image or text */
                 NULL,                        /* no keyboard alternative */
                 NULL                         /* no sub-items */
               } ;

struct Menu  rotate_menu  =
           { &goal_menu,                       /* next menu */
             166, NOT_IMPLEMENTED, 82, NOT_IMPLEMENTED, 
                                               /*menu position */
             MENUENABLED,
             "Rotate",                         /* menu title */
             &shoulder_item                    /* pointer to 1st menu item */
           } ;

struct MenuItem  telephoto_subitem =
               { NULL,                        /* next menu item */
                 80, 22, 110, 10,             /* menu item position */
                 CHECKIT | ITEMTEXT | HIGHCOMP | ITEMENABLED,
                                              /* item attributes */
                 0x0003,                      /* mutual excludes */
                 NULL,                        /* IntuiText address */
                 NULL,                        /* no alternate image or text */
                 NULL,                        /* no keyboard alternative */
                 NULL                         /* pointer to first subitem */
               } ;

struct MenuItem  wide_angle_subitem =
               { &telephoto_subitem,          /* next menu item */
                 80, 12, 110, 10,             /* menu item position */
                 CHECKIT | ITEMTEXT | HIGHCOMP | ITEMENABLED,
                                              /* item attributes */
                 0x0005,                      /* mutual excludes */
                 NULL,                        /* IntuiText address */
                 NULL,                        /* no alternate image or text */
                 NULL,                        /* no keyboard alternative */
                 NULL                         /* pointer to first subitem */
               } ;

struct MenuItem  parallel_subitem =
               { &wide_angle_subitem,         /* next menu item */
                 80, 2, 110, 10,              /* menu item position */
                 CHECKIT | CHECKED | ITEMTEXT | HIGHCOMP | ITEMENABLED,
                                              /* item attributes */
                 0x0006,                      /* mutual excludes */
                 NULL,                        /* IntuiText address */
                 NULL,                        /* no alternate image or text */
                 NULL,                        /* no keyboard alternative */
                 NULL                         /* pointer to first subitem */
               } ;

struct MenuItem  perspective_item  =
               { NULL,                        /* next menu item */
                 5, 40, 120, 10,              /* menu item position */
                 ITEMTEXT | HIGHCOMP | ITEMENABLED,
                                              /* item attributes */
                 NULL,                        /* mutual excludes */
                 NULL,                        /* IntuiText address */
                 NULL,                        /* no alternate image or text */
                 NULL,                        /* no keyboard alternative */
                 &parallel_subitem,           /* no sub-items */
               } ;                      

/*   The menu subitems are hooked into a linked list of menu subitems */
/* The list is connected to the appropriate menu item */

struct MenuItem angle3_subitem  =
               { NULL,                        /* next menu item */
                 80, 52, 80, 10,              /* menu item position */
                 CHECKIT | ITEMTEXT | HIGHCOMP | ITEMENABLED,
                                              /* item attributes */
                 0x001f,                      /* mutual excludes */
                 NULL,                        /* IntuiText address */
                 NULL,                        /* no alternate image or text */
                 NULL,                        /* no keyboard alternative */
                 NULL                         /* no sub-items */
               } ;

struct MenuItem angle2_subitem  =
               { &angle3_subitem,             /* next menu item */
                 80, 42, 80, 10,              /* menu item position */
                 CHECKIT | ITEMTEXT | HIGHCOMP | ITEMENABLED,
                                              /* item attributes */
                 0x002f,                      /* mutual excludes */
                 NULL,                        /* IntuiText address */
                 NULL,                        /* no alternate image or text */
                 NULL,                        /* no keyboard alternative */
                 NULL                         /* no sub-items */
               } ;

struct MenuItem angle1_subitem  =
               { &angle2_subitem,             /* next menu item */
                 80, 32, 80, 10,              /* menu item position */
                 CHECKIT | CHECKED | ITEMTEXT | HIGHCOMP | ITEMENABLED,
                                              /* item attributes */
                 0x0037,                      /* mutual excludes */
                 NULL,                        /* IntuiText address */
                 NULL,                        /* no alternate image or text */
                 NULL,                        /* no keyboard alternative */
                 NULL                         /* no sub-items */
               } ;

struct MenuItem top_subitem  =
               { &angle1_subitem,             /* next menu item */
                 80, 22, 80, 10,              /* menu item position */
                 CHECKIT | ITEMTEXT | HIGHCOMP | ITEMENABLED,
                                              /* item attributes */
                 0x003b,                      /* mutual excludes */
                 NULL,                        /* IntuiText address */
                 NULL,                        /* no alternate image or text */
                 NULL,                        /* no keyboard alternative */
                 NULL                         /* no sub-items */
               } ;

struct MenuItem  side_subitem  =
               { &top_subitem,                /* next menu item */
                 80, 12, 80, 10,              /* menu item position */
                 CHECKIT | ITEMTEXT | HIGHCOMP | ITEMENABLED,
                                              /* item attributes */
                 0x003d,                      /* mutual excludes */
                 NULL,                        /* IntuiText address */
                 NULL,                        /* no alternate image or text */
                 NULL,                        /* no keyboard alternative */
                 NULL                         /* no sub-items */
               } ;

struct MenuItem  front_subitem  =
               { &side_subitem,               /* next menu item */
                 80, 2, 80, 10,               /* menu item position */
                 CHECKIT | ITEMTEXT | HIGHCOMP | ITEMENABLED,
                                              /* item attributes */
                 0x003e,                      /* mutual excludes */
                 NULL,                        /* IntuiText address */
                 NULL,                        /* no alternate image or text */
                 NULL,                        /* no keyboard alternative */
                 NULL                         /* no sub-items */
               } ;

struct MenuItem  viewpoint_item  =
               { &perspective_item,           /* next menu item */
                 5, 30, 120, 10,              /* menu item position */
                 ITEMTEXT | HIGHCOMP | ITEMENABLED,
                                              /* item attributes */
                 NULL,                        /* mutual excludes */
                 NULL,                        /* IntuiText address */
                 NULL,                        /* no alternate image or text */
                 NULL,                        /* no keyboard alternative */
                 &front_subitem               /* no sub-items */
               } ;

struct MenuItem  off_subitem  =
               { NULL,                        /* next menu item */
                 100, 12, 54, 10,             /* menu item position */
                 CHECKIT | CHECKED | ITEMTEXT | HIGHCOMP | ITEMENABLED,
                                              /* item attributes */
                 0x0001,                      /* mutual excludes */
                 NULL,                        /* IntuiText address */
                 NULL,                        /* no alternate image or text */
                 NULL,                        /* no keyboard alternative */
                 NULL                         /* no sub-items */
               } ;

struct MenuItem  on_subitem  =
               { &off_subitem,                /* next menu item */
                 100, 2, 54, 10,              /* menu item position */
                 CHECKIT | ITEMTEXT | HIGHCOMP | ITEMENABLED,
                                              /* item attributes */
                 0x0002,                      /* mutual excludes */
                 NULL,                        /* IntuiText address */
                 NULL,                        /* no alternate image or text */
                 NULL,                        /* no keyboard alternative */
                 NULL                         /* no sub-items */
               } ;

struct MenuItem  ref_axes_item  =
               { &viewpoint_item,             /* next menu item */
                 5, 20, 120, 10,              /* menu item position */
                 ITEMTEXT | HIGHCOMP | ITEMENABLED,
                                              /* item attributes */
                 NULL,                        /* mutual excludes */
                 NULL,                        /* IntuiText address */
                 NULL,                        /* no alternate image or text */
                 NULL,                        /* no koard alternative */
                 &on_subitem                  /* no sub-items */
               } ;

struct MenuItem  solid_view_item  =
               { &ref_axes_item,              /* next menu item */
                 5, 10, 120, 10,              /* menu item position */
                 CHECKIT | ITEMTEXT | HIGHCOMP | ITEMENABLED,
                                              /* item attributes */
                 0x0001,                      /* mutual excludes */
                 NULL,                        /* IntuiText address */
                 NULL,                        /* no alternate image or text */
                 NULL,                        /* no keyboard alternative */
                 NULL                         /* no sub-items */
               } ;

struct MenuItem  wire_frame_item  =
               { &solid_view_item,            /* next menu item */
                 5, 0, 120, 10,               /* menu item position */
                 CHECKIT | CHECKED | ITEMTEXT | HIGHCOMP | ITEMENABLED,
                                              /* item attributes */
                 0x0002,                      /* mutual excludes */
                 NULL,                        /* IntuiText address */
                 NULL,                        /* no alternate image or text */
                 NULL,                        /* no keyboard alternative */
                 NULL                         /* no sub-items */
               } ;

struct Menu  view_menu  =
           { &rotate_menu,                      /* next menu */
             100, NOT_IMPLEMENTED, 66, NOT_IMPLEMENTED, 
                                                /*menu position */
             MENUENABLED,
             "View",                            /* menu title */
             &wire_frame_item                   /* pointer to 1st menu item */
           } ;

struct MenuItem  quit_item  =
               { NULL,                        /* next menu item */
                 5, 40, 82, 10,               /* menu item position */
                 ITEMTEXT | HIGHCOMP | ITEMENABLED,
                                              /* item attributes */
                 NULL,                        /* mutual excludes */
                 NULL,                        /* IntuiText address */
                 NULL,                        /* no alternate image or text */
                 NULL,                        /* no keyboard alternative */
                 NULL                         /* no sub-items */
               } ;

struct MenuItem  set3_subitem  =
               { NULL,                        /* next menu item */
                 55, 32, 87, 10,              /* menu item position */
                 CHECKIT | ITEMTEXT | HIGHCOMP | ITEMENABLED,
                                              /* item attributes */
                 0x0007,                      /* mutual excludes */
                 NULL,                        /* IntuiText address */
                 NULL,                        /* no alternate image or text */
                 NULL,                        /* no keyboard alternative */
                 NULL                         /* no sub-items */
               } ;

struct MenuItem  set2_subitem  =
               { &set3_subitem,               /* next menu item */
                 55, 22, 87, 10,              /* menu item position */
                 CHECKIT | ITEMTEXT | HIGHCOMP | ITEMENABLED,
                                              /* item attributes */
                 0x000b,                      /* mutual excludes */
                 NULL,                        /* IntuiText address */
                 NULL,                        /* no alternate image or text */
                 NULL,                        /* no keyboard alternative */
                 NULL                         /* no sub-items */
               } ;

struct MenuItem  set1_subitem  =
               { &set2_subitem,               /* next menu item */
                 55, 12, 87, 10,              /* menu item position */
                 CHECKIT | ITEMTEXT | HIGHCOMP | ITEMENABLED,
                                              /* item attributes */
                 0x000d,                      /* mutual excludes */
                 NULL,                        /* IntuiText address */
                 NULL,                        /* no alternate image or text */
                 NULL,                        /* no keyboard alternative */
                 NULL                         /* no sub-items */
               } ;

struct MenuItem  default_subitem  =
               { &set1_subitem,               /* next menu item */
                 55, 2, 87, 10,               /* menu item position */
                 CHECKIT | CHECKED | ITEMTEXT | HIGHCOMP | ITEMENABLED,
                                              /* item attributes */
                 0x000e,                      /* mutual excludes */
                 NULL,                        /* IntuiText address */
                 NULL,                        /* no alternate image or text */
                 NULL,                        /* no keyboard alternative */
                 NULL                         /* no sub-items */
               } ;

struct MenuItem  colors_item  =
               { &quit_item,                  /* next menu item */
                 5, 30, 82, 10,               /* menu item position */
                 ITEMTEXT | HIGHCOMP | ITEMENABLED,
                                              /* item attributes */
                 NULL,                        /* mutual excludes */
                 NULL,                        /* IntuiText address */
                 NULL,                        /* no alternate image or text */
                 NULL,                        /* no keyboard alternative */
                 &default_subitem             /* no sub-items */
               } ;

struct MenuItem  help_item  =
               { &colors_item,                /* next menu item */
                 5, 20, 82, 10,               /* menu item position */
                 ITEMTEXT | HIGHCOMP,
                                              /* item attributes */
                 NULL,                        /* mutual excludes */
                 NULL,                        /* IntuiText address */
                 NULL,                        /* no alternate image or text */
                 NULL,                        /* no keyboard alternative */
                 NULL                         /* no sub-items */
               } ;

struct MenuItem  author_item  =
               { &help_item,                  /* next menu item */
                 5, 10, 82, 10,               /* menu item position */
                 ITEMTEXT | HIGHCOMP | ITEMENABLED,
                                              /* item attributes */
                 NULL,                        /* mutual excludes */
                 NULL,                        /* IntuiText address */
                 NULL,                        /* no alternate image or text */
                 NULL,                        /* no keyboard alternative */
                 NULL                         /* no sub-items */
               } ;

struct MenuItem  new_item  =
               { &author_item,                /* next menu item */
                 5, 0, 82, 10,                /* menu item position */
                 ITEMTEXT | HIGHCOMP | ITEMENABLED,
                                              /* item attributes */
                 NULL,                        /* mutual excludes */
                 NULL,                        /* IntuiText address */
                 NULL,                        /* no alternate image or text */
                 NULL,                        /* no keyboard alternative */
                 NULL                         /* no sub-items */
               } ;

struct Menu  project_menu  =
           { &view_menu,                        /* next menu */
             10, NOT_IMPLEMENTED, 90, NOT_IMPLEMENTED, 
                                                /*menu position */
             MENUENABLED,
             "Project",                         /* menu title */
             &new_item                          /* pointer to 1st menu item */
           } ;


struct Menu  *first_menu  = &project_menu ;




fill_in_menu_item_text ()
{
 /*---------------------------------------------------------------------------
  *    Fill in the IntuiText structure required by the menu structures for 
  * the menu, item and subitem text.
  *---------------------------------------------------------------------------
 */

 /* Item text for Animate menu */
 create_menu_item_text (&t[0], "arm") ;
 arm_item.ItemFill  = (APTR) &t[0] ;
 create_menu_item_text (&t[32], "flypast") ;
 flypast_item.ItemFill  = (APTR) &t[32] ;
 create_menu_item_text (&t[33], "both") ;
 both_item.ItemFill  = (APTR) &t[33] ;

 /* Item text for Goal menu */
 create_menu_item_text (&t[1], "place obstacles") ;
 place_obstacles_item.ItemFill  = (APTR) &t[1] ;
 create_menu_item_text (&t[2], "distal goal") ;
 distal_goal_item.ItemFill  = (APTR) &t[2] ;
 create_menu_item_text (&t[3], "set all joints") ;
 set_all_joints_item.ItemFill  = (APTR) &t[3] ;

 /* Item text for Rotate menu */
 create_menu_item_text (&t[4], "wrist") ;
 wrist_item.ItemFill  = (APTR) &t[4] ;
 create_menu_item_text (&t[5], "elbow") ;
 elbow_item.ItemFill  = (APTR) &t[5] ;
 create_menu_item_text (&t[6], "shoulder") ;
 shoulder_item.ItemFill  = (APTR) &t[6] ;

 /* Item text for View menu */
 create_menu_item_text (&t[7], "perspective") ;
 perspective_item.ItemFill  = (APTR) &t[7] ;
 create_menu_item_text (&t[9], "viewpoint") ;
 viewpoint_item.ItemFill  = (APTR) &t[9] ;
 create_menu_item_text (&t[10], "ref axes") ;
 ref_axes_item.ItemFill  = (APTR) &t[10] ;
 create_menu_item_text (&t[11], "solid view") ;
 solid_view_item.ItemFill  = (APTR) &t[11] ;
 create_menu_item_text (&t[12], "wire frame") ;

 /* Item text for Project menu */
 wire_frame_item.ItemFill  = (APTR) &t[12] ;
 create_menu_item_text (&t[13], "quit") ;
 quit_item.ItemFill  = (APTR) &t[13] ;
 create_menu_item_text (&t[14], "help") ;
 help_item.ItemFill  = (APTR) &t[14] ;
 create_menu_item_text (&t[15], "author") ;
 author_item.ItemFill  = (APTR) &t[15] ;
 create_menu_item_text (&t[23], "colors") ;
 colors_item.ItemFill  = (APTR) &t[23] ;
 create_menu_item_text (&t[24], "new") ;
 new_item.ItemFill  = (APTR) &t[24] ;

 /* Subitem text for Perspective Item */
 create_menu_subitem_text (&t[8], "parallel") ;
 parallel_subitem.ItemFill  = (APTR) &t[8] ;
 create_menu_subitem_text (&t[30], "wide angle") ;
 wide_angle_subitem.ItemFill  = (APTR) &t[30] ;
 create_menu_subitem_text (&t[31], "telephoto") ;
 telephoto_subitem.ItemFill  = (APTR) &t[31] ;

 /* Subitem text for Viewpoint Item */
 create_menu_subitem_text (&t[16], "front") ;
 front_subitem.ItemFill  = (APTR) &t[16] ;
 create_menu_subitem_text (&t[27], "side") ;
 side_subitem.ItemFill  = (APTR) &t[27] ;
 create_menu_subitem_text (&t[17], "top") ;
 top_subitem.ItemFill  = (APTR) &t[17] ;
 create_menu_subitem_text (&t[18], "angle1") ;
 angle1_subitem.ItemFill  = (APTR) &t[18] ;
 create_menu_subitem_text (&t[25], "angle2") ;
 angle2_subitem.ItemFill  = (APTR) &t[25] ;
 create_menu_subitem_text (&t[26], "angle3") ;
 angle3_subitem.ItemFill  = (APTR) &t[26] ;

 /* Subitem text for Background Item */
 create_menu_subitem_text (&t[19], "on") ;
 on_subitem.ItemFill  = (APTR) &t[19] ;
 create_menu_subitem_text (&t[20], "off") ;
 off_subitem.ItemFill  = (APTR) &t[20] ;

 /* Subitem text for Colors Item */
 create_menu_subitem_text (&t[21], "default") ;
 default_subitem.ItemFill  = (APTR) &t[21] ;
 create_menu_subitem_text (&t[22], "set1") ;
 set1_subitem.ItemFill  = (APTR) &t[22] ;
 create_menu_subitem_text (&t[28], "set2") ;
 set2_subitem.ItemFill  = (APTR) &t[28] ;
 create_menu_subitem_text (&t[29], "set3") ;
 set3_subitem.ItemFill  = (APTR) &t[29] ;
}


create_menu_item_text (t, name)

struct IntuiText  *t ;
UBYTE  *name ;
{
 /*---------------------------------------------------------------------------
  *    Fill in the IntuiText data structure required by a menu or a menu item.
  *---------------------------------------------------------------------------
 */
 t->FrontPen   = COLOR3;              /* text foreground pen color */
 t->BackPen    = COLOR2 ;             /* text background pen color */
 t->DrawMode   = JAM1 ;               /* text drawing mode */
 t->LeftEdge   = CHECKWIDTH + 2 ;     /* offset of text from left edge */
 t->TopEdge    = 0 ;                  /* offset of text from top edge */
 t->ITextFont  = &prog_font ;         /* font in use */
 t->IText      = name ;               /* actual text */
 t->NextText   = NULL ;               /* pointer to next text */
}


create_menu_subitem_text (t, name)

struct IntuiText  *t ;
UBYTE  *name ;
{
 /*---------------------------------------------------------------------------
  *    Fill in the IntuiText data structure required by a menu subitem.
  * The menu subitem text color is different from the menu item text color.
  *---------------------------------------------------------------------------
 */
 t->FrontPen   = COLOR1 ;             /* text foreground pen color */
 t->BackPen    = COLOR4;              /* text background pen color */
 t->DrawMode   = JAM1 ;               /* text drawing mode */
 t->LeftEdge   = CHECKWIDTH + 2 ;     /* offset of text from left edge */
 t->TopEdge    = 0 ;                  /* offset of text from top edge */
 t->ITextFont  = &prog_font ;         /* font in use */
 t->IText      = name ;               /* actual text */
 t->NextText   = NULL ;               /* pointer to next text */
}


reinitialize_menus ()
{
 /*---------------------------------------------------------------------------
  *   When the "new" menu item is selected on the Project menu, this routine
  * is called to reinitialize the menu settings flags.  The main purpose is
  * to reset the menu checkmarks to the default settings.
  *---------------------------------------------------------------------------
*/ 
 arm_item.Flags             =  ITEMTEXT | HIGHCOMP | ITEMENABLED ;
 flypast_item.Flags         =  ITEMTEXT | HIGHCOMP | ITEMENABLED ;
 both_item.Flags            =  ITEMTEXT | HIGHCOMP ;
 animate_menu.Flags         =  MENUENABLED ;
 place_obstacles_item.Flags =  ITEMTEXT | HIGHCOMP ;
 distal_goal_item.Flags     =  ITEMTEXT | HIGHCOMP ;
 set_all_joints_item.Flags  =  ITEMTEXT | HIGHCOMP | ITEMENABLED ;
 goal_menu.Flags            =  MENUENABLED ;
 wrist_item.Flags           =  ITEMTEXT | HIGHCOMP | ITEMENABLED ;
 elbow_item.Flags           =  ITEMTEXT | HIGHCOMP | ITEMENABLED ;
 shoulder_item.Flags        =  ITEMTEXT | HIGHCOMP | ITEMENABLED ;
 rotate_menu.Flags          =  MENUENABLED ;
 perspective_item.Flags     =  CHECKIT | ITEMTEXT | HIGHCOMP | ITEMENABLED ;
 parallel_subitem.Flags     =  CHECKIT | CHECKED | ITEMTEXT | HIGHCOMP
                               | ITEMENABLED ;
 wide_angle_subitem.Flags   =  CHECKIT | ITEMTEXT | HIGHCOMP | ITEMENABLED ;
 telephoto_subitem.Flags    =  CHECKIT | ITEMTEXT | HIGHCOMP | ITEMENABLED ;
 angle1_subitem.Flags       =  CHECKIT | CHECKED | ITEMTEXT | HIGHCOMP
                               | ITEMENABLED ;
 angle2_subitem.Flags       =  CHECKIT | ITEMTEXT | HIGHCOMP | ITEMENABLED ;
 angle3_subitem.Flags       =  CHECKIT | ITEMTEXT | HIGHCOMP | ITEMENABLED ;
 top_subitem.Flags          =  CHECKIT | ITEMTEXT | HIGHCOMP | ITEMENABLED ;
 front_subitem.Flags        =  CHECKIT | ITEMTEXT | HIGHCOMP | ITEMENABLED ;
 side_subitem.Flags         =  CHECKIT | ITEMTEXT | HIGHCOMP | ITEMENABLED ;
 viewpoint_item.Flags       =  ITEMTEXT | HIGHCOMP | ITEMENABLED ;
 off_subitem.Flags          =  CHECKIT | CHECKED | ITEMTEXT | HIGHCOMP
                               | ITEMENABLED ;
 on_subitem.Flags           =  CHECKIT | ITEMTEXT | HIGHCOMP | ITEMENABLED ;
 ref_axes_item.Flags        =  ITEMTEXT | HIGHCOMP | ITEMENABLED ;
 solid_view_item.Flags      =  CHECKIT | ITEMTEXT | HIGHCOMP | ITEMENABLED ;
 wire_frame_item.Flags      =  CHECKIT | CHECKED | ITEMTEXT | HIGHCOMP 
                               | ITEMENABLED ;
 view_menu.Flags            =  MENUENABLED ;
 quit_item.Flags            =  ITEMTEXT | HIGHCOMP | ITEMENABLED ;
 set1_subitem.Flags         =  CHECKIT | ITEMTEXT | HIGHCOMP | ITEMENABLED ;
 default_subitem.Flags      =  CHECKIT | CHECKED | ITEMTEXT | HIGHCOMP
                               | ITEMENABLED ;
 set1_subitem.Flags         =  CHECKIT | ITEMTEXT | HIGHCOMP | ITEMENABLED ;
 set2_subitem.Flags         =  CHECKIT | ITEMTEXT | HIGHCOMP | ITEMENABLED ;
 set3_subitem.Flags         =  CHECKIT | ITEMTEXT | HIGHCOMP | ITEMENABLED ;
 colors_item.Flags          =  ITEMTEXT | HIGHCOMP | ITEMENABLED ;
 help_item.Flags            =  ITEMTEXT | HIGHCOMP ;
 author_item.Flags          =  ITEMTEXT | HIGHCOMP | ITEMENABLED ;
 new_item.Flags             =  ITEMTEXT | HIGHCOMP | ITEMENABLED ;
 project_menu.Flags         =  MENUENABLED ;
}