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