| 1 | /*
 | 
|---|
| 2 |    =============================================================================
 | 
|---|
| 3 |         sqfield.c -- MIDAS-VII sequence display field functions
 | 
|---|
| 4 |         Version 9 -- 1989-11-16 -- D.N. Lynx Crowe
 | 
|---|
| 5 |    =============================================================================
 | 
|---|
| 6 | */
 | 
|---|
| 7 | 
 | 
|---|
| 8 | #define DEBUGIT         0
 | 
|---|
| 9 | 
 | 
|---|
| 10 | #include "all.h"
 | 
|---|
| 11 | 
 | 
|---|
| 12 | #if     DEBUGIT
 | 
|---|
| 13 | extern  short   debugsw;
 | 
|---|
| 14 | 
 | 
|---|
| 15 | short   debugqf = 1;
 | 
|---|
| 16 | #endif
 | 
|---|
| 17 | 
 | 
|---|
| 18 | extern  void    (*xy_up)(void);
 | 
|---|
| 19 | extern  void    (*xy_dn)(void);
 | 
|---|
| 20 | extern  void    (*premove)(void);
 | 
|---|
| 21 | extern  void    (*pstmove)(void);
 | 
|---|
| 22 | extern  int16_t (*curtype)(void);
 | 
|---|
| 23 | 
 | 
|---|
| 24 | extern  void    select(void);
 | 
|---|
| 25 | extern  void    nokey(void);
 | 
|---|
| 26 | extern  int16_t nonf(int16_t k);
 | 
|---|
| 27 | extern  int16_t stdctp5(void);
 | 
|---|
| 28 | extern  void    cxkstd(void);
 | 
|---|
| 29 | extern  void    cykstd(void);
 | 
|---|
| 30 | extern  void    stdmkey(void);
 | 
|---|
| 31 | extern  void    stddkey(int16_t k);
 | 
|---|
| 32 | extern  void    stopsm(void);
 | 
|---|
| 33 | extern  void    smxupd(void);
 | 
|---|
| 34 | extern  void    sqyupd(void);
 | 
|---|
| 35 | extern  void    postcm(void);
 | 
|---|
| 36 | 
 | 
|---|
| 37 | extern  int16_t astat;
 | 
|---|
| 38 | extern  int16_t cmfirst;
 | 
|---|
| 39 | extern  int16_t cmtype;
 | 
|---|
| 40 | extern  int16_t curhold;
 | 
|---|
| 41 | extern  int16_t curslin;
 | 
|---|
| 42 | extern  int16_t cvtime;
 | 
|---|
| 43 | extern  int16_t cvwait;
 | 
|---|
| 44 | extern  int16_t ncvwait;
 | 
|---|
| 45 | extern  int16_t sqdeflg;
 | 
|---|
| 46 | extern  int16_t stccol;
 | 
|---|
| 47 | extern  int16_t ss_ptsw;
 | 
|---|
| 48 | extern  int16_t ss_sqsw;
 | 
|---|
| 49 | extern  int16_t syrate;
 | 
|---|
| 50 | extern  int16_t tvcwval;
 | 
|---|
| 51 | extern  int16_t vcwval;
 | 
|---|
| 52 | 
 | 
|---|
| 53 | extern  int16_t crate1[];
 | 
|---|
| 54 | 
 | 
|---|
| 55 | extern  struct  selbox  *csbp;
 | 
|---|
| 56 | extern  struct  selbox  sqboxes[];
 | 
|---|
| 57 | 
 | 
|---|
| 58 | extern  struct  seqent  seqbuf;
 | 
|---|
| 59 | 
 | 
|---|
| 60 | extern  int8_t  sqdebuf[];
 | 
|---|
| 61 | 
 | 
|---|
| 62 | void    sqxkey(void);
 | 
|---|
| 63 | void    sqekey(void);
 | 
|---|
| 64 | void    sqmkey(void);
 | 
|---|
| 65 | void    sqdkey(int16_t k);
 | 
|---|
| 66 | 
 | 
|---|
| 67 | extern  void curset(struct curpak *s);
 | 
|---|
| 68 | extern  void dcursq(void);
 | 
|---|
| 69 | extern  void dsqlin(int8_t *buf, int16_t slin);
 | 
