source: buchla-68k/ram/adselbx.c@ 0c834c5

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

Prototypes for global function pointers. Consistent global types.

  • Property mode set to 100644
File size: 9.9 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 void enterit(void);
28extern void adswin(short n);
29extern void advacur(void);
30extern void bspacur(void);
31extern short 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);
72void 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, enterit}, /* 2: curmop */
83 { 1, 42, 94, 54, 3, enterit}, /* 3: prgchan */
84 { 96, 1, 190, 138, 4, enterit}, /* 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, enterit}, /* 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
209void 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;
245
246 } else { /* table */
247
248 enterit(); /* data entry */
249 return;
250 }
251 }
252
253 if (adnamsw) { /* typewriter is up */
254
255 if (vtyper()) {
256
257 if (NOT asgmod) {
258
259 asgmod = TRUE;
260 adswin(0);
261 }
262 }
263/*
264
265*/
266 } else { /* setup the typewriter */
267
268 vbank(0);
269 vbfill4(asgob, 128, CTOX(ATWCOL), RTOY(ATWROW),
270 CTOX(ATWCOL+30) - 1, RTOY(ATWROW+3) - 1,
271 exp_c(ACBBX04));
272
273 tsplot4(asgob, 64, ACFBX04, ATWROW, ATWCOL, vtlin1, 14);
274 tsplot4(asgob, 64, ACFBX04, ATWROW+1, ATWCOL, vtlin2, 14);
275 tsplot4(asgob, 64, ACFBX04, ATWROW+2, ATWCOL, vtlin3, 14);
276
277 point = adpoint; /* draw a border ... */
278
279 lseg(CTOX(ATWCOL) - 1, RTOY(ATWROW) - 1, /* up, lt */
280 CTOX(ATWCOL+30), RTOY(ATWROW) - 1, /* up, rt */
281 AK_BORD);
282
283 lseg(CTOX(ATWCOL+30), RTOY(ATWROW) - 1, /* up, rt */
284 CTOX(ATWCOL+30), RTOY(ATWROW+3) - 1, /* dn, rt */
285 AK_BORD);
286
287 lseg(CTOX(ATWCOL+30), RTOY(ATWROW+3) - 1, /* dn, rt */
288 CTOX(1) - 1, RTOY(ATWROW+3) - 1, /* dn, lt */
289 AK_BORD);
290
291 lseg(CTOX(1) - 1, RTOY(ATWROW+3) - 1, /* dn, lt */
292 CTOX(1) - 1, RTOY(ATWROW) - 1, /* up, lt */
293 AK_BORD);
294
295 vtsetup(asgob, vtdisp, ATDECOL,
296 caname,
297 ATWROW, ATWCOL,
298 advacur, bspacur, nokey, nokey, endatyp,
299 adbox[n][4], adbox[n][5]);
300
301 adnamsw = TRUE;
302 submenu = TRUE;
303 }
304
305 return;
306/*
307
308*/
309 case 1:
310
311 if ((col GE 1) AND (col LE 4)) { /* store */
312
313 if (curasg EQ 0)
314 return(FAILURE);
315
316 putasg(curasg);
317 adswin(0);
318 return;
319
320 } else if ((col GE 6) AND (col LE 10)) { /* retrieve */
321
322 getasg(curasg);
323 awins();
324 return;
325 }
326
327 case 5: /* toggle controller omni mode */
328
329 if (col EQ 25) {
330
331 if ((row LT 5) OR (row GT 8))
332 return;
333
334 mctlnum[row - 5] ^= GTAG1;
335
336 if (v_regs[5] &0x0180)
337 vbank(0);
338
339 bfs[0] = row - 5 + '2';
340 bfs[1] = '\0';
341
342 tsplot4(asgob, 64,
343 (mctlnum[row - 5] & GTAG1) ?
344 AK_MODC : adbox[n][4],
345 row, adbox[n][7], bfs, 14);
346
347 return;
348
349 } else {
350
351 enterit();
352 return;
353 }
354/*
355
356*/
357 case 6: /* instruments, groups, ports, channels */
358
359 if (((col EQ 41) OR (col EQ 42) OR
360 (col EQ 54) OR (col EQ 55)) AND (row EQ 3)) {
361
362 /* instrument menu */
363
364 if (admctl NE 0)
365 admenu(0); /* put up menu */
366 else
367 admenu(-1); /* take down menu */
368
369 return;
370
371 } else if (col EQ 39) { /* groups 1..6 */
372
373 if ((row LT 4) OR (row GT 9))
374 return;
375
376 /* toggle "legato" mode */
377
378 grp = row - 4;
379
380 ins2grp[grp] ^= GTAG1;
381
382 bfs[0] = '1' + grp;
383 bfs[1] = '\0';
384
385 if (v_regs[5] & 0x0180)
386 vbank(0);
387
388 tsplot4(asgob, 64,
389 ((ins2grp[grp] & GTAG1) ? AK_MODC : adbox[n][4]),
390 row, col, bfs, 14);
391
392 return;
393/*
394
395*/
396 } else if (col EQ 52) { /* groups 7..12 */
397
398 if ((row LT 4) OR (row GT 9))
399 return(FAILURE);
400
401 /* toggle "legato" mode */
402
403 grp = row + 2;
404
405 ins2grp[grp] ^= GTAG1;
406
407 bfs[0] = grp + ((grp > 8) ? 163 : '1');
408 bfs[1] = '\0';
409
410 if (v_regs[5] & 0x0180)
411 vbank(0);
412
413 tsplot4(asgob, 64,
414 ((ins2grp[grp] & GTAG1) ? AK_MODC : adbox[n][4]),
415 row, col, bfs, 14);
416
417 return;
418
419 } else {
420
421 enterit(); /* data entry */
422 return;
423 }
424/*
425
426*/
427 case 7: /* assignment map */
428
429 if (admctl NE -1)
430 return;
431
432 if (asghit) {
433
434 if (asghit EQ (hitcy / 14)) { /* previous hit ? */
435
436 /* toggle selected key status */
437
438 grp = asghit - 11;
439 line = (14 * grp) + AK_BASE;
440 key = 0;
441
442 for (i = 0; i < 88; i++)
443 if ((hitcx GE (asgkble[i] + 24)) AND
444 (hitcx LE (asgkble[i] + (i EQ 87 ? 31 : 28))))
445 key = i + 1;
446
447 if (key-- EQ 0)
448 return;
449
450 if (key LT asgfks) {
451
452 i = asgfks;
453 asgfks = key;
454 key = i;
455 }
456
457 for (i = asgfks; i LE key; i++)
458 key2grp[i] ^= (0x0001 << grp);
459
460 drawk2g(grp);
461 asghit = 0;
462
463 if (NOT asgmod) {
464
465 asgmod = TRUE;
466 adswin(0);
467 }
468
469 } else {
470
471 /* clear the selection */
472
473 drawk2g(asghit - 11);
474 asghit = 0;
475 }
476/*
477
478*/
479 } else {
480
481 /* make initial selection */
482
483 asghit = hitcy / 14;
484 grp = asghit - 11;
485
486 if (grp2prt[grp][0] NE 1) {
487
488 asghit = 0;
489 return;
490 }
491
492 line = (14 * grp) + AK_BASE;
493 key = 0;
494
495 for (i = 0; i < 88; i++)
496 if ((hitcx GE (asgkble[i] + 24)) AND
497 (hitcx LE (asgkble[i] + (i EQ 87 ? 31 : 28))))
498 key = i + 1;
499
500 if (key-- EQ 0) {
501
502 asghit = 0;
503 return;
504 }
505
506 asgfks = key;
507
508 vbfill4(asgob, 128, asgkble[key] + 24, line,
509 asgkble[key] + (key EQ 87 ? 31 : 28),
510 line + 3, exp_c(AK_SELC2));
511
512 }
513
514 return;
515
516 case 8: /* aux ctl */
517
518 setaux(NOT auxctl);
519 adswin(8);
520 return;
521
522 case 9: /* tuning menu */
523
524 if ((col GE 6) AND (col LE 8)) {
525
526 if (admctl NE 2)
527 admenu(2); /* put up menu */
528 else
529 admenu(-1); /* take down menu */
530
531 return;
532
533 } else {
534
535 enterit(); /* data entry */
536 return;
537 }
538 }
539}
540
Note: See TracBrowser for help on using the repository browser.