Code

Respect "relink duplicates clones" setting with linked offsets.
[inkscape.git] / src / sp-guide.cpp
index bbb85cb781656e70e5e2570a36443b2b78e40bb3..f5edf7d97cf3a63baf9820d97bf57822ae640f1b 100644 (file)
@@ -167,7 +167,7 @@ static void sp_guide_release(SPObject *object)
     SPGuide *guide = (SPGuide *) object;
 
     while (guide->views) {
-        gtk_object_destroy(GTK_OBJECT(guide->views->data));
+        sp_guideline_delete(SP_GUIDELINE(guide->views->data));
         guide->views = g_slist_remove(guide->views, guide->views->data);
     }
 
@@ -284,7 +284,7 @@ sp_guide_create_guides_around_page(SPDesktop *dt) {
 
     sp_guide_pt_pairs_to_guides(dt, pts);
 
-    sp_document_done (doc, SP_VERB_NONE, _("Guides around page"));
+    sp_document_done (doc, SP_VERB_NONE, _("Guides Around Page"));
 }
 
 void sp_guide_show(SPGuide *guide, SPCanvasGroup *group, GCallback handler)
@@ -306,7 +306,7 @@ void sp_guide_hide(SPGuide *guide, SPCanvas *canvas)
 
     for (GSList *l = guide->views; l != NULL; l = l->next) {
         if (canvas == SP_CANVAS_ITEM(l->data)->canvas) {
-            gtk_object_destroy(GTK_OBJECT(l->data));
+            sp_guideline_delete(SP_GUIDELINE(l->data));
             guide->views = g_slist_remove(guide->views, l->data);
             return;
         }
@@ -404,32 +404,45 @@ void sp_guide_set_normal(SPGuide const &guide, Geom::Point const normal_to_line,
 
 /**
  * Returns a human-readable description of the guideline for use in dialog boxes and status bar.
+ * If verbose is false, only positioning information is included (useful for dialogs).
  *
  * The caller is responsible for freeing the string.
  */
-char *sp_guide_description(SPGuide const *guide)
+char *sp_guide_description(SPGuide const *guide, const bool verbose)
 {
     using Geom::X;
     using Geom::Y;
             
-    GString *position_string_x = SP_PX_TO_METRIC_STRING(guide->point_on_line[X], SP_ACTIVE_DESKTOP->namedview->getDefaultMetric());
-    GString *position_string_y = SP_PX_TO_METRIC_STRING(guide->point_on_line[Y], SP_ACTIVE_DESKTOP->namedview->getDefaultMetric());
+    GString *position_string_x = SP_PX_TO_METRIC_STRING(guide->point_on_line[X],
+                                                        SP_ACTIVE_DESKTOP->namedview->getDefaultMetric());
+    GString *position_string_y = SP_PX_TO_METRIC_STRING(guide->point_on_line[Y],
+                                                        SP_ACTIVE_DESKTOP->namedview->getDefaultMetric());
+
+    gchar *shortcuts = g_strdup_printf("; %s", _("<b>Shift+drag</b> to rotate, <b>Ctrl+drag</b> to move origin, <b>Del</b> to delete"));
+    gchar *descr;
 
     if ( are_near(guide->normal_to_line, component_vectors[X]) ||
          are_near(guide->normal_to_line, -component_vectors[X]) ) {
-        return g_strdup_printf(_("vertical, at %s"), position_string_x->str);
+        descr = g_strdup_printf(_("vertical, at %s"), position_string_x->str);
     } else if ( are_near(guide->normal_to_line, component_vectors[Y]) ||
                 are_near(guide->normal_to_line, -component_vectors[Y]) ) {
-        return g_strdup_printf(_("horizontal, at %s"), position_string_y->str);
+        descr = g_strdup_printf(_("horizontal, at %s"), position_string_y->str);
     } else {
         double const radians = guide->angle();
         double const degrees = Geom::rad_to_deg(radians);
         int const degrees_int = (int) round(degrees);
-        return g_strdup_printf(_("at %d degrees, through (%s,%s); <b>Ctrl</b>+click to delete"), degrees_int, position_string_x->str, position_string_y->str);
+        descr = g_strdup_printf(_("at %d degrees, through (%s,%s)"), 
+                                degrees_int, position_string_x->str, position_string_y->str);
     }
 
     g_string_free(position_string_x, TRUE);
     g_string_free(position_string_y, TRUE);
+
+    if (verbose) {
+        descr = g_strconcat(descr, shortcuts, NULL);
+    }
+    g_free(shortcuts);
+    return descr;
 }
 
 void sp_guide_remove(SPGuide *guide)