[f40a309] | 1 | /*
|
---|
| 2 | =============================================================================
|
---|
| 3 | adselbx.c -- assignment editor box selection functions
|
---|
| 4 | Version 30 -- 1988-12-08 -- D.N. Lynx Crowe
|
---|
| 5 | =============================================================================
|
---|
| 6 | */
|
---|
| 7 |
|
---|
| 8 | #define DEBUGIT 0
|
---|
| 9 |
|
---|
[b28a12e] | 10 | #include "ram.h"
|
---|
[f40a309] | 11 |
|
---|
| 12 | #define ATWROW 10 /* typewriter row */
|
---|
| 13 | #define ATWCOL 1 /* typewriter column */
|
---|
| 14 | #define ATDECOL 1 /* data entry base column */
|
---|
| 15 |
|
---|
| 16 | /* |
---|
| 17 |
|
---|
| 18 | */
|
---|
| 19 |
|
---|
| 20 | struct selbox adboxes[] = {
|
---|
| 21 |
|
---|
| 22 | { 1, 0, 94, 27, 0, adfnbox}, /* 0: curasg, caname */
|
---|
[60288f5] | 23 | { 1, 28, 94, 40, 1, adfnbox}, /* 1: asgtab[curasg] */
|
---|
| 24 | { 1, 56, 94, 68, 2, entbh}, /* 2: curmop */
|
---|
| 25 | { 1, 42, 94, 54, 3, entbh}, /* 3: prgchan */
|
---|
[f40a309] | 26 | { 96, 1, 190, 138, 4, entbh}, /* 4: vce2grp[voice] */
|
---|
| 27 | {192, 1, 302, 138, 5, adfnbox}, /* 5: mctlnum[srcvar] */
|
---|
| 28 | {304, 1, 510, 138, 6, adfnbox}, /* 6: grp2prt[group][pt|ch] */
|
---|
| 29 | { 1, 140, 510, 348, 7, adfnbox}, /* 7: key2grp[key] */
|
---|
| 30 | { 1, 70, 38, 82, 8, adfnbox}, /* 8: auxctl */
|
---|
[60288f5] | 31 | { 40, 70, 94, 82, 9, adfnbox}, /* 9: curtun */
|
---|
[f40a309] | 32 | { 1, 84, 94, 138, 10, entbh}, /* 10: ps_intn, ps_rate, ps_dpth */
|
---|
| 33 |
|
---|
| 34 | { 0, 0, 0, 0, 0, FN_NULL} /* end of table */
|
---|
| 35 | };
|
---|
| 36 |
|
---|
| 37 | /* |
---|
| 38 |
|
---|
| 39 | */
|
---|
| 40 |
|
---|
| 41 | /*
|
---|
| 42 | =============================================================================
|
---|
| 43 | endatyp() -- end function for virtual typewriter
|
---|
| 44 | =============================================================================
|
---|
[0580615] | 45 | */
|
---|
[f40a309] | 46 |
|
---|
| 47 | void endatyp(void)
|
---|
| 48 | {
|
---|
| 49 | adnamsw = FALSE;
|
---|
| 50 | submenu = FALSE;
|
---|
| 51 |
|
---|
| 52 | if (admctl EQ -1)
|
---|
| 53 | adswin(7); /* refresh key map window */
|
---|
| 54 | else
|
---|
| 55 | admenu(admctl); /* refresh menu window */
|
---|
| 56 | }
|
---|
| 57 |
|
---|
| 58 | /* |
---|
| 59 |
|
---|
| 60 | */
|
---|
| 61 |
|
---|
| 62 | /*
|
---|
| 63 | =============================================================================
|
---|
| 64 | admtxt() -- output text to the submenu
|
---|
[7258c6a] | 65 | =============================================================================
|
---|
[f40a309] | 66 | */
|
---|
| 67 |
|
---|
| 68 | void admtxt(int16_t row, int16_t col, int8_t *txt, int16_t tag)
|
---|
| 69 | {
|
---|
| 70 | if (v_regs[5] & 0x0180)
|
---|
| 71 | vbank(0);
|
---|
| 72 |
|
---|
| 73 | vcputsv(asgob, 64, ACFBX07, ACBBX07, row + 10, col, txt, 14);
|
---|
| 74 | }
|
---|
| 75 |
|
---|
| 76 | /* |
---|
| 77 |
|
---|
| 78 | */
|
---|
| 79 |
|
---|
| 80 | /*
|
---|
| 81 | =============================================================================
|
---|
[7258c6a] | 82 | admenu() -- put up or take down an assignment display submenu
|
---|
[f40a309] | 83 | =============================================================================
|
---|
[7258c6a] | 84 | */
|
---|
[f40a309] | 85 |
|
---|
| 86 | void admenu(int16_t n)
|
---|
| 87 | {
|
---|
| 88 | register int16_t i;
|
---|
| 89 |
|
---|
| 90 | if (n GE 0) { /* put up a submenu */
|
---|
| 91 |
|
---|
| 92 | itxput = admtxt; /* setup output function */
|
---|
| 93 |
|
---|
| 94 | if (v_regs[5] & 0x0180)
|
---|
| 95 | vbank(0);
|
---|
| 96 |
|
---|
| 97 | vbfill4(asgob, 128, adbox[7][0], adbox[7][1],
|
---|
| 98 | adbox[7][2], adbox[7][3], exp_c(adbox[7][5]));
|
---|
| 99 |
|
---|
| 100 | switch (n) { /* fill the window */
|
---|
| 101 |
|
---|
| 102 | case 0: /* instruments */
|
---|
| 103 |
|
---|
| 104 | showim(); /* show the instruments */
|
---|
| 105 | break;
|
---|
| 106 |
|
---|
| 107 | case 1: /* assignments */
|
---|
| 108 |
|
---|
| 109 | showam(lastam); /* show the assignments */
|
---|
| 110 | settc(0, 9); /* position the cursor */
|
---|
| 111 | break;
|
---|
| 112 |
|
---|
| 113 | case 2: /* tunings */
|
---|
| 114 |
|
---|
| 115 | showtm(); /* show the tunings */
|
---|
| 116 | settc(5, 10); /* position the cursor */
|
---|
| 117 | break;
|
---|
| 118 |
|
---|
| 119 | default: /* eh ? */
|
---|
| 120 |
|
---|
| 121 | break;
|
---|
| 122 | }
|
---|
| 123 |
|
---|
| 124 | } else { /* take down the submenu */
|
---|
| 125 |
|
---|
| 126 | admctl = n; /* set new menu type */
|
---|
| 127 | adswin(7); /* refresh the window */
|
---|
| 128 | }
|
---|
| 129 |
|
---|
| 130 | point = adpoint;
|
---|
| 131 |
|
---|
| 132 | if (v_regs[5] & 0x0180)
|
---|
| 133 | vbank(0);
|
---|
| 134 |
|
---|
| 135 | lseg( 0, 0, 0, 349, AK_BORD); /* fix left edge of screen */
|
---|
| 136 | lseg(511, 0, 511, 349, AK_BORD); /* fix right edge of screen */
|
---|
| 137 |
|
---|
| 138 | admctl = n; /* set new menu type */
|
---|
| 139 | }
|
---|
| 140 |
|
---|
| 141 | /* |
---|
| 142 |
|
---|
| 143 | */
|
---|
| 144 |
|
---|
| 145 | /*
|
---|
[7258c6a] | 146 | =============================================================================
|
---|
[f40a309] | 147 | adfnbox() -- assignment display box hit processor
|
---|
[7258c6a] | 148 | =============================================================================
|
---|
| 149 | */
|
---|
[f40a309] | 150 |
|
---|
| 151 | int16_t adfnbox(int16_t n)
|
---|
| 152 | {
|
---|
| 153 | register int16_t i, grp, key, line;
|
---|
| 154 | int16_t row, col;
|
---|
| 155 |
|
---|
| 156 | row = hitcy / 14;
|
---|
| 157 | col = hitcx >> 3;
|
---|
| 158 |
|
---|
| 159 | switch (hitbox) {
|
---|
| 160 |
|
---|
| 161 | case 0: /* asignment number or name */
|
---|
| 162 |
|
---|
| 163 | if ((NOT adnamsw) AND (row EQ 0)) { /* menu or table */
|
---|
| 164 |
|
---|
| 165 | if ((col GE 1) AND (col LE 7)) { /* menu */
|
---|
| 166 |
|
---|
| 167 | if (admctl NE 1) {
|
---|
| 168 |
|
---|
| 169 | lastam = 0;
|
---|
| 170 | admenu(1); /* put up menu */
|
---|
| 171 |
|
---|
| 172 | } else {
|
---|
| 173 |
|
---|
| 174 | if (lastam EQ 0) { /* show page 2 */
|
---|
| 175 |
|
---|
| 176 | lastam = 60;
|
---|
| 177 | admenu(1);
|
---|
| 178 |
|
---|
| 179 | } else { /* take down menu */
|
---|
| 180 |
|
---|
[60288f5] | 181 | lastam = 0;
|
---|
[f40a309] | 182 | admenu(-1);
|
---|
| 183 | }
|
---|
| 184 | }
|
---|
[60288f5] | 185 |
|
---|
[f40a309] | 186 | return(SUCCESS);
|
---|
| 187 |
|
---|
| 188 | } else { /* table */
|
---|
| 189 |
|
---|
| 190 | return(entbh(-1)); /* data entry */
|
---|
| 191 | }
|
---|
| 192 | }
|
---|
| 193 |
|
---|
| 194 | if (adnamsw) { /* typewriter is up */
|
---|
| 195 |
|
---|
| 196 | if (vtyper()) {
|
---|
| 197 |
|
---|
| 198 | if (NOT asgmod) {
|
---|
| 199 |
|
---|
| 200 | asgmod = TRUE;
|
---|
| 201 | adswin(0);
|
---|
| 202 | }
|
---|
| 203 | }
|
---|
| 204 | /* |
---|
| 205 |
|
---|
| 206 | */
|
---|
| 207 | } else { /* setup the typewriter */
|
---|
| 208 |
|
---|
| 209 | vbank(0);
|
---|
| 210 | vbfill4(asgob, 128, CTOX(ATWCOL), RTOY(ATWROW),
|
---|
| 211 | CTOX(ATWCOL+30) - 1, RTOY(ATWROW+3) - 1,
|
---|
| 212 | exp_c(ACBBX04));
|
---|
| 213 |
|
---|
| 214 | tsplot4(asgob, 64, ACFBX04, ATWROW, ATWCOL, vtlin1, 14);
|
---|
| 215 | tsplot4(asgob, 64, ACFBX04, ATWROW+1, ATWCOL, vtlin2, 14);
|
---|
| 216 | tsplot4(asgob, 64, ACFBX04, ATWROW+2, ATWCOL, vtlin3, 14);
|
---|
| 217 |
|
---|
| 218 | point = adpoint; /* draw a border ... */
|
---|
| 219 |
|
---|
| 220 | lseg(CTOX(ATWCOL) - 1, RTOY(ATWROW) - 1, /* up, lt */
|
---|
| 221 | CTOX(ATWCOL+30), RTOY(ATWROW) - 1, /* up, rt */
|
---|
| 222 | AK_BORD);
|
---|
| 223 |
|
---|
| 224 | lseg(CTOX(ATWCOL+30), RTOY(ATWROW) - 1, /* up, rt */
|
---|
| 225 | CTOX(ATWCOL+30), RTOY(ATWROW+3) - 1, /* dn, rt */
|
---|
| 226 | AK_BORD);
|
---|
| 227 |
|
---|
| 228 | lseg(CTOX(ATWCOL+30), RTOY(ATWROW+3) - 1, /* dn, rt */
|
---|
| 229 | CTOX(1) - 1, RTOY(ATWROW+3) - 1, /* dn, lt */
|
---|
| 230 | AK_BORD);
|
---|
| 231 |
|
---|
| 232 | lseg(CTOX(1) - 1, RTOY(ATWROW+3) - 1, /* dn, lt */
|
---|
| 233 | CTOX(1) - 1, RTOY(ATWROW) - 1, /* up, lt */
|
---|
| 234 | AK_BORD);
|
---|
| 235 |
|
---|
| 236 | vtsetup(asgob, vtdisp, ATDECOL,
|
---|
| 237 | caname,
|
---|
| 238 | ATWROW, ATWCOL,
|
---|
| 239 | advacur, bspacur, nokey, nokey, endatyp,
|
---|
[60288f5] | 240 | adbox[n][4], adbox[n][5]);
|
---|
[f40a309] | 241 |
|
---|
| 242 | adnamsw = TRUE;
|
---|
| 243 | submenu = TRUE;
|
---|
| 244 | }
|
---|
| 245 |
|
---|
| 246 | return(SUCCESS);
|
---|
| 247 | /* |
---|
| 248 |
|
---|
| 249 | */
|
---|
| 250 | case 1:
|
---|
| 251 |
|
---|
[60288f5] | 252 | if ((col GE 1) AND (col LE 4)) { /* store */
|
---|
[f40a309] | 253 |
|
---|
| 254 | if (curasg EQ 0)
|
---|
| 255 | return(FAILURE);
|
---|
| 256 |
|
---|
| 257 | putasg(curasg);
|
---|
[60288f5] | 258 | adswin(0);
|
---|
[f40a309] | 259 | return(SUCCESS);
|
---|
| 260 |
|
---|
| 261 | } else if ((col GE 6) AND (col LE 10)) { /* retrieve */
|
---|
| 262 |
|
---|
| 263 | getasg(curasg);
|
---|
| 264 | awins();
|
---|
| 265 | return(SUCCESS);
|
---|
[60288f5] | 266 | }
|
---|
[f40a309] | 267 |
|
---|
| 268 | case 5: /* toggle controller omni mode */
|
---|
| 269 |
|
---|
| 270 | if (col EQ 25) {
|
---|
| 271 |
|
---|
| 272 | if ((row LT 5) OR (row GT 8))
|
---|
| 273 | return(FAILURE);
|
---|
| 274 |
|
---|
| 275 | mctlnum[row - 5] ^= GTAG1;
|
---|
| 276 |
|
---|
| 277 | if (v_regs[5] &0x0180)
|
---|
| 278 | vbank(0);
|
---|
| 279 |
|
---|
| 280 | bfs[0] = row - 5 + '2';
|
---|
[60288f5] | 281 | bfs[1] = '\0';
|
---|
[f40a309] | 282 |
|
---|
| 283 | tsplot4(asgob, 64,
|
---|
| 284 | (mctlnum[row - 5] & GTAG1) ?
|
---|
[60288f5] | 285 | AK_MODC : adbox[n][4],
|
---|
[f40a309] | 286 | row, adbox[n][7], bfs, 14);
|
---|
| 287 |
|
---|
| 288 | return(SUCCESS);
|
---|
| 289 |
|
---|
| 290 | } else {
|
---|
| 291 |
|
---|
| 292 | return(entbh(-1));
|
---|
| 293 | }
|
---|
| 294 | /* |
---|
| 295 |
|
---|
| 296 | */
|
---|
| 297 | case 6: /* instruments, groups, ports, channels */
|
---|
| 298 |
|
---|
| 299 | if (((col EQ 41) OR (col EQ 42) OR
|
---|
| 300 | (col EQ 54) OR (col EQ 55)) AND (row EQ 3)) {
|
---|
[60288f5] | 301 |
|
---|
[f40a309] | 302 | /* instrument menu */
|
---|
| 303 |
|
---|
| 304 | if (admctl NE 0)
|
---|
| 305 | admenu(0); /* put up menu */
|
---|
[60288f5] | 306 | else
|
---|
[f40a309] | 307 | admenu(-1); /* take down menu */
|
---|
| 308 |
|
---|
| 309 | return(SUCCESS);
|
---|
| 310 |
|
---|
| 311 | } else if (col EQ 39) { /* groups 1..6 */
|
---|
| 312 |
|
---|
| 313 | if ((row LT 4) OR (row GT 9))
|
---|
| 314 | return(FAILURE);
|
---|
| 315 |
|
---|
| 316 | /* toggle "legato" mode */
|
---|
| 317 |
|
---|
| 318 | grp = row - 4;
|
---|
| 319 |
|
---|
| 320 | ins2grp[grp] ^= GTAG1;
|
---|
| 321 |
|
---|
| 322 | bfs[0] = '1' + grp;
|
---|
| 323 | bfs[1] = '\0';
|
---|
[60288f5] | 324 |
|
---|
[f40a309] | 325 | if (v_regs[5] & 0x0180)
|
---|
| 326 | vbank(0);
|
---|
| 327 |
|
---|
| 328 | tsplot4(asgob, 64,
|
---|
| 329 | ((ins2grp[grp] & GTAG1) ? AK_MODC : adbox[n][4]),
|
---|
| 330 | row, col, bfs, 14);
|
---|
| 331 |
|
---|
| 332 | return(SUCCESS);
|
---|
| 333 | /* |
---|
| 334 |
|
---|
| 335 | */
|
---|
| 336 | } else if (col EQ 52) { /* groups 7..12 */
|
---|
| 337 |
|
---|
| 338 | if ((row LT 4) OR (row GT 9))
|
---|
| 339 | return(FAILURE);
|
---|
| 340 |
|
---|
| 341 | /* toggle "legato" mode */
|
---|
| 342 |
|
---|
| 343 | grp = row + 2;
|
---|
| 344 |
|
---|
| 345 | ins2grp[grp] ^= GTAG1;
|
---|
| 346 |
|
---|
| 347 | bfs[0] = grp + ((grp > 8) ? 163 : '1');
|
---|
[60288f5] | 348 | bfs[1] = '\0';
|
---|
[f40a309] | 349 |
|
---|
| 350 | if (v_regs[5] & 0x0180)
|
---|
| 351 | vbank(0);
|
---|
[60288f5] | 352 |
|
---|
[f40a309] | 353 | tsplot4(asgob, 64,
|
---|
| 354 | ((ins2grp[grp] & GTAG1) ? AK_MODC : adbox[n][4]),
|
---|
| 355 | row, col, bfs, 14);
|
---|
| 356 |
|
---|
| 357 | return(SUCCESS);
|
---|
| 358 |
|
---|
[60288f5] | 359 | } else {
|
---|
[f40a309] | 360 |
|
---|
| 361 | return(entbh(-1)); /* data entry */
|
---|
| 362 | }
|
---|
| 363 | /* |
---|
| 364 |
|
---|
| 365 | */
|
---|
| 366 | case 7: /* assignment map */
|
---|
| 367 |
|
---|
| 368 | if (admctl NE -1)
|
---|
| 369 | return(FAILURE);
|
---|
| 370 |
|
---|
| 371 | if (asghit) {
|
---|
| 372 |
|
---|
| 373 | if (asghit EQ (hitcy / 14)) { /* previous hit ? */
|
---|
| 374 |
|
---|
| 375 | /* toggle selected key status */
|
---|
| 376 |
|
---|
[60288f5] | 377 | grp = asghit - 11;
|
---|
[f40a309] | 378 | line = (14 * grp) + AK_BASE;
|
---|
| 379 | key = 0;
|
---|
| 380 |
|
---|
| 381 | for (i = 0; i < 88; i++)
|
---|
| 382 | if ((hitcx GE (asgkble[i] + 24)) AND
|
---|
| 383 | (hitcx LE (asgkble[i] + (i EQ 87 ? 31 : 28))))
|
---|
| 384 | key = i + 1;
|
---|
| 385 |
|
---|
| 386 | if (key-- EQ 0)
|
---|
| 387 | return(FAILURE);
|
---|
| 388 |
|
---|
| 389 | if (key LT asgfks) {
|
---|
| 390 |
|
---|
| 391 | i = asgfks;
|
---|
| 392 | asgfks = key;
|
---|
| 393 | key = i;
|
---|
| 394 | }
|
---|
| 395 |
|
---|
| 396 | for (i = asgfks; i LE key; i++)
|
---|
| 397 | key2grp[i] ^= (0x0001 << grp);
|
---|
| 398 |
|
---|
| 399 | drawk2g(grp);
|
---|
| 400 | asghit = 0;
|
---|
| 401 |
|
---|
| 402 | if (NOT asgmod) {
|
---|
| 403 |
|
---|
| 404 | asgmod = TRUE;
|
---|
| 405 | adswin(0);
|
---|
| 406 | }
|
---|
| 407 |
|
---|
| 408 | } else {
|
---|
| 409 |
|
---|
| 410 | /* clear the selection */
|
---|
| 411 |
|
---|
| 412 | drawk2g(asghit - 11);
|
---|
| 413 | asghit = 0;
|
---|
| 414 | }
|
---|
| 415 | /* |
---|
| 416 |
|
---|
[60288f5] | 417 | */
|
---|
[f40a309] | 418 | } else {
|
---|
| 419 |
|
---|
| 420 | /* make initial selection */
|
---|
| 421 |
|
---|
| 422 | asghit = hitcy / 14;
|
---|
| 423 | grp = asghit - 11;
|
---|
| 424 |
|
---|
| 425 | if (grp2prt[grp][0] NE 1) {
|
---|
| 426 |
|
---|
| 427 | asghit = 0;
|
---|
| 428 | return(FAILURE);
|
---|
| 429 | }
|
---|
| 430 |
|
---|
[60288f5] | 431 | line = (14 * grp) + AK_BASE;
|
---|
[f40a309] | 432 | key = 0;
|
---|
| 433 |
|
---|
| 434 | for (i = 0; i < 88; i++)
|
---|
| 435 | if ((hitcx GE (asgkble[i] + 24)) AND
|
---|
| 436 | (hitcx LE (asgkble[i] + (i EQ 87 ? 31 : 28))))
|
---|
| 437 | key = i + 1;
|
---|
| 438 |
|
---|
| 439 | if (key-- EQ 0) {
|
---|
| 440 |
|
---|
| 441 | asghit = 0;
|
---|
[60288f5] | 442 | return(FAILURE);
|
---|
[f40a309] | 443 | }
|
---|
| 444 |
|
---|
| 445 | asgfks = key;
|
---|
| 446 |
|
---|
| 447 | vbfill4(asgob, 128, asgkble[key] + 24, line,
|
---|
[60288f5] | 448 | asgkble[key] + (key EQ 87 ? 31 : 28),
|
---|
[f40a309] | 449 | line + 3, exp_c(AK_SELC2));
|
---|
| 450 |
|
---|
| 451 | }
|
---|
| 452 |
|
---|
| 453 | return(SUCCESS);
|
---|
| 454 |
|
---|
| 455 | case 8: /* aux ctl */
|
---|
| 456 |
|
---|
| 457 | setaux(NOT auxctl);
|
---|
| 458 | adswin(8);
|
---|
[60288f5] | 459 | return(SUCCESS);
|
---|
[f40a309] | 460 |
|
---|
| 461 | case 9: /* tuning menu */
|
---|
| 462 |
|
---|
[60288f5] | 463 | if ((col GE 6) AND (col LE 8)) {
|
---|
[f40a309] | 464 |
|
---|
| 465 | if (admctl NE 2)
|
---|
[0c834c5] | 466 | admenu(2); /* put up menu */
|
---|
[60288f5] | 467 | else
|
---|
| 468 | admenu(-1); /* take down menu */
|
---|
[6262b5c] | 469 |
|
---|
| 470 | return(SUCCESS);
|
---|
| 471 |
|
---|
| 472 | } else {
|
---|
| 473 |
|
---|
| 474 | return(entbh(-1)); /* data entry */
|
---|
| 475 | }
|
---|
| 476 | }
|
---|
| 477 |
|
---|
| 478 | return(FAILURE);
|
---|
| 479 | }
|
---|
| 480 |
|
---|