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