source: buchla-68k/orig/RAM/TDSELBX.C@ 4f508e6

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

Imported original source code.

  • Property mode set to 100755
File size: 7.1 KB
Line 
1/*
2 =============================================================================
3 tdselbx.c -- tuning editor box selection functions
4 Version 14 -- 1988-12-08 -- D.N. Lynx Crowe
5 =============================================================================
6*/
7
8#include "stddefs.h"
9#include "fields.h"
10#include "vsdd.h"
11#include "graphdef.h"
12
13#include "midas.h"
14#include "tundsp.h"
15
16extern short enterit(), loc2key(), advtcur(), bsptcur(), vtdisp(), nokey();
17
18extern unsigned exp_c();
19
20extern short hitbox, cxval, cyval, hitcx, hitcy, submenu;
21extern short tunmod, curtun, tdnamsw;
22extern short ttcmdsv, ttsel1, ttsel2, ttsel3;
23
24extern short tdbox[][8];
25
26extern struct selbox *csbp, *curboxp;
27
28extern unsigned *tunob;
29
30extern short tuntab[];
31extern short oldtun[];
32
33extern char tuncurn[];
34extern char vtlin1[], vtlin2[], vtlin3[];
35
36/* forward references */
37
38short bx_null(), tdfnbox();
39
40/*
41
42*/
43
44struct selbox tdboxes[] = {
45
46 { 0, 0, 95, 335, 0, tdfnbox}, /* 0: keys 0..23 */
47 { 96, 0, 175, 335, 1, tdfnbox}, /* 1: keys 24..47 */
48 {176, 0, 255, 335, 2, tdfnbox}, /* 2: keys 48..71 */
49 {256, 0, 335, 335, 3, tdfnbox}, /* 3: keys 72..95 */
50 {336, 0, 423, 335, 4, tdfnbox}, /* 4: keys 96..119 */
51 {424, 0, 511, 118, 5, tdfnbox}, /* 5: keys 120..127 */
52 {424, 119, 511, 349, 6, tdfnbox}, /* 6: commands */
53 { 0, 336, 423, 349, 7, tdfnbox}, /* 7: name */
54
55 { 0, 0, 0, 0, 0, FN_NULL} /* end of table */
56};
57
58/*
59
60*/
61
62/*
63 =============================================================================
64 endttyp() -- end function for virtual typewriter
65 =============================================================================
66*/
67
68endttyp()
69{
70 tdnamsw = FALSE;
71 submenu = FALSE;
72 tdswin(0);
73 tdswin(1);
74 tdswin(2);
75 tdswin(6);
76}
77
78/*
79 =============================================================================
80 tcoladj() -- adjust select column to be a display column
81 =============================================================================
82*/
83
84short
85tcoladj(icol)
86short icol;
87{
88 if (icol < 12)
89 return(6);
90 else if (icol < 22)
91 return(16);
92 else if (icol < 32)
93 return(26);
94 else if (icol < 42)
95 return(36);
96 else if (icol < 53)
97 return(47);
98 else
99 return(58);
100}
101
102/*
103
104*/
105
106/*
107 =============================================================================
108 tdhilit() -- highlight selected tuning entries
109 =============================================================================
110*/
111
112tdhilit(from, to)
113short from, to;
114{
115 register short i, row, col, box;
116
117 if (to < from) {
118
119 i = to;
120 to = from;
121 from = i;
122 }
123/*
124
125*/
126 for (i = from; i LE to; i++) {
127
128 if (i < 24) {
129
130 row = i;
131 col = 6;
132 box = 0;
133
134 } else if (i < 48) {
135
136 row = i - 24;
137 col = 16;
138 box = 1;
139
140 } else if (i < 72) {
141
142 row = i - 48;
143 col = 26;
144 box = 2;
145
146 } else if (i < 96) {
147
148 row = i - 72;
149 col = 36;
150 box = 3;
151
152 } else if (i < 120) {
153
154 row = i - 96;
155 col = 47;
156 box = 4;
157
158 } else {
159
160 row = i - 120;
161 col = 58;
162 box = 5;
163 }
164
165 dsttval(row, col, tuntab[i], TDSELD, tdbox[box][5]);
166 }
167}
168
169/*
170
171*/
172
173/*
174 =============================================================================
175 tdfnbox() -- tuning display box hit processor
176 =============================================================================
177*/
178
179short
180tdfnbox(n)
181short n;
182{
183 register short i, key, dcol, row, col;
184
185 row = hitcy / 14;
186 col = hitcx >> 3;
187
188 switch (hitbox) {
189
190 case 0: /* pitch area */
191 case 1:
192 case 2:
193 case 3:
194 case 4:
195 case 5:
196
197 switch (ttcmdsv) { /* switch on editing state */
198
199 case 0: /* data entry */
200
201 enterit();
202 return(SUCCESS);
203/*
204
205*/
206 case 1: /* transpose and copy -- start */
207
208 ttsel1 = loc2key(row, col);
209
210 if (ttsel1 < 0) {
211
212 ttcmdsv = 0;
213 tdswin(6);
214 return(SUCCESS);
215 }
216
217 ttcmdsv = 2;
218 dcol = tcoladj(col);
219 dsttval(row, dcol, tuntab[ttsel1], TDSELD,
220 tdbox[hitbox][5]);
221
222 return(SUCCESS);
223
224 case 2: /* transpose and copy -- finish */
225
226 ttsel2 = loc2key(row, col);
227
228 if (ttsel2 < 0) {
229
230 ttcmdsv = 0;
231 tdswin(6);
232 return(SUCCESS);
233 }
234
235 ttcmdsv = 3;
236 tdhilit(ttsel1, ttsel2);
237 return(SUCCESS);
238
239 case 3: /* transpose and copy -- dest */
240
241 ttsel3 = loc2key(row, col);
242
243 if (ttsel3 GE 0)
244 tt_trcp(ttsel1, ttsel2, ttsel3);
245
246 ttcmdsv = 0;
247
248 for (i = 0; i < 7; i++)
249 tdswin(i);
250
251 return(SUCCESS);
252/*
253
254*/
255 case 4: /* increment -- from */
256
257 ttsel1 = loc2key(row, col);
258
259 if (ttsel1 < 0) {
260
261 ttcmdsv = 0;
262 tdswin(6);
263 return(SUCCESS);
264 }
265
266 ttcmdsv = 5;
267 dcol = tcoladj(col);
268 dsttval(row, dcol, tuntab[ttsel1], TDSELD,
269 tdbox[hitbox][5]);
270
271 return(SUCCESS);
272
273 case 5: /* increment -- to */
274
275 ttsel2 = loc2key(row, col);
276
277 if (ttsel2 GE 0)
278 tt_incr(ttsel1, ttsel2);
279
280 ttcmdsv = 0;
281
282 for (i = 0; i < 7; i++)
283 tdswin(i);
284
285 return(SUCCESS);
286/*
287
288*/
289 case 6: /* interpolate -- from */
290
291 ttsel1 = loc2key(row, col);
292
293 if (ttsel1 < 0) {
294
295 ttcmdsv = 0;
296 tdswin(6);
297 return(SUCCESS);
298 }
299
300 ttcmdsv = 7;
301 dcol = tcoladj(col);
302 dsttval(row, dcol, tuntab[ttsel1], TDSELD,
303 tdbox[hitbox][5]);
304
305 return(SUCCESS);
306
307 case 7: /* interpolate -- to */
308
309 ttsel2 = loc2key(row, col);
310
311 if (ttsel2 GE 0)
312 tt_intp(ttsel1, ttsel2);
313
314 ttcmdsv = 0;
315
316 for (i = 0; i < 7; i++)
317 tdswin(i);
318
319 return(SUCCESS);
320 }
321
322 return(FAILURE);
323/*
324
325*/
326 case 6: /* command, value, table # */
327
328 switch (row) {
329
330 case 9: /* transpose and copy */
331 case 10:
332
333 ttcmdsv = 1;
334 td_trcp(1);
335 return(SUCCESS);
336
337 case 12: /* increment */
338
339 ttcmdsv = 4;
340 td_incr(1);
341 return(SUCCESS);
342
343 case 14: /* interpolate */
344
345 ttcmdsv = 6;
346 td_intp(1);
347 return(SUCCESS);
348
349 case 16: /* undo */
350
351 ttcmdsv = 0;
352 memcpyw(tuntab, oldtun, 128);
353 twins();
354 return(SUCCESS);
355/*
356
357*/
358 case 18: /* data entry */
359 case 24:
360
361 enterit();
362 return(SUCCESS);
363
364 case 20: /* store */
365
366 if (curtun EQ 0)
367 return(FAILURE);
368
369 puttun(curtun);
370 memcpyw(oldtun, tuntab, 128);
371 tdswin(6);
372 return(SUCCESS);
373
374 case 22: /* retrieve */
375
376 gettun(curtun);
377 memcpyw(oldtun, tuntab, 128);
378 twins();
379 return(SUCCESS);
380 }
381
382 return(FAILURE);
383
384/*
385
386*/
387 case 7: /* tuning table name */
388
389 if ((col < 7) OR (col GT 38))
390 return(FAILURE);
391
392 if (tdnamsw) {
393
394 vtyper();
395 tunmod = TRUE;
396
397 } else {
398
399 vbank(0);
400 vbfill4(tunob, 128, CTOX(1), RTOY(21),
401 CTOX(31) - 1, RTOY(24) - 1, exp_c(TDTCURB));
402
403 tsplot4(tunob, 64, TDTCHRC, 21, 1, vtlin1, 14);
404 tsplot4(tunob, 64, TDTCHRC, 22, 1, vtlin2, 14);
405 tsplot4(tunob, 64, TDTCHRC, 23, 1, vtlin3, 14);
406
407 vtsetup(tunob, vtdisp, 7, tuncurn, 21, 1,
408 advtcur, bsptcur, nokey, nokey, endttyp,
409 tdbox[n][4], tdbox[n][5]);
410
411 tdnamsw = TRUE;
412 submenu = TRUE;
413 }
414
415 return(SUCCESS);
416 }
417
418 return(FAILURE);
419}
Note: See TracBrowser for help on using the repository browser.