source: buchla-68k/ram/adselbx.c@ 60288f5

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

Make function pointers more consistent.

  • Property mode set to 100644
File size: 10.0 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 entbh(short n);
28extern void adswin(short n);
29extern void advacur(void);
30extern void bspacur(void);
31extern void nokey(void);
32extern void vtdisp(unsigned *obj, unsigned fg, unsigned bg, short row, short col, char *buf);
33extern void adpoint(short x, short y, short pen);
34
35extern void (*itxput)(short row, short col, char *txt, short tag);
36extern void (*point)(short x, short y, short pen);
37
38extern short admctl;
39extern short adnamsw;
40extern short asgfks;
41extern short asghit;
42extern short asgmod;
43extern short auxctl;
44extern short curasg;
45extern short cxval;
46extern short cyval;
47extern short hitbox;
48extern short hitcx;
49extern short hitcy;
50extern short lastam;
51extern short submenu;
52
53extern short adbox[][8];
54
55extern short grp2prt[12][2];
56extern short ins2grp[12];
57extern short asgkble[];
58extern short key2grp[];
59extern short mctlnum[];
60
61extern struct selbox *csbp, *curboxp;
62
63extern char bfs[];
64extern char caname[];
65extern char vtlin1[], vtlin2[], vtlin3[];
66
67extern unsigned *asgob;
68
69/* forward references */
70
71short bx_null(void);
72short adfnbox(short n);
73
74/*
75
76*/
77
78struct selbox adboxes[] = {
79
80 { 1, 0, 94, 27, 0, adfnbox}, /* 0: curasg, caname */
81 { 1, 28, 94, 40, 1, adfnbox}, /* 1: asgtab[curasg] */
82 { 1, 56, 94, 68, 2, entbh}, /* 2: curmop */
83 { 1, 42, 94, 54, 3, entbh}, /* 3: prgchan */
84 { 96, 1, 190, 138, 4, entbh}, /* 4: vce2grp[voice] */
85 {192, 1, 302, 138, 5, adfnbox}, /* 5: mctlnum[srcvar] */
86 {304, 1, 510, 138, 6, adfnbox}, /* 6: grp2prt[group][pt|ch] */
87 { 1, 140, 510, 348, 7, adfnbox}, /* 7: key2grp[key] */
88 { 1, 70, 38, 82, 8, adfnbox}, /* 8: auxctl */
89 { 40, 70, 94, 82, 9, adfnbox}, /* 9: curtun */
90 { 1, 84, 94, 138, 10, entbh}, /* 10: ps_intn, ps_rate, ps_dpth */
91
92 { 0, 0, 0, 0, 0, FN_NULL} /* end of table */
93};
94
95/*
96
97*/
98
99/*
100 =============================================================================
101 endatyp() -- end function for virtual typewriter
102 =============================================================================
103*/
104
105void endatyp(void)
106{
107 adnamsw = FALSE;
108 submenu = FALSE;
109
110 if (admctl EQ -1)
111 adswin(7); /* refresh key map window */
112 else
113 admenu(admctl); /* refresh menu window */
114}
115
116/*
117
118*/
119
120/*
121 =============================================================================
122 admtxt() -- output text to the submenu
123 =============================================================================
124*/
125
126void admtxt(short row, short col, char *txt, short tag)
127{
128 if (v_regs[5] & 0x0180)
129 vbank(0);
130
131 vcputsv(asgob, 64, ACFBX07, ACBBX07, row + 10, col, txt, 14);
132}
133
134/*
135
136*/
137
138/*
139 =============================================================================
140 admenu() -- put up or take down an assignment display submenu
141 =============================================================================
142*/
143
144void admenu(short n)
145{
146 register short i;
147
148 if (n GE 0) { /* put up a submenu */
149
150 itxput = admtxt; /* setup output function */
151
152 if (v_regs[5] & 0x0180)
153 vbank(0);
154
155 vbfill4(asgob, 128, adbox[7][0], adbox[7][1],
156 adbox[7][2], adbox[7][3], exp_c(adbox[7][5]));
157
158 switch (n) { /* fill the window */
159
160 case 0: /* instruments */
161
162 showim(); /* show the instruments */
163 break;
164
165 case 1: /* assignments */
166
167 showam(lastam); /* show the assignments */
168 settc(0, 9); /* position the cursor */
169 break;
170
171 case 2: /* tunings */
172
173 showtm(); /* show the tunings */
174 settc(5, 10); /* position the cursor */
175 break;
176
177 default: /* eh ? */
178
179 break;
180 }
181
182 } else { /* take down the submenu */
183
184 admctl = n; /* set new menu type */
185 adswin(7); /* refresh the window */
186 }
187
188 point = adpoint;
189
190 if (v_regs[5] & 0x0180)
191 vbank(0);
192
193 lseg( 0, 0, 0, 349, AK_BORD); /* fix left edge of screen */
194 lseg(511, 0, 511, 349, AK_BORD); /* fix right edge of screen */
195
196 admctl = n; /* set new menu type */
197}
198
199/*
200
201*/
202
203/*
204 =============================================================================
205 adfnbox() -- assignment display box hit processor
206 =============================================================================
207*/
208
209short adfnbox(short 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(entbh(-1)); /* 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(entbh(-1));
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(entbh(-1)); /* 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(entbh(-1)); /* data entry */
533 }
534 }
535
536 return(FAILURE);
537}
Note: See TracBrowser for help on using the repository browser.