]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/groupdialog.cpp
* reactivated some old quake2 code
[xonotic/netradiant.git] / radiant / groupdialog.cpp
index d4570ff0a6084abd05cd4b075c5c9c6e0de53b24..acfca28677c86febabdb24938a95022253fb9c49 100644 (file)
@@ -30,6 +30,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
   #include <unistd.h>
 #endif
 #include <gdk/gdkkeysyms.h>
+#include <glib/gi18n.h>
 #include "stdafx.h"
 #include "groupdialog.h"
 
@@ -38,7 +39,6 @@ GtkListStore* g_entlist_store;
 GtkListStore* g_entprops_store;
 int                                    inspector_mode;         // W_TEXTURE, W_ENTITY, or W_CONSOLE
 qboolean               multiple_entities;
-// http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=17
 qboolean               disable_spawn_get = false;
 entity_t               *edit_entity;
 /*
@@ -100,12 +100,12 @@ void FillClassList ()
     GtkTreeIter iter;
     gtk_list_store_append(store, &iter);
     gtk_list_store_set(store, &iter, 0, e->name, 1, e, -1);
-  }    
+  }
 }
 
 // SetKeyValuePairs
 //
-// Reset the key/value (aka property) listbox and fill it with the 
+// Reset the key/value (aka property) listbox and fill it with the
 // k/v pairs from the entity being edited.
 //
 
@@ -142,7 +142,7 @@ void SetKeyValuePairs (bool bClearMD3)
 }
 
 // SetSpawnFlags
-// 
+//
 // Update the checkboxes to reflect the flag state of the entity
 //
 void SetSpawnFlags(void)
@@ -167,7 +167,7 @@ void SetSpawnFlags(void)
 }
 
 // GetSpawnFlags
-// 
+//
 // Update the entity flags to reflect the state of the checkboxes
 //
 // NOTE: this function had a tendency to add "spawnflags" "0" on most entities
@@ -191,7 +191,7 @@ void GetSpawnFlags(void)
     if (multiple_entities)
     {
       brush_t  *b;
-      
+
       for (b=selected_brushes.next ; b != &selected_brushes ; b=b->next)
         DeleteKey (b->owner, "spawnflags");
     }
@@ -199,12 +199,12 @@ void GetSpawnFlags(void)
       DeleteKey (edit_entity, "spawnflags");
   }
   else
-  {    
-    sprintf (sz, "%i", f);    
+  {
+    sprintf (sz, "%i", f);
     if (multiple_entities)
     {
       brush_t  *b;
-      
+
       for (b=selected_brushes.next ; b != &selected_brushes ; b=b->next)
         SetKeyValue(b->owner, "spawnflags", sz);
     }
@@ -225,7 +225,7 @@ bool UpdateSel(int iIndex, eclass_t *pec)
   int i, next_state;
   brush_t *b;
 
-  // syndrom of crappy code, we may get into stack overflowing crap with this function and Gtk 
+  // syndrom of crappy code, we may get into stack overflowing crap with this function and Gtk
   // if we play with the list of entity classes
   // using a static flag to prevent recursion
   static bool bBlockUpdate = false;
@@ -453,7 +453,7 @@ void AddProp()
     SetKeyValue(edit_entity, key, value);
 
   // refresh the prop listbox
-  SetKeyValuePairs();  
+  SetKeyValuePairs();
 
 
 #ifdef USEPLUGINENTITIES
@@ -585,7 +585,7 @@ void AssignSound()
     strcat (buffer, "/");
   }
 
-  const char *filename = file_dialog (g_pGroupDlg->m_pWidget, TRUE, "Open Wav File", buffer, "sound");
+  const char *filename = file_dialog (g_pGroupDlg->m_pWidget, TRUE, _("Open Wav File"), buffer, "sound");
   if (filename != NULL)
   {
     gtk_entry_set_text (GTK_ENTRY (EntWidgets[EntKeyField]), "noise");
@@ -599,7 +599,7 @@ void AssignSound()
       str = filename;
     }
 
-    gtk_entry_set_text (GTK_ENTRY (EntWidgets[EntValueField]), str.GetBuffer());       
+    gtk_entry_set_text (GTK_ENTRY (EntWidgets[EntValueField]), str.GetBuffer());
     AddProp();
   }
 }
@@ -618,7 +618,7 @@ void AssignModel()
     strcat (buffer, "/");
   }
 
-  const char *filename = file_dialog (g_pGroupDlg->m_pWidget, TRUE, "Open Model", buffer, MODEL_MAJOR);
+  const char *filename = file_dialog (g_pGroupDlg->m_pWidget, TRUE, _("Open Model"), buffer, MODEL_MAJOR);
   if (filename != NULL)
   {
     gtk_entry_set_text (GTK_ENTRY (EntWidgets[EntKeyField]), "model");
@@ -633,7 +633,7 @@ void AssignModel()
       str = filename;
     }
 
-    gtk_entry_set_text (GTK_ENTRY (EntWidgets[EntValueField]), str.GetBuffer());       
+    gtk_entry_set_text (GTK_ENTRY (EntWidgets[EntValueField]), str.GetBuffer());
     AddProp();
     edit_entity->brushes.onext->bModelFailed = false;
   }
@@ -664,7 +664,7 @@ void SetInspectorMode(int iType)
       iType = W_GROUP;
     else
       iType = W_ENTITY;
-  }            
+  }
 
   switch(iType)
   {
@@ -745,28 +745,28 @@ void Group_AddToItem(brush_t *b, GtkCTreeNode* item)
   }
   const char *pName = NULL;
   //  const char *pNamed = Brush_GetKeyValue(b, "name");
+
   if (!b->owner || (b->owner == world_entity))
   {
-    if (b->patchBrush) 
+    if (b->patchBrush)
     {
       pName = "Generic Patch";
       nImage = IMG_PATCH;
-    } 
-    else 
+    }
+    else
     {
       pName = "Generic Brush";
       nImage = IMG_BRUSH;
     }
-  } 
-  else 
+  }
+  else
   {
     pName = b->owner->eclass->name;
-    if (b->owner->eclass->fixedsize) 
+    if (b->owner->eclass->fixedsize)
     {
       nImage = IMG_ENTITY;
-    } 
-    else 
+    }
+    else
     {
       nImage = IMG_ENTITYGROUP;
     }
@@ -987,9 +987,8 @@ static void eclasslist_selection_changed(GtkTreeSelection* selection, gpointer d
   GtkTreeModel* model;
   GtkTreeIter selected;
   // no world entity, we are not ready yet
-  // http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=917
   if( !world_entity ) {
-    return;  
+    return;
   }
   if(gtk_tree_selection_get_selected(selection, &model, &selected))
   {
@@ -1133,7 +1132,7 @@ static void groupdlg_add (GtkWidget *widget, gpointer data)
 
   if (name != NULL)
   {
-    // create a new group node 
+    // create a new group node
     GtkCTreeNode *item;
     item = gtk_ctree_insert_node (GTK_CTREE (g_wndGroup.m_pTree), g_pGroupDlg->m_hWorld, NULL, &name, 0,
                                  tree_pixmaps[IMG_GROUP], tree_masks[IMG_GROUP],
@@ -1178,7 +1177,7 @@ static void switch_page (GtkNotebook *notebook, GtkNotebookPage *page, guint pag
     else
       inspector_mode = W_GROUP;
   }
-  
+
   if (inspector_mode == W_ENTITY)
     gtk_widget_set_sensitive (GTK_WIDGET (item), TRUE);
   else
@@ -1259,7 +1258,7 @@ void GroupDlg::Create ()
         GtkWidget* split1 = gtk_vpaned_new ();
         gtk_box_pack_start (GTK_BOX (vbox), split1, TRUE, TRUE, 0);
         gtk_widget_show (split1);
-  
+
         {
           GtkWidget* split2 = gtk_vpaned_new ();
           gtk_paned_add1 (GTK_PANED (split1), split2);
@@ -1302,7 +1301,7 @@ void GroupDlg::Create ()
                 gtk_widget_show(view);
 
                 gtk_container_add(GTK_CONTAINER (scr), view);
-    
+
                 g_object_unref(G_OBJECT(store));
                 EntWidgets[EntList] = view;
                 g_entlist_store = store;
@@ -1329,7 +1328,7 @@ void GroupDlg::Create ()
 
             {
               // Spawnflags (4 colums wide max, or window gets too wide.)
-              GtkWidget* table = LayoutTable = gtk_table_new (4, 4, FALSE);
+              GtkWidget* LayoutTable = gtk_table_new (4, 4, FALSE);
               gtk_box_pack_start (GTK_BOX (vbox2), LayoutTable, FALSE, TRUE, 0);
               gtk_widget_show(LayoutTable);
 
@@ -1341,40 +1340,39 @@ void GroupDlg::Create ()
                 EntWidgets[EntCheck1+i] = check;
               }
 
-              //++timo cleanme: these flags where Q2 stuff
-            /*
-              check = gtk_check_button_new_with_label ("!Easy");
-              gtk_widget_show (check);
-              gtk_signal_connect (GTK_OBJECT (check), "toggled", GTK_SIGNAL_FUNC (entity_check), NULL);
-              gtk_table_attach (GTK_TABLE (table), check, 2, 3, 0, 1,
-                                (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
-                                (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
-              EntWidgets[EntCheck17] = check;
-
-              check = gtk_check_button_new_with_label ("!Medium");
-              gtk_widget_show (check);
-              gtk_signal_connect (GTK_OBJECT (check), "toggled", GTK_SIGNAL_FUNC (entity_check), NULL);
-              gtk_table_attach (GTK_TABLE (table), check, 2, 3, 1, 2,
-                                (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
-                                (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
-              EntWidgets[EntCheck18] = check;
-
-              check = gtk_check_button_new_with_label ("!Hard");
-              gtk_widget_show (check);
-              gtk_signal_connect (GTK_OBJECT (check), "toggled", GTK_SIGNAL_FUNC (entity_check), NULL);
-              gtk_table_attach (GTK_TABLE (table), check, 2, 3, 2, 3,
-                                (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
-                                (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
-              EntWidgets[EntCheck19] = check;
-
-              check = gtk_check_button_new_with_label ("!DeathMatch");
-              gtk_widget_show (check);
-              gtk_signal_connect (GTK_OBJECT (check), "toggled", GTK_SIGNAL_FUNC (entity_check), NULL);
-              gtk_table_attach (GTK_TABLE (table), check, 2, 3, 3, 4,
-                                (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
-                                (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
-              EntWidgets[EntCheck20] = check;
-            */
+                               if (g_pGameDescription->quake2 || ( g_pGameDescription->mGameFile == "q2.game" ) || ( g_pGameDescription->mGameFile == "heretic2.game" )) {
+                                       GtkWidget *check = gtk_check_button_new_with_label (_("!Easy"));
+                                       gtk_widget_show (check);
+                                       gtk_signal_connect (GTK_OBJECT (check), "toggled", GTK_SIGNAL_FUNC (entity_check), NULL);
+/*                                     gtk_table_attach (GTK_TABLE (table), check, 2, 3, 0, 1,
+                                                                               (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+                                                                               (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);*/
+                                       EntWidgets[EntCheck17] = check;
+
+                                       check = gtk_check_button_new_with_label (_("!Medium"));
+                                       gtk_widget_show (check);
+                                       gtk_signal_connect (GTK_OBJECT (check), "toggled", GTK_SIGNAL_FUNC (entity_check), NULL);
+/*                                     gtk_table_attach (GTK_TABLE (table), check, 2, 3, 1, 2,
+                                                                               (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+                                                                               (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);*/
+                                       EntWidgets[EntCheck18] = check;
+
+                                       check = gtk_check_button_new_with_label (_("!Hard"));
+                                       gtk_widget_show (check);
+                                       gtk_signal_connect (GTK_OBJECT (check), "toggled", GTK_SIGNAL_FUNC (entity_check), NULL);
+/*                                     gtk_table_attach (GTK_TABLE (table), check, 2, 3, 2, 3,
+                                                                               (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+                                                                               (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);*/
+                                       EntWidgets[EntCheck19] = check;
+
+                                       check = gtk_check_button_new_with_label (_("!DeathMatch"));
+                                       gtk_widget_show (check);
+                                       gtk_signal_connect (GTK_OBJECT (check), "toggled", GTK_SIGNAL_FUNC (entity_check), NULL);
+/*                                     gtk_table_attach (GTK_TABLE (table), check, 2, 3, 3, 4,
+                                                                               (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+                                                                               (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);*/
+                                       EntWidgets[EntCheck20] = check;
+                               }
             }
 
             {
@@ -1410,7 +1408,7 @@ void GroupDlg::Create ()
                 gtk_widget_show(view);
 
                 gtk_container_add(GTK_CONTAINER (scr), view);
-    
+
                 g_object_unref(G_OBJECT(store));
 
                 EntWidgets[EntProps] = view;
@@ -1465,7 +1463,7 @@ void GroupDlg::Create ()
         }
 
         {
-          GtkWidget* label = gtk_label_new ("Value");
+          GtkWidget* label = gtk_label_new (_("Value"));
           gtk_widget_show (label);
           gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
                             (GtkAttachOptions) (GTK_FILL),
@@ -1474,7 +1472,7 @@ void GroupDlg::Create ()
         }
 
         {
-          GtkWidget* label = gtk_label_new ("Key");
+          GtkWidget* label = gtk_label_new (_("Key"));
           gtk_widget_show (label);
           gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
                             (GtkAttachOptions) (GTK_FILL),
@@ -1494,7 +1492,7 @@ void GroupDlg::Create ()
           gtk_box_pack_start (GTK_BOX (hbox), table, FALSE, TRUE, 0);
 
           {
-            GtkWidget* button = gtk_button_new_with_label ("360");
+            GtkWidget* button = gtk_button_new_with_label (_("360"));
             gtk_widget_show (button);
             gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (entitylist_angle), (void *)"360");
             gtk_table_attach (GTK_TABLE (table), button, 2, 3, 1, 2,
@@ -1503,7 +1501,7 @@ void GroupDlg::Create ()
           }
 
           {
-            GtkWidget* button = gtk_button_new_with_label ("45");
+            GtkWidget* button = gtk_button_new_with_label (_("45"));
             gtk_widget_show (button);
             gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (entitylist_angle), (void *)"45");
             gtk_table_attach (GTK_TABLE (table), button, 2, 3, 0, 1,
@@ -1512,7 +1510,7 @@ void GroupDlg::Create ()
           }
 
           {
-            GtkWidget* button = gtk_button_new_with_label ("90");
+            GtkWidget* button = gtk_button_new_with_label (_("90"));
             gtk_widget_show (button);
             gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (entitylist_angle), (void *)"90");
             gtk_table_attach (GTK_TABLE (table), button, 1, 2, 0, 1,
@@ -1522,7 +1520,7 @@ void GroupDlg::Create ()
 
 
           {
-            GtkWidget* button = gtk_button_new_with_label ("135");
+            GtkWidget* button = gtk_button_new_with_label (_("135"));
             gtk_widget_show (button);
             gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (entitylist_angle), (void *)"135");
             gtk_table_attach (GTK_TABLE (table), button, 0, 1, 0, 1,
@@ -1531,7 +1529,7 @@ void GroupDlg::Create ()
           }
 
           {
-            GtkWidget* button = gtk_button_new_with_label ("180");
+            GtkWidget* button = gtk_button_new_with_label (_("180"));
             gtk_widget_show (button);
             gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (entitylist_angle), (void *)"180");
             gtk_table_attach (GTK_TABLE (table), button, 0, 1, 1, 2,
@@ -1540,7 +1538,7 @@ void GroupDlg::Create ()
           }
 
           {
-            GtkWidget* button = gtk_button_new_with_label ("225");
+            GtkWidget* button = gtk_button_new_with_label (_("225"));
             gtk_widget_show (button);
             gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (entitylist_angle), (void *)"225");
             gtk_table_attach (GTK_TABLE (table), button, 0, 1, 2, 3,
@@ -1549,7 +1547,7 @@ void GroupDlg::Create ()
           }
 
           {
-            GtkWidget* button = gtk_button_new_with_label ("270");
+            GtkWidget* button = gtk_button_new_with_label (_("270"));
             gtk_widget_show (button);
             gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (entitylist_angle), (void *)"270");
             gtk_table_attach (GTK_TABLE (table), button, 1, 2, 2, 3,
@@ -1558,7 +1556,7 @@ void GroupDlg::Create ()
           }
 
           {
-            GtkWidget* button = gtk_button_new_with_label ("315");
+            GtkWidget* button = gtk_button_new_with_label (_("315"));
             gtk_widget_show (button);
             gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (entitylist_angle), (void *)"315");
             gtk_table_attach (GTK_TABLE (table), button, 2, 3, 2, 3,
@@ -1573,21 +1571,21 @@ void GroupDlg::Create ()
           gtk_box_pack_start (GTK_BOX (hbox), vbox2, TRUE, TRUE, 0);
 
           {
-            GtkWidget* button = gtk_button_new_with_label ("Reset");
+            GtkWidget* button = gtk_button_new_with_label (_("Reset"));
             gtk_widget_show (button);
             gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (ResetEntity), NULL);
             gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
           }
 
           {
-            GtkWidget* button = gtk_button_new_with_label ("Up");
+            GtkWidget* button = gtk_button_new_with_label (_("Up"));
             gtk_widget_show (button);
             gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (entitylist_angle), (void *)"-1");
             gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
           }
 
           {
-            GtkWidget* button = gtk_button_new_with_label ("Dn");
+            GtkWidget* button = gtk_button_new_with_label (_("Dn"));
             gtk_widget_show (button);
             gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (entitylist_angle), (void *)"-2");
             gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
@@ -1600,21 +1598,21 @@ void GroupDlg::Create ()
           gtk_box_pack_start (GTK_BOX (hbox), vbox2, TRUE, TRUE, 0);
 
           {
-            GtkWidget* button = gtk_button_new_with_label ("Del Key/Pair");
+            GtkWidget* button = gtk_button_new_with_label (_("Del Key/Pair"));
             gtk_widget_show (button);
             gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (DelProp), NULL);
             gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
           }
 
           {
-            GtkWidget* button = gtk_button_new_with_label ("Sound...");
+            GtkWidget* button = gtk_button_new_with_label (_("Sound..."));
             gtk_widget_show (button);
             gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (AssignSound), NULL);
             gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
           }
 
           {
-            GtkWidget* button = gtk_button_new_with_label ("Model...");
+            GtkWidget* button = gtk_button_new_with_label (_("Model..."));
             gtk_widget_show (button);
             gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (AssignModel), NULL);
             gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
