Code

lpe interpolate: fix traversal of trajectory_path. add option for equidistant_spacing
[inkscape.git] / src / dialogs / find.cpp
index f3efeed81329bba0fb4af6b8777e3a7e56f27285..6f9eca0d73c8acdb26fc9d88f9072fd7c5f7cb71 100644 (file)
@@ -51,6 +51,7 @@ sp_find_dialog(){
 #include "../sp-flowtext.h"
 #include "../text-editing.h"
 #include "../sp-tspan.h"
+#include "../sp-tref.h"
 #include "../selection-chemistry.h"
 #include "../sp-defs.h"
 #include "../sp-rect.h"
@@ -66,6 +67,8 @@ sp_find_dialog(){
 #include "../sp-offset.h"
 #include <xml/repr.h>
 
+#define MIN_ONSCREEN_DISTANCE 50
+
 using NR::X;
 using NR::Y;
 
@@ -74,7 +77,7 @@ static win_data wd;
 
 // impossible original values to make sure they are read from prefs
 static gint x = -1000, y = -1000, w = 0, h = 0;
-static gchar *prefs_path = "dialogs.find";
+static gchar const *prefs_path = "dialogs.find";
 
 
 
@@ -88,7 +91,7 @@ static void sp_find_dialog_destroy(GtkObject *object, gpointer)
 
 
 
-static gboolean sp_find_dialog_delete(GtkObject *, GdkEvent *, gpointer data)
+static gboolean sp_find_dialog_delete(GtkObject *, GdkEvent *, gpointer /*data*/)
 {
     gtk_window_get_position (GTK_WINDOW (dlg), &x, &y);
     gtk_window_get_size (GTK_WINDOW (dlg), &w, &h);
@@ -236,7 +239,7 @@ item_type_match (SPItem *item, GtkWidget *widget)
     } else if (SP_IS_PATH(item) || SP_IS_LINE(item) || SP_IS_POLYLINE(item)) {
         return (type_checkbox (widget, "paths"));
 
-    } else if (SP_IS_TEXT(item) || SP_IS_TSPAN(item) || SP_IS_STRING(item)) {
+    } else if (SP_IS_TEXT(item) || SP_IS_TSPAN(item) || SP_IS_TREF(item) || SP_IS_STRING(item)) {
         return (type_checkbox (widget, "texts"));
 
     } else if (SP_IS_GROUP(item) && !desktop->isLayer(item) ) { // never select layers!
@@ -612,7 +615,9 @@ sp_find_types ()
         }
 
         {
-            GtkWidget *c = sp_find_types_checkbox_indented (vb, "clones", TRUE, tt, _("Search clones"), _("Clones"), NULL, 10);
+            GtkWidget *c = sp_find_types_checkbox_indented (vb, "clones", TRUE, tt, _("Search clones"),
+                       //TRANSLATORS: Translate the word "Clones" only. A noun indicating type of object to find
+                       Q_("find|Clones"), NULL, 10);
             gtk_box_pack_start (GTK_BOX (vb_all), c, FALSE, FALSE, 0);
         }
 
@@ -645,24 +650,24 @@ sp_find_dialog_old (void)
 
         dlg = sp_window_new (title, TRUE);
         if (x == -1000 || y == -1000) {
-            x = prefs_get_int_attribute (prefs_path, "x", 0);
-            y = prefs_get_int_attribute (prefs_path, "y", 0);
+            x = prefs_get_int_attribute (prefs_path, "x", -1000);
+            y = prefs_get_int_attribute (prefs_path, "y", -1000);
         }
         if (w ==0 || h == 0) {
             w = prefs_get_int_attribute (prefs_path, "w", 0);
             h = prefs_get_int_attribute (prefs_path, "h", 0);
         }
         
-        if (x<0) x=0;
-        if (y<0) y=0;
+//        if (x<0) x=0;
+//        if (y<0) y=0;
 
-        if (x != 0 || y != 0) {
+        if (w && h)
+            gtk_window_resize ((GtkWindow *) dlg, w, h);
+        if (x >= 0 && y >= 0 && (x < (gdk_screen_width()-MIN_ONSCREEN_DISTANCE)) && (y < (gdk_screen_height()-MIN_ONSCREEN_DISTANCE))) {
             gtk_window_move ((GtkWindow *) dlg, x, y);
         } else {
             gtk_window_set_position(GTK_WINDOW(dlg), GTK_WIN_POS_CENTER);
         }
-        if (w && h)
-            gtk_window_resize ((GtkWindow *) dlg, w, h);
 
         sp_transientize (dlg);
         wd.win = dlg;