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