source: buchla-68k/ram/tdselbx.c@ 081eee0

Last change on this file since 081eee0 was 7ecfb7b, checked in by Thomas Lopatic <thomas@…>, 7 years ago

Unused variables and parameters.

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