|
|
1.1 ! root 1: #define y_line_to_pt(val) ((val)*NS + YMARGIN) ! 2: ! 3: #define SETUP_OWN 1 /* owner of setup.h definitions */ ! 4: ! 5: /* entrance to this routine happens when keyboard interrupt handler sees ! 6: a setup key. */ ! 7: #include <jerq.h> ! 8: #include <font.h> ! 9: #include <kbd.h> ! 10: #include <setup.h> ! 11: extern Point cur; /* current cursor position */ ! 12: extern int kbdstatus; ! 13: extern Point pt(); /* converts from row/col to Point */ ! 14: extern aciainit(); ! 15: ! 16: int Pf_edit; /* flag 1= editing pf key 0= in setup options mode */ ! 17: Word setup_space[XMAX/(8*sizeof(Word))][NS*2]; /* space for setup to */ ! 18: /* screenswap to */ ! 19: Bitmap setup_swap = { setup_space, XMAX/(8*sizeof(Word)), ! 20: {{(short) 0, (short) 0},{(short) XMAX,(short) NS*2}}, ! 21: (char *) 0}; ! 22: ! 23: setupdisplay() /* draws the initial setup display, and the current values */ ! 24: { ! 25: Point setupcur; /* save value of terminal cursor during setup */ ! 26: int tmpc; /* temp char value : (int to avoid sgs bug) */ ! 27: int cursindx; /* index into cursor position array */ ! 28: ! 29: /* the setup routines assume a routine called kgetc(), which is */ ! 30: /* equivalent to getc() or kbdchar(), except that it comes straight */ ! 31: /* from the keyboard DUART, not through the queues */ ! 32: ! 33: checkbram(); /* check bram checksum, if bad, set all 0s */ ! 34: setupcur = cur; /* save cursor away */ ! 35: screenswap(&setup_swap,setup_swap.rect, ! 36: Rect(0,y_line_to_pt(ymax+1),XMAX,y_line_to_pt(ymax+3))); ! 37: ! 38: reset_setup: ! 39: clear (Rect(0, ymax+1, xmax+1, ymax+3)); /* might want to use */ ! 40: /* a graypat instead */ ! 41: ! 42: /* NOTE: in layers mode, must do a "top" of the */ ! 43: /* physical setup layer first */ ! 44: /* HMM... TOM, I just realized we really do want to allow */ ! 45: /* interrupts while doing this stuff... otherwise, suppose */ ! 46: /* I hit setup during download, the terminal will never get */ ! 47: /* out of download mode if I take too long setting up */ ! 48: /* are there other UGH problems if the download completes */ ! 49: /* while still in setup mode??? */ ! 50: ! 51: Pf_edit = cur.x = 0; ! 52: cur.y = ymax+1; ! 53: string (&defont, SETUP_HEADINGS, &display, pt(cur), F_STORE); ! 54: cur.y++; ! 55: ! 56: for (cursindx = BAUD; cursindx < NUMOPTS; cursindx++) ! 57: { ! 58: string (&defont, val_indx[cursindx][BRAM->opts.opt_array[cursindx].byte], ! 59: &display, pt(cur), F_STORE); ! 60: cur.x = curpos[cursindx+1]; ! 61: } ! 62: ! 63: cap_setup(); ! 64: num_setup(); ! 65: cur.x = 0; ! 66: cursindx = 0; ! 67: curse(); ! 68: while((tmpc = kgetc()) != SETUPKEY) /* 0xae */ ! 69: { ! 70: switch (tmpc) { ! 71: case TABKEY: ! 72: curse(); /* erase old cursor */ ! 73: cur.x = curpos[(cursindx + 1 >= NUMOPTS ? cursindx : ++cursindx)]; ! 74: curse(); ! 75: break; ! 76: case BACKSPCKEY: ! 77: curse(); /* erase old cursor */ ! 78: cur.x = curpos [(cursindx - 1 < 0 ? 0 : --cursindx)]; ! 79: curse(); ! 80: break; ! 81: case SPACEKEY: ! 82: curse(); /* erase old cursor */ ! 83: if (++BRAM->opts.opt_array[cursindx].byte >= val_maxes[cursindx]) ! 84: BRAM->opts.opt_array[cursindx].byte = 0; ! 85: string (&defont, val_indx[cursindx][BRAM->opts.opt_array[cursindx].byte], &display, pt(cur), F_STORE); ! 86: switch (cursindx){ ! 87: case BAUD: ! 88: aciainit(baud_speeds[VALBAUD]); ! 89: break; ! 90: case RETKEY: ! 91: /* This is examined in vitty.c:main */ ! 92: case NEWLINE: ! 93: /* This is examined in vitty.c:introutine */ ! 94: case DUPLEX: ! 95: /* This is examined in vitty.c:introutine */ ! 96: break; ! 97: case KEYTONE: ! 98: if (VALKEYTONE) ! 99: kbdstatus &= ~TTY_CHIRP; ! 100: else ! 101: kbdstatus |= TTY_CHIRP; ! 102: DUART->b_data = kbdstatus; ! 103: break; ! 104: case SCREENCOLOR: ! 105: if (VALSCREENCOLOR) ! 106: BonW(); ! 107: else ! 108: WonB(); ! 109: break; ! 110: default: ! 111: /* Illegal value, force cursindx to 0 */ ! 112: cursindx = 0; ! 113: break; ! 114: } ! 115: curse(); /* restore cursor */ ! 116: break; ! 117: case FUNC1KEY: case FUNC2KEY: case FUNC3KEY: case FUNC4KEY: ! 118: case FUNC5KEY: case FUNC6KEY: case FUNC7KEY: case FUNC8KEY: ! 119: Pf_edit = 1; ! 120: if (pfkey(tmpc - FUNC1KEY + 1) != SETUPKEY) ! 121: goto reset_setup; ! 122: else /* exit of pfkey mode with setup means quit */ ! 123: goto exit_setup; ! 124: default: ! 125: /* ignore */ ! 126: break; ! 127: } ! 128: } ! 129: exit_setup: /* can jump here from pfkey exit via setupmode key */ ! 130: ! 131: /* restore saved screen values */ ! 132: screenswap(&setup_swap,setup_swap.rect,Rect(0,y_line_to_pt(ymax+1),XMAX,y_line_to_pt(ymax+3))); ! 133: /* ! 134: * fix caps lock label ! 135: */ ! 136: caps_msg(); ! 137: num_msg(); ! 138: cur = setupcur; /* restore cursor value */ ! 139: setbram(); /* reset checksum value in BRAM */ ! 140: } ! 141: ! 142: caps_msg() ! 143: { ! 144: Point ncur; ! 145: int mode; ! 146: ! 147: if(VALDWNLDFLAG) ! 148: return; /* a program is downloaded so don't show the message */ ! 149: mode = (VALCAPS ? F_STORE : F_CLR); ! 150: ncur.x = 25; ! 151: ncur.y = ymax+1; ! 152: string(&defont, "caps", &display, pt(ncur), mode); ! 153: ncur.y = ymax+2; ! 154: string(&defont, "lock", &display, pt(ncur), mode); ! 155: } ! 156: num_msg() ! 157: { ! 158: Point ncur; ! 159: int mode; ! 160: ! 161: if(VALDWNLDFLAG) ! 162: return; /* a program is downloaded so don't show message */ ! 163: mode = (VALNUM ? F_STORE : F_CLR); ! 164: ncur.x = 44; ! 165: ncur.y = ymax+1; ! 166: string(&defont, "num", &display, pt(ncur), mode); ! 167: ncur.y = ymax+2; ! 168: string(&defont, "lock", &display, pt(ncur), mode); ! 169: } ! 170: ! 171: cap_setup() ! 172: { ! 173: Point ncur; ! 174: ! 175: if(Pf_edit) ! 176: return; ! 177: ncur.x = 64; ! 178: ncur.y = ymax+2; ! 179: string(&defont,"CAPS LOCK",&display,pt(ncur),(VALCAPS ? F_STORE : F_CLR)); ! 180: } ! 181: ! 182: num_setup() ! 183: { ! 184: Point ncur; ! 185: ! 186: if(Pf_edit) ! 187: return; ! 188: ncur.x = 77; ! 189: ncur.y = ymax + 2; ! 190: string(&defont,"NUM LOCK", &display, pt(ncur), (VALNUM ? F_STORE : F_CLR)); ! 191: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.