Code

German translation update
[inkscape.git] / src / pencil-context.cpp
index f6bb827434b81befb3a05879e34ed0b4e2f8c84a..0717724de29f72a437bdda984d76f7f2ef550c14 100644 (file)
@@ -263,13 +263,14 @@ pencil_handle_button_press(SPPencilContext *const pc, GdkEventButton const &beve
             default:
                 /* Set first point of sequence */
                 SnapManager &m = desktop->namedview->snap_manager;
-                m.setup(desktop);
 
                 if (bevent.state & GDK_CONTROL_MASK) {
+                    m.setup(desktop);
                     if (!(bevent.state & GDK_SHIFT_MASK)) {
                         m.freeSnapReturnByRef(p, Inkscape::SNAPSOURCE_NODE_HANDLE);
                       }
                     spdc_create_single_dot(event_context, p, "/tools/freehand/pencil", bevent.state);
+                    m.unSetup();
                     ret = true;
                     break;
                 }
@@ -277,7 +278,7 @@ pencil_handle_button_press(SPPencilContext *const pc, GdkEventButton const &beve
                     p = anchor->dp;
                     desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Continuing selected path"));
                 } else {
-
+                    m.setup(desktop);
                     if (!(bevent.state & GDK_SHIFT_MASK)) {
                         // This is the first click of a new curve; deselect item so that
                         // this curve is not combined with it (unless it is drawn from its
@@ -289,6 +290,7 @@ pencil_handle_button_press(SPPencilContext *const pc, GdkEventButton const &beve
                         desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Appending to selected path"));
                         m.freeSnapReturnByRef(p, Inkscape::SNAPSOURCE_NODE_HANDLE);
                     }
+                    m.unSetup();
                 }
                 pc->sa = anchor;
                 spdc_set_startpoint(pc, p);
@@ -378,6 +380,13 @@ pencil_handle_motion_notify(SPPencilContext *const pc, GdkEventMotion const &mev
                 }
 
                 if ( pc->npoints != 0) { // buttonpress may have happened before we entered draw context!
+                    if (pc->ps.size() == 0) {
+                        // Only in freehand mode we have to add the first point also to pc->ps (apparently)
+                        // - We cannot add this point in spdc_set_startpoint, because we only need it for freehand
+                        // - We cannot do this in the button press handler because at that point we don't know yet
+                        //   wheter we're going into freehand mode or not
+                        pc->ps.push_back(pc->p[0]);
+                    }
                     spdc_add_freehand_point(pc, p, mevent.state);
                     ret = TRUE;
                 }
@@ -409,6 +418,7 @@ pencil_handle_motion_notify(SPPencilContext *const pc, GdkEventMotion const &mev
                 SnapManager &m = dt->namedview->snap_manager;
                 m.setup(dt);
                 m.preSnap(Inkscape::SnapCandidatePoint(p, Inkscape::SNAPSOURCE_NODE_HANDLE));
+                m.unSetup();
             }
             break;
     }
@@ -639,7 +649,6 @@ spdc_set_startpoint(SPPencilContext *const pc, Geom::Point const p)
     pc->red_curve_is_valid = false;
     if (in_svg_plane(p)) {
         pc->p[pc->npoints++] = p;
-        pc->ps.push_back(p);
     }
 }
 
@@ -944,4 +953,4 @@ fit_and_split(SPPencilContext *pc)
   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 :