source: buchla-68k/orig/RAM/ADSELBX.C@ 6f0834c

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

Imported original source code.

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