source: buchla-68k/ram/scselbx.c@ fa38804

Last change on this file since fa38804 was fa38804, checked in by Thomas Lopatic <thomas@…>, 7 years ago

Removed form-feed comments.

  • Property mode set to 100644
File size: 33.4 KB
Line 
1/*
2 =============================================================================
3 scselbx.c -- MIDAS-VII -- score editor box selection functions
4 Version 87 -- 1989-11-15 -- D.N. Lynx Crowe
5 =============================================================================
6*/
7
8#include "ram.h"
9
10int8_t *sdmenus[][3] = { /* score display menus */
11
12 /* 0 - typewriter */
13
14 {" ABCDEFGHIJKLMNOPQRSTUVWXYZ | ",
15 " abcdefghijklmnopqrstuvwxyz -*- ",
16 " 0123456789+-/*().,:;!?&<> | "},
17
18 /* 1 - note edit */
19
20 {" Begin Acc Move Note Escape ",
21 " Begin Nat Move Begin ",
22 " End Note Move End "},
23
24 /* 2 - clock source */
25
26 {" Local PLS24 Step ",
27 " MIDI PLS48 ",
28 " SMPTE PLS96 "},
29
30 /* 3 - clock control */
31
32 {" Local ",
33 " MIDI ",
34 " SMPTE "},
35
36 /* 4 - Section menu */
37
38 {" GoTo Move SMPTE ",
39 " Begin Copy Del Gr ",
40 " End Merge Del Ev "}
41};
42
43int8_t sdmln3[] =
44 " ReGrp Remove Trn S ";
45
46int8_t sdmln4[] =
47 "Escape D ";
48
49int16_t sdmht[][3] = { /* score section menu highlight table */
50
51 /* row, lcol, rcol */
52
53 { 6, 0, 0}, /* 0 - SOP_NUL */
54 { 3, 1, 4}, /* 1 - SOP_GO */
55 { 4, 1, 5}, /* 2 - SOP_BGN */
56 { 5, 1, 3}, /* 3 - SOP_END */
57 { 3, 8, 11}, /* 4 - SOP_MOV */
58 { 4, 8, 11}, /* 5 - SOP_CPY */
59 { 5, 8, 12}, /* 6 - SOP_MRG */
60 { 3, 15, 19}, /* 7 - SOP_STC */
61 { 4, 15, 23}, /* 8 - SOP_DGR */
62 { 5, 15, 23}, /* 9 - SOP_DEV */
63 { 6, 15, 20}, /* 10 - SOP_RMV */
64 { 6, 8, 12} /* 11 - SOP_GRP */
65};
66
67int16_t sdmlim[][4] = { /* score display menu cursor limits */
68
69 /* top, left, bottom, right */
70
71 { 19, 1, 21, 30 }, /* 0 - typewriter */
72 { 19, 1, 21, 30 }, /* 1 - note edit */
73 { 19, 1, 21, 20 }, /* 2 - clock source */
74 { 19, 1, 21, 19 }, /* 3 - clock control */
75 { 19, 1, 23, 62 } /* 4 - section menu */
76};
77
78int8_t *nedlbl[] = { /* note edit function labels */
79
80 "Note Edit", /* 0 - NOP_NUL */
81 "Begin Acc", /* 1 - NOP_ACC */
82 "Begin Nat", /* 2 - NOP_NAT */
83 "End Note ", /* 3 - NOP_END */
84 "Move Note", /* 4 - NOP_MVN */
85 "Move Beg ", /* 5 - NOP_MVB */
86 "Move End " /* 6 - NOP_MVE */
87};
88
89struct selbox sdboxes[] = {
90
91 { 0, 0, 175, 13, 0, sdboxfn}, /* 0 - Sec, Beat, Frame */
92 {176, 0, 231, 13, 1, sdboxfn}, /* 1 - Insert */
93 {232, 0, 439, 13, 2, sdboxfn}, /* 2 - Clock */
94 {440, 0, 511, 13, 3, sdboxfn}, /* 3 - Note Edit */
95
96 { 0, 238, 111, 251, 4, sdboxfn}, /* 4 - Assignment */
97 {112, 238, 167, 251, 5, sdboxfn}, /* 5 - Tune */
98 {168, 238, 247, 251, 6, entbh}, /* 6 - Tempo */
99 {248, 238, 319, 251, 7, entbh}, /* 7 - Interpolate */
100 {320, 238, 398, 251, 8, sdboxfn}, /* 8 - Stop/Next */
101 {400, 238, 455, 251, 9, sdboxfn}, /* 9 - In/Out */
102 {456, 238, 511, 251, 10, sdboxfn}, /* 10 - Output */
103
104 { 0, 252, 511, 307, 11, sdboxfn}, /* 11 - Grp, Trns, Dyn, Vel */
105
106 { 0, 308, 511, 335, 12, sdboxfn}, /* 12 - Ansrc, Anval */
107
108 { 0, 336, 215, 349, 13, sdboxfn}, /* 13 - Score Title */
109 {216, 336, 455, 349, 14, sdboxfn}, /* 14 - Rec Mode */
110 {456, 336, 511, 349, 15, sdboxfn}, /* 15 - Memory */
111
112 { 0, 14, 511, 237, 16, sdboxfn}, /* 16 - Note Display */
113
114 { 0, 0, 0, 0, 0, FN_NULL} /* end of table */
115};
116
117/*
118 =============================================================================
119 insect() -- return section number pointed to in section menu, or -1
120 =============================================================================
121*/
122
123int16_t insect(void)
124{
125 register int16_t col;
126
127 col = vtccol - 24;
128
129 if (col < 0)
130 return(-1);
131
132 sgoflag = col & 3;
133
134 if ((vtcrow < 19) OR (vtcrow > 20))
135 return(-1);
136
137 return((col >> 2) + (10 * (vtcrow - 19)));
138}
139
140/*
141 =============================================================================
142 svtdsp() -- display data for the virtual typewriter
143 =============================================================================
144*/
145
146void svtdsp(uint16_t *obj, uint16_t fg, uint16_t bg, int16_t row, int16_t col, int8_t *buf)
147{
148 if (v_regs[5] & 0x0180)
149 vbank(0);
150
151 vputs(obj, row - 16, col, buf, SDW13ATR);
152}
153
154/*
155 =============================================================================
156 svtstop() -- end vitrual typewriter data entry
157 =============================================================================
158*/
159
160void svtstop(void)
161{
162 sdmenu(-1);
163}
164
165/*
166 =============================================================================
167 bspscur() -- backspace the score display text cursor
168 =============================================================================
169*/
170
171void bspscur(void)
172{
173 register int16_t newcol;
174
175 if (infield(stcrow, stccol, curfet))
176 cfetp = infetp;
177 else
178 return;
179
180 newcol = stccol - 1;
181
182 if (newcol GE cfetp->flcol)
183 stcpos(stcrow, newcol);
184
185 cxval = CTOX(stccol);
186 cyval = RTOY(stcrow);
187}
188
189/*
190 =============================================================================
191 dsects() -- display list of section numbers
192 Highlight active sections and indicate SMPTE time-coded sections.
193 =============================================================================
194*/
195
196void dsects(void)
197{
198 register int16_t atr, row, col, i, j;
199 int8_t buf[8];
200 int8_t cl, cr, csl, csr;
201 int16_t begun;
202
203 register struct s_entry *sp;
204
205 if (v_regs[5] & 0x0180)
206 vbank(0);
207
208 row = 3;
209
210 for (i = 0; i < N_SECTS; i += 10) {
211
212 col = 24;
213
214 for (j = 0; j < 10; j++) {
215
216 if (stimes[curscor][i + j].sflags) { /* SMPTE time */
217
218 csl = '[';
219 csr = ']';
220
221 } else { /* no SMPTE time */
222
223 csl = '{';
224 csr = '}';
225 }
226
227 cl = ' ';
228 cr = ' ';
229
230 if (E_NULL NE seclist[curscor][i + j]) {
231
232 begun = TRUE;
233 atr = (SDBGMM | (SD_CHNG << 4));
234 cl = csl;
235
236 } else {
237
238 begun = FALSE;
239 atr = SDMENUBG;
240 }
241
242 sp = hplist[curscor][EH_SEND];
243
244 while (sp) {
245
246 if (sp->e_data1 EQ (i + j)) {
247
248 cr = begun ? csr : '}';
249 break;
250 }
251
252 sp = sp->e_up;
253 }
254
255 sprintf(buf, "%c%02d%c", cl, 1 + (i + j), cr);
256
257 vputs(obj8, row, col, buf, atr);
258 col += 4;
259 }
260
261 ++row;
262 }
263}
264
265/*
266 =============================================================================
267 dsgtmn() -- display group map source group number
268 =============================================================================
269*/
270
271void dsgtmn(int16_t n, int16_t f)
272{
273 int8_t buf[4];
274 int16_t atr, col;
275
276 sprintf(buf, "%02d", n + 1);
277
278 col = (3 * n) + 28;
279 atr = f ? (SDBGMM | (SD_CHNG <<4)) : SDMENUBG;
280
281 if (v_regs[5] & 0x0180)
282 vbank(0);
283
284 vputs(obj8, 6, col, buf, atr);
285}
286
287/*
288 =============================================================================
289 dsgtme() -- display group map destination group number
290 =============================================================================
291*/
292
293void dsgtme(int16_t n)
294{
295 int8_t buf[4];
296 int16_t col;
297
298 if (grptmap[n] EQ -1)
299 strcpy(buf, " ");
300 else
301 sprintf(buf, "%02d", grptmap[n] + 1);
302
303 col = (3 * n) + 28;
304
305 if (v_regs[5] & 0x0180)
306 vbank(0);
307
308 vputs(obj8, 7, col, buf, SDMENUBG);
309}
310
311/*
312 =============================================================================
313 dsgtmap() -- display group map and transposition value
314 =============================================================================
315*/
316
317void dsgtmap(void)
318{
319 int8_t buf[6];
320 register int16_t i;
321
322 if (v_regs[5] & 0x0180)
323 vbank(0);
324
325 sprintf(buf, "%c%02d", grptran < 0 ? '-' : '+', abs(grptran));
326
327 vputs(obj8, 7, 22, buf, SDMENUBG);
328
329 for (i = 0; i < 12; i++) {
330
331 dsgtmn(i, gtmsel EQ i);
332 dsgtme(i);
333 }
334}
335
336/*
337 =============================================================================
338 ingroup() -- return group number selected
339 =============================================================================
340*/
341
342int16_t ingroup(void)
343{
344 register int16_t col;
345
346 col = vtccol - 28;
347
348 if (col < 0)
349 return(-1);
350
351 if (2 EQ (col % 3))
352 return(-1);
353
354 return(col / 3);
355}
356
357/*
358 =============================================================================
359 sdmtxt() -- output text to the score area submenu
360 =============================================================================
361*/
362
363void sdmtxt(int16_t row, int16_t col, int8_t *txt, int16_t tag)
364{
365 if ((v_regs[5] & 0x0180) NE 0x0100)
366 vbank(1);
367
368 vcputsv(obj11, 64, SD_TEXT, SDBG16, row, col, txt, 14);
369}
370
371/*
372 =============================================================================
373 showam() -- show menu of assignments
374 =============================================================================
375*/
376
377void showam(int16_t asg)
378{
379 register int16_t col, na, row;
380
381 if (asg EQ 1)
382 na = 48;
383 else
384 na = NASGS;
385
386 for (col = 2; col < 60; col += 15) {
387
388 if (asg GE na)
389 return;
390
391 (*itxput)(0, col, "No Assignment", 0);
392
393 for (row = 1; row < 15; row++) {
394
395 if (asg GE na)
396 return;
397
398 sprintf(bfs, "%02d %-10.10s", asg, asgtab[asg].a_name);
399 (*itxput)(row, col, bfs, 1);
400 ++asg;
401 }
402 }
403}
404
405/*
406 =============================================================================
407 showtm() -- show menu of tunings
408 =============================================================================
409*/
410
411void showtm(void)
412{
413 register int16_t row, tun;
414
415 tun = 0;
416
417 (*itxput)(0, 0, "N Name", 0);
418
419 for (row = 1; row < 11; row++) {
420
421 sprintf(bfs, "%d %-32.32s", tun, tunname[tun]);
422 (*itxput)(row, 0, bfs, 1);
423 ++tun;
424 }
425}
426
427/*
428 =============================================================================
429 showsm() -- show menu of scores
430 =============================================================================
431*/
432
433void showsm(void)
434{
435 register int16_t col, row, scr;
436
437 scr = 1;
438
439 for (col = 1; col < 46; col+= 22) {
440
441 if (scr > N_SCORES)
442 return;
443
444 (*itxput)(0, col, "No Score", 0);
445
446 for (row = 1; row < 15; row++) {
447
448 if (scr > N_SCORES)
449 return;
450
451 sprintf(bfs, "%02d %-16.16s", scr, scname[scr - 1]);
452 (*itxput)(row, col, bfs, 1);
453 ++scr;
454 }
455 }
456}
457
458/*
459 =============================================================================
460 scmenu() -- display a submenu in area 1 (score area)
461 =============================================================================
462*/
463
464void scmenu(int16_t n)
465{
466 register int16_t i;
467 register struct octent *op;
468
469 if (n GE 0) { /* put up a submenu */
470
471 itxput = sdmtxt; /* setup output function */
472
473 vbank(0);
474
475 v_odtab[0][0] |= V_BLA; /* turn off line objcect */
476 objclr(0);
477
478 v_odtab[1][0] |= V_BLA; /* turn off score object */
479 objclr(1);
480
481 v_odtab[2][0] |= V_BLA; /* turn off keyboard object */
482 objclr(2);
483
484 vbank(1); /* clear the window */
485 vbfill4(obj11, 128, 0, 0, 511, 223, exp_c(SDBG16));
486
487 vbank(0); /* turn on window object */
488 SetPri(11, 4);
489
490 switch (n) { /* fill the window */
491
492 case 0: /* instruments */
493
494 showim(); /* show the instruments */
495 break;
496
497 case 1: /* assignments */
498
499 showam(lastam); /* show the assignments */
500 stcpos(17, 11); /* position the cursor */
501
502 cxval = CTOX(11);
503 cyval = RTOY(17);
504
505 if (infield(stcrow, stccol, curfet))
506 cfetp = infetp;
507
508 break;
509
510 case 2: /* tunings */
511
512 showtm(); /* show the tunings */
513 stcpos(17, 19); /* position the cursor */
514
515 cxval = CTOX(19);
516 cyval = RTOY(17);
517
518 if (infield(stcrow, stccol, curfet))
519 cfetp = infetp;
520
521 break;
522
523 case 3: /* scores */
524
525 showsm(); /* show the scores */
526 stcpos(24, 7); /* position the cursor */
527
528 cxval = CTOX(7);
529 cyval = RTOY(24);
530
531 if (infield(stcrow, stccol, curfet))
532 cfetp = infetp;
533
534 break;
535
536 default: /* eh ? */
537
538 break;
539 }
540
541 } else { /* take down the submenu */
542
543 vbank(0);
544
545 v_odtab[4][0] |= V_BLA; /* turn off window object */
546 objclr(4);
547
548 op = &v_obtab[13]; /* turn on keyboard object */
549 objon(2, op->objy, op->ysize);
550 v_odtab[2][0] &= ~V_BLA;
551
552 op = &v_obtab[14]; /* turn on score object */
553 objon(1, op->objy, op->ysize);
554 v_odtab[1][0] &= ~V_BLA;
555
556 op = &v_obtab[15]; /* turn on line object */
557 objon(0, op->objy, op->ysize);
558 v_odtab[0][0] &= ~V_BLA;
559 }
560
561 scmctl = n; /* set new menu type */
562}
563
564/*
565 =============================================================================
566 sdmenu() -- display a submenu in area 2 (text areas)
567 =============================================================================
568*/
569
570void sdmenu(int16_t n)
571{
572 register int16_t i, wasup;
573
574 wasup = sdmctl; /* save previous menu type */
575 sdmctl = n; /* set new menu type */
576
577 if (n GE 0) { /* put up a menu */
578
579 submenu = TRUE; /* indicate there's a menu up */
580
581 sdmrow = stcrow; /* save underline cursor position */
582 sdmcol = stccol; /* ... */
583
584 memsetw(&sctctab[3][0], exp_c(SDBGMM), 64); /* recolor */
585 memsetw(&sctctab[4][0], exp_c(SDBGMM), 64);
586 memsetw(&sctctab[5][0], exp_c(SDBGMM), 64);
587
588 if (n EQ 4) { /* extra 2 lines for section menu */
589
590 memsetw(&sctctab[6][0], exp_c(SDBGMM), 64);
591 memsetw(&sctctab[7][0], exp_c(SDBGMM), 64);
592 }
593
594 stcclr(); /* re-color the cursor background */
595 stcpos(sdmrow, sdmcol); /* turn underline cursor back on */
596
597 if (infield(stcrow, stccol, curfet))
598 cfetp = infetp;
599
600 if (v_regs[5] & 0x0180)
601 vbank(0);
602
603 for (i = 0; i < 3; i++) /* top 3 lines of menu */
604 vputs(obj8, 3 + i, 0, sdmenus[n][i], SDMENUBG);
605
606 if (n EQ 4) { /* extra 2 lines for section menu */
607
608 vputs(obj8, 6, 0, sdmln3, SDMENUBG);
609 vputs(obj8, 7, 0, sdmln4, SDMENUBG);
610
611 secop = SOP_NUL; /* clear section operation code */
612
613 grptran = 0; /* reset transpose value */
614 gtmsel = -1; /* de-select source group */
615
616 for (i = 0; i < 12; i++) /* reset the map */
617 grptmap[i] = i;
618
619 dsects(); /* display list of sections */
620 dsgtmap(); /* display group map and transpose */
621
622 point = GLCplot; /* setup to plot on LCD */
623 GLCcurs(G_ON);
624
625 if (ismode NE IS_NULL) { /* cancel inst. mode */
626
627 ismode = IS_NULL;
628 pkctrl = oldpk;
629 sliders = oldsl;
630 swpt = oldsw;
631 lcdlbls();
632 }
633
634 if (gomode NE GO_NULL) { /* cancel goto mode */
635
636 gomode = GO_NULL;
637 pkctrl = oldpk;
638 lseg(GOTO_XL, GOTO_Y, GOTO_XR, GOTO_Y, 0);
639 }
640
641 if (asmode) { /* cancel assign mode */
642
643 asmode = 0;
644 pkctrl = oldpk;
645 swpt = oldsw;
646 lseg(ASGN_XL, ASGN_Y, ASGN_XR, ASGN_Y, 0);
647 }
648
649 if ((pkctrl EQ PK_PFRM) OR (pkctrl EQ PK_NOTE))
650 oldpk = pkctrl;
651
652 if (sliders NE LS_LIBR)
653 oldsl = sliders;
654
655 oldsw = swpt; /* put panel in group mode */
656 swpt = &t_ngrp;
657 pkctrl = PK_NGRP;
658 sliders = LS_NGRP;
659
660 lcdlbls();
661 setleds();
662 }
663
664 SetPri(TTCURS, TTCPRI); /* turn on menu cursor */
665 ttcpos(sdmlim[n][0], sdmlim[n][1]); /* position menu cursor */
666
667 } else { /* take down the menu */
668
669 submenu = FALSE; /* indicate menu has gone bye bye */
670
671 if (v_regs[5] & 0x0180)
672 vbank(0);
673
674 objclr(TTCPRI); /* turn off the menu cursor */
675 stcset(); /* restore underline cursor */
676 stcclr(); /* ... */
677 sdwin(11); /* redisplay window 11 data */
678
679 if (wasup EQ 4) {
680
681 sdwin(12); /* redisplay window 12 data */
682
683 stcpos(sdmrow, sdmcol); /* display underline cursor */
684
685 cxval = CTOX(sdmcol);
686 cyval = RTOY(sdmrow);
687
688 if (infield(stcrow, stccol, curfet))
689 cfetp = infetp;
690
691 pkctrl = oldpk; /* restore panel state */
692 sliders = oldsl;
693 swpt = oldsw;
694
695 lcdlbls(); /* refresh LCD */
696 setleds(); /* refresh LEDs */
697
698 } else {
699
700 stcpos(sdmrow, sdmcol); /* display underline cursor */
701
702 cxval = CTOX(sdmcol);
703 cyval = RTOY(sdmrow);
704
705 if (infield(stcrow, stccol, curfet))
706 cfetp = infetp;
707 }
708 }
709}
710
711/*
712 =============================================================================
713 hilitnt() -- setup for a note operation
714 =============================================================================
715*/
716
717void hilitnt(int16_t nop)
718{
719 noteop = nop; /* set note operation */
720 notesel = FALSE; /* indicate no note selected */
721 sdmenu(-1); /* take down the menu */
722 dnedmod(); /* update the note edit window */
723}
724
725/*
726 =============================================================================
727 hilitop() -- highlight a section operation and set secop
728 =============================================================================
729*/
730
731void hilitop(int16_t n)
732{
733 register int16_t row, lc, rc, col;
734
735 if (clkrun) /* don't do anything if clock is running */
736 return;
737
738 if (v_regs[5] & 0x0180)
739 vbank(0);
740
741 if (secop NE SOP_NUL) {
742
743 row = sdmht[secop][0];
744 lc = sdmht[secop][1];
745 rc = sdmht[secop][2];
746
747 for (col = lc; col LE rc; col++)
748 vputa(obj8, row, col, SDMENUBG);
749 }
750
751 secop = n;
752
753 row = sdmht[n][0];
754 lc = sdmht[n][1];
755 rc = sdmht[n][2];
756
757 for (col = lc; col LE rc; col++)
758 vputa(obj8, row, col, (SDBGMM | (SD_ENTR << 4)));
759}
760
761/*
762 =============================================================================
763 dosecop() -- do the current section operation
764 =============================================================================
765*/
766
767void dosecop(void)
768{
769 register int16_t sect;
770 register struct s_entry *ep;
771
772 if (clkrun OR (-1 EQ (sect = insect()))) {
773
774 secop = SOP_NUL;
775 return;
776 }
777
778 if (insmode) {
779
780 icancel();
781 dsimode();
782 }
783
784 switch (secop) {
785
786 case SOP_GO: /* GoTo */
787
788 if (sgoflag EQ 3) { /* GoTo End Section */
789
790 ep = hplist[curscor][EH_SEND];
791
792 while (ep) {
793
794 if (ep->e_data1 EQ sect) {
795
796 sc_goto(fc_val = ep->e_time);
797 break;
798 }
799
800 ep = ep->e_up;
801 }
802
803 } else { /* GoTo Begin Section */
804
805 if (E_NULL NE (ep = seclist[curscor][sect]))
806 sc_goto(fc_val = ep->e_time);
807 }
808
809 break;
810
811 case SOP_BGN: /* Begin */
812
813 if (NOT recsw) /* only in record mode */
814 break;
815
816 if (v_regs[5] & 0x0180)
817 vbank(0);
818
819 if (E_NULL NE (ep = seclist[curscor][sect])) {
820
821 eh_rmv(ep, EH_SBGN);
822 e_rmv(ep);
823 ep->e_time = t_cur;
824 p_cur = e_ins(ep, ep_adj(p_cur, 1, t_cur)->e_bak)->e_fwd;
825 eh_ins(ep, EH_SBGN);
826 se_exec(ep, D_FWD);
827
828 } else if (E_NULL NE (ep = e_alc(E_SIZE2))) {
829
830 ep->e_time = t_cur;
831 ep->e_type = EV_SBGN;
832 ep->e_data1 = sect;
833 p_cur = e_ins(ep, ep_adj(p_cur, 1, t_cur)->e_bak)->e_fwd;
834 eh_ins(ep, EH_SBGN);
835 seclist[curscor][sect] = ep;
836 se_exec(ep, D_FWD);
837 }
838
839 sc_refr(fc_val); /* refresh the screen */
840 break;
841
842 case SOP_END: /* End */
843
844 if (NOT recsw) /* only in record mode */
845 break;
846
847 if (v_regs[5] & 0x0180)
848 vbank(0);
849
850 if (E_NULL NE (ep = ehfind(EH_SEND, -1L, sect, -1))) {
851
852 eh_rmv(ep, EH_SEND);
853 e_rmv(ep);
854 ep->e_time = t_cur;
855 p_cur = e_ins(ep, ep_adj(p_cur, 0, t_cur))->e_fwd;
856 eh_ins(ep, EH_SEND);
857 se_exec(ep, D_FWD);
858
859 } else if (E_NULL NE (ep = e_alc(E_SIZE2))) {
860
861 ep->e_time = t_cur;
862 ep->e_type = EV_SEND;
863 ep->e_data1 = sect;
864 p_cur = e_ins(ep, ep_adj(p_cur, 0, t_cur))->e_fwd;
865 eh_ins(ep, EH_SEND);
866 se_exec(ep, D_FWD);
867 }
868
869 sc_refr(fc_val); /* refresh the screen */
870 break;
871
872 case SOP_MOV: /* Move */
873
874 if (NOT recsw) /* only in record mode */
875 break;
876
877 if (sec_mov(sect)) /* move the section */
878 break;
879
880 sc_refr(fc_val); /* refresh screen if successful */
881 break;
882
883 case SOP_CPY: /* Copy */
884
885 if (NOT recsw) /* only in record mode */
886 break;
887
888 if (sec_cpy(sect)) /* copy the section */
889 break;
890
891 sc_refr(fc_val); /* refresh screen if successful */
892 break;
893
894 case SOP_MRG: /* Merge */
895
896 if (NOT recsw) /* only in record mode */
897 break;
898
899 if (sec_mrg(sect)) /* merge the section */
900 break;
901
902 sc_refr(fc_val); /* refresh screen if successful */
903 break;
904
905 case SOP_GRP: /* ReGrp */
906
907 if (NOT recsw) /* only in record mode */
908 break;
909
910 if (sec_grp(sect)) /* regroup the section */
911 break;
912
913 sc_refr(fc_val); /* refresh screen if successful */
914 break;
915
916
917 case SOP_STC: /* SMPTE */
918
919 if (NOT recsw) /* only in record mode */
920 break;
921
922 break;
923
924 case SOP_DGR: /* Delete Gr */
925
926 if (NOT recsw) /* only in record mode */
927 break;
928
929 if (sec_dgr(sect)) /* delete note events */
930 break;
931
932 sc_refr(fc_val); /* refresh display if successful */
933 break;
934
935 case SOP_DEV: /* Delete Ev */
936
937 if (NOT recsw) /* only in record mode */
938 break;
939
940 if (sec_dev(sect)) /* delete non-note events */
941 break;
942
943 sc_refr(fc_val); /* refresh display if successful */
944 break;
945
946 case SOP_RMV: /* Remove */
947
948 if (NOT recsw) /* only in record mode */
949 break;
950
951 if (sec_rmv(sect)) /* remove section */
952 break;
953
954 sc_refr(fc_val); /* refresh display if successful */
955 break;
956 }
957
958 secop = SOP_NUL;
959}
960
961/*
962 =============================================================================
963 clkset() -- set the clock state
964 =============================================================================
965*/
966
967void clkset(int16_t st)
968{
969 clkrun = st;
970
971 switch (clksrc) {
972
973 case CK_LOCAL: /* Local */
974 case CK_SMPTE: /* SMPTE */
975
976 midiclk = FALSE;
977 pulsclk = FALSE;
978
979 if (st)
980 fc_sw = 1;
981 else
982 fc_sw = 0;
983
984 return;
985
986 case CK_MIDI: /* MIDI */
987
988 fc_sw = 0;
989 pulsclk = FALSE;
990
991 if (st)
992 midiclk = TRUE;
993 else
994 midiclk = FALSE;
995
996 return;
997
998 case CK_PLS24: /* PLS24 */
999 case CK_PLS48: /* PLS48 */
1000 case CK_PLS96: /* PLS96 */
1001
1002 fc_sw = 0;
1003 midiclk = FALSE;
1004
1005 if (st)
1006 pulsclk = TRUE;
1007 else
1008 pulsclk = FALSE;
1009
1010 return;
1011
1012 case CK_STEP: /* Step */
1013
1014 fc_sw = 0;
1015 midiclk = FALSE;
1016 pulsclk = FALSE;
1017
1018 return;
1019 }
1020}
1021
1022/*
1023 =============================================================================
1024 sdboxfn() -- process score display box hits
1025 =============================================================================
1026*/
1027
1028int16_t sdboxfn(int16_t n)
1029{
1030 register int16_t row, col, grp, what, i;
1031 register struct s_entry *ep;
1032 int16_t atr, modewas;
1033
1034 row = hitcy / 14;
1035 col = hitcx >> 3;
1036
1037 switch (hitbox) {
1038
1039 case 0: /* signature, section, beat, frame */
1040
1041 if (col EQ 0) { /* signature */
1042
1043 if (clkrun) /* clock can't be running */
1044 return(FAILURE);
1045
1046 if (ac_code EQ N_SHARP)
1047 ac_code = N_FLAT;
1048 else
1049 ac_code = N_SHARP;
1050
1051 sc_refr(fc_val);
1052 return(SUCCESS);
1053
1054 } else if ((col GE 2) AND (col LE 4)) { /* section menu */
1055
1056 if (clkrun) /* clock can't be running */
1057 return(FAILURE);
1058
1059 if (sdmctl EQ -1) { /* menu not up yet */
1060
1061 sdmenu(4); /* put up the menu */
1062 return(SUCCESS);
1063
1064 } else { /* menu up */
1065
1066 if (vtcrow EQ 19) {
1067
1068 if ((vtccol GE 1) AND
1069 (vtccol LE 4)) { /* GoTo */
1070
1071 hilitop(SOP_GO);
1072 return(SUCCESS);
1073
1074 } else if ((vtccol GE 8) AND
1075 (vtccol LE 11)) { /* Move */
1076
1077 hilitop(SOP_MOV);
1078 return(SUCCESS);
1079
1080 } else if ((vtccol GE 15) AND
1081 (vtccol LE 19)) { /* SMPTE */
1082
1083 hilitop(SOP_STC);
1084 return(SUCCESS);
1085
1086 } else if ((vtccol GE 24) AND
1087 (vtccol LE 62)) { /* number */
1088
1089 if (-1 NE insect()) {
1090
1091 sdmenu(-1);
1092 dosecop();
1093 }
1094
1095 return(SUCCESS);
1096 }
1097
1098 } else if (vtcrow EQ 20) {
1099
1100 if ((vtccol GE 1) AND
1101 (vtccol LE 5)) { /* Begin */
1102
1103 hilitop(SOP_BGN);
1104 return(SUCCESS);
1105
1106 } else if ((vtccol GE 8) AND
1107 (vtccol LE 11)) { /* Copy */
1108
1109 hilitop(SOP_CPY);
1110 return(SUCCESS);
1111
1112 } else if ((vtccol GE 15) AND
1113 (vtccol LE 20)) { /* Del Gr */
1114
1115 hilitop(SOP_DGR);
1116 return(SUCCESS);
1117
1118 } else if ((vtccol GE 24) AND
1119 (vtccol LE 62)) { /* number */
1120
1121 if (-1 NE insect()) {
1122
1123 sdmenu(-1);
1124 dosecop();
1125 }
1126
1127 return(SUCCESS);
1128 }
1129
1130 } else if (vtcrow EQ 21) {
1131
1132 if ((vtccol GE 1) AND
1133 (vtccol LE 3)) { /* End */
1134
1135 hilitop(SOP_END);
1136 return(SUCCESS);
1137
1138 } else if ((vtccol GE 8) AND
1139 (vtccol LE 12)) { /* Merge */
1140
1141 hilitop(SOP_MRG);
1142 return(SUCCESS);
1143
1144 } else if ((vtccol GE 15) AND
1145 (vtccol LE 20)) { /* Del Ev */
1146
1147 hilitop(SOP_DEV);
1148 return(SUCCESS);
1149 }
1150
1151
1152 } else if (vtcrow EQ 22) {
1153
1154 if ((vtccol GE 8) AND
1155 (vtccol LE 12)) { /* ReGrp */
1156
1157 hilitop(SOP_GRP);
1158 return(SUCCESS);
1159
1160 } else if ((vtccol GE 15) AND
1161 (vtccol LE 20)) { /* Remove */
1162
1163 hilitop(SOP_RMV);
1164 return(SUCCESS);
1165
1166 } else if ((vtccol GE 28) AND
1167 (vtccol LE 62)) { /* number */
1168
1169 if (gtmsel GE 0)
1170 dsgtmn(gtmsel, FALSE);
1171
1172 if (-1 NE (gtmsel = ingroup()))
1173 dsgtmn(gtmsel, TRUE);
1174
1175 return(SUCCESS);
1176 }
1177
1178 } else if (vtcrow EQ 23) {
1179
1180 if ((vtccol GE 1) AND
1181 (vtccol LE 6)) { /* Escape */
1182
1183 secop = SOP_NUL;
1184 sdmenu(-1);
1185 return(SUCCESS);
1186
1187 } else if ((vtccol GE 22) AND
1188 (vtccol LE 24)) { /* Transpose */
1189
1190 return(entbh(-1));
1191 }
1192 }
1193 }
1194
1195 return(FAILURE);
1196
1197 } else
1198 return(entbh(-1));
1199
1200
1201 case 1: /* insert */
1202
1203 modewas = insmode; /* save old insert state */
1204
1205 if (insmode) /* toggle ... */
1206 icancel(); /* ... insert on -> off */
1207 else
1208 istart(); /* ... insert of -> on */
1209
1210 if (modewas NE insmode) /* only refresh if changed */
1211 sc_refr(fc_val);
1212
1213 dsimode(); /* update insert mode display */
1214 return(SUCCESS);
1215
1216 case 2: /* clock control, source */
1217
1218 if (col LE 33) { /* clock */
1219
1220 clkset(NOT clkrun);
1221 dsclk();
1222 return(SUCCESS);
1223
1224
1225 } else if ((col GE 35) AND (col LE 43)) { /* control */
1226
1227 if (sdmctl EQ -1) { /* menu not yet up */
1228
1229 sdmenu(3);
1230 return(SUCCESS);
1231
1232 } else { /* menu up */
1233
1234 if (vtcrow EQ 19) {
1235
1236 if ((vtccol GE 1) AND
1237 (vtccol LE 5)) {
1238
1239 clkctl = CK_LOCAL;
1240 sdmenu(-1);
1241 sdwin(2);
1242 return(SUCCESS);
1243 }
1244
1245 } else if (vtcrow EQ 20) {
1246
1247 if ((vtccol GE 1) AND
1248 (vtccol LE 5)) {
1249
1250 clkctl = CK_MIDI;
1251 sdmenu(-1);
1252 sdwin(2);
1253 return(SUCCESS);
1254 }
1255
1256 } else if (vtcrow EQ 21) {
1257
1258 if ((vtccol GE 1) AND
1259 (vtccol LE 5)) {
1260
1261 clkctl = CK_SMPTE;
1262 sdmenu(-1);
1263 sdwin(2);
1264 return(SUCCESS);
1265 }
1266 }
1267 }
1268
1269 return(FAILURE);
1270
1271 } else if (col GE 45) { /* source */
1272
1273 if (sdmctl EQ -1) { /* menu not yet up */
1274
1275 sdmenu(2);
1276 setleds();
1277 return(SUCCESS);
1278
1279 } else { /* menu up */
1280
1281 if (vtcrow EQ 19) {
1282
1283 if ((vtccol GE 1) AND
1284 (vtccol LE 5)) {
1285
1286 clksrc = CK_LOCAL;
1287 pkctrl = PK_PFRM;
1288 setleds();
1289 sdmenu(-1);
1290 sdwin(2);
1291 return(SUCCESS);
1292
1293 } else if ((vtccol GE 9) AND
1294 (vtccol LE 13)) {
1295
1296 clksrc = CK_PLS24;
1297 pkctrl = PK_PFRM;
1298 setleds();
1299 sdmenu(-1);
1300 sdwin(2);
1301 return(SUCCESS);
1302
1303 } else if ((vtccol GE 17) AND
1304 (vtccol LE 20)) {
1305
1306 clksrc = CK_STEP;
1307 pkctrl = PK_NOTE;
1308 stepenb = TRUE;
1309 setleds();
1310 sdmenu(-1);
1311 sdwin(2);
1312 return(SUCCESS);
1313 }
1314
1315
1316 } else if (vtcrow EQ 20) {
1317
1318 if ((vtccol GE 1) AND
1319 (vtccol LE 5)) {
1320
1321 clksrc = CK_MIDI;
1322 pkctrl = PK_PFRM;
1323 setleds();
1324 sdmenu(-1);
1325 sdwin(2);
1326 return(SUCCESS);
1327
1328 } else if ((vtccol GE 9) AND
1329 (vtccol LE 13)) {
1330
1331 clksrc = CK_PLS48;
1332 pkctrl = PK_PFRM;
1333 setleds();
1334 sdmenu(-1);
1335 sdwin(2);
1336 return(SUCCESS);
1337 }
1338
1339 } else if (vtcrow EQ 21) {
1340
1341 if ((vtccol GE 1) AND
1342 (vtccol LE 5)) {
1343
1344 clksrc = CK_SMPTE;
1345 pkctrl = PK_PFRM;
1346 setleds();
1347 sdmenu(-1);
1348 sdwin(2);
1349 return(SUCCESS);
1350
1351 } else if ((vtccol GE 9) AND
1352 (vtccol LE 13)) {
1353
1354 clksrc = CK_PLS96;
1355 pkctrl = PK_PFRM;
1356 setleds();
1357 sdmenu(-1);
1358 sdwin(2);
1359 return(SUCCESS);
1360 }
1361 }
1362 }
1363 }
1364
1365 return(FAILURE);
1366
1367
1368 case 3: /* note edit */
1369
1370 if (clkrun) /* clock can't be running */
1371 return(FAILURE);
1372
1373 if (scmctl NE -1)
1374 scmenu(-1);
1375
1376 if (sdmctl EQ -1) { /* menu not up */
1377
1378 sdmenu(1);
1379 noteop = NOP_NUL;
1380 return(SUCCESS);
1381
1382 } else { /* menu up - select operation */
1383
1384 if (vtcrow EQ 19) {
1385
1386 if ((vtccol GE 1) AND
1387 (vtccol LE 9)) { /* Begin Acc */
1388
1389 hilitnt(NOP_ACC);
1390 return(SUCCESS);
1391
1392 } else if ((vtccol GE 13) AND
1393 (vtccol LE 21)) { /* Move Note */
1394
1395 hilitnt(NOP_MVN);
1396 return(SUCCESS);
1397
1398 } else if ((vtccol GE 25) AND
1399 (vtccol LE 30)) { /* Escape */
1400
1401 hilitnt(NOP_NUL);
1402 return(SUCCESS);
1403
1404 }
1405
1406 return(FAILURE);
1407
1408 } else if (vtcrow EQ 20) {
1409
1410 if ((vtccol GE 1) AND
1411 (vtccol LE 9)) { /* Begin Nat */
1412
1413 hilitnt(NOP_NAT);
1414 return(SUCCESS);
1415
1416 } else if ((vtccol GE 13) AND
1417 (vtccol LE 22)) { /* Move Begin */
1418
1419 hilitnt(NOP_MVB);
1420 return(SUCCESS);
1421 }
1422
1423 return(FAILURE);
1424
1425 } else if (vtcrow EQ 21) {
1426
1427 if ((vtccol GE 1) AND
1428 (vtccol LE 8)) { /* End Note */
1429
1430 hilitnt(NOP_END);
1431 return(SUCCESS);
1432
1433 } else if ((vtccol GE 13) AND
1434 (vtccol LE 20)) { /* Move End */
1435
1436 hilitnt(NOP_MVE);
1437 return(SUCCESS);
1438 }
1439
1440 return(FAILURE);
1441
1442 } else
1443 return(FAILURE);
1444 }
1445
1446 return(FAILURE);
1447
1448
1449 case 4: /* assignments */
1450
1451 if (col LE 9) {
1452
1453 if (scmctl NE 1) { /* not up yet -- show page 1 */
1454
1455 lastam = 0;
1456 scmenu(1);
1457
1458 } else { /* up - switch pages */
1459
1460 if (lastam EQ 0) { /* show page 2 */
1461
1462 lastam = 60;
1463 scmenu(1);
1464
1465 } else { /* take down menu */
1466
1467 lastam = 0;
1468 scmenu(-1);
1469 }
1470 }
1471
1472 return(SUCCESS);
1473
1474 } else {
1475
1476 return(entbh(-1)); /* data entry */
1477 }
1478
1479 case 5: /* tunings */
1480
1481 if ((col GE 14) AND (col LE 17)) {
1482
1483 if (scmctl NE 2)
1484 scmenu(2); /* put up menu */
1485 else
1486 scmenu(-1); /* take down menu */
1487
1488 return(SUCCESS);
1489
1490 } else {
1491
1492 return(entbh(-1)); /* data entry */
1493 }
1494
1495 case 8: /* stop/next */
1496
1497 if ((col GE 40) AND (col LE 43)) { /* stop */
1498
1499 if (recsw) {
1500
1501 if (v_regs[5] & 0x0180)
1502 vbank(0);
1503
1504 if (E_NULL NE (ep = findev(p_cur, t_cur, EV_STOP, -1, -1))) {
1505
1506 se_exec(ep, D_FWD);
1507
1508 } else if (E_NULL NE (ep = e_alc(E_SIZE1))) {
1509
1510 ep->e_time = t_cur;
1511 ep->e_type = EV_STOP;
1512 p_cur= e_ins(ep, ep_adj(p_cur, 0, t_cur))->e_fwd;
1513 se_exec(ep, D_FWD);
1514 ctrsw = TRUE;
1515 se_disp(ep, D_FWD, gdstbc, 1);
1516 scupd();
1517 }
1518 }
1519
1520 } else if ((col GE 45) AND (col LE 48)) { /* next */
1521
1522 if (recsw) {
1523
1524 if (v_regs[5] & 0x0180)
1525 vbank(0);
1526
1527 if (E_NULL NE (ep = findev(p_cur, t_cur, EV_NEXT, -1, -1))) {
1528
1529 se_exec(ep, D_FWD);
1530
1531 } else if (E_NULL NE (ep = e_alc(E_SIZE1))) {
1532
1533 ep->e_time = t_cur;
1534 ep->e_type = EV_NEXT;
1535 p_cur= e_ins(ep, ep_adj(p_cur, 0, t_cur))->e_fwd;
1536 se_exec(ep, D_FWD);
1537 ctrsw = TRUE;
1538 se_disp(ep, D_FWD, gdstbc, 1);
1539 scupd();
1540 }
1541 }
1542
1543 }
1544
1545 return(SUCCESS);
1546
1547
1548 case 9: /* punch in/out */
1549
1550 if ((col GE 50) AND (col LE 51)) { /* punch in */
1551
1552 if (recsw) {
1553
1554 if (v_regs[5] & 0x0180)
1555 vbank(0);
1556
1557 if (E_NULL NE (ep = findev(p_cur, t_cur, EV_STOP, 1, -1))) {
1558
1559 se_exec(ep, D_FWD);
1560
1561 } else if (E_NULL NE (ep = e_alc(E_SIZE1))) {
1562
1563 ep->e_time = t_cur;
1564 ep->e_type = EV_PNCH;
1565 ep->e_data1 = 1;
1566 p_cur= e_ins(ep, ep_adj(p_cur, 0, t_cur))->e_fwd;
1567 se_exec(ep, D_FWD);
1568 ctrsw = TRUE;
1569 se_disp(ep, D_FWD, gdstbc, 1);
1570 scupd();
1571 }
1572 }
1573
1574 } else if ((col GE 53) AND (col LE 55)) { /* punch out */
1575
1576 if (recsw) {
1577
1578 if (v_regs[5] & 0x0180)
1579 vbank(0);
1580
1581 if (E_NULL NE (ep = findev(p_cur, t_cur, EV_PNCH, 0, -1))) {
1582
1583 se_exec(ep, D_FWD);
1584
1585 } else if (E_NULL NE (ep = e_alc(E_SIZE1))) {
1586
1587 ep->e_time = t_cur;
1588 ep->e_type = EV_PNCH;
1589 ep->e_data1 = 0;
1590 p_cur= e_ins(ep, ep_adj(p_cur, 0, t_cur))->e_fwd;
1591 se_exec(ep, D_FWD);
1592 ctrsw = TRUE;
1593 se_disp(ep, D_FWD, gdstbc, 1);
1594 scupd();
1595 }
1596 }
1597
1598 }
1599
1600 return(SUCCESS);
1601
1602 case 10: /* Output */
1603
1604 return(SUCCESS);
1605
1606 case 11: /* group/ins, trans, dyn/loc, velocity */
1607
1608 if ((row EQ 18) AND (col LE 3)) { /* inst. menu */
1609
1610 if (scmctl NE 0)
1611 scmenu(0); /* put up the menu */
1612 else
1613 scmenu(-1); /* take down the menu */
1614
1615 return(SUCCESS);
1616
1617 } else if ((row EQ 21) AND (col LE 3)) { /* velocity flag */
1618
1619 velflag = NOT velflag;
1620 ds_vmod();
1621 return(SUCCESS);
1622
1623 } else
1624 return(entbh(-1)); /* inst. number */
1625
1626
1627 case 12: /* analog source, value */
1628
1629 if ((row EQ 23) AND (col LE 4)) { /* display enable */
1630
1631 angroup = -angroup;
1632
1633 if (angroup < 0)
1634 atr = SDW12ATR;
1635 else
1636 atr = (SD_CHNG << 4) | SDBG12;
1637
1638 if (v_regs[5] & 0x0180)
1639 vbank(0);
1640
1641 for (i = 0; i < 4; i++)
1642 vputa(obj8, 7, i, atr);
1643
1644 return(SUCCESS);
1645
1646 } else if ((row EQ 22) AND (col LE 4)) { /* r/p source */
1647
1648 ancmsw = NOT ancmsw;
1649
1650 if (ancmsw)
1651 atr = (SD_CHNG << 4) | SDBG12;
1652 else
1653 atr = SDW12ATR;
1654
1655 if (v_regs[5] & 0x0180)
1656 vbank(0);
1657
1658 for (i = 0; i < 4; i++)
1659 vputa(obj8, 6, i, atr);
1660
1661 return(SUCCESS);
1662
1663 } else {
1664
1665 return(entbh(-1));
1666 }
1667
1668 case 13: /* score number and title */
1669
1670 if (col LE 4) { /* score menu */
1671
1672 if (scmctl NE 3)
1673 scmenu(3); /* put up menu */
1674 else
1675 scmenu(-1); /* take down menu */
1676
1677 return(SUCCESS);
1678
1679 } else if ((col GE 10) AND (col LE 25)) { /* score name */
1680
1681 if (sdmctl NE 0) {
1682
1683 sdmenu(0);
1684
1685 vtsetup(obj8, svtdsp, 10, scname[curscor], 19, 1,
1686 advscur, bspscur, nokey, nokey, svtstop,
1687 SDW13DEA, SDBG13);
1688
1689 } else {
1690
1691 vtyper();
1692 }
1693
1694 return(SUCCESS);
1695
1696 } else
1697 return(entbh(-1));
1698
1699 case 14: /* rec mode */
1700
1701 if ((col GE 31) AND (col LE 34)) { /* Play */
1702
1703 recsw = FALSE;
1704 dsrpmod();
1705 return(SUCCESS);
1706
1707 } else if ((col GE 36) AND (col LE 40)) { /* Recrd */
1708
1709 recsw = TRUE;
1710 dsrpmod();
1711 return(SUCCESS);
1712
1713 } else if ((col GE 42) AND (col LE 47)) { /* OvrDub */
1714
1715 dubsw = NOT dubsw;
1716 dsrpmod();
1717 return(SUCCESS);
1718
1719 } else if ((col GE 49) AND (col LE 55)) { /* PunchIn */
1720
1721 pchsw = NOT pchsw;
1722 dsrpmod();
1723 return(SUCCESS);
1724
1725 }
1726
1727 return(FAILURE);
1728
1729 case 16: /* note display */
1730
1731 if (NOP_NUL NE noteop)
1732 donote();
1733
1734 return(SUCCESS);
1735 }
1736
1737 return(FAILURE);
1738}
1739
Note: See TracBrowser for help on using the repository browser.