|---|
| 70 | 
 | 
|---|
| 71 | /*  | 
|---|
| 72 | 
 | 
|---|
| 73 | */
 | 
|---|
| 74 | 
 | 
|---|
| 75 | struct curpak sq_flds = {
 | 
|---|
| 76 | 
 | 
|---|
| 77 |         stdctp5,                /* curtype */
 | 
|---|
| 78 |         nokey,                  /* premove */
 | 
|---|
| 79 |         postcm,                 /* pstmove */
 | 
|---|
| 80 |         cxkstd,                 /* cx_key */
 | 
|---|
| 81 |         cykstd,                 /* cy_key */
 | 
|---|
| 82 |         smxupd,                 /* cx_upd */
 | 
|---|
| 83 |         sqyupd,                 /* cy_upd */
 | 
|---|
| 84 |         stopsm,                 /* xy_up */
 | 
|---|
| 85 |         nokey,                  /* xy_dn */
 | 
|---|
| 86 |         sqxkey,                 /* x_key */
 | 
|---|
| 87 |         sqekey,                 /* e_key */
 | 
|---|
| 88 |         sqmkey,                 /* m_key */
 | 
|---|
| 89 |         sqdkey,                 /* d_key */
 | 
|---|
| 90 |         nonf,                   /* not_fld */
 | 
|---|
| 91 |         (struct fet *)NULL,     /* curfet */
 | 
|---|
| 92 |         sqboxes,                /* csbp */
 | 
|---|
| 93 |         crate1,                 /* cratex */
 | 
|---|
| 94 |         crate1,                 /* cratey */
 | 
|---|
| 95 |         CT_SMTH,                /* cmtype */
 | 
|---|
| 96 |         CTOX(2),                /* cxval */
 | 
|---|
| 97 |         RTOY(DATAROW)           /* cyval */
 | 
|---|
| 98 | };
 | 
|---|
| 99 | 
 | 
|---|
| 100 | /*  | 
|---|
| 101 | 
 | 
|---|
| 102 | */
 | 
|---|
| 103 | 
 | 
|---|
| 104 | /*
 | 
|---|
| 105 |    =============================================================================
 | 
|---|
| 106 |         sqmkey() -- M key processing for the sequence display
 | 
|---|
| 107 |    =============================================================================
 | 
|---|
| 108 | */
 | 
|---|
| 109 | 
 | 
|---|
| 110 | void sqmkey(void)
 | 
|---|
| 111 | {
 | 
|---|
| 112 |         register int16_t nc;
 | 
|---|
| 113 | 
 | 
|---|
| 114 |         if (astat) {
 | 
|---|
| 115 | 
 | 
|---|
| 116 |                 if (stccol EQ 48) {
 | 
|---|
| 117 | 
 | 
|---|
| 118 |                         if (ss_ptsw EQ 0) {
 | 
|---|
| 119 | 
 | 
|---|
| 120 |                                 (*xy_dn)();             /* handle KEY_DOWN functions */
 | 
|---|
| 121 | 
 | 
|---|
| 122 |                                 (*premove)();           /* handle PRE-MOVE functions */
 | 
|---|
| 123 | 
 | 
|---|
| 124 |                                 nc = (*curtype)();      /* get new CURSOR TYPE wanted */
 | 
|---|
| 125 | 
 | 
|---|
| 126 |                                 cvtime  = syrate;
 | 
|---|
| 127 |                                 ncvwait = curhold;
 | 
|---|
| 128 | 
 | 
|---|
| 129 |                                 ss_sqsw = -1;
 | 
|---|
| 130 |                                 cmtype  = nc;
 | 
|---|
| 131 |                                 cvwait  = 1;
 | 
|---|
| 132 |                         }
 | 
|---|
| 133 | 
 | 
|---|
| 134 |                 } else
 | 
|---|
| 135 |                         stdmkey();
 | 
|---|
| 136 | 
 | 
|---|
| 137 |         } else {
 | 
|---|
| 138 | 
 | 
|---|
| 139 |                 if (stccol EQ 48) {
 | 
|---|
| 140 | 
 | 
|---|
| 141 |                         ss_sqsw = 0;
 | 
|---|
| 142 |                         cvwait  = 1;
 | 
|---|
| 143 |                         ncvwait = cvtime;
 | 
|---|
| 144 |                         cmfirst = TRUE;
 | 
|---|
| 145 | 
 | 
|---|
| 146 |                         if (ss_ptsw EQ 0)
 | 
|---|
| 147 |                                 (*xy_up)();
 | 
|---|
| 148 | 
 | 
|---|
| 149 |                         (*pstmove)();           /* handle POST-MOVE functions */
 | 
|---|
| 150 | 
 | 
|---|
| 151 |                 } else
 | 
|---|
| 152 |                         stdmkey();
 | 
|---|
| 153 |         }
 | 
|---|
| 154 | }
 | 
