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