summaryrefslogtreecommitdiffstats
path: root/src/pencil-context.cpp
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2009-11-29 19:01:07 +0000
committerTed Gould <ted@gould.cx>2009-11-29 19:01:07 +0000
commit29d3c0b15028e61f176df3a75189bf0959d0d03e (patch)
tree727afe596c693a9bdd098d72618abd9ceb0d1969 /src/pencil-context.cpp
parentAdd the build dir dbus directory to grab some headerfiles for distcheck. (diff)
parenthopefully fix build on linux (diff)
downloadinkscape-29d3c0b15028e61f176df3a75189bf0959d0d03e.tar.gz
inkscape-29d3c0b15028e61f176df3a75189bf0959d0d03e.zip
Merging in from trunk
(bzr r8254.1.37)
Diffstat (limited to 'src/pencil-context.cpp')
-rw-r--r--src/pencil-context.cpp25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/pencil-context.cpp b/src/pencil-context.cpp
index 4b87e86b5..d6050ba04 100644
--- a/src/pencil-context.cpp
+++ b/src/pencil-context.cpp
@@ -255,8 +255,15 @@ pencil_handle_button_press(SPPencilContext *const pc, GdkEventButton const &beve
/* Set first point of sequence */
SnapManager &m = desktop->namedview->snap_manager;
m.setup(desktop);
- sp_event_context_snap_window_open(event_context);
+ if (bevent.state & GDK_CONTROL_MASK) {
+ if (!(bevent.state & GDK_SHIFT_MASK)) {
+ m.freeSnapReturnByRef(Inkscape::SnapPreferences::SNAPPOINT_NODE, p, Inkscape::SNAPSOURCE_HANDLE);
+ }
+ spdc_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"));
@@ -349,7 +356,7 @@ pencil_handle_motion_notify(SPPencilContext *const pc, GdkEventMotion const &mev
/* We may be idle or already freehand */
if ( mevent.state & GDK_BUTTON1_MASK && pc->is_drawing ) {
if (pc->state == SP_PENCIL_CONTEXT_IDLE) {
- sp_event_context_snap_window_closed(event_context);
+ sp_event_context_discard_delayed_snap_event(event_context);
}
pc->state = SP_PENCIL_CONTEXT_FREEHAND;
@@ -416,8 +423,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;
- //sp_event_context_snap_window_open(dt->canvas);
+ 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:
@@ -431,7 +440,7 @@ pencil_handle_button_release(SPPencilContext *const pc, GdkEventButton const &re
spdc_set_endpoint(pc, p);
spdc_finish_endpoint(pc);
pc->state = SP_PENCIL_CONTEXT_IDLE;
- sp_event_context_snap_window_closed(event_context);
+ sp_event_context_discard_delayed_snap_event(event_context);
ret = TRUE;
break;
case SP_PENCIL_CONTEXT_FREEHAND:
@@ -445,7 +454,6 @@ pencil_handle_button_release(SPPencilContext *const pc, GdkEventButton const &re
}
pc->state = SP_PENCIL_CONTEXT_SKETCH;
- //sp_event_context_snap_window_open(dt->canvas);
} else {
/* Finish segment now */
/// \todo fixme: Clean up what follows (Lauris)
@@ -465,7 +473,6 @@ pencil_handle_button_release(SPPencilContext *const pc, GdkEventButton const &re
pc->green_anchor = sp_draw_anchor_destroy(pc->green_anchor);
}
pc->state = SP_PENCIL_CONTEXT_IDLE;
- // sp_event_context_snap_window_closed(dt->canvas);
// reset sketch mode too
pc->sketch_n = 0;
}
@@ -498,7 +505,7 @@ pencil_cancel (SPPencilContext *const pc)
pc->is_drawing = false;
pc->state = SP_PENCIL_CONTEXT_IDLE;
- sp_event_context_snap_window_closed(SP_EVENT_CONTEXT(pc));
+ sp_event_context_discard_delayed_snap_event(SP_EVENT_CONTEXT(pc));
pc->red_curve->reset();
sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(pc->red_bpath), NULL);
@@ -589,7 +596,7 @@ pencil_handle_key_release(SPPencilContext *const pc, guint const keyval, guint c
pc->green_anchor = sp_draw_anchor_destroy(pc->green_anchor);
}
pc->state = SP_PENCIL_CONTEXT_IDLE;
- sp_event_context_snap_window_closed(SP_EVENT_CONTEXT(pc));
+ sp_event_context_discard_delayed_snap_event(SP_EVENT_CONTEXT(pc));
pc->desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Finishing freehand sketch"));
ret = TRUE;
}