summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: bf09820)
raw | patch | inline | side by side (parent: bf09820)
author | johanengelen <johanengelen@users.sourceforge.net> | |
Wed, 2 Jul 2008 18:29:19 +0000 (18:29 +0000) | ||
committer | johanengelen <johanengelen@users.sourceforge.net> | |
Wed, 2 Jul 2008 18:29:19 +0000 (18:29 +0000) |
src/pen-context.cpp | patch | blob | history |
diff --git a/src/pen-context.cpp b/src/pen-context.cpp
index f91db70189642b0b6d19388edbccf353001c3638..e62d45192ddba178bbbed0b1c1e382f59403279a 100644 (file)
--- a/src/pen-context.cpp
+++ b/src/pen-context.cpp
pc->green_bpaths = g_slist_remove(pc->green_bpaths, pc->green_bpaths->data);
}
/* Get last segment */
- NArtBpath const *const p = SP_CURVE_BPATH(pc->green_curve);
- gint const e = SP_CURVE_LENGTH(pc->green_curve);
- if ( e < 2 ) {
- g_warning("Green curve length is %d", e);
+ if ( pc->green_curve->is_empty() ) {
+ g_warning("pen_handle_key_press, case GDK_KP_Delete: Green curve is empty");
break;
}
- pc->p[0] = p[e - 2].c(3);
- if (p[e - 1].code == NR_CURVETO) {
- pc->p[1] = p[e - 1].c(1);
+ // The code below assumes that pc->green_curve has only ONE path !
+ Geom::Path const & path = pc->green_curve->get_pathvector().back();
+ Geom::Curve const * crv = &path.back_default();
+ pc->p[0] = crv->initialPoint();
+ if ( Geom::CubicBezier const * cubic = dynamic_cast<Geom::CubicBezier const *>(crv)) {
+ pc->p[1] = from_2geom( (*cubic)[1] );
} else {
pc->p[1] = pc->p[0];
}
NR::Point const pt(( pc->npoints < 4
- ? p[e - 1].c(3)
+ ? crv->finalPoint()
: pc->p[3] ));
pc->npoints = 2;
pc->green_curve->backspace();