Code

- Send Mac package debugging output to stderr rather than stdout. Fixes
[inkscape.git] / src / knotholder.cpp
index f7935c7c33c9280230cbbec706f622317be60ea9..55a171414e58ee59144961b62c4cfd3e1f0734e9 100644 (file)
@@ -30,6 +30,8 @@
 #include "sp-pattern.h"
 #include "style.h"
 #include "live_effects/lpeobject.h"
+#include "desktop.h"
+#include "display/sp-canvas.h"
 
 #include "xml/repr.h" // for debugging only
 
@@ -53,6 +55,8 @@ KnotHolder::KnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolderReleasedFun
 
     this->repr = repr;
     this->local_change = FALSE;
+
+    this->dragging = false;
 }
 
 KnotHolder::~KnotHolder() {
@@ -78,7 +82,7 @@ KnotHolder::~KnotHolder() {
 void
 KnotHolder::update_knots()
 {
-    NR::Matrix const i2d(sp_item_i2d_affine(item));
+    Geom::Matrix const i2d(sp_item_i2d_affine(item));
 
     for(std::list<KnotHolderEntity *>::iterator i = entity.begin(); i != entity.end(); ++i) {
         KnotHolderEntity *e = *i;
@@ -89,7 +93,7 @@ KnotHolder::update_knots()
 void
 KnotHolder::knot_clicked_handler(SPKnot *knot, guint state)
 {
-    KnotHolder *knot_holder = this;
+       KnotHolder *knot_holder = this;
 
     for(std::list<KnotHolderEntity *>::iterator i = knot_holder->entity.begin(); i != knot_holder->entity.end(); ++i) {
         KnotHolderEntity *e = *i;
@@ -133,13 +137,17 @@ KnotHolder::knot_clicked_handler(SPKnot *knot, guint state)
 void
 KnotHolder::knot_moved_handler(SPKnot *knot, Geom::Point const &p, guint state)
 {
-    // this was a local change and the knotholder does not need to be recreated:
+    if (this->dragging == false) {
+       this->dragging = true;
+    }
+
+       // this was a local change and the knotholder does not need to be recreated:
     this->local_change = TRUE;
 
     for(std::list<KnotHolderEntity *>::iterator i = this->entity.begin(); i != this->entity.end(); ++i) {
         KnotHolderEntity *e = *i;
         if (e->knot == knot) {
-            NR::Point const q = p * sp_item_i2d_affine(item).inverse();
+            Geom::Point const q = p * sp_item_i2d_affine(item).inverse();
             e->knot_set(q, e->knot->drag_origin * sp_item_i2d_affine(item).inverse(), state);
             break;
         }
@@ -155,7 +163,9 @@ KnotHolder::knot_moved_handler(SPKnot *knot, Geom::Point const &p, guint state)
 void
 KnotHolder::knot_ungrabbed_handler(SPKnot */*knot*/)
 {
-    if (this->released) {
+       this->dragging = false;
+
+       if (this->released) {
         this->released(this->item);
     } else {
         SPObject *object = (SPObject *) this->item;