X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fdraw-anchor.cpp;h=f3a42ca4e797a4c7184a9b2fe60f24e0c5a5df17;hb=8a2e76b7021b9b960d7c30801a1a14461d9b5939;hp=f2af728cf7eec7c6c7b6b8108c18dca060629bfe;hpb=f951374eef04129c6a0d213e7ab4d9ed2095ca69;p=inkscape.git diff --git a/src/draw-anchor.cpp b/src/draw-anchor.cpp index f2af728cf..f3a42ca4e 100644 --- a/src/draw-anchor.cpp +++ b/src/draw-anchor.cpp @@ -17,24 +17,32 @@ #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) +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; - 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)); } @@ -67,11 +78,11 @@ sp_draw_anchor_destroy(SPDrawAnchor *anchor) * pointer to it or NULL. */ SPDrawAnchor * -sp_draw_anchor_test(SPDrawAnchor *anchor, NR::Point w, gboolean 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; @@ -96,4 +107,4 @@ sp_draw_anchor_test(SPDrawAnchor *anchor, NR::Point w, gboolean activate) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :