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