From 498629f82d9453cb7222ab642b867c183fdf1666 Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Thu, 5 Aug 2010 01:56:47 +0200 Subject: Wholesale cruft removal part 3 (bzr r9508.1.47) --- src/sp-star.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/sp-star.cpp') diff --git a/src/sp-star.cpp b/src/sp-star.cpp index 16c71d030..76a6618e5 100644 --- a/src/sp-star.cpp +++ b/src/sp-star.cpp @@ -20,6 +20,7 @@ #include #include +#include #include #include "svg/svg.h" @@ -176,7 +177,7 @@ sp_star_set (SPObject *object, unsigned int key, const gchar *value) case SP_ATTR_SODIPODI_SIDES: if (value) { star->sides = atoi (value); - star->sides = NR_CLAMP(star->sides, 3, 1024); + star->sides = CLAMP(star->sides, 3, 1024); } else { star->sides = 5; } @@ -527,13 +528,13 @@ sp_star_position_set (SPStar *star, gint sides, Geom::Point center, gdouble r1, g_return_if_fail (star != NULL); g_return_if_fail (SP_IS_STAR (star)); - star->sides = NR_CLAMP(sides, 3, 1024); + star->sides = CLAMP(sides, 3, 1024); star->center = center; star->r[0] = MAX (r1, 0.001); if (isflat == false) { - star->r[1] = NR_CLAMP(r2, 0.0, star->r[0]); + star->r[1] = CLAMP(r2, 0.0, star->r[0]); } else { - star->r[1] = NR_CLAMP( r1*cos(M_PI/sides) ,0.0, star->r[0] ); + star->r[1] = CLAMP( r1*cos(M_PI/sides) ,0.0, star->r[0] ); } star->arg[0] = arg1; star->arg[1] = arg2; -- cgit v1.2.3 From d6978fcea4a2ccd2d9cccefabc6558a74f332a6d Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sat, 2 Apr 2011 00:59:01 +0200 Subject: add curve before LPE to SPShape. this is useful for helperpath display. It was inspired from fixing bug 407008 Fixed bugs: - https://launchpad.net/bugs/407008 (bzr r10142) --- src/sp-star.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/sp-star.cpp') diff --git a/src/sp-star.cpp b/src/sp-star.cpp index 200217ba2..92d8cd7a5 100644 --- a/src/sp-star.cpp +++ b/src/sp-star.cpp @@ -439,6 +439,7 @@ sp_star_set_shape (SPShape *shape) Geom::PathVector pv = sp_svg_read_pathv(shape->getRepr()->attribute("d")); SPCurve *cold = new SPCurve(pv); shape->setCurveInsync( cold, TRUE); + shape->setCurveBeforeLPE(cold); cold->unref(); } return; @@ -509,6 +510,7 @@ sp_star_set_shape (SPShape *shape) /* Reset the shape'scurve to the "original_curve" * This is very important for LPEs to work properly! (the bbox might be recalculated depending on the curve in shape)*/ shape->setCurveInsync( c, TRUE); + shape->setCurveBeforeLPE( c ); if (sp_lpe_item_has_path_effect(SP_LPE_ITEM(shape)) && sp_lpe_item_path_effects_enabled(SP_LPE_ITEM(shape))) { SPCurve *c_lpe = c->copy(); bool success = sp_lpe_item_perform_path_effect(SP_LPE_ITEM (shape), c_lpe); -- cgit v1.2.3 From bdf703831ff93438d49324ab842052ccaf390a5d Mon Sep 17 00:00:00 2001 From: Diederik van Lierop Date: Sun, 26 Jun 2011 22:00:36 +0200 Subject: =?UTF-8?q?-=20Add=20a=20third=20group=20of=20snap=20sources/targe?= =?UTF-8?q?ts,=20called=20=C2=A8others=C2=A8=20(before=20we=20had=20only?= =?UTF-8?q?=20=C2=A8bounding=20box=C2=A8=20and=20nodes=20(see=20bug=20#788?= =?UTF-8?q?178)=20-=20Fix=20the=20display=20of=20the=20snap=20source=20-?= =?UTF-8?q?=20Fix=20snapping=20of=20guides=20to=20other=20guides=20&=20gri?= =?UTF-8?q?ds?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (bzr r10372) --- src/sp-star.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/sp-star.cpp') diff --git a/src/sp-star.cpp b/src/sp-star.cpp index 39efe2537..17ddf7279 100644 --- a/src/sp-star.cpp +++ b/src/sp-star.cpp @@ -557,7 +557,7 @@ static void sp_star_snappoints(SPItem const *item, std::vectorgetSnapModeNode() || snapprefs->getSnapModeGuide())) { + if (!(snapprefs->getSnapModeNode() || snapprefs->getSnapModeGuide() || snapprefs->getSnapModeOthers())) { return; } -- cgit v1.2.3 From eed6e9c2c229b10911a23976c47da79fc70a5b87 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sun, 17 Jul 2011 21:47:09 +0200 Subject: - rename SPItem::i2d_affine to i2dt_affine, to clarify that it is item-to-desktop, not item-to-document. This should make it easier to spot bugs. - tag some instances where the document-to-desktop transform has been hardcoded (bzr r10466) --- src/sp-star.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/sp-star.cpp') diff --git a/src/sp-star.cpp b/src/sp-star.cpp index 17ddf7279..c7c2c54ad 100644 --- a/src/sp-star.cpp +++ b/src/sp-star.cpp @@ -562,8 +562,8 @@ static void sp_star_snappoints(SPItem const *item, std::vectorgetSnapObjectMidpoints()) { - Geom::Affine const i2d (item->i2d_affine ()); - p.push_back(Inkscape::SnapCandidatePoint(SP_STAR(item)->center * i2d,Inkscape::SNAPSOURCE_OBJECT_MIDPOINT, Inkscape::SNAPTARGET_OBJECT_MIDPOINT)); + Geom::Affine const i2dt (item->i2dt_affine ()); + p.push_back(Inkscape::SnapCandidatePoint(SP_STAR(item)->center * i2dt,Inkscape::SNAPSOURCE_OBJECT_MIDPOINT, Inkscape::SNAPTARGET_OBJECT_MIDPOINT)); } } -- cgit v1.2.3 From babb7a67749cb691674bdd9758f0568d4b094b56 Mon Sep 17 00:00:00 2001 From: Diederik van Lierop Date: Mon, 22 Aug 2011 20:27:53 +0200 Subject: Refactoring of the snapping preferences; mainly about storing all toggles in a single array, instead of each having its own member variable (bzr r10569) --- src/sp-star.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'src/sp-star.cpp') diff --git a/src/sp-star.cpp b/src/sp-star.cpp index c7c2c54ad..d224ff1ba 100644 --- a/src/sp-star.cpp +++ b/src/sp-star.cpp @@ -548,20 +548,15 @@ sp_star_position_set (SPStar *star, gint sides, Geom::Point center, gdouble r1, static void sp_star_snappoints(SPItem const *item, std::vector &p, Inkscape::SnapPreferences const *snapprefs) { // We will determine the star's midpoint ourselves, instead of trusting on the base class - // Therefore setSnapObjectMidpoints() is set to false temporarily + // Therefore snapping to object midpoints is temporarily disabled Inkscape::SnapPreferences local_snapprefs = *snapprefs; - local_snapprefs.setSnapObjectMidpoints(false); + local_snapprefs.setTargetSnappable(Inkscape::SNAPTARGET_OBJECT_MIDPOINT, false); if (((SPItemClass *) parent_class)->snappoints) { ((SPItemClass *) parent_class)->snappoints (item, p, &local_snapprefs); } - // Help enforcing strict snapping, i.e. only return nodes when we're snapping nodes to nodes or a guide to nodes - if (!(snapprefs->getSnapModeNode() || snapprefs->getSnapModeGuide() || snapprefs->getSnapModeOthers())) { - return; - } - - if (snapprefs->getSnapObjectMidpoints()) { + if (snapprefs->isTargetSnappable(Inkscape::SNAPTARGET_OBJECT_MIDPOINT)) { Geom::Affine const i2dt (item->i2dt_affine ()); p.push_back(Inkscape::SnapCandidatePoint(SP_STAR(item)->center * i2dt,Inkscape::SNAPSOURCE_OBJECT_MIDPOINT, Inkscape::SNAPTARGET_OBJECT_MIDPOINT)); } -- cgit v1.2.3