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