source: buchla-68k/ram/tdselbx.c@ 06f6615

Last change on this file since 06f6615 was b28a12e, checked in by Thomas Lopatic <thomas@…>, 7 years ago

Zero redundant declarations.

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