diff --git a/src/pencil-context.cpp b/src/pencil-context.cpp
index 32ea8aafa36adb200e7198c0884d890589d832d5..d27d363f9690c8523011d5e4ed1341f21f212558 100644 (file)
--- a/src/pencil-context.cpp
+++ b/src/pencil-context.cpp
#include "desktop.h"
#include "desktop-handles.h"
#include "selection.h"
+#include "selection-chemistry.h"
#include "draw-anchor.h"
#include "message-stack.h"
#include "message-context.h"
#include "pixmaps/cursor-pencil.xpm"
#include "display/bezier-utils.h"
#include "display/canvas-bpath.h"
+#include "display/snap-indicator.h"
#include <glibmm/i18n.h>
#include "libnr/in-svg-plane.h"
#include "libnr/n-art-bpath.h"
#include "context-fns.h"
#include "sp-namedview.h"
+#include "xml/repr.h"
+#include "document.h"
+#include "desktop-style.h"
+#include "macros.h"
static void sp_pencil_context_class_init(SPPencilContextClass *klass);
static void sp_pencil_context_init(SPPencilContext *pc);
@@ -223,6 +229,11 @@ pencil_handle_button_press(SPPencilContext *const pc, GdkEventButton const &beve
break;
default:
/* Set first point of sequence */
+ if (bevent.state & GDK_CONTROL_MASK) {
+ freehand_create_single_dot(event_context, p, "tools.freehand.pencil", bevent.state);
+ ret = true;
+ break;
+ }
if (anchor) {
p = anchor->dp;
desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Continuing selected path"));
@@ -255,9 +266,17 @@ pencil_handle_button_press(SPPencilContext *const pc, GdkEventButton const &beve
static gint
pencil_handle_motion_notify(SPPencilContext *const pc, GdkEventMotion const &mevent)
{
+ if ((mevent.state & GDK_CONTROL_MASK) && (mevent.state & GDK_BUTTON1_MASK)) {
+ // mouse was accidentally moved during Ctrl+click;
+ // ignore the motion and create a single point
+ pc->is_drawing = false;
+ return TRUE;
+ }
gint ret = FALSE;
SPDesktop *const dt = pc->desktop;
+ dt->snapindicator->remove_snappoint();
+
SPEventContext *event_context = SP_EVENT_CONTEXT(pc);
if (event_context->space_panning || mevent.state & GDK_BUTTON2_MASK || mevent.state & GDK_BUTTON3_MASK) {
// allow scrolling
@@ -306,7 +325,11 @@ pencil_handle_motion_notify(SPPencilContext *const pc, GdkEventMotion const &mev
p = anchor->dp;
} else if ((mevent.state & GDK_SHIFT_MASK) == 0) {
SnapManager const &m = dt->namedview->snap_manager;
- p = m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, p, NULL).getPoint();
+ Inkscape::SnappedPoint const s = m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, p, NULL);
+ p = s.getPoint();
+ if (s.getDistance() < NR_HUGE) {
+ dt->snapindicator->set_new_snappoint(p.to_2geom());
+ }
}
if ( pc->npoints != 0 ) { // buttonpress may have happened before we entered draw context!
spdc_add_freehand_point(pc, p, mevent.state);
@@ -359,7 +382,10 @@ pencil_handle_button_release(SPPencilContext *const pc, GdkEventButton const &re
case SP_PENCIL_CONTEXT_IDLE:
/* Releasing button in idle mode means single click */
/* We have already set up start point/anchor in button_press */
- pc->state = SP_PENCIL_CONTEXT_ADDLINE;
+ if (!(revent.state & GDK_CONTROL_MASK)) {
+ // Ctrl+click creates a single point so only set context in ADDLINE mode when Ctrl isn't pressed
+ pc->state = SP_PENCIL_CONTEXT_ADDLINE;
+ }
ret = TRUE;
break;
case SP_PENCIL_CONTEXT_ADDLINE:
@@ -474,6 +500,13 @@ pencil_handle_key_press(SPPencilContext *const pc, guint const keyval, guint con
}
}
break;
+ case GDK_g:
+ case GDK_G:
+ if (mod_shift_only(state)) {
+ sp_selection_to_guides();
+ ret = true;
+ }
+ break;
default:
break;
}