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