|---|
| 155 | 
 | 
|---|
| 156 | /*  | 
|---|
| 157 | 
 | 
|---|
| 158 | */
 | 
|---|
| 159 | 
 | 
|---|
| 160 | /*
 | 
|---|
| 161 |    =============================================================================
 | 
|---|
| 162 |         sqekey() -- E key processing for the sequence display
 | 
|---|
| 163 |    =============================================================================
 | 
|---|
| 164 | */
 | 
|---|
| 165 | 
 | 
|---|
| 166 | void sqekey(void)
 | 
|---|
| 167 | {
 | 
|---|
| 168 |         register int16_t nc;
 | 
|---|
| 169 | 
 | 
|---|
| 170 |         if (astat) {
 | 
|---|
| 171 | 
 | 
|---|
| 172 |                 if (stccol EQ 48) {
 | 
|---|
| 173 | 
 | 
|---|
| 174 |                         if (ss_ptsw EQ 0) {
 | 
|---|
| 175 | 
 | 
|---|
| 176 |                                 (*xy_dn)();             /* handle KEY_DOWN functions */
 | 
|---|
| 177 | 
 | 
|---|
| 178 |                                 (*premove)();           /* handle PRE-MOVE functions */
 | 
|---|
| 179 | 
 | 
|---|
| 180 |                                 nc = (*curtype)();      /* get new CURSOR TYPE wanted */
 | 
|---|
| 181 | 
 | 
|---|
| 182 |                                 cvtime  = syrate;
 | 
|---|
| 183 |                                 ncvwait = curhold;
 | 
|---|
| 184 | 
 | 
|---|
| 185 |                                 ss_sqsw = 1;
 | 
|---|
| 186 |                                 cmtype  = nc;
 | 
|---|
| 187 |                                 cvwait  = 1;
 | 
|---|
| 188 |                         }
 | 
|---|
| 189 | 
 | 
|---|
| 190 |                 } else
 | 
|---|
| 191 |                         select();
 | 
|---|
| 192 | 
 | 
|---|
| 193 |         } else {
 | 
|---|
| 194 | 
 | 
|---|
| 195 |                 if (stccol EQ 48) {
 | 
|---|
| 196 | 
 | 
|---|
| 197 |                         ss_sqsw = 0;
 | 
|---|
| 198 |                         cvwait  = 1;
 | 
|---|
| 199 |                         ncvwait = cvtime;
 | 
|---|
| 200 |                         cmfirst = TRUE;
 | 
|---|
| 201 | 
 | 
|---|
| 202 |                         if (ss_ptsw EQ 0)
 | 
|---|
| 203 |                                 (*xy_up)();
 | 
|---|
| 204 | 
 | 
|---|
| 205 |                         (*pstmove)();           /* handle POST-MOVE functions */
 | 
|---|
| 206 | 
 | 
|---|
| 207 |                 } else
 | 
|---|
| 208 |                         select();
 | 
|---|
| 209 |         }
 | 
|---|
| 210 | }
 | 
|---|
| 211 | 
 | 
|---|
| 212 | /*  | 
|---|
| 213 | 
 | 
|---|
| 214 | */
 | 
|---|
| 215 | 
 | 
|---|
| 216 | /*
 | 
|---|
| 217 |    =============================================================================
 | 
|---|
| 218 |         sqxkey() -- delete key handler
 | 
|---|
| 219 |    =============================================================================
 | 
|---|
| 220 | */
 | 
|---|
| 221 | 
 | 
