]> git.xonotic.org Git - xonotic/netradiant.git/blob - plugins/surface_quake2/surfaceflagsdialog_quake2.cpp
Fixing Linux SCons build.
[xonotic/netradiant.git] / plugins / surface_quake2 / surfaceflagsdialog_quake2.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 #include <glib/gi18n.h>
25
26 #include "surfdlg_plugin.h"
27
28 #include "surfaceflagsdialog_quake2.h"
29
30   GtkWidget *notebook1;
31
32   GtkWidget *surface_lightbutton;
33   GtkWidget *surface_slickbutton;
34   GtkWidget *surface_skybutton;
35   GtkWidget *surface_warpbutton;
36   GtkWidget *surface_trans33button;
37   GtkWidget *surface_trans66button;
38   GtkWidget *surface_flowingbutton;
39   GtkWidget *surface_nodrawbutton;
40   GtkWidget *surface_hintbutton;
41   GtkWidget *surface_skipbutton;
42
43   GtkWidget *content_solidbutton;
44   GtkWidget *content_windowbutton;
45   GtkWidget *content_auxbutton;
46   GtkWidget *content_lavabutton;
47   GtkWidget *content_slimebutton;
48   GtkWidget *content_waterbutton;
49   GtkWidget *content_mistbutton;
50   GtkWidget *content_areaportalbutton;
51   GtkWidget *content_playerclipbutton;
52   GtkWidget *content_monsterclipbutton;
53   GtkWidget *content_current0button;
54   GtkWidget *content_current90button;
55   GtkWidget *content_current180button;
56   GtkWidget *content_current270button;
57   GtkWidget *content_currentUPbutton;
58   GtkWidget *content_currentDOWNbutton;
59   GtkWidget *content_originbutton;
60   GtkWidget *content_detailbutton;
61   GtkWidget *content_translucentbutton;
62   GtkWidget *content_ladderbutton;
63
64   GtkWidget *surfacebutton;
65   GtkWidget *contentbutton;
66
67   GtkWidget *value_entry;
68   gboolean setup_buttons = TRUE;
69
70   int working_surface_flags;
71   int surface_mask;
72   int working_content_flags;
73   int content_mask;
74   int working_value;
75
76 inline void set_inconsistent(GtkWidget *toggle_button)
77 {
78   gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON (toggle_button), TRUE);
79 }
80
81 inline void clear_inconsistent(GtkWidget *toggle_button)
82 {
83   if ( gtk_toggle_button_get_inconsistent(GTK_TOGGLE_BUTTON (toggle_button)) )
84   {
85     gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON (toggle_button), FALSE);
86   }
87 }
88
89 void clear_all_inconsistent(void)
90 {
91   clear_inconsistent( surface_lightbutton );
92   clear_inconsistent( surface_slickbutton );
93   clear_inconsistent( surface_skybutton );
94   clear_inconsistent( surface_warpbutton );
95   clear_inconsistent( surface_trans33button );
96   clear_inconsistent( surface_trans66button );
97   clear_inconsistent( surface_flowingbutton );
98   clear_inconsistent( surface_nodrawbutton );
99   clear_inconsistent( surface_hintbutton );
100   clear_inconsistent( surface_skipbutton );
101
102   clear_inconsistent( content_solidbutton );
103   clear_inconsistent( content_windowbutton );
104   clear_inconsistent( content_auxbutton );
105   clear_inconsistent( content_lavabutton );
106   clear_inconsistent( content_slimebutton );
107   clear_inconsistent( content_waterbutton );
108   clear_inconsistent( content_mistbutton );
109   clear_inconsistent( content_areaportalbutton );
110   clear_inconsistent( content_playerclipbutton );
111   clear_inconsistent( content_monsterclipbutton );
112   clear_inconsistent( content_current0button );
113   clear_inconsistent( content_current90button );
114   clear_inconsistent( content_current180button );
115   clear_inconsistent( content_current270button );
116   clear_inconsistent( content_currentUPbutton );
117   clear_inconsistent( content_currentDOWNbutton );
118   clear_inconsistent( content_originbutton );
119   clear_inconsistent( content_detailbutton );
120   clear_inconsistent( content_translucentbutton );
121   clear_inconsistent( content_ladderbutton );
122 }
123
124 void clear_all_buttons_and_values()
125 {
126   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surface_lightbutton ), FALSE);
127   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surface_slickbutton ), FALSE);
128   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surface_skybutton ), FALSE);
129   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surface_warpbutton ), FALSE);
130   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surface_trans33button ), FALSE);
131   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surface_trans66button ), FALSE);
132   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surface_flowingbutton ), FALSE);
133   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surface_nodrawbutton ), FALSE);
134   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surface_hintbutton ), FALSE);
135   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surface_skipbutton ), FALSE);
136
137   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_solidbutton ), FALSE);
138   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_windowbutton ), FALSE);
139   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_auxbutton ), FALSE);
140   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_lavabutton ), FALSE);
141   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_slimebutton ), FALSE);
142   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_waterbutton ), FALSE);
143   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_mistbutton ), FALSE);
144   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_areaportalbutton ), FALSE);
145   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_playerclipbutton ), FALSE);
146   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_monsterclipbutton ), FALSE);
147   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_current0button ), FALSE);
148   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_current90button ), FALSE);
149   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_current180button ), FALSE);
150   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_current270button ), FALSE);
151   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_currentUPbutton ), FALSE);
152   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_currentDOWNbutton ), FALSE);
153   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_originbutton ), FALSE);
154   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_detailbutton ), FALSE);
155   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_translucentbutton ), FALSE);
156   gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_ladderbutton ), FALSE);
157
158   gtk_entry_set_text( (GtkEntry *)value_entry, "");
159 }
160
161 void SetFlagButtons_Quake2(texdef_to_face_t *texdef_face_list, bool b_isListEmpty)
162 {
163   int contents = 0;
164   int flags = 0;
165   int value = 0;
166   int diff_contents = 0;
167   int diff_flags = 0;
168   gboolean diff_value = FALSE;
169   char tex_buff[11];
170   texdef_t* tmp_texdef;
171   texdef_to_face_t* temp_texdef_face_list;
172
173
174   setup_buttons = TRUE;
175   working_surface_flags = 0;
176   surface_mask = 0;
177   working_content_flags = 0;
178   content_mask = 0;
179   working_value = 0;
180
181   if(!b_isListEmpty)
182   {
183     tmp_texdef = &texdef_face_list->texdef;
184     contents = tmp_texdef->contents;
185     flags = tmp_texdef->flags;
186     value = tmp_texdef->value;
187
188     Sys_Printf("Surface: %d\tContents: %d\tValue: %d\ttmp_texdef\n",tmp_texdef->flags,tmp_texdef->contents,tmp_texdef->value);
189     Sys_Printf("Surface: %d\tContents: %d\tValue: %d\n",flags,contents,value);
190
191     for (temp_texdef_face_list = texdef_face_list->next; temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next)
192     {
193       tmp_texdef = &temp_texdef_face_list->texdef;
194       diff_contents |= contents ^ tmp_texdef->contents;  // Figure out which buttons are inconsistent
195       diff_flags |= flags ^ tmp_texdef->flags;
196       if (tmp_texdef->value != value)
197         diff_value = TRUE;
198
199       Sys_Printf("Surface: %d\tContents: %d\tValue: %d\ttmp_texdef\n",tmp_texdef->flags,tmp_texdef->contents,tmp_texdef->value);
200       Sys_Printf("Surface: %d\tContents: %d\tValue: %d\n",flags,contents,value);
201
202     }
203   }
204
205
206
207   clear_all_inconsistent();
208
209   // If no faces/brushes are selected, clear everything and bail
210    if(b_isListEmpty)
211   {
212     clear_all_buttons_and_values();
213     setup_buttons = FALSE;
214     return;
215   }
216
217   // Set surface buttons to reflect brush/face flags, contents, and values
218   if(diff_flags & QUAKE2_SURF_LIGHT)
219     set_inconsistent(surface_lightbutton);
220   else if(flags & QUAKE2_SURF_LIGHT)
221         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (surface_lightbutton), TRUE);
222   else
223         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (surface_lightbutton), FALSE);
224
225   if(diff_flags & QUAKE2_SURF_SLICK)
226     set_inconsistent(surface_slickbutton);
227   else if(flags & QUAKE2_SURF_SLICK)
228         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surface_slickbutton ), TRUE);
229   else
230         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surface_slickbutton ), FALSE);
231
232   if(diff_flags & QUAKE2_SURF_SKY)
233     set_inconsistent(surface_skybutton);
234   else if(flags & QUAKE2_SURF_SKY)
235         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surface_skybutton ), TRUE);
236   else
237         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surface_skybutton ), FALSE);
238
239   if(diff_flags & QUAKE2_SURF_WARP)
240     set_inconsistent(surface_warpbutton);
241   else if(flags & QUAKE2_SURF_WARP)
242         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surface_warpbutton ), TRUE);
243   else
244         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surface_warpbutton ), FALSE);
245
246   if(diff_flags & QUAKE2_SURF_TRANS33)
247     set_inconsistent(surface_trans33button);
248   else if(flags & QUAKE2_SURF_TRANS33)
249         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surface_trans33button ), TRUE);
250   else
251         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surface_trans33button ), FALSE);
252
253   if(diff_flags & QUAKE2_SURF_TRANS66)
254     set_inconsistent(surface_trans66button);
255   else if(flags & QUAKE2_SURF_TRANS66)
256         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surface_trans66button ), TRUE);
257   else
258         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surface_trans66button ), FALSE);
259
260   if(diff_flags & QUAKE2_SURF_FLOWING)
261     set_inconsistent(surface_flowingbutton);
262   else if(flags & QUAKE2_SURF_FLOWING)
263         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surface_flowingbutton ), TRUE);
264   else
265         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surface_flowingbutton ), FALSE);
266
267   if(diff_flags & QUAKE2_SURF_NODRAW)
268     set_inconsistent(surface_nodrawbutton);
269   else if(flags & QUAKE2_SURF_NODRAW)
270         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surface_nodrawbutton ), TRUE);
271   else
272         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surface_nodrawbutton ), FALSE);
273
274   if(diff_flags & QUAKE2_SURF_HINT)
275     set_inconsistent(surface_hintbutton);
276   else if(flags & QUAKE2_SURF_HINT)
277         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surface_hintbutton ), TRUE);
278   else
279         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surface_hintbutton ), FALSE);
280
281   if(diff_flags & QUAKE2_SURF_SKIP)
282     set_inconsistent(surface_skipbutton);
283   else if(flags & QUAKE2_SURF_SKIP)
284         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surface_skipbutton ), TRUE);
285   else
286         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( surface_skipbutton ), FALSE);
287
288   // Set content buttons to reflect brush values
289   if(diff_contents & QUAKE2_CONTENTS_SOLID)
290     set_inconsistent(content_solidbutton);
291   else if(contents & QUAKE2_CONTENTS_SOLID)
292         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_solidbutton ), TRUE);
293   else
294         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_solidbutton ), FALSE);
295
296   if(diff_contents & QUAKE2_CONTENTS_WINDOW)
297     set_inconsistent(content_windowbutton);
298   else if(contents & QUAKE2_CONTENTS_WINDOW)
299         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_windowbutton ), TRUE);
300   else
301         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_windowbutton ), FALSE);
302
303   if(diff_contents & QUAKE2_CONTENTS_AUX)
304     set_inconsistent(content_auxbutton);
305   else if(contents & QUAKE2_CONTENTS_AUX)
306         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_auxbutton ), TRUE);
307   else
308         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_auxbutton ), FALSE);
309
310   if(diff_contents & QUAKE2_CONTENTS_LAVA)
311     set_inconsistent(content_lavabutton);
312   else if(contents & QUAKE2_CONTENTS_LAVA)
313         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_lavabutton ), TRUE);
314   else
315         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_lavabutton ), FALSE);
316
317   if(diff_contents & QUAKE2_CONTENTS_SLIME)
318     set_inconsistent(content_slimebutton);
319   else if(contents & QUAKE2_CONTENTS_SLIME)
320         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_slimebutton ), TRUE);
321   else
322         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_slimebutton ), FALSE);
323
324   if(diff_contents & QUAKE2_CONTENTS_WATER)
325     set_inconsistent(content_waterbutton);
326   else if(contents & QUAKE2_CONTENTS_WATER)
327         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_waterbutton ), TRUE);
328   else
329         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_waterbutton ), FALSE);
330
331   if(diff_contents & QUAKE2_CONTENTS_MIST)
332     set_inconsistent(content_mistbutton);
333   else if(contents & QUAKE2_CONTENTS_MIST)
334         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_mistbutton ), TRUE);
335   else
336         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_mistbutton ), FALSE);
337
338   if(diff_contents & QUAKE2_CONTENTS_AREAPORTAL)
339     set_inconsistent(content_areaportalbutton);
340   else if(contents & QUAKE2_CONTENTS_AREAPORTAL)
341         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_areaportalbutton ), TRUE);
342   else
343         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_areaportalbutton ), FALSE);
344
345   if(diff_contents & QUAKE2_CONTENTS_PLAYERCLIP)
346     set_inconsistent(content_playerclipbutton);
347   else if(contents & QUAKE2_CONTENTS_PLAYERCLIP)
348         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_playerclipbutton ), TRUE);
349   else
350         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_playerclipbutton ), FALSE);
351
352   if(diff_contents & QUAKE2_CONTENTS_MONSTERCLIP)
353     set_inconsistent(content_monsterclipbutton);
354   else if(contents & QUAKE2_CONTENTS_MONSTERCLIP)
355         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_monsterclipbutton ), TRUE);
356   else
357         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_monsterclipbutton ), FALSE);
358
359   if(diff_contents & QUAKE2_CONTENTS_CURRENT_0)
360     set_inconsistent(content_current0button);
361   else if(contents & QUAKE2_CONTENTS_CURRENT_0)
362         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_current0button ), TRUE);
363   else
364         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_current0button ), FALSE);
365
366   if(diff_contents & QUAKE2_CONTENTS_CURRENT_90)
367     set_inconsistent(content_current90button);
368   else if(contents & QUAKE2_CONTENTS_CURRENT_90)
369         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_current90button ), TRUE);
370   else
371         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_current90button ), FALSE);
372
373   if(diff_contents & QUAKE2_CONTENTS_CURRENT_180)
374     set_inconsistent(content_current180button);
375   else if(contents & QUAKE2_CONTENTS_CURRENT_180)
376         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_current180button ), TRUE);
377   else
378         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_current180button ), FALSE);
379
380   if(diff_contents & QUAKE2_CONTENTS_CURRENT_270)
381     set_inconsistent(content_current270button);
382   else if(contents & QUAKE2_CONTENTS_CURRENT_270)
383         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_current270button ), TRUE);
384   else
385         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_current270button ), FALSE);
386
387   if(diff_contents & QUAKE2_CONTENTS_CURRENT_UP)
388     set_inconsistent(content_currentUPbutton);
389   else if(contents & QUAKE2_CONTENTS_CURRENT_UP)
390         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_currentUPbutton ), TRUE);
391   else
392         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_currentUPbutton ), FALSE);
393
394   if(diff_contents & QUAKE2_CONTENTS_CURRENT_DOWN)
395     set_inconsistent(content_currentDOWNbutton);
396   else if(contents & QUAKE2_CONTENTS_CURRENT_DOWN)
397         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_currentDOWNbutton ), TRUE);
398   else
399         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_currentDOWNbutton ), FALSE);
400
401   if(diff_contents & QUAKE2_CONTENTS_ORIGIN)
402     set_inconsistent(content_originbutton);
403   else if(contents & QUAKE2_CONTENTS_ORIGIN)
404         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_originbutton ), TRUE);
405   else
406         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_originbutton ), FALSE);
407
408   if(diff_contents & QUAKE2_CONTENTS_DETAIL)
409     set_inconsistent(content_detailbutton);
410   else if(contents & QUAKE2_CONTENTS_DETAIL)
411         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_detailbutton ), TRUE);
412   else
413         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_detailbutton ), FALSE);
414
415   if(diff_contents & QUAKE2_CONTENTS_TRANSLUCENT)
416     set_inconsistent(content_translucentbutton);
417   else if(contents & QUAKE2_CONTENTS_TRANSLUCENT)
418         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_translucentbutton ), TRUE);
419   else
420         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_translucentbutton ), FALSE);
421
422   if(diff_contents & QUAKE2_CONTENTS_LADDER)
423     set_inconsistent(content_ladderbutton);
424   else if(contents & QUAKE2_CONTENTS_LADDER)
425         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_ladderbutton ), TRUE);
426   else
427         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON ( content_ladderbutton ), FALSE);
428
429   // Set Value
430   if(diff_value)
431     gtk_entry_set_text( (GtkEntry *)value_entry, "");
432   else
433   {
434     working_value = value;
435     sprintf( tex_buff, "%d", value);
436     gtk_entry_set_text( (GtkEntry *)value_entry, tex_buff);
437   }
438
439   setup_buttons = FALSE;
440 }
441
442 void SetChangeInFlags_Face_Quake2 (texdef_to_face_t *texdef_face_list)
443 {
444   texdef_to_face_t *temp_texdef_face_list;
445   texdef_t *tmp_texdef;
446
447   for (temp_texdef_face_list = texdef_face_list; temp_texdef_face_list; temp_texdef_face_list = temp_texdef_face_list->next)
448   {
449     tmp_texdef = &temp_texdef_face_list->texdef;
450     tmp_texdef->flags = (tmp_texdef->flags & ~surface_mask) | working_surface_flags;
451     tmp_texdef->contents = (tmp_texdef->contents & ~content_mask) | working_content_flags;
452     tmp_texdef->value = working_value;
453     Sys_Printf("content_flag: %d     content_mask: %d\n",working_content_flags,content_mask);
454     Sys_Printf("content: %d\n",tmp_texdef->contents);
455   }
456 }
457
458 inline void change_surfaceflag (GtkWidget *togglebutton, int sur_flag, gboolean change_flag_to)
459 {
460
461   if (!setup_buttons) // If we're setting up the buttons, we really don't need to
462   {                   // set flags that are already set
463
464     if (gtk_toggle_button_get_inconsistent(GTK_TOGGLE_BUTTON (togglebutton))) // Clear out inconsistent, if set
465             clear_inconsistent(GTK_WIDGET (togglebutton));
466
467     surface_mask |= sur_flag;
468
469     if (change_flag_to)
470       working_surface_flags |= sur_flag;
471     else
472       working_surface_flags &= ~sur_flag;
473   }
474 }
475
476 inline void change_contentflag (GtkWidget *togglebutton, int content_flag, gboolean change_flag_to)
477 {
478
479   if ( (!setup_buttons) )  // If we're setting up the buttons, we really don't need to
480   {                        // set flags that are already set
481
482     if (gtk_toggle_button_get_inconsistent(GTK_TOGGLE_BUTTON (togglebutton)))
483             clear_inconsistent(togglebutton);
484     //if (g_ptrSelectedFaces.GetSize() == 0)  // Only changing content flags on whole brushes, not faces.
485     //{
486       content_mask |= content_flag;
487
488     if (change_flag_to)
489       working_content_flags |= content_flag;
490     else
491       working_content_flags &= ~content_flag;
492     //}
493     Sys_Printf("content_flag: %d     content_mask: %d\n",content_flag,content_mask);
494   }
495 }
496
497 // Surface Flags Callbacks
498 void
499 on_surface_lightbutton_toggled         (GtkToggleButton *togglebutton,
500                                         gpointer         user_data)
501 {
502        change_surfaceflag(surface_lightbutton, QUAKE2_SURF_LIGHT, (GTK_TOGGLE_BUTTON (surface_lightbutton)->active));
503
504 }
505
506 void
507 on_surface_slickbutton_toggled         (GtkToggleButton *togglebutton,
508                                         gpointer         user_data)
509 {
510         change_surfaceflag(surface_slickbutton, QUAKE2_SURF_SLICK, (GTK_TOGGLE_BUTTON (surface_slickbutton)->active));
511
512 }
513
514 void
515 on_surface_skybutton_toggled           (GtkToggleButton *togglebutton,
516                                         gpointer         user_data)
517 {
518         change_surfaceflag(surface_skybutton, QUAKE2_SURF_SKY, (GTK_TOGGLE_BUTTON (surface_skybutton)->active));
519 }
520
521 void
522 on_surface_warpbutton_toggled          (GtkToggleButton *togglebutton,
523                                         gpointer         user_data)
524 {
525         change_surfaceflag(surface_warpbutton, QUAKE2_SURF_WARP, (GTK_TOGGLE_BUTTON (surface_warpbutton)->active));
526 }
527
528 void
529 on_surface_trans33button_toggled       (GtkToggleButton *togglebutton,
530                                         gpointer         user_data)
531 {
532         change_surfaceflag(surface_trans33button, QUAKE2_SURF_TRANS33, (GTK_TOGGLE_BUTTON (surface_trans33button)->active));
533 }
534
535 void
536 on_surface_trans66button_toggled       (GtkToggleButton *togglebutton,
537                                         gpointer         user_data)
538 {
539         change_surfaceflag(surface_trans66button, QUAKE2_SURF_TRANS66, (GTK_TOGGLE_BUTTON (surface_trans66button)->active));
540 }
541
542 void
543 on_surface_flowingbutton_toggled       (GtkToggleButton *togglebutton,
544                                         gpointer         user_data)
545 {
546         change_surfaceflag(surface_flowingbutton, QUAKE2_SURF_FLOWING, (GTK_TOGGLE_BUTTON (surface_flowingbutton)->active));
547 }
548
549 void
550 on_surface_nodrawbutton_toggled        (GtkToggleButton *togglebutton,
551                                         gpointer         user_data)
552 {
553         change_surfaceflag(surface_nodrawbutton, QUAKE2_SURF_NODRAW, (GTK_TOGGLE_BUTTON (surface_nodrawbutton)->active));
554 }
555
556 void
557 on_surface_hintbutton_toggled          (GtkToggleButton *togglebutton,
558                                         gpointer         user_data)
559 {
560         change_surfaceflag(surface_hintbutton, QUAKE2_SURF_HINT, (GTK_TOGGLE_BUTTON (surface_hintbutton)->active));
561 }
562
563 void
564 on_surface_skipbutton_toggled          (GtkToggleButton *togglebutton,
565                                         gpointer         user_data)
566 {
567         change_surfaceflag(surface_skipbutton, QUAKE2_SURF_SKIP, (GTK_TOGGLE_BUTTON (surface_skipbutton)->active));
568 }
569
570 // Content Flags Callbacks
571 void
572 on_content_solidbutton_toggled         (GtkToggleButton *togglebutton,
573                                         gpointer         user_data)
574 {
575         change_contentflag(content_solidbutton, QUAKE2_CONTENTS_SOLID, (GTK_TOGGLE_BUTTON (content_solidbutton)->active));
576 }
577
578 void
579 on_content_windowbutton_toggled        (GtkToggleButton *togglebutton,
580                                         gpointer         user_data)
581 {
582         change_contentflag(content_windowbutton, QUAKE2_CONTENTS_WINDOW, (GTK_TOGGLE_BUTTON (content_windowbutton)->active));
583 }
584
585 void
586 on_content_auxbutton_toggled           (GtkToggleButton *togglebutton,
587                                         gpointer         user_data)
588 {
589         change_contentflag(content_auxbutton, QUAKE2_CONTENTS_AUX, (GTK_TOGGLE_BUTTON (content_auxbutton)->active));
590 }
591
592 void
593 on_content_lavabutton_toggled          (GtkToggleButton *togglebutton,
594                                         gpointer         user_data)
595 {
596         change_contentflag(content_lavabutton, QUAKE2_CONTENTS_LAVA, (GTK_TOGGLE_BUTTON (content_lavabutton)->active));
597 }
598
599 void
600 on_content_slimebutton_toggled         (GtkToggleButton *togglebutton,
601                                         gpointer         user_data)
602 {
603         change_contentflag(content_slimebutton, QUAKE2_CONTENTS_SLIME, (GTK_TOGGLE_BUTTON (content_slimebutton)->active));
604 }
605
606 void
607 on_content_waterbutton_toggled         (GtkToggleButton *togglebutton,
608                                         gpointer         user_data)
609 {
610         change_contentflag(content_waterbutton, QUAKE2_CONTENTS_WATER, (GTK_TOGGLE_BUTTON (content_waterbutton)->active));
611 }
612
613 void
614 on_content_mistbutton_toggled          (GtkToggleButton *togglebutton,
615                                         gpointer         user_data)
616 {
617         change_contentflag(content_mistbutton, QUAKE2_CONTENTS_MIST, (GTK_TOGGLE_BUTTON (content_mistbutton)->active));
618 }
619
620 void
621 on_content_areaportalbutton_toggled    (GtkToggleButton *togglebutton,
622                                         gpointer         user_data)
623 {
624         change_contentflag(content_areaportalbutton, QUAKE2_CONTENTS_AREAPORTAL, (GTK_TOGGLE_BUTTON (content_areaportalbutton)->active));
625 }
626
627 void
628 on_content_playerclipbutton_toggled    (GtkToggleButton *togglebutton,
629                                         gpointer         user_data)
630 {
631         change_contentflag(content_playerclipbutton, QUAKE2_CONTENTS_PLAYERCLIP, (GTK_TOGGLE_BUTTON (content_playerclipbutton)->active));
632 }
633
634 void
635 on_content_monsterclipbutton_toggled   (GtkToggleButton *togglebutton,
636                                         gpointer         user_data)
637 {
638         change_contentflag(content_monsterclipbutton, QUAKE2_CONTENTS_MONSTERCLIP, (GTK_TOGGLE_BUTTON (content_monsterclipbutton)->active));
639 }
640
641 void
642 on_content_current0button_toggled      (GtkToggleButton *togglebutton,
643                                         gpointer         user_data)
644 {
645         change_contentflag(content_current0button, QUAKE2_CONTENTS_CURRENT_0, (GTK_TOGGLE_BUTTON (content_current0button)->active));
646 }
647
648 void
649 on_content_current90button_toggled     (GtkToggleButton *togglebutton,
650                                         gpointer         user_data)
651 {
652         change_contentflag(content_current90button, QUAKE2_CONTENTS_CURRENT_90, (GTK_TOGGLE_BUTTON (content_current90button)->active));
653 }
654
655 void
656 on_content_current180button_toggled    (GtkToggleButton *togglebutton,
657                                         gpointer         user_data)
658 {
659         change_contentflag(content_current180button, QUAKE2_CONTENTS_CURRENT_180, (GTK_TOGGLE_BUTTON (content_current180button)->active));
660 }
661
662 void
663 on_content_current270button_toggled    (GtkToggleButton *togglebutton,
664                                         gpointer         user_data)
665 {
666         change_contentflag(content_current270button, QUAKE2_CONTENTS_CURRENT_270, (GTK_TOGGLE_BUTTON (content_current270button)->active));
667 }
668
669 void
670 on_content_currentUPbutton_toggled     (GtkToggleButton *togglebutton,
671                                         gpointer         user_data)
672 {
673         change_contentflag(content_currentUPbutton, QUAKE2_CONTENTS_CURRENT_UP, (GTK_TOGGLE_BUTTON (content_currentUPbutton)->active));
674 }
675
676 void
677 on_content_currentDOWNbutton_toggled   (GtkToggleButton *togglebutton,
678                                         gpointer         user_data)
679 {
680         change_contentflag(content_currentDOWNbutton, QUAKE2_CONTENTS_CURRENT_DOWN, (GTK_TOGGLE_BUTTON (content_currentDOWNbutton)->active));
681 }
682
683 void
684 on_content_originbutton_toggled        (GtkToggleButton *togglebutton,
685                                         gpointer         user_data)
686 {
687         change_contentflag(content_originbutton, QUAKE2_CONTENTS_ORIGIN, (GTK_TOGGLE_BUTTON (content_originbutton)->active));
688 }
689
690 void
691 on_content_detailbutton_toggled        (GtkToggleButton *togglebutton,
692                                         gpointer         user_data)
693 {
694         change_contentflag(content_detailbutton, QUAKE2_CONTENTS_DETAIL, (GTK_TOGGLE_BUTTON (content_detailbutton)->active));
695 }
696
697 void
698 on_content_translucentbutton_toggled   (GtkToggleButton *togglebutton,
699                                         gpointer         user_data)
700 {
701         change_contentflag(content_translucentbutton, QUAKE2_CONTENTS_TRANSLUCENT, (GTK_TOGGLE_BUTTON (content_translucentbutton)->active));
702 }
703
704 void
705 on_content_ladderbutton_toggled        (GtkToggleButton *togglebutton,
706                                         gpointer         user_data)
707 {
708         change_contentflag(content_ladderbutton, QUAKE2_CONTENTS_LADDER, (GTK_TOGGLE_BUTTON (content_ladderbutton)->active));
709 }
710
711 // Value Entry Callback
712 void
713 on_value_entry_changed                (GtkEditable     *editable,
714                                         gpointer         user_data)
715 {
716   if ( (!setup_buttons) )  // If we're setting up the buttons, don't change value
717     working_value = atoi( gtk_entry_get_text( (GtkEntry*)editable) );
718 }
719
720 void
721 on_value_entry_insert_text             (GtkEditable     *editable,
722                                         gchar           *new_text,
723                                         gint             new_text_length,
724                                         gint            *position,
725                                         gpointer         user_data)
726 {
727   int i, count=0;
728   gchar *result;
729
730   // Limit input to digits, throwing out anything else
731   // Modified from Gtk FAQ for text filtering of GtkEntry
732   result = g_new (gchar, new_text_length);
733
734   for (i=0; i < new_text_length; i++) {
735     if (!isdigit(new_text[i]))
736       continue;
737   result[count++] = new_text[i];
738   }
739
740   if (count > 0) {
741     gtk_signal_handler_block_by_func (GTK_OBJECT (editable),
742                                       GTK_SIGNAL_FUNC (on_value_entry_insert_text),
743                                       user_data);
744     gtk_editable_insert_text (editable, result, count, position);
745     gtk_signal_handler_unblock_by_func (GTK_OBJECT (editable),
746                                         GTK_SIGNAL_FUNC (on_value_entry_insert_text),
747                                         user_data);
748   }
749   gtk_signal_emit_stop_by_name (GTK_OBJECT (editable), "insert_text");
750
751   g_free (result);
752 }
753
754 void
755 on_surfacebutton_clicked               (GtkButton       *button,
756                                         gpointer         user_data)
757 {
758         gtk_notebook_set_page (GTK_NOTEBOOK(notebook1), 0);
759 }
760
761 void
762 on_contentbutton_clicked               (GtkButton       *button,
763                                         gpointer         user_data)
764 {
765         gtk_notebook_set_page (GTK_NOTEBOOK(notebook1), 1);
766 }
767
768
769 #define QUAKE2_FLAG_BUTTON_BORDER 3
770
771 GtkWidget* Create_Quake2FlagsDialog (GtkWidget* surfacedialog_widget)
772 {
773   GtkWidget *frame1;
774   GtkWidget *vbox1;
775   GtkWidget *vbox2;
776   GtkWidget *vbox3;
777   GtkWidget *vbox4;
778   GtkWidget *table4;
779   GtkWidget *hbox2;
780   GtkWidget *hbox3;
781   GtkWidget *hseparator1;
782   GtkWidget *value_label;
783   GtkWidget *label5;
784   GtkWidget *table3;
785   GtkWidget *label6;
786
787   frame1 = gtk_frame_new (_("Flags"));
788   gtk_widget_show (frame1);
789   gtk_container_add (GTK_CONTAINER (surfacedialog_widget), frame1);
790
791   vbox1 = gtk_vbox_new (FALSE, 0);
792   gtk_widget_show (vbox1);
793   gtk_container_add (GTK_CONTAINER (frame1), vbox1);
794
795   notebook1 = gtk_notebook_new ();
796   gtk_widget_show (notebook1);
797   gtk_box_pack_start (GTK_BOX (vbox1), notebook1, TRUE, TRUE, 0);
798   gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook1), TRUE);
799   gtk_container_set_border_width (GTK_CONTAINER (notebook1), 5);
800
801   vbox2 = gtk_vbox_new (FALSE, 0);
802   gtk_widget_show (vbox2);
803   gtk_container_add (GTK_CONTAINER (notebook1), vbox2);
804
805   table4 = gtk_table_new (3, 4, FALSE);
806   gtk_widget_show (table4);
807   gtk_box_pack_start (GTK_BOX (vbox2), table4, TRUE, TRUE, 0);
808
809   surface_lightbutton = gtk_toggle_button_new_with_label (_("Light"));
810   gtk_signal_connect (GTK_OBJECT (surface_lightbutton), "toggled",
811                       GTK_SIGNAL_FUNC (on_surface_lightbutton_toggled),
812                       NULL);
813   gtk_widget_show (surface_lightbutton);
814   gtk_table_attach (GTK_TABLE (table4), surface_lightbutton, 0, 1, 0, 1,
815                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
816                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
817   gtk_container_set_border_width (GTK_CONTAINER (surface_lightbutton), QUAKE2_FLAG_BUTTON_BORDER);
818
819   surface_slickbutton = gtk_toggle_button_new_with_label (_("Slick"));
820   gtk_signal_connect (GTK_OBJECT (surface_slickbutton), "toggled",
821                       GTK_SIGNAL_FUNC (on_surface_slickbutton_toggled),
822                       NULL);
823   gtk_widget_show (surface_slickbutton);
824   gtk_table_attach (GTK_TABLE (table4), surface_slickbutton, 1, 2, 0, 1,
825                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
826                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
827   gtk_container_set_border_width (GTK_CONTAINER (surface_slickbutton), QUAKE2_FLAG_BUTTON_BORDER);
828
829   surface_skybutton = gtk_toggle_button_new_with_label (_("Sky"));
830   gtk_signal_connect (GTK_OBJECT (surface_skybutton), "toggled",
831                       GTK_SIGNAL_FUNC (on_surface_skybutton_toggled),
832                       NULL);
833   gtk_widget_show (surface_skybutton);
834   gtk_table_attach (GTK_TABLE (table4), surface_skybutton, 2, 3, 0, 1,
835                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
836                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
837   gtk_container_set_border_width (GTK_CONTAINER (surface_skybutton), QUAKE2_FLAG_BUTTON_BORDER);
838
839   surface_warpbutton = gtk_toggle_button_new_with_label (_("Warp"));
840   gtk_signal_connect (GTK_OBJECT (surface_warpbutton), "toggled",
841                       GTK_SIGNAL_FUNC (on_surface_warpbutton_toggled),
842                       NULL);
843   gtk_widget_show (surface_warpbutton);
844   gtk_table_attach (GTK_TABLE (table4), surface_warpbutton, 3, 4, 0, 1,
845                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
846                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
847   gtk_container_set_border_width (GTK_CONTAINER (surface_warpbutton), QUAKE2_FLAG_BUTTON_BORDER);
848
849   surface_trans33button = gtk_toggle_button_new_with_label (_("Trans 33"));
850   gtk_signal_connect (GTK_OBJECT (surface_trans33button), "toggled",
851                       GTK_SIGNAL_FUNC (on_surface_trans33button_toggled),
852                       NULL);
853   gtk_widget_show (surface_trans33button);
854   gtk_table_attach (GTK_TABLE (table4), surface_trans33button, 0, 1, 1, 2,
855                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
856                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
857   gtk_container_set_border_width (GTK_CONTAINER (surface_trans33button), QUAKE2_FLAG_BUTTON_BORDER);
858
859   surface_trans66button = gtk_toggle_button_new_with_label (_("Trans 66"));
860   gtk_signal_connect (GTK_OBJECT (surface_trans66button), "toggled",
861                       GTK_SIGNAL_FUNC (on_surface_trans66button_toggled),
862                       NULL);
863   gtk_widget_show (surface_trans66button);
864   gtk_table_attach (GTK_TABLE (table4), surface_trans66button, 1, 2, 1, 2,
865                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
866                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
867   gtk_container_set_border_width (GTK_CONTAINER (surface_trans66button), QUAKE2_FLAG_BUTTON_BORDER);
868
869   surface_flowingbutton = gtk_toggle_button_new_with_label (_("Flowing"));
870   gtk_signal_connect (GTK_OBJECT (surface_flowingbutton), "toggled",
871                       GTK_SIGNAL_FUNC (on_surface_flowingbutton_toggled),
872                       NULL);
873   gtk_widget_show (surface_flowingbutton);
874   gtk_table_attach (GTK_TABLE (table4), surface_flowingbutton, 2, 3, 1, 2,
875                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
876                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
877   gtk_container_set_border_width (GTK_CONTAINER (surface_flowingbutton), QUAKE2_FLAG_BUTTON_BORDER);
878
879   surface_nodrawbutton = gtk_toggle_button_new_with_label (_("NoDraw"));
880   gtk_signal_connect (GTK_OBJECT (surface_nodrawbutton), "toggled",
881                       GTK_SIGNAL_FUNC (on_surface_nodrawbutton_toggled),
882                       NULL);
883   gtk_widget_show (surface_nodrawbutton);
884   gtk_table_attach (GTK_TABLE (table4), surface_nodrawbutton, 3, 4, 1, 2,
885                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
886                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
887   gtk_container_set_border_width (GTK_CONTAINER (surface_nodrawbutton), QUAKE2_FLAG_BUTTON_BORDER);
888
889   surface_hintbutton = gtk_toggle_button_new_with_label (_("Hint"));
890   gtk_signal_connect (GTK_OBJECT (surface_hintbutton), "toggled",
891                       GTK_SIGNAL_FUNC (on_surface_hintbutton_toggled),
892                       NULL);
893   gtk_widget_show (surface_hintbutton);
894   gtk_table_attach (GTK_TABLE (table4), surface_hintbutton, 0, 1, 2, 3,
895                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
896                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
897   gtk_container_set_border_width (GTK_CONTAINER (surface_hintbutton), QUAKE2_FLAG_BUTTON_BORDER);
898
899   surface_skipbutton = gtk_toggle_button_new_with_label (_("Skip"));
900   gtk_signal_connect (GTK_OBJECT (surface_skipbutton), "toggled",
901                       GTK_SIGNAL_FUNC (on_surface_skipbutton_toggled),
902                       NULL);
903   gtk_widget_show (surface_skipbutton);
904   gtk_table_attach (GTK_TABLE (table4), surface_skipbutton, 3, 4, 2, 3,
905                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
906                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
907   gtk_container_set_border_width (GTK_CONTAINER (surface_skipbutton), QUAKE2_FLAG_BUTTON_BORDER);
908
909   hseparator1 = gtk_hseparator_new ();
910   gtk_widget_show (hseparator1);
911   gtk_box_pack_start (GTK_BOX (vbox2), hseparator1, FALSE, FALSE, 0);
912   gtk_widget_set_usize (hseparator1, -2, 5);
913
914   hbox2 = gtk_hbox_new (FALSE, 0);
915   gtk_widget_show (hbox2);
916   gtk_box_pack_start (GTK_BOX (vbox2), hbox2, FALSE, FALSE, 0);
917
918   hbox3 = gtk_hbox_new (FALSE, 0);
919   gtk_widget_show (hbox3);
920   gtk_box_pack_start (GTK_BOX (hbox2), hbox3, TRUE, TRUE, 0);
921
922   vbox4 = gtk_vbox_new (FALSE, 0);
923   gtk_widget_show (vbox4);
924   gtk_box_pack_start (GTK_BOX (hbox3), vbox4, TRUE, TRUE, 0);
925
926   value_label = gtk_label_new (_("Value: "));
927   gtk_widget_show (value_label);
928   gtk_box_pack_start (GTK_BOX (hbox3), value_label, FALSE, FALSE, 0);
929
930   value_entry = gtk_entry_new ();
931   gtk_signal_connect (GTK_OBJECT (value_entry), "changed",
932                       GTK_SIGNAL_FUNC (on_value_entry_changed),
933                       NULL);
934   gtk_signal_connect (GTK_OBJECT (value_entry), "insert_text",
935                       GTK_SIGNAL_FUNC (on_value_entry_insert_text),
936                       NULL);
937   gtk_entry_set_max_length( (GtkEntry *)value_entry, 11);
938   gtk_widget_show (value_entry);
939   gtk_box_pack_start (GTK_BOX (hbox3), value_entry, TRUE, TRUE, 0);
940
941   vbox3 = gtk_vbox_new (FALSE, 0);
942   gtk_widget_show (vbox3);
943   gtk_box_pack_start (GTK_BOX (hbox3), vbox3, TRUE, TRUE, 0);
944
945   label5 = gtk_label_new (_("Surface Flags"));
946   gtk_widget_show (label5);
947   gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 0), label5);
948
949   table3 = gtk_table_new (5, 4, FALSE);
950   gtk_widget_show (table3);
951   gtk_container_add (GTK_CONTAINER (notebook1), table3);
952
953   content_solidbutton = gtk_toggle_button_new_with_label (_("Solid"));
954   gtk_signal_connect (GTK_OBJECT (content_solidbutton), "toggled",
955                       GTK_SIGNAL_FUNC (on_content_solidbutton_toggled),
956                       NULL);
957   gtk_widget_show (content_solidbutton);
958   gtk_table_attach (GTK_TABLE (table3), content_solidbutton, 0, 1, 0, 1,
959                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
960                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
961   gtk_container_set_border_width (GTK_CONTAINER (content_solidbutton), QUAKE2_FLAG_BUTTON_BORDER);
962
963   content_windowbutton = gtk_toggle_button_new_with_label (_("Window"));
964   gtk_signal_connect (GTK_OBJECT (content_windowbutton), "toggled",
965                       GTK_SIGNAL_FUNC (on_content_windowbutton_toggled),
966                       NULL);
967   gtk_widget_show (content_windowbutton);
968   gtk_table_attach (GTK_TABLE (table3), content_windowbutton, 1, 2, 0, 1,
969                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
970                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
971   gtk_container_set_border_width (GTK_CONTAINER (content_windowbutton), QUAKE2_FLAG_BUTTON_BORDER);
972
973   content_auxbutton = gtk_toggle_button_new_with_label (_("Aux"));
974   gtk_signal_connect (GTK_OBJECT (content_auxbutton), "toggled",
975                       GTK_SIGNAL_FUNC (on_content_auxbutton_toggled),
976                       NULL);
977   gtk_widget_show (content_auxbutton);
978   gtk_table_attach (GTK_TABLE (table3), content_auxbutton, 2, 3, 0, 1,
979                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
980                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
981   gtk_container_set_border_width (GTK_CONTAINER (content_auxbutton), QUAKE2_FLAG_BUTTON_BORDER);
982
983   content_lavabutton = gtk_toggle_button_new_with_label (_("Lava"));
984   gtk_signal_connect (GTK_OBJECT (content_lavabutton), "toggled",
985                       GTK_SIGNAL_FUNC (on_content_lavabutton_toggled),
986                       NULL);
987   gtk_widget_show (content_lavabutton);
988   gtk_table_attach (GTK_TABLE (table3), content_lavabutton, 3, 4, 0, 1,
989                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
990                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
991   gtk_container_set_border_width (GTK_CONTAINER (content_lavabutton), QUAKE2_FLAG_BUTTON_BORDER);
992
993   content_slimebutton = gtk_toggle_button_new_with_label (_("Slime"));
994   gtk_signal_connect (GTK_OBJECT (content_slimebutton), "toggled",
995                       GTK_SIGNAL_FUNC (on_content_slimebutton_toggled),
996                       NULL);
997   gtk_widget_show (content_slimebutton);
998   gtk_table_attach (GTK_TABLE (table3), content_slimebutton, 0, 1, 1, 2,
999                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
1000                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
1001   gtk_container_set_border_width (GTK_CONTAINER (content_slimebutton), QUAKE2_FLAG_BUTTON_BORDER);
1002
1003   content_waterbutton = gtk_toggle_button_new_with_label (_("Water"));
1004   gtk_signal_connect (GTK_OBJECT (content_waterbutton), "toggled",
1005                       GTK_SIGNAL_FUNC (on_content_waterbutton_toggled),
1006                       NULL);
1007   gtk_widget_show (content_waterbutton);
1008   gtk_table_attach (GTK_TABLE (table3), content_waterbutton, 1, 2, 1, 2,
1009                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
1010                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
1011   gtk_container_set_border_width (GTK_CONTAINER (content_waterbutton), QUAKE2_FLAG_BUTTON_BORDER);
1012
1013   content_mistbutton = gtk_toggle_button_new_with_label (_("Mist"));
1014   gtk_signal_connect (GTK_OBJECT (content_mistbutton), "toggled",
1015                       GTK_SIGNAL_FUNC (on_content_mistbutton_toggled),
1016                       NULL);
1017   gtk_widget_show (content_mistbutton);
1018   gtk_table_attach (GTK_TABLE (table3), content_mistbutton, 2, 3, 1, 2,
1019                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
1020                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
1021   gtk_container_set_border_width (GTK_CONTAINER (content_mistbutton), QUAKE2_FLAG_BUTTON_BORDER);
1022
1023   content_areaportalbutton = gtk_toggle_button_new_with_label (_("AreaPortal"));
1024   gtk_signal_connect (GTK_OBJECT (content_areaportalbutton), "toggled",
1025                       GTK_SIGNAL_FUNC (on_content_areaportalbutton_toggled),
1026                       NULL);
1027   gtk_widget_show (content_areaportalbutton);
1028   gtk_table_attach (GTK_TABLE (table3), content_areaportalbutton, 3, 4, 1, 2,
1029                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
1030                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
1031   gtk_container_set_border_width (GTK_CONTAINER (content_areaportalbutton), QUAKE2_FLAG_BUTTON_BORDER);
1032
1033   content_playerclipbutton = gtk_toggle_button_new_with_label (_("PlayerClip"));
1034   gtk_signal_connect (GTK_OBJECT (content_playerclipbutton), "toggled",
1035                       GTK_SIGNAL_FUNC (on_content_playerclipbutton_toggled),
1036                       NULL);
1037   gtk_widget_show (content_playerclipbutton);
1038   gtk_table_attach (GTK_TABLE (table3), content_playerclipbutton, 0, 1, 2, 3,
1039                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
1040                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
1041   gtk_container_set_border_width (GTK_CONTAINER (content_playerclipbutton), QUAKE2_FLAG_BUTTON_BORDER);
1042
1043   content_monsterclipbutton = gtk_toggle_button_new_with_label (_("MonsterClip"));
1044   gtk_signal_connect (GTK_OBJECT (content_monsterclipbutton), "toggled",
1045                       GTK_SIGNAL_FUNC (on_content_monsterclipbutton_toggled),
1046                       NULL);
1047   gtk_widget_show (content_monsterclipbutton);
1048   gtk_table_attach (GTK_TABLE (table3), content_monsterclipbutton, 1, 2, 2, 3,
1049                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
1050                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
1051   gtk_container_set_border_width (GTK_CONTAINER (content_monsterclipbutton), QUAKE2_FLAG_BUTTON_BORDER);
1052
1053   content_current0button = gtk_toggle_button_new_with_label (_("Current 0"));
1054   gtk_signal_connect (GTK_OBJECT (content_current0button), "toggled",
1055                       GTK_SIGNAL_FUNC (on_content_current0button_toggled),
1056                       NULL);
1057   gtk_widget_show (content_current0button);
1058   gtk_table_attach (GTK_TABLE (table3), content_current0button, 2, 3, 2, 3,
1059                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
1060                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
1061   gtk_container_set_border_width (GTK_CONTAINER (content_current0button), QUAKE2_FLAG_BUTTON_BORDER);
1062
1063   content_current90button = gtk_toggle_button_new_with_label (_("Current 90"));
1064   gtk_signal_connect (GTK_OBJECT (content_current90button), "toggled",
1065                       GTK_SIGNAL_FUNC (on_content_current90button_toggled),
1066                       NULL);
1067   gtk_widget_show (content_current90button);
1068   gtk_table_attach (GTK_TABLE (table3), content_current90button, 3, 4, 2, 3,
1069                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
1070                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
1071   gtk_container_set_border_width (GTK_CONTAINER (content_current90button), QUAKE2_FLAG_BUTTON_BORDER);
1072
1073   content_current180button = gtk_toggle_button_new_with_label (_("Current 180"));
1074   gtk_signal_connect (GTK_OBJECT (content_current180button), "toggled",
1075                       GTK_SIGNAL_FUNC (on_content_current180button_toggled),
1076                       NULL);
1077   gtk_widget_show (content_current180button);
1078   gtk_table_attach (GTK_TABLE (table3), content_current180button, 0, 1, 3, 4,
1079                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
1080                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
1081   gtk_container_set_border_width (GTK_CONTAINER (content_current180button), QUAKE2_FLAG_BUTTON_BORDER);
1082
1083   content_current270button = gtk_toggle_button_new_with_label (_("Current 270"));
1084   gtk_signal_connect (GTK_OBJECT (content_current270button), "toggled",
1085                       GTK_SIGNAL_FUNC (on_content_current270button_toggled),
1086                       NULL);
1087   gtk_widget_show (content_current270button);
1088   gtk_table_attach (GTK_TABLE (table3), content_current270button, 1, 2, 3, 4,
1089                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
1090                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
1091   gtk_container_set_border_width (GTK_CONTAINER (content_current270button), QUAKE2_FLAG_BUTTON_BORDER);
1092
1093   content_currentUPbutton = gtk_toggle_button_new_with_label (_("Current UP"));
1094   gtk_signal_connect (GTK_OBJECT (content_currentUPbutton), "toggled",
1095                       GTK_SIGNAL_FUNC (on_content_currentUPbutton_toggled),
1096                       NULL);
1097   gtk_widget_show (content_currentUPbutton);
1098   gtk_table_attach (GTK_TABLE (table3), content_currentUPbutton, 2, 3, 3, 4,
1099                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
1100                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
1101   gtk_container_set_border_width (GTK_CONTAINER (content_currentUPbutton), QUAKE2_FLAG_BUTTON_BORDER);
1102
1103   content_currentDOWNbutton = gtk_toggle_button_new_with_label (_("Current DOWN"));
1104   gtk_signal_connect (GTK_OBJECT (content_currentDOWNbutton), "toggled",
1105                       GTK_SIGNAL_FUNC (on_content_currentDOWNbutton_toggled),
1106                       NULL);
1107   gtk_widget_show (content_currentDOWNbutton);
1108   gtk_table_attach (GTK_TABLE (table3), content_currentDOWNbutton, 3, 4, 3, 4,
1109                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
1110                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
1111   gtk_container_set_border_width (GTK_CONTAINER (content_currentDOWNbutton), QUAKE2_FLAG_BUTTON_BORDER);
1112
1113   content_originbutton = gtk_toggle_button_new_with_label (_("Origin"));
1114   gtk_signal_connect (GTK_OBJECT (content_originbutton), "toggled",
1115                       GTK_SIGNAL_FUNC (on_content_originbutton_toggled),
1116                       NULL);
1117   gtk_widget_show (content_originbutton);
1118   gtk_table_attach (GTK_TABLE (table3), content_originbutton, 0, 1, 4, 5,
1119                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
1120                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
1121   gtk_container_set_border_width (GTK_CONTAINER (content_originbutton), QUAKE2_FLAG_BUTTON_BORDER);
1122
1123   content_detailbutton = gtk_toggle_button_new_with_label (_("Detail"));
1124   gtk_signal_connect (GTK_OBJECT (content_detailbutton), "toggled",
1125                       GTK_SIGNAL_FUNC (on_content_detailbutton_toggled),
1126                       NULL);
1127   gtk_widget_show (content_detailbutton);
1128   gtk_table_attach (GTK_TABLE (table3), content_detailbutton, 1, 2, 4, 5,
1129                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
1130                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
1131   gtk_container_set_border_width (GTK_CONTAINER (content_detailbutton), QUAKE2_FLAG_BUTTON_BORDER);
1132
1133   content_translucentbutton = gtk_toggle_button_new_with_label (_("Translucent"));
1134   gtk_signal_connect (GTK_OBJECT (content_translucentbutton), "toggled",
1135                       GTK_SIGNAL_FUNC (on_content_translucentbutton_toggled),
1136                       NULL);
1137   gtk_widget_show (content_translucentbutton);
1138   gtk_table_attach (GTK_TABLE (table3), content_translucentbutton, 2, 3, 4, 5,
1139                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
1140                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
1141   gtk_container_set_border_width (GTK_CONTAINER (content_translucentbutton), QUAKE2_FLAG_BUTTON_BORDER);
1142
1143   content_ladderbutton = gtk_toggle_button_new_with_label (_("Ladder"));
1144   gtk_signal_connect (GTK_OBJECT (content_ladderbutton), "toggled",
1145                       GTK_SIGNAL_FUNC (on_content_ladderbutton_toggled),
1146                       NULL);
1147   gtk_widget_show (content_ladderbutton);
1148   gtk_table_attach (GTK_TABLE (table3), content_ladderbutton, 3, 4, 4, 5,
1149                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
1150                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
1151   gtk_container_set_border_width (GTK_CONTAINER (content_ladderbutton), QUAKE2_FLAG_BUTTON_BORDER);
1152
1153   label6 = gtk_label_new (_("Content Flags"));
1154   gtk_widget_show (label6);
1155   gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 1), label6);
1156
1157   return frame1;
1158 }
1159