@@ -1643,7 +1641,7 @@ void GroupDlg::Create ()
         }
 
         {
-          GtkWidget* label = gtk_label_new ("Console");
+          GtkWidget* label = gtk_label_new (_("Console"));
           gtk_widget_show (label);
           gtk_notebook_append_page (GTK_NOTEBOOK (notebook), scr, label);
         }
@@ -1673,28 +1671,28 @@ void GroupDlg::Create ()
   gtk_widget_show (hbox);
   gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);
 
-  button = gtk_button_new_with_label ("Add...");
+  button = gtk_button_new_with_label (_("Add..."));
   gtk_widget_show (button);
   gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (groupdlg_add), NULL);
   gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
   gtk_widget_set_usize (button, 60, -2);
 
-  button = gtk_button_new_with_label ("Edit...");
+  button = gtk_button_new_with_label (_("Edit..."));
   gtk_widget_show (button);
   gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
   gtk_widget_set_usize (button, 60, -2);
 
-  button = gtk_button_new_with_label ("Delete");
+  button = gtk_button_new_with_label (_("Delete"));
   gtk_widget_show (button);
   gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
   gtk_widget_set_usize (button, 60, -2);
 
-  label = gtk_label_new ("Groups");
+  label = gtk_label_new (_("Groups"));
   gtk_widget_show (label);
   gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox, label);
   */
   inspector_mode = W_ENTITY;
-  //  gtk_window_set_title (GTK_WINDOW (dlg), "Entities");
+  //  gtk_window_set_title (GTK_WINDOW (dlg), _("Entities"));
   m_pWidget = dlg;
   /*
   load_pixmap ("grouptree1.bmp", g_pParentWnd->m_pWidget, &tree_pixmaps[0], &tree_masks[0]);