Code

by default, try square arrangement, not 1 row as before
[inkscape.git] / src / draw-anchor.cpp
index f2af728cf7eec7c6c7b6b8108c18dca060629bfe..363ea0b6ea095e6383042fb4038c12a31e480a16 100644 (file)
@@ -17,7 +17,9 @@
 #include "desktop.h"
 #include "desktop-handles.h"
 #include "event-context.h"
+#include "lpe-tool-context.h"
 #include "display/sodipodi-ctrl.h"
+#include "display/curve.h"
 
 /**
  * Creates an anchor object and initializes it.
 SPDrawAnchor *
 sp_draw_anchor_new(SPDrawContext *dc, SPCurve *curve, gboolean start, NR::Point delta)
 {
+    if (SP_IS_LPETOOL_CONTEXT(dc)) {
+        // suppress all kinds of anchors in LPEToolContext
+        return NULL;
+    }
+
     SPDesktop *dt = SP_EVENT_CONTEXT_DESKTOP(dc);
 
     SPDrawAnchor *a = g_new(SPDrawAnchor, 1);
 
     a->dc = dc;
     a->curve = curve;
+    curve->ref();
     a->start = start;
     a->active = FALSE;
     a->dp = delta;
-    a->ctrl = sp_canvas_item_new(SP_DT_CONTROLS(dt), SP_TYPE_CTRL,
+    a->ctrl = sp_canvas_item_new(sp_desktop_controls(dt), SP_TYPE_CTRL,
                                  "size", 6.0,
                                  "filled", 0,
                                  "fill_color", 0xff00007f,
@@ -53,6 +61,9 @@ sp_draw_anchor_new(SPDrawContext *dc, SPCurve *curve, gboolean start, NR::Point
 SPDrawAnchor *
 sp_draw_anchor_destroy(SPDrawAnchor *anchor)
 {
+    if (anchor->curve) {
+        anchor->curve->unref();
+    }
     if (anchor->ctrl) {
         gtk_object_destroy(GTK_OBJECT(anchor->ctrl));
     }