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

/* INIT MENU VARIABLES AND LITERALS */

#include "equs.c"
#include "data.c"



LitInit ()
{	char	count,i;
	char	chnum;	/* number of choices in this item */

	noneptr = 			"No Changes";
	retmptr = 			"Return to Main Menu";
	defblkptr =			"                ";
	/* init return string for sub menu when in main rout */
	mmrets [0] = UPCUR;
	mmrets [1] = DOWNCUR;
	mmrets [2] = '\0';
	
	/* standard retruns from a sub menu */
	sbrets [0] = ESC;
	sbrets [1] = CR;
	sbrets [2] = 0;

	count = 0;
	Obright = count++;
	OscrType = count++;
	if (dealer | !isFox) OcursType = count++;
	else	OcursType = 0;
	if (dealer | (!isFox & isHoriz)) OscrSize = count++;
	else	OscrSize = 0;
	if (dealer | isFox) OemulType = count++;
	else	OemulType  = 0;
	OfuncKeys = count++;
	Olang = count++;
	Okeys = count++;
	if (!isFox) OcreLang = count++;
	else	OcreLang = 0;
	OcreKey = count++;
	Oread = count++;
	Osave = count++;
	OsignOff = count++;
	readMen = Okeys + 1;  /* read menu array number */

	/* init string which tells which options have menus */
	i = 0;
	havemenus  [i++] = Obright + 1;
	havemenus  [i++] = OscrType + 1;
	if (OcursType) havemenus  [i++] = OcursType + 1;
	if (OscrSize) havemenus  [i++] = OscrSize + 1;
	if (OemulType) havemenus  [i++] = OemulType + 1;
	havemenus [i++] = OfuncKeys + 1;
	havemenus [i++] = Olang + 1;
	havemenus [i++] = Okeys + 1;
	havemenus [i++] = '\0';

	mainmen.MENhead = "MAIN MENU";
	mainmen.MENnumChoice = count;
	mainmen.MENsingleDef = TRUE;
	mainmen.MENintString [0] = 0;
	mainmen.MENdefChoice [0] = 0xFF;
	mainmen.MENactChoice = Obright;
	mainmen.MENchoice [Obright] 		 	 = "Brightness       ";
	mainmen.MENchoice [OscrType] 		 	 = "Screen Type      ";
	if (OcursType) mainmen.MENchoice [OcursType] 	 = "Cursor Type      ";
	if (OscrSize) mainmen.MENchoice [OscrSize]   	 = "Screen Size      ";
	if (OemulType) mainmen.MENchoice [OemulType] 	 = "Sceen Emulation  ";
	mainmen.MENchoice [OfuncKeys] 		 	 = "Function Keys    ";
	mainmen.MENchoice [Olang] 			 = "Language         ";
	mainmen.MENchoice [Okeys] 			 = "Keyboard Layout  ";
	mainmen.MENchoice [Oread] 			 = "Read In Settings  ";
	mainmen.MENchoice [Osave] 			 = "Save Settings    ";
	mainmen.MENchoice [OcreKey]	 		 = "Create a Keyboard";
	mainmen.MENchoice [Oread] 			 = "Recall Settings  ";
	if (OcreLang) mainmen.MENchoice [OcreLang] 	 = "Create Language  ";
	mainmen.MENchoice [OsignOff] 		 	 = "Sign Off         ";

	mainmen.MENheadRow = MAINROW;
	mainmen.MENheadCol = MAINCOL;
	for (i = 0; i < count; i++)
		{ mainmen.MENchCol [i] = MAINCOL + 1;
		  mainmen.MENchRow [i] = MAINROW + 1 + i;
		  if (!dealer)
			{ if (i >= Oread) (mainmen.MENchRow [i])++; 
			  if ((i >= OcreKey) | (!isFox & (i >= OcreLang)))
				(mainmen.MENchRow [i])++; 
			}
		}  /* i to signoff */
	
	
	/* brightness screen */
	mens [Obright].MENhead 			 = "BRIGHTNESS LEVEL";
	count = 2;
	mens [Obright].MENnumChoice = count;
	mens [Obright].MENsingleDef = TRUE;
	strcpy (mens [Obright].MENintString,mmrets);
	mens [Obright].MENdefChoice [0] = 1;
	mens [Obright].MENactChoice = 0xFF;
	mens [Obright].MENchoice [0] 		 = "Set Level ";
	mens [Obright].MENchoice [1] 		 = noneptr;

	mens [Obright].MENheadRow = SECROW;
	mens [Obright].MENheadCol = SECCOL;
	for (i = 0; i <= count; i++)
		{ mens [Obright].MENchCol [i] = SECCOL + 1;
		  mens [Obright].MENchRow [i] = SECROW + 1 + i;
		}  /* i to signoff */


	/*  screen type */
	mens [OscrType].MENhead 		= "SCREEN TYPE ";
	count = 3;
	mens [OscrType].MENnumChoice = count;
	mens [OscrType].MENsingleDef = TRUE;
	strcpy (mens [OscrType].MENintString,mmrets);
	mens [OscrType].MENdefChoice [0] = 2;
	mens [OscrType].MENactChoice = 0xFF;
	mens [OscrType].MENchoice [0] 		 = "Normal Video  ";
	mens [OscrType].MENchoice [1] 		 = "Inverse Video ";
	mens [OscrType].MENchoice [2] 		 = noneptr;

	mens [OscrType].MENheadRow = SECROW;
	mens [OscrType].MENheadCol = SECCOL;
	for (i = 0; i <= count; i++)
		{ mens [OscrType].MENchCol [i] = SECCOL + 1;
		  mens [OscrType].MENchRow [i] = SECROW + 1 + i;
		}  /* i to signoff */

	/*  cursor type */
	if (OcursType)
		{
		mens [OcursType].MENhead 		= "CURSOR TYPE ";
		count = 4;
		mens [OcursType].MENnumChoice = count;
		mens [OcursType].MENsingleDef = TRUE;
		strcpy (mens [OcursType].MENintString,mmrets);
		mens [OcursType].MENdefChoice [0] = 3;
		mens [OcursType].MENactChoice = 0xFF;
		mens [OcursType].MENchoice [0] 		 = "Flashing     ";
		mens [OcursType].MENchoice [1] 		 = "Non Flashing ";
		mens [OcursType].MENchoice [2] 		 = "Invisible    ";
		mens [OcursType].MENchoice [3] 		 = noneptr;

		mens [OcursType].MENheadRow = SECROW;
		mens [OcursType].MENheadCol = SECCOL;
		for (i = 0; i <= count; i++)
			{ mens [OcursType].MENchCol [i] = SECCOL + 1;
			  mens [OcursType].MENchRow [i] = SECROW + 1 + i;
			}  /* i to signoff */
		} /* if cursType */

	/*  screen size */
	if (OscrSize)
		{
		mens [OscrSize].MENhead 			= "SCREEN SIZE ";
		count = 4;
		mens [OscrSize].MENnumChoice = count;
		mens [OscrSize].MENsingleDef = TRUE;
		strcpy (mens [OscrSize].MENintString,mmrets);
		mens [OscrSize].MENdefChoice [0] = 3;
		mens [OscrSize].MENactChoice = 0xFF;
		mens [OscrSize].MENchoice [0] 		 = "Small (132 X 50)   ";
		mens [OscrSize].MENchoice [1] 		 = "Normal (80 X 24)   ";
		mens [OscrSize].MENchoice [2] 		 = "Extra Lines (80 x 26)";
		mens [OscrSize].MENchoice [3] 		 = noneptr;

		mens [OscrSize].MENheadRow = SECROW;
		mens [OscrSize].MENheadCol = SECCOL;
		for (i = 0; i <= count; i++)
			{ mens [OscrSize].MENchCol [i] = SECCOL + 1;
			  mens [OscrSize].MENchRow [i] = SECROW + 1 + i;
			}  /* i to signoff */
		} /* if scr size */

	/*  emulation*/
	if (OemulType)
		{
		mens [OemulType].MENhead 			= "SCREEN EMULATIONS ";
		count = 4;
		mens [OemulType].MENnumChoice = count;
		mens [OemulType].MENsingleDef = TRUE;
		strcpy (mens [OemulType].MENintString,mmrets);
		mens [OemulType].MENdefChoice [0] = 3;
		mens [OemulType].MENactChoice = 0xFF;
		mens [OemulType].MENchoice [0] 		 	= "ADDS Viewpoint   ";
		mens [OemulType].MENchoice [1] 		 	= "ADDS Regent 2025 ";
		mens [OemulType].MENchoice [2] 		 	= "Hazeltine 1500   ";
		mens [OemulType].MENchoice [3] 		 	= noneptr;

		mens [OemulType].MENheadRow = SECROW;
		mens [OemulType].MENheadCol = SECCOL;
		for (i = 0; i <= count; i++)
			{ mens [OemulType].MENchCol [i] = SECCOL + 1;
			  mens [OemulType].MENchRow [i] = SECROW + 1 + i;
			}  /* i to signoff */
		} /* if emualtion */


	/*  Function Keys */
	mens [OfuncKeys].MENhead 			= "FUNCTION KEYS ";
	if (isFox) count = 4;
	else count = 3;
	mens [OfuncKeys].MENnumChoice = count;
	mens [OfuncKeys].MENsingleDef = TRUE;
	strcpy (mens [OfuncKeys].MENintString,mmrets);
	mens [OfuncKeys].MENdefChoice [0] = 0;
	mens [OfuncKeys].MENactChoice = 0xFF;
	mens [OfuncKeys].MENchoice [0] 		 = "Create/Erase a  String";
	mens [OfuncKeys].MENchoice [1] 		 = "Edit a String  ";
	mens [OfuncKeys].MENchoice [2] 		 = "Display All Keys  ";
	if (isFox)
		mens [OfuncKeys].MENchoice [3] 	 = "Read Present Settings";

	mens [OfuncKeys].MENheadRow = SECROW;
	mens [OfuncKeys].MENheadCol = SECCOL;
	for (i = 0; i <= count; i++)
		{ mens [OfuncKeys].MENchCol [i] = SECCOL + 1;
		  mens [OfuncKeys].MENchRow [i] = SECROW + 1 + i;
		}  /* i to signoff */


	/*  Language */
	mens [Olang].MENhead 			= "LANGUAGES   ";
	count = 0;
	mens [Olang].MENsingleDef = TRUE;
	strcpy (mens [Olang].MENintString,mmrets);
	mens [Olang].MENactChoice = 0xFF;
	mens [Olang].MENchoice [count++] 		 = "Ascii (American) ";
	mens [Olang].MENchoice [count++] 		 = "British          ";
	mens [Olang].MENchoice [count++] 		 = "Danish           ";
	mens [Olang].MENchoice [count++] 		 = "Dutch            ";
	mens [Olang].MENchoice [count++] 		 = "French           ";
	mens [Olang].MENchoice [count++] 		 = "German           ";
	mens [Olang].MENchoice [count++] 		 = "Italian          ";
	mens [Olang].MENchoice [count++] 		 = "Norwegian        ";
	mens [Olang].MENchoice [count++] 		 = "Swedish          ";
	if (!isFox | dealer) mens [Olang].MENchoice [count++] 		 = "User Defined     ";
	mens [Olang].MENchoice [count++]		 = noneptr;

	mens [Olang].MENnumChoice = count;
	mens [Olang].MENdefChoice [0] = (count-1);

	mens [Olang].MENheadRow = SECROW;
	mens [Olang].MENheadCol = SECCOL;
	for (i = 0; i <= count; i++)
		{ mens [Olang].MENchCol [i] = SECCOL + 1;
		  mens [Olang].MENchRow [i] = SECROW + 1 + i;
		}  /* i to signoff */
	  (mens [Olang].MENchRow [count])++; /* separate by a line */




	/* keyboard arrangement */
	mens [Okeys].MENhead 			 = "KEYBOARD LAYOUT";
	count = 2;
	mens [Okeys].MENnumChoice = count;
	mens [Okeys].MENsingleDef = TRUE;
	strcpy (mens [Okeys].MENintString,mmrets);
	mens [Okeys].MENdefChoice [0] = 0;
	mens [Okeys].MENactChoice = 0xFF;
	mens [Okeys].MENchoice [0] 		 = "Standard     ";
	mens [Okeys].MENchoice [1] 		 = "User Defined ";

	mens [Okeys].MENheadRow = SECROW;
	mens [Okeys].MENheadCol = SECCOL;
	for (i = 0; i <= count; i++)
		{ mens [Okeys].MENchCol [i] = SECCOL + 1;
		  mens [Okeys].MENchRow [i] = SECROW + 1 + i;
		}  /* i to signoff */




	/* read in selection menu */
	count = 0;
	RDMSC = count++;
	RDMLG = count++;
	RDMFK = count++;
	if (!isFox | dealer) RDMUL = count++;
	else RDMUL = 0;
	RDMUKB = count++;
	RDMRR = count++;
	
	mens [readMen].MENhead 			 = "SETTINGS TO READ IN";
	mens [readMen].MENnumChoice = RDMRR + 1;
	for (i = 0; i < MENMAX; i++)
		mens [readMen].MENdefChoice [i] = 0;
	mens [readMen].MENsingleDef = FALSE;
	/* make it so sub menu  will return  - UP,DOWN, CR and ESC */ 
	strcpy (mens [readMen].MENintString,mmrets);
	strcat (mens [readMen].MENintString,sbrets);
	mens [readMen].MENactChoice = 0;
	mens [readMen].MENchoice [RDMSC]	 = "Screen and Cursor Settings";
	mens [readMen].MENchoice [RDMLG]	 = "Language and Keyboard ";
	mens [readMen].MENchoice [RDMFK]	 = "Function Keys";
	if (RDMUL)
		mens [readMen].MENchoice [RDMUL]  = "User Created Characters";
	mens [readMen].MENchoice [RDMUKB]	 = "User Created Keyboard";
	mens [readMen].MENchoice [RDMRR]	 = "Read in Marked Choices";

	mens [readMen].MENheadRow = SECROW;
	mens [readMen].MENheadCol = SECCOL;
	for (i = 0; i <= (RDMRR + 1); i++)
		{ mens [readMen].MENchCol [i] = SECCOL + 1;
		  mens [readMen].MENchRow [i] = SECROW + 1 + i;
		}  /* i to signoff */
	mens [readMen].MENchRow [RDMRR]++;
	


	/* FOR TRANSLATIONS SET BASIC LANGUAGE VALUE */
	standLang = 'A';  

	pipe  =			'|';
	hat   =			'^';
	dash  = 		'-';
	vString [0] = version;
	vString [1] = '.';
	vString [2] = revision;
	vString [3] = '\0';

	head1ptr = "SCREEN AND KEYBOARD CUSTOMIZATION PROGRAM    Ver ";
	head2ptr = "Use Up and Down arrows to move through menu.";
	head3aptr = "Press RETURN to select an entry.";
	head3bptr = "Press RETURN to select an entry.  Press ESC to abandon this sub-menu.";
/* prompt inits */
	ms1ptr = "Enter a brightness level from 1 to 15:";
	ms2ptr = "That is not a valid intensity level.";
	ms3ptr = "Level - ";
	ms4ptr = "Show that setting on screen now? (y/n)";
	ms5ptr = "Extra (80 x 26) ";
	ms6ptr = "You have made changes which you haven't saved to a file.";
	ms7ptr = "  Do you still want to sign off? (y/n)";
	ms8ptr ="Can't find overlay file ";
	ms9ptr = " Was unable to read language successfully.";
	ms10ptr ="Should I load that language onto the screen now? (y/n) ";
	ms11ptr = "On logged drive can't find file: ";
	ms12ptr = "Enter character of drive to find file on"; 
	ms13ptr = "   or press RETURN to give up ";
	ms13aptr = "Not a valid drive char. Valid chars are A,B,C and D.";
	ms14ptr = "Press the key of character you wish to define.\n";
	ms15ptr = "     To END session press RETURN.\n";
	ms16ptr = "     To save to a file press F1.";
	ms17ptr = "Choose what you want to use as starting language.";
	ms18ptr = "    or press ESC to abandon";
	ms19ptr = "You have asked to start with: ";
	ms20ptr = "Please confirm (y/n)";
	ms21ptr = "Couldn't load up language. Do you want to continue? (y/n)";
	ms22ptr = "CURRENT CHARACTER SET IS: ";
	ms23ptr = "DEFINING CHARACTER: ";
	ms24ptr = "      ASCII value: ";
	ms25ptr = "      To MOVE cursor use number pad arrow keys\n";
	ms26ptr = "      To CLEAR the grid press F3.\n";
	ms27ptr = "      To ENTER this character in table press RETURN.\n";
	ms28ptr = "      To ABANDON this character press ESC.\n";
	ms29ptr = "      To LOAD grid with a character press F2 and then that character.\n";
	ms30ptr = "      To change DESCENDER LINE press F4.\n";
	ms31ptr = "      To BLANK out a cell press SPACEBAR.\n";
	ms32ptr = "      To FILL a cell press any other key.";
	ms33ptr = "Can't find needed character set in CHARSET.CST file";
	ms34ptr = "Do you wish to use the currently loaded user language?";
	ms35ptr = "Read from file ";
	ms36ptr = "Couldn't read language from that file. ";
	ms37ptr = "Enter name of file to read in ";
	ms38ptr = "   or press RETURN to abandon";
	ms39ptr = "Enter name of file to save to ";
	ms40ptr = "Save to file ";
	ms41ptr = "Creating new file";
	ms42ptr = " already exists.";
	ms43ptr = " Should I overwrite it? (y/n) ";
	ms44ptr = "Saving, please wait.";
	ms45ptr = "nCan't write to file.  See if disk is full.";
	ms46ptr = "Can't find file named ";
	ms47ptr = "Do you wish to load in all settings? (y/n) ";
	ms48ptr = "Mark the items in the menu that you wish to read.";
	ms49ptr = "Select 'Read and Return' when all items are marked.";
	ms50ptr = "Reading in. Please wait.";
	ms51ptr = "Failed to read entire file. ";
	ms52ptr = "Press any key to continue ";
	ms53ptr = "Can't read in function keys, table too big.";
	ms54ptr = "Can't read character set.  This is a FOX.";
	ms55ptr = "User language is the wrong size.  I can't read it in.";
	ms56ptr = "Please wait.";
	ms57ptr = "There is no user defined version present.";
	ms58ptr = "Do you want to read one in? (y/n) ";
	ms59ptr = "Couldn't read information from that file.";


	ms73ptr = "Press function key you wish to ";
	ms74ptr = "    To return to Function Key Menu press RETURN";
	ms75ptr = "    To return to Main Menu press ESC. ";
	ms76ptr = "create or erase.";
	ms77ptr = "edit.";
	ms78ptr = "DEFINING FUNCTION KEY: ";
	ms79ptr = "Use <-- and --> to move in string.   Press RETURN when done,";
	ms80ptr = " ESC to abandon.   Before entering RETURN, ESC, <--, -->,";
 	ms81ptr = " DEL or @ into string press @.";
	ms82ptr = "To abandon press ESC or any other key to continue ";
	ms84ptr = "Keys used: ";
	ms83ptr = "Press ESC to abandon display or any other key to start display ";
	ms85ptr = "Bytes left in buffer";
	ms86ptr = "Read in special function keys from keyboard ";
	ms87ptr = "  PLEASE DON'T PRESS ANY KEYS  ";
	ms88ptr = "No keys programmed. ";

	ms91ptr = "Do you still want to leave this routine? (y/n) ";
	ms92ptr = "Can't find file on that drive either.          ";
	ms93ptr = "CURRENT SETTINGS";
	ms94ptr = "Press ESC to leave this menu";
	ms95ptr = "Not a valid CP/M file name.  Please re-enter name";
	
	ms99ptr = "Dealer";
}  /* end of new init */


