From 57a6fee4d17b6049b95ccf2ef445ed18c8a2a841 Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Wed, 4 Aug 2010 23:08:41 +0200 Subject: Wholesale cruft removal part 2 (bzr r9508.1.45) --- src/sp-rect.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/sp-rect.cpp') diff --git a/src/sp-rect.cpp b/src/sp-rect.cpp index bdfae7c99..54f4ceea5 100644 --- a/src/sp-rect.cpp +++ b/src/sp-rect.cpp @@ -16,9 +16,7 @@ #endif -#include -#include -#include +#include "display/curve.h" #include <2geom/rect.h> #include "inkscape.h" -- 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-rect.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/sp-rect.cpp') diff --git a/src/sp-rect.cpp b/src/sp-rect.cpp index fd44f64df..e8f79e6ed 100644 --- a/src/sp-rect.cpp +++ b/src/sp-rect.cpp @@ -232,6 +232,7 @@ sp_rect_set_shape(SPShape *shape) if ((rect->height.computed < 1e-18) || (rect->width.computed < 1e-18)) { SP_SHAPE(rect)->setCurveInsync( NULL, TRUE); + SP_SHAPE(rect)->setCurveBeforeLPE( NULL ); return; } @@ -282,6 +283,10 @@ sp_rect_set_shape(SPShape *shape) c->closepath(); SP_SHAPE(rect)->setCurveInsync( c, TRUE); + SP_SHAPE(rect)->setCurveBeforeLPE( c ); + + // LPE is not applied because result can generally not be represented as SPRect + c->unref(); } -- 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-rect.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/sp-rect.cpp') diff --git a/src/sp-rect.cpp b/src/sp-rect.cpp index 94a453ae6..db5a62f8f 100644 --- a/src/sp-rect.cpp +++ b/src/sp-rect.cpp @@ -567,7 +567,7 @@ static void sp_rect_snappoints(SPItem const *item, std::vectorgetSnapModeNode() || snapprefs->getSnapModeGuide())) { + if (!(snapprefs->getSnapModeNode() || snapprefs->getSnapModeGuide() || snapprefs->getSnapModeOthers())) { return; } -- cgit v1.2.3 From 2be2cf32db0668dc64512a98f6c2394152bd10cc Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Sat, 16 Jul 2011 00:42:39 -0700 Subject: Cleanup of oudated/redundant SP_ITEM() macro use. (bzr r10461) --- src/sp-rect.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src/sp-rect.cpp') diff --git a/src/sp-rect.cpp b/src/sp-rect.cpp index db5a62f8f..7cc9c7f29 100644 --- a/src/sp-rect.cpp +++ b/src/sp-rect.cpp @@ -417,7 +417,7 @@ sp_rect_set_visible_rx(SPRect *rect, gdouble rx) rect->rx.computed = rx / vector_stretch( Geom::Point(rect->x.computed + 1, rect->y.computed), Geom::Point(rect->x.computed, rect->y.computed), - SP_ITEM(rect)->transform); + rect->transform); rect->rx._set = true; } SP_OBJECT(rect)->updateRepr(); @@ -433,7 +433,7 @@ sp_rect_set_visible_ry(SPRect *rect, gdouble ry) rect->ry.computed = ry / vector_stretch( Geom::Point(rect->x.computed, rect->y.computed + 1), Geom::Point(rect->x.computed, rect->y.computed), - SP_ITEM(rect)->transform); + rect->transform); rect->ry._set = true; } SP_OBJECT(rect)->updateRepr(); @@ -447,7 +447,7 @@ sp_rect_get_visible_rx(SPRect *rect) return rect->rx.computed * vector_stretch( Geom::Point(rect->x.computed + 1, rect->y.computed), Geom::Point(rect->x.computed, rect->y.computed), - SP_ITEM(rect)->transform); + rect->transform); } gdouble @@ -458,7 +458,7 @@ sp_rect_get_visible_ry(SPRect *rect) return rect->ry.computed * vector_stretch( Geom::Point(rect->x.computed, rect->y.computed + 1), Geom::Point(rect->x.computed, rect->y.computed), - SP_ITEM(rect)->transform); + rect->transform); } Geom::Rect @@ -481,9 +481,9 @@ sp_rect_compensate_rxry(SPRect *rect, Geom::Affine xform) Geom::Point cy = c + Geom::Point(0, 1); // apply previous transform if any - c *= SP_ITEM(rect)->transform; - cx *= SP_ITEM(rect)->transform; - cy *= SP_ITEM(rect)->transform; + c *= rect->transform; + cx *= rect->transform; + cy *= rect->transform; // find out stretches that we need to compensate gdouble eX = vector_stretch(cx, c, xform); @@ -513,7 +513,7 @@ sp_rect_set_visible_width(SPRect *rect, gdouble width) rect->width.computed = width / vector_stretch( Geom::Point(rect->x.computed + 1, rect->y.computed), Geom::Point(rect->x.computed, rect->y.computed), - SP_ITEM(rect)->transform); + rect->transform); rect->width._set = true; SP_OBJECT(rect)->updateRepr(); } @@ -524,7 +524,7 @@ sp_rect_set_visible_height(SPRect *rect, gdouble height) rect->height.computed = height / vector_stretch( Geom::Point(rect->x.computed, rect->y.computed + 1), Geom::Point(rect->x.computed, rect->y.computed), - SP_ITEM(rect)->transform); + rect->transform); rect->height._set = true; SP_OBJECT(rect)->updateRepr(); } @@ -537,7 +537,7 @@ sp_rect_get_visible_width(SPRect *rect) return rect->width.computed * vector_stretch( Geom::Point(rect->x.computed + 1, rect->y.computed), Geom::Point(rect->x.computed, rect->y.computed), - SP_ITEM(rect)->transform); + rect->transform); } gdouble @@ -548,7 +548,7 @@ sp_rect_get_visible_height(SPRect *rect) return rect->height.computed * vector_stretch( Geom::Point(rect->x.computed, rect->y.computed + 1), Geom::Point(rect->x.computed, rect->y.computed), - SP_ITEM(rect)->transform); + rect->transform); } /** @@ -606,13 +606,13 @@ sp_rect_convert_to_guides(SPItem *item) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); if (!prefs->getBool("/tools/shapes/rect/convertguides", true)) { - SP_ITEM(rect)->convert_to_guides(); + rect->convert_to_guides(); return; } std::list > pts; - Geom::Affine const i2d (SP_ITEM(rect)->i2d_affine()); + Geom::Affine const i2d(rect->i2d_affine()); Geom::Point A1(Geom::Point(rect->x.computed, rect->y.computed) * i2d); Geom::Point A2(Geom::Point(rect->x.computed, rect->y.computed + rect->height.computed) * i2d); -- 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-rect.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/sp-rect.cpp') diff --git a/src/sp-rect.cpp b/src/sp-rect.cpp index 7cc9c7f29..ec83a47e9 100644 --- a/src/sp-rect.cpp +++ b/src/sp-rect.cpp @@ -573,12 +573,12 @@ static void sp_rect_snappoints(SPItem const *item, std::vectori2d_affine ()); + Geom::Affine const i2dt (item->i2dt_affine ()); - Geom::Point p0 = Geom::Point(rect->x.computed, rect->y.computed) * i2d; - Geom::Point p1 = Geom::Point(rect->x.computed, rect->y.computed + rect->height.computed) * i2d; - Geom::Point p2 = Geom::Point(rect->x.computed + rect->width.computed, rect->y.computed + rect->height.computed) * i2d; - Geom::Point p3 = Geom::Point(rect->x.computed + rect->width.computed, rect->y.computed) * i2d; + Geom::Point p0 = Geom::Point(rect->x.computed, rect->y.computed) * i2dt; + Geom::Point p1 = Geom::Point(rect->x.computed, rect->y.computed + rect->height.computed) * i2dt; + Geom::Point p2 = Geom::Point(rect->x.computed + rect->width.computed, rect->y.computed + rect->height.computed) * i2dt; + Geom::Point p3 = Geom::Point(rect->x.computed + rect->width.computed, rect->y.computed) * i2dt; if (snapprefs->getSnapToItemNode()) { p.push_back(Inkscape::SnapCandidatePoint(p0, Inkscape::SNAPSOURCE_CORNER, Inkscape::SNAPTARGET_CORNER)); @@ -612,12 +612,12 @@ sp_rect_convert_to_guides(SPItem *item) { std::list > pts; - Geom::Affine const i2d(rect->i2d_affine()); + Geom::Affine const i2dt(rect->i2dt_affine()); - Geom::Point A1(Geom::Point(rect->x.computed, rect->y.computed) * i2d); - Geom::Point A2(Geom::Point(rect->x.computed, rect->y.computed + rect->height.computed) * i2d); - Geom::Point A3(Geom::Point(rect->x.computed + rect->width.computed, rect->y.computed + rect->height.computed) * i2d); - Geom::Point A4(Geom::Point(rect->x.computed + rect->width.computed, rect->y.computed) * i2d); + Geom::Point A1(Geom::Point(rect->x.computed, rect->y.computed) * i2dt); + Geom::Point A2(Geom::Point(rect->x.computed, rect->y.computed + rect->height.computed) * i2dt); + Geom::Point A3(Geom::Point(rect->x.computed + rect->width.computed, rect->y.computed + rect->height.computed) * i2dt); + Geom::Point A4(Geom::Point(rect->x.computed + rect->width.computed, rect->y.computed) * i2dt); pts.push_back(std::make_pair(A1, A2)); pts.push_back(std::make_pair(A2, A3)); -- cgit v1.2.3 From 97b1c4d688a979eb8e327c13c6bcc6fad20902f2 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Tue, 19 Jul 2011 20:24:59 +0200 Subject: remove some unnecessary inkscape_active_desktop() calls (bzr r10477) --- src/sp-rect.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/sp-rect.cpp') diff --git a/src/sp-rect.cpp b/src/sp-rect.cpp index ec83a47e9..467b37d17 100644 --- a/src/sp-rect.cpp +++ b/src/sp-rect.cpp @@ -624,7 +624,7 @@ sp_rect_convert_to_guides(SPItem *item) { pts.push_back(std::make_pair(A3, A4)); pts.push_back(std::make_pair(A4, A1)); - sp_guide_pt_pairs_to_guides(inkscape_active_desktop(), pts); + sp_guide_pt_pairs_to_guides(item->document, pts); } /* -- 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-rect.cpp | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'src/sp-rect.cpp') diff --git a/src/sp-rect.cpp b/src/sp-rect.cpp index 467b37d17..729e2a34c 100644 --- a/src/sp-rect.cpp +++ b/src/sp-rect.cpp @@ -566,11 +566,6 @@ static void sp_rect_snappoints(SPItem const *item, std::vectorgetSnapModeNode() || snapprefs->getSnapModeGuide() || snapprefs->getSnapModeOthers())) { - return; - } - SPRect *rect = SP_RECT(item); Geom::Affine const i2dt (item->i2dt_affine ()); @@ -580,21 +575,21 @@ static void sp_rect_snappoints(SPItem const *item, std::vectorx.computed + rect->width.computed, rect->y.computed + rect->height.computed) * i2dt; Geom::Point p3 = Geom::Point(rect->x.computed + rect->width.computed, rect->y.computed) * i2dt; - if (snapprefs->getSnapToItemNode()) { - p.push_back(Inkscape::SnapCandidatePoint(p0, Inkscape::SNAPSOURCE_CORNER, Inkscape::SNAPTARGET_CORNER)); - p.push_back(Inkscape::SnapCandidatePoint(p1, Inkscape::SNAPSOURCE_CORNER, Inkscape::SNAPTARGET_CORNER)); - p.push_back(Inkscape::SnapCandidatePoint(p2, Inkscape::SNAPSOURCE_CORNER, Inkscape::SNAPTARGET_CORNER)); - p.push_back(Inkscape::SnapCandidatePoint(p3, Inkscape::SNAPSOURCE_CORNER, Inkscape::SNAPTARGET_CORNER)); + if (snapprefs->isTargetSnappable(Inkscape::SNAPTARGET_RECT_CORNER)) { + p.push_back(Inkscape::SnapCandidatePoint(p0, Inkscape::SNAPSOURCE_RECT_CORNER, Inkscape::SNAPTARGET_RECT_CORNER)); + p.push_back(Inkscape::SnapCandidatePoint(p1, Inkscape::SNAPSOURCE_RECT_CORNER, Inkscape::SNAPTARGET_RECT_CORNER)); + p.push_back(Inkscape::SnapCandidatePoint(p2, Inkscape::SNAPSOURCE_RECT_CORNER, Inkscape::SNAPTARGET_RECT_CORNER)); + p.push_back(Inkscape::SnapCandidatePoint(p3, Inkscape::SNAPSOURCE_RECT_CORNER, Inkscape::SNAPTARGET_RECT_CORNER)); } - if (snapprefs->getSnapLineMidpoints()) { // only do this when we're snapping nodes (enforce strict snapping) + if (snapprefs->isTargetSnappable(Inkscape::SNAPTARGET_LINE_MIDPOINT)) { p.push_back(Inkscape::SnapCandidatePoint((p0 + p1)/2, Inkscape::SNAPSOURCE_LINE_MIDPOINT, Inkscape::SNAPTARGET_LINE_MIDPOINT)); p.push_back(Inkscape::SnapCandidatePoint((p1 + p2)/2, Inkscape::SNAPSOURCE_LINE_MIDPOINT, Inkscape::SNAPTARGET_LINE_MIDPOINT)); p.push_back(Inkscape::SnapCandidatePoint((p2 + p3)/2, Inkscape::SNAPSOURCE_LINE_MIDPOINT, Inkscape::SNAPTARGET_LINE_MIDPOINT)); p.push_back(Inkscape::SnapCandidatePoint((p3 + p0)/2, Inkscape::SNAPSOURCE_LINE_MIDPOINT, Inkscape::SNAPTARGET_LINE_MIDPOINT)); } - if (snapprefs->getSnapObjectMidpoints()) { // only do this when we're snapping nodes (enforce strict snapping) + if (snapprefs->isTargetSnappable(Inkscape::SNAPTARGET_OBJECT_MIDPOINT)) { p.push_back(Inkscape::SnapCandidatePoint((p0 + p2)/2, Inkscape::SNAPSOURCE_OBJECT_MIDPOINT, Inkscape::SNAPTARGET_OBJECT_MIDPOINT)); } -- cgit v1.2.3 From 24526cceccb4ed103a6324756476c64efb3fb5dd Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Sat, 27 Aug 2011 16:58:22 +0200 Subject: Remove all NRRect use. (bzr r10582.1.5) --- src/sp-rect.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/sp-rect.cpp') diff --git a/src/sp-rect.cpp b/src/sp-rect.cpp index 729e2a34c..22a403345 100644 --- a/src/sp-rect.cpp +++ b/src/sp-rect.cpp @@ -173,8 +173,8 @@ sp_rect_update(SPObject *object, SPCtx *ctx, guint flags) SPRect *rect = (SPRect *) object; SPStyle *style = object->style; SPItemCtx const *ictx = (SPItemCtx const *) ctx; - double const w = (ictx->vp.x1 - ictx->vp.x0); - double const h = (ictx->vp.y1 - ictx->vp.y0); + double const w = ictx->viewport.width(); + double const h = ictx->viewport.height(); double const em = style->font_size.computed; double const ex = 0.5 * em; // fixme: get x height from pango or libnrtype. rect->x.update(em, ex, w); -- cgit v1.2.3