* removed unnecessary gi18n.h inclusions
[xonotic/netradiant.git] / plugins / surface_heretic2 / surfaceflagsdialog_heretic2.cpp
1 /*
2 Copyright (C) 1999-2007 id Software, Inc. and contributors.
3 For a list of contributors, see the accompanying CONTRIBUTORS file.
4
5 This file is part of GtkRadiant.
6
7 GtkRadiant is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 GtkRadiant is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GtkRadiant; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20 */
21
22 #include <gtk/gtk.h>
23 #include <gdk/gdkkeysyms.h>
24
25 #include "surfdlg_plugin.h"
26
27 #include "surfaceflagsdialog_heretic2.h"
28
29   GtkWidget *surface_lightbutton;
30   GtkWidget *surface_slickbutton;
31   GtkWidget *surface_skybutton;
32   GtkWidget *surface_warpbutton;
33   GtkWidget *surface_trans33button;
34   GtkWidget *surface_trans66button;
35   GtkWidget *surface_flowingbutton;
36   GtkWidget *surface_nodrawbutton;
37   GtkWidget *surface_tallwallbutton;
38   GtkWidget *surface_alphatexbutton;
39   GtkWidget *surface_animspeedbutton;
40   GtkWidget *surface_undulatebutton;
41
42   GtkWidget *surf_gravel_radiobutton;
43   GSList *surf_gravel_radiobutton_group = NULL;
44   GtkWidget *surf_metal_radiobutton;
45   GtkWidget *surf_stone_radiobutton;
46   GtkWidget *surf_wood_radiobutton;
47
48   GtkWidget *surf_value_entry;
49
50   GtkWidget *notebook1;
51
52   GtkWidget *content_solidbutton;
53   GtkWidget *content_windowbutton;
54   GtkWidget *content_illusbutton;
55   GtkWidget *content_lavabutton;
56   GtkWidget *content_slimebutton;
57   GtkWidget *content_waterbutton;
58   GtkWidget *content_mistbutton;
59   GtkWidget *content_areaportalbutton;
60   GtkWidget *content_playerclipbutton;
61   GtkWidget *content_monsterclipbutton;
62   GtkWidget *content_current0button;
63   GtkWidget *content_current90button;
64   GtkWidget *content_current180button;
65   GtkWidget *content_current270button;
66   GtkWidget *content_currentUPbutton;
67   GtkWidget *content_currentDOWNbutton;
68   GtkWidget *content_originbutton;
69   GtkWidget *content_detailbutton;
70   GtkWidget *content_ladderbutton;
71   GtkWidget *content_camnoblockbutton;
72
73
74   gboolean setup_buttons = TRUE;
75
76   int working_surface_flags;
77   int surface_mask;
78   int working_content_flags;
79   int content_mask;
80   int working_value;
81   gboolean surface_material_inconsistant = FALSE;
82
83 inline void set_inconsistent(GtkWidget *toggle_button)
84 {
85   gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON (toggle_button), TRUE);
86 }
87
88 inline void clear_inconsistent(GtkWidget *toggle_button)
89 {
90   if ( gtk_toggle_button_get_inconsistent(GTK_TOGGLE_BUTTON (toggle_button)) )
91   {
92     gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON (toggle_button), FALSE);
93   }
94
95 }
96
97 void clear_all_inconsistent(void)
98 {
99   clear_inconsistent( surface_lightbutton );
100   clear_inconsistent( surface_slickbutton );
101   clear_inconsistent( surface_skybutton );
102   clear_inconsistent( surface_warpbutton );
103   clear_inconsistent( surface_trans33button );
104   clear_inconsistent( surface_trans66button );
105   clear_inconsistent( surface_flowingbutton );
106   clear_inconsistent( surface_nodrawbutton );
107   clear_inconsistent( surface_tallwallbutton );
108   clear_inconsistent( surface_alphatexbutton );
109   clear_inconsistent( surface_animspeedbutton );
110   clear_inconsistent( surface_undulatebutton );
111
112   clear_inconsistent( surf_gravel_radiobutton );
113   clear_inconsistent( surf_metal_radiobutton );
114   clear_inconsistent( surf_stone_radiobutton );
115   clear_inconsistent( surf_wood_radiobutton );
116
117   clear_inconsistent( content_solidbutton );
118   clear_inconsistent( content_windowbutton );
119   clear_inconsistent( content_illusbutton );
120   clear_inconsistent( content_lavabutton );
121   clear_inconsistent( content_slimebutton );
122   clear_inconsistent( content_waterbutton );
123   clear_inconsistent( content_mistbutton );
124   clear_inconsistent( content_areaportalbutton );
125   clear_inconsistent( content_playerclipbutton );
126   clear_inconsistent( content_monsterclipbutton );
127   clear_inconsistent( content_current0button );
128   clear_inconsistent( content_current90button );
129   clear_inconsistent( content_current180button );
130   clear_inconsistent( content_current270button );
131   clear_inconsistent( content_currentUPbutton );
132   clear_inconsistent( content_currentDOWNbutton );
133   clear_inconsistent( content_originbutton );
134   clear_inconsistent( content_detailbutton );
135   clear_inconsistent( content_ladderbutton );
136   clear_inconsistent( content_camnoblockbutton );
137 }
138
139 void clear_all_buttons_and_values()
140 {
141   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON( surface_lightbutton ), FALSE);
142   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON( surface_slickbutton ), FALSE);
143   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON( surface_skybutton ), FALSE);
144   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON( surface_warpbutton ), FALSE);
145   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON( surface_trans33button ), FALSE);
146   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON( surface_trans66button ), FALSE);
147   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON( surface_flowingbutton ), FALSE);
148   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON( surface_nodrawbutton ), FALSE);
149   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON( surface_tallwallbutton ), FALSE);
150   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON( surface_alphatexbutton ), FALSE);
151   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON( surface_animspeedbutton ), FALSE);
152   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON( surface_undulatebutton ), FALSE);
153
154 //  surface_material_inconsistant = TRUE;
155
156   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surf_gravel_radiobutton ), FALSE);
157   set_inconsistent(surf_gravel_radiobutton);
158
159   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surf_metal_radiobutton ), FALSE);
160   set_inconsistent(surf_metal_radiobutton);
161
162   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surf_stone_radiobutton ), FALSE);
163   set_inconsistent(surf_stone_radiobutton);
164
165   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surf_wood_radiobutton ), FALSE);
166   set_inconsistent(surf_wood_radiobutton);
167
168   gtk_entry_set_text( (GtkEntry *)surf_value_entry, "");
169
170   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON( content_solidbutton ), FALSE);
171   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON( content_windowbutton ), FALSE);
172   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON( content_illusbutton ), FALSE);
173   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON( content_lavabutton ), FALSE);
174   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON( content_slimebutton ), FALSE);
175   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON( content_waterbutton ), FALSE);
176   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON( content_mistbutton ), FALSE);
177   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON( content_areaportalbutton ), FALSE);
178   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON( content_playerclipbutton ), FALSE);
179   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON( content_monsterclipbutton ), FALSE);
180   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON( content_current0button ), FALSE);
181   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON( content_current90button ), FALSE);
182   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON( content_current180button ), FALSE);
183   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON( content_current270button ), FALSE);
184   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON( content_currentUPbutton ), FALSE);
185   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON( content_currentDOWNbutton ), FALSE);
186   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON( content_originbutton ), FALSE);
187   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON( content_detailbutton ), FALSE);
188   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON( content_ladderbutton ), FALSE);
189   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON( content_camnoblockbutton ), FALSE);
190
191 }
192
193 void SetFlagButtons_Heretic2(texdef_to_face_t *texdef_face_list, bool b_isListEmpty)
194 {
195   int i;
196   int contents = 0;
197   int flags = 0;
198   int value = 0;
199   int diff_contents = 0;
200   int diff_flags = 0;
201   gboolean diff_value = FALSE;
202   char tex_buff[11];
203   texdef_t* tmp_texdef;
204   texdef_to_face_t* temp_texdef_face_list;
205   gboolean surface_which_material_inconsistant[4];
206   int surface_iterator;
207
208   setup_buttons = TRUE;
209   working_surface_flags = 0;
210   surface_mask = 0;
211   working_content_flags = 0;
212   content_mask = 0;
213   working_value = 0;
214   surface_material_inconsistant = FALSE;
215   surface_which_material_inconsistant[0] = FALSE;
216   surface_which_material_inconsistant[1] = FALSE;
217   surface_which_material_inconsistant[2] = FALSE;
218   surface_which_material_inconsistant[3] = FALSE;
219
220   if(!b_isListEmpty)
221   {
222     tmp_texdef = &texdef_face_list->texdef;
223     contents = tmp_texdef->contents;
224     flags = tmp_texdef->flags;
225     value = tmp_texdef->value;
226
227     surface_iterator = (tmp_texdef->flags & ~HERETIC2_SURF_MATERIAL_MASK) >> 24;  // Inconsistant Material?
228     surface_which_material_inconsistant[surface_iterator] = TRUE;
229
230     for (temp_texdef_face_list = texdef_face_list->next; temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next)
231     {
232       tmp_texdef = &temp_texdef_face_list->texdef;
233       diff_contents |= contents ^ tmp_texdef->contents;  // Figure out which buttons are inconsistent
234       diff_flags |= flags ^ tmp_texdef->flags;
235       if (tmp_texdef->value != value)
236         diff_value = TRUE;
237
238       surface_iterator = (tmp_texdef->flags & ~HERETIC2_SURF_MATERIAL_MASK) >> 24;  // Inconsistant Material?
239       surface_which_material_inconsistant[surface_iterator] = TRUE;
240
241       Sys_Printf("Diff_Flags: %d\t Surf_Iter: %d\n",diff_flags, surface_iterator);
242
243     }
244   }
245
246
247   clear_all_inconsistent();
248
249   // If no faces/brushes are selected, clear everything and bail
250   if(b_isListEmpty)
251   {
252     clear_all_buttons_and_values();
253     setup_buttons = FALSE;
254     return;
255   }
256
257   // Set surface buttons to reflect brush/face flags, contents, and values
258   if(diff_flags & HERETIC2_SURF_LIGHT)
259     set_inconsistent(surface_lightbutton);
260   else
261     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (surface_lightbutton), (flags & HERETIC2_SURF_LIGHT));
262
263   if(diff_flags & HERETIC2_SURF_SLICK)
264     set_inconsistent(surface_slickbutton);
265   else if(flags & HERETIC2_SURF_SLICK)
266         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surface_slickbutton ), TRUE);
267   else
268         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surface_slickbutton ), FALSE);
269
270   if(diff_flags & HERETIC2_SURF_SKY)
271     set_inconsistent(surface_skybutton);
272   else if(flags & HERETIC2_SURF_SKY)
273         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surface_skybutton ), TRUE);
274   else
275         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surface_skybutton ), FALSE);
276
277   if(diff_flags & HERETIC2_SURF_WARP)
278     set_inconsistent(surface_warpbutton);
279   else if(flags & HERETIC2_SURF_WARP)
280         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surface_warpbutton ), TRUE);
281   else
282         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surface_warpbutton ), FALSE);
283
284   if(diff_flags & HERETIC2_SURF_TRANS33)
285     set_inconsistent(surface_trans33button);
286   else if(flags & HERETIC2_SURF_TRANS33)
287         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surface_trans33button ), TRUE);
288   else
289         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surface_trans33button ), FALSE);
290
291   if(diff_flags & HERETIC2_SURF_TRANS66)
292     set_inconsistent(surface_trans66button);
293   else if(flags & HERETIC2_SURF_TRANS66)
294         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surface_trans66button ), TRUE);
295   else
296         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surface_trans66button ), FALSE);
297
298   if(diff_flags & HERETIC2_SURF_FLOWING)
299     set_inconsistent(surface_flowingbutton);
300   else if(flags & HERETIC2_SURF_FLOWING)
301         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surface_flowingbutton ), TRUE);
302   else
303         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surface_flowingbutton ), FALSE);
304
305   if(diff_flags & HERETIC2_SURF_NODRAW)
306     set_inconsistent(surface_nodrawbutton);
307   else if(flags & HERETIC2_SURF_NODRAW)
308         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surface_nodrawbutton ), TRUE);
309   else
310         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surface_nodrawbutton ), FALSE);
311
312   if(diff_flags & HERETIC2_SURF_TALL_WALL)
313     set_inconsistent(surface_tallwallbutton);
314   else if(flags & HERETIC2_SURF_TALL_WALL)
315         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surface_tallwallbutton ), TRUE);
316   else
317         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surface_tallwallbutton ), FALSE);
318
319   if(diff_flags & HERETIC2_SURF_ALPHA_TEXTURE)
320     set_inconsistent(surface_alphatexbutton);
321   else if(flags & HERETIC2_SURF_ALPHA_TEXTURE)
322         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surface_alphatexbutton ), TRUE);
323   else
324         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surface_alphatexbutton ), FALSE);
325
326   if(diff_flags & HERETIC2_SURF_ANIMSPEED)
327     set_inconsistent(surface_animspeedbutton);
328   else if(flags & HERETIC2_SURF_ANIMSPEED)
329         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surface_animspeedbutton ), TRUE);
330   else
331         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surface_animspeedbutton ), FALSE);
332
333   if(diff_flags & HERETIC2_SURF_UNDULATE)
334     set_inconsistent(surface_undulatebutton);
335   else if(flags & HERETIC2_SURF_UNDULATE)
336         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surface_undulatebutton ), TRUE);
337   else
338         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surface_undulatebutton ), FALSE);
339
340   if(diff_flags & ~HERETIC2_SURF_MATERIAL_MASK)
341   {
342     Sys_Printf("--> %d\n", (diff_flags & ~HERETIC2_SURF_MATERIAL_MASK) );
343     Sys_Printf("%d\t%d\t%d\t%d\n", surface_which_material_inconsistant[0], surface_which_material_inconsistant[1], surface_which_material_inconsistant[2], surface_which_material_inconsistant[3]);
344
345     if (surface_which_material_inconsistant[0])
346     {
347       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surf_gravel_radiobutton ), FALSE);
348       surface_material_inconsistant = TRUE;
349       set_inconsistent(surf_gravel_radiobutton);
350     }
351     if (surface_which_material_inconsistant[1])
352     {
353       //if (!surface_material_inconsistant)
354       //{
355         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surf_metal_radiobutton ), FALSE);
356         surface_material_inconsistant = TRUE;
357       //}
358       set_inconsistent(surf_metal_radiobutton);
359     }
360     if (surface_which_material_inconsistant[2])
361     {
362       //if (!surface_material_inconsistant)
363       //{
364         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surf_stone_radiobutton ), FALSE);
365         surface_material_inconsistant = TRUE;
366       //}
367       set_inconsistent(surf_stone_radiobutton);
368     }
369     if (surface_which_material_inconsistant[3])
370     {
371       //if (!surface_material_inconsistant)
372       //{
373         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surf_wood_radiobutton ), FALSE);
374         surface_material_inconsistant = TRUE;
375       //}
376       set_inconsistent(surf_wood_radiobutton);
377     }
378   }
379   else
380   {
381     if(flags & ~HERETIC2_SURF_MATERIAL_MASK)
382     {
383       surface_iterator = (flags & ~HERETIC2_SURF_MATERIAL_MASK) >> 24;
384       if( surface_iterator == 1)
385         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surf_metal_radiobutton ), TRUE);
386       else if(surface_iterator == 2)
387         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surf_stone_radiobutton ), TRUE);
388       else if(surface_iterator == 3)
389         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surf_wood_radiobutton ), TRUE);
390     }
391     else
392     {
393       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surf_gravel_radiobutton ), TRUE);
394     }
395   }
396
397   // Set content buttons to reflect brush values
398   if(diff_contents & HERETIC2_CONTENTS_SOLID)
399     set_inconsistent(content_solidbutton);
400   else if(contents & HERETIC2_CONTENTS_SOLID)
401         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_solidbutton ), TRUE);
402   else
403         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_solidbutton ), FALSE);
404
405   if(diff_contents & HERETIC2_CONTENTS_WINDOW)
406     set_inconsistent(content_windowbutton);
407   else if(contents & HERETIC2_CONTENTS_WINDOW)
408         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_windowbutton ), TRUE);
409   else
410         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_windowbutton ), FALSE);
411
412   if(diff_contents & HERETIC2_CONTENTS_ILLUSIONARY)
413     set_inconsistent(content_illusbutton);
414   else if(contents & HERETIC2_CONTENTS_ILLUSIONARY)
415         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_illusbutton ), TRUE);
416   else
417         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_illusbutton ), FALSE);
418
419   if(diff_contents & HERETIC2_CONTENTS_LAVA)
420     set_inconsistent(content_lavabutton);
421   else if(contents & HERETIC2_CONTENTS_LAVA)
422         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_lavabutton ), TRUE);
423   else
424         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_lavabutton ), FALSE);
425
426   if(diff_contents & HERETIC2_CONTENTS_SLIME)
427     set_inconsistent(content_slimebutton);
428   else if(contents & HERETIC2_CONTENTS_SLIME)
429         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_slimebutton ), TRUE);
430   else
431         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_slimebutton ), FALSE);
432
433   if(diff_contents & HERETIC2_CONTENTS_WATER)
434     set_inconsistent(content_waterbutton);
435   else if(contents & HERETIC2_CONTENTS_WATER)
436         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_waterbutton ), TRUE);
437   else
438         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_waterbutton ), FALSE);
439
440   if(diff_contents & HERETIC2_CONTENTS_MIST)
441     set_inconsistent(content_mistbutton);
442   else if(contents & HERETIC2_CONTENTS_MIST)
443         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_mistbutton ), TRUE);
444   else
445         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_mistbutton ), FALSE);
446
447   if(diff_contents & HERETIC2_CONTENTS_AREAPORTAL)
448     set_inconsistent(content_areaportalbutton);
449   else if(contents & HERETIC2_CONTENTS_AREAPORTAL)
450         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_areaportalbutton ), TRUE);
451   else
452         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_areaportalbutton ), FALSE);
453
454   if(diff_contents & HERETIC2_CONTENTS_PLAYERCLIP)
455     set_inconsistent(content_playerclipbutton);
456   else if(contents & HERETIC2_CONTENTS_PLAYERCLIP)
457         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_playerclipbutton ), TRUE);
458   else
459         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_playerclipbutton ), FALSE);
460
461   if(diff_contents & HERETIC2_CONTENTS_MONSTERCLIP)
462     set_inconsistent(content_monsterclipbutton);
463   else if(contents & HERETIC2_CONTENTS_MONSTERCLIP)
464         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_monsterclipbutton ), TRUE);
465   else
466         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_monsterclipbutton ), FALSE);
467
468   if(diff_contents & HERETIC2_CONTENTS_CURRENT_0)
469     set_inconsistent(content_current0button);
470   else if(contents & HERETIC2_CONTENTS_CURRENT_0)
471         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_current0button ), TRUE);
472   else
473         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_current0button ), FALSE);
474
475   if(diff_contents & HERETIC2_CONTENTS_CURRENT_90)
476     set_inconsistent(content_current90button);
477   else if(contents & HERETIC2_CONTENTS_CURRENT_90)
478         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_current90button ), TRUE);
479   else
480         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_current90button ), FALSE);
481
482   if(diff_contents & HERETIC2_CONTENTS_CURRENT_180)
483     set_inconsistent(content_current180button);
484   else if(contents & HERETIC2_CONTENTS_CURRENT_180)
485         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_current180button ), TRUE);
486   else
487         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_current180button ), FALSE);
488
489   if(diff_contents & HERETIC2_CONTENTS_CURRENT_270)
490     set_inconsistent(content_current270button);
491   else if(contents & HERETIC2_CONTENTS_CURRENT_270)
492         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_current270button ), TRUE);
493   else
494         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_current270button ), FALSE);
495
496   if(diff_contents & HERETIC2_CONTENTS_CURRENT_UP)
497     set_inconsistent(content_currentUPbutton);
498   else if(contents & HERETIC2_CONTENTS_CURRENT_UP)
499         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_currentUPbutton ), TRUE);
500   else
501         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_currentUPbutton ), FALSE);
502
503   if(diff_contents & HERETIC2_CONTENTS_CURRENT_DOWN)
504     set_inconsistent(content_currentDOWNbutton);
505   else if(contents & HERETIC2_CONTENTS_CURRENT_DOWN)
506         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_currentDOWNbutton ), TRUE);
507   else
508         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_currentDOWNbutton ), FALSE);
509
510   if(diff_contents & HERETIC2_CONTENTS_ORIGIN)
511     set_inconsistent(content_originbutton);
512   else if(contents & HERETIC2_CONTENTS_ORIGIN)
513         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_originbutton ), TRUE);
514   else
515         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_originbutton ), FALSE);
516
517   if(diff_contents & HERETIC2_CONTENTS_DETAIL)
518     set_inconsistent(content_detailbutton);
519   else if(contents & HERETIC2_CONTENTS_DETAIL)
520         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_detailbutton ), TRUE);
521   else
522         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_detailbutton ), FALSE);
523
524   if(diff_contents & HERETIC2_CONTENTS_LADDER)
525     set_inconsistent(content_ladderbutton);
526   else if(contents & HERETIC2_CONTENTS_LADDER)
527         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_ladderbutton ), TRUE);
528   else
529         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_ladderbutton ), FALSE);
530
531   if(diff_contents & HERETIC2_CONTENTS_CAMERANOBLOCK)
532     set_inconsistent(content_camnoblockbutton);
533   else if(contents & HERETIC2_CONTENTS_CAMERANOBLOCK)
534         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_camnoblockbutton ), TRUE);
535   else
536         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_camnoblockbutton ), FALSE);
537
538   // Set Value
539   if(diff_value)
540     gtk_entry_set_text( (GtkEntry *)surf_value_entry, "");
541   else
542   {
543     working_value = value;
544     sprintf( tex_buff, "%d", value);
545     gtk_entry_set_text( (GtkEntry *)surf_value_entry, tex_buff);
546   }
547
548   setup_buttons = FALSE;
549 }
550
551 void SetChangeInFlags_Face_Heretic2 (texdef_to_face_t *texdef_face_list)
552 {
553   texdef_to_face_t *temp_texdef_face_list;
554   texdef_t *tmp_texdef;
555
556   for (temp_texdef_face_list = texdef_face_list; temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next)
557   {
558     tmp_texdef = &temp_texdef_face_list->texdef;
559     tmp_texdef->flags = (tmp_texdef->flags & ~surface_mask) | working_surface_flags;
560     tmp_texdef->contents = (tmp_texdef->contents & ~content_mask) | working_content_flags;
561     tmp_texdef->value = working_value;
562     Sys_Printf("content_flag: %d     content_mask: %d\n",working_content_flags,content_mask);
563     Sys_Printf("content: %d\n",tmp_texdef->contents);
564   }
565 }
566
567 inline void change_surfaceflag (GtkWidget *togglebutton, int sur_flag) // For Material
568 {
569   if (!setup_buttons) // If we're setting up the buttons, we really don't need to
570   {                   // set flags that are already set
571     if (surface_material_inconsistant)
572     {
573       clear_inconsistent( surf_gravel_radiobutton );
574       clear_inconsistent( surf_metal_radiobutton );
575       clear_inconsistent( surf_stone_radiobutton );
576       clear_inconsistent( surf_wood_radiobutton );
577     }
578     surface_mask |= ~HERETIC2_SURF_MATERIAL_MASK;
579     working_surface_flags = (working_surface_flags & HERETIC2_SURF_MATERIAL_MASK) | sur_flag;
580   }
581 }
582
583 inline void change_material (GtkWidget *togglebutton)
584 {
585   if (!setup_buttons) // If we're setting up the buttons, we really don't need to
586   {                   // set flags that are already set
587     if (surface_material_inconsistant)
588     {
589       clear_inconsistent( surf_gravel_radiobutton );
590       clear_inconsistent( surf_metal_radiobutton );
591       clear_inconsistent( surf_stone_radiobutton );
592       clear_inconsistent( surf_wood_radiobutton );
593     }
594     if ( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(surf_gravel_radiobutton))  )
595     {
596       surface_mask |= ~HERETIC2_SURF_MATERIAL_MASK;
597       working_surface_flags = (working_surface_flags & HERETIC2_SURF_MATERIAL_MASK) | HERETIC2_SURF_TYPE_GRAVEL;
598     }
599     else if ( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(surf_metal_radiobutton)) )
600     {
601       surface_mask |= ~HERETIC2_SURF_MATERIAL_MASK;
602       working_surface_flags = (working_surface_flags & HERETIC2_SURF_MATERIAL_MASK) | HERETIC2_SURF_TYPE_METAL;
603     }
604     else if ( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(surf_stone_radiobutton)) )
605     {
606       surface_mask |= ~HERETIC2_SURF_MATERIAL_MASK;
607       working_surface_flags = (working_surface_flags & HERETIC2_SURF_MATERIAL_MASK) | HERETIC2_SURF_TYPE_STONE;
608     }
609     else if ( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(surf_wood_radiobutton)) )
610     {
611       surface_mask |= ~HERETIC2_SURF_MATERIAL_MASK;
612       working_surface_flags = (working_surface_flags & HERETIC2_SURF_MATERIAL_MASK) | HERETIC2_SURF_TYPE_WOOD;
613     }
614   }
615 }
616
617 inline void change_surfaceflag (GtkWidget *togglebutton, int sur_flag, gboolean change_flag_to)
618 {
619
620   if (!setup_buttons) // If we're setting up the buttons, we really don't need to
621   {                   // set flags that are already set
622     if (gtk_toggle_button_get_inconsistent(GTK_TOGGLE_BUTTON (togglebutton))) // Clear out inconsistent, if set
623             clear_inconsistent(GTK_WIDGET (togglebutton));
624
625     surface_mask |= sur_flag;
626
627     if (change_flag_to)
628       working_surface_flags |= sur_flag;
629     else
630       working_surface_flags &= ~sur_flag;
631   }
632 }
633
634 inline void change_contentflag (GtkWidget *togglebutton, int content_flag, gboolean change_flag_to)
635 {
636
637   if ( (!setup_buttons) )  // If we're setting up the buttons, we really don't need to
638   {                        // set flags that are already set
639
640     if (gtk_toggle_button_get_inconsistent(GTK_TOGGLE_BUTTON (togglebutton)))
641             clear_inconsistent(togglebutton);
642     //if (g_ptrSelectedFaces.GetSize() == 0)  // Only changing content flags on whole brushes, not faces.
643     //{
644       content_mask |= content_flag;
645
646     if (change_flag_to)
647       working_content_flags |= content_flag;
648     else
649       working_content_flags &= ~content_flag;
650     //}
651   }
652 }
653
654 // Surface Flags Callbacks
655 void
656 on_surface_lightbutton_toggled         (GtkToggleButton *togglebutton,
657                                         gpointer         user_data)
658 {
659   change_surfaceflag(surface_lightbutton, HERETIC2_SURF_LIGHT, (GTK_TOGGLE_BUTTON (surface_lightbutton)->active));
660 }
661
662
663 void
664 on_surface_slickbutton_toggled         (GtkToggleButton *togglebutton,
665                                         gpointer         user_data)
666 {
667   change_surfaceflag(surface_slickbutton, HERETIC2_SURF_SLICK, (GTK_TOGGLE_BUTTON (surface_slickbutton)->active));
668 }
669
670
671 void
672 on_surface_skybutton_toggled           (GtkToggleButton *togglebutton,
673                                         gpointer         user_data)
674 {
675   change_surfaceflag(surface_skybutton, HERETIC2_SURF_SKY, (GTK_TOGGLE_BUTTON (surface_skybutton)->active));
676 }
677
678
679 void
680 on_surface_warpbutton_toggled          (GtkToggleButton *togglebutton,
681                                         gpointer         user_data)
682 {
683   change_surfaceflag(surface_warpbutton, HERETIC2_SURF_WARP, (GTK_TOGGLE_BUTTON (surface_warpbutton)->active));
684 }
685
686
687 void
688 on_surface_trans33button_toggled       (GtkToggleButton *togglebutton,
689                                         gpointer         user_data)
690 {
691   change_surfaceflag(surface_trans33button, HERETIC2_SURF_TRANS33, (GTK_TOGGLE_BUTTON (surface_trans33button)->active));
692 }
693
694
695 void
696 on_surface_trans66button_toggled       (GtkToggleButton *togglebutton,
697                                         gpointer         user_data)
698 {
699   change_surfaceflag(surface_trans66button, HERETIC2_SURF_TRANS66, (GTK_TOGGLE_BUTTON (surface_trans66button)->active));
700 }
701
702
703 void
704 on_surface_flowingbutton_toggled       (GtkToggleButton *togglebutton,
705                                         gpointer         user_data)
706 {
707   change_surfaceflag(surface_flowingbutton, HERETIC2_SURF_FLOWING, (GTK_TOGGLE_BUTTON (surface_flowingbutton)->active));
708 }
709
710
711 void
712 on_surface_nodrawbutton_toggled        (GtkToggleButton *togglebutton,
713                                         gpointer         user_data)
714 {
715   change_surfaceflag(surface_nodrawbutton, HERETIC2_SURF_NODRAW, (GTK_TOGGLE_BUTTON (surface_nodrawbutton)->active));
716 }
717
718
719 void
720 on_surface_tallwallbutton_toggled      (GtkToggleButton *togglebutton,
721                                         gpointer         user_data)
722 {
723   change_surfaceflag(surface_tallwallbutton, HERETIC2_SURF_TALL_WALL, (GTK_TOGGLE_BUTTON (surface_tallwallbutton)->active));
724 }
725
726
727 void
728 on_surface_alphatexbutton_toggled      (GtkToggleButton *togglebutton,
729                                         gpointer         user_data)
730 {
731   change_surfaceflag(surface_alphatexbutton, HERETIC2_SURF_ALPHA_TEXTURE, (GTK_TOGGLE_BUTTON (surface_alphatexbutton)->active));
732 }
733
734
735 void
736 on_surface_animspeedbutton_toggled     (GtkToggleButton *togglebutton,
737                                         gpointer         user_data)
738 {
739   change_surfaceflag(surface_animspeedbutton, HERETIC2_SURF_ANIMSPEED, (GTK_TOGGLE_BUTTON (surface_animspeedbutton)->active));
740 }
741
742
743 void
744 on_surface_undulatebutton_toggled      (GtkToggleButton *togglebutton,
745                                         gpointer         user_data)
746 {
747   change_surfaceflag(surface_undulatebutton, HERETIC2_SURF_UNDULATE, (GTK_TOGGLE_BUTTON (surface_undulatebutton)->active));
748 }
749
750
751 void
752 on_surf_gravel_radiobutton_toggled     (GtkToggleButton *togglebutton,
753                                         gpointer         user_data)
754 {
755   if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(surf_gravel_radiobutton)))
756     change_material(GTK_WIDGET(togglebutton));
757 }
758
759 void
760 on_surf_metal_radiobutton_toggled     (GtkToggleButton *togglebutton,
761                                         gpointer         user_data)
762 {
763   if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(surf_metal_radiobutton)))
764     change_material(GTK_WIDGET(togglebutton));
765 }
766
767 void
768 on_surf_stone_radiobutton_toggled     (GtkToggleButton *togglebutton,
769                                         gpointer         user_data)
770 {
771   if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(surf_stone_radiobutton)))
772     change_material(GTK_WIDGET(togglebutton));
773 }
774
775 void
776 on_surf_wood_radiobutton_toggled     (GtkToggleButton *togglebutton,
777                                         gpointer         user_data)
778 {
779   if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(surf_wood_radiobutton)))
780     change_material(GTK_WIDGET(togglebutton));
781 }
782
783 // Content Flags Callbacks
784 void
785 on_content_solidbutton_toggled         (GtkToggleButton *togglebutton,
786                                         gpointer         user_data)
787 {
788   change_contentflag(content_solidbutton, HERETIC2_CONTENTS_SOLID, (GTK_TOGGLE_BUTTON (content_solidbutton)->active));
789 }
790
791
792 void
793 on_content_windowbutton_toggled        (GtkToggleButton *togglebutton,
794                                         gpointer         user_data)
795 {
796   change_contentflag(content_windowbutton, HERETIC2_CONTENTS_WINDOW, (GTK_TOGGLE_BUTTON (content_windowbutton)->active));
797 }
798
799
800 void
801 on_content_illusbutton_toggled         (GtkToggleButton *togglebutton,
802                                         gpointer         user_data)
803 {
804   change_contentflag(content_illusbutton, HERETIC2_CONTENTS_ILLUSIONARY, (GTK_TOGGLE_BUTTON (content_illusbutton)->active));
805 }
806
807
808 void
809 on_content_lavabutton_toggled          (GtkToggleButton *togglebutton,
810                                         gpointer         user_data)
811 {
812   change_contentflag(content_lavabutton, HERETIC2_CONTENTS_LAVA, (GTK_TOGGLE_BUTTON (content_lavabutton)->active));
813 }
814
815
816 void
817 on_content_slimebutton_toggled         (GtkToggleButton *togglebutton,
818                                         gpointer         user_data)
819 {
820   change_contentflag(content_slimebutton, HERETIC2_CONTENTS_SLIME, (GTK_TOGGLE_BUTTON (content_slimebutton)->active));
821 }
822
823
824 void
825 on_content_waterbutton_toggled         (GtkToggleButton *togglebutton,
826                                         gpointer         user_data)
827 {
828   change_contentflag(content_waterbutton, HERETIC2_CONTENTS_WATER, (GTK_TOGGLE_BUTTON (content_waterbutton)->active));
829 }
830
831
832 void
833 on_content_mistbutton_toggled          (GtkToggleButton *togglebutton,
834                                         gpointer         user_data)
835 {
836   change_contentflag(content_mistbutton, HERETIC2_CONTENTS_MIST, (GTK_TOGGLE_BUTTON (content_mistbutton)->active));
837 }
838
839
840 void
841 on_content_areaportalbutton_toggled    (GtkToggleButton *togglebutton,
842                                         gpointer         user_data)
843 {
844   change_contentflag(content_areaportalbutton, HERETIC2_CONTENTS_AREAPORTAL, (GTK_TOGGLE_BUTTON (content_areaportalbutton)->active));
845 }
846
847
848 void
849 on_content_playerclipbutton_toggled    (GtkToggleButton *togglebutton,
850                                         gpointer         user_data)
851 {
852   change_contentflag(content_playerclipbutton, HERETIC2_CONTENTS_PLAYERCLIP, (GTK_TOGGLE_BUTTON (content_playerclipbutton)->active));
853 }
854
855
856 void
857 on_content_monsterclipbutton_toggled   (GtkToggleButton *togglebutton,
858                                         gpointer         user_data)
859 {
860   change_contentflag(content_monsterclipbutton, HERETIC2_CONTENTS_MONSTERCLIP, (GTK_TOGGLE_BUTTON (content_monsterclipbutton)->active));
861 }
862
863
864 void
865 on_content_current0button_toggled      (GtkToggleButton *togglebutton,
866                                         gpointer         user_data)
867 {
868   change_contentflag(content_current0button, HERETIC2_CONTENTS_CURRENT_0, (GTK_TOGGLE_BUTTON (content_current0button)->active));
869 }
870
871
872 void
873 on_content_current90button_toggled     (GtkToggleButton *togglebutton,
874                                         gpointer         user_data)
875 {
876   change_contentflag(content_current90button, HERETIC2_CONTENTS_CURRENT_90, (GTK_TOGGLE_BUTTON (content_current90button)->active));
877 }
878
879
880 void
881 on_content_current180button_toggled    (GtkToggleButton *togglebutton,
882                                         gpointer         user_data)
883 {
884   change_contentflag(content_current180button, HERETIC2_CONTENTS_CURRENT_180, (GTK_TOGGLE_BUTTON (content_current180button)->active));
885 }
886
887
888 void
889 on_content_current270button_toggled    (GtkToggleButton *togglebutton,
890                                         gpointer         user_data)
891 {
892   change_contentflag(content_current270button, HERETIC2_CONTENTS_CURRENT_270, (GTK_TOGGLE_BUTTON (content_current270button)->active));
893 }
894
895
896 void
897 on_content_currentUPbutton_toggled     (GtkToggleButton *togglebutton,
898                                         gpointer         user_data)
899 {
900   change_contentflag(content_currentUPbutton, HERETIC2_CONTENTS_CURRENT_UP, (GTK_TOGGLE_BUTTON (content_currentUPbutton)->active));
901 }
902
903
904 void
905 on_content_currentDOWNbutton_toggled   (GtkToggleButton *togglebutton,
906                                         gpointer         user_data)
907 {
908   change_contentflag(content_currentDOWNbutton, HERETIC2_CONTENTS_CURRENT_DOWN, (GTK_TOGGLE_BUTTON (content_currentDOWNbutton)->active));
909 }
910
911
912 void
913 on_content_originbutton_toggled        (GtkToggleButton *togglebutton,
914                                         gpointer         user_data)
915 {
916   change_contentflag(content_originbutton, HERETIC2_CONTENTS_ORIGIN, (GTK_TOGGLE_BUTTON (content_originbutton)->active));
917 }
918
919
920 void
921 on_content_detailbutton_toggled        (GtkToggleButton *togglebutton,
922                                         gpointer         user_data)
923 {
924   change_contentflag(content_detailbutton, HERETIC2_CONTENTS_DETAIL, (GTK_TOGGLE_BUTTON (content_detailbutton)->active));
925 }
926
927
928 void
929 on_content_ladderbutton_toggled        (GtkToggleButton *togglebutton,
930                                         gpointer         user_data)
931 {
932   change_contentflag(content_ladderbutton, HERETIC2_CONTENTS_LADDER, (GTK_TOGGLE_BUTTON (content_ladderbutton)->active));
933 }
934
935
936 void
937 on_content_camnoblockbutton_toggled    (GtkToggleButton *togglebutton,
938                                         gpointer         user_data)
939 {
940   change_contentflag(content_camnoblockbutton, HERETIC2_CONTENTS_CAMERANOBLOCK, (GTK_TOGGLE_BUTTON (content_camnoblockbutton)->active));
941 }
942
943 // Value Entry Callback
944 void
945 on_surf_value_entry_changed             (GtkEditable     *editable,
946                                         gpointer         user_data)
947 {
948   if ( (!setup_buttons) )  // If we're setting up the buttons, don't change value
949     working_value = atoi( gtk_entry_get_text( (GtkEntry*)editable) );
950 }
951
952 void
953 on_surf_value_entry_insert_text         (GtkEditable     *editable,
954                                         gchar           *new_text,
955                                         gint             new_text_length,
956                                         gint            *position,
957                                         gpointer         user_data)
958 {
959   int i, count=0;
960   gchar *result;
961   int entry_value;
962   texdef_t *pt;
963   brush_t *b;
964   face_t *f;
965
966   // Limit input to digits, throwing out anything else
967   // Modified from Gtk FAQ for text filtering of GtkEntry
968   result = g_new (gchar, new_text_length);
969
970   for (i=0; i < new_text_length; i++) {
971     if (!isdigit(new_text[i]))
972       continue;
973   result[count++] = new_text[i];
974   }
975
976   if (count > 0) {
977     gtk_signal_handler_block_by_func (GTK_OBJECT (editable),
978                                       GTK_SIGNAL_FUNC (on_surf_value_entry_insert_text),
979                                       user_data);
980     gtk_editable_insert_text (editable, result, count, position);
981     gtk_signal_handler_unblock_by_func (GTK_OBJECT (editable),
982                                         GTK_SIGNAL_FUNC (on_surf_value_entry_insert_text),
983                                         user_data);
984   }
985   gtk_signal_emit_stop_by_name (GTK_OBJECT (editable), "insert_text");
986
987   g_free (result);
988 }
989
990 #define HERETIC2_FLAG_BUTTON_BORDER 3
991
992 GtkWidget* Create_Heretic2FlagsDialog (GtkWidget* surfacedialog_widget)
993 {
994   GtkWidget *frame1;
995   GtkWidget *notebook1;
996   GtkWidget *vbox3;
997   GtkWidget *table1;
998   GtkWidget *frame2;
999   GtkWidget *hbox4;
1000   GtkWidget *label4;
1001   GtkWidget *vbox4;
1002   GtkWidget *table3;
1003   GtkWidget *label5;
1004
1005   GtkWidget *hbox1;
1006   GtkWidget *hbox2;
1007   GtkWidget *label2;
1008   GtkWidget *table2;
1009   GtkWidget *label3;
1010
1011
1012   frame1 = gtk_frame_new ("Brush/Face Flags");
1013   gtk_widget_show (frame1);
1014   gtk_container_add (GTK_CONTAINER (surfacedialog_widget), frame1);
1015
1016   notebook1 = gtk_notebook_new ();
1017   gtk_widget_show (notebook1);
1018   gtk_container_add (GTK_CONTAINER (frame1), notebook1);
1019
1020   vbox3 = gtk_vbox_new (FALSE, 0);
1021   gtk_widget_show (vbox3);
1022   gtk_container_add (GTK_CONTAINER (notebook1), vbox3);
1023
1024   table1 = gtk_table_new (3, 4, TRUE);
1025   gtk_widget_show (table1);
1026   gtk_box_pack_start (GTK_BOX (vbox3), table1, TRUE, TRUE, 0);
1027
1028   surface_lightbutton = gtk_toggle_button_new_with_mnemonic ("Light");
1029   gtk_widget_show (surface_lightbutton);
1030   gtk_table_attach (GTK_TABLE (table1), surface_lightbutton, 0, 1, 0, 1,
1031                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
1032                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
1033
1034   surface_slickbutton = gtk_toggle_button_new_with_mnemonic ("Slick");
1035   gtk_widget_show (surface_slickbutton);
1036   gtk_table_attach (GTK_TABLE (table1), surface_slickbutton, 1, 2, 0, 1,
1037                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
1038                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
1039
1040   surface_skybutton = gtk_toggle_button_new_with_mnemonic ("Sky");
1041   gtk_widget_show (surface_skybutton);
1042   gtk_table_attach (GTK_TABLE (table1), surface_skybutton, 2, 3, 0, 1,
1043                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
1044                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
1045
1046   surface_warpbutton = gtk_toggle_button_new_with_mnemonic ("Warp");
1047   gtk_widget_show (surface_warpbutton);
1048   gtk_table_attach (GTK_TABLE (table1), surface_warpbutton, 3, 4, 0, 1,
1049                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
1050                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
1051
1052   surface_trans33button = gtk_toggle_button_new_with_mnemonic ("Trans33");
1053   gtk_widget_show (surface_trans33button);
1054   gtk_table_attach (GTK_TABLE (table1), surface_trans33button, 0, 1, 1, 2,
1055                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
1056                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
1057
1058   surface_trans66button = gtk_toggle_button_new_with_mnemonic ("Trans66");
1059   gtk_widget_show (surface_trans66button);
1060   gtk_table_attach (GTK_TABLE (table1), surface_trans66button, 1, 2, 1, 2,
1061                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
1062                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
1063
1064   surface_flowingbutton = gtk_toggle_button_new_with_mnemonic ("Flowing");
1065   gtk_widget_show (surface_flowingbutton);
1066   gtk_table_attach (GTK_TABLE (table1), surface_flowingbutton, 2, 3, 1, 2,
1067                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
1068                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
1069
1070   surface_nodrawbutton = gtk_toggle_button_new_with_mnemonic ("NoDraw");
1071   gtk_widget_show (surface_nodrawbutton);
1072   gtk_table_attach (GTK_TABLE (table1), surface_nodrawbutton, 3, 4, 1, 2,
1073                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
1074                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
1075
1076   surface_tallwallbutton = gtk_toggle_button_new_with_mnemonic ("TallWall");
1077   gtk_widget_show (surface_tallwallbutton);
1078   gtk_table_attach (GTK_TABLE (table1), surface_tallwallbutton, 0, 1, 2, 3,
1079                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
1080                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
1081
1082   surface_alphatexbutton = gtk_toggle_button_new_with_mnemonic ("AlphaTex");
1083   gtk_widget_show (surface_alphatexbutton);
1084   gtk_table_attach (GTK_TABLE (table1), surface_alphatexbutton, 1, 2, 2, 3,
1085                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
1086                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
1087
1088   surface_animspeedbutton = gtk_toggle_button_new_with_mnemonic ("AnimSpeed");
1089   gtk_widget_show (surface_animspeedbutton);
1090   gtk_table_attach (GTK_TABLE (table1), surface_animspeedbutton, 2, 3, 2, 3,
1091                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
1092                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
1093
1094   surface_undulatebutton = gtk_toggle_button_new_with_mnemonic ("Undulate");
1095   gtk_widget_show (surface_undulatebutton);
1096   gtk_table_attach (GTK_TABLE (table1), surface_undulatebutton, 3, 4, 2, 3,
1097                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
1098                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
1099
1100   frame2 = gtk_frame_new (NULL);
1101   gtk_widget_show (frame2);
1102   gtk_box_pack_start (GTK_BOX (vbox3), frame2, FALSE, FALSE, 0);
1103   gtk_frame_set_shadow_type (GTK_FRAME (frame2), GTK_SHADOW_ETCHED_OUT);
1104   gtk_container_set_border_width (GTK_CONTAINER (frame2), 4);
1105
1106   hbox4 = gtk_hbox_new (FALSE, 0);
1107   gtk_widget_show (hbox4);
1108   gtk_container_add (GTK_CONTAINER (frame2), hbox4);
1109
1110   surf_gravel_radiobutton = gtk_radio_button_new_with_mnemonic (NULL, "Gravel");
1111   gtk_widget_show (surf_gravel_radiobutton);
1112   gtk_box_pack_start (GTK_BOX (hbox4), surf_gravel_radiobutton, TRUE, FALSE, 0);
1113
1114   surf_metal_radiobutton = gtk_radio_button_new_with_mnemonic_from_widget (GTK_RADIO_BUTTON(surf_gravel_radiobutton), "Metal");
1115   gtk_widget_show (surf_metal_radiobutton);
1116   gtk_box_pack_start (GTK_BOX (hbox4), surf_metal_radiobutton, TRUE, FALSE, 0);
1117
1118   surf_stone_radiobutton = gtk_radio_button_new_with_mnemonic_from_widget (GTK_RADIO_BUTTON(surf_metal_radiobutton), "Stone");
1119   gtk_widget_show (surf_stone_radiobutton);
1120   gtk_box_pack_start (GTK_BOX (hbox4), surf_stone_radiobutton, TRUE, FALSE, 0);
1121
1122   surf_wood_radiobutton = gtk_radio_button_new_with_mnemonic_from_widget (GTK_RADIO_BUTTON(surf_stone_radiobutton), "Wood");
1123   gtk_widget_show (surf_wood_radiobutton);
1124   gtk_box_pack_start (GTK_BOX (hbox4), surf_wood_radiobutton, TRUE, FALSE, 0);
1125
1126   label4 = gtk_label_new ("Material");
1127   gtk_widget_show (label4);
1128   gtk_frame_set_label_widget (GTK_FRAME (frame2), label4);
1129   gtk_label_set_justify (GTK_LABEL (label4), GTK_JUSTIFY_LEFT);
1130
1131   table3 = gtk_table_new (1, 4, FALSE);
1132   gtk_widget_show (table3);
1133   gtk_box_pack_start (GTK_BOX (vbox3), table3, FALSE, FALSE, 0);
1134   gtk_container_set_border_width (GTK_CONTAINER (table3), 3);
1135
1136   hbox1 = gtk_hbox_new (FALSE, 0);
1137   gtk_widget_show (hbox1);
1138   gtk_table_attach (GTK_TABLE (table3), hbox1, 0, 1, 0, 1,
1139                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
1140                     (GtkAttachOptions) (GTK_FILL), 0, 0);
1141
1142   label5 = gtk_label_new ("Value: ");
1143   gtk_widget_show (label5);
1144   gtk_table_attach (GTK_TABLE (table3), label5, 1, 2, 0, 1,
1145                     (GtkAttachOptions) (0),
1146                     (GtkAttachOptions) (0), 0, 0);
1147   gtk_misc_set_alignment (GTK_MISC (label5), 0, 0);
1148   gtk_label_set_justify (GTK_LABEL (label5), GTK_JUSTIFY_RIGHT);
1149
1150   surf_value_entry = gtk_entry_new ();
1151   gtk_widget_show (surf_value_entry);
1152   gtk_table_attach (GTK_TABLE (table3), surf_value_entry, 2, 3, 0, 1,
1153                     (GtkAttachOptions) (GTK_FILL),
1154                     (GtkAttachOptions) (0), 0, 0);
1155
1156   hbox2 = gtk_hbox_new (FALSE, 0);
1157   gtk_widget_show (hbox2);
1158   gtk_table_attach (GTK_TABLE (table3), hbox2, 3, 4, 0, 1,
1159                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
1160                     (GtkAttachOptions) (GTK_FILL), 0, 0);
1161
1162   label2 = gtk_label_new ("Surface Flags");
1163   gtk_widget_show (label2);
1164   gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 0), label2);
1165   gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_LEFT);
1166
1167   table2 = gtk_table_new (5, 4, TRUE);
1168   gtk_widget_show (table2);
1169   gtk_container_add (GTK_CONTAINER (notebook1), table2);
1170
1171   content_solidbutton = gtk_toggle_button_new_with_mnemonic ("Solid");
1172   gtk_widget_show (content_solidbutton);
1173   gtk_table_attach (GTK_TABLE (table2), content_solidbutton, 0, 1, 0, 1,
1174                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
1175                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
1176
1177   content_windowbutton = gtk_toggle_button_new_with_mnemonic ("Window");
1178   gtk_widget_show (content_windowbutton);
1179   gtk_table_attach (GTK_TABLE (table2), content_windowbutton, 1, 2, 0, 1,
1180                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
1181                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
1182
1183   content_illusbutton = gtk_toggle_button_new_with_mnemonic ("Illusion");
1184   gtk_widget_show (content_illusbutton);
1185   gtk_table_attach (GTK_TABLE (table2), content_illusbutton, 2, 3, 0, 1,
1186                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
1187                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
1188
1189   content_lavabutton = gtk_toggle_button_new_with_mnemonic ("Lava");
1190   gtk_widget_show (content_lavabutton);
1191   gtk_table_attach (GTK_TABLE (table2), content_lavabutton, 3, 4, 0, 1,
1192                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
1193                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
1194
1195   content_slimebutton = gtk_toggle_button_new_with_mnemonic ("Slime");
1196   gtk_widget_show (content_slimebutton);
1197   gtk_table_attach (GTK_TABLE (table2), content_slimebutton, 0, 1, 1, 2,
1198                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
1199                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
1200
1201   content_waterbutton = gtk_toggle_button_new_with_mnemonic ("Water");
1202   gtk_widget_show (content_waterbutton);
1203   gtk_table_attach (GTK_TABLE (table2), content_waterbutton, 1, 2, 1, 2,
1204                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
1205                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
1206
1207   content_mistbutton = gtk_toggle_button_new_with_mnemonic ("Mist");
1208   gtk_widget_show (content_mistbutton);
1209   gtk_table_attach (GTK_TABLE (table2), content_mistbutton, 2, 3, 1, 2,
1210                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
1211                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
1212
1213   content_areaportalbutton = gtk_toggle_button_new_with_mnemonic ("AreaPortal");
1214   gtk_widget_show (content_areaportalbutton);
1215   gtk_table_attach (GTK_TABLE (table2), content_areaportalbutton, 3, 4, 1, 2,
1216                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
1217                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
1218
1219   content_playerclipbutton = gtk_toggle_button_new_with_mnemonic ("PlayerClip");
1220   gtk_widget_show (content_playerclipbutton);
1221   gtk_table_attach (GTK_TABLE (table2), content_playerclipbutton, 0, 1, 2, 3,
1222                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
1223                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
1224
1225   content_monsterclipbutton = gtk_toggle_button_new_with_mnemonic ("MonsterClip");
1226   gtk_widget_show (content_monsterclipbutton);
1227   gtk_table_attach (GTK_TABLE (table2), content_monsterclipbutton, 1, 2, 2, 3,
1228                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
1229                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
1230
1231   content_current0button = gtk_toggle_button_new_with_mnemonic ("Current 0");
1232   gtk_widget_show (content_current0button);
1233   gtk_table_attach (GTK_TABLE (table2), content_current0button, 2, 3, 2, 3,
1234                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
1235                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
1236
1237   content_current90button = gtk_toggle_button_new_with_mnemonic ("Current 90");
1238   gtk_widget_show (content_current90button);
1239   gtk_table_attach (GTK_TABLE (table2), content_current90button, 3, 4, 2, 3,
1240                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
1241                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
1242
1243   content_current180button = gtk_toggle_button_new_with_mnemonic ("Current 180");
1244   gtk_widget_show (content_current180button);
1245   gtk_table_attach (GTK_TABLE (table2), content_current180button, 0, 1, 3, 4,
1246                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
1247                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
1248
1249   content_current270button = gtk_toggle_button_new_with_mnemonic ("Current 270");
1250   gtk_widget_show (content_current270button);
1251   gtk_table_attach (GTK_TABLE (table2), content_current270button, 1, 2, 3, 4,
1252                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
1253                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
1254
1255   content_currentUPbutton = gtk_toggle_button_new_with_mnemonic ("Current UP");
1256   gtk_widget_show (content_currentUPbutton);
1257   gtk_table_attach (GTK_TABLE (table2), content_currentUPbutton, 2, 3, 3, 4,
1258                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
1259                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
1260
1261   content_currentDOWNbutton = gtk_toggle_button_new_with_mnemonic ("Current DOWN");
1262   gtk_widget_show (content_currentDOWNbutton);
1263   gtk_table_attach (GTK_TABLE (table2), content_currentDOWNbutton, 3, 4, 3, 4,
1264                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
1265                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
1266
1267   content_originbutton = gtk_toggle_button_new_with_mnemonic ("Origin");
1268   gtk_widget_show (content_originbutton);
1269   gtk_table_attach (GTK_TABLE (table2), content_originbutton, 0, 1, 4, 5,
1270                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
1271                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
1272
1273   content_detailbutton = gtk_toggle_button_new_with_mnemonic ("Detail");
1274   gtk_widget_show (content_detailbutton);
1275   gtk_table_attach (GTK_TABLE (table2), content_detailbutton, 1, 2, 4, 5,
1276                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
1277                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
1278
1279   content_ladderbutton = gtk_toggle_button_new_with_mnemonic ("Ladder");
1280   gtk_widget_show (content_ladderbutton);
1281   gtk_table_attach (GTK_TABLE (table2), content_ladderbutton, 2, 3, 4, 5,
1282                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
1283                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
1284
1285   content_camnoblockbutton = gtk_toggle_button_new_with_mnemonic ("Cam No Block");
1286   gtk_widget_show (content_camnoblockbutton);
1287   gtk_table_attach (GTK_TABLE (table2), content_camnoblockbutton, 3, 4, 4, 5,
1288                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
1289                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
1290
1291   label3 = gtk_label_new ("Content Flags");
1292   gtk_widget_show (label3);
1293   gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 1), label3);
1294   gtk_label_set_justify (GTK_LABEL (label3), GTK_JUSTIFY_LEFT);
1295
1296   // Signal Connects
1297   g_signal_connect ((gpointer) surface_lightbutton, "toggled",
1298                     G_CALLBACK (on_surface_lightbutton_toggled),
1299                     NULL);
1300   g_signal_connect ((gpointer) surface_slickbutton, "toggled",
1301                     G_CALLBACK (on_surface_slickbutton_toggled),
1302                     NULL);
1303   g_signal_connect ((gpointer) surface_skybutton, "toggled",
1304                     G_CALLBACK (on_surface_skybutton_toggled),
1305                     NULL);
1306   g_signal_connect ((gpointer) surface_warpbutton, "toggled",
1307                     G_CALLBACK (on_surface_warpbutton_toggled),
1308                     NULL);
1309   g_signal_connect ((gpointer) surface_trans33button, "toggled",
1310                     G_CALLBACK (on_surface_trans33button_toggled),
1311                     NULL);
1312   g_signal_connect ((gpointer) surface_trans66button, "toggled",
1313                     G_CALLBACK (on_surface_trans66button_toggled),
1314                     NULL);
1315   g_signal_connect ((gpointer) surface_flowingbutton, "toggled",
1316                     G_CALLBACK (on_surface_flowingbutton_toggled),
1317                     NULL);
1318   g_signal_connect ((gpointer) surface_nodrawbutton, "toggled",
1319                     G_CALLBACK (on_surface_nodrawbutton_toggled),
1320                     NULL);
1321   g_signal_connect ((gpointer) surface_tallwallbutton, "toggled",
1322                     G_CALLBACK (on_surface_tallwallbutton_toggled),
1323                     NULL);
1324   g_signal_connect ((gpointer) surface_alphatexbutton, "toggled",
1325                     G_CALLBACK (on_surface_alphatexbutton_toggled),
1326                     NULL);
1327   g_signal_connect ((gpointer) surface_animspeedbutton, "toggled",
1328                     G_CALLBACK (on_surface_animspeedbutton_toggled),
1329                     NULL);
1330   g_signal_connect ((gpointer) surface_undulatebutton, "toggled",
1331                     G_CALLBACK (on_surface_undulatebutton_toggled),
1332                     NULL);
1333
1334   g_signal_connect ((gpointer) surf_gravel_radiobutton, "toggled",
1335                     G_CALLBACK (on_surf_gravel_radiobutton_toggled),
1336                     NULL);
1337   g_signal_connect ((gpointer) surf_metal_radiobutton, "toggled",
1338                     G_CALLBACK (on_surf_metal_radiobutton_toggled),
1339                     NULL);
1340   g_signal_connect ((gpointer) surf_stone_radiobutton, "toggled",
1341                     G_CALLBACK (on_surf_stone_radiobutton_toggled),
1342                     NULL);
1343   g_signal_connect ((gpointer) surf_wood_radiobutton, "toggled",
1344                     G_CALLBACK (on_surf_wood_radiobutton_toggled),
1345                     NULL);
1346
1347   g_signal_connect ((gpointer) surf_value_entry, "changed",
1348                     G_CALLBACK (on_surf_value_entry_changed),
1349                     NULL);
1350   g_signal_connect ((gpointer) surf_value_entry, "insert_text",
1351                     G_CALLBACK (on_surf_value_entry_insert_text),
1352                     NULL);
1353   g_signal_connect ((gpointer) content_solidbutton, "toggled",
1354                     G_CALLBACK (on_content_solidbutton_toggled),
1355                     NULL);
1356   g_signal_connect ((gpointer) content_windowbutton, "toggled",
1357                     G_CALLBACK (on_content_windowbutton_toggled),
1358                     NULL);
1359   g_signal_connect ((gpointer) content_illusbutton, "toggled",
1360                     G_CALLBACK (on_content_illusbutton_toggled),
1361                     NULL);
1362   g_signal_connect ((gpointer) content_lavabutton, "toggled",
1363                     G_CALLBACK (on_content_lavabutton_toggled),
1364                     NULL);
1365   g_signal_connect ((gpointer) content_slimebutton, "toggled",
1366                     G_CALLBACK (on_content_slimebutton_toggled),
1367                     NULL);
1368   g_signal_connect ((gpointer) content_waterbutton, "toggled",
1369                     G_CALLBACK (on_content_waterbutton_toggled),
1370                     NULL);
1371   g_signal_connect ((gpointer) content_mistbutton, "toggled",
1372                     G_CALLBACK (on_content_mistbutton_toggled),
1373                     NULL);
1374   g_signal_connect ((gpointer) content_areaportalbutton, "toggled",
1375                     G_CALLBACK (on_content_areaportalbutton_toggled),
1376                     NULL);
1377   g_signal_connect ((gpointer) content_playerclipbutton, "toggled",
1378                     G_CALLBACK (on_content_playerclipbutton_toggled),
1379                     NULL);
1380   g_signal_connect ((gpointer) content_monsterclipbutton, "toggled",
1381                     G_CALLBACK (on_content_monsterclipbutton_toggled),
1382                     NULL);
1383   g_signal_connect ((gpointer) content_current0button, "toggled",
1384                     G_CALLBACK (on_content_current0button_toggled),
1385                     NULL);
1386   g_signal_connect ((gpointer) content_current90button, "toggled",
1387                     G_CALLBACK (on_content_current90button_toggled),
1388                     NULL);
1389   g_signal_connect ((gpointer) content_current180button, "toggled",
1390                     G_CALLBACK (on_content_current180button_toggled),
1391                     NULL);
1392   g_signal_connect ((gpointer) content_current270button, "toggled",
1393                     G_CALLBACK (on_content_current270button_toggled),
1394                     NULL);
1395   g_signal_connect ((gpointer) content_currentUPbutton, "toggled",
1396                     G_CALLBACK (on_content_currentUPbutton_toggled),
1397                     NULL);
1398   g_signal_connect ((gpointer) content_currentDOWNbutton, "toggled",
1399                     G_CALLBACK (on_content_currentDOWNbutton_toggled),
1400                     NULL);
1401   g_signal_connect ((gpointer) content_originbutton, "toggled",
1402                     G_CALLBACK (on_content_originbutton_toggled),
1403                     NULL);
1404   g_signal_connect ((gpointer) content_detailbutton, "toggled",
1405                     G_CALLBACK (on_content_detailbutton_toggled),
1406                     NULL);
1407   g_signal_connect ((gpointer) content_ladderbutton, "toggled",
1408                     G_CALLBACK (on_content_ladderbutton_toggled),
1409                     NULL);
1410   g_signal_connect ((gpointer) content_camnoblockbutton, "toggled",
1411                     G_CALLBACK (on_content_camnoblockbutton_toggled),
1412                     NULL);
1413
1414
1415   return frame1;
1416 }
1417