source: buchla-68k/ram/scfield.c@ df097bf

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

Code compiles, doesn't link.

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