[f40a309] | 1 | /*
|
---|
| 2 | =============================================================================
|
---|
| 3 | curset.c -- cursor control and data entry parameter setup
|
---|
| 4 | Version 14 -- 1988-12-13 -- D.N. Lynx Crowe
|
---|
| 5 | =============================================================================
|
---|
| 6 | */
|
---|
| 7 |
|
---|
| 8 | #define DEBUGIT 0
|
---|
| 9 |
|
---|
| 10 | #include "stddefs.h"
|
---|
| 11 | #include "fields.h"
|
---|
| 12 | #include "vsdd.h"
|
---|
| 13 | #include "graphdef.h"
|
---|
| 14 | #include "curpak.h"
|
---|
| 15 |
|
---|
| 16 | #include "midas.h"
|
---|
| 17 |
|
---|
| 18 | #if DEBUGIT
|
---|
| 19 | extern short debugsw;
|
---|
| 20 |
|
---|
| 21 | short debugcs = 1;
|
---|
| 22 |
|
---|
| 23 | char *C_TYPE[] = {
|
---|
| 24 |
|
---|
| 25 | "CT_GRAF", /* 0 graphics */
|
---|
| 26 | "CT_TEXT", /* 1 text -- general */
|
---|
| 27 | "CT_VIRT", /* 2 virtual -- graphic */
|
---|
| 28 | "CT_SCOR", /* 3 text -- score */
|
---|
| 29 | "CT_SMTH", /* 4 text -- smooth scroll */
|
---|
| 30 | "CT_MENU" /* 5 virtual -- character */
|
---|
| 31 | };
|
---|
| 32 | #endif
|
---|
| 33 |
|
---|
| 34 | short trkonly = FALSE; /* set TRUE to force use of trackball */
|
---|
| 35 |
|
---|
[0580615] | 36 | extern void txstd(void);
|
---|
| 37 | extern void tystd(void);
|
---|
| 38 | extern void cmvgen(void);
|
---|
[f40a309] | 39 |
|
---|
[0c834c5] | 40 | extern void (*curmove)(void);
|
---|
| 41 | extern short (*curtype)(void);
|
---|
| 42 | extern void (*cx_key)(void);
|
---|
| 43 | extern void (*cx_upd)(void);
|
---|
| 44 | extern void (*cy_key)(void);
|
---|
| 45 | extern void (*cy_upd)(void);
|
---|
[60288f5] | 46 | extern void (*d_key)(short k);
|
---|
[0c834c5] | 47 | extern void (*e_key)(void);
|
---|
| 48 | extern void (*m_key)(void);
|
---|
[60288f5] | 49 | extern short (*not_fld)(short k);
|
---|
[0c834c5] | 50 | extern void (*premove)(void);
|
---|
| 51 | extern void (*pstmove)(void);
|
---|
| 52 | extern void (*x_key)(void);
|
---|
| 53 | extern void (*xy_dn)(void);
|
---|
| 54 | extern void (*xy_up)(void);
|
---|
[f40a309] | 55 |
|
---|
| 56 | extern short *cratex;
|
---|
| 57 | extern short *cratey;
|
---|
| 58 |
|
---|
| 59 | /* |
---|
| 60 |
|
---|
| 61 | */
|
---|
| 62 |
|
---|
| 63 | extern short chtime;
|
---|
| 64 | extern short chwait;
|
---|
| 65 | extern short cmfirst;
|
---|
| 66 | extern short cmtype;
|
---|
| 67 | extern short curhold;
|
---|
| 68 | extern short curslim;
|
---|
| 69 | extern short cvtime;
|
---|
| 70 | extern short cvwait;
|
---|
| 71 | extern short cxval;
|
---|
| 72 | extern short cyval;
|
---|
| 73 | extern short hcwval;
|
---|
| 74 | extern short nchwait;
|
---|
| 75 | extern short ncvwait;
|
---|
| 76 | extern short stccol;
|
---|
| 77 | extern short stcrow;
|
---|
| 78 | extern short submenu;
|
---|
| 79 | extern short syrate;
|
---|
| 80 | extern short thcwval;
|
---|
| 81 | extern short tvcwval;
|
---|
| 82 | extern short vcwval;
|
---|
| 83 |
|
---|
| 84 | extern struct fet *infetp;
|
---|
| 85 | extern struct fet *cfetp;
|
---|
| 86 | extern struct fet *curfet;
|
---|
| 87 |
|
---|
| 88 | extern struct selbox *csbp;
|
---|
| 89 |
|
---|
| 90 | /* |
---|
| 91 |
|
---|
| 92 | */
|
---|
| 93 |
|
---|
| 94 | #if DEBUGIT
|
---|
| 95 |
|
---|
| 96 | /*
|
---|
| 97 | =============================================================================
|
---|
| 98 | SnapCT() -- snap dump curpak variables
|
---|
| 99 | =============================================================================
|
---|
| 100 | */
|
---|
| 101 |
|
---|
| 102 | SnapCT()
|
---|
| 103 | {
|
---|
| 104 | printf("\ncurpak variables:\n");
|
---|
| 105 | printf(" curtype = $%lX\n", curtype);
|
---|
| 106 | printf(" premove = $%lX\n", premove);
|
---|
| 107 | printf(" pstmove = $%lX\n", pstmove);
|
---|
| 108 | printf(" cx_key = $%lX\n", cx_key);
|
---|
| 109 | printf(" cy_key = $%lX\n", cy_key);
|
---|
| 110 | printf(" cx_upd = $%lX\n", cx_upd);
|
---|
| 111 | printf(" cy_upd = $%lX\n", cy_upd);
|
---|
| 112 | printf(" xy_up = $%lX\n", xy_up);
|
---|
| 113 | printf(" xy_dn = $%lX\n", xy_dn);
|
---|
| 114 | printf(" x_key = $%lX\n", x_key);
|
---|
| 115 | printf(" e_key = $%lX\n", e_key);
|
---|
| 116 | printf(" m_key = $%lX\n", m_key);
|
---|
| 117 | printf(" d_key = $%lX\n", d_key);
|
---|
| 118 | printf(" not_fld = $%lX\n", not_fld);
|
---|
| 119 | printf(" curfet = $%lX\n", curfet);
|
---|
| 120 | printf(" csbp = $%lX\n", csbp);
|
---|
| 121 | printf(" cratex = $%lX\n", cratex);
|
---|
| 122 | printf(" cratey = $%lX\n", cratey);
|
---|
| 123 | printf(" cmtype = %d\n", cmtype);
|
---|
| 124 | printf(" cxval = %d\n", cxval);
|
---|
| 125 | printf(" cyval = %d\n", cyval);
|
---|
| 126 | printf("\n");
|
---|
| 127 | }
|
---|
| 128 |
|
---|
| 129 | #endif
|
---|
| 130 |
|
---|
| 131 | /* |
---|
| 132 |
|
---|
| 133 | */
|
---|
| 134 |
|
---|
| 135 | /*
|
---|
| 136 | =============================================================================
|
---|
| 137 | stdctp0() -- cursor type - text, virtual
|
---|
[0580615] | 138 | =============================================================================
|
---|
[f40a309] | 139 | */
|
---|
| 140 |
|
---|
| 141 | short stdctp0(void)
|
---|
| 142 | {
|
---|
| 143 | return(submenu ? CT_VIRT : CT_TEXT);
|
---|
| 144 | }
|
---|
| 145 |
|
---|
| 146 | /*
|
---|
| 147 | =============================================================================
|
---|
| 148 | stdctp1() -- cursor type -- graphic, text, virtual -- text if > curslim
|
---|
[0580615] | 149 | =============================================================================
|
---|
[f40a309] | 150 | */
|
---|
| 151 |
|
---|
| 152 | short stdctp1(void)
|
---|
| 153 | {
|
---|
| 154 | if (submenu)
|
---|
| 155 | return(CT_VIRT);
|
---|
| 156 |
|
---|
| 157 | return((cyval > curslim) ? CT_TEXT : CT_GRAF);
|
---|
| 158 | }
|
---|
| 159 |
|
---|
| 160 | /*
|
---|
| 161 | =============================================================================
|
---|
| 162 | stdctp2() -- cursor type -- graphic
|
---|
[0580615] | 163 | =============================================================================
|
---|
[f40a309] | 164 | */
|
---|
| 165 |
|
---|
| 166 | short stdctp2(void)
|
---|
| 167 | {
|
---|
| 168 | return(CT_GRAF);
|
---|
| 169 | }
|
---|
| 170 |
|
---|
| 171 | /* |
---|
| 172 |
|
---|
| 173 | */
|
---|
| 174 |
|
---|
| 175 | /*
|
---|
| 176 | =============================================================================
|
---|
[0580615] | 177 | stdctp3() -- cursor type -- graphic, score text, virtual
|
---|
[f40a309] | 178 | =============================================================================
|
---|
| 179 | */
|
---|
| 180 |
|
---|
| 181 | short stdctp3(void)
|
---|
| 182 | {
|
---|
| 183 | if (submenu)
|
---|
| 184 | return(CT_VIRT);
|
---|
| 185 |
|
---|
| 186 | return(((cyval < 14) OR (cyval > 237)) ? CT_SCOR : CT_GRAF);
|
---|
| 187 | }
|
---|
| 188 |
|
---|
| 189 | /*
|
---|
| 190 | =============================================================================
|
---|
[0580615] | 191 | stdctp4() -- cursor type -- graphic, text, virtual -- text if < curslim
|
---|
[f40a309] | 192 | =============================================================================
|
---|
| 193 | */
|
---|
| 194 |
|
---|
| 195 | short stdctp4(void)
|
---|
| 196 | {
|
---|
| 197 | if (submenu)
|
---|
| 198 | return(CT_VIRT);
|
---|
| 199 |
|
---|
| 200 | return((cyval < curslim) ? CT_TEXT : CT_GRAF);
|
---|
| 201 | }
|
---|
| 202 |
|
---|
| 203 | /*
|
---|
| 204 | =============================================================================
|
---|
[0580615] | 205 | stdctp5() -- cursor type - text, virtual - character objects
|
---|
[f40a309] | 206 | =============================================================================
|
---|
| 207 | */
|
---|
| 208 |
|
---|
| 209 | short stdctp5(void)
|
---|
| 210 | {
|
---|
| 211 | return(submenu ? CT_MENU : CT_SMTH);
|
---|
| 212 | }
|
---|
| 213 |
|
---|
| 214 | /* |
---|
| 215 |
|
---|
| 216 | */
|
---|
| 217 |
|
---|
| 218 | /*
|
---|
[0580615] | 219 | =============================================================================
|
---|
[f40a309] | 220 | curset() -- setup the cursor control and data entry parameters
|
---|
| 221 | =============================================================================
|
---|
| 222 | */
|
---|
| 223 |
|
---|
| 224 | void curset(struct curpak *s)
|
---|
| 225 | {
|
---|
| 226 | #if DEBUGIT
|
---|
| 227 | if (debugsw AND debugcs)
|
---|
| 228 | printf("curset($%lX): ENTRY old cmtype=%d\n", s, cmtype);
|
---|
| 229 | #endif
|
---|
| 230 |
|
---|
| 231 | curtype = s->curtype;
|
---|
| 232 | premove = s->premove;
|
---|
| 233 | pstmove = s->pstmove;
|
---|
| 234 |
|
---|
| 235 | curmove = cmvgen;
|
---|
| 236 |
|
---|
| 237 | if (trkonly) {
|
---|
| 238 |
|
---|
| 239 | cx_key = txstd;
|
---|
| 240 | cy_key = tystd;
|
---|
| 241 |
|
---|
| 242 | } else {
|
---|
| 243 |
|
---|
| 244 | cx_key = s->cx_key;
|
---|
| 245 | cy_key = s->cy_key;
|
---|
| 246 | }
|
---|
| 247 |
|
---|
| 248 | cx_upd = s->cx_upd;
|
---|
| 249 | cy_upd = s->cy_upd;
|
---|
| 250 | xy_up = s->xy_up;
|
---|
| 251 | xy_dn = s->xy_dn;
|
---|
| 252 | x_key = s->x_key;
|
---|
| 253 | e_key = s->e_key;
|
---|
| 254 | m_key = s->m_key;
|
---|
| 255 | d_key = s->d_key;
|
---|
| 256 | not_fld = s->not_fld;
|
---|
| 257 | curfet = s->curfet;
|
---|
| 258 | csbp = s->csbp;
|
---|
| 259 | cratex = s->cratex;
|
---|
| 260 | cratey = s->cratey;
|
---|
| 261 | cmtype = s->cmtype;
|
---|
| 262 | cxval = s->cxval;
|
---|
| 263 | cyval = s->cyval;
|
---|
| 264 |
|
---|
| 265 | #if DEBUGIT
|
---|
| 266 | if (debugsw AND debugcs)
|
---|
| 267 | printf("curset($%lX): new cmtype=%d\n", s, cmtype);
|
---|
| 268 | #endif
|
---|
| 269 |
|
---|
| 270 | /* |
---|
| 271 |
|
---|
| 272 | */
|
---|
| 273 | if (cmtype EQ CT_GRAF) { /* graphics */
|
---|
| 274 |
|
---|
| 275 | chtime = hcwval;
|
---|
| 276 | cvtime = vcwval;
|
---|
| 277 |
|
---|
| 278 | } else { /* text of some sort */
|
---|
| 279 |
|
---|
| 280 | chtime = thcwval;
|
---|
| 281 | cvtime = (cmtype EQ CT_SMTH) ? syrate : tvcwval;
|
---|
| 282 | }
|
---|
| 283 |
|
---|
| 284 | stccol = XTOC(cxval);
|
---|
| 285 | stcrow = YTOR(cyval);
|
---|
| 286 |
|
---|
| 287 | chwait = chtime;
|
---|
| 288 | cvwait = cvtime;
|
---|
| 289 |
|
---|
| 290 | nchwait = curhold;
|
---|
| 291 | ncvwait = curhold;
|
---|
| 292 |
|
---|
| 293 | cmfirst = TRUE;
|
---|
| 294 |
|
---|
| 295 | ebflag = FALSE;
|
---|
| 296 | memset(ebuf, '\0', sizeof ebuf);
|
---|
| 297 |
|
---|
| 298 | cfetp = (struct fet *)NULL;
|
---|
| 299 | infetp = (struct fet *)NULL;
|
---|
| 300 |
|
---|
| 301 | #if DEBUGIT
|
---|
| 302 | if (debugsw AND debugcs) {
|
---|
| 303 |
|
---|
| 304 | printf("curset($%lX): EXIT cmtype=%d=%s chtime=%d cvtime=%d curhold=%d\n",
|
---|
| 305 | s, cmtype,
|
---|
| 306 | (cmtype < 6) ? C_TYPE[cmtype] : "UNKNOWN",
|
---|
| 307 | chtime, cvtime, curhold);
|
---|
| 308 |
|
---|
| 309 | SnapCT();
|
---|
| 310 | }
|
---|
| 311 | #endif
|
---|
| 312 |
|
---|
| 313 | }
|
---|