major cleanup of preprocessor hell
[rocksndiamonds.git] / src / editor.c
1 // ============================================================================
2 // Rocks'n'Diamonds - McDuffin Strikes Back!
3 // ----------------------------------------------------------------------------
4 // (c) 1995-2014 by Artsoft Entertainment
5 //                  Holger Schemel
6 //                  info@artsoft.org
7 //                  http://www.artsoft.org/
8 // ----------------------------------------------------------------------------
9 // editor.c
10 // ============================================================================
11
12 #include <math.h>
13
14 #include "libgame/libgame.h"
15
16 #include "editor.h"
17 #include "screens.h"
18 #include "tools.h"
19 #include "files.h"
20 #include "game.h"
21 #include "init.h"
22 #include "tape.h"
23
24
25 #define INFOTEXT_UNKNOWN_ELEMENT        "unknown"
26
27
28 /*
29   -----------------------------------------------------------------------------
30   screen and artwork graphic pixel position definitions
31   -----------------------------------------------------------------------------
32 */
33
34 /* positions in the level editor */
35 #define ED_WIN_MB_LEFT_XPOS             (editor.palette.element_left.x)
36 #define ED_WIN_MB_LEFT_YPOS             (editor.palette.element_left.y)
37 #define ED_WIN_MB_MIDDLE_XPOS           (editor.palette.element_middle.x)
38 #define ED_WIN_MB_MIDDLE_YPOS           (editor.palette.element_middle.y)
39 #define ED_WIN_MB_RIGHT_XPOS            (editor.palette.element_right.x)
40 #define ED_WIN_MB_RIGHT_YPOS            (editor.palette.element_right.y)
41
42 /* values for the control window */
43 #define ED_CTRL_NO_BUTTONS_GFX_XPOS     6
44 #define ED_CTRL_NO_BUTTONS_GFX_YPOS     286
45 #define ED_CTRL1_BUTTONS_GFX_YPOS       236
46 #define ED_CTRL2_BUTTONS_GFX_YPOS       236
47 #define ED_CTRL3_BUTTONS_GFX_YPOS       324
48 #define ED_CTRL4_BUTTONS_GFX_XPOS       44
49 #define ED_CTRL4_BUTTONS_GFX_YPOS       214
50 #define ED_CTRL1_BUTTONS_ALT_GFX_YPOS   142
51 #define ED_CTRL3_BUTTONS_ALT_GFX_YPOS   302
52
53 #define ED_CTRL1_BUTTON_XSIZE           22
54 #define ED_CTRL1_BUTTON_YSIZE           22
55 #define ED_CTRL1_BUTTONS_XPOS           6
56 #define ED_CTRL1_BUTTONS_YPOS           6
57 #define ED_CTRL2_BUTTON_XSIZE           30
58 #define ED_CTRL2_BUTTON_YSIZE           20
59 #define ED_CTRL2_BUTTONS_XPOS           5
60 #define ED_CTRL2_BUTTONS_YPOS           99
61 #define ED_CTRL3_BUTTON_XSIZE           22
62 #define ED_CTRL3_BUTTON_YSIZE           22
63 #define ED_CTRL3_BUTTONS_XPOS           6
64 #define ED_CTRL3_BUTTONS_YPOS           6
65 #define ED_CTRL4_BUTTON_XSIZE           22
66 #define ED_CTRL4_BUTTON_YSIZE           22
67 #define ED_CTRL4_BUTTONS_XPOS           6
68 #define ED_CTRL4_BUTTONS_YPOS           6
69
70 #define ED_CTRL1_BUTTONS_HORIZ          4
71 #define ED_CTRL1_BUTTONS_VERT           4
72 #define ED_CTRL2_BUTTONS_HORIZ          3
73 #define ED_CTRL2_BUTTONS_VERT           2
74 #define ED_CTRL3_BUTTONS_HORIZ          3
75 #define ED_CTRL3_BUTTONS_VERT           1
76 #define ED_CTRL4_BUTTONS_HORIZ          2
77 #define ED_CTRL4_BUTTONS_VERT           1
78
79 #define ED_NUM_CTRL1_BUTTONS   (ED_CTRL1_BUTTONS_HORIZ * ED_CTRL1_BUTTONS_VERT)
80 #define ED_NUM_CTRL2_BUTTONS   (ED_CTRL2_BUTTONS_HORIZ * ED_CTRL2_BUTTONS_VERT)
81 #define ED_NUM_CTRL3_BUTTONS   (ED_CTRL3_BUTTONS_HORIZ * ED_CTRL3_BUTTONS_VERT)
82 #define ED_NUM_CTRL4_BUTTONS   (ED_CTRL4_BUTTONS_HORIZ * ED_CTRL4_BUTTONS_VERT)
83 #define ED_NUM_CTRL1_2_BUTTONS (ED_NUM_CTRL1_BUTTONS   + ED_NUM_CTRL2_BUTTONS)
84 #define ED_NUM_CTRL1_3_BUTTONS (ED_NUM_CTRL1_2_BUTTONS + ED_NUM_CTRL3_BUTTONS)
85 #define ED_NUM_CTRL_BUTTONS    (ED_NUM_CTRL1_BUTTONS +  \
86                                 ED_NUM_CTRL2_BUTTONS +  \
87                                 ED_NUM_CTRL3_BUTTONS +  \
88                                 ED_NUM_CTRL4_BUTTONS)
89
90 /* values for the element list */
91 #define ED_ELEMENTLIST_XPOS             (editor.palette.x)
92 #define ED_ELEMENTLIST_YPOS             (editor.palette.y)
93 #define ED_ELEMENTLIST_XSIZE            20
94 #define ED_ELEMENTLIST_YSIZE            20
95 #define ED_ELEMENTLIST_BUTTONS_HORIZ    (editor.palette.cols)
96 #define ED_ELEMENTLIST_BUTTONS_VERT     (editor.palette.rows)
97 #define ED_NUM_ELEMENTLIST_BUTTONS      (ED_ELEMENTLIST_BUTTONS_HORIZ * \
98                                          ED_ELEMENTLIST_BUTTONS_VERT)
99
100 /* standard distances */
101 #define ED_BORDER_SIZE                  3
102 #define ED_BORDER_TEXT_XSIZE            5
103 #define ED_BORDER_AREA_YSIZE            1
104
105 #define ED_GADGET_DISTANCE              2
106 #define ED_GADGET_TEXT_DISTANCE         (2 * ED_GADGET_DISTANCE)
107 #define ED_DRAWINGAREA_TEXT_DISTANCE    (ED_GADGET_TEXT_DISTANCE +      \
108                                          MINI_TILEX / 2)
109
110 /* values for the settings windows */
111 #define ED_LEVEL_SETTINGS_XSTART        (3 * MINI_TILEX / 2)
112 #define ED_LEVEL_SETTINGS_YSTART        (7 * MINI_TILEY)
113
114 #define ED_ELEMENT_SETTINGS_XSTART      (3 * MINI_TILEX / 2)
115 #define ED_ELEMENT_SETTINGS_YSTART      (10 * MINI_TILEY)
116
117 #define ED_XOFFSET_CHECKBOX             (ED_CHECKBUTTON_XSIZE +         \
118                                          2 * ED_GADGET_DISTANCE)
119
120 #define ED_SETTINGS_XOFFSET             ED_XOFFSET_CHECKBOX
121 #define ED_SETTINGS_YOFFSET             (3 * MINI_TILEY / 2)
122 #define ED_SETTINGS_TAB_XOFFSET         124
123
124 #define ED_LEVEL_SETTINGS_XPOS(n)       (ED_LEVEL_SETTINGS_XSTART +     \
125                                          (n) * ED_SETTINGS_XOFFSET)
126 #define ED_LEVEL_SETTINGS_YPOS(n)       (ED_LEVEL_SETTINGS_YSTART +     \
127                                          (n) * ED_SETTINGS_YOFFSET)
128
129 #define ED_ELEMENT_SETTINGS_XPOS(n)     (ED_ELEMENT_SETTINGS_XSTART +   \
130                                          (n) * ED_SETTINGS_XOFFSET)
131 #define ED_ELEMENT_SETTINGS_YPOS(n)     (ED_ELEMENT_SETTINGS_YSTART +   \
132                                          (n) * ED_SETTINGS_YOFFSET)
133
134 #define ED_LEVEL_SETTINGS_TABS_XPOS(n)  (ED_LEVEL_SETTINGS_XPOS(0) +    \
135                                         (n) * ED_SETTINGS_TAB_XOFFSET)
136 #define ED_LEVEL_SETTINGS_TABS_YPOS(n)  (ED_LEVEL_SETTINGS_YSTART -     \
137                                          3 * MINI_TILEY)
138
139 #define ED_ELEMENT_SETTINGS_TABS_XPOS(n) (ED_ELEMENT_SETTINGS_XPOS(0) + \
140                                          (n) * ED_SETTINGS_TAB_XOFFSET)
141 #define ED_ELEMENT_SETTINGS_TABS_YPOS(n) (ED_ELEMENT_SETTINGS_YSTART -  \
142                                          2 * MINI_TILEY)
143
144 #define ED_SETTINGS1_YPOS               MINI_TILEY
145 #define ED_SETTINGS2_XPOS               MINI_TILEX
146 #define ED_SETTINGS2_YPOS               (ED_SETTINGS1_YPOS + 12 * TILEY - 2)
147
148 /* values for counter gadgets */
149 #define ED_COUNTER_YSTART               (ED_SETTINGS1_YPOS + 2 * TILEY)
150 #define ED_COUNTER_YDISTANCE            (3 * MINI_TILEY)
151 #define ED_COUNTER_YPOS(n)              (ED_COUNTER_YSTART +            \
152                                          (n) * ED_COUNTER_YDISTANCE)
153 #define ED_COUNTER2_YPOS(n)             (ED_COUNTER_YSTART +            \
154                                          (n) * ED_COUNTER_YDISTANCE - 2)
155
156 /* values for element content drawing areas */
157 #define ED_AREA_1X1_SETTINGS_XPOS(n)    (ED_ELEMENT_SETTINGS_XPOS(n))
158 #define ED_AREA_1X1_SETTINGS_YPOS(n)    (ED_ELEMENT_SETTINGS_YPOS(n) +  \
159                                          ED_GADGET_DISTANCE)
160
161 #define ED_AREA_3X3_SETTINGS_XPOS(n)    (ED_ELEMENT_SETTINGS_XPOS(n))
162 #define ED_AREA_3X3_SETTINGS_YPOS(n)    (ED_ELEMENT_SETTINGS_YPOS(n) +  \
163                                          ED_GADGET_DISTANCE - MINI_TILEY)
164
165 /* yamyam content */
166 #define ED_AREA_YAMYAM_CONTENT_XPOS(n)  (2 * MINI_TILEX +               \
167                                          5 * ((n) % 4) * MINI_TILEX)
168 #define ED_AREA_YAMYAM_CONTENT_YPOS(n)  (11 * ED_SETTINGS_YOFFSET +     \
169                                          6 * ((n) / 4) * MINI_TILEY)
170
171 /* magic ball content */
172 #define ED_AREA_MAGIC_BALL_CONTENT_XPOS(n) (2 * MINI_TILEX +            \
173                                             5 * ((n) % 4) * MINI_TILEX)
174 #define ED_AREA_MAGIC_BALL_CONTENT_YPOS(n) (12 * ED_SETTINGS_YOFFSET +  \
175                                             6 * ((n) / 4) * MINI_TILEY)
176
177 /* values for scrolling gadgets for drawing area */
178 #define ED_SCROLLBUTTON_XPOS            24
179 #define ED_SCROLLBUTTON_YPOS            0
180 #define ED_SCROLLBAR_XPOS               24
181 #define ED_SCROLLBAR_YPOS               64
182
183 #define ED_SCROLLBUTTON_XSIZE           16
184 #define ED_SCROLLBUTTON_YSIZE           16
185
186 #define ED_SCROLL_UP_XPOS               (SXSIZE - ED_SCROLLBUTTON_XSIZE)
187 #define ED_SCROLL_UP_YPOS               (0)
188 #define ED_SCROLL_DOWN_XPOS             ED_SCROLL_UP_XPOS
189 #define ED_SCROLL_DOWN_YPOS             (SYSIZE - 3 * ED_SCROLLBUTTON_YSIZE)
190 #define ED_SCROLL_LEFT_XPOS             (0)
191 #define ED_SCROLL_LEFT_YPOS             (SYSIZE - 2 * ED_SCROLLBUTTON_YSIZE)
192 #define ED_SCROLL_RIGHT_XPOS            (SXSIZE - 2 * ED_SCROLLBUTTON_XSIZE)
193 #define ED_SCROLL_RIGHT_YPOS            ED_SCROLL_LEFT_YPOS
194 #define ED_SCROLL_HORIZONTAL_XPOS       (ED_SCROLL_LEFT_XPOS +          \
195                                          ED_SCROLLBUTTON_XSIZE)
196 #define ED_SCROLL_HORIZONTAL_YPOS       ED_SCROLL_LEFT_YPOS
197 #define ED_SCROLL_HORIZONTAL_XSIZE      (SXSIZE - 3 * ED_SCROLLBUTTON_XSIZE)
198 #define ED_SCROLL_HORIZONTAL_YSIZE      ED_SCROLLBUTTON_YSIZE
199 #define ED_SCROLL_VERTICAL_XPOS         ED_SCROLL_UP_XPOS
200 #define ED_SCROLL_VERTICAL_YPOS         (ED_SCROLL_UP_YPOS +            \
201                                          ED_SCROLLBUTTON_YSIZE)
202 #define ED_SCROLL_VERTICAL_XSIZE        ED_SCROLLBUTTON_XSIZE
203 #define ED_SCROLL_VERTICAL_YSIZE        (SYSIZE - 4 * ED_SCROLLBUTTON_YSIZE)
204
205 /* values for scrolling gadgets for element list */
206 #define ED_SCROLLBUTTON2_XPOS           50
207 #define ED_SCROLLBUTTON2_YPOS           0
208 #define ED_SCROLLBAR2_XPOS              50
209 #define ED_SCROLLBAR2_YPOS              20
210
211 #define ED_SCROLLBUTTON2_XSIZE          10
212 #define ED_SCROLLBUTTON2_YSIZE          10
213
214 #define ED_SCROLL2_UP_XPOS              (ED_ELEMENTLIST_XPOS +          \
215                                          ED_ELEMENTLIST_BUTTONS_HORIZ * \
216                                          ED_ELEMENTLIST_XSIZE)
217 #define ED_SCROLL2_UP_YPOS              ED_ELEMENTLIST_YPOS
218 #define ED_SCROLL2_DOWN_XPOS            ED_SCROLL2_UP_XPOS
219 #define ED_SCROLL2_DOWN_YPOS            (ED_SCROLL2_UP_YPOS +           \
220                                          ED_ELEMENTLIST_BUTTONS_VERT *  \
221                                          ED_ELEMENTLIST_YSIZE -         \
222                                          ED_SCROLLBUTTON2_YSIZE)
223 #define ED_SCROLL2_VERTICAL_XPOS        ED_SCROLL2_UP_XPOS
224 #define ED_SCROLL2_VERTICAL_YPOS        (ED_SCROLL2_UP_YPOS +           \
225                                          ED_SCROLLBUTTON2_YSIZE)
226 #define ED_SCROLL2_VERTICAL_XSIZE       ED_SCROLLBUTTON2_XSIZE
227 #define ED_SCROLL2_VERTICAL_YSIZE       (ED_ELEMENTLIST_BUTTONS_VERT *  \
228                                          ED_ELEMENTLIST_YSIZE -         \
229                                          2 * ED_SCROLLBUTTON2_YSIZE)
230
231 /* values for checkbutton gadgets */
232 #define ED_CHECKBUTTON_XSIZE            ED_BUTTON_COUNT_XSIZE
233 #define ED_CHECKBUTTON_YSIZE            ED_BUTTON_COUNT_YSIZE
234 #define ED_CHECKBUTTON_UNCHECKED_XPOS   ED_BUTTON_MINUS_XPOS
235 #define ED_CHECKBUTTON_CHECKED_XPOS     ED_BUTTON_PLUS_XPOS
236 #define ED_CHECKBUTTON_YPOS             (ED_BUTTON_MINUS_YPOS + 22)
237 #define ED_RADIOBUTTON_YPOS             (ED_BUTTON_MINUS_YPOS + 44)
238 #define ED_STICKYBUTTON_YPOS            (ED_BUTTON_MINUS_YPOS + 66)
239
240 /* values for some special graphic buttons */
241 #define ED_COPY_CHANGE_PAGE_XPOS        25
242 #define ED_COPY_CHANGE_PAGE_YPOS        50
243 #define ED_PASTE_CHANGE_PAGE_XPOS       25
244 #define ED_PASTE_CHANGE_PAGE_YPOS       70
245
246 /* some values for text input, selectbox and counter gadgets */
247 #define ED_BUTTON_COUNT_YPOS            60
248 #define ED_BUTTON_COUNT_XSIZE           20
249 #define ED_BUTTON_COUNT_YSIZE           20
250 #define ED_WIN_COUNT_XPOS               (2 + ED_BUTTON_COUNT_XSIZE + 2)
251 #define ED_WIN_COUNT_YPOS               ED_BUTTON_COUNT_YPOS
252 #define ED_WIN_COUNT_XSIZE              52
253 #define ED_WIN_COUNT_YSIZE              ED_BUTTON_COUNT_YSIZE
254 #define ED_WIN_COUNT2_XPOS              27
255 #define ED_WIN_COUNT2_YPOS              3
256 #define ED_WIN_COUNT2_XSIZE             46
257 #define ED_WIN_COUNT2_YSIZE             ED_BUTTON_COUNT_YSIZE
258
259 #define ED_BUTTON_MINUS_XPOS            2
260 #define ED_BUTTON_MINUS_YPOS            ED_BUTTON_COUNT_YPOS
261 #define ED_BUTTON_MINUS_XSIZE           ED_BUTTON_COUNT_XSIZE
262 #define ED_BUTTON_MINUS_YSIZE           ED_BUTTON_COUNT_YSIZE
263 #define ED_BUTTON_PLUS_XPOS             (ED_WIN_COUNT_XPOS +            \
264                                          ED_WIN_COUNT_XSIZE + 2)
265 #define ED_BUTTON_PLUS_YPOS             ED_BUTTON_COUNT_YPOS
266 #define ED_BUTTON_PLUS_XSIZE            ED_BUTTON_COUNT_XSIZE
267 #define ED_BUTTON_PLUS_YSIZE            ED_BUTTON_COUNT_YSIZE
268
269 #define ED_SELECTBOX_XPOS               ED_WIN_COUNT_XPOS
270 #define ED_SELECTBOX_YPOS               (ED_WIN_COUNT_YPOS +            \
271                                          2 + ED_WIN_COUNT_YSIZE)
272 #define ED_SELECTBOX_XSIZE              ED_WIN_COUNT_XSIZE
273 #define ED_SELECTBOX_YSIZE              ED_WIN_COUNT_YSIZE
274
275 #define ED_SELECTBOX_BUTTON_XSIZE       14
276
277 #define ED_TEXTBUTTON_XPOS              ED_WIN_COUNT_XPOS
278 #define ED_TEXTBUTTON_YPOS              (ED_WIN_COUNT_YPOS +            \
279                                          4 * (2 + ED_WIN_COUNT_YSIZE))
280 #define ED_TEXTBUTTON_INACTIVE_YPOS     ED_TEXTBUTTON_YPOS
281
282 #define ED_TEXTBUTTON_TAB_XPOS          ED_WIN_COUNT_XPOS
283 #define ED_TEXTBUTTON_TAB_YPOS          (ED_WIN_COUNT_YPOS +            \
284                                          2 * (2 + ED_WIN_COUNT_YSIZE))
285 #define ED_TEXTBUTTON_TAB_INACTIVE_YPOS (ED_WIN_COUNT_YPOS +            \
286                                          3 * (2 + ED_WIN_COUNT_YSIZE))
287
288 #define ED_TEXTBUTTON_XSIZE             ED_WIN_COUNT_XSIZE
289 #define ED_TEXTBUTTON_YSIZE             ED_WIN_COUNT_YSIZE
290
291 /* values for ClearEditorGadgetInfoText() and HandleEditorGadgetInfoText() */
292 #define INFOTEXT_XPOS                   SX
293 #define INFOTEXT_YPOS                   (SY + SYSIZE - MINI_TILEX + 2)
294 #define INFOTEXT_XSIZE                  SXSIZE
295 #define INFOTEXT_YSIZE                  MINI_TILEX
296
297
298 /*
299   -----------------------------------------------------------------------------
300   editor gadget definitions
301   -----------------------------------------------------------------------------
302 */
303
304 /* drawing toolbox buttons */
305 #define GADGET_ID_NONE                  -1
306 #define GADGET_ID_TOOLBOX_FIRST         0
307
308 #define GADGET_ID_SINGLE_ITEMS          (GADGET_ID_TOOLBOX_FIRST + 0)
309 #define GADGET_ID_CONNECTED_ITEMS       (GADGET_ID_TOOLBOX_FIRST + 1)
310 #define GADGET_ID_LINE                  (GADGET_ID_TOOLBOX_FIRST + 2)
311 #define GADGET_ID_ARC                   (GADGET_ID_TOOLBOX_FIRST + 3)
312 #define GADGET_ID_RECTANGLE             (GADGET_ID_TOOLBOX_FIRST + 4)
313 #define GADGET_ID_FILLED_BOX            (GADGET_ID_TOOLBOX_FIRST + 5)
314 #define GADGET_ID_WRAP_UP               (GADGET_ID_TOOLBOX_FIRST + 6)
315 #define GADGET_ID_TEXT                  (GADGET_ID_TOOLBOX_FIRST + 7)
316 #define GADGET_ID_FLOOD_FILL            (GADGET_ID_TOOLBOX_FIRST + 8)
317 #define GADGET_ID_WRAP_LEFT             (GADGET_ID_TOOLBOX_FIRST + 9)
318 #define GADGET_ID_PROPERTIES            (GADGET_ID_TOOLBOX_FIRST + 10)
319 #define GADGET_ID_WRAP_RIGHT            (GADGET_ID_TOOLBOX_FIRST + 11)
320 #define GADGET_ID_RANDOM_PLACEMENT      (GADGET_ID_TOOLBOX_FIRST + 12)
321 #define GADGET_ID_GRAB_BRUSH            (GADGET_ID_TOOLBOX_FIRST + 13)
322 #define GADGET_ID_WRAP_DOWN             (GADGET_ID_TOOLBOX_FIRST + 14)
323 #define GADGET_ID_PICK_ELEMENT          (GADGET_ID_TOOLBOX_FIRST + 15)
324
325 #define GADGET_ID_UNDO                  (GADGET_ID_TOOLBOX_FIRST + 16)
326 #define GADGET_ID_INFO                  (GADGET_ID_TOOLBOX_FIRST + 17)
327 #define GADGET_ID_SAVE                  (GADGET_ID_TOOLBOX_FIRST + 18)
328 #define GADGET_ID_CLEAR                 (GADGET_ID_TOOLBOX_FIRST + 19)
329 #define GADGET_ID_TEST                  (GADGET_ID_TOOLBOX_FIRST + 20)
330 #define GADGET_ID_EXIT                  (GADGET_ID_TOOLBOX_FIRST + 21)
331
332 #define GADGET_ID_CUSTOM_COPY_FROM      (GADGET_ID_TOOLBOX_FIRST + 22)
333 #define GADGET_ID_CUSTOM_COPY_TO        (GADGET_ID_TOOLBOX_FIRST + 23)
334 #define GADGET_ID_CUSTOM_EXCHANGE       (GADGET_ID_TOOLBOX_FIRST + 24)
335 #define GADGET_ID_CUSTOM_COPY           (GADGET_ID_TOOLBOX_FIRST + 25)
336 #define GADGET_ID_CUSTOM_PASTE          (GADGET_ID_TOOLBOX_FIRST + 26)
337
338 /* counter gadget identifiers */
339 #define GADGET_ID_COUNTER_FIRST         (GADGET_ID_TOOLBOX_FIRST + 27)
340
341 #define GADGET_ID_SELECT_LEVEL_DOWN     (GADGET_ID_COUNTER_FIRST + 0)
342 #define GADGET_ID_SELECT_LEVEL_TEXT     (GADGET_ID_COUNTER_FIRST + 1)
343 #define GADGET_ID_SELECT_LEVEL_UP       (GADGET_ID_COUNTER_FIRST + 2)
344 #define GADGET_ID_LEVEL_XSIZE_DOWN      (GADGET_ID_COUNTER_FIRST + 3)
345 #define GADGET_ID_LEVEL_XSIZE_TEXT      (GADGET_ID_COUNTER_FIRST + 4)
346 #define GADGET_ID_LEVEL_XSIZE_UP        (GADGET_ID_COUNTER_FIRST + 5)
347 #define GADGET_ID_LEVEL_YSIZE_DOWN      (GADGET_ID_COUNTER_FIRST + 6)
348 #define GADGET_ID_LEVEL_YSIZE_TEXT      (GADGET_ID_COUNTER_FIRST + 7)
349 #define GADGET_ID_LEVEL_YSIZE_UP        (GADGET_ID_COUNTER_FIRST + 8)
350 #define GADGET_ID_LEVEL_RANDOM_DOWN     (GADGET_ID_COUNTER_FIRST + 9)
351 #define GADGET_ID_LEVEL_RANDOM_TEXT     (GADGET_ID_COUNTER_FIRST + 10)
352 #define GADGET_ID_LEVEL_RANDOM_UP       (GADGET_ID_COUNTER_FIRST + 11)
353 #define GADGET_ID_LEVEL_GEMSLIMIT_DOWN  (GADGET_ID_COUNTER_FIRST + 12)
354 #define GADGET_ID_LEVEL_GEMSLIMIT_TEXT  (GADGET_ID_COUNTER_FIRST + 13)
355 #define GADGET_ID_LEVEL_GEMSLIMIT_UP    (GADGET_ID_COUNTER_FIRST + 14)
356 #define GADGET_ID_LEVEL_TIMELIMIT_DOWN  (GADGET_ID_COUNTER_FIRST + 15)
357 #define GADGET_ID_LEVEL_TIMELIMIT_TEXT  (GADGET_ID_COUNTER_FIRST + 16)
358 #define GADGET_ID_LEVEL_TIMELIMIT_UP    (GADGET_ID_COUNTER_FIRST + 17)
359 #define GADGET_ID_LEVEL_TIMESCORE_DOWN  (GADGET_ID_COUNTER_FIRST + 18)
360 #define GADGET_ID_LEVEL_TIMESCORE_TEXT  (GADGET_ID_COUNTER_FIRST + 19)
361 #define GADGET_ID_LEVEL_TIMESCORE_UP    (GADGET_ID_COUNTER_FIRST + 20)
362 #define GADGET_ID_LEVEL_RANDOM_SEED_DOWN (GADGET_ID_COUNTER_FIRST + 21)
363 #define GADGET_ID_LEVEL_RANDOM_SEED_TEXT (GADGET_ID_COUNTER_FIRST + 22)
364 #define GADGET_ID_LEVEL_RANDOM_SEED_UP  (GADGET_ID_COUNTER_FIRST + 23)
365 #define GADGET_ID_ELEMENT_VALUE1_DOWN   (GADGET_ID_COUNTER_FIRST + 24)
366 #define GADGET_ID_ELEMENT_VALUE1_TEXT   (GADGET_ID_COUNTER_FIRST + 25)
367 #define GADGET_ID_ELEMENT_VALUE1_UP     (GADGET_ID_COUNTER_FIRST + 26)
368 #define GADGET_ID_ELEMENT_VALUE2_DOWN   (GADGET_ID_COUNTER_FIRST + 27)
369 #define GADGET_ID_ELEMENT_VALUE2_TEXT   (GADGET_ID_COUNTER_FIRST + 28)
370 #define GADGET_ID_ELEMENT_VALUE2_UP     (GADGET_ID_COUNTER_FIRST + 29)
371 #define GADGET_ID_ELEMENT_VALUE3_DOWN   (GADGET_ID_COUNTER_FIRST + 30)
372 #define GADGET_ID_ELEMENT_VALUE3_TEXT   (GADGET_ID_COUNTER_FIRST + 31)
373 #define GADGET_ID_ELEMENT_VALUE3_UP     (GADGET_ID_COUNTER_FIRST + 32)
374 #define GADGET_ID_ELEMENT_VALUE4_DOWN   (GADGET_ID_COUNTER_FIRST + 33)
375 #define GADGET_ID_ELEMENT_VALUE4_TEXT   (GADGET_ID_COUNTER_FIRST + 34)
376 #define GADGET_ID_ELEMENT_VALUE4_UP     (GADGET_ID_COUNTER_FIRST + 35)
377 #define GADGET_ID_YAMYAM_CONTENT_DOWN   (GADGET_ID_COUNTER_FIRST + 36)
378 #define GADGET_ID_YAMYAM_CONTENT_TEXT   (GADGET_ID_COUNTER_FIRST + 37)
379 #define GADGET_ID_YAMYAM_CONTENT_UP     (GADGET_ID_COUNTER_FIRST + 38)
380 #define GADGET_ID_BALL_CONTENT_DOWN     (GADGET_ID_COUNTER_FIRST + 39)
381 #define GADGET_ID_BALL_CONTENT_TEXT     (GADGET_ID_COUNTER_FIRST + 40)
382 #define GADGET_ID_BALL_CONTENT_UP       (GADGET_ID_COUNTER_FIRST + 41)
383 #define GADGET_ID_ANDROID_CONTENT_DOWN  (GADGET_ID_COUNTER_FIRST + 42)
384 #define GADGET_ID_ANDROID_CONTENT_TEXT  (GADGET_ID_COUNTER_FIRST + 43)
385 #define GADGET_ID_ANDROID_CONTENT_UP    (GADGET_ID_COUNTER_FIRST + 44)
386 #define GADGET_ID_ENVELOPE_XSIZE_DOWN   (GADGET_ID_COUNTER_FIRST + 45)
387 #define GADGET_ID_ENVELOPE_XSIZE_TEXT   (GADGET_ID_COUNTER_FIRST + 46)
388 #define GADGET_ID_ENVELOPE_XSIZE_UP     (GADGET_ID_COUNTER_FIRST + 47)
389 #define GADGET_ID_ENVELOPE_YSIZE_DOWN   (GADGET_ID_COUNTER_FIRST + 48)
390 #define GADGET_ID_ENVELOPE_YSIZE_TEXT   (GADGET_ID_COUNTER_FIRST + 49)
391 #define GADGET_ID_ENVELOPE_YSIZE_UP     (GADGET_ID_COUNTER_FIRST + 50)
392 #define GADGET_ID_INVENTORY_SIZE_DOWN   (GADGET_ID_COUNTER_FIRST + 51)
393 #define GADGET_ID_INVENTORY_SIZE_TEXT   (GADGET_ID_COUNTER_FIRST + 52)
394 #define GADGET_ID_INVENTORY_SIZE_UP     (GADGET_ID_COUNTER_FIRST + 53)
395 #define GADGET_ID_CUSTOM_SCORE_DOWN     (GADGET_ID_COUNTER_FIRST + 54)
396 #define GADGET_ID_CUSTOM_SCORE_TEXT     (GADGET_ID_COUNTER_FIRST + 55)
397 #define GADGET_ID_CUSTOM_SCORE_UP       (GADGET_ID_COUNTER_FIRST + 56)
398 #define GADGET_ID_CUSTOM_GEMCOUNT_DOWN  (GADGET_ID_COUNTER_FIRST + 57)
399 #define GADGET_ID_CUSTOM_GEMCOUNT_TEXT  (GADGET_ID_COUNTER_FIRST + 58)
400 #define GADGET_ID_CUSTOM_GEMCOUNT_UP    (GADGET_ID_COUNTER_FIRST + 59)
401 #define GADGET_ID_CUSTOM_VALUE_FIX_DOWN (GADGET_ID_COUNTER_FIRST + 60)
402 #define GADGET_ID_CUSTOM_VALUE_FIX_TEXT (GADGET_ID_COUNTER_FIRST + 61)
403 #define GADGET_ID_CUSTOM_VALUE_FIX_UP   (GADGET_ID_COUNTER_FIRST + 62)
404 #define GADGET_ID_CUSTOM_VALUE_RND_DOWN (GADGET_ID_COUNTER_FIRST + 63)
405 #define GADGET_ID_CUSTOM_VALUE_RND_TEXT (GADGET_ID_COUNTER_FIRST + 64)
406 #define GADGET_ID_CUSTOM_VALUE_RND_UP   (GADGET_ID_COUNTER_FIRST + 65)
407 #define GADGET_ID_PUSH_DELAY_FIX_DOWN   (GADGET_ID_COUNTER_FIRST + 66)
408 #define GADGET_ID_PUSH_DELAY_FIX_TEXT   (GADGET_ID_COUNTER_FIRST + 67)
409 #define GADGET_ID_PUSH_DELAY_FIX_UP     (GADGET_ID_COUNTER_FIRST + 68)
410 #define GADGET_ID_PUSH_DELAY_RND_DOWN   (GADGET_ID_COUNTER_FIRST + 69)
411 #define GADGET_ID_PUSH_DELAY_RND_TEXT   (GADGET_ID_COUNTER_FIRST + 70)
412 #define GADGET_ID_PUSH_DELAY_RND_UP     (GADGET_ID_COUNTER_FIRST + 71)
413 #define GADGET_ID_DROP_DELAY_FIX_DOWN   (GADGET_ID_COUNTER_FIRST + 72)
414 #define GADGET_ID_DROP_DELAY_FIX_TEXT   (GADGET_ID_COUNTER_FIRST + 73)
415 #define GADGET_ID_DROP_DELAY_FIX_UP     (GADGET_ID_COUNTER_FIRST + 74)
416 #define GADGET_ID_DROP_DELAY_RND_DOWN   (GADGET_ID_COUNTER_FIRST + 75)
417 #define GADGET_ID_DROP_DELAY_RND_TEXT   (GADGET_ID_COUNTER_FIRST + 76)
418 #define GADGET_ID_DROP_DELAY_RND_UP     (GADGET_ID_COUNTER_FIRST + 77)
419 #define GADGET_ID_MOVE_DELAY_FIX_DOWN   (GADGET_ID_COUNTER_FIRST + 78)
420 #define GADGET_ID_MOVE_DELAY_FIX_TEXT   (GADGET_ID_COUNTER_FIRST + 79)
421 #define GADGET_ID_MOVE_DELAY_FIX_UP     (GADGET_ID_COUNTER_FIRST + 80)
422 #define GADGET_ID_MOVE_DELAY_RND_DOWN   (GADGET_ID_COUNTER_FIRST + 81)
423 #define GADGET_ID_MOVE_DELAY_RND_TEXT   (GADGET_ID_COUNTER_FIRST + 82)
424 #define GADGET_ID_MOVE_DELAY_RND_UP     (GADGET_ID_COUNTER_FIRST + 83)
425 #define GADGET_ID_EXPLOSION_DELAY_DOWN  (GADGET_ID_COUNTER_FIRST + 84)
426 #define GADGET_ID_EXPLOSION_DELAY_TEXT  (GADGET_ID_COUNTER_FIRST + 85)
427 #define GADGET_ID_EXPLOSION_DELAY_UP    (GADGET_ID_COUNTER_FIRST + 86)
428 #define GADGET_ID_IGNITION_DELAY_DOWN   (GADGET_ID_COUNTER_FIRST + 87)
429 #define GADGET_ID_IGNITION_DELAY_TEXT   (GADGET_ID_COUNTER_FIRST + 88)
430 #define GADGET_ID_IGNITION_DELAY_UP     (GADGET_ID_COUNTER_FIRST + 89)
431 #define GADGET_ID_CHANGE_DELAY_FIX_DOWN (GADGET_ID_COUNTER_FIRST + 90)
432 #define GADGET_ID_CHANGE_DELAY_FIX_TEXT (GADGET_ID_COUNTER_FIRST + 91)
433 #define GADGET_ID_CHANGE_DELAY_FIX_UP   (GADGET_ID_COUNTER_FIRST + 92)
434 #define GADGET_ID_CHANGE_DELAY_RND_DOWN (GADGET_ID_COUNTER_FIRST + 93)
435 #define GADGET_ID_CHANGE_DELAY_RND_TEXT (GADGET_ID_COUNTER_FIRST + 94)
436 #define GADGET_ID_CHANGE_DELAY_RND_UP   (GADGET_ID_COUNTER_FIRST + 95)
437 #define GADGET_ID_CHANGE_CONT_RND_DOWN  (GADGET_ID_COUNTER_FIRST + 96)
438 #define GADGET_ID_CHANGE_CONT_RND_TEXT  (GADGET_ID_COUNTER_FIRST + 97)
439 #define GADGET_ID_CHANGE_CONT_RND_UP    (GADGET_ID_COUNTER_FIRST + 98)
440 #define GADGET_ID_GROUP_CONTENT_DOWN    (GADGET_ID_COUNTER_FIRST + 99)
441 #define GADGET_ID_GROUP_CONTENT_TEXT    (GADGET_ID_COUNTER_FIRST + 100)
442 #define GADGET_ID_GROUP_CONTENT_UP      (GADGET_ID_COUNTER_FIRST + 101)
443
444 /* drawing area identifiers */
445 #define GADGET_ID_DRAWING_AREA_FIRST    (GADGET_ID_COUNTER_FIRST + 102)
446
447 #define GADGET_ID_DRAWING_LEVEL         (GADGET_ID_DRAWING_AREA_FIRST + 0)
448 #define GADGET_ID_YAMYAM_CONTENT_0      (GADGET_ID_DRAWING_AREA_FIRST + 1)
449 #define GADGET_ID_YAMYAM_CONTENT_1      (GADGET_ID_DRAWING_AREA_FIRST + 2)
450 #define GADGET_ID_YAMYAM_CONTENT_2      (GADGET_ID_DRAWING_AREA_FIRST + 3)
451 #define GADGET_ID_YAMYAM_CONTENT_3      (GADGET_ID_DRAWING_AREA_FIRST + 4)
452 #define GADGET_ID_YAMYAM_CONTENT_4      (GADGET_ID_DRAWING_AREA_FIRST + 5)
453 #define GADGET_ID_YAMYAM_CONTENT_5      (GADGET_ID_DRAWING_AREA_FIRST + 6)
454 #define GADGET_ID_YAMYAM_CONTENT_6      (GADGET_ID_DRAWING_AREA_FIRST + 7)
455 #define GADGET_ID_YAMYAM_CONTENT_7      (GADGET_ID_DRAWING_AREA_FIRST + 8)
456 #define GADGET_ID_MAGIC_BALL_CONTENT_0  (GADGET_ID_DRAWING_AREA_FIRST + 9)
457 #define GADGET_ID_MAGIC_BALL_CONTENT_1  (GADGET_ID_DRAWING_AREA_FIRST + 10)
458 #define GADGET_ID_MAGIC_BALL_CONTENT_2  (GADGET_ID_DRAWING_AREA_FIRST + 11)
459 #define GADGET_ID_MAGIC_BALL_CONTENT_3  (GADGET_ID_DRAWING_AREA_FIRST + 12)
460 #define GADGET_ID_MAGIC_BALL_CONTENT_4  (GADGET_ID_DRAWING_AREA_FIRST + 13)
461 #define GADGET_ID_MAGIC_BALL_CONTENT_5  (GADGET_ID_DRAWING_AREA_FIRST + 14)
462 #define GADGET_ID_MAGIC_BALL_CONTENT_6  (GADGET_ID_DRAWING_AREA_FIRST + 15)
463 #define GADGET_ID_MAGIC_BALL_CONTENT_7  (GADGET_ID_DRAWING_AREA_FIRST + 16)
464 #define GADGET_ID_ANDROID_CONTENT       (GADGET_ID_DRAWING_AREA_FIRST + 17)
465 #define GADGET_ID_AMOEBA_CONTENT        (GADGET_ID_DRAWING_AREA_FIRST + 18)
466 #define GADGET_ID_START_ELEMENT         (GADGET_ID_DRAWING_AREA_FIRST + 19)
467 #define GADGET_ID_ARTWORK_ELEMENT       (GADGET_ID_DRAWING_AREA_FIRST + 20)
468 #define GADGET_ID_EXPLOSION_ELEMENT     (GADGET_ID_DRAWING_AREA_FIRST + 21)
469 #define GADGET_ID_INVENTORY_CONTENT     (GADGET_ID_DRAWING_AREA_FIRST + 22)
470 #define GADGET_ID_CUSTOM_GRAPHIC        (GADGET_ID_DRAWING_AREA_FIRST + 23)
471 #define GADGET_ID_CUSTOM_CONTENT        (GADGET_ID_DRAWING_AREA_FIRST + 24)
472 #define GADGET_ID_CUSTOM_MOVE_ENTER     (GADGET_ID_DRAWING_AREA_FIRST + 25)
473 #define GADGET_ID_CUSTOM_MOVE_LEAVE     (GADGET_ID_DRAWING_AREA_FIRST + 26)
474 #define GADGET_ID_CUSTOM_CHANGE_TARGET  (GADGET_ID_DRAWING_AREA_FIRST + 27)
475 #define GADGET_ID_CUSTOM_CHANGE_CONTENT (GADGET_ID_DRAWING_AREA_FIRST + 28)
476 #define GADGET_ID_CUSTOM_CHANGE_TRIGGER (GADGET_ID_DRAWING_AREA_FIRST + 29)
477 #define GADGET_ID_CUSTOM_CHANGE_ACTION  (GADGET_ID_DRAWING_AREA_FIRST + 30)
478 #define GADGET_ID_GROUP_CONTENT         (GADGET_ID_DRAWING_AREA_FIRST + 31)
479 #define GADGET_ID_RANDOM_BACKGROUND     (GADGET_ID_DRAWING_AREA_FIRST + 32)
480
481 /* text input identifiers */
482 #define GADGET_ID_TEXT_INPUT_FIRST      (GADGET_ID_DRAWING_AREA_FIRST + 33)
483
484 #define GADGET_ID_LEVEL_NAME            (GADGET_ID_TEXT_INPUT_FIRST + 0)
485 #define GADGET_ID_LEVEL_AUTHOR          (GADGET_ID_TEXT_INPUT_FIRST + 1)
486 #define GADGET_ID_ELEMENT_NAME          (GADGET_ID_TEXT_INPUT_FIRST + 2)
487
488 /* text area identifiers */
489 #define GADGET_ID_TEXT_AREA_FIRST       (GADGET_ID_TEXT_INPUT_FIRST + 3)
490
491 #define GADGET_ID_ENVELOPE_INFO         (GADGET_ID_TEXT_AREA_FIRST + 0)
492
493 /* selectbox identifiers */
494 #define GADGET_ID_SELECTBOX_FIRST       (GADGET_ID_TEXT_AREA_FIRST + 1)
495
496 #define GADGET_ID_TIME_OR_STEPS         (GADGET_ID_SELECTBOX_FIRST + 0)
497 #define GADGET_ID_GAME_ENGINE_TYPE      (GADGET_ID_SELECTBOX_FIRST + 1)
498 #define GADGET_ID_WIND_DIRECTION        (GADGET_ID_SELECTBOX_FIRST + 2)
499 #define GADGET_ID_PLAYER_SPEED          (GADGET_ID_SELECTBOX_FIRST + 3)
500 #define GADGET_ID_CUSTOM_WALK_TO_ACTION (GADGET_ID_SELECTBOX_FIRST + 4)
501 #define GADGET_ID_CUSTOM_EXPLOSION_TYPE (GADGET_ID_SELECTBOX_FIRST + 5)
502 #define GADGET_ID_CUSTOM_DEADLINESS     (GADGET_ID_SELECTBOX_FIRST + 6)
503 #define GADGET_ID_CUSTOM_MOVE_PATTERN   (GADGET_ID_SELECTBOX_FIRST + 7)
504 #define GADGET_ID_CUSTOM_MOVE_DIRECTION (GADGET_ID_SELECTBOX_FIRST + 8)
505 #define GADGET_ID_CUSTOM_MOVE_STEPSIZE  (GADGET_ID_SELECTBOX_FIRST + 9)
506 #define GADGET_ID_CUSTOM_MOVE_LEAVE_TYPE (GADGET_ID_SELECTBOX_FIRST + 10)
507 #define GADGET_ID_CUSTOM_SMASH_TARGETS  (GADGET_ID_SELECTBOX_FIRST + 11)
508 #define GADGET_ID_CUSTOM_SLIPPERY_TYPE  (GADGET_ID_SELECTBOX_FIRST + 12)
509 #define GADGET_ID_CUSTOM_ACCESS_TYPE    (GADGET_ID_SELECTBOX_FIRST + 13)
510 #define GADGET_ID_CUSTOM_ACCESS_LAYER   (GADGET_ID_SELECTBOX_FIRST + 14)
511 #define GADGET_ID_CUSTOM_ACCESS_PROTECTED (GADGET_ID_SELECTBOX_FIRST + 15)
512 #define GADGET_ID_CUSTOM_ACCESS_DIRECTION (GADGET_ID_SELECTBOX_FIRST + 16)
513 #define GADGET_ID_CHANGE_TIME_UNITS     (GADGET_ID_SELECTBOX_FIRST + 17)
514 #define GADGET_ID_CHANGE_DIRECT_ACTION  (GADGET_ID_SELECTBOX_FIRST + 18)
515 #define GADGET_ID_CHANGE_OTHER_ACTION   (GADGET_ID_SELECTBOX_FIRST + 19)
516 #define GADGET_ID_CHANGE_SIDE           (GADGET_ID_SELECTBOX_FIRST + 20)
517 #define GADGET_ID_CHANGE_PLAYER         (GADGET_ID_SELECTBOX_FIRST + 21)
518 #define GADGET_ID_CHANGE_PAGE           (GADGET_ID_SELECTBOX_FIRST + 22)
519 #define GADGET_ID_CHANGE_REPLACE_WHEN   (GADGET_ID_SELECTBOX_FIRST + 23)
520 #define GADGET_ID_ACTION_TYPE           (GADGET_ID_SELECTBOX_FIRST + 24)
521 #define GADGET_ID_ACTION_MODE           (GADGET_ID_SELECTBOX_FIRST + 25)
522 #define GADGET_ID_ACTION_ARG            (GADGET_ID_SELECTBOX_FIRST + 26)
523 #define GADGET_ID_SELECT_CHANGE_PAGE    (GADGET_ID_SELECTBOX_FIRST + 27)
524 #define GADGET_ID_GROUP_CHOICE_MODE     (GADGET_ID_SELECTBOX_FIRST + 28)
525
526 /* textbutton identifiers */
527 #define GADGET_ID_TEXTBUTTON_FIRST      (GADGET_ID_SELECTBOX_FIRST + 29)
528
529 #define GADGET_ID_LEVELINFO_LEVEL       (GADGET_ID_TEXTBUTTON_FIRST + 0)
530 #define GADGET_ID_LEVELINFO_EDITOR      (GADGET_ID_TEXTBUTTON_FIRST + 1)
531 #define GADGET_ID_PROPERTIES_INFO       (GADGET_ID_TEXTBUTTON_FIRST + 2)
532 #define GADGET_ID_PROPERTIES_CONFIG     (GADGET_ID_TEXTBUTTON_FIRST + 3)
533 #define GADGET_ID_PROPERTIES_CONFIG_1   (GADGET_ID_TEXTBUTTON_FIRST + 4)
534 #define GADGET_ID_PROPERTIES_CONFIG_2   (GADGET_ID_TEXTBUTTON_FIRST + 5)
535 #define GADGET_ID_PROPERTIES_CHANGE     (GADGET_ID_TEXTBUTTON_FIRST + 6)
536 #define GADGET_ID_SAVE_AS_TEMPLATE      (GADGET_ID_TEXTBUTTON_FIRST + 7)
537 #define GADGET_ID_ADD_CHANGE_PAGE       (GADGET_ID_TEXTBUTTON_FIRST + 8)
538 #define GADGET_ID_DEL_CHANGE_PAGE       (GADGET_ID_TEXTBUTTON_FIRST + 9)
539
540 /* graphicbutton identifiers */
541 #define GADGET_ID_GRAPHICBUTTON_FIRST   (GADGET_ID_TEXTBUTTON_FIRST + 10)
542
543 #define GADGET_ID_PREV_CHANGE_PAGE      (GADGET_ID_GRAPHICBUTTON_FIRST + 0)
544 #define GADGET_ID_NEXT_CHANGE_PAGE      (GADGET_ID_GRAPHICBUTTON_FIRST + 1)
545 #define GADGET_ID_COPY_CHANGE_PAGE      (GADGET_ID_GRAPHICBUTTON_FIRST + 2)
546 #define GADGET_ID_PASTE_CHANGE_PAGE     (GADGET_ID_GRAPHICBUTTON_FIRST + 3)
547
548 /* gadgets for scrolling of drawing area */
549 #define GADGET_ID_SCROLLING_FIRST       (GADGET_ID_GRAPHICBUTTON_FIRST + 4)
550
551 #define GADGET_ID_SCROLL_UP             (GADGET_ID_SCROLLING_FIRST + 0)
552 #define GADGET_ID_SCROLL_DOWN           (GADGET_ID_SCROLLING_FIRST + 1)
553 #define GADGET_ID_SCROLL_LEFT           (GADGET_ID_SCROLLING_FIRST + 2)
554 #define GADGET_ID_SCROLL_RIGHT          (GADGET_ID_SCROLLING_FIRST + 3)
555 #define GADGET_ID_SCROLL_HORIZONTAL     (GADGET_ID_SCROLLING_FIRST + 4)
556 #define GADGET_ID_SCROLL_VERTICAL       (GADGET_ID_SCROLLING_FIRST + 5)
557
558 /* gadgets for scrolling element list */
559 #define GADGET_ID_SCROLLING_LIST_FIRST  (GADGET_ID_SCROLLING_FIRST + 6)
560
561 #define GADGET_ID_SCROLL_LIST_UP        (GADGET_ID_SCROLLING_LIST_FIRST + 0)
562 #define GADGET_ID_SCROLL_LIST_DOWN      (GADGET_ID_SCROLLING_LIST_FIRST + 1)
563 #define GADGET_ID_SCROLL_LIST_VERTICAL  (GADGET_ID_SCROLLING_LIST_FIRST + 2)
564
565 /* checkbuttons/radiobuttons for level/element properties */
566 #define GADGET_ID_CHECKBUTTON_FIRST     (GADGET_ID_SCROLLING_LIST_FIRST + 3)
567
568 #define GADGET_ID_RANDOM_PERCENTAGE     (GADGET_ID_CHECKBUTTON_FIRST + 0)
569 #define GADGET_ID_RANDOM_QUANTITY       (GADGET_ID_CHECKBUTTON_FIRST + 1)
570 #define GADGET_ID_RANDOM_RESTRICTED     (GADGET_ID_CHECKBUTTON_FIRST + 2)
571 #define GADGET_ID_STICK_ELEMENT         (GADGET_ID_CHECKBUTTON_FIRST + 3)
572 #define GADGET_ID_EM_SLIPPERY_GEMS      (GADGET_ID_CHECKBUTTON_FIRST + 4)
573 #define GADGET_ID_EM_EXPLODES_BY_FIRE   (GADGET_ID_CHECKBUTTON_FIRST + 5)
574 #define GADGET_ID_USE_SPRING_BUG        (GADGET_ID_CHECKBUTTON_FIRST + 6)
575 #define GADGET_ID_USE_TIME_ORB_BUG      (GADGET_ID_CHECKBUTTON_FIRST + 7)
576 #define GADGET_ID_RANDOM_BALL_CONTENT   (GADGET_ID_CHECKBUTTON_FIRST + 8)
577 #define GADGET_ID_INITIAL_BALL_STATE    (GADGET_ID_CHECKBUTTON_FIRST + 9)
578 #define GADGET_ID_GROW_INTO_DIGGABLE    (GADGET_ID_CHECKBUTTON_FIRST + 10)
579 #define GADGET_ID_AUTO_EXIT_SOKOBAN     (GADGET_ID_CHECKBUTTON_FIRST + 11)
580 #define GADGET_ID_CONTINUOUS_SNAPPING   (GADGET_ID_CHECKBUTTON_FIRST + 12)
581 #define GADGET_ID_BLOCK_SNAP_FIELD      (GADGET_ID_CHECKBUTTON_FIRST + 13)
582 #define GADGET_ID_BLOCK_LAST_FIELD      (GADGET_ID_CHECKBUTTON_FIRST + 14)
583 #define GADGET_ID_SP_BLOCK_LAST_FIELD   (GADGET_ID_CHECKBUTTON_FIRST + 15)
584 #define GADGET_ID_INSTANT_RELOCATION    (GADGET_ID_CHECKBUTTON_FIRST + 16)
585 #define GADGET_ID_SHIFTED_RELOCATION    (GADGET_ID_CHECKBUTTON_FIRST + 17)
586 #define GADGET_ID_USE_START_ELEMENT     (GADGET_ID_CHECKBUTTON_FIRST + 18)
587 #define GADGET_ID_USE_ARTWORK_ELEMENT   (GADGET_ID_CHECKBUTTON_FIRST + 19)
588 #define GADGET_ID_USE_EXPLOSION_ELEMENT (GADGET_ID_CHECKBUTTON_FIRST + 20)
589 #define GADGET_ID_INITIAL_GRAVITY       (GADGET_ID_CHECKBUTTON_FIRST + 21)
590 #define GADGET_ID_USE_INITIAL_INVENTORY (GADGET_ID_CHECKBUTTON_FIRST + 22)
591 #define GADGET_ID_CAN_PASS_TO_WALKABLE  (GADGET_ID_CHECKBUTTON_FIRST + 23)
592 #define GADGET_ID_CAN_FALL_INTO_ACID    (GADGET_ID_CHECKBUTTON_FIRST + 24)
593 #define GADGET_ID_CAN_MOVE_INTO_ACID    (GADGET_ID_CHECKBUTTON_FIRST + 25)
594 #define GADGET_ID_DONT_COLLIDE_WITH     (GADGET_ID_CHECKBUTTON_FIRST + 26)
595 #define GADGET_ID_ENVELOPE_AUTOWRAP     (GADGET_ID_CHECKBUTTON_FIRST + 27)
596 #define GADGET_ID_ENVELOPE_CENTERED     (GADGET_ID_CHECKBUTTON_FIRST + 28)
597 #define GADGET_ID_CUSTOM_INDESTRUCTIBLE (GADGET_ID_CHECKBUTTON_FIRST + 29)
598 #define GADGET_ID_CUSTOM_CAN_EXPLODE    (GADGET_ID_CHECKBUTTON_FIRST + 30)
599 #define GADGET_ID_CUSTOM_EXPLODE_FIRE   (GADGET_ID_CHECKBUTTON_FIRST + 31)
600 #define GADGET_ID_CUSTOM_EXPLODE_SMASH  (GADGET_ID_CHECKBUTTON_FIRST + 32)
601 #define GADGET_ID_CUSTOM_EXPLODE_IMPACT (GADGET_ID_CHECKBUTTON_FIRST + 33)
602 #define GADGET_ID_CUSTOM_WALK_TO_OBJECT (GADGET_ID_CHECKBUTTON_FIRST + 34)
603 #define GADGET_ID_CUSTOM_DEADLY         (GADGET_ID_CHECKBUTTON_FIRST + 35)
604 #define GADGET_ID_CUSTOM_CAN_MOVE       (GADGET_ID_CHECKBUTTON_FIRST + 36)
605 #define GADGET_ID_CUSTOM_CAN_FALL       (GADGET_ID_CHECKBUTTON_FIRST + 37)
606 #define GADGET_ID_CUSTOM_CAN_SMASH      (GADGET_ID_CHECKBUTTON_FIRST + 38)
607 #define GADGET_ID_CUSTOM_SLIPPERY       (GADGET_ID_CHECKBUTTON_FIRST + 39)
608 #define GADGET_ID_CUSTOM_ACCESSIBLE     (GADGET_ID_CHECKBUTTON_FIRST + 40)
609 #define GADGET_ID_CUSTOM_GRAV_REACHABLE (GADGET_ID_CHECKBUTTON_FIRST + 41)
610 #define GADGET_ID_CUSTOM_USE_LAST_VALUE (GADGET_ID_CHECKBUTTON_FIRST + 42)
611 #define GADGET_ID_CUSTOM_USE_GRAPHIC    (GADGET_ID_CHECKBUTTON_FIRST + 43)
612 #define GADGET_ID_CUSTOM_USE_TEMPLATE   (GADGET_ID_CHECKBUTTON_FIRST + 44)
613 #define GADGET_ID_CUSTOM_CAN_CHANGE     (GADGET_ID_CHECKBUTTON_FIRST + 45)
614 #define GADGET_ID_CHANGE_USE_CONTENT    (GADGET_ID_CHECKBUTTON_FIRST + 46)
615 #define GADGET_ID_CHANGE_USE_EXPLOSION  (GADGET_ID_CHECKBUTTON_FIRST + 47)
616 #define GADGET_ID_CHANGE_ONLY_COMPLETE  (GADGET_ID_CHECKBUTTON_FIRST + 48)
617 #define GADGET_ID_CHANGE_USE_RANDOM     (GADGET_ID_CHECKBUTTON_FIRST + 49)
618 #define GADGET_ID_CHANGE_HAS_ACTION     (GADGET_ID_CHECKBUTTON_FIRST + 50)
619 #define GADGET_ID_CHANGE_DELAY          (GADGET_ID_CHECKBUTTON_FIRST + 51)
620 #define GADGET_ID_CHANGE_BY_DIRECT_ACT  (GADGET_ID_CHECKBUTTON_FIRST + 52)
621 #define GADGET_ID_CHANGE_BY_OTHER_ACT   (GADGET_ID_CHECKBUTTON_FIRST + 53)
622
623 /* gadgets for buttons in element list */
624 #define GADGET_ID_ELEMENTLIST_FIRST     (GADGET_ID_CHECKBUTTON_FIRST + 54)
625 #define GADGET_ID_ELEMENTLIST_LAST      (GADGET_ID_ELEMENTLIST_FIRST +  \
626                                         ED_NUM_ELEMENTLIST_BUTTONS - 1)
627
628 #define NUM_EDITOR_GADGETS              (GADGET_ID_ELEMENTLIST_LAST + 1)
629
630 /* radio button numbers */
631 #define RADIO_NR_NONE                   0
632 #define RADIO_NR_DRAWING_TOOLBOX        1
633 #define RADIO_NR_RANDOM_ELEMENTS        2
634
635 /* values for counter gadgets */
636 #define ED_COUNTER_ID_SELECT_LEVEL      0
637 #define ED_COUNTER_ID_LEVEL_XSIZE       1
638 #define ED_COUNTER_ID_LEVEL_YSIZE       2
639 #define ED_COUNTER_ID_LEVEL_GEMSLIMIT   3
640 #define ED_COUNTER_ID_LEVEL_TIMELIMIT   4
641 #define ED_COUNTER_ID_LEVEL_TIMESCORE   5
642 #define ED_COUNTER_ID_LEVEL_RANDOM_SEED 6
643 #define ED_COUNTER_ID_LEVEL_RANDOM      7
644 #define ED_COUNTER_ID_ELEMENT_VALUE1    8
645 #define ED_COUNTER_ID_ELEMENT_VALUE2    9
646 #define ED_COUNTER_ID_ELEMENT_VALUE3    10
647 #define ED_COUNTER_ID_ELEMENT_VALUE4    11
648 #define ED_COUNTER_ID_YAMYAM_CONTENT    12
649 #define ED_COUNTER_ID_BALL_CONTENT      13
650 #define ED_COUNTER_ID_ANDROID_CONTENT   14
651 #define ED_COUNTER_ID_ENVELOPE_XSIZE    15
652 #define ED_COUNTER_ID_ENVELOPE_YSIZE    16
653 #define ED_COUNTER_ID_INVENTORY_SIZE    17
654 #define ED_COUNTER_ID_CUSTOM_SCORE      18
655 #define ED_COUNTER_ID_CUSTOM_GEMCOUNT   19
656 #define ED_COUNTER_ID_CUSTOM_VALUE_FIX  20
657 #define ED_COUNTER_ID_CUSTOM_VALUE_RND  21
658 #define ED_COUNTER_ID_PUSH_DELAY_FIX    22
659 #define ED_COUNTER_ID_PUSH_DELAY_RND    23
660 #define ED_COUNTER_ID_DROP_DELAY_FIX    24
661 #define ED_COUNTER_ID_DROP_DELAY_RND    25
662 #define ED_COUNTER_ID_MOVE_DELAY_FIX    26
663 #define ED_COUNTER_ID_MOVE_DELAY_RND    27
664 #define ED_COUNTER_ID_EXPLOSION_DELAY   28
665 #define ED_COUNTER_ID_IGNITION_DELAY    29
666 #define ED_COUNTER_ID_GROUP_CONTENT     30
667 #define ED_COUNTER_ID_CHANGE_DELAY_FIX  31
668 #define ED_COUNTER_ID_CHANGE_DELAY_RND  32
669 #define ED_COUNTER_ID_CHANGE_CONT_RND   33
670
671 #define ED_NUM_COUNTERBUTTONS           34
672
673 #define ED_COUNTER_ID_LEVEL_FIRST       ED_COUNTER_ID_LEVEL_XSIZE
674 #define ED_COUNTER_ID_LEVEL_LAST        ED_COUNTER_ID_LEVEL_RANDOM_SEED
675 #define ED_COUNTER_ID_EDITOR_FIRST      ED_COUNTER_ID_LEVEL_RANDOM
676 #define ED_COUNTER_ID_EDITOR_LAST       ED_COUNTER_ID_LEVEL_RANDOM
677
678 #define ED_COUNTER_ID_CUSTOM1_FIRST     ED_COUNTER_ID_CUSTOM_SCORE
679 #define ED_COUNTER_ID_CUSTOM1_LAST      ED_COUNTER_ID_DROP_DELAY_RND
680 #define ED_COUNTER_ID_CUSTOM2_FIRST     ED_COUNTER_ID_MOVE_DELAY_FIX
681 #define ED_COUNTER_ID_CUSTOM2_LAST      ED_COUNTER_ID_IGNITION_DELAY
682 #define ED_COUNTER_ID_CUSTOM_FIRST      ED_COUNTER_ID_CUSTOM1_FIRST
683 #define ED_COUNTER_ID_CUSTOM_LAST       ED_COUNTER_ID_CUSTOM2_LAST
684
685 #define ED_COUNTER_ID_CHANGE_FIRST      ED_COUNTER_ID_CHANGE_DELAY_FIX
686 #define ED_COUNTER_ID_CHANGE_LAST       ED_COUNTER_ID_CHANGE_CONT_RND
687
688 /* values for scrollbutton gadgets */
689 #define ED_SCROLLBUTTON_ID_AREA_UP      0
690 #define ED_SCROLLBUTTON_ID_AREA_DOWN    1
691 #define ED_SCROLLBUTTON_ID_AREA_LEFT    2
692 #define ED_SCROLLBUTTON_ID_AREA_RIGHT   3
693 #define ED_SCROLLBUTTON_ID_LIST_UP      4
694 #define ED_SCROLLBUTTON_ID_LIST_DOWN    5
695
696 #define ED_NUM_SCROLLBUTTONS            6
697
698 #define ED_SCROLLBUTTON_ID_AREA_FIRST   ED_SCROLLBUTTON_ID_AREA_UP
699 #define ED_SCROLLBUTTON_ID_AREA_LAST    ED_SCROLLBUTTON_ID_AREA_RIGHT
700
701 /* values for scrollbar gadgets */
702 #define ED_SCROLLBAR_ID_AREA_HORIZONTAL 0
703 #define ED_SCROLLBAR_ID_AREA_VERTICAL   1
704 #define ED_SCROLLBAR_ID_LIST_VERTICAL   2
705
706 #define ED_NUM_SCROLLBARS               3
707
708 #define ED_SCROLLBAR_ID_AREA_FIRST      ED_SCROLLBAR_ID_AREA_HORIZONTAL
709 #define ED_SCROLLBAR_ID_AREA_LAST       ED_SCROLLBAR_ID_AREA_VERTICAL
710
711 /* values for text input gadgets */
712 #define ED_TEXTINPUT_ID_LEVEL_NAME      0
713 #define ED_TEXTINPUT_ID_LEVEL_AUTHOR    1
714 #define ED_TEXTINPUT_ID_ELEMENT_NAME    2
715
716 #define ED_NUM_TEXTINPUT                3
717
718 #define ED_TEXTINPUT_ID_LEVEL_FIRST     ED_TEXTINPUT_ID_LEVEL_NAME
719 #define ED_TEXTINPUT_ID_LEVEL_LAST      ED_TEXTINPUT_ID_LEVEL_AUTHOR
720
721 /* values for text area gadgets */
722 #define ED_TEXTAREA_ID_ENVELOPE_INFO    0
723
724 #define ED_NUM_TEXTAREAS                        1
725
726 #define ED_TEXTAREA_ID_LEVEL_FIRST      ED_TEXTAREA_ID_ENVELOPE
727 #define ED_TEXTAREA_ID_LEVEL_LAST       ED_TEXTAREA_ID_ENVELOPE
728
729 /* values for selectbox gadgets */
730 #define ED_SELECTBOX_ID_TIME_OR_STEPS           0
731 #define ED_SELECTBOX_ID_GAME_ENGINE_TYPE        1
732 #define ED_SELECTBOX_ID_WIND_DIRECTION          2
733 #define ED_SELECTBOX_ID_PLAYER_SPEED            3
734 #define ED_SELECTBOX_ID_CUSTOM_ACCESS_TYPE      4
735 #define ED_SELECTBOX_ID_CUSTOM_ACCESS_LAYER     5
736 #define ED_SELECTBOX_ID_CUSTOM_ACCESS_PROTECTED 6
737 #define ED_SELECTBOX_ID_CUSTOM_ACCESS_DIRECTION 7
738 #define ED_SELECTBOX_ID_CUSTOM_WALK_TO_ACTION   8
739 #define ED_SELECTBOX_ID_CUSTOM_MOVE_PATTERN     9
740 #define ED_SELECTBOX_ID_CUSTOM_MOVE_DIRECTION   10      
741 #define ED_SELECTBOX_ID_CUSTOM_MOVE_STEPSIZE    11
742 #define ED_SELECTBOX_ID_CUSTOM_MOVE_LEAVE_TYPE  12
743 #define ED_SELECTBOX_ID_CUSTOM_SMASH_TARGETS    13
744 #define ED_SELECTBOX_ID_CUSTOM_SLIPPERY_TYPE    14
745 #define ED_SELECTBOX_ID_CUSTOM_DEADLINESS       15
746 #define ED_SELECTBOX_ID_CUSTOM_EXPLOSION_TYPE   16
747 #define ED_SELECTBOX_ID_CHANGE_TIME_UNITS       17
748 #define ED_SELECTBOX_ID_CHANGE_DIRECT_ACTION    18
749 #define ED_SELECTBOX_ID_CHANGE_OTHER_ACTION     19
750 #define ED_SELECTBOX_ID_CHANGE_SIDE             20
751 #define ED_SELECTBOX_ID_CHANGE_PLAYER           21
752 #define ED_SELECTBOX_ID_CHANGE_PAGE             22
753 #define ED_SELECTBOX_ID_CHANGE_REPLACE_WHEN     23
754 #define ED_SELECTBOX_ID_ACTION_TYPE             24
755 #define ED_SELECTBOX_ID_ACTION_MODE             25
756 #define ED_SELECTBOX_ID_ACTION_ARG              26
757 #define ED_SELECTBOX_ID_SELECT_CHANGE_PAGE      27
758 #define ED_SELECTBOX_ID_GROUP_CHOICE_MODE       28
759
760 #define ED_NUM_SELECTBOX                        29
761
762 #define ED_SELECTBOX_ID_LEVEL_FIRST     ED_SELECTBOX_ID_TIME_OR_STEPS
763 #define ED_SELECTBOX_ID_LEVEL_LAST      ED_SELECTBOX_ID_WIND_DIRECTION
764
765 #define ED_SELECTBOX_ID_CUSTOM1_FIRST   ED_SELECTBOX_ID_CUSTOM_ACCESS_TYPE
766 #define ED_SELECTBOX_ID_CUSTOM1_LAST    ED_SELECTBOX_ID_CUSTOM_WALK_TO_ACTION
767 #define ED_SELECTBOX_ID_CUSTOM2_FIRST   ED_SELECTBOX_ID_CUSTOM_MOVE_PATTERN
768 #define ED_SELECTBOX_ID_CUSTOM2_LAST    ED_SELECTBOX_ID_CUSTOM_EXPLOSION_TYPE
769 #define ED_SELECTBOX_ID_CUSTOM_FIRST    ED_SELECTBOX_ID_CUSTOM1_FIRST
770 #define ED_SELECTBOX_ID_CUSTOM_LAST     ED_SELECTBOX_ID_CUSTOM2_LAST
771
772 #define ED_SELECTBOX_ID_CHANGE_FIRST    ED_SELECTBOX_ID_CHANGE_TIME_UNITS
773 #define ED_SELECTBOX_ID_CHANGE_LAST     ED_SELECTBOX_ID_SELECT_CHANGE_PAGE
774
775 /* values for textbutton gadgets */
776 #define ED_TEXTBUTTON_ID_LEVELINFO_LEVEL        0
777 #define ED_TEXTBUTTON_ID_LEVELINFO_EDITOR       1
778 #define ED_TEXTBUTTON_ID_PROPERTIES_INFO        2
779 #define ED_TEXTBUTTON_ID_PROPERTIES_CONFIG      3
780 #define ED_TEXTBUTTON_ID_PROPERTIES_CONFIG_1    4
781 #define ED_TEXTBUTTON_ID_PROPERTIES_CONFIG_2    5
782 #define ED_TEXTBUTTON_ID_PROPERTIES_CHANGE      6
783 #define ED_TEXTBUTTON_ID_SAVE_AS_TEMPLATE       7
784 #define ED_TEXTBUTTON_ID_ADD_CHANGE_PAGE        8
785 #define ED_TEXTBUTTON_ID_DEL_CHANGE_PAGE        9
786
787 #define ED_NUM_TEXTBUTTONS                      10
788
789 #define ED_TEXTBUTTON_ID_LEVELINFO_FIRST ED_TEXTBUTTON_ID_LEVELINFO_LEVEL
790 #define ED_TEXTBUTTON_ID_LEVELINFO_LAST  ED_TEXTBUTTON_ID_LEVELINFO_EDITOR
791
792 #define ED_TEXTBUTTON_ID_PROPERTIES_FIRST ED_TEXTBUTTON_ID_PROPERTIES_INFO
793 #define ED_TEXTBUTTON_ID_PROPERTIES_LAST  ED_TEXTBUTTON_ID_PROPERTIES_CHANGE
794
795 #define ED_TEXTBUTTON_ID_CHANGE_FIRST   ED_TEXTBUTTON_ID_ADD_CHANGE_PAGE
796 #define ED_TEXTBUTTON_ID_CHANGE_LAST    ED_TEXTBUTTON_ID_DEL_CHANGE_PAGE
797
798 /* values for graphicbutton gadgets */
799 #define ED_GRAPHICBUTTON_ID_PREV_CHANGE_PAGE    0
800 #define ED_GRAPHICBUTTON_ID_NEXT_CHANGE_PAGE    1
801 #define ED_GRAPHICBUTTON_ID_COPY_CHANGE_PAGE    2
802 #define ED_GRAPHICBUTTON_ID_PASTE_CHANGE_PAGE   3
803
804 #define ED_NUM_GRAPHICBUTTONS                   4
805
806 #define ED_GRAPHICBUTTON_ID_CHANGE_FIRST  ED_GRAPHICBUTTON_ID_PREV_CHANGE_PAGE
807 #define ED_GRAPHICBUTTON_ID_CHANGE_LAST   ED_GRAPHICBUTTON_ID_PASTE_CHANGE_PAGE
808
809 /* values for checkbutton gadgets */
810 #define ED_CHECKBUTTON_ID_RANDOM_RESTRICTED     0
811 #define ED_CHECKBUTTON_ID_STICK_ELEMENT         1
812 #define ED_CHECKBUTTON_ID_EM_SLIPPERY_GEMS      2
813 #define ED_CHECKBUTTON_ID_EM_EXPLODES_BY_FIRE   3
814 #define ED_CHECKBUTTON_ID_USE_SPRING_BUG        4
815 #define ED_CHECKBUTTON_ID_USE_TIME_ORB_BUG      5
816 #define ED_CHECKBUTTON_ID_RANDOM_BALL_CONTENT   6
817 #define ED_CHECKBUTTON_ID_INITIAL_BALL_STATE    7
818 #define ED_CHECKBUTTON_ID_GROW_INTO_DIGGABLE    8
819 #define ED_CHECKBUTTON_ID_AUTO_EXIT_SOKOBAN     9
820 #define ED_CHECKBUTTON_ID_CONTINUOUS_SNAPPING   10
821 #define ED_CHECKBUTTON_ID_BLOCK_SNAP_FIELD      11
822 #define ED_CHECKBUTTON_ID_BLOCK_LAST_FIELD      12
823 #define ED_CHECKBUTTON_ID_SP_BLOCK_LAST_FIELD   13
824 #define ED_CHECKBUTTON_ID_INSTANT_RELOCATION    14
825 #define ED_CHECKBUTTON_ID_SHIFTED_RELOCATION    15
826 #define ED_CHECKBUTTON_ID_USE_START_ELEMENT     16
827 #define ED_CHECKBUTTON_ID_USE_ARTWORK_ELEMENT   17
828 #define ED_CHECKBUTTON_ID_USE_EXPLOSION_ELEMENT 18
829 #define ED_CHECKBUTTON_ID_INITIAL_GRAVITY       19
830 #define ED_CHECKBUTTON_ID_USE_INITIAL_INVENTORY 20
831 #define ED_CHECKBUTTON_ID_CAN_PASS_TO_WALKABLE  21
832 #define ED_CHECKBUTTON_ID_CAN_FALL_INTO_ACID    22
833 #define ED_CHECKBUTTON_ID_CAN_MOVE_INTO_ACID    23
834 #define ED_CHECKBUTTON_ID_DONT_COLLIDE_WITH     24
835 #define ED_CHECKBUTTON_ID_ENVELOPE_AUTOWRAP     25
836 #define ED_CHECKBUTTON_ID_ENVELOPE_CENTERED     26
837 #define ED_CHECKBUTTON_ID_CUSTOM_USE_GRAPHIC    27
838 #define ED_CHECKBUTTON_ID_CUSTOM_USE_TEMPLATE   28
839 #define ED_CHECKBUTTON_ID_CUSTOM_ACCESSIBLE     29
840 #define ED_CHECKBUTTON_ID_CUSTOM_GRAV_REACHABLE 30
841 #define ED_CHECKBUTTON_ID_CUSTOM_USE_LAST_VALUE 31
842 #define ED_CHECKBUTTON_ID_CUSTOM_WALK_TO_OBJECT 32
843 #define ED_CHECKBUTTON_ID_CUSTOM_INDESTRUCTIBLE 33
844 #define ED_CHECKBUTTON_ID_CUSTOM_CAN_MOVE       34
845 #define ED_CHECKBUTTON_ID_CUSTOM_CAN_FALL       35
846 #define ED_CHECKBUTTON_ID_CUSTOM_CAN_SMASH      36
847 #define ED_CHECKBUTTON_ID_CUSTOM_SLIPPERY       37
848 #define ED_CHECKBUTTON_ID_CUSTOM_DEADLY         38
849 #define ED_CHECKBUTTON_ID_CUSTOM_CAN_EXPLODE    39
850 #define ED_CHECKBUTTON_ID_CUSTOM_EXPLODE_FIRE   40
851 #define ED_CHECKBUTTON_ID_CUSTOM_EXPLODE_SMASH  41
852 #define ED_CHECKBUTTON_ID_CUSTOM_EXPLODE_IMPACT 42
853 #define ED_CHECKBUTTON_ID_CUSTOM_CAN_CHANGE     43
854 #define ED_CHECKBUTTON_ID_CHANGE_DELAY          44
855 #define ED_CHECKBUTTON_ID_CHANGE_BY_DIRECT_ACT  45
856 #define ED_CHECKBUTTON_ID_CHANGE_BY_OTHER_ACT   46
857 #define ED_CHECKBUTTON_ID_CHANGE_USE_EXPLOSION  47
858 #define ED_CHECKBUTTON_ID_CHANGE_USE_CONTENT    48
859 #define ED_CHECKBUTTON_ID_CHANGE_ONLY_COMPLETE  49
860 #define ED_CHECKBUTTON_ID_CHANGE_USE_RANDOM     50
861 #define ED_CHECKBUTTON_ID_CHANGE_HAS_ACTION     51
862
863 #define ED_NUM_CHECKBUTTONS                     52
864
865 #define ED_CHECKBUTTON_ID_EDITOR_FIRST  ED_CHECKBUTTON_ID_RANDOM_RESTRICTED
866 #define ED_CHECKBUTTON_ID_EDITOR_LAST   ED_CHECKBUTTON_ID_RANDOM_RESTRICTED
867
868 #define ED_CHECKBUTTON_ID_CUSTOM1_FIRST ED_CHECKBUTTON_ID_CUSTOM_USE_GRAPHIC
869 #define ED_CHECKBUTTON_ID_CUSTOM1_LAST  ED_CHECKBUTTON_ID_CUSTOM_INDESTRUCTIBLE
870 #define ED_CHECKBUTTON_ID_CUSTOM2_FIRST ED_CHECKBUTTON_ID_CUSTOM_CAN_MOVE
871 #define ED_CHECKBUTTON_ID_CUSTOM2_LAST  ED_CHECKBUTTON_ID_CUSTOM_EXPLODE_IMPACT
872 #define ED_CHECKBUTTON_ID_CUSTOM_FIRST  ED_CHECKBUTTON_ID_CUSTOM1_FIRST
873 #define ED_CHECKBUTTON_ID_CUSTOM_LAST   ED_CHECKBUTTON_ID_CUSTOM2_LAST
874
875 #define ED_CHECKBUTTON_ID_CHANGE_FIRST  ED_CHECKBUTTON_ID_CUSTOM_CAN_CHANGE
876 #define ED_CHECKBUTTON_ID_CHANGE_LAST   ED_CHECKBUTTON_ID_CHANGE_HAS_ACTION
877
878 /* values for radiobutton gadgets */
879 #define ED_RADIOBUTTON_ID_PERCENTAGE    0
880 #define ED_RADIOBUTTON_ID_QUANTITY      1
881
882 #define ED_NUM_RADIOBUTTONS             2
883
884 #define ED_RADIOBUTTON_ID_EDITOR_FIRST  ED_RADIOBUTTON_ID_PERCENTAGE
885 #define ED_RADIOBUTTON_ID_EDITOR_LAST   ED_RADIOBUTTON_ID_QUANTITY
886
887 /* values for drawing area gadgets */
888 #define ED_DRAWING_ID_DRAWING_LEVEL             0
889 #define ED_DRAWING_ID_YAMYAM_CONTENT_0          1
890 #define ED_DRAWING_ID_YAMYAM_CONTENT_1          2
891 #define ED_DRAWING_ID_YAMYAM_CONTENT_2          3
892 #define ED_DRAWING_ID_YAMYAM_CONTENT_3          4
893 #define ED_DRAWING_ID_YAMYAM_CONTENT_4          5
894 #define ED_DRAWING_ID_YAMYAM_CONTENT_5          6
895 #define ED_DRAWING_ID_YAMYAM_CONTENT_6          7
896 #define ED_DRAWING_ID_YAMYAM_CONTENT_7          8
897 #define ED_DRAWING_ID_MAGIC_BALL_CONTENT_0      9
898 #define ED_DRAWING_ID_MAGIC_BALL_CONTENT_1      10
899 #define ED_DRAWING_ID_MAGIC_BALL_CONTENT_2      11
900 #define ED_DRAWING_ID_MAGIC_BALL_CONTENT_3      12
901 #define ED_DRAWING_ID_MAGIC_BALL_CONTENT_4      13
902 #define ED_DRAWING_ID_MAGIC_BALL_CONTENT_5      14
903 #define ED_DRAWING_ID_MAGIC_BALL_CONTENT_6      15
904 #define ED_DRAWING_ID_MAGIC_BALL_CONTENT_7      16
905 #define ED_DRAWING_ID_ANDROID_CONTENT           17
906 #define ED_DRAWING_ID_AMOEBA_CONTENT            18
907 #define ED_DRAWING_ID_START_ELEMENT             19
908 #define ED_DRAWING_ID_ARTWORK_ELEMENT           20
909 #define ED_DRAWING_ID_EXPLOSION_ELEMENT         21
910 #define ED_DRAWING_ID_INVENTORY_CONTENT         22
911 #define ED_DRAWING_ID_CUSTOM_GRAPHIC            23
912 #define ED_DRAWING_ID_CUSTOM_CONTENT            24
913 #define ED_DRAWING_ID_CUSTOM_MOVE_ENTER         25
914 #define ED_DRAWING_ID_CUSTOM_MOVE_LEAVE         26
915 #define ED_DRAWING_ID_CUSTOM_CHANGE_TARGET      27
916 #define ED_DRAWING_ID_CUSTOM_CHANGE_CONTENT     28
917 #define ED_DRAWING_ID_CUSTOM_CHANGE_TRIGGER     29
918 #define ED_DRAWING_ID_CUSTOM_CHANGE_ACTION      30
919 #define ED_DRAWING_ID_GROUP_CONTENT             31
920 #define ED_DRAWING_ID_RANDOM_BACKGROUND         32
921
922 #define ED_NUM_DRAWING_AREAS                    33
923
924
925 /*
926   -----------------------------------------------------------------------------
927   some internally used definitions
928   -----------------------------------------------------------------------------
929 */
930
931 /* values for CopyLevelToUndoBuffer() */
932 #define UNDO_IMMEDIATE                  0
933 #define UNDO_ACCUMULATE                 1
934
935 /* values for scrollbars */
936 #define ED_SCROLL_NO                    0
937 #define ED_SCROLL_LEFT                  1
938 #define ED_SCROLL_RIGHT                 2
939 #define ED_SCROLL_UP                    4
940 #define ED_SCROLL_DOWN                  8
941
942 /* screens in the level editor */
943 #define ED_MODE_DRAWING                 0
944 #define ED_MODE_INFO                    1
945 #define ED_MODE_PROPERTIES              2
946
947 /* sub-screens in the global settings section */
948 #define ED_MODE_LEVELINFO_LEVEL         ED_TEXTBUTTON_ID_LEVELINFO_LEVEL
949 #define ED_MODE_LEVELINFO_EDITOR        ED_TEXTBUTTON_ID_LEVELINFO_EDITOR
950
951 /* sub-screens in the element properties section */
952 #define ED_MODE_PROPERTIES_INFO         ED_TEXTBUTTON_ID_PROPERTIES_INFO
953 #define ED_MODE_PROPERTIES_CONFIG       ED_TEXTBUTTON_ID_PROPERTIES_CONFIG
954 #define ED_MODE_PROPERTIES_CONFIG_1     ED_TEXTBUTTON_ID_PROPERTIES_CONFIG_1
955 #define ED_MODE_PROPERTIES_CONFIG_2     ED_TEXTBUTTON_ID_PROPERTIES_CONFIG_2
956 #define ED_MODE_PROPERTIES_CHANGE       ED_TEXTBUTTON_ID_PROPERTIES_CHANGE
957
958 /* how many steps can be cancelled */
959 #define NUM_UNDO_STEPS                  (10 + 1)
960
961 /* values for elements with score for certain actions */
962 #define MIN_SCORE                       0
963 #define MAX_SCORE                       999
964
965 /* values for elements with count for collecting */
966 #define MIN_COLLECT_COUNT               0
967 #define MAX_COLLECT_COUNT               999
968
969 /* values for random placement */
970 #define RANDOM_USE_PERCENTAGE           0
971 #define RANDOM_USE_QUANTITY             1
972
973 /* maximal size of level editor drawing area */
974 #define MAX_ED_FIELDX                   (SCR_FIELDX)
975 #define MAX_ED_FIELDY                   (SCR_FIELDY - 1)
976
977
978 /*
979   -----------------------------------------------------------------------------
980   some internally used data structure definitions
981   -----------------------------------------------------------------------------
982 */
983
984 static struct
985 {
986   char shortcut;
987   char *text;
988 } control_info[ED_NUM_CTRL_BUTTONS] =
989 {
990   /* note: some additional characters are already reserved for "cheat mode"
991      shortcuts (":XYZ" style) -- for details, see "events.c" */
992
993   { 's',        "draw single items"                     },
994   { 'd',        "draw connected items"                  },
995   { 'l',        "draw lines"                            },
996   { 'a',        "draw arcs"                             },
997   { 'r',        "draw outline rectangles"               },
998   { 'R',        "draw filled rectangles"                },
999   { '\0',       "wrap (rotate) level up"                },
1000   { 't',        "enter text elements"                   },
1001   { 'f',        "flood fill"                            },
1002   { '\0',       "wrap (rotate) level left"              },
1003   { '?',        "properties of drawing element"         },
1004   { '\0',       "wrap (rotate) level right"             },
1005   { '\0',       "random element placement"              },
1006   { 'b',        "grab brush"                            },
1007   { '\0',       "wrap (rotate) level down"              },
1008   { ',',        "pick drawing element"                  },
1009
1010   { 'U',        "undo last operation"                   },
1011   { 'I',        "properties of level"                   },
1012   { 'S',        "save level"                            },
1013   { 'C',        "clear level"                           },
1014   { 'T',        "test level"                            },
1015   { 'E',        "exit level editor"                     },
1016
1017   { '\0',       "copy settings from other element"      },
1018   { '\0',       "copy settings to other element"        },
1019   { '\0',       "exchange element with other element"   },
1020
1021   { '\0',       "copy settings from this element"       },
1022   { '\0',       "paste settings to this element"        },
1023 };
1024
1025 static int random_placement_value = 10;
1026 static int random_placement_method = RANDOM_USE_QUANTITY;
1027 static int random_placement_background_element = EL_SAND;
1028 static boolean random_placement_background_restricted = FALSE;
1029 static boolean stick_element_properties_window = FALSE;
1030 static boolean custom_element_properties[NUM_ELEMENT_PROPERTIES];
1031 static boolean custom_element_change_events[NUM_CHANGE_EVENTS];
1032 static struct ElementChangeInfo custom_element_change;
1033 static struct ElementGroupInfo group_element_info;
1034 static struct ElementInfo custom_element;
1035
1036 static struct
1037 {
1038   int x, y;
1039   int min_value, max_value;
1040   int gadget_id_down, gadget_id_up;
1041   int gadget_id_text;
1042   int gadget_id_align;
1043   int *value;
1044   char *text_above, *text_left, *text_right;
1045 } counterbutton_info[ED_NUM_COUNTERBUTTONS] =
1046 {
1047   /* ---------- current level number --------------------------------------- */
1048
1049   {
1050     -1, -1,     /* these values are not constant, but can change at runtime */
1051     1,                                  100,
1052     GADGET_ID_SELECT_LEVEL_DOWN,        GADGET_ID_SELECT_LEVEL_UP,
1053     GADGET_ID_SELECT_LEVEL_TEXT,        GADGET_ID_NONE,
1054     &level_nr,
1055     NULL,                               NULL, NULL
1056   },
1057
1058   /* ---------- level and editor settings ---------------------------------- */
1059
1060   {
1061     ED_LEVEL_SETTINGS_XPOS(0),          ED_LEVEL_SETTINGS_YPOS(4),
1062     MIN_LEV_FIELDX,                     MAX_LEV_FIELDX,
1063     GADGET_ID_LEVEL_XSIZE_DOWN,         GADGET_ID_LEVEL_XSIZE_UP,
1064     GADGET_ID_LEVEL_XSIZE_TEXT,         GADGET_ID_NONE,
1065     &level.fieldx,
1066     "playfield size:",                  NULL, "width",
1067   },
1068   {
1069     -1,                                 ED_LEVEL_SETTINGS_YPOS(4),
1070     MIN_LEV_FIELDY,                     MAX_LEV_FIELDY,
1071     GADGET_ID_LEVEL_YSIZE_DOWN,         GADGET_ID_LEVEL_YSIZE_UP,
1072     GADGET_ID_LEVEL_YSIZE_TEXT,         GADGET_ID_LEVEL_XSIZE_UP,
1073     &level.fieldy,
1074     NULL,                               " ", "height",
1075   },
1076   {
1077     ED_LEVEL_SETTINGS_XPOS(0),          ED_LEVEL_SETTINGS_YPOS(5),
1078     0,                                  999,
1079     GADGET_ID_LEVEL_GEMSLIMIT_DOWN,     GADGET_ID_LEVEL_GEMSLIMIT_UP,
1080     GADGET_ID_LEVEL_GEMSLIMIT_TEXT,     GADGET_ID_NONE,
1081     &level.gems_needed,
1082     NULL,                               "number of gems to collect:", NULL
1083   },
1084   {
1085     ED_LEVEL_SETTINGS_XPOS(0),          ED_LEVEL_SETTINGS_YPOS(7),
1086     0,                                  9999,
1087     GADGET_ID_LEVEL_TIMELIMIT_DOWN,     GADGET_ID_LEVEL_TIMELIMIT_UP,
1088     GADGET_ID_LEVEL_TIMELIMIT_TEXT,     GADGET_ID_NONE,
1089     &level.time,
1090     "time or step limit to solve level:", NULL, NULL
1091   },
1092   {
1093     ED_LEVEL_SETTINGS_XPOS(0),          ED_LEVEL_SETTINGS_YPOS(9),
1094     0,                                  999,
1095     GADGET_ID_LEVEL_TIMESCORE_DOWN,     GADGET_ID_LEVEL_TIMESCORE_UP,
1096     GADGET_ID_LEVEL_TIMESCORE_TEXT,     GADGET_ID_NONE,
1097     &level.score[SC_TIME_BONUS],
1098     "score for each second/step left:", NULL, NULL
1099   },
1100   {
1101     ED_LEVEL_SETTINGS_XPOS(0),          ED_LEVEL_SETTINGS_YPOS(12),
1102     0,                                  9999,
1103     GADGET_ID_LEVEL_RANDOM_SEED_DOWN,   GADGET_ID_LEVEL_RANDOM_SEED_UP,
1104     GADGET_ID_LEVEL_RANDOM_SEED_TEXT,   GADGET_ID_NONE,
1105     &level.random_seed,
1106     NULL,                               "random seed:", "(0 => random)"
1107   },
1108   {
1109     ED_LEVEL_SETTINGS_XPOS(0),          ED_LEVEL_SETTINGS_YPOS(0),
1110     1,                                  100,
1111     GADGET_ID_LEVEL_RANDOM_DOWN,        GADGET_ID_LEVEL_RANDOM_UP,
1112     GADGET_ID_LEVEL_RANDOM_TEXT,        GADGET_ID_NONE,
1113     &random_placement_value,
1114     "random element placement:",        NULL, "in"
1115   },
1116
1117   /* ---------- element settings: configure (various elements) ------------- */
1118
1119   {
1120     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(0),
1121     MIN_SCORE,                          MAX_SCORE,
1122     GADGET_ID_ELEMENT_VALUE1_DOWN,      GADGET_ID_ELEMENT_VALUE1_UP,
1123     GADGET_ID_ELEMENT_VALUE1_TEXT,      GADGET_ID_NONE,
1124     NULL,                               /* will be set when used */
1125     NULL,                               NULL, NULL
1126   },
1127   {
1128     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(1),
1129     MIN_SCORE,                          MAX_SCORE,
1130     GADGET_ID_ELEMENT_VALUE2_DOWN,      GADGET_ID_ELEMENT_VALUE2_UP,
1131     GADGET_ID_ELEMENT_VALUE2_TEXT,      GADGET_ID_NONE,
1132     NULL,                               /* will be set when used */
1133     NULL,                               NULL, NULL
1134   },
1135   {
1136     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(2),
1137     MIN_SCORE,                          MAX_SCORE,
1138     GADGET_ID_ELEMENT_VALUE3_DOWN,      GADGET_ID_ELEMENT_VALUE3_UP,
1139     GADGET_ID_ELEMENT_VALUE3_TEXT,      GADGET_ID_NONE,
1140     NULL,                               /* will be set when used */
1141     NULL,                               NULL, NULL
1142   },
1143   {
1144     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(3),
1145     MIN_SCORE,                          MAX_SCORE,
1146     GADGET_ID_ELEMENT_VALUE4_DOWN,      GADGET_ID_ELEMENT_VALUE4_UP,
1147     GADGET_ID_ELEMENT_VALUE4_TEXT,      GADGET_ID_NONE,
1148     NULL,                               /* will be set when used */
1149     NULL,                               NULL, NULL
1150   },
1151   {
1152     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(3),
1153     MIN_ELEMENT_CONTENTS,               MAX_ELEMENT_CONTENTS,
1154     GADGET_ID_YAMYAM_CONTENT_DOWN,      GADGET_ID_YAMYAM_CONTENT_UP,
1155     GADGET_ID_YAMYAM_CONTENT_TEXT,      GADGET_ID_NONE,
1156     &level.num_yamyam_contents,
1157     NULL,                               NULL, "number of content areas"
1158   },
1159   {
1160     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(4),
1161     MIN_ELEMENT_CONTENTS,               MAX_ELEMENT_CONTENTS,
1162     GADGET_ID_BALL_CONTENT_DOWN,        GADGET_ID_BALL_CONTENT_UP,
1163     GADGET_ID_BALL_CONTENT_TEXT,        GADGET_ID_NONE,
1164     &level.num_ball_contents,
1165     NULL,                               NULL, "number of content areas"
1166   },
1167   {
1168     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(4),
1169     MIN_ANDROID_ELEMENTS,               MAX_ANDROID_ELEMENTS,
1170     GADGET_ID_ANDROID_CONTENT_DOWN,     GADGET_ID_ANDROID_CONTENT_UP,
1171     GADGET_ID_ANDROID_CONTENT_TEXT,     GADGET_ID_NONE,
1172     &level.num_android_clone_elements,
1173     NULL,                               NULL, "number of clonable elements"
1174   },
1175   {
1176     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(0),
1177     MIN_ENVELOPE_XSIZE,                 MAX_ENVELOPE_XSIZE,
1178     GADGET_ID_ENVELOPE_XSIZE_DOWN,      GADGET_ID_ENVELOPE_XSIZE_UP,
1179     GADGET_ID_ENVELOPE_XSIZE_TEXT,      GADGET_ID_NONE,
1180     NULL,                               /* will be set when used */
1181     NULL,                               NULL, "width",
1182   },
1183   {
1184     -1,                                 ED_ELEMENT_SETTINGS_YPOS(0),
1185     MIN_ENVELOPE_YSIZE,                 MAX_ENVELOPE_YSIZE,
1186     GADGET_ID_ENVELOPE_YSIZE_DOWN,      GADGET_ID_ENVELOPE_YSIZE_UP,
1187     GADGET_ID_ENVELOPE_YSIZE_TEXT,      GADGET_ID_ENVELOPE_XSIZE_UP,
1188     NULL,                               /* will be set when used */
1189     NULL,                               " ", "height",
1190   },
1191   {
1192     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(2),
1193     MIN_INITIAL_INVENTORY_SIZE,         MAX_INITIAL_INVENTORY_SIZE,
1194     GADGET_ID_INVENTORY_SIZE_DOWN,      GADGET_ID_INVENTORY_SIZE_UP,
1195     GADGET_ID_INVENTORY_SIZE_TEXT,      GADGET_ID_NONE,
1196     &level.initial_inventory_size[0],
1197     NULL,                               NULL, "number of inventory elements"
1198   },
1199
1200   /* ---------- element settings: configure 1 (custom elements) ------------ */
1201
1202   {
1203     ED_ELEMENT_SETTINGS_XPOS(1),        ED_ELEMENT_SETTINGS_YPOS(6),
1204     MIN_SCORE,                          MAX_SCORE,
1205     GADGET_ID_CUSTOM_SCORE_DOWN,        GADGET_ID_CUSTOM_SCORE_UP,
1206     GADGET_ID_CUSTOM_SCORE_TEXT,        GADGET_ID_NONE,
1207     &custom_element.collect_score_initial,
1208     NULL,                               "CE score", " "
1209   },
1210   {
1211     -1,                                 ED_ELEMENT_SETTINGS_YPOS(6),
1212     MIN_COLLECT_COUNT,                  MAX_COLLECT_COUNT,
1213     GADGET_ID_CUSTOM_GEMCOUNT_DOWN,     GADGET_ID_CUSTOM_GEMCOUNT_UP,
1214     GADGET_ID_CUSTOM_GEMCOUNT_TEXT,     GADGET_ID_CUSTOM_SCORE_UP,
1215     &custom_element.collect_count_initial,
1216     NULL,                               "CE count", NULL
1217   },
1218   {
1219     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(12),
1220     0,                                  9999,
1221     GADGET_ID_CUSTOM_VALUE_FIX_DOWN,    GADGET_ID_CUSTOM_VALUE_FIX_UP,
1222     GADGET_ID_CUSTOM_VALUE_FIX_TEXT,    GADGET_ID_NONE,
1223     &custom_element.ce_value_fixed_initial,
1224     NULL,                               "CE value", NULL
1225   },
1226   {
1227     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(12),
1228     0,                                  9999,
1229     GADGET_ID_CUSTOM_VALUE_RND_DOWN,    GADGET_ID_CUSTOM_VALUE_RND_UP,
1230     GADGET_ID_CUSTOM_VALUE_RND_TEXT,    GADGET_ID_CUSTOM_VALUE_FIX_UP,
1231     &custom_element.ce_value_random_initial,
1232     NULL,                               "+random", NULL
1233   },
1234   {
1235     ED_ELEMENT_SETTINGS_XPOS(1),        ED_ELEMENT_SETTINGS_YPOS(7),
1236     0,                                  999,
1237     GADGET_ID_PUSH_DELAY_FIX_DOWN,      GADGET_ID_PUSH_DELAY_FIX_UP,
1238     GADGET_ID_PUSH_DELAY_FIX_TEXT,      GADGET_ID_NONE,
1239     &custom_element.push_delay_fixed,
1240     NULL,                               "push delay", NULL
1241   },
1242   {
1243     -1,                                 ED_ELEMENT_SETTINGS_YPOS(7),
1244     0,                                  999,
1245     GADGET_ID_PUSH_DELAY_RND_DOWN,      GADGET_ID_PUSH_DELAY_RND_UP,
1246     GADGET_ID_PUSH_DELAY_RND_TEXT,      GADGET_ID_PUSH_DELAY_FIX_UP,
1247     &custom_element.push_delay_random,
1248     NULL,                               "+random", NULL
1249   },
1250   {
1251     ED_ELEMENT_SETTINGS_XPOS(1),        ED_ELEMENT_SETTINGS_YPOS(8),
1252     0,                                  999,
1253     GADGET_ID_DROP_DELAY_FIX_DOWN,      GADGET_ID_DROP_DELAY_FIX_UP,
1254     GADGET_ID_DROP_DELAY_FIX_TEXT,      GADGET_ID_NONE,
1255     &custom_element.drop_delay_fixed,
1256     NULL,                               "drop delay", NULL
1257   },
1258   {
1259     -1,                                 ED_ELEMENT_SETTINGS_YPOS(8),
1260     0,                                  999,
1261     GADGET_ID_DROP_DELAY_RND_DOWN,      GADGET_ID_DROP_DELAY_RND_UP,
1262     GADGET_ID_DROP_DELAY_RND_TEXT,      GADGET_ID_DROP_DELAY_FIX_UP,
1263     &custom_element.drop_delay_random,
1264     NULL,                               "+random", NULL
1265   },
1266
1267   /* ---------- element settings: configure 2 (custom elements) ------------ */
1268
1269   {
1270     ED_ELEMENT_SETTINGS_XPOS(1),        ED_ELEMENT_SETTINGS_YPOS(5),
1271     0,                                  999,
1272     GADGET_ID_MOVE_DELAY_FIX_DOWN,      GADGET_ID_MOVE_DELAY_FIX_UP,
1273     GADGET_ID_MOVE_DELAY_FIX_TEXT,      GADGET_ID_NONE,
1274     &custom_element.move_delay_fixed,
1275     NULL,                               "move delay", NULL
1276   },
1277   {
1278     -1,                                 ED_ELEMENT_SETTINGS_YPOS(5),
1279     0,                                  999,
1280     GADGET_ID_MOVE_DELAY_RND_DOWN,      GADGET_ID_MOVE_DELAY_RND_UP,
1281     GADGET_ID_MOVE_DELAY_RND_TEXT,      GADGET_ID_MOVE_DELAY_FIX_UP,
1282     &custom_element.move_delay_random,
1283     NULL,                               "+random", NULL
1284   },
1285   {
1286     ED_ELEMENT_SETTINGS_XPOS(1),        ED_ELEMENT_SETTINGS_YPOS(12),
1287     0,                                  999,
1288     GADGET_ID_EXPLOSION_DELAY_DOWN,     GADGET_ID_EXPLOSION_DELAY_UP,
1289     GADGET_ID_EXPLOSION_DELAY_TEXT,     GADGET_ID_NONE,
1290     &custom_element.explosion_delay,
1291     NULL,                               "explosion delay", NULL
1292   },
1293   {
1294     ED_ELEMENT_SETTINGS_XPOS(1),        ED_ELEMENT_SETTINGS_YPOS(13),
1295     0,                                  999,
1296     GADGET_ID_IGNITION_DELAY_DOWN,      GADGET_ID_IGNITION_DELAY_UP,
1297     GADGET_ID_IGNITION_DELAY_TEXT,      GADGET_ID_NONE,
1298     &custom_element.ignition_delay,
1299     NULL,                               "ignition delay", "(by fire)"
1300   },
1301
1302   /* ---------- element settings: configure (group elements) --------------- */
1303
1304   {
1305     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(5),
1306     MIN_ELEMENTS_IN_GROUP,              MAX_ELEMENTS_IN_GROUP,
1307     GADGET_ID_GROUP_CONTENT_DOWN,       GADGET_ID_GROUP_CONTENT_UP,
1308     GADGET_ID_GROUP_CONTENT_TEXT,       GADGET_ID_NONE,
1309     &group_element_info.num_elements,
1310     NULL,                               NULL, "number of elements in group"
1311   },
1312
1313   /* ---------- element settings: advanced (custom elements) --------------- */
1314
1315   {
1316     ED_ELEMENT_SETTINGS_XPOS(2),        ED_ELEMENT_SETTINGS_YPOS(2),
1317     0,                                  999,
1318     GADGET_ID_CHANGE_DELAY_FIX_DOWN,    GADGET_ID_CHANGE_DELAY_FIX_UP,
1319     GADGET_ID_CHANGE_DELAY_FIX_TEXT,    GADGET_ID_NONE,
1320     &custom_element_change.delay_fixed,
1321     NULL,                               "CE delay", NULL,
1322   },
1323   {
1324     -1,                                 ED_ELEMENT_SETTINGS_YPOS(2),
1325     0,                                  999,
1326     GADGET_ID_CHANGE_DELAY_RND_DOWN,    GADGET_ID_CHANGE_DELAY_RND_UP,
1327     GADGET_ID_CHANGE_DELAY_RND_TEXT,    GADGET_ID_CHANGE_DELAY_FIX_UP,
1328     &custom_element_change.delay_random,
1329     NULL,                               "+random", NULL
1330   },
1331   {
1332     ED_ELEMENT_SETTINGS_XPOS(3),        ED_ELEMENT_SETTINGS_YPOS(12),
1333     0,                                  100,
1334     GADGET_ID_CHANGE_CONT_RND_DOWN,     GADGET_ID_CHANGE_CONT_RND_UP,
1335     GADGET_ID_CHANGE_CONT_RND_TEXT,     GADGET_ID_NONE,
1336     &custom_element_change.random_percentage,
1337     NULL,                               "use random replace:", "%"
1338   },
1339 };
1340
1341 static struct
1342 {
1343   int x, y;
1344   int gadget_id;
1345   int size;
1346   char *value;
1347   char *text_above, *infotext;
1348 } textinput_info[ED_NUM_TEXTINPUT] =
1349 {
1350   {
1351     ED_LEVEL_SETTINGS_XPOS(0),          ED_LEVEL_SETTINGS_YPOS(0),
1352     GADGET_ID_LEVEL_NAME,
1353     MAX_LEVEL_NAME_LEN,
1354     level.name,
1355     "Title:", "Title"
1356   },
1357   {
1358     ED_LEVEL_SETTINGS_XPOS(0),          ED_LEVEL_SETTINGS_YPOS(2),
1359     GADGET_ID_LEVEL_AUTHOR,
1360     MAX_LEVEL_AUTHOR_LEN,
1361     level.author,
1362     "Author:", "Author"
1363   },
1364   {
1365     5 * MINI_TILEX - 2,                 5 * MINI_TILEY - ED_BORDER_SIZE + 1,
1366     GADGET_ID_ELEMENT_NAME,
1367     MAX_ELEMENT_NAME_LEN - 2,           /* currently 2 chars less editable */
1368     custom_element.description,
1369     NULL, "Element name"
1370   }
1371 };
1372
1373 static struct
1374 {
1375   int x, y;
1376   int gadget_id;
1377   int xsize, ysize;
1378   char *value;
1379   char *text_above, *infotext;
1380 } textarea_info[ED_NUM_TEXTAREAS] =
1381 {
1382   {
1383     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(3),
1384     GADGET_ID_ENVELOPE_INFO,
1385     MAX_ENVELOPE_XSIZE, MAX_ENVELOPE_YSIZE,
1386     NULL,
1387     "Envelope Content:", "Envelope Content"
1388   }
1389 };
1390
1391 static struct ValueTextInfo options_time_or_steps[] =
1392 {
1393   { 0,                          "seconds"                       },
1394   { 1,                          "steps"                         },
1395
1396   { -1,                         NULL                            }
1397 };
1398
1399 static struct ValueTextInfo options_game_engine_type[] =
1400 {
1401   { GAME_ENGINE_TYPE_RND,       "Rocks'n'Diamonds"              },
1402   { GAME_ENGINE_TYPE_EM,        "Emerald Mine"                  },
1403   { GAME_ENGINE_TYPE_SP,        "Supaplex"                      },
1404
1405   { -1,                         NULL                            }
1406 };
1407
1408 static struct ValueTextInfo options_wind_direction[] =
1409 {
1410   { MV_START_NONE,              "none"                          },
1411   { MV_START_LEFT,              "left"                          },
1412   { MV_START_RIGHT,             "right"                         },
1413   { MV_START_UP,                "up"                            },
1414   { MV_START_DOWN,              "down"                          },
1415
1416   { -1,                         NULL                            }
1417 };
1418
1419 static struct ValueTextInfo options_player_speed[] =
1420 {
1421   { 0,                          "frozen"                        },
1422   { 1,                          "very slow"                     },
1423   { 2,                          "slow"                          },
1424   { 4,                          "normal"                        },
1425   { 8,                          "fast"                          },
1426   { 16,                         "very fast"                     },
1427   { 32,                         "ultrafast"                     },
1428
1429   { -1,                         NULL                            }
1430 };
1431
1432 static struct ValueTextInfo options_access_type[] =
1433 {
1434   { EP_WALKABLE,                "walkable"                      },
1435   { EP_PASSABLE,                "passable"                      },
1436
1437   { -1,                         NULL                            }
1438 };
1439
1440 static struct ValueTextInfo options_access_layer[] =
1441 {
1442   { EP_ACCESSIBLE_OVER,         "over"                          },
1443   { EP_ACCESSIBLE_INSIDE,       "inside"                        },
1444   { EP_ACCESSIBLE_UNDER,        "under"                         },
1445
1446   { -1,                         NULL                            }
1447 };
1448
1449 static struct ValueTextInfo options_access_protected[] =
1450 {
1451   { 0,                          "unprotected"                   },
1452   { 1,                          "protected"                     },
1453
1454   { -1,                         NULL                            }
1455 };
1456
1457 static struct ValueTextInfo options_access_direction[] =
1458 {
1459   { MV_NO_DIRECTION,            "no direction"                  },
1460   { MV_LEFT,                    "left"                          },
1461   { MV_RIGHT,                   "right"                         },
1462   { MV_UP,                      "up"                            },
1463   { MV_DOWN,                    "down"                          },
1464   { MV_LEFT  | MV_UP,           "left + up"                     },
1465   { MV_LEFT  | MV_DOWN,         "left + down"                   },
1466   { MV_RIGHT | MV_UP,           "right + up"                    },
1467   { MV_RIGHT | MV_DOWN,         "right + down"                  },
1468   { MV_HORIZONTAL,              "horizontal"                    },
1469   { MV_VERTICAL,                "vertical"                      },
1470   { MV_HORIZONTAL | MV_UP,      "horizontal + up"               },
1471   { MV_HORIZONTAL | MV_DOWN,    "horizontal + down"             },
1472   { MV_VERTICAL   | MV_LEFT,    "vertical + left"               },
1473   { MV_VERTICAL   | MV_RIGHT,   "vertical + right"              },
1474   { MV_ALL_DIRECTIONS,          "all directions"                },
1475
1476   { -1,                         NULL                            }
1477 };
1478
1479 static struct ValueTextInfo options_walk_to_action[] =
1480 {
1481   { EP_DIGGABLE,                "diggable"                      },
1482   { EP_COLLECTIBLE_ONLY,        "collectible"                   },
1483   { EP_DROPPABLE,               "collectible & droppable"       },
1484   { EP_THROWABLE,               "collectible & throwable"       },
1485   { EP_PUSHABLE,                "pushable"                      },
1486
1487   { -1,                         NULL                            }
1488 };
1489
1490 static struct ValueTextInfo options_move_pattern[] =
1491 {
1492   { MV_LEFT,                    "left"                          },
1493   { MV_RIGHT,                   "right"                         },
1494   { MV_UP,                      "up"                            },
1495   { MV_DOWN,                    "down"                          },
1496   { MV_HORIZONTAL,              "horizontal"                    },
1497   { MV_VERTICAL,                "vertical"                      },
1498   { MV_ALL_DIRECTIONS,          "all directions"                },
1499   { MV_WIND_DIRECTION,          "wind direction"                },
1500   { MV_TOWARDS_PLAYER,          "towards player"                },
1501   { MV_AWAY_FROM_PLAYER,        "away from player"              },
1502   { MV_ALONG_LEFT_SIDE,         "along left side"               },
1503   { MV_ALONG_RIGHT_SIDE,        "along right side"              },
1504   { MV_TURNING_LEFT,            "turning left"                  },
1505   { MV_TURNING_RIGHT,           "turning right"                 },
1506   { MV_TURNING_LEFT_RIGHT,      "turning left, right"           },
1507   { MV_TURNING_RIGHT_LEFT,      "turning right, left"           },
1508   { MV_TURNING_RANDOM,          "turning random"                },
1509   { MV_MAZE_RUNNER,             "maze runner style"             },
1510   { MV_MAZE_HUNTER,             "maze hunter style"             },
1511   { MV_WHEN_PUSHED,             "when pushed"                   },
1512   { MV_WHEN_DROPPED,            "when dropped/thrown"           },
1513
1514   { -1,                         NULL                            }
1515 };
1516
1517 static struct ValueTextInfo options_move_direction[] =
1518 {
1519   { MV_START_AUTOMATIC,         "automatic"                     },
1520   { MV_START_LEFT,              "left"                          },
1521   { MV_START_RIGHT,             "right"                         },
1522   { MV_START_UP,                "up"                            },
1523   { MV_START_DOWN,              "down"                          },
1524   { MV_START_RANDOM,            "random"                        },
1525   { MV_START_PREVIOUS,          "previous"                      },
1526
1527   { -1,                         NULL                            }
1528 };
1529
1530 static struct ValueTextInfo options_move_stepsize[] =
1531 {
1532   { 0,                          "not moving"                    },
1533   { 1,                          "very slow"                     },
1534   { 2,                          "slow"                          },
1535   { 4,                          "normal"                        },
1536   { 8,                          "fast"                          },
1537   { 16,                         "very fast"                     },
1538   { 32,                         "even faster"                   },
1539
1540   { -1,                         NULL                            }
1541 };
1542
1543 static struct ValueTextInfo options_move_leave_type[] =
1544 {
1545   { LEAVE_TYPE_UNLIMITED,       "leave behind"                  },
1546   { LEAVE_TYPE_LIMITED,         "change it to"                  },
1547
1548   { -1,                         NULL                            }
1549 };
1550
1551 static struct ValueTextInfo options_smash_targets[] =
1552 {
1553   { EP_CAN_SMASH_PLAYER,        "player"                        },
1554 #if 0
1555   { EP_CAN_SMASH_ENEMIES,       "enemies"                       },
1556 #endif
1557   { EP_CAN_SMASH_EVERYTHING,    "everything"                    },
1558
1559   { -1,                         NULL                            }
1560 };
1561
1562 static struct ValueTextInfo options_slippery_type[] =
1563 {
1564   { SLIPPERY_ANY_RANDOM,        "random"                        },
1565   { SLIPPERY_ANY_LEFT_RIGHT,    "left, right"                   },
1566   { SLIPPERY_ANY_RIGHT_LEFT,    "right, left"                   },
1567   { SLIPPERY_ONLY_LEFT,         "only left"                     },
1568   { SLIPPERY_ONLY_RIGHT,        "only right"                    },
1569
1570   { -1,                         NULL                            }
1571 };
1572
1573 static struct ValueTextInfo options_deadliness[] =
1574 {
1575   { EP_DONT_RUN_INTO,           "running into"                  },
1576   { EP_DONT_COLLIDE_WITH,       "colliding with"                },
1577   { EP_DONT_GET_HIT_BY,         "getting hit by"                },
1578   { EP_DONT_TOUCH,              "touching"                      },
1579
1580   { -1,                         NULL                            }
1581 };
1582
1583 static struct ValueTextInfo options_explosion_type[] =
1584 {
1585   { EXPLODES_3X3,               "3x3"                           },
1586   { EXPLODES_CROSS,             "3+3"                           },
1587   { EXPLODES_1X1,               "1x1"                           },
1588
1589   { -1,                         NULL                            }
1590 };
1591
1592 static struct ValueTextInfo options_time_units[] =
1593 {
1594   { 1,                          "frames"                        },
1595   { FRAMES_PER_SECOND,          "seconds"                       },
1596
1597   { -1,                         NULL                            }
1598 };
1599
1600 static struct ValueTextInfo options_change_direct_action[] =
1601 {
1602   { CE_TOUCHED_BY_PLAYER,       "touched by player"             },
1603   { CE_PRESSED_BY_PLAYER,       "pressed by player"             },
1604   { CE_SWITCHED_BY_PLAYER,      "switched by player"            },
1605   { CE_SNAPPED_BY_PLAYER,       "snapped by player"             },
1606   { CE_PUSHED_BY_PLAYER,        "pushed by player"              },
1607   { CE_ENTERED_BY_PLAYER,       "entered by player"             },
1608   { CE_LEFT_BY_PLAYER,          "left by player"                },
1609   { CE_DROPPED_BY_PLAYER,       "dropped/thrown by player"      },
1610   { CE_SWITCHED,                "switched"                      },
1611   { CE_HITTING_SOMETHING,       "hitting something"             },
1612   { CE_HIT_BY_SOMETHING,        "hit by something"              },
1613 #if 0
1614   { CE_BLOCKED,                 "blocked"                       },
1615 #endif
1616   { CE_IMPACT,                  "impact (on something)"         },
1617   { CE_SMASHED,                 "smashed (from above)"          },
1618 #if 0
1619   { CE_VALUE_CHANGES,           "CE value changes"              },
1620   { CE_SCORE_CHANGES,           "CE score changes"              },
1621 #endif
1622   { CE_VALUE_GETS_ZERO,         "CE value gets 0"               },
1623   { CE_SCORE_GETS_ZERO,         "CE score gets 0"               },
1624
1625   { -1,                         NULL                            }
1626 };
1627
1628 static struct ValueTextInfo options_change_other_action[] =
1629 {
1630   { CE_PLAYER_TOUCHES_X,        "player touches"                },
1631   { CE_PLAYER_PRESSES_X,        "player presses"                },
1632   { CE_PLAYER_SWITCHES_X,       "player switches"               },
1633   { CE_PLAYER_SNAPS_X,          "player snaps"                  },
1634   { CE_PLAYER_PUSHES_X,         "player pushes"                 },
1635   { CE_PLAYER_ENTERS_X,         "player enters"                 },
1636   { CE_PLAYER_LEAVES_X,         "player leaves"                 },
1637   { CE_PLAYER_DIGS_X,           "player digs"                   },
1638   { CE_PLAYER_COLLECTS_X,       "player collects"               },
1639   { CE_PLAYER_DROPS_X,          "player drops/throws"           },
1640   { CE_TOUCHING_X,              "touching"                      },
1641   { CE_HITTING_X,               "hitting"                       },
1642   { CE_DIGGING_X,               "digging"                       },
1643   { CE_HIT_BY_X,                "hit by"                        },
1644   { CE_SWITCH_OF_X,             "switch of"                     },
1645   { CE_CHANGE_OF_X,             "change by page of"             },
1646   { CE_EXPLOSION_OF_X,          "explosion of"                  },
1647   { CE_MOVE_OF_X,               "move of"                       },
1648   { CE_CREATION_OF_X,           "creation of"                   },
1649   { CE_VALUE_CHANGES_OF_X,      "CE value changes of"           },
1650   { CE_SCORE_CHANGES_OF_X,      "CE score changes of"           },
1651   { CE_VALUE_GETS_ZERO_OF_X,    "CE value gets 0 of"            },
1652   { CE_SCORE_GETS_ZERO_OF_X,    "CE score gets 0 of"            },
1653
1654   { -1,                         NULL                            }
1655 };
1656
1657 static struct ValueTextInfo options_change_trigger_side[] =
1658 {
1659   { CH_SIDE_LEFT,               "left"                          },
1660   { CH_SIDE_RIGHT,              "right"                         },
1661   { CH_SIDE_TOP,                "top"                           },
1662   { CH_SIDE_BOTTOM,             "bottom"                        },
1663   { CH_SIDE_LEFT_RIGHT,         "left/right"                    },
1664   { CH_SIDE_TOP_BOTTOM,         "top/bottom"                    },
1665   { CH_SIDE_ANY,                "any"                           },
1666
1667   { -1,                         NULL                            }
1668 };
1669
1670 static struct ValueTextInfo options_change_trigger_player[] =
1671 {
1672   { CH_PLAYER_1,                "1"                             },
1673   { CH_PLAYER_2,                "2"                             },
1674   { CH_PLAYER_3,                "3"                             },
1675   { CH_PLAYER_4,                "4"                             },
1676   { CH_PLAYER_ANY,              "any"                           },
1677
1678   { -1,                         NULL                            }
1679 };
1680
1681 static struct ValueTextInfo options_change_trigger_page[] =
1682 {
1683   { (1 << 0),                   "1"                             },
1684   { (1 << 1),                   "2"                             },
1685   { (1 << 2),                   "3"                             },
1686   { (1 << 3),                   "4"                             },
1687   { (1 << 4),                   "5"                             },
1688   { (1 << 5),                   "6"                             },
1689   { (1 << 6),                   "7"                             },
1690   { (1 << 7),                   "8"                             },
1691   { (1 << 8),                   "9"                             },
1692   { (1 << 9),                   "10"                            },
1693   { (1 << 10),                  "11"                            },
1694   { (1 << 11),                  "12"                            },
1695   { (1 << 12),                  "13"                            },
1696   { (1 << 13),                  "14"                            },
1697   { (1 << 14),                  "15"                            },
1698   { (1 << 15),                  "16"                            },
1699   { (1 << 16),                  "17"                            },
1700   { (1 << 17),                  "18"                            },
1701   { (1 << 18),                  "19"                            },
1702   { (1 << 19),                  "20"                            },
1703   { (1 << 20),                  "21"                            },
1704   { (1 << 21),                  "22"                            },
1705   { (1 << 22),                  "23"                            },
1706   { (1 << 23),                  "24"                            },
1707   { (1 << 24),                  "25"                            },
1708   { (1 << 25),                  "26"                            },
1709   { (1 << 26),                  "27"                            },
1710   { (1 << 27),                  "28"                            },
1711   { (1 << 28),                  "29"                            },
1712   { (1 << 29),                  "30"                            },
1713   { (1 << 30),                  "31"                            },
1714   { (1 << 31),                  "32"                            },
1715   { CH_PAGE_ANY,                "any"                           },
1716
1717   { -1,                         NULL                            }
1718 };
1719
1720 static struct ValueTextInfo options_change_replace_when[] =
1721 {
1722   { CP_WHEN_EMPTY,              "empty"                         },
1723   { CP_WHEN_WALKABLE,           "walkable"                      },
1724   { CP_WHEN_DIGGABLE,           "diggable"                      },
1725   { CP_WHEN_COLLECTIBLE,        "collectible"                   },
1726   { CP_WHEN_REMOVABLE,          "removable"                     },
1727   { CP_WHEN_DESTRUCTIBLE,       "destructible"                  },
1728
1729   { -1,                         NULL                            }
1730 };
1731
1732 static struct ValueTextInfo options_action_type[] =
1733 {
1734   { CA_NO_ACTION,               "no action"                     },
1735   { CA_UNDEFINED,               " "                             },
1736   { CA_HEADLINE_LEVEL_ACTIONS,  "[level]"                       },
1737   { CA_RESTART_LEVEL,           "restart level"                 },
1738   { CA_SHOW_ENVELOPE,           "show envelope"                 },
1739   { CA_SET_LEVEL_TIME,          "set time"                      },
1740   { CA_SET_LEVEL_SCORE,         "set score"                     },
1741   { CA_SET_LEVEL_GEMS,          "set gems"                      },
1742   { CA_SET_LEVEL_WIND,          "set wind dir."                 },
1743   { CA_SET_LEVEL_RANDOM_SEED,   "set rand. seed"                },
1744   { CA_UNDEFINED,               " "                             },
1745   { CA_HEADLINE_PLAYER_ACTIONS, "[player]"                      },
1746   { CA_MOVE_PLAYER,             "move player"                   },
1747   { CA_EXIT_PLAYER,             "exit player"                   },
1748   { CA_KILL_PLAYER,             "kill player"                   },
1749   { CA_SET_PLAYER_KEYS,         "set keys"                      },
1750   { CA_SET_PLAYER_SPEED,        "set speed"                     },
1751   { CA_SET_PLAYER_SHIELD,       "set shield"                    },
1752   { CA_SET_PLAYER_GRAVITY,      "set gravity"                   },
1753   { CA_SET_PLAYER_ARTWORK,      "set artwork"                   },
1754   { CA_SET_PLAYER_INVENTORY,    "set inventory"                 },
1755   { CA_UNDEFINED,               " "                             },
1756   { CA_HEADLINE_CE_ACTIONS,     "[CE]"                          },
1757   { CA_SET_CE_VALUE,            "set CE value"                  },
1758   { CA_SET_CE_SCORE,            "set CE score"                  },
1759   { CA_SET_CE_ARTWORK,          "set CE artwork"                },
1760   { CA_UNDEFINED,               " "                             },
1761   { CA_HEADLINE_ENGINE_ACTIONS, "[engine]"                      },
1762   { CA_SET_ENGINE_SCAN_MODE,    "set scan mode"                 },
1763
1764   { -1,                         NULL                            }
1765 };
1766
1767 static struct ValueTextInfo options_action_mode_none[] =
1768 {
1769   { CA_MODE_UNDEFINED,          " "                             },
1770
1771   { -1,                         NULL                            }
1772 };
1773
1774 static struct ValueTextInfo options_action_mode_assign[] =
1775 {
1776   { CA_MODE_SET,                "="                             },
1777
1778   { -1,                         NULL                            }
1779 };
1780
1781 static struct ValueTextInfo options_action_mode_add_remove[] =
1782 {
1783   { CA_MODE_ADD,                "+"                             },
1784   { CA_MODE_SUBTRACT,           "-"                             },
1785
1786   { -1,                         NULL                            }
1787 };
1788
1789 static struct ValueTextInfo options_action_mode_calculate[] =
1790 {
1791   { CA_MODE_SET,                "="                             },
1792   { CA_MODE_ADD,                "+"                             },
1793   { CA_MODE_SUBTRACT,           "-"                             },
1794   { CA_MODE_MULTIPLY,           "*"                             },
1795   { CA_MODE_DIVIDE,             "/"                             },
1796   { CA_MODE_MODULO,             "%"                             },
1797
1798   { -1,                         NULL                            }
1799 };
1800
1801 static struct ValueTextInfo options_action_arg_none[] =
1802 {
1803   { CA_ARG_UNDEFINED,           "         "                     },
1804
1805   { -1,                         NULL                            }
1806 };
1807
1808 static struct ValueTextInfo options_action_arg_player[] =
1809 {
1810   { CA_ARG_PLAYER_HEADLINE,     "[player]"                      },
1811   { CA_ARG_PLAYER_1,            "1"                             },
1812   { CA_ARG_PLAYER_2,            "2"                             },
1813   { CA_ARG_PLAYER_3,            "3"                             },
1814   { CA_ARG_PLAYER_4,            "4"                             },
1815   { CA_ARG_PLAYER_ANY,          "any"                           },
1816   { CA_ARG_PLAYER_TRIGGER,      "trigger"                       },
1817   { CA_ARG_PLAYER_ACTION,       "action ->"                     },
1818
1819   { -1,                         NULL                            }
1820 };
1821
1822 static struct ValueTextInfo options_action_arg_number[] =
1823 {
1824   { CA_ARG_NUMBER_HEADLINE,     "[number]"                      },
1825   { CA_ARG_0,                   "0"                             },
1826   { CA_ARG_1,                   "1"                             },
1827   { CA_ARG_2,                   "2"                             },
1828   { CA_ARG_3,                   "3"                             },
1829   { CA_ARG_4,                   "4"                             },
1830   { CA_ARG_5,                   "5"                             },
1831   { CA_ARG_10,                  "10"                            },
1832   { CA_ARG_100,                 "100"                           },
1833   { CA_ARG_1000,                "1000"                          },
1834   { CA_ARG_UNDEFINED,           " "                             },
1835   { CA_ARG_NUMBER_MIN,          "min"                           },
1836   { CA_ARG_NUMBER_MAX,          "max"                           },
1837   { CA_ARG_UNDEFINED,           " "                             },
1838   { CA_ARG_NUMBER_RESET,        "reset"                         },
1839   { CA_ARG_UNDEFINED,           " "                             },
1840   { CA_ARG_NUMBER_CE_VALUE,     "CE value"                      },
1841   { CA_ARG_NUMBER_CE_SCORE,     "CE score"                      },
1842   { CA_ARG_NUMBER_CE_DELAY,     "CE delay"                      },
1843   { CA_ARG_UNDEFINED,           " "                             },
1844   { CA_ARG_NUMBER_LEVEL_TIME,   "time"                          },
1845   { CA_ARG_NUMBER_LEVEL_GEMS,   "gems"                          },
1846   { CA_ARG_NUMBER_LEVEL_SCORE,  "score"                         },
1847   { CA_ARG_UNDEFINED,           " "                             },
1848   { CA_ARG_ELEMENT_CV_HEADLINE, "[CE value]"                    },
1849   { CA_ARG_ELEMENT_CV_TARGET,   "target"                        },
1850   { CA_ARG_ELEMENT_CV_TRIGGER,  "trigger"                       },
1851   { CA_ARG_ELEMENT_CV_ACTION,   "action ->"                     },
1852   { CA_ARG_UNDEFINED,           " "                             },
1853   { CA_ARG_ELEMENT_CS_HEADLINE, "[CE score]"                    },
1854   { CA_ARG_ELEMENT_CS_TARGET,   "target"                        },
1855   { CA_ARG_ELEMENT_CS_TRIGGER,  "trigger"                       },
1856   { CA_ARG_ELEMENT_CS_ACTION,   "action ->"                     },
1857
1858   { -1,                         NULL                            }
1859 };
1860
1861 static struct ValueTextInfo options_action_arg_value[] =
1862 {
1863   { CA_ARG_NUMBER_HEADLINE,     "[number]"                      },
1864   { CA_ARG_0,                   "0"                             },
1865   { CA_ARG_1,                   "1"                             },
1866   { CA_ARG_2,                   "2"                             },
1867   { CA_ARG_3,                   "3"                             },
1868   { CA_ARG_4,                   "4"                             },
1869   { CA_ARG_5,                   "5"                             },
1870   { CA_ARG_10,                  "10"                            },
1871   { CA_ARG_100,                 "100"                           },
1872   { CA_ARG_1000,                "1000"                          },
1873   { CA_ARG_UNDEFINED,           " "                             },
1874   { CA_ARG_NUMBER_MIN,          "min"                           },
1875   { CA_ARG_NUMBER_MAX,          "max"                           },
1876   { CA_ARG_UNDEFINED,           " "                             },
1877   { CA_ARG_NUMBER_RESET,        "reset"                         },
1878   { CA_ARG_UNDEFINED,           " "                             },
1879   { CA_ARG_NUMBER_CE_VALUE,     "CE value"                      },
1880   { CA_ARG_NUMBER_CE_SCORE,     "CE score"                      },
1881   { CA_ARG_NUMBER_CE_DELAY,     "CE delay"                      },
1882   { CA_ARG_UNDEFINED,           " "                             },
1883   { CA_ARG_NUMBER_LEVEL_TIME,   "time"                          },
1884   { CA_ARG_NUMBER_LEVEL_GEMS,   "gems"                          },
1885   { CA_ARG_NUMBER_LEVEL_SCORE,  "score"                         },
1886   { CA_ARG_UNDEFINED,           " "                             },
1887   { CA_ARG_ELEMENT_CV_HEADLINE, "[CE value]"                    },
1888   { CA_ARG_ELEMENT_CV_TARGET,   "target"                        },
1889   { CA_ARG_ELEMENT_CV_TRIGGER,  "trigger"                       },
1890   { CA_ARG_ELEMENT_CV_ACTION,   "action ->"                     },
1891   { CA_ARG_UNDEFINED,           " "                             },
1892   { CA_ARG_ELEMENT_CS_HEADLINE, "[CE score]"                    },
1893   { CA_ARG_ELEMENT_CS_TARGET,   "target"                        },
1894   { CA_ARG_ELEMENT_CS_TRIGGER,  "trigger"                       },
1895   { CA_ARG_ELEMENT_CS_ACTION,   "action ->"                     },
1896   { CA_ARG_UNDEFINED,           " "                             },
1897   { CA_ARG_ELEMENT_NR_HEADLINE, "[element]"                     },
1898   { CA_ARG_ELEMENT_NR_TARGET,   "target"                        },
1899   { CA_ARG_ELEMENT_NR_TRIGGER,  "trigger"                       },
1900   { CA_ARG_ELEMENT_NR_ACTION,   "action ->"                     },
1901
1902   { -1,                         NULL                            }
1903 };
1904
1905 static struct ValueTextInfo options_action_arg_envelope[] =
1906 {
1907   { CA_ARG_NUMBER_HEADLINE,     "[number]"                      },
1908   { CA_ARG_1,                   "1"                             },
1909   { CA_ARG_2,                   "2"                             },
1910   { CA_ARG_3,                   "3"                             },
1911   { CA_ARG_4,                   "4"                             },
1912   { CA_ARG_UNDEFINED,           " "                             },
1913   { CA_ARG_ELEMENT_HEADLINE,    "[element]"                     },
1914   { CA_ARG_ELEMENT_TARGET,      "target"                        },
1915   { CA_ARG_ELEMENT_TRIGGER,     "trigger"                       },
1916   { CA_ARG_ELEMENT_ACTION,      "action ->"                     },
1917
1918   { -1,                         NULL                            }
1919 };
1920
1921 static struct ValueTextInfo options_action_arg_key[] =
1922 {
1923   { CA_ARG_NUMBER_HEADLINE,     "[number]"                      },
1924   { CA_ARG_1,                   "1"                             },
1925   { CA_ARG_2,                   "2"                             },
1926   { CA_ARG_3,                   "3"                             },
1927   { CA_ARG_4,                   "4"                             },
1928   { CA_ARG_5,                   "5"                             },
1929   { CA_ARG_6,                   "6"                             },
1930   { CA_ARG_7,                   "7"                             },
1931   { CA_ARG_8,                   "8"                             },
1932   { CA_ARG_UNDEFINED,           " "                             },
1933   { CA_ARG_ELEMENT_HEADLINE,    "[element]"                     },
1934   { CA_ARG_ELEMENT_TARGET,      "target"                        },
1935   { CA_ARG_ELEMENT_TRIGGER,     "trigger"                       },
1936   { CA_ARG_ELEMENT_ACTION,      "action ->"                     },
1937
1938   { -1,                         NULL                            }
1939 };
1940
1941 static struct ValueTextInfo options_action_arg_speed[] =
1942 {
1943   { CA_ARG_SPEED_HEADLINE,      "[speed]"                       },
1944   { CA_ARG_SPEED_NOT_MOVING,    "frozen"                        },
1945   { CA_ARG_SPEED_VERY_SLOW,     "very slow"                     },
1946   { CA_ARG_SPEED_SLOW,          "slow"                          },
1947   { CA_ARG_SPEED_NORMAL,        "normal"                        },
1948   { CA_ARG_SPEED_FAST,          "fast"                          },
1949   { CA_ARG_SPEED_VERY_FAST,     "very fast"                     },
1950   { CA_ARG_SPEED_EVEN_FASTER,   "ultrafast"                     },
1951   { CA_ARG_UNDEFINED,           " "                             },
1952   { CA_ARG_SPEED_SLOWER,        "slower"                        },
1953   { CA_ARG_SPEED_FASTER,        "faster"                        },
1954   { CA_ARG_UNDEFINED,           " "                             },
1955   { CA_ARG_SPEED_RESET,         "reset"                         },
1956
1957   { -1,                         NULL                            }
1958 };
1959
1960 static struct ValueTextInfo options_action_arg_shield[] =
1961 {
1962   { CA_ARG_SHIELD_HEADLINE,     "[shield]"                      },
1963   { CA_ARG_SHIELD_OFF,          "off"                           },
1964   { CA_ARG_SHIELD_NORMAL,       "normal"                        },
1965   { CA_ARG_SHIELD_DEADLY,       "deadly"                        },
1966
1967   { -1,                         NULL                            }
1968 };
1969
1970 static struct ValueTextInfo options_action_arg_artwork[] =
1971 {
1972   { CA_ARG_ELEMENT_HEADLINE,    "[element]"                     },
1973   { CA_ARG_ELEMENT_TARGET,      "target"                        },
1974   { CA_ARG_ELEMENT_TRIGGER,     "trigger"                       },
1975   { CA_ARG_ELEMENT_ACTION,      "action ->"                     },
1976   { CA_ARG_UNDEFINED,           " "                             },
1977   { CA_ARG_ELEMENT_RESET,       "reset"                         },
1978
1979   { -1,                         NULL                            }
1980 };
1981
1982 static struct ValueTextInfo options_action_arg_gravity[] =
1983 {
1984   { CA_ARG_GRAVITY_HEADLINE,    "[gravity]"                     },
1985   { CA_ARG_GRAVITY_ON,          "on"                            },
1986   { CA_ARG_GRAVITY_OFF,         "off"                           },
1987   { CA_ARG_GRAVITY_TOGGLE,      "toggle"                        },
1988
1989   { -1,                         NULL                            }
1990 };
1991
1992 static struct ValueTextInfo options_action_arg_direction[] =
1993 {
1994   { CA_ARG_DIRECTION_HEADLINE,  "[dir.]"                        },
1995   { CA_ARG_DIRECTION_NONE,      "none"                          },
1996   { CA_ARG_DIRECTION_LEFT,      "left"                          },
1997   { CA_ARG_DIRECTION_RIGHT,     "right"                         },
1998   { CA_ARG_DIRECTION_UP,        "up"                            },
1999   { CA_ARG_DIRECTION_DOWN,      "down"                          },
2000   { CA_ARG_DIRECTION_TRIGGER,   "trigger"                       },
2001   { CA_ARG_DIRECTION_TRIGGER_BACK, "-trigger"                   },
2002
2003   { -1,                         NULL                            }
2004 };
2005
2006 static struct ValueTextInfo options_action_arg_scan_mode[] =
2007 {
2008   { CA_ARG_SCAN_MODE_HEADLINE,  "[mode]"                        },
2009   { CA_ARG_SCAN_MODE_NORMAL,    "normal"                        },
2010   { CA_ARG_SCAN_MODE_REVERSE,   "reverse"                       },
2011
2012   { -1,                         NULL                            }
2013 };
2014
2015 static struct ValueTextInfo options_action_arg_inventory[] =
2016 {
2017   { CA_ARG_INVENTORY_HEADLINE,  "[add]"                         },
2018   { CA_ARG_ELEMENT_TARGET,      "+ target"                      },
2019   { CA_ARG_ELEMENT_TRIGGER,     "+ trigger"                     },
2020   { CA_ARG_ELEMENT_ACTION,      "+ action"                      },
2021   { CA_ARG_UNDEFINED,           " "                             },
2022   { CA_ARG_INVENTORY_RM_HEADLINE,"[remove]"                     },
2023   { CA_ARG_INVENTORY_RM_TARGET, "- target"                      },
2024   { CA_ARG_INVENTORY_RM_TRIGGER,"- trigger"                     },
2025   { CA_ARG_INVENTORY_RM_ACTION, "- action"                      },
2026   { CA_ARG_INVENTORY_RM_FIRST,  "- first"                       },
2027   { CA_ARG_INVENTORY_RM_LAST,   "- last"                        },
2028   { CA_ARG_INVENTORY_RM_ALL,    "- all"                         },
2029   { CA_ARG_UNDEFINED,           " "                             },
2030   { CA_ARG_INVENTORY_RESET,     "reset"                         },
2031
2032   { -1,                         NULL                            }
2033 };
2034
2035 static char options_change_page_strings[MAX_CHANGE_PAGES][10];
2036 static struct ValueTextInfo options_change_page[MAX_CHANGE_PAGES + 1] =
2037 {
2038   { -1,                         NULL                            }
2039 };
2040
2041 static struct ValueTextInfo options_group_choice_mode[] =
2042 {
2043   { ANIM_RANDOM,                "random"                        },
2044   { ANIM_LOOP,                  "loop"                          },
2045   { ANIM_LINEAR,                "linear"                        },
2046   { ANIM_PINGPONG,              "pingpong"                      },
2047   { ANIM_PINGPONG2,             "pingpong 2"                    },
2048
2049   { -1,                         NULL                            }
2050 };
2051
2052 static struct ValueTextInfo *action_arg_modes[] =
2053 {
2054   options_action_mode_none,
2055   options_action_mode_assign,
2056   options_action_mode_add_remove,
2057   options_action_mode_calculate,
2058 };
2059
2060 static struct
2061 {
2062   int value;
2063   int mode;
2064   struct ValueTextInfo *options;
2065 }
2066 action_arg_options[] =
2067 {
2068   { CA_NO_ACTION,               0,      options_action_arg_none,        },
2069   { CA_EXIT_PLAYER,             0,      options_action_arg_player,      },
2070   { CA_KILL_PLAYER,             0,      options_action_arg_player,      },
2071   { CA_MOVE_PLAYER,             0,      options_action_arg_direction,   },
2072   { CA_RESTART_LEVEL,           0,      options_action_arg_none,        },
2073   { CA_SHOW_ENVELOPE,           0,      options_action_arg_envelope,    },
2074   { CA_SET_LEVEL_TIME,          3,      options_action_arg_number,      },
2075   { CA_SET_LEVEL_GEMS,          3,      options_action_arg_number,      },
2076   { CA_SET_LEVEL_SCORE,         3,      options_action_arg_number,      },
2077   { CA_SET_LEVEL_WIND,          1,      options_action_arg_direction,   },
2078   { CA_SET_LEVEL_RANDOM_SEED,   1,      options_action_arg_number,      },
2079   { CA_SET_PLAYER_KEYS,         2,      options_action_arg_key,         },
2080   { CA_SET_PLAYER_SPEED,        1,      options_action_arg_speed,       },
2081   { CA_SET_PLAYER_SHIELD,       1,      options_action_arg_shield,      },
2082   { CA_SET_PLAYER_GRAVITY,      1,      options_action_arg_gravity,     },
2083   { CA_SET_PLAYER_ARTWORK,      1,      options_action_arg_artwork,     },
2084   { CA_SET_PLAYER_INVENTORY,    0,      options_action_arg_inventory,   },
2085   { CA_SET_CE_VALUE,            3,      options_action_arg_value,       },
2086   { CA_SET_CE_SCORE,            3,      options_action_arg_value,       },
2087   { CA_SET_CE_ARTWORK,          1,      options_action_arg_artwork,     },
2088   { CA_SET_ENGINE_SCAN_MODE,    1,      options_action_arg_scan_mode,   },
2089
2090   { -1,                         FALSE,  NULL                            }
2091 };
2092
2093 static struct
2094 {
2095   int x, y;
2096   int gadget_id;
2097   int gadget_id_align;
2098   int size;     /* char size of selectbox or '-1' (dynamically determined) */
2099   struct ValueTextInfo *options;
2100   int *value;
2101   char *text_left, *text_right, *infotext;
2102 } selectbox_info[ED_NUM_SELECTBOX] =
2103 {
2104   /* ---------- level and editor settings ---------------------------------- */
2105
2106   {
2107     -1,                                 ED_LEVEL_SETTINGS_YPOS(7),
2108     GADGET_ID_TIME_OR_STEPS,            GADGET_ID_LEVEL_TIMELIMIT_UP,
2109     -1,
2110     options_time_or_steps,
2111     &level.use_step_counter,
2112     NULL, "(0 => no limit)",            "time or step limit"
2113   },
2114   {
2115     ED_LEVEL_SETTINGS_XPOS(0),          ED_LEVEL_SETTINGS_YPOS(11),
2116     GADGET_ID_GAME_ENGINE_TYPE,         GADGET_ID_NONE,
2117     -1,
2118     options_game_engine_type,
2119     &level.game_engine_type,
2120     "game engine:", NULL,               "game engine"
2121   },
2122   {
2123     ED_LEVEL_SETTINGS_XPOS(0),          ED_LEVEL_SETTINGS_YPOS(10),
2124     GADGET_ID_WIND_DIRECTION,           GADGET_ID_NONE,
2125     -1,
2126     options_wind_direction,
2127     &level.wind_direction_initial,
2128     "initial wind direction:", NULL,    "initial wind direction"
2129   },
2130
2131   /* ---------- element settings: configure (several elements) ------------- */
2132
2133   {
2134     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(6),
2135     GADGET_ID_PLAYER_SPEED,             GADGET_ID_NONE,
2136     -1,
2137     options_player_speed,
2138     &level.initial_player_stepsize[0],
2139     "initial player speed:", NULL,      "initial player speed"
2140   },
2141
2142   /* ---------- element settings: configure 1 (custom elements) ------------ */
2143
2144   {
2145     ED_ELEMENT_SETTINGS_XPOS(1),        ED_ELEMENT_SETTINGS_YPOS(3),
2146     GADGET_ID_CUSTOM_ACCESS_TYPE,       GADGET_ID_NONE,
2147     -1,
2148     options_access_type,
2149     &custom_element.access_type,
2150     NULL, NULL,                         "type of access to this field"
2151   },
2152   {
2153     -1,                                 ED_ELEMENT_SETTINGS_YPOS(3),
2154     GADGET_ID_CUSTOM_ACCESS_LAYER,      GADGET_ID_CUSTOM_ACCESS_TYPE,
2155     -1,
2156     options_access_layer,
2157     &custom_element.access_layer,
2158     NULL, NULL,                         "layer of access for this field"
2159   },
2160   {
2161     -1,                                 ED_ELEMENT_SETTINGS_YPOS(3),
2162     GADGET_ID_CUSTOM_ACCESS_PROTECTED,  GADGET_ID_CUSTOM_ACCESS_LAYER,
2163     -1,
2164     options_access_protected,
2165     &custom_element.access_protected,
2166     NULL, NULL,                         "protected access for this field"
2167   },
2168   {
2169     ED_ELEMENT_SETTINGS_XPOS(1),        ED_ELEMENT_SETTINGS_YPOS(4),
2170     GADGET_ID_CUSTOM_ACCESS_DIRECTION,  GADGET_ID_NONE,
2171     -1,
2172     options_access_direction,
2173     &custom_element.access_direction,
2174     "from", NULL,                       "access direction for this field"
2175   },
2176   {
2177     ED_ELEMENT_SETTINGS_XPOS(1),        ED_ELEMENT_SETTINGS_YPOS(5),
2178     GADGET_ID_CUSTOM_WALK_TO_ACTION,    GADGET_ID_NONE,
2179     -1,
2180     options_walk_to_action,
2181     &custom_element.walk_to_action,
2182     NULL, NULL,                         "diggable/collectible/pushable"
2183   },
2184
2185   /* ---------- element settings: configure 2 (custom elements) ------------ */
2186
2187   {
2188     ED_ELEMENT_SETTINGS_XPOS(1),        ED_ELEMENT_SETTINGS_YPOS(1),
2189     GADGET_ID_CUSTOM_MOVE_PATTERN,      GADGET_ID_NONE,
2190     -1,
2191     options_move_pattern,
2192     &custom_element.move_pattern,
2193     "can move", NULL,                   "element move pattern"
2194   },
2195   {
2196     ED_ELEMENT_SETTINGS_XPOS(1),        ED_ELEMENT_SETTINGS_YPOS(2),
2197     GADGET_ID_CUSTOM_MOVE_DIRECTION,    GADGET_ID_NONE,
2198     -1,
2199     options_move_direction,
2200     &custom_element.move_direction_initial,
2201     "starts moving", NULL,              "initial element move direction"
2202   },
2203   {
2204     ED_ELEMENT_SETTINGS_XPOS(1),        ED_ELEMENT_SETTINGS_YPOS(4),
2205     GADGET_ID_CUSTOM_MOVE_STEPSIZE,     GADGET_ID_NONE,
2206     -1,
2207     options_move_stepsize,
2208     &custom_element.move_stepsize,
2209     "move/fall speed", NULL,            "speed of element movement"
2210   },
2211   {
2212     ED_ELEMENT_SETTINGS_XPOS(1),        ED_ELEMENT_SETTINGS_YPOS(3),
2213     GADGET_ID_CUSTOM_MOVE_LEAVE_TYPE,   GADGET_ID_NONE,
2214     -1,
2215     options_move_leave_type,
2216     &custom_element.move_leave_type,
2217     "can dig:    can", ":",             "leave behind or change element"
2218   },
2219   {
2220     -1,                                 ED_ELEMENT_SETTINGS_YPOS(7),
2221     GADGET_ID_CUSTOM_SMASH_TARGETS,     GADGET_ID_CUSTOM_CAN_SMASH,
2222     -1,
2223     options_smash_targets,
2224     &custom_element.smash_targets,
2225     "can smash", NULL,                  "elements that can be smashed"
2226   },
2227   {
2228     ED_ELEMENT_SETTINGS_XPOS(1),        ED_ELEMENT_SETTINGS_YPOS(8),
2229     GADGET_ID_CUSTOM_SLIPPERY_TYPE,     GADGET_ID_NONE,
2230     -1,
2231     options_slippery_type,
2232     &custom_element.slippery_type,
2233     "slippery", NULL,                   "where other elements fall down"
2234   },
2235   {
2236     ED_ELEMENT_SETTINGS_XPOS(1),        ED_ELEMENT_SETTINGS_YPOS(9),
2237     GADGET_ID_CUSTOM_DEADLINESS,        GADGET_ID_NONE,
2238     -1,
2239     options_deadliness,
2240     &custom_element.deadliness,
2241     "deadly when", NULL,                "deadliness of element"
2242   },
2243   {
2244     ED_ELEMENT_SETTINGS_XPOS(1),        ED_ELEMENT_SETTINGS_YPOS(10),
2245     GADGET_ID_CUSTOM_EXPLOSION_TYPE,    GADGET_ID_NONE,
2246     -1,
2247     options_explosion_type,
2248     &custom_element.explosion_type,
2249     "can explode", NULL,                "explosion type"
2250   },
2251
2252   /* ---------- element settings: advanced (custom elements) --------------- */
2253
2254   {
2255     ED_ELEMENT_SETTINGS_XPOS(2),        ED_ELEMENT_SETTINGS_YPOS(3),
2256     GADGET_ID_CHANGE_TIME_UNITS,        GADGET_ID_NONE,
2257     -1,
2258     options_time_units,
2259     &custom_element_change.delay_frames,
2260     "delay time given in", NULL,        "delay time units for change"
2261   },
2262   {
2263     ED_ELEMENT_SETTINGS_XPOS(2),        ED_ELEMENT_SETTINGS_YPOS(4),
2264     GADGET_ID_CHANGE_DIRECT_ACTION,     GADGET_ID_NONE,
2265     -1,
2266     options_change_direct_action,
2267     &custom_element_change.direct_action,
2268     NULL, NULL,                         "type of direct action"
2269   },
2270   {
2271     ED_ELEMENT_SETTINGS_XPOS(2),        ED_ELEMENT_SETTINGS_YPOS(5),
2272     GADGET_ID_CHANGE_OTHER_ACTION,      GADGET_ID_NONE,
2273     -1,
2274     options_change_other_action,
2275     &custom_element_change.other_action,
2276     NULL, "element:",                   "type of other element action"
2277   },
2278   {
2279     ED_ELEMENT_SETTINGS_XPOS(2),        ED_ELEMENT_SETTINGS_YPOS(6),
2280     GADGET_ID_CHANGE_SIDE,              GADGET_ID_NONE,
2281     -1,
2282     options_change_trigger_side,
2283     &custom_element_change.trigger_side,
2284     "at", "side",                       "element side triggering change"
2285   },
2286   {
2287     ED_ELEMENT_SETTINGS_XPOS(2),        ED_ELEMENT_SETTINGS_YPOS(7),
2288     GADGET_ID_CHANGE_PLAYER,            GADGET_ID_NONE,
2289     -1,
2290     options_change_trigger_player,
2291     &custom_element_change.trigger_player,
2292     "player:", " ",                     "player that causes change"
2293   },
2294   {
2295     ED_ELEMENT_SETTINGS_XPOS(2),        ED_ELEMENT_SETTINGS_YPOS(7),
2296     GADGET_ID_CHANGE_PAGE,              GADGET_ID_CHANGE_PLAYER,
2297     -1,
2298     options_change_trigger_page,
2299     &custom_element_change.trigger_page,
2300     "page:", NULL,                      "change page that causes change"
2301   },
2302   {
2303     ED_ELEMENT_SETTINGS_XPOS(2),        ED_ELEMENT_SETTINGS_YPOS(10),
2304     GADGET_ID_CHANGE_REPLACE_WHEN,      GADGET_ID_NONE,
2305     -1,
2306     options_change_replace_when,
2307     &custom_element_change.replace_when,
2308     "replace when", NULL,               "which elements can be replaced"
2309   },
2310   {
2311     ED_ELEMENT_SETTINGS_XPOS(1),        ED_ELEMENT_SETTINGS_YPOS(13),
2312     GADGET_ID_ACTION_TYPE,              GADGET_ID_NONE,
2313     -1,
2314     options_action_type,
2315     &custom_element_change.action_type,
2316     NULL, NULL,                         "action on specified condition"
2317   },
2318   {
2319     -1,                                 ED_ELEMENT_SETTINGS_YPOS(13),
2320     GADGET_ID_ACTION_MODE,              GADGET_ID_ACTION_TYPE,
2321     -1,
2322     options_action_mode_none,
2323     &custom_element_change.action_mode,
2324     NULL, NULL,                         "action operator"
2325   },
2326   {
2327     -1,                                 ED_ELEMENT_SETTINGS_YPOS(13),
2328     GADGET_ID_ACTION_ARG,               GADGET_ID_ACTION_MODE,
2329     -1,
2330     options_action_arg_none,
2331     &custom_element_change.action_arg,
2332     NULL, NULL,                         "action parameter"
2333   },
2334   {
2335     ED_ELEMENT_SETTINGS_XPOS(1),        ED_ELEMENT_SETTINGS_YPOS(14),
2336     GADGET_ID_SELECT_CHANGE_PAGE,       GADGET_ID_NONE,
2337     3,
2338     options_change_page,
2339     &custom_element.current_change_page,
2340     NULL, NULL,                         "element change page"
2341   },
2342
2343   /* ---------- element settings: configure (group elements) --------------- */
2344
2345   {
2346     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(6),
2347     GADGET_ID_GROUP_CHOICE_MODE,        GADGET_ID_NONE,
2348     -1,
2349     options_group_choice_mode,
2350     &group_element_info.choice_mode,
2351     "choice type:", NULL,               "type of group element choice"
2352   },
2353 };
2354
2355 static struct
2356 {
2357   int x, y;
2358   int gadget_id;
2359   int gadget_id_align;
2360   int size;
2361   char *text;
2362   char *text_left, *text_right, *infotext;
2363 } textbutton_info[ED_NUM_TEXTBUTTONS] =
2364 {
2365   {
2366     ED_LEVEL_SETTINGS_TABS_XPOS(0),     ED_LEVEL_SETTINGS_TABS_YPOS(0),
2367     GADGET_ID_LEVELINFO_LEVEL,          GADGET_ID_NONE,
2368     8,                                  "Level",                        
2369     NULL, NULL,                         "Configure level properties"
2370   },
2371   {
2372     ED_LEVEL_SETTINGS_TABS_XPOS(1),     ED_LEVEL_SETTINGS_TABS_YPOS(0),
2373     GADGET_ID_LEVELINFO_EDITOR,         GADGET_ID_NONE,
2374     8,                                  "Editor",                       
2375     NULL, NULL,                         "Configure editor properties"
2376   },
2377   {
2378     ED_ELEMENT_SETTINGS_TABS_XPOS(0),   ED_ELEMENT_SETTINGS_TABS_YPOS(0),
2379     GADGET_ID_PROPERTIES_INFO,          GADGET_ID_NONE,
2380     8,                                  "Info",                 
2381     NULL, NULL,                         "Show information about element"
2382   },
2383   {
2384     ED_ELEMENT_SETTINGS_TABS_XPOS(1),   ED_ELEMENT_SETTINGS_TABS_YPOS(0),
2385     GADGET_ID_PROPERTIES_CONFIG,        GADGET_ID_NONE,
2386     8,                                  "Config",
2387     NULL, NULL,                         "Configure element properties"
2388   },
2389   {
2390     ED_ELEMENT_SETTINGS_TABS_XPOS(1),   ED_ELEMENT_SETTINGS_TABS_YPOS(0),
2391     GADGET_ID_PROPERTIES_CONFIG_1,      GADGET_ID_NONE,
2392     8,                                  "Config 1",
2393     NULL, NULL,                         "Configure element properties, part 1"
2394   },
2395   {
2396     ED_ELEMENT_SETTINGS_TABS_XPOS(2),   ED_ELEMENT_SETTINGS_TABS_YPOS(0),
2397     GADGET_ID_PROPERTIES_CONFIG_2,      GADGET_ID_NONE,
2398     8,                                  "Config 2",
2399     NULL, NULL,                         "Configure element properties, part 2"
2400   },
2401   {
2402     ED_ELEMENT_SETTINGS_TABS_XPOS(3),   ED_ELEMENT_SETTINGS_TABS_YPOS(0),
2403     GADGET_ID_PROPERTIES_CHANGE,        GADGET_ID_NONE,
2404     8,                                  "Change",
2405     NULL, NULL,                         "Configure custom element change pages"
2406   },
2407   {
2408     -1,                                 ED_ELEMENT_SETTINGS_YPOS(2),
2409     GADGET_ID_SAVE_AS_TEMPLATE,         GADGET_ID_CUSTOM_USE_TEMPLATE,
2410     -1,                                 "Save",
2411     " ", "As Template",                 "Save current settings as new template"
2412   },
2413   {
2414     -1,                                 ED_ELEMENT_SETTINGS_YPOS(14),
2415     GADGET_ID_ADD_CHANGE_PAGE,          GADGET_ID_PASTE_CHANGE_PAGE,
2416     -1,                                 "New",
2417     NULL, NULL,                         "Add new change page"
2418   },
2419   {
2420     -1,                                 ED_ELEMENT_SETTINGS_YPOS(14),
2421     GADGET_ID_DEL_CHANGE_PAGE,          GADGET_ID_ADD_CHANGE_PAGE,
2422     -1,                                 "Delete",
2423     NULL, NULL,                         "Delete current change page"
2424   },
2425 };
2426
2427 static struct
2428 {
2429   int gd_x, gd_y;
2430   int x, y;
2431   int width, height;
2432   int gadget_id;
2433   int gadget_id_align;
2434   char *text_left, *text_right, *infotext;
2435 } graphicbutton_info[ED_NUM_GRAPHICBUTTONS] =
2436 {
2437   {
2438     ED_BUTTON_MINUS_XPOS,               ED_BUTTON_COUNT_YPOS,
2439     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(14),
2440     ED_BUTTON_COUNT_XSIZE,              ED_BUTTON_COUNT_YSIZE,
2441     GADGET_ID_PREV_CHANGE_PAGE,         GADGET_ID_NONE,
2442     NULL, NULL,                         "select previous change page"
2443   },
2444   {
2445     ED_BUTTON_PLUS_XPOS,                ED_BUTTON_COUNT_YPOS,
2446     -1,                                 ED_ELEMENT_SETTINGS_YPOS(14),
2447     ED_BUTTON_COUNT_XSIZE,              ED_BUTTON_COUNT_YSIZE,
2448     GADGET_ID_NEXT_CHANGE_PAGE,         GADGET_ID_SELECT_CHANGE_PAGE,
2449     NULL, "change page",                "select next change page"
2450   },
2451   {
2452     ED_COPY_CHANGE_PAGE_XPOS,           ED_COPY_CHANGE_PAGE_YPOS,
2453     -1,                                 ED_ELEMENT_SETTINGS_YPOS(14),
2454     ED_BUTTON_COUNT_XSIZE,              ED_BUTTON_COUNT_YSIZE,
2455     GADGET_ID_COPY_CHANGE_PAGE,         GADGET_ID_NEXT_CHANGE_PAGE,
2456     " ", NULL,                          "copy settings from this change page"
2457   },
2458   {
2459     ED_PASTE_CHANGE_PAGE_XPOS,          ED_PASTE_CHANGE_PAGE_YPOS,
2460     -1,                                 ED_ELEMENT_SETTINGS_YPOS(14),
2461     ED_BUTTON_COUNT_XSIZE,              ED_BUTTON_COUNT_YSIZE,
2462     GADGET_ID_PASTE_CHANGE_PAGE,        GADGET_ID_COPY_CHANGE_PAGE,
2463     NULL, NULL,                         "paste settings to this change page"
2464   },
2465 };
2466
2467 static struct
2468 {
2469   int x, y;
2470 } scrollbutton_pos[ED_NUM_SCROLLBUTTONS];
2471
2472 static struct
2473 {
2474   int graphic;
2475   int gadget_id;
2476   char *infotext;
2477 } scrollbutton_info[ED_NUM_SCROLLBUTTONS] =
2478 {
2479   {
2480     IMG_EDITOR_PLAYFIELD_SCROLL_UP,
2481     GADGET_ID_SCROLL_UP,
2482     "scroll level editing area up"
2483   },
2484   {
2485     IMG_EDITOR_PLAYFIELD_SCROLL_DOWN,
2486     GADGET_ID_SCROLL_DOWN,
2487     "scroll level editing area down"
2488   },
2489   {
2490     IMG_EDITOR_PLAYFIELD_SCROLL_LEFT,
2491     GADGET_ID_SCROLL_LEFT,
2492     "scroll level editing area left"
2493   },
2494   {
2495     IMG_EDITOR_PLAYFIELD_SCROLL_RIGHT,
2496     GADGET_ID_SCROLL_RIGHT,
2497     "scroll level editing area right"
2498   },
2499   {
2500     IMG_EDITOR_PALETTE_SCROLL_UP,
2501     GADGET_ID_SCROLL_LIST_UP,
2502     "scroll element list up ('Page Up')"
2503   },
2504   {
2505     IMG_EDITOR_PALETTE_SCROLL_DOWN,
2506     GADGET_ID_SCROLL_LIST_DOWN,
2507     "scroll element list down ('Page Down')"
2508   },
2509 };
2510
2511 static struct
2512 {
2513   int x, y;
2514   int width, height;
2515   int wheel_x, wheel_y;
2516   int wheel_width, wheel_height;
2517 } scrollbar_pos[ED_NUM_SCROLLBARS];
2518
2519 static struct
2520 {
2521   int graphic;
2522   int type;
2523   int gadget_id;
2524   char *infotext;
2525 } scrollbar_info[ED_NUM_SCROLLBARS] =
2526 {
2527   {
2528     IMG_EDITOR_PLAYFIELD_SCROLLBAR,
2529     GD_TYPE_SCROLLBAR_HORIZONTAL,
2530     GADGET_ID_SCROLL_HORIZONTAL,
2531     "scroll level editing area horizontally"
2532   },
2533   {
2534     IMG_EDITOR_PLAYFIELD_SCROLLBAR,
2535     GD_TYPE_SCROLLBAR_VERTICAL,
2536     GADGET_ID_SCROLL_VERTICAL,
2537     "scroll level editing area vertically"
2538   },
2539   {
2540     IMG_EDITOR_PALETTE_SCROLLBAR,
2541     GD_TYPE_SCROLLBAR_VERTICAL,
2542     GADGET_ID_SCROLL_LIST_VERTICAL,
2543     "scroll element list vertically"
2544   }
2545 };
2546
2547
2548 static struct
2549 {
2550   int x, y;
2551   int gadget_id;
2552   int gadget_id_align;
2553   int radio_button_nr;
2554   int *value;
2555   int checked_value;
2556   char *text_left, *text_right, *infotext;
2557 } radiobutton_info[ED_NUM_RADIOBUTTONS] =
2558 {
2559   {
2560     -1,                                 ED_LEVEL_SETTINGS_YPOS(0),
2561     GADGET_ID_RANDOM_PERCENTAGE,        GADGET_ID_LEVEL_RANDOM_UP,
2562     RADIO_NR_RANDOM_ELEMENTS,
2563     &random_placement_method,           RANDOM_USE_PERCENTAGE,
2564     " ", "percentage",                  "use percentage for random elements"
2565   },
2566   {
2567     -1,                                 ED_LEVEL_SETTINGS_YPOS(0),
2568     GADGET_ID_RANDOM_QUANTITY,          GADGET_ID_RANDOM_PERCENTAGE,
2569     RADIO_NR_RANDOM_ELEMENTS,
2570     &random_placement_method,           RANDOM_USE_QUANTITY,
2571     " ", "quantity",                    "use quantity for random elements"
2572   }
2573 };
2574
2575 static struct
2576 {
2577   int x, y;
2578   int gadget_id;
2579   int gadget_id_align;
2580   boolean *value;
2581   char *text_left, *text_right, *infotext;
2582 } checkbutton_info[ED_NUM_CHECKBUTTONS] =
2583 {
2584   /* ---------- level and editor settings ---------------------------------- */
2585
2586   {
2587     ED_LEVEL_SETTINGS_XPOS(0),          ED_LEVEL_SETTINGS_YPOS(1),
2588     GADGET_ID_RANDOM_RESTRICTED,        GADGET_ID_NONE,
2589     &random_placement_background_restricted,
2590     NULL,
2591     "restrict random placement to:",    "set random placement restriction"
2592   },
2593
2594   /* ---------- element settings: configure (various elements) ------------- */
2595
2596   {
2597     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(0),
2598     GADGET_ID_STICK_ELEMENT,            GADGET_ID_NONE,
2599     &stick_element_properties_window,
2600     NULL,
2601     "stick this screen to edit content","stick this screen to edit content"
2602   },
2603   {
2604     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(1),
2605     GADGET_ID_EM_SLIPPERY_GEMS,         GADGET_ID_NONE,
2606     &level.em_slippery_gems,
2607     NULL,
2608     "slip down from certain flat walls","use EM/DC style slipping behaviour"
2609   },
2610   {
2611     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(1),
2612     GADGET_ID_EM_EXPLODES_BY_FIRE,      GADGET_ID_NONE,
2613     &level.em_explodes_by_fire,
2614     NULL,
2615     "explodes with chain reaction",     "use R'n'D style explosion behaviour"
2616   },
2617   {
2618     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(2),
2619     GADGET_ID_USE_SPRING_BUG,           GADGET_ID_NONE,
2620     &level.use_spring_bug,
2621     NULL,
2622     "use spring pushing bug",           "use odd spring pushing behaviour"
2623   },
2624   {
2625     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(1),
2626     GADGET_ID_USE_TIME_ORB_BUG,         GADGET_ID_NONE,
2627     &level.use_time_orb_bug,
2628     NULL,
2629     "use time orb bug",                 "use odd time orb behaviour"
2630   },
2631   {
2632     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(2),
2633     GADGET_ID_RANDOM_BALL_CONTENT,      GADGET_ID_NONE,
2634     &level.ball_random,
2635     NULL,
2636     "create single random element",     "only create one element from content"
2637   },
2638   {
2639     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(1),
2640     GADGET_ID_INITIAL_BALL_STATE,       GADGET_ID_NONE,
2641     &level.ball_state_initial,
2642     NULL,
2643     "magic ball initially activated",   "activate magic ball after level start"
2644   },
2645   {
2646     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(0),
2647     GADGET_ID_GROW_INTO_DIGGABLE,       GADGET_ID_NONE,
2648     &level.grow_into_diggable,
2649     NULL,
2650     "can grow into anything diggable",  "grow into more than just sand"
2651   },
2652   {
2653     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(0),
2654     GADGET_ID_AUTO_EXIT_SOKOBAN,        GADGET_ID_NONE,
2655     &level.auto_exit_sokoban,
2656     NULL,
2657     "exit level if all fields solved",  "automatically finish Sokoban levels"
2658   },
2659   {
2660     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(8),
2661     GADGET_ID_CONTINUOUS_SNAPPING,      GADGET_ID_NONE,
2662     &level.continuous_snapping,
2663     NULL,
2664     "continuous snapping",              "use snapping without releasing key"
2665   },
2666   {
2667     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(7),
2668     GADGET_ID_BLOCK_SNAP_FIELD,         GADGET_ID_NONE,
2669     &level.block_snap_field,
2670     NULL,
2671     "block snapped field when snapping", "use snapping delay to show animation"
2672   },
2673   {
2674     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(2),
2675     GADGET_ID_BLOCK_LAST_FIELD,         GADGET_ID_NONE,
2676     &level.block_last_field,
2677     NULL,
2678     "block last field when moving",     "player blocks last field when moving"
2679   },
2680   {
2681     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(2),
2682     GADGET_ID_SP_BLOCK_LAST_FIELD,      GADGET_ID_NONE,
2683     &level.sp_block_last_field,
2684     NULL,
2685     "block last field when moving",     "player blocks last field when moving"
2686   },
2687   {
2688     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(3),
2689     GADGET_ID_INSTANT_RELOCATION,       GADGET_ID_NONE,
2690     &level.instant_relocation,
2691     NULL,
2692     "no scrolling when relocating",     "player gets relocated without delay"
2693   },
2694   {
2695     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(4),
2696     GADGET_ID_SHIFTED_RELOCATION,       GADGET_ID_NONE,
2697     &level.shifted_relocation,
2698     NULL,
2699     "no centering when relocating",     "level not centered after relocation"
2700   },
2701   {
2702     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(9),
2703     GADGET_ID_USE_START_ELEMENT,        GADGET_ID_NONE,
2704     &level.use_start_element[0],
2705     NULL,
2706     "use level start element:",        "start level at this element's position"
2707   },
2708   {
2709     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(10),
2710     GADGET_ID_USE_ARTWORK_ELEMENT,      GADGET_ID_NONE,
2711     &level.use_artwork_element[0],
2712     NULL,
2713     "use artwork from element:",        "use player artwork from other element"
2714   },
2715   {
2716     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(11),
2717     GADGET_ID_USE_EXPLOSION_ELEMENT,    GADGET_ID_NONE,
2718     &level.use_explosion_element[0],
2719     NULL,
2720     "use explosion from element:",      "use explosion properties from element"
2721   },
2722   {
2723     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(12),
2724     GADGET_ID_INITIAL_GRAVITY,          GADGET_ID_NONE,
2725     &level.initial_player_gravity[0],
2726     NULL,
2727     "use initial gravity",              "set initial player gravity"
2728   },
2729   {
2730     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(1),
2731     GADGET_ID_USE_INITIAL_INVENTORY,    GADGET_ID_NONE,
2732     &level.use_initial_inventory[0],
2733     NULL,
2734     "use initial inventory:",           "use collected elements on level start"
2735   },
2736   {
2737     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(5),
2738     GADGET_ID_CAN_PASS_TO_WALKABLE,     GADGET_ID_NONE,
2739     &level.can_pass_to_walkable,
2740     NULL,
2741     "can pass to walkable element",     "player can pass to empty or walkable"
2742   },
2743   {
2744     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(1),
2745     GADGET_ID_CAN_FALL_INTO_ACID,       GADGET_ID_NONE,
2746     &custom_element_properties[EP_CAN_MOVE_INTO_ACID],
2747     NULL,
2748     "can fall into acid (with gravity)","player can fall into acid pool"
2749   },
2750   {
2751     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(0),
2752     GADGET_ID_CAN_MOVE_INTO_ACID,       GADGET_ID_NONE,
2753     &custom_element_properties[EP_CAN_MOVE_INTO_ACID],
2754     NULL,
2755     "can move into acid",               "element can move into acid pool"
2756   },
2757   {
2758     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(1),
2759     GADGET_ID_DONT_COLLIDE_WITH,        GADGET_ID_NONE,
2760     &custom_element_properties[EP_DONT_COLLIDE_WITH],
2761     NULL,
2762     "deadly when colliding with",       "element is deadly when hitting player"
2763   },
2764   {
2765     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(1),
2766     GADGET_ID_ENVELOPE_AUTOWRAP,        GADGET_ID_NONE,
2767     &level.envelope[0].autowrap,
2768     NULL,
2769     "auto-wrap",                        "automatically wrap envelope text"
2770   },
2771   {
2772     -1,                                 ED_ELEMENT_SETTINGS_YPOS(1),
2773     GADGET_ID_ENVELOPE_CENTERED,        GADGET_ID_ENVELOPE_AUTOWRAP,
2774     &level.envelope[0].centered,
2775     " ",
2776     "centered",                         "automatically center envelope text"
2777   },
2778
2779   /* ---------- element settings: configure 1 (custom elements) ----------- */
2780
2781   {
2782     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(1),
2783     GADGET_ID_CUSTOM_USE_GRAPHIC,       GADGET_ID_NONE,
2784     &custom_element.use_gfx_element,
2785     NULL,
2786     "use graphic of element:",          "use existing element graphic"
2787   },
2788   {
2789     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(2),
2790     GADGET_ID_CUSTOM_USE_TEMPLATE,      GADGET_ID_NONE,
2791     &level.use_custom_template,
2792     NULL,
2793     "use template",                     "use template for custom properties"
2794   },
2795   {
2796     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(3),
2797     GADGET_ID_CUSTOM_ACCESSIBLE,        GADGET_ID_NONE,
2798     &custom_element_properties[EP_ACCESSIBLE],
2799     NULL,
2800     NULL,                               "player can walk to or pass this field"
2801   },
2802   {
2803     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(10),
2804     GADGET_ID_CUSTOM_GRAV_REACHABLE,    GADGET_ID_NONE,
2805     &custom_element_properties[EP_GRAVITY_REACHABLE],
2806     NULL,
2807     "reachable despite gravity",        "player can walk/dig despite gravity"
2808   },
2809   {
2810     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(13),
2811     GADGET_ID_CUSTOM_USE_LAST_VALUE,    GADGET_ID_NONE,
2812     &custom_element.use_last_ce_value,
2813     NULL,
2814     "use last CE value after change",   "use last CE value after change"
2815   },
2816   {
2817     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(5),
2818     GADGET_ID_CUSTOM_WALK_TO_OBJECT,    GADGET_ID_NONE,
2819     &custom_element_properties[EP_WALK_TO_OBJECT],
2820     NULL,
2821     NULL,                               "player can dig/collect/push element"
2822   },
2823   {
2824     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(9),
2825     GADGET_ID_CUSTOM_INDESTRUCTIBLE,    GADGET_ID_NONE,
2826     &custom_element_properties[EP_INDESTRUCTIBLE],
2827     NULL,
2828     "indestructible",                   "element is indestructible"
2829   },
2830
2831   /* ---------- element settings: configure 2 (custom elements) ----------- */
2832
2833   {
2834     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(1),
2835     GADGET_ID_CUSTOM_CAN_MOVE,          GADGET_ID_NONE,
2836     &custom_element_properties[EP_CAN_MOVE],
2837     NULL,
2838     NULL,                               "element can move with some pattern"
2839   },
2840   {
2841     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(7),
2842     GADGET_ID_CUSTOM_CAN_FALL,          GADGET_ID_NONE,
2843     &custom_element_properties[EP_CAN_FALL],
2844     NULL,
2845     "can fall",                         "element can fall down"
2846   },
2847   {
2848     -1,                                 ED_ELEMENT_SETTINGS_YPOS(7),
2849     GADGET_ID_CUSTOM_CAN_SMASH,         GADGET_ID_CUSTOM_CAN_FALL,
2850     &custom_element_properties[EP_CAN_SMASH],
2851     " ",
2852     NULL,                               "element can smash other elements"
2853   },
2854   {
2855     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(8),
2856     GADGET_ID_CUSTOM_SLIPPERY,          GADGET_ID_NONE,
2857     &custom_element_properties[EP_SLIPPERY],
2858     NULL,
2859     NULL,                               "other elements can fall down from it"
2860   },
2861   {
2862     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(9),
2863     GADGET_ID_CUSTOM_DEADLY,            GADGET_ID_NONE,
2864     &custom_element_properties[EP_DEADLY],
2865     NULL,
2866     NULL,                               "element can kill the player"
2867   },
2868   {
2869     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(10),
2870     GADGET_ID_CUSTOM_CAN_EXPLODE,       GADGET_ID_NONE,
2871     &custom_element_properties[EP_CAN_EXPLODE],
2872     NULL,
2873     NULL,                               "element can explode"
2874   },
2875   {
2876     ED_ELEMENT_SETTINGS_XPOS(1),        ED_ELEMENT_SETTINGS_YPOS(11),
2877     GADGET_ID_CUSTOM_EXPLODE_FIRE,      GADGET_ID_NONE,
2878     &custom_element_properties[EP_EXPLODES_BY_FIRE],
2879     NULL,
2880     "by fire",                          "element can explode by fire/explosion"
2881   },
2882   {
2883     -1,                                 ED_ELEMENT_SETTINGS_YPOS(11),
2884     GADGET_ID_CUSTOM_EXPLODE_SMASH,     GADGET_ID_CUSTOM_EXPLODE_FIRE,
2885     &custom_element_properties[EP_EXPLODES_SMASHED],
2886     " ",
2887     "smashed",                          "element can explode when smashed"
2888   },
2889   {
2890     -1,                                 ED_ELEMENT_SETTINGS_YPOS(11),
2891     GADGET_ID_CUSTOM_EXPLODE_IMPACT,    GADGET_ID_CUSTOM_EXPLODE_SMASH,
2892     &custom_element_properties[EP_EXPLODES_IMPACT],
2893     " ",
2894     "impact",                           "element can explode on impact"
2895   },
2896
2897   /* ---------- element settings: advanced (custom elements) --------------- */
2898
2899   {
2900     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(1),
2901     GADGET_ID_CUSTOM_CAN_CHANGE,        GADGET_ID_NONE,
2902     &custom_element_change.can_change,
2903     NULL,
2904     "element changes to:",              "change element on specified condition"
2905   },
2906   {
2907     ED_ELEMENT_SETTINGS_XPOS(1),        ED_ELEMENT_SETTINGS_YPOS(2),
2908     GADGET_ID_CHANGE_DELAY,             GADGET_ID_NONE,
2909     &custom_element_change_events[CE_DELAY],
2910     NULL,
2911     NULL,                               "element changes after delay"
2912   },
2913   {
2914     ED_ELEMENT_SETTINGS_XPOS(1),        ED_ELEMENT_SETTINGS_YPOS(4),
2915     GADGET_ID_CHANGE_BY_DIRECT_ACT,     GADGET_ID_NONE,
2916     &custom_element_change_events[CE_BY_DIRECT_ACTION],
2917     NULL,
2918     NULL,                               "element changes by direct action"
2919   },
2920   {
2921     ED_ELEMENT_SETTINGS_XPOS(1),        ED_ELEMENT_SETTINGS_YPOS(5),
2922     GADGET_ID_CHANGE_BY_OTHER_ACT,      GADGET_ID_NONE,
2923     &custom_element_change_events[CE_BY_OTHER_ACTION],
2924     NULL,
2925     NULL,                               "element changes by other element"
2926   },
2927   {
2928     ED_ELEMENT_SETTINGS_XPOS(1),        ED_ELEMENT_SETTINGS_YPOS(8),
2929     GADGET_ID_CHANGE_USE_EXPLOSION,     GADGET_ID_NONE,
2930     &custom_element_change.explode,
2931     NULL,
2932     "explode instead of change",        "element explodes instead of change"
2933   },
2934   {
2935     ED_ELEMENT_SETTINGS_XPOS(1),        ED_ELEMENT_SETTINGS_YPOS(9),
2936     GADGET_ID_CHANGE_USE_CONTENT,       GADGET_ID_NONE,
2937     &custom_element_change.use_target_content,
2938     NULL,
2939     "use extended change target:",      "element changes to more elements"
2940   },
2941   {
2942     ED_ELEMENT_SETTINGS_XPOS(2),        ED_ELEMENT_SETTINGS_YPOS(11),
2943     GADGET_ID_CHANGE_ONLY_COMPLETE,     GADGET_ID_NONE,
2944     &custom_element_change.only_if_complete,
2945     NULL,
2946     "replace all or nothing",           "only replace when all can be changed"
2947   },
2948   {
2949     ED_ELEMENT_SETTINGS_XPOS(2),        ED_ELEMENT_SETTINGS_YPOS(12),
2950     GADGET_ID_CHANGE_USE_RANDOM,        GADGET_ID_NONE,
2951     &custom_element_change.use_random_replace,
2952     NULL,
2953     NULL,                               "use percentage for random replace"
2954   },
2955   {
2956     ED_ELEMENT_SETTINGS_XPOS(0),        ED_ELEMENT_SETTINGS_YPOS(13),
2957     GADGET_ID_CHANGE_HAS_ACTION,        GADGET_ID_NONE,
2958     &custom_element_change.has_action,
2959     NULL,
2960     NULL,                               "execute action on specified condition"
2961   },
2962 };
2963
2964 static struct
2965 {
2966   int x, y;
2967   int gadget_id;
2968   int gadget_id_align;
2969   int *value;
2970   int area_xsize, area_ysize;
2971   char *text_left, *text_right, *text_below, *infotext;
2972 } drawingarea_info[ED_NUM_DRAWING_AREAS] =
2973 {
2974   /* ---------- level playfield content ------------------------------------ */
2975
2976   {
2977     0,                                  0,
2978     GADGET_ID_DRAWING_LEVEL,            GADGET_ID_NONE,
2979     NULL,
2980     -1, -1,     /* these values are not constant, but can change at runtime */
2981     NULL, NULL, NULL,                   NULL
2982   },
2983
2984   /* ---------- yam yam content -------------------------------------------- */
2985
2986   {
2987     ED_AREA_YAMYAM_CONTENT_XPOS(0),     ED_AREA_YAMYAM_CONTENT_YPOS(0),
2988     GADGET_ID_YAMYAM_CONTENT_0,         GADGET_ID_NONE,
2989     &level.yamyam_content[0].e[0][0],   3, 3,
2990     NULL, NULL, "1",                    NULL
2991   },
2992   {
2993     ED_AREA_YAMYAM_CONTENT_XPOS(1),     ED_AREA_YAMYAM_CONTENT_YPOS(1),
2994     GADGET_ID_YAMYAM_CONTENT_1,         GADGET_ID_NONE,
2995     &level.yamyam_content[1].e[0][0],   3, 3,
2996     NULL, NULL, "2",                    NULL
2997   },
2998   {
2999     ED_AREA_YAMYAM_CONTENT_XPOS(2),     ED_AREA_YAMYAM_CONTENT_YPOS(2),
3000     GADGET_ID_YAMYAM_CONTENT_2,         GADGET_ID_NONE,
3001     &level.yamyam_content[2].e[0][0],   3, 3,
3002     NULL, NULL, "3",                    NULL
3003   },
3004   {
3005     ED_AREA_YAMYAM_CONTENT_XPOS(3),     ED_AREA_YAMYAM_CONTENT_YPOS(3),
3006     GADGET_ID_YAMYAM_CONTENT_3,         GADGET_ID_NONE,
3007     &level.yamyam_content[3].e[0][0],   3, 3,
3008     NULL, NULL, "4",                    NULL
3009   },
3010   {
3011     ED_AREA_YAMYAM_CONTENT_XPOS(4),     ED_AREA_YAMYAM_CONTENT_YPOS(4),
3012     GADGET_ID_YAMYAM_CONTENT_4,         GADGET_ID_NONE,
3013     &level.yamyam_content[4].e[0][0],   3, 3,
3014     NULL, NULL, "5",                    NULL
3015   },
3016   {
3017     ED_AREA_YAMYAM_CONTENT_XPOS(5),     ED_AREA_YAMYAM_CONTENT_YPOS(5),
3018     GADGET_ID_YAMYAM_CONTENT_5,         GADGET_ID_NONE,
3019     &level.yamyam_content[5].e[0][0],   3, 3,
3020     NULL, NULL, "6",                    NULL
3021   },
3022   {
3023     ED_AREA_YAMYAM_CONTENT_XPOS(6),     ED_AREA_YAMYAM_CONTENT_YPOS(6),
3024     GADGET_ID_YAMYAM_CONTENT_6,         GADGET_ID_NONE,
3025     &level.yamyam_content[6].e[0][0],   3, 3,
3026     NULL, NULL, "7",                    NULL
3027   },
3028   {
3029     ED_AREA_YAMYAM_CONTENT_XPOS(7),     ED_AREA_YAMYAM_CONTENT_YPOS(7),
3030     GADGET_ID_YAMYAM_CONTENT_7,         GADGET_ID_NONE,
3031     &level.yamyam_content[7].e[0][0],   3, 3,
3032     NULL, NULL, "8",                    NULL
3033   },
3034
3035   /* ---------- magic ball content ----------------------------------------- */
3036
3037   {
3038     ED_AREA_MAGIC_BALL_CONTENT_XPOS(0), ED_AREA_MAGIC_BALL_CONTENT_YPOS(0),
3039     GADGET_ID_MAGIC_BALL_CONTENT_0,     GADGET_ID_NONE,
3040     &level.ball_content[0].e[0][0],     3, 3,
3041     NULL, NULL, "1",                    NULL
3042   },
3043   {
3044     ED_AREA_MAGIC_BALL_CONTENT_XPOS(1), ED_AREA_MAGIC_BALL_CONTENT_YPOS(1),
3045     GADGET_ID_MAGIC_BALL_CONTENT_1,     GADGET_ID_NONE,
3046     &level.ball_content[1].e[0][0],     3, 3,
3047     NULL, NULL, "2",                    NULL
3048   },
3049   {
3050     ED_AREA_MAGIC_BALL_CONTENT_XPOS(2), ED_AREA_MAGIC_BALL_CONTENT_YPOS(2),
3051     GADGET_ID_MAGIC_BALL_CONTENT_2,     GADGET_ID_NONE,
3052     &level.ball_content[2].e[0][0],     3, 3,
3053     NULL, NULL, "3",                    NULL
3054   },
3055   {
3056     ED_AREA_MAGIC_BALL_CONTENT_XPOS(3), ED_AREA_MAGIC_BALL_CONTENT_YPOS(3),
3057     GADGET_ID_MAGIC_BALL_CONTENT_3,     GADGET_ID_NONE,
3058     &level.ball_content[3].e[0][0],     3, 3,
3059     NULL, NULL, "4",                    NULL
3060   },
3061   {
3062     ED_AREA_MAGIC_BALL_CONTENT_XPOS(4), ED_AREA_MAGIC_BALL_CONTENT_YPOS(4),
3063     GADGET_ID_MAGIC_BALL_CONTENT_4,     GADGET_ID_NONE,
3064     &level.ball_content[4].e[0][0],     3, 3,
3065     NULL, NULL, "5",                    NULL
3066   },
3067   {
3068     ED_AREA_MAGIC_BALL_CONTENT_XPOS(5), ED_AREA_MAGIC_BALL_CONTENT_YPOS(5),
3069     GADGET_ID_MAGIC_BALL_CONTENT_5,     GADGET_ID_NONE,
3070     &level.ball_content[5].e[0][0],     3, 3,
3071     NULL, NULL, "6",                    NULL
3072   },
3073   {
3074     ED_AREA_MAGIC_BALL_CONTENT_XPOS(6), ED_AREA_MAGIC_BALL_CONTENT_YPOS(6),
3075     GADGET_ID_MAGIC_BALL_CONTENT_6,     GADGET_ID_NONE,
3076     &level.ball_content[6].e[0][0],     3, 3,
3077     NULL, NULL, "7",                    NULL
3078   },
3079   {
3080     ED_AREA_MAGIC_BALL_CONTENT_XPOS(7), ED_AREA_MAGIC_BALL_CONTENT_YPOS(7),
3081     GADGET_ID_MAGIC_BALL_CONTENT_7,     GADGET_ID_NONE,
3082     &level.ball_content[7].e[0][0],     3, 3,
3083     NULL, NULL, "8",                    NULL
3084   },
3085
3086   /* ---------- android content -------------------------------------------- */
3087
3088   {
3089     ED_AREA_1X1_SETTINGS_XPOS(0),       ED_AREA_1X1_SETTINGS_YPOS(5),
3090     GADGET_ID_ANDROID_CONTENT,          GADGET_ID_NONE,
3091     &level.android_clone_element[0],    MAX_ANDROID_ELEMENTS, 1,
3092     "elements:", NULL, NULL,            "elements android can clone"
3093   },
3094
3095   /* ---------- amoeba content --------------------------------------------- */
3096
3097   {
3098     ED_AREA_1X1_SETTINGS_XPOS(0),       ED_AREA_1X1_SETTINGS_YPOS(3),
3099     GADGET_ID_AMOEBA_CONTENT,           GADGET_ID_NONE,
3100     &level.amoeba_content,              1, 1,
3101     "content:", NULL, NULL,             "amoeba content"
3102   },
3103
3104   /* ---------- level start element ---------------------------------------- */
3105
3106   {
3107     -1,                                 ED_AREA_1X1_SETTINGS_YPOS(9),
3108     GADGET_ID_START_ELEMENT,            GADGET_ID_USE_START_ELEMENT,
3109     &level.start_element[0],            1, 1,
3110     NULL, NULL, NULL,                   "level start element"
3111   },
3112
3113   /* ---------- player artwork element ------------------------------------- */
3114
3115   {
3116     -1,                                 ED_AREA_1X1_SETTINGS_YPOS(10),
3117     GADGET_ID_ARTWORK_ELEMENT,          GADGET_ID_USE_ARTWORK_ELEMENT,
3118     &level.artwork_element[0],          1, 1,
3119     NULL, NULL, NULL,                   "element for player artwork"
3120   },
3121
3122   /* ---------- player explosion element ----------------------------------- */
3123
3124   {
3125     -1,                                 ED_AREA_1X1_SETTINGS_YPOS(11),
3126     GADGET_ID_EXPLOSION_ELEMENT,        GADGET_ID_USE_EXPLOSION_ELEMENT,
3127     &level.explosion_element[0],        1, 1,
3128     NULL, NULL, NULL,                   "element for player explosion"
3129   },
3130
3131   /* ---------- player initial inventory ----------------------------------- */
3132
3133   {
3134     -1,                                 ED_AREA_1X1_SETTINGS_YPOS(1),
3135     GADGET_ID_INVENTORY_CONTENT,        GADGET_ID_USE_INITIAL_INVENTORY,
3136     &level.initial_inventory_content[0][0], MAX_INITIAL_INVENTORY_SIZE, 1,
3137     NULL, NULL, NULL,                   "content for initial inventory"
3138   },
3139
3140   /* ---------- element settings: configure 1 (custom elements) ----------- */
3141
3142   /* ---------- custom graphic --------------------------------------------- */
3143
3144   {
3145     -1,                                 ED_AREA_1X1_SETTINGS_YPOS(1),
3146     GADGET_ID_CUSTOM_GRAPHIC,           GADGET_ID_CUSTOM_USE_GRAPHIC,
3147     &custom_element.gfx_element_initial,1, 1,
3148     NULL, NULL, NULL,                   "custom graphic element"
3149   },
3150
3151   /* ---------- element settings: configure 2 (custom elements) ----------- */
3152
3153   /* ---------- custom content (when exploding) ---------------------------- */
3154
3155   {
3156     -1,                                 ED_AREA_3X3_SETTINGS_YPOS(10),
3157     GADGET_ID_CUSTOM_CONTENT,           GADGET_ID_NONE, /* align three rows */
3158     &custom_element.content.e[0][0],    3, 3,
3159     "content:", NULL, NULL,             NULL
3160   },
3161
3162   /* ---------- custom enter and leave element (when moving) --------------- */
3163
3164   {
3165     ED_AREA_1X1_SETTINGS_XPOS(1),       ED_AREA_1X1_SETTINGS_YPOS(3),
3166     GADGET_ID_CUSTOM_MOVE_ENTER,        GADGET_ID_NONE,
3167     &custom_element.move_enter_element, 1, 1,
3168     "can dig:", " ", NULL,              "element that can be digged/collected"
3169   },
3170   {
3171     -1,                                 ED_AREA_1X1_SETTINGS_YPOS(3),
3172     GADGET_ID_CUSTOM_MOVE_LEAVE,        GADGET_ID_CUSTOM_MOVE_LEAVE_TYPE,
3173     &custom_element.move_leave_element, 1, 1,
3174     NULL, NULL, NULL,                   "element that will be left behind"
3175   },
3176
3177   /* ---------- element settings: advanced (custom elements) --------------- */
3178
3179   /* ---------- custom change target --------------------------------------- */
3180
3181   {
3182     -1,                                 ED_AREA_1X1_SETTINGS_YPOS(1),
3183     GADGET_ID_CUSTOM_CHANGE_TARGET,     GADGET_ID_CUSTOM_CAN_CHANGE,
3184     &custom_element_change.target_element, 1, 1,
3185     NULL, "after/when:", NULL,          "new target element after change"
3186   },
3187
3188   /* ---------- custom change content (extended change target) ------------- */
3189
3190   {
3191     -1,                                 ED_AREA_3X3_SETTINGS_YPOS(9),
3192     GADGET_ID_CUSTOM_CHANGE_CONTENT,    GADGET_ID_NONE, /* align three rows */
3193     &custom_element_change.target_content.e[0][0], 3, 3,
3194     NULL, NULL, NULL,                   "new extended elements after change"
3195   },
3196
3197   /* ---------- custom change trigger (element causing change) ------------- */
3198
3199   {
3200     -1,                                 ED_AREA_1X1_SETTINGS_YPOS(5),
3201     GADGET_ID_CUSTOM_CHANGE_TRIGGER,    GADGET_ID_CHANGE_OTHER_ACTION,
3202     &custom_element_change.initial_trigger_element, 1, 1,
3203     NULL, NULL, NULL,                   "other element triggering change"
3204   },
3205
3206   /* ---------- custom change action (element used for action) ------------- */
3207
3208   {
3209     -1,                                 ED_AREA_1X1_SETTINGS_YPOS(13),
3210     GADGET_ID_CUSTOM_CHANGE_ACTION,     GADGET_ID_ACTION_ARG,
3211     &custom_element_change.action_element, 1, 1,
3212     NULL, NULL, NULL,                   "element used as action parameter"
3213   },
3214
3215   /* ---------- group element content -------------------------------------- */
3216
3217   {
3218     ED_AREA_1X1_SETTINGS_XPOS(0),       ED_AREA_1X1_SETTINGS_YPOS(4),
3219     GADGET_ID_GROUP_CONTENT,            GADGET_ID_NONE,
3220     &group_element_info.element[0],     MAX_ELEMENTS_IN_GROUP, 1,
3221     "content:", NULL, NULL,             NULL
3222   },
3223
3224   /* ---------- random background (for random painting) -------------------- */
3225
3226   {
3227     -1,                                 ED_AREA_1X1_SETTINGS_YPOS(-1),
3228     GADGET_ID_RANDOM_BACKGROUND,        GADGET_ID_RANDOM_RESTRICTED,
3229     &random_placement_background_element, 1, 1,
3230     NULL, NULL, NULL,                   "random placement background"
3231   },
3232 };
3233
3234
3235 /*
3236   -----------------------------------------------------------------------------
3237   some internally used variables
3238   -----------------------------------------------------------------------------
3239 */
3240
3241 /* actual size of level editor drawing area */
3242 static int ed_fieldx, ed_fieldy;
3243
3244 /* actual position of level editor drawing area in level playfield */
3245 static int level_xpos = -1, level_ypos = -1;
3246
3247 #define IN_ED_FIELD(x,y)        IN_FIELD(x, y, ed_fieldx, ed_fieldy)
3248
3249 /* drawing elements on the three mouse buttons */
3250 static int new_element1 = EL_WALL;
3251 static int new_element2 = EL_EMPTY;
3252 static int new_element3 = EL_SAND;
3253
3254 #define IS_VALID_BUTTON(button) (button >= 1 && button <= 3)
3255 #define BUTTON_ELEMENT(button) ((button) == 1 ? new_element1 : \
3256                                 (button) == 2 ? new_element2 : \
3257                                 (button) == 3 ? new_element3 : EL_EMPTY)
3258 #define BUTTON_STEPSIZE(button) ((button) == 1 ? 1 : (button) == 2 ? 5 : 10)
3259
3260 /* forward declaration for internal use */
3261 static void ModifyEditorCounterValue(int, int);
3262 static void ModifyEditorCounterLimits(int, int, int);
3263 static void ModifyEditorSelectboxValue(int, int);
3264 static void ModifyEditorSelectboxOptions(int, struct ValueTextInfo *);
3265 static void ModifyEditorDrawingArea(int, int, int);
3266 static void ModifyEditorElementList();
3267 static void AdjustElementListScrollbar();
3268 static void RedrawDrawingElements();
3269 static void DrawDrawingWindow();
3270 static void DrawLevelInfoWindow();
3271 static void DrawPropertiesWindow();
3272 static void UpdateCustomElementGraphicGadgets();
3273 static boolean checkPropertiesConfig(int);
3274 static void CopyLevelToUndoBuffer(int);
3275 static void HandleDrawingAreas(struct GadgetInfo *);
3276 static void HandleCounterButtons(struct GadgetInfo *);
3277 static void HandleTextInputGadgets(struct GadgetInfo *);
3278 static void HandleTextAreaGadgets(struct GadgetInfo *);
3279 static void HandleSelectboxGadgets(struct GadgetInfo *);
3280 static void HandleTextbuttonGadgets(struct GadgetInfo *);
3281 static void HandleGraphicbuttonGadgets(struct GadgetInfo *);
3282 static void HandleRadiobuttons(struct GadgetInfo *);
3283 static void HandleCheckbuttons(struct GadgetInfo *);
3284 static void HandleControlButtons(struct GadgetInfo *);
3285 static void HandleDrawingAreaInfo(struct GadgetInfo *);
3286 static void PrintEditorGadgetInfoText(struct GadgetInfo *);
3287
3288 static int num_editor_gadgets = 0;      /* dynamically determined */
3289
3290 static struct GadgetInfo **level_editor_gadget = NULL;
3291 static int *right_gadget_border = NULL;
3292
3293 static int drawing_function = GADGET_ID_SINGLE_ITEMS;
3294 static int last_drawing_function = GADGET_ID_SINGLE_ITEMS;
3295 static boolean draw_with_brush = FALSE;
3296 static int properties_element = 0;
3297
3298 static short FieldBackup[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
3299 static short UndoBuffer[NUM_UNDO_STEPS][MAX_LEV_FIELDX][MAX_LEV_FIELDY];
3300 static short IntelliDrawBuffer[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
3301 static int undo_buffer_position = 0;
3302 static int undo_buffer_steps = 0;
3303
3304 static int edit_mode;