home *** CD-ROM | disk | FTP | other *** search
- #include "header.h"
- #include "file.h"
-
- /************************************************************************/
- /** PC screen functions **/
- /************************************************************************/
- #if PC
- /* NB: this code will only work on IBM PCs and compatibles.
- "gotoxy, "window", "wherex" and "wherey"
- are not standard C, they are features of Turbo-C only. */
-
- /********************************/
- /* function: wholewin */
- /********************************/
- /* returns whole screen to one window */
- wholewin ()
- {
- /* whole screen is 80 cols, 25 lines */
- window(1, 1, 80, 25);
- return(0);
- } /* wholewin */
-
- /********************************/
- /* function: makedisplay */
- /********************************/
- /* makes border around screen, sets up initial windows */
- makedisplay ()
- {
- /* clear screen */
- wholewin();
- clrscr();
- /* make borders */
- botline();
- leftside();
- rightside();
- topline("");
-
- /* set up windows */
- outputwin();
- sep1win();
- inputwin();
- sep2win();
- msgwin();
- col80win(); /* erases chars in 80th col */
- funcline();
- return(0);
- } /* makedisplay */
-
- /********************************/
- /* function: outputwin */
- /********************************/
- /* makes output window */
- outputwin ()
- {
- window(2, OUTPUTTOP, 79, OUTPUTBOT);
- return(0);
- } /* outputwin */
-
- /********************************/
- /* function: sep1win */
- /********************************/
- /* makes first separation window (line of =s)
- also prints cycle length anunciator */
- sep1win ()
- {
- int i;
-
- window(2, SEP1LN, 79, SEP1LN);
- for ( i=1; i<79; i++ ) {
- gotoxy(i, 1);
- putchar(HBAR);
- }
- gotoxy(52, 1);
- cprintf(" Current Cycle=%.2lf days ", CycleTime);
- normvideo();
- return(0);
- } /* sep1win */
-
- /********************************/
- /* function: msgwin */
- /********************************/
- /* makes messages window */
- msgwin ()
- {
- window(2, MSGTOP, 79, MSGBOT);
- return(0);
- } /* msgwin */
-
- /********************************/
- /* function: sep2win */
- /********************************/
- /* makes second separation window (line of =s) */
- sep2win ()
- {
- int i;
-
- window(2, SEP2LN, 79, SEP2LN);
- for ( i=1; i<79; i++ ) {
- gotoxy(i, 1);
- putchar(HBAR);
- }
- normvideo();
- return(0);
- } /* sep2win */
-
- /********************************/
- /* function: inputwin */
- /********************************/
- /* makes input window: bottom 5 lines */
- inputwin ()
- {
- window(2, INPUTTOP, 79, INPUTBOT);
- return(0);
- } /* inputwin */
-
- /********************************/
- /* function: topline */
- /********************************/
- /* makes border top line, puts "str" on it
- (a menu name) */
- topline (str)
- char *str; /* menu label */
- {
- int i, len;
-
- window(2, 1, 79, 1);
- highvideo();
- for ( i=1; i<79; i++ ) {
- gotoxy(i, 1);
- putchar(HBAR);
- }
- highvideo();
- if (strlen(str)) {
- gotoxy(3, 1);
- cprintf("%s", str);
- }
- len = strlen(" ANIMAL: ") + strlen(Animal) + 1;
- gotoxy(76-len, 1);
- cprintf(" ANIMAL: %s ", Animal);
- normvideo();
- return(0);
- } /* topline */
-
- /********************************/
- /* function: botline */
- /********************************/
- /* makes border bottom line, with annunciators:
- left: file status right: version */
- botline ()
- {
- int i;
-
- window(2, 24, 79, 24);
- for ( i=1; i<79; i++ ) {
- gotoxy(i, 1);
- putchar(HBAR);
- }
- highvideo();
- gotoxy(4, 1);
- if (FILEq && FILECOPY) {
- cprintf("FILE: On");
- normvideo();
- putchar(HBAR);
- } else {
- cprintf("FILE: Off");
- }
- gotoxy(72, 1);
- cprintf("%s", VERSION);
- /* took out this annunciator: F8 is just print screen,
- a user would never leave the printer on for a whole session!
- gotoxy(67, 1);
- if (HARDCOPY) {
- cprintf("PRINT: On");
- normvideo();
- putchar(HBAR);
- } else {
- cprintf("PRINT: Off");
- }
- */
- normvideo();
- return(0);
- } /* botline */
-
- /********************************/
- /* function: leftside */
- /********************************/
- /* makes border left side */
- leftside ()
- {
- int i;
-
- window(1, 1, 1, 24);
- for ( i=2; i<24; i++ ) {
- gotoxy(1, i);
- putchar(VBAR);
- }
- gotoxy(1, 1);
- putchar(LTOP);
- gotoxy(1, 16);
- putchar(LTEE);
- gotoxy(1, 20);
- putchar(LTEE);
- gotoxy(1, 24);
- putchar(LBOT);
- normvideo();
- return(0);
- } /* leftside */
-
- /********************************/
- /* function: rightside */
- /********************************/
- /* makes border right side */
- rightside ()
- {
- int i;
-
- window(79, 1, 79, 24);
- for ( i=2; i<24; i++ ) {
- gotoxy(1, i);
- putchar(VBAR);
- }
- gotoxy(1, 1);
- putchar(RTOP);
- gotoxy(1, 16);
- putchar(RTEE);
- gotoxy(1, 20);
- putchar(RTEE);
- gotoxy(1, 24);
- putchar(RBOT);
- normvideo();
- return(0);
- } /* rightside */
-
- /********************************/
- /* function: col80win */
- /********************************/
- /* the 80th col that isn't used */
- col80win ()
- {
- int i;
-
- window(80, 1, 80, 24);
- for ( i=0; i<24; i++ ){
- gotoxy(1, i);
- cprintf(" ");
- }
- return(0);
- } /* col80win */
-
- /********************************/
- /* function: funcline */
- /********************************/
- /* displays active F-keys and ESC */
- funcline ()
- {
- window(1, 25, 79, 25);
-
- highvideo();
- gotoxy(1, 1);
- cprintf("F1:");
- normvideo();
- cprintf("Gen");
-
- highvideo();
- gotoxy(8, 1);
- cprintf("F2:");
- normvideo();
- cprintf("Help");
-
- highvideo();
- gotoxy(16, 1);
- cprintf("F3:");
- normvideo();
- cprintf("Animl");
-
- highvideo();
- gotoxy(25, 1);
- cprintf("F4:");
- normvideo();
- cprintf("Cycl");
-
- highvideo();
- gotoxy(33, 1);
- cprintf("F5:");
- normvideo();
- cprintf("Cell");
-
- highvideo();
- gotoxy(41, 1);
- cprintf("F6:");
- normvideo();
- cprintf("Day");
-
- highvideo();
- gotoxy(48, 1);
- cprintf("F7:");
- normvideo();
- cprintf("File");
-
- highvideo();
- gotoxy(56, 1);
- cprintf("F8:");
- normvideo();
- cprintf("PSc");
-
- highvideo();
- gotoxy(63, 1);
- cprintf("F9:");
- normvideo();
- cprintf("Rfsh");
-
- highvideo();
- gotoxy(71, 1);
- cprintf("F10:");
- normvideo();
- cprintf("Exit");
- return(0);
- } /* funcline */
-
- /********************************/
- /* function: makeactivewin */
- /********************************/
- /* makes a given window active
- 1 = output window, 2 = input window, 3 = message window */
- makeactivewin (win)
- int win;
- {
- switch (win) {
- case 1:
- outputwin();
- break;
- case 2:
- inputwin();
- break;
- case 3:
- msgwin();
- break;
- default: /* shouldn't! */
- msgwin();
- clrscr();
- rightside();
- outputwin();
- gotoxy(1, 5);
- cprintf("%s<makeactivewin>: Internal error, win=%d", tab2, win);
- gotoxy(1, 7);
- cprintf("%s Sorry, aborting.", tab2);
- printexit(18);
- } /* switch */
- return(0);
- } /* makeactivewin */
-
- /********************************/
- /* function: clrscr1 */
- /********************************/
- /* clears a window, then redraws the right border */
- clrscr1 (win)
- int win; /* code for window we came from */
- {
- switch (win) {
- case 1:
- outputwin();
- break;
- case 2:
- inputwin();
- break;
- case 3:
- msgwin();
- break;
- default: /* shouldn't! */
- break;
- } /* switch */
- clrscr();
- rightside();
- makeactivewin(win);
- gotoxy(1, 1);
- return(0);
- } /* clrscr1 */
-
- /********************************/
- /* function: clreol1 */
- /********************************/
- /* clears a line to eol, then redraws the right border */
- clreol1 (win)
- int win; /* code for window we came from */
- {
- clreol();
- rightside();
- makeactivewin(win);
- return(0);
- } /* clreol1 */
-
- #endif