Code

better method to convert nartbpath to PathVector
[inkscape.git] / src / spiral-context.cpp
index 4e0fd98787e109af84e7c2b74c48acf17a5c52b6..56c5b0ebd76bf89d1407b1e18b7d4a26ece8a483 100644 (file)
@@ -17,6 +17,8 @@
 #include "config.h"
 
 #include <gdk/gdkkeysyms.h>
+#include <cstring>
+#include <string>
 
 #include "macros.h"
 #include "display/sp-canvas.h"
@@ -129,7 +131,7 @@ sp_spiral_context_dispose(GObject *object)
     if (sc->item) sp_spiral_finish(sc);
 
     if (ec->shape_knot_holder) {
-        sp_knot_holder_destroy(ec->shape_knot_holder);
+        delete ec->shape_knot_holder;
         ec->shape_knot_holder = NULL;
     }
 
@@ -165,7 +167,7 @@ sp_spiral_context_selection_changed(Inkscape::Selection *selection, gpointer dat
     SPEventContext *ec = SP_EVENT_CONTEXT(sc);
 
     if (ec->shape_knot_holder) { // desktroy knotholder
-        sp_knot_holder_destroy(ec->shape_knot_holder);
+        delete ec->shape_knot_holder;
         ec->shape_knot_holder = NULL;
     }
 
@@ -263,8 +265,9 @@ sp_spiral_context_root_handler(SPEventContext *event_context, GdkEvent *event)
                 dragging = TRUE;
                 sc->center = Inkscape::setup_for_drag_start(desktop, event_context, event);
 
-                SnapManager const &m = desktop->namedview->snap_manager;
-                sc->center = m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, sc->center, sc->item).getPoint();
+                SnapManager &m = desktop->namedview->snap_manager;
+                m.setup(desktop, NULL); //null, because we don't have an item yet
+                m.freeSnapReturnByRef(Inkscape::Snapper::SNAPPOINT_NODE, sc->center);
 
                 sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate),
                                     ( GDK_KEY_PRESS_MASK |
@@ -291,10 +294,13 @@ sp_spiral_context_root_handler(SPEventContext *event_context, GdkEvent *event)
                 NR::Point const motion_w(event->motion.x, event->motion.y);
                 NR::Point motion_dt(event_context->desktop->w2d(motion_w));
                 
-                SnapManager const &m = desktop->namedview->snap_manager;
-                motion_dt = m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, motion_dt, sc->item).getPoint();
-            
+                SnapManager &m = desktop->namedview->snap_manager;
+                m.setup(desktop, sc->item);
+                m.freeSnapReturnByRef(Inkscape::Snapper::SNAPPOINT_NODE, motion_dt);
                 sp_spiral_drag(sc, motion_dt, event->motion.state);
+
+                gobble_motion_events(GDK_BUTTON1_MASK);
+
                 ret = TRUE;
             }
             break;
@@ -432,8 +438,9 @@ sp_spiral_drag(SPSpiralContext *sc, NR::Point p, guint state)
 
     NR::Point const p0 = sp_desktop_dt2root_xy_point(desktop, sc->center);
     NR::Point p1 = sp_desktop_dt2root_xy_point(desktop, p);
-    SnapManager const &m = desktop->namedview->snap_manager;
-    p1 = m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, p1, sc->item).getPoint();
+    SnapManager &m = desktop->namedview->snap_manager;
+    m.setup(desktop, sc->item);
+    m.freeSnapReturnByRef(Inkscape::Snapper::SNAPPOINT_NODE, p1);
 
     SPSpiral *spiral = SP_SPIRAL(sc->item);
 
@@ -455,7 +462,7 @@ sp_spiral_drag(SPSpiralContext *sc, NR::Point p, guint state)
 
     /* status text */
     GString *rads = SP_PX_TO_METRIC_STRING(rad, desktop->namedview->getDefaultMetric());
-    sc->_message_context->setF(Inkscape::NORMAL_MESSAGE,
+    sc->_message_context->setF(Inkscape::IMMEDIATE_MESSAGE,
                                _("<b>Spiral</b>: radius %s, angle %5g&#176;; with <b>Ctrl</b> to snap angle"),
                                rads->str, sp_round((arg + 2.0*M_PI*spiral->revo)*180/M_PI, 0.0001));
     g_string_free(rads, FALSE);