home *** CD-ROM | disk | FTP | other *** search
- #include "header.h"
- #include "file.h"
-
- #if PC
- #define TAB1 4 /* pos of 1st col of menu items on pc screen */
- #define TAB2 35 /* pos of 2nd col of menu items on pc screen */
- #endif
-
- /*************************************************************************/
- /** menu functions **/
- /*************************************************************************/
- /* all menus return int value:
- 0 = successful input, continue program
-
- menus listed herein:
- cyclemenu
- displaymenu
- cellmenu
- daysmenu
- */
- /********************************/
- /* function: cyclemenu */
- /********************************/
- /* prints out the Cyclen menu, deals with user input to the menu */
- cyclemenu ()
- {
- char input[MAXLEN]; /* user menu choice */
- char c;
- int valid; /* boolean */
- int val, j;
- #if PC
- int i;
- #endif
-
- if (strcmp(Animal, "None")==0) {
- #if PC
- topline(" Cycle Length Menu ");
- clrscr1(1);
- gotoxy(1, 5);
- cprintf("%sNo animal has been selected yet.", tab);
- gotoxy(1, 6);
- cprintf("%sPlease use the Animal Menu to select an animal.", tab);
- hitreturn(1);
- if (HARDCOPY) {
- togglepr();
- fprintf(stdprn, "\n\tNo animal has been selected yet.\n");
- fprintf(stdprn, "\tPlease use the Animal Menu to select an animal.\n");
- }
- #else
- printf("\n\tNo animal has been selected yet.\n");
- printf("\tPlease use the Animal Menu to select an animal.\n");
- #endif
- if (FILEq && FILECOPY) {
- fprintf(fpout, "\n\tNo animal has been selected yet.\n");
- fprintf(fpout, "\tPlease use the Animal Menu to select an animal.\n");
- }
- return(103); /* goto animal menu */
- }
-
- valid = 0;
- while (! valid) {
- #if PC
- topline(" Cycle Length Menu ");
- clrscr1(1);
- normvideo();
- i = 2;
- gotoxy(TAB2, i++);
- cprintf("H: Change Cycle Length");
- gotoxy(TAB2, i++);
- cprintf("I: Use Default Cycle Length");
- i = 2;
- gotoxy(TAB1, i++);
- cprintf("A: Go to General Menu");
- gotoxy(TAB1, i++);
- cprintf("B: Go to Help Menu");
- gotoxy(TAB1, i++);
- cprintf("C: Go to Animal Menu");
- gotoxy(TAB1, i++);
- cprintf("D: (...");
- highvideo();
- cprintf("Cycle Menu");
- normvideo();
- cprintf("...)");
- gotoxy(TAB1, i++);
- cprintf("E: Go to Display Menu");
- gotoxy(TAB1, i++);
- cprintf("F: Go to Cell Input Menu");
- gotoxy(TAB1, i++);
- cprintf("G: Go to Days Input Menu");
- i++;
- gotoxy(TAB1, i);
- cprintf("X: Exit Program");
- gotoxy(TAB2, i);
- cprintf("?: Show Help Screen");
- if (HARDCOPY) {
- togglepr();
- fprintf(stdprn, "\n\n\t\t Cycle Length Menu\n\n");
- fprintf(stdprn, "\tA: Go to General Menu\n");
- fprintf(stdprn, "\tB: Go to Help Menu\n");
- fprintf(stdprn, "\tC: Go to Animal Menu\n");
- fprintf(stdprn, "\tD: (...Cycle Length Menu...)\n");
- fprintf(stdprn, "\tE: Go to Display Menu\n");
- fprintf(stdprn, "\tF: Go to Cell Input Menu\n");
- fprintf(stdprn, "\tG: Go to Days Input Menu\n\n");
- fprintf(stdprn, "\tH: Change Cycle Length\n");
- fprintf(stdprn, "\tI: Use Default Cycle Length\n\n");
- fprintf(stdprn, "\tX: Exit Program\n");
- fprintf(stdprn, "\t?: Show Help Screen\n");
- }
- #else
- printf("\n\n\t\t Cycle Length Menu\n\n");
- printf("\tA: Go to General Menu\n");
- printf("\tB: Go to Help Menu\n");
- printf("\tC: Go to Animal Menu\n");
- printf("\tD: (...Cycle Length Menu...)\n");
- printf("\tE: Go to Display Menu\n");
- printf("\tF: Go to Cell Input Menu\n");
- printf("\tG: Go to Days Input Menu\n\n");
- printf("\tH: Change Cycle Length\n");
- printf("\tI: Use Default Cycle Length\n\n");
- printf("\tX: Exit Program\n");
- printf("\t?: Show Help Screen\n");
- #endif
- if (FILEq && FILECOPY) {
- fprintf(fpout, "\n\n\t\t Cycle Length Menu\n\n");
- fprintf(fpout, "\tA: Go to General Menu\n");
- fprintf(fpout, "\tB: Go to Help Menu\n");
- fprintf(fpout, "\tC: Go to Animal Menu\n");
- fprintf(fpout, "\tD: (...Cycle Length Menu...)\n");
- fprintf(fpout, "\tE: Go to Display Menu\n");
- fprintf(fpout, "\tF: Go to Cell Input Menu\n");
- fprintf(fpout, "\tG: Go to Days Input Menu\n\n");
- fprintf(fpout, "\tH: Change Cycle Length\n");
- fprintf(fpout, "\tI: Use Default Cycle Length\n\n");
- fprintf(fpout, "\tX: Exit Program\n");
- fprintf(fpout, "\t?: Show Help Screen\n");
- }
-
- #if PC
- clrscr1(2);
- cprintf("%sPlease enter your menu choice:", tab);
- gotoxy(1, 2);
- highvideo();
- cprintf("%s%c%c%c ", tab2, HBAR, HBAR, RTRI);
- normvideo();
- val = getusrstr(input);
- if (HARDCOPY) {
- togglepr();
- fprintf(stdprn, "\n\tPlease enter your menu choice:\n");
- fprintf(stdprn, "\t\t==> %s", input);
- }
- #else
- printf("\n\tPlease enter your menu choice:\n");
- printf("\t\t==> ");
- getusrstr(input);
- #endif
- if (FILEq && FILECOPY) {
- fprintf(fpout, "\n\tPlease enter your menu choice:\n");
- fprintf(fpout, "\t\t==> %s", input);
- }
-
- #if PC
- if (val) return(val);
- else {
- #endif
- c = input[0];
- switch (toupper1(c)) {
- case 'A': /* goto intro menu */
- return(101);
- case 'B': /* goto help menu */
- return(102);
- case 'C': /* goto animal menu */
- return(103);
- case 'D': /* stay here at cycle length menu */
- break;
- case 'E': /* goto display meny */
- return(114);
- case 'F': /* goto cell input menu */
- return(105);
- case 'G': /* goto days input menu */
- return(106);
- case 'H': /* change cycle length */
- valid = 1;
- val = getCyclelen();
- break;
- case 'I': /* use default cycle length */
- valid = 1;
- /* transform old stage[j] vals (days) to new ones */
- for ( j=0; j<NumStages; j++ )
- stage[j] = stage[j] * DefaultCycleTime / CycleTime;
- /* reset CycleTime to default value */
- CycleTime = DefaultCycleTime;
- #if PC
- printCycleTime();
- #endif
- NewCycleTime = 0;
- val = 0;
- break;
- case '?': /* show help screen */
- helpcyclelenip();
- break;
- case 'X': /* Done */
- printexit(32);
- default:
- #if PC
- clrscr1(3);
- printf("%s%sInvalid choice: <%c>.", tab, ERRSTR, input[0]);
- if (HARDCOPY) {
- togglepr();
- fprintf(stdprn, "\t%sInvalid choice: <%c>.", ERRSTR, input[0]);
- }
- #else
- printf("\t%sInvalid choice: <%c>.", ERRSTR, input[0]);
- #endif
- if (FILEq && FILECOPY)
- fprintf(fpout, "\t%sInvalid choice: <%c>.\n", ERRSTR, input[0]);
- } /* switch */
- #if PC
- } /* if ! val */
- #endif
- } /* while */
- } /* cyclemenu */
-
- /********************************/
- /* function: displaymenu */
- /********************************/
- /* prints out the display menu, deals with user input
- prints out stage data and cell sequence data */
- displaymenu ()
- {
- char input[MAXLEN]; /* user menu choice */
- char c;
- #if PC
- int val; /* return val of getusrstr */
- int i;
- #endif
-
- while (TRUE) {
- /* endless loop; only way out is via returns in the loop */
- #if PC
- topline(" Display Menu ");
- clrscr1(1);
- normvideo();
- i = 2;
- gotoxy(TAB2, i++);
- cprintf("H: Show Stage Length Data");
- gotoxy(TAB2, i++);
- cprintf("I: Show Cell Sequence Data");
- i = 2;
- gotoxy(TAB1, i++);
- cprintf("A: Go to General Menu");
- gotoxy(TAB1, i++);
- cprintf("B: Go to Help Menu");
- gotoxy(TAB1, i++);
- cprintf("C: Go to Animal Menu");
- gotoxy(TAB1, i++);
- cprintf("D: Go to Cycle Length Menu");
- gotoxy(TAB1, i++);
- cprintf("E: (...");
- highvideo();
- cprintf("Display Menu");
- normvideo();
- cprintf("...)");
- gotoxy(TAB1, i++);
- cprintf("F: Go to Cell Input Menu");
- gotoxy(TAB1, i++);
- cprintf("G: Go to Days Input Menu");
- i++;
- gotoxy(TAB1, i);
- cprintf("X: Exit Program");
- gotoxy(TAB2, i);
- cprintf("?: Show Help Screen");
- if (HARDCOPY) {
- togglepr();
- fprintf(stdprn, "\n\n\t\t Display Menu\n\n");
- fprintf(stdprn, "\tA: Go to General Menu\n");
- fprintf(stdprn, "\tB: Go to Help Menu\n");
- fprintf(stdprn, "\tC: Go to Animal Menu\n");
- fprintf(stdprn, "\tD: Go to Cycle Length Menu\n");
- fprintf(stdprn, "\tE: (...Display Menu...)\n");
- fprintf(stdprn, "\tF: Go to Cell Input Menu\n");
- fprintf(stdprn, "\tG: Go to Days Input Menu\n\n");
- fprintf(stdprn, "\tH: Stage Length Data\n");
- fprintf(stdprn, "\tI: Cell Sequence Data\n\n");
- fprintf(stdprn, "\tX: Exit Program\n");
- fprintf(stdprn, "\t?: Show Help Screen\n");
- }
- #else
- printf("\n\n\t\t Display Menu\n\n");
- printf("\tA: Go to General Menu\n");
- printf("\tB: Go to Help Menu\n");
- printf("\tC: Go to Animal Menu\n");
- printf("\tD: Go to Cycle Length Menu\n");
- printf("\tE: (...Display Menu...)\n");
- printf("\tF: Go to Cell Input Menu\n");
- printf("\tG: Go to Days Input Menu\n\n");
- printf("\tH: Stage Length Data\n");
- printf("\tI: Cell Sequence Data\n\n");
- printf("\tX: Exit Program\n");
- printf("\t?: Show Help Screen\n");
- #endif
- if (FILEq && FILECOPY) {
- fprintf(fpout, "\n\n\t\t Display Menu\n\n");
- fprintf(fpout, "\tA: Go to General Menu\n");
- fprintf(fpout, "\tB: Go to Help Menu\n");
- fprintf(fpout, "\tC: Go to Animal Menu\n");
- fprintf(fpout, "\tD: Go to Cycle Length Menu\n");
- fprintf(fpout, "\tE: (...Display Menu...)\n");
- fprintf(fpout, "\tF: Go to Cell Input Menu\n");
- fprintf(fpout, "\tG: Go to Days Input Menu\n\n");
- fprintf(fpout, "\tH: Stage Length Data\n");
- fprintf(fpout, "\tI: Cell Sequence Data\n\n");
- fprintf(fpout, "\tX: Exit Program\n");
- fprintf(fpout, "\t?: Show Help Screen\n");
- }
-
- #if PC
- clrscr1(2);
- cprintf("%sPlease enter your menu choice:", tab);
- gotoxy(1, 2);
- highvideo();
- cprintf("%s%c%c%c ", tab2, HBAR, HBAR, RTRI);
- normvideo();
- val = getusrstr(input);
- if (HARDCOPY) {
- fprintf(stdprn, "\n\tPlease enter your menu choice:\n");
- fprintf(stdprn, "\t\t==> %s", input);
- }
- if (val) return(val);
- #else
- printf("\n\tPlease enter your menu choice:\n");
- printf("\t\t==> ");
- getusrstr(input);
- #endif
- if (FILEq && FILECOPY) {
- fprintf(fpout, "\n\tPlease enter your menu choice:\n");
- fprintf(fpout, "\t\t==> %s", input);
- }
-
- c = input[0];
- switch (toupper1(c)) {
- case 'A': /* goto intro menu */
- return(101);
- case 'B': /* goto help menu */
- return(102);
- case 'C': /* goto animalmenu */
- return(103);
- case 'D': /* goto cycle length menu */
- return(104);
- case 'E': /* stay here at display menu */
- break;
- case 'F': /* go to cell input menu */
- return(105);
- case 'G': /* go to days input menu */
- return(106);
- case 'H':
- if (! printstgdat())
- /* tried to print w/o animal: goto animalmenu */
- return(103);
- #if PC
- else {
- hitreturn(1);
- if (HARDCOPY)
- printstgdatHARD();
- }
- #endif
- break;
- case 'I':
- if (! printseqdat())
- /* tried to print w/o animal: goto animalmenu */
- return(103);
- #if PC
- else {
- hitreturn(1);
- if (HARDCOPY)
- printseqdatHARD();
- }
- #endif
- break;
- case '?': /* show help screen */
- helpdisplaymenu();
- break;
- case 'X': /* Done */
- printexit(33);
- break;
- default:
- #if PC
- clrscr1(3);
- printf("%s%sInvalid choice: <%c>.", tab, ERRSTR, input[0]);
- if (HARDCOPY) {
- togglepr();
- fprintf(stdprn, "\t%sInvalid choice: <%c>.", ERRSTR, input[0]);
- }
- #else
- printf("\t%sInvalid choice: <%c>.", ERRSTR, input[0]);
- #endif
- if (FILEq && FILECOPY)
- fprintf(fpout, "\t%sInvalid choice: <%c>.\n", ERRSTR, input[0]);
- } /* switch */
- } /* while */
- } /* displaymenu */
-
- /********************************/
- /* function: cellmenu */
- /********************************/
- /* prints out the cell menu. doesn't deal with user input,
- this is done in inputs2.c: getusrcells */
- cellmenu ()
- {
- #if PC
- int i;
- #endif
-
- #if PC
- topline(" Cell Input Menu ");
- clrscr1(1);
- normvideo();
- i = 2;
- gotoxy(TAB2, i++);
- cprintf("H: Show Stage Length Data");
- gotoxy(TAB2, i++);
- cprintf("I: Show Cell Sequence Data");
- i = 2;
- gotoxy(TAB1, i++);
- cprintf("A: Go to General Menu");
- gotoxy(TAB1, i++);
- cprintf("B: Go to Help Menu");
- gotoxy(TAB1, i++);
- cprintf("C: Go to Animal Menu");
- gotoxy(TAB1, i++);
- cprintf("D: Go to Cycle Length Menu");
- gotoxy(TAB1, i++);
- cprintf("E: Go to Display Menu");
- gotoxy(TAB1, i++);
- cprintf("F: (...");
- highvideo();
- cprintf("Cell Input Menu");
- normvideo();
- cprintf("...)");
- gotoxy(TAB1, i++);
- cprintf("G: Go to Days Input Menu");
- i++;
- gotoxy(TAB1, i);
- cprintf("X: Exit Program");
- gotoxy(TAB2, i);
- cprintf("?: Show Help Screen");
- if (HARDCOPY) {
- togglepr();
- fprintf(stdprn, "\n\n\t\t Cell Input Menu\n\n");
- fprintf(stdprn, "\tA: Go to General Menu\n");
- fprintf(stdprn, "\tB: Go to Help Menu\n");
- fprintf(stdprn, "\tC: Go to Animal Menu\n");
- fprintf(stdprn, "\tD: Go to Cycle Length Menu\n");
- fprintf(stdprn, "\tE: Go to Display Menu\n");
- fprintf(stdprn, "\tF: (...Cell Input Menu...)\n");
- fprintf(stdprn, "\tG: Go to Days Input Menu\n\n");
- fprintf(stdprn, "\tH: Show Stage Length Data\n");
- fprintf(stdprn, "\tI: Show Cell Sequence Data\n\n");
- fprintf(stdprn, "\tX: Exit Program\n");
- fprintf(stdprn, "\t?: Show Help Screen\n");
- }
- #else
- printf("\n\n\t\t Cell Input Menu\n\n");
- printf("\tA: Go to General Menu\n");
- printf("\tB: Go to Help Menu\n");
- printf("\tC: Go to Animal Menu\n");
- printf("\tD: Go to Cycle Length Menu\n");
- printf("\tE: Go to Display Menu\n");
- printf("\tF: (...Cell Input Menu...)\n");
- printf("\tG: Go to Days Input Menu\n\n");
- printf("\tH: Show Stage Length Data\n");
- printf("\tI: Show Cell Sequence Data\n\n");
- printf("\tX: Exit Program\n");
- printf("\t?: Show Help Screen\n");
- #endif
- if (FILEq && FILECOPY) {
- fprintf(fpout, "\n\n\t\t Cell Input Menu\n\n");
- fprintf(fpout, "\tA: Go to General Menu\n");
- fprintf(fpout, "\tB: Go to Help Menu\n");
- fprintf(fpout, "\tC: Go to Animal Menu\n");
- fprintf(fpout, "\tD: Go to Cycle Length Menu\n");
- fprintf(fpout, "\tE: Go to Display Menu\n");
- fprintf(fpout, "\tF: (...Cell Input Menu...)\n");
- fprintf(fpout, "\tG: Go to Days Input Menu\n\n");
- fprintf(fpout, "\tH: Show Stage Length Data\n");
- fprintf(fpout, "\tI: Show Cell Sequence Data\n\n");
- fprintf(fpout, "\tX: Exit Program\n");
- fprintf(fpout, "\t?: Show Help Screen\n");
- }
- return(0);
- } /* cellmenu */
-
- /********************************/
- /* function: daysmenu */
- /********************************/
- /* prints out the days menu. doesn't deal with user input,
- this is done in inputs.c:getusrcells */
- daysmenu ()
- {
- #if PC
- int i;
- #endif
-
- #if PC
- topline(" Days Input Menu ");
- clrscr1(1);
- normvideo();
- i = 2;
- gotoxy(TAB2, i++);
- cprintf("H: Show Stage Length Data");
- gotoxy(TAB2, i++);
- cprintf("I: Show Cell Sequence Data");
- gotoxy(TAB2, i++);
- cprintf("J: Show Input Cells");
- i = 2;
- gotoxy(TAB1, i++);
- cprintf("A: Go to General Menu");
- gotoxy(TAB1, i++);
- cprintf("B: Go to Help Menu");
- gotoxy(TAB1, i++);
- cprintf("C: Go to Animal Menu");
- gotoxy(TAB1, i++);
- cprintf("D: Go to Cycle Length Menu");
- gotoxy(TAB1, i++);
- cprintf("E: Go to Display Menu");
- gotoxy(TAB1, i++);
- cprintf("F: Go to Cell Input Menu");
- gotoxy(TAB1, i++);
- cprintf("G: (...");
- highvideo();
- cprintf("Days Input Menu");
- normvideo();
- cprintf("...)");
- i++;
- gotoxy(TAB1, i);
- cprintf("X: Exit Program", tab);
- gotoxy(TAB2, i);
- cprintf("?: Show Help Screen", tab);
- if (HARDCOPY) {
- togglepr();
- fprintf(stdprn, "\n\n\t\t Days Input Menu\n\n");
- fprintf(stdprn, "\tA: Go to General Menu\n");
- fprintf(stdprn, "\tB: Go to Help Menu\n");
- fprintf(stdprn, "\tC: Go to Animal Menu\n");
- fprintf(stdprn, "\tD: Go to Cycle Length Menu\n");
- fprintf(stdprn, "\tE: Go to Display Menu\n");
- fprintf(stdprn, "\tF: Go to Cell Input Menu\n");
- fprintf(stdprn, "\tG: (...Days Input Menu...)\n\n");
- fprintf(stdprn, "\tH: Show Stage Length Data\n");
- fprintf(stdprn, "\tI: Show Cell Sequence Data\n");
- fprintf(stdprn, "\tJ: Show Input Cells\n\n");
- fprintf(stdprn, "\tX: Exit Program\n");
- fprintf(stdprn, "\t?: Show Help Screen\n");
- }
- #else
- printf("\n\n\t\t Days Input Menu\n\n");
- printf("\tA: Go to General Menu\n");
- printf("\tB: Go to Help Menu\n");
- printf("\tC: Go to Animal Menu\n");
- printf("\tD: Go to Cycle Length Menu\n");
- printf("\tE: Go to Display Menu\n");
- printf("\tF: Go to Cell Input Menu\n");
- printf("\tG: (...Days Input Menu...)\n\n");
- printf("\tH: Show Stage Length Data\n");
- printf("\tI: Show Cell Sequence Data\n");
- printf("\tJ: Show Input Cells\n\n");
- printf("\tX: Exit Program\n");
- printf("\t?: Show Help Screen\n");
- #endif
- if (FILEq && FILECOPY) {
- fprintf(fpout, "\n\n\t\t Days Input Menu\n\n");
- fprintf(fpout, "\tA: Go to General Menu\n");
- fprintf(fpout, "\tB: Go to Help Menu\n");
- fprintf(fpout, "\tC: Go to Animal Menu\n");
- fprintf(fpout, "\tD: Go to Cycle Length Menu\n");
- fprintf(fpout, "\tE: Go to Display Menu\n");
- fprintf(fpout, "\tF: Go to Cell Input Menu\n");
- fprintf(fpout, "\tG: (...Days Input Menu...)\n\n");
- fprintf(fpout, "\tH: Show Stage Length Data\n");
- fprintf(fpout, "\tI: Show Cell Sequence Data\n");
- fprintf(fpout, "\tJ: Show Input Cells\n\n");
- fprintf(fpout, "\tX: Exit Program\n");
- fprintf(fpout, "\t?: Show Help Screen\n");
- }
- return(0);
- } /* daysmenu */