[f40a309] | 1 | /*
|
---|
| 2 | =============================================================================
|
---|
| 3 | scfield.c -- score editor field setup
|
---|
| 4 | Version 62 -- 1989-11-15 -- D.N. Lynx Crowe
|
---|
| 5 | =============================================================================
|
---|
| 6 | */
|
---|
| 7 |
|
---|
[b28a12e] | 8 | #include "ram.h"
|
---|
[f40a309] | 9 |
|
---|
| 10 | #define PCENTER 256L
|
---|
| 11 |
|
---|
| 12 | /* |
---|
| 13 |
|
---|
| 14 | */
|
---|
| 15 |
|
---|
| 16 | struct fet sc_fet1[] = {
|
---|
| 17 |
|
---|
| 18 | { 0, 2, 4, 0x0000, et_strn, ef_strn, rd_strn, nd_strn},
|
---|
| 19 | { 0, 11, 15, 0x0000, et_snbt, ef_snbt, rd_snbt, nd_snbt},
|
---|
| 20 |
|
---|
| 21 | {17, 11, 12, 0x0000, et_ioas, ef_ioas, rd_ioas, nd_ioas},
|
---|
| 22 | {17, 19, 19, 0x0000, et_tune, ef_tune, rd_tune, nd_tune},
|
---|
| 23 | {17, 27, 29, 0x0000, et_tmpo, ef_tmpo, rd_tmpo, nd_tmpo},
|
---|
| 24 | {17, 35, 38, 0x0000, et_intp, ef_intp, rd_intp, nd_intp},
|
---|
| 25 |
|
---|
| 26 | {18, 7, 8, 0, et_inst, ef_inst, rd_inst, nd_inst},
|
---|
| 27 | {18, 12, 13, 1, et_inst, ef_inst, rd_inst, nd_inst},
|
---|
| 28 | {18, 17, 18, 2, et_inst, ef_inst, rd_inst, nd_inst},
|
---|
| 29 | {18, 22, 23, 3, et_inst, ef_inst, rd_inst, nd_inst},
|
---|
| 30 | {18, 27, 28, 4, et_inst, ef_inst, rd_inst, nd_inst},
|
---|
| 31 | {18, 32, 33, 5, et_inst, ef_inst, rd_inst, nd_inst},
|
---|
| 32 | {18, 37, 38, 6, et_inst, ef_inst, rd_inst, nd_inst},
|
---|
| 33 | {18, 42, 43, 7, et_inst, ef_inst, rd_inst, nd_inst},
|
---|
| 34 | {18, 47, 48, 8, et_inst, ef_inst, rd_inst, nd_inst},
|
---|
| 35 | {18, 52, 53, 9, et_inst, ef_inst, rd_inst, nd_inst},
|
---|
| 36 | {18, 57, 58, 10, et_inst, ef_inst, rd_inst, nd_inst},
|
---|
| 37 | {18, 62, 63, 11, et_inst, ef_inst, rd_inst, nd_inst},
|
---|
| 38 |
|
---|
| 39 | {19, 5, 8, 0, et_trns, ef_trns, rd_trns, nd_trns},
|
---|
| 40 | {19, 10, 13, 1, et_trns, ef_trns, rd_trns, nd_trns},
|
---|
| 41 | {19, 15, 18, 2, et_trns, ef_trns, rd_trns, nd_trns},
|
---|
| 42 | {19, 20, 23, 3, et_trns, ef_trns, rd_trns, nd_trns},
|
---|
| 43 | {19, 25, 28, 4, et_trns, ef_trns, rd_trns, nd_trns},
|
---|
| 44 | {19, 30, 33, 5, et_trns, ef_trns, rd_trns, nd_trns},
|
---|
| 45 | {19, 35, 38, 6, et_trns, ef_trns, rd_trns, nd_trns},
|
---|
| 46 | {19, 40, 43, 7, et_trns, ef_trns, rd_trns, nd_trns},
|
---|
| 47 | {19, 45, 48, 8, et_trns, ef_trns, rd_trns, nd_trns},
|
---|
| 48 | {19, 50, 53, 9, et_trns, ef_trns, rd_trns, nd_trns},
|
---|
| 49 | {19, 55, 58, 10, et_trns, ef_trns, rd_trns, nd_trns},
|
---|
| 50 | {19, 60, 63, 11, et_trns, ef_trns, rd_trns, nd_trns},
|
---|
| 51 |
|
---|
| 52 | /* |
---|
| 53 |
|
---|
| 54 | */
|
---|
| 55 |
|
---|
| 56 | {20, 6, 6, 0, et_dyn, ef_dyn, rd_dyn, nd_dyn},
|
---|
| 57 | {20, 8, 8, 0, et_loc, ef_loc, rd_loc, nd_loc},
|
---|
| 58 |
|
---|
| 59 | {20, 11, 11, 1, et_dyn, ef_dyn, rd_dyn, nd_dyn},
|
---|
| 60 | {20, 13, 13, 1, et_loc, ef_loc, rd_loc, nd_loc},
|
---|
| 61 |
|
---|
| 62 | {20, 16, 16, 2, et_dyn, ef_dyn, rd_dyn, nd_dyn},
|
---|
| 63 | {20, 18, 18, 2, et_loc, ef_loc, rd_loc, nd_loc},
|
---|
| 64 |
|
---|
| 65 | {20, 21, 21, 3, et_dyn, ef_dyn, rd_dyn, nd_dyn},
|
---|
| 66 | {20, 23, 23, 3, et_loc, ef_loc, rd_loc, nd_loc},
|
---|
| 67 |
|
---|
| 68 | {20, 26, 26, 4, et_dyn, ef_dyn, rd_dyn, nd_dyn},
|
---|
| 69 | {20, 28, 28, 4, et_loc, ef_loc, rd_loc, nd_loc},
|
---|
| 70 |
|
---|
| 71 | {20, 31, 31, 5, et_dyn, ef_dyn, rd_dyn, nd_dyn},
|
---|
| 72 | {20, 33, 33, 5, et_loc, ef_loc, rd_loc, nd_loc},
|
---|
| 73 |
|
---|
| 74 | {20, 36, 36, 6, et_dyn, ef_dyn, rd_dyn, nd_dyn},
|
---|
| 75 | {20, 38, 38, 6, et_loc, ef_loc, rd_loc, nd_loc},
|
---|
| 76 |
|
---|
| 77 | {20, 41, 41, 7, et_dyn, ef_dyn, rd_dyn, nd_dyn},
|
---|
| 78 | {20, 43, 43, 7, et_loc, ef_loc, rd_loc, nd_loc},
|
---|
| 79 |
|
---|
| 80 | {20, 46, 46, 8, et_dyn, ef_dyn, rd_dyn, nd_dyn},
|
---|
| 81 | {20, 48, 48, 8, et_loc, ef_loc, rd_loc, nd_loc},
|
---|
| 82 |
|
---|
| 83 | {20, 51, 51, 9, et_dyn, ef_dyn, rd_dyn, nd_dyn},
|
---|
| 84 | {20, 53, 53, 9, et_loc, ef_loc, rd_loc, nd_loc},
|
---|
| 85 |
|
---|
| 86 | {20, 56, 56, 10, et_dyn, ef_dyn, rd_dyn, nd_dyn},
|
---|
| 87 | {20, 58, 58, 10, et_loc, ef_loc, rd_loc, nd_loc},
|
---|
| 88 |
|
---|
| 89 | {20, 61, 61, 11, et_dyn, ef_dyn, rd_dyn, nd_dyn},
|
---|
| 90 | {20, 63, 63, 11, et_loc, ef_loc, rd_loc, nd_loc},
|
---|
| 91 |
|
---|
| 92 | /* |
---|
| 93 |
|
---|
| 94 | */
|
---|
| 95 |
|
---|
| 96 | {21, 6, 8, 0, et_vel, ef_vel, rd_vel, nd_vel},
|
---|
| 97 | {21, 11, 13, 1, et_vel, ef_vel, rd_vel, nd_vel},
|
---|
| 98 | {21, 16, 18, 2, et_vel, ef_vel, rd_vel, nd_vel},
|
---|
| 99 | {21, 21, 23, 3, et_vel, ef_vel, rd_vel, nd_vel},
|
---|
| 100 | {21, 26, 28, 4, et_vel, ef_vel, rd_vel, nd_vel},
|
---|
| 101 | {21, 31, 33, 5, et_vel, ef_vel, rd_vel, nd_vel},
|
---|
| 102 | {21, 36, 38, 6, et_vel, ef_vel, rd_vel, nd_vel},
|
---|
| 103 | {21, 41, 43, 7, et_vel, ef_vel, rd_vel, nd_vel},
|
---|
| 104 | {21, 46, 48, 8, et_vel, ef_vel, rd_vel, nd_vel},
|
---|
| 105 | {21, 51, 53, 9, et_vel, ef_vel, rd_vel, nd_vel},
|
---|
| 106 | {21, 56, 58, 10, et_vel, ef_vel, rd_vel, nd_vel},
|
---|
| 107 | {21, 61, 63, 11, et_vel, ef_vel, rd_vel, nd_vel},
|
---|
| 108 |
|
---|
| 109 |
|
---|
| 110 | {23, 6, 6, 0, et_res1, ef_res1, rd_res1, nd_res1},
|
---|
| 111 | {23, 8, 12, 0, et_aval, ef_aval, rd_aval, nd_aval},
|
---|
| 112 |
|
---|
| 113 | {23, 15, 15, 1, et_res1, ef_res1, rd_res1, nd_res1},
|
---|
| 114 | {23, 17, 21, 1, et_aval, ef_aval, rd_aval, nd_aval},
|
---|
| 115 |
|
---|
| 116 | {23, 24, 24, 2, et_res1, ef_res1, rd_res1, nd_res1},
|
---|
| 117 | {23, 26, 30, 2, et_aval, ef_aval, rd_aval, nd_aval},
|
---|
| 118 |
|
---|
| 119 | {23, 33, 33, 3, et_res1, ef_res1, rd_res1, nd_res1},
|
---|
| 120 | {23, 35, 39, 3, et_aval, ef_aval, rd_aval, nd_aval},
|
---|
| 121 |
|
---|
| 122 | {23, 42, 42, 4, et_res1, ef_res1, rd_res1, nd_res1},
|
---|
| 123 | {23, 44, 48, 4, et_aval, ef_aval, rd_aval, nd_aval},
|
---|
| 124 |
|
---|
| 125 | {23, 51, 51, 5, et_res1, ef_res1, rd_res1, nd_res1},
|
---|
| 126 | {23, 53, 57, 5, et_aval, ef_aval, rd_aval, nd_aval},
|
---|
| 127 |
|
---|
| 128 | {23, 61, 62, 0, et_agrp, ef_agrp, rd_agrp, nd_agrp},
|
---|
| 129 |
|
---|
| 130 | {24, 7, 8, 0x0000, et_scor, ef_scor, rd_scor, nd_scor},
|
---|
| 131 | {24, 10, 25, 0x0000, et_null, ef_null, rd_null, nd_null},
|
---|
| 132 |
|
---|
| 133 |
|
---|
| 134 | { 0, 0, 0, 0x0000, FN_NULL, FN_NULL, FN_NULL, FN_NULL}
|
---|
| 135 | };
|
---|
| 136 |
|
---|
| 137 | /* |
---|
| 138 |
|
---|
| 139 | */
|
---|
| 140 |
|
---|
| 141 | struct curpak sc_flds = {
|
---|
| 142 |
|
---|
| 143 | stdctp3, /* curtype */
|
---|
| 144 | nokey, /* premove */
|
---|
| 145 | nokey, /* pstmove */
|
---|
| 146 | cxkstd, /* cx_key */
|
---|
| 147 | cykstd, /* cy_key */
|
---|
| 148 | sdcxu, /* cx_upd */
|
---|
| 149 | sdcyu, /* cy_upd */
|
---|
| 150 | nokey, /* xy_up */
|
---|
| 151 | nokey, /* xy_dn */
|
---|
| 152 | sdxkey, /* x_key */
|
---|
| 153 | select, /* e_key */
|
---|
| 154 | sdmkey, /* m_key */
|
---|
| 155 | stddkey, /* d_key */
|
---|
| 156 | scntfld, /* not_fld */
|
---|
| 157 | sc_fet1, /* curfet */
|
---|
| 158 | sdboxes, /* csbp */
|
---|
| 159 | crate1, /* cratex */
|
---|
| 160 | crate1, /* cratey */
|
---|
| 161 | CT_GRAF, /* cmtype */
|
---|
| 162 | C1X, /* cxval */
|
---|
| 163 | C1Y /* cyval */
|
---|
| 164 | };
|
---|
| 165 |
|
---|
| 166 | /* |
---|
| 167 |
|
---|
| 168 | */
|
---|
| 169 |
|
---|
| 170 | /*
|
---|
[7258c6a] | 171 | =============================================================================
|
---|
[f40a309] | 172 | et_null() .. nd_null() -- null data entry key processors
|
---|
| 173 | =============================================================================
|
---|
| 174 | */
|
---|
| 175 |
|
---|
[7258c6a] | 176 | int16_t et_null(int16_t n)
|
---|
[f40a309] | 177 | {
|
---|
| 178 | return(SUCCESS);
|
---|
| 179 | }
|
---|
| 180 |
|
---|
[7258c6a] | 181 | int16_t ef_null(int16_t n)
|
---|
[f40a309] | 182 | {
|
---|
| 183 | return(SUCCESS);
|
---|
| 184 | }
|
---|
| 185 |
|
---|
[7258c6a] | 186 | int16_t rd_null(int16_t n)
|
---|
[f40a309] | 187 | {
|
---|
| 188 | return(SUCCESS);
|
---|
| 189 | }
|
---|
| 190 |
|
---|
| 191 | int16_t nd_null(int16_t n, int16_t k)
|
---|
| 192 | {
|
---|
| 193 | return(SUCCESS);
|
---|
| 194 | }
|
---|
| 195 |
|
---|
| 196 | /* |
---|
| 197 |
|
---|
| 198 | */
|
---|
| 199 |
|
---|
[0580615] | 200 | /*
|
---|
[f40a309] | 201 | =============================================================================
|
---|
| 202 | istart() -- start insert mode
|
---|
| 203 | =============================================================================
|
---|
| 204 | */
|
---|
| 205 |
|
---|
| 206 | void istart(void)
|
---|
| 207 | {
|
---|
| 208 | register struct s_entry *ep, *pp, *tp;
|
---|
| 209 |
|
---|
| 210 | if (insmode) /* can't already be inserting */
|
---|
| 211 | return;
|
---|
| 212 |
|
---|
| 213 | ep = ep_adj(p_cur, 1, t_cur); /* locate tail */
|
---|
[9519422] | 214 |
|
---|
[f40a309] | 215 | if (EV_SCORE EQ (0x007F & ep->e_type)) /* skip begin score event */
|
---|
| 216 | ep = ep->e_fwd;
|
---|
| 217 |
|
---|
| 218 | if (EV_FINI EQ (0x007F & ep->e_type)) /* null if at end of score */
|
---|
| 219 | return;
|
---|
| 220 |
|
---|
| 221 | tp = scores[curscor]->e_bak; /* locate end of score */
|
---|
| 222 | pp = ep->e_bak; /* locate end of head */
|
---|
| 223 |
|
---|
| 224 | ep->e_bak = E_NULL; /* unhook tail from head */
|
---|
| 225 | pp->e_fwd = tp; /* unhook head from tail */
|
---|
| 226 | (tp->e_bak)->e_fwd = E_NULL; /* unhook tail from end */
|
---|
| 227 |
|
---|
| 228 | tp->e_bak = pp; /* connect end to head */
|
---|
| 229 |
|
---|
| 230 | t_ins = t_cur; /* record tail time */
|
---|
| 231 | peg = ep; /* hang tail on peg */
|
---|
| 232 |
|
---|
| 233 | p_cur = ep_adj(pp, 0, t_cur); /* adjust p_cur */
|
---|
| 234 | p_ctr = p_cur; /* adjust p_ctr */
|
---|
| 235 | p_bak = ep_adj(p_cur, 0, t_bak); /* adjust p_bak */
|
---|
| 236 | p_fwd = ep_adj(p_cur, 0, t_fwd); /* adjust p_fwd */
|
---|
| 237 |
|
---|
| 238 | insmode = TRUE;
|
---|
| 239 | }
|
---|
| 240 |
|
---|
| 241 | /* |
---|
| 242 |
|
---|
| 243 | */
|
---|
[0580615] | 244 |
|
---|
[f40a309] | 245 | /*
|
---|
| 246 | =============================================================================
|
---|
| 247 | icancel() -- cancel insert mode
|
---|
[7258c6a] | 248 | =============================================================================
|
---|
[f40a309] | 249 | */
|
---|
| 250 |
|
---|
| 251 | void icancel(void)
|
---|
| 252 | {
|
---|
| 253 | register struct s_entry *ep, *tp, *rp;
|
---|
| 254 | struct s_entry *pp;
|
---|
| 255 | int32_t endtime;
|
---|
| 256 |
|
---|
| 257 | if (NOT insmode)
|
---|
| 258 | return;
|
---|
| 259 |
|
---|
| 260 | tp = scores[curscor]->e_bak; /* locate end of score */
|
---|
| 261 | pp = tp->e_bak; /* locate end of head */
|
---|
| 262 |
|
---|
| 263 | endtime = pp->e_time; /* find last time in score */
|
---|
| 264 |
|
---|
| 265 | if (t_cur > endtime) /* use max of t_cur, endtime */
|
---|
| 266 | endtime = t_cur;
|
---|
| 267 |
|
---|
| 268 | rp = peg; /* point at start of tail */
|
---|
| 269 |
|
---|
| 270 | while (E_NULL NE rp) { /* scan each event in the tail */
|
---|
| 271 |
|
---|
| 272 | ep = rp; /* update pointers */
|
---|
| 273 | rp = ep->e_fwd;
|
---|
| 274 |
|
---|
| 275 | ep->e_time = (ep->e_time - t_ins) + endtime; /* adjust time */
|
---|
| 276 | }
|
---|
| 277 |
|
---|
| 278 | ep->e_fwd = tp; /* connect tail to end */
|
---|
| 279 | tp->e_bak = ep; /* connect end to tail */
|
---|
| 280 |
|
---|
| 281 | pp->e_fwd = peg; /* connect head to tail */
|
---|
| 282 | peg->e_bak = pp; /* connect tail to head */
|
---|
| 283 |
|
---|
| 284 | p_cur = ep_adj(pp, 0, t_cur); /* adjust p_cur */
|
---|
| 285 | p_ctr = p_cur; /* adjust p_ctr */
|
---|
| 286 | p_bak = ep_adj(p_cur, 0, t_bak); /* adjust p_bak */
|
---|
| 287 | p_fwd = ep_adj(p_cur, 0, t_fwd); /* adjust p_fwd */
|
---|
| 288 |
|
---|
| 289 | insmode = FALSE;
|
---|
| 290 | }
|
---|
| 291 |
|
---|
| 292 | /* |
---|
| 293 |
|
---|
[0580615] | 294 | */
|
---|
[f40a309] | 295 |
|
---|
| 296 | /*
|
---|
| 297 | =============================================================================
|
---|
| 298 | sdcxu() -- score cursor x update processing
|
---|
| 299 | =============================================================================
|
---|
| 300 | */
|
---|
| 301 |
|
---|
| 302 | void sdcxu(void)
|
---|
| 303 | {
|
---|
| 304 | if (sdmctl EQ 0) { /* typewriter up */
|
---|
| 305 |
|
---|
| 306 | vtcxupd();
|
---|
| 307 |
|
---|
| 308 | } else if (sdmctl > 0) { /* menu up */
|
---|
| 309 |
|
---|
| 310 | vtccol = XTOC(vtxval += cxrate);
|
---|
| 311 |
|
---|
| 312 | if (vtccol > sdmlim[sdmctl][3])
|
---|
| 313 | vtxval = CTOX(vtccol = sdmlim[sdmctl][3]);
|
---|
| 314 | else if (vtccol < sdmlim[sdmctl][1])
|
---|
| 315 | vtxval = CTOX(vtccol = sdmlim[sdmctl][1]);
|
---|
| 316 |
|
---|
| 317 | } else { /* no menu showing */
|
---|
| 318 |
|
---|
| 319 | cxval += cxrate;
|
---|
| 320 |
|
---|
| 321 | if (cxval > CXMAX)
|
---|
| 322 | cxval = CXMAX;
|
---|
| 323 | else if (cxval < 0)
|
---|
| 324 | cxval = 0;
|
---|
| 325 | }
|
---|
| 326 |
|
---|
| 327 | return;
|
---|
| 328 | }
|
---|
| 329 |
|
---|
| 330 | /* |
---|
[0580615] | 331 |
|
---|
[f40a309] | 332 | */
|
---|
| 333 |
|
---|
| 334 | /*
|
---|
| 335 | =============================================================================
|
---|
| 336 | sdcyu() -- score cursor y update processing
|
---|
| 337 | =============================================================================
|
---|
| 338 | */
|
---|
| 339 |
|
---|
| 340 | void sdcyu(void)
|
---|
| 341 | {
|
---|
| 342 | if (sdmctl EQ 0) {
|
---|
| 343 |
|
---|
| 344 | vtcyupd();
|
---|
| 345 |
|
---|
| 346 | } else if (sdmctl > 0) { /* menu up */
|
---|
| 347 |
|
---|
| 348 | vtcrow = YTOR(vtyval += cyrate);
|
---|
| 349 |
|
---|
| 350 | if (vtcrow < sdmlim[sdmctl][0])
|
---|
| 351 | vtyval = RTOY(vtcrow = sdmlim[sdmctl][0]);
|
---|
| 352 | else if (vtcrow > sdmlim[sdmctl][2])
|
---|
| 353 | vtyval = RTOY(vtcrow = sdmlim[sdmctl][2]);
|
---|
| 354 |
|
---|
| 355 | } else { /* no menu showing */
|
---|
| 356 |
|
---|
| 357 | cyval += cyrate;
|
---|
| 358 |
|
---|
| 359 | if (cyval > CYMAX)
|
---|
| 360 | cyval = CYMAX;
|
---|
| 361 | else if (cyval < 0)
|
---|
| 362 | cyval = 0;
|
---|
| 363 |
|
---|
| 364 | }
|
---|
| 365 |
|
---|
| 366 | return;
|
---|
| 367 | }
|
---|
| 368 |
|
---|
[7258c6a] | 369 | /* |
---|
[f40a309] | 370 |
|
---|
[7258c6a] | 371 | */
|
---|
[f40a309] | 372 |
|
---|
| 373 | /*
|
---|
| 374 | =============================================================================
|
---|
| 375 | scntfld() -- not-in-field data entry key processing
|
---|
| 376 | =============================================================================
|
---|
| 377 | */
|
---|
| 378 |
|
---|
| 379 | int16_t scntfld(int16_t k)
|
---|
| 380 | {
|
---|
| 381 | register int16_t grp, fnc, var;
|
---|
| 382 |
|
---|
| 383 | if (NOT astat)
|
---|
| 384 | return(FAILURE);
|
---|
| 385 |
|
---|
| 386 | if (stcrow EQ 18) { /* group status or mode */
|
---|
| 387 |
|
---|
| 388 | if (stccol LT 5)
|
---|
| 389 | return(FAILURE);
|
---|
| 390 |
|
---|
| 391 | grp = (stccol - 5) / 5; /* group */
|
---|
| 392 | fnc = (stccol - 5) % 5; /* status or mode */
|
---|
| 393 |
|
---|
| 394 | if (fnc EQ 0) { /* status */
|
---|
| 395 |
|
---|
| 396 | if (k EQ 8) { /* '-' */
|
---|
| 397 |
|
---|
| 398 | grpstat[grp] = FALSE;
|
---|
| 399 | dsgstat(grp);
|
---|
| 400 | return(SUCCESS);
|
---|
| 401 |
|
---|
| 402 | } else if (k EQ 9) { /* '+' */
|
---|
| 403 |
|
---|
| 404 | grpstat[grp] = TRUE;
|
---|
| 405 | dsgstat(grp);
|
---|
| 406 | return(SUCCESS);
|
---|
| 407 |
|
---|
| 408 | } else
|
---|
| 409 | return(FAILURE);
|
---|
| 410 | /* |
---|
| 411 |
|
---|
| 412 | */
|
---|
| 413 | } else if (fnc EQ 1) { /* mode */
|
---|
| 414 |
|
---|
| 415 | if (k EQ 8) { /* '-' */
|
---|
| 416 |
|
---|
| 417 | grpmode[grp] = 0;
|
---|
| 418 | dsgmode(grp);
|
---|
| 419 | return(SUCCESS);
|
---|
| 420 |
|
---|
| 421 | } else if (k EQ 9) { /* '+' */
|
---|
| 422 |
|
---|
| 423 | if (++grpmode[grp] GT 1)
|
---|
| 424 | grpmode[grp] = 2;
|
---|
| 425 |
|
---|
| 426 | dsgmode(grp);
|
---|
| 427 | return(SUCCESS);
|
---|
| 428 |
|
---|
| 429 | } else
|
---|
| 430 | return(FAILURE);
|
---|
| 431 |
|
---|
| 432 | } else
|
---|
| 433 | return(FAILURE);
|
---|
| 434 | /* |
---|
| 435 |
|
---|
| 436 | */
|
---|
| 437 | } else if (stcrow EQ 22) { /* analog variables */
|
---|
| 438 |
|
---|
| 439 | if (stccol < 5)
|
---|
| 440 | return(FAILURE);
|
---|
| 441 |
|
---|
| 442 | var = (stccol - 5) / 9; /* variable */
|
---|
| 443 | fnc = (stccol - 5) % 9; /* field column */
|
---|
| 444 | grp = abs(angroup) - 1; /* group */
|
---|
| 445 |
|
---|
| 446 | if (fnc EQ 0) { /* mode column */
|
---|
| 447 |
|
---|
| 448 | if (k EQ 8) { /* '-' */
|
---|
| 449 |
|
---|
| 450 | varmode[var][grp] = 0;
|
---|
| 451 | dsvmode(var);
|
---|
| 452 | return(SUCCESS);
|
---|
| 453 |
|
---|
| 454 | } else if (k EQ 9) { /* '+' */
|
---|
| 455 |
|
---|
| 456 | if (++varmode[var][grp] GT 1)
|
---|
| 457 | varmode[var][grp] = 2;
|
---|
| 458 |
|
---|
| 459 | dsvmode(var);
|
---|
| 460 | return(SUCCESS);
|
---|
| 461 | }
|
---|
| 462 | }
|
---|
| 463 | }
|
---|
| 464 |
|
---|
| 465 | return(FAILURE);
|
---|
| 466 | }
|
---|
[7258c6a] | 467 |
|
---|
[f40a309] | 468 | /* |
---|
[7258c6a] | 469 |
|
---|
[f40a309] | 470 | */
|
---|
[7258c6a] | 471 |
|
---|
[f40a309] | 472 | /*
|
---|
| 473 | =============================================================================
|
---|
| 474 | cp2time() -- check cursor position and convert it to time
|
---|
| 475 |
|
---|
| 476 | Sets 'ctime' if the cursor x argument, 'cx', is within the score.
|
---|
| 477 | =============================================================================
|
---|
| 478 | */
|
---|
| 479 |
|
---|
| 480 | int16_t cp2time(int16_t cx)
|
---|
| 481 | {
|
---|
| 482 | register int32_t ct;
|
---|
| 483 |
|
---|
| 484 | ct = t_cur + ((int32_t)cx - PCENTER);
|
---|
| 485 |
|
---|
| 486 | if (ct < 0L) /* if out of score time range */
|
---|
| 487 | return(FALSE); /* ... return FALSE */
|
---|
| 488 |
|
---|
[7258c6a] | 489 | ctime = ct; /* set ctime */
|
---|
[f40a309] | 490 | return(TRUE); /* ... and return TRUE */
|
---|
| 491 | }
|
---|
[7258c6a] | 492 |
|
---|
| 493 | /* |
---|
| 494 |
|
---|
[f40a309] | 495 | */
|
---|
| 496 |
|
---|
| 497 | /*
|
---|
| 498 | =============================================================================
|
---|
| 499 | delevts() -- delete record enabled non-note events at current time
|
---|
| 500 | =============================================================================
|
---|
| 501 | */
|
---|
| 502 |
|
---|
| 503 | int16_t delevts(int16_t etp, int32_t thetime)
|
---|
| 504 | {
|
---|
| 505 | register struct s_entry *ep, *np;
|
---|
| 506 | register int16_t et;
|
---|
| 507 | register int16_t rc;
|
---|
| 508 | register int16_t dsw;
|
---|
| 509 |
|
---|
| 510 | rc = FALSE; /* intialize return code */
|
---|
| 511 |
|
---|
| 512 | ep = ep_adj(p_cur, 1, thetime); /* start at left end of chain */
|
---|
| 513 |
|
---|
| 514 | /* |
---|
| 515 |
|
---|
| 516 | */
|
---|
| 517 | while (ep->e_time EQ thetime) { /* for each event at ctime ... */
|
---|
| 518 |
|
---|
| 519 | np = ep->e_fwd; /* get next event pointer */
|
---|
| 520 | et = 0x007F & ep->e_type; /* get type */
|
---|
| 521 | dsw = oktode(ep); /* get deletion status */
|
---|
| 522 |
|
---|
| 523 | if (dsw AND /* delete event if it's deletable ... */
|
---|
| 524 | ((etp EQ -1) OR (et EQ etp))) { /* ... and the right kind */
|
---|
| 525 |
|
---|
| 526 | rc = TRUE;
|
---|
| 527 |
|
---|
| 528 | if (-1 NE ehdlist[et]) /* if this is a header event ... */
|
---|
| 529 | eh_rmv(ep, ehdlist[et]); /* remove from hdr list */
|
---|
| 530 |
|
---|
| 531 | /* fix up any effected pointers */
|
---|
| 532 |
|
---|
| 533 | if (p_bak EQ ep)
|
---|
| 534 | p_bak = np;
|
---|
| 535 |
|
---|
| 536 | if (p_cur EQ ep)
|
---|
| 537 | p_cur = np;
|
---|
| 538 |
|
---|
| 539 | if (p_ctr EQ ep)
|
---|
| 540 | p_ctr = np;
|
---|
| 541 |
|
---|
| 542 | if (p_fwd EQ ep)
|
---|
| 543 | p_fwd = np;
|
---|
| 544 |
|
---|
| 545 | e_del(e_rmv(ep)); /* delete the event */
|
---|
| 546 | }
|
---|
| 547 |
|
---|
| 548 | ep = np;
|
---|
| 549 | }
|
---|
| 550 |
|
---|
[7258c6a] | 551 | if (rc) /* if anything was deleted ... */
|
---|
[f40a309] | 552 | sc_refr(t_cur); /* ... update the display */
|
---|
| 553 |
|
---|
[7258c6a] | 554 | return(rc);
|
---|
[f40a309] | 555 | }
|
---|
| 556 |
|
---|
| 557 | /* |
---|
| 558 |
|
---|
| 559 | */
|
---|
| 560 |
|
---|
| 561 | /*
|
---|
| 562 | =============================================================================
|
---|
| 563 | deladat() -- delete analog varaible data
|
---|
| 564 | =============================================================================
|
---|
| 565 | */
|
---|
| 566 |
|
---|
| 567 | int16_t deladat(void)
|
---|
| 568 | {
|
---|
| 569 | register struct s_entry *ep, *rp;
|
---|
| 570 | register int16_t grp, rc, var, vc, vn;
|
---|
| 571 |
|
---|
| 572 | rc = FALSE;
|
---|
| 573 |
|
---|
| 574 | if (stccol < 6) /* pointing at var ? */
|
---|
| 575 | return(rc);
|
---|
| 576 |
|
---|
| 577 | vn = (stccol - 6) / 9; /* variable number */
|
---|
| 578 | vc = (stccol - 6) % 9; /* variable column */
|
---|
| 579 |
|
---|
| 580 | ep = ep_adj(p_cur, 1, t_cur); /* start at left end of chain */
|
---|
| 581 |
|
---|
| 582 | if (vc EQ 0) { /* resolution */
|
---|
| 583 |
|
---|
| 584 | while (t_cur EQ ep->e_time) {
|
---|
| 585 |
|
---|
| 586 | rp = ep->e_fwd;
|
---|
| 587 |
|
---|
| 588 | if (EV_ANRS EQ (0x007F & ep->e_type)) {
|
---|
| 589 |
|
---|
| 590 | grp = 0x000F & ep->e_data1;
|
---|
| 591 | var = 0x000F & (ep->e_data1 >> 4);
|
---|
| 592 |
|
---|
| 593 | if ((var EQ vn) AND grpstat[grp] AND
|
---|
| 594 | (2 EQ (ancmsw ? varmode[var][grp] :
|
---|
| 595 | grpmode[grp]))) {
|
---|
| 596 |
|
---|
| 597 | /* fix pointers */
|
---|
| 598 |
|
---|
| 599 | if (p_bak EQ ep)
|
---|
| 600 | p_bak = rp;
|
---|
| 601 |
|
---|
| 602 | if (p_cur EQ ep)
|
---|
| 603 | p_cur = rp;
|
---|
| 604 |
|
---|
| 605 | if (p_ctr EQ ep)
|
---|
| 606 | p_ctr = rp;
|
---|
| 607 |
|
---|
| 608 | if (p_fwd EQ ep)
|
---|
| 609 | p_fwd = rp;
|
---|
| 610 |
|
---|
| 611 | /* delete event */
|
---|
| 612 |
|
---|
| 613 | eh_rmv(ep, EH_ANRS);
|
---|
| 614 | e_del(e_rmv(ep));
|
---|
| 615 | rc = TRUE;
|
---|
| 616 | }
|
---|
| 617 | }
|
---|
| 618 |
|
---|
| 619 | ep = rp; /* next event */
|
---|
| 620 | }
|
---|
| 621 | /* |
---|
| 622 |
|
---|
| 623 | */
|
---|
| 624 | } else if ((vc GE 2) AND (vc LE 6)) { /* value */
|
---|
| 625 |
|
---|
| 626 | while (t_cur EQ ep->e_time) {
|
---|
| 627 |
|
---|
| 628 | rp = ep->e_fwd;
|
---|
| 629 |
|
---|
| 630 | if (EV_ANVL EQ (0x007F & ep->e_type)) {
|
---|
| 631 |
|
---|
| 632 | grp = 0x000F & ep->e_data1;
|
---|
| 633 | var = 0x000F & (ep->e_data1 >> 4);
|
---|
| 634 |
|
---|
| 635 | if ((var EQ vn) AND grpstat[grp] AND
|
---|
| 636 | (2 EQ (ancmsw ? varmode[var][grp] :
|
---|
| 637 | grpmode[grp]))) {
|
---|
| 638 |
|
---|
| 639 | /* fix pointers */
|
---|
| 640 |
|
---|
| 641 | if (p_bak EQ ep)
|
---|
| 642 | p_bak = rp;
|
---|
| 643 |
|
---|
| 644 | if (p_cur EQ ep)
|
---|
| 645 | p_cur = rp;
|
---|
| 646 |
|
---|
| 647 | if (p_ctr EQ ep)
|
---|
| 648 | p_ctr = rp;
|
---|
| 649 |
|
---|
| 650 | if (p_fwd EQ ep)
|
---|
| 651 | p_fwd = rp;
|
---|
| 652 |
|
---|
| 653 | e_del(e_rmv(ep)); /* delete */
|
---|
| 654 | rc = TRUE;
|
---|
| 655 | }
|
---|
| 656 | }
|
---|
| 657 |
|
---|
| 658 | ep = rp; /* next event */
|
---|
| 659 | }
|
---|
| 660 | }
|
---|
| 661 |
|
---|
| 662 | if (rc) { /* refresh the screen if it changed */
|
---|
| 663 |
|
---|
[0580615] | 664 | sc_refr(fc_val);
|
---|
[f40a309] | 665 | ds_anrs();
|
---|
[7258c6a] | 666 | ds_anvl();
|
---|
[f40a309] | 667 | }
|
---|
| 668 |
|
---|
| 669 | return(rc);
|
---|
| 670 | }
|
---|
| 671 |
|
---|
| 672 | /* |
---|
| 673 |
|
---|
| 674 | */
|
---|
| 675 |
|
---|
| 676 | /*
|
---|
| 677 | =============================================================================
|
---|
| 678 | sdxkey() -- score delete key processing
|
---|
| 679 | =============================================================================
|
---|
| 680 | */
|
---|
| 681 |
|
---|
| 682 | void sdxkey(void)
|
---|
| 683 | {
|
---|
| 684 | register int16_t col, grp, sect;
|
---|
| 685 | register struct s_entry *ep, *rp;
|
---|
| 686 |
|
---|
| 687 | if (NOT astat) /* only do when key goes down */
|
---|
| 688 | return;
|
---|
| 689 |
|
---|
| 690 | if (clkrun) /* ... and not while clock is running */
|
---|
| 691 | return;
|
---|
| 692 |
|
---|
| 693 | if (scmctl NE -1) /* ... and area 1 menu is down */
|
---|
| 694 | return;
|
---|
| 695 | /* |
---|
| 696 |
|
---|
| 697 | */
|
---|
| 698 | if (sdmctl EQ 4) { /* section menu is up */
|
---|
| 699 |
|
---|
| 700 | if (((vtcrow EQ 19) OR (vtcrow EQ 20)) AND
|
---|
| 701 | (vtccol GE 24)) {
|
---|
| 702 |
|
---|
| 703 | if (NOT recsw)
|
---|
| 704 | return;
|
---|
| 705 |
|
---|
| 706 | /* set up to delete a section marker */
|
---|
| 707 |
|
---|
| 708 | sect = ((vtccol - 24) >> 2) + ((vtcrow EQ 20) ? 10 : 0);
|
---|
| 709 | col = (vtccol - 24) & 3;
|
---|
| 710 |
|
---|
| 711 | switch (col) {
|
---|
| 712 |
|
---|
| 713 | case 0: /* delete begin section */
|
---|
| 714 |
|
---|
| 715 |
|
---|
| 716 | if (E_NULL NE (ep = seclist[curscor][sect])) {
|
---|
| 717 |
|
---|
| 718 | /* fix pointers */
|
---|
| 719 |
|
---|
| 720 | rp = ep->e_fwd;
|
---|
| 721 |
|
---|
| 722 | if (p_bak EQ ep)
|
---|
| 723 | p_bak = rp;
|
---|
| 724 |
|
---|
| 725 | if (p_cur EQ ep)
|
---|
| 726 | p_cur = rp;
|
---|
| 727 |
|
---|
| 728 | if (p_ctr EQ ep)
|
---|
| 729 | p_ctr = rp;
|
---|
| 730 |
|
---|
| 731 | if (p_fwd EQ ep)
|
---|
| 732 | p_fwd = rp;
|
---|
| 733 |
|
---|
| 734 | eh_rmv(ep, EH_SBGN); /* delete */
|
---|
| 735 | e_del(e_rmv(ep));
|
---|
| 736 | seclist[curscor][sect] = E_NULL;
|
---|
| 737 | sdmenu(-1); /* take down menu */
|
---|
| 738 | sc_refr(fc_val); /* refresh screen */
|
---|
| 739 | }
|
---|
| 740 |
|
---|
| 741 | break;
|
---|
| 742 | /* |
---|
| 743 |
|
---|
| 744 | */
|
---|
| 745 | case 1: /* section number */
|
---|
| 746 | case 2:
|
---|
| 747 | break;
|
---|
| 748 |
|
---|
| 749 | case 3: /* delete end section */
|
---|
| 750 |
|
---|
| 751 | if (E_NULL NE
|
---|
| 752 | (ep = ehfind(EV_SEND, -1L, sect, -1))) {
|
---|
| 753 |
|
---|
| 754 | /* fix pointers */
|
---|
| 755 |
|
---|
| 756 | rp = ep->e_fwd;
|
---|
| 757 |
|
---|
| 758 | if (p_bak EQ ep)
|
---|
| 759 | p_bak = rp;
|
---|
| 760 |
|
---|
| 761 | if (p_cur EQ ep)
|
---|
| 762 | p_cur = rp;
|
---|
| 763 |
|
---|
| 764 | if (p_ctr EQ ep)
|
---|
| 765 | p_ctr = rp;
|
---|
| 766 |
|
---|
| 767 | if (p_fwd EQ ep)
|
---|
| 768 | p_fwd = rp;
|
---|
| 769 |
|
---|
| 770 | eh_rmv(ep, EH_SEND); /* delete */
|
---|
| 771 | e_del(e_rmv(ep));
|
---|
| 772 | sdmenu(-1); /* take down menu */
|
---|
| 773 | sc_refr(fc_val); /* refresh screen */
|
---|
| 774 | }
|
---|
| 775 |
|
---|
| 776 | break;
|
---|
| 777 | }
|
---|
| 778 |
|
---|
| 779 | return;
|
---|
| 780 |
|
---|
| 781 | /* |
---|
| 782 |
|
---|
| 783 | */
|
---|
| 784 | } else if ((vtcrow EQ 23) AND
|
---|
| 785 | (vtccol GE 28) AND (vtccol LE 62)) {
|
---|
| 786 |
|
---|
| 787 | /* group map entry */
|
---|
| 788 |
|
---|
| 789 | col = vtccol - 28;
|
---|
| 790 |
|
---|
| 791 | if (2 EQ (col % 3))
|
---|
| 792 | return;
|
---|
| 793 |
|
---|
| 794 | grp = col / 3;
|
---|
| 795 | grptmap[grp] = -1;
|
---|
| 796 | dsgtme(grp);
|
---|
| 797 | return;
|
---|
| 798 | }
|
---|
| 799 | }
|
---|
| 800 |
|
---|
| 801 | if (NOT recsw) /* do only if recording */
|
---|
| 802 | return;
|
---|
| 803 |
|
---|
| 804 | if ((cyval GE 14) AND (cyval LE 223)) { /* notes */
|
---|
| 805 |
|
---|
| 806 | delnote(); /* delete a note */
|
---|
| 807 |
|
---|
| 808 | } else if ((cyval GE 224) AND (cyval LE 237)) { /* new data */
|
---|
| 809 |
|
---|
| 810 | if (cp2time(cxval))
|
---|
| 811 | delevts(-1, ctime); /* delete all events at cursor */
|
---|
| 812 |
|
---|
| 813 | /* |
---|
| 814 |
|
---|
| 815 | */
|
---|
| 816 |
|
---|
| 817 | } else if (stcrow EQ 17) {
|
---|
| 818 |
|
---|
| 819 | if ((stccol GE 11) AND (stccol LE 12))
|
---|
| 820 | delevts(EV_ASGN, t_cur); /* assignment */
|
---|
| 821 | else if (stccol EQ 19)
|
---|
| 822 | delevts(EV_TUNE, t_cur); /* tuning */
|
---|
| 823 | else if ((stccol GE 27) AND (stccol LE 29))
|
---|
| 824 | delevts(EV_TMPO, t_cur); /* tempo */
|
---|
| 825 | else if ((stccol GE 36) AND (stccol LE 38))
|
---|
| 826 | delevts(EV_INTP, t_cur); /* interpolation */
|
---|
| 827 | else if ((stccol GE 40) AND (stccol LE 43))
|
---|
| 828 | delevts(EV_STOP, t_cur); /* stop */
|
---|
| 829 | else if ((stccol GE 45) AND (stccol LE 48))
|
---|
| 830 | delevts(EV_NEXT, t_cur); /* next */
|
---|
| 831 | else if ((stccol GE 50) AND (stccol LE 55))
|
---|
| 832 | delevts(EV_PNCH, t_cur); /* punch in/out */
|
---|
| 833 |
|
---|
| 834 | } else if ((stcrow EQ 18) AND
|
---|
| 835 | (0 EQ ((stccol - 5) % 5))) { /* group status */
|
---|
| 836 |
|
---|
| 837 | delevts(EV_GRP, t_cur);
|
---|
| 838 |
|
---|
| 839 | } else if ((stcrow EQ 18) AND
|
---|
| 840 | ((2 EQ ((stccol - 5) % 5)) OR
|
---|
| 841 | (3 EQ ((stccol - 5) % 5)))) { /* instrument */
|
---|
| 842 |
|
---|
| 843 | delevts(EV_INST, t_cur);
|
---|
| 844 |
|
---|
| 845 | } else if (stcrow EQ 19) { /* transposition */
|
---|
| 846 |
|
---|
| 847 | delevts(EV_TRNS, t_cur);
|
---|
| 848 |
|
---|
| 849 | } else if ((stcrow EQ 20) AND (stccol GE 6) AND
|
---|
| 850 | (0 EQ ((stccol - 6) % 5))) { /* dynamics */
|
---|
| 851 |
|
---|
| 852 | delevts(EV_DYN, t_cur);
|
---|
| 853 |
|
---|
| 854 | } else if ((stcrow EQ 20) AND (stccol GE 6) AND
|
---|
| 855 | (2 EQ ((stccol - 6) % 5))) { /* location */
|
---|
| 856 |
|
---|
| 857 | delevts(EV_LOCN, t_cur);
|
---|
| 858 |
|
---|
| 859 | } else if (stcrow EQ 23) { /* analog */
|
---|
| 860 |
|
---|
| 861 | deladat();
|
---|
| 862 | /* |
---|
| 863 |
|
---|
| 864 | */
|
---|
| 865 | } else if (stcrow EQ 24) { /* score */
|
---|
| 866 |
|
---|
| 867 | if (stccol LE 4) {
|
---|
| 868 |
|
---|
| 869 | /* clear score */
|
---|
| 870 |
|
---|
| 871 | if (insmode) /* cancel insert mode */
|
---|
| 872 | icancel();
|
---|
[0580615] | 873 |
|
---|
[f40a309] | 874 | sc_clr(curscor); /* clear score itself */
|
---|
| 875 | selscor(curscor); /* refresh the display */
|
---|
| 876 |
|
---|
| 877 | } else if ((stccol GE 10) AND (stccol LE 25)) {
|
---|
| 878 |
|
---|
| 879 | /* clear score name */
|
---|
| 880 |
|
---|
| 881 | memset(scname[curscor], ' ', 16);
|
---|
| 882 | dswin(13);
|
---|
| 883 | }
|
---|
| 884 | }
|
---|
| 885 | }
|
---|
| 886 |
|
---|
| 887 | /* |
---|
| 888 |
|
---|
| 889 | */
|
---|
| 890 |
|
---|
| 891 | /*
|
---|
| 892 | =============================================================================
|
---|
[0580615] | 893 | sdmkey() -- score display menu key processor
|
---|
[f40a309] | 894 | =============================================================================
|
---|
| 895 | */
|
---|
| 896 |
|
---|
[6262b5c] | 897 | void sdmkey(void)
|
---|
| 898 | {
|
---|
| 899 | if (astat) {
|
---|
| 900 |
|
---|
| 901 | if (insmode)
|
---|
| 902 | icancel();
|
---|
| 903 | }
|
---|
| 904 |
|
---|
| 905 | stdmkey();
|
---|
| 906 | }
|
---|
| 907 |
|
---|
| 908 | /* |
---|
| 909 |
|
---|
| 910 | */
|
---|
| 911 |
|
---|
| 912 | /*
|
---|
| 913 | =============================================================================
|
---|
| 914 | scfield() -- setup field routines for the score display
|
---|
| 915 | =============================================================================
|
---|
| 916 | */
|
---|
| 917 |
|
---|
| 918 | void scfield(void)
|
---|
| 919 | {
|
---|
| 920 | curset(&sc_flds);
|
---|
| 921 | }
|
---|
| 922 |
|
---|