Code

Fix bug #1077600 -> correct mirroring and no drifting of origin
[inkscape.git] / src / knotholder.cpp
index ff6a819702bfc8711c75142637c48fac03565156..c67f22933f760ec298ecf2ea912b3e808bc5514e 100644 (file)
 #include "knot.h"
 #include "knotholder.h"
 #include "knot-holder-entity.h"
+#include "rect-context.h"
+#include "sp-rect.h"
+#include "arc-context.h"
+#include "sp-ellipse.h"
+#include "star-context.h"
+#include "sp-star.h"
+#include "spiral-context.h"
+#include "sp-spiral.h"
+#include "sp-offset.h"
+
 #include <libnr/nr-matrix-div.h>
+#include <glibmm/i18n.h>
 
 class SPDesktop;
 
@@ -221,8 +232,26 @@ static void knot_clicked_handler(SPKnot *knot, guint state, gpointer data)
     knotholder_update_knots(knot_holder, item);
     g_object_unref(knot_holder);
 
+    unsigned int object_verb = SP_VERB_NONE;
+
+    if (SP_IS_RECT(item))
+        object_verb = SP_VERB_CONTEXT_RECT;
+    else if (SP_IS_GENERICELLIPSE(item))
+        object_verb = SP_VERB_CONTEXT_ARC;
+    else if (SP_IS_STAR(item))
+        object_verb = SP_VERB_CONTEXT_STAR;
+    else if (SP_IS_SPIRAL(item))
+        object_verb = SP_VERB_CONTEXT_SPIRAL;
+    else if (SP_IS_OFFSET(item)) {
+        if (SP_OFFSET(item)->sourceHref)
+            object_verb = SP_VERB_SELECTION_LINKED_OFFSET;
+        else
+            object_verb = SP_VERB_SELECTION_DYNAMIC_OFFSET;
+    }
+
     // for drag, this is done by ungrabbed_handler, but for click we must do it here
-    sp_document_done(SP_OBJECT_DOCUMENT(knot_holder->item));
+    sp_document_done(SP_OBJECT_DOCUMENT(knot_holder->item), object_verb, 
+                     _("Change handle"));
 }
 
 static void knot_moved_handler(SPKnot *knot, NR::Point const *p, guint state, gpointer data)
@@ -255,7 +284,26 @@ static void knot_ungrabbed_handler(SPKnot *knot, unsigned int state, SPKnotHolde
     } else {
         SPObject *object = (SPObject *) kh->item;
         object->updateRepr(object->repr, SP_OBJECT_WRITE_EXT);
-        sp_document_done(SP_OBJECT_DOCUMENT (object));
+
+        unsigned int object_verb = SP_VERB_NONE;
+
+        if (SP_IS_RECT(object))
+            object_verb = SP_VERB_CONTEXT_RECT;
+        else if (SP_IS_GENERICELLIPSE(object))
+            object_verb = SP_VERB_CONTEXT_ARC;
+        else if (SP_IS_STAR(object))
+            object_verb = SP_VERB_CONTEXT_STAR;
+        else if (SP_IS_SPIRAL(object))
+            object_verb = SP_VERB_CONTEXT_SPIRAL;
+        else if (SP_IS_OFFSET(object)) {
+            if (SP_OFFSET(object)->sourceHref)
+                object_verb = SP_VERB_SELECTION_LINKED_OFFSET;
+            else
+                object_verb = SP_VERB_SELECTION_DYNAMIC_OFFSET;
+        }
+        
+        sp_document_done(SP_OBJECT_DOCUMENT (object), object_verb,
+                         _("Move handle"));
     }
 }