1 | /*
|
---|
2 | =============================================================================
|
---|
3 | etwpnt.c -- waveshape editor - point number field handlers
|
---|
4 | Version 8 -- 1987-12-11 -- D.N. Lynx Crowe
|
---|
5 | =============================================================================
|
---|
6 | */
|
---|
7 |
|
---|
8 | #include "stddefs.h"
|
---|
9 | #include "fields.h"
|
---|
10 | #include "vsdd.h"
|
---|
11 | #include "vsddsw.h"
|
---|
12 | #include "graphdef.h"
|
---|
13 |
|
---|
14 | #include "midas.h"
|
---|
15 | #include "wsdsp.h"
|
---|
16 |
|
---|
17 | extern void advwcur(void);
|
---|
18 | extern void wdswin(short n);
|
---|
19 | extern void newws(void);
|
---|
20 |
|
---|
21 | extern unsigned *waveob;
|
---|
22 |
|
---|
23 | extern short stccol, curwpnt;
|
---|
24 |
|
---|
25 | extern short wdbox[][8];
|
---|
26 |
|
---|
27 | extern char dspbuf[];
|
---|
28 |
|
---|
29 | /* |
---|
30 |
|
---|
31 | */
|
---|
32 |
|
---|
33 | /*
|
---|
34 | =============================================================================
|
---|
35 | et_wpnt() -- load the edit buffer
|
---|
36 | =============================================================================
|
---|
37 | */
|
---|
38 |
|
---|
39 | short et_wpnt(short n)
|
---|
40 | {
|
---|
41 | sprintf(ebuf, "%03d", curwpnt);
|
---|
42 | ebflag = TRUE;
|
---|
43 |
|
---|
44 | return(SUCCESS);
|
---|
45 | }
|
---|
46 |
|
---|
47 | /* |
---|
48 |
|
---|
49 | */
|
---|
50 |
|
---|
51 | /*
|
---|
52 | =============================================================================
|
---|
53 | ef_wpnt() -- parse (unload) the edit buffer
|
---|
54 | =============================================================================
|
---|
55 | */
|
---|
56 |
|
---|
57 | short ef_wpnt(short n)
|
---|
58 | {
|
---|
59 | register short i, tmpval;
|
---|
60 |
|
---|
61 | ebuf[3] = '\0'; /* terminate the string in ebuf */
|
---|
62 | ebflag = FALSE;
|
---|
63 |
|
---|
64 | tmpval = 0;
|
---|
65 |
|
---|
66 | for (i = 0; i < 3; i++) /* convert from ASCII to binary */
|
---|
67 | tmpval = (tmpval * 10) + (ebuf[i] - '0');
|
---|
68 |
|
---|
69 | if (tmpval GE NUMWPNT)
|
---|
70 | return(FAILURE);
|
---|
71 |
|
---|
72 | curwpnt = tmpval;
|
---|
73 | newws();
|
---|
74 | wdswin(4);
|
---|
75 | return(SUCCESS);
|
---|
76 | }
|
---|
77 |
|
---|
78 | /* |
---|
79 |
|
---|
80 | */
|
---|
81 |
|
---|
82 | /*
|
---|
83 | =============================================================================
|
---|
84 | rd_wpnt() -- (re)display the field
|
---|
85 | =============================================================================
|
---|
86 | */
|
---|
87 |
|
---|
88 | short rd_wpnt(short nn)
|
---|
89 | {
|
---|
90 | register short n;
|
---|
91 |
|
---|
92 | n = nn & 0xFF;
|
---|
93 | sprintf(dspbuf, "%03d", curwpnt);
|
---|
94 |
|
---|
95 | vbank(0);
|
---|
96 | vcputsv(waveob, 64, wdbox[n][4], wdbox[n][5],
|
---|
97 | wdbox[n][6], wdbox[n][7] + WPNT_OFF, dspbuf, 14);
|
---|
98 |
|
---|
99 | return(SUCCESS);
|
---|
100 | }
|
---|
101 |
|
---|
102 | /* |
---|
103 |
|
---|
104 | */
|
---|
105 |
|
---|
106 | /*
|
---|
107 | =============================================================================
|
---|
108 | nd_wpnt() -- handle new data entry
|
---|
109 | =============================================================================
|
---|
110 | */
|
---|
111 |
|
---|
112 | short nd_wpnt(short nn, short k)
|
---|
113 | {
|
---|
114 | register short ec, n;
|
---|
115 |
|
---|
116 | n = nn & 0xFF;
|
---|
117 | ec = stccol - cfetp->flcol; /* setup edit buffer column */
|
---|
118 | ebuf[ec] = k + '0';
|
---|
119 | ebuf[3] = '\0';
|
---|
120 |
|
---|
121 | dspbuf[0] = k + '0';
|
---|
122 | dspbuf[1] = '\0';
|
---|
123 |
|
---|
124 | vbank(0);
|
---|
125 |
|
---|
126 | vcputsv(waveob, 64, WS_ENTRY, wdbox[n][5],
|
---|
127 | wdbox[n][6], stccol, dspbuf, 14);
|
---|
128 |
|
---|
129 | advwcur();
|
---|
130 |
|
---|
131 | return(SUCCESS);
|
---|
132 | }
|
---|