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