]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/mainframe.cpp
ToggleGridSnap command (beware of it)
[xonotic/netradiant.git] / radiant / mainframe.cpp
index 031f2b473cc1520684eeb49f9193061ee9e2d5c5..a441e03c39a9e9b38baec34522b8f8167aa83ffa 100644 (file)
@@ -718,7 +718,7 @@ void PasteToCamera()
   // Work out the delta
   Vector3 mid;
   Select_GetMid(mid);
-  Vector3 delta = vector3_subtracted(vector3_snapped(Camera_getOrigin(camwnd), GetGridSize()), mid);
+  Vector3 delta = vector3_subtracted(vector3_snapped(Camera_getOrigin(camwnd), GetSnapGridSize()), mid);
 
   // Move to camera
   GlobalSelectionSystem().translateSelected(delta);
@@ -976,11 +976,13 @@ void OpenUpdateURL()
 {
   // build the URL
   StringOutputStream URL(256);
-  URL << "http://www.qeradiant.com/index.php?data=dlupdate&query_dlup=1";
+  URL << "http://www.icculus.org/netradiant/?cmd=update&data=dlupdate&query_dlup=1";
 #ifdef WIN32
   URL << "&OS_dlup=1";
-#else
+#elif defined(__APPLE__)
   URL << "&OS_dlup=2";
+#else
+  URL << "&OS_dlup=3";
 #endif
   URL << "&Version_dlup=" RADIANT_VERSION;
   g_GamesDialog.AddPacksURL(URL);
@@ -998,7 +1000,7 @@ void OpenHelpURL()
 
 void OpenBugReportURL()
 {
-  OpenURL("http://www.qeradiant.com/?data=bugreport");
+  OpenURL("http://www.icculus.org/netradiant/?cmd=bugs");
 }
 
 
@@ -1186,7 +1188,9 @@ void SelectFaceMode()
 
 class CloneSelected : public scene::Graph::Walker
 {
+  bool doMakeUnique;
 public:
+  CloneSelected(bool d): doMakeUnique(d) { }
   bool pre(const scene::Path& path, scene::Instance& instance) const
   {
     if(path.size() == 1)
@@ -1216,16 +1220,17 @@ public:
         && selectable->isSelected())
       {
         NodeSmartReference clone(Node_Clone(path.top()));
-        Map_gatherNamespaced(clone);
+               if(doMakeUnique)
+                       Map_gatherNamespaced(clone);
         Node_getTraversable(path.parent().get())->insert(clone);
       }
     }
   }
 };
 
-void Scene_Clone_Selected(scene::Graph& graph)
+void Scene_Clone_Selected(scene::Graph& graph, bool doMakeUnique)
 {
-  graph.traverse(CloneSelected());
+  graph.traverse(CloneSelected(doMakeUnique));
 
   Map_mergeClonedNames();
 }
@@ -1297,7 +1302,20 @@ void Selection_Clone()
   {
     UndoableCommand undo("cloneSelected");
 
-    Scene_Clone_Selected(GlobalSceneGraph());
+    Scene_Clone_Selected(GlobalSceneGraph(), false);
+
+    //NudgeSelection(eNudgeRight, GetGridSize(), GlobalXYWnd_getCurrentViewType());
+    //NudgeSelection(eNudgeDown, GetGridSize(), GlobalXYWnd_getCurrentViewType());
+  }
+}
+
+void Selection_Clone_MakeUnique()
+{
+  if(GlobalSelectionSystem().Mode() == SelectionSystem::ePrimitive)
+  {
+    UndoableCommand undo("cloneSelectedMakeUnique");
+
+    Scene_Clone_Selected(GlobalSceneGraph(), true);
 
     //NudgeSelection(eNudgeRight, GetGridSize(), GlobalXYWnd_getCurrentViewType());
     //NudgeSelection(eNudgeDown, GetGridSize(), GlobalXYWnd_getCurrentViewType());
@@ -1978,6 +1996,7 @@ GtkMenuItem* create_edit_menu()
   create_menu_item_with_mnemonic(menu, "P_aste To Camera", "PasteToCamera");
   menu_separator(menu);
   create_menu_item_with_mnemonic(menu, "_Duplicate", "CloneSelection");
+  create_menu_item_with_mnemonic(menu, "Duplicate, make uni_que", "CloneSelectionAndMakeUnique");
   create_menu_item_with_mnemonic(menu, "D_elete", "DeleteSelection");
   menu_separator(menu);
   create_menu_item_with_mnemonic(menu, "Pa_rent", "ParentSelection");
@@ -3269,7 +3288,7 @@ void MainFrame::SetGridStatus()
 {
   StringOutputStream status(64);
   const char* lock = (GridStatus_getTextureLockEnabled()) ? "ON" : "OFF";
-  status << "G:" << GridStatus_getGridSize()
+  status << (GetSnapGridSize() > 0 ? "G:" : "g:") << GridStatus_getGridSize()
     << "  R:" << GridStatus_getRotateIncrement()
     << "  C:" << GridStatus_getFarClipDistance()
     << "  L:" << lock;
@@ -3286,7 +3305,7 @@ void GridStatus_onTextureLockEnabledChanged()
 
 namespace
 {
-  GLFont g_font(0, 0);
+  GLFont g_font(0, 0, 0, 0);
 }
 
 void GlobalGL_sharedContextCreated()
@@ -3304,15 +3323,21 @@ void GlobalGL_sharedContextCreated()
   GlobalShaderCache().realise();
   Textures_Realise();
 
-#if defined(WIN32)
+#ifdef WIN32
+  /* win32 is dodgy here, just use courier new then */
   g_font = glfont_create("courier new 8");
-#elif defined(__linux__)
-  g_font = glfont_create("fixed 8");
 #else
-  g_font = glfont_create("courier 8");
+  /* use default font here (Sans 10 is gtk default) */
+  GtkSettings *settings = gtk_settings_get_default();
+  gchar *fontname;
+  g_object_get(settings, "gtk-font-name", &fontname, NULL);
+  g_font = glfont_create(fontname);
 #endif
+
   GlobalOpenGL().m_font = g_font.getDisplayList();
   GlobalOpenGL().m_fontHeight = g_font.getPixelHeight();
+  GlobalOpenGL().m_fontAscent = g_font.getPixelAscent();
+  GlobalOpenGL().m_fontDescent = g_font.getPixelDescent();
 }
 
 void GlobalGL_sharedContextDestroyed()
@@ -3393,6 +3418,7 @@ void MainFrame_Construct()
   GlobalCommands_insert("Paste", FreeCaller<Paste>(), Accelerator('V', (GdkModifierType)GDK_CONTROL_MASK));
   GlobalCommands_insert("PasteToCamera", FreeCaller<PasteToCamera>(), Accelerator('V', (GdkModifierType)GDK_MOD1_MASK));
   GlobalCommands_insert("CloneSelection", FreeCaller<Selection_Clone>(), Accelerator(GDK_space));
+  GlobalCommands_insert("CloneSelectionAndMakeUnique", FreeCaller<Selection_Clone_MakeUnique>(), Accelerator(GDK_space, (GdkModifierType)GDK_SHIFT_MASK));
   GlobalCommands_insert("DeleteSelection", FreeCaller<deleteSelection>(), Accelerator(GDK_BackSpace));
   GlobalCommands_insert("ParentSelection", FreeCaller<Scene_parentSelected>());
   GlobalCommands_insert("UnSelectSelection", FreeCaller<Selection_Deselect>(), Accelerator(GDK_Escape));