From 0e3db26399a6a20603d53e3e0f0bd1ad5aa6b017 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sat, 28 Apr 2012 18:45:21 +0200 Subject: powerstroke: restrict the 'ray' values for ellipses that powerstroke can generate. (bzr r11306) --- src/live_effects/lpe-powerstroke.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/live_effects') diff --git a/src/live_effects/lpe-powerstroke.cpp b/src/live_effects/lpe-powerstroke.cpp index 44f9b9eb0..048742452 100644 --- a/src/live_effects/lpe-powerstroke.cpp +++ b/src/live_effects/lpe-powerstroke.cpp @@ -269,6 +269,15 @@ Geom::Path path_from_piecewise_fix_cusps( Geom::Piecewise break; } + // check if ellipse.ray is within 'sane' range. + if ( ( fabs(ellipse.ray(Geom::X)) > 1e6 ) || + ( fabs(ellipse.ray(Geom::Y)) > 1e6 ) ) + { + // do bevel, and break + pb.lineTo(B[i].at0()); + break; + } + pb.arcTo( ellipse.ray(Geom::X), ellipse.ray(Geom::Y), ellipse.rot_angle(), false, width < 0, B[i].at0() ); -- cgit v1.2.3 From 3198928b491fb91cdd177505c051659f89aa4158 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Wed, 2 May 2012 19:06:15 -0700 Subject: Adding base configurable sizing of controls/handles. (bzr r11316) --- src/live_effects/lpe-angle_bisector.cpp | 10 ++++------ src/live_effects/lpe-copy_rotate.cpp | 13 +++++-------- src/live_effects/lpe-knot.cpp | 15 ++++++--------- src/live_effects/lpe-parallel.cpp | 13 +++++-------- src/live_effects/lpe-perp_bisector.cpp | 10 ++++------ src/live_effects/lpe-perspective_path.cpp | 14 +++++--------- src/live_effects/lpe-tangent_to_curve.cpp | 15 ++++++--------- src/live_effects/parameter/point.cpp | 2 +- src/live_effects/parameter/powerstrokepointarray.cpp | 13 ++++++------- src/live_effects/parameter/vector.cpp | 4 ++-- 10 files changed, 44 insertions(+), 65 deletions(-) (limited to 'src/live_effects') diff --git a/src/live_effects/lpe-angle_bisector.cpp b/src/live_effects/lpe-angle_bisector.cpp index 99110c51e..b337f71d8 100644 --- a/src/live_effects/lpe-angle_bisector.cpp +++ b/src/live_effects/lpe-angle_bisector.cpp @@ -83,16 +83,14 @@ void LPEAngleBisector::addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item) { { KnotHolderEntity *e = new AB::KnotHolderEntityLeftEnd(this); - e->create( desktop, item, knotholder, - _("Adjust the \"left\" end of the bisector") - /*optional: knot_shape, knot_mode, knot_color*/); + e->create( desktop, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, + _("Adjust the \"left\" end of the bisector") ); knotholder->add(e); } { KnotHolderEntity *e = new AB::KnotHolderEntityRightEnd(this); - e->create( desktop, item, knotholder, - _("Adjust the \"right\" of the bisector") - /*optional: knot_shape, knot_mode, knot_color*/); + e->create( desktop, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, + _("Adjust the \"right\" of the bisector") ); knotholder->add(e); } }; diff --git a/src/live_effects/lpe-copy_rotate.cpp b/src/live_effects/lpe-copy_rotate.cpp index c61f4c3c1..bddd65be6 100644 --- a/src/live_effects/lpe-copy_rotate.cpp +++ b/src/live_effects/lpe-copy_rotate.cpp @@ -127,20 +127,17 @@ LPECopyRotate::addCanvasIndicators(SPLPEItem */*lpeitem*/, std::vectorcreate( desktop, item, knotholder, - _("Adjust the starting angle") - /*optional: knot_shape, knot_mode, knot_color*/); + e->create( desktop, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, + _("Adjust the starting angle") ); knotholder->add(e); } { KnotHolderEntity *e = new CR::KnotHolderEntityRotationAngle(this); - e->create( desktop, item, knotholder, - _("Adjust the rotation angle") - /*optional: knot_shape, knot_mode, knot_color*/); + e->create( desktop, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, + _("Adjust the rotation angle") ); knotholder->add(e); } }; diff --git a/src/live_effects/lpe-knot.cpp b/src/live_effects/lpe-knot.cpp index 7ec103a85..3a9b036d8 100644 --- a/src/live_effects/lpe-knot.cpp +++ b/src/live_effects/lpe-knot.cpp @@ -607,15 +607,12 @@ LPEKnot::addCanvasIndicators(SPLPEItem */*lpeitem*/, std::vectorcreate( desktop, item, knotholder, - _("Drag to select a crossing, click to flip it") - /*optional: knot_shape, knot_mode, knot_color*/); - knotholder->add(e); - } +void LPEKnot::addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item) +{ + KnotHolderEntity *e = new KnotHolderEntityCrossingSwitcher(this); + e->create( desktop, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, + _("Drag to select a crossing, click to flip it") ); + knotholder->add(e); }; diff --git a/src/live_effects/lpe-parallel.cpp b/src/live_effects/lpe-parallel.cpp index 4d15bf13e..95340fcf4 100644 --- a/src/live_effects/lpe-parallel.cpp +++ b/src/live_effects/lpe-parallel.cpp @@ -94,20 +94,17 @@ LPEParallel::doEffect_pwd2 (Geom::Piecewise > const & pwd return output + dir; } -void -LPEParallel::addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item) { +void LPEParallel::addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item) { { KnotHolderEntity *e = new Pl::KnotHolderEntityLeftEnd(this); - e->create( desktop, item, knotholder, - _("Adjust the \"left\" end of the parallel") - /*optional: knot_shape, knot_mode, knot_color*/); + e->create( desktop, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, + _("Adjust the \"left\" end of the parallel") ); knotholder->add(e); } { KnotHolderEntity *e = new Pl::KnotHolderEntityRightEnd(this); - e->create( desktop, item, knotholder, - _("Adjust the \"right\" end of the parallel") - /*optional: knot_shape, knot_mode, knot_color*/); + e->create( desktop, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, + _("Adjust the \"right\" end of the parallel") ); knotholder->add(e); } }; diff --git a/src/live_effects/lpe-perp_bisector.cpp b/src/live_effects/lpe-perp_bisector.cpp index ddf16cc9a..f6d69f03c 100644 --- a/src/live_effects/lpe-perp_bisector.cpp +++ b/src/live_effects/lpe-perp_bisector.cpp @@ -154,16 +154,14 @@ void LPEPerpBisector::addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item) { { KnotHolderEntity *e = new PB::KnotHolderEntityLeftEnd(this); - e->create( desktop, item, knotholder, - _("Adjust the bisector's \"left\" end") - /*optional: knot_shape, knot_mode, knot_color*/); + e->create( desktop, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, + _("Adjust the bisector's \"left\" end") ); knotholder->add(e); } { KnotHolderEntity *e = new PB::KnotHolderEntityRightEnd(this); - e->create( desktop, item, knotholder, - _("Adjust the bisector's \"right\" end") - /*optional: knot_shape, knot_mode, knot_color*/); + e->create( desktop, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, + _("Adjust the bisector's \"right\" end") ); knotholder->add(e); } }; diff --git a/src/live_effects/lpe-perspective_path.cpp b/src/live_effects/lpe-perspective_path.cpp index d9df32076..c8048f74b 100644 --- a/src/live_effects/lpe-perspective_path.cpp +++ b/src/live_effects/lpe-perspective_path.cpp @@ -137,15 +137,11 @@ LPEPerspectivePath::doEffect_pwd2 (Geom::Piecewise > cons return output; } -void -LPEPerspectivePath::addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item) { - { - KnotHolderEntity *e = new PP::KnotHolderEntityOffset(this); - e->create( desktop, item, knotholder, - _("Adjust the origin") - /*optional: knot_shape, knot_mode, knot_color*/); - knotholder->add(e); - } +void LPEPerspectivePath::addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item) { + KnotHolderEntity *e = new PP::KnotHolderEntityOffset(this); + e->create( desktop, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, + _("Adjust the origin") ); + knotholder->add(e); }; namespace PP { diff --git a/src/live_effects/lpe-tangent_to_curve.cpp b/src/live_effects/lpe-tangent_to_curve.cpp index 04cc3335f..633a36860 100644 --- a/src/live_effects/lpe-tangent_to_curve.cpp +++ b/src/live_effects/lpe-tangent_to_curve.cpp @@ -100,23 +100,20 @@ void LPETangentToCurve::addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item) { { KnotHolderEntity *e = new TtC::KnotHolderEntityAttachPt(this); - e->create( desktop, item, knotholder, - _("Adjust the point of attachment of the tangent") - /*optional: knot_shape, knot_mode, knot_color*/); + e->create( desktop, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, + _("Adjust the point of attachment of the tangent") ); knotholder->add(e); } { KnotHolderEntity *e = new TtC::KnotHolderEntityLeftEnd(this); - e->create( desktop, item, knotholder, - _("Adjust the \"left\" end of the tangent") - /*optional: knot_shape, knot_mode, knot_color*/); + e->create( desktop, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, + _("Adjust the \"left\" end of the tangent") ); knotholder->add(e); } { KnotHolderEntity *e = new TtC::KnotHolderEntityRightEnd(this); - e->create( desktop, item, knotholder, - _("Adjust the \"right\" end of the tangent") - /*optional: knot_shape, knot_mode, knot_color*/); + e->create( desktop, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, + _("Adjust the \"right\" end of the tangent") ); knotholder->add(e); } }; diff --git a/src/live_effects/parameter/point.cpp b/src/live_effects/parameter/point.cpp index eb2543ac7..c192cd6d6 100644 --- a/src/live_effects/parameter/point.cpp +++ b/src/live_effects/parameter/point.cpp @@ -165,7 +165,7 @@ PointParam::addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *desktop, SP { PointParamKnotHolderEntity *e = new PointParamKnotHolderEntity(this); // TODO: can we ditch handleTip() etc. because we have access to handle_tip etc. itself??? - e->create(desktop, item, knotholder, handleTip(), knot_shape, knot_mode, knot_color); + e->create(desktop, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, handleTip(), knot_shape, knot_mode, knot_color); knotholder->add(e); } diff --git a/src/live_effects/parameter/powerstrokepointarray.cpp b/src/live_effects/parameter/powerstrokepointarray.cpp index 06048cb32..07cc71245 100644 --- a/src/live_effects/parameter/powerstrokepointarray.cpp +++ b/src/live_effects/parameter/powerstrokepointarray.cpp @@ -222,22 +222,21 @@ PowerStrokePointArrayParamKnotHolderEntity::knot_click(guint state) }; // add knot to knotholder PowerStrokePointArrayParamKnotHolderEntity *e = new PowerStrokePointArrayParamKnotHolderEntity(_pparam, _index+1); - e->create( this->desktop, this->item, parent_holder, - _("Stroke width control point: drag to alter the stroke width. Ctrl+click adds a control point, Ctrl+Alt+click deletes it."), + e->create( this->desktop, this->item, parent_holder, Inkscape::CTRL_TYPE_UNKNOWN, + _("Stroke width control point: drag to alter the stroke width. Ctrl+click adds a control point, Ctrl+Alt+click deletes it."), _pparam->knot_shape, _pparam->knot_mode, _pparam->knot_color); parent_holder->add(e); } } } -void -PowerStrokePointArrayParam::addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item) +void PowerStrokePointArrayParam::addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item) { for (unsigned int i = 0; i < _vector.size(); ++i) { PowerStrokePointArrayParamKnotHolderEntity *e = new PowerStrokePointArrayParamKnotHolderEntity(this, i); - e->create( desktop, item, knotholder, - _("Stroke width control point: drag to alter the stroke width. Ctrl+click adds a control point, Ctrl+Alt+click deletes it."), - knot_shape, knot_mode, knot_color); + e->create( desktop, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, + _("Stroke width control point: drag to alter the stroke width. Ctrl+click adds a control point, Ctrl+Alt+click deletes it."), + knot_shape, knot_mode, knot_color); knotholder->add(e); } } diff --git a/src/live_effects/parameter/vector.cpp b/src/live_effects/parameter/vector.cpp index 3e0ac9092..3348670dd 100644 --- a/src/live_effects/parameter/vector.cpp +++ b/src/live_effects/parameter/vector.cpp @@ -191,11 +191,11 @@ void VectorParam::addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item) { VectorParamKnotHolderEntity_Origin *origin_e = new VectorParamKnotHolderEntity_Origin(this); - origin_e->create(desktop, item, knotholder, handleTip(), ori_knot_shape, ori_knot_mode, ori_knot_color); + origin_e->create(desktop, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, handleTip(), ori_knot_shape, ori_knot_mode, ori_knot_color); knotholder->add(origin_e); VectorParamKnotHolderEntity_Vector *vector_e = new VectorParamKnotHolderEntity_Vector(this); - vector_e->create(desktop, item, knotholder, handleTip(), vec_knot_shape, vec_knot_mode, vec_knot_color); + vector_e->create(desktop, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, handleTip(), vec_knot_shape, vec_knot_mode, vec_knot_color); knotholder->add(vector_e); } -- cgit v1.2.3