X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fpencil-context.cpp;h=3265d87bf23b1b9a95451ca2ccc990266e0a63c6;hb=468127ac43dba09e4e8f0d45e0949c20db8d6512;hp=a75b4c561e085887ee320616377b7ba436ba93fe;hpb=6b15695578f07a3f72c4c9475c1a261a3021472a;p=inkscape.git diff --git a/src/pencil-context.cpp b/src/pencil-context.cpp index a75b4c561..3265d87bf 100644 --- a/src/pencil-context.cpp +++ b/src/pencil-context.cpp @@ -1,4 +1,4 @@ -/** \file +/** \file * Pencil event context implementation. */ @@ -35,6 +35,7 @@ #include "libnr/in-svg-plane.h" #include "libnr/n-art-bpath.h" #include "context-fns.h" +#include "sp-namedview.h" static void sp_pencil_context_class_init(SPPencilContextClass *klass); static void sp_pencil_context_init(SPPencilContext *pc); @@ -110,7 +111,7 @@ sp_pencil_context_init(SPPencilContext *pc) event_context->cursor_shape = cursor_pencil_xpm; event_context->hot_x = 4; event_context->hot_y = 4; - + pc->npoints = 0; pc->state = SP_PENCIL_CONTEXT_IDLE; pc->req_tangent = NR::Point(0, 0); @@ -200,14 +201,14 @@ pencil_handle_button_press(SPPencilContext *const pc, GdkEventButton const &beve SPDrawContext *dc = SP_DRAW_CONTEXT (pc); SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(dc); - Inkscape::Selection *selection = SP_DT_SELECTION(desktop); + Inkscape::Selection *selection = sp_desktop_selection(desktop); if (Inkscape::have_viable_layer(desktop, dc->_message_context) == false) { return TRUE; } NR::Point const button_w(bevent.x, bevent.y); - + /* Find desktop coordinates */ NR::Point p = pc->desktop->w2d(button_w); @@ -233,7 +234,7 @@ pencil_handle_button_press(SPPencilContext *const pc, GdkEventButton const &beve // anchor, which is handled by the sibling branch above) selection->clear(); desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Creating new path")); - SnapManager const m(desktop->namedview); + SnapManager const &m = desktop->namedview->snap_manager; p = m.freeSnap(Inkscape::Snapper::BBOX_POINT | Inkscape::Snapper::SNAP_POINT, p, NULL).getPoint(); } else if (selection->singleItem() && SP_IS_PATH(selection->singleItem())) { desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Appending to selected path")); @@ -295,14 +296,14 @@ pencil_handle_motion_notify(SPPencilContext *const pc, GdkEventMotion const &mev /* Create green anchor */ pc->green_anchor = sp_draw_anchor_new(pc, pc->green_curve, TRUE, pc->p[0]); } - /** \todo - * fixme: I am not sure whether we want to snap to anchors + /** \todo + * fixme: I am not sure whether we want to snap to anchors * in middle of freehand (Lauris) */ if (anchor) { p = anchor->dp; } else if ((mevent.state & GDK_SHIFT_MASK) == 0) { - SnapManager const m(dt->namedview); + SnapManager const &m = dt->namedview->snap_manager; p = m.freeSnap(Inkscape::Snapper::BBOX_POINT | Inkscape::Snapper::SNAP_POINT, p, NULL).getPoint(); } if ( pc->npoints != 0 ) { // buttonpress may have happened before we entered draw context! @@ -480,8 +481,8 @@ spdc_set_endpoint(SPPencilContext *const pc, NR::Point const p) /** * Finalize addline. - * - * \todo + * + * \todo * fixme: I'd like remove red reset from concat colors (lauris). * Still not sure, how it will make most sense. */ @@ -567,8 +568,8 @@ fit_and_split(SPPencilContext *pc) sp_curve_append_continuous(pc->green_curve, pc->red_curve, 0.0625); SPCurve *curve = sp_curve_copy(pc->red_curve); - /// \todo fixme: - SPCanvasItem *cshape = sp_canvas_bpath_new(SP_DT_SKETCH(pc->desktop), curve); + /// \todo fixme: + SPCanvasItem *cshape = sp_canvas_bpath_new(sp_desktop_sketch(pc->desktop), curve); sp_curve_unref(curve); sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(cshape), pc->green_color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);