summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 238893a)
raw | patch | inline | side by side (parent: 238893a)
author | cilix42 <cilix42@users.sourceforge.net> | |
Thu, 12 Jun 2008 13:22:37 +0000 (13:22 +0000) | ||
committer | cilix42 <cilix42@users.sourceforge.net> | |
Thu, 12 Jun 2008 13:22:37 +0000 (13:22 +0000) |
src/pen-context.cpp | patch | blob | history | |
src/pen-context.h | patch | blob | history |
diff --git a/src/pen-context.cpp b/src/pen-context.cpp
index 7dc489540bb4e60eec6e298e562e34c8cc71151f..e3ff835d59c467add40879aa4b3c99b74fb5384d 100644 (file)
--- a/src/pen-context.cpp
+++ b/src/pen-context.cpp
pc->cl1 = NULL;
pc->events_disabled = 0;
+
+ pc->polylines_only = false;
}
/**
@@ -473,10 +475,13 @@ static gint pen_handle_button_press(SPPenContext *const pc, GdkEventButton const
p = event_dt;
spdc_endpoint_snap(pc, p, bevent.state); /* Snap node only if not hitting anchor. */
spdc_pen_set_subsequent_point(pc, p, true);
+ if (pc->polylines_only) {
+ spdc_pen_finish_segment(pc, p, bevent.state);
+ }
}
}
- pc->state = SP_PEN_CONTEXT_CONTROL;
+ pc->state = pc->polylines_only ? SP_PEN_CONTEXT_POINT : SP_PEN_CONTEXT_CONTROL;
ret = TRUE;
break;
case SP_PEN_CONTEXT_CONTROL:
// snap the handle
spdc_endpoint_snap_handle(pc, p, mevent.state);
- spdc_pen_set_ctrl(pc, p, mevent.state);
+ if (!pc->polylines_only) {
+ spdc_pen_set_ctrl(pc, p, mevent.state);
+ } else {
+ spdc_pen_set_ctrl(pc, pc->p[1], mevent.state);
+ }
gobble_motion_events(GDK_BUTTON1_MASK);
ret = TRUE;
break;
@@ -717,8 +726,10 @@ pen_handle_button_release(SPPenContext *const pc, GdkEventButton const &revent)
switch (pc->state) {
case SP_PEN_CONTEXT_POINT:
case SP_PEN_CONTEXT_CONTROL:
- spdc_endpoint_snap(pc, p, revent.state);
- spdc_pen_finish_segment(pc, p, revent.state);
+ if (!pc->polylines_only) {
+ spdc_endpoint_snap(pc, p, revent.state);
+ spdc_pen_finish_segment(pc, p, revent.state);
+ }
break;
case SP_PEN_CONTEXT_CLOSE:
spdc_endpoint_snap(pc, p, revent.state);
diff --git a/src/pen-context.h b/src/pen-context.h
index e149391a9b02da04c2e36463ba1a522fdefbe4f0..29938e923ca79ce9878d40004f70a24761d6d5be 100644 (file)
--- a/src/pen-context.h
+++ b/src/pen-context.h
unsigned int state : 2;
unsigned int onlycurves : 1;
+ bool polylines_only;
+
SPCanvasItem *c0, *c1, *cl0, *cl1;
unsigned int events_disabled : 1;