1 
2 enum
3 {
4   UNT_POSITIONNR = 0,
5   UNT_RESTART,
6   UNT_TRACKLEN,
7   UNT_SUBSONGS,
8   UNT_SSPOS,
9   UNT_CHANNELS,
10   UNT_MIXGAIN,
11   UNT_SPMUL,
12 
13   UNT_ENV_AFRAMES,
14   UNT_ENV_AVOLUME,
15   UNT_ENV_DFRAMES,
16   UNT_ENV_DVOLUME,
17   UNT_ENV_SFRAMES,
18   UNT_ENV_RFRAMES,
19   UNT_ENV_RVOLUME,
20 
21   UNT_PLE,
22 
23   UNT_PLE_NOTE,
24   UNT_PLE_WAVEFORM,
25   UNT_PLE_FIXED,
26   UNT_PLE_FX0,
27   UNT_PLE_FX1,
28   UNT_PLE_FXPARAM0,
29   UNT_PLE_FXPARAM1,
30 
31   UNT_PLS_SPEED,
32   UNT_PLS_LENGTH,
33 
34   UNT_INS_VOLUME,
35   UNT_INS_WAVELENGTH,
36   UNT_INS_FILTERLOWERLIMIT,
37   UNT_INS_FILTERUPPERLIMIT,
38   UNT_INS_FILTERSPEED,
39   UNT_INS_SQUARELOWERLIMIT,
40   UNT_INS_SQUAREUPPERLIMIT,
41   UNT_INS_SQUARESPEED,
42   UNT_INS_VIBRATODELAY,
43   UNT_INS_VIBRATOSPEED,
44   UNT_INS_VIBRATODEPTH,
45   UNT_INS_HARDCUTRELEASE,
46   UNT_INS_HARDCUTRELEASEFRAMES,
47 
48   UNT_TRACK,
49 
50   UNT_STP_NOTE,
51   UNT_STP_INSTRUMENT,
52   UNT_STP_NOTEANDINS,
53   UNT_STP_FX,
54   UNT_STP_FXPARAM,
55   UNT_STP_FXANDPARAM,
56   UNT_STP_FXB,
57   UNT_STP_FXBPARAM,
58   UNT_STP_FXBANDPARAM,
59 
60   UNT_POS_TRACK,
61   UNT_POS_TRANS,
62   UNT_POS_REGION,
63 
64   // Strings are treated differently
65   UNT_STRING_SONGNAME,
66   UNT_STRING_INSNAME,
67   UNT_STRING_INSNAME2
68 };
69 
70 struct undonode
71 {
72   struct Node  un_ln;
73   uint32       un_size;
74   uint16       un_type;
75   void        *un_data;
76 };
77 
78 struct udat_env_w
79 {
80   struct ahx_envelope *ptr;
81   int32 insnum;
82   int16 before;
83   int16 after;
84 };
85 
86 struct udat_ple_w
87 {
88   struct ahx_plsentry *ptr;
89   struct ahx_instrument *pins;
90   int32 insnum;
91   int32 pcurx, pcury, ptop;
92   int16 before;
93   int16 after;
94 };
95 
96 struct udat_ple_b
97 {
98   struct ahx_plsentry *ptr;
99   struct ahx_instrument *pins;
100   int32 insnum;
101   int32 pcurx, pcury, ptop;
102   int8 before;
103   int8 after;
104 };
105 
106 struct udat_pls_w
107 {
108   struct ahx_plist *ptr;
109   int32 insnum;
110   int16 before;
111   int16 after;
112 };
113 
114 struct udat_ins_b
115 {
116   struct ahx_instrument *ptr;
117   int32 insnum;
118   uint8 before;
119   uint8 after;
120 };
121 
122 struct udat_stp_b
123 {
124   struct ahx_step *ptr;
125   uint16 posnr;
126   uint8  notenr;
127   int32  tracked_curs;
128   int32  curlch;
129   uint8  before;
130   uint8  after;
131 };
132 
133 struct udat_stp_w
134 {
135   struct ahx_step *ptr;
136   uint16 posnr;
137   uint8  notenr;
138   int32  tracked_curs;
139   int32  curlch;
140   uint16  before;
141   uint16  after;
142 };
143 
144 struct udat_track
145 {
146   int32 track;
147   uint16 posnr;
148   uint8  notenr;
149   int32  tracked_curs;
150   int32  curlch;
151   struct ahx_step before[64];
152   struct ahx_step after[64];
153 };
154 
155 struct udat_pos_b
156 {
157   struct ahx_position *ptr;
158   int32 chan;
159   uint16 posnr;
160   int32 posed_curs;
161   int32 curlch;
162   uint8 before;
163   uint8 after;
164 };
165 
166 struct udat_pos_region
167 {
168   uint16 posnr;
169   int32 posed_curs;
170   int32 curlch;
171   int32 left,  pos;
172   int32 chans, rows;
173   uint8 *before;
174   uint8 *after;
175 };
176 
177 struct udat_whole_plist
178 {
179   struct ahx_plsentry *ptr;
180   int32 insnum;
181   struct ahx_plsentry before[256];
182   struct ahx_plsentry after[256];
183 };
184 
185 struct udat_string
186 {
187   TEXT *ptr;
188   int32 extra;
189   TEXT *before;
190   TEXT *after;
191 };
192 
193 struct udat_tune_b
194 {
195   uint8 before;
196   uint8 after;
197 };
198 
199 struct udat_tune_w
200 {
201   int16 before;
202   int16 after;
203 };
204 
205 struct udat_subsongpos
206 {
207   int32 subsong;
208   uint16 before;
209   uint16 after;
210 };
211 
212 void setbefore_posregion( struct ahx_tune *at, int32 left, int32 pos, int32 chans, int32 rows );
213 void setafter_posregion( struct ahx_tune *at, int32 left, int32 pos, int32 chans, int32 rows );
214 void setbefore_track( struct ahx_tune *at, int32 trk );
215 void setafter_track( struct ahx_tune *at, int32 trk );
216 void setbefore_plist( struct ahx_tune *at, struct ahx_plsentry *ptr );
217 void setafter_plist( struct ahx_tune *at, struct ahx_plsentry *ptr );
218 void setbefore_string( struct ahx_tune *at, TEXT *ptr );
219 void setafter_string( int32 which, struct ahx_tune *at, TEXT *ptr );
220 
221 void modify_env_w( struct ahx_tune *at, struct ahx_envelope *ptr, uint32 field, int16 new );
222 void modify_ins_b( struct ahx_tune *at, struct ahx_instrument *ptr, uint32 field, uint8 new );
223 void modify_ple_b( struct ahx_tune *at, struct ahx_instrument *ins, struct ahx_plsentry *ptr, uint32 field, int8 new );
224 void modify_ple_w( struct ahx_tune *at, struct ahx_instrument *ins, struct ahx_plsentry *ptr, uint32 field, int16 new );
225 void modify_pls_w( struct ahx_tune *at, struct ahx_plist *ptr, uint32 field, int16 new );
226 void modify_stp_b( struct ahx_tune *at, struct ahx_step *ptr, uint32 field, int8 new );
227 void modify_stp_w( struct ahx_tune *at, struct ahx_step *ptr, uint32 field, int16 new );
228 void modify_pos_b( struct ahx_tune *at, struct ahx_position *ptr, int32 chan, uint32 field, int8 new );
229 void modify_tune_b( struct ahx_tune *at, uint32 field, int8 new );
230 void modify_tune_w( struct ahx_tune *at, uint32 field, int16 new );
231 void modify_sspos( struct ahx_tune *at, int16 new );
232 
233 void undo( struct ahx_tune *at );
234 void redo( struct ahx_tune *at );
235 
236 void free_undolists( struct ahx_tune *at );
237