diff --git a/src/draw-anchor.cpp b/src/draw-anchor.cpp
index ce016aabbeb24a70ea6a2ec122fc9d105519becc..c6590ac44d422272d99c82a8bbd5bbb0561dcd9f 100644 (file)
--- a/src/draw-anchor.cpp
+++ b/src/draw-anchor.cpp
#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, bool start, NR::Point delta)
+sp_draw_anchor_new(SPDrawContext *dc, SPCurve *curve, gboolean start, Geom::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;
SPDrawAnchor *
sp_draw_anchor_destroy(SPDrawAnchor *anchor)
{
+ if (anchor->curve) {
+ anchor->curve->unref();
+ }
if (anchor->ctrl) {
gtk_object_destroy(GTK_OBJECT(anchor->ctrl));
}
* pointer to it or NULL.
*/
SPDrawAnchor *
-sp_draw_anchor_test(SPDrawAnchor *anchor, NR::Point w, bool activate)
+sp_draw_anchor_test(SPDrawAnchor *anchor, Geom::Point w, gboolean activate)
{
SPDesktop *dt = SP_EVENT_CONTEXT_DESKTOP(anchor->dc);
- if ( activate && ( NR::LInfty( w - dt->d2w(anchor->dp) ) <= A_SNAP ) ) {
+ if ( activate && ( Geom::LInfty( w - dt->d2w(anchor->dp) ) <= A_SNAP ) ) {
if (!anchor->active) {
sp_canvas_item_set((GtkObject *) anchor->ctrl, "filled", TRUE, NULL);
anchor->active = TRUE;