|---|
| 222 | void sqxkey(void)
 | 
|---|
| 223 | {
 | 
|---|
| 224 |         if (NOT astat)
 | 
|---|
| 225 |                 return;
 | 
|---|
| 226 | 
 | 
|---|
| 227 |         if (inrange(stccol, 2, 4)) {
 | 
|---|
| 228 | 
 | 
|---|
| 229 |                 memsetw(&seqbuf, 0, NSEQW);
 | 
|---|
| 230 |                 memsetw(&seqtab[curslin], 0, NSEQW);
 | 
|---|
| 231 |                 dsqlin(sqdebuf, curslin);
 | 
|---|
| 232 |                 sqdeflg = TRUE;
 | 
|---|
| 233 |                 dcursq();
 | 
|---|
| 234 | 
 | 
|---|
| 235 |         } else if (inrange(stccol, 12, 22)) {
 | 
|---|
| 236 | 
 | 
|---|
| 237 |                 seqtab[curslin].seqact1 = 0;
 | 
|---|
| 238 |                 seqtab[curslin].seqdat1 = 0;
 | 
|---|
| 239 |                 memcpyw(&seqbuf, &seqtab[curslin], NSEQW);
 | 
|---|
| 240 |                 dsqlin(sqdebuf, curslin);
 | 
|---|
| 241 |                 sqdeflg = TRUE;
 | 
|---|
| 242 |                 dcursq();
 | 
|---|
| 243 | 
 | 
|---|
| 244 |         } else if (inrange(stccol, 24, 34)) {
 | 
|---|
| 245 | 
 | 
|---|
| 246 |                 seqtab[curslin].seqact2 = 0;
 | 
|---|
| 247 |                 seqtab[curslin].seqdat2 = 0;
 | 
|---|
| 248 |                 memcpyw(&seqbuf, &seqtab[curslin], NSEQW);
 | 
|---|
| 249 |                 dsqlin(sqdebuf, curslin);
 | 
|---|
| 250 |                 sqdeflg = TRUE;
 | 
|---|
| 251 |                 dcursq();
 | 
|---|
| 252 | 
 | 
|---|
| 253 |         } else if (inrange(stccol, 36, 46)) {
 | 
|---|
| 254 | 
 | 
|---|
| 255 |                 seqtab[curslin].seqact3 = 0;
 | 
|---|
| 256 |                 seqtab[curslin].seqdat3 = 0;
 | 
|---|
| 257 |                 memcpyw(&seqbuf, &seqtab[curslin], NSEQW);
 | 
|---|
| 258 |                 dsqlin(sqdebuf, curslin);
 | 
|---|
| 259 |                 sqdeflg = TRUE;
 | 
|---|
| 260 |                 dcursq();
 | 
|---|
| 261 |         }
 | 
|---|
| 262 | }
 | 
|---|
| 263 | 
 | 
|---|
| 264 | /*  | 
|---|
| 265 | 
 | 
|---|
| 266 | */
 | 
|---|
| 267 | 
 | 
|---|
| 268 | /*
 | 
|---|
| 269 |    =============================================================================
 | 
|---|
| 270 |         sqfield() -- setup field routines for the sequence editor
 | 
|---|
| 271 |    =============================================================================
 | 
|---|
| 272 | */
 | 
|---|
| 273 | 
 | 
|---|
| 274 | void sqfield(void)
 | 
|---|
| 275 | {
 | 
|---|
| 276 | 
 | 
|---|
| 277 | #if     DEBUGIT
 | 
|---|
| 278 |         if (debugsw AND debugqf)
 | 
|---|
| 279 |                 printf("sqfield(): ENTRY\n");
 | 
|---|
| 280 | #endif
 | 
|---|
| 281 | 
 | 
|---|
| 282 |         curset(&sq_flds);
 | 
|---|
| 283 | 
 | 
|---|
| 284 | #if     DEBUGIT
 | 
|---|
| 285 |         if (debugsw AND debugqf)
 | 
|---|
| 286 |                 printf("sqfield(): EXIT\n");
 | 
|---|
| 287 | #endif
 | 
|---|
| 288 | 
 | 
|---|
| 289 | }
 | 
|---|
| 290 | 
 | 
|---|