/*
 *	Menus.c - Copyright © 1990 by S.R. & P.C.
 *
 *	Created:	16 Jun 1990
 *	Modified:	04 Apr 1991  23:20:35
 *
 *	Make>> make
 */


static struct IntuiText SubText2 = {
	3,2,JAM1,
	22,1,
	NULL,
	(UBYTE *)"Shell",
	NULL
};

static struct MenuItem SubItem2 = {
	NULL,
	104,10,
	72,10,
	CHECKIT+ITEMTEXT+ITEMENABLED+HIGHCOMP,
	1,
	NULL,
	NULL,
	NULL,
	NULL,
	MENUNULL
};

static struct IntuiText SubText1 = {
	3,2,JAM1,
	22,1,
	NULL,
	(UBYTE *)"Simple",
	NULL
};

struct MenuItem SubItem1 = {
	NULL,
	104,0,
	72,10,
	CHECKIT+ITEMTEXT+ITEMENABLED+HIGHCOMP+CHECKED,	/* Item flags */
	2,
	NULL,
	NULL,
	NULL,
	NULL,
	MENUNULL
};


struct Menu Menu1 = {
	NULL,
	0,0,
	44,0,
	MENUENABLED,
	"ParM",
	NULL
};

static struct IntuiText Line = {
	2, 0, JAM1,
	0, 9,
	NULL,
	(UBYTE *)"-------------",
	NULL
};

static struct {
	char *MenuName;
	char Command;
	char line;
} MenuTab[] = {
	{"Open",	 'O', 0},
	{"UpDate",	 'U', 0},
	{"Std Cfg",	  0 , 1},
	{"Cmd Mode",  0 , 0},
	{"Command",	 'C', 1},
	{"Change Dir",0 , 1},
	{"Quit",	  0 , 0}
};

#define NUMBER_OF_ITEM 7

void CreateParMenu(short Color)
{
	struct MenuItem *mi, **miptr;
	struct IntuiText *it;
	struct Menu *ParM;
	short top, i;

	ParM = &Menu1;
	miptr = &ParM->FirstItem;
	Line.FrontPen = Color;
	for( top=0, i=0 ; i<NUMBER_OF_ITEM ; i++ ) {
		mi = ArpAlloc(sizeof(struct MenuItem));
		it = ArpAlloc(sizeof(struct IntuiText));
		mi->ItemFill = (APTR)it;
		mi->Width = 104;
		mi->Height = 10;
		mi->TopEdge = top;
		mi->Flags = ITEMTEXT+ITEMENABLED+HIGHCOMP;
		if (MenuTab[i].Command) {
			mi->Command = MenuTab[i].Command;
			mi->Flags |= COMMSEQ;
		}
		top += 10;
		it->IText = (UBYTE *)MenuTab[i].MenuName;
		it->FrontPen = Color;
		it->LeftEdge = it->TopEdge = 1;
		if (MenuTab[i].line) {
			it->NextText = &Line;
			top += 5;
		}
		if (i == 3) {
			SubItem1.ItemFill = (APTR)&SubText1;
			SubText1.FrontPen = Color;
			SubItem1.NextItem = &SubItem2;
			SubItem2.ItemFill = (APTR)&SubText2;
			SubText2.FrontPen = Color;
			mi->SubItem = &SubItem1;
		}
		*miptr = mi;
		miptr = &mi->NextItem;
	}
}

